@Test public void test_read_current_deployment_with_uris() throws Exception { when(environment.getProperty(eq(Config.EnvKey.APPLICATION_DESCRIPTION_ENVIRONMENT_KEY))) .thenReturn(BeanGenerator.getSampleVcapApplication(APP_ID, APPLICATION_NAME, URIS)); DeployedApplicationConfig.Deployment deployment = config.loadCurrentDeployment(); assertThat(deployment, is(notNullValue())); assertThat(deployment.getApplicationId(), is(equalTo(APP_ID.toString()))); assertThat(deployment.getApplicationName(), is(equalTo(APPLICATION_NAME))); assertThat(deployment.getApplicationUris(), is(notNullValue())); assertThat(deployment.getApplicationUris().size(), is(equalTo(URIS.length))); assertThat(deployment.getFirstUri(), is(equalTo(URIS[0]))); }
@Bean public Deployment loadCurrentDeployment() throws IOException { String deployment = environment.getProperty(Config.EnvKey.APPLICATION_DESCRIPTION_ENVIRONMENT_KEY); if (deployment == null) { return null; } else { ObjectMapper objectMapper = new ObjectMapper(); return objectMapper.readValue(deployment, Deployment.class); } }
DeployedApplicationConfig { @Bean public Deployment loadCurrentDeployment() throws IOException { String deployment = environment.getProperty(Config.EnvKey.APPLICATION_DESCRIPTION_ENVIRONMENT_KEY); if (deployment == null) { return null; } else { ObjectMapper objectMapper = new ObjectMapper(); return objectMapper.readValue(deployment, Deployment.class); } } }
DeployedApplicationConfig { @Bean public Deployment loadCurrentDeployment() throws IOException { String deployment = environment.getProperty(Config.EnvKey.APPLICATION_DESCRIPTION_ENVIRONMENT_KEY); if (deployment == null) { return null; } else { ObjectMapper objectMapper = new ObjectMapper(); return objectMapper.readValue(deployment, Deployment.class); } }  }
DeployedApplicationConfig { @Bean public Deployment loadCurrentDeployment() throws IOException { String deployment = environment.getProperty(Config.EnvKey.APPLICATION_DESCRIPTION_ENVIRONMENT_KEY); if (deployment == null) { return null; } else { ObjectMapper objectMapper = new ObjectMapper(); return objectMapper.readValue(deployment, Deployment.class); } }  @Bean Deployment loadCurrentDeployment(); }
DeployedApplicationConfig { @Bean public Deployment loadCurrentDeployment() throws IOException { String deployment = environment.getProperty(Config.EnvKey.APPLICATION_DESCRIPTION_ENVIRONMENT_KEY); if (deployment == null) { return null; } else { ObjectMapper objectMapper = new ObjectMapper(); return objectMapper.readValue(deployment, Deployment.class); } }  @Bean Deployment loadCurrentDeployment();  }