Package com.google.sitebricks.stat.testservices

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


  }

  @SuppressWarnings("unchecked")
  @Test
  public final void testPublishingUsingDifferentExposers() {
    StatExposerTestingService service =
        injector.getInstance(StatExposerTestingService.class);

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

    Stats stats = injector.getInstance(Stats.class);
    ImmutableMap<StatDescriptor, Object> snapshot = stats.snapshot();
    assertEquals(snapshot.size(), 8, "Snapshot has unexpected size: " + snapshot);

    AtomicInteger atomicIntegerCallCount = service.getCallCount();
    String stringCallCount = String.valueOf(atomicIntegerCallCount);

    StatDescriptor callsDefaultExposerDescriptor = getByName(
        StatExposerTestingService.CALLS_WITH_DEFAULT_EXPOSER, snapshot);
    String callsDefaultExposerValue =
        (String) snapshot.get(callsDefaultExposerDescriptor);
    assertEquals(stringCallCount, callsDefaultExposerValue);

    StatDescriptor callsIdentityExposerDescriptor = getByName(
        StatExposerTestingService.CALLS_WITH_IDENTITY_EXPOSER, snapshot);
    AtomicInteger callsIdentityExposerValue =
        (AtomicInteger) snapshot.get(callsIdentityExposerDescriptor);
    assertEquals(atomicIntegerCallCount.get(), callsIdentityExposerValue.get());

    StatDescriptor callsInferenceExposerDescriptor = getByName(
        StatExposerTestingService.CALLS_WITH_INFERENCE_EXPOSER, snapshot);
    String callsInferenceExposerValue =
        (String) snapshot.get(callsInferenceExposerDescriptor);
    assertEquals(stringCallCount, callsInferenceExposerValue);

    StatDescriptor callsToStringExposerDescriptor = getByName(
        StatExposerTestingService.CALLS_WITH_TO_STRING_EXPOSER, snapshot);
    String callsToStringExposerValue =
        (String) snapshot.get(callsToStringExposerDescriptor);
    assertEquals(stringCallCount, callsToStringExposerValue);

    List<Integer> callsList = service.getCallsList();
    String callsListAsString = String.valueOf(callsList);

    StatDescriptor listDefaultExposerDescriptor = getByName(
        StatExposerTestingService.LIST_WITH_DEFAULT_EXPOSER, snapshot);
    List<Integer> listDefaultExposerValue =
View Full Code Here


  }

  @SuppressWarnings("unchecked")
  @Test
  public final void testPublishingUsingDifferentExposers() {
    StatExposerTestingService service =
        injector.getInstance(StatExposerTestingService.class);

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

    Stats stats = injector.getInstance(Stats.class);
    ImmutableMap<StatDescriptor, Object> snapshot = stats.snapshot();
    assertEquals(snapshot.size(), 8, "Snapshot has unexpected size: " + snapshot);

    AtomicInteger atomicIntegerCallCount = service.getCallCount();
    String stringCallCount = String.valueOf(atomicIntegerCallCount);

    StatDescriptor callsDefaultExposerDescriptor = getByName(
        StatExposerTestingService.CALLS_WITH_DEFAULT_EXPOSER, snapshot);
    String callsDefaultExposerValue =
        (String) snapshot.get(callsDefaultExposerDescriptor);
    assertEquals(stringCallCount, callsDefaultExposerValue);

    StatDescriptor callsIdentityExposerDescriptor = getByName(
        StatExposerTestingService.CALLS_WITH_IDENTITY_EXPOSER, snapshot);
    AtomicInteger callsIdentityExposerValue =
        (AtomicInteger) snapshot.get(callsIdentityExposerDescriptor);
    assertEquals(atomicIntegerCallCount.get(), callsIdentityExposerValue.get());

    StatDescriptor callsInferenceExposerDescriptor = getByName(
        StatExposerTestingService.CALLS_WITH_INFERENCE_EXPOSER, snapshot);
    String callsInferenceExposerValue =
        (String) snapshot.get(callsInferenceExposerDescriptor);
    assertEquals(stringCallCount, callsInferenceExposerValue);

    StatDescriptor callsToStringExposerDescriptor = getByName(
        StatExposerTestingService.CALLS_WITH_TO_STRING_EXPOSER, snapshot);
    String callsToStringExposerValue =
        (String) snapshot.get(callsToStringExposerDescriptor);
    assertEquals(stringCallCount, callsToStringExposerValue);

    List<Integer> callsList = service.getCallsList();
    String callsListAsString = String.valueOf(callsList);

    StatDescriptor listDefaultExposerDescriptor = getByName(
        StatExposerTestingService.LIST_WITH_DEFAULT_EXPOSER, snapshot);
    List<Integer> listDefaultExposerValue =
View Full Code Here

TOP

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

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.