Package org.apache.excalibur.instrument

Examples of org.apache.excalibur.instrument.CounterInstrument


        }
       
        // Make sure that instruments can no longer be added
        try
        {
            impl.addInstrument( new CounterInstrument( "bad" ) );
            fail( "Should not have been able to add more instruments" );
        }
        catch ( IllegalStateException e )
        {
            // Ok
View Full Code Here


   
    public void test1Instrument() throws Exception
    {
        Instrument[] instruments = new Instrument[]
            {
                new CounterInstrument( "c1" )
            };
        Instrumentable[] children = new Instrumentable[] {};
       
        generalTest( instruments, children );
    }
View Full Code Here

   
    public void testNInstrument() throws Exception
    {
        Instrument[] instruments = new Instrument[]
            {
                new CounterInstrument( "c1" ),
                new ValueInstrument( "v1" ),
                new CounterInstrument( "c2" ),
                new ValueInstrument( "v2" ),
                new CounterInstrument( "c3" ),
                new ValueInstrument( "v3" ),
                new CounterInstrument( "c4" ),
                new ValueInstrument( "v4" )
            };
        Instrumentable[] children = new Instrumentable[] {};
       
        generalTest( instruments, children );
View Full Code Here

    /*---------------------------------------------------------------
     * Test Cases
     *-------------------------------------------------------------*/
    public void testSimpleIncrementDisconnected() throws Exception
    {
        CounterInstrument ci = new CounterInstrument( "testInstrument" );
        assertEquals( "A disconnected instrument should not be active.", ci.isActive(), false );
       
        ci.increment( 1 );
    }
View Full Code Here

        ci.increment( 1 );
    }
   
    public void testCount1IncrementDisconnected() throws Exception
    {
        CounterInstrument ci = new CounterInstrument( "testInstrument" );
        assertEquals( "A disconnected instrument should not be active.", ci.isActive(), false );
       
        ci.increment( 1 );
    }
View Full Code Here

        ci.increment( 1 );
    }
   
    public void testCount0IncrementDisconnected() throws Exception
    {
        CounterInstrument ci = new CounterInstrument( "testInstrument" );
        try
        {
            ci.increment( 0 );
            fail( "calling increment with a count of 0 should fail." );
        }
        catch ( IllegalArgumentException e )
        {
            // Ok
View Full Code Here

        }
    }
   
    public void testCountNegIncrementDisconnected() throws Exception
    {
        CounterInstrument ci = new CounterInstrument( "testInstrument" );
        try
        {
            ci.increment( -1 );
            fail( "calling increment with a negative count should fail." );
        }
        catch ( IllegalArgumentException e )
        {
            // Ok
View Full Code Here

        }
    }
   
    public void testSimpleIncrementConnectedInactive() throws Exception
    {
        CounterInstrument ci = new CounterInstrument( "testInstrument" );
        TestInstrumentProxy proxy = new TestInstrumentProxy();
        ci.setInstrumentProxy( proxy );
       
        assertEquals( "The instrument should not be active.", ci.isActive(), false );
       
        ci.increment();
       
        assertEquals( "The expected count was incorrect.", proxy.getValue(), 1 );
       
        ci.increment();
        assertEquals( "The expected count was incorrect.", proxy.getValue(), 2 );
    }
View Full Code Here

        assertEquals( "The expected count was incorrect.", proxy.getValue(), 2 );
    }
   
    public void testCount1IncrementConnectedInactive() throws Exception
    {
        CounterInstrument ci = new CounterInstrument( "testInstrument" );
        TestInstrumentProxy proxy = new TestInstrumentProxy();
        ci.setInstrumentProxy( proxy );
       
        assertEquals( "The instrument should not be active.", ci.isActive(), false );
       
        ci.increment( 1 );
       
        assertEquals( "The expected count was incorrect.", proxy.getValue(), 1 );
       
        ci.increment( 2 );
        assertEquals( "The expected count was incorrect.", proxy.getValue(), 3 );
    }
View Full Code Here

        assertEquals( "The expected count was incorrect.", proxy.getValue(), 3 );
    }
   
    public void testSimpleIncrementConnectedActive() throws Exception
    {
        CounterInstrument ci = new CounterInstrument( "testInstrument" );
        TestInstrumentProxy proxy = new TestInstrumentProxy();
        ci.setInstrumentProxy( proxy );
        proxy.activate();
       
        assertEquals( "The instrument should br active.", ci.isActive(), true );
       
        ci.increment();
       
        assertEquals( "The expected count was incorrect.", proxy.getValue(), 1 );
    }
View Full Code Here

TOP

Related Classes of org.apache.excalibur.instrument.CounterInstrument

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.