Search in sources :

Example 1 with View

use of com.google.cloud.bigquery.Acl.View in project google-cloud-java by GoogleCloudPlatform.

the class AclTest method testOf.

@Test
public void testOf() {
    Acl acl = Acl.of(Group.ofAllAuthenticatedUsers(), Role.READER);
    assertEquals(Group.ofAllAuthenticatedUsers(), acl.getEntity());
    assertEquals(Role.READER, acl.getRole());
    Dataset.Access pb = acl.toPb();
    assertEquals(acl, Acl.fromPb(pb));
    View view = new View(TableId.of("project", "dataset", "view"));
    acl = Acl.of(view);
    assertEquals(view, acl.getEntity());
    assertEquals(null, acl.getRole());
}
Also used : Dataset(com.google.api.services.bigquery.model.Dataset) View(com.google.cloud.bigquery.Acl.View) Test(org.junit.Test)

Example 2 with View

use of com.google.cloud.bigquery.Acl.View in project google-cloud-java by GoogleCloudPlatform.

the class AclTest method testViewEntity.

@Test
public void testViewEntity() {
    TableId viewId = TableId.of("project", "dataset", "view");
    View entity = new View(viewId);
    assertEquals(viewId, entity.getId());
    assertEquals(Type.VIEW, entity.getType());
    Dataset.Access pb = entity.toPb();
    assertEquals(entity, Entity.fromPb(pb));
}
Also used : Dataset(com.google.api.services.bigquery.model.Dataset) View(com.google.cloud.bigquery.Acl.View) Test(org.junit.Test)

Aggregations

Dataset (com.google.api.services.bigquery.model.Dataset)2 View (com.google.cloud.bigquery.Acl.View)2 Test (org.junit.Test)2