aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-java-api
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2014-09-05 14:58:03 +0200
committerJulien HENRY <julien.henry@sonarsource.com>2014-09-05 14:58:03 +0200
commitd0c7a71f3d960cd5c9bf39b1f7fe8341470b06e7 (patch)
tree1d21d9901c613e68f3acab90b78381372f6f4f74 /sonar-java-api
parente1c3a706319c397b436a28b7921b695baf712063 (diff)
downloadsonarqube-d0c7a71f3d960cd5c9bf39b1f7fe8341470b06e7.tar.gz
sonarqube-d0c7a71f3d960cd5c9bf39b1f7fe8341470b06e7.zip
SONAR-2860 Drop commons-configuration
Diffstat (limited to 'sonar-java-api')
-rw-r--r--sonar-java-api/pom.xml4
-rw-r--r--sonar-java-api/src/main/java/org/sonar/java/api/JavaUtils.java4
-rw-r--r--sonar-java-api/src/test/java/org/sonar/java/api/JavaUtilsTest.java16
3 files changed, 14 insertions, 10 deletions
diff --git a/sonar-java-api/pom.xml b/sonar-java-api/pom.xml
index 7c18701b2f2..321e44fbc93 100644
--- a/sonar-java-api/pom.xml
+++ b/sonar-java-api/pom.xml
@@ -17,6 +17,10 @@
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar-deprecated</artifactId>
</dependency>
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ </dependency>
<!-- unit tests -->
<dependency>
diff --git a/sonar-java-api/src/main/java/org/sonar/java/api/JavaUtils.java b/sonar-java-api/src/main/java/org/sonar/java/api/JavaUtils.java
index fd8c163ef6d..53596792273 100644
--- a/sonar-java-api/src/main/java/org/sonar/java/api/JavaUtils.java
+++ b/sonar-java-api/src/main/java/org/sonar/java/api/JavaUtils.java
@@ -80,12 +80,12 @@ public final class JavaUtils {
}
public static String getSourceVersion(Project project) {
- String version = project.getConfiguration() != null ? project.getConfiguration().getString(JAVA_SOURCE_PROPERTY) : null;
+ String version = project.getSettings() != null ? project.getSettings().getString(JAVA_SOURCE_PROPERTY) : null;
return StringUtils.isNotBlank(version) ? version : JAVA_SOURCE_DEFAULT_VALUE;
}
public static String getTargetVersion(Project project) {
- String version = project.getConfiguration() != null ? project.getConfiguration().getString(JAVA_TARGET_PROPERTY) : null;
+ String version = project.getSettings() != null ? project.getSettings().getString(JAVA_TARGET_PROPERTY) : null;
return StringUtils.isNotBlank(version) ? version : JAVA_TARGET_DEFAULT_VALUE;
}
}
diff --git a/sonar-java-api/src/test/java/org/sonar/java/api/JavaUtilsTest.java b/sonar-java-api/src/test/java/org/sonar/java/api/JavaUtilsTest.java
index 5ec3d97a2a4..1c2eb29753b 100644
--- a/sonar-java-api/src/test/java/org/sonar/java/api/JavaUtilsTest.java
+++ b/sonar-java-api/src/test/java/org/sonar/java/api/JavaUtilsTest.java
@@ -19,13 +19,13 @@
*/
package org.sonar.java.api;
-import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertThat;
-
-import org.apache.commons.configuration.BaseConfiguration;
import org.junit.Test;
+import org.sonar.api.config.Settings;
import org.sonar.api.resources.Project;
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertThat;
+
public class JavaUtilsTest {
@Test
@@ -41,8 +41,8 @@ public class JavaUtilsTest {
@Test
public void shouldReturnDefaultJavaVersion() {
- BaseConfiguration configuration = new BaseConfiguration();
- Project project = new Project("").setConfiguration(configuration);
+ Settings configuration = new Settings();
+ Project project = new Project("").setSettings(configuration);
assertThat(JavaUtils.getSourceVersion(project), is("1.5"));
assertThat(JavaUtils.getTargetVersion(project), is("1.5"));
@@ -50,8 +50,8 @@ public class JavaUtilsTest {
@Test
public void shouldReturnSpecifiedJavaVersion() {
- BaseConfiguration configuration = new BaseConfiguration();
- Project project = new Project("").setConfiguration(configuration);
+ Settings configuration = new Settings();
+ Project project = new Project("").setSettings(configuration);
configuration.setProperty(JavaUtils.JAVA_SOURCE_PROPERTY, "1.4");
configuration.setProperty(JavaUtils.JAVA_TARGET_PROPERTY, "1.6");