Java Code Examples for org.jboss.shrinkwrap.api.spec.JavaArchive

The following examples show how to use org.jboss.shrinkwrap.api.spec.JavaArchive. These examples are extracted from open source projects. 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
@Deployment
public static WebArchive create() {
    ConfigAnnotationAsset config = new ConfigAnnotationAsset();
    config.set(FallbackConfigBean.class, "applyOnMethod", Fallback.class, "applyOn", TestConfigExceptionA.class.getCanonicalName());
    config.set(FallbackConfigBean.class, "skipOnMethod", Fallback.class, "skipOn", TestConfigExceptionA.class.getCanonicalName());
    config.set(FallbackConfigBean.class, "fallbackMethodConfig", Fallback.class, "fallbackMethod", "anotherFallback");
    config.set(FallbackConfigBean.class, "fallbackHandlerConfig", Fallback.class, "value", FallbackHandlerB.class.getName());
    
    JavaArchive jar = ShrinkWrap
            .create(JavaArchive.class, "ftFallbackConfigTest.jar")
            .addPackage(FallbackConfigTest.class.getPackage())
            .addPackage(Packages.UTILS)
            .addAsManifestResource(config, "microprofile-config.properties")
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
    
    WebArchive war = ShrinkWrap
            .create(WebArchive.class, "ftFallbackConfigTest.war")
            .addAsLibraries(jar);
    return war;
}
 
Example 2
private JavaArchive prepareTestDeployment(String dependency) throws Exception {
    final String deploymentName = dependency + DEPLOYMENT_NAME_SUFFIX;
    final Properties properties = new Properties();
    properties.put(deploymentName + "Service", "isNew");
    final JavaArchive archive = ServiceActivatorDeploymentUtil.createServiceActivatorDeploymentArchive(deploymentName,
            properties);
    archive.delete("META-INF/permissions.xml");
    archive.addAsManifestResource(PermissionUtils.createPermissionsXmlAsset(
            new PropertyPermission("test.deployment.trivial.prop", "write"),
            new PropertyPermission(deploymentName + "Service", "write"),
            new PropertyPermission("service", "write")
    ), "permissions.xml");
    archive.addAsResource(new StringAsset(prepareJBossDeploymentStructure(dependency)),
            "META-INF/jboss-deployment-structure.xml");
    return archive;
}
 
Example 3
/*******************************
 * loadSinglePlugin(...) Tests *
 *******************************/

@Test(timeout = 5000)
public void test_load_single_plugin_load_and_instantiate_enabled() throws Throwable {

    final File pluginFolder1 = temporaryFolder.newFolder("extension", "plugin1");
    FileUtils.writeStringToFile(pluginFolder1.toPath().resolve("hivemq-extension.xml").toFile(),
            validPluginXML1,
            Charset.defaultCharset());
    final File file = new File(pluginFolder1, "extension.jar");
    final JavaArchive javaArchive = ShrinkWrap.create(JavaArchive.class).
            addAsServiceProviderAndClasses(ExtensionMain.class, TestExtensionMainImpl.class);
    javaArchive.as(ZipExporter.class).exportTo(file);

    final HiveMQExtension hiveMQExtension = realPluginLoader.loadSinglePlugin(
            pluginFolder1.toPath(),
            HiveMQPluginXMLReader.getPluginEntityFromXML(pluginFolder1.toPath(), true).get(),
            ExtensionMain.class);

    assertNotNull(hiveMQExtension);
    hiveMQExtension.start(super.getTestPluginStartInput(), super.getTestPluginStartOutput());
    assertTrue(hiveMQExtension.isEnabled());
}
 
Example 4
Source Project: deltaspike   Source File: CustomSchedulerWarFileTest.java    License: Apache License 2.0 6 votes vote down vote up
@Deployment
public static WebArchive deploy()
{
    String simpleName = CustomSchedulerWarFileTest.class.getSimpleName();
    String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);

    JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, "customSchedulerTest.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(CustomConfigSource.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 5
Source Project: JEEventStore   Source File: OptimisticEventStoreServiceTest.java    License: MIT License 6 votes vote down vote up
@Deployment
public static Archive<?> deployment() {
    EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class, "test.ear")
            .addAsModule(ShrinkWrap.create(JavaArchive.class, "ejb.jar")
                    .addAsManifestResource(new File("src/test/resources/META-INF/beans.xml"))
                    .addAsManifestResource(new File(
                            "src/test/resources/META-INF/ejb-jar-OptimisticEventStoreServiceTest.xml"),
                            "ejb-jar.xml")
                    .addPackage(ChangeSet.class.getPackage())
                    .addPackage(EventStoreCommitNotifier.class.getPackage())
                    .addPackage(OptimisticEventStoreService.class.getPackage())
                    .addPackage(SyncEventStoreCommitNotifier.class.getPackage())
                    .addClass(IteratorUtils.class)
                    .addClass(MockPersistence.class)
                    .addClass(EventStorePersistence.class)
            );
    return ear;
}
 
Example 6
private @NotNull PingReqInboundInterceptor getIsolatedInboundInterceptor(final @NotNull String name) throws Exception {
    final JavaArchive javaArchive = ShrinkWrap.create(JavaArchive.class)
            .addClass("com.hivemq.extensions.handler.PingInterceptorHandlerTest$" + name);

    final File jarFile = temporaryFolder.newFile();
    javaArchive.as(ZipExporter.class).exportTo(jarFile, true);

    final IsolatedPluginClassloader
            cl =
            new IsolatedPluginClassloader(new URL[]{jarFile.toURI().toURL()}, this.getClass().getClassLoader());

    final Class<?> interceptorClass =
            cl.loadClass("com.hivemq.extensions.handler.PingInterceptorHandlerTest$" + name);

    final PingReqInboundInterceptor interceptor =
            (PingReqInboundInterceptor) interceptorClass.newInstance();

    return interceptor;
}
 
Example 7
@NotNull
private PubcompInboundInterceptor getInboundInterceptor(@NotNull final String name) throws Exception {

    final JavaArchive javaArchive = ShrinkWrap.create(JavaArchive.class)
            .addClass("com.hivemq.extensions.handler.PubcompInterceptorHandlerTest$" + name);

    final File jarFile = temporaryFolder.newFile();
    javaArchive.as(ZipExporter.class).exportTo(jarFile, true);

    //This classloader contains the classes from the jar file
    final IsolatedPluginClassloader
            cl =
            new IsolatedPluginClassloader(new URL[]{jarFile.toURI().toURL()}, this.getClass().getClassLoader());

    final Class<?> interceptorClass =
            cl.loadClass("com.hivemq.extensions.handler.PubcompInterceptorHandlerTest$" + name);

    return (PubcompInboundInterceptor) interceptorClass.newInstance();
}
 
Example 8
@Before
public void startContainer() throws Exception {
    // Start the server
    container.startSuspended();
    managementClient = container.getClient();

    //ServerDeploymentHelper helper = new ServerDeploymentHelper(managementClient.getControllerClient());
    JavaArchive war = ShrinkWrap.create(JavaArchive.class, WEB_SUSPEND_JAR);
    war.addPackage(SuspendResumeHandler.class.getPackage());
    war.addAsServiceProvider(ServiceActivator.class, TestSuspendServiceActivator.class);
    war.addAsResource(new StringAsset("Dependencies: org.jboss.dmr, org.jboss.as.controller, io.undertow.core, org.jboss.as.server,org.wildfly.extension.request-controller, org.jboss.as.network\n"), "META-INF/MANIFEST.MF");
    war.addAsManifestResource(PermissionUtils.createPermissionsXmlAsset(
        new RuntimePermission("createXnioWorker"),
        new SocketPermission(TestSuiteEnvironment.getServerAddress() + ":8080", "listen,resolve"),
        new SocketPermission("*", "accept,resolve")
    ), "permissions.xml");
    //helper.deploy(WEB_SUSPEND_JAR, war.as(ZipExporter.class).exportAsInputStream());
    serverController.deploy(war, WEB_SUSPEND_JAR);
}
 
Example 9
@Deployment
public static WebArchive deploy() {
    
    Asset config = new DisableConfigAsset()
            .disable(Retry.class)
            .disable(CircuitBreaker.class)
            .disable(Timeout.class)
            .disable(Asynchronous.class)
            .disable(Fallback.class)
            .disable(Bulkhead.class);
    
    JavaArchive testJar = ShrinkWrap
        .create(JavaArchive.class, "ftDisableGlobally.jar")
        .addClasses(DisableAnnotationClient.class)
        .addPackage(Packages.UTILS)
        .addAsManifestResource(config, "microprofile-config.properties")
        .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
        .as(JavaArchive.class);

    WebArchive war = ShrinkWrap
        .create(WebArchive.class, "ftDisableGlobally.war")
        .addAsLibrary(testJar);
    return war;
}
 
Example 10
@Deployment
public static WebArchive deploy() {
   Asset config = new DisableConfigAsset()
           .disable(DisableAnnotationClient.class, Retry.class)
           .disable(DisableAnnotationClient.class, CircuitBreaker.class)
           .disable(DisableAnnotationClient.class, Timeout.class)
           .disable(DisableAnnotationClient.class, Asynchronous.class)
           .disable(DisableAnnotationClient.class, Fallback.class)
           .disable(DisableAnnotationClient.class, Bulkhead.class);
    
    JavaArchive testJar = ShrinkWrap
        .create(JavaArchive.class, "ftDisableClass.jar")
        .addClasses(DisableAnnotationClient.class)
        .addPackage(Packages.UTILS)
        .addAsManifestResource(config, "microprofile-config.properties")
        .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
        .as(JavaArchive.class);

    WebArchive war = ShrinkWrap
        .create(WebArchive.class, "ftDisableClass.war")
        .addAsLibrary(testJar);
    return war;
}
 
Example 11
Source Project: shiro-jwt   Source File: JWTOrFormAuthenticationFilterTest.java    License: 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 12
private void startContainer(int suspendTimeout) throws Exception {

        suspendTimeout = suspendTimeout < 1 ? suspendTimeout : TimeoutUtil.adjust(suspendTimeout);

        jbossArgs = System.getProperty("jboss.args");
        String newArgs = jbossArgs == null ? "" : jbossArgs;
        newArgs += " -D[Standalone] -Dorg.wildfly.sigterm.suspend.timeout=" + suspendTimeout;
        System.setProperty("jboss.args", newArgs);

        if (File.pathSeparatorChar == ':'){
            processUtil = new UnixProcessUtil();
        } else {
            processUtil = new WindowsProcessUtil();
        }

        // Start the server
        serverController.start();

        // If there's already the deployment there from a previous test, remove it
        try {
            serverController.undeploy(WEB_SUSPEND_JAR);
        } catch (Exception ignored) {
            // assume it wasn't deployed. if it was we'll fail below
        }

        JavaArchive war = ShrinkWrap.create(JavaArchive.class, WEB_SUSPEND_JAR);
        war.addPackage(SuspendResumeHandler.class.getPackage());
        war.addAsServiceProvider(ServiceActivator.class, TestSuspendServiceActivator.class);
        war.addAsResource(new StringAsset("Dependencies: org.jboss.dmr, org.jboss.as.controller, io.undertow.core, org.jboss.as.server,org.wildfly.extension.request-controller, org.jboss.as.network\n"), "META-INF/MANIFEST.MF");
        war.addAsManifestResource(PermissionUtils.createPermissionsXmlAsset(
                new RuntimePermission("createXnioWorker"),
                new SocketPermission(TestSuiteEnvironment.getServerAddress() + ":8080", "listen,resolve"),
                new SocketPermission("*", "accept,resolve")
        ), "permissions.xml");
        serverController.deploy(war, WEB_SUSPEND_JAR);
    }
 
Example 13
protected File export(JavaArchive archive) throws IOException {
    File tmpFile = File.createTempFile("boostrap-archive", ".jar");
    tmpFile.deleteOnExit();
    tmpFile.delete();
    archive.as(ZipExporter.class).exportTo(tmpFile);
    return tmpFile;
}
 
Example 14
Source Project: tutorials   Source File: StatelessEJBIntegrationTest.java    License: MIT License 5 votes vote down vote up
@Deployment
public static JavaArchive createDeployment() {
    return ShrinkWrap.create(JavaArchive.class)
            .addClass(StatelessEJB.class)
            .addClass(EJBClient1.class)
            .addClass(EJBClient2.class)
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
}
 
Example 15
@Deployment
@ShouldThrowException(value = FaultToleranceDefinitionException.class)
public static WebArchive deploy() {
    JavaArchive testJar = ShrinkWrap
        .create(JavaArchive.class, "ftInvalidCB5.jar")
        .addClasses(CircuitBreakerClientForValidationReqVolNeg.class)
        .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
        .as(JavaArchive.class);

    return ShrinkWrap
        .create(WebArchive.class, "ftInvalidCB5.war")
        .addAsLibrary(testJar);
}
 
Example 16
Source Project: wildfly-camel   Source File: QuickfixIntegrationTest.java    License: Apache License 2.0 5 votes vote down vote up
@Deployment
public static JavaArchive createdeployment() {
    final JavaArchive archive = ShrinkWrap.create(JavaArchive.class, "camel-quickfix-tests");
    archive.addPackage(QuickfixjMessageJsonPrinter.class.getPackage());
    archive.addAsResource("quickfix/inprocess.cfg");
    return archive;
}
 
Example 17
@Test
public void testUniqueRuntimeName() throws Exception {
    final JavaArchive archive1 = ServiceActivatorDeploymentUtil.createServiceActivatorDeploymentArchive("test-deployment1.jar", properties);
    final JavaArchive archive2 = ServiceActivatorDeploymentUtil.createServiceActivatorDeploymentArchive("test-deployment2.jar", properties2);
    archive2.addAsManifestResource(DeploymentTestCase.class.getPackage(), "marker.txt", "marker.txt");

    final ModelControllerClient client = managementClient.getControllerClient();
    final ServerDeploymentManager manager = ServerDeploymentManager.Factory.create(client);
    try (InputStream is1 = archive1.as(ZipExporter.class).exportAsInputStream();
            InputStream is2 = archive2.as(ZipExporter.class).exportAsInputStream();) {
        Future<?> future = manager.execute(manager.newDeploymentPlan()
                .add("test-deployment1.jar", "test-deployment.jar", is1)
                .add("test-deployment2.jar", "test-deployment.jar", is2)
                .build());
        awaitDeploymentExecution(future);
        checkDeploymentStatus(client, "test-deployment1.jar", "STOPPED");
        checkDeploymentStatus(client, "test-deployment2.jar", "STOPPED");
        future = manager.execute(manager.newDeploymentPlan().deploy("test-deployment1.jar").build());
        awaitDeploymentExecution(future);
        future = manager.execute(manager.newDeploymentPlan().deploy("test-deployment2.jar").build());
        awaitDeploymentExecution(future);
        checkDeploymentStatus(client, "test-deployment1.jar", "OK");
        checkDeploymentStatus(client, "test-deployment2.jar", "STOPPED");
        future = manager.execute(manager.newDeploymentPlan()
                .undeploy("test-deployment1.jar")
                .remove("test-deployment1.jar")
                .undeploy("test-deployment2.jar")
                .remove("test-deployment2.jar")
                .build());
        awaitDeploymentExecution(future);
    }
}
 
Example 18
@Deployment
public static ResourceAdapterArchive rarDeployment() {
    return ShrinkWrap.create(ResourceAdapterArchive.class, DEPLOYMENT_RESADAPTOR_RAR)
        .addAsManifestResource("classloading/resource-adapter.xml", "ra.xml")
        .addAsLibrary(ShrinkWrap.create(JavaArchive.class)
            .addClasses(FakeResourceAdapter.class, FakeActivationSpec.class, CamelEnablementResourceAdapterTest.class)
        );
}
 
Example 19
@Before
public void setupContainer() throws Exception {
    container.start();
    host = CoreUtils.stripSquareBrackets(TestSuiteEnvironment.getServerAddress());
    final JavaArchive deployment = createDeployment();
    deploy(deployment);
    SyslogServer.shutdown();
    BlockedAllProtocolsSyslogServerEventHandler.initializeForProtocol(SyslogConstants.UDP);
    BlockedAllProtocolsSyslogServerEventHandler.initializeForProtocol(SyslogConstants.TCP);
    setupServer();
    container.stop();
}
 
Example 20
Source Project: tomee   Source File: TomcatScanningTest.java    License: Apache License 2.0 5 votes vote down vote up
@Deployment(testable = false)
public static Archive<?> app() {
    return ShrinkWrap.create(WebArchive.class, "TomcatScanningTest.war")
            .addAsLibraries(
                    ShrinkWrap.create(JavaArchive.class, "ant.jar"/*excluded by tomcat only*/).addClass(E1.class),
                    ShrinkWrap.create(JavaArchive.class, "log4j-taglib-isincludedbytomcat.jar"/*excluded by tomee, included by tomcat*/).addClass(E2.class),
                    ShrinkWrap.create(JavaArchive.class, "neethi-whatever.jar"/*excluded by tomee only*/).addClass(E3.class)
            );
}
 
Example 21
@Deployment(name = "withAlternative", managed = false)
public static JavaArchive createDeploymentWithAlternative() {
  return ShrinkWrap.create(JavaArchive.class)
      .addClass(ProgrammaticBeanLookup.class)
      .addClass(ProcessEngineServicesProducer.class)
      .addClass(AlternativeTestBean.class)
      .addAsManifestResource("org/camunda/bpm/engine/cdi/test/impl/util/beansWithAlternative.xml", "beans.xml");
}
 
Example 22
Source Project: deltaspike   Source File: UncatchedFlushExceptionTest.java    License: Apache License 2.0 5 votes vote down vote up
@Deployment
public static WebArchive deploy()
{
    JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, "nestedMultiTransactionUncatchedFlushExceptionTest.jar")
            .addPackage(ArchiveUtils.SHARED_PACKAGE)
            .addPackage(UncatchedFlushExceptionTest.class.getPackage().getName())
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");

    return ShrinkWrap.create(WebArchive.class)
            .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJpaArchive())
            .addAsLibraries(testJar)
            .addAsServiceProvider(Extension.class, TransactionContextExtension.class)
            .addAsWebInfResource(ArchiveUtils.getBeansXml(), "beans.xml");
}
 
Example 23
@Deployment(managed = false, name = "incoming-returning-non-void-cs")
@ShouldThrowException(value = DefinitionException.class, testable = true)
public static Archive<JavaArchive> incomingReturningNonVoidCompletionStage() {
    JavaArchive archive = ShrinkWrap.create(JavaArchive.class)
        .addClasses(IncomingReturningNonVoidCompletionStage.class, ArchiveExtender.class)
        .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");

    ServiceLoader.load(ArchiveExtender.class).iterator().forEachRemaining(ext -> ext.extend(archive));
    return archive;
}
 
Example 24
Source Project: flexy-pool   Source File: TomeeHibernateIntegrationTest.java    License: Apache License 2.0 5 votes vote down vote up
@Deployment
public static Archive<?> createDeployment() {
    System.setProperty(PropertyLoader.PROPERTIES_FILE_PATH, "hibernate-connection-provider/flexy-pool-hibernate.properties");
    return ShrinkWrap.create(JavaArchive.class)
            .addPackage(Book.class.getPackage())
            .addClass(DefaultDataSourceConfiguration.class)
            .addAsManifestResource("hibernate-connection-provider/test-persistence-hibernate.xml", "persistence.xml")
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
}
 
Example 25
@Deployment
public static Archive<?> createTestArchive() {
    return ShrinkWrap.create(JavaArchive.class)
        // Test bean
        .addClass(ExceptionMeteredMethodBean.class)
        // Metrics CDI extension
        .addPackage(MetricsExtension.class.getPackage())
        // Bean archive deployment descriptor
        .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
}
 
Example 26
Source Project: hammock   Source File: ProgrammaticPUTest.java    License: Apache License 2.0 5 votes vote down vote up
@Deployment
public static JavaArchive createDeployment() {
    return ShrinkWrap.create(JavaArchive.class)
            .addClasses(AnotherEmployeeService.class, ProgrammaticPUTest.class, PUConfiguration.class)
            .addAsServiceProviderAndClasses(Extension.class, DataSourceExtension.class, JPAExtension.class)
            .addPackage(EntityManagerProducer.class.getPackage())
            .addAsManifestResource("META-INF/beans.xml", "beans.xml");
}
 
Example 27
Source Project: metrics-cdi   Source File: CounterFieldBeanTest.java    License: Apache License 2.0 5 votes vote down vote up
@Deployment
public static Archive<?> createTestArchive() {
    return ShrinkWrap.create(JavaArchive.class)
        // Test bean
        .addClass(CounterFieldBean.class)
        // Metrics CDI extension
        .addPackage(MetricsExtension.class.getPackage())
        // Bean archive deployment descriptor
        .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
}
 
Example 28
Source Project: camunda-bpm-platform   Source File: DeploymentHelper.java    License: Apache License 2.0 5 votes vote down vote up
public static JavaArchive[] getEngineSpring() {
  if(CACHED_SPRING_ASSETS != null) {
    return CACHED_SPRING_ASSETS;
  } else {

    JavaArchive[] resolvedArchives = Maven.configureResolver()
        .workOffline()
        .loadPomFromFile("pom.xml")
        .addDependencies(
            MavenDependencies.createDependency("org.camunda.bpm:camunda-engine-spring", ScopeType.COMPILE, false,
                MavenDependencies.createExclusion("org.camunda.bpm:camunda-engine")),
                MavenDependencies.createDependency("org.springframework:spring-context", ScopeType.COMPILE, false),
                MavenDependencies.createDependency("org.springframework:spring-jdbc", ScopeType.COMPILE, false),
                MavenDependencies.createDependency("org.springframework:spring-tx", ScopeType.COMPILE, false),
                MavenDependencies.createDependency("org.springframework:spring-orm", ScopeType.COMPILE, false),
                MavenDependencies.createDependency("org.springframework:spring-web", ScopeType.COMPILE, false))
        .resolve()
        .withTransitivity()
        .as(JavaArchive.class);

    if(resolvedArchives.length == 0) {
      throw new RuntimeException("could not resolve org.camunda.bpm:camunda-engine-spring");
    } else {
      CACHED_SPRING_ASSETS = resolvedArchives;
      return CACHED_SPRING_ASSETS;
    }
  }

}
 
Example 29
private static Map<ArchivePath, Node> getMatchingFilesFromJar(List<String> patterns, JavaArchive archive) {
    return archive.getContent(path -> {
                for (String pattern : patterns) {
                    if (SelectorUtils.match(pattern, path.get())) {
                        return true;
                    }
                }
                return false;
            });
}
 
Example 30
@Deployment
public static JavaArchive deployment() {
    final JavaArchive archive = ShrinkWrap.create(JavaArchive.class, "zookeeper-master-tests");
    archive.addClasses(CuratorFactoryBean.class, ZKServerFactoryBean.class);
    archive.addAsResource("zookeepermaster/zkmaster-camel-context.xml");
    return archive;
}