use of org.apache.ignite.internal.table.impl.TestTupleBuilder in project ignite-3 by apache.
the class RecordBinaryViewOperationsTest method validateSchema.
@Test
public void validateSchema() {
SchemaDescriptor schema = new SchemaDescriptor(1, new Column[] { new Column("id".toUpperCase(), NativeTypes.INT64, false) }, new Column[] { new Column("val".toUpperCase(), NativeTypes.INT64, true), new Column("str".toUpperCase(), NativeTypes.stringOf(3), true), new Column("blob".toUpperCase(), NativeTypes.blobOf(3), true) });
RecordView<Tuple> tbl = createTableImpl(schema).recordView();
final Tuple keyTuple0 = new TestTupleBuilder().set("id", 0).set("id1", 0);
final Tuple keyTuple1 = new TestTupleBuilder().set("id1", 0);
final Tuple tuple0 = new TestTupleBuilder().set("id", 1L).set("str", "qweqweqwe").set("val", 11L);
final Tuple tuple1 = new TestTupleBuilder().set("id", 1L).set("blob", new byte[] { 0, 1, 2, 3 }).set("val", 22L);
assertThrowsWithCause(InvalidTypeException.class, () -> tbl.get(null, keyTuple0));
assertThrowsWithCause(SchemaMismatchException.class, () -> tbl.get(null, keyTuple1));
assertThrowsWithCause(InvalidTypeException.class, () -> tbl.replace(null, tuple0));
assertThrowsWithCause(InvalidTypeException.class, () -> tbl.replace(null, tuple1));
assertThrowsWithCause(InvalidTypeException.class, () -> tbl.insert(null, tuple0));
assertThrowsWithCause(InvalidTypeException.class, () -> tbl.insert(null, tuple1));
assertThrowsWithCause(InvalidTypeException.class, () -> tbl.replace(null, tuple0));
assertThrowsWithCause(InvalidTypeException.class, () -> tbl.replace(null, tuple1));
}
Aggregations