use of org.apache.ignite.binary.BinaryObject in project ignite by apache.
the class CacheKeepBinaryTransactionTest method testBinaryContains.
/**
* @throws Exception If failed.
*/
public void testBinaryContains() throws Exception {
IgniteEx ignite = grid(0);
IgniteCache<Object, Object> cache = ignite.cache("tx-cache").withKeepBinary();
try (Transaction tx = ignite.transactions().txStart()) {
BinaryObject key = ignite.binary().builder("test2").setField("id", 1).build();
assertFalse(cache.containsKey(key));
}
}
use of org.apache.ignite.binary.BinaryObject in project ignite by apache.
the class BinaryObjectBuilderDefaultMappersSelfTest method testUuidArrayField.
/**
* @throws Exception If failed.
*/
public void testUuidArrayField() throws Exception {
BinaryObjectBuilder builder = builder("Class");
UUID[] arr = new UUID[] { UUID.randomUUID(), UUID.randomUUID() };
builder.setField("uuidArrayField", arr);
BinaryObject po = builder.build();
assertEquals(expectedHashCode("Class"), po.type().typeId());
assertEquals(BinaryArrayIdentityResolver.instance().hashCode(po), po.hashCode());
assertTrue(Arrays.equals(arr, po.<UUID[]>field("uuidArrayField")));
}
use of org.apache.ignite.binary.BinaryObject in project ignite by apache.
the class BinaryObjectBuilderDefaultMappersSelfTest method testPlainBinaryObjectCopyFrom.
/**
*/
public void testPlainBinaryObjectCopyFrom() {
GridBinaryTestClasses.TestObjectPlainBinary obj = new GridBinaryTestClasses.TestObjectPlainBinary(toBinary(new GridBinaryTestClasses.TestObjectAllTypes()));
BinaryObjectBuilderImpl builder = builder(toBinary(obj));
assertTrue(builder.getField("plainBinary") instanceof BinaryObject);
GridBinaryTestClasses.TestObjectPlainBinary deserialized = builder.build().deserialize();
assertTrue(deserialized.plainBinary != null);
}
use of org.apache.ignite.binary.BinaryObject in project ignite by apache.
the class BinaryObjectBuilderDefaultMappersSelfTest method testDecimalField.
/**
* @throws Exception If failed.
*/
public void testDecimalField() throws Exception {
BinaryObjectBuilder builder = builder("Class");
builder.setField("decimalField", BigDecimal.TEN);
BinaryObject po = builder.build();
assertEquals(expectedHashCode("Class"), po.type().typeId());
assertEquals(BinaryArrayIdentityResolver.instance().hashCode(po), po.hashCode());
assertEquals(BigDecimal.TEN, po.<BigDecimal>field("decimalField"));
}
use of org.apache.ignite.binary.BinaryObject in project ignite by apache.
the class BinaryObjectBuilderDefaultMappersSelfTest method testDecimalArrayField.
/**
* @throws Exception If failed.
*/
public void testDecimalArrayField() throws Exception {
BinaryObjectBuilder builder = builder("Class");
builder.setField("decimalArrayField", new BigDecimal[] { BigDecimal.ONE, BigDecimal.TEN });
BinaryObject po = builder.build();
assertEquals(expectedHashCode("Class"), po.type().typeId());
assertEquals(BinaryArrayIdentityResolver.instance().hashCode(po), po.hashCode());
assertTrue(Arrays.equals(new BigDecimal[] { BigDecimal.ONE, BigDecimal.TEN }, po.<String[]>field("decimalArrayField")));
}
Aggregations