Package org.jboss.shrinkwrap.api.asset

Examples of org.jboss.shrinkwrap.api.asset.ByteArrayAsset


        war.addAsLibraries(libJar);

        EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class);
        ear.addAsModule(war);
        JavaArchive earLib = ShrinkWrap.create(JavaArchive.class, "earLib.jar");
        earLib.addAsManifestResource(new ByteArrayAsset("Class-Path: ../cp1.jar\n".getBytes()), "MANIFEST.MF");
        ear.addAsLibraries(earLib);

        earLib = ShrinkWrap.create(JavaArchive.class, "cp1.jar");
        earLib.addAsManifestResource(new ByteArrayAsset("Class-Path: cp2.jar\n".getBytes()), "MANIFEST.MF");
        ear.addAsModule(earLib);

        earLib = ShrinkWrap.create(JavaArchive.class, "cp2.jar");
        earLib.addAsManifestResource(new ByteArrayAsset("Class-Path: a/b/c\n".getBytes()), "MANIFEST.MF");
        earLib.addClass(TestBB.class);
        ear.addAsModule(earLib);

        ear.add(new StringAsset("Hello World"), "a/b/c", "testfile.file");
View Full Code Here


        war.addAsLibraries(libJar);

        EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class);
        ear.addAsModule(war);
        JavaArchive earLib = ShrinkWrap.create(JavaArchive.class, "earLib.jar");
        earLib.addAsManifestResource(new ByteArrayAsset("Class-Path: ../cp1.jar\n".getBytes()), "MANIFEST.MF");
        ear.addAsLibraries(earLib);

        earLib = ShrinkWrap.create(JavaArchive.class, "cp1.jar");
        earLib.addAsManifestResource(new ByteArrayAsset("Class-Path: cp2.jar\n".getBytes()), "MANIFEST.MF");
        ear.addAsModule(earLib);

        earLib = ShrinkWrap.create(JavaArchive.class, "cp2.jar");
        earLib.addClass(TestBB.class);
        ear.addAsModule(earLib);
View Full Code Here

    @Deployment
    public static Archive<?> deploy() {
        WebArchive war = ShrinkWrap.create(WebArchive.class);
        JavaArchive libJar = ShrinkWrap.create(JavaArchive.class);
        libJar.addClasses(TestAA.class, EarClassPath3TestCase.class);
        libJar.addAsManifestResource(new ByteArrayAsset("Class-Path: ../../../cp.jar\n".getBytes()), "MANIFEST.MF");
        war.addAsLibraries(libJar);

        EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class);
        ear.addAsModule(war);
        JavaArchive earLib = ShrinkWrap.create(JavaArchive.class, "cp.jar");
View Full Code Here

        }
        Index index = indexer.complete();
        ByteArrayOutputStream data = new ByteArrayOutputStream();
        IndexWriter writer = new IndexWriter(data);
        writer.write(index);
        jar.addAsManifestResource(new ByteArrayAsset(data.toByteArray()), "jandex.idx");
        FileOutputStream jarFile = new FileOutputStream(new File(file, "weldTest.jar"));
        try {
            jar.as(ZipExporter.class).exportTo(jarFile);
        } finally {
            jarFile.flush();
View Full Code Here

            indexer.index(cl.getResourceAsStream(GlobalModuleInterceptor.class.getName().replace(".", "/") + ".class"));
            final Index index = indexer.complete();
            final ByteArrayOutputStream out = new ByteArrayOutputStream();
            IndexWriter writer = new IndexWriter(out);
            writer.write(index);
            jar.addAsManifestResource(new ByteArrayAsset(out.toByteArray()), "jandex.idx");


            FileOutputStream jarFile = new FileOutputStream(new File(file, "globalTest.jar"));
            try {
                jar.as(ZipExporter.class).exportTo(jarFile);
View Full Code Here

   }


   private void addPersistenceConfigurationSerializedAsProperties(final JavaArchive archiveToExtend)
   {
      archiveToExtend.addAsResource(new ByteArrayAsset(exportPersistenceConfigurationAsProperties().toByteArray()), persistenceConfigurationInstance.get().getPrefix() + "properties");
   }
View Full Code Here

   private void addDBUnitConfigurationSerializedAsProperties(final JavaArchive archiveToExtend)
   {
      final DBUnitConfiguration dbUnitConfigurationPrototype = new DBUnitConfiguration();
      final Map<String, String> extensionProperties = extractExtensionProperties(arquillianDescriptorInstance.get(), dbUnitConfigurationPrototype.getQualifier());
      final ByteArrayOutputStream properties = new PropertiesSerializer(dbUnitConfigurationPrototype.getPrefix()).serializeToProperties(extensionProperties);
      archiveToExtend.addAsResource(new ByteArrayAsset(properties.toByteArray()), new DBUnitConfiguration().getPrefix() + "properties");
   }
View Full Code Here

    public static WebArchive deployment() {
        StringBuilder listeners = new StringBuilder();
        listeners.append(toListener(BatRequestListener.class.getName()));
        listeners.append(toListener(BatSessionListener.class.getName()));
        listeners.append(toListener(BatServletContextListener.class.getName()));
        Asset webXml = new ByteArrayAsset(
                extendDefaultWebXml(
                        listeners.toString()
                                + "<servlet><servlet-name>Bat Servlet</servlet-name><servlet-class>"
                                + BatServlet.class.getName()
                                + "</servlet-class></servlet> <servlet-mapping><servlet-name>Bat Servlet</servlet-name><url-pattern>/bat</url-pattern></servlet-mapping>")
View Full Code Here

    public static final String BEANS_XML_FOOTER = "</beans>";

    public static Asset createBeansXml(String str) {
        String xml = BEANS_XML_HEADER + str + BEANS_XML_FOOTER;
        return new ByteArrayAsset(xml.getBytes());
    }
View Full Code Here

    public static WebArchive deployment() {
        return ShrinkWrap.create(WebArchive.class, "test.war")
                .addPackage(JsfTest.class.getPackage())
                .addAsWebInfResource(JsfTest.class.getPackage(), "faces-config.xml", "faces-config.xml")
                .addAsWebInfResource(JsfTest.class.getPackage(), "web.xml", "web.xml")
                .addAsWebInfResource(new ByteArrayAsset(new byte[0]), "beans.xml");
    }
View Full Code Here

TOP

Related Classes of org.jboss.shrinkwrap.api.asset.ByteArrayAsset

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.