org.jboss.shrinkwrap.api.spec.WebArchive Java Examples

The following examples show how to use org.jboss.shrinkwrap.api.spec.WebArchive. 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: BasicHelloTest.java    From microprofile1.4-samples with MIT License 6 votes vote down vote up
@Deployment(testable = false)
public static WebArchive createDeployment() {
    WebArchive archive =
        create(WebArchive.class)
            .addClasses(
                ApplicationInit.class,
                HelloResource.class,
                HelloModelReader.class,
                OperationHyphenFilter.class
            ).addAsResource(
                "META-INF/microprofile-config.properties"
            ).addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
            ;

    System.out.println("************************************************************");
    System.out.println(archive.toString(true));
    System.out.println("************************************************************");

    return archive;
}
 
Example #3
Source File: BdaAlternativeWarFileTest.java    From deltaspike with Apache License 2.0 6 votes vote down vote up
/**
 * X TODO creating a WebArchive is only a workaround because JavaArchive cannot contain other archives.
 */
@Deployment
public static WebArchive deploy()
{
    String simpleName = BdaAlternativeWarFileTest.class.getSimpleName();
    String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);

    JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, "securedAnnotationTest.jar")
            .addPackage(BdaAlternativeWarFileTest.class.getPackage())
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");

    return ShrinkWrap.create(WebArchive.class, archiveName + ".war")
            .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive(new String[]{"META-INF.config"}))
            .addAsLibraries(testJar)
            .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
}
 
Example #4
Source File: EarClassLoaderTest.java    From tomee with Apache License 2.0 6 votes vote down vote up
@Deployment(testable = false)
public static Archive<?> ear() {
    return ShrinkWrap.create(EnterpriseArchive.class, "broken.ear")
            .addAsModule(
                    ShrinkWrap.create(WebArchive.class, "broken-web.war")
                            .addClasses(LoadJodaFromTheWebAppResource.class)
                            .addAsLibraries(
                                    Maven.configureResolver()
                                            .workOffline()
                                            .withClassPathResolution(true)
                                            .resolve("joda-time:joda-time:2.5")
                                            .using(new AcceptScopesStrategy(ScopeType.COMPILE, ScopeType.RUNTIME))
                                            .asFile()
                            )
            );
}
 
Example #5
Source File: JeeMessagingEndpointTest.java    From joynr with Apache License 2.0 6 votes vote down vote up
@Deployment
public static WebArchive createTestArchive() {
    // @formatter:off
    JavaArchive javaArchive = ShrinkWrap.create(JavaArchive.class)
                                        .addClasses(ServiceProviderDiscovery.class,
                                                    CallbackHandlerDiscovery.class,
                                                    DefaultJoynrRuntimeFactory.class,
                                                    JeeIntegrationJoynrTestConfigurationProvider.class,
                                                    JoynrIntegrationBean.class,
                                                    JeeMessagingApplication.class,
                                                    JeeMessagingEndpoint.class,
                                                    JeeJoynrStatusMetricsAggregator.class,
                                                    JeeJoynrServiceLocator.class)
                                        .addAsManifestResource(new File("src/main/resources/META-INF/beans.xml"));
    // @formatter:on
    return ShrinkWrap.create(WebArchive.class).addAsLibraries(javaArchive);
}
 
Example #6
Source File: ArrayConverterTest.java    From ConfigJSR with Apache License 2.0 6 votes vote down vote up
@Deployment
public static WebArchive deploy() {
    JavaArchive testJar = ShrinkWrap
            .create(JavaArchive.class, "arrayConverterTest.jar")
            .addPackage(PizzaConverter.class.getPackage())
            .addClass(ArrayConverterTest.class)
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
            .addAsServiceProvider(Converter.class, PizzaConverter.class)
            .as(JavaArchive.class);

    addFile(testJar, "META-INF/javaconfig.properties");

    WebArchive war = ShrinkWrap
            .create(WebArchive.class, "arrayConverterTest.war")
            .addAsLibrary(testJar);
    return war;
}
 
Example #7
Source File: MessageContextTest.java    From deltaspike with Apache License 2.0 6 votes vote down vote up
/**
 * X TODO creating a WebArchive is only a workaround because JavaArchive
 * cannot contain other archives.
 */
@Deployment
public static WebArchive deploy()
{
    final JavaArchive testJar = ShrinkWrap
            .create(JavaArchive.class, "messageContextTest.jar")
            .addPackage(MessageContextTest.class.getPackage())
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");

    return ShrinkWrap
            .create(WebArchive.class, "messageContextTest.war")
            .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())
            .addAsLibraries(testJar)
            .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
            .addAsServiceProvider(Extension.class,
                    MessageBundleExtension.class);
}
 
Example #8
Source File: CDIURIvsURLConfigTest.java    From microprofile-rest-client with Apache License 2.0 6 votes vote down vote up
@Deployment
public static WebArchive createDeployment() {
    String uriPropertyName = SimpleGetApi.class.getName()+"/mp-rest/uri";
    String uriValue = getStringURL() + "uri";
    String urlPropertyName = SimpleGetApi.class.getName()+"/mp-rest/url";
    String urlValue = getStringURL() + "url";
    String overridePropName = ClientWithURI2.class.getName()+"/mp-rest/uri";
    String overridePropValue = "http://localhost:9876/someOtherBaseUri";
    String simpleName = CDIURIvsURLConfigTest.class.getSimpleName();
    JavaArchive jar = ShrinkWrap.create(JavaArchive.class, simpleName + ".jar")
        .addClasses(ClientWithURI.class,
                    ClientWithURI2.class,
                    SimpleGetApi.class,
                    WiremockArquillianTest.class,
                    ReturnWithURLRequestFilter.class)
        .addAsManifestResource(new StringAsset(
            String.format(uriPropertyName+"="+uriValue+"%n"+
                          urlPropertyName+"="+urlValue+"%n"+
                          overridePropName+"="+overridePropValue)),
            "microprofile-config.properties")
        .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
    return ShrinkWrap.create(WebArchive.class, simpleName + ".war")
        .addAsLibrary(jar)
        .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
}
 
Example #9
Source File: ECPublicKeyAsJWKLocationTest.java    From microprofile-jwt-auth with Apache License 2.0 6 votes vote down vote up
/**
 * Create a CDI aware base web application archive that includes an embedded PEM public key that
 * is referenced via the mp.jwt.verify.publickey.location as an embedded resource property.
 * The root url is /jwks
 * @return the base base web application archive
 * @throws IOException - on resource failure
 */
@Deployment()
public static WebArchive createLocationDeployment() throws IOException {
    URL publicKey = ECPublicKeyAsJWKLocationTest.class.getResource("/ecPublicKey.jwk");
    // Setup the microprofile-config.properties content
    Properties configProps = new Properties();
    // Location points to the JWKS bundled in the deployment
    configProps.setProperty(Names.VERIFIER_PUBLIC_KEY_LOCATION, "/ecPublicKey.jwk");
    configProps.setProperty(Names.VERIFIER_PUBLIC_KEY_ALGORITHM, SignatureAlgorithm.ES256.getAlgorithm());
    configProps.setProperty(Names.ISSUER, TCKConstants.TEST_ISSUER);
    StringWriter configSW = new StringWriter();
    configProps.store(configSW, "ECPublicKeyAsJWKLocationTest microprofile-config.properties");
    StringAsset configAsset = new StringAsset(configSW.toString());
    WebArchive webArchive = ShrinkWrap
            .create(WebArchive.class, "ECPublicKeyAsJWKLocationTest.war")
            .addAsManifestResource(new StringAsset(MpJwtTestVersion.MPJWT_V_1_2.name()), MpJwtTestVersion.MANIFEST_NAME)
            .addAsResource(publicKey, "/ecPublicKey.jwk")
            .addClass(PublicKeyEndpoint.class)
            .addClass(JwksApplication.class)
            .addClass(SimpleTokenUtils.class)
            .addAsWebInfResource("beans.xml", "beans.xml")
            .addAsManifestResource(configAsset, "microprofile-config.properties");
    return webArchive;
}
 
Example #10
Source File: JsonValueInjectionTest.java    From microprofile-jwt-auth with Apache License 2.0 6 votes vote down vote up
/**
 * Create a CDI aware base web application archive
 * @return the base base web application archive
 * @throws IOException - on resource failure
 */
@Deployment(testable=true)
public static WebArchive createDeployment() throws IOException {
    URL config = JsonValueInjectionTest.class.getResource("/META-INF/microprofile-config-publickey-location.properties");
    URL publicKey = JsonValueInjectionTest.class.getResource("/publicKey.pem");
    WebArchive webArchive = ShrinkWrap
            .create(WebArchive.class, "JsonValueInjectionTest.war")
            .addAsManifestResource(new StringAsset(MpJwtTestVersion.MPJWT_V_1_0.name()), MpJwtTestVersion.MANIFEST_NAME)
            .addAsResource(publicKey, "/publicKey.pem")
            .addClass(JsonValuejectionEndpoint.class)
            .addClass(TCKApplication.class)
            .addAsWebInfResource("beans.xml", "beans.xml")
            .addAsManifestResource(config, "microprofile-config.properties");
    System.out.printf("WebArchive: %s\n", webArchive.toString(true));
    return webArchive;
}
 
Example #11
Source File: ApplicationScopedInjectionTest.java    From microprofile-jwt-auth with Apache License 2.0 6 votes vote down vote up
/**
 * Create a CDI aware base web application archive
 * @return the base base web application archive
 * @throws IOException - on resource failure
 */
@Deployment(testable=true)
public static WebArchive createDeployment() throws IOException {
    URL config = ApplicationScopedInjectionTest.class.getResource("/META-INF/microprofile-config-publickey-location.properties");
    URL publicKey = ApplicationScopedInjectionTest.class.getResource("/publicKey.pem");
    WebArchive webArchive = ShrinkWrap
        .create(WebArchive.class, "ClaimValueInjectionTest.war")
        .addAsManifestResource(new StringAsset(MpJwtTestVersion.MPJWT_V_1_0.name()), MpJwtTestVersion.MANIFEST_NAME)
        .addAsResource(publicKey, "/publicKey.pem")
        .addClass(ApplicationScopedEndpoint.class)
        .addClass(TCKApplication.class)
        .addAsWebInfResource("beans.xml", "beans.xml")
        .addAsManifestResource(config, "microprofile-config.properties");
    System.out.printf("WebArchive: %s\n", webArchive.toString(true));
    return webArchive;
}
 
Example #12
Source File: ConfigAccessorTest.java    From ConfigJSR with Apache License 2.0 6 votes vote down vote up
@Deployment
public static WebArchive deploy() {
    JavaArchive testJar = ShrinkWrap
        .create(JavaArchive.class, "configValueTest.jar")
        .addPackage(AbstractTest.class.getPackage())
        .addClass(ConfigAccessorTest.class)
        .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
        .addAsServiceProvider(ConfigSource.class, ConfigurableConfigSource.class)
        .as(JavaArchive.class);

    AbstractTest.addFile(testJar, "META-INF/javaconfig.properties");

    WebArchive war = ShrinkWrap
        .create(WebArchive.class, "configValueTest.war")
        .addAsLibrary(testJar);
    return war;
}
 
Example #13
Source File: ServletObjectInjectionTest.java    From deltaspike with Apache License 2.0 5 votes vote down vote up
@Deployment(testable = false)
public static WebArchive getDeployment()
{
    return ShrinkWrap.create(WebArchive.class, ServletObjectInjectionTest.class.getSimpleName() + ".war")
            .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndServletModuleArchive())
            .addClass(ServletObjectInjectionBean.class)
            .addClass(ServletObjectInjectionServlet.class)
            .addAsWebInfResource(new StringAsset("<beans/>"), "beans.xml")
            .setWebXML(new StringAsset(
                    Descriptors.create(WebAppDescriptor.class)
                            .servlet(ServletObjectInjectionServlet.class, "/servlet-object-injecetion")
                            .exportAsString()));

}
 
Example #14
Source File: FallbackMethodGenericWildcardTest.java    From microprofile-fault-tolerance with Apache License 2.0 5 votes vote down vote up
@Deployment
public static WebArchive deploy() {
    JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, "ftFallbackMethodGenericWildcard.jar")
            .addClasses(FallbackMethodGenericWildcardBeanA.class, FallbackMethodGenericWildcardBeanB.class)
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
    
    WebArchive war = ShrinkWrap
            .create(WebArchive.class, "ftFallbackMethodGenericWildcard.war")
            .addAsLibrary(testJar);
    return war;
}
 
Example #15
Source File: TransformerTest.java    From appengine-tck with Apache License 2.0 5 votes vote down vote up
@Deployment
public static WebArchive getDeployment() {
    TestContext context = new TestContext().setWebXmlFile("endpoints-web.xml");
    WebArchive war = getDefaultDeployment(context);
    war.addPackage(TransformerEndPoint.class.getPackage());
    return war;
}
 
Example #16
Source File: LocalSLSBInvocationTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Deployment(order=1)
public static WebArchive delegateDeployment() {
  WebArchive webArchive = ShrinkWrap.create(WebArchive.class, "service.war")
    .addAsLibraries(DeploymentHelper.getEjbClient())
    .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
    .addClass(AbstractFoxPlatformIntegrationTest.class)
    .addClass(LocalSLSBean.class) // the EJB
    .addClass(BusinessInterface.class); // the business interface

  TestContainer.addContainerSpecificResourcesForNonPa(webArchive);

  return webArchive;
}
 
Example #17
Source File: ProspectiveTestBase.java    From appengine-tck with Apache License 2.0 5 votes vote down vote up
protected static WebArchive getBaseDeployment() {
    TestContext context = new TestContext().setUseSystemProperties(true).setCompatibilityProperties(TCK_PROPERTIES);
    context.setWebXmlFile("match-web.xml");

    WebArchive war = getTckDeployment(context);
    war.addClasses(ProspectiveTestBase.class);
    war.addClasses(MatchResponseServlet.class, SpecialMatchResponseServlet.class);
    war.addClasses(InvocationData.class, Ping.class);
    return war;
}
 
Example #18
Source File: RestTest.java    From incubator-batchee with Apache License 2.0 5 votes vote down vote up
@Deployment(testable = false)
@OverProtocol("Servlet 2.5") // to use a custom web.xml
public static Archive<?> war() {
    return ShrinkWrap.create(WebArchive.class, "batchee-gui.war")
        // GUI
        .addPackages(true, JBatchResourceImpl.class.getPackage())
        .addPackages(true, JBatchResource.class.getPackage())
        .addAsWebInfResource(new StringAsset(
            Descriptors.create(WebAppDescriptor.class)
                .metadataComplete(false)
                .createServlet()
                .servletName("CXF")
                .servletClass("org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet")
                .createInitParam()
                .paramName("jaxrs.serviceClasses")
                .paramValue(JBatchResourceImpl.class.getName())
                .up()
                .createInitParam()
                .paramName("jaxrs.providers")
                .paramValue(JohnzonBatcheeProvider.class.getName() + "," + JBatchExceptionMapper.class.getName())
                .up()
                .createInitParam()
                .paramName("jaxrs.outInterceptors")
                .paramValue(LoggingOutInterceptor.class.getName())
                .up()
                .up()
                .createServletMapping()
                .servletName("CXF")
                .urlPattern("/api/*")
                .up()
                .exportAsString()
        ), "web.xml")
        // test data to create some job things to do this test
        .addPackage(CreateSomeJobs.class.getPackage())
        .addAsWebInfResource("META-INF/batch-jobs/init.xml", "classes/META-INF/batch-jobs/init.xml");
}
 
Example #19
Source File: SingletonBeanDelegateTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Deployment
public static WebArchive processArchive() {
  return initWebArchiveDeployment()
    .addClass(SingletonBeanDelegate.class)
    .addClass(SingletonBeanClientDelegate.class)
    .addAsResource("org/camunda/bpm/integrationtest/functional/ejb/SingletonBeanDelegateTest.testBeanResolution.bpmn20.xml")
    .addAsResource("org/camunda/bpm/integrationtest/functional/ejb/SingletonBeanDelegateTest.testBeanResolutionFromClient.bpmn20.xml");
}
 
Example #20
Source File: PublicKeyAsJWKLocationURLTest.java    From microprofile-jwt-auth with Apache License 2.0 5 votes vote down vote up
/**
 * Create a CDI aware base web application archive that includes a JWKS endpoint that
 * is referenced via the mp.jwt.verify.publickey.location as a URL resource property.
 * The root url is /jwks
 * @return the base base web application archive
 * @throws IOException - on resource failure
 */
@Deployment()
public static WebArchive createLocationURLDeployment() throws IOException {
    URL publicKey = PublicKeyAsJWKLocationURLTest.class.getResource("/publicKey4k.pem");
    // Setup the microprofile-config.properties content
    Properties configProps = new Properties();
    // Read in the base URL of deployment since it cannot be injected for use by this method
    String jwksBaseURL = System.getProperty("mp.jwt.tck.jwks.baseURL", "http://localhost:8080/");
    // Location points to the JWKS endpoint of the deployment
    System.out.printf("baseURL=%s\n", jwksBaseURL);
    URL jwksURL = new URL(new URL(jwksBaseURL), "jwks/endp/publicKey4kAsJWKS?kid=publicKey4k");
    System.out.printf("jwksURL=%s\n", jwksURL);
    configProps.setProperty(Names.VERIFIER_PUBLIC_KEY_LOCATION, jwksURL.toExternalForm());
    configProps.setProperty(Names.ISSUER, TCKConstants.TEST_ISSUER);
    StringWriter configSW = new StringWriter();
    configProps.store(configSW, "PublicKeyAsJWKLocationURLTest microprofile-config.properties");
    StringAsset configAsset = new StringAsset(configSW.toString());
    WebArchive webArchive = ShrinkWrap
        .create(WebArchive.class, "PublicKeyAsJWKLocationURLTest.war")
        .addAsManifestResource(new StringAsset(MpJwtTestVersion.MPJWT_V_1_1.name()), MpJwtTestVersion.MANIFEST_NAME)
        .addAsResource(publicKey, "/publicKey4k.pem")
        .addAsResource(publicKey, "/publicKey.pem")
        .addClass(PublicKeyEndpoint.class)
        .addClass(JwksApplication.class)
        .addClass(SimpleTokenUtils.class)
        .addAsWebInfResource("beans.xml", "beans.xml")
        .addAsManifestResource(configAsset, "microprofile-config.properties")
        ;
    System.out.printf("WebArchive: %s\n", webArchive.toString(true));
    return webArchive;
}
 
Example #21
Source File: DeploymentArchiveUtils.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Create enterprise EAR archive for deployment testing
 *
 * @param archiveName Name of archive
 * @param content Context of page.html file
 * @return Return created {@link File} instance
 */
public static File createEnterpriseArchive(String archiveName, String subArchiveName, String content) {

    WebArchive war = ShrinkWrap.create(WebArchive.class, archiveName);
    war.addAsWebResource(new StringAsset(content), "page.html");
    final EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class,
            subArchiveName);
    ear.add(war, new BasicPath("/"), ZipExporter.class);

    final String tempDir = TestSuiteEnvironment.getTmpDir();
    File file = new File(tempDir, ear.getName());
    new ZipExporterImpl(ear).exportTo(file, true);
    return file;
}
 
Example #22
Source File: UncatchedExceptionTest.java    From deltaspike with Apache License 2.0 5 votes vote down vote up
@Deployment
public static WebArchive deploy()
{
    JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, "autoInjectionUncatchedExceptionTest.jar")
            .addPackage(ArchiveUtils.SHARED_PACKAGE)
            .addPackage(UncatchedExceptionTest.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
Source File: ConcurrentGaugedConstructorBeanTest.java    From microprofile-metrics with Apache License 2.0 5 votes vote down vote up
@Deployment
static Archive<?> createTestArchive() {
    return ShrinkWrap.create(WebArchive.class)
        // Test bean
        .addClass(ConcurrentGaugedConstructorBean.class)
        // Bean archive deployment descriptor
        .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
}
 
Example #24
Source File: TimeoutBuilderIndependentOfMPConfigTest.java    From microprofile-rest-client with Apache License 2.0 5 votes vote down vote up
@Deployment
public static Archive<?> createDeployment() {
    String clientName = SimpleGetApi.class.getName();
    String timeoutProps = clientName + "/mp-rest/connectTimeout=15000" +
                          System.lineSeparator() +
                          clientName + "/mp-rest/readTimeout=15000";
    StringAsset mpConfig = new StringAsset(timeoutProps);
    return ShrinkWrap.create(WebArchive.class, TimeoutBuilderIndependentOfMPConfigTest.class.getSimpleName()+".war")
        .addAsWebInfResource(mpConfig, "classes/META-INF/microprofile-config.properties")
        .addClasses(SimpleGetApi.class,
                    TimeoutTestBase.class,
                    WiremockArquillianTest.class);
}
 
Example #25
Source File: WindowMaxCountTest.java    From deltaspike with Apache License 2.0 5 votes vote down vote up
@Deployment
public static WebArchive deploy()
{
    WebArchive archive = ShrinkWrap
            .create(WebArchive.class, "windowMaxCountTest.war")
            .addPackage(WindowMaxCountTest.class.getPackage())
            .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJsfArchive())
            .addAsLibraries(ArchiveUtils.getDeltaSpikeSecurityArchive())
            .addAsWebResource("windowScopedContextTest/windowcount.xhtml", "/windowcount.xhtml")
            .addAsWebInfResource("default/WEB-INF/web.xml", "web.xml")
            .addAsWebInfResource("META-INF/apache-deltaspike.properties",
                    "classes/META-INF/apache-deltaspike.properties")
            .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
    return archive;
}
 
Example #26
Source File: TestUtil.java    From cloud-s4-sdk-examples with Apache License 2.0 5 votes vote down vote up
public static WebArchive createDeployment( final Class<?>... classesUnderTest )
{
    return ShrinkWrap
        .create(WebArchive.class)
        .addClasses(classesUnderTest)
        .addClass(RequestContextServletFilter.class)
        .addClass(TenantRequestContextListener.class)
        .addClass(UserRequestContextListener.class)
        .addClass(DestinationsRequestContextListener.class)
        .addAsManifestResource("arquillian.xml");
}
 
Example #27
Source File: HibernateTest.java    From tomee with Apache License 2.0 5 votes vote down vote up
@Deployment
public static WebArchive war() {
    File[] hibernate;
    try { // try offline first since it is generally faster
        hibernate = Maven.configureResolver()
                .workOffline()
                .loadPomFromFile("src/test/resources/hibernate-pom.xml")
                .importCompileAndRuntimeDependencies().resolve().withTransitivity()
                .asFile();
    } catch (ResolutionException re) { // try on central
        hibernate = Maven.resolver()
                .loadPomFromFile("src/test/resources/hibernate-pom.xml")
                .importCompileAndRuntimeDependencies().resolve().withTransitivity()
                .asFile();
    }

    return ShrinkWrap.create(WebArchive.class, "hibernate-app.war")
            .addAsWebInfResource(new StringAsset("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
                    "<persistence version=\"2.0\"\n" +
                    "    xmlns=\"http://java.sun.com/xml/ns/persistence\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
                    "    xsi:schemaLocation=\"http://java.sun.com/xml/ns/persistence" +
                    "                         http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd\">\n" +
                    "  <persistence-unit name=\"hibernate\">\n" +
                    "    <provider>org.hibernate.jpa.HibernatePersistence</provider>\n" +
                    "    <exclude-unlisted-classes>true</exclude-unlisted-classes>\n" +
                    "    <properties>\n" +
                    "      <property name=\"hibernate.hbm2ddl.auto\" value=\"create-drop\" />\n" +
                    "    </properties>\n" +
                    "  </persistence-unit>\n" +
                    "</persistence>"), ArchivePaths.create("persistence.xml"))
            .addAsLibraries(hibernate)
            .addAsLibraries(JarLocation.jarLocation(ResolutionException.class))
            .addAsLibraries(JarLocation.jarLocation(org.jboss.shrinkwrap.resolver.api.maven.filter.MavenResolutionFilter.class));
}
 
Example #28
Source File: PaContextSwitchCustomSerializerTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Deployment(name = "pa4")
public static WebArchive createDeployment2() {
  WebArchive webArchive = ShrinkWrap.create(WebArchive.class, "pa4.war")
      .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
      .addAsLibraries(DeploymentHelper.getEngineCdi())
      .addAsResource("META-INF/processes.xml")
      .addClass(AbstractFoxPlatformIntegrationTest.class)
      .addClass(ProcessApplication4.class);

  return webArchive;
}
 
Example #29
Source File: SpringExpressionResolvingTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Deployment(name="clientDeployment")
public static WebArchive clientDeployment() {

  // the test is deployed as a seperate deployment

  WebArchive deployment = ShrinkWrap.create(WebArchive.class, "client.war")
          .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
          .addClass(AbstractFoxPlatformIntegrationTest.class)
          .addAsLibraries(DeploymentHelper.getEngineCdi());

  TestContainer.addContainerSpecificResourcesForNonPa(deployment);

  return deployment;
}
 
Example #30
Source File: HandlerComparatorTest.java    From deltaspike with Apache License 2.0 5 votes vote down vote up
@Deployment(name = "HandlerComparatorTest")
public static Archive<?> createTestArchive()
{
    return ShrinkWrap
            .create(WebArchive.class, "handlerComparator.war")
            .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())
            .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
            .addClasses(ExtensionExceptionHandler.class, Account.class,
                    org.apache.deltaspike.test.core.impl.exception.control.extension.Arquillian.class,
                    CatchQualifier.class, CatchQualifierLiteral.class);
}