Package com.pugh.sockso.tests

Examples of com.pugh.sockso.tests.TestDatabase


        Track track = Track.find( db, 1 );
        assertEquals( "My Album", track.getAlbum().getName() );
    }

    public void testFindingTrackReturnsAlbumObjectWithTrack() throws Exception {
        TestDatabase db = new TestDatabase();
        db.fixture( "singleTrack" );
        Track track = Track.find( db, 1 );
        assertEquals( "My Artist", track.getArtist().getName() );
    }
View Full Code Here


        Track track = Track.find( db, 1 );
        assertEquals( "My Artist", track.getArtist().getName() );
    }
   
    public void testFindallReturnsAllTracksRequested() throws Exception {
        TestDatabase db = new TestDatabase();
        db.fixture( "artistsAlbumsAndTracks" );
        List<Track> tracks = Track.findAll( db, 100, 0 );
        assertEquals( 3, tracks.size() );
    }
View Full Code Here

        assertNotNull( new SessionCleaner(null) );
    }

    public void testCleanSessionsTable() throws Exception {

        final TestDatabase db = new TestDatabase();
        final SessionCleaner c = new SessionCleaner( db );
        final String code = "abcdefghij";
       
        db.update(
            " insert into sessions ( id, code, user_id, date_created ) " +
            " values ( 1, '" +code+ "', 1, 0 ) "
        );
        assertRowExists( db, "sessions", "code", code );
       
View Full Code Here

        List<Track> tracks = Track.findAll( db, 100, 0 );
        assertEquals( 3, tracks.size() );
    }
   
    public void testFindallCanBeLimited() throws Exception {
        TestDatabase db = new TestDatabase();
        db.fixture( "artistsAlbumsAndTracks" );
        List<Track> tracks = Track.findAll( db, 2, 0 );
        assertEquals( 2, tracks.size() );
    }
View Full Code Here

    }

    public void testCurrentSessionNotDeletedOnClean() throws Exception {

        final TestDatabase db = new TestDatabase();
        final SessionCleaner c = new SessionCleaner( db );
        final String code = "abcdefghij";

        db.update(
            " insert into sessions ( id, code, user_id, date_created ) " +
            " values ( 1, '" +code+ "', 1, current_timestamp ) "
        );
        assertRowExists( db, "sessions", "code", code );
View Full Code Here

        List<Track> tracks = Track.findAll( db, 2, 0 );
        assertEquals( 2, tracks.size() );
    }
   
    public void testFindallCanBeOffset() throws Exception {
        TestDatabase db = new TestDatabase();
        db.fixture( "artistsAlbumsAndTracks" );
        List<Track> tracks = Track.findAll( db, 100, 1 );
        assertEquals( 2, tracks.size() );
    }
View Full Code Here

        List<Track> tracks = Track.findAll( db, 100, 1 );
        assertEquals( 2, tracks.size() );
    }
   
    public void testFindallWithLimitOfMinusOneMeansNoLimit() throws Exception {
        TestDatabase db = new TestDatabase();
        db.fixture( "artistsAlbumsAndTracks" );
        List<Track> tracks = Track.findAll( db, -1, 0 );
        assertEquals( 3, tracks.size() );
    }
View Full Code Here

    @Override
    protected void setUp() {
        p = new StringProperties();
        p.set( Constants.WWW_BROWSE_FOLDERS_ENABLED, Properties.YES );
        db = new TestDatabase();
    }
View Full Code Here

    // sufficiently low probability of this (or develop a better way of testing
    // the randomness.
    protected boolean doRandomTest( final String orderBy ) throws Exception {
        boolean wereDifferent = false;
        for ( int i=0; i<100; i++ ) {
            db = new TestDatabase();
            TracksRequest tr = getInstance( "/tr1/tr2/tr3" );
            req.setArgument( "orderBy", orderBy );
            Track[] first = tr.getRequestedTracks();
            Track[] second = tr.getRequestedTracks();
            if ( !Arrays.equals(first,second) ) {
View Full Code Here

   
    private TestResponse res;
   
    @Override
    protected void setUp() throws Exception {
        TestDatabase db = new TestDatabase();
        db.fixture( "playlists" );
        res = new TestResponse();
        action = new Playlister();
        action.setDatabase( db );
        action.setResponse( res );
    }
View Full Code Here

TOP

Related Classes of com.pugh.sockso.tests.TestDatabase

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.