use of org.apache.ignite.internal.binary.builder.BinaryObjectBuilderImpl in project ignite by apache.
the class BinaryObjectBuilderAdditionalSelfTest method testArrayListRead.
/**
*
*/
public void testArrayListRead() {
GridBinaryTestClasses.TestObjectContainer obj = new GridBinaryTestClasses.TestObjectContainer();
obj.foo = Lists.newArrayList(obj, "a");
BinaryObjectBuilderImpl mutObj = wrap(obj);
List<Object> list = mutObj.getField("foo");
assert list.equals(Lists.newArrayList(mutObj, "a"));
}
use of org.apache.ignite.internal.binary.builder.BinaryObjectBuilderImpl in project ignite by apache.
the class BinaryObjectBuilderAdditionalSelfTest method testHashSetRead.
/**
*
*/
public void testHashSetRead() {
GridBinaryTestClasses.TestObjectContainer obj = new GridBinaryTestClasses.TestObjectContainer();
obj.foo = Sets.newHashSet(obj, "a");
BinaryObjectBuilderImpl mutObj = wrap(obj);
Set<Object> set = mutObj.getField("foo");
assert set.equals(Sets.newHashSet(mutObj, "a"));
}
use of org.apache.ignite.internal.binary.builder.BinaryObjectBuilderImpl in project ignite by apache.
the class BinaryObjectBuilderAdditionalSelfTest method testDateArrayOverride.
/**
*
*/
@SuppressWarnings("AssertEqualsBetweenInconvertibleTypes")
public void testDateArrayOverride() {
GridBinaryTestClasses.TestObjectContainer obj = new GridBinaryTestClasses.TestObjectContainer();
BinaryObjectBuilderImpl mutableObj = wrap(obj);
Date[] arr = { new Date() };
mutableObj.setField("foo", arr, Object.class);
GridBinaryTestClasses.TestObjectContainer res = mutableObj.build().deserialize();
assertEquals(Date[].class, res.foo.getClass());
assertTrue(Objects.deepEquals(arr, res.foo));
}
use of org.apache.ignite.internal.binary.builder.BinaryObjectBuilderImpl in project ignite by apache.
the class BinaryObjectBuilderAdditionalSelfTest method testMetadataChangingDoublePut.
/**
*
*/
public void testMetadataChangingDoublePut() {
BinaryObjectBuilderImpl mutableObj = wrap(new GridBinaryTestClasses.TestObjectContainer());
mutableObj.setField("xx567", "a");
mutableObj.setField("xx567", "b");
mutableObj.build();
BinaryType metadata = binaries().type(GridBinaryTestClasses.TestObjectContainer.class);
assertEquals("String", metadata.fieldTypeName("xx567"));
}
use of org.apache.ignite.internal.binary.builder.BinaryObjectBuilderImpl in project ignite by apache.
the class BinaryObjectBuilderAdditionalSelfTest method testArrayListModification.
/**
*
*/
public void testArrayListModification() {
GridBinaryTestClasses.TestObjectContainer obj = new GridBinaryTestClasses.TestObjectContainer();
obj.foo = Lists.newArrayList("a", "b", "c");
BinaryObjectBuilderImpl mutObj = wrap(obj);
List<String> list = mutObj.getField("foo");
// "a", "b", "c", "!"
list.add("!");
// "_", "a", "b", "c", "!"
list.add(0, "_");
// "_", "b", "c", "!"
String s = list.remove(1);
assertEquals("a", s);
assertEquals(Arrays.asList("c", "!"), list.subList(2, 4));
assertEquals(1, list.indexOf("b"));
assertEquals(1, list.lastIndexOf("b"));
GridBinaryTestClasses.TestObjectContainer res = mutObj.build().deserialize();
assertTrue(res.foo instanceof ArrayList);
assertEquals(Arrays.asList("_", "b", "c", "!"), res.foo);
}
Aggregations