use of ai.grakn.rpc.generated.GrpcGrakn.Open in project grakn by graknlabs.
the class GrpcServerTest method whenSendingDeleteRequest_CallDeleteOnEmbeddedTx.
@Test
public void whenSendingDeleteRequest_CallDeleteOnEmbeddedTx() {
Open open = Open.newBuilder().setKeyspace(convert(MYKS)).setTxType(TxType.Write).build();
blockingStub.delete(deleteRequest(open));
verify(tx).delete();
}
use of ai.grakn.rpc.generated.GrpcGrakn.Open in project grakn by graknlabs.
the class GrpcServerTest method whenSendingDeleteRequestWithInvalidKeyspace_CallDeleteOnEmbeddedTx.
@Test
public void whenSendingDeleteRequestWithInvalidKeyspace_CallDeleteOnEmbeddedTx() {
GrpcGrakn.Keyspace keyspace = GrpcGrakn.Keyspace.newBuilder().setValue("not!@akeyspace").build();
Open open = Open.newBuilder().setKeyspace(keyspace).setTxType(TxType.Write).build();
String message = GraknTxOperationException.invalidKeyspace("not!@akeyspace").getMessage();
exception.expect(hasStatus(Status.UNKNOWN.withDescription(message)));
exception.expect(hasMetadata(ErrorType.KEY, ErrorType.GRAKN_TX_OPERATION_EXCEPTION));
blockingStub.delete(deleteRequest(open));
}
use of ai.grakn.rpc.generated.GrpcGrakn.Open in project grakn by graknlabs.
the class GrpcServerTest method whenOpeningATransactionRemotelyWithAnInvalidKeyspace_Throw.
@Test
public void whenOpeningATransactionRemotelyWithAnInvalidKeyspace_Throw() throws Throwable {
GrpcGrakn.Keyspace keyspace = GrpcGrakn.Keyspace.newBuilder().setValue("not!@akeyspace").build();
Open open = Open.newBuilder().setKeyspace(keyspace).setTxType(TxType.Write).build();
try (TxGrpcCommunicator tx = TxGrpcCommunicator.create(stub)) {
tx.send(TxRequest.newBuilder().setOpen(open).build());
exception.expect(hasStatus(Status.UNKNOWN.withDescription(GraknTxOperationException.invalidKeyspace("not!@akeyspace").getMessage())));
exception.expect(hasMetadata(ErrorType.KEY, ErrorType.GRAKN_TX_OPERATION_EXCEPTION));
throw tx.receive().error();
}
}
Aggregations