From: Sébastien Lesaint Date: Thu, 8 Sep 2016 13:17:11 +0000 (+0200) Subject: SONAR-7676 remove PropertyDto#id X-Git-Tag: 6.1-RC1~163 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=5c84d34cff25ccc4e8178c7096362722c72c3d46;p=sonarqube.git SONAR-7676 remove PropertyDto#id --- diff --git a/sonar-db/src/main/java/org/sonar/db/property/PropertyDto.java b/sonar-db/src/main/java/org/sonar/db/property/PropertyDto.java index 22f0998b353..59c9455e4d4 100644 --- a/sonar-db/src/main/java/org/sonar/db/property/PropertyDto.java +++ b/sonar-db/src/main/java/org/sonar/db/property/PropertyDto.java @@ -29,21 +29,11 @@ import static com.google.common.base.Preconditions.checkArgument; public class PropertyDto { private static final int MAX_KEY_LENGTH = 512; - private Long id; private String key; private String value; private Long resourceId; private Long userId; - public Long getId() { - return id; - } - - public PropertyDto setId(Long id) { - this.id = id; - return this; - } - public String getKey() { return key; } diff --git a/sonar-db/src/main/resources/org/sonar/db/property/PropertiesMapper.xml b/sonar-db/src/main/resources/org/sonar/db/property/PropertiesMapper.xml index eb6a14664f1..206195eab86 100644 --- a/sonar-db/src/main/resources/org/sonar/db/property/PropertiesMapper.xml +++ b/sonar-db/src/main/resources/org/sonar/db/property/PropertiesMapper.xml @@ -51,7 +51,6 @@ - p.id as id, p.prop_key as "key", p.is_empty as empty, p.text_value as textValue, diff --git a/sonar-db/src/test/java/org/sonar/db/property/PropertiesDaoTest.java b/sonar-db/src/test/java/org/sonar/db/property/PropertiesDaoTest.java index 4ad5862b347..e95511e8a3e 100644 --- a/sonar-db/src/test/java/org/sonar/db/property/PropertiesDaoTest.java +++ b/sonar-db/src/test/java/org/sonar/db/property/PropertiesDaoTest.java @@ -190,13 +190,13 @@ public class PropertiesDaoTest { assertThat(properties.size()) .isEqualTo(2); - assertThatDto(findById(properties, id1)) + assertThatDto(findByKey(properties, "global.one")) .hasKey("global.one") .hasNoUserId() .hasNoResourceId() .hasValue("one"); - assertThatDto(findById(properties, id2)) + assertThatDto(findByKey(properties, "global.two")) .hasKey("global.two") .hasNoResourceId() .hasNoUserId() @@ -257,17 +257,17 @@ public class PropertiesDaoTest { insertProperty("global.one", "one", null, null); insertProperty("global.two", "two", null, null); // project - long id3 = insertProperty("project.one", "Pone", projectId, null); - long id4 = insertProperty("project.two", "Ptwo", projectId, null); + insertProperty("project.one", "Pone", projectId, null); + insertProperty("project.two", "Ptwo", projectId, null); List dtos = underTest.selectProjectProperties(projectDto.key()); assertThat(dtos) .hasSize(2); - assertThatDto(findById(dtos, id3)) + assertThatDto(findByKey(dtos, "project.one")) .hasKey("project.one") .hasResourceId(projectId) .hasValue("Pone"); - assertThatDto(findById(dtos, id4)) + assertThatDto(findByKey(dtos, "project.two")) .hasKey("project.two") .hasResourceId(projectId) .hasValue("Ptwo"); @@ -994,9 +994,9 @@ public class PropertiesDaoTest { underTest.renamePropertyKey(null, "foo"); } - private PropertyDto findById(List properties, long id) { + private PropertyDto findByKey(List properties, String key) { for (PropertyDto property : properties) { - if (property.getId() == id) { + if (key.equals(property.getKey())) { return property; } }