Examples of CustomAction


Examples of org.jmock.lib.action.CustomAction

            }
        };
    }

    public synchronized CustomAction upgradeResources() {
        return new CustomAction("upgradeServerSideInventory") {
            @SuppressWarnings({ "serial", "unchecked" })
            public Object invoke(Invocation invocation) throws Throwable {
                synchronized (FakeServerInventory.this) {
                    throwIfFailing();
View Full Code Here

Examples of org.jmock.lib.action.CustomAction

            }
        };
    }

    public synchronized CustomAction getResources() {
        return new CustomAction("getResources") {
            @SuppressWarnings("unchecked")
            public Object invoke(Invocation invocation) throws Throwable {
                synchronized (FakeServerInventory.this) {
                    throwIfFailing();
View Full Code Here

Examples of org.jmock.lib.action.CustomAction

            }
        };
    }

    public synchronized CustomAction getResourcesAsList() {
        return new CustomAction("getResourcesAsList") {
            @Override
            public Object invoke(Invocation invocation) throws Throwable {
                synchronized (FakeServerInventory.this) {
                    throwIfFailing();
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=jobScheduler,jobSchedulerName=JMS"))));
           
            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(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

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

        _testService = context.mock(TestService.class);
        // We use one partner to simulate failing service and receive message upon process completion.
        final MessageExchangeContext partner = context.mock(MessageExchangeContext.class);
        // Some processes will complete, but not all.
        context.checking(new Expectations() {{
            atMost(1).of(partner).invokePartner(with(aMexWithOpnameIs("respond"))); will(new CustomAction("process completed") {
                public Object invoke(org.jmock.api.Invocation invocation) throws Throwable {
                    _testService.completed();
                    return null;
                }
            });
        }});

        context.checking(new Expectations() {{
            atLeast(1).of(partner).invokePartner(with(aMexWithOpnameIs("invoke"))); will(new CustomAction("invoke failing service") {
                public Object invoke(org.jmock.api.Invocation invocation) throws Throwable {
                    PartnerRoleMessageExchange mex = (PartnerRoleMessageExchange) invocation.getParameter(0);
                    if (_testService.invoke()) {
                        Message response = mex.createMessage(mex.getOperation().getOutput().getMessage().getQName());
                        response.setMessage(DOMUtils.newDocument().createElementNS(NAMESPACE, "tns:ResponseElement"));
                        mex.reply(response);
                    } else {
                        mex.replyWithFailure(MessageExchange.FailureType.COMMUNICATION_ERROR, "BangGoesInvoke", null);
                    }
                    return null;
                }
            });
        }});

        context.checking(new Expectations() {{
            atMost(1).of(partner).onAsyncReply(with(any(MyRoleMessageExchange.class))); will(new CustomAction("async reply") {
                public Object invoke(org.jmock.api.Invocation invocation) throws Throwable {
                    return null;
                }
            });
        }});
View Full Code Here

Examples of org.jmock.lib.action.CustomAction

                        with(any(UsernamePasswordAuthentication.class))); will(returnValue(user));
                atLeast(1).of(userManager).getUserByName(userNamePass); will(returnValue(user));
                atLeast(1).of(user).getHomeDirectory(); will(returnValue(ftpHomeDirFile.getParent()));
                atLeast(1).of(user).getMaxIdleTime(); will(returnValue(20000));
                atLeast(1).of(user).getName(); will(returnValue(userNamePass));
                atLeast(1).of(user).authorize( with(any(AuthorizationRequest.class))); will(new CustomAction("return first passed in param") {
                    public Object invoke(Invocation invocation)
                            throws Throwable {
                        return invocation.getParameter(0);
                    }
                });
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=jobScheduler,jobSchedulerName=JMS"))));
           
            atLeast(maxReconnects - 1).of (managementContext).registerMBean(with(any(Object.class)), with(new NetworkBridgeObjectNameMatcher<ObjectName>(
                        new ObjectName("Test:BrokerName=BrokerNC,Type=NetworkBridge,NetworkConnectorName=NC,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(1), "dscription");
                                }
                            });
            atLeast(maxReconnects - 1).of (managementContext).unregisterMBean(with(new NetworkBridgeObjectNameMatcher<ObjectName>(
                    new ObjectName("Test:BrokerName=BrokerNC,Type=NetworkBridge,NetworkConnectorName=NC,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
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.