Package org.easymock

Examples of org.easymock.Capture


        EasyMock.expect(systemBundleRevision.getCapabilities(null)).andReturn(Collections.<Capability>emptyList());
        EasyMock.expect(systemBundle.adapt(BundleRevision.class)).andReturn(systemBundleRevision);
        bundleContext.addBundleListener((BundleListener) EasyMock.anyObject());
        bundleContext.addServiceListener((ServiceListener) EasyMock.anyObject());
        EasyMock.expect(bundleContext.getBundles()).andReturn(new Bundle[] { systemBundle });
        final Capture c = new Capture();
        EasyMock.expect(bundleContext.createFilter((String) capture(c))).andAnswer(new IAnswer() {
            public Object answer() throws Throwable {
                return FilterImpl.newInstance((String) c.getValue());
            }
        }).anyTimes();
        EasyMock.replay(new Object[] { bundleContext, systemBundle, systemBundleRevision });

        RepositoryAdminImpl repoAdmin = new RepositoryAdminImpl(bundleContext, new Logger(bundleContext));
View Full Code Here


        EasyMock.expect(systemBundleRevision.getCapabilities(null)).andReturn(Collections.<Capability>emptyList());
        EasyMock.expect(systemBundle.adapt(BundleRevision.class)).andReturn(systemBundleRevision);
        bundleContext.addBundleListener((BundleListener) EasyMock.anyObject());
        bundleContext.addServiceListener((ServiceListener) EasyMock.anyObject());
        EasyMock.expect(bundleContext.getBundles()).andReturn(new Bundle[] { systemBundle });
        final Capture c = new Capture();
        EasyMock.expect(bundleContext.createFilter((String) capture(c))).andAnswer(new IAnswer() {
            public Object answer() throws Throwable {
                return FilterImpl.newInstance((String) c.getValue());
            }
        }).anyTimes();
        EasyMock.replay(new Object[] { bundleContext, systemBundle, systemBundleRevision });

        RepositoryAdminImpl repoAdmin = new RepositoryAdminImpl(bundleContext, new Logger(bundleContext));
View Full Code Here

        EasyMock.expect(systemBundleRevision.getCapabilities(null)).andReturn(Collections.<Capability>emptyList());
        EasyMock.expect(systemBundle.adapt(BundleRevision.class)).andReturn(systemBundleRevision);
        bundleContext.addBundleListener((BundleListener) EasyMock.anyObject());
        bundleContext.addServiceListener((ServiceListener) EasyMock.anyObject());
        EasyMock.expect(bundleContext.getBundles()).andReturn(new Bundle[] { systemBundle });
        final Capture c = new Capture();
        EasyMock.expect(bundleContext.createFilter((String) capture(c))).andAnswer(new IAnswer() {
            public Object answer() throws Throwable {
                return FilterImpl.newInstance((String) c.getValue());
            }
        }).anyTimes();
        EasyMock.replay(new Object[] { bundleContext, systemBundle, systemBundleRevision });

        RepositoryAdminImpl repoAdmin = new RepositoryAdminImpl(bundleContext, new Logger(bundleContext));
View Full Code Here

        EasyMock.expect(new Long(systemBundle.getBundleId())).andReturn(new Long(0)).anyTimes();
        EasyMock.expect(systemBundle.getBundleContext()).andReturn(bundleContext);
        bundleContext.addBundleListener((BundleListener) EasyMock.anyObject());
        bundleContext.addServiceListener((ServiceListener) EasyMock.anyObject());
        EasyMock.expect(bundleContext.getBundles()).andReturn(new Bundle[] { systemBundle });
        final Capture c = new Capture();
        EasyMock.expect(bundleContext.createFilter((String) capture(c))).andAnswer(new IAnswer() {
            public Object answer() throws Throwable {
                return FilterImpl.newInstance((String) c.getValue());
            }
        }).anyTimes();
        EasyMock.replay(new Object[] { bundleContext, systemBundle });

        RepositoryAdminImpl repoAdmin = new RepositoryAdminImpl(bundleContext, new Logger(bundleContext));
View Full Code Here

        EasyMock.expect(new Long(systemBundle.getBundleId())).andReturn(new Long(0)).anyTimes();
        EasyMock.expect(systemBundle.getBundleContext()).andReturn(bundleContext);
        bundleContext.addBundleListener((BundleListener) EasyMock.anyObject());
        bundleContext.addServiceListener((ServiceListener) EasyMock.anyObject());
        EasyMock.expect(bundleContext.getBundles()).andReturn(new Bundle[] { systemBundle });
        final Capture c = new Capture();
        EasyMock.expect(bundleContext.createFilter((String) capture(c))).andAnswer(new IAnswer() {
            public Object answer() throws Throwable {
                return FilterImpl.newInstance((String) c.getValue());
            }
        }).anyTimes();
        EasyMock.replay(new Object[] { bundleContext, systemBundle });

        RepositoryAdminImpl repoAdmin = new RepositoryAdminImpl(bundleContext, new Logger(bundleContext));
View Full Code Here

        EasyMock.expect(new Long(systemBundle.getBundleId())).andReturn(new Long(0)).anyTimes();
        EasyMock.expect(systemBundle.getBundleContext()).andReturn(bundleContext);
        bundleContext.addBundleListener((BundleListener) EasyMock.anyObject());
        bundleContext.addServiceListener((ServiceListener) EasyMock.anyObject());
        EasyMock.expect(bundleContext.getBundles()).andReturn(new Bundle[] { systemBundle });
        final Capture c = new Capture();
        EasyMock.expect(bundleContext.createFilter((String) capture(c))).andAnswer(new IAnswer() {
            public Object answer() throws Throwable {
                return FilterImpl.newInstance((String) c.getValue());
            }
        }).anyTimes();
        EasyMock.replay(new Object[] { bundleContext, systemBundle });

        RepositoryAdminImpl repoAdmin = new RepositoryAdminImpl(bundleContext, new Logger(bundleContext));
View Full Code Here

        EasyMock.expect(serverView.getQueryRunner(server))
                .andReturn(expectations.getQueryRunner())
                .once();

        final Capture<? extends Query> capture = new Capture();
        final Capture<? extends Map> context = new Capture();
        queryCaptures.add(capture);
        QueryRunner queryable = expectations.getQueryRunner();

        if (query instanceof TimeseriesQuery) {
          List<String> segmentIds = Lists.newArrayList();
View Full Code Here

        RequestSecurityManager securityManager = mockRequestSecurityManager();
        Request request = mockRequest();
        Response response = mockResponse();
        ComponentInvocationMap invocationMap = new NoOpComponentInvocationMap();
        RequestPathOptimizer optimizer = mockRequestPathOptimizer();
        Capture<Link> linkCapture = new Capture();
        LinkFactoryListener listener = mockLinkFactoryListener();

        train_getLogicalName(page, logicalName);

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

        train_getBaseURL(securityManager, page, null);
        train_getContextPath(request, "/context");


        train_optimizePath(optimizer, expectedURL, optimizedURL);
        train_encodeURL(response, optimizedURL, encodedURL);

        listener.createdPageRenderLink(capture(linkCapture));

        replay();


        LinkFactory factory = new LinkFactoryImpl(request, response, invocationMap, null, optimizer, null,
                                                  securityManager, contextPathEncoder, collector);

        factory.addListener(listener);

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

        Link link = factory.createPageRenderLink(page, overrideContext, passedContext);

        // Make sure the same link is returned.

        assertSame(linkCapture.getValue(), link);

        assertEquals(link.toURI(), encodedURL);

        verify();
    }
View Full Code Here

        RequestSecurityManager securityManager = mockRequestSecurityManager();
        Request request = mockRequest();
        Response response = mockResponse();
        ComponentInvocationMap invocationMap = new NoOpComponentInvocationMap();
        RequestPathOptimizer optimizer = mockRequestPathOptimizer();
        Capture<Link> linkCapture = new Capture();
        LinkFactoryListener listener = mockLinkFactoryListener();

        String optimizedURL = "optimized:" + expectedURL;
        String encodedURL = "encoded:" + expectedURL;

        train_getRenderingPage(queue, null);

        train_getLogicalName(primaryPage, logicalName);

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

        train_getBaseURL(securityManager, activePage, null);

        train_getContextPath(request, "/context");

        train_optimizePath(optimizer, expectedURL, optimizedURL);
        train_encodeURL(response, optimizedURL, encodedURL);

        listener.createdComponentEventLink(capture(linkCapture));

        replay();

        LinkFactory factory = new LinkFactoryImpl(request, response, invocationMap, null, optimizer, queue,
                                                  securityManager, contextPathEncoder, collector);

        factory.addListener(listener);

        Link link = factory.createComponentEventLink(primaryPage, nestedId, eventType, forForm, context);

        // Make sure the same link is returned.

        assertSame(linkCapture.getValue(), link);

        assertEquals(link.toURI(), encodedURL);

        verify();
View Full Code Here

TOP

Related Classes of org.easymock.Capture

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.