MachineInDatacenterToNodeMetadata converter = new MachineInDatacenterToNodeMetadata(
JoyentCloudComputeServiceContextModule.toPortableNodeStatus, locationIndex,
Suppliers.<Set<? extends Image>> ofInstance(images),
Suppliers.<Set<? extends Hardware>> ofInstance(hardwares), namingConvention);
NodeMetadata convertedNodeMetadata = converter.apply(machineInDatacenterToConvert);
assertEquals(machineInDatacenterToConvert.slashEncode(), convertedNodeMetadata.getId());
assertEquals(machineToConvert.getId(), convertedNodeMetadata.getProviderId());
assertEquals(convertedNodeMetadata.getLocation().getScope(), LocationScope.ZONE);
assertEquals(convertedNodeMetadata.getLocation().getId(), "us-sw-1");
assertEquals(machineToConvert.getName(), convertedNodeMetadata.getName());
assertEquals(convertedNodeMetadata.getGroup(), "sample");
assertEquals(convertedNodeMetadata.getImageId(), expectedImageId);
assertEquals(convertedNodeMetadata.getOperatingSystem(), expectedOs);
assertEquals(convertedNodeMetadata.getHardware(), expectedHardware);
assertEquals(JoyentCloudComputeServiceContextModule.toPortableNodeStatus.get(machineToConvert.getState()),
convertedNodeMetadata.getStatus());
assertNotNull(convertedNodeMetadata.getPrivateAddresses());
assertEquals(convertedNodeMetadata.getPrivateAddresses(), ImmutableSet.of("10.224.0.63"));
assertNotNull(convertedNodeMetadata.getPublicAddresses());
assertEquals(convertedNodeMetadata.getPublicAddresses(), ImmutableSet.of("37.153.96.62"));
assertNotNull(convertedNodeMetadata.getUserMetadata());
// ensure filtered out root_authorized_keys!
assertEquals(convertedNodeMetadata.getUserMetadata(), ImmutableMap.<String, String> of());
}