@Test public void testHandleInsertSensorOffering() throws InternalServiceException { InsertSensorOfferingEvent event = new InsertSensorOfferingEvent(insertSensorOffering); assertCorrectInsertOfferingHandling(event); assertCorrectSensorConfigurationHandling(); }
public void handleInsertSensorOffering(InsertSensorOfferingEvent insertSensorOfferingEvent) throws InternalServiceException { InsertSensorOfferingDocument insertSensorOfferingDocument = insertSensorOfferingEvent.getInsertSensorOffering(); InsertSensorOffering insertSensorOffering = insertSensorOfferingDocument.getInsertSensorOffering(); SensorOfferingType sensorOffering = createFromInsertSensorOffering(insertSensorOffering); SensorConfiguration sensorConfiguration = createSensorConfiguration(insertSensorOffering, sensorOffering); if (isSensorExisting(insertSensorOffering.getSensorInstanceData())) { SensorPlugin sensorPlugin = getSensorForProcedure(sensorOffering.getProcedure()); sensorPlugin.mergeSensorConfigurations(sensorConfiguration); sensorConfigurationRepository.saveOrUpdateSensorConfiguration(sensorConfiguration); } else { checkMandatoryContentForNewSensorOffering(insertSensorOffering); sensorInstances.add(initSensorInstance(sensorConfiguration)); sensorConfigurationRepository.storeNewSensorConfiguration(sensorConfiguration); } }
SensorInstanceProvider implements InsertSensorOfferingListener { public void handleInsertSensorOffering(InsertSensorOfferingEvent insertSensorOfferingEvent) throws InternalServiceException { InsertSensorOfferingDocument insertSensorOfferingDocument = insertSensorOfferingEvent.getInsertSensorOffering(); InsertSensorOffering insertSensorOffering = insertSensorOfferingDocument.getInsertSensorOffering(); SensorOfferingType sensorOffering = createFromInsertSensorOffering(insertSensorOffering); SensorConfiguration sensorConfiguration = createSensorConfiguration(insertSensorOffering, sensorOffering); if (isSensorExisting(insertSensorOffering.getSensorInstanceData())) { SensorPlugin sensorPlugin = getSensorForProcedure(sensorOffering.getProcedure()); sensorPlugin.mergeSensorConfigurations(sensorConfiguration); sensorConfigurationRepository.saveOrUpdateSensorConfiguration(sensorConfiguration); } else { checkMandatoryContentForNewSensorOffering(insertSensorOffering); sensorInstances.add(initSensorInstance(sensorConfiguration)); sensorConfigurationRepository.storeNewSensorConfiguration(sensorConfiguration); } } }
SensorInstanceProvider implements InsertSensorOfferingListener { public void handleInsertSensorOffering(InsertSensorOfferingEvent insertSensorOfferingEvent) throws InternalServiceException { InsertSensorOfferingDocument insertSensorOfferingDocument = insertSensorOfferingEvent.getInsertSensorOffering(); InsertSensorOffering insertSensorOffering = insertSensorOfferingDocument.getInsertSensorOffering(); SensorOfferingType sensorOffering = createFromInsertSensorOffering(insertSensorOffering); SensorConfiguration sensorConfiguration = createSensorConfiguration(insertSensorOffering, sensorOffering); if (isSensorExisting(insertSensorOffering.getSensorInstanceData())) { SensorPlugin sensorPlugin = getSensorForProcedure(sensorOffering.getProcedure()); sensorPlugin.mergeSensorConfigurations(sensorConfiguration); sensorConfigurationRepository.saveOrUpdateSensorConfiguration(sensorConfiguration); } else { checkMandatoryContentForNewSensorOffering(insertSensorOffering); sensorInstances.add(initSensorInstance(sensorConfiguration)); sensorConfigurationRepository.storeNewSensorConfiguration(sensorConfiguration); } }  }
SensorInstanceProvider implements InsertSensorOfferingListener { public void handleInsertSensorOffering(InsertSensorOfferingEvent insertSensorOfferingEvent) throws InternalServiceException { InsertSensorOfferingDocument insertSensorOfferingDocument = insertSensorOfferingEvent.getInsertSensorOffering(); InsertSensorOffering insertSensorOffering = insertSensorOfferingDocument.getInsertSensorOffering(); SensorOfferingType sensorOffering = createFromInsertSensorOffering(insertSensorOffering); SensorConfiguration sensorConfiguration = createSensorConfiguration(insertSensorOffering, sensorOffering); if (isSensorExisting(insertSensorOffering.getSensorInstanceData())) { SensorPlugin sensorPlugin = getSensorForProcedure(sensorOffering.getProcedure()); sensorPlugin.mergeSensorConfigurations(sensorConfiguration); sensorConfigurationRepository.saveOrUpdateSensorConfiguration(sensorConfiguration); } else { checkMandatoryContentForNewSensorOffering(insertSensorOffering); sensorInstances.add(initSensorInstance(sensorConfiguration)); sensorConfigurationRepository.storeNewSensorConfiguration(sensorConfiguration); } }  void init(); Iterable<SensorPlugin> getSensors(); boolean containsTaskWith(String taskId); SensorTask getTaskForTaskId(String taskId); boolean containsSensorWith(String procedure); SensorPlugin getSensorForProcedure(String procedure); SensorPlugin getSensorForTaskId(String taskId); SensorConfigurationRepository getSensorConfigurationRepository(); void setSensorConfigurationRepository(SensorConfigurationRepository sensorConfigurationRepository); SensorTaskRepository getSensorTaskRepository(); void setSensorTaskRepository(SensorTaskRepository sensorTaskRepository); void handleInsertSensorOffering(InsertSensorOfferingEvent insertSensorOfferingEvent); }
SensorInstanceProvider implements InsertSensorOfferingListener { public void handleInsertSensorOffering(InsertSensorOfferingEvent insertSensorOfferingEvent) throws InternalServiceException { InsertSensorOfferingDocument insertSensorOfferingDocument = insertSensorOfferingEvent.getInsertSensorOffering(); InsertSensorOffering insertSensorOffering = insertSensorOfferingDocument.getInsertSensorOffering(); SensorOfferingType sensorOffering = createFromInsertSensorOffering(insertSensorOffering); SensorConfiguration sensorConfiguration = createSensorConfiguration(insertSensorOffering, sensorOffering); if (isSensorExisting(insertSensorOffering.getSensorInstanceData())) { SensorPlugin sensorPlugin = getSensorForProcedure(sensorOffering.getProcedure()); sensorPlugin.mergeSensorConfigurations(sensorConfiguration); sensorConfigurationRepository.saveOrUpdateSensorConfiguration(sensorConfiguration); } else { checkMandatoryContentForNewSensorOffering(insertSensorOffering); sensorInstances.add(initSensorInstance(sensorConfiguration)); sensorConfigurationRepository.storeNewSensorConfiguration(sensorConfiguration); } }  void init(); Iterable<SensorPlugin> getSensors(); boolean containsTaskWith(String taskId); SensorTask getTaskForTaskId(String taskId); boolean containsSensorWith(String procedure); SensorPlugin getSensorForProcedure(String procedure); SensorPlugin getSensorForTaskId(String taskId); SensorConfigurationRepository getSensorConfigurationRepository(); void setSensorConfigurationRepository(SensorConfigurationRepository sensorConfigurationRepository); SensorTaskRepository getSensorTaskRepository(); void setSensorTaskRepository(SensorTaskRepository sensorTaskRepository); void handleInsertSensorOffering(InsertSensorOfferingEvent insertSensorOfferingEvent);  }