Exemple #1
0
  @Test
  public void testGetIncludedFiles() throws Exception {
    List<String> files =
        mojo.getIncludedFiles(
            project, new String[] {"src/main/api/**/*.yaml", "src/main/**/*.yml"}, new String[] {});
    HashSet<String> set = new HashSet<String>(files);

    assertTrue(set.contains(new File(project, "src/main/api/hello.yaml").getAbsolutePath()));
    assertTrue(set.contains(new File(project, "src/main/api/bye.yml").getAbsolutePath()));
    assertTrue(set.contains(new File(project, "src/main/api/lala/wow.yaml").getAbsolutePath()));
    assertFalse(set.contains(new File(project, "src/main/dont-read.yaml").getAbsolutePath()));
    assertEquals(3, files.size());
  }
Exemple #2
0
  @Test
  public void testExecute() throws Exception {
    setVariableValueToObject(mojo, "muleXmlDirectory", app);
    setVariableValueToObject(mojo, "specDirectory", project);

    IOUtils.copy(
        this.getClass().getClassLoader().getResourceAsStream("create-mojo/simple.yaml"),
        new FileOutputStream(apiFile));

    mojo.execute();

    assertTrue(apiFile.exists());
    FileInputStream input = new FileInputStream(apiFile);
    String s = IOUtils.toString(input);
    input.close();

    assertTrue(s.length() > 0);
    // TODO Assert content
  }