diff options
Diffstat (limited to 'branches/sca-equinox/modules/contribution-impl/src/test/java')
5 files changed, 0 insertions, 265 deletions
diff --git a/branches/sca-equinox/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/FolderContributionPackageProcessorTestCase.java b/branches/sca-equinox/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/FolderContributionPackageProcessorTestCase.java deleted file mode 100644 index c527e0920b..0000000000 --- a/branches/sca-equinox/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/FolderContributionPackageProcessorTestCase.java +++ /dev/null @@ -1,48 +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.processor; - -import static junit.framework.Assert.assertNotNull; - -import java.io.File; -import java.net.URI; -import java.net.URL; -import java.util.List; - -import org.apache.tuscany.sca.contribution.processor.impl.FolderContributionProcessor; -import org.junit.Test; - -/** - * Folder Package Processor test case - * Verifies proper handle of File System structured contributions - * - * @version $Rev$ $Date$ - */ -public class FolderContributionPackageProcessorTestCase { - private static final String FOLDER_CONTRIBUTION = "."; - - @Test - public final void testProcessPackageArtifacts() throws Exception { - FolderContributionProcessor folderProcessor = new FolderContributionProcessor(); - URL contributionURL = new File(FOLDER_CONTRIBUTION).toURL().toURI().toURL(); - - List<URI> artifacts = folderProcessor.getArtifacts(contributionURL, null); - assertNotNull(artifacts); - } -} diff --git a/branches/sca-equinox/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/JarContributionPackageProcessorTestCase.java b/branches/sca-equinox/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/JarContributionPackageProcessorTestCase.java deleted file mode 100644 index a59465340c..0000000000 --- a/branches/sca-equinox/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/JarContributionPackageProcessorTestCase.java +++ /dev/null @@ -1,57 +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.processor; - -import static junit.framework.Assert.assertNotNull; - -import java.io.InputStream; -import java.net.URI; -import java.net.URL; -import java.util.List; - -import org.apache.tuscany.sca.contribution.processor.impl.JarContributionProcessor; -import org.apache.tuscany.sca.contribution.service.util.IOHelper; -import org.junit.Test; - -/** - * JAR Package Processor test case - * Verifies proper handle of JAR Archives contributions - * - * @version $Rev$ $Date$ - */ - -public class JarContributionPackageProcessorTestCase { - private static final String JAR_CONTRIBUTION = "/repository/sample-calculator.jar"; - - @Test - public final void testProcessPackageArtifacts() throws Exception { - JarContributionProcessor jarProcessor = new JarContributionProcessor(); - - URL jarURL = getClass().getResource(JAR_CONTRIBUTION); - InputStream jarStream = jarURL.openStream(); - List<URI> artifacts = null; - try { - artifacts = jarProcessor.getArtifacts(jarURL, jarStream); - } finally { - IOHelper.closeQuietly(jarStream); - } - - assertNotNull(artifacts); - } -} diff --git a/branches/sca-equinox/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/URLartifactProcessorExtensionPointTestCase.java b/branches/sca-equinox/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/URLartifactProcessorExtensionPointTestCase.java index 7b3d8dadc0..14b6b956da 100644 --- a/branches/sca-equinox/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/URLartifactProcessorExtensionPointTestCase.java +++ b/branches/sca-equinox/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/URLartifactProcessorExtensionPointTestCase.java @@ -25,8 +25,6 @@ import java.net.URI; import java.net.URL; import org.apache.tuscany.sca.contribution.resolver.ModelResolver; -import org.apache.tuscany.sca.contribution.service.ContributionReadException; -import org.apache.tuscany.sca.contribution.service.ContributionResolveException; import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry; import org.apache.tuscany.sca.core.ExtensionPointRegistry; import org.junit.BeforeClass; diff --git a/branches/sca-equinox/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/ContributionRepositoryTestCase.java b/branches/sca-equinox/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/ContributionRepositoryTestCase.java deleted file mode 100644 index 5ec23475ac..0000000000 --- a/branches/sca-equinox/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/ContributionRepositoryTestCase.java +++ /dev/null @@ -1,88 +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.services; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertNotNull; -import static junit.framework.Assert.assertNull; - -import java.io.File; -import java.io.InputStream; -import java.net.URL; - -import javax.xml.stream.XMLInputFactory; - -import org.apache.tuscany.sca.contribution.service.impl.ContributionRepositoryImpl; -import org.apache.tuscany.sca.contribution.service.util.FileHelper; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; - -public class ContributionRepositoryTestCase { - private static ContributionRepositoryImpl repository; - - @BeforeClass - public static void setUp() throws Exception { - // create repository (this should re-create the root directory) - repository = new ContributionRepositoryImpl("target/repository/", XMLInputFactory.newInstance(), null); - repository.init(); - } - - @Test - public void testStore() throws Exception { - String resourceLocation = "/repository/sample-calculator.jar"; - String contribution = "sample-calculator.jar"; - URL contributionLocation = getClass().getResource(resourceLocation); - InputStream contributionStream = getClass().getResourceAsStream(resourceLocation); - repository.store(contribution, contributionLocation, contributionStream); - - URL contributionURL = repository.find(contribution); - assertNotNull(contributionURL); - } - - @Test - public void testRemove() throws Exception { - String resourceLocation = "/repository/sample-calculator.jar"; - String contribution = "sample-calculator.jar"; - URL contributionLocation = getClass().getResource(resourceLocation); - InputStream contributionStream = getClass().getResourceAsStream(resourceLocation); - repository.store(contribution, contributionLocation, contributionStream); - - repository.remove(contribution); - URL contributionURL = repository.find(contribution); - assertNull(contributionURL); - } - - @Test - public void testList() throws Exception { - String resourceLocation = "/repository/sample-calculator.jar"; - String contribution = "sample-calculator.jar"; - URL contributionLocation = getClass().getResource(resourceLocation); - InputStream contributionStream = getClass().getResourceAsStream(resourceLocation); - repository.store(contribution, contributionLocation, contributionStream); - - assertEquals(1, repository.list().size()); - } - - @AfterClass - public static void tearDown() throws Exception { - FileHelper.deleteDirectory(new File("target/repository")); - } -} diff --git a/branches/sca-equinox/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/PackageTypeDescriberImplTestCase.java b/branches/sca-equinox/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/PackageTypeDescriberImplTestCase.java deleted file mode 100644 index 6edfbb78b6..0000000000 --- a/branches/sca-equinox/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/PackageTypeDescriberImplTestCase.java +++ /dev/null @@ -1,70 +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.services; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertNull; - -import java.net.URL; - -import org.apache.tuscany.sca.contribution.PackageType; -import org.apache.tuscany.sca.contribution.service.impl.PackageTypeDescriberImpl; -import org.junit.BeforeClass; -import org.junit.Test; - -public class PackageTypeDescriberImplTestCase { - private static PackageTypeDescriberImpl packageTypeDescriber; - - @Test - public void testResolveArchivePackageType() throws Exception { - URL artifactURL = getClass().getResource("/deployables/sample-calculator.jar"); - assertEquals(PackageType.JAR, this.packageTypeDescriber.getType(artifactURL, null)); - } - - @Test - public void testResolveFolderPackageType() throws Exception { - URL artifactURL = getClass().getResource("/deployables/"); - assertEquals(PackageType.FOLDER, this.packageTypeDescriber.getType(artifactURL, null)); - } - - @Test - public void testResolveFolder2PackageType() throws Exception { - URL artifactURL = getClass().getResource("/deployables"); - assertEquals(PackageType.FOLDER, this.packageTypeDescriber.getType(artifactURL, null)); - } - - @Test - public void testResolveUnknownPackageType() throws Exception { - URL artifactURL = getClass().getResource("/test.ext"); - assertNull(this.packageTypeDescriber.getType(artifactURL, null)); - } - - @Test - public void testDefaultPackageType() throws Exception { - URL artifactURL = getClass().getResource("/test.ext"); - assertEquals("application/vnd.tuscany.ext", packageTypeDescriber.getType(artifactURL, - "application/vnd.tuscany.ext")); - } - - @BeforeClass - public static void setUp() throws Exception { - packageTypeDescriber = new PackageTypeDescriberImpl(); - } - -} |