Package org.cyclopsgroup.jmxterm

Examples of org.cyclopsgroup.jmxterm.MockSession


                will( returnValue( SelfRecordingCommand.class ) );
                one( cc ).getCommandType( "b" );
                will( returnValue( SelfRecordingCommand.class ) );
            }
        } );
        command.setSession( new MockSession( output, null ) );
        command.execute();
        context.assertIsSatisfied();
    }
View Full Code Here


                will( returnValue( SelfRecordingCommand.class ) );
                one( cc ).getCommandType( "b" );
                will( returnValue( SelfRecordingCommand.class ) );
            }
        } );
        command.setSession( new MockSession( output, null ) );
        command.execute();
        assertEquals( "a        - desc" + SystemUtils.LINE_SEPARATOR + "b        - desc", output.toString().trim() );
    }
View Full Code Here

        throws IOException, JMException
    {
        Mockery context = new Mockery();
        final MBeanServerConnection con = context.mock( MBeanServerConnection.class );
        command.setDomain( domainName );
        MockSession session = new MockSession( output, con );
        context.checking( new Expectations()
        {
            {
                one( con ).getDomains();
                will( returnValue( knownDomains ) );
            }
        } );
        command.setSession( session );
        command.execute();
        assertEquals( domainName, session.getDomain() );
        context.assertIsSatisfied();
    }
View Full Code Here

     */
    @Test
    public void testExecuteWithGettingNull()
        throws IOException, JMException
    {
        command.setSession( new MockSession( output, null ) );
        command.execute();
        assertEquals( "null", output.toString().trim() );
    }
View Full Code Here

     */
    @Test
    public void testExecuteWithGettingSomething()
        throws IOException, JMException
    {
        MockSession session = new MockSession( output, null );
        session.setDomain( "something" );
        command.setSession( session );
        command.execute();
        assertEquals( "something", output.toString().trim() );
    }
View Full Code Here

                atLeast(1).of(notification).getMessage();
                will(returnValue("qwerty"));
            }
        });
        command.setSession(new MockSession(output, con));
        command.execute();
        assertEquals( 1, SubscribeCommand.getListeners().size() );

        NotificationListener notificationListener = SubscribeCommand.getListeners().get( objectName );
        assertNotNull( notificationListener );
View Full Code Here

                atLeast(1).of(notification).getMessage();
                will(returnValue("qwerty"));
            }
        });
        command.setSession(new MockSession(output, con));
        command.execute();
        assertEquals( 1, SubscribeCommand.getListeners().size() );

        NotificationListener notificationListener = SubscribeCommand.getListeners().get( objectName );
        assertNotNull( notificationListener );
View Full Code Here

        command.setBean( "a:type=x" );
        command.setType( "a" );
        final MBeanServerConnection con = context.mock( MBeanServerConnection.class );
        final MBeanInfo beanInfo = context.mock( MBeanInfo.class );
        final MBeanAttributeInfo attributeInfo = context.mock( MBeanAttributeInfo.class );
        Session session = new MockSession( output, con );
        context.checking( new Expectations()
        {
            {
                atLeast( 1 ).of( con ).getMBeanInfo( new ObjectName( "a:type=x" ) );
                will( returnValue( beanInfo ) );
View Full Code Here

        command.setType( "o" );
        final MBeanServerConnection con = context.mock( MBeanServerConnection.class );
        final MBeanInfo beanInfo = context.mock( MBeanInfo.class );
        final MBeanOperationInfo opInfo = context.mock( MBeanOperationInfo.class );
        final MBeanParameterInfo paramInfo = context.mock( MBeanParameterInfo.class );
        Session session = new MockSession( output, con );
        context.checking( new Expectations()
        {
            {
                atLeast( 1 ).of( con ).getMBeanInfo( new ObjectName( "a:type=x" ) );
                will( returnValue( beanInfo ) );
View Full Code Here

                                                                           new ObjectName( "a:type=2" ) ) ) ) );
                atLeast( 1 ).of( conn ).queryNames( new ObjectName( "b:*" ), null );
                will( returnValue( new HashSet<ObjectName>( Arrays.asList( new ObjectName( "b:type=1" ) ) ) ) );
            }
        } );
        command.setSession( new MockSession( output, conn ) );
        command.execute();
        context.assertIsSatisfied();
        assertEquals( "a:type=1\na:type=2\nb:type=1\n", output.toString() );
    }
View Full Code Here

TOP

Related Classes of org.cyclopsgroup.jmxterm.MockSession

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.