@Test public void getApiGatewayJsonTranslation() { String jsonTranslation = localesService.getJsonTranslation("api-gateway", "fr", "api-gateway"); verifyZeroInteractions(discoveryUtils); verifyZeroInteractions(modulesService); assertThat(jsonTranslation, notNullValue()); }
public String getJsonTranslation(String module, String lng, String ns) { if (module.equals("api-gateway")) { return LocalFileUtils.getLocalFile(String.join("/","public/locales",lng, ns.concat(".json"))); } if(modulesService.moduleHaveInstance(module)) { try { return Objects.requireNonNull(restTemplate.getForObject(this.buildLocalesEndpointUrl(module, lng, ns), String.class)); } catch (RestClientException e) { LOGGER.warn("[getJsonTranslation] An error occured in module {} : {}", module, e.getMessage()); } } else { LOGGER.warn("Module {} not have instance", module); } return ""; }
LocalesService { public String getJsonTranslation(String module, String lng, String ns) { if (module.equals("api-gateway")) { return LocalFileUtils.getLocalFile(String.join("/","public/locales",lng, ns.concat(".json"))); } if(modulesService.moduleHaveInstance(module)) { try { return Objects.requireNonNull(restTemplate.getForObject(this.buildLocalesEndpointUrl(module, lng, ns), String.class)); } catch (RestClientException e) { LOGGER.warn("[getJsonTranslation] An error occured in module {} : {}", module, e.getMessage()); } } else { LOGGER.warn("Module {} not have instance", module); } return ""; } }
LocalesService { public String getJsonTranslation(String module, String lng, String ns) { if (module.equals("api-gateway")) { return LocalFileUtils.getLocalFile(String.join("/","public/locales",lng, ns.concat(".json"))); } if(modulesService.moduleHaveInstance(module)) { try { return Objects.requireNonNull(restTemplate.getForObject(this.buildLocalesEndpointUrl(module, lng, ns), String.class)); } catch (RestClientException e) { LOGGER.warn("[getJsonTranslation] An error occured in module {} : {}", module, e.getMessage()); } } else { LOGGER.warn("Module {} not have instance", module); } return ""; } LocalesService(RestTemplateBuilder builder, DiscoveryUtils discoveryUtils, ModulesService modulesService); }
LocalesService { public String getJsonTranslation(String module, String lng, String ns) { if (module.equals("api-gateway")) { return LocalFileUtils.getLocalFile(String.join("/","public/locales",lng, ns.concat(".json"))); } if(modulesService.moduleHaveInstance(module)) { try { return Objects.requireNonNull(restTemplate.getForObject(this.buildLocalesEndpointUrl(module, lng, ns), String.class)); } catch (RestClientException e) { LOGGER.warn("[getJsonTranslation] An error occured in module {} : {}", module, e.getMessage()); } } else { LOGGER.warn("Module {} not have instance", module); } return ""; } LocalesService(RestTemplateBuilder builder, DiscoveryUtils discoveryUtils, ModulesService modulesService); String getJsonTranslation(String module, String lng, String ns); }
LocalesService { public String getJsonTranslation(String module, String lng, String ns) { if (module.equals("api-gateway")) { return LocalFileUtils.getLocalFile(String.join("/","public/locales",lng, ns.concat(".json"))); } if(modulesService.moduleHaveInstance(module)) { try { return Objects.requireNonNull(restTemplate.getForObject(this.buildLocalesEndpointUrl(module, lng, ns), String.class)); } catch (RestClientException e) { LOGGER.warn("[getJsonTranslation] An error occured in module {} : {}", module, e.getMessage()); } } else { LOGGER.warn("Module {} not have instance", module); } return ""; } LocalesService(RestTemplateBuilder builder, DiscoveryUtils discoveryUtils, ModulesService modulesService); String getJsonTranslation(String module, String lng, String ns);  }