override findById for dnsServer

This commit is contained in:
Manoj Kumar 2026-04-29 23:51:25 +05:30
parent 1da794f4d9
commit 8d365cbd71
No known key found for this signature in database
GPG Key ID: E952B7234D2C6F88
4 changed files with 16 additions and 1 deletions

View File

@ -76,7 +76,6 @@ public class UpdateDnsServerCmd extends BaseCmd {
private String publicDomainSuffix;
@Parameter(name = ApiConstants.NAME_SERVERS, type = CommandType.LIST, collectionType = CommandType.STRING,
required = true,
description = "Comma separated list of name servers; used to create NS records for the DNS Zone (for example, ns1.example.com, ns2.example.com)")
private List<String> nameServers;

View File

@ -29,6 +29,9 @@ import com.cloud.utils.db.Filter;
import com.cloud.utils.db.GenericDao;
public interface DnsServerDao extends GenericDao<DnsServerVO, Long> {
DnsServerVO findById(Long dnsServerId);
DnsServer findByUrlAndAccount(String url, long accountId);
List<Long> listDnsServerIdsByAccountId(Long accountId);

View File

@ -74,6 +74,13 @@ public class DnsServerDaoImpl extends GenericDaoBase<DnsServerVO, Long> implemen
}
@Override
public DnsServerVO findById(Long dnsServerId) {
DnsServerVO dnsServer = super.findById(dnsServerId);
loadDetails(dnsServer);
return dnsServer;
}
@Override
public DnsServer findByUrlAndAccount(String url, long accountId) {
SearchCriteria<DnsServerVO> sc = AccountUrlSearch.create();

View File

@ -38,7 +38,9 @@ import static org.mockito.Mockito.when;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.cloudstack.api.command.user.dns.CreateDnsZoneCmd;
import org.apache.cloudstack.api.command.user.dns.DeleteDnsServerCmd;
@ -158,6 +160,10 @@ public class DnsProviderManagerImplTest {
serverVO = Mockito.spy(
new DnsServerVO("test-server", "http://pdns:8081", 8081, DnsProviderType.PowerDNS, null,
"apikey", false, null, Collections.singletonList("ns1.example.com"), ACCOUNT_ID, DOMAIN_ID));
Map<String, String> serverDetails = new HashMap<>();
serverDetails.put("pdsnServerId", "localhost");
serverVO.setDetails(serverDetails);
Mockito.lenient().doReturn(SERVER_ID).when(serverVO).getId();
zoneVO = Mockito.spy(