Package org.eclipse.sapphire

Examples of org.eclipse.sapphire.Counter


    @Test
   
    public void testReadUnderlyingListCount()
    {
        final TestResource resource = new TestResource();
        final Counter counter = resource.getReadUnderlyingListCounter();
        final TestElement element = TestElement.TYPE.instantiate( resource );
        final ElementList<Element> list = element.getList();
       
        list.iterator(); // prime
        counter.reset();
       
        list.refresh();
        assertEquals( 1, counter.read() );
        counter.reset();
       
        list.insert();
        assertEquals( 1, counter.read() );
        counter.reset();

        list.remove( 0 );
        assertEquals( 1, counter.read() );
        counter.reset();
       
        final Element a = list.insert();
        final Element b = list.insert();
        assertEquals( 2, counter.read() );
        counter.reset();
       
        list.moveDown( a );
        assertEquals( 1, counter.read() );
        counter.reset();
       
        list.moveUp( a );
        assertEquals( 1, counter.read() );
        counter.reset();
       
        list.move( b, 0 );
        assertEquals( 1, counter.read() );
        counter.reset();
    }
View Full Code Here


        testUniqueValuePerformance( 100000 );
    }
   
    private void testUniqueValuePerformance( final int entries ) throws Exception
    {
        final Counter counter = Counter.find( UniqueValueValidationService.class );
       
        final ByteArrayResourceStore byteArrayResourceStore = new ByteArrayResourceStore( generateTestData( entries ) );
        final XmlResourceStore xmlResourceStore = new XmlResourceStore( byteArrayResourceStore );
       
        counter.reset();
       
        final TestElement element = TestElement.TYPE.instantiate( new RootXmlResource( xmlResourceStore ) );
        element.validation();
        assertEquals( entries, counter.read() );
       
        counter.reset();
       
        element.getList().get( 0 ).setValue( "a" );
        element.validation();
        assertEquals( entries + 1, counter.read() );
       
        counter.reset();
       
        element.getList().get( 0 ).setValue( "9" );
        element.validation();
        assertEquals( entries + 1, counter.read() );
    }
View Full Code Here

TOP

Related Classes of org.eclipse.sapphire.Counter

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.