use of org.apache.ignite.internal.binary.builder.BinaryObjectBuilderImpl in project ignite by apache.
the class BinaryObjectBuilderAdditionalSelfTest method testMapEntryOverride.
/**
*
*/
public void testMapEntryOverride() {
GridBinaryTestClasses.TestObjectContainer obj = new GridBinaryTestClasses.TestObjectContainer();
BinaryObjectBuilderImpl mutableObj = wrap(obj);
mutableObj.setField("foo", new GridMapEntry<>(1, "a"));
GridBinaryTestClasses.TestObjectContainer res = mutableObj.build().deserialize();
assertEquals(new GridMapEntry<>(1, "a"), res.foo);
}
use of org.apache.ignite.internal.binary.builder.BinaryObjectBuilderImpl in project ignite by apache.
the class BinaryObjectBuilderAdditionalSelfTest method testMapOverride.
/**
*
*/
public void testMapOverride() {
GridBinaryTestClasses.TestObjectContainer obj = new GridBinaryTestClasses.TestObjectContainer();
BinaryObjectBuilderImpl mutObj = wrap(obj);
Map<Object, Object> map = Maps.newHashMap(ImmutableMap.of(mutObj, "a", "b", mutObj));
mutObj.setField("foo", map, Object.class);
GridBinaryTestClasses.TestObjectContainer res = mutObj.build().deserialize();
assertEquals(ImmutableMap.of(res, "a", "b", res), res.foo);
}
use of org.apache.ignite.internal.binary.builder.BinaryObjectBuilderImpl in project ignite by apache.
the class BinaryObjectBuilderAdditionalSelfTest method testMetadataChangingDoublePut2.
/**
*
*/
public void testMetadataChangingDoublePut2() {
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 testLinkedListOverride.
/**
*
*/
public void testLinkedListOverride() {
GridBinaryTestClasses.TestObjectContainer obj = new GridBinaryTestClasses.TestObjectContainer();
BinaryObjectBuilderImpl mutObj = wrap(obj);
List<Object> list = Lists.newLinkedList(Arrays.asList(mutObj, "a", Lists.newLinkedList(Arrays.asList(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 testBuildFromObjectWithoutSchema.
/**
* Ensure that object w/o schema can be re-built.
*/
public void testBuildFromObjectWithoutSchema() {
BinaryObjectBuilderImpl binBuilder = wrap(new GridBinaryTestClass2());
BinaryObject binObj = binBuilder.build();
BinaryObjectBuilderImpl binBuilder2 = wrap(binObj);
binBuilder2.build();
}
Aggregations