44import com .r3 .corda .lib .tokens .contracts .types .TokenPointer ;
55import com .r3 .corda .lib .tokens .contracts .types .TokenType ;
66import com .r3 .corda .lib .tokens .money .FiatCurrency ;
7- import com .r3 .corda .lib .tokens .workflows .utilities .QueryUtilitiesKt ;
7+ import com .r3 .corda .lib .tokens .workflows .utilities .QueryUtilities ;
88import net .corda .core .concurrent .CordaFuture ;
99import net .corda .core .contracts .Amount ;
1010import net .corda .core .contracts .StateAndRef ;
@@ -112,7 +112,7 @@ public void tearDown() {
112112 @ Test
113113 public void issueTest () throws ExecutionException , InterruptedException {
114114 // Issue Stock
115- CordaFuture <String > future = company .startFlow (new IssueStock (STOCK_SYMBOL , STOCK_NAME , STOCK_CURRENCY , STOCK_PRICE , ISSUING_STOCK_QUANTITY , notaryParty ));
115+ CordaFuture <String > future = company .startFlow (new CreateAndIssueStock (STOCK_SYMBOL , STOCK_NAME , STOCK_CURRENCY , STOCK_PRICE , ISSUING_STOCK_QUANTITY , notaryParty ));
116116 network .runNetwork ();
117117 String stx = future .get ();
118118
@@ -131,7 +131,7 @@ public void issueTest() throws ExecutionException, InterruptedException {
131131 @ Test
132132 public void moveTest () throws ExecutionException , InterruptedException {
133133 // Issue Stock
134- CordaFuture <String > future = company .startFlow (new IssueStock (STOCK_SYMBOL , STOCK_NAME , STOCK_CURRENCY , STOCK_PRICE , ISSUING_STOCK_QUANTITY , notaryParty ));
134+ CordaFuture <String > future = company .startFlow (new CreateAndIssueStock (STOCK_SYMBOL , STOCK_NAME , STOCK_CURRENCY , STOCK_PRICE , ISSUING_STOCK_QUANTITY , notaryParty ));
135135 network .runNetwork ();
136136 future .get ();
137137
@@ -143,15 +143,15 @@ public void moveTest() throws ExecutionException, InterruptedException {
143143 //Retrieve states from receiver
144144 List <StateAndRef <StockState >> receivedStockStatesPages = shareholder .getServices ().getVaultService ().queryBy (StockState .class ).getStates ();
145145 StockState receivedStockState = receivedStockStatesPages .get (0 ).getState ().getData ();
146- Amount <TokenPointer > receivedAmount = QueryUtilitiesKt .tokenBalance (shareholder .getServices ().getVaultService (), receivedStockState .toPointer (receivedStockState .getClass ()));
146+ Amount <TokenType > receivedAmount = QueryUtilities .tokenBalance (shareholder .getServices ().getVaultService (), receivedStockState .toPointer (receivedStockState .getClass ()));
147147
148148 //Check
149149 assertEquals (receivedAmount .getQuantity (), Long .valueOf (500 ).longValue ());
150150
151151 //Retrieve states from sender
152152 List <StateAndRef <StockState >> remainingStockStatesPages = company .getServices ().getVaultService ().queryBy (StockState .class ).getStates ();
153153 StockState remainingStockState = remainingStockStatesPages .get (0 ).getState ().getData ();
154- Amount <TokenPointer > remainingAmount = QueryUtilitiesKt .tokenBalance (company .getServices ().getVaultService (), remainingStockState .toPointer (remainingStockState .getClass ()));
154+ Amount <TokenType > remainingAmount = QueryUtilities .tokenBalance (company .getServices ().getVaultService (), remainingStockState .toPointer (remainingStockState .getClass ()));
155155
156156 //Check
157157 assertEquals (remainingAmount .getQuantity (), Long .valueOf (1500 ).longValue ());
@@ -161,7 +161,7 @@ public void moveTest() throws ExecutionException, InterruptedException {
161161 @ Test
162162 public void announceDividendTest () throws ExecutionException , InterruptedException {
163163 // Issue Stock
164- CordaFuture <String > future = company .startFlow (new IssueStock (STOCK_SYMBOL , STOCK_NAME , STOCK_CURRENCY , STOCK_PRICE , ISSUING_STOCK_QUANTITY , notaryParty ));
164+ CordaFuture <String > future = company .startFlow (new CreateAndIssueStock (STOCK_SYMBOL , STOCK_NAME , STOCK_CURRENCY , STOCK_PRICE , ISSUING_STOCK_QUANTITY , notaryParty ));
165165 network .runNetwork ();
166166 future .get ();
167167
@@ -199,7 +199,7 @@ public void announceDividendTest() throws ExecutionException, InterruptedExcepti
199199 @ Test
200200 public void getStockUpdateTest () throws ExecutionException , InterruptedException {
201201 // Issue Stock
202- CordaFuture <String > future = company .startFlow (new IssueStock (STOCK_SYMBOL , STOCK_NAME , STOCK_CURRENCY , STOCK_PRICE , ISSUING_STOCK_QUANTITY , notaryParty ));
202+ CordaFuture <String > future = company .startFlow (new CreateAndIssueStock (STOCK_SYMBOL , STOCK_NAME , STOCK_CURRENCY , STOCK_PRICE , ISSUING_STOCK_QUANTITY , notaryParty ));
203203 network .runNetwork ();
204204 future .get ();
205205
@@ -214,7 +214,7 @@ public void getStockUpdateTest() throws ExecutionException, InterruptedException
214214 future .get ();
215215
216216 // Get Stock Update
217- future = shareholder .startFlow (new GetStockUpdate .Initiator (STOCK_SYMBOL ));
217+ future = shareholder .startFlow (new ClaimDividendReceivable .Initiator (STOCK_SYMBOL ));
218218 network .runNetwork ();
219219 future .get ();
220220
@@ -231,7 +231,7 @@ public void getStockUpdateTest() throws ExecutionException, InterruptedException
231231 @ Test
232232 public void claimDividendTest () throws ExecutionException , InterruptedException {
233233 // Issue Stock
234- CordaFuture <String > future = company .startFlow (new IssueStock (STOCK_SYMBOL , STOCK_NAME , STOCK_CURRENCY , STOCK_PRICE , ISSUING_STOCK_QUANTITY , notaryParty ));
234+ CordaFuture <String > future = company .startFlow (new CreateAndIssueStock (STOCK_SYMBOL , STOCK_NAME , STOCK_CURRENCY , STOCK_PRICE , ISSUING_STOCK_QUANTITY , notaryParty ));
235235 network .runNetwork ();
236236 future .get ();
237237
@@ -245,11 +245,6 @@ public void claimDividendTest() throws ExecutionException, InterruptedException
245245 network .runNetwork ();
246246 future .get ();
247247
248- // Shareholder claims Dividend
249- future = shareholder .startFlow (new GetStockUpdate .Initiator (STOCK_SYMBOL ));
250- network .runNetwork ();
251- future .get ();
252-
253248 // Shareholder claims Dividend
254249 future = shareholder .startFlow (new ClaimDividendReceivable .Initiator (STOCK_SYMBOL ));
255250 network .runNetwork ();
@@ -287,7 +282,7 @@ public void payDividendTest() throws ExecutionException, InterruptedException {
287282 future .get ();
288283
289284 // Issue Stock
290- future = company .startFlow (new IssueStock (STOCK_SYMBOL , STOCK_NAME , STOCK_CURRENCY , STOCK_PRICE , ISSUING_STOCK_QUANTITY , notaryParty ));
285+ future = company .startFlow (new CreateAndIssueStock (STOCK_SYMBOL , STOCK_NAME , STOCK_CURRENCY , STOCK_PRICE , ISSUING_STOCK_QUANTITY , notaryParty ));
291286 network .runNetwork ();
292287 future .get ();
293288
@@ -301,11 +296,6 @@ public void payDividendTest() throws ExecutionException, InterruptedException {
301296 network .runNetwork ();
302297 future .get ();
303298
304- // Shareholder claims Dividend
305- future = shareholder .startFlow (new GetStockUpdate .Initiator (STOCK_SYMBOL ));
306- network .runNetwork ();
307- future .get ();
308-
309299 // Shareholder claims Dividend
310300 future = shareholder .startFlow (new ClaimDividendReceivable .Initiator (STOCK_SYMBOL ));
311301 network .runNetwork ();
@@ -331,7 +321,7 @@ public void payDividendTest() throws ExecutionException, InterruptedException {
331321
332322 // Validates shareholder has received equivalent fiat currencies of the dividend
333323 TokenType fiatTokenType = FiatCurrency .Companion .getInstance (STOCK_CURRENCY );
334- Amount <TokenType > fiatAmount = QueryUtilitiesKt .tokenBalance (shareholder .getServices ().getVaultService (), fiatTokenType );
324+ Amount <TokenType > fiatAmount = QueryUtilities .tokenBalance (shareholder .getServices ().getVaultService (), fiatTokenType );
335325 BigDecimal receivingDividend = BigDecimal .valueOf (BUYING_STOCK ).multiply (STOCK_PRICE ).multiply (ANNOUNCING_DIVIDEND );
336326 assertEquals (fiatAmount .getQuantity (), receivingDividend .movePointRight (2 ).longValue ());
337327
0 commit comments