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


Java WebArchive類代碼示例

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


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

示例1: createDeployment

import org.jboss.shrinkwrap.api.spec.WebArchive; //導入依賴的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.spec.WebArchive; //導入依賴的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: deploy

import org.jboss.shrinkwrap.api.spec.WebArchive; //導入依賴的package包/類
@Deployment
    public static WebArchive deploy() {
        JavaArchive testJar = ShrinkWrap
                .create(JavaArchive.class, "ftRetryVisibility.jar")
//                .addClasses(
//                        RS.class, 
//                        RetryServiceType.class,
//                        RetryService.class, 
//                        BaseRetryOnClassService.class,
//                        RetryOnClassServiceOverrideClassLevel.class,
//                        RetryOnClassServiceOverrideMethodLevel.class,
//                        RetryOnClassServiceNoAnnotationOnOveriddenMethod.class
//                )
                .addPackage("org.eclipse.microprofile.fault.tolerance.tck.visibility.retry")
                .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
                .as(JavaArchive.class);

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

示例4: deploy

import org.jboss.shrinkwrap.api.spec.WebArchive; //導入依賴的package包/類
@Deployment
public static WebArchive deploy() {
    JavaArchive testJar = ShrinkWrap
            .create(JavaArchive.class, "configProviderTest.jar")
            .addPackage(AbstractTest.class.getPackage())
            .addClass(ConfigProviderTest.class)
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
            .as(JavaArchive.class);

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

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

示例5: getBaseArchive

import org.jboss.shrinkwrap.api.spec.WebArchive; //導入依賴的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

示例6: deployment

import org.jboss.shrinkwrap.api.spec.WebArchive; //導入依賴的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

示例7: deploy

import org.jboss.shrinkwrap.api.spec.WebArchive; //導入依賴的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

示例8: createDeployment

import org.jboss.shrinkwrap.api.spec.WebArchive; //導入依賴的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 = ServletTest.class.getResource("/publicKey.pem");
    WebArchive webArchive = ShrinkWrap
        .create(WebArchive.class, "ServletTest.war")
        .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;
}
 
開發者ID:eclipse,項目名稱:microprofile-jwt-auth,代碼行數:22,代碼來源:ServletTest.java

示例9: deployAnotherApp

import org.jboss.shrinkwrap.api.spec.WebArchive; //導入依賴的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

示例10: createDeployment

import org.jboss.shrinkwrap.api.spec.WebArchive; //導入依賴的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

示例11: createDeployment

import org.jboss.shrinkwrap.api.spec.WebArchive; //導入依賴的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

示例12: createDeployment

import org.jboss.shrinkwrap.api.spec.WebArchive; //導入依賴的package包/類
/**
 * 
 * @return 
 */
@Deployment
public static WebArchive createDeployment()
{
    return ShrinkWrap.create(WebArchive.class, DEPLOY + ".war")
            .addPackage(FotoEntity.class.getPackage())
            .addPackage(FotoPersistence.class.getPackage())
            .addAsResource("META-INF/persistence.xml", "META-INF/persistence.xml")
            .addAsWebInfResource("META-INF/beans.xml", "beans.xml");
}
 
開發者ID:Uniandes-ISIS2603-backup,項目名稱:201710-paseos_01,代碼行數:14,代碼來源:FotoPersistenceTest.java

示例13: createDeployment

import org.jboss.shrinkwrap.api.spec.WebArchive; //導入依賴的package包/類
@Deployment
public static WebArchive createDeployment() {
    // Import Maven runtime dependencies
    final File[] dependencies = Maven.resolver().loadPomFromFile("pom.xml")
            .importRuntimeAndTestDependencies().resolve().withTransitivity().asFile();
    // Create deploy file
    return ShrinkWrap.create(WebArchive.class)
            .addPackages(false, Fabric8OpenShiftServiceImpl.class.getPackage(), OpenShiftServiceIT.class.getPackage(), OpenShiftService.class.getPackage())
            .addClasses(DeleteOpenShiftProjectRule.class, OpenShiftServiceSpi.class, OpenShiftTestCredentials.class)
            .addClasses(OpenShiftCluster.class, OpenShiftClusterRegistry.class, OpenShiftClusterRegistryImpl.class, OpenShiftClusterConstructor.class)
            .addAsResource("openshift-project-template.json")
            .addAsResource("foo-service-template.yaml")
            .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
            .addAsLibraries(dependencies);
}
 
開發者ID:fabric8-launcher,項目名稱:launcher-backend,代碼行數:16,代碼來源:OpenShiftServiceIT.java

示例14: createDeployment

import org.jboss.shrinkwrap.api.spec.WebArchive; //導入依賴的package包/類
@Deployment(testable = false)
public static WebArchive createDeployment() {

    File[] extraJars = Maven.resolver().loadPomFromFile("pom.xml")
        .resolve(
            "org.projectlombok:lombok:1.16.8",
            "io.jsonwebtoken:jjwt:0.8.0"
        )
        .withTransitivity()
        .asFile();

    final WebArchive war = ShrinkWrap.create(WebArchive.class, "test.war")
        .addAsLibraries(extraJars)
        .addPackage(AbstractEntity.class.getPackage())
        //domain package.
        .addPackage(User.class.getPackage())
        // repository package.
        .addPackage(UserRepository.class.getPackage())
        //base classes
        .addPackage(Bootstrap.class.getPackage())
        //Add JAXRS resources classes
        .addPackage(UserResource.class.getPackage())
        .addPackages(true, Authenticated.class.getPackage())
        // .addAsResource("test-log4j.properties", "log4j.properties")
        //Add JPA persistence configration.
        //WARN: In a war package, persistence.xml should be put into /WEB-INF/classes/META-INF/, not /META-INF
        //.addAsManifestResource("META-INF/test-persistence.xml", "persistence.xml")
        .addAsResource("META-INF/test-persistence.xml", "META-INF/persistence.xml")
        // .addAsResource("META-INF/test-orm.xml", "META-INF/orm.xml")

        .addAsWebInfResource("test-web.xml", "web.xml")
        // Enable CDI
        .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
    //  .addAsWebInfResource("test-jboss-deployment-structure.xml", "jboss-deployment-structure.xml");

    LOG.log(Level.INFO, "war to string @{0}", war.toString(true));
    return war;
}
 
開發者ID:hantsy,項目名稱:javaee8-jaxrs-sample,代碼行數:39,代碼來源:UserResourceWithoutAuthIT.java

示例15: createDeployment

import org.jboss.shrinkwrap.api.spec.WebArchive; //導入依賴的package包/類
@Deployment
public static WebArchive createDeployment() {
    String url = SimpleGetApi.class.getName() + "/mp-rest/url=http://localhost:8080";
    String url2 = MyAppScopedApi.class.getName() + "/mp-rest/url=http://localhost:8080";
    String scope = SimpleGetApi.class.getName() + "/mp-rest/scope=" + ApplicationScoped.class.getName();
    JavaArchive jar = ShrinkWrap.create(JavaArchive.class)
        .addClasses(SimpleGetApi.class, MyAppScopedApi.class)
        .addAsManifestResource(new StringAsset(url + "\n" + scope + "\n"+ url2), "microprofile-config.properties")
        .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
    return ShrinkWrap.create(WebArchive.class)
        .addAsLibrary(jar)
        .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
}
 
開發者ID:eclipse,項目名稱:microprofile-rest-client,代碼行數:14,代碼來源:HasAppScopeTest.java


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