當前位置: 首頁>>代碼示例>>Java>>正文


Java ShrinkWrap類代碼示例

本文整理匯總了Java中org.jboss.shrinkwrap.api.ShrinkWrap的典型用法代碼示例。如果您正苦於以下問題:Java ShrinkWrap類的具體用法?Java ShrinkWrap怎麽用?Java ShrinkWrap使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ShrinkWrap類屬於org.jboss.shrinkwrap.api包,在下文中一共展示了ShrinkWrap類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createDeployment

import org.jboss.shrinkwrap.api.ShrinkWrap; //導入依賴的package包/類
/**
 * @return a war file containing all the required classes and dependencies
 * to test the {@link GitHubService}
 */
@Deployment
public static WebArchive createDeployment() {
    // Import Maven runtime dependencies
    final File[] dependencies = Maven.resolver().loadPomFromFile("pom.xml")
            .importDependencies(RUNTIME, COMPILE)
            .resolve().withTransitivity()
            .asFile();

    final File[] testDependencies = Maven.resolver().loadPomFromFile("pom.xml").resolve("org.assertj:assertj-core").withoutTransitivity().asFile();
    // Create deploy file
    WebArchive war = ShrinkWrap.create(WebArchive.class)
            .addPackage(KohsukeGitHubServiceFactoryImpl.class.getPackage())
            .addClasses(GitHubTestCredentials.class, GitHubServiceSpi.class, AbstractGitService.class)
            // libraries will include all classes/interfaces from the API project.
            .addAsLibraries(dependencies)
            .addAsLibraries(testDependencies);
    // Show the deployed structure
    log.fine(war.toString(true));
    return war;
}
 
開發者ID:fabric8-launcher,項目名稱:launcher-backend,代碼行數:25,代碼來源:GitHubServiceIT.java

示例2: deployAnotherApp

import org.jboss.shrinkwrap.api.ShrinkWrap; //導入依賴的package包/類
@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;
}
 
開發者ID:eclipse,項目名稱:microprofile-fault-tolerance,代碼行數:18,代碼來源:ConfigPropertyGlobalVsClassVsMethodTest.java

示例3: deployment

import org.jboss.shrinkwrap.api.ShrinkWrap; //導入依賴的package包/類
@Deployment
public static WebArchive deployment() {
  PomEquippedResolveStage pom = Maven.resolver().loadPomFromFile("pom.xml");

  String[] libraries = new String[]{"de.undercouch:actson", "commons-io:commons-io"};

  return ShrinkWrap.create(WebArchive.class)
    .addPackage(SingleItemPublisher.class.getPackage())
    .addPackage(Customer.class.getPackage())
    .addPackage(JsonConverter.class.getPackage())
    .addPackage(PublisherMessageBodyReader.class.getPackage())
    .addAsLibraries(pom.resolve(libraries).withTransitivity().asFile())
    .setWebXML(new StringAsset(Descriptors.create(WebAppDescriptor.class)
      .addDefaultNamespaces()
      .version("3.1")
      .exportAsString()));
}
 
開發者ID:openknowledge,項目名稱:reactive-jax-rs,代碼行數:18,代碼來源:CustomerBatchUploadTest.java

示例4: getBaseArchive

import org.jboss.shrinkwrap.api.ShrinkWrap; //導入依賴的package包/類
@Override
public WebArchive getBaseArchive() {

    // TODO: Can we get the versions from the pom?
    File[] dependencies = Maven.resolver()
            .resolve(
                    "javax.mvc:javax.mvc-api:1.0-pr",
                    "org.mvc-spec.ozark:ozark-core:1.0.0-m03",
                    "org.mvc-spec.ozark:ozark-jersey:1.0.0-m03"
            )
            .withoutTransitivity()
            .asFile();

    return ShrinkWrap.create(WebArchive.class)
            .addAsLibraries(dependencies);
}
 
開發者ID:mvc-spec,項目名稱:mvc-tck,代碼行數:17,代碼來源:OzarkGlassfishProvider.java

示例5: deploy

import org.jboss.shrinkwrap.api.ShrinkWrap; //導入依賴的package包/類
@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;
}
 
開發者ID:eclipse,項目名稱:ConfigJSR,代碼行數:22,代碼來源:ConverterTest.java

示例6: deployAnotherApp

import org.jboss.shrinkwrap.api.ShrinkWrap; //導入依賴的package包/類
@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;
}
 
開發者ID:eclipse,項目名稱:microprofile-fault-tolerance,代碼行數:17,代碼來源:ConfigPropertyGlobalVsClassTest.java

示例7: deploy

import org.jboss.shrinkwrap.api.ShrinkWrap; //導入依賴的package包/類
@Deployment
public static WebArchive deploy() {
    JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, "ftCircuitBreaker.jar")
        .addClasses(CircuitBreakerClientDefaultSuccessThreshold.class,
                    Misc.class)
        .addAsManifestResource(new StringAsset(
                                   "org.eclipse.microprofile.fault.tolerance.tck.circuitbreaker" +
                                       ".clientserver.CircuitBreakerClientDefaultSuccessThreshold/serviceA/CircuitBreaker/delay=200")
            , "microprofile-config.properties")
        .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
        .as(JavaArchive.class);

    WebArchive war = ShrinkWrap.create(WebArchive.class, "ftCircuitBreaker.war")
        .addAsLibrary(testJar);
    return war;
}
 
開發者ID:eclipse,項目名稱:microprofile-fault-tolerance,代碼行數:17,代碼來源:CircuitBreakerConfigOnMethodTest.java

示例8: createDeployment

import org.jboss.shrinkwrap.api.ShrinkWrap; //導入依賴的package包/類
@Deployment(testable = false)
public static WebArchive createDeployment() {
    return ShrinkWrap.create(WebArchive.class,"paseos-01-web.war")
            // Se agrega las dependencias
            .addAsLibraries(Maven.resolver().loadPomFromFile("pom.xml")
                    .importRuntimeDependencies().resolve()
                    .withTransitivity().asFile())
            // Se agregan los compilados de los paquetes de servicios
            .addPackage(PaseoResource.class.getPackage())
            // El archivo que contiene la configuracion a la base de datos.
            .addAsResource("META-INF/persistence.xml", "META-INF/persistence.xml")
            // El archivo beans.xml es necesario para injeccion de dependencias.
            .addAsWebInfResource(new File("src/main/webapp/WEB-INF/beans.xml"))
            // El archivo shiro.ini es necesario para injeccion de dependencias
            
            // El archivo web.xml es necesario para el despliegue de los servlets
            .setWebXML(new File("src/main/webapp/WEB-INF/web.xml"));
             
}
 
開發者ID:Uniandes-ISIS2603-backup,項目名稱:201710-paseos_01,代碼行數:20,代碼來源:FotosTestIntegracion.java

示例9: createDeployment

import org.jboss.shrinkwrap.api.ShrinkWrap; //導入依賴的package包/類
/**
 * 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")
        .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;
}
 
開發者ID:eclipse,項目名稱:microprofile-jwt-auth,代碼行數:21,代碼來源:EjbTest.java

示例10: main

import org.jboss.shrinkwrap.api.ShrinkWrap; //導入依賴的package包/類
public static void main(String[] args) throws Exception {
    // Instantiate the container
    Swarm swarm = new Swarm(args);

    // Create one or more deployments
    WARArchive deployment = ShrinkWrap.create(WARArchive.class);

    // Add resource to deployment
    deployment.addPackage(Main.class.getPackage());
    deployment.addAllDependencies();

    // Add Web resources
    deployment.addAsWebResource(
            new ClassLoaderAsset("src/main/webapp/index.html", Main.class.getClassLoader()), "src/main/webapp/index.html");
    deployment.addAsWebInfResource(
            new ClassLoaderAsset("src/main/webapp/WEB-INF/beans.xml", Main.class.getClassLoader()), "beans.xml");


    swarm.start().deploy(deployment);

}
 
開發者ID:xstefank,項目名稱:lra-service,代碼行數:22,代碼來源:Main.java

示例11: deploy

import org.jboss.shrinkwrap.api.ShrinkWrap; //導入依賴的package包/類
@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;
}
 
開發者ID:eclipse,項目名稱:ConfigJSR,代碼行數:18,代碼來源:ArrayConverterTest.java

示例12: createDeployment

import org.jboss.shrinkwrap.api.ShrinkWrap; //導入依賴的package包/類
protected static JAXRSArchive createDeployment(Swarm container) throws Exception {
    System.out.println("\tConfiguration folder is " + configFolder);
    
    LoginModule<?> loginModule = new LoginModule<>("UsersRoles");
    loginModule.flag(Flag.REQUIRED)
    .code("UsersRoles")
    .moduleOption("usersProperties", configFolder + "/security/application-users.properties")
    .moduleOption("rolesProperties", configFolder + "/security/application-roles.properties");
    
    SecurityDomain<?> security = new SecurityDomain<>("other")
            .classicAuthentication(new ClassicAuthentication<>()
                    .loginModule(loginModule)); 
    container.fraction(new SecurityFraction().securityDomain(security));

    JAXRSArchive deployment = ShrinkWrap.create(JAXRSArchive.class, "kie-server.war");
    deployment.staticContent();
    deployment.addAllDependencies();
    deployment.addAsWebInfResource(new File(configFolder + "/web/web.xml"), "web.xml");
    deployment.addAsWebInfResource(new File(configFolder + "/web/jboss-web.xml"), "jboss-web.xml");
    
            
    return deployment;
    
}
 
開發者ID:jesuino,項目名稱:kie-ml,代碼行數:25,代碼來源:AbstractKieServerMain.java

示例13: createDeployment

import org.jboss.shrinkwrap.api.ShrinkWrap; //導入依賴的package包/類
/**
 * Create war archive to test.
 *
 * @return the war used for testing
 */
public static Archive<?> createDeployment() {
    return ShrinkWrap.create(WebArchive.class)
            .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
            .addAsServiceProvider(Extension.class, LauncherExtension.class)
            .addPackages(true,
                         HttpEndpoints.class.getPackage(),
                         ForgeInitializer.class.getPackage())
            .addAsLibraries(Maven.resolver()
                                    .loadPomFromFile("pom.xml")
                                    .importCompileAndRuntimeDependencies()
                                    .resolve().withTransitivity().asFile());
}
 
開發者ID:fabric8-launcher,項目名稱:launcher-backend,代碼行數:18,代碼來源:Deployments.java

示例14: deploy

import org.jboss.shrinkwrap.api.ShrinkWrap; //導入依賴的package包/類
@Deployment
public static WebArchive deploy() {
    JavaArchive testJar = ShrinkWrap
            .create(JavaArchive.class, "autoDiscoveredConfigSourceTest.jar")
            .addClasses(AutoDiscoveredConfigSourceTest.class, CustomDbConfigSource.class, Pizza.class, PizzaConverter.class)
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
            .addAsServiceProvider(ConfigSource.class, CustomDbConfigSource.class)
            .addAsServiceProvider(Converter.class, PizzaConverter.class)
            .as(JavaArchive.class);

    WebArchive war = ShrinkWrap
            .create(WebArchive.class, "autoDiscoveredConfigSourceTest.war")
            .addAsLibrary(testJar);
    return war;
}
 
開發者ID:eclipse,項目名稱:ConfigJSR,代碼行數:16,代碼來源:AutoDiscoveredConfigSourceTest.java

示例15: createDeployment

import org.jboss.shrinkwrap.api.ShrinkWrap; //導入依賴的package包/類
@Deployment
public static WebArchive createDeployment() {
    return ShrinkWrap.create(WebArchive.class)
            .addClasses(
                    ArtistService.class, ArtistService.class, ArtistDao.class, ArtistDao.class,
                    AlbumDao.class, AlbumDao.class, MaprDbDao.class, MaprDbDao.class, SlugService.class,
                    StatisticServiceMock.class, StatisticDao.class, StatisticDao.class)
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
}
 
開發者ID:mapr-demos,項目名稱:mapr-music,代碼行數:10,代碼來源:ArtistServiceIntegrationTest.java


注:本文中的org.jboss.shrinkwrap.api.ShrinkWrap類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。