@Test(expected = IllegalArgumentException.class) public void duplicateCreate() { store.createRegion(RID1, "R1", METRO, MASTERS); store.createRegion(RID1, "R2", CAMPUS, MASTERS); }
@Override public Region createRegion(RegionId regionId, String name, Region.Type type, List<Set<NodeId>> masterNodeIds) { return regionsRepo.compute(regionId, (id, region) -> { checkArgument(region == null, DUPLICATE_REGION); return new DefaultRegion(regionId, name, type, masterNodeIds); }).value(); }
DistributedRegionStore extends AbstractStore<RegionEvent, RegionStoreDelegate> implements RegionStore { @Override public Region createRegion(RegionId regionId, String name, Region.Type type, List<Set<NodeId>> masterNodeIds) { return regionsRepo.compute(regionId, (id, region) -> { checkArgument(region == null, DUPLICATE_REGION); return new DefaultRegion(regionId, name, type, masterNodeIds); }).value(); } }
DistributedRegionStore extends AbstractStore<RegionEvent, RegionStoreDelegate> implements RegionStore { @Override public Region createRegion(RegionId regionId, String name, Region.Type type, List<Set<NodeId>> masterNodeIds) { return regionsRepo.compute(regionId, (id, region) -> { checkArgument(region == null, DUPLICATE_REGION); return new DefaultRegion(regionId, name, type, masterNodeIds); }).value(); }  }
DistributedRegionStore extends AbstractStore<RegionEvent, RegionStoreDelegate> implements RegionStore { @Override public Region createRegion(RegionId regionId, String name, Region.Type type, List<Set<NodeId>> masterNodeIds) { return regionsRepo.compute(regionId, (id, region) -> { checkArgument(region == null, DUPLICATE_REGION); return new DefaultRegion(regionId, name, type, masterNodeIds); }).value(); }  @Override Set<Region> getRegions(); @Override Region getRegion(RegionId regionId); @Override Region getRegionForDevice(DeviceId deviceId); @Override Set<DeviceId> getRegionDevices(RegionId regionId); @Override Region createRegion(RegionId regionId, String name, Region.Type type,
                               List<Set<NodeId>> masterNodeIds); @Override Region updateRegion(RegionId regionId, String name, Region.Type type,
                               List<Set<NodeId>> masterNodeIds); @Override void removeRegion(RegionId regionId); @Override void addDevices(RegionId regionId, Collection<DeviceId> deviceIds); @Override void removeDevices(RegionId regionId, Collection<DeviceId> deviceIds); }
DistributedRegionStore extends AbstractStore<RegionEvent, RegionStoreDelegate> implements RegionStore { @Override public Region createRegion(RegionId regionId, String name, Region.Type type, List<Set<NodeId>> masterNodeIds) { return regionsRepo.compute(regionId, (id, region) -> { checkArgument(region == null, DUPLICATE_REGION); return new DefaultRegion(regionId, name, type, masterNodeIds); }).value(); }  @Override Set<Region> getRegions(); @Override Region getRegion(RegionId regionId); @Override Region getRegionForDevice(DeviceId deviceId); @Override Set<DeviceId> getRegionDevices(RegionId regionId); @Override Region createRegion(RegionId regionId, String name, Region.Type type,
                               List<Set<NodeId>> masterNodeIds); @Override Region updateRegion(RegionId regionId, String name, Region.Type type,
                               List<Set<NodeId>> masterNodeIds); @Override void removeRegion(RegionId regionId); @Override void addDevices(RegionId regionId, Collection<DeviceId> deviceIds); @Override void removeDevices(RegionId regionId, Collection<DeviceId> deviceIds);  }