Package org.codehaus.enunciate.apt

Examples of org.codehaus.enunciate.apt.EnunciateFreemarkerModel


  /**
   * tests that a web fault without both construtors doesn't have an explicit bean.
   */
  public void testAlmostExplicitWebFault2() throws Exception {
    FreemarkerModel.set(new EnunciateFreemarkerModel());
    try {
      new WebFault((ClassDeclaration) getDeclaration("org.codehaus.enunciate.samples.services.AlmostExplicitFaultBeanTwo"));
      fail("A web fault without both constructors shouldn't have an explicit fault bean.");
    }
    catch (ValidationException e) {
View Full Code Here


  /**
   * tests that a web fault with one of the constructors public doesn't have an explicit fault bean.
   */
  public void testAlmostExplicitWebFault3() throws Exception {
    FreemarkerModel.set(new EnunciateFreemarkerModel());
    try {
      new WebFault((ClassDeclaration) getDeclaration("org.codehaus.enunciate.samples.services.AlmostExplicitFaultBeanThree"));
      fail("A web fault without both PUBLIC constructors shouldn't have an explicit fault bean.");
    }
    catch (ValidationException e) {
View Full Code Here

*/
public class TestElement extends InAPTTestCase {

  @Override
  protected void setUp() throws Exception {
    FreemarkerModel.set(new EnunciateFreemarkerModel());
  }
View Full Code Here

  /**
   * Tests the names and properties of a web param.
   */
  public void testNamesAndProperties() throws Exception {
    EnunciateFreemarkerModel model = new EnunciateFreemarkerModel();
    model.add(new ComplexTypeDefinition((ClassDeclaration) getDeclaration("org.codehaus.enunciate.samples.schema.BeanOne")));
    model.add(new ComplexTypeDefinition((ClassDeclaration) getDeclaration("org.codehaus.enunciate.samples.schema.BeanTwo")));
    model.add(new ComplexTypeDefinition((ClassDeclaration) getDeclaration("org.codehaus.enunciate.samples.schema.BeanThree")));
    FreemarkerModel.set(model);
    EndpointInterface ei = new EndpointInterface(getDeclaration("org.codehaus.enunciate.samples.services.WebMethodExamples"));

    WebMethod docLitBareMethod = null;
    WebMethod docLitWrappedMethod = null;
View Full Code Here

{
    @Override
    protected void setUp() throws Exception
    {
        super.setUp();
        final EnunciateFreemarkerModel model = new EnunciateFreemarkerModel();
        FreemarkerModel.set(model);
    }
View Full Code Here

    @Override
    protected void setUp() throws Exception
    {
        super.setUp();
        final EnunciateFreemarkerModel model = new EnunciateFreemarkerModel();
        FreemarkerModel.set(model);
        enumTypeDefinition = new JsonEnumTypeDefinition((EnumDeclaration) getDeclaration("org.codehaus.enunciate.samples.json.PersonType"));
    }
View Full Code Here

{
    @Override
    protected void setUp() throws Exception
    {
        super.setUp();
        final EnunciateFreemarkerModel model = new EnunciateFreemarkerModel();
        FreemarkerModel.set(model);
    }
View Full Code Here

* @see <a href="http://jira.codehaus.org/browse/ENUNCIATE-668">ENUNCIATE-668</a>
*/
public class TestEnunciate668 extends InAPTTestCase {

  public void testStaticInnerBaseTypeQName() throws Exception {
    EnunciateFreemarkerModel model = new EnunciateFreemarkerModel();
    FreemarkerModel.set(model);

    ComplexTypeDefinition container = new ComplexTypeDefinition((ClassDeclaration) getDeclaration("org.codehaus.enunciate.samples.schema.ClassForEnunciateIssue668"));
    Collection<TypeDeclaration> nestedTypes = container.getNestedTypes();
    assertEquals(2, nestedTypes.size());
View Full Code Here

{
    @Override
    protected void setUp() throws Exception
    {
        super.setUp();
        final EnunciateFreemarkerModel model = new EnunciateFreemarkerModel();
        FreemarkerModel.set(model);
    }
View Full Code Here

    return freemarkerProcessingTemplateURL;
  }

  @Override
  public void doFreemarkerGenerate() throws IOException, TemplateException {
    EnunciateFreemarkerModel model = getModel();

    File artifactDir = new File(getGenerateDir(), getDir());
    model.setFileOutputDirectory(artifactDir);
    boolean upToDate = isUpToDate(artifactDir);
    if (!upToDate) {
      Map<String, Map<String, List<ResourceMethod>>> facetsToResourceMethods = new TreeMap<String, Map<String, List<ResourceMethod>>>();
      Map<String, String> facetsToDocs = new TreeMap<String, String>();
      for (RootResource rootResource : getModelInternal().getRootResources()) {
        for (ResourceMethod resourceMethod : rootResource.getResourceMethods(true)) {
          if (FacetFilter.accept(resourceMethod)) {
            Set<Facet> facets = resourceMethod.getFacets();
            if (facets != null) {
              for (Facet facet : facets) {
                if (facet.getName().equals(getGroupRestResources())) {
                  Map<String, List<ResourceMethod>> group = facetsToResourceMethods.get(facet.getValue());
                  if (group == null) {
                    group = new TreeMap<String, List<ResourceMethod>>();
                    facetsToResourceMethods.put(facet.getValue(), group);
                  }
                  String subcontext = (String) resourceMethod.getMetaData().get("defaultSubcontext");
                  if (subcontext == null) {
                    subcontext = "/rest";
                  }
                  String fullpath = subcontext + resourceMethod.getFullpath();
                  List<ResourceMethod> methods = group.get(fullpath);
                  if (methods == null) {
                    methods = new ArrayList<ResourceMethod>();
                    group.put(fullpath, methods);
                  }
                  methods.add(resourceMethod);
                  facetsToDocs.put(facet.getValue(), facet.getDocumentation());
                }
              }
            }
          }
        }
      }
      String defaultNamespace = getDefaultNamespace();
      if (defaultNamespace == null && model.getNamespacesToSchemas().size() == 1) {
        defaultNamespace = model.getNamespacesToSchemas().keySet().iterator().next();
      }
      model.setVariable("uniqueContentTypes", new UniqueContentTypesMethod());
      model.put("datatypeNameFor", new DatatypeNameForMethod(model, defaultNamespace));
      model.put("facetsToResourceMethods", facetsToResourceMethods);
      model.put("facetsToDocs", facetsToDocs);
      model.put("swaggerDir", artifactDir.getName());
      buildBase(artifactDir);
      processTemplate(getTemplateURL(), model);
    }
    else {
      info("Skipping generation of Swagger since everything appears up-to-date...");
View Full Code Here

TOP

Related Classes of org.codehaus.enunciate.apt.EnunciateFreemarkerModel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.