Esempio n. 1
0
 @Override
 public boolean apply(Instance input) {
   if (emptyString.equals(input.getProductCodes())) input.getProductCodes().clear();
   if (input.getIp() != null && "".equals(input.getIp().trim())) input.setIp(null);
   else if (input.getIp() != null && input.getIp().endsWith(" "))
     input.setIp(input.getIp().trim());
   if (input.getHostname() != null && "".equals(input.getHostname().trim()))
     input.setHostname(null);
   else if (input.getHostname() != null && input.getHostname().endsWith(" "))
     input.setHostname(input.getHostname().trim());
   return true;
 }
 private void assertConsistent(Instance instance, String name) {
   assertNotNull(instance.getId());
   assertEquals(instance.getName(), name);
   assertEquals(instance.getInstanceType(), instanceType.getId());
   assertEquals(instance.getLocation(), location.getId());
   assertEquals(instance.getImageId(), image.getId());
   assertEquals(instance.getSoftware(), SOFTWARE);
   assertEquals(instance.getKeyName(), key.getName());
   assertNotNull(instance.getLaunchTime());
   assertNotNull(instance.getExpirationTime());
   assertEquals(instance.getOwner(), identity);
   assertEquals(instance.getProductCodes(), ImmutableSet.<String>of());
   assertEquals(instance.getRequestName(), name);
   assertNotNull(instance.getRequestId());
 }