GameProposal Create test
This commit is contained in:
parent
abc31d4c03
commit
4f5a636909
@ -7,7 +7,9 @@ import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
|
||||
import djmil.cordacheckers.cordaclient.dao.Color;
|
||||
import djmil.cordacheckers.cordaclient.dao.VirtualNode;
|
||||
import djmil.cordacheckers.user.HoldingIdentityResolver;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@ -31,11 +33,34 @@ public class CordaClientTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testListGameProposals() throws JsonProcessingException {
|
||||
void testGameProposalList() throws JsonProcessingException {
|
||||
String resp = cordaClient.listGameProposals(
|
||||
holdingIdentityResolver.getByCommonName("alice"));
|
||||
holdingIdentityResolver.getByUsername("alice"));
|
||||
|
||||
System.out.println("testListGameProposals "+ resp);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testGemeProposalCreate() {
|
||||
final String gpSender = "alice";
|
||||
final String gpReceiver = "bob";
|
||||
final Color gpReceiverColor = Color.WHITE;
|
||||
final String gpMessage = "GameProposal create test";
|
||||
|
||||
final String gpUuid = cordaClient.createGameProposal(
|
||||
holdingIdentityResolver.getByUsername(gpSender),
|
||||
holdingIdentityResolver.getByUsername(gpReceiver),
|
||||
gpReceiverColor,
|
||||
gpMessage
|
||||
);
|
||||
|
||||
String listResSender = cordaClient.listGameProposals(
|
||||
holdingIdentityResolver.getByUsername(gpSender));
|
||||
|
||||
String listResReceiver = cordaClient.listGameProposals(
|
||||
holdingIdentityResolver.getByUsername(gpReceiver));
|
||||
|
||||
assertThat(listResSender).contains(gpUuid);
|
||||
assertThat(listResReceiver).contains(gpUuid);
|
||||
}
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ public class CreateFlow implements ClientStartableFlow{
|
||||
return new GameProposalState(
|
||||
myInfo.getName(),
|
||||
opponentInfo.getName(),
|
||||
GameProposalState.Color.valueOf(args.opponentColor),
|
||||
opponentColor,
|
||||
args.message,
|
||||
UUID.randomUUID(),
|
||||
Arrays.asList(myInfo.getLedgerKeys().get(0), opponentInfo.getLedgerKeys().get(0))
|
||||
@ -120,6 +120,9 @@ public class CreateFlow implements ClientStartableFlow{
|
||||
.finalize(signedTransaction, sessionsList)
|
||||
.getTransaction();
|
||||
|
||||
return finalizedSignedTransaction.getId().toString();
|
||||
|
||||
// final String trxId = finalizedSignedTransaction.getId().toString();
|
||||
|
||||
return gameProposal.id.toString();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user