Package org.codehaus.xharness.log

Examples of org.codehaus.xharness.log.LineBuffer


        tlCtrl.verify();
        prCtrl.verify();
    }
   
    public void testCharsLargerFails() throws Exception {
        LineBuffer buffer = new LineBuffer();
        buffer.logLine("All good things must come to an end");
       
        MockControl prCtrl = MockClassControl.createNiceControl(Project.class);
        Project project = (Project)prCtrl.getMock();
       
        MockControl xhCtrl = MockClassControl.createNiceControl(XharnessTask.class);
View Full Code Here


        xhCtrl.verify();
        tlCtrl.verify();
        prCtrl.verify();
    }
    public void testLinesSmallerPass() throws Exception {
        LineBuffer buffer = new LineBuffer();
        buffer.logLine("All good things must come to an end");
        buffer.logLine("Beam me up, Scottie");
       
        MockControl prCtrl = MockClassControl.createNiceControl(Project.class);
        Project project = (Project)prCtrl.getMock();
       
        MockControl xhCtrl = MockClassControl.createNiceControl(XharnessTask.class);
View Full Code Here

        tlCtrl.verify();
        prCtrl.verify();
    }
   
    public void testLinesSmallerFails() throws Exception {
        LineBuffer buffer = new LineBuffer();
        buffer.logLine("All good things must come to an end");
        buffer.logLine("Beam me up, Scottie");
       
        MockControl prCtrl = MockClassControl.createNiceControl(Project.class);
        Project project = (Project)prCtrl.getMock();
       
        MockControl xhCtrl = MockClassControl.createNiceControl(XharnessTask.class);
View Full Code Here

        tlCtrl.verify();
        prCtrl.verify();
    }
   
    public void testCharsSmallerPass() throws Exception {
        LineBuffer buffer = new LineBuffer();
        buffer.logLine("All good things must come to an end");
       
        MockControl prCtrl = MockClassControl.createNiceControl(Project.class);
        Project project = (Project)prCtrl.getMock();
       
        MockControl xhCtrl = MockClassControl.createNiceControl(XharnessTask.class);
View Full Code Here

        tlCtrl.verify();
        prCtrl.verify();
    }
   
    public void testCharsSmallerFails() throws Exception {
        LineBuffer buffer = new LineBuffer();
        buffer.logLine("All good things must come to an end");
       
        MockControl prCtrl = MockClassControl.createNiceControl(Project.class);
        Project project = (Project)prCtrl.getMock();
       
        MockControl xhCtrl = MockClassControl.createNiceControl(XharnessTask.class);
View Full Code Here

        }
    }

    public void testUseNoLauncher() throws Exception {
        Project project = new Project();
        LineBuffer buffer = new LineBuffer();

        ProcessTester server = new ProcessTester();

        XhExecBgTask task = new XhExecBgTask();
        task.setProject(project);
        task.setExecutable(JVM);
        task.createArg().setValue("-cp");
        Path path = new Path(project, getClassPath());
        task.createArg().setPath(path);
        task.createArg().setLine(ProcessTester.class.getName());
        task.createArg().setLine("-p " + server.getPort());
        task.createArg().setLine("-s user.dir");
        task.createArg().setLine("-t 60");
        task.setUseLauncher(false);
        task.enableLogging(buffer, 0, 1);

        try {
            task.execute();
            // wait 250ms for process to start
            Thread.sleep(250);
            assertTrue("Process is not running", task.isRunning());
            assertTrue("Process is not running", server.passed());
            assertEquals("Wrong user dir",
                         System.getProperty("user.dir"),
                         server.getReceivedData());
            task.kill();
            assertTrue("Process is still running", !task.isRunning());
            String cmdl = task.getCommandline();
            assertTrue("Wrong commandline: " + cmdl, cmdl.indexOf("async_exec_launcher") < 0);
            assertContains("Wrong commandline", JVM, cmdl);
            assertContains("Wrong commandline", path.toString(), cmdl);
            assertContains("Wrong commandline", ProcessTester.class.getName(), cmdl);
            assertContains("Wrong commandline", " -s user.dir", cmdl);
            assertEquals("Wrong stderr", "Welcome stderr!", buffer.toString(1));
            String stdout = buffer.toString(0);
            assertTrue("Wrong stdout", stdout.startsWith("Welcome stdout!"));
        } finally {
//            System.out.println(task.getCommandline());
//            System.out.println(buffer.toString('\n', null));
        }
View Full Code Here

            }
            public final void messageLogged(BuildEvent event) {
//                System.out.println("> " + event.getMessage());
            }
        });
        LineBuffer buffer = new LineBuffer();

        EnvironmentVariable var = new EnvironmentVariable();
        if (System.getProperty("os.name").toLowerCase().startsWith("win")) {
            var.setKey("Path");
        } else {
View Full Code Here

                       server.getReceivedData());
    }

    public void testExecuteLogging() throws Exception {
        Project project = new Project();
        LineBuffer buffer = new LineBuffer();
       
        ProcessTester server = new ProcessTester();
       
        XhJavaTask task = new XhJavaTask();
        task.setProject(project);
        task.setClassname(ProcessTester.class.getName());
        task.setClasspath(new Path(project, getClassPath()));
        task.createArg().setLine("-p " + server.getPort());
        task.createArg().setLine("-s user.dir");
        task.enableLogging(buffer, 0, 1);
       
        task.execute();
        assertEquals("Wrong return value", 0, task.getReturnValue());
        assertTrue("Client did not run", server.passed());
        assertEquals("Wrong user dir", System.getProperty("user.dir"), server.getReceivedData());
        assertEquals("Wrong stderr", "Welcome stderr!", buffer.toString(1));
        String stdout = buffer.toString(0);
        assertTrue("Wrong stdout", stdout.startsWith("Welcome stdout!"));
        assertTrue("Wrong stdout", stdout.endsWith("...done. Exiting."));
    }
View Full Code Here

        OutputContains condition = new OutputContains();
        assertTrue("Condition evaled incorrectly", condition.eval());
    }
   
    public void testEvalFalse() throws Exception {
        LineBuffer buffer = new LineBuffer(LogPriority.STDOUT);
        buffer.logLine("All good things must come to an end");
       
        MockControl prCtrl = MockClassControl.createNiceControl(Project.class);
        Project project = (Project)prCtrl.getMock();
       
        MockControl xhCtrl = MockClassControl.createNiceControl(XharnessTask.class);
View Full Code Here

        tlCtrl.verify();
        prCtrl.verify();
    }

    public void testEvalTrue() throws Exception {
        LineBuffer buffer = new LineBuffer(LogPriority.STDERR);
        buffer.logLine("All good things must come to an end");
        buffer.logLine("Beam me up, Scottie");
       
        MockControl prCtrl = MockClassControl.createNiceControl(Project.class);
        Project project = (Project)prCtrl.getMock();
       
        MockControl xhCtrl = MockClassControl.createNiceControl(XharnessTask.class);
View Full Code Here

TOP

Related Classes of org.codehaus.xharness.log.LineBuffer

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.