Package org.apache.hivemind

Examples of org.apache.hivemind.Registry


        assertSame(s1, s2);
    }

    public void testComplex() throws Exception
    {
        Registry r = buildFrameworkRegistry("ComplexModule.xml");

        SimpleService s =
            (SimpleService) r.getService("hivemind.test.services.Simple", SimpleService.class);
        CountFactory.reset();

        assertEquals(
            "<SingletonProxy for hivemind.test.services.Simple(hivemind.test.services.SimpleService)>",
            s.toString());
View Full Code Here


                + "Unable to localize resource DoesNotExist\\.xml for module hivemind\\.test\\.config\\.");
    }

    public void testShutdown() throws Exception
    {
        Registry r = buildFrameworkRegistry("Simple.xml");

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

        assertEquals(2, l.size());

        r.shutdown();

        try
        {
            l.size();
        }
View Full Code Here

    // is failing inside Eclipse.  It appears the be a Log4J
    // configuration problem ... but I have no idea why.

    public void testInterceptorSort() throws Exception
    {
        Registry r =
            buildFrameworkRegistry(
                new String[] {
                    "SimpleModule.xml",
                    "AddSimpleInterceptors1.xml",
                    "AddSimpleInterceptors2.xml",
                    "Tracker.xml" });

        SimpleService s =
            (SimpleService) r.getService("hivemind.test.services.Simple", SimpleService.class);

        TrackerFactory.reset();

        assertEquals(11, s.add(4, 7));
View Full Code Here

     * Checks that you can put references to schemas out of order (within a module, though
     * it applies to cross-module references as well) and that it still works.
     */
    public void testDeferredSchema() throws Exception
    {
        Registry r = buildFrameworkRegistry("DeferredSchema.xml");

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

        assertEquals(1, l.size());

        Datum d = (Datum) l.get(0);

View Full Code Here

    public void testLogging() throws Exception
    {
        interceptLogging("hivemind.test.services.Demo");

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

        DemoService s =
            (DemoService) r.getService("hivemind.test.services.Demo", DemoService.class);

        s.add(5, 3);

        assertLoggedMessages(
            new String[] {
View Full Code Here

     */
    public void testUnresolvedSchema() throws Exception
    {
        interceptLogging();

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

        assertLoggedMessagePattern(
            "Error at .*?UnresolvedSchema.xml.*?: Unable to resolve reference to schema "
                + "'hivemind\\.test\\.config\\.Datum'\\.");

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

        assertEquals(1, l.size());

        Element e = (Element) l.get(0);

View Full Code Here

     */
    public void testLoggingMethodFilters() throws Exception
    {
        interceptLogging("hivemind.test.services.Demo");

        Registry r = buildFrameworkRegistry("LoggingMethodFilters.sdl");

        DemoService s =
            (DemoService) r.getService("hivemind.test.services.Demo", DemoService.class);

        s.add(5, 3);

        assertLoggedMessages(
            new String[] {
View Full Code Here

     * Checks for the detection of a recursive service; one that is dependant on
     * itself.
     */
    public void testRecursiveService() throws Exception
    {
        Registry r = buildFrameworkRegistry("RecursiveService.xml");

        try
        {
            r.getService("hivemind.test.services.tracker.Fred", Object.class);
            unreachable();
        }
        catch (Exception ex)
        {
            assertExceptionSubstring(
View Full Code Here

    }

    public void testServiceTranslator() throws Exception
    {
        Registry r = buildFrameworkRegistry("ServiceTranslator.xml");

        SimpleService ss =
            (SimpleService) r.getService("hivemind.test.services.Simple", SimpleService.class);

        assertNotNull(ss);

        ThreadLocalStorage tls =
            (ThreadLocalStorage) r.getService(
                "hivemind.ThreadLocalStorage",
                ThreadLocalStorage.class);

        assertNotNull(tls);

        Constructed c =
            (Constructed) r.getService("hivemind.test.services.Constructed", Constructed.class);

        assertNotNull(c);

        assertSame(ss, c.getSimpleService());
        assertSame(tls, c.getThreadLocal());
View Full Code Here

     * Test that checks that interceptors don't override toString() if toString()
     * is part of the service interface.
     */
    public void testToString() throws Exception
    {
        Registry r = buildFrameworkRegistry("ToString.xml");

        ToString ts = (ToString) r.getService("hivemind.test.services.ToString", ToString.class);

        interceptLogging("hivemind.test.services.ToString");

        assertEquals("ToStringImpl of toString()", ts.toString());

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.