use of org.xel.http.APICall in project elastic-core-maven by OrdinaryDude.
the class TestGetVoterPhasedTransactions method transactionLookupAfterVote.
@Test
public void transactionLookupAfterVote() {
APICall apiCall = new TwoPhasedMoneyTransferBuilder().build();
JSONObject transactionJSON = TestCreateTwoPhased.issueCreateTwoPhased(apiCall, false);
String transactionFullHash = (String) transactionJSON.get("fullHash");
generateBlock();
long fee = Constants.ONE_NXT;
apiCall = new APICall.Builder("approveTransaction").param("secretPhrase", CHUCK.getSecretPhrase()).param("transactionFullHash", transactionFullHash).param("feeNQT", fee).build();
JSONObject response = apiCall.invoke();
Logger.logMessage("approvePhasedTransactionResponse:" + response.toJSONString());
generateBlock();
response = getVoterPhasedTransactions().invoke();
Logger.logMessage("getVoterPhasedTransactionsResponse:" + response.toJSONString());
JSONArray transactionsJson = (JSONArray) response.get("transactions");
Assert.assertFalse(TwoPhasedSuite.searchForTransactionId(transactionsJson, transactionFullHash));
}
use of org.xel.http.APICall in project elastic-core-maven by OrdinaryDude.
the class TestCastVote method validVoteCasting.
@Test
public void validVoteCasting() {
APICall apiCall = new CreatePollBuilder().build();
String poll = TestCreatePoll.issueCreatePoll(apiCall, false);
generateBlock();
apiCall = new APICall.Builder("castVote").param("secretPhrase", ALICE.getSecretPhrase()).param("poll", poll).param("vote00", 1).param("vote01", 0).param("feeNQT", Constants.ONE_NXT).build();
JSONObject response = apiCall.invoke();
Logger.logMessage("voteCasting:" + response.toJSONString());
Assert.assertNull(response.get("error"));
generateBlock();
apiCall = new APICall.Builder("getPollResult").param("poll", poll).build();
JSONObject getPollResponse = apiCall.invoke();
Logger.logMessage("getPollResultResponse:" + getPollResponse.toJSONString());
JSONArray results = (JSONArray) getPollResponse.get("results");
long ringoResult = Long.parseLong(getResult(results, 0));
Assert.assertEquals(1, ringoResult);
long paulResult = Long.parseLong(getResult(results, 1));
Assert.assertEquals(0, paulResult);
// John's result is empty by spec
Assert.assertEquals("", getResult(results, 2));
}
use of org.xel.http.APICall in project elastic-core-maven by OrdinaryDude.
the class TestCastVote method invalidVoteCasting.
@Test
public void invalidVoteCasting() {
APICall apiCall = new CreatePollBuilder().build();
String poll = TestCreatePoll.issueCreatePoll(apiCall, false);
generateBlock();
apiCall = new APICall.Builder("castVote").param("secretPhrase", ALICE.getSecretPhrase()).param("poll", poll).param("vote1", 1).param("vote2", 1).param("vote3", 1).param("feeNQT", Constants.ONE_NXT).build();
JSONObject response = apiCall.invoke();
Logger.logMessage("voteCasting:" + response.toJSONString());
Assert.assertNotNull(response.get("error"));
}
use of org.xel.http.APICall in project elastic-core-maven by OrdinaryDude.
the class PhasingOnlyTest method setPhasingOnlyControl.
private void setPhasingOnlyControl(VotingModel votingModel, String holdingId, Long quorum, Long minBalance, MinBalanceModel minBalanceModel, long[] whitelist, long maxFees, int minDuration, int maxDuration) {
Builder builder = new ACTestUtils.Builder("setPhasingOnlyControl", ALICE.getSecretPhrase());
setControlPhasingParams(builder, votingModel, holdingId, quorum, minBalance, minBalanceModel, whitelist, maxFees, minDuration, maxDuration);
APICall apiCall = builder.build();
JSONObject response = apiCall.invoke();
Logger.logMessage("setPhasingOnlyControl response: " + response.toJSONString());
String result = (String) response.get("transaction");
Assert.assertNotNull(result);
generateBlock();
}
use of org.xel.http.APICall in project elastic-core-maven by OrdinaryDude.
the class TestCreateTwoPhased method validMoneyTransfer.
@Test
public void validMoneyTransfer() {
APICall apiCall = new TwoPhasedMoneyTransferBuilder().build();
issueCreateTwoPhased(apiCall, false);
}
Aggregations