diff options
author | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-11 23:07:28 +0000 |
---|---|---|
committer | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-11 23:07:28 +0000 |
commit | 07b7dfd1a70ba222b899d9813f8c449dbf3b785f (patch) | |
tree | ecfc876747e6cfedee0a8533d87c19ac78a2dbd0 /branches/sca-java-1.1/modules/contribution-java/src/test | |
parent | 6fadbc9cd1fcf03d0b3630f772d91df149b70428 (diff) |
Moving 1.x branches
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835124 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.1/modules/contribution-java/src/test')
3 files changed, 0 insertions, 260 deletions
diff --git a/branches/sca-java-1.1/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/ClassReferenceArtifactResolverTestCase.java b/branches/sca-java-1.1/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/ClassReferenceArtifactResolverTestCase.java deleted file mode 100644 index f0e74b363a..0000000000 --- a/branches/sca-java-1.1/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/ClassReferenceArtifactResolverTestCase.java +++ /dev/null @@ -1,75 +0,0 @@ - /*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.java.impl;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.resolver.ClassReference;
-import org.apache.tuscany.sca.contribution.resolver.DefaultModelResolverExtensionPoint;
-import org.apache.tuscany.sca.contribution.resolver.ExtensibleModelResolver;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint;
-
-/**
- * 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;
-
- @Override
- protected void setUp() throws Exception {
-
- ModelResolverExtensionPoint resolvers = new DefaultModelResolverExtensionPoint();
- resolvers.addResolver(ClassReference.class, ClassReferenceModelResolver.class);
-
- ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
-
- resolver = new ExtensibleModelResolver(null, resolvers, factories);
- }
-
- @Override
- protected void tearDown() throws Exception {
- }
-
- /**
- * Test ClassReference resolution
- *
- */
- public void testResolveClass() {
- ClassReference ref = new ClassReference(getClass().getName());
- ClassReference clazz = resolver.resolveModel(ClassReference.class, ref);
- assertFalse(clazz.isUnresolved());
- assertTrue(clazz.getJavaClass() == getClass());
- }
-
- /**
- * Test ClassReference resolution of inexistent class
- *
- */
- public void testUnresolvedClass() {
- ClassReference ref = new ClassReference("NonExistentClass");
- ClassReference clazz = resolver.resolveModel(ClassReference.class, ref);
- assertTrue(clazz.isUnresolved());
- assertTrue(clazz.getJavaClass() == null);
- }
-}
diff --git a/branches/sca-java-1.1/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportProcessorTestCase.java b/branches/sca-java-1.1/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportProcessorTestCase.java deleted file mode 100644 index 81c7ee525a..0000000000 --- a/branches/sca-java-1.1/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportProcessorTestCase.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.contribution.java.impl; - -import java.io.StringReader; - -import javax.xml.stream.XMLInputFactory; -import javax.xml.stream.XMLStreamReader; - -import junit.framework.TestCase; - -import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint; -import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; -import org.apache.tuscany.sca.contribution.java.JavaExport; -import org.apache.tuscany.sca.contribution.service.ContributionReadException; - -/** - * Test JavaExportProcessorTestCase - * - * @version $Rev$ $Date$ - */ -public class JavaExportProcessorTestCase extends TestCase { - - private static final String VALID_XML = - "<?xml version=\"1.0\" encoding=\"ASCII\"?>" - + "<contribution xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\">" - + "<export.java package=\"org.apache.tuscany.sca.contribution.java\"/>" - + "</contribution>"; - - private static final String INVALID_XML = - "<?xml version=\"1.0\" encoding=\"ASCII\"?>" - + "<contribution xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\">" - + "<export.java/>" - + "</contribution>"; - - private XMLInputFactory xmlFactory; - - @Override - protected void setUp() throws Exception { - xmlFactory = XMLInputFactory.newInstance(); - } - - /** - * Test loading a valid export element from a contribution metadata stream - * @throws Exception - */ - public void testLoad() throws Exception { - XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(VALID_XML)); - - ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint(); - factories.addFactory(new JavaImportExportFactoryImpl()); - JavaExportProcessor exportProcessor = new JavaExportProcessor(factories); - JavaExport javaExport = exportProcessor.read(reader); - - assertEquals("org.apache.tuscany.sca.contribution.java", javaExport.getPackage()); - } - - /** - * Test loading an INVALID export element from a contribution metadata stream - * @throws Exception - */ - public void testLoadInvalid() throws Exception { - XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(INVALID_XML)); - - ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint(); - factories.addFactory(new JavaImportExportFactoryImpl()); - JavaExportProcessor exportProcessor = new JavaExportProcessor(factories); - try { - exportProcessor.read(reader); - fail("readerException should have been thrown"); - } catch (ContributionReadException e) { - assertTrue(true); - } - } -} diff --git a/branches/sca-java-1.1/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportProcessorTestCase.java b/branches/sca-java-1.1/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportProcessorTestCase.java deleted file mode 100644 index 7f342c2278..0000000000 --- a/branches/sca-java-1.1/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportProcessorTestCase.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.contribution.java.impl; - -import java.io.StringReader; - -import javax.xml.stream.XMLInputFactory; -import javax.xml.stream.XMLStreamReader; - -import junit.framework.TestCase; - -import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint; -import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; -import org.apache.tuscany.sca.contribution.java.JavaImport; -import org.apache.tuscany.sca.contribution.service.ContributionReadException; - -/** - * Test JavaImportProcessorTestCase - * - * @version $Rev$ $Date$ - */ -public class JavaImportProcessorTestCase extends TestCase { - - private static final String VALID_XML = - "<?xml version=\"1.0\" encoding=\"ASCII\"?>" - + "<contribution xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\">" - + "<import.java package=\"org.apache.tuscany.sca.contribution.java\" location=\"sca://contributions/001\"/>" - + "</contribution>"; - - private static final String INVALID_XML = - "<?xml version=\"1.0\" encoding=\"ASCII\"?>" - + "<contribution xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\">" - + "<import.java location=\"sca://contributions/001\"/>" - + "</contribution>"; - - private XMLInputFactory xmlFactory; - - @Override - protected void setUp() throws Exception { - xmlFactory = XMLInputFactory.newInstance(); - } - - /** - * Test loading a valid import element from a contribution metadata stream - * @throws Exception - */ - public void testLoad() throws Exception { - XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(VALID_XML)); - - ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint(); - factories.addFactory(new JavaImportExportFactoryImpl()); - JavaImportProcessor importProcessor = new JavaImportProcessor(factories); - JavaImport javaImport = importProcessor.read(reader); - - assertEquals("org.apache.tuscany.sca.contribution.java", javaImport.getPackage()); - assertEquals("sca://contributions/001", javaImport.getLocation()); - } - - /** - * Test loading a INVALID import element from a contribution metadata stream - * @throws Exception - */ - public void testLoadInvalid() throws Exception { - XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(INVALID_XML)); - - ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint(); - factories.addFactory(new JavaImportExportFactoryImpl()); - JavaImportProcessor importProcessor = new JavaImportProcessor(factories); - try { - importProcessor.read(reader); - fail("readerException should have been thrown"); - } catch (ContributionReadException e) { - assertTrue(true); - } - } -} |