@Test public void testGetProviderMetaData() { MetadataIdentifier identifier = buildIdentifier(true); Map<String, String> params = new HashMap<>(); params.put("key1", "value1"); params.put("key2", "true"); FullServiceDefinition definition = ServiceDefinitionBuilder.buildFullDefinition(ServiceA.class, params); String metadata = gson.toJson(definition); consulMetaDataCollector.getClient().setKVValue(identifier.getUniqueKey(MetadataIdentifier.KeyTypeEnum.UNIQUE_KEY), metadata); String providerMetaData = consulMetaDataCollector.getProviderMetaData(identifier); Assert.assertEquals(metadata, providerMetaData); FullServiceDefinition retDef = gson.fromJson(providerMetaData, FullServiceDefinition.class); Assert.assertEquals(ServiceA.class.getCanonicalName(), retDef.getCanonicalName()); Assert.assertEquals(ClassUtils.getCodeSource(ServiceA.class), retDef.getCodeSource()); Assert.assertEquals(params, retDef.getParameters()); Assert.assertNotNull(retDef.getMethods()); Assert.assertEquals(3, retDef.getMethods().size()); List<String> methodNames = retDef.getMethods().stream().map(MethodDefinition::getName).sorted().collect(Collectors.toList()); Assert.assertEquals("method1", methodNames.get(0)); Assert.assertEquals("method2", methodNames.get(1)); Assert.assertEquals("method3", methodNames.get(2)); }
@Override public String getProviderMetaData(MetadataIdentifier key) { return doGetMetaData(key); }
ConsulMetaDataCollector implements MetaDataCollector { @Override public String getProviderMetaData(MetadataIdentifier key) { return doGetMetaData(key); } }
ConsulMetaDataCollector implements MetaDataCollector { @Override public String getProviderMetaData(MetadataIdentifier key) { return doGetMetaData(key); }  }
ConsulMetaDataCollector implements MetaDataCollector { @Override public String getProviderMetaData(MetadataIdentifier key) { return doGetMetaData(key); }  @Override URL getUrl(); @Override void setUrl(URL url); @Override void init(); @Override String getProviderMetaData(MetadataIdentifier key); @Override String getConsumerMetaData(MetadataIdentifier key); }
ConsulMetaDataCollector implements MetaDataCollector { @Override public String getProviderMetaData(MetadataIdentifier key) { return doGetMetaData(key); }  @Override URL getUrl(); @Override void setUrl(URL url); @Override void init(); @Override String getProviderMetaData(MetadataIdentifier key); @Override String getConsumerMetaData(MetadataIdentifier key);  }