use of com.sequenceiq.freeipa.client.model.DnsRecord in project cloudbreak by hortonworks.
the class DnsRecordServiceTest method testARecordExists.
@Test
public void testARecordExists() throws FreeIpaClientException {
AddDnsARecordRequest request = new AddDnsARecordRequest();
request.setEnvironmentCrn(ENV_CRN);
request.setHostname("Asdf");
request.setIp("1.1.1.2");
request.setCreateReverse(true);
Stack stack = createStack();
when(stackService.getByEnvironmentCrnAndAccountId(ENV_CRN, ACCOUNT_ID)).thenReturn(stack);
FreeIpa freeIpa = createFreeIpa();
when(freeIpaService.findByStack(stack)).thenReturn(freeIpa);
when(freeIpaClientFactory.getFreeIpaClientForStack(stack)).thenReturn(freeIpaClient);
DnsRecord dnsRecord = new DnsRecord();
dnsRecord.setArecord(List.of(request.getIp()));
dnsRecord.setIdnsname(request.getHostname());
when(freeIpaClient.showDnsRecord(DOMAIN, request.getHostname())).thenReturn(dnsRecord);
underTest.addDnsARecord(ACCOUNT_ID, request);
verify(freeIpaClient, times(0)).addDnsARecord(DOMAIN, request.getHostname(), request.getIp(), request.isCreateReverse());
}
use of com.sequenceiq.freeipa.client.model.DnsRecord in project cloudbreak by hortonworks.
the class DnsRecordServiceTest method testARecordExistsDifferentValue.
@Test
public void testARecordExistsDifferentValue() throws FreeIpaClientException {
AddDnsARecordRequest request = new AddDnsARecordRequest();
request.setEnvironmentCrn(ENV_CRN);
request.setHostname("Asdf");
request.setIp("1.1.1.2");
request.setCreateReverse(true);
Stack stack = createStack();
when(stackService.getByEnvironmentCrnAndAccountId(ENV_CRN, ACCOUNT_ID)).thenReturn(stack);
FreeIpa freeIpa = createFreeIpa();
when(freeIpaService.findByStack(stack)).thenReturn(freeIpa);
when(freeIpaClientFactory.getFreeIpaClientForStack(stack)).thenReturn(freeIpaClient);
DnsRecord dnsRecord = new DnsRecord();
dnsRecord.setArecord(List.of("asdf"));
dnsRecord.setIdnsname(request.getHostname());
when(freeIpaClient.showDnsRecord(DOMAIN, request.getHostname())).thenReturn(dnsRecord);
Assertions.assertThrows(DnsRecordConflictException.class, () -> underTest.addDnsARecord(ACCOUNT_ID, request));
}
use of com.sequenceiq.freeipa.client.model.DnsRecord in project cloudbreak by hortonworks.
the class DnsRecordAddResponse method handleInternal.
@Override
protected DnsRecord handleInternal(List<CloudVmMetaDataStatus> metadatas, String body) {
DnsRecord dnsRecord = new DnsRecord();
dnsRecord.setIdnsname("localhost");
return dnsRecord;
}
use of com.sequenceiq.freeipa.client.model.DnsRecord in project cloudbreak by hortonworks.
the class DnsRecordFindResponse method handleInternal.
@Override
protected Set<DnsRecord> handleInternal(List<CloudVmMetaDataStatus> metadatas, String body) {
DnsRecord dnsRecord = new DnsRecord();
dnsRecord.setIdnsname("admin");
return Set.of(dnsRecord);
}
use of com.sequenceiq.freeipa.client.model.DnsRecord in project cloudbreak by hortonworks.
the class DnsRecordShowResponse method handleInternal.
@Override
protected DnsRecord handleInternal(List<CloudVmMetaDataStatus> metadatas, String body) {
DnsRecord dnsRecord = new DnsRecord();
dnsRecord.setIdnsname("localhost");
return dnsRecord;
}
Aggregations