public Map<String, ? extends DriveMetrics> apply(Map<String, String> from) { Builder<String, DriveMetrics> builder = ImmutableMap.builder(); addIDEDevices(from, builder); addSCSIDevices(from, builder); addBlockDevices(from, builder); return builder.build(); }
@Override public ServerInfo apply(HttpResponse response) { Set<ServerInfo> drives = setParser.apply(response); if (drives.size() == 0) return null; return Iterables.get(drives, 0); } }
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(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); } }
@Override public DriveInfo apply(HttpResponse response) { Set<DriveInfo> drives = setParser.apply(response); if (drives.size() == 0) return null; return Iterables.get(drives, 0); } }
@Override public VLANInfo apply(HttpResponse response) { Set<VLANInfo> drives = setParser.apply(response); if (drives.size() == 0) return null; return Iterables.get(drives, 0); } }
public void testRenameKeyWhenFound() { Map<String, String> nothing = ImmutableMap.of("foo", "bar"); assertEquals(DriveDataToMap.renameKey(nothing, "foo", "bar"), ImmutableMap.of("bar", "bar")); }
@Override public StaticIPInfo apply(HttpResponse response) { Set<StaticIPInfo> drives = setParser.apply(response); if (drives.size() == 0) return null; return Iterables.get(drives, 0); } }
@Override public ProfileInfo apply(HttpResponse response) { Set<ProfileInfo> drives = setParser.apply(response); if (drives.size() == 0) return null; return Iterables.get(drives, 0); } }
@Override protected void configure() { bind(new TypeLiteral<Function<Map<String, String>, List<NIC>>>() { }).to(MapToNICs.class); bind(new TypeLiteral<Function<Map<String, String>, Map<String, ? extends Device>>>() { }).to(MapToDevices.class); bind(new TypeLiteral<Function<Map<String, String>, Map<String, ? extends DriveMetrics>>>() { }).to(MapToDriveMetrics.class); bind(new TypeLiteral<Function<Map<String, String>, ServerMetrics>>() { }).to(MapToServerMetrics.class); bind(new TypeLiteral<Function<Device, String>>() { }).to(DeviceToId.class); }
@Override protected void configure() { bind(new TypeLiteral<Function<Map<String, String>, List<NIC>>>() { }).to(MapToNICs.class); bind(new TypeLiteral<Function<Map<String, String>, Map<String, ? extends Device>>>() { }).to(MapToDevices.class); bind(new TypeLiteral<Function<Map<String, String>, Map<String, ? extends DriveMetrics>>>() { }).to(MapToDriveMetrics.class); bind(new TypeLiteral<Function<Map<String, String>, ServerMetrics>>() { }).to(MapToServerMetrics.class); bind(new TypeLiteral<Function<Device, String>>() { }).to(DeviceToId.class); }
public Map<String, ? extends DriveMetrics> apply(Map<String, String> from) { Builder<String, DriveMetrics> builder = ImmutableMap.builder(); addIDEDevices(from, builder); addSCSIDevices(from, builder); addBlockDevices(from, builder); return builder.build(); }
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); }
@Override public DriveInfo apply(HttpResponse response) { Set<DriveInfo> drives = setParser.apply(response); if (drives.size() == 0) return null; return Iterables.get(drives, 0); } }
@Override public StaticIPInfo apply(HttpResponse response) { Set<StaticIPInfo> drives = setParser.apply(response); if (drives.size() == 0) return null; return Iterables.get(drives, 0); } }