use of org.apache.ignite.internal.binary.BinaryMarshaller in project ignite by apache.
the class IgniteSqlRoutingTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration c = super.getConfiguration(gridName);
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(IP_FINDER);
c.setDiscoverySpi(disco);
c.setMarshaller(new BinaryMarshaller());
List<CacheConfiguration> ccfgs = new ArrayList<>();
CacheConfiguration ccfg = buildCacheConfiguration(gridName);
if (ccfg != null)
ccfgs.add(ccfg);
ccfgs.add(buildCacheConfiguration(CACHE_PERSON));
ccfgs.add(buildCacheConfiguration(CACHE_CALL));
c.setCacheConfiguration(ccfgs.toArray(new CacheConfiguration[ccfgs.size()]));
if (gridName.equals(NODE_CLIENT))
c.setClientMode(true);
c.setCacheKeyConfiguration(new CacheKeyConfiguration(CallKey.class));
return c;
}
use of org.apache.ignite.internal.binary.BinaryMarshaller in project ignite by apache.
the class AbstractH2CompareQueryTest method getConfiguration.
/**
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(IP_FINDER);
c.setDiscoverySpi(disco);
c.setMarshaller(new BinaryMarshaller());
return c;
}
use of org.apache.ignite.internal.binary.BinaryMarshaller in project ignite by apache.
the class JdbcResultSetSelfTest method testObject.
/**
* @throws Exception If failed.
*/
public void testObject() throws Exception {
final Ignite ignite = ignite(0);
final boolean binaryMarshaller = ignite.configuration().getMarshaller() instanceof BinaryMarshaller;
final IgniteBinary binary = binaryMarshaller ? ignite.binary() : null;
ResultSet rs = stmt.executeQuery(SQL);
TestObjectField f1 = new TestObjectField(100, "AAAA");
TestObjectField f2 = new TestObjectField(500, "BBBB");
TestObject o = createObjectWithData(1);
assertTrue(rs.next());
assertEqualsToStringRepresentation(f1, binary, rs.getObject("f1"));
assertEqualsToStringRepresentation(f1, binary, rs.getObject(16));
assertEqualsToStringRepresentation(f2, binary, rs.getObject("f2"));
assertEqualsToStringRepresentation(f2, binary, rs.getObject(17));
assertNull(rs.getObject("f3"));
assertTrue(rs.wasNull());
assertNull(rs.getObject(18));
assertTrue(rs.wasNull());
assertEqualsToStringRepresentation(o, binary, rs.getObject("_val"));
assertEqualsToStringRepresentation(o, binary, rs.getObject(19));
assertFalse(rs.next());
}
use of org.apache.ignite.internal.binary.BinaryMarshaller in project ignite by apache.
the class JdbcMetadataSelfTest method testGetColumns.
/**
* @throws Exception If failed.
*/
public void testGetColumns() throws Exception {
final boolean primitivesInformationIsLostAfterStore = ignite(0).configuration().getMarshaller() instanceof BinaryMarshaller;
try (Connection conn = DriverManager.getConnection(URL)) {
DatabaseMetaData meta = conn.getMetaData();
ResultSet rs = meta.getColumns("", "pers", "Person", "%");
assert rs != null;
Collection<String> names = new ArrayList<>(2);
names.add("NAME");
names.add("AGE");
names.add("ORGID");
int cnt = 0;
while (rs.next()) {
String name = rs.getString("COLUMN_NAME");
assert names.remove(name);
if ("NAME".equals(name)) {
assert rs.getInt("DATA_TYPE") == VARCHAR;
assert "VARCHAR".equals(rs.getString("TYPE_NAME"));
assert rs.getInt("NULLABLE") == 1;
} else if ("AGE".equals(name) || "ORGID".equals(name)) {
assert rs.getInt("DATA_TYPE") == INTEGER;
assert "INTEGER".equals(rs.getString("TYPE_NAME"));
assert rs.getInt("NULLABLE") == (primitivesInformationIsLostAfterStore ? 1 : 0);
}
if ("_KEY".equals(name)) {
assert rs.getInt("DATA_TYPE") == OTHER;
assert "OTHER".equals(rs.getString("TYPE_NAME"));
assert rs.getInt("NULLABLE") == 0;
}
if ("_VAL".equals(name)) {
assert rs.getInt("DATA_TYPE") == OTHER;
assert "OTHER".equals(rs.getString("TYPE_NAME"));
assert rs.getInt("NULLABLE") == 0;
}
cnt++;
}
assert names.isEmpty();
assert cnt == 3;
rs = meta.getColumns("", "org", "Organization", "%");
assert rs != null;
names.add("ID");
names.add("NAME");
cnt = 0;
while (rs.next()) {
String name = rs.getString("COLUMN_NAME");
assert names.remove(name);
if ("id".equals(name)) {
assert rs.getInt("DATA_TYPE") == INTEGER;
assert "INTEGER".equals(rs.getString("TYPE_NAME"));
assert rs.getInt("NULLABLE") == 0;
} else if ("name".equals(name)) {
assert rs.getInt("DATA_TYPE") == VARCHAR;
assert "VARCHAR".equals(rs.getString("TYPE_NAME"));
assert rs.getInt("NULLABLE") == 1;
}
if ("_KEY".equals(name)) {
assert rs.getInt("DATA_TYPE") == VARCHAR;
assert "VARCHAR".equals(rs.getString("TYPE_NAME"));
assert rs.getInt("NULLABLE") == 0;
}
if ("_VAL".equals(name)) {
assert rs.getInt("DATA_TYPE") == OTHER;
assert "OTHER".equals(rs.getString("TYPE_NAME"));
assert rs.getInt("NULLABLE") == 0;
}
cnt++;
}
assert names.isEmpty();
assert cnt == 2;
}
}
use of org.apache.ignite.internal.binary.BinaryMarshaller in project ignite by apache.
the class JdbcResultSetSelfTest method testObject.
/**
* @throws Exception If failed.
*/
public void testObject() throws Exception {
final Ignite ignite = ignite(0);
final boolean binaryMarshaller = ignite.configuration().getMarshaller() instanceof BinaryMarshaller;
final IgniteBinary binary = binaryMarshaller ? ignite.binary() : null;
ResultSet rs = stmt.executeQuery(SQL);
TestObjectField f1 = new TestObjectField(100, "AAAA");
TestObjectField f2 = new TestObjectField(500, "BBBB");
TestObject o = createObjectWithData(1);
assertTrue(rs.next());
assertEqualsToStringRepresentation(f1, binary, rs.getObject("f1"));
assertEqualsToStringRepresentation(f1, binary, rs.getObject(16));
assertEqualsToStringRepresentation(f2, binary, rs.getObject("f2"));
assertEqualsToStringRepresentation(f2, binary, rs.getObject(17));
assertNull(rs.getObject("f3"));
assertTrue(rs.wasNull());
assertNull(rs.getObject(18));
assertTrue(rs.wasNull());
assertEqualsToStringRepresentation(o, binary, rs.getObject("_val"));
assertEqualsToStringRepresentation(o, binary, rs.getObject(19));
assertFalse(rs.next());
}
Aggregations