summaryrefslogtreecommitdiffstats
path: root/sonar-core
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2012-03-11 21:37:19 +0100
committerSimon Brandhof <simon.brandhof@gmail.com>2012-03-12 11:29:00 +0100
commitd129cbd866b0242ef6777bb6923d27c852ccf95f (patch)
tree3b678507e2836c31c30b97d9a16436163be5012e /sonar-core
parent48ac6cdb612920154aa4bca46fb4f626173adcbc (diff)
downloadsonarqube-d129cbd866b0242ef6777bb6923d27c852ccf95f.tar.gz
sonarqube-d129cbd866b0242ef6777bb6923d27c852ccf95f.zip
Remove Hibernate from the component org.sonar.api.config.Settings
Diffstat (limited to 'sonar-core')
-rw-r--r--sonar-core/src/main/java/org/sonar/core/config/ConfigurationUtils.java47
-rw-r--r--sonar-core/src/test/java/org/sonar/core/config/ConfigurationUtilsTest.java2
2 files changed, 5 insertions, 44 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/config/ConfigurationUtils.java b/sonar-core/src/main/java/org/sonar/core/config/ConfigurationUtils.java
index 91c03732bb2..e81ffff6ece 100644
--- a/sonar-core/src/main/java/org/sonar/core/config/ConfigurationUtils.java
+++ b/sonar-core/src/main/java/org/sonar/core/config/ConfigurationUtils.java
@@ -22,18 +22,15 @@ package org.sonar.core.config;
import org.apache.commons.configuration.Configuration;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
-import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.text.StrSubstitutor;
-import org.sonar.api.database.DatabaseSession;
-import org.sonar.api.database.configuration.Property;
-import org.sonar.api.database.model.ResourceModel;
-import org.sonar.jpa.session.DatabaseSessionFactory;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.util.*;
+import java.util.Enumeration;
+import java.util.Map;
+import java.util.Properties;
/**
* @since 2.12
@@ -85,43 +82,7 @@ public final class ConfigurationUtils {
return result;
}
- public static List<Property> getProjectProperties(DatabaseSessionFactory dbFactory, String moduleKey, String branch) {
- final String completeKey;
- if (StringUtils.isNotBlank(branch)) {
- completeKey = String.format("%s:%s", moduleKey, branch);
- } else {
- completeKey = moduleKey;
- }
- DatabaseSession session = prepareDbSession(dbFactory);
- ResourceModel resource = session.getSingleResult(ResourceModel.class, "key", completeKey);
- if (resource != null) {
- return session
- .createQuery("from " + Property.class.getSimpleName() + " p where p.resourceId=:resourceId and p.userId is null")
- .setParameter("resourceId", resource.getId())
- .getResultList();
-
- }
- return Collections.emptyList();
- }
-
- public static List<Property> getGeneralProperties(DatabaseSessionFactory dbFactory) {
- DatabaseSession session = prepareDbSession(dbFactory);
- return session
- .createQuery("from " + Property.class.getSimpleName() + " p where p.resourceId is null and p.userId is null")
- .getResultList();
-
- }
-
- private static DatabaseSession prepareDbSession(DatabaseSessionFactory dbFactory) {
- DatabaseSession session = dbFactory.getSession();
- // Ugly workaround before the move to myBatis
- // Session is not up-to-date when Ruby on Rails inserts new rows in its own transaction. Seems like
- // Hibernate keeps a cache...
- session.commit();
- return session;
- }
-
- public static void copyToCommonsConfiguration(Map<String,String> input, Configuration commonsConfig) {
+ public static void copyToCommonsConfiguration(Map<String, String> input, Configuration commonsConfig) {
// update deprecated configuration
commonsConfig.clear();
for (Map.Entry<String, String> entry : input.entrySet()) {
diff --git a/sonar-core/src/test/java/org/sonar/core/config/ConfigurationUtilsTest.java b/sonar-core/src/test/java/org/sonar/core/config/ConfigurationUtilsTest.java
index 7552abdfded..6707b019125 100644
--- a/sonar-core/src/test/java/org/sonar/core/config/ConfigurationUtilsTest.java
+++ b/sonar-core/src/test/java/org/sonar/core/config/ConfigurationUtilsTest.java
@@ -57,7 +57,7 @@ public class ConfigurationUtilsTest {
Properties input = new Properties();
input.setProperty("hello", "world");
input.setProperty("foo", "bar");
- Map<String,String> output = Maps.newHashMap();
+ Map<String, String> output = Maps.newHashMap();
ConfigurationUtils.copyProperties(input, output);