@Test public void jsonCorrectlyProduced() throws Exception { ScheduledTime t1 = new ScheduledTime("2013-12-20T20:00:00.000Z"); ScheduledTime t2 = new ScheduledTime("2013-12-20T21:00:00.000Z"); WorkflowID wfID = new WorkflowID("foobar"); SlotState s1 = new SlotState(new SlotID(wfID, t1), SlotState.Status.READY); SlotState s2 = new SlotState(new SlotID(wfID, t2), SlotState.Status.RUNNING, "external-ID", 4); List<SlotState> states = new LinkedList<SlotState>(); states.add(s1); states.add(s2); ObjectMapper mapper = new ObjectMapper(); ObjectNode node = mapper.createObjectNode(); node.put(t1.toString(), s1.toJSONNode()); node.put(t2.toString(), s2.toJSONNode()); Assert.assertEquals(node, new JSONWorkflowServlet().createJSONObject(states)); }
ObjectNode createJSONObject(List<SlotState> slotStates) { ObjectNode node = Util.MAPPER.createObjectNode(); for (SlotState state : slotStates) { node.put(state.getScheduledTime().toString(), state.toJSONNode()); } return node; }
JSONWorkflowServlet extends AbstractJSONServlet { ObjectNode createJSONObject(List<SlotState> slotStates) { ObjectNode node = Util.MAPPER.createObjectNode(); for (SlotState state : slotStates) { node.put(state.getScheduledTime().toString(), state.toJSONNode()); } return node; } }
JSONWorkflowServlet extends AbstractJSONServlet { ObjectNode createJSONObject(List<SlotState> slotStates) { ObjectNode node = Util.MAPPER.createObjectNode(); for (SlotState state : slotStates) { node.put(state.getScheduledTime().toString(), state.toJSONNode()); } return node; }  }
JSONWorkflowServlet extends AbstractJSONServlet { ObjectNode createJSONObject(List<SlotState> slotStates) { ObjectNode node = Util.MAPPER.createObjectNode(); for (SlotState state : slotStates) { node.put(state.getScheduledTime().toString(), state.toJSONNode()); } return node; }   }
JSONWorkflowServlet extends AbstractJSONServlet { ObjectNode createJSONObject(List<SlotState> slotStates) { ObjectNode node = Util.MAPPER.createObjectNode(); for (SlotState state : slotStates) { node.put(state.getScheduledTime().toString(), state.toJSONNode()); } return node; }    }