EtcdMetadataReport extends AbstractMetadataReport { @Override protected void doRemoveMetadata(ServiceMetadataIdentifier serviceMetadataIdentifier) { etcdClient.delete(getNodeKey(serviceMetadataIdentifier)); } EtcdMetadataReport(URL url); @Override String getServiceDefinition(MetadataIdentifier metadataIdentifier);  }
@Test public void testDoRemoveMetadata() 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); CompletableFuture<GetResponse> response = etcdClientForTest.getKVClient().get(ByteSequence.from( etcdMetadataReport.getNodeKey(serviceMetadataIdentifier), StandardCharsets.UTF_8)); String fileContent = response.get().getKvs().get(0).getValue().toString(StandardCharsets.UTF_8); Assertions.assertNotNull(fileContent); etcdMetadataReport.doRemoveMetadata(serviceMetadataIdentifier); response = etcdClientForTest.getKVClient().get(ByteSequence.from( etcdMetadataReport.getNodeKey(serviceMetadataIdentifier), StandardCharsets.UTF_8)); Assertions.assertTrue(response.get().getKvs().isEmpty()); }