Package org.apache.tapestry5.ioc

Examples of org.apache.tapestry5.ioc.ObjectLocator


        Logger logger = mockLogger();
        Orderer<Map> orderer = new Orderer<Map>(logger);
        Map pre = new HashMap();
        Map post = new HashMap();
        HashMap contribution = new HashMap();
        ObjectLocator locator = mockObjectLocator();
        TypeCoercerProxy tc = mockTypeCoercerProxy();

        train_autobuild(locator, HashMap.class, contribution);

        expect(tc.coerce(contribution, Map.class)).andReturn(contribution);
View Full Code Here


        Logger logger = mockLogger();
        Orderer<Map> orderer = new Orderer<Map>(logger);
        Map pre = new HashMap();
        Map post = new HashMap();
        HashMap contribution = new HashMap();
        ObjectLocator locator = mockObjectLocator();
        TypeCoercerProxy tc = mockTypeCoercerProxy();

        train_autobuild(locator, HashMap.class, contribution);

        expect(tc.coerce(contribution, Map.class)).andReturn(contribution);
View Full Code Here

    }

    @Test
    public void inject_service_annotation_on_field()
    {
        ObjectLocator ol = mockObjectLocator();
        FieldInjectionViaInjectService target = new FieldInjectionViaInjectService();
        Runnable fred = mockRunnable();

        train_getService(ol, "FredService", Runnable.class, fred);
View Full Code Here

    }
   
    @Test
    public void javax_inject_named_annotation_on_field()
    {
        ObjectLocator ol = mockObjectLocator();
        FieldInjectionViaJavaxNamed target = new FieldInjectionViaJavaxNamed();
        Runnable fred = mockRunnable();

        train_getService(ol, "BarneyService", Runnable.class, fred);
View Full Code Here

   
    @Test
    public void javax_inject_annotation_on_field()
    {
        ObjectLocator ol = mockObjectLocator();
        FieldInjectionViaInject target = new FieldInjectionViaInject();
        final SymbolSource ss = mockSymbolSource();

        IAnswer answer = new IAnswer()
        {
            public Object answer() throws Throwable
            {
                Object[] args = EasyMock.getCurrentArguments();

                AnnotationProvider ap = (AnnotationProvider) args[1];

                // Verify that annotations on the field are accessible.

                assertNotNull(ap.getAnnotation(Builtin.class));

                return ss;
            }
        };

        expect(ol.getObject(eq(SymbolSource.class), isA(AnnotationProvider.class))).andAnswer(answer);

        replay();

        InternalUtils.injectIntoFields(target, ol, null, tracker);
View Full Code Here

    }

    @Test
    public void inject_annotation_on_field()
    {
        ObjectLocator ol = mockObjectLocator();
        FieldInjectionViaInject target = new FieldInjectionViaInject();
        final SymbolSource ss = mockSymbolSource();

        IAnswer answer = new IAnswer()
        {
            public Object answer() throws Throwable
            {
                Object[] args = EasyMock.getCurrentArguments();

                AnnotationProvider ap = (AnnotationProvider) args[1];

                // Verify that annotations on the field are accessible.

                assertNotNull(ap.getAnnotation(Builtin.class));

                return ss;
            }
        };

        expect(ol.getObject(eq(SymbolSource.class), isA(AnnotationProvider.class))).andAnswer(answer);

        replay();

        InternalUtils.injectIntoFields(target, ol, null, tracker);
View Full Code Here

    }

    @Test
    public void exception_injecting_into_field()
    {
        ObjectLocator ol = mockObjectLocator();
        FieldInjectionViaInjectService target = new FieldInjectionViaInjectService();

        // It's very hard to come up with a value that causes an error when assigned. We have to break
        // a lot of rules.

        ol.getService("FredService", Runnable.class);
        EasyMock.expectLastCall().andReturn("NotTheRightType");

        replay();

        try
View Full Code Here

    @Test
    public void proper_key_and_value()
    {
        ContributionDef def = mockContributionDef();
        Map<Class, ContributionDef> keyToContribution = newMap();
        ObjectLocator locator = mockObjectLocator();
        Map<Class, Runnable> map = CollectionFactory.newMap();
        TypeCoercerProxy tc = mockTypeCoercerProxy();

        Class key = Integer.class;
        Runnable value = mockRunnable();
View Full Code Here

    @Test
    public void coerced_value()
    {
        ContributionDef def = mockContributionDef();
        Map<Class, ContributionDef> keyToContribution = newMap();
        ObjectLocator locator = mockObjectLocator();
        Map<Class, Runnable> map = CollectionFactory.newMap();
        TypeCoercerProxy tc = mockTypeCoercerProxy();
        String contributedValue = "coerceme";

        Class key = Integer.class;
View Full Code Here

    public void duplicate_key()
    {
        ContributionDef def1 = newContributionDef("contributionPlaceholder1");
        ContributionDef def2 = newContributionDef("contributionPlaceholder2");
        Map<Class, ContributionDef> keyToContribution = newMap();
        ObjectLocator locator = mockObjectLocator();
        Map<Class, Runnable> map = CollectionFactory.newMap();
        TypeCoercerProxy tc = mockTypeCoercerProxy();

        keyToContribution.put(Integer.class, def1);
View Full Code Here

TOP

Related Classes of org.apache.tapestry5.ioc.ObjectLocator

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.