DnsServicesDiscovery extends Configurable implements DnsDiscovery { @Override public Set<String> listServiceTypes(Fqdn browsingDomain, boolean secValidation) throws LookupException, ConfigurationException { try { ValidatorUtil.isValidDomainName(browsingDomain); } catch(IllegalArgumentException exception) { throw new LookupException(StatusCode.ILLEGAL_FQDN, browsingDomain.fqdn()); } validatedConf(); Set<String> result = null; try { result = new TreeSet<>(); result.addAll(this.helper.serviceTypes(browsingDomain, secValidation)); if (result.isEmpty() && !ExceptionsUtil.onlyNameResolutionTrace(this.errorsTrace.get())) { throw ExceptionsUtil.build(StatusCode.RESOURCE_LOOKUP_ERROR, FormattingUtil.unableToResolve(browsingDomain.fqdn()), errorsTrace.get()); } } catch (LookupException | ConfigurationException exception) { throw exception; } finally { errorsTrace.remove(); } return result; } DnsServicesDiscovery();  DnsServicesDiscovery(int cacheSize, int cacheTTL); @Override Set<String> listServiceTypes(Fqdn browsingDomain, boolean secValidation); @Override Set<ServiceInstance> listServiceInstances(Fqdn browsingDomain, CompoundLabel type, boolean secValidation); @Override Set<TextRecord> listTextRecords(Fqdn browsingDomain, String label, boolean secValidation); @Override Set<CertRecord> listTLSARecords(Fqdn browsingDomain, DnsCertPrefix tlsaPrefix,
                                                    boolean secValidation); @Override boolean isDnsSecValid(Fqdn name);  }
@Test public void listServiceTypes() { try { this.discovery = new DnsServicesDiscovery(); this.discovery.dnsSecDomain(Constants.DEFAULT_DNSSEC_DOMAIN) .dnsServer(InetAddress.getByName(DNS_RESOLVER)) .trustAnchorDefault(Constants.DEFAULT_TRUST_ANCHOR) . introspected(true) .observer(this) .checkConfiguration(true); } catch (UnknownHostException ex) { Assert.fail("Expected correct initialization, not " + ex.toString()); } catch (ConfigurationException ex) { Assert.fail("Expected correct configuration, not " + ex.toString()); } Fqdn name = new Fqdn(SERVICE_DOMAIN); try { Set<String> typ = this.discovery.listServiceTypes(name, false); Assert.assertTrue(typ.size() > 0); } catch (LookupException ex) { Assert.fail("Expected correct configuration, not " + ex.toString()); } catch (ConfigurationException ex) { Assert.fail("Expected correct configuration, not " + ex.toString()); } }