Examples of MethodAction


Examples of com.volantis.testtools.mock.method.MethodAction

            vector = new Vector();
        } else {
            vector = new Vector(Arrays.asList(value));
        }
        environmentContextMock.expects.getHeaders(name).does(
                new MethodAction() {
                    public Object perform(MethodActionEvent event) throws Throwable {
                        return vector.elements();
                    }
                }).any();
    }
View Full Code Here

Examples of com.volantis.testtools.mock.method.MethodAction

        final Map headers = new TreeMap(String.CASE_INSENSITIVE_ORDER);
        headers.put("User-Agent", deviceName);

        requestMock.fuzzy.getHeader(mockFactory.expectsInstanceOf(String.class))
                .does(new MethodAction() {

                    public Object perform(MethodActionEvent event)
                            throws Throwable {
                        String header =
                                (String) event.getArgument(String.class);
                        return headers.get(header);
                    }
                }).any();
        requestMock.fuzzy
                .getHeaders(mockFactory.expectsInstanceOf(String.class))
                .does(new MethodAction() {

                    public Object perform(MethodActionEvent event)
                            throws Throwable {
                        String header =
                                (String) event.getArgument(String.class);
View Full Code Here

Examples of com.volantis.testtools.mock.method.MethodAction

            public void add() {

                stylingEngineMock.fuzzy
                        .startElement(XDIMESchemata.CDM_NAMESPACE, "pane",
                                      mockFactory.expectsInstanceOf(Attributes.class))
                        .does(new MethodAction() {
                            public Object perform(MethodActionEvent event)
                                    throws Throwable {

                                Attributes attributes = (Attributes)
                                        event.getArgument(Attributes.class);
View Full Code Here

Examples of com.volantis.testtools.mock.method.MethodAction

        sessionContextMock.expects.getDevice().returns(device);
       
        protocolMock.expects.setMarinerPageContext(context);           
        protocolMock.expects.initialise()
            .does(new MethodAction() {
                public Object perform(MethodActionEvent event) throws Throwable {
                   
                    // Make sure asset resolver has been initialized (VBM 2006032022)
                    assertNotNull(context.getAssetResolver());
                    // Make sure policy ref resolver has been initialized (VBM 2006021602)
View Full Code Here

Examples of com.volantis.testtools.mock.method.MethodAction

                .getCommonExpectations(expectations, mockFactory))
                .any();

        deviceLayoutContextMock.expects.allocateOutputBuffer().
            does(
                new MethodAction() {
                    public Object perform(MethodActionEvent event)
                        throws Throwable {
                        return new DOMOutputBuffer();
                    }
                }).any();
View Full Code Here

Examples of com.volantis.testtools.mock.method.MethodAction

    public void testMaxAge() {
        final SystemClockMock clockMock =
            new SystemClockMock("clockMock", expectations);
        final Time[] time =
            new Time[]{Time.inMilliSeconds(System.currentTimeMillis())};
        clockMock.expects.getCurrentTime().does(new MethodAction(){
                public Object perform(final MethodActionEvent event) {
                    return time[0];
                }
            }).any();
        final ResponseCachingDirectives rcd =
View Full Code Here

Examples of com.volantis.testtools.mock.method.MethodAction

    public void testExpires() {
        final SystemClockMock clockMock =
            new SystemClockMock("clockMock", expectations);
        final Time[] time =
            new Time[]{Time.inMilliSeconds(System.currentTimeMillis())};
        clockMock.expects.getCurrentTime().does(new MethodAction(){
                public Object perform(final MethodActionEvent event) {
                    return time[0];
                }
            }).any();
        final ResponseCachingDirectives rcd =
View Full Code Here

Examples of com.volantis.testtools.mock.method.MethodAction

        // =====================================================================
        //   Set Expectations
        // =====================================================================

        valueCompilerMock.fuzzy.compile(mockFactory.expectsAny())
                .does(new MethodAction() {
                    public Object perform(MethodActionEvent event)
                            throws Throwable {
                        return event.getArgument(StyleValue.class);
                    }
                }).any();
View Full Code Here

Examples of com.volantis.testtools.mock.method.MethodAction

        // =====================================================================
        //   Set Expectations
        // =====================================================================

        valueCompilerMock.fuzzy.compile(mockFactory.expectsAny())
                .does(new MethodAction() {
                    public Object perform(MethodActionEvent event)
                            throws Throwable {
                        return event.getArgument(StyleValue.class);
                    }
                }).any();
View Full Code Here

Examples of com.volantis.testtools.mock.method.MethodAction

        final AssetResolverMock assetResolverMock =
            new AssetResolverMock("assetResolverMock", expectations);

        policyReferenceFactoryMock.fuzzy.createLazyNormalizedReference(
            runtimeProjectMock, null, mockFactory.expectsInstanceOf(String.class),
            PolicyType.SCRIPT).does(new MethodAction(){
            public Object perform(MethodActionEvent event) throws Throwable {
                final String url = (String) event.getArguments()[2];
                if (url.startsWith("URL")) {
                    return urlRuntimePolicyReferenceMock;
                } else {
                    return noUrlRuntimePolicyReferenceMock;
                }
            }
        }).any();

        final SelectedVariantMock selectedVariantMock =
            new SelectedVariantMock("selectedVariantMock", expectations);
        selectedVariantMock.expects.getOldObject().does(new MethodAction(){
            public Object perform(MethodActionEvent event) throws Throwable {
                return new ScriptAsset("name", "deviceName",
                    "programmingLanguage", "mimeType", "characterSet",
                    ScriptAsset.URL, "assetGroupName", "value");
            }}).any();

        assetResolverMock.expects.selectBestVariant(
            urlRuntimePolicyReferenceMock, null).returns(selectedVariantMock).any();

        assetResolverMock.expects.selectBestVariant(
            noUrlRuntimePolicyReferenceMock, null).returns(null).any();
        assetResolverMock.expects.computeURLAsString(selectedVariantMock).
            returns("url-for-the-script-variant").any();
        assetResolverMock.expects
            .rewriteURLWithPageURLRewriter("url-for-the-script-variant", PageURLType.SCRIPT)
            .returns("url-for-the-script-variant").any();

        final DOMProtocol protocol = createProtocol();

        requestContextMock.expects.
            getMarinerPageContext().returns(pageContextMock).any();

        final StylingEngine stylingEngine = getStylingEngine();

        final PaneInstanceMock paneInstance = getPaneInstance();

        pageContextMock.expects.enteringXDIMECPElement().any();
        pageContextMock.expects.insideXDIMECPElement().returns(false).any();
        pageContextMock.expects.exitingXDIMECPElement().any();
        pageContextMock.expects.getStylingEngine().returns(stylingEngine).any();
        pageContextMock.expects.getCurrentContainerInstance().
            returns(paneInstance).any();
        pageContextMock.expects.initialisedCanvas().returns(true).any();
        pageContextMock.expects.getProtocol().returns(protocol).any();
        pageContextMock.fuzzy.pushOutputBuffer(
            mockFactory.expectsInstanceOf(DOMOutputBuffer.class)).does(
                new MethodAction() {
                    public Object perform(MethodActionEvent event)
                        throws Throwable {
                        Object buffer = event.getArgument(OutputBuffer.class);

                        outputBufferStack.push(buffer);

                        return null;
                    }
                }).any();
        pageContextMock.fuzzy.popOutputBuffer(
            mockFactory.expectsInstanceOf(DOMOutputBuffer.class)).does(
                new MethodAction() {
                    public Object perform(MethodActionEvent event)
                        throws Throwable {

                        return outputBufferStack.pop();
                    }
                }).any();
        pageContextMock.expects.getCurrentOutputBuffer().does(
            new MethodAction() {
                public Object perform(MethodActionEvent event) throws Throwable {
                    return outputBufferStack.peek();
                }
            }).any();
        pageContextMock.expects.getVolantisBean().returns(volantisBeanMock).any();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.