@Test public void testGetSensorTaskIds() { List<SensorTask> createdSensorTasks = new ArrayList<SensorTask>(); createdSensorTasks.add(sensorTaskRepository.createNewSensorTask(PROCEDURE_1)); createdSensorTasks.add(sensorTaskRepository.createNewSensorTask(PROCEDURE_1)); createdSensorTasks.add(sensorTaskRepository.createNewSensorTask(PROCEDURE_2)); assertAmountOfCreatedTasksAvailable(sensorTaskRepository, PROCEDURE_1, 2); assertAmountOfCreatedTasksAvailable(sensorTaskRepository, PROCEDURE_2, 1); try { assertCorrectSensorTaskIds(sensorTaskRepository, createdSensorTasks); } catch(InvalidParameterValueException e) { fail("Task repository reported an unknown task id."); } }
public Iterable<String> getSensorTaskIds(String procedure) { List<String> taskIds = new ArrayList<String>(); for (SensorTask sensorTask : sensorTasks.values()) { if (sensorTask.getProcedure().equals(procedure)) { taskIds.add(sensorTask.getTaskId()); } } return taskIds; }
InMemorySensorTaskRepository implements SensorTaskRepository { public Iterable<String> getSensorTaskIds(String procedure) { List<String> taskIds = new ArrayList<String>(); for (SensorTask sensorTask : sensorTasks.values()) { if (sensorTask.getProcedure().equals(procedure)) { taskIds.add(sensorTask.getTaskId()); } } return taskIds; } }
InMemorySensorTaskRepository implements SensorTaskRepository { public Iterable<String> getSensorTaskIds(String procedure) { List<String> taskIds = new ArrayList<String>(); for (SensorTask sensorTask : sensorTasks.values()) { if (sensorTask.getProcedure().equals(procedure)) { taskIds.add(sensorTask.getTaskId()); } } return taskIds; }  }
InMemorySensorTaskRepository implements SensorTaskRepository { public Iterable<String> getSensorTaskIds(String procedure) { List<String> taskIds = new ArrayList<String>(); for (SensorTask sensorTask : sensorTasks.values()) { if (sensorTask.getProcedure().equals(procedure)) { taskIds.add(sensorTask.getTaskId()); } } return taskIds; }  SensorTask createNewSensorTask(String procedure); void saveOrUpdateSensorTask(SensorTask sensorTask); void removeSensorTask(SensorTask sensorTask); boolean containsSensorTask(String procedure, String taskId); SensorTask getTask(String taskId); Iterable<String> getSensorTaskIds(String procedure); Iterable<SensorTask> getSensorTasks(String procedure); SensorTask getSensorTask(String procedure, String taskId); IdWithPrefixGenerator getIdGenerator(); long getTaskAmountOf(String procedure); }
InMemorySensorTaskRepository implements SensorTaskRepository { public Iterable<String> getSensorTaskIds(String procedure) { List<String> taskIds = new ArrayList<String>(); for (SensorTask sensorTask : sensorTasks.values()) { if (sensorTask.getProcedure().equals(procedure)) { taskIds.add(sensorTask.getTaskId()); } } return taskIds; }  SensorTask createNewSensorTask(String procedure); void saveOrUpdateSensorTask(SensorTask sensorTask); void removeSensorTask(SensorTask sensorTask); boolean containsSensorTask(String procedure, String taskId); SensorTask getTask(String taskId); Iterable<String> getSensorTaskIds(String procedure); Iterable<SensorTask> getSensorTasks(String procedure); SensorTask getSensorTask(String procedure, String taskId); IdWithPrefixGenerator getIdGenerator(); long getTaskAmountOf(String procedure);  }