@Override public String getDescription() { return getDisplayName(); }
@Override public void toJson(Map jsonMap, Revision revision) { jsonMap.put("scmType", getTypeForDisplay()); jsonMap.put("action", "Modified"); jsonMap.put("location", getUriForDisplay()); jsonMap.put("materialName", getDisplayName()); }
@Override public void emailContent(StringBuilder content, Modification modification) { content.append(getTypeForDisplay() + " : " + getDisplayName()).append('\n').append( format("revision: %s, completed on %s", modification.getRevision(), modification.getModifiedTime())); }
@Test public void shouldGetDisplayName() { PackageMaterial material = new PackageMaterial(); PackageRepository repository = PackageRepositoryMother.create("repo-id", "repo-name", "pluginid", "version", new Configuration(ConfigurationPropertyMother.create("k1", false, "v1"))); material.setPackageDefinition(PackageDefinitionMother.create("p-id", "package-name", new Configuration(ConfigurationPropertyMother.create("k2", false, "v2")), repository)); assertThat(material.getDisplayName(), is("repo-name:package-name")); }
@Test public void shouldGetUriForDisplayNameIfNameIsNull() { PackageMaterial material = new PackageMaterial(); PackageRepository repository = PackageRepositoryMother.create("repo-id", null, "pluginid", "version", new Configuration(ConfigurationPropertyMother.create("k1", false, "repo-v1"), ConfigurationPropertyMother.create("k2", false, "repo-v2"))); material.setPackageDefinition(PackageDefinitionMother.create("p-id", null, new Configuration(ConfigurationPropertyMother.create("k3", false, "package-v1")), repository)); assertThat(material.getDisplayName(), is(material.getUriForDisplay())); }