summaryrefslogtreecommitdiffstats
path: root/java/sca/modules
diff options
context:
space:
mode:
authorvamsic007 <vamsic007@13f79535-47bb-0310-9956-ffa450edef68>2008-11-06 15:26:29 +0000
committervamsic007 <vamsic007@13f79535-47bb-0310-9956-ffa450edef68>2008-11-06 15:26:29 +0000
commit2f43458a5a3391633a0b45ff59b0cef34a7db34f (patch)
treefd56a86dbdf05c9594fffca9792b76791f6fa2f5 /java/sca/modules
parentf839519add108a237fabadfbae24415ca0219c5e (diff)
Package processor for war files.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@711879 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules')
-rw-r--r--java/sca/modules/contribution-jee/pom.xml5
-rw-r--r--java/sca/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/WarContributionProcessor.java36
-rw-r--r--java/sca/modules/contribution-jee/src/test/java/org/apache/tuscany/sca/contribution/jee/WarContributionProcessorTestCase.java57
-rw-r--r--java/sca/modules/contribution-jee/src/test/resources/sample-web-app.warbin0 -> 12454 bytes
4 files changed, 98 insertions, 0 deletions
diff --git a/java/sca/modules/contribution-jee/pom.xml b/java/sca/modules/contribution-jee/pom.xml
index d7ad035d82..f89e41edcf 100644
--- a/java/sca/modules/contribution-jee/pom.xml
+++ b/java/sca/modules/contribution-jee/pom.xml
@@ -34,6 +34,11 @@
<artifactId>tuscany-contribution</artifactId>
<version>1.4-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-impl</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
diff --git a/java/sca/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/WarContributionProcessor.java b/java/sca/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/WarContributionProcessor.java
new file mode 100644
index 0000000000..17974e831f
--- /dev/null
+++ b/java/sca/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/WarContributionProcessor.java
@@ -0,0 +1,36 @@
+/*
+ * 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.jee.impl;
+
+import org.apache.tuscany.sca.contribution.PackageType;
+import org.apache.tuscany.sca.contribution.processor.PackageProcessor;
+import org.apache.tuscany.sca.contribution.processor.impl.JarContributionProcessor;
+
+/**
+ * War Contribution package processor.
+ *
+ * @version $Rev$ $Date$
+ */
+public class WarContributionProcessor extends JarContributionProcessor implements PackageProcessor {
+ @Override
+ public String getPackageType() {
+ return PackageType.WAR;
+ }
+}
diff --git a/java/sca/modules/contribution-jee/src/test/java/org/apache/tuscany/sca/contribution/jee/WarContributionProcessorTestCase.java b/java/sca/modules/contribution-jee/src/test/java/org/apache/tuscany/sca/contribution/jee/WarContributionProcessorTestCase.java
new file mode 100644
index 0000000000..e315c417b9
--- /dev/null
+++ b/java/sca/modules/contribution-jee/src/test/java/org/apache/tuscany/sca/contribution/jee/WarContributionProcessorTestCase.java
@@ -0,0 +1,57 @@
+/*
+ * 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.jee;
+
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
+import java.util.List;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.contribution.jee.impl.WarContributionProcessor;
+import org.apache.tuscany.sca.contribution.service.util.IOHelper;
+import org.junit.Test;
+
+/**
+ * War Contribution package processor test case.
+ * Verifies proper handling of WAR contributions.
+ *
+ * @version $Rev$ $Date$
+ */
+public class WarContributionProcessorTestCase {
+ private static final String WAR_CONTRIBUTION = "/sample-web-app.war";
+
+ @Test
+ public void testProcessPackageArtifacts() throws Exception {
+ WarContributionProcessor warProcessor = new WarContributionProcessor();
+
+ URL warURL = getClass().getResource(WAR_CONTRIBUTION);
+ InputStream warStream = warURL.openStream();
+ List<URI> artifacts = null;
+ try {
+ artifacts = warProcessor.getArtifacts(warURL, warStream);
+ } finally {
+ IOHelper.closeQuietly(warStream);
+ }
+
+ Assert.assertNotNull(artifacts);
+ }
+}
diff --git a/java/sca/modules/contribution-jee/src/test/resources/sample-web-app.war b/java/sca/modules/contribution-jee/src/test/resources/sample-web-app.war
new file mode 100644
index 0000000000..681b203fab
--- /dev/null
+++ b/java/sca/modules/contribution-jee/src/test/resources/sample-web-app.war
Binary files differ