@Test public void testGetLocations() throws Exception { final Set<Location.Name> locations = new SwiftLocationFeature(session).getLocations(); assertTrue(locations.contains(new SwiftLocationFeature.SwiftRegion("DFW"))); assertTrue(locations.contains(new SwiftLocationFeature.SwiftRegion("ORD"))); assertTrue(locations.contains(new SwiftLocationFeature.SwiftRegion("SYD"))); assertEquals(new SwiftLocationFeature.SwiftRegion("DFW"), locations.iterator().next()); }
@Override public Set<Name> getLocations() { final Set<Name> locations = new LinkedHashSet<Name>(); if(StringUtils.isNotBlank(session.getHost().getRegion())) { locations.add(new SwiftRegion(session.getHost().getRegion())); } else { final List<Region> regions = new ArrayList<Region>(session.getClient().getRegions()); regions.sort(new Comparator<Region>() { @Override public int compare(final Region r1, final Region r2) { if(r1.isDefault()) { return -1; } if(r2.isDefault()) { return 1; } return 0; } }); for(Region region : regions) { if(StringUtils.isBlank(region.getRegionId())) { continue; } locations.add(new SwiftRegion(region.getRegionId())); } } return locations; }
SwiftLocationFeature implements Location { @Override public Set<Name> getLocations() { final Set<Name> locations = new LinkedHashSet<Name>(); if(StringUtils.isNotBlank(session.getHost().getRegion())) { locations.add(new SwiftRegion(session.getHost().getRegion())); } else { final List<Region> regions = new ArrayList<Region>(session.getClient().getRegions()); regions.sort(new Comparator<Region>() { @Override public int compare(final Region r1, final Region r2) { if(r1.isDefault()) { return -1; } if(r2.isDefault()) { return 1; } return 0; } }); for(Region region : regions) { if(StringUtils.isBlank(region.getRegionId())) { continue; } locations.add(new SwiftRegion(region.getRegionId())); } } return locations; } }
SwiftLocationFeature implements Location { @Override public Set<Name> getLocations() { final Set<Name> locations = new LinkedHashSet<Name>(); if(StringUtils.isNotBlank(session.getHost().getRegion())) { locations.add(new SwiftRegion(session.getHost().getRegion())); } else { final List<Region> regions = new ArrayList<Region>(session.getClient().getRegions()); regions.sort(new Comparator<Region>() { @Override public int compare(final Region r1, final Region r2) { if(r1.isDefault()) { return -1; } if(r2.isDefault()) { return 1; } return 0; } }); for(Region region : regions) { if(StringUtils.isBlank(region.getRegionId())) { continue; } locations.add(new SwiftRegion(region.getRegionId())); } } return locations; } SwiftLocationFeature(final SwiftSession session); }
SwiftLocationFeature implements Location { @Override public Set<Name> getLocations() { final Set<Name> locations = new LinkedHashSet<Name>(); if(StringUtils.isNotBlank(session.getHost().getRegion())) { locations.add(new SwiftRegion(session.getHost().getRegion())); } else { final List<Region> regions = new ArrayList<Region>(session.getClient().getRegions()); regions.sort(new Comparator<Region>() { @Override public int compare(final Region r1, final Region r2) { if(r1.isDefault()) { return -1; } if(r2.isDefault()) { return 1; } return 0; } }); for(Region region : regions) { if(StringUtils.isBlank(region.getRegionId())) { continue; } locations.add(new SwiftRegion(region.getRegionId())); } } return locations; } SwiftLocationFeature(final SwiftSession session); @Override Set<Name> getLocations(); @Override Name getLocation(final Path file); }
SwiftLocationFeature implements Location { @Override public Set<Name> getLocations() { final Set<Name> locations = new LinkedHashSet<Name>(); if(StringUtils.isNotBlank(session.getHost().getRegion())) { locations.add(new SwiftRegion(session.getHost().getRegion())); } else { final List<Region> regions = new ArrayList<Region>(session.getClient().getRegions()); regions.sort(new Comparator<Region>() { @Override public int compare(final Region r1, final Region r2) { if(r1.isDefault()) { return -1; } if(r2.isDefault()) { return 1; } return 0; } }); for(Region region : regions) { if(StringUtils.isBlank(region.getRegionId())) { continue; } locations.add(new SwiftRegion(region.getRegionId())); } } return locations; } SwiftLocationFeature(final SwiftSession session); @Override Set<Name> getLocations(); @Override Name getLocation(final Path file);  }