@Test public void testEmpty() throws Exception { BaleenJob job = new BaleenJob("name", new YamlPipelineConfiguration(), null, Collections.emptyList()); doReturn(Optional.of(job)).when(manager).get(anyString()); ServletCaller caller = new ServletCaller(); caller.addParameter("name", "name"); caller.doGet(new JobConfigServlet(manager)); assertEquals("", caller.getResponseBody()); }
@Override protected void get(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String name = req.getParameter("name"); if (name == null) { respondWithBadArguments(resp); return; } Optional<BaleenPipeline> pipeline = manager.get(name); if (!pipeline.isPresent()) { respondWithNotFound(resp); } else { respond(resp, MediaType.PLAIN_TEXT_UTF_8, pipeline.get().originalConfig()); } }
JobConfigServlet extends AbstractApiServlet { @Override protected void get(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String name = req.getParameter("name"); if (name == null) { respondWithBadArguments(resp); return; } Optional<BaleenPipeline> pipeline = manager.get(name); if (!pipeline.isPresent()) { respondWithNotFound(resp); } else { respond(resp, MediaType.PLAIN_TEXT_UTF_8, pipeline.get().originalConfig()); } } }
JobConfigServlet extends AbstractApiServlet { @Override protected void get(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String name = req.getParameter("name"); if (name == null) { respondWithBadArguments(resp); return; } Optional<BaleenPipeline> pipeline = manager.get(name); if (!pipeline.isPresent()) { respondWithNotFound(resp); } else { respond(resp, MediaType.PLAIN_TEXT_UTF_8, pipeline.get().originalConfig()); } } JobConfigServlet(BaleenJobManager manager); }
JobConfigServlet extends AbstractApiServlet { @Override protected void get(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String name = req.getParameter("name"); if (name == null) { respondWithBadArguments(resp); return; } Optional<BaleenPipeline> pipeline = manager.get(name); if (!pipeline.isPresent()) { respondWithNotFound(resp); } else { respond(resp, MediaType.PLAIN_TEXT_UTF_8, pipeline.get().originalConfig()); } } JobConfigServlet(BaleenJobManager manager); @Override WebPermission[] getPermissions(); }
JobConfigServlet extends AbstractApiServlet { @Override protected void get(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String name = req.getParameter("name"); if (name == null) { respondWithBadArguments(resp); return; } Optional<BaleenPipeline> pipeline = manager.get(name); if (!pipeline.isPresent()) { respondWithNotFound(resp); } else { respond(resp, MediaType.PLAIN_TEXT_UTF_8, pipeline.get().originalConfig()); } } JobConfigServlet(BaleenJobManager manager); @Override WebPermission[] getPermissions();  }