use of com.palantir.atlasdb.schema.stream.generated.StreamTestStreamStore in project atlasdb by palantir.
the class StreamTest method testStreamMetadataConflictWriteFirst.
@Test
public void testStreamMetadataConflictWriteFirst() throws Exception {
long streamId = timestampService.getFreshTimestamp();
runConflictingTasksConcurrently(streamId, new TwoConflictingTasks() {
@Override
public void startFirstAndFail(Transaction tx, long streamId) {
DeletingStreamStore deletingStreamStore = new DeletingStreamStore(StreamTestStreamStore.of(txManager, StreamTestTableFactory.of()));
deletingStreamStore.deleteStreams(tx, ImmutableSet.of(streamId));
}
@Override
public void startSecondAndFinish(Transaction tx, long streamId) {
StreamTestStreamStore ss = StreamTestStreamStore.of(txManager, StreamTestTableFactory.of());
ss.storeStreams(tx, ImmutableMap.of(streamId, new ByteArrayInputStream(new byte[1])));
}
});
Optional<InputStream> stream = getStream(streamId);
assertTrue(stream.isPresent());
assertNotNull(stream.get());
}
use of com.palantir.atlasdb.schema.stream.generated.StreamTestStreamStore in project atlasdb by palantir.
the class StreamTest method testStreamMetadataConflictDeleteFirst.
@Test
public void testStreamMetadataConflictDeleteFirst() throws Exception {
long streamId = timestampService.getFreshTimestamp();
runConflictingTasksConcurrently(streamId, new TwoConflictingTasks() {
@Override
public void startFirstAndFail(Transaction tx, long streamId) {
StreamTestStreamStore ss = StreamTestStreamStore.of(txManager, StreamTestTableFactory.of());
ss.storeStreams(tx, ImmutableMap.of(streamId, new ByteArrayInputStream(new byte[1])));
}
@Override
public void startSecondAndFinish(Transaction tx, long streamId) {
DeletingStreamStore deletingStreamStore = new DeletingStreamStore(StreamTestStreamStore.of(txManager, StreamTestTableFactory.of()));
deletingStreamStore.deleteStreams(tx, ImmutableSet.of(streamId));
}
});
assertStreamDoesNotExist(streamId);
}
Aggregations