org.jboss.shrinkwrap.api.asset.EmptyAsset Java Examples

The following examples show how to use org.jboss.shrinkwrap.api.asset.EmptyAsset. 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: ConfigPropertyGlobalVsClassTest.java    From microprofile-fault-tolerance with Apache License 2.0 6 votes vote down vote up
@Deployment
public static WebArchive deployAnotherApp() {
    JavaArchive testJar = ShrinkWrap
        .create(JavaArchive.class, "ftConfig.jar")
        .addClasses(BeanWithRetry.class)
        .addAsManifestResource(new StringAsset(
            "org.eclipse.microprofile.fault.tolerance.tck.config.BeanWithRetry/Retry/maxRetries=5" +
                "\nRetry/maxRetries=7"), "microprofile-config.properties")
        .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
        .as(JavaArchive.class);

    WebArchive war = ShrinkWrap
        .create(WebArchive.class, "ftConfigTest.war")
        .addAsLibrary(testJar);
    return war;
}
 
Example #2
Source File: CircuitBreakerTimeoutTest.java    From microprofile-fault-tolerance with Apache License 2.0 6 votes vote down vote up
@Deployment
public static WebArchive deploy() {
    ConfigAnnotationAsset config = new ConfigAnnotationAsset()
            .autoscaleMethod(CircuitBreakerClientWithTimeout.class, "serviceWithTimeout")
            .autoscaleMethod(CircuitBreakerClientWithTimeout.class, "serviceWithTimeoutWithoutFailOn");
    
    JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, "ftCircuitBreakerTimeout.jar")
                                    .addClasses(CircuitBreakerClientWithTimeout.class)
                                    .addPackage(Packages.UTILS)
                                    .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
                                    .addAsManifestResource(config, "microprofile-config.properties");

    WebArchive war = ShrinkWrap.create(WebArchive.class, "ftCircuitBreakerTimeout.war")
                               .addAsLibrary(testJar);
    return war;
}
 
Example #3
Source File: CDIQueryParamStyleTest.java    From microprofile-rest-client with Apache License 2.0 6 votes vote down vote up
@Deployment
public static WebArchive createDeployment() {
    String urlProperty = "queryParamStyle/mp-rest/uri=http://localhost:8080/stub";
    String filterProperty = "queryParamStyle/mp-rest/providers=" + ReturnWithURLRequestFilter.class.getName();
    String multiPairsProperty = MultiPairsStringClient.class.getName()
        + "/mp-rest/queryParamStyle=MULTI_PAIRS";
    String commaSeparatedProperty = CommaSeparatedStringClient.class.getName()
        + "/mp-rest/queryParamStyle=COMMA_SEPARATED";
    String arrayPairsProperty = ArrayPairsStringClient.class.getName()
        + "/mp-rest/queryParamStyle=ARRAY_PAIRS";
    String simpleName = CDIQueryParamStyleTest.class.getSimpleName();
    JavaArchive jar = ShrinkWrap.create(JavaArchive.class, simpleName + ".jar")
        .addClasses(StringClient.class, ReturnWithURLRequestFilter.class, QueryParamStyleTest.class)
        .addAsManifestResource(new StringAsset(String.format(filterProperty + "%n" 
                                                           + urlProperty + "%n"
                                                           + multiPairsProperty + "%n"
                                                           + commaSeparatedProperty + "%n"
                                                           + arrayPairsProperty + "%n")),
                                               "microprofile-config.properties")
        .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
    return ShrinkWrap.create(WebArchive.class, simpleName + ".war")
        .addAsLibrary(jar)
        .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
}
 
Example #4
Source File: CustomConfigSourceTest.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, "customConfigSourceTest.jar")
            .addClasses(CustomConfigSourceTest.class, CustomDbConfigSource.class, CustomConfigSourceProvider.class)
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
            .addAsServiceProvider(ConfigSource.class, CustomDbConfigSource.class)
            .addAsServiceProvider(ConfigSourceProvider.class, CustomConfigSourceProvider.class)
            .as(JavaArchive.class);

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

    WebArchive war = ShrinkWrap
            .create(WebArchive.class, "customConfigSourceTest.war")
            .addAsLibrary(testJar);
    return war;
}
 
Example #5
Source File: TimeoutConfigTest.java    From microprofile-fault-tolerance with Apache License 2.0 6 votes vote down vote up
@Deployment
public static WebArchive create() {
    ConfigAnnotationAsset config = new ConfigAnnotationAsset()
        .set(TimeoutConfigBean.class, "serviceValue", Timeout.class, "value",
            TCKConfig.getConfig().getTimeoutInStr(1000))
        // only changing value here to scale the original, not for the purpose of this test
        .set(TimeoutConfigBean.class, "serviceUnit", Timeout.class, "value",
            TCKConfig.getConfig().getTimeoutInStr(1000))
        .set(TimeoutConfigBean.class, "serviceUnit", Timeout.class, "unit", "MILLIS")
        .set(TimeoutConfigBean.class, "serviceBoth", Timeout.class, "value",
            TCKConfig.getConfig().getTimeoutInStr(1000))
        .set(TimeoutConfigBean.class, "serviceBoth", Timeout.class, "unit", "MILLIS");

    JavaArchive jar = ShrinkWrap.create(JavaArchive.class, "ftTimeoutConfig.jar")
        .addClasses(TimeoutConfigBean.class, CompletableFutureHelper.class)
        .addPackage(Packages.UTILS)
        .addAsManifestResource(config, "microprofile-config.properties")
        .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");

    return ShrinkWrap.create(WebArchive.class, "ftTimeoutConfig.war")
        .addAsLibrary(jar);
}
 
Example #6
Source File: BasicReactiveStreamsTest.java    From microprofile-rest-client with Apache License 2.0 6 votes vote down vote up
@Deployment
public static WebArchive createDeployment() {
    WebArchive webArchive = ShrinkWrap.create(WebArchive.class, 
                                              BasicReactiveStreamsTest.class.getSimpleName() + ".war")
            .addClasses(AbstractSseTest.class,
                        BasicReactiveStreamsTest.class,
                        HttpSseServer.class,
                        MyEventSource.class,
                        MyEventSourceServlet.class,
                        RsSseClient.class,
                        RsWeatherEventClient.class,
                        WeatherEvent.class,
                        WeatherEventProvider.class)
            .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");

    return webArchive;
}
 
Example #7
Source File: FallbackApplyOnConfigTest.java    From microprofile-fault-tolerance with Apache License 2.0 6 votes vote down vote up
@Deployment
public static WebArchive create() {
    ConfigAnnotationAsset config = new ConfigAnnotationAsset();
    config.setGlobally(Fallback.class, "applyOn", TestConfigExceptionA.class.getCanonicalName());
    
    JavaArchive jar = ShrinkWrap
            .create(JavaArchive.class, "ftFallbackApplyOnConfigTest.jar")
            .addPackage(FallbackConfigTest.class.getPackage())
            .addPackage(Packages.UTILS)
            .addAsManifestResource(config, "microprofile-config.properties")
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
    
    WebArchive war = ShrinkWrap
            .create(WebArchive.class, "ftFallbackApplyOnConfigTest.war")
            .addAsLibraries(jar);
    return war;
}
 
Example #8
Source File: TimeoutUninterruptableTest.java    From microprofile-fault-tolerance with Apache License 2.0 6 votes vote down vote up
@Deployment
public static WebArchive deployment() {
    ConfigAnnotationAsset timeoutConfig = new ConfigAnnotationAsset()
            .autoscaleMethod(UninterruptableTimeoutClient.class, "serviceTimeout")
            .autoscaleMethod(UninterruptableTimeoutClient.class, "serviceTimeoutAsync")
            .autoscaleMethod(UninterruptableTimeoutClient.class, "serviceTimeoutAsyncCS")
            .autoscaleMethod(UninterruptableTimeoutClient.class, "serviceTimeoutAsyncBulkhead")
            .autoscaleMethod(UninterruptableTimeoutClient.class, "serviceTimeoutAsyncBulkheadQueueTimed")
            .autoscaleMethod(UninterruptableTimeoutClient.class, "serviceTimeoutAsyncRetry")
            .autoscaleMethod(UninterruptableTimeoutClient.class, "serviceTimeoutAsyncFallback");
            
    JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, "ftTimeoutUninterruptable.jar")
                                    .addClass(UninterruptableTimeoutClient.class)
                                    .addPackage(Packages.UTILS)
                                    .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
                                    .addAsManifestResource(timeoutConfig, "microprofile-config.properties");

    WebArchive testWar = ShrinkWrap.create(WebArchive.class, "ftTimeoutUninterruptable.war")
                                   .addAsLibrary(testJar);

    return testWar;
}
 
Example #9
Source File: ConverterTest.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, "converterTest.jar")
            .addClass(ConverterTest.class)
            .addPackage(CustomDbConfigSource.class.getPackage())
            .addClasses(DuckConverter.class, Duck.class, Donald.class, SomeEnumToConvert.class)
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
            .addAsServiceProvider(ConfigSource.class, CustomDbConfigSource.class)
            .addAsServiceProvider(ConfigSourceProvider.class, CustomConfigSourceProvider.class)
            .addAsServiceProvider(Converter.class, DuckConverter.class)
            .as(JavaArchive.class);

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

    WebArchive war = ShrinkWrap
            .create(WebArchive.class, "converterTest.war")
            .addAsLibrary(testJar);
    return war;
}
 
Example #10
Source File: ServletTest.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 publicKey = ServletTest.class.getResource("/publicKey.pem");
    WebArchive webArchive = ShrinkWrap
        .create(WebArchive.class, "ServletTest.war")
        .addAsManifestResource(new StringAsset(MpJwtTestVersion.MPJWT_V_1_0.name()), MpJwtTestVersion.MANIFEST_NAME)
        .addAsResource(publicKey, "/publicKey.pem")
        .addClass(EjbEndpoint.class)
        .addClass(ServiceServlet.class)
        .addClass(IService.class)
        .addClass(ServiceEJB.class)
        .addClass(TCKApplication.class)
        .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
        ;
    System.out.printf("WebArchive: %s\n", webArchive.toString(true));
    return webArchive;
}
 
Example #11
Source File: EjbTest.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 publicKey = EjbTest.class.getResource("/publicKey.pem");
    WebArchive webArchive = ShrinkWrap
        .create(WebArchive.class, "EjbTest.war")
        .addAsManifestResource(new StringAsset(MpJwtTestVersion.MPJWT_V_1_0.name()), MpJwtTestVersion.MANIFEST_NAME)
        .addAsResource(publicKey, "/publicKey.pem")
        .addClass(EjbEndpoint.class)
        .addClass(IService.class)
        .addClass(ServiceEJB.class)
        .addClass(TCKApplication.class)
        .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
        ;
    System.out.printf("WebArchive: %s\n", webArchive.toString(true));
    return webArchive;
}
 
Example #12
Source File: WiredQueryExecutorBeanTest.java    From datawave with Apache License 2.0 6 votes vote down vote up
@Deployment
public static JavaArchive createDeployment() throws Exception {
    System.setProperty("cdi.bean.context", "springFrameworkBeanRefContext.xml");
    // Set system properties that are normally set by the Wildfly container, and needed for test deployment
    try (InputStream is = WiredQueryExecutorBeanTest.class.getResourceAsStream("/test-system-properties.properties")) {
        Properties systemProperties = System.getProperties();
        systemProperties.load(is);
        System.setProperties(systemProperties);
    }
    
    return ShrinkWrap
                    .create(JavaArchive.class)
                    .addPackages(true, "org.apache.deltaspike", "io.astefanutti.metrics.cdi", "datawave.data.type", "datawave.query.language.parser.jexl",
                                    "datawave.query.language.functions.jexl", "datawave.webservice.query.configuration", "datawave.configuration")
                    .addClasses(DefaultResponseObjectFactory.class, QueryExpirationConfiguration.class, FacetedQueryPlanner.class, FacetedQueryLogic.class,
                                    DefaultQueryPlanner.class, BooleanChunkingQueryPlanner.class, ShardQueryLogic.class, CountingShardQueryLogic.class,
                                    EventQueryDataDecoratorTransformer.class, FieldIndexCountQueryLogic.class, CompositeQueryLogic.class,
                                    QueryMetricQueryLogic.class, TLDQueryLogic.class, ParentQueryLogic.class, DiscoveryLogic.class, IndexQueryLogic.class,
                                    QueryLogicFactoryImpl.class, NoOpQueryMetricHandler.class, DatawaveRoleManager.class, EasyRoleManager.class,
                                    CachedResultsConfiguration.class, DateIndexHelperFactory.class, EdgeDictionaryResponseTypeProducer.class,
                                    RemoteEdgeDictionary.class, DefaultMapperDecorator.class).addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
}
 
Example #13
Source File: RetryConditionTest.java    From microprofile-fault-tolerance with Apache License 2.0 6 votes vote down vote up
@Deployment
public static WebArchive deploy() {
    JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, "ftRetryCondition.jar")
                    .addClasses(RetryClientAbortOn.class, RetryClientRetryOn.class,
                                    RetryClassLevelClientRetryOn.class,
                                    RetryClassLevelClientAbortOn.class,
                                    AsyncCallerExecutor.class,
                                    AsyncCaller.class,
                                    AsyncRetryClient.class,
                                    CompletableFutureHelper.class,
                                    RetryChildException.class,
                                    RetryParentException.class)
                    .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
                    .as(JavaArchive.class);

    WebArchive war = ShrinkWrap
            .create(WebArchive.class, "ftRetryCondition.war")
            .addAsLibrary(testJar);
    return war;
}
 
Example #14
Source File: DisableFTEnableGloballyTest.java    From microprofile-fault-tolerance with Apache License 2.0 6 votes vote down vote up
@Deployment
public static WebArchive deploy() {
   Asset config = new DisableConfigAsset()
           .enable(Retry.class)
           .enable(CircuitBreaker.class)
           .enable(Timeout.class)
           .enable(Asynchronous.class)
           .enable(Fallback.class)
           .enable(Bulkhead.class)
           .disableGlobally();

    JavaArchive testJar = ShrinkWrap
        .create(JavaArchive.class, "ftDisableGlobalEnableClass.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, "ftDisableGlobalEnableClass.war")
        .addAsLibrary(testJar);
    return war;
}
 
Example #15
Source File: CDIFollowRedirectsTest.java    From microprofile-rest-client with Apache License 2.0 6 votes vote down vote up
@Deployment
public static WebArchive createDeployment() {
    String urlProperty1 = SimpleGetApi.class.getName() + "/mp-rest/uri=" + getStringURL();
    String urlProperty2 = "myConfigKey/mp-rest/uri=" + getStringURL();
    String redirectProperty = "myConfigKey/mp-rest/followRedirects=true";
    String simpleName = CDIFollowRedirectsTest.class.getSimpleName();
    JavaArchive jar = ShrinkWrap.create(JavaArchive.class, simpleName + ".jar")
        .addClasses(SimpleGetApi.class, SimpleGetApiWithConfigKey.class, 
                    FollowRedirectsTest.class, WiremockArquillianTest.class)
        .addAsManifestResource(new StringAsset(String.format(redirectProperty + "%n" + urlProperty1 + "%n" + urlProperty2)),
                                               "microprofile-config.properties")
        .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
    return ShrinkWrap.create(WebArchive.class, simpleName + ".war")
        .addAsLibrary(jar)
        .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
}
 
Example #16
Source File: ConfigPropertyGlobalVsClassVsMethodTest.java    From microprofile-fault-tolerance with Apache License 2.0 6 votes vote down vote up
@Deployment
public static WebArchive deployAnotherApp() {
    JavaArchive testJar = ShrinkWrap
        .create(JavaArchive.class, "ftConfig.jar")
        .addClasses(BeanWithRetry.class)
        .addAsManifestResource(new StringAsset(
            "org.eclipse.microprofile.fault.tolerance.tck.config.BeanWithRetry/Retry/maxRetries=5" +
                "\norg.eclipse.microprofile.fault.tolerance.tck.config.BeanWithRetry/triggerException/Retry/maxRetries=6" +
                "\nRetry/maxRetries=7"), "microprofile-config.properties")
        .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
        .as(JavaArchive.class);

    WebArchive war = ShrinkWrap
        .create(WebArchive.class, "ftConfigTest.war")
        .addAsLibrary(testJar);
    return war;
}
 
Example #17
Source File: MPConfigTest.java    From microprofile-context-propagation with Apache License 2.0 6 votes vote down vote up
@Deployment
public static WebArchive createDeployment() {
    // build a JAR that provides three fake context types: 'Buffer', 'Label', and 'ThreadPriority'
    JavaArchive fakeContextProviders = ShrinkWrap.create(JavaArchive.class, "fakeContextTypes.jar")
            .addPackages(true, "org.eclipse.microprofile.context.tck.contexts.buffer")
            .addPackages(true, "org.eclipse.microprofile.context.tck.contexts.label")
            .addPackage("org.eclipse.microprofile.context.tck.contexts.priority.spi")
            .addAsServiceProvider(ThreadContextProvider.class,
                    BufferContextProvider.class, LabelContextProvider.class, ThreadPriorityContextProvider.class);

    return ShrinkWrap.create(WebArchive.class, MPConfigTest.class.getSimpleName() + ".war")
            .addClass(MPConfigBean.class)
            .addClass(MPConfigTest.class)
            .addClass(ProducerBean.class)
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
            .addAsWebInfResource(new StringAsset(
                            "mp.context.ManagedExecutor.maxAsync=1\n" +
                                    "mp.context.ManagedExecutor.maxQueued=4\n" +
                                    "mp.context.ManagedExecutor.propagated=Label,ThreadPriority\n" +
                                    "mp.context.ManagedExecutor.cleared=Remaining\n" +
                                    "mp.context.ThreadContext.cleared=Buffer\n" +
                                    "mp.context.ThreadContext.propagated=\n" +
                                    "mp.context.ThreadContext.unchanged=Remaining"),
                    "classes/META-INF/microprofile-config.properties")
            .addAsLibraries(fakeContextProviders);
}
 
Example #18
Source File: ConfigPropertyOnClassAndMethodTest.java    From microprofile-fault-tolerance with Apache License 2.0 6 votes vote down vote up
@Deployment
public static WebArchive deployAnotherApp() {
    JavaArchive testJar = ShrinkWrap
        .create(JavaArchive.class, "ftConfig.jar")
        .addClasses(BeanWithRetry.class)
        .addAsManifestResource(new StringAsset(
                                   "org.eclipse.microprofile.fault.tolerance.tck.config.BeanWithRetry/Retry/maxRetries=5" +
                                       "\norg.eclipse.microprofile.fault.tolerance.tck.config.BeanWithRetry/triggerException/Retry/maxRetries=6"),
                               "microprofile-config.properties")
        .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
        .as(JavaArchive.class);

    WebArchive war = ShrinkWrap
        .create(WebArchive.class, "ftConfigTest.war")
        .addAsLibrary(testJar);
    return war;
}
 
Example #19
Source File: InvalidAsynchronousMethodTest.java    From microprofile-fault-tolerance with Apache License 2.0 5 votes vote down vote up
@Deployment
@ShouldThrowException(value = FaultToleranceDefinitionException.class)
public static WebArchive deploy() {
    JavaArchive testJar = ShrinkWrap
        .create(JavaArchive.class, "ftInvalidAsnycMethod.jar")
        .addClasses(AsynchronousClientForValidationMethod.class)
        .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
        .as(JavaArchive.class);

    return ShrinkWrap
        .create(WebArchive.class, "ftInvalidAsnycMethod.war")
        .addAsLibrary(testJar);
}
 
Example #20
Source File: InvalidCircuitBreakerFailureRatioPosTest.java    From microprofile-fault-tolerance with Apache License 2.0 5 votes vote down vote up
@Deployment
@ShouldThrowException(value = FaultToleranceDefinitionException.class)
public static WebArchive deploy() {
    JavaArchive testJar = ShrinkWrap
        .create(JavaArchive.class, "ftInvalidCB2.jar")
        .addClasses(CircuitBreakerClientForValidationFailureRatioPos.class)
        .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
        .as(JavaArchive.class);

    return ShrinkWrap
        .create(WebArchive.class, "ftInvalidCB2.war")
        .addAsLibrary(testJar);
}
 
Example #21
Source File: CircuitBreakerExceptionHierarchyTest.java    From microprofile-fault-tolerance with Apache License 2.0 5 votes vote down vote up
@Deployment
public static WebArchive deploy() {
    JavaArchive jar = ShrinkWrap.create(JavaArchive.class, "ftCircuitBreakerExceptionHierarchy.jar")
        .addPackage(E0.class.getPackage())
        .addClass(CircuitBreakerService.class)
        .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
        .as(JavaArchive.class);

    return ShrinkWrap
        .create(WebArchive.class, "ftCircuitBreakerExceptionHierarchy.war")
        .addAsLibrary(jar);
}
 
Example #22
Source File: CDIInvokeAsyncSimpleGetOperationTest.java    From microprofile-rest-client with Apache License 2.0 5 votes vote down vote up
@Deployment
public static WebArchive createDeployment() {
    String propertyName = SimpleGetApiAsync.class.getName()+"/mp-rest/url";
    String value = getStringURL();
    String simpleName = CDIInvokeAsyncSimpleGetOperationTest.class.getSimpleName();
    JavaArchive jar = ShrinkWrap.create(JavaArchive.class, simpleName + ".jar")
        .addClasses(SimpleGetApiAsync.class, WiremockArquillianTest.class)
        .addAsManifestResource(new StringAsset(propertyName+"="+value), "microprofile-config.properties")
        .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
    return ShrinkWrap.create(WebArchive.class, simpleName + ".war")
        .addAsLibrary(jar)
        .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
}
 
Example #23
Source File: TimerTagFieldBeanTest.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
        .addClasses(TimerTagFieldBean.class, MetricsUtil.class)
        // Bean archive deployment descriptor
        .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
}
 
Example #24
Source File: FallbackTest.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, "ftfallback.jar")
                    .addClasses(FallbackClient.class, FallbackWithBeanClient.class,
                                    FallbackClassLevelClient.class, StringFallbackHandler.class,
                                    SecondStringFallbackHandler.class,
                                    StringFallbackHandlerWithBean.class, MyBean.class,
                                    FallbackOnlyClient.class)
                    .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
                    .as(JavaArchive.class);

    WebArchive war = ShrinkWrap.create(WebArchive.class, "ftFallback.war")
                    .addAsLibrary(testJar);
    return war;
}
 
Example #25
Source File: InvalidAsynchronousClassTest.java    From microprofile-fault-tolerance with Apache License 2.0 5 votes vote down vote up
@Deployment
@ShouldThrowException(value = FaultToleranceDefinitionException.class)
public static WebArchive deploy() {
    JavaArchive testJar = ShrinkWrap
        .create(JavaArchive.class, "ftInvalidAsnycClass.jar")
        .addClasses(AsynchronousClientForValidationClass.class)
        .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
        .as(JavaArchive.class);

    return ShrinkWrap
        .create(WebArchive.class, "ftInvalidAsnycClass.war")
        .addAsLibrary(testJar);
}
 
Example #26
Source File: CountedMethodTagBeanTest.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(CountedMethodTagBean.class)
        // Bean archive deployment descriptor
        .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
}
 
Example #27
Source File: CircuitBreakerLifecycleTest.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, "ftCircuitBreakerLifecycle.jar")
            .addPackage(CircuitBreakerLifecycleService.class.getPackage())
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
            .as(JavaArchive.class);

    return ShrinkWrap
            .create(WebArchive.class, "ftCircuitBreakerLifecycle.war")
            .addAsLibrary(testJar);
}
 
Example #28
Source File: CounterFieldTagBeanTest.java    From microprofile-metrics with Apache License 2.0 5 votes vote down vote up
@Deployment
public static Archive<?> createTestArchive() {
    return ShrinkWrap.create(WebArchive.class)
        // Test bean
        .addClass(CounterFieldTagBean.class)
        // Bean archive deployment descriptor
        .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
}
 
Example #29
Source File: DynamicConfigSourceTest.java    From ConfigJSR with Apache License 2.0 5 votes vote down vote up
@Deployment
public static WebArchive deploy() {
    JavaArchive testJar = ShrinkWrap
            .create(JavaArchive.class, "dynamicValuesTest.jar")
            .addClass(DynamicConfigSourceTest.class)
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
            .addAsServiceProvider(ConfigSource.class, DynamicChangeConfigSource.class)
            .as(JavaArchive.class);


    WebArchive war = ShrinkWrap
            .create(WebArchive.class, "dynamicValuesTest.war")
            .addAsLibrary(testJar);
    return war;
}
 
Example #30
Source File: CircuitBreakerInitialSuccessTest.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, "ftCircuitBreakerInitialSuccess.jar")
                    .addClasses(CircuitBreakerClientDefaultSuccessThreshold.class,
                                    Misc.class)
                    .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
                    .as(JavaArchive.class);

    return ShrinkWrap.create(WebArchive.class, "ftCircuitBreakerInitialSuccess.war")
                    .addAsLibrary(testJar);
}