Java Code Examples for org.jboss.shrinkwrap.api.spec.JavaArchive#addPackages()

The following examples show how to use org.jboss.shrinkwrap.api.spec.JavaArchive#addPackages() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ResourceAdapterFactory.java    From ironjacamar with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * 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;
}
 
Example 2
Source File: ResourceAdapterFactory.java    From ironjacamar with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * 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;
}
 
Example 3
Source File: ConfigAuxiliaryArchiveAppender.java    From thorntail with Apache License 2.0 5 votes vote down vote up
@Override
public Archive<?> createAuxiliaryArchive() {
    JavaArchive archive = ShrinkWrap.create(JavaArchive.class);
    // https://github.com/eclipse/microprofile-config/issues/261
    archive.addPackages(true, org.hamcrest.Matchers.class.getPackage());
    // https://github.com/eclipse/microprofile-config/issues/263
    archive.addPackages(true, "org.junit");
    return archive;
}
 
Example 4
Source File: OptaPlannerIntegrationTest.java    From wildfly-camel with Apache License 2.0 5 votes vote down vote up
@Deployment
public static JavaArchive createDeployment() {
    JavaArchive archive = ShrinkWrap.create(JavaArchive.class, "camel-optaplanner-tests");
    archive.addPackages(true, "org.optaplanner.examples.cloudbalancing");
    archive.addPackages(true, "org.optaplanner.examples.common");
    archive.setManifest(() -> {
        ManifestBuilder builder = new ManifestBuilder();
        builder.addManifestHeader("Dependencies", "com.google.guava,org.apache.commons.lang3");
        return builder.openStream();
    });
    archive.addAsResource("optaplanner/cloudBalancingScoreRules.drl");
    archive.addAsResource("optaplanner/solverConfig.xml");
    return archive;
}
 
Example 5
Source File: HipchatConsumerIntegrationTest.java    From wildfly-camel with Apache License 2.0 5 votes vote down vote up
@Deployment
public static JavaArchive createDeployment() {
    JavaArchive archive = ShrinkWrap.create(JavaArchive.class, "camel-hipchat-tests.jar");
    archive.addPackages(true, Mockito.class.getPackage(), Objenesis.class.getPackage(), ByteBuddy.class.getPackage());
    archive.addClasses(HipchatComponentSupport.class, HipchatEndpointSupport.class);
    return archive;
}
 
Example 6
Source File: ResourceAdapterFactory.java    From ironjacamar with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Create the unified-security.rar
 *
 *
 * @return The resource adapter archive
 */
public static ResourceAdapterArchive createUnifiedSecurityRar()
{
   org.jboss.shrinkwrap.descriptor.api.connector16.ConnectorDescriptor raXml = Descriptors
         .create(org.jboss.shrinkwrap.descriptor.api.connector16.ConnectorDescriptor.class, "ra.xml").version("1.6");

   org.jboss.shrinkwrap.descriptor.api.connector16.ResourceadapterType rt = raXml.getOrCreateResourceadapter()
         .resourceadapterClass(UnifiedSecurityResourceAdapter.class.getName());
   org.jboss.shrinkwrap.descriptor.api.connector16.OutboundResourceadapterType ort = rt
         .getOrCreateOutboundResourceadapter().transactionSupport("XATransaction").reauthenticationSupport(false);
   org.jboss.shrinkwrap.descriptor.api.connector16.ConnectionDefinitionType cdt = ort.createConnectionDefinition()
         .managedconnectionfactoryClass(UnifiedSecurityManagedConnectionFactory.class.getName())
         .connectionfactoryInterface(UnifiedSecurityConnectionFactory.class.getName())
         .connectionfactoryImplClass(UnifiedSecurityConnectionFactoryImpl.class.getName())
         .connectionInterface(UnifiedSecurityConnection.class.getName())
         .connectionImplClass(UnifiedSecurityConnectionImpl.class.getName());

   ResourceAdapterArchive raa = ShrinkWrap.create(ResourceAdapterArchive.class, "unified-security.rar");


   JavaArchive ja = ShrinkWrap.create(JavaArchive.class, "unified-security.jar");
   ja.addPackages(true, UnifiedSecurityConnection.class.getPackage());

   raa.addAsLibrary(ja);
   raa.addAsManifestResource(new StringAsset(raXml.exportAsString()), "ra.xml");

   return raa;
}
 
Example 7
Source File: ResourceAdapterFactory.java    From ironjacamar with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Create the work.rar
 *
 * @return The resource adapter archive
 */
public static ResourceAdapterArchive createWorkRarMCFNoHashCode()
{
   org.jboss.shrinkwrap.descriptor.api.connector16.ConnectorDescriptor raXml = Descriptors
         .create(org.jboss.shrinkwrap.descriptor.api.connector16.ConnectorDescriptor.class, "ra.xml").version("1.6");

   org.jboss.shrinkwrap.descriptor.api.connector16.ResourceadapterType rt = raXml.getOrCreateResourceadapter()
         .resourceadapterClass(WorkResourceAdapter.class.getName());
   org.jboss.shrinkwrap.descriptor.api.connector16.OutboundResourceadapterType ort = rt
         .getOrCreateOutboundResourceadapter().transactionSupport("NoTransaction").reauthenticationSupport(false);
   org.jboss.shrinkwrap.descriptor.api.connector16.ConnectionDefinitionType cdt = ort.createConnectionDefinition()
         .managedconnectionfactoryClass(WorkManagedConnectionFactoryNoHashCode.class.getName())
         .connectionfactoryInterface(WorkConnectionFactory.class.getName())
         .connectionfactoryImplClass(WorkConnectionFactoryImpl.class.getName())
         .connectionInterface(WorkConnection.class.getName())
         .connectionImplClass(WorkConnectionImpl.class.getName());

   ResourceAdapterArchive raa = ShrinkWrap.create(ResourceAdapterArchive.class, "work.rar");

   JavaArchive ja = ShrinkWrap.create(JavaArchive.class, "work.jar");
   ja.addPackages(true, WorkConnection.class.getPackage());

   raa.addAsLibrary(ja);
   raa.addAsManifestResource(new StringAsset(raXml.exportAsString()), "ra.xml");

   return raa;
}
 
Example 8
Source File: ResourceAdapterFactory.java    From ironjacamar with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Create the work.rar
 *
 * @return The resource adapter archive
 */
public static ResourceAdapterArchive createWorkRar()
{
   org.jboss.shrinkwrap.descriptor.api.connector16.ConnectorDescriptor raXml = Descriptors
         .create(org.jboss.shrinkwrap.descriptor.api.connector16.ConnectorDescriptor.class, "ra.xml").version("1.6");

   org.jboss.shrinkwrap.descriptor.api.connector16.ResourceadapterType rt = raXml.getOrCreateResourceadapter()
         .resourceadapterClass(WorkResourceAdapter.class.getName());
   org.jboss.shrinkwrap.descriptor.api.connector16.OutboundResourceadapterType ort = rt
         .getOrCreateOutboundResourceadapter().transactionSupport("NoTransaction").reauthenticationSupport(false);
   org.jboss.shrinkwrap.descriptor.api.connector16.ConnectionDefinitionType cdt = ort.createConnectionDefinition()
         .managedconnectionfactoryClass(WorkManagedConnectionFactory.class.getName())
         .connectionfactoryInterface(WorkConnectionFactory.class.getName())
         .connectionfactoryImplClass(WorkConnectionFactoryImpl.class.getName())
         .connectionInterface(WorkConnection.class.getName())
         .connectionImplClass(WorkConnectionImpl.class.getName());

   ResourceAdapterArchive raa = ShrinkWrap.create(ResourceAdapterArchive.class, "work.rar");

   JavaArchive ja = ShrinkWrap.create(JavaArchive.class, "work.jar");
   ja.addPackages(true, WorkConnection.class.getPackage());

   raa.addAsLibrary(ja);
   raa.addAsManifestResource(new StringAsset(raXml.exportAsString()), "ra.xml");

   return raa;
}
 
Example 9
Source File: ResourceAdapterFactory.java    From ironjacamar with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Create the lazy.rar
 *
 * @return The resource adapter archive
 */
public static ResourceAdapterArchive createLazyRar()
{
   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()
         .resourceadapterClass(LazyResourceAdapter.class.getName());

   rt.createConfigProperty().configPropertyName("Enable")
      .configPropertyType(Boolean.class.getName()).configPropertyValue(Boolean.TRUE.toString());

   rt.createConfigProperty().configPropertyName("LocalTransaction")
      .configPropertyType(Boolean.class.getName()).configPropertyValue(Boolean.FALSE.toString());

   rt.createConfigProperty().configPropertyName("XATransaction")
      .configPropertyType(Boolean.class.getName()).configPropertyValue(Boolean.FALSE.toString());

   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(LazyManagedConnectionFactory.class.getName())
         .connectionfactoryInterface(LazyConnectionFactory.class.getName())
         .connectionfactoryImplClass(LazyConnectionFactoryImpl.class.getName())
         .connectionInterface(LazyConnection.class.getName())
         .connectionImplClass(LazyConnectionImpl.class.getName());

   ResourceAdapterArchive raa = ShrinkWrap.create(ResourceAdapterArchive.class, "lazy.rar");

   JavaArchive ja = ShrinkWrap.create(JavaArchive.class, "lazy.jar");
   ja.addPackages(true, LazyConnection.class.getPackage());

   raa.addAsLibrary(ja);
   raa.addAsManifestResource(new StringAsset(raXml.exportAsString()), "ra.xml");

   return raa;
}
 
Example 10
Source File: DeploymentProcessor.java    From thorntail with Apache License 2.0 5 votes vote down vote up
@Override
public void process(Archive<?> archive, TestClass testClass) {
  JavaArchive extensionsJar = ShrinkWrap.create(JavaArchive.class,"mp-ot-mocktracer-resolver.jar")
               .addAsServiceProvider(TracerResolver.class, MockTracerResolver.class);
  extensionsJar.addAsServiceProvider(Providers.class, ExceptionMapper.class);
  extensionsJar.addClass(MockTracerResolver.class);
  extensionsJar.addClass(ExceptionMapper.class);
  extensionsJar.addPackages(true, "io.opentracing.tracerresolver", "io.opentracing.mock");

  WebArchive war = WebArchive.class.cast(archive);
  war.addAsLibraries(extensionsJar);
  war.setWebXML("web.xml");
}
 
Example 11
Source File: ResourceAdapterFactory.java    From ironjacamar with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Create the test.rar
 *
 * @return The resource adapter archive
 */
public static ResourceAdapterArchive createTestRar()
{
   org.jboss.shrinkwrap.descriptor.api.connector16.ConnectorDescriptor raXml = Descriptors
         .create(org.jboss.shrinkwrap.descriptor.api.connector16.ConnectorDescriptor.class, "ra.xml").version("1.6");

   org.jboss.shrinkwrap.descriptor.api.connector16.ResourceadapterType rt = raXml.getOrCreateResourceadapter()
      .resourceadapterClass(TestResourceAdapter.class.getName());

   org.jboss.shrinkwrap.descriptor.api.connector16.OutboundResourceadapterType ort = rt
      .getOrCreateOutboundResourceadapter().transactionSupport("NoTransaction").reauthenticationSupport(false);

   org.jboss.shrinkwrap.descriptor.api.connector16.ConnectionDefinitionType cdt = ort.createConnectionDefinition()
      .managedconnectionfactoryClass(TestManagedConnectionFactory.class.getName())
      .connectionfactoryInterface(TestConnectionFactory.class.getName())
      .connectionfactoryImplClass(TestConnectionFactoryImpl.class.getName())
      .connectionInterface(TestConnection.class.getName())
      .connectionImplClass(TestConnectionImpl.class.getName());

   cdt.createConfigProperty().configPropertyName("CreateFailureCount")
      .configPropertyType(Integer.class.getName()).configPropertyValue("0");

   cdt.createConfigProperty().configPropertyName("InvalidConnectionFailureCount")
      .configPropertyType(Integer.class.getName()).configPropertyValue("0");

   rt.createAdminobject().adminobjectInterface(TestAdminObject.class.getName())
     .adminobjectClass(TestAdminObjectImpl.class.getName());

   rt.getOrCreateInboundResourceadapter().getOrCreateMessageadapter().getOrCreateMessagelistener()
      .messagelistenerType(TestMessageListener.class.getName())
      .getOrCreateActivationspec().activationspecClass(TestActivationSpec.class.getName())
      .getOrCreateRequiredConfigProperty().configPropertyName("Name");
   
   ResourceAdapterArchive raa = ShrinkWrap.create(ResourceAdapterArchive.class, "test.rar");

   JavaArchive ja = ShrinkWrap.create(JavaArchive.class, "test.jar");
   ja.addPackages(true, PerfConnection.class.getPackage());

   raa.addAsLibrary(ja);
   raa.addAsManifestResource(new StringAsset(raXml.exportAsString()), "ra.xml");

   return raa;
}
 
Example 12
Source File: OpenstackIntegrationTest.java    From wildfly-camel with Apache License 2.0 4 votes vote down vote up
@Deployment
public static JavaArchive createDeployment() {
    JavaArchive archive = ShrinkWrap.create(JavaArchive.class, "camel-openstack-tests.jar");
    archive.addPackages(true, Mockito.class.getPackage(), Objenesis.class.getPackage(), ByteBuddy.class.getPackage());
    return archive;
}
 
Example 13
Source File: NagiosIntegrationTest.java    From wildfly-camel with Apache License 2.0 4 votes vote down vote up
@Deployment
public static JavaArchive createDeployment() {
    final JavaArchive archive = ShrinkWrap.create(JavaArchive.class, "camel-nagios-test");
    archive.addPackages(true, Mockito.class.getPackage(), Objenesis.class.getPackage(), ByteBuddy.class.getPackage());
    return archive;
}
 
Example 14
Source File: HazelcastMapConsumerIntegrationTest.java    From wildfly-camel with Apache License 2.0 4 votes vote down vote up
@Deployment
public static JavaArchive deployment() {
    final JavaArchive archive = ShrinkWrap.create(JavaArchive.class, "hazelcast-map-consumer-tests");
    archive.addPackages(true, Mockito.class.getPackage(), Objenesis.class.getPackage(), ByteBuddy.class.getPackage());
    return archive;
}
 
Example 15
Source File: HazelcastMapProducerIntegrationTest.java    From wildfly-camel with Apache License 2.0 4 votes vote down vote up
@Deployment
public static JavaArchive deployment() {
    final JavaArchive archive = ShrinkWrap.create(JavaArchive.class, "hazelcast-map-producer-tests");
    archive.addPackages(true, Mockito.class.getPackage(), Objenesis.class.getPackage(), ByteBuddy.class.getPackage());
    return archive;
}
 
Example 16
Source File: BeanstalkIntegrationTest.java    From wildfly-camel with Apache License 2.0 4 votes vote down vote up
@Deployment
public static JavaArchive createdeployment() {
    final JavaArchive archive = ShrinkWrap.create(JavaArchive.class, "camel-beanstalk-tests");
    archive.addPackages(true, Mockito.class.getPackage(), Objenesis.class.getPackage(), ByteBuddy.class.getPackage());
    return archive;
}
 
Example 17
Source File: PrinterIntegrationTest.java    From wildfly-camel with Apache License 2.0 4 votes vote down vote up
@Deployment
public static JavaArchive deployment() {
    final JavaArchive archive = ShrinkWrap.create(JavaArchive.class, "camel-lpr-tests");
    archive.addPackages(true, Mockito.class.getPackage(), Objenesis.class.getPackage(), ByteBuddy.class.getPackage());
    return archive;
}