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