@Override public String getDescription() { return getDisplayName(); }
@Override public void toJson(Map jsonMap, Revision revision) { jsonMap.put("scmType", getTypeForDisplay()); jsonMap.put("materialName", getDisplayName()); jsonMap.put("location", getUriForDisplay()); jsonMap.put("folder", getFolder()); jsonMap.put("action", "Modified"); }
@Override public void emailContent(StringBuilder content, Modification modification) { String scmDetails = getTypeForDisplay() + " : " + getDisplayName(); String revisionDetails = format("revision: %s, completed on %s\n%s", modification.getRevision(), modification.getModifiedTime(), Optional.ofNullable(modification.getComment()).orElse("")); content.append(scmDetails).append('\n').append(revisionDetails); }
private void handleCheckoutResult(PluggableSCMMaterial material, Result result) { if (result.isSuccessful()) { if (StringUtils.isNotBlank(result.getMessagesForDisplay())) { consumer.stdOutput(result.getMessagesForDisplay()); } } else { consumer.taggedErrOutput(PREP_ERR, String.format("Material %s checkout failed: %s", material.getDisplayName(), result.getMessagesForDisplay())); throw new RuntimeException(String.format("Material %s checkout failed: %s", material.getDisplayName(), result.getMessagesForDisplay())); } }
@Test public void shouldGetDisplayName() { ConfigurationProperty k1 = ConfigurationPropertyMother.create("k1", false, "v1"); SCM scmConfig = SCMMother.create("scm-id", "scm-name", "pluginid", "version", new Configuration(k1)); PluggableSCMMaterial material = new PluggableSCMMaterial(); material.setSCMConfig(scmConfig); assertThat(material.getDisplayName(), is("scm-name")); }
@Test public void shouldGetUriForDisplayNameIfNameIsNull() { ConfigurationProperty k1 = ConfigurationPropertyMother.create("k1", false, "scm-v1"); ConfigurationProperty k2 = ConfigurationPropertyMother.create("k2", false, "scm-v2"); SCM scmConfig = SCMMother.create("scm-id", null, "pluginid", "version", new Configuration(k1, k2)); PluggableSCMMaterial material = new PluggableSCMMaterial(); material.setSCMConfig(scmConfig); assertThat(material.getDisplayName(), is(material.getUriForDisplay())); }