summaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authormcombellack <mcombellack@13f79535-47bb-0310-9956-ffa450edef68>2008-12-04 09:48:12 +0000
committermcombellack <mcombellack@13f79535-47bb-0310-9956-ffa450edef68>2008-12-04 09:48:12 +0000
commitb47a350c4a5aba653a494097676e7b02ad892202 (patch)
tree255541571ca5b239b47d82c734513149cb2bcc84 /java
parentc918ddaab87af0aa877df08dd46348720b3903f9 (diff)
Converted unit tests from JUnit 3 to JUnit 4
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@723270 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java')
-rw-r--r--java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/ReadTestCase.java13
-rw-r--r--java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLTestCase.java15
-rw-r--r--java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WriteTestCase.java13
3 files changed, 29 insertions, 12 deletions
diff --git a/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/ReadTestCase.java b/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/ReadTestCase.java
index 7f17f7463f..d2a019f47d 100644
--- a/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/ReadTestCase.java
+++ b/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/ReadTestCase.java
@@ -19,13 +19,13 @@
package org.apache.tuscany.sca.interfacedef.wsdl.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.ComponentType;
import org.apache.tuscany.sca.assembly.Composite;
import org.apache.tuscany.sca.assembly.ConstrainingType;
@@ -37,19 +37,21 @@ 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.apache.tuscany.sca.core.FactoryExtensionPoint;
+import org.junit.Before;
+import org.junit.Test;
/**
* Test reading WSDL interfaces.
*
* @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();
@@ -60,6 +62,7 @@ public class ReadTestCase extends TestCase {
compositeBuilder = extensionPoints.getExtensionPoint(CompositeBuilderExtensionPoint.class).getCompositeBuilder("org.apache.tuscany.sca.assembly.builder.CompositeBuilder");
}
+ @Test
public void testReadComponentType() throws Exception {
InputStream is = getClass().getResourceAsStream("CalculatorImpl.componentType");
XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
@@ -67,6 +70,7 @@ public class ReadTestCase extends TestCase {
assertNotNull(componentType);
}
+ @Test
public void testReadConstrainingType() throws Exception {
InputStream is = getClass().getResourceAsStream("CalculatorComponent.constrainingType");
XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
@@ -74,6 +78,7 @@ public class ReadTestCase extends TestCase {
assertNotNull(constrainingType);
}
+ @Test
public void testReadComposite() throws Exception {
InputStream is = getClass().getResourceAsStream("Calculator.composite");
XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
diff --git a/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLTestCase.java b/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLTestCase.java
index ca7d96ccb0..6b1f92f372 100644
--- a/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLTestCase.java
+++ b/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLTestCase.java
@@ -19,31 +19,35 @@
package org.apache.tuscany.sca.interfacedef.wsdl.xml;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
import java.net.URI;
import java.net.URL;
import javax.xml.namespace.QName;
-import junit.framework.TestCase;
-
import org.apache.tuscany.sca.contribution.processor.ExtensibleURLArtifactProcessor;
import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.core.FactoryExtensionPoint;
import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
+import org.junit.Before;
+import org.junit.Test;
/**
* Test reading WSDL interfaces.
*
* @version $Rev$ $Date$
*/
-public class WSDLTestCase extends TestCase {
+public class WSDLTestCase {
private ExtensibleURLArtifactProcessor documentProcessor;
private WSDLModelResolver wsdlResolver;
- @Override
+ @Before
public void setUp() throws Exception {
ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
URLArtifactProcessorExtensionPoint documentProcessors = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
@@ -53,6 +57,7 @@ public class WSDLTestCase extends TestCase {
wsdlResolver = new WSDLModelResolver(null, modelFactories);
}
+ @Test
public void testReadWSDLDocument() throws Exception {
URL url = getClass().getResource("example.wsdl");
WSDLDefinition definition = documentProcessor.read(null, new URI("example.wsdl"), url, WSDLDefinition.class);
@@ -61,6 +66,7 @@ public class WSDLTestCase extends TestCase {
assertEquals(definition.getNamespace(), "http://www.example.org");
}
+ @Test
public void testReadWSDLImports() throws Exception {
QName aBinding = new QName("http://helloworld", "HelloWorldSoapBinding");
QName aPortType = new QName("http://helloworld", "HelloWorld");
@@ -76,6 +82,7 @@ public class WSDLTestCase extends TestCase {
assertNotNull(test1Defn.getDefinition().getPortType(aPortType));
}
+ @Test
public void testReadSameNamespaceWSDLDocument() throws Exception {
QName aBinding = new QName("http://helloworld", "HelloWorldSoapBinding");
QName aPortType = new QName("http://helloworld", "HelloWorld");
diff --git a/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WriteTestCase.java b/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WriteTestCase.java
index 6448291f41..a11eb1017f 100644
--- a/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WriteTestCase.java
+++ b/java/sca/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WriteTestCase.java
@@ -19,14 +19,14 @@
package org.apache.tuscany.sca.interfacedef.wsdl.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.ComponentType;
import org.apache.tuscany.sca.assembly.Composite;
import org.apache.tuscany.sca.assembly.ConstrainingType;
@@ -35,19 +35,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/write WSDL interfaces.
*
* @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();
@@ -56,6 +58,7 @@ public class WriteTestCase extends TestCase {
staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory, null);
}
+ @Test
public void testReadWriteComponentType() throws Exception {
InputStream is = getClass().getResourceAsStream("CalculatorImpl.componentType");
ComponentType componentType = (ComponentType)staxProcessor.read(inputFactory.createXMLStreamReader(is));
@@ -64,6 +67,7 @@ public class WriteTestCase extends TestCase {
staxProcessor.write(componentType, outputFactory.createXMLStreamWriter(bos));
}
+ @Test
public void testReadWriteConstrainingType() throws Exception {
InputStream is = getClass().getResourceAsStream("CalculatorComponent.constrainingType");
ConstrainingType constrainingType = (ConstrainingType)staxProcessor.read(inputFactory.createXMLStreamReader(is));
@@ -72,6 +76,7 @@ public class WriteTestCase extends TestCase {
staxProcessor.write(constrainingType, outputFactory.createXMLStreamWriter(bos));
}
+ @Test
public void testReadWriteComposite() throws Exception {
InputStream is = getClass().getResourceAsStream("Calculator.composite");
Composite composite = (Composite)staxProcessor.read(inputFactory.createXMLStreamReader(is));