use of oasis.names.tc.xacml._3_0.core.schema.wd_17.Policy in project java-resourcemanager by googleapis.
the class ProjectsClientTest method getIamPolicyTest2.
@Test
public void getIamPolicyTest2() throws Exception {
Policy expectedResponse = Policy.newBuilder().setVersion(351608024).addAllBindings(new ArrayList<Binding>()).setEtag(ByteString.EMPTY).build();
mockProjects.addResponse(expectedResponse);
String resource = "resource-341064690";
Policy actualResponse = client.getIamPolicy(resource);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockProjects.getRequests();
Assert.assertEquals(1, actualRequests.size());
GetIamPolicyRequest actualRequest = ((GetIamPolicyRequest) actualRequests.get(0));
Assert.assertEquals(resource, actualRequest.getResource());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of oasis.names.tc.xacml._3_0.core.schema.wd_17.Policy in project java-resourcemanager by googleapis.
the class TagKeysClientTest method setIamPolicyExceptionTest2.
@Test
public void setIamPolicyExceptionTest2() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockTagKeys.addException(exception);
try {
String resource = "resource-341064690";
Policy policy = Policy.newBuilder().build();
client.setIamPolicy(resource, policy);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
use of oasis.names.tc.xacml._3_0.core.schema.wd_17.Policy in project java-resourcemanager by googleapis.
the class FoldersClientTest method setIamPolicyExceptionTest2.
@Test
public void setIamPolicyExceptionTest2() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockFolders.addException(exception);
try {
String resource = "resource-341064690";
Policy policy = Policy.newBuilder().build();
client.setIamPolicy(resource, policy);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
use of oasis.names.tc.xacml._3_0.core.schema.wd_17.Policy in project java-resourcemanager by googleapis.
the class FoldersClientTest method getIamPolicyTest.
@Test
public void getIamPolicyTest() throws Exception {
Policy expectedResponse = Policy.newBuilder().setVersion(351608024).addAllBindings(new ArrayList<Binding>()).setEtag(ByteString.EMPTY).build();
mockFolders.addResponse(expectedResponse);
ResourceName resource = FolderName.of("[FOLDER]");
Policy actualResponse = client.getIamPolicy(resource);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockFolders.getRequests();
Assert.assertEquals(1, actualRequests.size());
GetIamPolicyRequest actualRequest = ((GetIamPolicyRequest) actualRequests.get(0));
Assert.assertEquals(resource.toString(), actualRequest.getResource());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of oasis.names.tc.xacml._3_0.core.schema.wd_17.Policy in project java-resourcemanager by googleapis.
the class TagValuesClientTest method setIamPolicyExceptionTest.
@Test
public void setIamPolicyExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockTagValues.addException(exception);
try {
ResourceName resource = FolderName.of("[FOLDER]");
Policy policy = Policy.newBuilder().build();
client.setIamPolicy(resource, policy);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
Aggregations