Search in sources :

Example 1 with DBHelper

use of org.apache.cayenne.test.jdbc.DBHelper in project cayenne by apache.

the class FlattenedServerCase method startCayenne.

@Before
public void startCayenne() throws Exception {
    this.runtime = configureCayenne().build();
    DBHelper dbHelper = new DBHelper(runtime.getDataSource());
    this.e3 = new TableHelper(dbHelper, "E3").setColumns("ID");
    this.e4 = new TableHelper(dbHelper, "E4").setColumns("ID");
    this.e34 = new TableHelper(dbHelper, "E34").setColumns("E3_ID", "E4_ID");
    this.e34.deleteAll();
    this.e3.deleteAll();
}
Also used : DBHelper(org.apache.cayenne.test.jdbc.DBHelper) TableHelper(org.apache.cayenne.test.jdbc.TableHelper) Before(org.junit.Before)

Example 2 with DBHelper

use of org.apache.cayenne.test.jdbc.DBHelper in project cayenne by apache.

the class AuditableServerCase method startCayenne.

@Before
public void startCayenne() throws Exception {
    this.runtime = configureCayenne().build();
    DBHelper dbHelper = new DBHelper(runtime.getDataSource());
    this.auditLog = new TableHelper(dbHelper, "AUDIT_LOG").setColumns("ID", "LOG");
    this.auditable1 = new TableHelper(dbHelper, "AUDITABLE1").setColumns("ID", "CHAR_PROPERTY1");
    this.auditableChild1 = new TableHelper(dbHelper, "AUDITABLE_CHILD1").setColumns("ID", "AUDITABLE1_ID", "CHAR_PROPERTY1");
    this.auditableChild1x = new TableHelper(dbHelper, "AUDITABLE_CHILD1X").setColumns("ID", "AUDITABLE1_ID", "CHAR_PROPERTY1");
    this.auditable2 = new TableHelper(dbHelper, "AUDITABLE2").setColumns("ID", "CHAR_PROPERTY1", "CHAR_PROPERTY2");
    this.auditableChild3 = new TableHelper(dbHelper, "AUDITABLE_CHILD3").setColumns("ID", "AUDITABLE2_ID", "CHAR_PROPERTY1", "CHAR_PROPERTY2");
    this.auditable3 = new TableHelper(dbHelper, "AUDITABLE3").setColumns("ID", "CHAR_PROPERTY1", "CHAR_PROPERTY2");
    this.auditable4 = new TableHelper(dbHelper, "AUDITABLE4").setColumns("ID", "CHAR_PROPERTY1", "CHAR_PROPERTY2", "AUDITABLE3_ID");
    this.auditableChild1.deleteAll();
    this.auditableChild1x.deleteAll();
    this.auditable1.deleteAll();
    this.auditableChild3.deleteAll();
    this.auditable2.deleteAll();
    this.auditable4.deleteAll();
    this.auditable3.deleteAll();
    this.auditLog.deleteAll();
}
Also used : DBHelper(org.apache.cayenne.test.jdbc.DBHelper) TableHelper(org.apache.cayenne.test.jdbc.TableHelper) Before(org.junit.Before)

Example 3 with DBHelper

use of org.apache.cayenne.test.jdbc.DBHelper in project cayenne by apache.

the class ObjectIdRelationshipHandlerTest method setUp.

@Before
public void setUp() throws Exception {
    runtime = ServerRuntime.builder().addConfig("cayenne-lifecycle.xml").build();
    // a filter is required to invalidate root objects after commit
    ObjectIdRelationshipFilter filter = new ObjectIdRelationshipFilter();
    runtime.getDataDomain().addQueryFilter(filter);
    runtime.getDataDomain().getEntityResolver().getCallbackRegistry().addListener(filter);
    DBHelper dbHelper = new DBHelper(runtime.getDataSource(null));
    rootTable = new TableHelper(dbHelper, "UUID_ROOT1").setColumns("ID", "UUID");
    rootTable.deleteAll();
    e1Table = new TableHelper(dbHelper, "E1").setColumns("ID");
    e1Table.deleteAll();
}
Also used : DBHelper(org.apache.cayenne.test.jdbc.DBHelper) TableHelper(org.apache.cayenne.test.jdbc.TableHelper) Before(org.junit.Before)

Example 4 with DBHelper

use of org.apache.cayenne.test.jdbc.DBHelper in project cayenne by apache.

the class StringIdQueryTest method setUp.

@Before
public void setUp() {
    runtime = ServerRuntime.builder().addConfig("cayenne-lifecycle.xml").build();
    DBHelper dbHelper = new DBHelper(runtime.getDataSource("lifecycle-db"));
    e1Helper = new TableHelper(dbHelper, "E1", "ID");
    e2Helper = new TableHelper(dbHelper, "E2", "ID");
}
Also used : DBHelper(org.apache.cayenne.test.jdbc.DBHelper) TableHelper(org.apache.cayenne.test.jdbc.TableHelper) Before(org.junit.Before)

Example 5 with DBHelper

use of org.apache.cayenne.test.jdbc.DBHelper in project cayenne by apache.

the class Runtime_AES128_Base method setUp.

protected void setUp(boolean compress, boolean useHMAC) throws Exception {
    Module crypto = createCryptoModule(compress, useHMAC);
    this.runtime = createRuntime(crypto);
    setupTestTables(new DBHelper(runtime.getDataSource(null)));
}
Also used : DBHelper(org.apache.cayenne.test.jdbc.DBHelper) Module(org.apache.cayenne.di.Module)

Aggregations

DBHelper (org.apache.cayenne.test.jdbc.DBHelper)6 TableHelper (org.apache.cayenne.test.jdbc.TableHelper)5 Before (org.junit.Before)5 Module (org.apache.cayenne.di.Module)1