@Override public Set<String> getApplicationTags(SliderFileSystem fileSystem, String appDef) throws SliderException { Set<String> tags; Metainfo metaInfo = getMetainfo(fileSystem, appDef); if (metaInfo == null) { log.error("Error retrieving metainfo from {}", appDef); throw new SliderException("Error parsing metainfo file, possibly bad structure."); } Application application = metaInfo.getApplication(); tags = new HashSet<String>(); tags.add("Name: " + application.getName()); tags.add("Version: " + application.getVersion()); tags.add("Description: " + SliderUtils.truncate(application.getComment(), 80)); return tags; }
@Override public Set<String> getApplicationTags(SliderFileSystem fileSystem, String appDef) throws SliderException { Set<String> tags; Metainfo metaInfo = getMetainfo(fileSystem, appDef); if (metaInfo == null) { log.error("Error retrieving metainfo from {}", appDef); throw new SliderException("Error parsing metainfo file, possibly bad structure."); } Application application = metaInfo.getApplication(); tags = new HashSet<String>(); tags.add("Name: " + application.getName()); tags.add("Version: " + application.getVersion()); tags.add("Description: " + SliderUtils.truncate(application.getComment(), 80)); return tags; }
@Test public void testTruncate() { Assert.assertEquals(SliderUtils.truncate(null, 5), null); Assert.assertEquals(SliderUtils.truncate("323", -1), "323"); Assert.assertEquals(SliderUtils.truncate("3232", 5), "3232"); Assert.assertEquals(SliderUtils.truncate("1234567890", 0), "1234567890"); Assert.assertEquals(SliderUtils.truncate("123456789012345", 15), "123456789012345"); Assert.assertEquals(SliderUtils.truncate("123456789012345", 14), "12345678901..."); Assert.assertEquals(SliderUtils.truncate("1234567890", 1), "1"); Assert.assertEquals(SliderUtils.truncate("1234567890", 10), "1234567890"); Assert.assertEquals(SliderUtils.truncate("", 10), ""); }
@Test public void testTruncate() { Assert.assertEquals(SliderUtils.truncate(null, 5), null); Assert.assertEquals(SliderUtils.truncate("323", -1), "323"); Assert.assertEquals(SliderUtils.truncate("3232", 5), "3232"); Assert.assertEquals(SliderUtils.truncate("1234567890", 0), "1234567890"); Assert.assertEquals(SliderUtils.truncate("123456789012345", 15), "123456789012345"); Assert.assertEquals(SliderUtils.truncate("123456789012345", 14), "12345678901..."); Assert.assertEquals(SliderUtils.truncate("1234567890", 1), "1"); Assert.assertEquals(SliderUtils.truncate("1234567890", 10), "1234567890"); Assert.assertEquals(SliderUtils.truncate("", 10), ""); }