本文整理汇总了Java中org.jboss.shrinkwrap.descriptor.api.Descriptors类的典型用法代码示例。如果您正苦于以下问题:Java Descriptors类的具体用法?Java Descriptors怎么用?Java Descriptors使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Descriptors类属于org.jboss.shrinkwrap.descriptor.api包,在下文中一共展示了Descriptors类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: persistenceXml
import org.jboss.shrinkwrap.descriptor.api.Descriptors; //导入依赖的package包/类
private static PersistenceDescriptor persistenceXml() {
Properties<PersistenceUnit<PersistenceDescriptor>> propertiesContext = Descriptors.create( PersistenceDescriptor.class )
.version( "2.0" )
.createPersistenceUnit()
.name( "primary" )
.provider( "org.hibernate.ogm.jpa.HibernateOgmPersistence" )
.getOrCreateProperties();
if ( RedisTestProperties.getPassword() != null ) {
propertiesContext.createProperty().name( OgmProperties.PASSWORD ).value( RedisTestProperties.getPassword() );
}
return propertiesContext
.createProperty().name( OgmProperties.HOST ).value( RedisTestProperties.getHost() ).up()
.createProperty().name( OgmProperties.DATASTORE_PROVIDER ).value( Redis.DATASTORE_PROVIDER_NAME ).up()
.createProperty().name( OgmProperties.DATABASE ).value( "0" ).up()
.createProperty().name( RedisProperties.TTL ).value( "3600" ).up()
.createProperty().name( "hibernate.search.default.directory_provider" ).value( "ram" ).up()
.createProperty().name( "wildfly.jpa.hibernate.search.module" ).value( "org.hibernate.search.orm:${hibernate-search.module.slot}" ).up()
.up().up();
}
开发者ID:hibernate,项目名称:hibernate-ogm-redis,代码行数:21,代码来源:RedisModuleMemberRegistrationWithTTLConfiguredIT.java
示例2: persistenceXml
import org.jboss.shrinkwrap.descriptor.api.Descriptors; //导入依赖的package包/类
private static PersistenceDescriptor persistenceXml() {
Properties<PersistenceUnit<PersistenceDescriptor>> propertiesContext = Descriptors.create( PersistenceDescriptor.class )
.version( "2.0" )
.createPersistenceUnit()
.name( "primary" )
.provider( "org.hibernate.ogm.jpa.HibernateOgmPersistence" )
.getOrCreateProperties();
if ( RedisTestProperties.getPassword() != null ) {
propertiesContext.createProperty().name( OgmProperties.PASSWORD ).value( RedisTestProperties.getPassword() );
}
return propertiesContext
.createProperty().name( OgmProperties.HOST ).value( RedisTestProperties.getHost() ).up()
.createProperty().name( OgmProperties.DATASTORE_PROVIDER ).value( Redis.DATASTORE_PROVIDER_NAME ).up()
.createProperty().name( OgmProperties.DATABASE ).value( "0" ).up()
.createProperty().name( "hibernate.search.default.directory_provider" ).value( "ram" ).up()
.createProperty().name( "wildfly.jpa.hibernate.search.module" ).value( "org.hibernate.search.orm:${hibernate-search.module.slot}" ).up()
.up().up();
}
示例3: deployment
import org.jboss.shrinkwrap.descriptor.api.Descriptors; //导入依赖的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: startFirst
import org.jboss.shrinkwrap.descriptor.api.Descriptors; //导入依赖的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
示例5: yaml_parsing
import org.jboss.shrinkwrap.descriptor.api.Descriptors; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void yaml_parsing() throws Exception {
InputStream in = getClass().getClassLoader().getResourceAsStream("security.yml");
assertThat(in).isNotNull().as("security.yml is null");
Yaml yaml = new Yaml();
Map<String, Object> httpConfig = (Map<String, Object>) yaml.load(in);
preparer.deploymentConfigs = (Map) ((Map) httpConfig.get("swarm")).get("deployment");
preparer.process();
WebAppDescriptor webXml = Descriptors.importAs(WebAppDescriptor.class).fromStream(archive.get(WebXmlAsset.NAME).getAsset().openStream());
assertThat(webXml.getAllSecurityConstraint().size()).isEqualTo(1);
assertThat(webXml.getAllSecurityConstraint().get(0).getAllWebResourceCollection().get(0).getAllUrlPattern().get(0)).isEqualTo("/protected");
}
示例6: yaml_parsing_again
import org.jboss.shrinkwrap.descriptor.api.Descriptors; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void yaml_parsing_again() throws Exception {
InputStream in = getClass().getClassLoader().getResourceAsStream("security2.yml");
assertThat(in).isNotNull().as("security2.yml is null");
Yaml yaml = new Yaml();
Map<String, Object> httpConfig = (Map<String, Object>) yaml.load(in);
preparer.deploymentConfigs = (Map) ((Map) httpConfig.get("swarm")).get("deployment");
preparer.process();
WebAppDescriptor webXml = Descriptors.importAs(WebAppDescriptor.class).fromStream(archive.get(WebXmlAsset.NAME).getAsset().openStream());
assertThat(webXml.getAllSecurityConstraint().size()).isEqualTo(1);
assertThat(webXml.getAllSecurityConstraint().get(0).getAllWebResourceCollection().get(0).getAllUrlPattern().get(0)).isEqualTo("/protected");
}
示例7: set_1_security_constraint
import org.jboss.shrinkwrap.descriptor.api.Descriptors; //导入依赖的package包/类
@Test
public void set_1_security_constraint() throws Exception {
Map<String, Object> deploymentConfig = createConfigStub();
Map<String, Object> webConfig = findWebConfig(deploymentConfig);
Map<String, Object> securityConstraint = new HashMap<>();
securityConstraint.put("url-pattern", "/aaa");
webConfig.put("security-constraints", Collections.singletonList(securityConstraint));
preparer.deploymentConfigs = deploymentConfig;
preparer.process();
WebAppDescriptor webXml = Descriptors.importAs(WebAppDescriptor.class).fromStream(archive.get(WebXmlAsset.NAME).getAsset().openStream());
assertThat(webXml.getAllSecurityConstraint().size()).isEqualTo(1);
assertThat(webXml.getAllSecurityConstraint().get(0).getAllWebResourceCollection().get(0).getAllUrlPattern().get(0)).isEqualTo("/aaa");
}
示例8: set_2_security_constraints
import org.jboss.shrinkwrap.descriptor.api.Descriptors; //导入依赖的package包/类
@Test
public void set_2_security_constraints() throws Exception {
Map<String, Object> deploymentConfig = createConfigStub();
Map<String, Object> webConfig = findWebConfig(deploymentConfig);
Map<String, Object> securityConstraint1 = new HashMap<>();
securityConstraint1.put("url-pattern", "/aaa");
Map<String, Object> securityConstraint2 = new HashMap<>();
securityConstraint2.put("url-pattern", "/bbb");
webConfig.put("security-constraints", Arrays.asList(securityConstraint1, securityConstraint2));
preparer.deploymentConfigs = deploymentConfig;
preparer.process();
WebAppDescriptor webXml = Descriptors.importAs(WebAppDescriptor.class).fromStream(archive.get(WebXmlAsset.NAME).getAsset().openStream());
assertThat(webXml.getAllSecurityConstraint().size()).isEqualTo(2);
assertThat(webXml.getAllSecurityConstraint().get(0).getAllWebResourceCollection().get(0).getAllUrlPattern().get(0)).isEqualTo("/aaa");
assertThat(webXml.getAllSecurityConstraint().get(1).getAllWebResourceCollection().get(0).getAllUrlPattern().get(0)).isEqualTo("/bbb");
}
示例9: set_1_method
import org.jboss.shrinkwrap.descriptor.api.Descriptors; //导入依赖的package包/类
@Test
public void set_1_method() throws Exception {
Map<String, Object> deploymentConfig = createConfigStub();
Map<String, Object> webConfig = findWebConfig(deploymentConfig);
Map<String, Object> securityConstraint = new HashMap<>();
securityConstraint.put("methods", Arrays.asList("GET"));
webConfig.put("security-constraints", Collections.singletonList(securityConstraint));
preparer.deploymentConfigs = deploymentConfig;
preparer.process();
WebAppDescriptor webXml = Descriptors.importAs(WebAppDescriptor.class).fromStream(archive.get(WebXmlAsset.NAME).getAsset().openStream());
assertThat(webXml.getAllSecurityConstraint().size()).isEqualTo(1);
assertThat(webXml.getAllSecurityConstraint().get(0).getAllWebResourceCollection().get(0).getAllHttpMethod().get(0)).isEqualTo("GET");
}
示例10: set_2_methods
import org.jboss.shrinkwrap.descriptor.api.Descriptors; //导入依赖的package包/类
@Test
public void set_2_methods() throws Exception {
Map<String, Object> deploymentConfig = createConfigStub();
Map<String, Object> webConfig = findWebConfig(deploymentConfig);
Map<String, Object> securityConstraint = new HashMap<>();
securityConstraint.put("methods", Arrays.asList("GET", "POST"));
webConfig.put("security-constraints", Collections.singletonList(securityConstraint));
preparer.deploymentConfigs = deploymentConfig;
preparer.process();
WebAppDescriptor webXml = Descriptors.importAs(WebAppDescriptor.class).fromStream(archive.get(WebXmlAsset.NAME).getAsset().openStream());
assertThat(webXml.getAllSecurityConstraint().size()).isEqualTo(1);
assertThat(webXml.getAllSecurityConstraint().get(0).getAllWebResourceCollection().get(0).getAllHttpMethod().get(0)).isEqualTo("GET");
assertThat(webXml.getAllSecurityConstraint().get(0).getAllWebResourceCollection().get(0).getAllHttpMethod().get(1)).isEqualTo("POST");
}
示例11: createDeployment
import org.jboss.shrinkwrap.descriptor.api.Descriptors; //导入依赖的package包/类
@Deployment(name="glassfish",testable = true)
public static WebArchive createDeployment() {
WebArchive wa = ShrinkWrap.create(WebArchive.class, "test.jar")
.addPackage(Address.class.getPackage()).addPackage(Bid.class.getPackage())
.addPackage(BidService.class.getPackage())
.addAsResource(new StringAsset(
Descriptors.create(PersistenceDescriptor.class)
.persistenceUnit("actionbazaar")
.provider("oracle.toplink.essentials.PersistenceProvider")
.transactionType(TransactionType.JTA)
.jtaDataSource("jdbc/actionbazaar")
.schemaGenerationMode(SchemaGenerationModeType.CREATE_DROP)
.exportAsString()), "META-INF/persistence.xml");
wa.addAsWebInfResource(new File("src/test/resources/web.xml"), "src/test/resources/web.xml");
return wa;
}
示例12: testParsing
import org.jboss.shrinkwrap.descriptor.api.Descriptors; //导入依赖的package包/类
@Test
public void testParsing() throws Exception
{
String dockerFileContents = "FROM jbossforge\nUSER George\nRUN cmd.exe /n";
DescriptorImporter<DockerDescriptor> importer = Descriptors.importAs(DockerDescriptor.class);
DockerDescriptor descriptor = importer.fromString(dockerFileContents);
Assert.assertNotNull(descriptor);
Assert.assertEquals(3, descriptor.getInstructions().size());
Assert.assertNotNull(descriptor.getFrom());
Assert.assertNotNull(descriptor.getUser());
Assert.assertEquals(1, descriptor.getAllRun().size());
Assert.assertEquals("jbossforge", descriptor.getFrom().getName());
Assert.assertEquals("George", descriptor.getUser().getName());
List<String> parameters = descriptor.getAllRun().get(0).getParameters();
Assert.assertEquals("cmd.exe", parameters.get(0));
Assert.assertEquals("/n", parameters.get(1));
}
示例13: createDeployment
import org.jboss.shrinkwrap.descriptor.api.Descriptors; //导入依赖的package包/类
@Deployment(testable = false)
public static JavaArchive createDeployment() throws Exception {
ResourceDeployer.addQueue(INPUT_QUEUE);
ResourceDeployer.addQueue(INPUT_INOUT_QUEUE);
ResourceDeployer.addQueue(INPUT_INOUT_PHYSICAL_NAME_QUEUE + "_physical", INPUT_INOUT_PHYSICAL_NAME_QUEUE + "_jndi");
ResourceDeployer.addQueue(INOUT_REPLY_TO_QUEUE);
ResourceDeployer.addQueue(INOUT_REPLY_TO_PHYSICAL_NAME_QUEUE + "_physical", INOUT_REPLY_TO_PHYSICAL_NAME_QUEUE + "_jndi");
ResourceDeployer.addQueue(INOUT_FAULT_TO_QUEUE);
ResourceDeployer.addQueue(INOUT_FAULT_TO_PHYSICAL_NAME_QUEUE + "_physical", INOUT_FAULT_TO_PHYSICAL_NAME_QUEUE + "_jndi");
ResourceDeployer.addQueue(RESULT_QUEUE);
ResourceDeployer.addQueue(FAULT_QUEUE);
URL testConfigUrl = Classes.getResource(TEST_CONFIG);
String beansXml = Descriptors.create(BeansDescriptor.class).exportAsString();
return ShrinkWrap.create(JavaArchive.class, "switchyard-JCAJMSServiceBindingTest.jar")
.addClass(JCAJMSService.class)
.addClass(JCAJMSServiceImpl.class)
.addClass(JCAJMSFault.class)
.addClass(MyJMSContextMapper.class)
.addClass(MyJMSMessageComposer.class)
.addAsManifestResource(new UrlAsset(testConfigUrl), "switchyard.xml")
.addAsManifestResource(new StringAsset(beansXml), "beans.xml");
}
示例14: createPerfRar
import org.jboss.shrinkwrap.descriptor.api.Descriptors; //导入依赖的package包/类
/**
* Create the perf.rar
*
* @return The resource adapter archive
*/
public static ResourceAdapterArchive createPerfRar()
{
org.jboss.shrinkwrap.descriptor.api.connector15.ConnectorDescriptor raXml = Descriptors
.create(org.jboss.shrinkwrap.descriptor.api.connector15.ConnectorDescriptor.class, "ra.xml").version("1.5");
org.jboss.shrinkwrap.descriptor.api.connector15.ResourceadapterType rt = raXml.getOrCreateResourceadapter();
org.jboss.shrinkwrap.descriptor.api.connector15.OutboundResourceadapterType ort = rt
.getOrCreateOutboundResourceadapter().transactionSupport("XATransaction").reauthenticationSupport(false);
org.jboss.shrinkwrap.descriptor.api.connector15.ConnectionDefinitionType cdt = ort.createConnectionDefinition()
.managedconnectionfactoryClass(PerfManagedConnectionFactory.class.getName())
.connectionfactoryInterface(PerfConnectionFactory.class.getName())
.connectionfactoryImplClass(PerfConnectionFactoryImpl.class.getName())
.connectionInterface(PerfConnection.class.getName())
.connectionImplClass(PerfConnectionImpl.class.getName());
ResourceAdapterArchive raa = ShrinkWrap.create(ResourceAdapterArchive.class, "perf.rar");
JavaArchive ja = ShrinkWrap.create(JavaArchive.class, "perf.jar");
ja.addPackages(true, PerfConnection.class.getPackage());
raa.addAsLibrary(ja);
raa.addAsManifestResource(new StringAsset(raXml.exportAsString()), "ra.xml");
return raa;
}
示例15: createTxLogRar
import org.jboss.shrinkwrap.descriptor.api.Descriptors; //导入依赖的package包/类
/**
* Create the txlog.rar
*
* @return The resource adapter archive
*/
public static ResourceAdapterArchive createTxLogRar()
{
org.jboss.shrinkwrap.descriptor.api.connector15.ConnectorDescriptor raXml = Descriptors
.create(org.jboss.shrinkwrap.descriptor.api.connector15.ConnectorDescriptor.class, "ra.xml").version("1.5");
org.jboss.shrinkwrap.descriptor.api.connector15.ResourceadapterType rt = raXml.getOrCreateResourceadapter();
org.jboss.shrinkwrap.descriptor.api.connector15.OutboundResourceadapterType ort = rt
.getOrCreateOutboundResourceadapter().transactionSupport("XATransaction").reauthenticationSupport(false);
org.jboss.shrinkwrap.descriptor.api.connector15.ConnectionDefinitionType cdt = ort.createConnectionDefinition()
.managedconnectionfactoryClass(TxLogManagedConnectionFactory.class.getName())
.connectionfactoryInterface(TxLogConnectionFactory.class.getName())
.connectionfactoryImplClass(TxLogConnectionFactoryImpl.class.getName())
.connectionInterface(TxLogConnection.class.getName())
.connectionImplClass(TxLogConnectionImpl.class.getName());
ResourceAdapterArchive raa = ShrinkWrap.create(ResourceAdapterArchive.class, "txlog.rar");
JavaArchive ja = ShrinkWrap.create(JavaArchive.class, "txlog.jar");
ja.addPackages(true, TxLogConnection.class.getPackage());
raa.addAsLibrary(ja);
raa.addAsManifestResource(new StringAsset(raXml.exportAsString()), "ra.xml");
return raa;
}