Search in sources :

Example 1 with ClientMtTable3

use of org.apache.cayenne.testdo.mt.ClientMtTable3 in project cayenne by apache.

the class ClientServerChannelIT method testPerformQueryValuePropagation.

@Test
public void testPerformQueryValuePropagation() throws Exception {
    byte[] bytes = new byte[] { 1, 2, 3 };
    tMtTable3.insert(1, bytes, "abc", 4);
    Query query = new SelectQuery("MtTable3");
    QueryResponse response = clientServerChannel.onQuery(null, query);
    assertNotNull(response);
    List<?> results = response.firstList();
    assertNotNull(results);
    assertEquals(1, results.size());
    Object result = results.get(0);
    assertTrue("Result is of wrong type: " + result, result instanceof ClientMtTable3);
    ClientMtTable3 clientObject = (ClientMtTable3) result;
    assertEquals("abc", clientObject.getCharColumn());
    assertEquals(new Integer(4), clientObject.getIntColumn());
    assertTrue(new EqualsBuilder().append(clientObject.getBinaryColumn(), bytes).isEquals());
}
Also used : SelectQuery(org.apache.cayenne.query.SelectQuery) ClientMtTable3(org.apache.cayenne.testdo.mt.ClientMtTable3) SelectQuery(org.apache.cayenne.query.SelectQuery) MockQuery(org.apache.cayenne.query.MockQuery) Query(org.apache.cayenne.query.Query) QueryResponse(org.apache.cayenne.QueryResponse) EqualsBuilder(org.apache.cayenne.util.EqualsBuilder) Test(org.junit.Test)

Aggregations

QueryResponse (org.apache.cayenne.QueryResponse)1 MockQuery (org.apache.cayenne.query.MockQuery)1 Query (org.apache.cayenne.query.Query)1 SelectQuery (org.apache.cayenne.query.SelectQuery)1 ClientMtTable3 (org.apache.cayenne.testdo.mt.ClientMtTable3)1 EqualsBuilder (org.apache.cayenne.util.EqualsBuilder)1 Test (org.junit.Test)1