use of org.apache.ignite.internal.binary.builder.BinaryObjectBuilderImpl in project ignite by apache.
the class BinaryObjectBuilderAdditionalSelfTest method testHashSetOverride.
/**
*/
public void testHashSetOverride() {
GridBinaryTestClasses.TestObjectContainer obj = new GridBinaryTestClasses.TestObjectContainer();
BinaryObjectBuilderImpl mutObj = wrap(obj);
Set<Object> c = Sets.newHashSet(mutObj, "a", Sets.newHashSet(1, 2));
mutObj.setField("foo", c, Object.class);
GridBinaryTestClasses.TestObjectContainer res = mutObj.build().deserialize();
c.remove(mutObj);
c.add(res);
assertNotSame(c, res.foo);
assertEquals(c, res.foo);
}
use of org.apache.ignite.internal.binary.builder.BinaryObjectBuilderImpl in project ignite by apache.
the class BinaryObjectBuilderAdditionalSelfTest method testDecimalArrayModification.
/**
*/
public void testDecimalArrayModification() {
GridBinaryTestClasses.TestObjectAllTypes obj = new GridBinaryTestClasses.TestObjectAllTypes();
obj.bdArr = new BigDecimal[] { new BigDecimal(1000), new BigDecimal(1000), new BigDecimal(1000) };
BinaryObjectBuilderImpl mutObj = wrap(obj);
BigDecimal[] arr = mutObj.getField("bdArr");
arr[0] = new BigDecimal(2000);
GridBinaryTestClasses.TestObjectAllTypes res = mutObj.build().deserialize();
Assert.assertArrayEquals(new BigDecimal[] { new BigDecimal(1000), new BigDecimal(1000), new BigDecimal(1000) }, res.bdArr);
}
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 testSavingObjectWithNotZeroStart.
/**
*/
public void testSavingObjectWithNotZeroStart() {
GridBinaryTestClasses.TestObjectOuter out = new GridBinaryTestClasses.TestObjectOuter();
GridBinaryTestClasses.TestObjectInner inner = new GridBinaryTestClasses.TestObjectInner();
out.inner = inner;
inner.outer = out;
BinaryObjectBuilderImpl builder = wrap(out);
BinaryObjectBuilderImpl innerBuilder = builder.getField("inner");
GridBinaryTestClasses.TestObjectInner res = innerBuilder.build().deserialize();
assertSame(res, res.outer.inner);
}
use of org.apache.ignite.internal.binary.builder.BinaryObjectBuilderImpl in project ignite by apache.
the class BinaryObjectBuilderAdditionalSelfTest method testSimpleTypeFieldOverride.
/**
* @throws Exception If any error occurs.
*/
public void testSimpleTypeFieldOverride() throws Exception {
GridBinaryTestClasses.TestObjectAllTypes exp = new GridBinaryTestClasses.TestObjectAllTypes();
exp.setDefaultData();
BinaryObjectBuilderImpl mutPo = wrap(new GridBinaryTestClasses.TestObjectAllTypes());
for (Field field : GridBinaryTestClasses.TestObjectAllTypes.class.getDeclaredFields()) mutPo.setField(field.getName(), field.get(exp));
GridBinaryTestClasses.TestObjectAllTypes res = mutPo.build().deserialize();
GridTestUtils.deepEquals(exp, res);
}
Aggregations