Package org.apache.tapestry5.ioc

Examples of org.apache.tapestry5.ioc.Registry


     */

    @Test
    public void integration_tests()
    {
        Registry registry = buildRegistry();

        UpcaseService us = registry.getService(UpcaseService.class);

        assertEquals(us.upcase("hello"), "HELLO");
        assertEquals(us.toString(), "<Proxy for Upcase(org.apache.tapestry5.ioc.internal.UpcaseService)>");

        ToStringService ts = registry.getService(ToStringService.class);

        assertEquals(ts.toString(), "<ToStringService: ToString>");

        registry.shutdown();
    }
View Full Code Here


    }

    @Test
    public void recursive_singleton_integration_test()
    {
        Registry registry = buildRegistry();

        FoeService foe = registry.getService("RecursiveFoe", FoeService.class);

        try
        {
            foe.foe();
            unreachable();
        }
        catch (RuntimeException ex)
        {
            // The details are checked elsewhere.
        }

        registry.shutdown();
    }
View Full Code Here

    }

    @Test
    public void integration()
    {
        Registry r = buildRegistry(StartupModule.class);

        assertFalse(StartupModule.startupInvoked);

        r.performRegistryStartup();

        assertTrue(StartupModule.startupInvoked);

        // Ideally we'd have a way to show that the PerthreadManager was notified after
        // RegistryStartup did its thing, but ...

        r.shutdown();
    }
View Full Code Here

    }

    @Test
    public void integration()
    {
        Registry registry = buildRegistry();

        PropertyAccess pa = registry.getService("PropertyAccess", PropertyAccess.class);

        Bean b = new Bean();

        int value = random.nextInt();

        pa.set(b, "value", value);

        assertEquals(b.getValue(), value);

        registry.shutdown();
    }
View Full Code Here

    }

    @Test
    public void integration()
    {
        Registry r = buildRegistry(StartupModule.class);

        assertFalse(StartupModule.startupInvoked);

        r.performRegistryStartup();

        assertTrue(StartupModule.startupInvoked);

        // Ideally we'd have a way to show that the PerthreadManager was notified after
        // RegistryStartup did its thing, but ...

        r.shutdown();
    }
View Full Code Here

    }

    @Test
    public void integration()
    {
        Registry registry = buildRegistry();

        PropertyAccess pa = registry.getService("PropertyAccess", PropertyAccess.class);

        Bean b = new Bean();

        int value = random.nextInt();

        pa.set(b, "value", value);

        assertEquals(b.getValue(), value);

        registry.shutdown();
    }
View Full Code Here

{
    @SuppressWarnings("unchecked")
    @Test
    public void testLoadAppModule()
    {
        Registry registry = new TapestryAppInitializer("org.apache.tapestry5.integration.app0",
                                                       "foo", "").getRegistry();

        Transformer<String> s1 = registry.getService("Service1", Transformer.class);
        assertEquals(s1.transform("a"), "A");
    }
View Full Code Here

public class ServiceProxySerializationTest extends IOCTestCase
{
    @Test
    public void serialization_deserialization() throws Exception
    {
        Registry r = buildRegistry();

        TypeCoercer proxy = r.getService(TypeCoercer.class);

        byte[] serialized = serialize(proxy);

        TypeCoercer proxy2 = deserialize(TypeCoercer.class, serialized);

        assertSame(proxy2, proxy, "De-serialized proxy is same object if Registry unchanged.");

        r.shutdown();

        r = buildRegistry();

        TypeCoercer proxy3 = deserialize(TypeCoercer.class, serialized);

        assertNotNull(proxy3);
        assertNotSame(proxy3, proxy, "New proxy should be different, as it is from a different Registry.");

        r.shutdown();
    }
View Full Code Here

    }

    @Test
    public void deserialize_with_no_registry() throws Exception
    {
        Registry r = buildRegistry();

        TypeCoercer proxy = r.getService(TypeCoercer.class);

        byte[] serialized = serialize(proxy);

        r.shutdown();

        try
        {
            deserialize(TypeCoercer.class, serialized);
            unreachable();
View Full Code Here

     */

    @Test
    public void integration_tests()
    {
        Registry registry = buildRegistry();

        UpcaseService us = registry.getService(UpcaseService.class);

        assertEquals(us.upcase("hello"), "HELLO");
        assertEquals(us.toString(), "<Proxy for Upcase(org.apache.tapestry5.ioc.internal.UpcaseService)>");

        ToStringService ts = registry.getService(ToStringService.class);

        assertEquals(ts.toString(), "<ToStringService: ToString>");

        registry.shutdown();
    }
View Full Code Here

TOP

Related Classes of org.apache.tapestry5.ioc.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.