Package org.jmock.lib.action

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


            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(0), "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

    private void setupFakeJndiLookup() throws NamingException {
        CONTEXT_MOCK_FOR_TEST = context.mock(Context.class);

        context.checking(new Expectations() {{
            allowing(CONTEXT_MOCK_FOR_TEST).lookup(with(any(String.class)));
                will(new CustomAction("Fake JNDI lookup") {

                    @Override
                    public Object invoke(Invocation invocation) throws Throwable {
                        // JNDI name format like: java:global/rhq/rhq-server/SystemManagerBean!org.rhq.enterprise.server.system.SystemManagerLocal
                        String jndiName = (String) invocation.getParameter(0);
View Full Code Here

    public synchronized CustomAction mergeInventoryReport(final InventoryStatus requiredInventoryStatus) {
        return mergeInventoryReport(getSimpleJudge(requiredInventoryStatus));
    }

    public synchronized CustomAction mergeInventoryReport(final InventoryStatusJudge judge) {
        return new CustomAction("updateServerSideInventory") {
            public Object invoke(Invocation invocation) throws Throwable {
                synchronized (FakeServerInventory.this) {
                    throwIfFailing();

                    InventoryReport inventoryReport = (InventoryReport) invocation.getParameter(0);
View Full Code Here

            }
        };
    }

    public synchronized CustomAction getResourceSyncInfo() {
        return new CustomAction("getResourceSyncInfo") {
            public Object invoke(Invocation invocation) throws Throwable {
                synchronized (FakeServerInventory.this) {
                    throwIfFailing();

                    Integer resourceId = (Integer) invocation.getParameter(0);
View Full Code Here

            }
        };
    }

    public synchronized CustomAction clearPlatform() {
        return new CustomAction("updateServerSideInventory - report platform deleted on the server") {
            public Object invoke(Invocation invocation) throws Throwable {
                synchronized (FakeServerInventory.this) {
                    throwIfFailing();

                    platform = null;
View Full Code Here

            }
        };
    }

    public synchronized CustomAction setResourceError() {
        return new CustomAction("setResourceError") {
            public Object invoke(Invocation invocation) throws Throwable {
                synchronized (FakeServerInventory.this) {
                    throwIfFailing();

                    ResourceError error = (ResourceError) invocation.getParameter(0);
View Full Code Here

            }
        };
    }

    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

            }
        };
    }

    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

            }
        };
    }

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

TOP

Related Classes of org.jmock.lib.action.CustomAction

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.