ExecutionRampDao { public void updateExecutedRampFlows(final String ramp, ExecutableRampExceptionalItems executableRampExceptionalItems) throws ExecutorManagerException { String sqlCommand = ""; try { Object[][] parameters = executableRampExceptionalItems.getCachedItems().stream() .map(item -> { ArrayList<Object> object = new ArrayList<>(); object.add(ramp); object.add(item.getKey()); object.add(item.getValue().getStatus().getKey()); object.add(item.getValue().getTimeStamp()); return object.toArray(); }) .collect(Collectors.toList()).toArray(new Object[0][]); if (parameters.length > 0) { sqlCommand = "INSERT INTO ramp_exceptional_flow_items (rampId, flowId, treatment, timestamp) VALUES(?,?,?,?)"; this.dbOperator.batch(sqlCommand, parameters); executableRampExceptionalItems.resetCacheFlag(); } } catch (final SQLException e) { throw new ExecutorManagerException( String.format("Error on update into ramp, by command [%s]", sqlCommand), e ); } } @Inject  ExecutionRampDao(final DatabaseOperator dbOperator); ExecutableRampMap fetchExecutableRampMap(); ExecutableRampItemsMap fetchExecutableRampItemsMap(); ExecutableRampDependencyMap fetchExecutableRampDependencyMap(); ExecutableRampExceptionalFlowItemsMap fetchExecutableRampExceptionalFlowItemsMap(); ExecutableRampExceptionalJobItemsMap fetchExecutableRampExceptionalJobItemsMap(); void insertAction(final String tableName, Map<String, Object> actionData); void deleteAction(final String tableName, Map<String, Object> constraints); void updateAction(final String tableName, Map<String, Object> actionData, Map<String, Object> constraints); Map<String, String> doRampActions(List<Map<String, Object>> rampActionsMap); void updateExecutableRamp(ExecutableRamp executableRamp); void updateExecutedRampFlows(final String ramp, ExecutableRampExceptionalItems executableRampExceptionalItems);  }
@Test public void testUpdateExecutedRampFlows() throws ExecutorManagerException { long timeStamp = System.currentTimeMillis(); ExecutableRampExceptionalItems items = ExecutableRampExceptionalItems .createInstance() .add("contact-join.cjn-all", ExecutableRampStatus.SELECTED, timeStamp, true) .add("project.flow", ExecutableRampStatus.UNSELECTED, timeStamp, true); this.executionRampDao.updateExecutedRampFlows("dali", items); final ExecutableRampExceptionalFlowItemsMap record = this.executionRampDao.fetchExecutableRampExceptionalFlowItemsMap(); assertThat(record.get("dali").getItems().size()).isEqualTo(2); assertThat(record.get("dali").getItems().get("contact-join.cjn-all").getStatus()) .isEqualByComparingTo(ExecutableRampStatus.SELECTED); assertThat(record.get("dali").getItems().get("contact-join.cjn-all").getTimeStamp()) .isEqualTo(timeStamp); assertThat(record.get("dali").getItems().get("project.flow").getStatus()) .isEqualByComparingTo(ExecutableRampStatus.UNSELECTED); assertThat(record.get("dali").getItems().get("project.flow").getTimeStamp()) .isEqualTo(timeStamp); }