You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by ti...@apache.org on 2011/11/28 10:38:14 UTC

svn commit: r1207034 - in /aries/trunk: application/application-modeller-standalone/ ejb/ejb-modeller-itest/ ejb/ejb-modeller-itest/src/test/java/org/apache/aries/ejb/container/itest/

Author: timothyjward
Date: Mon Nov 28 09:38:13 2011
New Revision: 1207034

URL: http://svn.apache.org/viewvc?rev=1207034&view=rev
Log:
ARIES-792: Add standalone itests for EJB modelling and add EJB support to standalone modeller

Added:
    aries/trunk/ejb/ejb-modeller-itest/src/test/java/org/apache/aries/ejb/container/itest/AbstractEJBModellerTest.java
    aries/trunk/ejb/ejb-modeller-itest/src/test/java/org/apache/aries/ejb/container/itest/ApplicationStandaloneModellerTest.java
Modified:
    aries/trunk/application/application-modeller-standalone/pom.xml
    aries/trunk/ejb/ejb-modeller-itest/pom.xml
    aries/trunk/ejb/ejb-modeller-itest/src/test/java/org/apache/aries/ejb/container/itest/EJBModellingTest.java

Modified: aries/trunk/application/application-modeller-standalone/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/application/application-modeller-standalone/pom.xml?rev=1207034&r1=1207033&r2=1207034&view=diff
==============================================================================
--- aries/trunk/application/application-modeller-standalone/pom.xml (original)
+++ aries/trunk/application/application-modeller-standalone/pom.xml Mon Nov 28 09:38:13 2011
@@ -77,6 +77,11 @@
             <artifactId>blueprint-parser</artifactId>
             <version>0.4</version>
         </dependency>
+        <dependency>
+            <groupId>org.apache.aries.ejb</groupId>
+            <artifactId>org.apache.aries.ejb.modeller</artifactId>
+            <version>0.1-SNAPSHOT</version>
+        </dependency>
     </dependencies>
 
     <build>

Modified: aries/trunk/ejb/ejb-modeller-itest/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/ejb/ejb-modeller-itest/pom.xml?rev=1207034&r1=1207033&r2=1207034&view=diff
==============================================================================
--- aries/trunk/ejb/ejb-modeller-itest/pom.xml (original)
+++ aries/trunk/ejb/ejb-modeller-itest/pom.xml Mon Nov 28 09:38:13 2011
@@ -126,10 +126,17 @@
         	<groupId>org.apache.aries.application</groupId>
         	<artifactId>org.apache.aries.application.modeller</artifactId>
         	<version>0.3.1-SNAPSHOT</version>
-        	<type>pom</type>
+        	<type>bundle</type>
         	<scope>test</scope>
         </dependency>
         <dependency>
+            <groupId>org.apache.aries.application</groupId>
+            <artifactId>application-modeller-standalone</artifactId>
+            <version>0.3.1-SNAPSHOT</version>
+            <type>bundle</type>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
         	<groupId>org.apache.aries.application</groupId>
         	<artifactId>org.apache.aries.application.utils</artifactId>
         	<version>0.3.1-SNAPSHOT</version>

Added: aries/trunk/ejb/ejb-modeller-itest/src/test/java/org/apache/aries/ejb/container/itest/AbstractEJBModellerTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/ejb/ejb-modeller-itest/src/test/java/org/apache/aries/ejb/container/itest/AbstractEJBModellerTest.java?rev=1207034&view=auto
==============================================================================
--- aries/trunk/ejb/ejb-modeller-itest/src/test/java/org/apache/aries/ejb/container/itest/AbstractEJBModellerTest.java (added)
+++ aries/trunk/ejb/ejb-modeller-itest/src/test/java/org/apache/aries/ejb/container/itest/AbstractEJBModellerTest.java Mon Nov 28 09:38:13 2011
@@ -0,0 +1,334 @@
+/*  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.aries.ejb.container.itest;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+
+import org.apache.aries.application.modelling.ExportedService;
+import org.apache.aries.application.modelling.ModelledResource;
+import org.apache.aries.application.modelling.ModelledResourceManager;
+import org.apache.aries.application.modelling.ModellerException;
+import org.apache.aries.application.modelling.ModellingManager;
+import org.apache.aries.itest.AbstractIntegrationTest;
+import org.apache.aries.util.filesystem.FileSystem;
+import org.apache.aries.util.filesystem.ICloseableDirectory;
+import org.apache.aries.util.io.IOUtils;
+import org.junit.Test;
+
+public abstract class AbstractEJBModellerTest extends AbstractIntegrationTest
+{
+  protected ModelledResourceManager mrm;
+  protected ModellingManager mm;
+  
+  @Test
+  public void modelBasicEJBBundleWithXML() throws Exception {
+    ModelledResource mr = null;
+    
+    ByteArrayOutputStream baos = new ByteArrayOutputStream();
+    ZipOutputStream zos = new ZipOutputStream(baos);
+    addToZip(zos, "MANIFEST_1.MF", "META-INF/MANIFEST.MF");
+    addToZip(zos, "ejb-jar.xml", "META-INF/ejb-jar.xml");
+    zos.close();
+    mr = model(baos.toByteArray());
+
+    Collection<? extends ExportedService> services = 
+      mr.getExportedServices(); 
+    
+    assertEquals("Wrong number of services", 2, services.size());
+        
+    assertTrue(services.containsAll(getXMLservices()));
+    assertTrue(Collections.disjoint(services, getAnnotatedservices()));
+  }
+  
+  @Test
+  public void testEJBJARAndAnnotatedInZip() throws Exception {
+    ModelledResource mr = null;
+    
+    ByteArrayOutputStream baos = new ByteArrayOutputStream();
+    ZipOutputStream zos = new ZipOutputStream(baos);
+    addToZip(zos, "MANIFEST_1.MF", "META-INF/MANIFEST.MF");
+    addToZip(zos, "ejb-jar.xml", "META-INF/ejb-jar.xml");
+    addToZip(zos, "beans/StatelessSessionBean.class");
+    addToZip(zos, "beans/StatefulSessionBean.class");
+    zos.close();
+    
+    mr = model(baos.toByteArray());
+
+    Collection<? extends ExportedService> services = 
+      mr.getExportedServices(); 
+    
+    assertEquals("Wrong number of services", 3, services.size());
+
+    assertTrue(services.containsAll(getXMLservices()));
+    assertTrue(services.containsAll(getAnnotatedservices()));
+  }
+  
+  @Test
+  public void testAnnotatedOnlyInZip() throws Exception {
+    ModelledResource mr = null;
+    
+    ByteArrayOutputStream baos = new ByteArrayOutputStream();
+    ZipOutputStream zos = new ZipOutputStream(baos);
+    addToZip(zos, "MANIFEST_1.MF", "META-INF/MANIFEST.MF");
+    addToZip(zos, "beans/StatelessSessionBean.class");
+    addToZip(zos, "beans/StatefulSessionBean.class");
+    zos.close();
+    
+    mr = model(baos.toByteArray());
+
+    Collection<? extends ExportedService> services = 
+      mr.getExportedServices(); 
+    
+    assertEquals("Wrong number of services", 1, services.size());
+    
+    assertTrue(Collections.disjoint(services, getXMLservices()));
+    assertTrue(services.containsAll(getAnnotatedservices()));
+  }
+  
+  @Test
+  public void testEJBJARAndAnnotatedNotOnClasspathInZip() throws Exception {
+    ModelledResource mr = null;
+    
+    ByteArrayOutputStream baos = new ByteArrayOutputStream();
+    ZipOutputStream zos = new ZipOutputStream(baos);
+    addToZip(zos, "MANIFEST_2.MF", "META-INF/MANIFEST.MF");
+    addToZip(zos, "ejb-jar.xml", "META-INF/ejb-jar.xml");
+    addToZip(zos, "beans/StatelessSessionBean.class", "no/beans/StatelessSessionBean.class");
+    addToZip(zos, "beans/StatefulSessionBean.class", "no/beans/StatefulSessionBean.class");
+    zos.close();
+    
+    mr = model(baos.toByteArray());
+
+    Collection<? extends ExportedService> services = 
+      mr.getExportedServices(); 
+    
+    assertEquals("Wrong number of services", 2, services.size());
+    
+    assertTrue(services.containsAll(getXMLservices()));
+    assertTrue(Collections.disjoint(services, getAnnotatedservices()));
+  }
+
+  @Test
+  public void testEJBJARAndAnnotatedOnClasspathInZip() throws Exception {
+    ModelledResource mr = null;
+    
+    ByteArrayOutputStream baos = new ByteArrayOutputStream();
+    ZipOutputStream zos = new ZipOutputStream(baos);
+    addToZip(zos, "MANIFEST_2.MF", "META-INF/MANIFEST.MF");
+    addToZip(zos, "ejb-jar.xml", "META-INF/ejb-jar.xml");
+    addToZip(zos, "beans/StatelessSessionBean.class", "yes/beans/StatelessSessionBean.class");
+    addToZip(zos, "beans/StatefulSessionBean.class", "yes/beans/StatefulSessionBean.class");
+    zos.close();
+    
+    mr = model(baos.toByteArray());
+
+    Collection<? extends ExportedService> services = 
+      mr.getExportedServices(); 
+    
+    assertEquals("Wrong number of services", 3, services.size());
+    
+    assertTrue(services.containsAll(getXMLservices()));
+    assertTrue(services.containsAll(getAnnotatedservices()));
+  }
+  
+  @Test
+  public void testEJBJARInWebZip() throws Exception {
+    ModelledResource mr = null;
+    
+    ByteArrayOutputStream baos = new ByteArrayOutputStream();
+    ZipOutputStream zos = new ZipOutputStream(baos);
+    addToZip(zos, "MANIFEST_3.MF", "META-INF/MANIFEST.MF");
+    addToZip(zos, "ejb-jar.xml", "WEB-INF/ejb-jar.xml");
+    zos.close();
+    
+    mr = model(baos.toByteArray());
+
+    Collection<? extends ExportedService> services = 
+      mr.getExportedServices(); 
+    
+    assertEquals("Wrong number of services", 2, services.size());
+    
+    assertTrue(services.containsAll(getXMLservices()));
+    assertTrue(Collections.disjoint(services, getAnnotatedservices()));
+  }
+
+  @Test
+  public void testEJBJARInWrongPlaceWebZip() throws Exception {
+    ModelledResource mr = null;
+    
+    ByteArrayOutputStream baos = new ByteArrayOutputStream();
+    ZipOutputStream zos = new ZipOutputStream(baos);
+    addToZip(zos, "MANIFEST_3.MF", "META-INF/MANIFEST.MF");
+    addToZip(zos, "ejb-jar.xml", "META-INF/ejb-jar.xml");
+    zos.close();
+    
+    mr = model(baos.toByteArray());
+
+    Collection<? extends ExportedService> services = 
+      mr.getExportedServices(); 
+    
+    assertEquals("Wrong number of services", 0, services.size());
+  }
+  
+  @Test
+  public void testEJBJARAndAnnotatedInWebZip() throws Exception {
+    ModelledResource mr = null;
+    
+    ByteArrayOutputStream baos = new ByteArrayOutputStream();
+    ZipOutputStream zos = new ZipOutputStream(baos);
+    addToZip(zos, "MANIFEST_3.MF", "META-INF/MANIFEST.MF");
+    addToZip(zos, "ejb-jar.xml", "WEB-INF/ejb-jar.xml");
+    addToZip(zos, "beans/StatelessSessionBean.class");
+    addToZip(zos, "beans/StatefulSessionBean.class");
+    zos.close();
+    
+    mr = model(baos.toByteArray());
+
+    Collection<? extends ExportedService> services = 
+      mr.getExportedServices(); 
+    
+    assertEquals("Wrong number of services", 3, services.size());
+    
+    assertTrue(services.containsAll(getXMLservices()));
+    assertTrue(services.containsAll(getAnnotatedservices()));
+  }
+  
+  @Test
+  public void testAnnotatedOnlyInWebZip() throws Exception {
+    ModelledResource mr = null;
+    
+    ByteArrayOutputStream baos = new ByteArrayOutputStream();
+    ZipOutputStream zos = new ZipOutputStream(baos);
+    addToZip(zos, "MANIFEST_3.MF", "META-INF/MANIFEST.MF");
+    addToZip(zos, "beans/StatelessSessionBean.class");
+    addToZip(zos, "beans/StatefulSessionBean.class");
+    zos.close();
+    
+    mr = model(baos.toByteArray());
+
+    Collection<? extends ExportedService> services = 
+      mr.getExportedServices(); 
+    
+    assertEquals("Wrong number of services", 1, services.size());
+    
+    assertTrue(Collections.disjoint(services, getXMLservices()));
+    assertTrue(services.containsAll(getAnnotatedservices()));
+  }
+  
+  @Test
+  public void testEJBJARAndAnnotatedNotOnClasspathInWebZip() throws Exception {
+    ModelledResource mr = null;
+    
+    ByteArrayOutputStream baos = new ByteArrayOutputStream();
+    ZipOutputStream zos = new ZipOutputStream(baos);
+    addToZip(zos, "MANIFEST_4.MF", "META-INF/MANIFEST.MF");
+    addToZip(zos, "ejb-jar.xml", "WEB-INF/ejb-jar.xml");
+    addToZip(zos, "beans/StatelessSessionBean.class", "no/beans/StatelessSessionBean.class");
+    addToZip(zos, "beans/StatefulSessionBean.class", "no/beans/StatefulSessionBean.class");
+    zos.close();
+    
+    mr = model(baos.toByteArray());
+
+    Collection<? extends ExportedService> services = 
+      mr.getExportedServices(); 
+    
+    assertEquals("Wrong number of services", 2, services.size());
+    
+    assertTrue(services.containsAll(getXMLservices()));
+    assertTrue(Collections.disjoint(services, getAnnotatedservices()));
+  }
+  
+  @Test
+  public void testEJBJARAndAnnotatedOnClasspathInWebZip() throws Exception {
+    ModelledResource mr = null;
+    
+    ByteArrayOutputStream baos = new ByteArrayOutputStream();
+    ZipOutputStream zos = new ZipOutputStream(baos);
+    addToZip(zos, "MANIFEST_4.MF", "META-INF/MANIFEST.MF");
+    addToZip(zos, "ejb-jar.xml", "WEB-INF/ejb-jar.xml");
+    addToZip(zos, "beans/StatelessSessionBean.class", "yes/beans/StatelessSessionBean.class");
+    addToZip(zos, "beans/StatefulSessionBean.class", "yes/beans/StatefulSessionBean.class");
+    zos.close();
+    
+    mr = model(baos.toByteArray());
+
+    Collection<? extends ExportedService> services = 
+      mr.getExportedServices(); 
+    
+    assertEquals("Wrong number of services", 3, services.size());
+    
+    assertTrue(services.containsAll(getXMLservices()));
+    assertTrue(services.containsAll(getAnnotatedservices()));
+  }
+
+  private ModelledResource model(byte[] bytes) throws ModellerException {
+    ICloseableDirectory dir = null;
+    try {
+      dir = FileSystem.getFSRoot(
+           new ByteArrayInputStream(bytes));
+      return mrm.getModelledResource(dir);
+    } finally {
+      IOUtils.close(dir);
+    }
+  }
+  
+  private Collection<ExportedService> getXMLservices() {
+    Map<String, Object> serviceProperties = new HashMap<String, Object>();
+    serviceProperties.put("ejb.name", "XML");
+    serviceProperties.put("ejb.type", "Singleton");
+    serviceProperties.put("service.exported.interfaces", "remote.Iface");
+    
+    Map<String, Object> serviceProperties2 = new HashMap<String, Object>();
+    serviceProperties2.put("ejb.name", "XML");
+    serviceProperties2.put("ejb.type", "Singleton");
+    
+    return Arrays.asList(mm.getExportedService("XML", 0, 
+        Arrays.asList("remote.Iface"), serviceProperties), mm.getExportedService(
+            "XML", 0, Arrays.asList("local.Iface"), serviceProperties2));
+  }
+  
+  private Collection<ExportedService> getAnnotatedservices() {
+    Map<String, Object> serviceProperties = new HashMap<String, Object>();
+    serviceProperties.put("ejb.name", "Annotated");
+    serviceProperties.put("ejb.type", "Stateless");
+    
+    return Arrays.asList(mm.getExportedService("Annotated", 0, 
+        Arrays.asList("beans.StatelessSessionBean"), serviceProperties));
+  }
+  
+  private void addToZip(ZipOutputStream zos, String src) throws IOException {
+    addToZip(zos, src, src);
+  }
+  
+  private void addToZip(ZipOutputStream zos, String src, String outLocation) throws IOException {
+    zos.putNextEntry(new ZipEntry(outLocation));
+    IOUtils.copy(getClass().getClassLoader().
+        getResourceAsStream(src), zos);
+    zos.closeEntry();
+  }
+}

Added: aries/trunk/ejb/ejb-modeller-itest/src/test/java/org/apache/aries/ejb/container/itest/ApplicationStandaloneModellerTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/ejb/ejb-modeller-itest/src/test/java/org/apache/aries/ejb/container/itest/ApplicationStandaloneModellerTest.java?rev=1207034&view=auto
==============================================================================
--- aries/trunk/ejb/ejb-modeller-itest/src/test/java/org/apache/aries/ejb/container/itest/ApplicationStandaloneModellerTest.java (added)
+++ aries/trunk/ejb/ejb-modeller-itest/src/test/java/org/apache/aries/ejb/container/itest/ApplicationStandaloneModellerTest.java Mon Nov 28 09:38:13 2011
@@ -0,0 +1,29 @@
+/*  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.aries.ejb.container.itest;
+
+import org.junit.Before;
+import org.apache.aries.application.modelling.impl.ModellingManagerImpl;
+import org.apache.aries.application.modelling.standalone.OfflineModellingFactory;
+
+public class ApplicationStandaloneModellerTest extends AbstractEJBModellerTest {
+
+    @Before
+    public void setup() {
+        mrm = OfflineModellingFactory.getModelledResourceManager();
+        mm = new ModellingManagerImpl();
+    }
+}

Modified: aries/trunk/ejb/ejb-modeller-itest/src/test/java/org/apache/aries/ejb/container/itest/EJBModellingTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/ejb/ejb-modeller-itest/src/test/java/org/apache/aries/ejb/container/itest/EJBModellingTest.java?rev=1207034&r1=1207033&r2=1207034&view=diff
==============================================================================
--- aries/trunk/ejb/ejb-modeller-itest/src/test/java/org/apache/aries/ejb/container/itest/EJBModellingTest.java (original)
+++ aries/trunk/ejb/ejb-modeller-itest/src/test/java/org/apache/aries/ejb/container/itest/EJBModellingTest.java Mon Nov 28 09:38:13 2011
@@ -19,354 +19,25 @@ import static org.apache.aries.itest.Ext
 import static org.apache.aries.itest.ExtraOptions.paxLogging;
 import static org.apache.aries.itest.ExtraOptions.testOptions;
 import static org.apache.aries.itest.ExtraOptions.transactionBootDelegation;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
 import static org.ops4j.pax.exam.CoreOptions.equinox;
 import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.vmOption;
 
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipOutputStream;
-
-import org.apache.aries.application.modelling.ExportedService;
-import org.apache.aries.application.modelling.ModelledResource;
 import org.apache.aries.application.modelling.ModelledResourceManager;
-import org.apache.aries.application.modelling.ModellerException;
 import org.apache.aries.application.modelling.ModellingManager;
 import org.apache.aries.application.modelling.ServiceModeller;
-import org.apache.aries.itest.AbstractIntegrationTest;
-import org.apache.aries.util.filesystem.FileSystem;
-import org.apache.aries.util.filesystem.ICloseableDirectory;
-import org.apache.aries.util.io.IOUtils;
 import org.junit.Before;
-import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.ops4j.pax.exam.Option;
 import org.ops4j.pax.exam.junit.JUnit4TestRunner;
 
 @RunWith(JUnit4TestRunner.class)
-public class EJBModellingTest extends AbstractIntegrationTest {
-
-  private ModelledResourceManager mrm;
-  private ModellingManager mm;
+public class EJBModellingTest extends AbstractEJBModellerTest {
 
   @Before
   public void setup() {
     mrm = context().getService(ModelledResourceManager.class);
     mm = context().getService(ModellingManager.class);
-  }
-  
-  @Test
-  public void modelBasicEJBBundleWithXML() throws Exception {
-    context().getService(ServiceModeller.class);
-    ModelledResource mr = null;
-    
-    ByteArrayOutputStream baos = new ByteArrayOutputStream();
-    ZipOutputStream zos = new ZipOutputStream(baos);
-    addToZip(zos, "MANIFEST_1.MF", "META-INF/MANIFEST.MF");
-    addToZip(zos, "ejb-jar.xml", "META-INF/ejb-jar.xml");
-    zos.close();
-    mr = model(baos.toByteArray());
-
-    Collection<? extends ExportedService> services = 
-      mr.getExportedServices(); 
-    
-    assertEquals("Wrong number of services", 2, services.size());
-        
-    assertTrue(services.containsAll(getXMLservices()));
-    assertTrue(Collections.disjoint(services, getAnnotatedservices()));
-  }
-  
-  @Test
-  public void testEJBJARAndAnnotatedInZip() throws Exception {
-    context().getService(ServiceModeller.class);
-    ModelledResource mr = null;
-    
-    ByteArrayOutputStream baos = new ByteArrayOutputStream();
-    ZipOutputStream zos = new ZipOutputStream(baos);
-    addToZip(zos, "MANIFEST_1.MF", "META-INF/MANIFEST.MF");
-    addToZip(zos, "ejb-jar.xml", "META-INF/ejb-jar.xml");
-    addToZip(zos, "beans/StatelessSessionBean.class");
-    addToZip(zos, "beans/StatefulSessionBean.class");
-    zos.close();
-    
-    mr = model(baos.toByteArray());
-
-    Collection<? extends ExportedService> services = 
-      mr.getExportedServices(); 
-    
-    assertEquals("Wrong number of services", 3, services.size());
-
-    assertTrue(services.containsAll(getXMLservices()));
-    assertTrue(services.containsAll(getAnnotatedservices()));
-  }
-  
-  @Test
-  public void testAnnotatedOnlyInZip() throws Exception {
-    context().getService(ServiceModeller.class);
-    ModelledResource mr = null;
-    
-    ByteArrayOutputStream baos = new ByteArrayOutputStream();
-    ZipOutputStream zos = new ZipOutputStream(baos);
-    addToZip(zos, "MANIFEST_1.MF", "META-INF/MANIFEST.MF");
-    addToZip(zos, "beans/StatelessSessionBean.class");
-    addToZip(zos, "beans/StatefulSessionBean.class");
-    zos.close();
-    
-    mr = model(baos.toByteArray());
-
-    Collection<? extends ExportedService> services = 
-      mr.getExportedServices(); 
-    
-    assertEquals("Wrong number of services", 1, services.size());
-    
-    assertTrue(Collections.disjoint(services, getXMLservices()));
-    assertTrue(services.containsAll(getAnnotatedservices()));
-  }
-  
-  @Test
-  public void testEJBJARAndAnnotatedNotOnClasspathInZip() throws Exception {
-
-    context().getService(ServiceModeller.class);
-    ModelledResource mr = null;
-    
-    ByteArrayOutputStream baos = new ByteArrayOutputStream();
-    ZipOutputStream zos = new ZipOutputStream(baos);
-    addToZip(zos, "MANIFEST_2.MF", "META-INF/MANIFEST.MF");
-    addToZip(zos, "ejb-jar.xml", "META-INF/ejb-jar.xml");
-    addToZip(zos, "beans/StatelessSessionBean.class", "no/beans/StatelessSessionBean.class");
-    addToZip(zos, "beans/StatefulSessionBean.class", "no/beans/StatefulSessionBean.class");
-    zos.close();
-    
-    mr = model(baos.toByteArray());
-
-    Collection<? extends ExportedService> services = 
-      mr.getExportedServices(); 
-    
-    assertEquals("Wrong number of services", 2, services.size());
-    
-    assertTrue(services.containsAll(getXMLservices()));
-    assertTrue(Collections.disjoint(services, getAnnotatedservices()));
-  }
-
-  @Test
-  public void testEJBJARAndAnnotatedOnClasspathInZip() throws Exception {
-
-    context().getService(ServiceModeller.class);
-    ModelledResource mr = null;
-    
-    ByteArrayOutputStream baos = new ByteArrayOutputStream();
-    ZipOutputStream zos = new ZipOutputStream(baos);
-    addToZip(zos, "MANIFEST_2.MF", "META-INF/MANIFEST.MF");
-    addToZip(zos, "ejb-jar.xml", "META-INF/ejb-jar.xml");
-    addToZip(zos, "beans/StatelessSessionBean.class", "yes/beans/StatelessSessionBean.class");
-    addToZip(zos, "beans/StatefulSessionBean.class", "yes/beans/StatefulSessionBean.class");
-    zos.close();
-    
-    mr = model(baos.toByteArray());
-
-    Collection<? extends ExportedService> services = 
-      mr.getExportedServices(); 
-    
-    assertEquals("Wrong number of services", 3, services.size());
-    
-    assertTrue(services.containsAll(getXMLservices()));
-    assertTrue(services.containsAll(getAnnotatedservices()));
-  }
-  
-  @Test
-  public void testEJBJARInWebZip() throws Exception {
-
-    context().getService(ServiceModeller.class);
-    ModelledResource mr = null;
-    
-    ByteArrayOutputStream baos = new ByteArrayOutputStream();
-    ZipOutputStream zos = new ZipOutputStream(baos);
-    addToZip(zos, "MANIFEST_3.MF", "META-INF/MANIFEST.MF");
-    addToZip(zos, "ejb-jar.xml", "WEB-INF/ejb-jar.xml");
-    zos.close();
-    
-    mr = model(baos.toByteArray());
-
-    Collection<? extends ExportedService> services = 
-      mr.getExportedServices(); 
-    
-    assertEquals("Wrong number of services", 2, services.size());
-    
-    assertTrue(services.containsAll(getXMLservices()));
-    assertTrue(Collections.disjoint(services, getAnnotatedservices()));
-  }
-
-  @Test
-  public void testEJBJARInWrongPlaceWebZip() throws Exception {
-
-    context().getService(ServiceModeller.class);
-    ModelledResource mr = null;
-    
-    ByteArrayOutputStream baos = new ByteArrayOutputStream();
-    ZipOutputStream zos = new ZipOutputStream(baos);
-    addToZip(zos, "MANIFEST_3.MF", "META-INF/MANIFEST.MF");
-    addToZip(zos, "ejb-jar.xml", "META-INF/ejb-jar.xml");
-    zos.close();
-    
-    mr = model(baos.toByteArray());
-
-    Collection<? extends ExportedService> services = 
-      mr.getExportedServices(); 
-    
-    assertEquals("Wrong number of services", 0, services.size());
-  }
-  
-  @Test
-  public void testEJBJARAndAnnotatedInWebZip() throws Exception {
-
-    context().getService(ServiceModeller.class);
-    ModelledResource mr = null;
-    
-    ByteArrayOutputStream baos = new ByteArrayOutputStream();
-    ZipOutputStream zos = new ZipOutputStream(baos);
-    addToZip(zos, "MANIFEST_3.MF", "META-INF/MANIFEST.MF");
-    addToZip(zos, "ejb-jar.xml", "WEB-INF/ejb-jar.xml");
-    addToZip(zos, "beans/StatelessSessionBean.class");
-    addToZip(zos, "beans/StatefulSessionBean.class");
-    zos.close();
-    
-    mr = model(baos.toByteArray());
-
-    Collection<? extends ExportedService> services = 
-      mr.getExportedServices(); 
-    
-    assertEquals("Wrong number of services", 3, services.size());
-    
-    assertTrue(services.containsAll(getXMLservices()));
-    assertTrue(services.containsAll(getAnnotatedservices()));
-  }
-  
-  @Test
-  public void testAnnotatedOnlyInWebZip() throws Exception {
-
-    context().getService(ServiceModeller.class);
-    ModelledResource mr = null;
-    
-    ByteArrayOutputStream baos = new ByteArrayOutputStream();
-    ZipOutputStream zos = new ZipOutputStream(baos);
-    addToZip(zos, "MANIFEST_3.MF", "META-INF/MANIFEST.MF");
-    addToZip(zos, "beans/StatelessSessionBean.class");
-    addToZip(zos, "beans/StatefulSessionBean.class");
-    zos.close();
-    
-    mr = model(baos.toByteArray());
-
-    Collection<? extends ExportedService> services = 
-      mr.getExportedServices(); 
-    
-    assertEquals("Wrong number of services", 1, services.size());
-    
-    assertTrue(Collections.disjoint(services, getXMLservices()));
-    assertTrue(services.containsAll(getAnnotatedservices()));
-  }
-  
-  @Test
-  public void testEJBJARAndAnnotatedNotOnClasspathInWebZip() throws Exception {
-
     context().getService(ServiceModeller.class);
-    ModelledResource mr = null;
-    
-    ByteArrayOutputStream baos = new ByteArrayOutputStream();
-    ZipOutputStream zos = new ZipOutputStream(baos);
-    addToZip(zos, "MANIFEST_4.MF", "META-INF/MANIFEST.MF");
-    addToZip(zos, "ejb-jar.xml", "WEB-INF/ejb-jar.xml");
-    addToZip(zos, "beans/StatelessSessionBean.class", "no/beans/StatelessSessionBean.class");
-    addToZip(zos, "beans/StatefulSessionBean.class", "no/beans/StatefulSessionBean.class");
-    zos.close();
-    
-    mr = model(baos.toByteArray());
-
-    Collection<? extends ExportedService> services = 
-      mr.getExportedServices(); 
-    
-    assertEquals("Wrong number of services", 2, services.size());
-    
-    assertTrue(services.containsAll(getXMLservices()));
-    assertTrue(Collections.disjoint(services, getAnnotatedservices()));
-  }
-  
-  @Test
-  public void testEJBJARAndAnnotatedOnClasspathInWebZip() throws Exception {
-
-    context().getService(ServiceModeller.class);
-    ModelledResource mr = null;
-    
-    ByteArrayOutputStream baos = new ByteArrayOutputStream();
-    ZipOutputStream zos = new ZipOutputStream(baos);
-    addToZip(zos, "MANIFEST_4.MF", "META-INF/MANIFEST.MF");
-    addToZip(zos, "ejb-jar.xml", "WEB-INF/ejb-jar.xml");
-    addToZip(zos, "beans/StatelessSessionBean.class", "yes/beans/StatelessSessionBean.class");
-    addToZip(zos, "beans/StatefulSessionBean.class", "yes/beans/StatefulSessionBean.class");
-    zos.close();
-    
-    mr = model(baos.toByteArray());
-
-    Collection<? extends ExportedService> services = 
-      mr.getExportedServices(); 
-    
-    assertEquals("Wrong number of services", 3, services.size());
-    
-    assertTrue(services.containsAll(getXMLservices()));
-    assertTrue(services.containsAll(getAnnotatedservices()));
-  }
-
-  private ModelledResource model(byte[] bytes) throws ModellerException {
-    ICloseableDirectory dir = null;
-    try {
-      dir = FileSystem.getFSRoot(
-           new ByteArrayInputStream(bytes));
-      return mrm.getModelledResource(dir);
-    } finally {
-      IOUtils.close(dir);
-    }
-  }
-  
-  private Collection<ExportedService> getXMLservices() {
-    Map<String, Object> serviceProperties = new HashMap<String, Object>();
-    serviceProperties.put("ejb.name", "XML");
-    serviceProperties.put("ejb.type", "Singleton");
-    serviceProperties.put("service.exported.interfaces", "remote.Iface");
-    
-    Map<String, Object> serviceProperties2 = new HashMap<String, Object>();
-    serviceProperties2.put("ejb.name", "XML");
-    serviceProperties2.put("ejb.type", "Singleton");
-    
-    return Arrays.asList(mm.getExportedService("XML", 0, 
-        Arrays.asList("remote.Iface"), serviceProperties), mm.getExportedService(
-            "XML", 0, Arrays.asList("local.Iface"), serviceProperties2));
-  }
-  
-  private Collection<ExportedService> getAnnotatedservices() {
-    Map<String, Object> serviceProperties = new HashMap<String, Object>();
-    serviceProperties.put("ejb.name", "Annotated");
-    serviceProperties.put("ejb.type", "Stateless");
-    
-    return Arrays.asList(mm.getExportedService("Annotated", 0, 
-        Arrays.asList("beans.StatelessSessionBean"), serviceProperties));
-  }
-  
-  private void addToZip(ZipOutputStream zos, String src) throws IOException {
-    addToZip(zos, src, src);
-  }
-  
-  private void addToZip(ZipOutputStream zos, String src, String outLocation) throws IOException {
-    zos.putNextEntry(new ZipEntry(outLocation));
-    IOUtils.copy(getClass().getClassLoader().
-        getResourceAsStream(src), zos);
-    zos.closeEntry();
   }
 
   @org.ops4j.pax.exam.junit.Configuration