@Test public void testPipeWithTwoBasicCommands() throws Exception { morphline = createMorphline("test-morphlines/pipeWithTwoBasicCommands"); Record record = createBasicRecord(); processAndVerifySuccess(record, record); }
@Test public void testLog() throws Exception { morphline = createMorphline("test-morphlines/log"); Record record = createBasicRecord(); processAndVerifySuccess(record, record); }
@Test public void testIsTrue() throws Exception { System.setProperty("MY_VARIABLE", "true"); morphline = createMorphline("test-morphlines/isTrue"); Record record = new Record(); record.put("isTooYoung", "true"); processAndVerifySuccess(record, record); System.setProperty("MY_VARIABLE", "false"); morphline = createMorphline("test-morphlines/isTrue"); processAndVerifyFailure(createBasicRecord()); System.clearProperty("MY_VARIABLE"); try { morphline = createMorphline("test-morphlines/isTrue"); fail(); } catch (ConfigException.UnresolvedSubstitution e) { ; } }
@Test public void testIfThenElseWithElseEmpty() throws Exception { morphline = createMorphline("test-morphlines/ifThenElseWithElseEmpty"); Record record = createBasicRecord(); processAndVerifySuccess(record, record); assertEquals("init1", collector.getFirstRecord().getFirstValue("state")); }
@Test public void testIfThenElseWithThenEmpty() throws Exception { morphline = createMorphline("test-morphlines/ifThenElseWithThenEmpty"); Record record = createBasicRecord(); processAndVerifySuccess(record, record); assertEquals("init1", collector.getFirstRecord().getFirstValue("state")); }
@Test public void testIfThenElseWithElse() throws Exception { morphline = createMorphline("test-morphlines/ifThenElseWithElse"); Record record = createBasicRecord(); processAndVerifySuccess(record, record); assertEquals("else1", collector.getFirstRecord().getFirstValue("state")); }
@Test public void testIfThenElseWithThenAndNot() throws Exception { morphline = createMorphline("test-morphlines/ifThenElseWithThenAndNot"); Record record = createBasicRecord(); processAndVerifySuccess(record, record); assertEquals("then1", collector.getFirstRecord().getFirstValue("state")); }
@Test public void testIfThenElseWithThen() throws Exception { morphline = createMorphline("test-morphlines/ifThenElseWithThen"); Record record = createBasicRecord(); processAndVerifySuccess(record, record); assertEquals("then1", collector.getFirstRecord().getFirstValue("state")); }
@Test public void testNotWithTrue() throws Exception { morphline = createMorphline("test-morphlines/notWithTrue"); Record record = createBasicRecord(); startSession(); assertEquals(1, collector.getNumStartEvents()); assertFalse(morphline.process(record)); assertEquals(Lists.newArrayList(), collector.getRecords()); }
@Test public void testNotWithFalse() throws Exception { morphline = createMorphline("test-morphlines/notWithFalse"); Record record = createBasicRecord(); startSession(); assertEquals(1, collector.getNumStartEvents()); assertTrue(morphline.process(record)); assertEquals(record, collector.getFirstRecord()); assertSame(record, collector.getFirstRecord()); }
@Test public void testNotWithFalseWithContinuation() throws Exception { morphline = createMorphline("test-morphlines/notWithFalseAndContinuation"); Record record = createBasicRecord(); startSession(); assertEquals(1, collector.getNumStartEvents()); assertTrue(morphline.process(record)); assertEquals(record, collector.getFirstRecord()); assertSame(record, collector.getFirstRecord()); assertEquals("touched", collector.getFirstRecord().getFirstValue("state")); }