@Test public void testRender() throws Exception { ScheduledTime end = new ScheduledTime("2015-09-03T13:17Z"); ScheduledTime start = new ScheduledTime("2015-09-03T13:11Z"); NavigableSet<ScheduledTime> tileTimes = new TreeSet<>(ImmutableSet.of(new ScheduledTime("2015-09-03T13:10Z"), new ScheduledTime("2015-09-03T13:15Z"))); WorkflowID id = new WorkflowID("foo"); List<WorkflowGroup> groups = ImmutableList.of(new WorkflowGroup("All workflows", ImmutableList.of(id))); WorkflowInfo workflowInfo = new WorkflowInfo(new URL("http: SlotState state1 = new SlotState(new SlotID(id, new ScheduledTime("2015-09-03T13:16Z")), SlotState.Status.FAILURE); SlotState state2 = new SlotState(new SlotID(id, new ScheduledTime("2015-09-03T13:12Z")), SlotState.Status.WAITING); List<SlotState> slotStates = ImmutableList.of(state1, state2); Map<WorkflowID, WorkflowStatus> statuses = ImmutableMap.of(id, new WorkflowStatus(workflowInfo, slotStates, false)); UIConfiguration conf = new UIConfiguration(start, end, tileTimes, groups, statuses, new URL("http: StringWebResponse response = new StringWebResponse(UIServlet.render(conf), new URL("http: WebClient webClient = new WebClient(); webClient.setThrowExceptionOnFailingStatusCode(false); HtmlPage page = HTMLParser.parse(response, new TopLevelWindow("top", webClient)); List<HtmlTableDataCell> slotCells = (List<HtmlTableDataCell>) page.getByXPath(" Assert.assertEquals("fail", slotCells.get(0).getTextContent()); Assert.assertEquals("wait", slotCells.get(1).getTextContent()); List<HtmlTableDataCell> hourCells = (List<HtmlTableDataCell>) page.getByXPath(" Assert.assertEquals("1315", hourCells.get(0).getTextContent()); Assert.assertEquals("1310", hourCells.get(1).getTextContent()); List<HtmlTableDataCell> workflowCells = (List<HtmlTableDataCell>) page.getByXPath(" Assert.assertEquals("foo", workflowCells.get(0).getTextContent()); System.out.println(response.getContentAsString()); }
static String render(UIConfiguration conf) throws Exception { return html().with(makeHead(), makeBody(conf)).render(); }
UIServlet extends HttpServlet { static String render(UIConfiguration conf) throws Exception { return html().with(makeHead(), makeBody(conf)).render(); } }
UIServlet extends HttpServlet { static String render(UIConfiguration conf) throws Exception { return html().with(makeHead(), makeBody(conf)).render(); }  }
UIServlet extends HttpServlet { static String render(UIConfiguration conf) throws Exception { return html().with(makeHead(), makeBody(conf)).render(); }   }
UIServlet extends HttpServlet { static String render(UIConfiguration conf) throws Exception { return html().with(makeHead(), makeBody(conf)).render(); }    }