Package org.apache.hivemind

Examples of org.apache.hivemind.Registry


     */
    public void testIntegration() throws Exception
    {
        Logger logger = Logger.getLogger("package1.logger1");

        Registry registry = buildFrameworkRegistry("testLogManagementMBean.xml");

        registry.getService(LogManagement.class);

        MBeanServer mbeanServer = (MBeanServer) registry.getService(MBeanServer.class);
        ObjectNameBuilder objectNameBuilder = (ObjectNameBuilder) registry
                .getService(ObjectNameBuilder.class);
        ObjectName objectName = objectNameBuilder.createObjectName(logger.getName(), "logger");

        ObjectInstance instance = mbeanServer.getObjectInstance(objectName);
        assertNotNull(instance);

        registry.shutdown();
    }
View Full Code Here


    /**
     * Tests the creation of a performance interceptor via the registry
     */
    public void testIntegration() throws Exception
    {
        Registry registry = buildFrameworkRegistry("testPerformanceMonitorFactory.xml");

        // Get Calculator service so that interceptor gets created
        Calculator calculator = (Calculator) registry.getService(Calculator.class);
        calculator.getSum();

        // Look for the mbean that collects the performance data
        MBeanServer mbeanServer = (MBeanServer) registry.getService(MBeanServer.class);

        registry.getService(ObjectNameBuilder.class);

        ObjectName objectName = new ObjectName(
                "hivemind:module=test.management,type=service,id=Calculator,decorator=PerformanceCollector");
        ObjectInstance instance = mbeanServer.getObjectInstance(objectName);
        assertNotNull(instance);
View Full Code Here

    /**
     * Tests the registration of MBeans via contribution
     */
    public void testContribution() throws Exception
    {
        Registry registry = buildFrameworkRegistry("testMBeanRegistry.xml");
        List mBeanList = registry.getConfiguration("hivemind.management.MBeans");

        // Training
        ServicePoint sp1 = ((MBeanRegistrationContribution) mBeanList.get(0)).getServicePoint();
        Object mBean1 = registry.getService("test.management.MBean1", Runnable.class);
        ObjectName on1 = objectNameBuilder.createServiceObjectName(sp1);
        server.registerMBean(mBean1, on1);
        serverControl.setReturnValue(new ObjectInstance(on1, mBean1.getClass().getName()));

        ObjectName on2 = new ObjectName("hivemind:name=bean1");
        server.registerMBean(mBean1, on2);
        serverControl.setReturnValue(new ObjectInstance(on1, mBean1.getClass().getName()));

        replayControls();

        new MBeanRegistryImpl(errorHandler, log, server, objectNameBuilder, mBeanList);

        verifyControls();

        assertTrue("start method has not been called", ((MBeanTestService) mBean1).isStartCalled());

        registry.shutdown();
    }
View Full Code Here

     */
    public void testIntegration() throws Exception
    {
        Logger logger = Logger.getLogger("package1.logger1");

        Registry registry = buildFrameworkRegistry("testLogManagementMBean.xml");

        registry.getService(LogManagement.class);

        MBeanServer mbeanServer = (MBeanServer) registry.getService(MBeanServer.class);
        ObjectNameBuilder objectNameBuilder = (ObjectNameBuilder) registry
                .getService(ObjectNameBuilder.class);
        ObjectName objectName = objectNameBuilder.createObjectName(logger.getName(), "logger");

        ObjectInstance instance = mbeanServer.getObjectInstance(objectName);
        assertNotNull(instance);

        registry.shutdown();
    }
View Full Code Here

        verifyControls();
    }

    public void testWrongType() throws Exception
    {
        Registry r = buildFrameworkRegistry("WrongType.xml");

        interceptLogging();

        List l = r.getConfiguration("hivemind.test.rules.WrongType");

        // Convert the proxy into a real list; this will trigger the
        // expected errors.

        l.size();
View Full Code Here

        MockServletConfig servletConfig = new MockServletConfig(servletContext, "servlet");
        ApplicationServlet servlet = new ApplicationServlet();
        servlet.init(servletConfig);

        Registry hiveMindRegistry = (Registry) servletContext.getAttribute("org.apache.tapestry.Registry:servlet");
        assertNotNull("HiveMind registry is not available in servlet context", hiveMindRegistry);

        BeanFactory beanFactory = (BeanFactory) hiveMindRegistry.getService("hivemind.lib.DefaultSpringBeanFactory", BeanFactory.class);
        String name = (String) beanFactory.getBean("name", String.class);
        assertNotNull(name);
        assertEquals("Steven Devijver", name);
    }
View Full Code Here

        Filter f = new HiveMindFilter();

        f.init(filterConfig);

        Registry r = (Registry) servletContext.getAttribute(HiveMindFilter.CONTEXT_KEY);

        assertNotNull(r);

        ThreadEventNotifier t =
            (ThreadEventNotifier) r.getService(
                HiveMind.THREAD_EVENT_NOTIFIER_SERVICE,
                ThreadEventNotifier.class);

        Listener l = new Listener();
View Full Code Here

    }

    public void testObjectTranslator() throws Exception
    {
        Registry r = buildFrameworkRegistry("ObjectTranslator.xml");

        List l = r.getConfiguration("hivemind.test.config.ObjectTranslator");

        assertEquals(1, l.size());

        FrobableHolder h = (FrobableHolder) l.get(0);
View Full Code Here

    public void testSymbols() throws Exception
    {
        interceptLogging();

        Registry r = buildFrameworkRegistry("Symbols.xml");

        List l = r.getConfiguration("hivemind.test.config.Symbols");

        assertEquals(3, l.size());

        Datum d = (Datum) l.get(0);
View Full Code Here

        assertLoggedMessagePattern("No value available for symbol 'work'");
    }

    public void testNoSchema() throws Exception
    {
        Registry r = buildFrameworkRegistry("NoSchema.xml");

        List l = r.getConfiguration("hivemind.test.config.NoSchema");

        assertEquals(2, l.size());

        Element e = (Element) l.get(0);
        assertEquals("datum", e.getElementName());
View Full Code Here

TOP

Related Classes of org.apache.hivemind.Registry

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.