Search in sources :

Example 96 with TableHelper

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

the class DataContextFlattenedAttributesIT method createTestDataSet.

private void createTestDataSet() throws Exception {
    TableHelper tArtist = new TableHelper(dbHelper, "ARTIST");
    tArtist.setColumns("ARTIST_ID", "ARTIST_NAME", "DATE_OF_BIRTH");
    TableHelper tPainting = new TableHelper(dbHelper, "PAINTING");
    tPainting.setColumns("PAINTING_ID", "PAINTING_TITLE", "ARTIST_ID", "ESTIMATED_PRICE", "GALLERY_ID").setColumnTypes(Types.INTEGER, Types.VARCHAR, Types.BIGINT, Types.DECIMAL, Types.INTEGER);
    TableHelper tPaintingInfo = new TableHelper(dbHelper, "PAINTING_INFO");
    tPaintingInfo.setColumns("PAINTING_ID", "TEXT_REVIEW");
    TableHelper tGallery = new TableHelper(dbHelper, "GALLERY");
    tGallery.setColumns("GALLERY_ID", "GALLERY_NAME");
    long dateBase = System.currentTimeMillis();
    for (int i = 1; i <= 4; i++) {
        tArtist.insert(i + 1, "artist" + i, new java.sql.Date(dateBase + 1000 * 60 * 60 * 24 * i));
    }
    for (int i = 1; i <= 2; i++) {
        tGallery.insert(i + 2, "gallery" + i);
    }
    for (int i = 1; i <= 8; i++) {
        Integer galleryId = (i == 3) ? null : (i - 1) % 2 + 3;
        tPainting.insert(i, "painting" + i, (i - 1) % 4 + 2, new BigDecimal(1000d), galleryId);
        tPaintingInfo.insert(i, "painting review" + i);
    }
}
Also used : TableHelper(org.apache.cayenne.test.jdbc.TableHelper) BigDecimal(java.math.BigDecimal)

Example 97 with TableHelper

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

the class DataContextIteratedQueryIT method before.

@Before
public void before() throws Exception {
    tArtist = new TableHelper(dbHelper, "ARTIST");
    tArtist.setColumns("ARTIST_ID", "ARTIST_NAME");
    tExhibit = new TableHelper(dbHelper, "EXHIBIT");
    tExhibit.setColumns("EXHIBIT_ID", "GALLERY_ID", "OPENING_DATE", "CLOSING_DATE");
    tGallery = new TableHelper(dbHelper, "GALLERY");
    tGallery.setColumns("GALLERY_ID", "GALLERY_NAME");
    tPainting = new TableHelper(dbHelper, "PAINTING");
    tPainting.setColumns("PAINTING_ID", "PAINTING_TITLE", "ARTIST_ID", "ESTIMATED_PRICE");
}
Also used : TableHelper(org.apache.cayenne.test.jdbc.TableHelper) Before(org.junit.Before)

Example 98 with TableHelper

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

the class DataContextJoinAliasesIT method setUp.

@Before
public void setUp() throws Exception {
    tArtist = new TableHelper(dbHelper, "ARTIST");
    tArtist.setColumns("ARTIST_ID", "ARTIST_NAME");
    tExhibit = new TableHelper(dbHelper, "EXHIBIT");
    tExhibit.setColumns("EXHIBIT_ID", "GALLERY_ID", "OPENING_DATE", "CLOSING_DATE");
    tGallery = new TableHelper(dbHelper, "GALLERY");
    tGallery.setColumns("GALLERY_ID", "GALLERY_NAME");
    tArtistExhibit = new TableHelper(dbHelper, "ARTIST_EXHIBIT");
    tArtistExhibit.setColumns("EXHIBIT_ID", "ARTIST_ID");
}
Also used : TableHelper(org.apache.cayenne.test.jdbc.TableHelper) Before(org.junit.Before)

Example 99 with TableHelper

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

the class DataContextPaginatedQueryIT method setUp.

@Before
public void setUp() throws Exception {
    tArtist = new TableHelper(dbHelper, "ARTIST");
    tArtist.setColumns("ARTIST_ID", "ARTIST_NAME");
}
Also used : TableHelper(org.apache.cayenne.test.jdbc.TableHelper) Before(org.junit.Before)

Example 100 with TableHelper

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

the class DataContextPrefetchExtrasIT method setUp.

@Before
public void setUp() throws Exception {
    tCharPkTest = new TableHelper(dbHelper, "CHAR_PK_TEST");
    tCharPkTest.setColumns("PK_COL", "OTHER_COL");
    tCharFkTest = new TableHelper(dbHelper, "CHAR_FK_TEST");
    tCharFkTest.setColumns("PK", "FK_COL", "NAME");
    tCompoundPkTest = new TableHelper(dbHelper, "COMPOUND_PK_TEST");
    tCompoundPkTest.setColumns("KEY1", "KEY2", "NAME");
    tCompoundFkTest = new TableHelper(dbHelper, "COMPOUND_FK_TEST");
    tCompoundFkTest.setColumns("PKEY", "F_KEY1", "F_KEY2", "NAME");
}
Also used : TableHelper(org.apache.cayenne.test.jdbc.TableHelper) Before(org.junit.Before)

Aggregations

TableHelper (org.apache.cayenne.test.jdbc.TableHelper)158 Before (org.junit.Before)132 Test (org.junit.Test)18 SelectQuery (org.apache.cayenne.query.SelectQuery)6 HashMap (java.util.HashMap)5 DBHelper (org.apache.cayenne.test.jdbc.DBHelper)5 Date (java.util.Date)2 Ignore (org.junit.Ignore)2 BigDecimal (java.math.BigDecimal)1 HashSet (java.util.HashSet)1 MapQueryCache (org.apache.cayenne.cache.MapQueryCache)1 DefaultRuntimeProperties (org.apache.cayenne.configuration.DefaultRuntimeProperties)1 OracleAdapter (org.apache.cayenne.dba.oracle.OracleAdapter)1 DefaultEventManager (org.apache.cayenne.event.DefaultEventManager)1 EJBQLQuery (org.apache.cayenne.query.EJBQLQuery)1 SQLTemplate (org.apache.cayenne.query.SQLTemplate)1 PrimitivesTestEntity (org.apache.cayenne.testdo.primitive.PrimitivesTestEntity)1 After (org.junit.After)1