public void addTo(String to) { if (to == null || to.length() == 0) { throw new IllegalArgumentException("Null or empty <to> property"); } PatternLayoutBase plb = makeNewToPatternLayout(to.trim()); plb.setContext(context); plb.start(); this.toPatternLayoutList.add(plb); }
public void addTo(String to) { if (to == null || to.length() == 0) { throw new IllegalArgumentException("Null or empty <to> property"); } PatternLayoutBase<E> plb = makeNewToPatternLayout(to.trim()); plb.setContext(context); plb.start(); this.toPatternLayoutList.add(plb); }
public void addTo(String to) { if (to == null || to.length() == 0) { throw new IllegalArgumentException("Null or empty <to> property"); } PatternLayoutBase plb = makeNewToPatternLayout(to.trim()); plb.setContext(context); plb.start(); this.toPatternLayoutList.add(plb); }
public void addTo(String to) { if (to == null || to.length() == 0) { throw new IllegalArgumentException("Null or empty <to> property"); } PatternLayoutBase plb = makeNewToPatternLayout(to.trim()); plb.setContext(context); plb.start(); this.toPatternLayoutList.add(plb); }
public void addTo(String to) { if (to == null || to.length() == 0) { throw new IllegalArgumentException("Null or empty <to> property"); } PatternLayoutBase plb = makeNewToPatternLayout(to.trim()); plb.setContext(context); plb.start(); this.toPatternLayoutList.add(plb); }
public void addTo(String to) { if (to == null || to.length() == 0) { throw new IllegalArgumentException("Null or empty <to> property"); } PatternLayoutBase plb = makeNewToPatternLayout(to.trim()); plb.setContext(context); plb.start(); this.toPatternLayoutList.add(plb); }
public void addTo(String to) { if (to == null || to.length() == 0) { throw new IllegalArgumentException("Null or empty <to> property"); } PatternLayoutBase plb = makeNewToPatternLayout(to.trim()); plb.setContext(context); plb.start(); this.toPatternLayoutList.add(plb); }
public void addTo(String to) { if (to == null || to.length() == 0) { throw new IllegalArgumentException("Null or empty <to> property"); } PatternLayoutBase plb = makeNewToPatternLayout(to.trim()); plb.setContext(context); plb.start(); this.toPatternLayoutList.add(plb); }
protected PatternLayoutBase<Event> buildLayout(String format) { PatternLayoutBase<Event> layout = createLayout(); layout.setContext(contextAware.getContext()); layout.setPattern(format); layout.setPostCompileProcessor(null); // Remove EnsureLineSeparation which is there by default layout.start(); return layout; }
public AbstractPropertyAndEncoder(Property property, Context context) { this.property = property; this.layout = getLayout(); this.layout.setContext(context); this.layout.setPattern(property.getValue()); this.layout.setPostCompileProcessor(null); this.layout.start(); }
@Test public void testEscapeClosingParentheses() { PatternLayoutBase<Object> plb = getPatternLayoutBase(); Context context = new ContextBase(); plb.setContext(context); plb.setPattern("x(%OTT\\)y"); plb.start(); String s = plb.doLayout(new Object()); assertEquals("x(123)y", s); }
@Test public void testEscapeBothParentheses() { PatternLayoutBase<Object> plb = getPatternLayoutBase(); Context context = new ContextBase(); plb.setContext(context); plb.setPattern("x\\(%OTT\\)y"); plb.start(); String s = plb.doLayout(new Object()); assertEquals("x(123)y", s); }
@Test public void testPercentAsLiteral() { PatternLayoutBase<Object> plb = getPatternLayoutBase(); Context context = new ContextBase(); plb.setContext(context); plb.setPattern("hello \\% world"); plb.start(); String s = plb.doLayout(new Object()); assertEquals("hello % world", s); }
@Test public void testOK() { PatternLayoutBase<Object> plb = getPatternLayoutBase(); Context context = new ContextBase(); plb.setContext(context); plb.setPattern("x%OTT"); plb.start(); String s = plb.doLayout(new Object()); //System.out.println(s); //StatusManager sm = context.getStatusManager(); //StatusPrinter.print(sm); assertEquals("x123", s); }
/** * This test checks that the pattern layout implementation starts its * converters. ExceptionalConverter throws an exception if it's convert * method is called before being started. */ @Test public void testConverterStart() { PatternLayoutBase<E> plb = getPatternLayoutBase(); plb.setContext(getContext()); plb.getInstanceConverterMap().put("EX", ExceptionalConverter.class.getName()); plb.setPattern("%EX"); plb.start(); String result = plb.doLayout(getEventObject()); assertFalse(result.contains("%PARSER_ERROR_EX")); //System.out.println("========="+result); }
@Test public void testUnStarted() { PatternLayoutBase<E> plb = getPatternLayoutBase(); Context context = new ContextBase(); plb.setContext(context); String s = plb.doLayout(getEventObject()); assertEquals("", s); StatusManager sm = context.getStatusManager(); StatusPrinter.print(sm); }
@Test public void testStarted() { PatternLayoutBase<E> plb = getPatternLayoutBase(); Context context = new ContextBase(); plb.setContext(context); String s = plb.doLayout(getEventObject()); assertEquals("", s); StatusManager sm = context.getStatusManager(); StatusPrinter.print(sm); }
@Test public void testEmptyPattern() { //System.out.println("testNullPattern"); PatternLayoutBase<E> plb = getPatternLayoutBase(); Context context = new ContextBase(); plb.setContext(context); plb.setPattern(""); plb.start(); String s = plb.doLayout(getEventObject()); assertEquals("", s); StatusChecker checker = new StatusChecker(context.getStatusManager()); //StatusPrinter.print(context); checker.assertContainsMatch("Empty or null pattern."); }
@Test public void testNullPattern() { //System.out.println("testNullPattern"); PatternLayoutBase<E> plb = getPatternLayoutBase(); Context context = new ContextBase(); plb.setContext(context); plb.setPattern(null); plb.start(); String s = plb.doLayout(getEventObject()); assertEquals("", s); StatusChecker checker = new StatusChecker(context.getStatusManager()); //StatusPrinter.print(context); checker.assertContainsMatch("Empty or null pattern."); }