* Tests getting analytics as CSV from a real engine. Requires an engine running on {@code localhost}.
*/
public class AnalyticsCsvTest {
public static void main(String[] args) throws IOException, JSONException, InterruptedException {
WebPushTestUtils _webPushTestUtils = new WebPushTestUtils();
String clientId = _webPushTestUtils.handshake();
String viewDefJson = "{" +
"\"viewDefinitionName\": \"Single Swap Test View\", " +
//"\"snapshotId\": \"Tst~123\", " + // use live data
"\"portfolioViewport\": {" +
"\"rowIds\": [0, 1, 2, 3], " +
"\"lastTimestamps\": [null, null, null, null], " +
"\"dependencyGraphCells\": [[0, 0], [1, 2]]" +
"}," +
"\"primitivesViewport\": {" +
"\"rowIds\": [0, 1, 2, 3], " +
"\"lastTimestamps\": [null, null, null, null], " +
"\"dependencyGraphCells\": [[0, 0]]" +
"}" +
"}";
String viewportUrl = _webPushTestUtils.createViewport(clientId, viewDefJson);
//noinspection InfiniteLoopStatement
while (true) {
String csv = _webPushTestUtils.readFromPath(viewportUrl + "/report/csv");
System.out.println(csv);
Thread.sleep(2000);
}
}