Package org.fishwife.jrugged

Examples of org.fishwife.jrugged.PerformanceMonitor


     * @param name the value for the {@link PerformanceMonitorBean}
     * @return the found {@link PerformanceMonitorBean}, or null if it is not
     * found.
     */
    public PerformanceMonitorBean findPerformanceMonitorBean(String name) {
        PerformanceMonitor performanceMonitor = findPerformanceMonitor(name);

        if (performanceMonitor instanceof PerformanceMonitorBean) {
            return (PerformanceMonitorBean)performanceMonitor;
        }
        return null;
View Full Code Here


    public void testAttributesCreatePerfMon() {
       
        DummyService service = (DummyService)context.getBean("dummyService");
        assertNotNull(service);

        PerformanceMonitor monitor =
            (PerformanceMonitor)context.getBean("dummyServicePerformanceMonitor");
        assertNotNull(monitor);       
       
        service.foo()
        assertEquals(1, monitor.getRequestCount());
       
        service.bar();
        assertEquals(2, monitor.getRequestCount());

        service.baz();
        assertEquals(2, monitor.getRequestCount());       
       
        MethodInterceptor wrapper =
            (MethodInterceptor)context.getBean("dummyServicePerformanceMonitorInterceptor");
        assertNotNull(wrapper);  
    }
View Full Code Here

        assertNotNull(wrapper);  
    }

    @Test
    public void testPerfMonElementCreatedPerfMon() {
        PerformanceMonitor monitor =
            (PerformanceMonitor)context.getBean("performanceMonitor");
        assertNotNull(monitor);           
    }
View Full Code Here

        assertNotNull(factory.findPerformanceMonitor(name2));
    }

    @Test
    public void testCreatePerformanceMonitor() {
        PerformanceMonitor createdMonitor =
          factory.createPerformanceMonitor("testCreate");
        assertNotNull(createdMonitor);
    }
View Full Code Here

    }

    @Test
    public void testCreateDuplicatePerformanceMonitor() {
        String name = "testCreate";
        PerformanceMonitor createdMonitor =
          factory.createPerformanceMonitor(name);
        PerformanceMonitor secondMonitor =
          factory.createPerformanceMonitor(name);
        assertSame(createdMonitor, secondMonitor);
    }
View Full Code Here

    }

    @Test
    public void testFindPerformanceMonitorBean() {
        String monitorName = "testFind";
        PerformanceMonitor createdMonitor =
          factory.createPerformanceMonitor(monitorName);
        PerformanceMonitorBean foundMonitor =
          factory.findPerformanceMonitorBean(monitorName);
        assertNotNull(foundMonitor);
        assertEquals(createdMonitor, foundMonitor);
View Full Code Here

        // Create a map with an invalid PerformanceMonitor (non-bean) in it,
        // and jam it in.
        Map<String, PerformanceMonitor> invalidMap =
          new HashMap<String, PerformanceMonitor>();
        invalidMap.put(monitorName, new PerformanceMonitor());
        ReflectionTestUtils.setField(
          factory, "performanceMonitorMap", invalidMap);

        // Try to find it.
        PerformanceMonitorBean foundMonitor =
View Full Code Here

        assertNull(foundMonitor);
    }
    @Test
    public void testMonitorWithoutMBeanExporter() {
        factory.setMBeanExportOperations(null);
        PerformanceMonitor createdMonitor =
                factory.createPerformanceMonitor(
                  "testCreateWithoutMBeanExporter");
        assertNotNull(createdMonitor);
    }
View Full Code Here

        mockMBeanExporter.registerManagedResource(
          EasyMock.<Object>anyObject(), EasyMock.<ObjectName>anyObject());
        replay(mockMBeanExporter);
       
        factory.setMBeanExportOperations(mockMBeanExporter);
        PerformanceMonitor createdMonitor =
                factory.createPerformanceMonitor(
                  "testCreateWithoutMBeanExporter");
        assertNotNull(createdMonitor);
    }
View Full Code Here

    public ModelAndView viewPerformanceMonitor(HttpServletRequest request,
            HttpServletResponse response) throws Exception {
        final StringBuilder sb = new StringBuilder();
        PerformanceMonitorFactory factory = performanceAspect.getPerformanceMonitorFactory();
        for (String monitorName : factory.getPerformanceMonitorNames()) {
            PerformanceMonitor m = factory.findPerformanceMonitor(monitorName);
            sb.append(String.format("[%s]", monitorName)).append("\n");
            // Go through all methods and invoke those with ManagedAttribute
            // marker annotations
            Method[] methods = m.getClass().getMethods();
            for (Method monitorMethod : methods) {
                if (monitorMethod.getName().startsWith("get")) {
                    sb.append(
                        String.format("\t%s: %s\n",
                            monitorMethod.getName().substring(3),
View Full Code Here

TOP

Related Classes of org.fishwife.jrugged.PerformanceMonitor

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.