Package org.apache.tapestry.ioc

Examples of org.apache.tapestry.ioc.Registry


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

        Transformer<String> s1 = registry.getService("Service1", Transformer.class);
        assertEquals(s1.transform("a"), "A");
    }
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.tapestry.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

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

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

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

    }

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

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

        Bean b = new Bean();

        int value = _random.nextInt();
View Full Code Here

    private final String CLASS_NAME = getClass().getName();

    @BeforeClass
    public void setupBuilder()
    {
        Registry registry = buildRegistry();

        _builder = registry.getService(
                "tapestry.ioc.PropertyShadowBuilder",
                PropertyShadowBuilder.class);
    }
View Full Code Here

    /** The following tests work better as integration tests. */

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

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

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

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

        assertEquals(ts.toString(), "<ToStringService: ioc.test.ToString>");
    }
View Full Code Here

    }

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

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

        try
        {
            foe.foe();
            unreachable();
View Full Code Here

TOP

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