use of com.google.cloud.teleport.v2.templates.spanner.ddl.Ddl in project DataflowTemplates by GoogleCloudPlatform.
the class ChangeEventConvertorTest method cannotConvertChangeEventWithInvalidDateToMutation.
@Test(expected = ChangeEventConvertorException.class)
public void cannotConvertChangeEventWithInvalidDateToMutation() throws Exception {
Ddl ddl = getTestDdl();
JSONObject changeEvent = getTestChangeEvent("Users");
changeEvent.put("date_field", "asdf");
JsonNode ce = parseChangeEvent(changeEvent.toString());
Mutation mutation = ChangeEventConvertor.changeEventToMutation(ddl, ce);
}
use of com.google.cloud.teleport.v2.templates.spanner.ddl.Ddl in project DataflowTemplates by GoogleCloudPlatform.
the class ChangeEventConvertorTest method cannotConvertChangeEventWithInvalidDateToPrimaryKey.
@Test(expected = ChangeEventConvertorException.class)
public void cannotConvertChangeEventWithInvalidDateToPrimaryKey() throws Exception {
Ddl ddl = getTestDdl();
JSONObject changeEvent = getTestChangeEvent("Users2");
changeEvent.put("date_field", "asdf");
JsonNode ce = parseChangeEvent(changeEvent.toString());
Key key = ChangeEventConvertor.changeEventToPrimaryKey(ddl, ce);
// Expect an exception since the event has invalid timestamp
}
use of com.google.cloud.teleport.v2.templates.spanner.ddl.Ddl in project DataflowTemplates by GoogleCloudPlatform.
the class ChangeEventConvertorTest method cannotConvertValidChangeEventWithMissingKeyColumnsToMutation.
@Test(expected = ChangeEventConvertorException.class)
public void cannotConvertValidChangeEventWithMissingKeyColumnsToMutation() throws Exception {
Ddl ddl = getTestDdl();
JSONObject changeEvent = new JSONObject();
changeEvent.put("first_name", "A");
changeEvent.put(DatastreamConstants.EVENT_TABLE_NAME_KEY, "Users");
JsonNode ce = parseChangeEvent(changeEvent.toString());
Mutation mutation = ChangeEventConvertor.changeEventToMutation(ddl, ce);
}
use of com.google.cloud.teleport.v2.templates.spanner.ddl.Ddl in project DataflowTemplates by GoogleCloudPlatform.
the class ChangeEventConvertorTest method cannotConvertChangeEventWithInvalidFloat64ToMutation.
@Test(expected = ChangeEventConvertorException.class)
public void cannotConvertChangeEventWithInvalidFloat64ToMutation() throws Exception {
Ddl ddl = getTestDdl();
JSONObject changeEvent = getTestChangeEvent("Users");
changeEvent.put("float64_field", "asdfasdf");
JsonNode ce = parseChangeEvent(changeEvent.toString());
Mutation mutation = ChangeEventConvertor.changeEventToMutation(ddl, ce);
}
use of com.google.cloud.teleport.v2.templates.spanner.ddl.Ddl in project DataflowTemplates by GoogleCloudPlatform.
the class ChangeEventConvertorTest method cannotConvertChangeEventWithInvalidFloat64ToPrimaryKey.
@Test(expected = ChangeEventConvertorException.class)
public void cannotConvertChangeEventWithInvalidFloat64ToPrimaryKey() throws Exception {
Ddl ddl = getTestDdl();
JSONObject changeEvent = getTestChangeEvent("Users2");
changeEvent.put("float64_field", "asdfasdf");
JsonNode ce = parseChangeEvent(changeEvent.toString());
Key key = ChangeEventConvertor.changeEventToPrimaryKey(ddl, ce);
// Expect an exception since the event has invalid timestamp
}
Aggregations