All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.arch.util.GenerateWarUtils Maven / Gradle / Ivy

//package com.arch.util;
//
//
//import org.jboss.shrinkwrap.api.ShrinkWrap;
//import org.jboss.shrinkwrap.api.asset.EmptyAsset;
//import org.jboss.shrinkwrap.api.spec.WebArchive;
//import org.jboss.shrinkwrap.resolver.api.maven.Maven;
//
//import javax.enterprise.inject.Vetoed;
//import java.io.File;
//
//@Vetoed
//public final class GenerateWarUtils {
//
//    private GenerateWarUtils() {
//
//    }
//
//    public static WebArchive generate(Class clazzTest, Package packageTest) {
//        return generate(clazzTest, packageTest, null);
//    }
//
//    public static WebArchive generate(Class clazzTest, String packageTestStr) {
//        return generate(clazzTest, null, packageTestStr);
//    }
//
//    private static WebArchive generate(Class clazzTest, Package packageTest, String packageTestStr) {
//        String pastaRaiz = clazzTest.getResource("/").getPath().concat("../../");
//        LogUtils.warning("Pasta Atual: " + pastaRaiz);
//
//        File[] files = Maven
//                .resolver()
//                .loadPomFromFile(pastaRaiz + "pom.xml")
//                .importRuntimeDependencies()
//                .resolve()
//                .withTransitivity()
//                .asFile();
//
//        WebArchive deploy = ShrinkWrap
//                .create(WebArchive.class)
//                .addAsLibraries(files)
//                .addAsWebInfResource(new File(pastaRaiz + "src/main/webapp/WEB-INF/web.xml"), "web.xml")
//                .addAsResource(new File(pastaRaiz + "src/test/resources/META-INF/persistence-teste.xml"), "META-INF/persistence.xml")
//                .addAsResource(new File(pastaRaiz + "src/test/resources/META-INF/create-objects.sql"), "META-INF/create-objects.sql")
//                .addAsResource(new File(pastaRaiz + "src/test/resources/META-INF/drop-objects.sql"), "META-INF/drop-objects.sql")
//                .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
//                .addAsWebResource(new File(pastaRaiz + "src/main/webapp", "*"));
//
//        File bundle = new File(pastaRaiz + "src/main/resources/bundle/bundle_pt_BR.properties");
//
//        if (bundle.exists()) {
//            deploy = deploy.addAsResource(bundle, "bundle/bundle_pt_BR.properties");
//        }
//
//        File jbossWebXml = new File(pastaRaiz + "src/main/webapp/WEB-INF/jboss-web.xml");
//
//        if (jbossWebXml.exists()) {
//            deploy = deploy.addAsWebInfResource(jbossWebXml, "jboss-web.xml");
//        }
//
//        if (packageTest != null) {
//            deploy = deploy.addPackages(true, packageTest);
//        }
//
//        if (packageTestStr != null) {
//            deploy = deploy.addPackages(true, packageTestStr);
//        }
//
//        return deploy;
//    }
//}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy