use of org.apache.ignite.internal.binary.builder.BinaryObjectBuilderImpl in project ignite by apache.
the class BinaryObjectBuilderAdditionalSelfTest method testTimestampInObjectField.
/**
*
*/
public void testTimestampInObjectField() {
GridBinaryTestClasses.TestObjectContainer obj = new GridBinaryTestClasses.TestObjectContainer();
obj.foo = new Timestamp(100020003);
BinaryObjectBuilderImpl mutableObj = wrap(obj);
assertEquals(Timestamp.class, mutableObj.getField("foo").getClass());
}
use of org.apache.ignite.internal.binary.builder.BinaryObjectBuilderImpl in project ignite by apache.
the class BinaryObjectBuilderAdditionalSelfTest method testHashSetModification.
/**
*
*/
public void testHashSetModification() {
GridBinaryTestClasses.TestObjectContainer obj = new GridBinaryTestClasses.TestObjectContainer();
obj.foo = Sets.newHashSet("a", "b", "c");
BinaryObjectBuilderImpl mutObj = wrap(obj);
Set<String> set = mutObj.getField("foo");
set.remove("b");
set.add("!");
assertEquals(Sets.newHashSet("a", "!", "c"), set);
assertTrue(set.contains("a"));
assertTrue(set.contains("!"));
GridBinaryTestClasses.TestObjectContainer res = mutObj.build().deserialize();
assertTrue(res.foo instanceof HashSet);
assertEquals(Sets.newHashSet("a", "!", "c"), res.foo);
}
use of org.apache.ignite.internal.binary.builder.BinaryObjectBuilderImpl in project ignite by apache.
the class BinaryObjectBuilderAdditionalSelfTest method testIntArrayModification.
/**
*
*/
public void testIntArrayModification() {
GridBinaryTestClasses.TestObjectAllTypes obj = new GridBinaryTestClasses.TestObjectAllTypes();
obj.iArr = new int[] { 1, 1, 1 };
BinaryObjectBuilderImpl mutObj = wrap(obj);
int[] arr = mutObj.getField("iArr");
arr[0] = 2;
GridBinaryTestClasses.TestObjectAllTypes res = mutObj.build().deserialize();
Assert.assertArrayEquals(new int[] { 2, 1, 1 }, res.iArr);
}
use of org.apache.ignite.internal.binary.builder.BinaryObjectBuilderImpl in project ignite by apache.
the class BinaryObjectBuilderAdditionalSelfTest method testModifyObjectArray.
/**
*
*/
public void testModifyObjectArray() {
GridBinaryTestClasses.TestObjectContainer obj = new GridBinaryTestClasses.TestObjectContainer();
obj.foo = new Object[] { "a" };
BinaryObjectBuilderImpl mutObj = wrap(obj);
Object[] arr = mutObj.getField("foo");
Assert.assertArrayEquals(new Object[] { "a" }, arr);
arr[0] = "b";
GridBinaryTestClasses.TestObjectContainer res = mutObj.build().deserialize();
Assert.assertArrayEquals(new Object[] { "b" }, (Object[]) res.foo);
}
use of org.apache.ignite.internal.binary.builder.BinaryObjectBuilderImpl in project ignite by apache.
the class BinaryObjectBuilderAdditionalSelfTest method testOverrideObjectArrayField.
/**
*
*/
public void testOverrideObjectArrayField() {
BinaryObjectBuilderImpl mutObj = wrap(new GridBinaryTestClasses.TestObjectContainer());
Object[] createdArr = { mutObj, "a", 1, new String[] { "s", "s" }, new byte[] { 1, 2 }, new UUID(3, 0) };
mutObj.setField("foo", createdArr.clone(), Object.class);
GridBinaryTestClasses.TestObjectContainer res = mutObj.build().deserialize();
createdArr[0] = res;
assertTrue(Objects.deepEquals(createdArr, res.foo));
}
Aggregations