rendered paste bodyProperty changes on: .___________________________________________________________________Added: svn:ignore + bindoclast.fm-bindings-*.ziplast.fm-bindings.jarIndex: build.xml===================================================================--- build.xml (revision 53)+++ build.xml (working copy)@@ -6,6 +6,22 @@ <property name="bin" value="bin/production/last.fm"/> <property name="doc" value="doc"/> + <property name="tests.src" value="tests/junit/src"/>+ <property name="tests.bin" value="bin/tests/classes"/>+ <property name="tests.report" value="bin/tests/report"/>+ <property name="tests.coverage" value="bin/tests/coverage"/>++ <property name="buildtools" value="buildtools"/>+ <property name="junit.jar" value="${buildtools}/junit-4.5.jar"/>+ <property name="emma.jar" value="${buildtools}/emma.jar"/>+ <property name="emma_ant.jar" value="${buildtools}/emma_ant.jar"/>+ <path id="emma.lib">+ <pathelement location="${emma.jar}" />+ <pathelement location="${emma_ant.jar}" />+ </path>++ <taskdef resource="emma_ant.properties" classpathref="emma.lib" />+ <target name="init"> <tstamp> <format property="date" pattern="M.d"/>@@ -13,10 +29,19 @@ </target> <target name="compile">- <delete includeemptydirs="true">+ <delete includeemptydirs="true" failonerror="no"> <fileset dir="${bin}" includes="**/*"/> </delete>+ <mkdir dir="${bin}" /> <javac srcdir="${src}" destdir="${bin}" debug="on" debuglevel="lines,vars,source"/>+ <emma enabled="${emma.enabled}">+ <instr instrpath="${bin}"+ metadatafile="${tests.coverage}/metadata.emma"+ merge="true"+ mode="overwrite">+ <filter includes="net.roarsoftware.*" />+ </instr>+ </emma> </target> <target name="jar" depends="init">@@ -24,13 +49,71 @@ </target> <target name="javadoc">- <delete includeemptydirs="true">+ <delete includeemptydirs="true" failonerror="no"> <fileset dir="${doc}" includes="**/*"/> </delete> <javadoc sourcepath="${src}" destdir="${doc}" link="http://java.sun.com/j2se/1.5.0/docs/api/" excludepackagenames="examples, test"/> </target> + <target name="enableEmma">+ <property name="emma.enabled" value="true" />+ </target>+ + <target name="compile-tests">+ <mkdir dir="${tests.bin}" />+ <javac srcdir="${tests.src}" destdir="${tests.bin}" debug="on" debuglevel="lines,vars,source">+ <classpath>+ <pathelement location="${junit.jar}" />+ <pathelement location="${bin}" />+ </classpath>+ </javac>+ </target>++ <target name="test" depends="init, enableEmma, compile, compile-tests">+ <delete includeemptydirs="true" failonerror="no">+ <fileset dir="${tests.report}" includes="**/*" />+ </delete>+ <mkdir dir="${tests.report}" />+ <junit printsummary="yes" haltonfailure="no" haltonerror="no" failureProperty="tests.fail" errorProperty="tests.fail" fork="yes" forkmode="once">++ <jvmarg value="-Xms32M" />+ <jvmarg value="-Xmx32M" />+ <jvmarg value="-enableassertions" />+ <jvmarg value="-Demma.coverage.out.file=${tests.coverage}/coverage.emma" />+ <jvmarg value="-Demma.coverage.out.merge=true" />+ <jvmarg value="-Demma.verbosity.level=quiet" />+ <jvmarg value="-Dcoverage.enabled=true" />++ <classpath>+ <pathelement location="${junit.jar}" />+ <pathelement location="${bin}" />+ <pathelement location="${tests.bin}" />+ <path refid="emma.lib" />+ </classpath>++ <formatter type="plain" />+ <batchtest todir="${tests.report}">+ <fileset dir="${tests.src}">+ <include name="**/*Test.java" />+ </fileset>+ </batchtest>++ </junit>+ <fail message="At least one unit test failed" if="tests.fail" />++ <mkdir dir="${tests.coverage}" />+ <emma enabled="${emma.enabled}">+ <report sourcepath="${src}">+ <fileset dir="${tests.coverage}">+ <include name="*.emma" />+ </fileset>+ <txt outfile="${tests.coverage}/coverage.txt" />+ <html outfile="${tests.coverage}/coverage.html" />+ </report>+ </emma>+ </target>+ <target name="create-snapshot" depends="init, compile, jar, javadoc"> <zip file="last.fm-bindings-${date}.zip"> <fileset dir="." includes="${src}/**/*" excludes="${src}/test/*"/>@@ -40,4 +123,4 @@ </zip> </target> -</project>\ No newline at end of file+</project>Index: buildtools/emma.jar===================================================================Cannot display: file marked as a binary type.svn:mime-type = application/octet-streamProperty changes on: buildtools\emma.jar___________________________________________________________________Added: svn:mime-type + application/octet-streamIndex: buildtools/emma_ant.jar===================================================================Cannot display: file marked as a binary type.svn:mime-type = application/octet-streamProperty changes on: buildtools\emma_ant.jar___________________________________________________________________Added: svn:mime-type + application/octet-streamIndex: buildtools/junit-4.5.jar===================================================================Cannot display: file marked as a binary type.svn:mime-type = application/octet-streamProperty changes on: buildtools\junit-4.5.jar___________________________________________________________________Added: svn:mime-type + application/octet-streamIndex: 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 @@+<?xml version="1.0" encoding="utf-8"?>+<lfm status="ok">+<track>+ <id>22234439</id>+ <name>CycleswithinCycleswithin</name>+ <mbid></mbid>+ <url>http://www.last.fm/music/Tipper/_/CycleswithinCycleswithin</url>+ <duration>241000</duration>+ <streamable fulltrack="0">0</streamable> + <listeners>544</listeners>+ <playcount>1841</playcount> + <artist>+ <name>Tipper</name>+ <mbid>c3cf7f15-4a5e-4e9e-bce7-5e5b101fa29c</mbid>+ <url>http://www.last.fm/music/Tipper</url>+ </artist>+ <toptags>+ <tag>+ <name>idm</name>+ <url>http://www.last.fm/tag/idm</url>+ </tag>+ <tag>+ <name>breakbeat</name>+ <url>http://www.last.fm/tag/breakbeat</url>+ </tag>+ <tag>+ <name>musique pour pleurer des larmes multicolores</name>+ <url>http://www.last.fm/tag/musique%20pour%20pleurer%20des%20larmes%20multicolores</url>+ </tag>+ </toptags>+ </track></lfm>