You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by va...@apache.org on 2009/04/04 00:06:34 UTC

svn commit: r761817 - in /tuscany/branches/sca-java-1.x/itest/contribution-jee/src/test: java/org/apache/tuscany/sca/test/contribution/jee/ContributionServiceTestCase.java resources/repository/enhanced-app.ear

Author: vamsic007
Date: Fri Apr  3 22:06:34 2009
New Revision: 761817

URL: http://svn.apache.org/viewvc?rev=761817&view=rev
Log:
TUSCANY-2935 Integration tests for Java EE contribution processing
 o Test Enhanced EAR w application composite containing non-enhanced WAR, non-enhanced EJB JAR.

Added:
    tuscany/branches/sca-java-1.x/itest/contribution-jee/src/test/resources/repository/enhanced-app.ear   (with props)
Modified:
    tuscany/branches/sca-java-1.x/itest/contribution-jee/src/test/java/org/apache/tuscany/sca/test/contribution/jee/ContributionServiceTestCase.java

Modified: tuscany/branches/sca-java-1.x/itest/contribution-jee/src/test/java/org/apache/tuscany/sca/test/contribution/jee/ContributionServiceTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/itest/contribution-jee/src/test/java/org/apache/tuscany/sca/test/contribution/jee/ContributionServiceTestCase.java?rev=761817&r1=761816&r2=761817&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.x/itest/contribution-jee/src/test/java/org/apache/tuscany/sca/test/contribution/jee/ContributionServiceTestCase.java (original)
+++ tuscany/branches/sca-java-1.x/itest/contribution-jee/src/test/java/org/apache/tuscany/sca/test/contribution/jee/ContributionServiceTestCase.java Fri Apr  3 22:06:34 2009
@@ -57,6 +57,7 @@
     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 @@
         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());
+                    }
+                }
+            }
+        }
+    }
 }

Added: tuscany/branches/sca-java-1.x/itest/contribution-jee/src/test/resources/repository/enhanced-app.ear
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/itest/contribution-jee/src/test/resources/repository/enhanced-app.ear?rev=761817&view=auto
==============================================================================
Binary file - no diff available.

Propchange: tuscany/branches/sca-java-1.x/itest/contribution-jee/src/test/resources/repository/enhanced-app.ear
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream