use of com.google.cloud.dns.ProjectInfo in project google-cloud-java by GoogleCloudPlatform.
the class ITDnsTest method testGetProject.
@Test
public void testGetProject() {
// fetches all fields
ProjectInfo project = DNS.getProject();
assertNotNull(project.getQuota());
// options
project = DNS.getProject(Dns.ProjectOption.fields(ProjectField.QUOTA));
assertNotNull(project.getQuota());
project = DNS.getProject(Dns.ProjectOption.fields(ProjectField.PROJECT_ID));
assertNull(project.getQuota());
project = DNS.getProject(Dns.ProjectOption.fields(ProjectField.PROJECT_NUMBER));
assertNull(project.getQuota());
project = DNS.getProject(Dns.ProjectOption.fields(ProjectField.PROJECT_NUMBER, ProjectField.QUOTA, ProjectField.PROJECT_ID));
assertNotNull(project.getQuota());
}
use of com.google.cloud.dns.ProjectInfo in project google-cloud-java by GoogleCloudPlatform.
the class ITDnsTest method testBatchCombined.
@Test
public void testBatchCombined() {
// the results are validated in the other test methods
try {
DNS.create(ZONE1);
DnsBatch batch = DNS.batch();
DnsBatchResult<Zone> zoneResult = batch.getZone(ZONE_NAME1);
DnsBatchResult<ChangeRequest> changeRequestResult = batch.getChangeRequest(ZONE_NAME1, "0");
DnsBatchResult<Page<RecordSet>> pageResult = batch.listRecordSets(ZONE_NAME1);
DnsBatchResult<ProjectInfo> projectResult = batch.getProject();
assertFalse(zoneResult.completed());
try {
zoneResult.get();
fail("this should be submitted first");
} catch (IllegalStateException ex) {
// expected
}
batch.submit();
assertNotNull(zoneResult.get().getCreationTimeMillis());
assertEquals(ZONE1.getDnsName(), zoneResult.get().getDnsName());
assertEquals(ZONE1.getDescription(), zoneResult.get().getDescription());
assertFalse(zoneResult.get().getNameServers().isEmpty());
// we did not set it
assertNull(zoneResult.get().getNameServerSet());
assertNotNull(zoneResult.get().getGeneratedId());
assertNotNull(projectResult.get().getQuota());
assertEquals(2, Iterables.size(pageResult.get().getValues()));
assertNotNull(changeRequestResult.get());
} finally {
DNS.delete(ZONE1.getName());
}
}
use of com.google.cloud.dns.ProjectInfo in project google-cloud-java by GoogleCloudPlatform.
the class ITDnsTest method testGetProjectBatch.
@Test
public void testGetProjectBatch() {
// fetches all fields
DnsBatch batch = DNS.batch();
DnsBatchResult<ProjectInfo> result = batch.getProject();
DnsBatchResult<ProjectInfo> resultQuota = batch.getProject(Dns.ProjectOption.fields(ProjectField.QUOTA));
DnsBatchResult<ProjectInfo> resultId = batch.getProject(Dns.ProjectOption.fields(ProjectField.PROJECT_ID));
DnsBatchResult<ProjectInfo> resultNumber = batch.getProject(Dns.ProjectOption.fields(ProjectField.PROJECT_NUMBER));
DnsBatchResult<ProjectInfo> resultCombination = batch.getProject(Dns.ProjectOption.fields(ProjectField.PROJECT_NUMBER, ProjectField.QUOTA, ProjectField.PROJECT_ID));
batch.submit();
assertNotNull(result.get().getQuota());
assertNotNull(resultQuota.get().getQuota());
assertNull(resultId.get().getQuota());
assertNull(resultNumber.get().getQuota());
assertNotNull(resultCombination.get().getQuota());
}
Aggregations