ConfigCommands implements CommandMarker,
		InitializingBean,
		ApplicationListener<ApplicationReadyEvent>,
		ApplicationContextAware { @CliCommand(value = {"dataflow config info"}, help = "Show the Dataflow server being used") public String info() { final Map<String, String> statusValues = new TreeMap<String, String>(); final Target target = targetHolder.getTarget(); statusValues.put("Target", target.getTargetUriAsString()); if (target.isSkipSslValidation()) { statusValues.put("SSL Validation", "skipped"); } if (target.getTargetCredentials() != null) { statusValues.put("Credentials", target.getTargetCredentials().getDisplayableContents()); } statusValues.put("Result", target.getTargetResultMessage() != null ? target.getTargetResultMessage() : ""); final TableModelBuilder<Object> modelBuilder = new TableModelBuilder<>(); for (Map.Entry<String, String> row : statusValues.entrySet()) { modelBuilder.addRow().addValue(row.getKey()).addValue(row.getValue()); } final TableBuilder builder = new TableBuilder(modelBuilder.build()); DataFlowTables.applyStyle(builder); final StringBuilder sb = new StringBuilder(builder.build().render(66)); if (Target.TargetStatus.ERROR.equals(target.getStatus())) { sb.append(HORIZONTAL_LINE); sb.append("An exception occurred during targeting:\n"); final StringWriter stringWriter = new StringWriter(); target.getTargetException().printStackTrace(new PrintWriter(stringWriter)); sb.append(stringWriter.toString()); } return sb.toString(); }  @Autowired void setUserInput(UserInput userInput); @Autowired void setTargetHolder(TargetHolder targetHolder); @Autowired void setDataFlowShell(DataFlowShell shell); @Autowired void setRestTemplate(RestTemplate restTemplate); @Bean RestTemplate restTemplate(Environment ev); void setServerUri(String serverUri); @CliCommand(value = {"dataflow config server"}, help = "Configure the Spring Cloud Data Flow REST server to use") String target(
			@CliOption(mandatory = false, key = {"", "uri"},
					help = "the location of the Spring Cloud Data Flow REST endpoint",
					unspecifiedDefaultValue =  Target.DEFAULT_TARGET) String targetUriString,
			@CliOption(mandatory = false, key = {"username"},
					help = "the username for authenticated access to the Admin REST endpoint",
					unspecifiedDefaultValue = Target.DEFAULT_USERNAME) String targetUsername,
			@CliOption(mandatory = false, key = {"password"},
					help = "the password for authenticated access to the Admin REST endpoint (valid only with a username)",
					specifiedDefaultValue = Target.DEFAULT_SPECIFIED_PASSWORD,
					unspecifiedDefaultValue = Target.DEFAULT_UNSPECIFIED_PASSWORD) String targetPassword,
			@CliOption(mandatory = false, key = {"skip-ssl-validation"},
					help = "accept any SSL certificate (even self-signed)",
					specifiedDefaultValue = Target.DEFAULT_SPECIFIED_SKIP_SSL_VALIDATION,
					unspecifiedDefaultValue = Target.DEFAULT_UNSPECIFIED_SKIP_SSL_VALIDATION) boolean skipSslValidation); @CliCommand(value = {"dataflow config info"}, help = "Show the Dataflow server being used") String info(); @Override void onApplicationEvent(ApplicationReadyEvent event); @Override void afterPropertiesSet(); @Override void setApplicationContext(ApplicationContext applicationContext); static final String HORIZONTAL_LINE; }
@Test public void testInfo() { final String infoResult = configCommands.info(); assertThat(infoResult, containsString("Target│http: assertThat(infoResult, containsString("RestClientException: FooBar")); }