CountDecimate extends Decimate { public int getInterval() { return m_interval; } CountDecimate();  CountDecimate(int interval);  CountDecimate(int interval, boolean should_process_last_inputs); int getInterval(); @Override void reset(); @Override CountDecimate duplicate(boolean with_state);  }
@Test public void testSerialization1() throws ProcessorException, PrintException, ReadException { ClonePrinter printer = new ClonePrinter(); CloneReader reader = new CloneReader(); CountDecimate proc = new CountDecimate(5); Object e = printer.print(proc); assertNotNull(e); Object o = reader.read(e); assertNotNull(o); assertTrue(o instanceof CountDecimate); CountDecimate proc2 = (CountDecimate) o; assertFalse(proc == proc2); assertEquals(5, proc2.getInterval()); assertEquals(0, proc2.getInputCount()); assertEquals(0, proc2.getOutputCount()); }
@Test public void testSerialization2() throws ProcessorException, PrintException, ReadException { ClonePrinter printer = new ClonePrinter(); CloneReader reader = new CloneReader(); CountDecimate proc1 = new CountDecimate(4); BlackHole hole = new BlackHole(); Connector.connect(proc1, hole); Pushable p1 = proc1.getPushableInput(); p1.push("0"); p1.push("1"); Object e = printer.print(proc1); assertNotNull(e); Object o = reader.read(e); assertNotNull(o); assertTrue(o instanceof CountDecimate); CountDecimate proc2 = (CountDecimate) o; assertEquals(4, proc2.getInterval()); assertEquals(2, proc2.getInputCount()); assertEquals(1, proc2.getOutputCount()); QueueSink sink2 = new QueueSink(); Connector.connect(proc2, sink2); Pushable p2 = proc2.getPushableInput(); Queue<Object> q2 = sink2.getQueue(); p2.push("2"); assertTrue(q2.isEmpty()); p2.push("3"); assertTrue(q2.isEmpty()); p2.push("4"); assertFalse(q2.isEmpty()); }