Property changes on: . ___________________________________________________________________ Added: svn:ignore + bin doc last.fm-bindings-*.zip last.fm-bindings.jar Index: build.xml =================================================================== --- build.xml (revision 53) +++ build.xml (working copy) @@ -6,6 +6,22 @@ + + + + + + + + + + + + + + + + @@ -13,10 +29,19 @@ - + + + + + + + @@ -24,13 +49,71 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -40,4 +123,4 @@ - \ No newline at end of file + Index: buildtools/emma.jar =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: buildtools\emma.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: buildtools/emma_ant.jar =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: buildtools\emma_ant.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: buildtools/junit-4.5.jar =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: buildtools\junit-4.5.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: tests/junit/src/net/roarsoftware/lastfm/TrackTest.java =================================================================== --- tests/junit/src/net/roarsoftware/lastfm/TrackTest.java (revision 0) +++ tests/junit/src/net/roarsoftware/lastfm/TrackTest.java (revision 0) @@ -0,0 +1,40 @@ +package net.roarsoftware.lastfm; + +import static org.junit.Assert.assertEquals; +import net.roarsoftware.lastfm.testutil.TestDataCache; + +import org.junit.Before; +import org.junit.Test; + +public class TrackTest { + + @Before + public void setUp() throws Exception { + Caller.getInstance().setCache(new TestDataCache()); + } + + @Test + public void testGetInfo_noAlbum() { + + Track track = Track.getInfo("Tipper", "CycleswithinCycleswithin", "test.key"); + + assertEquals(null, track.getAlbum()); + assertEquals(null, track.getAlbumMbid()); + assertEquals("Tipper", track.getArtist()); + assertEquals("c3cf7f15-4a5e-4e9e-bce7-5e5b101fa29c", track.getArtistMbid()); + assertEquals(241, track.getDuration()); + assertEquals(544, track.getListeners()); + assertEquals(null, track.getLocation()); + assertEquals("", track.getMbid()); + assertEquals("CycleswithinCycleswithin", track.getName()); + assertEquals(1841, track.getPlaycount()); + assertEquals(null, track.getPlayedWhen()); + assertEquals(3, track.getTags().size()); + assertEquals("http://www.last.fm/music/Tipper/_/CycleswithinCycleswithin", track.getUrl()); + assertEquals(null, track.getWikiLastChanged()); + assertEquals(null, track.getWikiSummary()); + assertEquals(null, track.getWikiText()); + + } + +} Index: tests/junit/src/net/roarsoftware/lastfm/testutil/TestDataCache.java =================================================================== --- tests/junit/src/net/roarsoftware/lastfm/testutil/TestDataCache.java (revision 0) +++ tests/junit/src/net/roarsoftware/lastfm/testutil/TestDataCache.java (revision 0) @@ -0,0 +1,91 @@ +package net.roarsoftware.lastfm.testutil; + +import java.io.File; +import java.io.InputStream; + +import net.roarsoftware.lastfm.cache.FileSystemCache; + +public class TestDataCache extends FileSystemCache { + + private static String testDataDirectory = "tests/testData"; + + static { + String testDataDirOverride = System.getProperty("net.roarsoftware.lastfm.testdata.path"); + if (testDataDirOverride != null) { + testDataDirectory = testDataDirOverride; + } + } + + public TestDataCache() { + super(new File(testDataDirectory)); + this.verifyTestDataDirectory(); + } + + /** + * Verify test data directory. + */ + private void verifyTestDataDirectory() { + File testDataPath = new File(testDataDirectory); + if (!testDataPath.isDirectory()) { + throw new RuntimeException("Error: '" + + testDataPath.getPath() + + "' is not a valid directory. Please ensure system property 'net.roarsoftware.lastfm.testdata.path' is set correctly."); + } + } + + /** + * {@inheritDoc} + */ + @Override + public void clear() { + // Don't clear test data cache. + } + + /** + * {@inheritDoc} + */ + @Override + public boolean contains(String cacheEntryName) { + boolean found = super.contains(cacheEntryName); + + if (!found) { + System.err.println("Warning: entry not found in test data cache: " + cacheEntryName); + } + + return found; + } + + /** + * {@inheritDoc} + */ + @Override + public boolean isExpired(String cacheEntryName) { + // Test data doesn't expire. + return false; + } + + /** + * {@inheritDoc} + */ + @Override + public InputStream load(String cacheEntryName) { + return super.load(cacheEntryName); + } + + /** + * {@inheritDoc} + */ + @Override + public void remove(String cacheEntryName) { + // Don't remove test data cache entries. + } + + /** + * {@inheritDoc} + */ + @Override + public void store(String cacheEntryName, InputStream inputStream, long expirationDate) { + // Test data is added manually. + } + +} Index: tests/testData/track.getinfo.artistTippertrackCycleswithinCycleswithin.xml =================================================================== --- tests/testData/track.getinfo.artistTippertrackCycleswithinCycleswithin.xml (revision 0) +++ tests/testData/track.getinfo.artistTippertrackCycleswithinCycleswithin.xml (revision 0) @@ -0,0 +1,31 @@ + + + + 22234439 + CycleswithinCycleswithin + + http://www.last.fm/music/Tipper/_/CycleswithinCycleswithin + 241000 + 0 + 544 + 1841 + + Tipper + c3cf7f15-4a5e-4e9e-bce7-5e5b101fa29c + http://www.last.fm/music/Tipper + + + + idm + http://www.last.fm/tag/idm + + + breakbeat + http://www.last.fm/tag/breakbeat + + + musique pour pleurer des larmes multicolores + http://www.last.fm/tag/musique%20pour%20pleurer%20des%20larmes%20multicolores + + +