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 testDoubleArrayModification.
/**
*/
public void testDoubleArrayModification() {
GridBinaryTestClasses.TestObjectAllTypes obj = new GridBinaryTestClasses.TestObjectAllTypes();
obj.dArr = new double[] { 1.0, 1.0, 1.0 };
BinaryObjectBuilderImpl mutObj = wrap(obj);
double[] arr = mutObj.getField("dArr");
arr[0] = 2.0;
GridBinaryTestClasses.TestObjectAllTypes res = mutObj.build().deserialize();
Assert.assertArrayEquals(new double[] { 2.0, 1.0, 1.0 }, res.dArr, 0);
}
use of org.apache.ignite.internal.binary.builder.BinaryObjectBuilderImpl in project ignite by apache.
the class BinaryObjectBuilderAdditionalSelfTest method testArrayListOverride.
/**
*/
public void testArrayListOverride() {
GridBinaryTestClasses.TestObjectContainer obj = new GridBinaryTestClasses.TestObjectContainer();
BinaryObjectBuilderImpl mutObj = wrap(obj);
ArrayList<Object> list = Lists.newArrayList(mutObj, "a", Lists.newArrayList(1, 2));
mutObj.setField("foo", list, Object.class);
GridBinaryTestClasses.TestObjectContainer res = mutObj.build().deserialize();
list.set(0, res);
assertNotSame(list, res.foo);
assertEquals(list, res.foo);
}
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 testBooleanArrayModification.
/**
*/
public void testBooleanArrayModification() {
GridBinaryTestClasses.TestObjectAllTypes obj = new GridBinaryTestClasses.TestObjectAllTypes();
obj.zArr = new boolean[] { false, false, false };
BinaryObjectBuilderImpl mutObj = wrap(obj);
boolean[] arr = mutObj.getField("zArr");
arr[0] = true;
GridBinaryTestClasses.TestObjectAllTypes res = mutObj.build().deserialize();
boolean[] expected = new boolean[] { true, false, false };
assertEquals(expected.length, res.zArr.length);
for (int i = 0; i < expected.length; i++) assertEquals(expected[i], res.zArr[i]);
}
Aggregations