use of org.apache.ignite.internal.binary.builder.BinaryObjectBuilderImpl in project ignite by apache.
the class BinaryObjectBuilderAdditionalSelfTest method testByteArrayModification.
/**
*/
public void testByteArrayModification() {
GridBinaryTestClasses.TestObjectAllTypes obj = new GridBinaryTestClasses.TestObjectAllTypes();
obj.bArr = new byte[] { 1, 1, 1 };
BinaryObjectBuilderImpl mutObj = wrap(obj);
byte[] arr = mutObj.getField("bArr");
arr[0] = 2;
GridBinaryTestClasses.TestObjectAllTypes res = mutObj.build().deserialize();
Assert.assertArrayEquals(new byte[] { 2, 1, 1 }, res.bArr);
}
use of org.apache.ignite.internal.binary.builder.BinaryObjectBuilderImpl in project ignite by apache.
the class BinaryObjectBuilderAdditionalSelfTest method testEnumArrayModification.
/**
*/
public void testEnumArrayModification() {
GridBinaryTestClasses.TestObjectAllTypes obj = new GridBinaryTestClasses.TestObjectAllTypes();
obj.enumArr = new GridBinaryTestClasses.TestObjectEnum[] { GridBinaryTestClasses.TestObjectEnum.A, GridBinaryTestClasses.TestObjectEnum.B };
BinaryObjectBuilderImpl mutObj = wrap(obj);
BinaryBuilderEnum[] arr = mutObj.getField("enumArr");
arr[0] = new BinaryBuilderEnum(mutObj.typeId(), GridBinaryTestClasses.TestObjectEnum.B);
GridBinaryTestClasses.TestObjectAllTypes res = mutObj.build().deserialize();
Assert.assertArrayEquals(new GridBinaryTestClasses.TestObjectEnum[] { GridBinaryTestClasses.TestObjectEnum.A, GridBinaryTestClasses.TestObjectEnum.B }, res.enumArr);
}
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);
}
use of org.apache.ignite.internal.binary.builder.BinaryObjectBuilderImpl in project ignite by apache.
the class BinaryObjectBuilderAdditionalSelfTest method testHashCode.
/**
*/
public void testHashCode() {
GridBinaryTestClasses.TestObjectContainer obj = new GridBinaryTestClasses.TestObjectContainer();
BinaryObjectBuilderImpl mutableObj = wrap(obj);
BinaryObject bo = mutableObj.build();
assertEquals(BinaryArrayIdentityResolver.instance().hashCode(bo), bo.hashCode());
}
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);
}
Aggregations