@Test public void testStateMigratedFromLocalFile() throws Exception { 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(StandardCharsets.UTF_8)); } runner.run(); Assert.assertTrue("Failed to remove persistence file", !persistenceFile.exists()); final Map<String, String> expectedState = new HashMap<>(); expectedState.put(AbstractListProcessor.LATEST_LISTED_ENTRY_TIMESTAMP_KEY, "1492"); expectedState.put(AbstractListProcessor.LAST_PROCESSED_LATEST_ENTRY_TIMESTAMP_KEY, "1492"); expectedState.put(AbstractListProcessor.IDENTIFIER_PREFIX + ".0", "id"); 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);  File getPersistenceFile(); @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);  File getPersistenceFile(); @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 AllowableValue PRECISION_AUTO_DETECT; static final AllowableValue PRECISION_MILLIS; static final AllowableValue PRECISION_SECONDS; static final AllowableValue PRECISION_MINUTES; static final PropertyDescriptor TARGET_SYSTEM_TIMESTAMP_PRECISION; static final Relationship REL_SUCCESS; static final Map<TimeUnit, Long> LISTING_LAG_MILLIS; }