Search in sources :

Example 1 with DatabaseMetaData

use of org.datanucleus.store.rdbms.adapter.DatabaseMetaData in project tests by datanucleus.

the class RDBMSAdapterFactoryTest method testGetNewDatastoreAdapter2.

/**
 * datastores are identified by product name
 * test unknown product with given adapterClassName
 */
public void testGetNewDatastoreAdapter2() {
    DatabaseMetaData md = new DatabaseMetaData();
    md.setProductName("unknown");
    md.setProductVersion("1");
    DatastoreAdapter adapter = factory.getNewDatastoreAdapter(clr, md, DerbyAdapter.class.getName(), pluginMgr);
    assertNotNull(adapter);
    assertEquals(DerbyAdapter.class.getName(), adapter.getClass().getName());
}
Also used : DatastoreAdapter(org.datanucleus.store.rdbms.adapter.DatastoreAdapter) DatabaseMetaData(org.datanucleus.store.rdbms.adapter.DatabaseMetaData)

Example 2 with DatabaseMetaData

use of org.datanucleus.store.rdbms.adapter.DatabaseMetaData in project tests by datanucleus.

the class RDBMSAdapterFactoryTest method testGetNewDatastoreAdapter3.

/**
 * datastores are identified by product name
 * test Derby adapter with null adapterClassName
 */
public void testGetNewDatastoreAdapter3() {
    DatabaseMetaData md = new DatabaseMetaData();
    // test Derby adapter
    md.setProductName("Derby");
    md.setProductVersion("10");
    DatastoreAdapter adapter = factory.getNewDatastoreAdapter(clr, md, null, pluginMgr);
    assertNotNull(adapter);
    assertEquals(DerbyAdapter.class.getName(), adapter.getClass().getName());
}
Also used : DatastoreAdapter(org.datanucleus.store.rdbms.adapter.DatastoreAdapter) DatabaseMetaData(org.datanucleus.store.rdbms.adapter.DatabaseMetaData)

Example 3 with DatabaseMetaData

use of org.datanucleus.store.rdbms.adapter.DatabaseMetaData in project tests by datanucleus.

the class RDBMSAdapterFactoryTest method testGetNewDatastoreAdapter1.

/**
 * datastores are identified by product name
 * test unknown product
 */
public void testGetNewDatastoreAdapter1() {
    DatabaseMetaData md = new DatabaseMetaData();
    md.setProductName("unknown");
    md.setProductVersion("1");
    DatastoreAdapter adapter = factory.getNewDatastoreAdapter(clr, md, null, pluginMgr);
    assertNull(adapter);
}
Also used : DatastoreAdapter(org.datanucleus.store.rdbms.adapter.DatastoreAdapter) DatabaseMetaData(org.datanucleus.store.rdbms.adapter.DatabaseMetaData)

Example 4 with DatabaseMetaData

use of org.datanucleus.store.rdbms.adapter.DatabaseMetaData in project tests by datanucleus.

the class RDBMSAdapterFactoryTest method testGetNewDatastoreAdapter4.

/**
 * datastores are identified by product name
 * test jdbc driver returns null for product name
 */
public void testGetNewDatastoreAdapter4() {
    DatabaseMetaData md = new DatabaseMetaData();
    md.setProductName(null);
    DatastoreAdapter adapter = factory.getNewDatastoreAdapter(clr, md, null, pluginMgr);
    assertNull(adapter);
}
Also used : DatastoreAdapter(org.datanucleus.store.rdbms.adapter.DatastoreAdapter) DatabaseMetaData(org.datanucleus.store.rdbms.adapter.DatabaseMetaData)

Aggregations

DatabaseMetaData (org.datanucleus.store.rdbms.adapter.DatabaseMetaData)4 DatastoreAdapter (org.datanucleus.store.rdbms.adapter.DatastoreAdapter)4