summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.x
diff options
context:
space:
mode:
authorvamsic007 <vamsic007@13f79535-47bb-0310-9956-ffa450edef68>2009-04-03 22:06:34 +0000
committervamsic007 <vamsic007@13f79535-47bb-0310-9956-ffa450edef68>2009-04-03 22:06:34 +0000
commit0e32d5e1b6c987782140de4856283225ef08f7a7 (patch)
treec77dc7484438248f15acf64c0721fdec8096d271 /branches/sca-java-1.x
parent2de833622c128decbfe98f187105eff9e3c9d13c (diff)
TUSCANY-2935 Integration tests for Java EE contribution processing
o Test Enhanced EAR w application composite containing non-enhanced WAR, non-enhanced EJB JAR. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@761817 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.x')
-rw-r--r--branches/sca-java-1.x/itest/contribution-jee/src/test/java/org/apache/tuscany/sca/test/contribution/jee/ContributionServiceTestCase.java39
-rw-r--r--branches/sca-java-1.x/itest/contribution-jee/src/test/resources/repository/enhanced-app.earbin0 -> 16071 bytes
2 files changed, 39 insertions, 0 deletions
diff --git a/branches/sca-java-1.x/itest/contribution-jee/src/test/java/org/apache/tuscany/sca/test/contribution/jee/ContributionServiceTestCase.java b/branches/sca-java-1.x/itest/contribution-jee/src/test/java/org/apache/tuscany/sca/test/contribution/jee/ContributionServiceTestCase.java
index 918920a840..8e6a4cce6f 100644
--- a/branches/sca-java-1.x/itest/contribution-jee/src/test/java/org/apache/tuscany/sca/test/contribution/jee/ContributionServiceTestCase.java
+++ b/branches/sca-java-1.x/itest/contribution-jee/src/test/java/org/apache/tuscany/sca/test/contribution/jee/ContributionServiceTestCase.java
@@ -57,6 +57,7 @@ public class ContributionServiceTestCase {
private static final String EAR_CONTRIBUTION = "/repository/helloworld-ejb.ear";
private static final String EAR_NONENHANCED_CONTRIBUTION = "/repository/simple-app-ear.jar";
private static final String EAR_ENHANCED_16_CONTRIBUTION = "/repository/simple-app.ear";
+ private static final String EAR_ENHANCED_19_CONTRIBUTION = "/repository/enhanced-app.ear";
private ClassLoader cl;
@@ -285,4 +286,42 @@ public class ContributionServiceTestCase {
Assert.assertEquals("Number of services", 2, jeeImpl.getServices().size());
Assert.assertEquals("Number of references", 1, jeeImpl.getReferences().size());
}
+
+ /**
+ * This method tests an EAR as a contribution.
+ * Enhanced EAR w application composite containing non-enhanced WAR, non-enhanced EJB JAR.
+ */
+ @Test
+ public void testContributeEAR_Enhanced19() throws Exception {
+ URL contributionLocation = getClass().getResource(EAR_ENHANCED_19_CONTRIBUTION);
+ String contributionId = CONTRIBUTION_001_ID;
+ contributionService.contribute(contributionId, contributionLocation, false);
+ Contribution contribution = contributionService.getContribution(contributionId);
+ Assert.assertNotNull(contribution);
+
+ List<Artifact> artifacts = contribution.getArtifacts();
+ for(Artifact artifact : artifacts) {
+ if(artifact.getURI().toString().equals("META-INF/application.composite")) {
+ Composite composite = (Composite)artifact.getModel();
+ Assert.assertEquals("Number of components", 3, composite.getComponents().size());
+ for(Component component : composite.getComponents()) {
+ if(component.getName().equals("webComponent")) {
+ Assert.assertTrue(component.getImplementation() instanceof WebImplementation);
+ WebImplementation webImpl = (WebImplementation)component.getImplementation();
+ Assert.assertEquals("Number of references", 1, webImpl.getReferences().size());
+ } else if(component.getName().equals("ejbComponent1")) {
+ Assert.assertTrue(component.getImplementation() instanceof EJBImplementation);
+ EJBImplementation ejbImpl = (EJBImplementation)component.getImplementation();
+ Assert.assertEquals("Number of services", 1, ejbImpl.getServices().size());
+ Assert.assertEquals("Number of references", 0, ejbImpl.getReferences().size());
+ } else if(component.getName().equals("ejbComponent2")) {
+ Assert.assertTrue(component.getImplementation() instanceof EJBImplementation);
+ EJBImplementation ejbImpl = (EJBImplementation)component.getImplementation();
+ Assert.assertEquals("Number of services", 1, ejbImpl.getServices().size());
+ Assert.assertEquals("Number of references", 1, ejbImpl.getReferences().size());
+ }
+ }
+ }
+ }
+ }
}
diff --git a/branches/sca-java-1.x/itest/contribution-jee/src/test/resources/repository/enhanced-app.ear b/branches/sca-java-1.x/itest/contribution-jee/src/test/resources/repository/enhanced-app.ear
new file mode 100644
index 0000000000..11d2a029ec
--- /dev/null
+++ b/branches/sca-java-1.x/itest/contribution-jee/src/test/resources/repository/enhanced-app.ear
Binary files differ