WadlProcessor { public Application process(ResourceDescriptor resourceDescriptor, URI baseURI) { Application wadlApp = wadlGenerator.createApplication(); Resources wadlResources = wadlGenerator.createResources(); if (baseURI != null) { wadlResources.setBase(baseURI.toString()); } org.everrest.core.wadl.research.Resource wadlResource = processResource(resourceDescriptor); wadlResources.getResource().add(wadlResource); wadlApp.setResources(wadlResources); return wadlApp; } WadlProcessor();  WadlProcessor(WadlGenerator wadlGenerator); Application process(ResourceDescriptor resourceDescriptor, URI baseURI);  }
@Test public void testBaseWadlGenerator() throws Exception { ResourceDescriptor ard = new AbstractResourceDescriptor(Resource1.class); WadlProcessor wadlProcessor = new WadlProcessor(); Application app = wadlProcessor.process(ard, new URI("http: JAXBContext jctx = JAXBContext.newInstance(Application.class); ByteArrayOutputStream bout = new ByteArrayOutputStream(); jctx.createMarshaller().marshal(app, bout); System.out.println(new String(bout.toByteArray())); DocumentBuilderFactory f = DocumentBuilderFactory.newInstance(); f.setNamespaceAware(true); Document doc = f.newDocumentBuilder().parse(new ByteArrayInputStream(bout.toByteArray())); XPath xp = XPathFactory.newInstance().newXPath(); xp.setNamespaceContext(new DummyNamespaceContext()); String str = (String)xp.evaluate("count( assertEquals("4", str); str = (String)xp.evaluate("count( assertEquals("1", str); str = (String)xp.evaluate("count( assertEquals("1", str); str = (String)xp.evaluate("count( assertEquals("1", str); str = (String)xp.evaluate("count( assertEquals("1", str); str = (String)xp.evaluate("count( assertEquals("5", str); NodeList nl = (NodeList)xp.evaluate(" assertEquals(1, nl.getLength()); boolean get = false; for (int i = 0; i < nl.getLength(); i++) { String t = nl.item(i).getTextContent(); if (t.equals("GET")) { get = true; } } assertTrue(get); for (int i = 0; i < nl.getLength(); i++) { System.out.println(">>>>> resource method : " + nl.item(i).getTextContent()); } str = (String)xp.evaluate(" assertEquals("POST", str); str = (String)xp.evaluate(" assertEquals("content-type", str); str = (String)xp.evaluate(" assertEquals("DELETE", str); str = (String)xp.evaluate(" assertEquals("PUT", str); nl = (NodeList)xp.evaluate(" assertEquals(1, nl.getLength()); boolean subget = false; for (int i = 0; i < nl.getLength(); i++) { String t = nl.item(i).getTextContent(); if (t.equals("GET")) { subget = true; } } assertTrue(subget); for (int i = 0; i < nl.getLength(); i++) { System.out.println(">>>>> sub-resource method : " + nl.item(i).getTextContent()); } str = (String)xp.evaluate("count( assertEquals("1", str); str = (String)xp.evaluate(" assertEquals("template", str); str = (String)xp.evaluate(" assertEquals("template", str); str = (String)xp.evaluate(" assertEquals("template", str); str = (String)xp.evaluate(" assertEquals("template", str); str = (String)xp.evaluate(" assertEquals("POST", str); nl = (NodeList)xp.evaluate(" assertEquals(2, nl.getLength()); boolean childget = false; boolean childopt = false; for (int i = 0; i < nl.getLength(); i++) { String t = nl.item(i).getTextContent(); if (t.equals("GET")) { childget = true; } if (t.equals("OPTIONS")) { childopt = true; } } assertTrue(childget && childopt); for (int i = 0; i < nl.getLength(); i++) { System.out.println(">>>>> child resource method : " + nl.item(i).getTextContent()); } str = (String)xp.evaluate("count( assertEquals("2", str); str = (String)xp.evaluate(" assertEquals("template", str); str = (String)xp.evaluate(" assertEquals("text/plain", str); }