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

The following examples show how to use org.jboss.shrinkwrap.api.spec.WebArchive. 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
Source Project: smallrye-metrics   Author: smallrye   File: ArchiveProcessor.java    License: 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 Project: microprofile1.4-samples   Author: javaee-samples   File: BasicHelloTest.java    License: 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 Project: deltaspike   Author: apache   File: MessageContextTest.java    License: 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 #4
Source Project: microprofile-rest-client   Author: eclipse   File: CDIURIvsURLConfigTest.java    License: 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 #5
Source Project: microprofile-jwt-auth   Author: eclipse   File: JsonValueInjectionTest.java    License: 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 #6
Source Project: microprofile-jwt-auth   Author: eclipse   File: ApplicationScopedInjectionTest.java    License: 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 #7
Source Project: ConfigJSR   Author: eclipse   File: ConfigAccessorTest.java    License: 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 #8
Source Project: microprofile-jwt-auth   Author: eclipse   File: ECPublicKeyAsJWKLocationTest.java    License: 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 #9
Source Project: joynr   Author: bmwcarit   File: JeeMessagingEndpointTest.java    License: 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 #10
Source Project: tomee   Author: apache   File: EarClassLoaderTest.java    License: 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 #11
Source Project: deltaspike   Author: apache   File: BdaAlternativeWarFileTest.java    License: 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 #12
Source Project: ConfigJSR   Author: eclipse   File: ArrayConverterTest.java    License: 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 #13
@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 #14
Source Project: microprofile-metrics   Author: eclipse   File: MeteredConstructorBeanTest.java    License: Apache License 2.0 5 votes vote down vote up
@Deployment
static Archive<?> createTestArchive() {
    return ShrinkWrap.create(WebArchive.class)
        // Test bean
        .addClass(MeteredConstructorBean.class)
        // Bean archive deployment descriptor
        .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
}
 
Example #15
Source Project: microprofile-jwt-auth   Author: eclipse   File: PublicKeyAsPEMLocationTest.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Create a CDI aware base web application archive that includes an embedded PEM public key
 * that is included as the mp.jwt.verify.publickey property.
 * The root url is /
 * @return the base base web application archive
 * @throws IOException - on resource failure
 */
@Deployment()
public static WebArchive createLocationDeployment() throws IOException {
    URL publicKey = PublicKeyAsPEMLocationTest.class.getResource("/publicKey4k.pem");
    // Setup the microprofile-config.properties content
    Properties configProps = new Properties();
    // Location points to the PEM bundled in the deployment
    configProps.setProperty(Names.VERIFIER_PUBLIC_KEY_LOCATION, "/publicKey4k.pem");
    configProps.setProperty(Names.ISSUER, TCKConstants.TEST_ISSUER);
    StringWriter configSW = new StringWriter();
    configProps.store(configSW, "PublicKeyAsPEMLocationTest microprofile-config.properties");
    StringAsset configAsset = new StringAsset(configSW.toString());

    WebArchive webArchive = ShrinkWrap
        .create(WebArchive.class, "PublicKeyAsPEMLocationTest.war")
        .addAsManifestResource(new StringAsset(MpJwtTestVersion.MPJWT_V_1_1.name()), MpJwtTestVersion.MANIFEST_NAME)
        .addAsResource(publicKey, "/publicKey.pem")
        .addAsResource(publicKey, "/publicKey4k.pem")
        .addClass(PublicKeyEndpoint.class)
        .addClass(PEMApplication.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 #16
Source Project: wildfly-camel   Author: wildfly-extras   File: CXFWSClientCertSecureProducerIntegrationTest.java    License: Apache License 2.0 5 votes vote down vote up
@Deployment
public static Archive<?> deployment() {
    final WebArchive archive = ShrinkWrap
            .create(WebArchive.class, CXFWSClientCertSecureProducerIntegrationTest.class.getSimpleName() + ".war")
            .addClasses(ClientCertSecurityDomainSetup.class, CXFWSSecureUtils.class, EnvironmentUtils.class)
            .addPackage(CxfWsRouteBuilder.class.getPackage())
            .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
    ;
    SecurityUtils.enhanceArchive(archive, ClientCertSecurityDomainSetup.SECURITY_DOMAIN,
            ClientCertSecurityDomainSetup.AUTH_METHOD, PATH_ROLE_MAP);
    return archive;
}
 
Example #17
Source Project: deltaspike   Author: apache   File: ExplicitlyGroupedConversationsTest.java    License: Apache License 2.0 5 votes vote down vote up
@Deployment
public static WebArchive deploy()
{
    String simpleName = ExplicitlyGroupedConversationsTest.class.getSimpleName();
    String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);

    JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, archiveName + ".jar")
            .addPackage(ExplicitlyGroupedConversationsTest.class.getPackage().getName())
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");

    return ShrinkWrap.create(WebArchive.class, archiveName + ".war")
            .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())
            .addAsLibraries(testJar)
            .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
}
 
Example #18
Source Project: microprofile-config   Author: eclipse   File: MissingValueOnInstanceInjectionTest.java    License: Apache License 2.0 5 votes vote down vote up
@ShouldThrowException(DeploymentException.class)
@Deployment
public static WebArchive deploy() {
    JavaArchive testJar = ShrinkWrap
            .create(JavaArchive.class, "missingValueOnInstanceInjectionTest.jar")
            .addClass(ConfigOwner.class)
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
            .as(JavaArchive.class);

    WebArchive war = ShrinkWrap
            .create(WebArchive.class, "missingValueOnInstanceInjectionTest.war")
            .addAsLibrary(testJar);
    return war;
}
 
Example #19
Source Project: camunda-bpm-platform   Author: camunda   File: CallActivityContextSwitchTest.java    License: Apache License 2.0 5 votes vote down vote up
@Deployment(name="mainDeployment")
public static WebArchive createProcessArchiveDeplyoment() {
  return initWebArchiveDeployment("mainDeployment.war")
    .addClass(DelegateBefore.class)
    .addClass(DelegateAfter.class)
    .addAsResource("org/camunda/bpm/integrationtest/functional/context/CallActivityContextSwitchTest.mainProcessSync.bpmn20.xml")
    .addAsResource("org/camunda/bpm/integrationtest/functional/context/CallActivityContextSwitchTest.mainProcessSyncNoWait.bpmn20.xml")
    .addAsResource("org/camunda/bpm/integrationtest/functional/context/CallActivityContextSwitchTest.mainProcessASync.bpmn20.xml")
    .addAsResource("org/camunda/bpm/integrationtest/functional/context/CallActivityContextSwitchTest.mainProcessASyncBefore.bpmn20.xml")
    .addAsResource("org/camunda/bpm/integrationtest/functional/context/CallActivityContextSwitchTest.mainProcessASyncAfter.bpmn20.xml");
}
 
Example #20
Source Project: appengine-tck   Author: GoogleCloudPlatform   File: HeadersStaticFilesTest.java    License: Apache License 2.0 5 votes vote down vote up
@Deployment
public static WebArchive getDeployment() {
    WebArchive archive = getTckDeployment(new TestContext()
        .setAppEngineWebXmlFile("appengine-web-headers-static-files.xml"));
    createFile(archive, "/with-header/foo.txt");
    createFile(archive, "/with-expiration/foo.txt");
    createFile(archive, "/with-default-expiration/foo.txt");
    return archive;
}
 
Example #21
Source Project: deltaspike   Author: apache   File: ProxyUtilsTest.java    License: Apache License 2.0 5 votes vote down vote up
@Deployment
public static Archive<?> createTestArchive()
{
    return ShrinkWrap
            .create(WebArchive.class, "proxyUtil.war")
            .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())
            .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
            .addClasses(ProxyUtilsTest.class, MyBean.class, MyInterface.class,
                    MyInterfaceImpl.class);
}
 
Example #22
Source Project: wildfly-camel   Author: wildfly-extras   File: LRAIntegrationTest.java    License: Apache License 2.0 5 votes vote down vote up
@Deployment
public static WebArchive createDeployment() {
    return ShrinkWrap.create(WebArchive.class, "LRAIntegrationTest.war")
        .addClass(TestUtils.class)
        .addPackages(true, "org.awaitility")
        .setManifest(() -> {
            ManifestBuilder builder = new ManifestBuilder();
            builder.addManifestHeader("Dependencies", "org.jboss.resteasy.resteasy-jaxrs,com.fasterxml.jackson.core.jackson-databind");
            return builder.openStream();
        });
}
 
Example #23
Source Project: camunda-bpm-platform   Author: camunda   File: PythonPaClassImportTest.java    License: Apache License 2.0 5 votes vote down vote up
@Deployment(name="pa2")
public static WebArchive createProcessApplication2() {
  return initWebArchiveDeployment("pa2.war")
    .addClass(CustomClass.class)
    .addAsWebInfResource(new StringAsset(JYTHON_MODULE_DEPENDENCY),"jboss-deployment-structure.xml")
    .addAsResource(createScriptTaskProcess("python", SCRIPT_WITH_IMPORT, "process2"), "process2.bpmn20.xml");
}
 
Example #24
Source Project: cloud-s4-sdk-examples   Author: SAP   File: TestUtil.java    License: Apache License 2.0 5 votes vote down vote up
public static WebArchive createDeployment( final Class<?>... classesUnderTest )
{
    return ShrinkWrap
        .create(WebArchive.class)
        .addClasses(classesUnderTest)
        .addClasses(RequestContextServletFilter.class, RequestContextCallable.class)
        .addClass(TenantRequestContextListener.class)
        .addClass(UserRequestContextListener.class)
        .addClass(DestinationsRequestContextListener.class)
        .addAsManifestResource("arquillian.xml")
        .addAsWebInfResource(new ByteArrayAsset("<beans/>".getBytes()), ArchivePaths.create("beans.xml"));
}
 
Example #25
Source Project: tomee   Author: apache   File: PublicKeyAsJWKLocationURLTest.java    License: 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(name = "testApp", order = 2)
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), "key/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 #26
Source Project: deltaspike   Author: apache   File: HandlerComparatorTest.java    License: 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);
}
 
Example #27
Source Project: camunda-bpm-platform   Author: camunda   File: SpringExpressionResolvingTest.java    License: 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 #28
Source Project: camunda-bpm-platform   Author: camunda   File: PaContextSwitchCustomSerializerTest.java    License: 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 Project: tomee   Author: apache   File: HibernateTest.java    License: 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 #30
Source Project: cloud-s4-sdk-examples   Author: SAP   File: TestUtil.java    License: 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");
}