EtcdMetadataReport extends AbstractMetadataReport { @Override protected List<String> doGetExportedURLs(ServiceMetadataIdentifier metadataIdentifier) { String content = etcdClient.getKVValue(getNodeKey(metadataIdentifier)); if (StringUtils.isEmpty(content)) { return Collections.emptyList(); } return new ArrayList<String>(Arrays.asList(URL.decode(content))); } EtcdMetadataReport(URL url); @Override String getServiceDefinition(MetadataIdentifier metadataIdentifier);  }
@Test public void testDoGetExportedURLs() throws ExecutionException, InterruptedException { String version = "1.0.0"; String group = null; String application = "etc-metadata-report-consumer-test"; String revision = "90980"; String protocol = "xxx"; URL url = generateURL(TEST_SERVICE, version, group, application); ServiceMetadataIdentifier serviceMetadataIdentifier = new ServiceMetadataIdentifier(TEST_SERVICE, version, group, "provider", revision, protocol); etcdMetadataReport.doSaveMetadata(serviceMetadataIdentifier, url); List<String> r = etcdMetadataReport.doGetExportedURLs(serviceMetadataIdentifier); Assertions.assertTrue(r.size() == 1); String fileContent = r.get(0); Assertions.assertNotNull(fileContent); Assertions.assertEquals(fileContent, url.toFullString()); }