Search in sources :

Example 1 with Write

use of org.apache.beam.sdk.io.gcp.datastore.DatastoreV1.Write in project beam by apache.

the class DatastoreV1Test method testWriteValidationSucceedsWithProject.

@Test
public void testWriteValidationSucceedsWithProject() throws Exception {
    Write write = DatastoreIO.v1().write().withProjectId(PROJECT_ID);
    write.validate(null);
}
Also used : Write(org.apache.beam.sdk.io.gcp.datastore.DatastoreV1.Write) Test(org.junit.Test)

Example 2 with Write

use of org.apache.beam.sdk.io.gcp.datastore.DatastoreV1.Write in project beam by apache.

the class DatastoreV1Test method testWriteValidationFailsWithNoProjectInStaticValueProvider.

@Test
public void testWriteValidationFailsWithNoProjectInStaticValueProvider() throws Exception {
    Write write = DatastoreIO.v1().write().withProjectId(StaticValueProvider.<String>of(null));
    thrown.expect(NullPointerException.class);
    thrown.expectMessage("projectId");
    write.validate(null);
}
Also used : Write(org.apache.beam.sdk.io.gcp.datastore.DatastoreV1.Write) Test(org.junit.Test)

Example 3 with Write

use of org.apache.beam.sdk.io.gcp.datastore.DatastoreV1.Write in project beam by apache.

the class DatastoreV1Test method testWriteValidationFailsWithNoProject.

@Test
public void testWriteValidationFailsWithNoProject() throws Exception {
    Write write = DatastoreIO.v1().write();
    thrown.expect(NullPointerException.class);
    thrown.expectMessage("projectId ValueProvider");
    write.validate(null);
}
Also used : Write(org.apache.beam.sdk.io.gcp.datastore.DatastoreV1.Write) Test(org.junit.Test)

Example 4 with Write

use of org.apache.beam.sdk.io.gcp.datastore.DatastoreV1.Write in project beam by apache.

the class DatastoreV1Test method testWriteDisplayData.

@Test
public void testWriteDisplayData() {
    Write write = DatastoreIO.v1().write().withProjectId(PROJECT_ID);
    DisplayData displayData = DisplayData.from(write);
    assertThat(displayData, hasDisplayItem("projectId", PROJECT_ID));
}
Also used : Write(org.apache.beam.sdk.io.gcp.datastore.DatastoreV1.Write) DisplayData(org.apache.beam.sdk.transforms.display.DisplayData) Test(org.junit.Test)

Example 5 with Write

use of org.apache.beam.sdk.io.gcp.datastore.DatastoreV1.Write in project beam by apache.

the class DatastoreV1Test method testBuildWrite.

/**
   * Test building a Write using builder methods.
   */
@Test
public void testBuildWrite() throws Exception {
    DatastoreV1.Write write = DatastoreIO.v1().write().withProjectId(PROJECT_ID);
    assertEquals(PROJECT_ID, write.getProjectId());
}
Also used : Write(org.apache.beam.sdk.io.gcp.datastore.DatastoreV1.Write) Test(org.junit.Test)

Aggregations

Write (org.apache.beam.sdk.io.gcp.datastore.DatastoreV1.Write)5 Test (org.junit.Test)5 DisplayData (org.apache.beam.sdk.transforms.display.DisplayData)1