@Test public void getRootTest() throws JAXBException { RootRest rootRest = new RootRest(); Response response = rootRest.getRoot(); String timestamp = "" + System.currentTimeMillis(); timestamp = timestamp.substring(0, timestamp.length() - 4); assertEquals(200, response.getStatus()); String providersXML = (String) response.getEntity(); JAXBContext jaxbContext = JAXBContext.newInstance(Root.class); Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); Root root = (Root) jaxbUnmarshaller.unmarshal(new StringReader(providersXML)); assertEquals("/", root.getHref()); assertEquals("0.1-SNAPSHOT", root.getVersion()); assertEquals(timestamp, root.getTimestamp().substring(0, root.getTimestamp().length() - 4)); assertEquals(1, root.getLinks().size()); assertEquals("applications", root.getLinks().get(0).getRel()); assertEquals(MediaType.APPLICATION_XML, root.getLinks().get(0).getType()); assertEquals("/applications", root.getLinks().get(0).getHref()); }
@GET @Produces(MediaType.APPLICATION_XML) public Response getRoot() { logger.info("REQUEST to Path: /"); Root root = new Root(); root.setHref("/"); root.setTimestamp("" + System.currentTimeMillis()); root.setVersion("0.1-SNAPSHOT"); Link link = new Link(); link.setRel("applications"); link.setType(MediaType.APPLICATION_XML); link.setHref("/applications"); root.addLink(link); return buildResponse(Status.OK, ModelConverter.objectRootToXML(root)); }
RootRest extends AbstractRest { @GET @Produces(MediaType.APPLICATION_XML) public Response getRoot() { logger.info("REQUEST to Path: /"); Root root = new Root(); root.setHref("/"); root.setTimestamp("" + System.currentTimeMillis()); root.setVersion("0.1-SNAPSHOT"); Link link = new Link(); link.setRel("applications"); link.setType(MediaType.APPLICATION_XML); link.setHref("/applications"); root.addLink(link); return buildResponse(Status.OK, ModelConverter.objectRootToXML(root)); } }
RootRest extends AbstractRest { @GET @Produces(MediaType.APPLICATION_XML) public Response getRoot() { logger.info("REQUEST to Path: /"); Root root = new Root(); root.setHref("/"); root.setTimestamp("" + System.currentTimeMillis()); root.setVersion("0.1-SNAPSHOT"); Link link = new Link(); link.setRel("applications"); link.setType(MediaType.APPLICATION_XML); link.setHref("/applications"); root.addLink(link); return buildResponse(Status.OK, ModelConverter.objectRootToXML(root)); }  }
RootRest extends AbstractRest { @GET @Produces(MediaType.APPLICATION_XML) public Response getRoot() { logger.info("REQUEST to Path: /"); Root root = new Root(); root.setHref("/"); root.setTimestamp("" + System.currentTimeMillis()); root.setVersion("0.1-SNAPSHOT"); Link link = new Link(); link.setRel("applications"); link.setType(MediaType.APPLICATION_XML); link.setHref("/applications"); root.addLink(link); return buildResponse(Status.OK, ModelConverter.objectRootToXML(root)); }  @GET @Produces(MediaType.APPLICATION_XML) Response getRoot(); }
RootRest extends AbstractRest { @GET @Produces(MediaType.APPLICATION_XML) public Response getRoot() { logger.info("REQUEST to Path: /"); Root root = new Root(); root.setHref("/"); root.setTimestamp("" + System.currentTimeMillis()); root.setVersion("0.1-SNAPSHOT"); Link link = new Link(); link.setRel("applications"); link.setType(MediaType.APPLICATION_XML); link.setHref("/applications"); root.addLink(link); return buildResponse(Status.OK, ModelConverter.objectRootToXML(root)); }  @GET @Produces(MediaType.APPLICATION_XML) Response getRoot();  }