Package org.apache.derbyTesting.junit

Examples of org.apache.derbyTesting.junit.SpawnedProcess$ProcessKillerTask


    public void spawnProcess() throws Exception {
        String[] cmd = {
            "junit.textui.TestRunner", spawnedTestClass.getName()
        };

        SpawnedProcess proc =
            new SpawnedProcess(execJavaCmd(cmd), spawnedTestClass.getName());

        if (proc.complete() != 0) {
            fail(proc.getFailMessage("Test process failed"));
        }
    }
View Full Code Here


        String[] cmd = (String[]) cmdList.toArray(commandSpecifics);

        Process serverProcess = execJavaCmd(cmd);
       
        SpawnedProcess spawned = new SpawnedProcess(serverProcess,
                cmdList.toString());
       
        // Ensure it completes without failures.
        assertEquals(0, spawned.complete());
       
        return spawned.getFullServerOutput();
    }
View Full Code Here

        String[] cmd = (String[]) cmdList.toArray(commandSpecifics);

        Process serverProcess = execJavaCmd(cmd);
       
        SpawnedProcess spawned = new SpawnedProcess(serverProcess,
                cmdList.toString());
       
        // Ensure it completes without failures.
        assertEquals(0, spawned.complete());
       
        return spawned.getFullServerOutput();
    }
View Full Code Here

     * been called previously in the same JVM process. Spawn a new process to
     * satisfy those requirements.
     */
    public void testLeak() throws IOException {
        String[] cmd = {"-Xmx16M", getClass().getName()};
        SpawnedProcess sp = new SpawnedProcess(execJavaCmd(cmd), "DERBY-5730");
        if (sp.complete() != 0) {
            fail(sp.getFailMessage("Process failed"));
        }
    }
View Full Code Here

            getClass().getName()
        };

        Process process = execJavaCmd(command);
       
        SpawnedProcess spawned = new SpawnedProcess( process, "UnbootedTest" );
       
        // Ensure it completes without failures.
        assertEquals(0, spawned.complete());

        assertEquals( SUCCESS, spawned.getFullServerOutput() );
    }
View Full Code Here

        args.add("-Dij.connection.test=jdbc:derby:wombat;create=true");
        args.add("org.apache.derby.tools.ij");
        final String[] argArray = args.toArray(new String[0]);

        final Process p = execJavaCmd(argArray);
        SpawnedProcess spawned = new SpawnedProcess(p, "MPT");
        spawned.suppressOutputOnComplete(); // we want to read it ourselves

        // The started process is an interactive ij session that will wait
        // for user input. Close stdin of the process so that it stops
        // waiting and exits.
        p.getOutputStream().close();

        final int exitCode = spawned.complete(120000L); // 2 minutes

        assertTrue(
            spawned.getFailMessage("subprocess run failed: "), exitCode == 0);

        // The actual message may vary. On Java 6, the names are not quoted,
        // whereas newer versions double-quote them. On Windows, the directory
        // separator is different. Also, different JVM vendors capitalize
        // the "access denied" message differently.
        //
        // Use a regular expression that matches all known variants.
        final String expectedMessageOnConsole =
            "(?s).*The file or directory system.nested could not be created " +
            "due to a security exception: " +
            "java\\.security\\.AccessControlException: [Aa]ccess denied " +
            "\\(\"?java\\.io\\.FilePermission\"? \"?system.nested\"? " +
            "\"?write\"?\\).*";

        final String output = spawned.getFullServerOutput(); // ignore
        final String err    = spawned.getFullServerError();

        assertTrue(err, err.matches(expectedMessageOnConsole));
    }
View Full Code Here

    public void spawnProcess() throws Exception {
        if (TestConfiguration.isDefaultBasePort()) {
            String[] cmd = {
                    "junit.textui.TestRunner", spawnedTestClass.getName()
                           };
            SpawnedProcess proc = new SpawnedProcess
                    (execJavaCmd(cmd), spawnedTestClass.getName());
            if (proc.complete() != 0) {
                fail(proc.getFailMessage("Test process failed"));
            }
        }
        else
        {
            // if we're not using the default port of 1527, ensure we're
            // passing on the baseport value to the spawned process.
            String[] cmd = {
                    "-Dderby.tests.basePort=" + TestConfiguration.getBasePort(),
                    "junit.textui.TestRunner", spawnedTestClass.getName()
            };           
            SpawnedProcess proc = new SpawnedProcess
                    (execJavaCmd(cmd), spawnedTestClass.getName());
            if (proc.complete() != 0) {
                fail(proc.getFailMessage("Test process failed"));
            }
        }
    }
View Full Code Here

                     return result;
                 }
             }
            );
       
        SpawnedProcess spawned = new SpawnedProcess(serverProcess,
                commandSpecifics);
       
        // Ensure it completes without failures.
        assertEquals(0, spawned.complete(false));
       
        return spawned.getFullServerOutput();
    }
View Full Code Here

            "org.apache.derbyTesting.functionTests.tests." +
                "compatibility.ClientCompatibilitySuite"
        };
        Process proc = execJavaCmd(null, classpath, cmd, null);

        SpawnedProcess spawned = new SpawnedProcess(proc, realName);
        int exitCode = spawned.complete(30*60*1000); // 30 minutes
        assertTrue(spawned.getFailMessage("client VM failed: "), exitCode == 0);
        println(spawned.getFullServerOutput());
    }
View Full Code Here

            proc = BaseTestCase.execJavaCmd(null, classpath,
                cmd.toArray(new String[cmd.size()]), null);
        } catch (IOException ioe) {
            fail("failed to start server: " + ioe.getMessage());
        }
        spawned = new SpawnedProcess(proc, "NetworkServerControl");
        boolean pingOk = ping(true, proc);
        assertTrue(spawned.getFailMessage("server failed to come up"), pingOk);
        println("--- Server " + dist.getVersion() + " up");
    }
View Full Code Here

TOP

Related Classes of org.apache.derbyTesting.junit.SpawnedProcess$ProcessKillerTask

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.