Package com.sun.mirror.declaration

Examples of com.sun.mirror.declaration.TypeDeclaration


  /**
   * tests a basic root resource.
   */
  public void testBasicResource() throws Exception {
    TypeDeclaration declaration = getDeclaration("org.codehaus.enunciate.samples.rs.RootResource1");
    RootResource root1 = new RootResource((ClassDeclaration) declaration);
    assertEquals(4, root1.getResourceMethods().size());
    boolean getFound = false;
    boolean postFound = false;
    boolean putFound = false;
View Full Code Here


  /**
   * tests annotation inheritance
   */
  public void testAnnotationInheritance() throws Exception {
    TypeDeclaration declaration = getDeclaration("org.codehaus.enunciate.samples.rs.RootResource2Impl");
    RootResource root2 = new RootResource((ClassDeclaration) declaration);
    assertEquals("root2", root2.getPath());
    assertEquals(1, root2.getResourceParameters().size());
    assertEquals(8, root2.getResourceMethods().size());
    boolean getFound = false;
View Full Code Here

* @author Ryan Heaton
*/
public class TestEndpointInterface extends InAPTTestCase {

  public void testTargetNamespace() throws Exception {
    TypeDeclaration declaration = getDeclaration("org.codehaus.enunciate.samples.services.NoNamespaceWebService");
    assertEquals("calculated namespace doesn't conform to JSR 181: 3.2", "http://services.samples.enunciate.codehaus.org/", new EndpointInterface(declaration).getTargetNamespace()
    );

    declaration = getDeclaration("org.codehaus.enunciate.samples.services.NamespacedWebService");
    assertEquals(new EndpointInterface(declaration).getTargetNamespace(), "http://enunciate.codehaus.org/samples/contract");
View Full Code Here

      //fall through.
    }
  }

  public void testGetWebMethods() throws Exception {
    TypeDeclaration declaration = getDeclaration("org.codehaus.enunciate.samples.services.NamespacedWebService");
    Collection<WebMethod> webMethods = new EndpointInterface(declaration).getWebMethods();
    assertEquals(1, webMethods.size());
    assertEquals("myPublicMethod", webMethods.iterator().next().getSimpleName());

    declaration = getDeclaration("org.codehaus.enunciate.samples.services.NoNamespaceWebService");
View Full Code Here

  /**
   * Tests the attributes of an ei.
   */
  public void testAttributes() throws Exception {
    TypeDeclaration declaration = getDeclaration("org.codehaus.enunciate.samples.services.NamespacedWebService");
    EndpointInterface annotated = new EndpointInterface(declaration);
    declaration = getDeclaration("org.codehaus.enunciate.samples.services.NoNamespaceWebService");
    EndpointInterface notAnnotated = new EndpointInterface(declaration);

    assertEquals("The port type name of the web service should be customized by the annotation (JSR 181: 3.4)", "annotated-web-service", annotated.getPortTypeName());
View Full Code Here

 
  /**
   * see https://jira.codehaus.org/browse/ENUNCIATE-626
   */
  public void testAdaptingSubclassedAdapter() throws Exception {
    TypeDeclaration decl = getDeclaration("org.codehaus.enunciate.samples.anotherschema.BeanWithPropertyAdaptedBySubclass");
    ComplexTypeDefinition ct = new ComplexTypeDefinition((ClassDeclaration) decl);
    EnunciateFreemarkerModel model = new EnunciateFreemarkerModel();
    FreemarkerModel.set(model);
    model.add(ct);
    Element el = ct.getElements().first();
View Full Code Here

  /**
   * see https://jira.codehaus.org/browse/ENUNCIATE-514
   */
  public void testAdaptingIfaceToImpl() throws Exception {
    TypeDeclaration decl = getDeclaration("org.codehaus.enunciate.samples.schema.BeanWithAdaptedIfaceAccessor");
    ComplexTypeDefinition ct = new ComplexTypeDefinition((ClassDeclaration) decl);
    EnunciateFreemarkerModel model = new EnunciateFreemarkerModel();
    FreemarkerModel.set(model);
    model.add(ct);
    Element el = ct.getElements().first();
View Full Code Here

          for (ReferenceType referenceType : resourceMethod.getThrownTypes()) {
            if (!(referenceType instanceof DeclaredType)) {
              throw new ValidationException(resourceMethod.getPosition(), "Method " + resourceMethod + " of " + resourceMethod.getParent().getQualifiedName() + ": thrown type must be a declared type.");
            }

            TypeDeclaration declaration = ((DeclaredType) referenceType).getDeclaration();

            if (declaration == null) {
              throw new ValidationException(resourceMethod.getPosition(), "Method " + resourceMethod + " of " + resourceMethod.getParent().getQualifiedName() + ": unknown declaration for " + referenceType);
            }
            else if (declaration.getAnnotation(javax.xml.ws.WebFault.class) != null) {
              WebFault fault = new WebFault((ClassDeclaration) declaration);
              if (fault.isImplicitSchemaElement() && visitedFaults.add(fault)) {
                model.put("message", fault);
                processTemplate(faultBeanTemplate, model);
              }
View Full Code Here

   *
   * @param fqn The fqn.
   * @return The declaration.
   */
  protected TypeDeclaration getDeclaration(String fqn) {
    TypeDeclaration declaration = Context.getCurrentEnvironment().getTypeDeclaration(fqn);
    assertNotNull("No source def found: " + fqn, declaration);
    return declaration;
  }
View Full Code Here

  /**
   * tests getting the imported namspaces
   */
  public void testGetImportedNamespaces() throws Exception {
    final TypeDeclaration decl = getDeclaration("org.codehaus.enunciate.samples.services.NamespacedWebService");
    EndpointInterface ei1 = new EndpointInterface(decl) {
      @Override
      public Set<String> getReferencedNamespaces() {
        return new HashSet<String>(Arrays.asList("urn:ns1", "urn:ns2", "urn:ns3"));
      }
View Full Code Here

TOP

Related Classes of com.sun.mirror.declaration.TypeDeclaration

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.