Package org.codehaus.enunciate.contract.validation

Examples of org.codehaus.enunciate.contract.validation.ValidationResult


  }


  @Override
  public ValidationResult validateSimpleType(SimpleTypeDefinition simpleType) {
    ValidationResult result = super.validateSimpleType(simpleType);
    if (!isAMFTransient(simpleType)) {
      if (!hasDefaultConstructor(simpleType)) {
        result.addError(simpleType, "The mapping from AMF to JAXB requires a public no-arg constructor.");
      }

      if (!disabledRules.contains("as3.conflicting.names")) {
        if ("Date".equals(simpleType.getClientSimpleName())) {
          result.addError(simpleType, "ActionScript can't handle a class named 'Date'.  It conflicts with the top-level ActionScript class of the same name. Either rename the class, or use the @org.codehaus.enunciate.ClientName annotation to rename the class on the client-side.");
        }
        else if ("Event".equals(simpleType.getClientSimpleName())) {
          result.addError(simpleType, "The Enunciate-generated ActionScript code can't handle a class named 'Event'.  It conflicts with the ActionScript remoting class of the same name. Either rename the class, or use the @org.codehaus.enunciate.ClientName annotation to rename the class on the client-side.");
        }
      }
    }
    return result;
  }
View Full Code Here


    return result;
  }

  @Override
  public ValidationResult validateEnumType(EnumTypeDefinition enumType) {
    ValidationResult result = super.validateEnumType(enumType);
    if (!isAMFTransient(enumType)) {
      if (!disabledRules.contains("as3.conflicting.names")) {
        if ("Date".equals(enumType.getClientSimpleName())) {
          result.addError(enumType, "ActionScript can't handle a class named 'Date'.  It conflicts with the top-level ActionScript class of the same name. Either rename the class, or use the @org.codehaus.enunciate.ClientName annotation to rename the class on the client-side.");
        }
        else if ("Event".equals(enumType.getClientSimpleName())) {
          result.addError(enumType, "The Enunciate-generated ActionScript code can't handle a class named 'Event'.  It conflicts with the ActionScript remoting class of the same name. Either rename the class, or use the @org.codehaus.enunciate.ClientName annotation to rename the class on the client-side.");
        }
      }
    }
    return result;
  }
View Full Code Here

    return result;
  }

  @Override
  public ValidationResult validateSimpleType(SimpleTypeDefinition simpleType) {
    ValidationResult result = super.validateSimpleType(simpleType);
    if (!serverSideTypesToUse.isEmpty()) {
      try {
        if (!simpleType.getQualifiedName().equals(clientConversion.convert(simpleType))) {
          result.addError(simpleType, "If you're using server-side types in your client library, you can't convert the name of "
            + simpleType.getQualifiedName() + " to " + clientConversion.convert(simpleType) + ".");
        }
      }
      catch (TemplateModelException e) {
        throw new IllegalStateException(e);
View Full Code Here

    return result;
  }

  @Override
  public ValidationResult validateEnumType(EnumTypeDefinition enumType) {
    ValidationResult result = super.validateEnumType(enumType);
    if (!serverSideTypesToUse.isEmpty()) {
      try {
        if (!enumType.getQualifiedName().equals(clientConversion.convert(enumType))) {
          result.addError(enumType, "If you're using server-side types in your client library, you can't convert the name of "
            + enumType.getQualifiedName() + " to " + clientConversion.convert(enumType) + ".");
        }
      }
      catch (TemplateModelException e) {
        throw new IllegalStateException(e);
View Full Code Here

    return result;
  }

  @Override
  public ValidationResult validateRootElement(RootElementDeclaration elType) {
    ValidationResult result = super.validateRootElement(elType);
    if (!serverSideTypesToUse.isEmpty()) {
      try {
        if (!elType.getQualifiedName().equals(clientConversion.convert(elType))) {
          result.addError(elType, "If you're using server-side types in your client library, you can't convert the name of "
            + elType.getQualifiedName() + " to " + clientConversion.convert(elType) + ".");
        }
      }
      catch (TemplateModelException e) {
        throw new IllegalStateException(e);
View Full Code Here

*/
public class SwaggerValidator extends BaseValidator {

  @Override
  public ValidationResult validateSimpleType(SimpleTypeDefinition type) {
    ValidationResult result = super.validateSimpleType(type);
    validateTypeDefinition(type, result);
    return result;
  }
View Full Code Here

    return result;
  }

  @Override
  public ValidationResult validateComplexType(ComplexTypeDefinition type) {
    ValidationResult result = super.validateComplexType(type);
    validateTypeDefinition(type, result);
    return result;
  }
View Full Code Here

  private final HashMap<String, EndpointInterface> visitedEndpoints = new HashMap<String, EndpointInterface>();

  @Override
  public ValidationResult validateEndpointInterface(EndpointInterface ei) {
    ValidationResult result = super.validateEndpointInterface(ei);

    WebService eiAnnotation = ei.getAnnotation(WebService.class);
    if (ei.isInterface()) {
      if (!"".equals(eiAnnotation.serviceName())) {
        result.addError(ei, "JBoss fails if you specify 'serviceName' on an endpoint interface.");
      }
      if (!"".equals(eiAnnotation.portName())) {
        result.addError(ei, "JBoss fails if you specify 'portName' on an endpoint interface.");
      }
      for (MethodDeclaration m : ei.getMethods()) {
        javax.jws.WebMethod wm = m.getAnnotation(javax.jws.WebMethod.class);
        if (wm != null && wm.exclude()) {
          result.addError(m, "JBoss fails if you specify 'exclude=true' on an endpoint interface.");
        }
      }
    }

    if (ei.getEndpointImplementations().size() > 1) {
      ArrayList<String> impls = new ArrayList<String>();
      for (EndpointImplementation impl : ei.getEndpointImplementations()) {
        impls.add(impl.getQualifiedName());
      }
      result.addError(ei, "Sorry, JBoss doesn't support two endpoint implementations for interface '" + ei.getQualifiedName() +
        "'.  Found " + ei.getEndpointImplementations().size() + " implementations (" + impls.toString() + ").");
    }
    else if (ei.getEndpointImplementations().isEmpty()) {
      result.addError(ei, "JBoss requires an implementation for each service interface.");
    }

    EndpointInterface visited = visitedEndpoints.put(ei.getServiceName(), ei);
    if (visited != null) {
      if (visited.getTargetNamespace().equals(ei.getTargetNamespace())) {
        result.addError(ei, "Ummm... you already have a service named " + ei.getServiceName() + " at " +
          visited.getPosition() + ".  You need to disambiguate.");
      }
    }

    return result;
View Full Code Here

    typeDef = model.createTypeDefinition((ClassDeclaration) getDeclaration("org.codehaus.enunciate.samples.schema.RootElementMapAdapted"));
    model.add(typeDef);
    DefaultValidator validator = new DefaultValidator();
    for (SchemaInfo schemaInfo : model.getNamespacesToSchemas().values()) {
      for (TypeDefinition typeDefinition : schemaInfo.getTypeDefinitions()) {
        ValidationResult result = validator.validateTypeDefinition(typeDefinition);
        if (result.hasErrors()) {
          for (ValidationMessage validationMessage : result.getErrors()) {
            fail(validationMessage.getText());
          }
        }
      }
    }
View Full Code Here

    typeDef = model.createTypeDefinition((ClassDeclaration) getDeclaration("org.codehaus.enunciate.samples.schema.RootElementMapAdapted"));
    model.add(typeDef);
    DefaultValidator validator = new DefaultValidator();
    for (SchemaInfo schemaInfo : model.getNamespacesToSchemas().values()) {
      for (TypeDefinition typeDefinition : schemaInfo.getTypeDefinitions()) {
        ValidationResult result = validator.validateTypeDefinition(typeDefinition);
        if (result.hasErrors()) {
          for (ValidationMessage validationMessage : result.getErrors()) {
            fail(validationMessage.getText());
          }
        }
      }
    }
View Full Code Here

TOP

Related Classes of org.codehaus.enunciate.contract.validation.ValidationResult

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.