summaryrefslogtreecommitdiffstats
path: root/branches/sca-equinox/modules/interface-java-xml
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2008-10-14 20:47:47 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2008-10-14 20:47:47 +0000
commitd8153166e25c9e0afa4e3416059670a635a41ca9 (patch)
treef800d75ad52229affba995fbd93c78333ce3443f /branches/sca-equinox/modules/interface-java-xml
parent6f1396d4e4bab48a6789e0ef3efa359547cf3359 (diff)
Update test case to JUNIT 4
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@704675 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-equinox/modules/interface-java-xml')
-rw-r--r--branches/sca-equinox/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/xml/ReadTestCase.java39
-rw-r--r--branches/sca-equinox/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/xml/WriteTestCase.java22
2 files changed, 29 insertions, 32 deletions
diff --git a/branches/sca-equinox/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/xml/ReadTestCase.java b/branches/sca-equinox/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/xml/ReadTestCase.java
index 817006cf5e..9891d79676 100644
--- a/branches/sca-equinox/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/xml/ReadTestCase.java
+++ b/branches/sca-equinox/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/xml/ReadTestCase.java
@@ -19,60 +19,51 @@
package org.apache.tuscany.sca.interfacedef.java.xml;
+import static org.junit.Assert.assertNotNull;
+
import java.io.InputStream;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamReader;
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
import org.apache.tuscany.sca.assembly.ComponentType;
import org.apache.tuscany.sca.assembly.Composite;
import org.apache.tuscany.sca.assembly.ConstrainingType;
-import org.apache.tuscany.sca.assembly.SCABindingFactory;
import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
-import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderExtensionPoint;
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.apache.tuscany.sca.core.FactoryExtensionPoint;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
-import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
+import org.junit.BeforeClass;
+import org.junit.Test;
/**
* Test reading Java interfaces.
*
* @version $Rev$ $Date$
*/
-public class ReadTestCase extends TestCase {
+public class ReadTestCase {
- private XMLInputFactory inputFactory;
- private XMLOutputFactory outputFactory;
- private StAXArtifactProcessor<Object> staxProcessor;
- private CompositeBuilder compositeBuilder;
+ private static XMLInputFactory inputFactory;
+ private static XMLOutputFactory outputFactory;
+ private static StAXArtifactProcessor<Object> staxProcessor;
+ private static CompositeBuilder compositeBuilder;
- @Override
- public void setUp() throws Exception {
+ @BeforeClass
+ public static void setUp() throws Exception {
DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
inputFactory = XMLInputFactory.newInstance();
outputFactory = XMLOutputFactory.newInstance();
StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory, null);
- FactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(FactoryExtensionPoint.class);
- AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
- SCABindingFactory scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class);
- UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
- InterfaceContractMapper mapper = utilities.getUtility(InterfaceContractMapper.class);
- IntentAttachPointTypeFactory attachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
- compositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, mapper);
+ 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);
@@ -80,6 +71,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);
@@ -87,6 +79,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/branches/sca-equinox/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/xml/WriteTestCase.java b/branches/sca-equinox/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/xml/WriteTestCase.java
index 55fc12d176..b21505936b 100644
--- a/branches/sca-equinox/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/xml/WriteTestCase.java
+++ b/branches/sca-equinox/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/xml/WriteTestCase.java
@@ -19,14 +19,14 @@
package org.apache.tuscany.sca.interfacedef.java.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,20 +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.BeforeClass;
+import org.junit.Test;
/**
* Test writing Java interfaces.
*
* @version $Rev$ $Date$
*/
-public class WriteTestCase extends TestCase {
-
- private XMLInputFactory inputFactory;
- private XMLOutputFactory outputFactory;
- private StAXArtifactProcessor<Object> staxProcessor;
+public class WriteTestCase {
+ private static XMLInputFactory inputFactory;
+ private static XMLOutputFactory outputFactory;
+ private static StAXArtifactProcessor<Object> staxProcessor;
- @Override
- public void setUp() throws Exception {
+ @BeforeClass
+ public static void setUp() throws Exception {
DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
inputFactory = XMLInputFactory.newInstance();
outputFactory = XMLOutputFactory.newInstance();
@@ -56,6 +57,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 +66,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 +75,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));