Package com.opengamma.web.analytics.push

Examples of com.opengamma.web.analytics.push.WebPushTestUtils


    assertEquals(0, json.length());
  }

  @Test
  public void getJsonOverHttp() throws Exception {
    WebPushTestUtils _webPushTestUtils = new WebPushTestUtils();
    Pair<Server, WebApplicationContext> serverAndContext =
        _webPushTestUtils.createJettyServer("classpath:/com/opengamma/web/analytics/push/marketdatasnapshotlist-test.xml");
    Server server = serverAndContext.getFirst();
    WebApplicationContext context = serverAndContext.getSecond();
    InMemorySnapshotMaster snapshotMaster = context.getBean(InMemorySnapshotMaster.class);
    snapshotMaster.add(createSnapshot("basisView1", "snap1", null));
    JSONArray json = new JSONArray(_webPushTestUtils.readFromPath("/jax/marketdatasnapshots"));
    assertEquals(1, json.length());
    JSONObject basis1Map = json.getJSONObject(0);
    assertEquals("basisView1", basis1Map.get(BASIS_VIEW_NAME));
    JSONArray snapshots = basis1Map.getJSONArray(SNAPSHOTS);
    assertEquals(1, snapshots.length());
View Full Code Here


* 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);
    }
  }
View Full Code Here

TOP

Related Classes of com.opengamma.web.analytics.push.WebPushTestUtils

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.