From 3caf8614f25d6b1962e20331fdf423c863bc02f3 Mon Sep 17 00:00:00 2001 From: lresende Date: Wed, 11 Nov 2009 23:13:31 +0000 Subject: Moving 1.x branches git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835144 13f79535-47bb-0310-9956-ffa450edef68 --- .../testing/sca/itest/contribution/pom.xml | 33 ++++++++ .../resources/META-INF/sca/application.composite | 24 ++++++ .../ContributionDirectoryWatcherTestCase.java | 41 ++++++++++ .../contribution/ContributionServiceTestCase.java | 83 +++++++++++++++++++++ .../resources/deployables/sample-calculator.jar | Bin 0 -> 26901 bytes .../resources/repository/sample-calculator.jar | Bin 0 -> 26901 bytes 6 files changed, 181 insertions(+) create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/contribution/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/contribution/src/main/resources/META-INF/sca/application.composite create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/contribution/src/test/java/org/apache/tuscany/sca/test/contribution/ContributionDirectoryWatcherTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/contribution/src/test/java/org/apache/tuscany/sca/test/contribution/ContributionServiceTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/contribution/src/test/resources/deployables/sample-calculator.jar create mode 100644 sca-java-1.x/branches/sca-java-integration/testing/sca/itest/contribution/src/test/resources/repository/sample-calculator.jar (limited to 'sca-java-1.x/branches/sca-java-integration/testing/sca/itest/contribution') diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/contribution/pom.xml b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/contribution/pom.xml new file mode 100644 index 0000000000..5da30f99d8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/contribution/pom.xml @@ -0,0 +1,33 @@ + + + + + org.apache.tuscany.testing + sca-itest + 0.1-integration-incubating-SNAPSHOT + ../pom.xml + + 4.0.0 + iTest-Contribution + SNAPSHOT + jar + Test Suite for SCA Contribution + + diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/contribution/src/main/resources/META-INF/sca/application.composite b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/contribution/src/main/resources/META-INF/sca/application.composite new file mode 100644 index 0000000000..2b5153a28a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/contribution/src/main/resources/META-INF/sca/application.composite @@ -0,0 +1,24 @@ + + + + + diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/contribution/src/test/java/org/apache/tuscany/sca/test/contribution/ContributionDirectoryWatcherTestCase.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/contribution/src/test/java/org/apache/tuscany/sca/test/contribution/ContributionDirectoryWatcherTestCase.java new file mode 100644 index 0000000000..466ba18c78 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/contribution/src/test/java/org/apache/tuscany/sca/test/contribution/ContributionDirectoryWatcherTestCase.java @@ -0,0 +1,41 @@ +/* + * 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.test.contribution; + +import org.apache.tuscany.core.services.deployment.ContributionDirectoryWatcher; +import org.apache.tuscany.spi.annotation.Autowire; +import org.apache.tuscany.test.SCATestCase; + +/** + * This is more intended to be a integration test then a unit test. * + */ +public class ContributionDirectoryWatcherTestCase extends SCATestCase { + @Autowire + private ContributionDirectoryWatcher contributionDirectoryWatcher; // NOPMD + + protected void setUp() throws Exception { + super.setUp(); + } + + public void testContributeURL() throws Exception { + + } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/contribution/src/test/java/org/apache/tuscany/sca/test/contribution/ContributionServiceTestCase.java b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/contribution/src/test/java/org/apache/tuscany/sca/test/contribution/ContributionServiceTestCase.java new file mode 100644 index 0000000000..2bd9de672a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/contribution/src/test/java/org/apache/tuscany/sca/test/contribution/ContributionServiceTestCase.java @@ -0,0 +1,83 @@ +/* + * 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.test.contribution; + +import java.io.File; +import java.net.URI; +import java.net.URL; + +import org.apache.tuscany.api.SCARuntime; +import org.apache.tuscany.core.bootstrap.DefaultSCARuntime; +import org.apache.tuscany.core.util.FileHelper; +import org.apache.tuscany.host.deployment.ContributionService; +import org.apache.tuscany.spi.bootstrap.ComponentNames; +import org.apache.tuscany.spi.model.Contribution; +import org.apache.tuscany.test.SCATestCase; + +/** + * This is more intended to be a integration test then a unit test. * + */ +public class ContributionServiceTestCase extends SCATestCase { + private static final String JAR_CONTRIBUTION = "/repository/sample-calculator.jar"; + private static final String FOLDER_CONTRIBUTION = "/repository/calculator/"; + + private ContributionService contributionService; + + protected void setUp() throws Exception { + super.setUp(); + + this.contributionService = (ContributionService) ((DefaultSCARuntime)SCARuntime.getInstance()).getSystemService(ComponentNames.TUSCANY_CONTRIBUTION_SERVICE); + } + + public void testContributeJAR() throws Exception { + URL contributionLocation = getClass().getResource(JAR_CONTRIBUTION); + URI contributionId = contributionService.contribute(contributionLocation, false); + assertNotNull(contributionId); + } + + public void testStoreContributionInRepository() throws Exception { + URL contributionLocation = getClass().getResource(JAR_CONTRIBUTION); + URI contributionId = contributionService.contribute(contributionLocation, true); + + assertNotNull(contributionId); + + Contribution contributionModel = (Contribution) contributionService.getContribution(contributionId); + + File contributionFile = FileHelper.toFile(contributionModel.getLocation()); + assertTrue(contributionFile.exists()); + } + + public void testStoreDuplicatedContributionInRepository() throws Exception { + URL contributionLocation = getClass().getResource(JAR_CONTRIBUTION); + URI contributionId1 = contributionService.contribute(contributionLocation, true); + assertNotNull(contributionId1); + URI contributionId2 = contributionService.contribute(contributionLocation, true); + assertNotNull(contributionId2); + } + + +// public void testContributeFolder() throws Exception { +// File rootContributionFolder = new File(FOLDER_CONTRIBUTION); +// +// URI contributionURI = contributionService.contribute(rootContributionFolder.toURL(), false); +// assertNotNull(contributionURI); +// } + +} diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/contribution/src/test/resources/deployables/sample-calculator.jar b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/contribution/src/test/resources/deployables/sample-calculator.jar new file mode 100644 index 0000000000..0ca3a1b781 Binary files /dev/null and b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/contribution/src/test/resources/deployables/sample-calculator.jar differ diff --git a/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/contribution/src/test/resources/repository/sample-calculator.jar b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/contribution/src/test/resources/repository/sample-calculator.jar new file mode 100644 index 0000000000..0ca3a1b781 Binary files /dev/null and b/sca-java-1.x/branches/sca-java-integration/testing/sca/itest/contribution/src/test/resources/repository/sample-calculator.jar differ -- cgit v1.2.3