Examples of CustomAction


Examples of org.jmock.lib.action.CustomAction

        assertThat("main class", localAppletInfo.getMainClass(), equalTo("main"));
        assertThat("arguments", localAppletInfo.getArguments(), contains("arg1"));
    }

    private CustomAction saveLocalFileName() {
        return new CustomAction("file") {
            public Object invoke(Invocation invocation) throws Throwable {
                localFileName = (String) invocation.getParameter(0);
                return new ByteArrayOutputStream();
            }
        };
View Full Code Here

Examples of org.jmock.lib.action.CustomAction

public final class Actions
{
    public static Action countDown(final CountDownLatch latch)
    {
        return new CustomAction("Count Down Latch")
        {
            public Object invoke(Invocation invocation) throws Throwable
            {
                latch.countDown();
                return null;
View Full Code Here

Examples of org.jmock.lib.action.CustomAction

            allowing(managementContext).registerMBean(with(any(Object.class)), with(equal(
                    new ObjectName("Test:type=Broker,brokerName=BrokerNC,service=jobScheduler,jobSchedulerName=JMS"))));

            atLeast(maxReconnects - 1).of (managementContext).registerMBean(with(any(Object.class)), with(new NetworkBridgeObjectNameMatcher<ObjectName>(
                        new ObjectName("Test:type=Broker,brokerName=BrokerNC,connector=networkConnectors,networkConnectorName=NC,networkBridge=localhost/127.0.0.1_"
                            + proxy.getUrl().getPort())))); will(new CustomAction("signal register network mbean") {
                                @Override
                                public Object invoke(Invocation invocation) throws Throwable {
                                    LOG.info("Mbean Registered: " + invocation.getParameter(0));
                                    mbeanRegistered.release();
                                    return new ObjectInstance((ObjectName)invocation.getParameter(1), "discription");
                                }
                            });
            atLeast(maxReconnects - 1).of (managementContext).unregisterMBean(with(new NetworkBridgeObjectNameMatcher<ObjectName>(
                    new ObjectName("Test:type=Broker,brokerName=BrokerNC,connector=networkConnectors,networkConnectorName=NC,networkBridge=localhost/127.0.0.1_"
                            + proxy.getUrl().getPort())))); will(new CustomAction("signal unregister network mbean") {
                                @Override
                                public Object invoke(Invocation invocation) throws Throwable {
                                    LOG.info("Mbean Unregistered: " + invocation.getParameter(0));
                                    mbeanUnregistered.release();
                                    return null;
View Full Code Here

Examples of org.jmock.lib.action.CustomAction

            allowing (managementContext).registerMBean(with(any(Object.class)), with(equal(           
                    new ObjectName("Test:BrokerName=BrokerNC,Type=Topic,Destination=ActiveMQ.Advisory.Connection"))));
           
            atLeast(maxReconnects - 1).of (managementContext).registerMBean(with(any(Object.class)), with(new NetworkBridgeObjectNameMatcher<ObjectName>(
                        new ObjectName("Test:BrokerName=BrokerNC,Type=NetworkBridge,NetworkConnectorName=localhost,Name=localhost/127.0.0.1_"
                            + proxy.getUrl().getPort())))); will(new CustomAction("signal register network mbean") {
                                public Object invoke(Invocation invocation) throws Throwable {
                                    LOG.info("Mbean Registered: " + invocation.getParameter(0));
                                    mbeanRegistered.release();
                                    return new ObjectInstance((ObjectName)invocation.getParameter(0), "dscription");
                                }
                            });
            atLeast(maxReconnects - 1).of (managementContext).unregisterMBean(with(new NetworkBridgeObjectNameMatcher<ObjectName>(
                    new ObjectName("Test:BrokerName=BrokerNC,Type=NetworkBridge,NetworkConnectorName=localhost,Name=localhost/127.0.0.1_"
                            + proxy.getUrl().getPort())))); will(new CustomAction("signal unregister network mbean") {
                                public Object invoke(Invocation invocation) throws Throwable {
                                    LOG.info("Mbean Unregistered: " + invocation.getParameter(0));
                                    mbeanUnregistered.release();
                                    return null;
                                }
View Full Code Here

Examples of org.jmock.lib.action.CustomAction

                allowing(velocityEngine).getTemplate(TEXT_BODY_RESOURCE);
                will(returnValue(textBodyTemplate));

                allowing(velocityEngine).evaluate(with(any(VelocityContext.class)), with(any(StringWriter.class)),
                        with(any(String.class)), with(equal(SUBJECT_TEMPLATE)));
                will(new CustomAction("Render subject")
                {
                    public Object invoke(final Invocation inv) throws Throwable
                    {
                        ((StringWriter) inv.getParameter(1)).append(SUBJECT_RENDERED);
                        return true;
                    }
                });

                allowing(textBodyTemplate).merge(with(any(VelocityContext.class)), with(any(StringWriter.class)));
                will(new CustomAction("Render text body")
                {
                    public Object invoke(final Invocation inv) throws Throwable
                    {
                        ((StringWriter) inv.getParameter(1)).append(TEXT_BODY_RENDERED);
                        return null;
                    }
                });

                allowing(htmlBodyTemplate).merge(with(any(VelocityContext.class)), with(any(StringWriter.class)));
                will(new CustomAction("Render HTML body")
                {
                    public Object invoke(final Invocation inv) throws Throwable
                    {
                        ((StringWriter) inv.getParameter(1)).append(HTML_BODY_RENDERED);
                        return null;
View Full Code Here

Examples of org.jmock.lib.action.CustomAction

                    {
                        return (notNull ? contextWithPrincipalMatcher : contextWithNullPrincipalMatcher)
                                .matches(inTestObject.getActionContext());
                    }
                }));
                will(new CustomAction("execute task handler execution")
                {
                    @Override
                    public Object invoke(final Invocation inInvocation) throws Throwable
                    {
                        userActionRequests.add(userActionRequest);
View Full Code Here

Examples of org.jmock.lib.action.CustomAction

                    protected boolean isMatch(final TaskHandlerActionContext inTestObject)
                    {
                        return contextMatcher.matches(inTestObject.getActionContext());
                    }
                }));
                will(new CustomAction("execute task handler execution")
                {
                    @Override
                    public Object invoke(final Invocation inInvocation) throws Throwable
                    {
                        userActionRequests.add(userActionRequest);
View Full Code Here

Examples of org.jmock.lib.action.CustomAction

                 * callback on the proxy, leaving it to the test class to
                 * control when the callback is called. It is set it up like
                 * this to imitate the asynchronous nature of rpc
                 */

                will(new CustomAction(
                        "Instead of call the success method on the callback, set the callback on the proxy")
                {
                    public Object invoke(final Invocation invocation)
                            throws Throwable
                    {
View Full Code Here

Examples of org.jmock.lib.action.CustomAction

        mockery.checking(new Expectations()
        {
            {
                oneOf(messageProcessor).execute(with(same(message)), with(any(List.class)));
                will(new CustomAction("simulate error")
                {
                    @Override
                    public Object invoke(final Invocation inInvocation) throws Throwable
                    {
                        ((List<Message>) inInvocation.getParameter(1)).add(responseMessage);
View Full Code Here

Examples of org.jmock.lib.action.CustomAction

                allowing(velocityEngine).getTemplate(TEXT_BODY_RESOURCE);
                will(returnValue(textBodyTemplate));

                allowing(velocityEngine).evaluate(with(any(VelocityContext.class)), with(any(StringWriter.class)),
                        with(any(String.class)), with(equal(SUBJECT_TEMPLATE)));
                will(new CustomAction("Render subject")
                {
                    public Object invoke(final Invocation inv) throws Throwable
                    {
                        assertVelocityContext(inv);
                        ((StringWriter) inv.getParameter(1)).append(SUBJECT_RENDERED);
                        return true;
                    }
                });

                allowing(textBodyTemplate).merge(with(any(VelocityContext.class)), with(any(StringWriter.class)));
                will(new CustomAction("Render text body")
                {
                    public Object invoke(final Invocation inv) throws Throwable
                    {
                        assertVelocityContext(inv);
                        ((StringWriter) inv.getParameter(1)).append(TEXT_BODY_RENDERED);
                        return null;
                    }
                });

                allowing(htmlBodyTemplate).merge(with(any(VelocityContext.class)), with(any(StringWriter.class)));
                will(new CustomAction("Render HTML body")
                {
                    public Object invoke(final Invocation inv) throws Throwable
                    {
                        assertVelocityContext(inv);
                        ((StringWriter) inv.getParameter(1)).append(HTML_BODY_RENDERED);
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.