Search in sources :

Example 36 with ModelledResource

use of org.apache.aries.application.modelling.ModelledResource in project aries by apache.

the class AbstractEJBModellerTest method testEJBJARAndAnnotatedInWebZip.

@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()));
}
Also used : ZipOutputStream(java.util.zip.ZipOutputStream) ByteArrayOutputStream(java.io.ByteArrayOutputStream) ModelledResource(org.apache.aries.application.modelling.ModelledResource) Test(org.junit.Test) AbstractIntegrationTest(org.apache.aries.itest.AbstractIntegrationTest)

Example 37 with ModelledResource

use of org.apache.aries.application.modelling.ModelledResource in project aries by apache.

the class AbstractEJBModellerTest method testEJBJARAndAnnotatedInZip.

@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()));
}
Also used : ZipOutputStream(java.util.zip.ZipOutputStream) ByteArrayOutputStream(java.io.ByteArrayOutputStream) ModelledResource(org.apache.aries.application.modelling.ModelledResource) Test(org.junit.Test) AbstractIntegrationTest(org.apache.aries.itest.AbstractIntegrationTest)

Example 38 with ModelledResource

use of org.apache.aries.application.modelling.ModelledResource in project aries by apache.

the class AbstractEJBModellerTest method testEJBJARInWebZip.

@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()));
}
Also used : ZipOutputStream(java.util.zip.ZipOutputStream) ByteArrayOutputStream(java.io.ByteArrayOutputStream) ModelledResource(org.apache.aries.application.modelling.ModelledResource) Test(org.junit.Test) AbstractIntegrationTest(org.apache.aries.itest.AbstractIntegrationTest)

Example 39 with ModelledResource

use of org.apache.aries.application.modelling.ModelledResource in project aries by apache.

the class AbstractEJBModellerTest method testAnnotatedOnlyInZip.

@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()));
}
Also used : ZipOutputStream(java.util.zip.ZipOutputStream) ByteArrayOutputStream(java.io.ByteArrayOutputStream) ModelledResource(org.apache.aries.application.modelling.ModelledResource) Test(org.junit.Test) AbstractIntegrationTest(org.apache.aries.itest.AbstractIntegrationTest)

Example 40 with ModelledResource

use of org.apache.aries.application.modelling.ModelledResource in project aries by apache.

the class AbstractEJBModellerTest method testEJBJARInWrongPlaceWebZip.

@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());
}
Also used : ZipOutputStream(java.util.zip.ZipOutputStream) ByteArrayOutputStream(java.io.ByteArrayOutputStream) ModelledResource(org.apache.aries.application.modelling.ModelledResource) Test(org.junit.Test) AbstractIntegrationTest(org.apache.aries.itest.AbstractIntegrationTest)

Aggregations

ModelledResource (org.apache.aries.application.modelling.ModelledResource)41 Test (org.junit.Test)21 ArrayList (java.util.ArrayList)16 ByteArrayOutputStream (java.io.ByteArrayOutputStream)11 ZipOutputStream (java.util.zip.ZipOutputStream)11 ResolverException (org.apache.aries.application.management.ResolverException)11 AbstractIntegrationTest (org.apache.aries.itest.AbstractIntegrationTest)11 DeployedBundles (org.apache.aries.application.modelling.DeployedBundles)10 File (java.io.File)8 Content (org.apache.aries.application.Content)8 ApplicationMetadata (org.apache.aries.application.ApplicationMetadata)7 FileOutputStream (java.io.FileOutputStream)6 HashSet (java.util.HashSet)6 MethodCall (org.apache.aries.unittest.mocks.MethodCall)6 Manifest (java.util.jar.Manifest)5 AriesApplication (org.apache.aries.application.management.AriesApplication)5 ExportedPackage (org.apache.aries.application.modelling.ExportedPackage)5 HashMap (java.util.HashMap)4 Attributes (java.util.jar.Attributes)4 InvalidAttributeException (org.apache.aries.application.InvalidAttributeException)4