Merge remote-tracking branch 'origin/pr/1332'

master
Andrew DeMaria 5 years ago
commit ceb6b3e598
No known key found for this signature in database
GPG Key ID: 0A3F5E91F8364EDF
  1. 6
      airsonic-main/src/test/java/org/airsonic/player/TestCaseUtils.java
  2. 3
      airsonic-main/src/test/java/org/airsonic/player/dao/DaoTestCaseBean2.java
  3. 2
      airsonic-main/src/test/java/org/airsonic/player/dao/InternetRadioDaoTestCase.java
  4. 2
      airsonic-main/src/test/java/org/airsonic/player/dao/MusicFolderDaoTestCase.java
  5. 4
      airsonic-main/src/test/java/org/airsonic/player/dao/PlayerDaoTestCase.java
  6. 4
      airsonic-main/src/test/java/org/airsonic/player/dao/PodcastDaoTestCase.java
  7. 2
      airsonic-main/src/test/java/org/airsonic/player/dao/UserDaoTestCase.java
  8. 6
      airsonic-main/src/test/java/org/airsonic/player/domain/PlayQueueTestCase.java
  9. 2
      airsonic-main/src/test/java/org/airsonic/player/service/JukeboxServiceUnitTest.java
  10. 4
      airsonic-main/src/test/java/org/airsonic/player/service/LegacyDatabaseStartupTestCase.java
  11. 12
      airsonic-main/src/test/java/org/airsonic/player/service/MediaScannerServiceTestCase.java
  12. 1
      airsonic-main/src/test/java/org/airsonic/player/service/SecurityServiceTestCase.java
  13. 1
      airsonic-main/src/test/java/org/airsonic/player/service/TranscodingServiceIntTest.java
  14. 8
      airsonic-main/src/test/java/org/airsonic/player/service/search/AbstractAirsonicHomeTest.java
  15. 6
      airsonic-main/src/test/java/org/airsonic/player/service/search/AirsonicHomeTest.java
  16. 14
      airsonic-main/src/test/java/org/airsonic/player/service/search/AnalyzerFactoryTestCase.java
  17. 4
      airsonic-main/src/test/java/org/airsonic/player/service/search/IndexManagerTestCase.java
  18. 15
      airsonic-main/src/test/java/org/airsonic/player/service/search/SearchServiceSpecialGenreTestCase.java
  19. 13
      airsonic-main/src/test/java/org/airsonic/player/service/search/SearchServiceSpecialPathTestCase.java
  20. 11
      airsonic-main/src/test/java/org/airsonic/player/service/search/SearchServiceStartWithStopwardsTestCase.java
  21. 12
      airsonic-main/src/test/java/org/airsonic/player/service/search/SearchServiceTestCase.java
  22. 2
      airsonic-main/src/test/java/org/airsonic/player/util/HomeRule.java
  23. 1
      airsonic-main/src/test/java/org/airsonic/player/util/MusicFolderTestData.java
  24. 1
      pom.xml

@ -43,7 +43,6 @@ public class TestCaseUtils {
} }
/** /**
*
* @return current REST api version. * @return current REST api version.
*/ */
public static String restApiVersion() { public static String restApiVersion() {
@ -66,7 +65,6 @@ public class TestCaseUtils {
throw e; throw e;
} }
} }
} }
/** /**
@ -93,7 +91,6 @@ public class TestCaseUtils {
return daoHelper.getJdbcTemplate().queryForObject("select count(1) from " + tableName,Integer.class); return daoHelper.getJdbcTemplate().queryForObject("select count(1) from " + tableName,Integer.class);
} }
public static ApplicationContext loadSpringApplicationContext(String baseResources) { public static ApplicationContext loadSpringApplicationContext(String baseResources) {
String applicationContextService = baseResources + "applicationContext-service.xml"; String applicationContextService = baseResources + "applicationContext-service.xml";
String applicationContextCache = baseResources + "applicationContext-cache.xml"; String applicationContextCache = baseResources + "applicationContext-cache.xml";
@ -105,7 +102,6 @@ public class TestCaseUtils {
return new ClassPathXmlApplicationContext(configLocations); return new ClassPathXmlApplicationContext(configLocations);
} }
/** /**
* Scans the music library * @param mediaScannerService * Scans the music library * @param mediaScannerService
*/ */
@ -120,7 +116,5 @@ public class TestCaseUtils {
e.printStackTrace(); e.printStackTrace();
} }
} }
} }
} }

@ -1,10 +1,10 @@
package org.airsonic.player.dao; package org.airsonic.player.dao;
import org.airsonic.player.util.HomeRule;
import org.junit.ClassRule; import org.junit.ClassRule;
import org.junit.Rule; import org.junit.Rule;
import org.junit.runner.Description; import org.junit.runner.Description;
import org.junit.runners.model.Statement; import org.junit.runners.model.Statement;
import org.airsonic.player.util.HomeRule;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.ContextConfiguration;
@ -33,7 +33,6 @@ public class DaoTestCaseBean2 {
@Autowired @Autowired
GenericDaoHelper genericDaoHelper; GenericDaoHelper genericDaoHelper;
JdbcTemplate getJdbcTemplate() { JdbcTemplate getJdbcTemplate() {
return genericDaoHelper.getJdbcTemplate(); return genericDaoHelper.getJdbcTemplate();
} }

@ -1,8 +1,8 @@
package org.airsonic.player.dao; package org.airsonic.player.dao;
import org.airsonic.player.domain.InternetRadio;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.airsonic.player.domain.InternetRadio;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import java.util.Date; import java.util.Date;

@ -18,10 +18,10 @@
Based upon Subsonic, Copyright 2009 (C) Sindre Mehus Based upon Subsonic, Copyright 2009 (C) Sindre Mehus
*/ */
package org.airsonic.player.dao; package org.airsonic.player.dao;
import org.airsonic.player.domain.MusicFolder;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.airsonic.player.domain.MusicFolder;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import java.io.File; import java.io.File;

@ -1,11 +1,11 @@
package org.airsonic.player.dao; package org.airsonic.player.dao;
import org.airsonic.player.domain.PlayQueue; import org.airsonic.player.domain.PlayQueue;
import org.airsonic.player.domain.Player;
import org.airsonic.player.domain.PlayerTechnology; import org.airsonic.player.domain.PlayerTechnology;
import org.airsonic.player.domain.TranscodeScheme;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.airsonic.player.domain.Player;
import org.airsonic.player.domain.TranscodeScheme;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import java.util.Date; import java.util.Date;

@ -1,10 +1,10 @@
package org.airsonic.player.dao; package org.airsonic.player.dao;
import org.airsonic.player.domain.PodcastChannel;
import org.airsonic.player.domain.PodcastEpisode;
import org.airsonic.player.domain.PodcastStatus; import org.airsonic.player.domain.PodcastStatus;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.airsonic.player.domain.PodcastChannel;
import org.airsonic.player.domain.PodcastEpisode;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import java.util.Date; import java.util.Date;

@ -1,11 +1,11 @@
package org.airsonic.player.dao; package org.airsonic.player.dao;
import org.airsonic.player.domain.AvatarScheme; import org.airsonic.player.domain.AvatarScheme;
import org.airsonic.player.domain.TranscodeScheme;
import org.airsonic.player.domain.User; import org.airsonic.player.domain.User;
import org.airsonic.player.domain.UserSettings; import org.airsonic.player.domain.UserSettings;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.airsonic.player.domain.TranscodeScheme;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataIntegrityViolationException; import org.springframework.dao.DataIntegrityViolationException;

@ -23,6 +23,7 @@ import junit.framework.TestCase;
import java.io.File; import java.io.File;
import java.util.Arrays; import java.util.Arrays;
import java.util.Objects;
/** /**
* Unit test of {@link PlayQueue}. * Unit test of {@link PlayQueue}.
@ -320,5 +321,10 @@ public class PlayQueueTestCase extends TestCase {
public boolean equals(Object o) { public boolean equals(Object o) {
return this == o; return this == o;
} }
@Override
public int hashCode() {
return Objects.hash(name, track, album, artist);
}
} }
} }

@ -8,8 +8,8 @@ import org.junit.runner.RunWith;
import org.mockito.Mock; import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner; import org.mockito.runners.MockitoJUnitRunner;
import static org.mockito.Mockito.verify;
import static org.assertj.core.api.Assertions.*; import static org.assertj.core.api.Assertions.*;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
@RunWith(MockitoJUnitRunner.class) @RunWith(MockitoJUnitRunner.class)

@ -1,13 +1,13 @@
package org.airsonic.player.service; package org.airsonic.player.service;
import org.airsonic.player.TestCaseUtils;
import org.airsonic.player.util.HomeRule;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.junit.ClassRule; import org.junit.ClassRule;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.Description; import org.junit.runner.Description;
import org.junit.runners.model.Statement; import org.junit.runners.model.Statement;
import org.airsonic.player.TestCaseUtils;
import org.airsonic.player.util.HomeRule;
import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.rules.SpringClassRule; import org.springframework.test.context.junit4.rules.SpringClassRule;
import org.springframework.test.context.junit4.rules.SpringMethodRule; import org.springframework.test.context.junit4.rules.SpringMethodRule;

@ -3,9 +3,14 @@ package org.airsonic.player.service;
import com.codahale.metrics.ConsoleReporter; import com.codahale.metrics.ConsoleReporter;
import com.codahale.metrics.MetricRegistry; import com.codahale.metrics.MetricRegistry;
import com.codahale.metrics.Timer; import com.codahale.metrics.Timer;
import org.airsonic.player.TestCaseUtils;
import org.airsonic.player.dao.*; import org.airsonic.player.dao.*;
import org.airsonic.player.domain.Album;
import org.airsonic.player.domain.Artist;
import org.airsonic.player.domain.MediaFile; import org.airsonic.player.domain.MediaFile;
import org.airsonic.player.domain.MusicFolder; import org.airsonic.player.domain.MusicFolder;
import org.airsonic.player.util.HomeRule;
import org.airsonic.player.util.MusicFolderTestData;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.junit.Assert; import org.junit.Assert;
import org.junit.ClassRule; import org.junit.ClassRule;
@ -14,11 +19,6 @@ import org.junit.Test;
import org.junit.rules.TemporaryFolder; import org.junit.rules.TemporaryFolder;
import org.junit.runner.Description; import org.junit.runner.Description;
import org.junit.runners.model.Statement; import org.junit.runners.model.Statement;
import org.airsonic.player.TestCaseUtils;
import org.airsonic.player.domain.Album;
import org.airsonic.player.domain.Artist;
import org.airsonic.player.util.HomeRule;
import org.airsonic.player.util.MusicFolderTestData;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
import org.springframework.core.io.ResourceLoader; import org.springframework.core.io.ResourceLoader;
@ -29,9 +29,9 @@ import org.springframework.test.context.junit4.rules.SpringMethodRule;
import java.io.File; import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.ArrayList;
import java.util.Map; import java.util.Map;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;

@ -20,6 +20,7 @@
package org.airsonic.player.service; package org.airsonic.player.service;
import junit.framework.TestCase; import junit.framework.TestCase;
/** /**
* Unit test of {@link SecurityService}. * Unit test of {@link SecurityService}.
* *

@ -9,6 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.SpyBean; import org.springframework.boot.test.mock.mockito.SpyBean;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
import static org.mockito.Mockito.*; import static org.mockito.Mockito.*;
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)

@ -1,9 +1,5 @@
package org.airsonic.player.service.search; package org.airsonic.player.service.search;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Function;
import org.airsonic.player.TestCaseUtils; import org.airsonic.player.TestCaseUtils;
import org.airsonic.player.dao.DaoHelper; import org.airsonic.player.dao.DaoHelper;
import org.airsonic.player.dao.MusicFolderDao; import org.airsonic.player.dao.MusicFolderDao;
@ -23,6 +19,10 @@ import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.rules.SpringClassRule; import org.springframework.test.context.junit4.rules.SpringClassRule;
import org.springframework.test.context.junit4.rules.SpringMethodRule; import org.springframework.test.context.junit4.rules.SpringMethodRule;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Function;
@ContextConfiguration(locations = { @ContextConfiguration(locations = {
"/applicationContext-service.xml", "/applicationContext-service.xml",
"/applicationContext-cache.xml", "/applicationContext-cache.xml",

@ -1,11 +1,11 @@
package org.airsonic.player.service.search; package org.airsonic.player.service.search;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import org.airsonic.player.domain.MusicFolder; import org.airsonic.player.domain.MusicFolder;
import org.airsonic.player.util.MusicFolderTestData; import org.airsonic.player.util.MusicFolderTestData;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
/** /**
* Test case interface for scanning MusicFolder. * Test case interface for scanning MusicFolder.
*/ */

@ -1,8 +1,10 @@
package org.airsonic.player.service.search; package org.airsonic.player.service.search;
import static java.util.Arrays.asList; import org.apache.lucene.analysis.TokenStream;
import static org.junit.Assert.assertEquals; import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
import org.junit.Test;
import org.slf4j.LoggerFactory;
import java.io.IOException; import java.io.IOException;
import java.io.StringReader; import java.io.StringReader;
@ -10,10 +12,8 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import org.apache.lucene.analysis.TokenStream; import static java.util.Arrays.asList;
import org.apache.lucene.analysis.tokenattributes.CharTermAttribute; import static org.junit.Assert.assertEquals;
import org.junit.Test;
import org.slf4j.LoggerFactory;
/** /**
* Test case for Analyzer. * Test case for Analyzer.
@ -631,8 +631,6 @@ public class AnalyzerFactoryTestCase {
assertEquals("{ }", terms.get(0)); assertEquals("{ }", terms.get(0));
} }
private List<String> toTermString(String str) { private List<String> toTermString(String str) {
return toTermString(null, str); return toTermString(null, str);
} }

@ -26,8 +26,6 @@ import org.airsonic.player.domain.MusicFolder;
import org.airsonic.player.domain.SearchCriteria; import org.airsonic.player.domain.SearchCriteria;
import org.airsonic.player.domain.SearchResult; import org.airsonic.player.domain.SearchResult;
import org.airsonic.player.service.SearchService; import org.airsonic.player.service.SearchService;
import org.airsonic.player.service.search.IndexManager;
import org.airsonic.player.service.search.IndexType;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
@ -36,9 +34,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ResourceLoader; import org.springframework.core.io.ResourceLoader;
import java.io.File; import java.io.File;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.ArrayList;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.springframework.util.ObjectUtils.isEmpty; import static org.springframework.util.ObjectUtils.isEmpty;

@ -1,13 +1,7 @@
package org.airsonic.player.service.search; package org.airsonic.player.service.search;
import static org.springframework.util.ObjectUtils.isEmpty; import com.google.common.base.Function;
import java.io.File;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.airsonic.player.domain.MediaFile; import org.airsonic.player.domain.MediaFile;
import org.airsonic.player.domain.MusicFolder; import org.airsonic.player.domain.MusicFolder;
import org.airsonic.player.domain.RandomSearchCriteria; import org.airsonic.player.domain.RandomSearchCriteria;
@ -17,7 +11,12 @@ import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import com.google.common.base.Function; import java.io.File;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import static org.springframework.util.ObjectUtils.isEmpty;
/* /*
* Tests to prove what kind of strings/chars can be used in the genre field. * Tests to prove what kind of strings/chars can be used in the genre field.

@ -1,12 +1,6 @@
package org.airsonic.player.service.search; package org.airsonic.player.service.search;
import java.io.File;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import org.airsonic.player.domain.MediaFile; import org.airsonic.player.domain.MediaFile;
import org.airsonic.player.domain.MusicFolder; import org.airsonic.player.domain.MusicFolder;
import org.airsonic.player.service.SearchService; import org.airsonic.player.service.SearchService;
@ -14,6 +8,13 @@ import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import java.io.File;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import static org.springframework.util.ObjectUtils.isEmpty; import static org.springframework.util.ObjectUtils.isEmpty;
/* /*

@ -1,11 +1,6 @@
package org.airsonic.player.service.search; package org.airsonic.player.service.search;
import java.io.File;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.airsonic.player.domain.MusicFolder; import org.airsonic.player.domain.MusicFolder;
import org.airsonic.player.domain.SearchCriteria; import org.airsonic.player.domain.SearchCriteria;
import org.airsonic.player.domain.SearchResult; import org.airsonic.player.domain.SearchResult;
@ -14,6 +9,12 @@ import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import java.io.File;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import static org.springframework.util.ObjectUtils.isEmpty; import static org.springframework.util.ObjectUtils.isEmpty;
/* /*

@ -4,12 +4,6 @@ package org.airsonic.player.service.search;
import com.codahale.metrics.ConsoleReporter; import com.codahale.metrics.ConsoleReporter;
import com.codahale.metrics.MetricRegistry; import com.codahale.metrics.MetricRegistry;
import com.codahale.metrics.Timer; import com.codahale.metrics.Timer;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
import java.util.concurrent.TimeUnit;
import org.airsonic.player.dao.AlbumDao; import org.airsonic.player.dao.AlbumDao;
import org.airsonic.player.dao.MusicFolderDao; import org.airsonic.player.dao.MusicFolderDao;
import org.airsonic.player.domain.Album; import org.airsonic.player.domain.Album;
@ -22,13 +16,17 @@ import org.airsonic.player.domain.RandomSearchCriteria;
import org.airsonic.player.domain.SearchCriteria; import org.airsonic.player.domain.SearchCriteria;
import org.airsonic.player.domain.SearchResult; import org.airsonic.player.domain.SearchResult;
import org.airsonic.player.service.SearchService; import org.airsonic.player.service.SearchService;
import org.airsonic.player.service.search.IndexType;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.subsonic.restapi.ArtistID3; import org.subsonic.restapi.ArtistID3;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
import java.util.concurrent.TimeUnit;
public class SearchServiceTestCase extends AbstractAirsonicHomeTest { public class SearchServiceTestCase extends AbstractAirsonicHomeTest {
@Autowired @Autowired

@ -1,7 +1,7 @@
package org.airsonic.player.util; package org.airsonic.player.util;
import org.junit.rules.ExternalResource;
import org.airsonic.player.TestCaseUtils; import org.airsonic.player.TestCaseUtils;
import org.junit.rules.ExternalResource;
public class HomeRule extends ExternalResource { public class HomeRule extends ExternalResource {
@Override @Override

@ -38,5 +38,4 @@ public class MusicFolderTestData {
liste.add(musicFolder2); liste.add(musicFolder2);
return liste; return liste;
} }
} }

@ -249,6 +249,7 @@
<encoding>UTF-8</encoding> <encoding>UTF-8</encoding>
<consoleOutput>true</consoleOutput> <consoleOutput>true</consoleOutput>
<failOnViolation>true</failOnViolation> <failOnViolation>true</failOnViolation>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
</configuration> </configuration>
<goals> <goals>
<goal>check</goal> <goal>check</goal>

Loading…
Cancel
Save