use of org.apache.tapestry5.Binding in project java-resourcemanager by googleapis.
the class OrganizationsClientTest method getIamPolicyTest2.
@Test
public void getIamPolicyTest2() throws Exception {
Policy expectedResponse = Policy.newBuilder().setVersion(351608024).addAllBindings(new ArrayList<Binding>()).setEtag(ByteString.EMPTY).build();
mockOrganizations.addResponse(expectedResponse);
String resource = "resource-341064690";
Policy actualResponse = client.getIamPolicy(resource);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockOrganizations.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 org.apache.tapestry5.Binding in project java-resourcemanager by googleapis.
the class OrganizationsClientTest method setIamPolicyTest.
@Test
public void setIamPolicyTest() throws Exception {
Policy expectedResponse = Policy.newBuilder().setVersion(351608024).addAllBindings(new ArrayList<Binding>()).setEtag(ByteString.EMPTY).build();
mockOrganizations.addResponse(expectedResponse);
ResourceName resource = FolderName.of("[FOLDER]");
Policy actualResponse = client.setIamPolicy(resource);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockOrganizations.getRequests();
Assert.assertEquals(1, actualRequests.size());
SetIamPolicyRequest actualRequest = ((SetIamPolicyRequest) actualRequests.get(0));
Assert.assertEquals(resource.toString(), actualRequest.getResource());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of org.apache.tapestry5.Binding in project java-resourcemanager by googleapis.
the class OrganizationsClientTest method getIamPolicyTest.
@Test
public void getIamPolicyTest() throws Exception {
Policy expectedResponse = Policy.newBuilder().setVersion(351608024).addAllBindings(new ArrayList<Binding>()).setEtag(ByteString.EMPTY).build();
mockOrganizations.addResponse(expectedResponse);
ResourceName resource = FolderName.of("[FOLDER]");
Policy actualResponse = client.getIamPolicy(resource);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockOrganizations.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 org.apache.tapestry5.Binding in project java-resourcemanager by googleapis.
the class ProjectsClientTest method setIamPolicyTest.
@Test
public void setIamPolicyTest() throws Exception {
Policy expectedResponse = Policy.newBuilder().setVersion(351608024).addAllBindings(new ArrayList<Binding>()).setEtag(ByteString.EMPTY).build();
mockProjects.addResponse(expectedResponse);
ResourceName resource = FolderName.of("[FOLDER]");
Policy policy = Policy.newBuilder().build();
Policy actualResponse = client.setIamPolicy(resource, policy);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockProjects.getRequests();
Assert.assertEquals(1, actualRequests.size());
SetIamPolicyRequest actualRequest = ((SetIamPolicyRequest) actualRequests.get(0));
Assert.assertEquals(resource.toString(), actualRequest.getResource());
Assert.assertEquals(policy, actualRequest.getPolicy());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of org.apache.tapestry5.Binding in project java-resourcemanager by googleapis.
the class ProjectsClientTest method getIamPolicyTest.
@Test
public void getIamPolicyTest() throws Exception {
Policy expectedResponse = Policy.newBuilder().setVersion(351608024).addAllBindings(new ArrayList<Binding>()).setEtag(ByteString.EMPTY).build();
mockProjects.addResponse(expectedResponse);
ResourceName resource = FolderName.of("[FOLDER]");
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.toString(), actualRequest.getResource());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Aggregations