本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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);
}
示例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()));
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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"));
}
示例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");
}
示例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);
}
示例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;
}
示例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");
}