Search in sources :

Example 1 with Identity

use of loghub.processors.Identity in project LogHub by fbacchella.

the class TestConfigurations method testBadFields3.

// Ensure that multi-fields processor don't access a success sub-pipeline
@Test
public void testBadFields3() {
    SyslogPriority processor = new SyslogPriority();
    processor.setException(new Identity());
    processor.setFields(new String[] { "a", "b" });
    Assert.assertFalse(processor.configure(new Properties(Collections.emptyMap())));
}
Also used : SyslogPriority(loghub.processors.SyslogPriority) Identity(loghub.processors.Identity) Test(org.junit.Test)

Example 2 with Identity

use of loghub.processors.Identity in project LogHub by fbacchella.

the class TestConfigurations method testBadFields2.

// Ensure that multi-fields processor don't access a success sub-pipeline
@Test
public void testBadFields2() {
    SyslogPriority processor = new SyslogPriority();
    processor.setFailure(new Identity());
    processor.setFields(new String[] { "a", "b" });
    Assert.assertFalse(processor.configure(new Properties(Collections.emptyMap())));
}
Also used : SyslogPriority(loghub.processors.SyslogPriority) Identity(loghub.processors.Identity) Test(org.junit.Test)

Example 3 with Identity

use of loghub.processors.Identity in project LogHub by fbacchella.

the class TestConfigurations method testBadFields1.

// Ensure that multi-fields processor don't access a success sub-pipeline
@Test
public void testBadFields1() {
    SyslogPriority processor = new SyslogPriority();
    processor.setSuccess(new Identity());
    processor.setFields(new String[] { "a", "b" });
    Assert.assertFalse(processor.configure(new Properties(Collections.emptyMap())));
}
Also used : SyslogPriority(loghub.processors.SyslogPriority) Identity(loghub.processors.Identity) Test(org.junit.Test)

Example 4 with Identity

use of loghub.processors.Identity in project LogHub by fbacchella.

the class TestProcessor method testIf.

@Test
public void testIf() throws ProcessorException {
    Event e = new EventInstance(ConnectionContext.EMPTY);
    Processor p = new Identity();
    p.setIf("true");
    p.configure(new Properties(Collections.emptyMap()));
    Assert.assertTrue(p.isprocessNeeded(e));
    p.setIf("false");
    p.configure(new Properties(Collections.emptyMap()));
    Assert.assertFalse(p.isprocessNeeded(e));
    p.setIf("0");
    p.configure(new Properties(Collections.emptyMap()));
    Assert.assertFalse(p.isprocessNeeded(e));
    p.setIf("1");
    p.configure(new Properties(Collections.emptyMap()));
    Assert.assertTrue(p.isprocessNeeded(e));
    p.setIf("0.1");
    p.configure(new Properties(Collections.emptyMap()));
    Assert.assertTrue(p.isprocessNeeded(e));
    p.setIf("\"bob\"");
    p.configure(new Properties(Collections.emptyMap()));
    Assert.assertTrue(p.isprocessNeeded(e));
    p.setIf("\"\"");
    p.configure(new Properties(Collections.emptyMap()));
    Assert.assertFalse(p.isprocessNeeded(e));
}
Also used : Identity(loghub.processors.Identity) Properties(loghub.configuration.Properties) Test(org.junit.Test)

Aggregations

Identity (loghub.processors.Identity)4 Test (org.junit.Test)4 SyslogPriority (loghub.processors.SyslogPriority)3 Properties (loghub.configuration.Properties)1