Search in sources :

Example 61 with Mutation

use of com.google.cloud.spanner.Mutation in project beam by apache.

the class MutationUtilsTest method testCreateUpdateMutationFromRow.

@Test
public void testCreateUpdateMutationFromRow() {
    Mutation expectedMutation = createMutation(Mutation.Op.UPDATE);
    Mutation mutation = beamRowToMutationFn(Mutation.Op.UPDATE, TABLE).apply(WRITE_ROW);
    assertEquals(expectedMutation, mutation);
}
Also used : Mutation(com.google.cloud.spanner.Mutation) Test(org.junit.Test)

Example 62 with Mutation

use of com.google.cloud.spanner.Mutation in project beam by apache.

the class MutationUtilsTest method testCreateInsertOrUpdateMutationFromRowWithNulls.

@Test
public void testCreateInsertOrUpdateMutationFromRowWithNulls() {
    Mutation expectedMutation = createMutationNulls(Mutation.Op.INSERT_OR_UPDATE);
    Mutation mutation = beamRowToMutationFn(Mutation.Op.INSERT_OR_UPDATE, TABLE).apply(WRITE_ROW_NULLS);
    assertEquals(expectedMutation, mutation);
}
Also used : Mutation(com.google.cloud.spanner.Mutation) Test(org.junit.Test)

Example 63 with Mutation

use of com.google.cloud.spanner.Mutation in project beam by apache.

the class MutationUtilsTest method testCreateInsertOrUpdateMutationFromRow.

@Test
public void testCreateInsertOrUpdateMutationFromRow() {
    Mutation expectedMutation = createMutation(Mutation.Op.INSERT_OR_UPDATE);
    Mutation mutation = beamRowToMutationFn(Mutation.Op.INSERT_OR_UPDATE, TABLE).apply(WRITE_ROW);
    assertEquals(expectedMutation, mutation);
}
Also used : Mutation(com.google.cloud.spanner.Mutation) Test(org.junit.Test)

Example 64 with Mutation

use of com.google.cloud.spanner.Mutation in project beam by apache.

the class MutationUtilsTest method testCreateUpdateMutationFromRowWithNulls.

@Test
public void testCreateUpdateMutationFromRowWithNulls() {
    Mutation expectedMutation = createMutationNulls(Mutation.Op.UPDATE);
    Mutation mutation = beamRowToMutationFn(Mutation.Op.UPDATE, TABLE).apply(WRITE_ROW_NULLS);
    assertEquals(expectedMutation, mutation);
}
Also used : Mutation(com.google.cloud.spanner.Mutation) Test(org.junit.Test)

Example 65 with Mutation

use of com.google.cloud.spanner.Mutation in project beam by apache.

the class MutationUtilsTest method testCreateDeleteMutationFromRowWithNulls.

@Test
public void testCreateDeleteMutationFromRowWithNulls() {
    Mutation expectedMutation = createDeleteMutationNulls();
    Mutation mutation = beamRowToMutationFn(Mutation.Op.DELETE, TABLE).apply(KEY_ROW_NULLS);
    assertEquals(expectedMutation, mutation);
}
Also used : Mutation(com.google.cloud.spanner.Mutation) Test(org.junit.Test)

Aggregations

Mutation (com.google.cloud.spanner.Mutation)70 Test (org.junit.Test)53 ArrayList (java.util.ArrayList)11 CommitResponse (com.google.cloud.spanner.CommitResponse)4 KeySet (com.google.cloud.spanner.KeySet)4 ReadQueryUpdateTransactionOption (com.google.cloud.spanner.Options.ReadQueryUpdateTransactionOption)4 Timestamp (com.google.cloud.Timestamp)3 DatabaseClient (com.google.cloud.spanner.DatabaseClient)3 ResultSet (com.google.cloud.spanner.ResultSet)3 TransactionContext (com.google.cloud.spanner.TransactionContext)3 BatchableMutationFilterFn (org.apache.beam.sdk.io.gcp.spanner.SpannerIO.BatchableMutationFilterFn)3 Sleeper (org.apache.beam.sdk.util.Sleeper)3 Database (com.google.cloud.spanner.Database)2 DatabaseAdminClient (com.google.cloud.spanner.DatabaseAdminClient)2 Key (com.google.cloud.spanner.Key)2 WriteBuilder (com.google.cloud.spanner.Mutation.WriteBuilder)2 SpannerException (com.google.cloud.spanner.SpannerException)2 TransactionRunner (com.google.cloud.spanner.TransactionRunner)2 CreateDatabaseMetadata (com.google.spanner.admin.database.v1.CreateDatabaseMetadata)2 BigDecimal (java.math.BigDecimal)2