Package com.voyagegames.java.tracking

Examples of com.voyagegames.java.tracking.AppEvent


  @Test
  public void testDispatchIAccumulator() {
    final BasicAccumulator acc = new BasicAccumulator();
    final JsonDispatcherConfig config = new JsonDispatcherConfig();
    final TestDispatchCallback callback = new TestDispatchCallback();
    final AppEvent event = new AppEvent("testkey", "testvalue");

    acc.trackAppEvent(event);
    config.callback = callback;
    config.url = "testurl";
    config.debugMode = true;
   
    final JsonDispatcher disp = new JsonDispatcher(config);
   
    assertTrue(!callback.errorCalled);
    assertTrue(null == callback.output);
    assertTrue(disp.dispatch(acc));
    assertTrue(null != callback.output);
   
    final String output = "{\"data\":[" + event.toJSON() + "]}";
    assertTrue(output.length() > callback.output.length);
  }
View Full Code Here


  @Test
  public void testDispatchIAccumulator_noCompression() {
    final BasicAccumulator acc = new BasicAccumulator();
    final JsonDispatcherConfig config = new JsonDispatcherConfig();
    final TestDispatchCallback callback = new TestDispatchCallback();
    final AppEvent event = new AppEvent("testkey", "testvalue");

    acc.trackAppEvent(event);
    config.callback = callback;
    config.url = "testurl";
    config.debugMode = true;
    config.useCompression = false;
   
    final JsonDispatcher disp = new JsonDispatcher(config);
   
    assertTrue(!callback.errorCalled);
    assertTrue(null == callback.output);
    assertTrue(disp.dispatch(acc));
    assertTrue(!callback.errorCalled);
   
    try {
      final String output = "{\"data\":[" + event.toJSON() + "]}";
      assertArrayEquals(output.getBytes("UTF-8"), callback.output);
    } catch (UnsupportedEncodingException e) {
      e.printStackTrace();
      assertTrue(false);
    }
View Full Code Here

  @Test
  public void testDispatchIAccumulator_withHeader() {
    final BasicAccumulator acc = new BasicAccumulator();
    final JsonDispatcherConfig config = new JsonDispatcherConfig();
    final TestDispatchCallback callback = new TestDispatchCallback();
    final AppEvent header = new AppEvent("testheader", "testheadervalue");
    final AppEvent event = new AppEvent("testkey", "testvalue");

    acc.trackAppEvent(event);
    config.callback = callback;
    config.url = "testurl";
    config.debugMode = true;
    config.useCompression = false;
    config.trackingHeader.add(header);
   
    final JsonDispatcher disp = new JsonDispatcher(config);
   
    assertTrue(!callback.errorCalled);
    assertTrue(null == callback.output);
    assertTrue(disp.dispatch(acc));
    assertTrue(!callback.errorCalled);
   
    try {
      final String output = "{\"data\":[" + header.toJSON() + "," + event.toJSON() + "]}";
      assertArrayEquals(output.getBytes("UTF-8"), callback.output);
    } catch (UnsupportedEncodingException e) {
      e.printStackTrace();
      assertTrue(false);
    }
View Full Code Here

  public void testDispatchIAccumulator_noUrl() {
    final BasicAccumulator acc = new BasicAccumulator();
    final JsonDispatcherConfig config = new JsonDispatcherConfig();
    final TestDispatchCallback callback = new TestDispatchCallback();

    acc.trackAppEvent(new AppEvent("testkey", "testvalue"));
    config.callback = callback;
   
    final JsonDispatcher disp = new JsonDispatcher(config);
   
    assertTrue(!callback.errorCalled);
View Full Code Here

  public void testDispatchIAccumulator_maxUploadSize() {
    final BasicAccumulator acc = new BasicAccumulator();
    final JsonDispatcherConfig config = new JsonDispatcherConfig();
    final TestDispatchCallback callback = new TestDispatchCallback();

    acc.trackAppEvent(new AppEvent("testkey", "testvalue"));
    config.callback = callback;
    config.url = "testurl";
    config.maxUploadSize = 1;
   
    final JsonDispatcher disp = new JsonDispatcher(config);
View Full Code Here

    }
   
  }
 
  private void trackValue(Tracker<?, ?> tracker) {
    tracker.trackAppEvent(new AppEvent("testkey", "testvalue"));
  }
View Full Code Here

  @Test
  public void testTrackAppEvent() {
    final TestAccumulator acc = new TestAccumulator();
    final TestDispatcher disp = new TestDispatcher();
    final Tracker<?, ?> tracker = new Tracker<TestAccumulator, TestDispatcher>(acc, disp);
    final AppEvent data = new AppEvent("testkey", "testvalue");

    assertTrue(0 == acc.getTrackingData().size());
    tracker.trackAppEvent(data);
    assertTrue(1 == acc.getTrackingData().size());
    assertTrue(data == acc.getTrackingData().get(0));
View Full Code Here

  @Test
  public void testGetTrackingData() {
    final BasicAccumulator acc = new BasicAccumulator();
   
    assertTrue(0 == acc.getTrackingData().size());
    acc.trackAppEvent(new AppEvent("testkey", "testvalue"));
    assertTrue(1 == acc.getTrackingData().size());
  }
View Full Code Here

  @Test
  public void testResetTrackingData() {
    final BasicAccumulator acc = new BasicAccumulator();
   
    assertTrue(0 == acc.getTrackingData().size());
    acc.trackAppEvent(new AppEvent("testkey", "testvalue"));
    assertTrue(1 == acc.getTrackingData().size());
    acc.resetTrackingData();
    assertTrue(0 == acc.getTrackingData().size());
  }
View Full Code Here

  }

  @Test
  public void testTrackAppEvent() {
    final BasicAccumulator acc = new BasicAccumulator();
    final AppEvent data = new AppEvent("testkey", "testvalue");
   
    assertTrue(0 == acc.getTrackingData().size());
    acc.trackAppEvent(data);
    assertTrue(1 == acc.getTrackingData().size());
    assertTrue(data == acc.getTrackingData().get(0));
View Full Code Here

TOP

Related Classes of com.voyagegames.java.tracking.AppEvent

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.