use of org.apache.ignite.internal.binary.builder.BinaryObjectBuilderImpl in project ignite by apache.
the class BinaryObjectBuilderAdditionalSelfTest method testCharArrayModification.
/**
*
*/
public void testCharArrayModification() {
GridBinaryTestClasses.TestObjectAllTypes obj = new GridBinaryTestClasses.TestObjectAllTypes();
obj.cArr = new char[] { 'a', 'a', 'a' };
BinaryObjectBuilderImpl mutObj = wrap(obj);
char[] arr = mutObj.getField("cArr");
arr[0] = 'b';
GridBinaryTestClasses.TestObjectAllTypes res = mutObj.build().deserialize();
Assert.assertArrayEquals(new char[] { 'b', 'a', 'a' }, res.cArr);
}
use of org.apache.ignite.internal.binary.builder.BinaryObjectBuilderImpl in project ignite by apache.
the class BinaryObjectBuilderAdditionalSelfTest method testSimpleTypeFieldSerialize.
/**
*
*/
public void testSimpleTypeFieldSerialize() {
GridBinaryTestClasses.TestObjectAllTypes exp = new GridBinaryTestClasses.TestObjectAllTypes();
exp.setDefaultData();
BinaryObjectBuilderImpl mutPo = wrap(exp);
GridBinaryTestClasses.TestObjectAllTypes res = mutPo.build().deserialize();
GridTestUtils.deepEquals(exp, res);
}
use of org.apache.ignite.internal.binary.builder.BinaryObjectBuilderImpl in project ignite by apache.
the class BinaryObjectBuilderAdditionalSelfTest method testUUIDArrayModification.
/**
*
*/
public void testUUIDArrayModification() {
GridBinaryTestClasses.TestObjectAllTypes obj = new GridBinaryTestClasses.TestObjectAllTypes();
obj.uuidArr = new UUID[] { new UUID(1, 1), new UUID(1, 1), new UUID(1, 1) };
BinaryObjectBuilderImpl mutObj = wrap(obj);
UUID[] arr = mutObj.getField("uuidArr");
arr[0] = new UUID(2, 2);
GridBinaryTestClasses.TestObjectAllTypes res = mutObj.build().deserialize();
Assert.assertArrayEquals(new UUID[] { new UUID(2, 2), new UUID(1, 1), new UUID(1, 1) }, res.uuidArr);
}
use of org.apache.ignite.internal.binary.builder.BinaryObjectBuilderImpl in project ignite by apache.
the class BinaryObjectBuilderAdditionalSelfTest method testRemoveFromExistingObject.
/**
*
*/
public void testRemoveFromExistingObject() {
GridBinaryTestClasses.TestObjectAllTypes obj = new GridBinaryTestClasses.TestObjectAllTypes();
obj.setDefaultData();
BinaryObjectBuilderImpl wrapper = wrap(toBinary(obj));
wrapper.removeField("str");
TestCase.assertNull(wrapper.build().<GridBinaryTestClasses.TestObjectAllTypes>deserialize().str);
}
use of org.apache.ignite.internal.binary.builder.BinaryObjectBuilderImpl in project ignite by apache.
the class BinaryObjectBuilderAdditionalSelfTest method testLinkedListWriteUnmodifiable.
/**
*
*/
public void testLinkedListWriteUnmodifiable() {
GridBinaryTestClasses.TestObjectContainer obj = new GridBinaryTestClasses.TestObjectContainer();
LinkedList<Object> src = Lists.newLinkedList(Arrays.asList(obj, "a", "b", "c"));
obj.foo = src;
BinaryObjectBuilderImpl mutObj = wrap(obj);
GridBinaryTestClasses.TestObjectContainer deserialized = mutObj.build().deserialize();
List<Object> res = (List<Object>) deserialized.foo;
src.set(0, deserialized);
assertEquals(src, res);
}
Aggregations