summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormcombellack <mcombellack@13f79535-47bb-0310-9956-ffa450edef68>2008-12-03 14:53:51 +0000
committermcombellack <mcombellack@13f79535-47bb-0310-9956-ffa450edef68>2008-12-03 14:53:51 +0000
commite7f7f7e51890bf24f540834ead4762707f1aaf09 (patch)
treeea3667916fb37697d5b0715adffe398c3af1f118
parentd6fc15d4314aaaf9b032e0f46606b87ec2fe8797 (diff)
Converted unit tests from JUnit 3 to JUnit 4
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@722912 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--java/sca/modules/implementation-node/src/test/java/org/apache/tuscany/sca/implementation/node/builder/impl/CalculateBindingURITestCase.java34
-rw-r--r--java/sca/modules/implementation-node/src/test/java/org/apache/tuscany/sca/implementation/node/xml/ReadTestCase.java11
-rw-r--r--java/sca/modules/implementation-node/src/test/java/org/apache/tuscany/sca/implementation/node/xml/WriteTestCase.java11
3 files changed, 41 insertions, 15 deletions
diff --git a/java/sca/modules/implementation-node/src/test/java/org/apache/tuscany/sca/implementation/node/builder/impl/CalculateBindingURITestCase.java b/java/sca/modules/implementation-node/src/test/java/org/apache/tuscany/sca/implementation/node/builder/impl/CalculateBindingURITestCase.java
index 3c6588eefc..3ec5ce20f8 100644
--- a/java/sca/modules/implementation-node/src/test/java/org/apache/tuscany/sca/implementation/node/builder/impl/CalculateBindingURITestCase.java
+++ b/java/sca/modules/implementation-node/src/test/java/org/apache/tuscany/sca/implementation/node/builder/impl/CalculateBindingURITestCase.java
@@ -19,14 +19,15 @@
package org.apache.tuscany.sca.implementation.node.builder.impl;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;
import javax.xml.namespace.QName;
-import junit.framework.TestCase;
-
import org.apache.tuscany.sca.assembly.AssemblyFactory;
import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.assembly.Component;
@@ -43,12 +44,15 @@ import org.apache.tuscany.sca.implementation.node.NodeImplementation;
import org.apache.tuscany.sca.implementation.node.NodeImplementationFactory;
import org.apache.tuscany.sca.implementation.node.impl.NodeImplementationFactoryImpl;
import org.apache.tuscany.sca.monitor.Monitor;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
/**
*
* @version $Rev$ $Date$
*/
-public class CalculateBindingURITestCase extends TestCase {
+public class CalculateBindingURITestCase {
private static final Logger logger = Logger.getLogger(CalculateBindingURITestCase.class.getName());
private AssemblyFactory assemblyFactory;
private SCABindingFactory scaBindingFactory;
@@ -58,8 +62,8 @@ public class CalculateBindingURITestCase extends TestCase {
private CompositeBuilder nodeConfigurationBuilder;
private List<Binding> defaultBindings = new ArrayList<Binding>();
- @Override
- protected void setUp() throws Exception {
+ @Before
+ public void setUp() throws Exception {
assemblyFactory = new DefaultAssemblyFactory();
scaBindingFactory = new TestBindingFactory();
nodeImplementationFactory = new NodeImplementationFactoryImpl();
@@ -95,8 +99,8 @@ public class CalculateBindingURITestCase extends TestCase {
return nodeComposite;
}
- @Override
- protected void tearDown() throws Exception {
+ @After
+ public void tearDown() throws Exception {
assemblyFactory = null;
}
@@ -241,6 +245,7 @@ public class CalculateBindingURITestCase extends TestCase {
// component service binding tests
+ @Test
public void testComponentServiceSingleService() {
Composite composite = createComponentServiceBinding();
composite.getComponents().get(0).getServices().remove(1);
@@ -256,6 +261,7 @@ public class CalculateBindingURITestCase extends TestCase {
}
}
+ @Test
public void testComponentServiceBindingDefault() {
Composite composite = createComponentServiceBinding();
Binding b = composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
@@ -270,6 +276,7 @@ public class CalculateBindingURITestCase extends TestCase {
}
}
+ @Test
public void testComponentServiceBindingName() {
Composite composite = createComponentServiceBinding();
Binding b = composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
@@ -285,6 +292,7 @@ public class CalculateBindingURITestCase extends TestCase {
}
}
+ @Test
public void testComponentServiceBindingURIRelative() {
Composite composite = createComponentServiceBinding();
Binding b = composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
@@ -301,6 +309,7 @@ public class CalculateBindingURITestCase extends TestCase {
}
}
+ @Test
public void testComponentServiceBindingURIAbsolute() {
Composite composite = createComponentServiceBinding();
Binding b = composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
@@ -317,6 +326,7 @@ public class CalculateBindingURITestCase extends TestCase {
}
}
+ @Test
public void testComponentServiceBindingURIRelative2() {
Composite composite = createComponentServiceBinding();
Binding b = composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
@@ -335,6 +345,7 @@ public class CalculateBindingURITestCase extends TestCase {
// top level composite service binding tests
+ @Test
public void testCompositeServiceSingleService() {
Composite composite = createTopLevelCompositeServiceBinding();
composite.getServices().remove(1);
@@ -350,6 +361,7 @@ public class CalculateBindingURITestCase extends TestCase {
}
}
+ @Test
public void testCompositeServiceBindingDefault() {
Composite composite = createTopLevelCompositeServiceBinding();
Binding b = composite.getServices().get(0).getBindings().get(0);
@@ -364,6 +376,7 @@ public class CalculateBindingURITestCase extends TestCase {
}
}
+ @Test
public void testCompositeServiceBindingName() {
Composite composite = createTopLevelCompositeServiceBinding();
Binding b = composite.getServices().get(0).getBindings().get(0);
@@ -379,6 +392,7 @@ public class CalculateBindingURITestCase extends TestCase {
}
}
+ @Test
public void testCompositeServiceBindingURIRelative() {
Composite composite = createTopLevelCompositeServiceBinding();
Binding b = composite.getServices().get(0).getBindings().get(0);
@@ -395,6 +409,7 @@ public class CalculateBindingURITestCase extends TestCase {
}
}
+ @Test
public void testCompositeServiceBindingURIAbsolute() {
Composite composite = createTopLevelCompositeServiceBinding();
Binding b = composite.getServices().get(0).getBindings().get(0);
@@ -413,6 +428,7 @@ public class CalculateBindingURITestCase extends TestCase {
// nested composite service binding tests
+ @Test
public void testNestedCompositeServiceSingleService() {
Composite composite = createNestCompositeServiceBinding();
((Composite)composite.getComponents().get(0).getImplementation()).getComponents().get(0).getServices()
@@ -431,6 +447,7 @@ public class CalculateBindingURITestCase extends TestCase {
}
}
+ @Test
public void testNestedCompositeServiceBindingDefault() {
Composite composite = createNestCompositeServiceBinding();
Binding b =
@@ -447,6 +464,7 @@ public class CalculateBindingURITestCase extends TestCase {
}
}
+ @Test
public void testNestedCompositeServiceBindingName() {
Composite composite = createNestCompositeServiceBinding();
Binding b =
@@ -464,6 +482,7 @@ public class CalculateBindingURITestCase extends TestCase {
}
}
+ @Test
public void testNestedCompositeServiceBindingURIRelative() {
Composite composite = createNestCompositeServiceBinding();
Binding b =
@@ -482,6 +501,7 @@ public class CalculateBindingURITestCase extends TestCase {
}
}
+ @Test
public void testNestedCompositeServiceBindingURIAbsolute() {
Composite composite = createNestCompositeServiceBinding();
Binding b =
diff --git a/java/sca/modules/implementation-node/src/test/java/org/apache/tuscany/sca/implementation/node/xml/ReadTestCase.java b/java/sca/modules/implementation-node/src/test/java/org/apache/tuscany/sca/implementation/node/xml/ReadTestCase.java
index 5ff5d2bf7f..8720d5c607 100644
--- a/java/sca/modules/implementation-node/src/test/java/org/apache/tuscany/sca/implementation/node/xml/ReadTestCase.java
+++ b/java/sca/modules/implementation-node/src/test/java/org/apache/tuscany/sca/implementation/node/xml/ReadTestCase.java
@@ -19,13 +19,13 @@
package org.apache.tuscany.sca.implementation.node.xml;
+import static org.junit.Assert.assertNotNull;
+
import java.io.InputStream;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamReader;
-import junit.framework.TestCase;
-
import org.apache.tuscany.sca.assembly.Composite;
import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
import org.apache.tuscany.sca.assembly.builder.CompositeBuilderExtensionPoint;
@@ -34,19 +34,21 @@ import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProce
import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.junit.Before;
+import org.junit.Test;
/**
* Test reading Node implementations.
*
* @version $Rev$ $Date$
*/
-public class ReadTestCase extends TestCase {
+public class ReadTestCase {
private XMLInputFactory inputFactory;
private StAXArtifactProcessor<Object> staxProcessor;
private CompositeBuilder compositeBuilder;
- @Override
+ @Before
public void setUp() throws Exception {
DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
inputFactory = XMLInputFactory.newInstance();
@@ -57,6 +59,7 @@ public class ReadTestCase extends TestCase {
}
+ @Test
public void testReadComposite() throws Exception {
InputStream is = getClass().getResourceAsStream("TestNode.composite");
XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
diff --git a/java/sca/modules/implementation-node/src/test/java/org/apache/tuscany/sca/implementation/node/xml/WriteTestCase.java b/java/sca/modules/implementation-node/src/test/java/org/apache/tuscany/sca/implementation/node/xml/WriteTestCase.java
index c5e6a40f89..de1506ae59 100644
--- a/java/sca/modules/implementation-node/src/test/java/org/apache/tuscany/sca/implementation/node/xml/WriteTestCase.java
+++ b/java/sca/modules/implementation-node/src/test/java/org/apache/tuscany/sca/implementation/node/xml/WriteTestCase.java
@@ -19,33 +19,35 @@
package org.apache.tuscany.sca.implementation.node.xml;
+import static org.junit.Assert.assertNotNull;
+
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLOutputFactory;
-import junit.framework.TestCase;
-
import org.apache.tuscany.sca.assembly.Composite;
import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.junit.Before;
+import org.junit.Test;
/**
* Test reading/writing Node implementations.
*
* @version $Rev$ $Date$
*/
-public class WriteTestCase extends TestCase {
+public class WriteTestCase {
private XMLInputFactory inputFactory;
private XMLOutputFactory outputFactory;
private StAXArtifactProcessor<Object> staxProcessor;
- @Override
+ @Before
public void setUp() throws Exception {
DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
inputFactory = XMLInputFactory.newInstance();
@@ -54,6 +56,7 @@ public class WriteTestCase extends TestCase {
staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory, null);
}
+ @Test
public void testReadWriteComposite() throws Exception {
InputStream is = getClass().getResourceAsStream("TestNode.composite");
Composite composite = (Composite)staxProcessor.read(inputFactory.createXMLStreamReader(is));