@Override public Set<StaticIPInfo> apply(HttpResponse response) { String text = returnStringIf200.apply(response); if (text == null || text.trim().equals("")) return ImmutableSet.<StaticIPInfo> of(); return ImmutableSet.copyOf(Iterables.transform(mapConverter.apply(text), mapToProfile)); } }
@Override public Set<ProfileInfo> apply(HttpResponse response) { String text = returnStringIf200.apply(response); if (text == null || text.trim().equals("")) return ImmutableSet.<ProfileInfo> of(); return ImmutableSet.copyOf(Iterables.transform(mapConverter.apply(text), mapToProfile)); } }
@Override public Set<DriveInfo> apply(HttpResponse response) { String text = returnStringIf200.apply(response); if (text == null || text.trim().equals("")) return ImmutableSet.<DriveInfo> of(); return ImmutableSet.copyOf(Iterables.transform(mapConverter.apply(text), mapToDrive)); } }
@Override public Set<ProfileInfo> apply(HttpResponse response) { String text = returnStringIf200.apply(response); if (text == null || text.trim().equals("")) return ImmutableSet.<ProfileInfo> of(); return ImmutableSet.copyOf(Iterables.transform(mapConverter.apply(text), mapToProfile)); } }
@Override public Set<ServerInfo> apply(HttpResponse response) { String text = returnStringIf200.apply(response); if (text == null || text.trim().equals("")) return ImmutableSet.<ServerInfo> of(); return ImmutableSet.copyOf(Iterables.transform(mapConverter.apply(text), mapToServer)); } }
@Override public Set<VLANInfo> apply(HttpResponse response) { String text = returnStringIf200.apply(response); if (text == null || text.trim().equals("")) return ImmutableSet.<VLANInfo> of(); return ImmutableSet.copyOf(Iterables.transform(mapConverter.apply(text), mapToProfile)); } }
@Override public Set<ProfileInfo> apply(HttpResponse response) { String text = returnStringIf200.apply(response); if (text == null || text.trim().equals("")) return ImmutableSet.<ProfileInfo> of(); return ImmutableSet.copyOf(Iterables.transform(mapConverter.apply(text), mapToProfile)); } }
@Override public Set<DriveInfo> apply(HttpResponse response) { String text = returnStringIf200.apply(response); if (text == null || text.trim().equals("")) return ImmutableSet.<DriveInfo> of(); return ImmutableSet.copyOf(Iterables.transform(mapConverter.apply(text), mapToDrive)); } }
@Override public Set<VLANInfo> apply(HttpResponse response) { String text = returnStringIf200.apply(response); if (text == null || text.trim().equals("")) return ImmutableSet.<VLANInfo> of(); return ImmutableSet.copyOf(Iterables.transform(mapConverter.apply(text), mapToProfile)); } }
@Override public Set<VLANInfo> apply(HttpResponse response) { String text = returnStringIf200.apply(response); if (text == null || text.trim().equals("")) return ImmutableSet.<VLANInfo> of(); return ImmutableSet.copyOf(Iterables.transform(mapConverter.apply(text), mapToProfile)); } }
@Override public Set<DriveInfo> apply(HttpResponse response) { String text = returnStringIf200.apply(response); if (text == null || text.trim().equals("")) return ImmutableSet.<DriveInfo> of(); return ImmutableSet.copyOf(Iterables.transform(mapConverter.apply(text), mapToDrive)); } }
@Override public Set<ServerInfo> apply(HttpResponse response) { String text = returnStringIf200.apply(response); if (text == null || text.trim().equals("")) return ImmutableSet.<ServerInfo> of(); return ImmutableSet.copyOf(Iterables.transform(mapConverter.apply(text), mapToServer)); } }
public void testValueEncodesNewlines() { assertEquals(FN.apply("key1 value1\\n\nkey2 value2"), ImmutableList.of(ImmutableMap.of("key1", "value1\n", "key2", "value2"))); }
public void testTwoMaps() { assertEquals( FN.apply("key1 value1\nkey2 value2\n\nkey1 v1\nkey2 v2"), ImmutableList.of(ImmutableMap.of("key1", "value1", "key2", "value2"), ImmutableMap.of("key1", "v1", "key2", "v2"))); assertEquals( FN.apply("key1 value1\nkey2 value2\n\nkey1 v1\nkey2 v2\n\n"), ImmutableList.of(ImmutableMap.of("key1", "value1", "key2", "value2"), ImmutableMap.of("key1", "v1", "key2", "v2"))); } }
public void testNew() throws IOException { Map<String, String> input = new ListOfKeyValuesDelimitedByBlankLinesToListOfMaps().apply( Strings2.toStringAndClose(MapToServerInfoTest.class.getResourceAsStream("/new_server.txt"))).get(0); assertEquals(MAP_TO_DRIVE.apply(input), NEW); } }
public void test() throws IOException { Map<String, String> input = new ListOfKeyValuesDelimitedByBlankLinesToListOfMaps().apply( Strings2.toStringAndClose(MapToVLANInfoTest.class.getResourceAsStream("/vlan.txt"))).get(0); assertEquals(MAP_TO_VLAN.apply(input), ONE); } }
public void testComplete() throws IOException { Map<String, String> input = new ListOfKeyValuesDelimitedByBlankLinesToListOfMaps().apply( Strings2.toStringAndClose(MapToServerInfoTest.class.getResourceAsStream("/servers.txt"))).get(0); assertEquals(MAP_TO_DRIVE.apply(input), ONE); }
public void testComplete() throws IOException { Map<String, String> input = new ListOfKeyValuesDelimitedByBlankLinesToListOfMaps().apply( Strings2.toStringAndClose(MapToDriveInfoTest.class.getResourceAsStream("/drive.txt"))).get(0); assertEquals(MAP_TO_DRIVE.apply(input), ONE); } }
public void test() throws IOException { Map<String, String> input = new ListOfKeyValuesDelimitedByBlankLinesToListOfMaps().apply( Strings2.toStringAndClose(MapToProfileInfoTest.class.getResourceAsStream("/profile.txt"))).get(0); assertEquals(MAP_TO_PROFILE.apply(input), ONE); } }