Package com.dtolabs.rundeck.core.utils

Examples of com.dtolabs.rundeck.core.utils.PartialLineBuffer


    }

    public void testDetectFailPartial2() throws Exception {
        ByteArrayInputStream bais = new ByteArrayInputStream("Test1\r\nTest2: blah\r".getBytes());
        boolean result = ResponderTask.detect(null, "^Test2: .*", 1000, 20, new InputStreamReader(bais),
                                              new PartialLineBuffer());
        assertFalse(result);
    }
View Full Code Here


    }

    public void testDetectSuccessPartial3() throws Exception {
        ByteArrayInputStream bais = new ByteArrayInputStream("Test1\rTest2: blah".getBytes());
        boolean result = ResponderTask.detect("^Test2: .*", null, 1000, 20, new InputStreamReader(bais),
                                              new PartialLineBuffer());
        assertTrue(result);
    }
View Full Code Here

    }

    public void testDetectFailPartial3() throws Exception {
        ByteArrayInputStream bais = new ByteArrayInputStream("Test1\rTest2: blah".getBytes());
        boolean result = ResponderTask.detect(null, "^Test2: .*", 1000, 20, new InputStreamReader(bais),
                                              new PartialLineBuffer());
        assertFalse(result);
    }
View Full Code Here

    }

    public void testDetectBoth() throws Exception {
        ByteArrayInputStream bais = new ByteArrayInputStream("Test1\nTest2: blah\n".getBytes());
        boolean result = ResponderTask.detect("^Test2: .*", "^Test2: .*", 1000, 20, new InputStreamReader(bais),
                                              new PartialLineBuffer());
        assertTrue(result);
    }
View Full Code Here

    }

    public void testDetectBothOrderSuccessFirst() throws Exception {
        ByteArrayInputStream bais = new ByteArrayInputStream("Test1\nTest2: blah\nTest3: bloo".getBytes());
        boolean result = ResponderTask.detect("^Test2: .*", "^Test3: .*", 1000, 20, new InputStreamReader(bais),
                                              new PartialLineBuffer());
        assertTrue(result);
    }
View Full Code Here

    }

    public void testDetectBothOrderFailureFirst() throws Exception {
        ByteArrayInputStream bais = new ByteArrayInputStream("Test1\nTest2: blah\nTest3: bloo".getBytes());
        boolean result = ResponderTask.detect("^Test3: .*", "^Test2: .*", 1000, 20, new InputStreamReader(bais),
                                              new PartialLineBuffer());
        assertFalse(result);
    }
View Full Code Here

    public void testDetectMaxLines() throws Exception {
        ByteArrayInputStream bais = new ByteArrayInputStream(
            "Test1\nTest1\nTest1\nTest1\nTest1\nTest2: blah\nTest3: bloo".getBytes());
        try {
            boolean result = ResponderTask.detect("^Test2: .*", null, 1000, 5, new InputStreamReader(bais),
                                                  new PartialLineBuffer());
            fail("Should have thrown exception");
        } catch (ResponderTask.ThreshholdException e) {
            assertNotNull(e);
            assertEquals(Integer.valueOf(5), e.getValue());
            assertEquals(ResponderTask.ThresholdType.lines, e.getType());
View Full Code Here

    public void testDetectMaxLinesOK() throws Exception {
        ByteArrayInputStream bais = new ByteArrayInputStream(
            "Test1\nTest1\nTest1\nTest1\nTest1\nTest2: blah\nTest3: bloo".getBytes());
        boolean result = ResponderTask.detect("^Test2: .*", null, 1000, 6, new InputStreamReader(bais),
                                              new PartialLineBuffer());
        assertTrue(result);
    }
View Full Code Here

    public void testDetectMaxTimeout() throws Exception {
        ByteArrayInputStream bais = new ByteArrayInputStream(
            "Test1\nTest1\nTest1\nTest1\nTest1\nTest2: blah\nTest3: bloo".getBytes());
        try {
            boolean result = ResponderTask.detect("^TestZ: .*", null, 100, 50, new InputStreamReader(bais),
                                                  new PartialLineBuffer());
            fail("Should have thrown exception");
        } catch (ResponderTask.ThreshholdException e) {
            assertNotNull(e);
            assertEquals(Long.valueOf(100), e.getValue());
            assertEquals(ResponderTask.ThresholdType.milliseconds, e.getType());
View Full Code Here

    /**
     * Create a ResponderTask with a responder, io streams, and result handler which can be null.
     */
    public ResponderTask(final Responder responder, final InputStream inputStream, final OutputStream outputStream,
                         final ResultHandler resultHandler) {
        this(responder, new InputStreamReader(inputStream), outputStream, resultHandler, new PartialLineBuffer());
    }
View Full Code Here

TOP

Related Classes of com.dtolabs.rundeck.core.utils.PartialLineBuffer

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.