AMImageConfigurationEntryParser { public String getConfigurationString( AMImageConfigurationEntry amImageConfigurationEntry) { StringBundler sb = new StringBundler(14); sb.append(URLCodec.encodeURL(amImageConfigurationEntry.getName())); sb.append(StringPool.COLON); sb.append( URLCodec.encodeURL(amImageConfigurationEntry.getDescription())); sb.append(StringPool.COLON); sb.append(amImageConfigurationEntry.getUUID()); sb.append(StringPool.COLON); Map<String, String> properties = amImageConfigurationEntry.getProperties(); if (properties.get("max-height") != null) { int height = GetterUtil.getInteger(properties.get("max-height")); sb.append("max-height="); sb.append(height); if (properties.get("max-width") != null) { sb.append(StringPool.SEMICOLON); } } if (properties.get("max-width") != null) { int width = GetterUtil.getInteger(properties.get("max-width")); sb.append("max-width="); sb.append(width); } sb.append(StringPool.COLON); sb.append("enabled="); sb.append(String.valueOf(amImageConfigurationEntry.isEnabled())); return sb.toString(); } AMImageConfigurationEntryParser(); protected  AMImageConfigurationEntryParser(Http http); String getConfigurationString(
		AMImageConfigurationEntry amImageConfigurationEntry); AMImageConfigurationEntry parse(String s);  }
@Test public void testGetConfigurationStringWithMaxHeight() { AMImageConfigurationEntry amImageConfigurationEntry = new AMImageConfigurationEntryImpl( "test", "desc", "12345", HashMapBuilder.put( "max-height", "100" ).build(), true); String configurationString = _amImageConfigurationEntryParser.getConfigurationString( amImageConfigurationEntry); Assert.assertEquals( "test:desc:12345:max-height=100:enabled=true", configurationString); }
@Test public void testGetConfigurationStringWithMaxHeightAndMaxWidth() { AMImageConfigurationEntry amImageConfigurationEntry = new AMImageConfigurationEntryImpl( "test", "desc", "12345", HashMapBuilder.put( "max-height", "100" ).put( "max-width", "200" ).build(), true); String configurationString = _amImageConfigurationEntryParser.getConfigurationString( amImageConfigurationEntry); Assert.assertEquals( "test:desc:12345:max-height=100;max-width=200:enabled=true", configurationString); }
@Test public void testGetConfigurationStringWithMaxWidth() { AMImageConfigurationEntry amImageConfigurationEntry = new AMImageConfigurationEntryImpl( "test", "desc", "12345", HashMapBuilder.put( "max-width", "200" ).build(), true); String configurationString = _amImageConfigurationEntryParser.getConfigurationString( amImageConfigurationEntry); Assert.assertEquals( "test:desc:12345:max-width=200:enabled=true", configurationString); }
@Test public void testGetConfigurationStringWithNoProperties() { AMImageConfigurationEntry amImageConfigurationEntry = new AMImageConfigurationEntryImpl( "test", "desc", "12345", Collections.emptyMap(), true); String configurationString = _amImageConfigurationEntryParser.getConfigurationString( amImageConfigurationEntry); Assert.assertEquals( "test:desc:12345::enabled=true", configurationString); }
@Test public void testGetDisabledConfigurationStringWithMaxHeight() { AMImageConfigurationEntry amImageConfigurationEntry = new AMImageConfigurationEntryImpl( "test", "desc", "12345", HashMapBuilder.put( "max-height", "100" ).build(), false); String configurationString = _amImageConfigurationEntryParser.getConfigurationString( amImageConfigurationEntry); Assert.assertEquals( "test:desc:12345:max-height=100:enabled=false", configurationString); }
@Test public void testGetDisabledConfigurationStringWithMaxHeightAndMaxWidth() { AMImageConfigurationEntry amImageConfigurationEntry = new AMImageConfigurationEntryImpl( "test", "desc", "12345", HashMapBuilder.put( "max-height", "100" ).put( "max-width", "200" ).build(), false); String configurationString = _amImageConfigurationEntryParser.getConfigurationString( amImageConfigurationEntry); Assert.assertEquals( "test:desc:12345:max-height=100;max-width=200:enabled=false", configurationString); }
@Test public void testGetDisabledConfigurationStringWithMaxWidth() { AMImageConfigurationEntry amImageConfigurationEntry = new AMImageConfigurationEntryImpl( "test", "desc", "12345", HashMapBuilder.put( "max-width", "200" ).build(), false); String configurationString = _amImageConfigurationEntryParser.getConfigurationString( amImageConfigurationEntry); Assert.assertEquals( "test:desc:12345:max-width=200:enabled=false", configurationString); }