Owner: | |
Cash Account initial balance: | |
Cash Account currency: |
Owner: | 16 |${param.owner} | 17 |
---|---|
Commission: 20 | | ${commission} | 21 |
Stock Symbol: 24 | | 25 | |
Number of Shares: 28 | | 29 | |
Buy | 32 |Sell | 33 |
Username: | 16 |17 | |
---|---|
Password: | 20 |21 | |
47 | | Owner | 48 |Total | 49 |Loyalty Level | 50 |
---|---|---|---|
> | 70 |<%=owner%> | 71 |$<%=currency.format(broker.getTotal())%> | 72 |<%=broker.getLoyalty()%> | 73 |
Symbol | 37 |Shares | 38 |Price | 39 |Date Quoted | 40 |Total | 41 |Commission | 42 |
---|---|---|---|---|---|
<%=symbol%> | 72 |<%=shares%> | 73 |<%=formattedPrice%> | 74 |<%=date%> | 75 |<%=formattedTotal%> | 76 |<%=formattedCommission%> | 77 |
Portfolio Value: | 89 |$<%=currency.format(broker.getTotal())%> | 90 |
---|---|
Loyalty Level: | 93 |${broker.loyalty} | 94 |
Account Balance: | 97 |$<%=currency.format(broker.getBalance())%> | 98 |
Cash Account Balance: | 101 |<%=broker.getCashAccountCurrency()%> <%=currency.format(broker.getCashAccountBalance())%> | 102 |
Total Commissions Paid: | 105 |$<%=currency.format(broker.getCommissions())%> | 106 |
Free Trades Available: | 109 |${broker.free} | 110 |
Sentiment: | 113 |${broker.sentiment} | 114 |
Return On Investment: | 117 |${returnOnInvestment} | 118 |
9 | If not automatically redirected, 10 | click here 11 | to redirect to the Trader UI. 12 |
13 | 14 | 15 | -------------------------------------------------------------------------------- /src/test/java/com/ibm/hybrid/cloud/sample/stocktrader/trader/test/HealthEndpointIT.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2017-2021 IBM Corp, All Rights Reserved 3 | Copyright 2022-2024 Kyndryl, All Rights Reserved 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | package com.ibm.hybrid.cloud.sample.stocktrader.trader.test; 19 | 20 | import static org.junit.Assert.assertTrue; 21 | 22 | import jakarta.ws.rs.client.Client; 23 | import jakarta.ws.rs.client.ClientBuilder; 24 | import jakarta.ws.rs.client.Invocation; 25 | import jakarta.ws.rs.core.Response; 26 | 27 | import org.junit.Test; 28 | 29 | public class HealthEndpointIT { 30 | 31 | private String port = System.getProperty("http.port"); 32 | // private String warContext = System.getProperty("war.name"); 33 | private String liveUrl = "http://localhost:" + port + "/health/live"; 34 | private String readyUrl = "http://localhost:" + port + "/health/ready"; 35 | // private String url = "http://localhost:" + port; 36 | private static final int MAX_RETRY_COUNT = 5; 37 | private static final int SLEEP_TIMEOUT = 3000; 38 | 39 | @Test 40 | public void testLiveEndpoint() throws Exception { 41 | 42 | System.out.println("Testing endpoint " + liveUrl ); 43 | int responseCode = makeRequest(liveUrl); 44 | for(int i = 0; (responseCode != 200) && (i < MAX_RETRY_COUNT); i++) { 45 | System.out.println("Response code : " + responseCode + ", retrying ... (" + i + " of " + MAX_RETRY_COUNT + ")"); 46 | Thread.sleep(SLEEP_TIMEOUT); 47 | responseCode = makeRequest(liveUrl); 48 | } 49 | assertTrue("Incorrect response code: " + responseCode, responseCode == 200); 50 | } 51 | 52 | @Test 53 | public void testReadyEndpoint() throws Exception { 54 | System.out.println("Testing endpoint " + readyUrl); 55 | int responseCode = makeRequest(readyUrl); 56 | for(int i = 0; (responseCode != 200) && (i < MAX_RETRY_COUNT); i++) { 57 | System.out.println("Response code : " + responseCode + ", retrying ... (" + i + " of " + MAX_RETRY_COUNT + ")"); 58 | Thread.sleep(SLEEP_TIMEOUT); 59 | responseCode = makeRequest(readyUrl); 60 | } 61 | assertTrue("Incorrect response code: " + responseCode, responseCode == 200); 62 | } 63 | 64 | private int makeRequest(String urlToTest) { 65 | Client client = ClientBuilder.newClient(); 66 | Invocation.Builder invoBuild = client.target(urlToTest).request(); 67 | Response response = invoBuild.get(); 68 | int responseCode = response.getStatus(); 69 | response.close(); 70 | return responseCode; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/test/java/com/ibm/hybrid/cloud/sample/stocktrader/trader/test/HomePageIT.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2017-2021 IBM Corp, All Rights Reserved 3 | Copyright 2022-2024 Kyndryl, All Rights Reserved 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | package com.ibm.hybrid.cloud.sample.stocktrader.trader.test; 19 | 20 | import static org.junit.Assert.assertTrue; 21 | 22 | import jakarta.ws.rs.client.Client; 23 | import jakarta.ws.rs.client.ClientBuilder; 24 | import jakarta.ws.rs.client.Invocation; 25 | import jakarta.ws.rs.core.Response; 26 | 27 | import org.junit.Test; 28 | 29 | public class HomePageIT { 30 | 31 | private String port = System.getProperty("http.port"); 32 | private String warContext = System.getProperty("war.name"); 33 | 34 | private String url = "http://localhost:" + port + "/" + warContext + "/login"; 35 | private static final int MAX_RETRY_COUNT = 5; 36 | private static final int SLEEP_TIMEOUT = 3000; 37 | 38 | @Test 39 | public void testHomeEndpoint() throws Exception { 40 | 41 | System.out.println("Testing endpoint " + url ); 42 | int responseCode = makeRequest(url); 43 | for(int i = 0; (responseCode != 200) && (i < MAX_RETRY_COUNT); i++) { 44 | System.out.println("Response code : " + responseCode + ", retrying ... (" + i + " of " + MAX_RETRY_COUNT + ")"); 45 | Thread.sleep(SLEEP_TIMEOUT); 46 | responseCode = makeRequest(url); 47 | } 48 | assertTrue("Incorrect response code: " + responseCode, responseCode == 200); 49 | } 50 | 51 | private int makeRequest(String urlToTest) { 52 | Client client = ClientBuilder.newClient(); 53 | Invocation.Builder invoBuild = client.target(urlToTest).request(); 54 | Response response = invoBuild.get(); 55 | int responseCode = response.getStatus(); 56 | response.close(); 57 | return responseCode; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /trigger.txt: -------------------------------------------------------------------------------- 1 | gha trigger 9 2 | rtclauss trigger 1 3 | --------------------------------------------------------------------------------