Package org.apache.tapestry5

Examples of org.apache.tapestry5.EventContext


    @Test
    public void unable_to_coerce()
    {
        ComponentEventCallback handler = mockComponentEventHandler();
        EventContext context = mockEventContext();
        PageResources resources = mockPageResources();
        Logger logger = mockLogger();

        train_isDebugEnabled(logger, false);

        train_toClass(resources, Integer.class.getName(), Integer.class);

        train_getCount(context, 1);

        expect(context.get(Integer.class, 0)).andThrow(new NumberFormatException("Not so easy, is it?"));

        replay();

        ComponentEvent event = new ComponentEventImpl("eventType", "someId", context, handler, resources, logger);
View Full Code Here


        if (nestedComponentId == null && eventType == null) return false;

        if (!componentClassResolver.isPageName(activePageName)) return false;

        EventContext eventContext = decodeContext(matcher.group(CONTEXT));

        EventContext activationContext = decodeContext(request.getParameter(InternalConstants.PAGE_CONTEXT_NAME));

        // The event type is often omitted, and defaults to "action".

        if (eventType == null) eventType = EventConstants.ACTION;
View Full Code Here

        {
            public Boolean answer() throws Throwable
            {
                Object[] arguments = EasyMock.getCurrentArguments();

                EventContext ec = (EventContext) arguments[1];

                assertEquals(ec.getCount(), context.length);

                for (int i = 0; i < context.length; i++)
                {
                    assertEquals(ec.get(Object.class, i), context[i]);
                }


                return handled;
            }
View Full Code Here

        train_canonicalizePageName(resolver, pageName, pageName);

        train_collectPageActivationContext(collector, pageName, 3);

        EventContext pageActivationContext = new ArrayEventContext(typeCoercer, 3);
        PageRenderRequestParameters parameters = new PageRenderRequestParameters(pageName, pageActivationContext);

        expect(factory.createPageRenderLink(parameters)).andReturn(link);

        replay();
View Full Code Here

        train_getName(activePage, "order/View");
        train_getName(primaryPage, primaryPageName);

        train_collectPageActivationContext(collector, "order/View", "x", "y");

        EventContext pageActivationContext = new ArrayEventContext(typeCoercer, "x", "y");
        EventContext eventContext = new ArrayEventContext(typeCoercer, 3, 5, 9);

        ComponentEventRequestParameters parameters = new ComponentEventRequestParameters("order/View", primaryPageName,
                                                                                         "gnip.gnop", "myevent",
                                                                                         pageActivationContext,
                                                                                         eventContext);
View Full Code Here

    public void override_passivate_context()
    {
        ComponentClassResolver resolver = mockComponentClassResolver();
        LinkSource source = mockLinkSource();
        Link link = mockLink();
        EventContext eventContext = mockEventContext();

        train_resolvePageClassNameToPageName(resolver, PAGE_CLASS.getName(), PAGE_NAME);

        expect(source.createPageRenderLink(PAGE_NAME, true, "fred", "barney")).andReturn(link);
View Full Code Here

    @Test
    public void matches_on_event_type()
    {
        ComponentEventCallback handler = mockComponentEventHandler();
        EventContext context = mockEventContext();
        Logger logger = mockLogger();

        train_isDebugEnabled(logger, false);

        train_getCount(context, 0);
View Full Code Here

     */
    @Test
    public void no_match_one_event_is_aborted()
    {
        ComponentEventCallback handler = mockComponentEventHandler();
        EventContext context = mockEventContext();
        Logger logger = mockLogger();
        Object result = new Object();
        ComponentPageElementResources resources = mockResources();

        train_isDebugEnabled(logger, false);
View Full Code Here

    @Test
    public void event_type_match_is_case_insensitive()
    {
        ComponentEventCallback handler = mockComponentEventHandler();
        EventContext context = mockEventContext();
        Logger logger = mockLogger();

        train_isDebugEnabled(logger, false);

        train_getCount(context, 0);
View Full Code Here

    @Test
    public void matches_on_component_id()
    {
        ComponentEventCallback handler = mockComponentEventHandler();
        EventContext context = mockEventContext();
        Logger logger = mockLogger();

        train_isDebugEnabled(logger, false);

        train_getCount(context, 0);
View Full Code Here

TOP

Related Classes of org.apache.tapestry5.EventContext

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.