use of org.apache.ignite.binary.BinaryObjectBuilder in project ignite by apache.
the class BinaryObjectBuilderDefaultMappersSelfTest method testRemoveFromNewObject.
/**
*/
public void testRemoveFromNewObject() {
BinaryObjectBuilder builder = builder(GridBinaryTestClasses.TestObjectAllTypes.class.getName());
builder.setField("str", "a");
builder.removeField("str");
TestCase.assertNull(builder.build().<GridBinaryTestClasses.TestObjectAllTypes>deserialize().str);
}
use of org.apache.ignite.binary.BinaryObjectBuilder in project ignite by apache.
the class BinaryObjectBuilderDefaultMappersSelfTest method testFloatArrayField.
/**
* @throws Exception If failed.
*/
public void testFloatArrayField() throws Exception {
BinaryObjectBuilder builder = builder("Class");
builder.setField("floatArrayField", new float[] { 1, 2, 3 });
BinaryObject po = builder.build();
assertEquals(expectedHashCode("Class"), po.type().typeId());
assertEquals(BinaryArrayIdentityResolver.instance().hashCode(po), po.hashCode());
assertTrue(Arrays.equals(new float[] { 1, 2, 3 }, po.<float[]>field("floatArrayField")));
}
use of org.apache.ignite.binary.BinaryObjectBuilder in project ignite by apache.
the class BinaryObjectBuilderDefaultMappersSelfTest method testDoubleArrayField.
/**
* @throws Exception If failed.
*/
public void testDoubleArrayField() throws Exception {
BinaryObjectBuilder builder = builder("Class");
builder.setField("doubleArrayField", new double[] { 1, 2, 3 });
BinaryObject po = builder.build();
assertEquals(expectedHashCode("Class"), po.type().typeId());
assertEquals(BinaryArrayIdentityResolver.instance().hashCode(po), po.hashCode());
assertTrue(Arrays.equals(new double[] { 1, 2, 3 }, po.<double[]>field("doubleArrayField")));
}
use of org.apache.ignite.binary.BinaryObjectBuilder in project ignite by apache.
the class BinaryObjectBuilderDefaultMappersSelfTest method testFloatField.
/**
* @throws Exception If failed.
*/
public void testFloatField() throws Exception {
BinaryObjectBuilder builder = builder("Class");
builder.setField("floatField", 1.0f);
BinaryObject po = builder.build();
assertEquals(expectedHashCode("Class"), po.type().typeId());
assertEquals(BinaryArrayIdentityResolver.instance().hashCode(po), po.hashCode());
assertEquals(1.0f, po.<Float>field("floatField").floatValue(), 0);
}
use of org.apache.ignite.binary.BinaryObjectBuilder in project ignite by apache.
the class BinaryObjectBuilderDefaultMappersSelfTest method testIntField.
/**
* @throws Exception If failed.
*/
public void testIntField() throws Exception {
BinaryObjectBuilder builder = builder("Class");
builder.setField("intField", 1);
BinaryObject po = builder.build();
assertEquals(expectedHashCode("Class"), po.type().typeId());
assertEquals(BinaryArrayIdentityResolver.instance().hashCode(po), po.hashCode());
assertEquals(1, po.<Integer>field("intField").intValue());
}
Aggregations