Examples of TestDatabase


Examples of com.pugh.sockso.tests.TestDatabase

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

Examples of com.pugh.sockso.tests.TestDatabase

        assertFalse( action.canHandle(getRequest( "/api/artists/123" )) );
        assertFalse( action.canHandle(getRequest( "/api/albums/123/tracks" )) );
    }
   
    public void testTracksListedWhenArtistIdFound() throws Exception {
        TestDatabase db = new TestDatabase();
        TestResponse res = new TestResponse();
        db.fixture( "tracksForPath" );
        action.setDatabase( db );
        action.setResponse( res );
        action.setRequest(getRequest( "/api/artists/1/tracks" ));
        action.handleRequest();
        assertContains( res.getOutput(), "My Track 1" );
View Full Code Here

Examples of com.pugh.sockso.tests.TestDatabase

    private IndexEvent indexEvent;
    private TestDatabase db;

    @Override
    public void setUp() throws Exception {
        db = new TestDatabase();
        indexer = new TrackIndexer( db );
        indexer.addIndexListener( this );
        indexEvent = null;
    }
View Full Code Here

Examples of com.pugh.sockso.tests.TestDatabase

        indexer.updateCache();
       
    }

    public void testCompleteEventFiredAfterScan() {
        final Indexer i = new TrackIndexer( new TestDatabase() );
        i.addIndexListener( this );
        i.scan();
        assertEquals( IndexEvent.Type.COMPLETE, this.indexEvent.getType() );
    }
View Full Code Here

Examples of com.pugh.sockso.tests.TestDatabase

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

Examples of com.pugh.sockso.tests.TestDatabase

    private Properties p;
   
    @Override
    protected void setUp() throws Exception {
       
        TestDatabase db = new TestDatabase();
       
        p = new StringProperties();
        res = new TestResponse();
       
        db.fixture( "artistsAlbumsAndTracks" );
       
        pl = new Xspfer();
        pl.setDatabase( db );
        pl.setResponse( res );
        pl.setProperties( p );
View Full Code Here

Examples of com.pugh.sockso.tests.TestDatabase

        super.tearDown();
    }

    public void testCheckTrackTagInfo() throws Exception {

        final TestDatabase db = new TestDatabase();
        final DBCollectionManager cm = new DBCollectionManager( db, p, indexer );

        db.fixture( "checkTrackTagChange" );

        // Verify that if tag data == track name & number in db then track is not updated
        {
            Track trackBefore = cm.getTrack(1);
View Full Code Here

Examples of com.pugh.sockso.tests.TestDatabase

       
    }
   
    public void testCheckArtistTagInfo() throws IOException, SQLException {

        final TestDatabase db = new TestDatabase();
        final DBCollectionManager cm = new DBCollectionManager( db, p, indexer );
        final String artistName = "My Artist";
       
        int firstArtistId = 0, secondArtistId = 0;

        db.fixture( "checkArtistTagChange" );

        Tag newTag = createMock( Tag.class );
        expect( newTag.getArtist() ).andReturn( artistName ).times(2);
        replay( newTag );

        Statement st = db.getConnection().createStatement();
        ResultSet rs = st.executeQuery("select * from albums where id = 1" );
       
        while (rs.next())
            firstArtistId = rs.getInt( "artist_id" );

        Utils.close( rs );
        Utils.close( st );

        Track track = cm.getTrack( 3 );
        cm.checkArtistTagInfo( newTag, track );
        track = cm.getTrack( 3 );

        st = db.getConnection().createStatement();
        rs = st.executeQuery("select * from albums where id = 3" );
       
        while (rs.next())
            secondArtistId = rs.getInt( "artist_id" );

View Full Code Here

Examples of com.pugh.sockso.tests.TestDatabase

    }

    public void testGetTrack() throws Exception {

        final TestDatabase db = new TestDatabase();
        final DBCollectionManager cm = new DBCollectionManager( db, p, indexer );

        db.fixture( "singleTrack" );

        final Track track = cm.getTrack( 1 );
       
        assertTrue( track.getPath().equals("/music/track.mp3") );
       
View Full Code Here

Examples of com.pugh.sockso.tests.TestDatabase

       
    }

    public void testGetTrackNotFound() throws Exception {

        final Database db = new TestDatabase();
        final DBCollectionManager cm = new DBCollectionManager( db, p, indexer );

        boolean gotException = false;

        try {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.