@Test public void testGetIso3166CodeWhitespaceTrimmer() { Address address = Address.builder().country(" US ").state(" TX ").description("This is spaced out Texas") .build(); Datacenter datacenter = Datacenter.builder().id(1).name("NoWhere").longName("Nowhere").locationAddress(address) .build(); Location location = function.apply(datacenter); assertEquals(location.getId(), datacenter.getName()); Set<String> iso3166Codes = location.getIso3166Codes(); assertEquals(iso3166Codes.size(), 1); assertTrue(iso3166Codes.contains("US-TX")); } }
@Override @Consumes(MediaType.APPLICATION_JSON) public Datacenter expected() { return Datacenter.builder() .id(265592) .longName("Amsterdam 1") .name("ams01") .locationAddress(Address.builder() .address("Paul van Vlissingenstraat 16") .accountId(1) .city("Amsterdam") .contactName("SoftLayer") .country("NL") .description("Amsterdam - AMS01") .id(3322) .isActive(1) .locationId(265592) .postalCode("1096 BK") .build()) .regions(ImmutableSet.of(Region.builder().keyname("AMSTERDAM") .description("AMS01 - Amsterdam - Western Europe") .build())) .build(); } }
public T fromAddress(Address in) { return this .id(in.getId()) .country(in.getCountry()) .state(in.getState()) .description(in.getDescription()) .accountId(in.getAccountId()) .address(in.getAddress1()) .city(in.getCity()) .contactName(in.getContactName()) .isActive(in.isActive()) .locationId(in.getLocationId()) .postalCode(in.getPostalCode()); } }
public T fromAddress(Address in) { return this .id(in.getId()) .country(in.getCountry()) .state(in.getState()) .description(in.getDescription()) .accountId(in.getAccountId()) .address(in.getAddress1()) .city(in.getCity()) .contactName(in.getContactName()) .isActive(in.isActive()) .locationId(in.getLocationId()) .postalCode(in.getPostalCode()); } }
public T fromAddress(Address in) { return this .id(in.getId()) .country(in.getCountry()) .state(in.getState()) .description(in.getDescription()) .accountId(in.getAccountId()) .address(in.getAddress1()) .city(in.getCity()) .contactName(in.getContactName()) .isActive(in.isActive()) .locationId(in.getLocationId()) .postalCode(in.getPostalCode()); } }
public T fromAddress(Address in) { return this .id(in.getId()) .country(in.getCountry()) .state(in.getState()) .description(in.getDescription()) .accountId(in.getAccountId()) .address(in.getAddress1()) .city(in.getCity()) .contactName(in.getContactName()) .isActive(in.isActive()) .locationId(in.getLocationId()) .postalCode(in.getPostalCode()); } }
@Test public void testGetIso3166CodeCountryOnly() { Address address = Address.builder().country("US").description("This is North America!").build(); Datacenter datacenter = Datacenter.builder().id(1).name("Nowhere").longName("No where").locationAddress(address) .build(); Location location = function.apply(datacenter); assertEquals(location.getId(), datacenter.getName()); Set<String> iso3166Codes = location.getIso3166Codes(); assertEquals(iso3166Codes.size(), 1); assertTrue(iso3166Codes.contains("US")); }
@Test public void testDatacenterToLocation() { Address address = Address.builder().country("US").state("TX").description("This is Texas!").build(); Datacenter datacenter = Datacenter.builder().id(1).name("Texas").longName("Texas Datacenter") .locationAddress(address).build(); Location location = function.apply(datacenter); assertEquals(location.getId(), datacenter.getName()); Set<String> iso3166Codes = location.getIso3166Codes(); assertEquals(iso3166Codes.size(), 1); assertTrue(iso3166Codes.contains("US-TX")); }
public T fromAddress(Address in) { return this .id(in.getId()) .country(in.getCountry()) .state(in.getState()) .description(in.getDescription()); } }
@Test public void testGetIso3166CodeCountryOnly() { Address address = Address.builder().country("US").description("This is North America!").build(); Datacenter datacenter = Datacenter.builder().id(1).longName("Nowhere").locationAddress(address).build(); Location location = function.apply(datacenter); assertEquals(location.getId(), Long.toString(datacenter.getId())); Set<String> iso3166Codes = location.getIso3166Codes(); assertEquals(iso3166Codes.size(), 1); assertTrue(iso3166Codes.contains("US")); }
public T fromAddress(Address in) { return this .id(in.getId()) .country(in.getCountry()) .state(in.getState()) .description(in.getDescription()); } }
@Test public void testGetIso3166CodeWhitespaceTrimmer() { Address address = Address.builder().country(" US ").state(" TX ").description("This is spaced out Texas") .build(); Datacenter datacenter = Datacenter.builder().id(1).longName("Nowhere").locationAddress(address).build(); Location location = function.apply(datacenter); assertEquals(location.getId(), Long.toString(datacenter.getId())); Set<String> iso3166Codes = location.getIso3166Codes(); assertEquals(iso3166Codes.size(), 1); assertTrue(iso3166Codes.contains("US-TX")); } }
@Test public void testDatacenterToLocation() { Address address = Address.builder().country("US").state("TX").description("This is Texas!").build(); Datacenter datacenter = Datacenter.builder().id(1).longName("Texas Datacenter").locationAddress(address).build(); Location location = function.apply(datacenter); assertEquals(location.getId(), Long.toString(datacenter.getId())); Set<String> iso3166Codes = location.getIso3166Codes(); assertEquals(iso3166Codes.size(), 1); assertTrue(iso3166Codes.contains("US-TX")); }