Search in sources :

Example 1 with ArraysEntity

use of org.apache.cayenne.testdo.misc_types.ArraysEntity in project cayenne by apache.

the class MiscTypesIT method testByteArray.

@Test
public void testByteArray() {
    ArraysEntity test = context.newObject(ArraysEntity.class);
    byte[] a = new byte[] { 1, 2, 3 };
    test.setByteArray(a);
    context.commitChanges();
    SelectQuery q = new SelectQuery(ArraysEntity.class);
    ArraysEntity testRead = (ArraysEntity) context.performQuery(q).get(0);
    assertNotNull(testRead.getByteArray());
    assertArraysEqual(a, testRead.getByteArray());
    test.setByteArray(null);
    context.commitChanges();
}
Also used : SelectQuery(org.apache.cayenne.query.SelectQuery) ArraysEntity(org.apache.cayenne.testdo.misc_types.ArraysEntity) Test(org.junit.Test)

Example 2 with ArraysEntity

use of org.apache.cayenne.testdo.misc_types.ArraysEntity in project cayenne by apache.

the class MiscTypesIT method testByteWrapperArray.

@Test
public void testByteWrapperArray() {
    ArraysEntity test = context.newObject(ArraysEntity.class);
    Byte[] a = new Byte[] { new Byte((byte) 1), new Byte((byte) 2), new Byte((byte) 3) };
    test.setByteWrapperArray(a);
    context.commitChanges();
    SelectQuery q = new SelectQuery(ArraysEntity.class);
    ArraysEntity testRead = (ArraysEntity) context.performQuery(q).get(0);
    assertNotNull(testRead.getByteWrapperArray());
    assertArraysEqual(a, testRead.getByteWrapperArray());
    test.setByteWrapperArray(null);
    context.commitChanges();
}
Also used : SelectQuery(org.apache.cayenne.query.SelectQuery) ArraysEntity(org.apache.cayenne.testdo.misc_types.ArraysEntity) Test(org.junit.Test)

Example 3 with ArraysEntity

use of org.apache.cayenne.testdo.misc_types.ArraysEntity in project cayenne by apache.

the class MiscTypesIT method testCharArray.

@Test
public void testCharArray() {
    ArraysEntity test = context.newObject(ArraysEntity.class);
    char[] a = new char[] { 'x', 'y', 'z' };
    test.setCharArray(a);
    context.commitChanges();
    SelectQuery q = new SelectQuery(ArraysEntity.class);
    ArraysEntity testRead = (ArraysEntity) context.performQuery(q).get(0);
    assertNotNull(testRead.getCharArray());
    assertArraysEqual(a, testRead.getCharArray());
    test.setCharArray(null);
    context.commitChanges();
}
Also used : SelectQuery(org.apache.cayenne.query.SelectQuery) ArraysEntity(org.apache.cayenne.testdo.misc_types.ArraysEntity) Test(org.junit.Test)

Example 4 with ArraysEntity

use of org.apache.cayenne.testdo.misc_types.ArraysEntity in project cayenne by apache.

the class MiscTypesIT method testCharacterArray.

@Test
public void testCharacterArray() {
    ArraysEntity test = context.newObject(ArraysEntity.class);
    Character[] a = new Character[] { new Character('x'), new Character('y'), new Character('z') };
    test.setCharWrapperArray(a);
    context.commitChanges();
    SelectQuery q = new SelectQuery(ArraysEntity.class);
    ArraysEntity testRead = (ArraysEntity) context.performQuery(q).get(0);
    assertNotNull(testRead.getCharWrapperArray());
    assertArraysEqual(a, testRead.getCharWrapperArray());
    test.setCharWrapperArray(null);
    context.commitChanges();
}
Also used : SelectQuery(org.apache.cayenne.query.SelectQuery) ArraysEntity(org.apache.cayenne.testdo.misc_types.ArraysEntity) Test(org.junit.Test)

Aggregations

SelectQuery (org.apache.cayenne.query.SelectQuery)4 ArraysEntity (org.apache.cayenne.testdo.misc_types.ArraysEntity)4 Test (org.junit.Test)4