org.jboss.shrinkwrap.resolver.api.maven.Maven Java Examples

The following examples show how to use org.jboss.shrinkwrap.resolver.api.maven.Maven. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ArchiveProcessor.java    From smallrye-metrics with Apache License 2.0 7 votes vote down vote up
@Override
public void process(TestDeployment testDeployment, Archive<?> protocolArchive) {
    WebArchive war = (WebArchive) protocolArchive;
    war.addAsWebInfResource("WEB-INF/jboss-web.xml", "jboss-web.xml");
    String[] deps = {
            "io.smallrye:smallrye-config",
            "io.smallrye:smallrye-metrics",
            "io.smallrye:smallrye-metrics-testsuite-common",
            "org.eclipse.microprofile.metrics:microprofile-metrics-api",
            "org.jboss.weld.servlet:weld-servlet-core"
    };

    File[] dependencies = Maven.resolver().loadPomFromFile(new File("pom.xml")).resolve(deps).withTransitivity().asFile();

    war.addAsLibraries(dependencies);

    war.addClass(SmallRyeBeanArchiveHandler.class);
    war.addClass(MetricsHttpServlet.class);
    war.addClass(MetricsInitializer.class);
    war.addAsResource("io/smallrye/metrics/base-metrics.properties", "/io/smallrye/metrics/base-metrics.properties");
    war.addAsServiceProvider(BeanArchiveHandler.class, SmallRyeBeanArchiveHandler.class);
    war.addAsServiceProvider(Extension.class, ConfigExtension.class);
    war.addAsServiceProvider(ConfigProviderResolver.class, SmallRyeConfigProviderResolver.class);
}
 
Example #2
Source File: ScopeNotStartedTest.java    From deltaspike with Apache License 2.0 6 votes vote down vote up
@Deployment
public static WebArchive deploy()
{
    String simpleName = ScopeNotStartedTest.class.getSimpleName();
    String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);

    JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, "scopeNotStartedTest.jar")
            .addPackage(CustomSchedulerWarFileTest.class.getPackage().getName())
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
            .addAsResource(new StringAsset(MockedScheduler.class.getName()),
                    "META-INF/services/" + Scheduler.class.getName())
            .addAsResource(new StringAsset(CustomDeactivatedConfigSource.class.getName()),
                    "META-INF/services/" + ConfigSource.class.getName());

    return ShrinkWrap.create(WebArchive.class, archiveName + ".war")
            .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndSchedulerArchive())
            .addAsLibraries(ArchiveUtils.getContextControlForDeployment())
            .addAsLibraries(Maven.resolver().loadPomFromFile("pom.xml").resolve(
                    "org.quartz-scheduler:quartz")
                    .withTransitivity()
                    .asFile())
            .addAsLibraries(testJar)
            .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
}
 
Example #3
Source File: Deployments.java    From javaee7-petclinic with GNU General Public License v2.0 6 votes vote down vote up
public static WebArchive createPetTypeDeployment() {
    File[] deps = Maven.resolver().loadPomFromFile("pom.xml").importRuntimeDependencies().resolve().withTransitivity().asFile();
    return ShrinkWrap.create(WebArchive.class, "pettypes.war")
            .addClasses(PetTypeController.class, LanguageBean.class,
                    PetTypeDao.class, PetTypeDaoImpl.class,
                    Owner.class, Pet.class, PetType.class,
                    Specialty.class, Vet.class, Visit.class)
            .merge(ShrinkWrap.create(GenericArchive.class).as(ExplodedImporter.class)
                    .importDirectory(WEBAPP_SRC).as(GenericArchive.class),
                    "/", Filters.include(".*\\.xhtml$|.*\\.html$"))
            .addAsResource("META-INF/persistence.xml")
            .addAsResource("messages_de.properties")
            .addAsResource("messages_en.properties")
            .addAsLibraries(deps)
            .addAsWebInfResource(
                    new StringAsset("<faces-config version=\"2.2\"/>"),
                    "faces-config.xml");
}
 
Example #4
Source File: Enrichers.java    From tomee with Apache License 2.0 6 votes vote down vote up
public static File[] resolve(final String pom) {
    if (!CACHE.containsKey(pom)) {
        try {

            // try offline first since it is generally faster
            CACHE.put(pom, Maven.resolver()
                    .offline(true)
                    .loadPomFromFile(pom)
                    .importCompileAndRuntimeDependencies().resolve().withTransitivity()
                    .asFile());
        } catch (ResolutionException re) { // try on central
            CACHE.put(pom, Maven.resolver()
                    .loadPomFromFile(pom)
                    .importCompileAndRuntimeDependencies().resolve().withTransitivity()
                    .asFile());
        }
    }
    return CACHE.get(pom);
}
 
Example #5
Source File: Deployments.java    From javaee7-petclinic with GNU General Public License v2.0 6 votes vote down vote up
public static WebArchive createSpecialtiesDeployment() {
    File[] deps = Maven.resolver().loadPomFromFile("pom.xml").importRuntimeDependencies().resolve().withTransitivity().asFile();
    WebArchive war = null;
    try {
        war = ShrinkWrap.create(WebArchive.class, "specialties.war")
            .addClasses(SpecialtyController.class, LanguageBean.class,
                    SpecialtyDao.class, SpecialtyDaoImpl.class,
                    Owner.class, Pet.class, PetType.class,
                    Specialty.class, Vet.class, Visit.class)
            .merge(ShrinkWrap.create(GenericArchive.class).as(ExplodedImporter.class)
                    .importDirectory(WEBAPP_SRC).as(GenericArchive.class),
                    "/", Filters.include(".*\\.xhtml$|.*\\.html$"))
            .addAsResource("META-INF/persistence.xml")
            .addAsResource("messages_de.properties")
            .addAsResource("messages_en.properties")
            .addAsLibraries(deps)
            .addAsWebInfResource(
                    new StringAsset("<faces-config version=\"2.2\"/>"),
                    "faces-config.xml");
    } catch (Exception e) {
        e.printStackTrace();
    }
    return war;
}
 
Example #6
Source File: SmallRyeGraphQLArchiveProcessor.java    From smallrye-graphql with Apache License 2.0 6 votes vote down vote up
@Override
public void process(Archive<?> applicationArchive, TestClass testClass) {

    if (applicationArchive instanceof WebArchive) {
        WebArchive testDeployment = (WebArchive) applicationArchive;

        final File[] dependencies = Maven.resolver()
                .loadPomFromFile("pom.xml")
                .resolve("io.smallrye:smallrye-graphql-servlet")
                .withTransitivity()
                .asFile();
        // Make sure it's unique
        Set<File> dependenciesSet = new LinkedHashSet<>(Arrays.asList(dependencies));
        testDeployment.addAsLibraries(dependenciesSet.toArray(new File[] {}));
    }
}
 
Example #7
Source File: CountedMethodScheduledBeanTest.java    From metrics-cdi with Apache License 2.0 6 votes vote down vote up
@Deployment
public static Archive<?> createTestArchive() {
    return ShrinkWrap.create(EnterpriseArchive.class)
        .addAsLibraries(
            Maven.configureResolver()
                .workOffline()
                .loadPomFromFile("pom.xml")
                .resolve("io.astefanutti.metrics.cdi:metrics-cdi")
                .withTransitivity()
                .as(JavaArchive.class))
        .addAsModule(
            ShrinkWrap.create(JavaArchive.class)
                .addClass(CountedMethodScheduledBean.class)
                .addClass(CallCounter.class)
                // FIXME: Test class must be added until ARQ-659 is fixed
                .addClass(CountedMethodScheduledBeanTest.class)
                .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml"));
}
 
Example #8
Source File: SmallRyeHealthArchiveProcessor.java    From smallrye-health with Apache License 2.0 6 votes vote down vote up
@Override
public void process(Archive<?> applicationArchive, TestClass testClass) {
    if (applicationArchive instanceof WebArchive) {
        WebArchive testDeployment = (WebArchive) applicationArchive;
        // Register SmallRyeBeanArchiveHandler using the ServiceLoader mechanism
        testDeployment.addClass(SmallRyeBeanArchiveHandler.class);
        testDeployment.addAsServiceProvider(BeanArchiveHandler.class, SmallRyeBeanArchiveHandler.class);

        String[] deps = {
                "io.smallrye:smallrye-health",
                "io.smallrye.config:smallrye-config",
                "io.smallrye:smallrye-health-tck",
                "org.eclipse.microprofile.health:microprofile-health-tck",
                "org.jboss.weld.servlet:weld-servlet-core" };

        File[] dependencies = Maven.resolver().loadPomFromFile(new File("pom.xml")).resolve(deps).withTransitivity()
                .asFile();

        testDeployment.addAsLibraries(dependencies);
    }
}
 
Example #9
Source File: MVCTest.java    From tomee with Apache License 2.0 6 votes vote down vote up
@Deployment
public static WebArchive createDeployment() {
    File[] files = Maven.resolver()
                        .loadPomFromFile("pom.xml")
                        .importRuntimeDependencies()
                        .resolve()
                        .withTransitivity()
                        .asFile();

    return ShrinkWrap.create(WebArchive.class, "test.war")
                     .addPackages(true, "org.superbiz.mvc")
                     .addAsLibraries(files)
                     .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
                     .addAsWebInfResource(new File("src/main/webapp/WEB-INF/web.xml"), "/web.xml")
                     .addAsWebInfResource(new File("src/main/webapp/WEB-INF/views/hello.jsp"), "/views/hello.jsp");
}
 
Example #10
Source File: KeycloakDependenciesResolver.java    From keycloak with Apache License 2.0 6 votes vote down vote up
public static File[] resolveDependencies(String canonicalForm) {
    if (dependencies.containsKey(canonicalForm)) {
        return dependencies.get(canonicalForm);
    }

    log.info("Resolving " + canonicalForm + "'s dependencies");
    PomEquippedResolveStage resolver = Maven.configureResolverViaPlugin();

    File[] files = resolver.addDependency(MavenDependencies.createDependency(canonicalForm, ScopeType.COMPILE, false))
            .resolve().withTransitivity().asFile();

    dependencies.put(canonicalForm, files);

    log.info("Resolving dependencies is finished with " + files.length + " files");

    return dependencies.get(canonicalForm);
}
 
Example #11
Source File: TimedMethodWithElNameBeanTest.java    From metrics-cdi with Apache License 2.0 6 votes vote down vote up
@Deployment
public static Archive<?> createTestArchive() {
    return ShrinkWrap.create(EnterpriseArchive.class)
        .addAsLibraries(
            Maven.configureResolver()
                .workOffline()
                .loadPomFromFile("pom.xml")
                .resolve("io.astefanutti.metrics.cdi:metrics-cdi")
                .withTransitivity()
                .as(JavaArchive.class))
        .addAsLibrary(
            ShrinkWrap.create(JavaArchive.class)
                .addClass(TimedMethodWithElNameBean.class)
                .addClass(TimerIdBean.class)
                // FIXME: Test class must be added until ARQ-659 is fixed
                .addClass(TimedMethodWithElNameBeanTest.class)
                .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml"));
}
 
Example #12
Source File: TaskanaWildflyTest.java    From taskana with Apache License 2.0 6 votes vote down vote up
@Deployment(testable = false)
public static Archive<?> createTestArchive() {

  File[] files =
      Maven.resolver()
          .loadPomFromFile("pom.xml")
          .importRuntimeDependencies()
          .resolve()
          .withTransitivity()
          .asFile();

  return ShrinkWrap.create(WebArchive.class, "taskana.war")
      .addPackages(true, "pro.taskana")
      .addAsResource("taskana.properties")
      .addAsResource("application.properties")
      .addAsResource("project-defaults.yml")
      .addAsLibraries(files);
}
 
Example #13
Source File: Resolver.java    From arquillian-container-chameleon with Apache License 2.0 6 votes vote down vote up
public static File[] resolve(File cacheFolder, MavenDependency[] dependencies) {
    String hash = hash(dependencies);
    File[] files;

    File cacheFile = getCacheFile(cacheFolder, hash);
    if (cacheFile.exists()) {
        files = readCache(cacheFile);
    } else {
        files = Maven.configureResolver()
            .addDependencies(dependencies)
            .resolve()
            .withTransitivity()
            .asFile();

        writeCache(getCacheFile(cacheFolder, hash), files);
    }
    return files;
}
 
Example #14
Source File: MasterRegistrationControlEntryManagerTest.java    From joynr with Apache License 2.0 6 votes vote down vote up
@Deployment
public static WebArchive createArchive() {
    File[] files = Maven.resolver()
                        .loadPomFromFile("pom.xml")
                        .importRuntimeDependencies()
                        .resolve()
                        .withTransitivity()
                        .asFile();
    return ShrinkWrap.create(WebArchive.class)
                     .addClasses(EntityManagerProducer.class,
                                 DomainRoleEntryEntity.class,
                                 DomainRoleEntryManager.class,
                                 MasterRegistrationControlEntryEntity.class,
                                 MasterRegistrationControlEntryManager.class,
                                 JoynrConfigurationProvider.class)
                     .addAsLibraries(files)
                     .addAsResource("test-persistence.xml", "META-INF/persistence.xml")
                     .addAsWebInfResource(new File("src/main/webapp/WEB-INF/beans.xml"));
}
 
Example #15
Source File: TimerFieldWithElNameBeanTest.java    From metrics-cdi with Apache License 2.0 6 votes vote down vote up
@Deployment
public static Archive<?> createTestArchive() {
    return ShrinkWrap.create(EnterpriseArchive.class)
        .addAsLibraries(
            Maven.configureResolver()
                .workOffline()
                .loadPomFromFile("pom.xml")
                .resolve("io.astefanutti.metrics.cdi:metrics-cdi")
                .withTransitivity()
                .as(JavaArchive.class))
        .addAsLibrary(
            ShrinkWrap.create(JavaArchive.class)
                .addClass(TimerFieldWithElNameBean.class)
                .addClass(TimerIdBean.class)
                // FIXME: Test class must be added until ARQ-659 is fixed
                .addClass(TimerFieldWithElNameBeanTest.class)
                .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml"));
}
 
Example #16
Source File: ElasticsearchIntegrationTest.java    From wildfly-camel with Apache License 2.0 6 votes vote down vote up
@Deployment(order = 1, testable = false, name = "elasticsearch-server.war")
public static WebArchive createElasticSearchServerDeployment() {
    File[] files = Maven.configureResolverViaPlugin()
        .resolve("org.elasticsearch.plugin:transport-netty4-client")
        .withoutTransitivity()
        .asFile();

    return ShrinkWrap.create(WebArchive.class, "elasticsearch-server.war")
        .addClasses(FileUtils.class, AvailablePortFinder.class, ElasticsearchServerServlet.class)
        .addAsLibraries(files)
        .setManifest(() -> {
            ManifestBuilder builder = new ManifestBuilder();
            builder.addManifestHeader("Dependencies",
                "org.elasticsearch,io.netty,com.carrotsearch.hppc,org.apache.logging.log4j,org.apache.lucene:8.0");
            return builder.openStream();
        });
}
 
Example #17
Source File: RestClientArchiveProcessor.java    From thorntail with Apache License 2.0 6 votes vote down vote up
@Override
public void process(Archive<?> appArchive, TestClass testClass) {

    if (!(appArchive instanceof WebArchive)) {
        return;
    }
    log.info("Preparing archive: " + appArchive);
    WARArchive war = appArchive.as(WARArchive.class);

    PomEquippedResolveStage pom = Maven.resolver().loadPomFromFile("pom.xml");

    // Wiremock classes that need to be present
    File[] wiremockDeps = pom
            .resolve("com.github.tomakehurst:wiremock")
            .withTransitivity()
            .asFile();

    war.addAsLibraries(wiremockDeps);


    // TCK Classes that need to present
    war.addPackages(true, "org.eclipse.microprofile.rest.client.tck.ext");

    log.fine("Augmented war: \n" + war.toString(true));
}
 
Example #18
Source File: ResourceAdaptersIronjacamarFromRaTest.java    From thorntail with Apache License 2.0 6 votes vote down vote up
@Deployment(testable = false)
public static Archive<?> createDeployment1() {
    final File[] files = Maven.resolver().resolve("net.java.xadisk:xadisk:jar:1.2.2").withoutTransitivity().asFile();
    final RARArchive deploymentRar = ShrinkWrap.create(RARArchive.class, "xadisk.rar");
    deploymentRar.as(RARArchive.class).resourceAdapter("", (rar) -> {
        rar.archive("xadisk-1.2.2.rar");
        rar.transactionSupport(TransactionSupport.XATRANSACTION);
        rar.configProperties(new ConfigProperties("xaDiskHome").value("diskHome"));
        rar.configProperties(new ConfigProperties("instanceId").value("instance1"));
        rar.connectionDefinitions("XADiskConnectionFactoryPool", (connDef) -> {
            connDef.className("org.xadisk.connector.outbound.XADiskManagedConnectionFactory");
            connDef.jndiName("java:global/XADiskCF");
            connDef.configProperties(new ConfigProperties("instanceId").value("instance1"));
        });
    });

    deploymentRar.addAsLibraries(files[0]);
    deploymentRar.setResourceAdapterXML("ra.xml");
    return deploymentRar;
}
 
Example #19
Source File: MavenizeRuleProviderTest.java    From windup with Eclipse Public License 1.0 6 votes vote down vote up
@Deployment
@AddonDependencies({
            @AddonDependency(name = "org.jboss.forge.furnace.container:cdi"),
            @AddonDependency(name = "org.jboss.windup.config:windup-config"),
            @AddonDependency(name = "org.jboss.windup.exec:windup-exec"),
            @AddonDependency(name = "org.jboss.windup.utils:windup-utils"),
            @AddonDependency(name = "org.jboss.windup.rules.apps:windup-rules-base"),
            @AddonDependency(name = "org.jboss.windup.rules.apps:windup-rules-java"),
            @AddonDependency(name = "org.jboss.windup.rules.apps:windup-rules-java-archives"),
            @AddonDependency(name = "org.jboss.windup.tests:test-util"),
})
public static AddonArchive getDeployment()
{
    // See https://github.com/shrinkwrap/resolver/blob/master/README.asciidoc
    JavaArchive[] archives = Maven.resolver().resolve("org.jboss.windup.maven:nexus-indexer-data:zip:5").withoutTransitivity()
                .as(JavaArchive.class);
    Assert.assertEquals("maven-indexer-data found", 1, archives.length);
    AddonArchive deployment = ShrinkWrap.create(AddonArchive.class)
                .addBeansXML();
    for (JavaArchive archive : archives)
        deployment.merge(archive);
    return deployment;
}
 
Example #20
Source File: OpenShiftServiceCdiIT.java    From launchpad-missioncontrol with Apache License 2.0 6 votes vote down vote up
/**
 * @return a jar file containing all the required classes to test the {@link OpenShiftService}
 */
@Deployment(testable = true)
public static WebArchive createDeployment() {
    // Import Maven runtime dependencies
    final File[] dependencies = Maven.resolver().loadPomFromFile("pom.xml")
            .importRuntimeAndTestDependencies().resolve().withTransitivity().asFile();
    // Create deploy file
    final WebArchive war = ShrinkWrap.create(WebArchive.class)
            .addPackage(Fabric8OpenShiftServiceImpl.class.getPackage())
            .addPackage(OpenShiftServiceCdiIT.class.getPackage())
            .addPackage(OpenShiftService.class.getPackage())
            .addClass(DeleteOpenShiftProjectRule.class)
            .addClass(OpenShiftServiceSpi.class)
            .addClass(OpenShiftTestCredentials.class)
            .addClasses(OpenShiftCluster.class, OpenShiftClusterRegistry.class, OpenShiftClusterRegistryImpl.class, OpenShiftClusterConstructor.class)
            .addAsResource("openshift-project-template.json")
            .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
            .addAsWebInfResource("META-INF/jboss-deployment-structure.xml", "jboss-deployment-structure.xml")
            .addAsLibraries(dependencies);
    // Show the deployed structure
    log.info(war.toString(true));
    return war;
}
 
Example #21
Source File: DeploymentHelper.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
public static JavaArchive getEngineCdi() {
  if(CACHED_ENGINE_CDI_ASSET != null) {
    return CACHED_ENGINE_CDI_ASSET;
  } else {

    JavaArchive[] resolvedArchives = Maven.configureResolver()
        .workOffline()
        .loadPomFromFile("pom.xml")
        .resolve(CAMUNDA_ENGINE_CDI)
        .withTransitivity()
        .as(JavaArchive.class);

    if(resolvedArchives.length != 1) {
      throw new RuntimeException("could not resolve "+CAMUNDA_ENGINE_CDI);
    } else {
      CACHED_ENGINE_CDI_ASSET = resolvedArchives[0];
      return CACHED_ENGINE_CDI_ASSET;
    }
  }
}
 
Example #22
Source File: JsonpTest.java    From ee8-sandbox with Apache License 2.0 6 votes vote down vote up
@Deployment(name = "test")
public static Archive<?> createDeployment() {
    File[] extraJars = Maven.resolver().loadPomFromFile("pom.xml")
            .resolve(
                    "com.jayway.jsonpath:json-path:2.4.0",
                    "com.google.code.gson:gson:2.8.2"
            )
            .withTransitivity()
            .asFile();

    WebArchive archive = ShrinkWrap.create(WebArchive.class)
            .addAsLibraries(extraJars)
            .addPackage(Person.class.getPackage())
            //.addAsManifestResource("META-INF/test-persistence.xml", "persistence.xml")
            .addAsResource("persons.json")
            .addAsResource("person.json")
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
    // System.out.println(archive.toString(true));
    return archive;
}
 
Example #23
Source File: JsonbTest.java    From ee8-sandbox with Apache License 2.0 6 votes vote down vote up
@Deployment(name = "test")
public static Archive<?> createDeployment() {
    File[] extraJars = Maven.resolver().loadPomFromFile("pom.xml")
            .resolve(
                    "com.jayway.jsonpath:json-path:2.4.0",
                    "com.google.code.gson:gson:2.8.2"
            )
            .withTransitivity()
            .asFile();
    WebArchive archive = ShrinkWrap.create(WebArchive.class)
            .addAsLibraries(extraJars)
            .addPackage(Person.class.getPackage())
            //.addAsManifestResource("META-INF/test-persistence.xml", "persistence.xml")
            .addAsResource("persons.json")
            .addAsResource("person.json")
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
    // System.out.println(archive.toString(true));
    return archive;
}
 
Example #24
Source File: MissionControlIT.java    From launchpad-missioncontrol with Apache License 2.0 6 votes vote down vote up
/**
 * @return a ear file containing all the required classes and dependencies
 * to test the {@link MissionControl}
 */
@Deployment(testable = true)
public static WebArchive createDeployment() {
    // Import Maven runtime dependencies
    final File[] dependencies = Maven.resolver().loadPomFromFile("pom.xml")
            .importRuntimeAndTestDependencies().resolve().withTransitivity().asFile();
    // Create deploy file
    final WebArchive war = ShrinkWrap.create(WebArchive.class)
            .addPackage(MissionControl.class.getPackage())
            .addPackage(MissionControlImpl.class.getPackage())
            .addPackage(GitHubTestCredentials.class.getPackage())
            .addAsWebInfResource("META-INF/jboss-deployment-structure.xml", "jboss-deployment-structure.xml")
            .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
            .addAsLibraries(dependencies);
    // Show the deployed structure
    log.info(war.toString(true));
    return war;
}
 
Example #25
Source File: JWTOrFormAuthenticationFilterTest.java    From shiro-jwt with MIT License 6 votes vote down vote up
@Deployment
public static Archive<?> deployment() {

    File[] filesCompile = Maven.resolver().loadPomFromFile("pom.xml").importDependencies(ScopeType.COMPILE).resolve().withTransitivity().asFile();
    File[] filestest = Maven.resolver().loadPomFromFile("pom.xml")
            .resolve("com.fasterxml.jackson.core:jackson-annotations", "com.fasterxml.jackson.core:jackson-databind", "com.fasterxml.jackson.core:jackson-core").withTransitivity().asFile();

    JavaArchive jar = ShrinkWrap.create(MavenImporter.class)
            .loadPomFromFile("pom.xml")
            .importBuildOutput()
            .as(JavaArchive.class);

    WebArchive war = ShrinkWrap.create(WebArchive.class)
            .addAsLibraries(filestest)
            .addAsLibraries(jar)
            .addAsLibraries(filesCompile)
            .addClasses(UserDefaultExample.class, UserRepositoryExample.class)
            .addClasses(JAXRSConfigurationExample.class, ObjectMapperProviderExample.class, ResourceExample.class)
            .addAsWebInfResource("WEB-INF/test.shiro.ini", "shiro.ini")
            .addAsWebInfResource("WEB-INF/web.xml", "web.xml")
            .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");

    System.out.println(war.toString(true));

    return war;
}
 
Example #26
Source File: AuthServerTestEnricher.java    From keycloak with Apache License 2.0 5 votes vote down vote up
public void deployProviders(@Observes(precedence = -1) AfterStart event) throws DeploymentException {
    if (isAuthServerRemote() && currentContainerName.contains("auth-server")) {
        this.testsuiteProvidersArchive = ShrinkWrap.create(ZipImporter.class, "testsuiteProviders.jar")
                .importFrom(Maven.configureResolverViaPlugin()
                    .resolve("org.keycloak.testsuite:integration-arquillian-testsuite-providers")
                    .withoutTransitivity()
                    .asSingleFile()
                ).as(JavaArchive.class)
                .addAsManifestResource("jboss-deployment-structure.xml");
                
        event.getDeployableContainer().deploy(testsuiteProvidersArchive);
    }
}
 
Example #27
Source File: KeycloakSetupTestIT.java    From apicurio-studio with Apache License 2.0 5 votes vote down vote up
private static WebArchive getWar(String gav) {
    File resolvedApiWar = Maven.resolver()
            .resolve(gav)
            .withTransitivity()
            .asSingleFile();
    return ShrinkWrap.createFromZipFile(WebArchive.class, resolvedApiWar);
}
 
Example #28
Source File: DeploymentUtil.java    From hibernate-demos with Apache License 2.0 5 votes vote down vote up
public static JavaArchive infinispan() {
	File file = Maven.resolver()
			.resolve( "org.hibernate.demos.messageboard:message-server-task:jar:" + MavenUtils.getProperty( "project.version" ) )
			.withoutTransitivity().asSingleFile();

	return ShrinkWrap.createFromZipFile( JavaArchive.class, file );
}
 
Example #29
Source File: JAXPOverrideTest.java    From thorntail with Apache License 2.0 5 votes vote down vote up
@Deployment
public static Archive createDeployment() throws Exception {
    WARArchive deployment = ShrinkWrap.create(WARArchive.class, "services.war");
    deployment.addAsLibraries(Maven.resolver().resolve("saxon:saxon:8.7").withTransitivity().asFile());
    deployment.addClass(ServicesServlet.class);
    deployment.addClass(TransformerServlet.class);
    return deployment;
}
 
Example #30
Source File: ResourceAdaptersIronjacamarProvidedTest.java    From thorntail with Apache License 2.0 5 votes vote down vote up
@Deployment(testable = false)
public static Archive<?> createDeployment1() {
    final File[] files = Maven.resolver().resolve("net.java.xadisk:xadisk:jar:1.2.2").withoutTransitivity().asFile();
    final RARArchive deploymentRar = ShrinkWrap.create(RARArchive.class, "xadisk.rar");
    deploymentRar.addAsLibraries(files[0]);
    deploymentRar.addAsManifestResource("ironjacamar.xml", "ironjacamar.xml");
    deploymentRar.setResourceAdapterXML("ra.xml");
    return deploymentRar;
}