@Test public void testStateMigratedFromLocalFile() throws Exception { final ConcreteListProcessor proc = new ConcreteListProcessor(); final TestRunner runner = TestRunners.newTestRunner(proc); File persistenceFile = testFolder.newFile(proc.persistenceFilename); proc.persistenceFile = persistenceFile; final String serviceState = proc.getPath(runner.getProcessContext()) + "={\"latestTimestamp\":1492,\"matchingIdentifiers\":[\"id\"]}"; try (FileOutputStream fos = new FileOutputStream(persistenceFile);) { fos.write(serviceState.getBytes(Charsets.UTF_8)); } runner.run(); Assert.assertTrue("Failed to remove persistence file", !persistenceFile.exists()); final Map<String, String> expectedState = new HashMap<>(); expectedState.put(AbstractListProcessor.LISTING_TIMESTAMP_KEY, "1492"); expectedState.put(AbstractListProcessor.PROCESSED_TIMESTAMP_KEY, "1492"); runner.getStateManager().assertStateEquals(expectedState, Scope.CLUSTER); }
protected abstract String getPath(final ProcessContext context);
AbstractListProcessor extends AbstractProcessor { protected abstract String getPath(final ProcessContext context); }
AbstractListProcessor extends AbstractProcessor { protected abstract String getPath(final ProcessContext context);  }
AbstractListProcessor extends AbstractProcessor { protected abstract String getPath(final ProcessContext context);  @Override void onPropertyModified(final PropertyDescriptor descriptor, final String oldValue, final String newValue); @Override Set<Relationship> getRelationships(); @OnPrimaryNodeStateChange void onPrimaryNodeChange(final PrimaryNodeState newState); @OnScheduled final void updateState(final ProcessContext context); @Override void onTrigger(final ProcessContext context, final ProcessSession session); }
AbstractListProcessor extends AbstractProcessor { protected abstract String getPath(final ProcessContext context);  @Override void onPropertyModified(final PropertyDescriptor descriptor, final String oldValue, final String newValue); @Override Set<Relationship> getRelationships(); @OnPrimaryNodeStateChange void onPrimaryNodeChange(final PrimaryNodeState newState); @OnScheduled final void updateState(final ProcessContext context); @Override void onTrigger(final ProcessContext context, final ProcessSession session); static final PropertyDescriptor DISTRIBUTED_CACHE_SERVICE; static final Relationship REL_SUCCESS; }