@Test public void assertLoadWithConfig() { when(regCenter.get("/config/app/test_app")).thenReturn(CloudAppJsonConstants.getAppJson("test_app")); Optional<CloudAppConfigurationPOJO> actual = configService.load("test_app"); assertTrue(actual.isPresent()); assertThat(actual.get().getAppName(), is("test_app")); }
public Optional<CloudAppConfigurationPOJO> load(final String appName) { String configContent = regCenter.get(CloudAppConfigurationNode.getRootNodePath(appName)); return Strings.isNullOrEmpty(configContent) ? Optional.empty() : Optional.of(YamlEngine.unmarshal(configContent, CloudAppConfigurationPOJO.class)); }
CloudAppConfigurationService { public Optional<CloudAppConfigurationPOJO> load(final String appName) { String configContent = regCenter.get(CloudAppConfigurationNode.getRootNodePath(appName)); return Strings.isNullOrEmpty(configContent) ? Optional.empty() : Optional.of(YamlEngine.unmarshal(configContent, CloudAppConfigurationPOJO.class)); } }
CloudAppConfigurationService { public Optional<CloudAppConfigurationPOJO> load(final String appName) { String configContent = regCenter.get(CloudAppConfigurationNode.getRootNodePath(appName)); return Strings.isNullOrEmpty(configContent) ? Optional.empty() : Optional.of(YamlEngine.unmarshal(configContent, CloudAppConfigurationPOJO.class)); }  }
CloudAppConfigurationService { public Optional<CloudAppConfigurationPOJO> load(final String appName) { String configContent = regCenter.get(CloudAppConfigurationNode.getRootNodePath(appName)); return Strings.isNullOrEmpty(configContent) ? Optional.empty() : Optional.of(YamlEngine.unmarshal(configContent, CloudAppConfigurationPOJO.class)); }  void add(final CloudAppConfigurationPOJO appConfig); void update(final CloudAppConfigurationPOJO appConfig); Optional<CloudAppConfigurationPOJO> load(final String appName); Collection<CloudAppConfigurationPOJO> loadAll(); void remove(final String appName); }
CloudAppConfigurationService { public Optional<CloudAppConfigurationPOJO> load(final String appName) { String configContent = regCenter.get(CloudAppConfigurationNode.getRootNodePath(appName)); return Strings.isNullOrEmpty(configContent) ? Optional.empty() : Optional.of(YamlEngine.unmarshal(configContent, CloudAppConfigurationPOJO.class)); }  void add(final CloudAppConfigurationPOJO appConfig); void update(final CloudAppConfigurationPOJO appConfig); Optional<CloudAppConfigurationPOJO> load(final String appName); Collection<CloudAppConfigurationPOJO> loadAll(); void remove(final String appName);  }