Package net.anotheria.moskito.core.registry

Examples of net.anotheria.moskito.core.registry.ProducerRegistryAPIFactory


    for (int i=0; i<10; i++){
      service.doSomethingMethod();
    }

    //in this case we don't have anything in the Registry.
    IProducerRegistryAPI registry = new ProducerRegistryAPIFactory().createProducerRegistryAPI();
    try{
      registry.getProducer("SimpleService");
      registry.getProducer("SimpleService-1");
      fail("There should be no producer in the factory");
    }catch(NoSuchProducerException e){}
View Full Code Here


    for (int i=0; i<10; i++){
      service.doSomethingMethod();
    }

    //in this case we don't have anything in the Registry.
    IProducerRegistryAPI registry = new ProducerRegistryAPIFactory().createProducerRegistryAPI();
    OnDemandStatsProducer<ServiceStats> producer = (OnDemandStatsProducer<ServiceStats>)registry.getProducer("SimpleService-1");
    assertNotNull(producer);
    ServiceStats methodStats = producer.getStats("doSomethingMethod");
    assertEquals(10, methodStats.getTotalRequests());
View Full Code Here

    for (int i=0; i<10; i++){
      monitoredInstance.doSomethingMethod();
    }

    //in this case we don't have anything in the Registry.
    IProducerRegistryAPI registry = new ProducerRegistryAPIFactory().createProducerRegistryAPI();
    OnDemandStatsProducer<ServiceStats> producer = (OnDemandStatsProducer<ServiceStats>)registry.getProducer("SimpleService");
    assertNotNull(producer);
    ServiceStats methodStats = producer.getStats("doSomethingMethod");
    assertEquals(10, methodStats.getTotalRequests());
View Full Code Here

        new String[] {"services-aop.xml"});
    AService service = (AService)context.getBean("AService");
    assertEquals(2*100, service.echoMethodA(100));

    //check that the call is traced
    IProducerRegistryAPI registryAPI = new ProducerRegistryAPIFactory().createProducerRegistryAPI();
    IStatsProducer<ServiceStats> producerB = registryAPI.getProducer("BServiceImpl");
    assertEquals(1, producerB.getStats().get(0).getTotalRequests());

    IStatsProducer<ServiceStats> producerC = registryAPI.getProducer("CServiceImpl");
    assertEquals(1, producerC.getStats().get(0).getTotalRequests());
View Full Code Here

        /* waiting some time for next stats update */
        Thread.sleep(5500);

        /* if there is no MoSKito WebUI embedded in your application, stats can be accessed in a way like this */
        IProducerRegistryAPI registryAPI = new ProducerRegistryAPIFactory().createProducerRegistryAPI();
        OnDemandStatsProducer<EhcacheStats> producer = (OnDemandStatsProducer<EhcacheStats>) registryAPI.getProducer("browser-cache");
        EhcacheStats stats =  producer.getStats("cumulated");
        System.out.println(stats.toStatsString(null, TimeUnit.MILLISECONDS));

        /* first 100 accesses will not result in hits because we don't have this pages in cache yet */
 
View Full Code Here

    for (int i=0; i<10; i++){
      process.methodWhichIsPartiallyMonitored();
    }

    //now we check
    ServiceStats stats = ((OnDemandStatsProducer<ServiceStats>)(new ProducerRegistryAPIFactory().createProducerRegistryAPI().getProducer("complexprocess"))).getStats("methodWhichIsPartiallyMonitored");
    assertNotNull(stats);
    assertEquals(10, stats.getTotalRequests());
  }
View Full Code Here

    ComplexProcess process =  new ComplexProcess();
    for (int i=0; i<10; i++){
      process.methodWithMultipleComplexSubprocesses();
    }

    OnDemandStatsProducer<ServiceStats> producer = (OnDemandStatsProducer<ServiceStats>)(new ProducerRegistryAPIFactory().createProducerRegistryAPI().getProducer("complexprocess"));
    //now we check
    ServiceStats phase1 = producer.getStats("phase1");
    ServiceStats phase2 = producer.getStats("phase2");
    ServiceStats phase3 = producer.getStats("phase3");
    assertNotNull(phase1);
View Full Code Here

      testObject.doNotMonitorMe();
    }

    //test is finished, now to ensure that the class is really monitored...
    //you don't have to do this, as your data will probably show up in webui or logs or whatever configured.
    IProducerRegistryAPI registryAPI = new ProducerRegistryAPIFactory().createProducerRegistryAPI();
    OnDemandStatsProducer<ServiceStats> producer = (OnDemandStatsProducer<ServiceStats>)registryAPI.getProducer("MonitoredClass");
    assertNotNull(producer);

    ServiceStats firstMethodStats = producer.getStats("firstMethod");
    assertNotNull(firstMethodStats);
View Full Code Here

      testObject.secondMethod();
    }

    //test is finished, now to ensure that the class is really monitored...
    //you don't have to do this, as your data will probably show up in webui or logs or whatever configured.
    IProducerRegistryAPI registryAPI = new ProducerRegistryAPIFactory().createProducerRegistryAPI();
    OnDemandStatsProducer<ServiceStats> producer = (OnDemandStatsProducer<ServiceStats>)registryAPI.getProducer("ClassWithMonitoredMethod");
    assertNotNull(producer);

    //the firstMethod is monitored and should therefor produce stats.
    ServiceStats firstMethodStats = producer.getStats("firstMethod");
View Full Code Here

    counter.cc();
    counter.paypal();

    //As you see we had a total of 4 payments, one credit card payment, 2 ec payments and one paypal. Let's test it:
    //this code is just to test the results, you don't need to repeat it in your code, the counters will show up in the webui.
    IProducerRegistryAPI registry = new ProducerRegistryAPIFactory().createProducerRegistryAPI();
    IStatsProducer<CounterStats> producer = (IStatsProducer<CounterStats>)registry.getProducer("PaymentCounter");
    assertNotNull(producer);
    //total stats is always at first place in producer which is an instance of an on-demand-producer.
    assertEquals(4, producer.getStats().get(0).get());
    //other stats follow in order they are first called.
View Full Code Here

TOP

Related Classes of net.anotheria.moskito.core.registry.ProducerRegistryAPIFactory

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.