use of org.apache.cayenne.test.jdbc.TableHelper in project cayenne by apache.
the class OneWayRelationshipsIT method setUp.
@Before
public void setUp() throws Exception {
t1Helper = new TableHelper(dbHelper, "oneway_table1");
t1Helper.setColumns("ID");
t2Helper = new TableHelper(dbHelper, "oneway_table2");
t2Helper.setColumns("ID", "TABLE1_ID");
t3Helper = new TableHelper(dbHelper, "oneway_table3");
t3Helper.setColumns("ID");
t4Helper = new TableHelper(dbHelper, "oneway_table4");
t4Helper.setColumns("ID", "TABLE3_ID").setColumnTypes(Types.INTEGER, Types.INTEGER);
}
use of org.apache.cayenne.test.jdbc.TableHelper in project cayenne by apache.
the class CAY2509IT method before.
@Before
public void before() {
this.tArtist = new TableHelper(dbHelper, "ARTIST").setColumns("ARTIST_ID", "ARTIST_NAME", "DATE_OF_BIRTH").setColumnTypes(Types.BIGINT, Types.CHAR, Types.DATE);
this.tPainting = new TableHelper(dbHelper, "PAINTING").setColumns("PAINTING_ID", "ARTIST_ID", "PAINTING_TITLE").setColumnTypes(Types.INTEGER, Types.BIGINT, Types.VARCHAR);
}
use of org.apache.cayenne.test.jdbc.TableHelper in project cayenne by apache.
the class CayenneDataObjectSetToManyCollectionIT method setUp.
@Before
public void setUp() throws Exception {
TableHelper tCollectionToMany = new TableHelper(dbHelper, "COLLECTION_TO_MANY");
tCollectionToMany.setColumns("ID");
TableHelper tCollectionToManyTarget = new TableHelper(dbHelper, "COLLECTION_TO_MANY_TARGET");
tCollectionToManyTarget.setColumns("ID", "COLLECTION_TO_MANY_ID");
// single data set for all tests
tCollectionToMany.insert(1).insert(2);
tCollectionToManyTarget.insert(1, 1).insert(2, 1).insert(3, 1).insert(4, 2);
}
use of org.apache.cayenne.test.jdbc.TableHelper in project cayenne by apache.
the class LazyAttributesIT method setup.
@Before
public void setup() throws Exception {
TableHelper th = new TableHelper(dbHelper, "LAZYBLOB").setColumns("ID", "NAME", "LAZY_DATA").setColumnTypes(Types.INTEGER, Types.VARCHAR, Types.VARBINARY);
th.insert(1, "test", new byte[] { 1, 2, 3, 4, 5 });
}
use of org.apache.cayenne.test.jdbc.TableHelper in project cayenne by apache.
the class VerticalInheritanceIT method testSelectQuery_MiddleLeaf.
@Test
public void testSelectQuery_MiddleLeaf() throws Exception {
TableHelper ivRootTable = new TableHelper(dbHelper, "IV_ROOT");
ivRootTable.setColumns("ID", "NAME", "DISCRIMINATOR").setColumnTypes(Types.INTEGER, Types.VARCHAR, Types.VARCHAR);
TableHelper ivSub1Table = new TableHelper(dbHelper, "IV_SUB1");
ivSub1Table.setColumns("ID", "SUB1_NAME");
TableHelper ivSub2Table = new TableHelper(dbHelper, "IV_SUB2");
ivSub2Table.setColumns("ID", "SUB2_NAME");
TableHelper ivSub1Sub1Table = new TableHelper(dbHelper, "IV_SUB1_SUB1");
ivSub1Sub1Table.setColumns("ID", "SUB1_SUB1_NAME");
// insert
ivRootTable.insert(1, "xROOT", null);
ivRootTable.insert(2, "xSUB1_ROOT", "IvSub1");
ivSub1Table.insert(2, "xSUB1");
ivRootTable.insert(3, "xSUB1_SUB1_ROOT", "IvSub1Sub1");
ivSub1Table.insert(3, "xSUB1_SUB1_SUBROOT");
ivSub1Sub1Table.insert(3, "xSUB1_SUB1");
ivRootTable.insert(4, "xROOT_SUB2", "IvSub2");
ivSub2Table.insert(4, "xSUB2");
ObjectSelect<IvSub1> query = ObjectSelect.query(IvSub1.class);
List<IvSub1> results = context.select(query);
assertEquals(2, results.size());
// since we don't have ordering, need to analyze results in an order
// agnostic
// fashion
Map<String, IvRoot> resultTypes = new HashMap<>();
for (IvRoot result : results) {
resultTypes.put(result.getClass().getName(), result);
}
assertEquals(2, resultTypes.size());
IvSub1 sub1 = (IvSub1) resultTypes.get(IvSub1.class.getName());
assertNotNull(sub1);
assertEquals("xSUB1_ROOT", sub1.getName());
assertEquals("IvSub1", sub1.getDiscriminator());
IvSub1Sub1 sub1Sub1 = (IvSub1Sub1) resultTypes.get(IvSub1Sub1.class.getName());
assertNotNull(sub1Sub1);
assertEquals("xSUB1_SUB1_ROOT", sub1Sub1.getName());
assertEquals("IvSub1Sub1", sub1Sub1.getDiscriminator());
assertEquals("xSUB1_SUB1_SUBROOT", sub1Sub1.getSub1Name());
assertEquals("xSUB1_SUB1", sub1Sub1.getSub1Sub1Name());
}
Aggregations