AtomicCounterEditor extends DefaultEditor { @Override public void propertyAdded(final PropertyState after) throws CommitFailedException { if (shallWeProcessProperty(after, path, builder)) { setUniqueCounter(after.getValue(LONG)); builder.removeProperty(PROP_INCREMENT); } } AtomicCounterEditor(@NotNull final NodeBuilder builder, 
                               @Nullable String instanceId,
                               @Nullable ScheduledExecutorService executor,
                               @Nullable NodeStore store,
                               @Nullable Whiteboard board); private  AtomicCounterEditor(final String path, 
                                final NodeBuilder builder, 
                                @Nullable String instanceId, 
                                @Nullable ScheduledExecutorService executor,
                                @Nullable NodeStore store,
                                @Nullable Whiteboard board); static void consolidateCount(@NotNull final NodeBuilder builder); @Override void propertyAdded(final PropertyState after); @Override Editor childNodeAdded(final String name, final NodeState after); @Override Editor childNodeChanged(final String name, 
                                   final NodeState before, 
                                   final NodeState after); @Override void leave(final NodeState before, final NodeState after); static final String PROP_INCREMENT; static final String PROP_COUNTER; static final String PREFIX_PROP_COUNTER; static final String PREFIX_PROP_REVISION; }
@Test public void increment() throws CommitFailedException { NodeBuilder builder; Editor editor; builder = EMPTY_NODE.builder(); editor = new AtomicCounterEditor(builder, null, null, null, null); editor.propertyAdded(INCREMENT_BY_1); assertNoCounters(builder.getProperties()); builder = EMPTY_NODE.builder(); builder = setMixin(builder); editor = new AtomicCounterEditor(builder, null, null, null, null); editor.propertyAdded(INCREMENT_BY_1); assertNull("the oak:increment should never be set", builder.getProperty(PROP_INCREMENT)); assertTotalCountersValue(builder.getProperties(), 1); }