aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2016-07-26 10:54:54 +0200
committerSimon Brandhof <simon.brandhof@sonarsource.com>2016-07-29 10:31:31 +0200
commit1e6c0e1a47509ca88f0cd2d9fa127dc4302a899d (patch)
treea4dbdf8e741031f7ffe12033f0dd7f3744d5912d /server
parentd107bfeb735e2d75bece233900a546b347774c2b (diff)
downloadsonarqube-1e6c0e1a47509ca88f0cd2d9fa127dc4302a899d.tar.gz
sonarqube-1e6c0e1a47509ca88f0cd2d9fa127dc4302a899d.zip
Minor Quality flaws
Diffstat (limited to 'server')
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/db/EmbeddedDatabaseFactory.java4
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/db/EmbeddedDatabaseFactoryTest.java12
2 files changed, 9 insertions, 7 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/db/EmbeddedDatabaseFactory.java b/server/sonar-server/src/main/java/org/sonar/server/db/EmbeddedDatabaseFactory.java
index 25e15e503c1..5a5f4e45c15 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/db/EmbeddedDatabaseFactory.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/db/EmbeddedDatabaseFactory.java
@@ -40,7 +40,7 @@ public class EmbeddedDatabaseFactory implements Startable {
if (embeddedDatabase == null) {
String jdbcUrl = settings.getString(DatabaseProperties.PROP_URL);
if (startsWith(jdbcUrl, URL_PREFIX)) {
- embeddedDatabase = getEmbeddedDatabase(settings);
+ embeddedDatabase = createEmbeddedDatabase();
embeddedDatabase.start();
}
}
@@ -55,7 +55,7 @@ public class EmbeddedDatabaseFactory implements Startable {
}
@VisibleForTesting
- EmbeddedDatabase getEmbeddedDatabase(Settings settings) {
+ EmbeddedDatabase createEmbeddedDatabase() {
return new EmbeddedDatabase(settings);
}
}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/EmbeddedDatabaseFactoryTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/EmbeddedDatabaseFactoryTest.java
index 8cbe8790346..2a780dc6812 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/db/EmbeddedDatabaseFactoryTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/db/EmbeddedDatabaseFactoryTest.java
@@ -23,7 +23,9 @@ import org.junit.Test;
import org.sonar.api.config.Settings;
import org.sonar.api.database.DatabaseProperties;
-import static org.mockito.Mockito.*;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
public class EmbeddedDatabaseFactoryTest {
@@ -33,11 +35,11 @@ public class EmbeddedDatabaseFactoryTest {
public void should_start_and_stop_tcp_h2_database() {
settings.setProperty(DatabaseProperties.PROP_URL, "jdbc:h2:tcp:localhost");
- final EmbeddedDatabase embeddedDatabase = mock(EmbeddedDatabase.class);
+ EmbeddedDatabase embeddedDatabase = mock(EmbeddedDatabase.class);
EmbeddedDatabaseFactory databaseFactory = new EmbeddedDatabaseFactory(settings) {
@Override
- EmbeddedDatabase getEmbeddedDatabase(Settings settings) {
+ EmbeddedDatabase createEmbeddedDatabase() {
return embeddedDatabase;
}
};
@@ -52,11 +54,11 @@ public class EmbeddedDatabaseFactoryTest {
public void should_not_start_mem_h2_database() {
settings.setProperty(DatabaseProperties.PROP_URL, "jdbc:h2:mem");
- final EmbeddedDatabase embeddedDatabase = mock(EmbeddedDatabase.class);
+ EmbeddedDatabase embeddedDatabase = mock(EmbeddedDatabase.class);
EmbeddedDatabaseFactory databaseFactory = new EmbeddedDatabaseFactory(settings) {
@Override
- EmbeddedDatabase getEmbeddedDatabase(Settings settings) {
+ EmbeddedDatabase createEmbeddedDatabase() {
return embeddedDatabase;
}
};