@Test public void shouldGenerateMessages() { final Step step = new Step.Builder().putConfiguredProperty("customText", "Log me baby one more time").build(); assertThat(LogStepHandler.createMessage(step)).isEqualTo("Log me baby one more time"); final Step withContext = new Step.Builder().createFrom(step) .putConfiguredProperty("contextLoggingEnabled", "true").build(); assertThat(LogStepHandler.createMessage(withContext)) .isEqualTo("Message Context: [${in.headers}] Log me baby one more time"); final Step withBody = new Step.Builder().createFrom(step).putConfiguredProperty("bodyLoggingEnabled", "true") .build(); assertThat(LogStepHandler.createMessage(withBody)).isEqualTo("Body: [${bean:bodyLogger}] Log me baby one more time"); final Step withContextAndBody = new Step.Builder().createFrom(step) .putConfiguredProperty("contextLoggingEnabled", "true").putConfiguredProperty("bodyLoggingEnabled", "true") .build(); assertThat(LogStepHandler.createMessage(withContextAndBody)) .isEqualTo("Message Context: [${in.headers}] Body: [${bean:bodyLogger}] Log me baby one more time"); }
static String createMessage(Step l) { StringBuilder sb = new StringBuilder(128); String customText = getCustomText(l.getConfiguredProperties()); boolean isContextLoggingEnabled = isContextLoggingEnabled(l.getConfiguredProperties()); boolean isBodyLoggingEnabled = isBodyLoggingEnabled(l.getConfiguredProperties()); if (isContextLoggingEnabled) { sb.append("Message Context: [${in.headers}] "); } if (isBodyLoggingEnabled) { sb.append("Body: [${bean:bodyLogger}] "); } if (customText != null && !customText.isEmpty() && !customText.equals("null")) { sb.append(customText); } return sb.toString(); }
LogStepHandler implements IntegrationStepHandler { static String createMessage(Step l) { StringBuilder sb = new StringBuilder(128); String customText = getCustomText(l.getConfiguredProperties()); boolean isContextLoggingEnabled = isContextLoggingEnabled(l.getConfiguredProperties()); boolean isBodyLoggingEnabled = isBodyLoggingEnabled(l.getConfiguredProperties()); if (isContextLoggingEnabled) { sb.append("Message Context: [${in.headers}] "); } if (isBodyLoggingEnabled) { sb.append("Body: [${bean:bodyLogger}] "); } if (customText != null && !customText.isEmpty() && !customText.equals("null")) { sb.append(customText); } return sb.toString(); } }
LogStepHandler implements IntegrationStepHandler { static String createMessage(Step l) { StringBuilder sb = new StringBuilder(128); String customText = getCustomText(l.getConfiguredProperties()); boolean isContextLoggingEnabled = isContextLoggingEnabled(l.getConfiguredProperties()); boolean isBodyLoggingEnabled = isBodyLoggingEnabled(l.getConfiguredProperties()); if (isContextLoggingEnabled) { sb.append("Message Context: [${in.headers}] "); } if (isBodyLoggingEnabled) { sb.append("Body: [${bean:bodyLogger}] "); } if (customText != null && !customText.isEmpty() && !customText.equals("null")) { sb.append(customText); } return sb.toString(); }  }
LogStepHandler implements IntegrationStepHandler { static String createMessage(Step l) { StringBuilder sb = new StringBuilder(128); String customText = getCustomText(l.getConfiguredProperties()); boolean isContextLoggingEnabled = isContextLoggingEnabled(l.getConfiguredProperties()); boolean isBodyLoggingEnabled = isBodyLoggingEnabled(l.getConfiguredProperties()); if (isContextLoggingEnabled) { sb.append("Message Context: [${in.headers}] "); } if (isBodyLoggingEnabled) { sb.append("Body: [${bean:bodyLogger}] "); } if (customText != null && !customText.isEmpty() && !customText.equals("null")) { sb.append(customText); } return sb.toString(); }  @Override boolean canHandle(Step step); @Override Optional<ProcessorDefinition<?>> handle(Step step, ProcessorDefinition<?> route, IntegrationRouteBuilder builder, String flowIndex, String stepIndex); }
LogStepHandler implements IntegrationStepHandler { static String createMessage(Step l) { StringBuilder sb = new StringBuilder(128); String customText = getCustomText(l.getConfiguredProperties()); boolean isContextLoggingEnabled = isContextLoggingEnabled(l.getConfiguredProperties()); boolean isBodyLoggingEnabled = isBodyLoggingEnabled(l.getConfiguredProperties()); if (isContextLoggingEnabled) { sb.append("Message Context: [${in.headers}] "); } if (isBodyLoggingEnabled) { sb.append("Body: [${bean:bodyLogger}] "); } if (customText != null && !customText.isEmpty() && !customText.equals("null")) { sb.append(customText); } return sb.toString(); }  @Override boolean canHandle(Step step); @Override Optional<ProcessorDefinition<?>> handle(Step step, ProcessorDefinition<?> route, IntegrationRouteBuilder builder, String flowIndex, String stepIndex);  }