@Test public void getNextSequence_shouldFindSequenceWithNextIdIncreasedByOneForExistingSequence() { Sequence existingSequence = new Sequence(ORDER, 10); persistence.create(existingSequence); Sequence sequence = persistence.getNextSequence(existingSequence.getName()); Assert.assertThat(sequence.getIntNextId(), is(11)); }
@Override public synchronized Sequence getNextSequence(@Nonnull final String id) { checkNotNull(id, "Argument[id] must not be null"); Sequence sequence = read(id); if (sequence == null) { sequence = create(new Sequence(ORDER, 1)); } else { sequence.setIntNextId(sequence.getIntNextId() + 1); sequence = update(sequence); } logger.info("Found sequence: {}", sequence); return sequence; }
SequenceBasePersistence extends AbstractBasePersistence<Sequence, String> implements SequenceMapper { @Override public synchronized Sequence getNextSequence(@Nonnull final String id) { checkNotNull(id, "Argument[id] must not be null"); Sequence sequence = read(id); if (sequence == null) { sequence = create(new Sequence(ORDER, 1)); } else { sequence.setIntNextId(sequence.getIntNextId() + 1); sequence = update(sequence); } logger.info("Found sequence: {}", sequence); return sequence; } }
SequenceBasePersistence extends AbstractBasePersistence<Sequence, String> implements SequenceMapper { @Override public synchronized Sequence getNextSequence(@Nonnull final String id) { checkNotNull(id, "Argument[id] must not be null"); Sequence sequence = read(id); if (sequence == null) { sequence = create(new Sequence(ORDER, 1)); } else { sequence.setIntNextId(sequence.getIntNextId() + 1); sequence = update(sequence); } logger.info("Found sequence: {}", sequence); return sequence; }  }
SequenceBasePersistence extends AbstractBasePersistence<Sequence, String> implements SequenceMapper { @Override public synchronized Sequence getNextSequence(@Nonnull final String id) { checkNotNull(id, "Argument[id] must not be null"); Sequence sequence = read(id); if (sequence == null) { sequence = create(new Sequence(ORDER, 1)); } else { sequence.setIntNextId(sequence.getIntNextId() + 1); sequence = update(sequence); } logger.info("Found sequence: {}", sequence); return sequence; }  @Override synchronized Sequence getNextSequence(@Nonnull final String id); }
SequenceBasePersistence extends AbstractBasePersistence<Sequence, String> implements SequenceMapper { @Override public synchronized Sequence getNextSequence(@Nonnull final String id) { checkNotNull(id, "Argument[id] must not be null"); Sequence sequence = read(id); if (sequence == null) { sequence = create(new Sequence(ORDER, 1)); } else { sequence.setIntNextId(sequence.getIntNextId() + 1); sequence = update(sequence); } logger.info("Found sequence: {}", sequence); return sequence; }  @Override synchronized Sequence getNextSequence(@Nonnull final String id);  }