@Test public void testTranslate() throws Exception { when(serviceMessage.getAttributes()).thenReturn(TEST_MAP); final List<BuildMessage1> ret = highlightServiceMessageTranslator.translate(sRunningBuild, buildMessage1, serviceMessage); assertThat(Arrays.asList(buildMessage1).equals(ret), is(true)); verify(dataStoreService).saveData(eq(sRunningBuild), any(HighlightData.class)); }
@NotNull @Override public List<BuildMessage1> translate(@NotNull SRunningBuild sRunningBuild, @NotNull BuildMessage1 buildMessage1, @NotNull ServiceMessage serviceMessage) { final Map<String, String> messageAttributes = serviceMessage.getAttributes(); if (messageAttributes.isEmpty()) { LOG.warning("Could not translate service message with empty attributes."); return Arrays.asList(buildMessage1); } dataStoreServices.get(activeDataStoreName) .saveData(sRunningBuild, new HighlightData(messageAttributes.get("title"), Arrays.asList(messageAttributes.get("text")), valueOfOrDefault(messageAttributes.get("level"), Level.class, Level.info), valueOfOrDefault(messageAttributes.get("block"), Block.class, Block.expanded), valueOfOrDefault(messageAttributes.get("order"), Order.class, Order.none))); return Arrays.asList(buildMessage1); }
HighlightServiceMessageTranslator implements ServiceMessageTranslator { @NotNull @Override public List<BuildMessage1> translate(@NotNull SRunningBuild sRunningBuild, @NotNull BuildMessage1 buildMessage1, @NotNull ServiceMessage serviceMessage) { final Map<String, String> messageAttributes = serviceMessage.getAttributes(); if (messageAttributes.isEmpty()) { LOG.warning("Could not translate service message with empty attributes."); return Arrays.asList(buildMessage1); } dataStoreServices.get(activeDataStoreName) .saveData(sRunningBuild, new HighlightData(messageAttributes.get("title"), Arrays.asList(messageAttributes.get("text")), valueOfOrDefault(messageAttributes.get("level"), Level.class, Level.info), valueOfOrDefault(messageAttributes.get("block"), Block.class, Block.expanded), valueOfOrDefault(messageAttributes.get("order"), Order.class, Order.none))); return Arrays.asList(buildMessage1); } }
HighlightServiceMessageTranslator implements ServiceMessageTranslator { @NotNull @Override public List<BuildMessage1> translate(@NotNull SRunningBuild sRunningBuild, @NotNull BuildMessage1 buildMessage1, @NotNull ServiceMessage serviceMessage) { final Map<String, String> messageAttributes = serviceMessage.getAttributes(); if (messageAttributes.isEmpty()) { LOG.warning("Could not translate service message with empty attributes."); return Arrays.asList(buildMessage1); } dataStoreServices.get(activeDataStoreName) .saveData(sRunningBuild, new HighlightData(messageAttributes.get("title"), Arrays.asList(messageAttributes.get("text")), valueOfOrDefault(messageAttributes.get("level"), Level.class, Level.info), valueOfOrDefault(messageAttributes.get("block"), Block.class, Block.expanded), valueOfOrDefault(messageAttributes.get("order"), Order.class, Order.none))); return Arrays.asList(buildMessage1); }  }
HighlightServiceMessageTranslator implements ServiceMessageTranslator { @NotNull @Override public List<BuildMessage1> translate(@NotNull SRunningBuild sRunningBuild, @NotNull BuildMessage1 buildMessage1, @NotNull ServiceMessage serviceMessage) { final Map<String, String> messageAttributes = serviceMessage.getAttributes(); if (messageAttributes.isEmpty()) { LOG.warning("Could not translate service message with empty attributes."); return Arrays.asList(buildMessage1); } dataStoreServices.get(activeDataStoreName) .saveData(sRunningBuild, new HighlightData(messageAttributes.get("title"), Arrays.asList(messageAttributes.get("text")), valueOfOrDefault(messageAttributes.get("level"), Level.class, Level.info), valueOfOrDefault(messageAttributes.get("block"), Block.class, Block.expanded), valueOfOrDefault(messageAttributes.get("order"), Order.class, Order.none))); return Arrays.asList(buildMessage1); }  @NotNull @Override List<BuildMessage1> translate(@NotNull SRunningBuild sRunningBuild, @NotNull BuildMessage1 buildMessage1,
                                         @NotNull ServiceMessage serviceMessage); @NotNull @Override String getServiceMessageName(); void setMessageName(String messageName); void setActiveDataStoreName(String activeDataStoreName); }
HighlightServiceMessageTranslator implements ServiceMessageTranslator { @NotNull @Override public List<BuildMessage1> translate(@NotNull SRunningBuild sRunningBuild, @NotNull BuildMessage1 buildMessage1, @NotNull ServiceMessage serviceMessage) { final Map<String, String> messageAttributes = serviceMessage.getAttributes(); if (messageAttributes.isEmpty()) { LOG.warning("Could not translate service message with empty attributes."); return Arrays.asList(buildMessage1); } dataStoreServices.get(activeDataStoreName) .saveData(sRunningBuild, new HighlightData(messageAttributes.get("title"), Arrays.asList(messageAttributes.get("text")), valueOfOrDefault(messageAttributes.get("level"), Level.class, Level.info), valueOfOrDefault(messageAttributes.get("block"), Block.class, Block.expanded), valueOfOrDefault(messageAttributes.get("order"), Order.class, Order.none))); return Arrays.asList(buildMessage1); }  @NotNull @Override List<BuildMessage1> translate(@NotNull SRunningBuild sRunningBuild, @NotNull BuildMessage1 buildMessage1,
                                         @NotNull ServiceMessage serviceMessage); @NotNull @Override String getServiceMessageName(); void setMessageName(String messageName); void setActiveDataStoreName(String activeDataStoreName);  }