Source:
protected void before() { System.out.println("externalAuthoritiesServer>>>>>>>> " + System.getProperty("foo")); originalDataflowServerPort = System.getProperty(DATAFLOW_PORT_PROPERTY); this.dataflowServerPort = SocketUtils.findAvailableTcpPort(); logger.info("Setting Dataflow Server port to " + this.dataflowServerPort); System.setProperty(DATAFLOW_PORT_PROPERTY, String.valueOf(this.dataflowServerPort)); originalConfigLocation = System.getProperty("spring.config.additional-locationn"); if (!StringUtils.isEmpty(configurationLocation)) { final Resource resource = new PathMatchingResourcePatternResolver().getResource(configurationLocation); if (!resource.exists()) { throw new IllegalArgumentException(String.format("Resource 'configurationLocation' ('%s') does not exist.", configurationLocation)); } System.setProperty("spring.config.additional-location", configurationLocation); } app = new SpringApplication(TestConfig.class); configurableApplicationContext = (WebApplicationContext) app.run(new String[] { "--spring.cloud.kubernetes.enabled=false", "--" + FeaturesProperties.FEATURES_PREFIX + "." + FeaturesProperties.STREAMS_ENABLED + "=" + this.streamsEnabled, "--" + FeaturesProperties.FEATURES_PREFIX + "." + FeaturesProperties.TASKS_ENABLED + "=" + this.tasksEnabled, "--" + FeaturesProperties.FEATURES_PREFIX + "." + FeaturesProperties.SCHEDULES_ENABLED + "=" + this.schedulesEnabled, "--spring.cloud.skipper.client.serverUri=http://localhost:" + this.skipperServerPort + "/api" }); skipperClient = configurableApplicationContext.getBean(SkipperClient.class); LauncherRepository launcherRepository = configurableApplicationContext.getBean(LauncherRepository.class); launcherRepository.save(new Launcher("default", "local", new LocalTaskLauncher(new LocalDeployerProperties()))); Collection<Filter> filters = configurableApplicationContext.getBeansOfType(Filter.class).values(); mockMvc = MockMvcBuilders.webAppContextSetup(configurableApplicationContext) .addFilters(filters.toArray(new Filter[filters.size()])).build(); dataflowPort = configurableApplicationContext.getEnvironment().resolvePlaceholders("${server.port}"); }

Target:
protected void before() { originalDataflowServerPort = System.getProperty(DATAFLOW_PORT_PROPERTY); this.dataflowServerPort = SocketUtils.findAvailableTcpPort(); logger.info("Setting Dataflow Server port to " + this.dataflowServerPort); System.setProperty(DATAFLOW_PORT_PROPERTY, String.valueOf(this.dataflowServerPort)); originalConfigLocation = System.getProperty("spring.config.additional-locationn"); if (!StringUtils.isEmpty(configurationLocation)) { final Resource resource = new PathMatchingResourcePatternResolver().getResource(configurationLocation); if (!resource.exists()) { throw new IllegalArgumentException(String.format("Resource 'configurationLocation' ('%s') does not exist.", configurationLocation)); } System.setProperty("spring.config.additional-location", configurationLocation); } app = new SpringApplication(TestConfig.class); configurableApplicationContext = (WebApplicationContext) app.run(new String[] { "--spring.cloud.kubernetes.enabled=false", "--" + FeaturesProperties.FEATURES_PREFIX + "." + FeaturesProperties.STREAMS_ENABLED + "=" + this.streamsEnabled, "--" + FeaturesProperties.FEATURES_PREFIX + "." + FeaturesProperties.TASKS_ENABLED + "=" + this.tasksEnabled, "--" + FeaturesProperties.FEATURES_PREFIX + "." + FeaturesProperties.SCHEDULES_ENABLED + "=" + this.schedulesEnabled, "--spring.cloud.skipper.client.serverUri=http://localhost:" + this.skipperServerPort + "/api" }); skipperClient = configurableApplicationContext.getBean(SkipperClient.class); LauncherRepository launcherRepository = configurableApplicationContext.getBean(LauncherRepository.class); launcherRepository.save(new Launcher("default", "local", new LocalTaskLauncher(new LocalDeployerProperties()))); Collection<Filter> filters = configurableApplicationContext.getBeansOfType(Filter.class).values(); mockMvc = MockMvcBuilders.webAppContextSetup(configurableApplicationContext) .addFilters(filters.toArray(new Filter[filters.size()])).build(); dataflowPort = configurableApplicationContext.getEnvironment().resolvePlaceholders("${server.port}"); }