summaryrefslogtreecommitdiffstats
path: root/branches/sca-equinox/modules/contribution-java
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2008-10-10 22:28:22 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2008-10-10 22:28:22 +0000
commit9134aecc4e049bfa5df2fc2f17c90f3088b1e2f1 (patch)
treed17cd7f2330bd4b216069eeaea49f93324c21711 /branches/sca-equinox/modules/contribution-java
parent267c37371ae406d89c59fe039d45a13f09472047 (diff)
Restrict Export-Package and convert test cases to Junit 4
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@703589 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-equinox/modules/contribution-java')
-rw-r--r--branches/sca-equinox/modules/contribution-java/pom.xml2
-rw-r--r--branches/sca-equinox/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/ClassReferenceArtifactResolverTestCase.java15
-rw-r--r--branches/sca-equinox/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/ContributionClassLoaderTestCase.java10
-rw-r--r--branches/sca-equinox/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportProcessorTestCase.java23
-rw-r--r--branches/sca-equinox/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportProcessorTestCase.java21
5 files changed, 44 insertions, 27 deletions
diff --git a/branches/sca-equinox/modules/contribution-java/pom.xml b/branches/sca-equinox/modules/contribution-java/pom.xml
index 8e57661a84..f2bf387e49 100644
--- a/branches/sca-equinox/modules/contribution-java/pom.xml
+++ b/branches/sca-equinox/modules/contribution-java/pom.xml
@@ -66,7 +66,7 @@
<Bundle-Version>${tuscany.version}</Bundle-Version>
<Bundle-SymbolicName>org.apache.tuscany.sca.contribution.java</Bundle-SymbolicName>
<Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.contribution.java*</Export-Package>
+ <Export-Package>org.apache.tuscany.sca.contribution.java</Export-Package>
<DynamicImport-Package>org.apache.tuscany.sca.contribution.osgi.impl</DynamicImport-Package>
</instructions>
</configuration>
diff --git a/branches/sca-equinox/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/ClassReferenceArtifactResolverTestCase.java b/branches/sca-equinox/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/ClassReferenceArtifactResolverTestCase.java
index d4f6fec2b0..206d25e1e1 100644
--- a/branches/sca-equinox/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/ClassReferenceArtifactResolverTestCase.java
+++ b/branches/sca-equinox/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/ClassReferenceArtifactResolverTestCase.java
@@ -19,7 +19,8 @@
package org.apache.tuscany.sca.contribution.java.impl;
-import junit.framework.TestCase;
+import static junit.framework.Assert.assertFalse;
+import static junit.framework.Assert.assertTrue;
import org.apache.tuscany.sca.contribution.resolver.ClassReference;
import org.apache.tuscany.sca.contribution.resolver.ExtensibleModelResolver;
@@ -27,17 +28,19 @@ import org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint;
import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.core.FactoryExtensionPoint;
+import org.junit.BeforeClass;
+import org.junit.Test;
/**
* Test ClassReferenceArtifactResolver.
*
* @version $Rev: 560435 $ $Date: 2007-07-27 18:26:55 -0700 (Fri, 27 Jul 2007) $
*/
-public class ClassReferenceArtifactResolverTestCase extends TestCase {
- private ExtensibleModelResolver resolver;
+public class ClassReferenceArtifactResolverTestCase {
+ private static ExtensibleModelResolver resolver;
- @Override
- protected void setUp() throws Exception {
+ @BeforeClass
+ public static void setUp() throws Exception {
ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
ModelResolverExtensionPoint resolvers = extensionPoints.getExtensionPoint(ModelResolverExtensionPoint.class);
@@ -50,6 +53,7 @@ public class ClassReferenceArtifactResolverTestCase extends TestCase {
* Test ClassReference resolution
*
*/
+ @Test
public void testResolveClass() {
ClassReference ref = new ClassReference(getClass().getName());
ClassReference clazz = resolver.resolveModel(ClassReference.class, ref);
@@ -61,6 +65,7 @@ public class ClassReferenceArtifactResolverTestCase extends TestCase {
* Test ClassReference resolution of inexistent class
*
*/
+ @Test
public void testUnresolvedClass() {
ClassReference ref = new ClassReference("NonExistentClass");
ClassReference clazz = resolver.resolveModel(ClassReference.class, ref);
diff --git a/branches/sca-equinox/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/ContributionClassLoaderTestCase.java b/branches/sca-equinox/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/ContributionClassLoaderTestCase.java
index ef2b646ad9..779c00f71c 100644
--- a/branches/sca-equinox/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/ContributionClassLoaderTestCase.java
+++ b/branches/sca-equinox/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/ContributionClassLoaderTestCase.java
@@ -35,7 +35,7 @@ import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.core.FactoryExtensionPoint;
import org.junit.Assert;
-import org.junit.Before;
+import org.junit.BeforeClass;
import org.junit.Test;
@@ -45,11 +45,11 @@ import org.junit.Test;
*/
public class ContributionClassLoaderTestCase {
- private ContributionFactory contributionFactory;
- private JavaImportExportFactory javaImportExportFactory;
+ private static ContributionFactory contributionFactory;
+ private static JavaImportExportFactory javaImportExportFactory;
- @Before
- public void setUp() throws Exception {
+ @BeforeClass
+ public static void setUp() throws Exception {
ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
FactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(FactoryExtensionPoint.class);
contributionFactory = modelFactories.getFactory(ContributionFactory.class);
diff --git a/branches/sca-equinox/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportProcessorTestCase.java b/branches/sca-equinox/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportProcessorTestCase.java
index 6528124a2a..8de1d61a34 100644
--- a/branches/sca-equinox/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportProcessorTestCase.java
+++ b/branches/sca-equinox/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportProcessorTestCase.java
@@ -19,12 +19,15 @@
package org.apache.tuscany.sca.contribution.java.impl;
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNotNull;
+
import java.io.StringReader;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamReader;
-import junit.framework.TestCase;
+import junit.framework.Assert;
import org.apache.tuscany.sca.contribution.java.JavaExport;
import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
@@ -37,13 +40,15 @@ import org.apache.tuscany.sca.monitor.DefaultMonitorFactory;
import org.apache.tuscany.sca.monitor.Monitor;
import org.apache.tuscany.sca.monitor.MonitorFactory;
import org.apache.tuscany.sca.monitor.Problem;
+import org.junit.BeforeClass;
+import org.junit.Test;
/**
* Test JavaExportProcessorTestCase
*
* @version $Rev$ $Date$
*/
-public class JavaExportProcessorTestCase extends TestCase {
+public class JavaExportProcessorTestCase {
private static final String VALID_XML =
"<?xml version=\"1.0\" encoding=\"ASCII\"?>"
@@ -53,12 +58,12 @@ public class JavaExportProcessorTestCase extends TestCase {
"<?xml version=\"1.0\" encoding=\"ASCII\"?>"
+ "<export.java xmlns=\"http://www.osoa.org/xmlns/sca/1.0\"/>";
- private XMLInputFactory inputFactory;
- private StAXArtifactProcessor<Object> staxProcessor;
- private Monitor monitor;
+ private static XMLInputFactory inputFactory;
+ private static StAXArtifactProcessor<Object> staxProcessor;
+ private static Monitor monitor;
- @Override
- protected void setUp() throws Exception {
+ @BeforeClass
+ public static void setUp() throws Exception {
ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
inputFactory = XMLInputFactory.newInstance();
// Create a monitor
@@ -76,16 +81,18 @@ public class JavaExportProcessorTestCase extends TestCase {
* Test loading a valid export element from a contribution metadata stream
* @throws Exception
*/
+ @Test
public void testLoad() throws Exception {
XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(VALID_XML));
JavaExport javaExport = (JavaExport)staxProcessor.read(reader);
- assertEquals("org.apache.tuscany.sca.contribution.java", javaExport.getPackage());
+ Assert.assertEquals("org.apache.tuscany.sca.contribution.java", javaExport.getPackage());
}
/**
* Test loading an INVALID export element from a contribution metadata stream
* @throws Exception
*/
+ @Test
public void testLoadInvalid() throws Exception {
XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(INVALID_XML));
/*try {
diff --git a/branches/sca-equinox/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportProcessorTestCase.java b/branches/sca-equinox/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportProcessorTestCase.java
index bd2911b60b..76a3090c28 100644
--- a/branches/sca-equinox/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportProcessorTestCase.java
+++ b/branches/sca-equinox/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportProcessorTestCase.java
@@ -19,13 +19,14 @@
package org.apache.tuscany.sca.contribution.java.impl;
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNotNull;
+
import java.io.StringReader;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamReader;
-import junit.framework.TestCase;
-
import org.apache.tuscany.sca.contribution.java.JavaImport;
import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
@@ -37,13 +38,15 @@ import org.apache.tuscany.sca.monitor.DefaultMonitorFactory;
import org.apache.tuscany.sca.monitor.Monitor;
import org.apache.tuscany.sca.monitor.MonitorFactory;
import org.apache.tuscany.sca.monitor.Problem;
+import org.junit.BeforeClass;
+import org.junit.Test;
/**
* Test JavaImportProcessorTestCase
*
* @version $Rev$ $Date$
*/
-public class JavaImportProcessorTestCase extends TestCase {
+public class JavaImportProcessorTestCase {
private static final String VALID_XML =
"<?xml version=\"1.0\" encoding=\"ASCII\"?>"
@@ -53,12 +56,12 @@ public class JavaImportProcessorTestCase extends TestCase {
"<?xml version=\"1.0\" encoding=\"ASCII\"?>"
+ "<import.java xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\" location=\"sca://contributions/001\"/>";
- private XMLInputFactory inputFactory;
- private StAXArtifactProcessor<Object> staxProcessor;
- private Monitor monitor;
+ private static XMLInputFactory inputFactory;
+ private static StAXArtifactProcessor<Object> staxProcessor;
+ private static Monitor monitor;
- @Override
- protected void setUp() throws Exception {
+ @BeforeClass
+ public static void setUp() throws Exception {
ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
inputFactory = XMLInputFactory.newInstance();
// Create a monitor
@@ -76,6 +79,7 @@ public class JavaImportProcessorTestCase extends TestCase {
* Test loading a valid import element from a contribution metadata stream
* @throws Exception
*/
+ @Test
public void testLoad() throws Exception {
XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(VALID_XML));
JavaImport javaImport = (JavaImport)staxProcessor.read(reader);
@@ -88,6 +92,7 @@ public class JavaImportProcessorTestCase extends TestCase {
* Test loading a INVALID import element from a contribution metadata stream
* @throws Exception
*/
+ @Test
public void testLoadInvalid() throws Exception {
XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(INVALID_XML));
/*try {