Package com.pugh.sockso.tests

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


    }

    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

       
    }

    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

    }

    public void testSaveAndRemovePlaylist() throws Exception {

        final TestDatabase db = new TestDatabase();
        final DBCollectionManager cm = new DBCollectionManager( db, p, indexer );
        final String name = Utils.getRandomString( 20 );

        db.fixture( "singleTrack" );

        final Track[] tracks = new Track[] {
            cm.getTrack( 1 )
        };
View Full Code Here

    }

    public void testRemoveEmptyArtists() throws Exception {

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

        // Should delete Artists with no Track or Album references
        db.fixture( "artists" );

        assertTableSize( db, "artists", 3 );
        assertTableSize( db, "albums", 0 );
        assertTableSize( db, "tracks", 0 );
View Full Code Here

    private TestDatabase db;

    @Override
    public void setUp() throws Exception {
        db = new TestDatabase();
        auth = new DBAuthenticator( db );
        db.fixture( "singleUser" );
    }
View Full Code Here

       
    }
   
    public void testUsernameExists() throws Exception {

        TestDatabase db = new TestDatabase();

        Validater v = new Validater( db );
        final String email = "rod@pu-gh.com";

        assertFalse( v.emailExists(email) );

        db.fixture( "singleUser" );

        assertTrue( v.emailExists(email) );
       
    }
View Full Code Here

    }


    public void testDoesNotRemoveArtistsWithAlbums() throws Exception {

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

        // Should not delete an Artist that has Albums referencing it
        db.fixture( "artistsWithAlbums" );

        assertTableSize( db, "artists", 1 );
        assertTableSize( db, "albums", 1 );
        assertTableSize( db, "tracks", 0 );
View Full Code Here

       
    }
   
    public void testEmailExists() throws Exception {

        TestDatabase db = new TestDatabase();

        Validater v = new Validater( db );
        final String username = "foo";

        assertFalse( v.usernameExists(username) );

        db.fixture( "singleUser" );

        assertTrue( v.usernameExists(username) );
       
    }
View Full Code Here

        assertTableSize( db, "tracks", 0 );
    }

    public void testDoesNotRemoveArtistsWithTracks() throws Exception {

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

        // Should not delete an Artist that has Tracks referencing it
        db.fixture( "artistsWithTracks" );

        assertTableSize( db, "artists", 1 );
        assertTableSize( db, "albums", 0 );
        assertTableSize( db, "tracks", 1 );
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.