From 0e32d5e1b6c987782140de4856283225ef08f7a7 Mon Sep 17 00:00:00 2001 From: vamsic007 Date: Fri, 3 Apr 2009 22:06:34 +0000 Subject: 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 --- .../jee/ContributionServiceTestCase.java | 39 +++++++++++++++++++++ .../src/test/resources/repository/enhanced-app.ear | Bin 0 -> 16071 bytes 2 files changed, 39 insertions(+) create mode 100644 branches/sca-java-1.x/itest/contribution-jee/src/test/resources/repository/enhanced-app.ear (limited to 'branches') 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 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 Binary files /dev/null and b/branches/sca-java-1.x/itest/contribution-jee/src/test/resources/repository/enhanced-app.ear differ -- cgit v1.2.3