summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-integration/testing/sca/itest/contribution/src
diff options
context:
space:
mode:
authordims <dims@13f79535-47bb-0310-9956-ffa450edef68>2008-06-17 00:23:01 +0000
committerdims <dims@13f79535-47bb-0310-9956-ffa450edef68>2008-06-17 00:23:01 +0000
commitbdd0a41aed7edf21ec2a65cfa17a86af2ef8c48a (patch)
tree38a92061c0793434c4be189f1d70c3458b6bc41d /branches/sca-java-integration/testing/sca/itest/contribution/src
Move Tuscany from Incubator to top level.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@668359 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-integration/testing/sca/itest/contribution/src')
-rw-r--r--branches/sca-java-integration/testing/sca/itest/contribution/src/main/resources/META-INF/sca/application.composite24
-rw-r--r--branches/sca-java-integration/testing/sca/itest/contribution/src/test/java/org/apache/tuscany/sca/test/contribution/ContributionDirectoryWatcherTestCase.java41
-rw-r--r--branches/sca-java-integration/testing/sca/itest/contribution/src/test/java/org/apache/tuscany/sca/test/contribution/ContributionServiceTestCase.java83
-rw-r--r--branches/sca-java-integration/testing/sca/itest/contribution/src/test/resources/deployables/sample-calculator.jarbin0 -> 26901 bytes
-rw-r--r--branches/sca-java-integration/testing/sca/itest/contribution/src/test/resources/repository/sample-calculator.jarbin0 -> 26901 bytes
5 files changed, 148 insertions, 0 deletions
diff --git a/branches/sca-java-integration/testing/sca/itest/contribution/src/main/resources/META-INF/sca/application.composite b/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/branches/sca-java-integration/testing/sca/itest/contribution/src/main/resources/META-INF/sca/application.composite
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:foo="http://foo"
+ name="ContributionTest">
+
+</composite>
diff --git a/branches/sca-java-integration/testing/sca/itest/contribution/src/test/java/org/apache/tuscany/sca/test/contribution/ContributionDirectoryWatcherTestCase.java b/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/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/branches/sca-java-integration/testing/sca/itest/contribution/src/test/java/org/apache/tuscany/sca/test/contribution/ContributionServiceTestCase.java b/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/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/branches/sca-java-integration/testing/sca/itest/contribution/src/test/resources/deployables/sample-calculator.jar b/branches/sca-java-integration/testing/sca/itest/contribution/src/test/resources/deployables/sample-calculator.jar
new file mode 100644
index 0000000000..0ca3a1b781
--- /dev/null
+++ b/branches/sca-java-integration/testing/sca/itest/contribution/src/test/resources/deployables/sample-calculator.jar
Binary files differ
diff --git a/branches/sca-java-integration/testing/sca/itest/contribution/src/test/resources/repository/sample-calculator.jar b/branches/sca-java-integration/testing/sca/itest/contribution/src/test/resources/repository/sample-calculator.jar
new file mode 100644
index 0000000000..0ca3a1b781
--- /dev/null
+++ b/branches/sca-java-integration/testing/sca/itest/contribution/src/test/resources/repository/sample-calculator.jar
Binary files differ