test_class.file: everrest-core/src/test/java/org/everrest/core/wadl/WadlProcessorTest.java
test_class.identifier: WadlProcessorTest
test_case.body: @Test
      public void testBaseWadlGenerator() throws Exception {
          ResourceDescriptor ard = new AbstractResourceDescriptor(Resource1.class);
          WadlProcessor wadlProcessor = new WadlProcessor();
          Application app = wadlProcessor.process(ard, new URI("http://localhost:8080/ws/rs"));
  
          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(//wadl:resource)", doc, STRING);
          assertEquals("4", str);
          str = (String)xp.evaluate("count(//wadl:resource[@path='a/{b}'])", doc, STRING);
          assertEquals("1", str);
          str = (String)xp.evaluate("count(//wadl:resource[@path='{c}/{d}'])", doc, STRING);
          assertEquals("1", str);
          str = (String)xp.evaluate("count(//wadl:resource[@path='{c}/{d}/{e}'])", doc, STRING);
          assertEquals("1", str);
          str = (String)xp.evaluate("count(//wadl:resource[@path='sub/{x}'])", doc, STRING);
          assertEquals("1", str);
  
          // discover resource methods
          str = (String)xp.evaluate("count(//wadl:resource[@path='a/{b}']/wadl:method)", doc, STRING);
          assertEquals("5", str);
          NodeList nl = (NodeList)xp.evaluate("//wadl:resource[@path='a/{b}']/wadl:method[@id='m1']/@name", doc, NODESET);
          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("//wadl:resource[@path='a/{b}']/wadl:method[@id='m2']/@name", doc, STRING);
          assertEquals("POST", str);
          str = (String)xp.evaluate("//wadl:resource[@path='a/{b}']/wadl:method[@id='m2']/wadl:request/wadl:param[@style='header']/@name", doc, STRING);
          assertEquals("content-type", str);
          str = (String)xp.evaluate("//wadl:resource[@path='a/{b}']/wadl:method[@id='m3']/@name", doc, STRING);
          assertEquals("DELETE", str);
          str = (String)xp.evaluate("//wadl:resource[@path='a/{b}']/wadl:method[@id='m4']/@name", doc, STRING);
          assertEquals("PUT", str);
  
          // discover sub-resource methods
          nl = (NodeList)xp.evaluate("//wadl:resource[@path='a/{b}']/wadl:resource[@path='{c}/{d}']/wadl:method/@name", doc, NODESET);
          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(//wadl:resource[@path='a/{b}']/wadl:resource[@path='{c}/{d}/{e}']/wadl:method)", doc, STRING);
          assertEquals("1", str);
  
          str = (String)xp.evaluate("//wadl:resource[@path='a/{b}']/wadl:resource[@path='{c}/{d}']/wadl:param[@name='c']/@style", doc, STRING);
          assertEquals("template", str);
          str = (String)xp.evaluate("//wadl:resource[@path='a/{b}']/wadl:resource[@path='{c}/{d}']/wadl:param[@name='b']/@style", doc, STRING);
          assertEquals("template", str);
          str = (String)xp.evaluate("//wadl:resource[@path='a/{b}']/wadl:resource[@path='{c}/{d}/{e}']/wadl:param[@name='c']/@style", doc, STRING);
          assertEquals("template", str);
          str = (String)xp.evaluate("//wadl:resource[@path='a/{b}']/wadl:resource[@path='{c}/{d}/{e}']/wadl:param[@name='e']/@style", doc, STRING);
          assertEquals("template", str);
          str = (String)xp.evaluate("//wadl:resource[@path='a/{b}']/wadl:resource[@path='{c}/{d}/{e}']/wadl:method[@id='m6']/@name", doc, STRING);
          assertEquals("POST", str);
  
          // discover sub-resource locators
          nl = (NodeList)xp.evaluate("//wadl:resource[@path='a/{b}']/wadl:resource[@path='sub/{x}']/wadl:method/@name", doc, NODESET);
          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(//wadl:resource[@path='a/{b}']/wadl:resource[@path='sub/{x}']/wadl:method)", doc, STRING);
          assertEquals("2", str);
          str = (String)xp.evaluate("//wadl:resource[@path='a/{b}']/wadl:resource[@path='sub/{x}']/wadl:param[@name='x']/@style", doc, STRING);
          assertEquals("template", str);
          str = (String)xp.evaluate("//wadl:resource[@path='a/{b}']/wadl:resource[@path='sub/{x}']/wadl:method[@id='m0']/wadl:response/wadl:representation/@mediaType", doc, STRING);
          assertEquals("text/plain", str);
      }
test_case.class_method_signature: WadlProcessorTest.testBaseWadlGenerator()
test_case.full_signature: @Test public void testBaseWadlGenerator()
test_case.identifier: testBaseWadlGenerator
test_case.invocations: process newInstance marshal createMarshaller println toByteArray newInstance setNamespaceAware parse newDocumentBuilder toByteArray newXPath newInstance setNamespaceContext evaluate assertEquals evaluate assertEquals evaluate assertEquals evaluate assertEquals evaluate assertEquals evaluate assertEquals evaluate assertEquals getLength getLength getTextContent item equals assertTrue getLength println getTextContent item evaluate assertEquals evaluate assertEquals evaluate assertEquals evaluate assertEquals evaluate assertEquals getLength getLength getTextContent item equals assertTrue getLength println getTextContent item evaluate assertEquals evaluate assertEquals evaluate assertEquals evaluate assertEquals evaluate assertEquals evaluate assertEquals evaluate assertEquals getLength getLength getTextContent item equals equals assertTrue getLength println getTextContent item evaluate assertEquals evaluate assertEquals evaluate assertEquals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testBaseWadlGenerator()
focal_class.declarator: wadlGenerator
focal_class.modifier: private final
focal_class.original_string: private final WadlGenerator wadlGenerator;
focal_class.type: WadlGenerator
focal_class.var_name: wadlGenerator
focal_class.file: everrest-core/src/main/java/org/everrest/core/wadl/WadlProcessor.java
focal_class.identifier: WadlProcessor
focal_class.class_method_signature: WadlProcessor.WadlProcessor()
focal_class.full_signature: public  WadlProcessor()
focal_class.identifier: WadlProcessor
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  WadlProcessor()
focal_class.class_method_signature: WadlProcessor.WadlProcessor(WadlGenerator wadlGenerator)
focal_class.full_signature: public  WadlProcessor(WadlGenerator wadlGenerator)
focal_class.identifier: WadlProcessor
focal_class.modifiers: public
focal_class.parameters: (WadlGenerator wadlGenerator)
focal_class.signature:  WadlProcessor(WadlGenerator wadlGenerator)
focal_class.class_method_signature: WadlProcessor.process(ResourceDescriptor resourceDescriptor, URI baseURI)
focal_class.full_signature: public Application process(ResourceDescriptor resourceDescriptor, URI baseURI)
focal_class.identifier: process
focal_class.modifiers: public
focal_class.parameters: (ResourceDescriptor resourceDescriptor, URI baseURI)
focal_class.return: Application
focal_class.signature: Application process(ResourceDescriptor resourceDescriptor, URI baseURI)
focal_class.class_method_signature: WadlProcessor.processResource(ResourceDescriptor resourceDescriptor)
focal_class.full_signature: private org.everrest.core.wadl.research.Resource processResource(ResourceDescriptor resourceDescriptor)
focal_class.identifier: processResource
focal_class.modifiers: private
focal_class.parameters: (ResourceDescriptor resourceDescriptor)
focal_class.return: org.everrest.core.wadl.research.Resource
focal_class.signature: org.everrest.core.wadl.research.Resource processResource(ResourceDescriptor resourceDescriptor)
focal_class.class_method_signature: WadlProcessor.processSubResourceMethods(org.everrest.core.wadl.research.Resource wadlResource,
                                             ResourceDescriptor resourceDescriptor)
focal_class.full_signature: private void processSubResourceMethods(org.everrest.core.wadl.research.Resource wadlResource,
                                             ResourceDescriptor resourceDescriptor)
focal_class.identifier: processSubResourceMethods
focal_class.modifiers: private
focal_class.parameters: (org.everrest.core.wadl.research.Resource wadlResource,
                                             ResourceDescriptor resourceDescriptor)
focal_class.return: void
focal_class.signature: void processSubResourceMethods(org.everrest.core.wadl.research.Resource wadlResource,
                                             ResourceDescriptor resourceDescriptor)
focal_class.class_method_signature: WadlProcessor.processSubResourceLocators(org.everrest.core.wadl.research.Resource wadlResource,
                                              ResourceDescriptor resourceDescriptor)
focal_class.full_signature: private void processSubResourceLocators(org.everrest.core.wadl.research.Resource wadlResource,
                                              ResourceDescriptor resourceDescriptor)
focal_class.identifier: processSubResourceLocators
focal_class.modifiers: private
focal_class.parameters: (org.everrest.core.wadl.research.Resource wadlResource,
                                              ResourceDescriptor resourceDescriptor)
focal_class.return: void
focal_class.signature: void processSubResourceLocators(org.everrest.core.wadl.research.Resource wadlResource,
                                              ResourceDescriptor resourceDescriptor)
focal_class.class_method_signature: WadlProcessor.processMethod(ResourceMethodDescriptor rmd,
                                                                   Map<String, Param> wadlResourceParams)
focal_class.full_signature: private org.everrest.core.wadl.research.Method processMethod(ResourceMethodDescriptor rmd,
                                                                   Map<String, Param> wadlResourceParams)
focal_class.identifier: processMethod
focal_class.modifiers: private
focal_class.parameters: (ResourceMethodDescriptor rmd,
                                                                   Map<String, Param> wadlResourceParams)
focal_class.return: org.everrest.core.wadl.research.Method
focal_class.signature: org.everrest.core.wadl.research.Method processMethod(ResourceMethodDescriptor rmd,
                                                                   Map<String, Param> wadlResourceParams)
focal_class.class_method_signature: WadlProcessor.processRequest(ResourceMethodDescriptor rmd,
                                                                     Map<String, Param> wadlResourceParams)
focal_class.full_signature: private org.everrest.core.wadl.research.Request processRequest(ResourceMethodDescriptor rmd,
                                                                     Map<String, Param> wadlResourceParams)
focal_class.identifier: processRequest
focal_class.modifiers: private
focal_class.parameters: (ResourceMethodDescriptor rmd,
                                                                     Map<String, Param> wadlResourceParams)
focal_class.return: org.everrest.core.wadl.research.Request
focal_class.signature: org.everrest.core.wadl.research.Request processRequest(ResourceMethodDescriptor rmd,
                                                                     Map<String, Param> wadlResourceParams)
focal_class.class_method_signature: WadlProcessor.processResponse(ResourceMethodDescriptor rmd)
focal_class.full_signature: private org.everrest.core.wadl.research.Response processResponse(ResourceMethodDescriptor rmd)
focal_class.identifier: processResponse
focal_class.modifiers: private
focal_class.parameters: (ResourceMethodDescriptor rmd)
focal_class.return: org.everrest.core.wadl.research.Response
focal_class.signature: org.everrest.core.wadl.research.Response processResponse(ResourceMethodDescriptor rmd)
focal_class.class_method_signature: WadlProcessor.processParam(Parameter methodParameter)
focal_class.full_signature: private Param processParam(Parameter methodParameter)
focal_class.identifier: processParam
focal_class.modifiers: private
focal_class.parameters: (Parameter methodParameter)
focal_class.return: Param
focal_class.signature: Param processParam(Parameter methodParameter)
focal_method.body: public Application process(ResourceDescriptor resourceDescriptor, URI baseURI) {
          // Root component of WADL representation
          Application wadlApp = wadlGenerator.createApplication();
          // Container for resources
          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;
      }
focal_method.class_method_signature: WadlProcessor.process(ResourceDescriptor resourceDescriptor, URI baseURI)
focal_method.full_signature: public Application process(ResourceDescriptor resourceDescriptor, URI baseURI)
focal_method.identifier: process
focal_method.invocations: createApplication createResources setBase toString processResource add getResource setResources
focal_method.modifiers: public
focal_method.parameters: (ResourceDescriptor resourceDescriptor, URI baseURI)
focal_method.return: Application
focal_method.signature: Application process(ResourceDescriptor resourceDescriptor, URI baseURI)