use of com.scalar.db.api.Delete in project scalardb by scalar-labs.
the class GrpcStorageTest method mutate_StubThrowInvalidArgumentError_ShouldThrowIllegalArgumentException.
@Test
public void mutate_StubThrowInvalidArgumentError_ShouldThrowIllegalArgumentException() {
// Arrange
Key partitionKey = new Key("col1", 1);
List<Mutation> mutations = Arrays.asList(new Put(partitionKey), new Delete(partitionKey));
when(blockingStub.mutate(any())).thenThrow(Status.INVALID_ARGUMENT.asRuntimeException());
// Act Assert
assertThatThrownBy(() -> storage.mutate(mutations)).isInstanceOf(IllegalArgumentException.class);
}
use of com.scalar.db.api.Delete in project scalardb by scalar-labs.
the class GrpcStorageTest method delete_isCalledWithProperArguments_StubShouldBeCalledProperly.
@Test
public void delete_isCalledWithProperArguments_StubShouldBeCalledProperly() throws ExecutionException {
// Arrange
Key partitionKey = new Key("col1", 1);
Delete delete = new Delete(partitionKey);
// Act
storage.delete(delete);
// Assert
verify(blockingStub).mutate(any());
}
use of com.scalar.db.api.Delete in project scalardb by scalar-labs.
the class CommitMutationComposerTest method prepareDelete.
private Delete prepareDelete() {
Key partitionKey = new Key(ANY_NAME_1, ANY_TEXT_1);
Key clusteringKey = new Key(ANY_NAME_2, ANY_TEXT_2);
return new Delete(partitionKey, clusteringKey).forNamespace(ANY_NAMESPACE_NAME).forTable(ANY_TABLE_NAME);
}
use of com.scalar.db.api.Delete in project scalardb by scalar-labs.
the class ConsensusCommitTest method delete_TwoDeletesGiven_ShouldCallCrudHandlerDeleteTwice.
@Test
public void delete_TwoDeletesGiven_ShouldCallCrudHandlerDeleteTwice() {
// Arrange
Delete delete = prepareDelete();
doNothing().when(crud).delete(delete);
// Act Assert
consensus.delete(Arrays.asList(delete, delete));
// Assert
verify(crud, times(2)).delete(delete);
}
use of com.scalar.db.api.Delete in project scalardb by scalar-labs.
the class ConsensusCommitTest method prepareDelete.
private Delete prepareDelete() {
Key partitionKey = new Key(ANY_NAME_1, ANY_TEXT_1);
Key clusteringKey = new Key(ANY_NAME_2, ANY_TEXT_2);
return new Delete(partitionKey, clusteringKey).forNamespace(ANY_NAMESPACE).forTable(ANY_TABLE_NAME);
}
Aggregations