Package org.apache.hivemind

Examples of org.apache.hivemind.Registry


        assertEquals("${value2}", e.getAttributeValue("value"));
    }

    public void testLocalized() throws Exception
    {
        Registry r = buildFrameworkRegistry("Localized.xml");

        List l = r.getConfiguration("hivemind.test.config.Localized");
        assertEquals(1, l.size());

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

        assertEquals("message", d.getKey());
View Full Code Here


        assertEquals("Some Damn Thing", d.getValue());
    }

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

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

        assertEquals("<Element List Proxy for hivemind.test.config.Simple>", l.toString());

        assertEquals(true, l.equals(l));
        assertEquals(false, l.equals(null));

        assertEquals(2, l.size());

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

        assertNotSame(l, l2);
        assertEquals(l, l2);

        assertEquals(l2.toString(), l.toString());
View Full Code Here

    public void testTooFew() throws Exception
    {

        interceptLogging(RegistryBuilder.class.getName());

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

        r.getConfiguration("hivemind.test.config.TooFew");

        assertLoggedMessage("Configuration extension point hivemind.test.config.TooFew contains no contributions but expects at least one contribution.");

    }
View Full Code Here

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

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

        r.getConfiguration("hivemind.test.config.TooMany");

        assertLoggedMessage("Configuration extension point hivemind.test.config.TooMany contains 2 contributions but expects an optional contribution.");
    }
View Full Code Here

        assertLoggedMessage("Configuration extension point hivemind.test.config.TooMany contains 2 contributions but expects an optional contribution.");
    }

    public void testBadAttributes() throws Exception
    {
        Registry r = buildFrameworkRegistry("BadAttributes.xml");

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

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

public class TestServices extends FrameworkTestCase
{

    public void testSimple() throws Exception
    {
        Registry r = buildFrameworkRegistry("SimpleModule.xml");

        assertNotNull(r);

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

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

        }
    }

    public void testBadElement() throws Exception
    {
        Registry r = buildFrameworkRegistry("BadElement.xml");

        interceptLogging(SchemaProcessorImpl.class.getName());

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

        assertEquals(1, l.size());

        assertLoggedMessagePattern("Error at .*?: Element xatum is not allowed here\\.");
    }
View Full Code Here

        }
    }

    public void testDupeSymbol() throws Exception
    {
        Registry r = buildFrameworkRegistry("DupeSymbol.xml");

        interceptLogging("hivemind.ApplicationDefaultsSymbolSource");

        assertEquals(
            "Fred's friend is barney.",
            r.expandSymbols("Fred's friend is ${fred}.", null));

        assertLoggedMessagePattern("Error at .*?: Default for symbol 'fred' duplicates prior value \\(at .*\\) and has been ignored\\.");
    }
View Full Code Here

    /**
     * Test that service instances are cached.
     */
    public void testCache() throws Exception
    {
        Registry r = buildFrameworkRegistry("SimpleModule.xml");

        assertNotNull(r);

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

        assertSame(s1, s2);
    }
View Full Code Here

            new ClasspathResource(_resolver, "/hivemind/test/config/ResourceTranslator.xml");

        builder.processModules(_resolver);
        builder.processModule(_resolver, moduleResource);

        Registry r = (Registry) builder.constructRegistry(Locale.FRENCH);

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

        interceptLogging();

        assertEquals(4, l.size());
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.