use of com.quorum.tessera.api.StoreRawRequest in project tessera by ConsenSys.
the class RawTransactionResourceTest method store.
@Test
public void store() {
com.quorum.tessera.transaction.StoreRawResponse response = mock(com.quorum.tessera.transaction.StoreRawResponse.class);
MessageHash transactionHash = mock(MessageHash.class);
when(transactionHash.getHashBytes()).thenReturn("TXN".getBytes());
when(response.getHash()).thenReturn(transactionHash);
when(transactionManager.store(any())).thenReturn(response);
final StoreRawRequest storeRawRequest = new StoreRawRequest();
storeRawRequest.setPayload("PAYLOAD".getBytes());
storeRawRequest.setFrom("Sender".getBytes());
final Response result = transactionResource.store(storeRawRequest);
assertThat(result.getStatus()).isEqualTo(200);
verify(transactionManager).store(any());
}
use of com.quorum.tessera.api.StoreRawRequest in project tessera by ConsenSys.
the class RawTransactionResourceTest method storeVersion21.
@Test
public void storeVersion21() {
com.quorum.tessera.transaction.StoreRawResponse response = mock(com.quorum.tessera.transaction.StoreRawResponse.class);
MessageHash transactionHash = mock(MessageHash.class);
when(transactionHash.getHashBytes()).thenReturn("TXN".getBytes());
when(response.getHash()).thenReturn(transactionHash);
when(transactionManager.store(any())).thenReturn(response);
final StoreRawRequest storeRawRequest = new StoreRawRequest();
storeRawRequest.setPayload("PAYLOAD".getBytes());
storeRawRequest.setFrom("Sender".getBytes());
final Response result = transactionResource.storeVersion21(storeRawRequest);
assertThat(result.getStatus()).isEqualTo(200);
verify(transactionManager).store(any());
}
use of com.quorum.tessera.api.StoreRawRequest in project tessera by ConsenSys.
the class RawTransactionResourceTest method storeUsingDefaultKeyVersion21.
@Test
public void storeUsingDefaultKeyVersion21() {
com.quorum.tessera.transaction.StoreRawResponse response = mock(com.quorum.tessera.transaction.StoreRawResponse.class);
MessageHash transactionHash = mock(MessageHash.class);
when(transactionHash.getHashBytes()).thenReturn("TXN".getBytes());
when(response.getHash()).thenReturn(transactionHash);
when(transactionManager.store(any())).thenReturn(response);
when(transactionManager.defaultPublicKey()).thenReturn(PublicKey.from("SENDER".getBytes()));
final StoreRawRequest storeRawRequest = new StoreRawRequest();
storeRawRequest.setPayload("PAYLOAD".getBytes());
final Response result = transactionResource.storeVersion21(storeRawRequest);
assertThat(result.getStatus()).isEqualTo(200);
verify(transactionManager).store(any());
verify(transactionManager).defaultPublicKey();
}
use of com.quorum.tessera.api.StoreRawRequest in project tessera by ConsenSys.
the class RawTransactionResourceTest method storeUsingDefaultKey.
@Test
public void storeUsingDefaultKey() {
com.quorum.tessera.transaction.StoreRawResponse response = mock(com.quorum.tessera.transaction.StoreRawResponse.class);
MessageHash transactionHash = mock(MessageHash.class);
when(transactionHash.getHashBytes()).thenReturn("TXN".getBytes());
when(response.getHash()).thenReturn(transactionHash);
when(transactionManager.store(any())).thenReturn(response);
when(transactionManager.defaultPublicKey()).thenReturn(PublicKey.from("SENDER".getBytes()));
final StoreRawRequest storeRawRequest = new StoreRawRequest();
storeRawRequest.setPayload("PAYLOAD".getBytes());
final Response result = transactionResource.store(storeRawRequest);
assertThat(result.getStatus()).isEqualTo(200);
verify(transactionManager).store(any());
verify(transactionManager).defaultPublicKey();
}
Aggregations