Java Code Examples for org.jboss.shrinkwrap.api.spec.ResourceAdapterArchive#addAsManifestResource()

The following examples show how to use org.jboss.shrinkwrap.api.spec.ResourceAdapterArchive#addAsManifestResource() . 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: ConnectorTestCase.java    From ironjacamar with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Define the deployment
 *
 * @return The deployment archive
 */
@Deployment(order = 1)
public static ResourceAdapterArchive createDeployment()
{
   ResourceAdapterArchive raa =
      ShrinkWrap.create(ResourceAdapterArchive.class, deploymentName + ".rar");
   JavaArchive ja = ShrinkWrap.create(JavaArchive.class, 
      UUID.randomUUID().toString() + ".jar");
   ja.addClasses(HelloWorldResourceAdapter.class, 
      HelloWorldManagedConnectionFactory.class, 
      HelloWorldManagedConnection.class, 
      HelloWorldManagedConnectionMetaData.class, 
      HelloWorldConnectionFactory.class, 
      HelloWorldConnectionFactoryImpl.class, 
      HelloWorldConnection.class, 
      HelloWorldConnectionImpl.class);
   raa.addAsLibrary(ja);
   // Contains the default deployment information
   raa.addAsManifestResource("META-INF/ironjacamar.xml", "ironjacamar.xml");

   return raa;
}
 
Example 4
Source File: ConnectorTestCase.java    From ironjacamar with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Define the deployment
 *
 * @return The deployment archive
 */
@Deployment(order = 1)
public static ResourceAdapterArchive createDeployment()
{
   ResourceAdapterArchive raa =
      ShrinkWrap.create(ResourceAdapterArchive.class, deploymentName + ".rar");
   JavaArchive ja = ShrinkWrap.create(JavaArchive.class, 
      UUID.randomUUID().toString() + ".jar");
   ja.addClasses(HelloWorldResourceAdapter.class, 
      HelloWorldManagedConnectionFactory.class, 
      HelloWorldManagedConnection.class, 
      HelloWorldManagedConnectionMetaData.class, 
      HelloWorldConnectionFactory.class, 
      HelloWorldConnectionFactoryImpl.class, 
      HelloWorldConnection.class, 
      HelloWorldConnectionImpl.class);
   raa.addAsLibrary(ja);
   // Contains the default deployment information
   raa.addAsManifestResource("META-INF/ironjacamar.xml", "ironjacamar.xml");

   return raa;
}
 
Example 5
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 6
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 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 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 9
Source File: ConnectorTestCase.java    From ironjacamar with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Define the deployment
 *
 * @return The deployment archive
 */
@Deployment(order = 1)
public static ResourceAdapterArchive createDeployment()
{
   String deploymentName = "ConnectorTestCase.rar";

   ResourceAdapterArchive raa =
      ShrinkWrap.create(ResourceAdapterArchive.class, deploymentName);
   JavaArchive ja = ShrinkWrap.create(JavaArchive.class, 
      UUID.randomUUID().toString() + ".jar");
   ja.addClasses(HelloWorldResourceAdapter.class, 
      HelloWorldManagedConnectionFactory.class, 
      HelloWorldManagedConnection.class, 
      HelloWorldManagedConnectionMetaData.class, 
      HelloWorldConnectionFactory.class, 
      HelloWorldConnectionFactoryImpl.class, 
      HelloWorldConnection.class, 
      HelloWorldConnectionImpl.class);
   raa.addAsLibrary(ja);
   // Contains the deployment information
   raa.addAsManifestResource("META-INF/ironjacamar.xml", "ironjacamar.xml");

   String rootPath =
      System.getProperty("test.dir") + File.separator + ".." + File.separator;

   File root = new File(rootPath);
   for (File f : root.listFiles())
   {
      if (f.getName().contains("HelloWorld"))
         raa.addAsLibrary(f);
   }

   return raa;
}
 
Example 10
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;
}