@Test public void testMigrateFrom100To110() throws IOException { runner.setProperty(TailFile.FILENAME, "target/existing-log.txt"); final MockStateManager stateManager = runner.getStateManager(); final Map<String, String> state = new HashMap<>(); state.put("filename", "target/existing-log.txt"); state.put("checksum", "2279929157"); state.put("position", "14"); state.put("timestamp", "1480639134000"); stateManager.setState(state, Scope.LOCAL); runner.run(); runner.assertAllFlowFilesTransferred(TailFile.REL_SUCCESS, 1); final MockFlowFile flowFile = runner.getFlowFilesForRelationship(TailFile.REL_SUCCESS).iterator().next(); final ByteArrayOutputStream bos = new ByteArrayOutputStream(); try (final BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(bos))) { writer.write("Line 3"); writer.newLine(); } flowFile.assertContentEquals(bos.toByteArray()); final StateMap updatedState = stateManager.getState(Scope.LOCAL); assertNull(updatedState.get("filename")); assertNull(updatedState.get("checksum")); assertNull(updatedState.get("position")); assertNull(updatedState.get("timestamp")); assertEquals("target/existing-log.txt", updatedState.get("file.0.filename")); assertEquals("3380848603", updatedState.get("file.0.checksum")); assertEquals("21", updatedState.get("file.0.position")); assertNotNull(updatedState.get("file.0.timestamp")); runner.clearTransferState(); runner.run(); runner.assertAllFlowFilesTransferred(TailFile.REL_SUCCESS, 0); }
Map<String, TailFileObject> getState() { return states; }
TailFile extends AbstractProcessor { Map<String, TailFileObject> getState() { return states; } }
TailFile extends AbstractProcessor { Map<String, TailFileObject> getState() { return states; }  }
TailFile extends AbstractProcessor { Map<String, TailFileObject> getState() { return states; }  @Override Set<Relationship> getRelationships(); @Override void onPropertyModified(final PropertyDescriptor descriptor, final String oldValue, final String newValue); @OnScheduled void recoverState(final ProcessContext context); @OnStopped void cleanup(); @Override void onTrigger(final ProcessContext context, final ProcessSession session); }
TailFile extends AbstractProcessor { Map<String, TailFileObject> getState() { return states; }  @Override Set<Relationship> getRelationships(); @Override void onPropertyModified(final PropertyDescriptor descriptor, final String oldValue, final String newValue); @OnScheduled void recoverState(final ProcessContext context); @OnStopped void cleanup(); @Override void onTrigger(final ProcessContext context, final ProcessSession session);  }