Package com.google.sitebricks.stat.testservices

Examples of com.google.sitebricks.stat.testservices.DummyService


    });
  }

  @Test
  public final void testPublishingStatsInDummyService() {
    DummyService service = injector.getInstance(DummyService.class);

    service.call();
    service.call();
    service.call();

    Stats stats = injector.getInstance(Stats.class);
    ImmutableMap<StatDescriptor, Object> snapshot = stats.snapshot();

    assertEquals(snapshot.size(), 2);

    // Here we check the value of the field, NUMBER_OF_CALLS
    StatDescriptor numberOfCallsDescriptor =
        getByName(DummyService.NUMBER_OF_CALLS, snapshot);
    String numberOfCallsValue = (String) snapshot.get(numberOfCallsDescriptor);
    assertEquals(String.valueOf(service.getCalls()), numberOfCallsValue);

    // Here we check the value of the method, CALL_LATENCY_NS
    StatDescriptor callLatencyNsDescriptor =
        getByName(DummyService.CALL_LATENCY_NS, snapshot);
    String callLatencyValue = (String) snapshot.get(callLatencyNsDescriptor);
    assertEquals(service.getCallLatencyMs().toString(), callLatencyValue);
  }
View Full Code Here


        numberOfStaticCallsValue);
  }

  @Test
  public final void testPublishingDuplicatedStat() {
    DummyService service1 = injector.getInstance(DummyService.class);
    DummyService service2 = injector.getInstance(DummyService.class);

    service1.call();
    service2.call();

    Stats stats = injector.getInstance(Stats.class);
    ImmutableMap<StatDescriptor, Object> snapshot = stats.snapshot();

    assertEquals(2, snapshot.size(), snapshot.toString());
View Full Code Here

    });
  }

  @Test
  public final void testPublishingStatsInDummyService() {
    DummyService service = injector.getInstance(DummyService.class);

    service.call();
    service.call();
    service.call();

    Stats stats = injector.getInstance(Stats.class);
    ImmutableMap<StatDescriptor, Object> snapshot = stats.snapshot();

    assertEquals(snapshot.size(), 2);
View Full Code Here

        numberOfStaticCallsValue);
  }

  @Test
  public final void testPublishingDuplicatedStat() {
    DummyService service1 = injector.getInstance(DummyService.class);
    DummyService service2 = injector.getInstance(DummyService.class);

    service1.call();
    service2.call();

    Stats stats = injector.getInstance(Stats.class);
    ImmutableMap<StatDescriptor, Object> snapshot = stats.snapshot();

    assertEquals(2, snapshot.size(), snapshot.toString());
View Full Code Here

TOP

Related Classes of com.google.sitebricks.stat.testservices.DummyService

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.