Package aQute.lib.osgi

Examples of aQute.lib.osgi.Macro$Link


        LinkFactory factory = new LinkFactoryImpl(request, response, map, cache, optimizer, queue,
                                                  contextValueEncoder, securityManager);
        factory.addListener(listener);

        Link link = factory.createActionLink(containingPage, null, "myaction", false);

        assertEquals(link.toURI(), ENCODED);
        assertSame(link, holder.get());

        verify();
    }
View Full Code Here


        LinkFactory factory = new LinkFactoryImpl(request, response, map, cache, optimizer, queue,
                                                  contextValueEncoder, securityManager);
        factory.addListener(listener);

        Link link = factory.createActionLink(page, nestedId, eventName, false, context);

        assertEquals(link.toURI(), ENCODED);
        assertSame(link, holder.get());

        verify();
    }
View Full Code Here

    {
        if (isDisabled()) return;

        Object[] activationContext = context != null ? context.toArray() : emptyContext;

        Link link = resources.createPageLink(page, resources.isBound("context"), activationContext);

        writeLink(writer, link);
    }
View Full Code Here

        String pageName = "order/Edit";

        PageActivationContextCollector collector = mockPageActivationContextCollector();
        RequestPageCache pageCache = mockRequestPageCache();
        LinkFactory factory = mockLinkFactory();
        Link link = mockLink();
        ComponentClassResolver resolver = mockComponentClassResolver();

        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();


        LinkSource source = new LinkSourceImpl(pageCache, null,
                                               collector, factory, typeCoercer, resolver);


        Link actual = source.createPageRenderLink(pageName, false);

        // Make sure the same link is returned.

        assertEquals(actual, link);
View Full Code Here

                                      Object... context)
    {
        PageActivationContextCollector collector = mockPageActivationContextCollector();
        LinkCreationListener listener = mockLinkCreationListener();
        LinkFactory factory = mockLinkFactory();
        Link link = mockLink();
        ComponentClassResolver resolver = mockComponentClassResolver();
        String canonical = "CanonicalPageName";

        train_canonicalizePageName(resolver, pageName, canonical);

        if (!overrideContext)
            train_collectPageActivationContext(collector, canonical, context);

        PageRenderRequestParameters parameters =
                new PageRenderRequestParameters(canonical,
                                                new ArrayEventContext(typeCoercer, context));

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

        listener.createdPageRenderLink(link);

        replay();

        LinkSource source = new LinkSourceImpl(null, null,
                                               collector, factory, typeCoercer, resolver);

        source.getLinkCreationHub().addListener(listener);

        Object[] passedContext = overrideContext ? context : new Object[0];

        Link returnedLink = source.createPageRenderLink(pageName, overrideContext, passedContext);

        assertSame(returnedLink, link);

        verify();
    }
View Full Code Here

        Page primaryPage = mockPage();
        Page activePage = mockPage();
        PageRenderQueue queue = mockPageRenderQueue();
        PageActivationContextCollector collector = mockPageActivationContextCollector();
        LinkFactory factory = mockLinkFactory();
        Link link = mockLink();

        train_getRenderingPage(queue, activePage);

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

        Page primaryPage = mockPage();
        PageRenderQueue queue = mockPageRenderQueue();
        PageActivationContextCollector collector = mockPageActivationContextCollector();
        LinkCreationListener listener = mockLinkCreationListener();
        LinkFactory factory = mockLinkFactory();
        Link link = mockLink();


        ArrayEventContext eventContext = new ArrayEventContext(typeCoercer, context);

        ArrayEventContext pageEventContext = new ArrayEventContext(
                typeCoercer, "a", "b");

        train_getRenderingPage(queue, null);

        train_getName(primaryPage, pageName);

        train_collectPageActivationContext(collector, pageName, "a", "b");


        ComponentEventRequestParameters parameters =
                new ComponentEventRequestParameters(pageName, pageName,
                                                    nestedId, eventType,
                                                    pageEventContext, eventContext);

        expect(factory.createComponentEventLink(parameters, forForm)).andReturn(link);

        listener.createdComponentEventLink(link);

        replay();

        LinkSource source = new LinkSourceImpl(null, queue,
                                               collector, factory, typeCoercer, null);

        source.getLinkCreationHub().addListener(listener);

        Link returnedLink = source.createComponentEventLink(primaryPage, nestedId, eventType, forForm, context);

        // Make sure the same link is returned.

        assertSame(returnedLink, link);
View Full Code Here

    @Test
    public void default_passivate_context()
    {
        ComponentClassResolver resolver = mockComponentClassResolver();
        LinkSource source = mockLinkSource();
        Link link = mockLink();

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

        expect(source.createPageRenderLink(PAGE_NAME, false)).andReturn(link);
View Full Code Here

    @Test
    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

        ComponentEventLinkEncoder encoder = new ComponentEventLinkEncoderImpl(null, contextPathEncoder, null, request,
                response, manager, null, null, false, "", null, null);

        PageRenderRequestParameters parameters = new PageRenderRequestParameters("MyPage", new EmptyEventContext());

        Link link = encoder.createPageRenderLink(parameters);

        assertEquals(link.toURI(), "MAGIC");

        verify();
    }
View Full Code Here

TOP

Related Classes of aQute.lib.osgi.Macro$Link

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.