]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-249 rename some methods of PastSnapshot so sonar can detect it's a bean
authorsimonbrandhof <simon.brandhof@gmail.com>
Sat, 4 Dec 2010 19:19:40 +0000 (19:19 +0000)
committersimonbrandhof <simon.brandhof@gmail.com>
Sat, 4 Dec 2010 19:19:40 +0000 (19:19 +0000)
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/PastSnapshot.java
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/PastSnapshotFinder.java
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/TimeMachineConfigurationPersister.java
plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/timemachine/PastSnapshotFinderTest.java
plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/timemachine/TimeMachineConfigurationPersisterTest.java

index 1193c4294dd148c35cf8b8295a37e51474638f87..87d803612e8bf9ddcf7d486c046e06853d9096be 100644 (file)
@@ -48,15 +48,15 @@ public final class PastSnapshot {
     return projectSnapshot.getCreatedAt();
   }
 
-  public String getConfigurationMode() {
+  public String getMode() {
     return mode;
   }
 
-  public String getConfigurationModeParameter() {
+  public String getModeParameter() {
     return modeParameter;
   }
 
-  public PastSnapshot setConfigurationModeParameter(String s) {
+  public PastSnapshot setModeParameter(String s) {
     this.modeParameter = s;
     return this;
   }
index 90e7c8bbc6ec7787413751abf2791f9e380d7e68..92ca2715ec3a6457418f73210b8ad1ca093acebb 100644 (file)
@@ -76,7 +76,7 @@ public class PastSnapshotFinder implements BatchExtension {
       if (projectSnapshot != null) {
         SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
         String date = format.format(projectSnapshot.getCreatedAt());
-        return new PastSnapshot(index, LAST__ANALYSIS_MODE, projectSnapshot).setConfigurationModeParameter(date);
+        return new PastSnapshot(index, LAST__ANALYSIS_MODE, projectSnapshot).setModeParameter(date);
       }
     }
     return null;
@@ -88,7 +88,7 @@ public class PastSnapshotFinder implements BatchExtension {
       Date date = format.parse(property);
       Snapshot projectSnapshot = finderByDate.findByDate(date);
       if (projectSnapshot != null) {
-        return new PastSnapshot(index, DATE_MODE, projectSnapshot).setConfigurationModeParameter(property);
+        return new PastSnapshot(index, DATE_MODE, projectSnapshot).setModeParameter(property);
       }
       return null;
 
@@ -100,7 +100,7 @@ public class PastSnapshotFinder implements BatchExtension {
   private PastSnapshot findByVersion(int index, String property) {
     Snapshot projectSnapshot = finderByVersion.findVersion(property);
     if (projectSnapshot != null) {
-      return new PastSnapshot(index, VERSION_MODE, projectSnapshot).setConfigurationModeParameter(property);
+      return new PastSnapshot(index, VERSION_MODE, projectSnapshot).setModeParameter(property);
     }
     return null;
   }
@@ -110,7 +110,7 @@ public class PastSnapshotFinder implements BatchExtension {
       int days = Integer.parseInt(property);
       Snapshot projectSnapshot = finderByDays.findInDays(days);
       if (projectSnapshot != null) {
-        return new PastSnapshot(index, DAYS_MODE, projectSnapshot).setConfigurationModeParameter(String.valueOf(days));
+        return new PastSnapshot(index, DAYS_MODE, projectSnapshot).setModeParameter(String.valueOf(days));
       }
       return null;
 
index 3fc43b9a784779c00b9c58044ed034422c79081e..e6616a784c92ea7e5feb04cb17acba97c3e6839d 100644 (file)
@@ -42,16 +42,16 @@ public final class TimeMachineConfigurationPersister implements BatchExtension {
     for (PastSnapshot variationSnapshot : variationSnapshots) {
       switch (variationSnapshot.getIndex()) {
         case 1:
-          projectSnapshot.setVarMode1(variationSnapshot.getConfigurationMode());
-          projectSnapshot.setVarLabel1(variationSnapshot.getConfigurationModeParameter());
+          projectSnapshot.setVarMode1(variationSnapshot.getMode());
+          projectSnapshot.setVarLabel1(variationSnapshot.getModeParameter());
           break;
         case 2:
-          projectSnapshot.setVarMode2(variationSnapshot.getConfigurationMode());
-          projectSnapshot.setVarLabel2(variationSnapshot.getConfigurationModeParameter());
+          projectSnapshot.setVarMode2(variationSnapshot.getMode());
+          projectSnapshot.setVarLabel2(variationSnapshot.getModeParameter());
           break;
         case 3:
-          projectSnapshot.setVarMode3(variationSnapshot.getConfigurationMode());
-          projectSnapshot.setVarLabel3(variationSnapshot.getConfigurationModeParameter());
+          projectSnapshot.setVarMode3(variationSnapshot.getMode());
+          projectSnapshot.setVarLabel3(variationSnapshot.getModeParameter());
           break;
         default:
           throw new IndexOutOfBoundsException("Index of variation configuration is out of range: " + variationSnapshot);
index 7c1109b7b060382ee64286451204bae45e8c6279..79ae41629c6b8c0bdc4d363c46f96d86b7dc738f 100644 (file)
@@ -61,8 +61,8 @@ public class PastSnapshotFinderTest {
     verify(finderByDays).findInDays(30);
     assertNotNull(variationSnapshot);
     assertThat(variationSnapshot.getIndex(), is(1));
-    assertThat(variationSnapshot.getConfigurationMode(), is("days"));
-    assertThat(variationSnapshot.getConfigurationModeParameter(), is("30"));
+    assertThat(variationSnapshot.getMode(), is("days"));
+    assertThat(variationSnapshot.getModeParameter(), is("30"));
   }
 
   @Test
@@ -91,8 +91,8 @@ public class PastSnapshotFinderTest {
       }
     }));
     assertThat(variationSnapshot.getIndex(), is(2));
-    assertThat(variationSnapshot.getConfigurationMode(), is("date"));
-    assertThat(variationSnapshot.getConfigurationModeParameter(), is("2010-05-18"));
+    assertThat(variationSnapshot.getMode(), is("date"));
+    assertThat(variationSnapshot.getModeParameter(), is("2010-05-18"));
   }
 
   @Test
@@ -117,8 +117,8 @@ public class PastSnapshotFinderTest {
 
     verify(finderByLastAnalysis).findLastAnalysis();
     assertThat(variationSnapshot.getIndex(), is(2));
-    assertThat(variationSnapshot.getConfigurationMode(), is("last_analysis"));
-    assertThat(variationSnapshot.getConfigurationModeParameter(), is("2010-05-18"));
+    assertThat(variationSnapshot.getMode(), is("last_analysis"));
+    assertThat(variationSnapshot.getModeParameter(), is("2010-05-18"));
   }
 
   @Test
@@ -140,8 +140,8 @@ public class PastSnapshotFinderTest {
 
     verify(finderByVersion).findVersion("1.2");
     assertThat(variationSnapshot.getIndex(), is(2));
-    assertThat(variationSnapshot.getConfigurationMode(), is("version"));
-    assertThat(variationSnapshot.getConfigurationModeParameter(), is("1.2"));
+    assertThat(variationSnapshot.getMode(), is("version"));
+    assertThat(variationSnapshot.getModeParameter(), is("1.2"));
   }
 
   @Test
index 5d08a57f1636e54bd9c1c8e6ba0f25488decc25a..0e25e21d7a3d223161a15ad263755758494ead95 100644 (file)
@@ -36,9 +36,9 @@ public class TimeMachineConfigurationPersisterTest extends AbstractDbUnitTestCas
 
     TimeMachineConfiguration conf = mock(TimeMachineConfiguration.class);
     PastSnapshot vs1 = new PastSnapshot(1, "days", getSession().getSingleResult(Snapshot.class, "id", 100))
-        .setConfigurationModeParameter("30");
+        .setModeParameter("30");
     PastSnapshot vs3 = new PastSnapshot(3, "version", getSession().getSingleResult(Snapshot.class, "id", 300))
-        .setConfigurationModeParameter("1.2.3");
+        .setModeParameter("1.2.3");
     when(conf.getProjectPastSnapshots()).thenReturn(Arrays.asList(vs1, vs3));
     Snapshot projectSnapshot = getSession().getSingleResult(Snapshot.class, "id", 1000);