本文整理匯總了Java中org.jboss.shrinkwrap.api.asset.StringAsset類的典型用法代碼示例。如果您正苦於以下問題:Java StringAsset類的具體用法?Java StringAsset怎麽用?Java StringAsset使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
StringAsset類屬於org.jboss.shrinkwrap.api.asset包,在下文中一共展示了StringAsset類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: deployment
import org.jboss.shrinkwrap.api.asset.StringAsset; //導入依賴的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()));
}
示例2: createTestArchive2
import org.jboss.shrinkwrap.api.asset.StringAsset; //導入依賴的package包/類
@Deployment(name= APP_NAME, order = 2, testable = false)
public static Archive<?> createTestArchive2() throws IOException {
File[] files = Maven.resolver().loadPomFromFile("pom.xml")
.importRuntimeDependencies().resolve().withTransitivity().asFile();
return ShrinkWrap.create(WebArchive.class, "app-jsp.war")
.addPackages(true, Filters.exclude(".*Test.*"), Controller.class.getPackage())
.addAsLibraries(files)
.addAsWebResource(new File(WEBAPP_SRC, "index.jsp"))
.addAsWebResource(new File(WEBAPP_SRC, "protected.jsp"))
.addAsWebResource(new File(WEBAPP_SRC, "styles.css"))
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
.addAsWebInfResource(new StringAsset(createClient(ClientBuilder.create(APP_NAME)
.rootUrl(ROOT_URL)
.accessType(PUBLIC))), "keycloak.json")
.setWebXML(new File("src/main/webapp", "WEB-INF/web.xml"));
}
示例3: deploy
import org.jboss.shrinkwrap.api.asset.StringAsset; //導入依賴的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;
}
示例4: deployAnotherApp
import org.jboss.shrinkwrap.api.asset.StringAsset; //導入依賴的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;
}
示例5: deployAnotherApp
import org.jboss.shrinkwrap.api.asset.StringAsset; //導入依賴的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"),
"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,代碼來源:ConfigPropertyOnClassAndMethodTest.java
示例6: deployAnotherApp
import org.jboss.shrinkwrap.api.asset.StringAsset; //導入依賴的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
示例7: deploy
import org.jboss.shrinkwrap.api.asset.StringAsset; //導入依賴的package包/類
@Deployment
public static WebArchive deploy() {
JavaArchive testJar = ShrinkWrap
.create(JavaArchive.class, "ftConfig.jar")
.addClasses(ConfigClient.class, ConfigClassLevelClient.class, ConfigClassLevelMaxDurationClient.class)
.addAsManifestResource(new StringAsset(
"org.eclipse.microprofile.fault.tolerance.tck.config.clientserver.ConfigClient/serviceA/Retry/maxRetries=3"+
"\norg.eclipse.microprofile.fault.tolerance.tck.config.clientserver.ConfigClassLevelClient/Retry/maxRetries=3"+
"\norg.eclipse.microprofile.fault.tolerance.tck.config.clientserver.ConfigClient/serviceC/Retry/maxDuration=1000"+
"\norg.eclipse.microprofile.fault.tolerance.tck.config.clientserver.ConfigClassLevelMaxDurationClient/Retry/maxDuration=1000"),
"microprofile-config.properties")
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
.as(JavaArchive.class);
WebArchive war = ShrinkWrap
.create(WebArchive.class, "ftConfig.war")
.addAsLibrary(testJar);
return war;
}
示例8: getImplicitDeployments
import org.jboss.shrinkwrap.api.asset.StringAsset; //導入依賴的package包/類
@Override
public List<Archive> getImplicitDeployments(TopologyWebAppFraction fraction) throws Exception {
String context = System.getProperty(TopologyProperties.CONTEXT_PATH);
if (context == null) context = DEFAULT_CONTEXT;
List<Archive> list = new ArrayList<>();
if (fraction.exposeTopologyEndpoint()) {
WARArchive war = ShrinkWrap.create(WARArchive.class, "topology-webapp.war");
war.addAsWebInfResource(new StringAsset(getWebXml(fraction)), "web.xml");
war.addClass(TopologySSEServlet.class);
war.addModule("swarm.application");
war.addModule("org.wildfly.swarm.topology");
war.addAsWebResource(new ClassLoaderAsset("topology.js", this.getClass().getClassLoader()), "topology.js");
war.setContextRoot(context);
war.as(TopologyArchive.class);
list.add(war);
}
return list;
}
開發者ID:wildfly-swarm-archive,項目名稱:wildfly-swarm-topology,代碼行數:20,代碼來源:TopologyWebAppConfiguration.java
示例9: doAdvertise
import org.jboss.shrinkwrap.api.asset.StringAsset; //導入依賴的package包/類
protected TopologyArchive doAdvertise() {
if (!as(ServiceActivatorArchive.class).containsServiceActivator(SERVICE_ACTIVATOR_CLASS_NAME)) {
as(ServiceActivatorArchive.class).addServiceActivator(SERVICE_ACTIVATOR_CLASS_NAME);
as(JARArchive.class).addModule("org.wildfly.swarm.topology", "runtime");
}
StringBuffer buf = new StringBuffer();
List<String> names = getServiceNames();
for (String name : names) {
buf.append(name).append("\n");
}
as(JARArchive.class).add(new StringAsset(buf.toString()), REGISTRATION_CONF);
return this;
}
示例10: startFirst
import org.jboss.shrinkwrap.api.asset.StringAsset; //導入依賴的package包/類
@Deployment(testable = false)
public static WebArchive startFirst() {
return ShrinkWrap.create(WebArchive.class, "session-cookie-agent.war")
.addClasses(FirstServlet2x.class, OtherServlet2x.class,
BaseServlet.class, SomeFilter.class,
SessionListenerCalled2x.class,
InvalidateSession2x.class,
CallCountingSessionListener.class)
.setWebXML(new StringAsset(Descriptors.create(WebAppDescriptor.class).version("2.5")
.getOrCreateContextParam().paramName(SessionConfiguration.DEFAULT_SESSION_TIMEOUT).paramValue("2").up()
.createFilter().filterName("someFilter").filterClass(SomeFilter.class.getName()).up()
.createServlet().servletName("firstServlet").servletClass(FirstServlet2x.class.getName()).up()
.createServlet().servletName("secondServlet").servletClass(OtherServlet2x.class.getName()).up()
.createServlet().servletName("invalidateServlet").servletClass(InvalidateSession2x.class.getName()).up()
.createServlet().servletName("sessionListenerServlet").servletClass(SessionListenerCalled2x.class.getName()).up()
.createListener().listenerClass(CallCountingSessionListener.class.getName()).up()
.createFilterMapping().filterName("someFilter").urlPattern("/*").up()
.createServletMapping().servletName("firstServlet").urlPattern("/FirstServlet").up()
.createServletMapping().servletName("secondServlet").urlPattern("/OtherServlet").up()
.createServletMapping().servletName("invalidateServlet").urlPattern("/InvalidateServlet").up()
.createServletMapping().servletName("sessionListenerServlet").urlPattern("/SessionListener").up()
.exportAsString()));
}
開發者ID:AmadeusITGroup,項目名稱:HttpSessionReplacer,代碼行數:24,代碼來源:AgentServlet2xITSessionWithCookieSomeFilter.java
示例11: testAdvertiseMultiple
import org.jboss.shrinkwrap.api.asset.StringAsset; //導入依賴的package包/類
@Test
public void testAdvertiseMultiple() {
JARArchive archive = ShrinkWrap.create(JARArchive.class, "myapp.war");
archive.as(RibbonArchive.class)
.advertise("service-a")
.advertise("service-b")
.advertise("service-c");
Asset asset = archive.get(RibbonArchive.REGISTRATION_CONF).getAsset();
assertThat(asset).isNotNull();
assertThat(asset).isInstanceOf(StringAsset.class);
String[] services = ((StringAsset) asset).getSource().split("\n");
assertThat(services).contains("service-a");
assertThat(services).contains("service-b");
assertThat(services).contains("service-c");
assertThat(archive.as(ServiceActivatorArchive.class).containsServiceActivator(RibbonArchiveImpl.SERVICE_ACTIVATOR_CLASS_NAME)).isTrue();
}
示例12: deployment
import org.jboss.shrinkwrap.api.asset.StringAsset; //導入依賴的package包/類
@Produces
@Dependent()
Archive deployment() {
String context = TopologyWebAppFraction.DEFAULT_CONTEXT;
if (this.contextPath != null) {
context = this.contextPath;
}
if (fraction.exposeTopologyEndpoint()) {
WARArchive war = ShrinkWrap.create(WARArchive.class, "topology-webapp.war");
war.addAsWebInfResource(new StringAsset(getWebXml(fraction)), "web.xml");
war.addClass(TopologySSEServlet.class);
war.addModule("swarm.application");
war.addModule("org.wildfly.swarm.topology");
war.addAsWebResource(new ClassLoaderAsset("topology.js", this.getClass().getClassLoader()), "topology.js");
war.setContextRoot(context);
war.as(TopologyArchive.class);
return war;
}
return null;
}
示例13: doAdvertise
import org.jboss.shrinkwrap.api.asset.StringAsset; //導入依賴的package包/類
protected TopologyArchive doAdvertise() {
if (!as(ServiceActivatorArchive.class).containsServiceActivator(SERVICE_ACTIVATOR_CLASS_NAME)) {
as(ServiceActivatorArchive.class).addServiceActivator(SERVICE_ACTIVATOR_CLASS_NAME);
//as(JARArchive.class).addModule("org.wildfly.swarm.topology", "deployment");
}
StringBuilder registrationConf = new StringBuilder();
List<String> names = getServiceNames();
for (String name : names) {
Collection<String> tags = tagsByService.getOrDefault(name, Collections.emptyList());
registrationConf.append(name);
if (!tags.isEmpty()) {
registrationConf.append(" ")
.append(
tags.stream().collect(Collectors.joining(TAG_SEPARATOR))
);
}
registrationConf.append("\n");
}
as(JARArchive.class).add(new StringAsset(registrationConf.toString()), REGISTRATION_CONF);
return this;
}
示例14: process
import org.jboss.shrinkwrap.api.asset.StringAsset; //導入依賴的package包/類
public void process() {
if (archive.get("META-INF/arquillian-testable") == null) {
return;
}
archive.add(new StringAsset(archive.getName()), "META-INF/arquillian-testable");
archive.as(JARArchive.class)
.addModule("org.wildfly.swarm.arquillian.adapter");
archive.as(JARArchive.class)
.addModule("org.wildfly.swarm.arquillian", "deployment");
archive.as(ServiceActivatorArchive.class)
.addServiceActivator("org.wildfly.swarm.arquillian.deployment.TestableArchiveServiceActivator");
}
示例15: startProcessJar
import org.jboss.shrinkwrap.api.asset.StringAsset; //導入依賴的package包/類
/**
* Start the cli process
*/
@Test
public void startProcessJar() throws Exception {
String jarName = String.format("target%stest.jar", File.separator);
String java = System.getProperty("java.home") + Config.getPathSeparator() + "bin" + Config.getPathSeparator() + "java";
JavaArchive archive = ShrinkWrap.create(MavenImporter.class).loadPomFromFile("pom.xml").importBuildOutput().importBuildOutput().as(JavaArchive.class);
archive.addAsManifestResource(new StringAsset(String.format("Manifest-Version: 1.0\n" + "Main-Class: %s\n", SimpleTestExample.class.getCanonicalName())), "MANIFEST.MF");
archive.addClass(SimpleTestExample.class);
File fileArchive = new File(jarName);
archive.as(ZipExporter.class).exportTo(fileArchive, true);
ProcessBuilder pb = new ProcessBuilder(
java,
"-jar",
jarName);
testReadlineByProcessBuilder(pb);
}