Java Code Examples for org.apache.derby.jdbc.EmbeddedXADataSource

The following examples show how to use org.apache.derby.jdbc.EmbeddedXADataSource. These examples are extracted from open source projects. 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 Project: FHIR   Source File: FHIRProxyXADataSourceTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testDerby_3() throws Exception {
    FHIRRequestContext.set(new FHIRRequestContext("tenant1", "derby_3"));
    
    FHIRProxyXADataSource proxyDS = new FHIRProxyXADataSource();
    XADataSource xaDS = proxyDS.getDelegate();
    assertNotNull(xaDS);
    assertTrue(xaDS instanceof EmbeddedXADataSource);
    EmbeddedXADataSource derbyDS = (EmbeddedXADataSource) xaDS;
    assertEquals("myDerbyDatabase3", derbyDS.getDatabaseName());
    assertEquals("create", derbyDS.getCreateDatabase());
    assertEquals("dbuser", derbyDS.getUser());
    assertEquals("change-password", derbyDS.getPassword());
    assertEquals("myDataSource", derbyDS.getDataSourceName());
    assertEquals("shutdown", derbyDS.getShutdownDatabase());
    assertEquals(1000, derbyDS.getLoginTimeout());
    assertEquals("DataSource description", derbyDS.getDescription());
    assertEquals("prop1=value1", derbyDS.getConnectionAttributes());
    assertEquals(false, derbyDS.getAttributesAsPassword());
}
 
Example 2
Source Project: FHIR   Source File: FHIRProxyXADataSourceTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testDerby_1() throws Exception {
    FHIRRequestContext.set(new FHIRRequestContext("tenant1", "derby_1"));
    
    FHIRProxyXADataSource proxyDS = new FHIRProxyXADataSource();
    XADataSource xaDS = proxyDS.getDelegate();
    assertNotNull(xaDS);
    assertTrue(xaDS instanceof EmbeddedXADataSource);
    EmbeddedXADataSource derbyDS = (EmbeddedXADataSource) xaDS;
    assertEquals("myDerbyDatabase1", derbyDS.getDatabaseName());
}
 
Example 3
Source Project: FHIR   Source File: FHIRProxyXADataSourceTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testDerby_2() throws Exception {
    FHIRRequestContext.set(new FHIRRequestContext("tenant1", "derby_2"));
    
    FHIRProxyXADataSource proxyDS = new FHIRProxyXADataSource();
    XADataSource xaDS = proxyDS.getDelegate();
    assertNotNull(xaDS);
    assertTrue(xaDS instanceof EmbeddedXADataSource);
    EmbeddedXADataSource derbyDS = (EmbeddedXADataSource) xaDS;
    assertEquals("myDerbyDatabase2", derbyDS.getDatabaseName());
    assertEquals("create", derbyDS.getCreateDatabase());
}
 
Example 4
Source Project: FHIR   Source File: FHIRProxyXADataSourceTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testDerby_default() throws Exception {
    FHIRRequestContext.set(new FHIRRequestContext("tenant1", "default_derby"));
    
    FHIRProxyXADataSource proxyDS = new FHIRProxyXADataSource();
    XADataSource xaDS = proxyDS.getDelegate();
    assertNotNull(xaDS);
    assertTrue(xaDS instanceof EmbeddedXADataSource);
    EmbeddedXADataSource derbyDS = (EmbeddedXADataSource) xaDS;
    assertEquals("myDefaultDerbyDatabase", derbyDS.getDatabaseName());
    assertEquals("create", derbyDS.getCreateDatabase());
}
 
Example 5
Source Project: activemq-artemis   Source File: JdbcXARecoveryBrokerTest.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void setUp() throws Exception {
   dataSource = new EmbeddedXADataSource();
   dataSource.setDatabaseName("derbyDb");
   dataSource.setCreateDatabase("create");
   super.setUp();
}
 
Example 6
Source Project: activemq-artemis   Source File: JdbcXARecoveryBrokerTest.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void restartBroker() throws Exception {
   broker.stop();
   stopDerby();
   dataSource = new EmbeddedXADataSource();
   dataSource.setDatabaseName("derbyDb");
   dataSource.setCreateDatabase("create");

   broker = createRestartedBroker();
   broker.start();
}
 
Example 7
Source Project: FHIR   Source File: TestEmbeddedXADataSource.java    License: Apache License 2.0 4 votes vote down vote up
public TestEmbeddedXADataSource() {
    log.entering(this.getClass().getName(), "TestEmbeddedXADataSource ctor");
    this.delegate = new EmbeddedXADataSource();
    log.exiting(this.getClass().getName(), "TestEmbeddedXADataSource ctor");
}
 
Example 8
Source Project: flink   Source File: DerbyDbMetadata.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public XADataSource buildXaDataSource() {
	EmbeddedXADataSource ds = new EmbeddedXADataSource();
	ds.setDatabaseName(dbName);
	return ds;
}