use of org.apache.ignite.internal.schema.testobjects.TestObjectWithPrivateConstructor in project ignite-3 by apache.
the class RecordMarshallerTest method classWithPrivateConstructor.
@ParameterizedTest
@MethodSource("marshallerFactoryProvider")
public void classWithPrivateConstructor(MarshallerFactory factory) throws MarshallerException, IllegalAccessException {
SchemaDescriptor schema = new SchemaDescriptor(1, new Column[] { new Column("primLongCol".toUpperCase(), INT64, false) }, new Column[] { new Column("primIntCol".toUpperCase(), INT32, false) });
RecordMarshaller<TestObjectWithPrivateConstructor> marshaller = factory.create(schema, TestObjectWithPrivateConstructor.class);
final TestObjectWithPrivateConstructor rec = TestObjectWithPrivateConstructor.randomObject(rnd);
BinaryRow row = marshaller.marshal(rec);
TestObjectWithPrivateConstructor restoredRec = marshaller.unmarshal(new Row(schema, row));
assertDeepEquals(TestObjectWithPrivateConstructor.class, rec, restoredRec);
}
use of org.apache.ignite.internal.schema.testobjects.TestObjectWithPrivateConstructor in project ignite-3 by apache.
the class KvMarshallerTest method classWithPrivateConstructor.
@ParameterizedTest
@MethodSource("marshallerFactoryProvider")
public void classWithPrivateConstructor(MarshallerFactory factory) throws MarshallerException {
Column[] cols = new Column[] { new Column("primLongCol".toUpperCase(), INT64, false), new Column("primIntCol".toUpperCase(), INT32, false) };
SchemaDescriptor schema = new SchemaDescriptor(1, cols, cols);
KvMarshaller<TestObjectWithPrivateConstructor, TestObjectWithPrivateConstructor> marshaller = factory.create(schema, TestObjectWithPrivateConstructor.class, TestObjectWithPrivateConstructor.class);
final TestObjectWithPrivateConstructor key = TestObjectWithPrivateConstructor.randomObject(rnd);
final TestObjectWithPrivateConstructor val = TestObjectWithPrivateConstructor.randomObject(rnd);
BinaryRow row = marshaller.marshal(key, val);
Object key1 = marshaller.unmarshalKey(new Row(schema, row));
Object val1 = marshaller.unmarshalValue(new Row(schema, row));
assertTrue(key.getClass().isInstance(key1));
assertTrue(val.getClass().isInstance(val1));
assertEquals(key, key);
assertEquals(val, val1);
}
Aggregations