use of org.apache.ignite.internal.binary.builder.BinaryObjectBuilderImpl in project ignite by apache.
the class BinaryObjectBuilderAdditionalSelfTest method testLinkedListRead.
/**
*
*/
public void testLinkedListRead() {
GridBinaryTestClasses.TestObjectContainer obj = new GridBinaryTestClasses.TestObjectContainer();
obj.foo = Lists.newLinkedList(Arrays.asList(obj, "a"));
BinaryObjectBuilderImpl mutObj = wrap(obj);
List<Object> list = mutObj.getField("foo");
assert list.equals(Lists.newLinkedList(Arrays.asList(mutObj, "a")));
}
use of org.apache.ignite.internal.binary.builder.BinaryObjectBuilderImpl in project ignite by apache.
the class BinaryObjectBuilderAdditionalSelfTest method testEditObjectWithRawData.
/**
*
*/
public void testEditObjectWithRawData() {
GridBinaryMarshalerAwareTestClass obj = new GridBinaryMarshalerAwareTestClass();
obj.s = "a";
obj.sRaw = "aa";
BinaryObjectBuilderImpl mutableObj = wrap(obj);
mutableObj.setField("s", "z");
GridBinaryMarshalerAwareTestClass res = mutableObj.build().deserialize();
assertEquals("z", res.s);
assertEquals("aa", res.sRaw);
}
use of org.apache.ignite.internal.binary.builder.BinaryObjectBuilderImpl in project ignite by apache.
the class BinaryObjectBuilderAdditionalSelfTest method testDateArrayModification.
/**
*
*/
public void testDateArrayModification() {
GridBinaryTestClasses.TestObjectAllTypes obj = new GridBinaryTestClasses.TestObjectAllTypes();
obj.dateArr = new Date[] { new Date(11111), new Date(11111), new Date(11111) };
BinaryObjectBuilderImpl mutObj = wrap(obj);
Date[] arr = mutObj.getField("dateArr");
arr[0] = new Date(22222);
GridBinaryTestClasses.TestObjectAllTypes res = mutObj.build().deserialize();
Assert.assertArrayEquals(new Date[] { new Date(22222), new Date(11111), new Date(11111) }, res.dateArr);
}
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 testLongArrayModification.
/**
*
*/
public void testLongArrayModification() {
GridBinaryTestClasses.TestObjectAllTypes obj = new GridBinaryTestClasses.TestObjectAllTypes();
obj.lArr = new long[] { 1, 1, 1 };
BinaryObjectBuilderImpl mutObj = wrap(obj);
long[] arr = mutObj.getField("lArr");
arr[0] = 2;
GridBinaryTestClasses.TestObjectAllTypes res = mutObj.build().deserialize();
Assert.assertArrayEquals(new long[] { 2, 1, 1 }, res.lArr);
}
Aggregations