Java Code Examples for javax.tools.DocumentationTool#run()

The following examples show how to use javax.tools.DocumentationTool#run() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RunTest.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Verify that run method can be invoked.
 */
@Test
public void testRunOK() throws Exception {
    File testSrc = new File(System.getProperty("test.src"));
    File srcFile = new File(testSrc, "pkg/C.java");
    File outDir = getOutDir();
    String[] args = { "-d", outDir.getPath(), srcFile.getPath() };

    ByteArrayOutputStream stdout = new ByteArrayOutputStream();
    ByteArrayOutputStream stderr = new ByteArrayOutputStream();
    DocumentationTool tool = ToolProvider.getSystemDocumentationTool();
    int rc = tool.run(null, stdout, stderr, args);
    System.err.println("stdout >>" + stdout.toString() + "<<");
    System.err.println("stderr >>" + stderr.toString() + "<<");

    if (rc == 0) {
        System.err.println("call succeeded");
        checkFiles(outDir, standardExpectFiles);
        String out = stdout.toString();
        for (String f: standardExpectFiles) {
            String f1 = f.replace('/', File.separatorChar);
            if (f1.endsWith(".html") && !out.contains(f1))
                error("expected string not found: " + f1);
        }
    } else {
        error("call failed");
    }
}
 
Example 2
Source File: RunTest.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Verify that run method can be invoked.
 */
@Test
public void testRunOK() throws Exception {
    File testSrc = new File(System.getProperty("test.src"));
    File srcFile = new File(testSrc, "pkg/C.java");
    File outDir = getOutDir();
    String[] args = { "-d", outDir.getPath(), srcFile.getPath() };

    ByteArrayOutputStream stdout = new ByteArrayOutputStream();
    ByteArrayOutputStream stderr = new ByteArrayOutputStream();
    DocumentationTool tool = ToolProvider.getSystemDocumentationTool();
    int rc = tool.run(null, stdout, stderr, args);
    System.err.println("stdout >>" + stdout.toString() + "<<");
    System.err.println("stderr >>" + stderr.toString() + "<<");

    if (rc == 0) {
        System.err.println("call succeeded");
        checkFiles(outDir, standardExpectFiles);
        String out = stdout.toString();
        for (String f: standardExpectFiles) {
            String f1 = f.replace('/', File.separatorChar);
            if (f1.endsWith(".html") && !out.contains(f1))
                error("expected string not found: " + f1);
        }
    } else {
        error("call failed");
    }
}
 
Example 3
Source File: RunTest.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Verify that run method can be invoked.
 */
@Test
public void testRunOK() throws Exception {
    File testSrc = new File(System.getProperty("test.src"));
    File srcFile = new File(testSrc, "pkg/C.java");
    File outDir = getOutDir();
    String[] args = { "-d", outDir.getPath(), srcFile.getPath() };

    ByteArrayOutputStream stdout = new ByteArrayOutputStream();
    ByteArrayOutputStream stderr = new ByteArrayOutputStream();
    DocumentationTool tool = ToolProvider.getSystemDocumentationTool();
    int rc = tool.run(null, stdout, stderr, args);
    System.err.println("stdout >>" + stdout.toString() + "<<");
    System.err.println("stderr >>" + stderr.toString() + "<<");

    if (rc == 0) {
        System.err.println("call succeeded");
        checkFiles(outDir, standardExpectFiles);
        String out = stdout.toString();
        for (String f: standardExpectFiles) {
            String f1 = f.replace('/', File.separatorChar);
            if (f1.endsWith(".html") && !out.contains(f1))
                error("expected string not found: " + f1);
        }
    } else {
        error("call failed");
    }
}
 
Example 4
Source File: RunTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Verify that run method can be invoked.
 */
@Test
public void testRunOK() throws Exception {
    File testSrc = new File(System.getProperty("test.src"));
    File srcFile = new File(testSrc, "pkg/C.java");
    File outDir = getOutDir();
    String[] args = { "-d", outDir.getPath(), srcFile.getPath() };

    ByteArrayOutputStream stdout = new ByteArrayOutputStream();
    ByteArrayOutputStream stderr = new ByteArrayOutputStream();
    DocumentationTool tool = ToolProvider.getSystemDocumentationTool();
    int rc = tool.run(null, stdout, stderr, args);
    System.err.println("stdout >>" + stdout.toString() + "<<");
    System.err.println("stderr >>" + stderr.toString() + "<<");

    if (rc == 0) {
        System.err.println("call succeeded");
        checkFiles(outDir, standardExpectFiles);
        String out = stdout.toString();
        for (String f: standardExpectFiles) {
            String f1 = f.replace('/', File.separatorChar);
            if (f1.endsWith(".html") && !out.contains(f1))
                error("expected string not found: " + f1);
        }
    } else {
        error("call failed");
    }
}
 
Example 5
Source File: RunTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
     * Verify that run method can be invoked.
     */
//    @Test
    public void testRunOK() throws Exception {
        File testSrc = new File(System.getProperty("test.src"));
        File srcFile = new File(testSrc, "pkg/C.java");
        File outDir = getOutDir();
        String[] args = { "-d", outDir.getPath(), srcFile.getPath() };

        ByteArrayOutputStream stdout = new ByteArrayOutputStream();
        ByteArrayOutputStream stderr = new ByteArrayOutputStream();
        DocumentationTool tool = ToolProvider.getSystemDocumentationTool();
        int rc = tool.run(null, stdout, stderr, args);
        System.err.println("stdout >>" + stdout.toString() + "<<");
        System.err.println("stderr >>" + stderr.toString() + "<<");

        if (rc == 0) {
            System.err.println("call succeeded");
            checkFiles(outDir, standardExpectFiles);
            String out = stdout.toString();
            for (String f: standardExpectFiles) {
                String f1 = f.replace('/', File.separatorChar);
                if (f1.endsWith(".html") && !out.contains(f1))
                    error("expected string not found: " + f1);
            }
        } else {
            error("call failed");
        }
    }
 
Example 6
Source File: RunTest.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Verify that run method can be invoked.
 */
@Test
public void testRunOK() throws Exception {
    File testSrc = new File(System.getProperty("test.src"));
    File srcFile = new File(testSrc, "pkg/C.java");
    File outDir = getOutDir();
    String[] args = { "-d", outDir.getPath(), srcFile.getPath() };

    ByteArrayOutputStream stdout = new ByteArrayOutputStream();
    ByteArrayOutputStream stderr = new ByteArrayOutputStream();
    DocumentationTool tool = ToolProvider.getSystemDocumentationTool();
    int rc = tool.run(null, stdout, stderr, args);
    System.err.println("stdout >>" + stdout.toString() + "<<");
    System.err.println("stderr >>" + stderr.toString() + "<<");

    if (rc == 0) {
        System.err.println("call succeeded");
        checkFiles(outDir, standardExpectFiles);
        String out = stdout.toString();
        for (String f: standardExpectFiles) {
            String f1 = f.replace('/', File.separatorChar);
            if (f1.endsWith(".html") && !out.contains(f1))
                error("expected string not found: " + f1);
        }
    } else {
        error("call failed");
    }
}
 
Example 7
Source File: RunTest.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Verify that run method can be invoked.
 */
@Test
public void testRunOK() throws Exception {
    File testSrc = new File(System.getProperty("test.src"));
    File srcFile = new File(testSrc, "pkg/C.java");
    File outDir = getOutDir();
    String[] args = { "-d", outDir.getPath(), srcFile.getPath() };

    ByteArrayOutputStream stdout = new ByteArrayOutputStream();
    ByteArrayOutputStream stderr = new ByteArrayOutputStream();
    DocumentationTool tool = ToolProvider.getSystemDocumentationTool();
    int rc = tool.run(null, stdout, stderr, args);
    System.err.println("stdout >>" + stdout.toString() + "<<");
    System.err.println("stderr >>" + stderr.toString() + "<<");

    if (rc == 0) {
        System.err.println("call succeeded");
        checkFiles(outDir, standardExpectFiles);
        String out = stdout.toString();
        for (String f: standardExpectFiles) {
            String f1 = f.replace('/', File.separatorChar);
            if (f1.endsWith(".html") && !out.contains(f1))
                error("expected string not found: " + f1);
        }
    } else {
        error("call failed");
    }
}
 
Example 8
Source File: RunTest.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Verify that run method can be invoked.
 */
@Test
public void testRunOK() throws Exception {
    File testSrc = new File(System.getProperty("test.src"));
    File srcFile = new File(testSrc, "pkg/C.java");
    File outDir = getOutDir();
    String[] args = { "-d", outDir.getPath(), srcFile.getPath() };

    ByteArrayOutputStream stdout = new ByteArrayOutputStream();
    ByteArrayOutputStream stderr = new ByteArrayOutputStream();
    DocumentationTool tool = ToolProvider.getSystemDocumentationTool();
    int rc = tool.run(null, stdout, stderr, args);
    System.err.println("stdout >>" + stdout.toString() + "<<");
    System.err.println("stderr >>" + stderr.toString() + "<<");

    if (rc == 0) {
        System.err.println("call succeeded");
        checkFiles(outDir, standardExpectFiles);
        String out = stdout.toString();
        for (String f: standardExpectFiles) {
            String f1 = f.replace('/', File.separatorChar);
            if (f1.endsWith(".html") && !out.contains(f1))
                error("expected string not found: " + f1);
        }
    } else {
        error("call failed");
    }
}