Skip to content
This repository was archived by the owner on Aug 30, 2022. It is now read-only.

Commit f429217

Browse files
author
anguyen
committed
Implemented TransactionProcessor and TransactionSession, working on Unit test
1 parent 43caa1d commit f429217

32 files changed

+1271
-59
lines changed

.idea/codeStyles/Project.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

eosiojava/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,6 @@ dependencies {
1717
implementation 'org.bouncycastle:bcprov-jdk15on:1.61'
1818
implementation 'com.google.guava:guava:19.0'
1919
testCompile 'junit:junit:4.12'
20+
testCompile 'org.mockito:mockito-core:2.7.22'
2021
implementation 'org.bitcoinj:bitcoinj-core:0.15.1'
2122
}

eosiojava/src/main/java/one/block/eosiojava/error/ErrorConstants.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,28 @@ public class ErrorConstants {
1717
public static final String INVALID_DER_PRIVATE_KEY = "DER format of private key is incorrect!";
1818
public static final String CHECKSUM_GENERATION_ERROR = "Could not generate checksum!";
1919
public static final String BASE58_ENCODING_ERROR = "Unable to Base58 encode object!";
20+
public static final String TRANSACTION_PROCESSOR_ACTIONS_EMPTY_ERROR_MSG = "Action list can't be empty!";
21+
public static final String TRANSACTION_PROCESSOR_RPC_GET_INFO = "Error happened on calling GetInfo RPC.";
22+
public static final String TRANSACTION_PROCESSOR_PREPARE_RPC_GET_BLOCK = "Error happened on calling GetBlock RPC.";
23+
public static final String TRANSACTION_PROCESSOR_HEAD_BLOCK_TIME_PARSE_ERROR = "Failed to parse head block time";
24+
public static final String TRANSACTION_PROCESSOR_HEAD_BLOCK_TIME_PARSE_NULL_ERROR = "NullPointerException happened on parsing head block time";
25+
public static final String TRANSACTION_PROCESSOR_PREPARE_CLONE_ERROR = "Error happened on cloning transaction.";
26+
public static final String TRANSACTION_PROCESSOR_PREPARE_CLONE_CLASS_NOT_FOUND = "Transaction class was not found";
27+
public static final String TRANSACTION_PROCESSOR_TRANSACTION_HAS_TO_BE_INITIALIZED = "Transaction must be initialized before this method could be called! call prepare for initialize Transaction";
28+
public static final String TRANSACTION_PROCESSOR_GET_ABI_ERROR = "Error happened on getting abi for contract [%s]";
29+
public static final String TRANSACTION_PROCESSOR_SERIALIZE_ACTION_WORKED_BUT_EMPTY_RESULT = "Serialization of action worked fine but got back empty result!";
30+
public static final String TRANSACTION_PROCESSOR_SERIALIZE_TRANSACTION_WORKED_BUT_EMPTY_RESULT = "Serialization of transaction worked fine but got back empty result!";
31+
public static final String TRANSACTION_PROCESSOR_SERIALIZE_ACTION_ERROR = "Error happened on serializing action [%s]";
32+
public static final String TRANSACTION_PROCESSOR_SERIALIZE_TRANSACTION_ERROR = "Error happened on serializing transaction";
33+
public static final String TRANSACTION_PROCESSOR_GET_AVAILABLE_KEY_ERROR = "Error happened on getAvailableKeys from SignatureProvider!";
34+
public static final String TRANSACTION_PROCESSOR_GET_AVAILABLE_KEY_EMPTY = "Signature provider return no available key";
35+
public static final String TRANSACTION_PROCESSOR_RPC_GET_REQUIRED_KEYS = "Error happened on calling getRequiredKeys RPC call.";
36+
public static final String GET_REQUIRED_KEY_RPC_EMPTY_RESULT = "GetRequiredKeys RPC returned no required keys";
37+
public static final String TRANSACTION_PROCESSOR_SIGN_TRANSACTION_ERROR = "Error happened on calling sign transaction of Signature provider";
38+
public static final String TRANSACTION_IS_NOT_ALLOWED_TOBE_MODIFIED = "The transaction is not allowed to be modified but was modified by signature provider!";
39+
public static final String TRANSACTION_PROCESSOR_GET_SIGN_DESERIALIZE_TRANS_ERROR = "Error happened on calling deserializeTransaction to refresh transaction object with new values";
40+
public static final String TRANSACTION_PROCESSOR_RPC_PUSH_TRANSACTION = "Error happened on calling pushTransaction RPC call";
41+
public static final String TRANSACTION_PROCESSOR_SERIALIZE_ERROR = "Error happened on calling serializeTransaction";
42+
public static final String TRANSACTION_PROCESSOR_SIGN_CREATE_SIGN_REQUEST_ERROR = "Error happened on creating signature request for Signature Provider to sign!";
43+
public static final String TRANSACTION_PROCESSOR_BROADCAST_TRANS_ERROR = "Error happened on pushing transaction to chain!";
2044
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package one.block.eosiojava.error.session;
2+
3+
public class TransactionBroadCastError extends TransactionProcessorError {
4+
5+
public TransactionBroadCastError() {
6+
}
7+
8+
public TransactionBroadCastError(String s) {
9+
super(s);
10+
}
11+
12+
public TransactionBroadCastError(String s, Throwable throwable) {
13+
super(s, throwable);
14+
}
15+
16+
public TransactionBroadCastError(Throwable throwable) {
17+
super(throwable);
18+
}
19+
20+
public TransactionBroadCastError(String s, Throwable throwable, boolean b, boolean b1) {
21+
super(s, throwable, b, b1);
22+
}
23+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package one.block.eosiojava.error.session;
2+
3+
public class TransactionCreateSignatureRequestAbiError extends TransactionCreateSignatureRequestError{
4+
5+
public TransactionCreateSignatureRequestAbiError() {
6+
}
7+
8+
public TransactionCreateSignatureRequestAbiError(String s) {
9+
super(s);
10+
}
11+
12+
public TransactionCreateSignatureRequestAbiError(String s, Throwable throwable) {
13+
super(s, throwable);
14+
}
15+
16+
public TransactionCreateSignatureRequestAbiError(Throwable throwable) {
17+
super(throwable);
18+
}
19+
20+
public TransactionCreateSignatureRequestAbiError(String s, Throwable throwable, boolean b, boolean b1) {
21+
super(s, throwable, b, b1);
22+
}
23+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package one.block.eosiojava.error.session;
2+
3+
public class TransactionCreateSignatureRequestEmptyAvailableKey extends TransactionCreateSignatureRequestError {
4+
5+
public TransactionCreateSignatureRequestEmptyAvailableKey() {
6+
}
7+
8+
public TransactionCreateSignatureRequestEmptyAvailableKey(String s) {
9+
super(s);
10+
}
11+
12+
public TransactionCreateSignatureRequestEmptyAvailableKey(String s, Throwable throwable) {
13+
super(s, throwable);
14+
}
15+
16+
public TransactionCreateSignatureRequestEmptyAvailableKey(Throwable throwable) {
17+
super(throwable);
18+
}
19+
20+
public TransactionCreateSignatureRequestEmptyAvailableKey(String s, Throwable throwable, boolean b, boolean b1) {
21+
super(s, throwable, b, b1);
22+
}
23+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package one.block.eosiojava.error.session;
2+
3+
public class TransactionCreateSignatureRequestError extends TransactionProcessorError {
4+
5+
public TransactionCreateSignatureRequestError() {
6+
}
7+
8+
public TransactionCreateSignatureRequestError(String s) {
9+
super(s);
10+
}
11+
12+
public TransactionCreateSignatureRequestError(String s, Throwable throwable) {
13+
super(s, throwable);
14+
}
15+
16+
public TransactionCreateSignatureRequestError(Throwable throwable) {
17+
super(throwable);
18+
}
19+
20+
public TransactionCreateSignatureRequestError(String s, Throwable throwable, boolean b, boolean b1) {
21+
super(s, throwable, b, b1);
22+
}
23+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package one.block.eosiojava.error.session;
2+
3+
public class TransactionCreateSignatureRequestKeyError extends TransactionCreateSignatureRequestError {
4+
5+
public TransactionCreateSignatureRequestKeyError() {
6+
}
7+
8+
public TransactionCreateSignatureRequestKeyError(String s) {
9+
super(s);
10+
}
11+
12+
public TransactionCreateSignatureRequestKeyError(String s, Throwable throwable) {
13+
super(s, throwable);
14+
}
15+
16+
public TransactionCreateSignatureRequestKeyError(Throwable throwable) {
17+
super(throwable);
18+
}
19+
20+
public TransactionCreateSignatureRequestKeyError(String s, Throwable throwable, boolean b, boolean b1) {
21+
super(s, throwable, b, b1);
22+
}
23+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package one.block.eosiojava.error.session;
2+
3+
public class TransactionCreateSignatureRequestRequiredKeysEmptyError extends TransactionCreateSignatureRequestError {
4+
5+
public TransactionCreateSignatureRequestRequiredKeysEmptyError() {
6+
}
7+
8+
public TransactionCreateSignatureRequestRequiredKeysEmptyError(String s) {
9+
super(s);
10+
}
11+
12+
public TransactionCreateSignatureRequestRequiredKeysEmptyError(String s, Throwable throwable) {
13+
super(s, throwable);
14+
}
15+
16+
public TransactionCreateSignatureRequestRequiredKeysEmptyError(Throwable throwable) {
17+
super(throwable);
18+
}
19+
20+
public TransactionCreateSignatureRequestRequiredKeysEmptyError(String s, Throwable throwable, boolean b, boolean b1) {
21+
super(s, throwable, b, b1);
22+
}
23+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package one.block.eosiojava.error.session;
2+
3+
public class TransactionCreateSignatureRequestRpcError extends TransactionCreateSignatureRequestError {
4+
5+
public TransactionCreateSignatureRequestRpcError() {
6+
}
7+
8+
public TransactionCreateSignatureRequestRpcError(String s) {
9+
super(s);
10+
}
11+
12+
public TransactionCreateSignatureRequestRpcError(String s, Throwable throwable) {
13+
super(s, throwable);
14+
}
15+
16+
public TransactionCreateSignatureRequestRpcError(Throwable throwable) {
17+
super(throwable);
18+
}
19+
20+
public TransactionCreateSignatureRequestRpcError(String s, Throwable throwable, boolean b, boolean b1) {
21+
super(s, throwable, b, b1);
22+
}
23+
}

0 commit comments

Comments
 (0)