From 1dfe588e6679820380b82f6442eaffee6c180558 Mon Sep 17 00:00:00 2001 From: David Gageot Date: Mon, 25 Jun 2012 17:12:38 +0200 Subject: [PATCH] Load dependency versions --- .../sonar/core/dependency/DependencyDto.java | 20 +++++++++++++++++++ .../core/dependency/DependencyMapper.xml | 6 ++++-- .../core/dependency/DependencyMapperTest.java | 4 ++-- .../DependencyMapperTest/fixture.xml | 4 ++++ 4 files changed, 30 insertions(+), 4 deletions(-) diff --git a/sonar-core/src/main/java/org/sonar/core/dependency/DependencyDto.java b/sonar-core/src/main/java/org/sonar/core/dependency/DependencyDto.java index 0a61133942b..00599da2344 100644 --- a/sonar-core/src/main/java/org/sonar/core/dependency/DependencyDto.java +++ b/sonar-core/src/main/java/org/sonar/core/dependency/DependencyDto.java @@ -22,7 +22,9 @@ package org.sonar.core.dependency; public final class DependencyDto { private Long id; private Long fromResourceId; + private String fromVersion; private Long toResourceId; + private String toVersion; private String usage; private Integer weight; @@ -44,6 +46,15 @@ public final class DependencyDto { return this; } + public String getFromVersion() { + return fromVersion; + } + + public DependencyDto setFromVersion(String fromVersion) { + this.fromVersion = fromVersion; + return this; + } + public Long getToResourceId() { return toResourceId; } @@ -53,6 +64,15 @@ public final class DependencyDto { return this; } + public String getToVersion() { + return toVersion; + } + + public DependencyDto setToVersion(String toVersion) { + this.toVersion = toVersion; + return this; + } + public String getUsage() { return usage; } diff --git a/sonar-core/src/main/resources/org/sonar/core/dependency/DependencyMapper.xml b/sonar-core/src/main/resources/org/sonar/core/dependency/DependencyMapper.xml index 53ab9f500cf..8f864c313fb 100644 --- a/sonar-core/src/main/resources/org/sonar/core/dependency/DependencyMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/dependency/DependencyMapper.xml @@ -4,8 +4,10 @@ - diff --git a/sonar-core/src/test/java/org/sonar/core/dependency/DependencyMapperTest.java b/sonar-core/src/test/java/org/sonar/core/dependency/DependencyMapperTest.java index 11699e567db..4dd1307dcb9 100644 --- a/sonar-core/src/test/java/org/sonar/core/dependency/DependencyMapperTest.java +++ b/sonar-core/src/test/java/org/sonar/core/dependency/DependencyMapperTest.java @@ -43,13 +43,13 @@ public class DependencyMapperTest extends DaoTestCase { DependencyDto dep = dependencies.get(0); assertThat(dep.getUsage()).isEqualTo("compile"); assertThat(dep.getFromResourceId()).isEqualTo(100L); + assertThat(dep.getFromVersion()).isEqualTo("1.0"); assertThat(dep.getToResourceId()).isEqualTo(101L); + assertThat(dep.getToVersion()).isEqualTo("3.0"); assertThat(dep.getId()).isEqualTo(1L); } finally { MyBatis.closeQuietly(session); } } - - } diff --git a/sonar-core/src/test/resources/org/sonar/core/dependency/DependencyMapperTest/fixture.xml b/sonar-core/src/test/resources/org/sonar/core/dependency/DependencyMapperTest/fixture.xml index 7e8a8e9f677..b6cc818679b 100644 --- a/sonar-core/src/test/resources/org/sonar/core/dependency/DependencyMapperTest/fixture.xml +++ b/sonar-core/src/test/resources/org/sonar/core/dependency/DependencyMapperTest/fixture.xml @@ -1,4 +1,8 @@ + + + + \ No newline at end of file -- 2.39.5