@Test(expected = UnknownRoadException.class) public void createHiveDestination_UnknownRoad() throws Exception { underTest.createHiveDestination(NAME, hiveDestination); }
@Override public void createHiveDestination(String name, HiveDestination hiveDestination) throws UnknownRoadException, AlreadyExistsException { if (getHiveDestination(name).isPresent()) { throw new AlreadyExistsException(String.format("Hive destination for Road \"%s\" already exists.", name)); } List<PatchOperation> operations = new ArrayList<>(); if (!destinations(name).isPresent()) { operations.add(PatchOperation.add(DESTINATIONS, new HashMap<>())); } operations.add(PatchOperation.add(DESTINATIONS_HIVE, hiveDestination)); PatchSet patchSet = new PatchSet(name, operations); modificationEmitter.emit(patchSet); }
TollBoothHiveDestinationAdminClient implements HiveDestinationAdminClient { @Override public void createHiveDestination(String name, HiveDestination hiveDestination) throws UnknownRoadException, AlreadyExistsException { if (getHiveDestination(name).isPresent()) { throw new AlreadyExistsException(String.format("Hive destination for Road \"%s\" already exists.", name)); } List<PatchOperation> operations = new ArrayList<>(); if (!destinations(name).isPresent()) { operations.add(PatchOperation.add(DESTINATIONS, new HashMap<>())); } operations.add(PatchOperation.add(DESTINATIONS_HIVE, hiveDestination)); PatchSet patchSet = new PatchSet(name, operations); modificationEmitter.emit(patchSet); } }
TollBoothHiveDestinationAdminClient implements HiveDestinationAdminClient { @Override public void createHiveDestination(String name, HiveDestination hiveDestination) throws UnknownRoadException, AlreadyExistsException { if (getHiveDestination(name).isPresent()) { throw new AlreadyExistsException(String.format("Hive destination for Road \"%s\" already exists.", name)); } List<PatchOperation> operations = new ArrayList<>(); if (!destinations(name).isPresent()) { operations.add(PatchOperation.add(DESTINATIONS, new HashMap<>())); } operations.add(PatchOperation.add(DESTINATIONS_HIVE, hiveDestination)); PatchSet patchSet = new PatchSet(name, operations); modificationEmitter.emit(patchSet); } @Autowired  TollBoothHiveDestinationAdminClient(
      @Value("#{store}") Map<String, Road> roads,
      PatchSetEmitter modificationEmitter); }
TollBoothHiveDestinationAdminClient implements HiveDestinationAdminClient { @Override public void createHiveDestination(String name, HiveDestination hiveDestination) throws UnknownRoadException, AlreadyExistsException { if (getHiveDestination(name).isPresent()) { throw new AlreadyExistsException(String.format("Hive destination for Road \"%s\" already exists.", name)); } List<PatchOperation> operations = new ArrayList<>(); if (!destinations(name).isPresent()) { operations.add(PatchOperation.add(DESTINATIONS, new HashMap<>())); } operations.add(PatchOperation.add(DESTINATIONS_HIVE, hiveDestination)); PatchSet patchSet = new PatchSet(name, operations); modificationEmitter.emit(patchSet); } @Autowired  TollBoothHiveDestinationAdminClient(
      @Value("#{store}") Map<String, Road> roads,
      PatchSetEmitter modificationEmitter); @Override Optional<HiveDestination> getHiveDestination(String name); @Override void createHiveDestination(String name, HiveDestination hiveDestination); @Override void deleteHiveDestination(String name); @Override void updateHiveDestination(String name, HiveDestination hiveDestination); }
TollBoothHiveDestinationAdminClient implements HiveDestinationAdminClient { @Override public void createHiveDestination(String name, HiveDestination hiveDestination) throws UnknownRoadException, AlreadyExistsException { if (getHiveDestination(name).isPresent()) { throw new AlreadyExistsException(String.format("Hive destination for Road \"%s\" already exists.", name)); } List<PatchOperation> operations = new ArrayList<>(); if (!destinations(name).isPresent()) { operations.add(PatchOperation.add(DESTINATIONS, new HashMap<>())); } operations.add(PatchOperation.add(DESTINATIONS_HIVE, hiveDestination)); PatchSet patchSet = new PatchSet(name, operations); modificationEmitter.emit(patchSet); } @Autowired  TollBoothHiveDestinationAdminClient(
      @Value("#{store}") Map<String, Road> roads,
      PatchSetEmitter modificationEmitter); @Override Optional<HiveDestination> getHiveDestination(String name); @Override void createHiveDestination(String name, HiveDestination hiveDestination); @Override void deleteHiveDestination(String name); @Override void updateHiveDestination(String name, HiveDestination hiveDestination);  }