Skip to content

Commit 8d365cb

Browse files
committed
override findById for dnsServer
1 parent 1da794f commit 8d365cb

4 files changed

Lines changed: 16 additions & 1 deletion

File tree

api/src/main/java/org/apache/cloudstack/api/command/user/dns/UpdateDnsServerCmd.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ public class UpdateDnsServerCmd extends BaseCmd {
7676
private String publicDomainSuffix;
7777

7878
@Parameter(name = ApiConstants.NAME_SERVERS, type = CommandType.LIST, collectionType = CommandType.STRING,
79-
required = true,
8079
description = "Comma separated list of name servers; used to create NS records for the DNS Zone (for example, ns1.example.com, ns2.example.com)")
8180
private List<String> nameServers;
8281

server/src/main/java/org/apache/cloudstack/dns/dao/DnsServerDao.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
import com.cloud.utils.db.GenericDao;
3030

3131
public interface DnsServerDao extends GenericDao<DnsServerVO, Long> {
32+
33+
DnsServerVO findById(Long dnsServerId);
34+
3235
DnsServer findByUrlAndAccount(String url, long accountId);
3336

3437
List<Long> listDnsServerIdsByAccountId(Long accountId);

server/src/main/java/org/apache/cloudstack/dns/dao/DnsServerDaoImpl.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,13 @@ public DnsServerDaoImpl() {
7474

7575
}
7676

77+
@Override
78+
public DnsServerVO findById(Long dnsServerId) {
79+
DnsServerVO dnsServer = super.findById(dnsServerId);
80+
loadDetails(dnsServer);
81+
return dnsServer;
82+
}
83+
7784
@Override
7885
public DnsServer findByUrlAndAccount(String url, long accountId) {
7986
SearchCriteria<DnsServerVO> sc = AccountUrlSearch.create();

server/src/test/java/org/apache/cloudstack/dns/DnsProviderManagerImplTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@
3838
import java.io.IOException;
3939
import java.util.Arrays;
4040
import java.util.Collections;
41+
import java.util.HashMap;
4142
import java.util.List;
43+
import java.util.Map;
4244

4345
import org.apache.cloudstack.api.command.user.dns.CreateDnsZoneCmd;
4446
import org.apache.cloudstack.api.command.user.dns.DeleteDnsServerCmd;
@@ -158,6 +160,10 @@ public void setUp() throws Exception {
158160
serverVO = Mockito.spy(
159161
new DnsServerVO("test-server", "http://pdns:8081", 8081, DnsProviderType.PowerDNS, null,
160162
"apikey", false, null, Collections.singletonList("ns1.example.com"), ACCOUNT_ID, DOMAIN_ID));
163+
164+
Map<String, String> serverDetails = new HashMap<>();
165+
serverDetails.put("pdsnServerId", "localhost");
166+
serverVO.setDetails(serverDetails);
161167
Mockito.lenient().doReturn(SERVER_ID).when(serverVO).getId();
162168

163169
zoneVO = Mockito.spy(

0 commit comments

Comments
 (0)