Package org.cyclopsgroup.jmxterm

Examples of org.cyclopsgroup.jmxterm.MockSession


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


                will( returnValue( new String[] { "a", "b" } ) );
                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( "b:type=1\n", output.toString() );
    }
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" ) ) ) ) );
            }
        } );
        MockSession session = new MockSession( output, conn );
        session.setDomain( "b" );
        command.setSession( session );
        command.execute();
        context.assertIsSatisfied();
        assertEquals( "a:type=1\na:type=2\nb:type=1\n", output.toString() );
    }
View Full Code Here

        throws IOException, JMException
    {
        Mockery context = new Mockery();
        final MBeanServerConnection con = context.mock( MBeanServerConnection.class );
        command.setBean( beanName );
        MockSession s = new MockSession( output, con );
        if ( domainName != null )
        {
            s.setDomain( domainName );
        }
        context.checking( new Expectations()
        {
            {
                atLeast( 1 ).of( con ).getMBeanInfo( new ObjectName( expectedBean ) );
            }
        } );
        command.setSession( s );
        command.execute();
        assertEquals( expectedBean, s.getBean() );
    }
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 s = new MockSession( output, null );
        s.setBean( "something" );
        command.setSession( s );
        command.execute();
        assertEquals( "something", output.toString().trim() );
    }
View Full Code Here

    @Test( expected = IllegalArgumentException.class )
    public void testExecuteWithInvalidBean()
        throws IOException, JMException
    {
        command.setBean( "blablabla" );
        command.setSession( new MockSession( output, null ) );
        command.execute();
    }
View Full Code Here

    @Test
    public void testExecuteWithSettingNull()
        throws IOException, JMException
    {
        command.setBean( "null" );
        MockSession s = new MockSession( output, null );
        s.setBean( "something" );
        command.setSession( s );
        command.execute();
        assertNull( s.getBean() );
    }
View Full Code Here

            {
                one( con ).getDomains();
                will( returnValue( new String[] { "a", "b" } ) );
            }
        } );
        command.setSession( new MockSession( output, con ) );
        command.execute();
        context.assertIsSatisfied();
        assertEquals( "a" + SystemUtils.LINE_SEPARATOR + "b", output.toString().trim() );
    }
View Full Code Here

                        }
                    } ) );
                }
            } );

            command.setSession( new MockSession( output, con ) );
            command.execute();
        }
        catch ( IOException e )
        {
            throw new RuntimeException( e );
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.