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;
return this;
}
+ public String getFromVersion() {
+ return fromVersion;
+ }
+
+ public DependencyDto setFromVersion(String fromVersion) {
+ this.fromVersion = fromVersion;
+ return this;
+ }
+
public Long getToResourceId() {
return toResourceId;
}
return this;
}
+ public String getToVersion() {
+ return toVersion;
+ }
+
+ public DependencyDto setToVersion(String toVersion) {
+ this.toVersion = toVersion;
+ return this;
+ }
+
public String getUsage() {
return usage;
}
<mapper namespace="org.sonar.core.dependency.DependencyMapper">
<select id="selectAll" resultType="dependency">
- select id, from_resource_id as fromResourceId, to_resource_id as toResourceId, dep_usage as usage, dep_weight as weight from dependencies
+ SELECT dependencies.id as id, from_resource_id as fromResourceId, sLeft.version as fromVersion, to_resource_id as toResourceId, sRight.version as toVersion, dep_usage as usage, dep_weight as weight
+ FROM dependencies
+ JOIN snapshots as sLeft ON dependencies.from_snapshot_id = sLeft.id
+ JOIN snapshots as sRight ON dependencies.to_snapshot_id = sRight.id
</select>
</mapper>
-
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);
}
}
-
-
}
<dataset>
<dependencies id="1" from_resource_id="100" to_resource_id="101" from_snapshot_id="1000" to_snapshot_id="1001" dep_usage="compile" dep_weight="1" />
<dependencies id="2" from_resource_id="200" to_resource_id="201" from_snapshot_id="2000" to_snapshot_id="2001" dep_usage="provided" dep_weight="1" />
+ <snapshots id="1000" version="1.0" project_id="1" />
+ <snapshots id="2000" version="2.0" project_id="1" />
+ <snapshots id="1001" version="3.0" project_id="1" />
+ <snapshots id="2001" version="4.0" project_id="1" />
</dataset>
\ No newline at end of file