Prep work for spring boot test

- Added enforcer plugin
- Fix some version conflicts
- Moved custom initializer to spring.factories
- Bump spring boot version

Signed-off-by: Andrew DeMaria <lostonamountain@gmail.com>
master
Andrew DeMaria 7 years ago
parent 753d76e0fe
commit 7d4ca2ffe2
No known key found for this signature in database
GPG Key ID: 0A3F5E91F8364EDF
  1. 12
      airsonic-main/pom.xml
  2. 5
      airsonic-main/src/main/java/org/airsonic/player/Application.java
  3. 2
      airsonic-main/src/main/java/org/airsonic/player/TomcatApplication.java
  4. 3
      airsonic-main/src/main/resources/META-INF/spring.factories
  5. 8
      airsonic-main/src/test/java/org/airsonic/player/service/PlaylistServiceTestExport.java
  6. 7
      airsonic-main/src/test/java/org/airsonic/player/service/PlaylistServiceTestImport.java
  7. 41
      pom.xml

@ -79,7 +79,6 @@
<dependency>
<groupId>org.springframework.ldap</groupId>
<artifactId>spring-ldap-core</artifactId>
<version>2.0.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
@ -153,13 +152,11 @@
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.5</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.2</version>
</dependency>
<dependency>
@ -278,7 +275,7 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>2.5.7</version>
<version>1.10.19</version>
<scope>test</scope>
</dependency>
@ -380,8 +377,6 @@
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
<!-- Cannot use 3.5.3/2 due to https://liquibase.jira.com/browse/CORE-2944 -->
<version>3.5.1</version>
</dependency>
<dependency>
@ -419,7 +414,6 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.24</version>
</dependency>
<!-- Embedded tomcat -->
@ -448,12 +442,10 @@
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.8.7</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.8.7</version>
</dependency>
<dependency>
<groupId>com.jayway.jsonpath</groupId>
@ -479,7 +471,7 @@
<artifactId>spring-boot-maven-plugin</artifactId>
<version>1.5.2.RELEASE</version>
<configuration>
<mainClass>org.airsonic.player.boot.Application</mainClass>
<mainClass>org.airsonic.player.Application</mainClass>
<layout>WAR</layout>
<excludeGroupIds>${boot.group.excludes}</excludeGroupIds>
<excludeArtifactIds>${boot.artifact.excludes}</excludeArtifactIds>

@ -1,8 +1,7 @@
package org.airsonic.player.boot;
package org.airsonic.player;
import net.sf.ehcache.constructs.web.ShutdownListener;
import org.airsonic.player.filter.*;
import org.airsonic.player.spring.CustomPropertySourceConfigurer;
import org.directwebremoting.servlet.DwrServlet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -180,7 +179,7 @@ public class Application extends SpringBootServletInitializer implements Embedde
// Customize the application or call application.sources(...) to add sources
// Since our example is itself a @Configuration class (via @SpringBootApplication)
// we actually don't need to override this method.
return application.sources(Application.class).web(true).initializers(new CustomPropertySourceConfigurer());
return application.sources(Application.class).web(true);
}
@Override

@ -1,4 +1,4 @@
package org.airsonic.player.boot;
package org.airsonic.player;
import org.apache.catalina.Container;
import org.apache.catalina.Wrapper;

@ -1,3 +1,6 @@
org.springframework.context.ApplicationListener=\
org.airsonic.player.spring.LoggingFileOverrideListener,\
org.airsonic.player.security.LoginFailureListener
org.springframework.context.ApplicationContextInitializer=\
org.airsonic.player.spring.CustomPropertySourceConfigurer

@ -2,8 +2,10 @@ package org.airsonic.player.service;
import com.google.common.collect.Lists;
import org.airsonic.player.dao.MediaFileDao;
import org.airsonic.player.dao.PlaylistDao;
import org.airsonic.player.domain.MediaFile;
import org.airsonic.player.domain.Playlist;
import org.airsonic.player.service.playlist.DefaultPlaylistExportHandler;
import org.apache.commons.io.IOUtils;
import org.apache.commons.io.output.ByteArrayOutputStream;
import org.junit.Assert;
@ -12,19 +14,17 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.junit.runner.RunWith;
import org.airsonic.player.dao.PlaylistDao;
import org.airsonic.player.service.playlist.DefaultPlaylistExportHandler;
import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.mockito.runners.MockitoJUnitRunner;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.when;
@RunWith(MockitoJUnitRunner.class)

@ -19,7 +19,7 @@ import org.mockito.Captor;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.junit.MockitoJUnitRunner;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.stubbing.Answer;
import java.io.ByteArrayInputStream;
@ -30,7 +30,6 @@ import java.util.List;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.*;
@RunWith(MockitoJUnitRunner.class)
@ -190,7 +189,7 @@ public class PlaylistServiceTestImport {
@Override
public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
Playlist playlist = invocationOnMock.getArgument(0);
Playlist playlist = invocationOnMock.getArgumentAt(0, Playlist.class);
playlist.setId(id);
return null;
}
@ -200,7 +199,7 @@ public class PlaylistServiceTestImport {
@Override
public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
File file = invocationOnMock.getArgument(0);
File file = invocationOnMock.getArgumentAt(0, File.class);
MediaFile mediaFile = new MediaFile();
mediaFile.setPath(file.getPath());
return mediaFile;

@ -16,7 +16,7 @@
<properties>
<failOnDependencyWarning>true</failOnDependencyWarning>
<project.build.sourceEncoding>iso-8859-1</project.build.sourceEncoding>
<cxf.version>3.1.8</cxf.version>
<cxf.version>3.1.12</cxf.version>
</properties>
<repositories>
@ -86,10 +86,28 @@
<!-- Import dependency management from Spring Boot -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>1.4.5.RELEASE</version>
<version>1.5.6.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
<!-- Cannot use 3.5.3/2 due to https://liquibase.jira.com/browse/CORE-2944 -->
<version>3.5.1</version>
</dependency>
<!-- Fix convergence issues -->
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>5.1</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.3.2</version>
</dependency>
</dependencies>
</dependencyManagement>
@ -219,6 +237,25 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M1</version>
<inherited>true</inherited>
<executions>
<execution>
<id>enforce</id>
<configuration>
<rules>
<dependencyConvergence/>
</rules>
</configuration>
<goals>
<goal>enforce</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

Loading…
Cancel
Save