Package org.codehaus.enunciate.main

Examples of org.codehaus.enunciate.main.Enunciate$FileVisitor


    config.setDeploymentProtocol("https");
    config.putNamespace(CITE_NAMESPACE, "cite");
    config.putNamespace(DATA_NAMESPACE, "data");
    config.putNamespace(FULL_NAMESPACE, "full");
    config.putNamespace(null, "default");
    Enunciate enunciate = new Enunciate(getAllJavaFiles("full"));
    enunciate.setConfig(config);
    enunciate.setTarget(Enunciate.Target.GENERATE);
    enunciate.setRuntimeClasspath(getInAPTClasspath());
    enunciate.execute();

    final File dataSchemaFile = new File(enunciate.getGenerateDir(), "xml/data.xsd");
    final File citationSchemaFile = new File(enunciate.getGenerateDir(), "xml/cite.xsd");
    final File fullSchemaFile = new File(enunciate.getGenerateDir(), "xml/full.xsd");
    final File defaultSchemaFile = new File(enunciate.getGenerateDir(), "xml/default.xsd");
    File fullWsdlFile = new File(enunciate.getGenerateDir(), "xml/full.wsdl");
    File relationshipWsdlFile = new File(enunciate.getGenerateDir(), "xml/relationship.wsdl");

    assertTrue(dataSchemaFile.exists());
    assertTrue(citationSchemaFile.exists());
    assertTrue(fullWsdlFile.exists());
    assertTrue(relationshipWsdlFile.exists());
View Full Code Here


  /**
   * Builds the base output directory.
   */
  protected void buildBase(File buildDir) throws IOException {
    Enunciate enunciate = getEnunciate();
    buildDir.mkdirs();
    if (this.base == null) {
      InputStream discoveredBase = SwaggerDeploymentModule.class.getResourceAsStream("/META-INF/enunciate/swagger-base.zip");
      if (discoveredBase == null) {
        debug("Default base to be used for swagger base.");
        enunciate.extractBase(loadDefaultBase(), buildDir);

        if (this.css != null) {
          enunciate.copyFile(enunciate.resolvePath(this.css), new File(new File(buildDir, "css"), "screen.css"));
        }
      }
      else {
        debug("Discovered documentation base at /META-INF/enunciate/docs-base.zip");
        enunciate.extractBase(discoveredBase, buildDir);
      }
    }
    else {
      File baseFile = enunciate.resolvePath(this.base);
      if (baseFile.isDirectory()) {
        debug("Directory %s to be used as the documentation base.", baseFile);
        enunciate.copyDir(baseFile, buildDir);
      }
      else {
        debug("Zip file %s to be extracted as the documentation base.", baseFile);
        enunciate.extractBase(new FileInputStream(baseFile), buildDir);
      }
    }
  }
View Full Code Here

    WsdlConfig wsdlConfig = new WsdlConfig();
    wsdlConfig.setNamespace("urn:custom");
    wsdlConfig.setFile("custom.wsdl");
    module.addWsdlConfig(wsdlConfig);

    Enunciate enunciate = new Enunciate(new String[0]);
    File generateDir = enunciate.createTempDir();
    enunciate.setGenerateDir(generateDir);
    module.init(enunciate);
    module.initModel(model);
    module.doFreemarkerGenerate();

    assertTrue("Not all templates were processed.  Unprocessed templates: " + processList.toString(), processList.isEmpty());
View Full Code Here

      @Override
      public List<DeploymentModule> getEnabledModules() {
        return Arrays.asList(new DeploymentModule[]{mockModule});
      }
    };
    Enunciate enunciate = new Enunciate(new String[0]);
    enunciate.setConfig(config);

    EnunciateAnnotationProcessor processor = new EnunciateAnnotationProcessor(enunciate) {
      @Override
      protected EnunciateFreemarkerModel getRootModel() {
        mockModule.model = new EnunciateFreemarkerModel();
View Full Code Here

    config.putNamespace("urn:test", "test");
    config.putNamespace("http://enunciate.codehaus.org/samples/contract", "tContract");
    config.setExcludeUnreferencedClasses(false);

    final boolean[] validated = new boolean[]{false};
    Enunciate enunciate = new Enunciate(new String[0]);
    enunciate.setConfig(config);
    EnunciateAnnotationProcessor processor = new EnunciateAnnotationProcessor(enunciate) {
      @Override
      protected void validate(EnunciateFreemarkerModel model) {
        validated[0] = true;
      }
View Full Code Here

    EnunciateConfiguration config = new EnunciateConfiguration();
    config.putNamespace("urn:test", "test");
    config.putNamespace("http://enunciate.codehaus.org/samples/contract", "tContract");

    final boolean[] validated = new boolean[]{false};
    Enunciate enunciate = new Enunciate(new String[0]);
    enunciate.setConfig(config);
    EnunciateAnnotationProcessor processor = new EnunciateAnnotationProcessor(enunciate) {
      @Override
      protected void validate(EnunciateFreemarkerModel model) {
        validated[0] = true;
      }
View Full Code Here

      public Validator getValidator() {
        return validator;
      }
    });

    Enunciate enunciate = new Enunciate(new String[0]);
    enunciate.setConfig(config);
    EnunciateAnnotationProcessor processor = new EnunciateAnnotationProcessor(enunciate) {
      @Override
      protected Messager getMessager() {
        return messager;
      }
    };
    EnunciateFreemarkerModel model = new EnunciateFreemarkerModel();
    model.add(ei);
    model.add(beanOne);
    model.add(beanTwo);
    model.add(beanThree);
    model.add(beanThreeElement);

    processor.validate(model);

    for (int i = 0; i < 3; i++) {
      assertTrue("Endpoint interface should have been validated three (and only three) times.", validator.validatedObjects.remove(ei));
    }
    assertFalse("Endpoint interface should have been validated three (and only three) times.", validator.validatedObjects.remove(ei));

    for (int i = 0; i < 3; i++) {
      assertTrue("Bean one should have been validated three (and only three) times.", validator.validatedObjects.remove(beanOne));
    }
    assertFalse("Bean one should have been validated three (and only three) times.", validator.validatedObjects.remove(beanOne));

    for (int i = 0; i < 3; i++) {
      assertTrue("Bean two should have been validated three (and only three) times.", validator.validatedObjects.remove(beanTwo));
    }
    assertFalse("Bean two should have been validated three (and only three) times.", validator.validatedObjects.remove(beanTwo));

    for (int i = 0; i < 3; i++) {
      assertTrue("Bean three should have been validated three (and only three) times.", validator.validatedObjects.remove(beanThree));
    }

    for (int i = 0; i < 3; i++) {
      assertTrue("Bean three element should have been validated three (and only three) times.", validator.validatedObjects.remove(beanThreeElement));
    }

    assertFalse("Bean three should have been validated three (and only three) times.", validator.validatedObjects.remove(beanThree));
    assertFalse("Bean three element should have been validated three (and only three) times.", validator.validatedObjects.remove(beanThreeElement));

    enunciate.setConfig(config);
    processor = new EnunciateAnnotationProcessor(enunciate) {
      @Override
      protected ValidationResult validate(EnunciateFreemarkerModel model, Validator validator) {
        ValidationResult result = new ValidationResult();
        result.addWarning(beanThree, "test warning.");
View Full Code Here

TOP

Related Classes of org.codehaus.enunciate.main.Enunciate$FileVisitor

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.