]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5183 timezones - fix views and devcockpit
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Fri, 6 Feb 2015 08:23:38 +0000 (09:23 +0100)
committerTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Fri, 6 Feb 2015 08:25:49 +0000 (09:25 +0100)
16 files changed:
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/TimeMachineConfigurationPersister.java
sonar-batch/src/main/java/org/sonar/batch/ProjectConfigurator.java
sonar-batch/src/main/java/org/sonar/batch/components/PastSnapshot.java
sonar-batch/src/main/java/org/sonar/batch/components/PastSnapshotFinderByDays.java
sonar-batch/src/main/java/org/sonar/batch/components/PastSnapshotFinderByPreviousAnalysis.java
sonar-batch/src/main/java/org/sonar/batch/components/PastSnapshotFinderByPreviousVersion.java
sonar-batch/src/main/java/org/sonar/batch/components/PastSnapshotFinderByVersion.java
sonar-batch/src/main/java/org/sonar/batch/components/PeriodsDefinition.java
sonar-batch/src/main/java/org/sonar/batch/components/TimeMachineConfiguration.java
sonar-batch/src/main/java/org/sonar/batch/index/ResourcePersister.java
sonar-batch/src/test/java/org/sonar/batch/components/PastSnapshotFinderByDaysTest.java
sonar-batch/src/test/java/org/sonar/batch/components/PastSnapshotFinderTest.java
sonar-batch/src/test/java/org/sonar/batch/components/PastSnapshotTest.java
sonar-plugin-api/src/main/java/org/sonar/api/batch/Event.java
sonar-plugin-api/src/main/java/org/sonar/api/database/model/Snapshot.java
sonar-plugin-api/src/test/java/org/sonar/api/database/model/SnapshotTest.java

index 13f1a85efbf8f0329b26cb5259c21e14bff4ec55..84125404fb0dbc863e582f319db7a765ca770240 100644 (file)
@@ -77,6 +77,6 @@ public final class TimeMachineConfigurationPersister implements Decorator {
     int periodIndex = pastSnapshot.getIndex();
     snapshot.setPeriodMode(periodIndex, pastSnapshot.getMode());
     snapshot.setPeriodModeParameter(periodIndex, pastSnapshot.getModeParameter());
-    snapshot.setPeriodDate(periodIndex, dateToLong(pastSnapshot.getDate()));
+    snapshot.setPeriodDateMs(periodIndex, dateToLong(pastSnapshot.getDate()));
   }
 }
index 4447bf9e4b4e1d702da13f7a6adbd30cf75e1308..b345f2e1b0aa3e61692487411328342b0df68d41 100644 (file)
@@ -95,12 +95,12 @@ public class ProjectConfigurator implements BatchComponent {
       ResourceModel persistedProject = databaseSession.getSingleResult(ResourceModel.class, "key", projectKey, "enabled", true);
       if (persistedProject != null) {
         Snapshot lastSnapshot = databaseSession.getSingleResult(Snapshot.class, "resourceId", persistedProject.getId(), "last", true);
-        boolean analysisBeforeLastSnapshot = lastSnapshot != null && analysisDate.getTime() <= lastSnapshot.getCreatedAt();
+        boolean analysisBeforeLastSnapshot = lastSnapshot != null && analysisDate.getTime() <= lastSnapshot.getCreatedAtMs();
         if (analysisBeforeLastSnapshot) {
           throw new IllegalArgumentException(
             "'sonar.projectDate' property cannot be older than the date of the last known quality snapshot on this project. Value: '" +
               settings.getString(CoreProperties.PROJECT_DATE_PROPERTY) + "'. " +
-              "Latest quality snapshot: '" + formatDateTime(longToDate(lastSnapshot.getCreatedAt()))
+              "Latest quality snapshot: '" + formatDateTime(longToDate(lastSnapshot.getCreatedAtMs()))
               + "'. This property may only be used to rebuild the past in a chronological order.");
         }
       }
index aaaca92897027843c2149480a8609642408f5905..48955f9738f43fcc0c309b85dcbbaa1f88d15f96 100644 (file)
@@ -75,7 +75,7 @@ public class PastSnapshot {
   }
 
   public Date getDate() {
-    return projectSnapshot != null ? longToDate(projectSnapshot.getCreatedAt()) : null;
+    return projectSnapshot != null ? longToDate(projectSnapshot.getCreatedAtMs()) : null;
   }
 
   public PastSnapshot setMode(String mode) {
index a3aa8b8387f28be2b77cbae3d23615f495c7bcfb..0f802682c8a2603ba5d84519bc9ef0ede7d7c263 100644 (file)
@@ -41,10 +41,10 @@ public class PastSnapshotFinderByDays implements BatchExtension {
   }
 
   PastSnapshot findFromDays(Snapshot projectSnapshot, int days) {
-    Date targetDate = DateUtils.addDays(longToDate(projectSnapshot.getCreatedAt()), -days);
+    Date targetDate = DateUtils.addDays(longToDate(projectSnapshot.getCreatedAtMs()), -days);
     String hql = "from " + Snapshot.class.getSimpleName() + " where resourceId=:resourceId AND status=:status AND createdAt<:date AND qualifier<>:lib order by createdAt asc";
     List<Snapshot> snapshots = session.createQuery(hql)
-      .setParameter("date", projectSnapshot.getCreatedAt())
+      .setParameter("date", projectSnapshot.getCreatedAtMs())
       .setParameter("resourceId", projectSnapshot.getResourceId())
       .setParameter("status", Snapshot.STATUS_PROCESSED)
       .setParameter("lib", Qualifiers.LIBRARY)
@@ -65,7 +65,7 @@ public class PastSnapshotFinderByDays implements BatchExtension {
     long bestDistance = Long.MAX_VALUE;
     Snapshot nearest = null;
     for (Snapshot snapshot : snapshots) {
-      long distance = distance(longToDate(snapshot.getCreatedAt()), targetDate);
+      long distance = distance(longToDate(snapshot.getCreatedAtMs()), targetDate);
       if (distance <= bestDistance) {
         bestDistance = distance;
         nearest = snapshot;
index 627e1943b0cd858d87bce3179bc8593a154b1e9d..506295775eff0dadf1f86db652fdca14fbce90b7 100644 (file)
@@ -44,7 +44,7 @@ public class PastSnapshotFinderByPreviousAnalysis implements BatchExtension {
     String hql = "from " + Snapshot.class.getSimpleName()
         + " where createdAt<:date AND resourceId=:resourceId AND status=:status and last=:last and qualifier<>:lib order by createdAt desc";
     List<Snapshot> snapshots = session.createQuery(hql)
-        .setParameter("date", projectSnapshot.getCreatedAt())
+        .setParameter("date", projectSnapshot.getCreatedAtMs())
         .setParameter("resourceId", projectSnapshot.getResourceId())
         .setParameter("status", Snapshot.STATUS_PROCESSED)
         .setParameter("last", true)
@@ -56,7 +56,7 @@ public class PastSnapshotFinderByPreviousAnalysis implements BatchExtension {
       return new PastSnapshot(CoreProperties.TIMEMACHINE_MODE_PREVIOUS_ANALYSIS);
     }
     Snapshot snapshot = snapshots.get(0);
-    Date targetDate = longToDate(snapshot.getCreatedAt());
+    Date targetDate = longToDate(snapshot.getCreatedAtMs());
     SimpleDateFormat format = new SimpleDateFormat(DateUtils.DATE_FORMAT);
     return new PastSnapshot(CoreProperties.TIMEMACHINE_MODE_PREVIOUS_ANALYSIS, targetDate, snapshot).setModeParameter(format.format(targetDate));
   }
index 85fc0f855da018ece6d7fc541495d43073d94835..6437688bf68b8114b11f38b7fbb848ec3223f79e 100644 (file)
@@ -57,7 +57,7 @@ public class PastSnapshotFinderByPreviousVersion implements BatchExtension {
     Event previousVersionEvent = events.get(0);
     Snapshot snapshot = session.getSingleResult(Snapshot.class, "id", previousVersionEvent.getSnapshot().getId());
 
-    return new PastSnapshot(CoreProperties.TIMEMACHINE_MODE_PREVIOUS_VERSION, longToDate(snapshot.getCreatedAt()), snapshot).setModeParameter(snapshot.getVersion());
+    return new PastSnapshot(CoreProperties.TIMEMACHINE_MODE_PREVIOUS_VERSION, longToDate(snapshot.getCreatedAtMs()), snapshot).setModeParameter(snapshot.getVersion());
   }
 
 }
index 3995c2cb69de81ee9351a195ff2fcc4ed57559a6..161bd87b2ee121f585a3afea5ce6fe35958e541b 100644 (file)
@@ -53,7 +53,7 @@ public class PastSnapshotFinderByVersion implements BatchExtension {
       result = new PastSnapshot(CoreProperties.TIMEMACHINE_MODE_VERSION);
     } else {
       Snapshot snapshot = snapshots.get(0);
-      Date targetDate = longToDate(snapshot.getCreatedAt());
+      Date targetDate = longToDate(snapshot.getCreatedAtMs());
       result = new PastSnapshot(CoreProperties.TIMEMACHINE_MODE_VERSION, targetDate, snapshot).setModeParameter(version);
     }
     return result;
index 9f75d86fcb639c82192152390d5d496be86c2111..6f1eb16a5bc539b06a64291aed832e943b59cb83 100644 (file)
@@ -79,8 +79,8 @@ public class PeriodsDefinition implements BatchComponent {
     if (projectId != null) {
       snapshot = new Snapshot();
       snapshot.setResourceId(projectId.intValue());
-      snapshot.setCreatedAt(dateToLong(projectTree.getRootProject().getAnalysisDate()));
-      snapshot.setBuildDate(System.currentTimeMillis());
+      snapshot.setCreatedAtMs(dateToLong(projectTree.getRootProject().getAnalysisDate()));
+      snapshot.setBuildDateMs(System.currentTimeMillis());
       snapshot.setVersion(projectTree.getRootProject().getAnalysisVersion());
     }
     return snapshot;
index 28c4957d89f178f185ac4b7edf673bd76b23be4a..2d4c71bc9c12beaf2e6dea705801c267046c4fad 100644 (file)
@@ -60,7 +60,7 @@ public class TimeMachineConfiguration implements BatchComponent {
       PastSnapshot pastSnapshot = projectPastSnapshot.clonePastSnapshot();
       modulePastSnapshots.add(pastSnapshot);
       // When no snapshot is found, date of the period is null
-      periods.add(new Period(pastSnapshot.getIndex(), snapshot != null ? longToDate(snapshot.getCreatedAt()) : null));
+      periods.add(new Period(pastSnapshot.getIndex(), snapshot != null ? longToDate(snapshot.getCreatedAtMs()) : null));
       log(pastSnapshot);
     }
   }
index 7373053e2c057f62dd96e108fa584aebceae6dae..8b739aada0264be35ab8d282fe17e68318c6a26f 100644 (file)
@@ -135,8 +135,8 @@ public class ResourcePersister implements ScanPersister {
 
     Snapshot snapshot = new Snapshot(model, parentSnapshot);
     snapshot.setVersion(project.getAnalysisVersion());
-    snapshot.setCreatedAt(dateToLong(project.getAnalysisDate()));
-    snapshot.setBuildDate(System.currentTimeMillis());
+    snapshot.setCreatedAtMs(dateToLong(project.getAnalysisDate()));
+    snapshot.setBuildDateMs(System.currentTimeMillis());
     snapshot = session.save(snapshot);
     session.commit();
 
@@ -170,8 +170,8 @@ public class ResourcePersister implements ScanPersister {
     Snapshot snapshot = findLibrarySnapshot(model.getId(), library.getVersion());
     if (snapshot == null) {
       snapshot = new Snapshot(model, null);
-      snapshot.setCreatedAt(dateToLong(analysisDate));
-      snapshot.setBuildDate(System.currentTimeMillis());
+      snapshot.setCreatedAtMs(dateToLong(analysisDate));
+      snapshot.setBuildDateMs(System.currentTimeMillis());
       snapshot.setVersion(library.getVersion());
       snapshot.setStatus(Snapshot.STATUS_PROCESSED);
 
@@ -219,7 +219,7 @@ public class ResourcePersister implements ScanPersister {
     }
 
     Snapshot snapshot = new Snapshot(model, parentSnapshot);
-    snapshot.setBuildDate(System.currentTimeMillis());
+    snapshot.setBuildDateMs(System.currentTimeMillis());
     snapshot = session.save(snapshot);
     session.commit();
     return snapshot;
index 44b69304b4513e3e7f3510e3f711c99c80f6d2c7..1b136e9ae72cfae3940dc87b9ba2f73ca8ef6b45 100644 (file)
@@ -107,7 +107,7 @@ public class PastSnapshotFinderByDaysTest extends AbstractDbUnitTestCase {
   private Snapshot newSnapshot(int id, String date) throws ParseException {
     Snapshot snapshot = new Snapshot();
     snapshot.setId(id);
-    snapshot.setCreatedAt(dateFormat.parse(date).getTime());
+    snapshot.setCreatedAtMs(dateFormat.parse(date).getTime());
     return snapshot;
   }
 }
index f821e63057f4665af99e95465ec58492526c2f0c..c335d3b87d68edd0e2af54519bf285f8a66b8956 100644 (file)
@@ -148,7 +148,7 @@ public class PastSnapshotFinderTest {
   public void should_find_by_previous_analysis() throws ParseException {
     final Date date = DateUtils.parseDate("2010-05-18");
     Snapshot snapshot = new Snapshot();
-    snapshot.setCreatedAt(date.getTime());
+    snapshot.setCreatedAtMs(date.getTime());
     when(finderByPreviousAnalysis.findByPreviousAnalysis(null)).thenReturn(new PastSnapshot(CoreProperties.TIMEMACHINE_MODE_PREVIOUS_ANALYSIS, date, snapshot));
 
     PastSnapshot variationSnapshot = finder.find(null, 2, CoreProperties.TIMEMACHINE_MODE_PREVIOUS_ANALYSIS);
@@ -175,7 +175,7 @@ public class PastSnapshotFinderTest {
     final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
     final Date date = format.parse("2010-05-18");
     Snapshot snapshot = new Snapshot();
-    snapshot.setCreatedAt(date.getTime());
+    snapshot.setCreatedAtMs(date.getTime());
     when(finderByPreviousVersion.findByPreviousVersion(null)).thenReturn(new PastSnapshot(CoreProperties.TIMEMACHINE_MODE_PREVIOUS_VERSION, date, snapshot));
 
     PastSnapshot variationSnapshot = finder.find(null, 2, CoreProperties.TIMEMACHINE_MODE_PREVIOUS_VERSION);
index 4113cfc069c9445d9318bf8e38e2c7b83552ba90..3d38431f780b24bfb61165eddc675704a6721db1 100644 (file)
@@ -32,7 +32,7 @@ public class PastSnapshotTest {
 
   @Test
   public void test_some_setters_and_getters() {
-    Snapshot snapshot = new Snapshot().setQualifier(Qualifiers.FILE).setCreatedAt(System.currentTimeMillis());
+    Snapshot snapshot = new Snapshot().setQualifier(Qualifiers.FILE).setCreatedAtMs(System.currentTimeMillis());
     snapshot.setId(10);
     PastSnapshot pastSnapshot = new PastSnapshot(CoreProperties.TIMEMACHINE_MODE_VERSION, new Date(),
       snapshot)
@@ -57,7 +57,7 @@ public class PastSnapshotTest {
 
   @Test
   public void testToStringForVersion() {
-    PastSnapshot pastSnapshot = new PastSnapshot(CoreProperties.TIMEMACHINE_MODE_VERSION, new Date(), new Snapshot().setCreatedAt(System.currentTimeMillis())).setModeParameter("2.3");
+    PastSnapshot pastSnapshot = new PastSnapshot(CoreProperties.TIMEMACHINE_MODE_VERSION, new Date(), new Snapshot().setCreatedAtMs(System.currentTimeMillis())).setModeParameter("2.3");
     assertThat(pastSnapshot.toString()).startsWith("Compare to version 2.3");
   }
 
@@ -75,7 +75,7 @@ public class PastSnapshotTest {
 
   @Test
   public void testToStringForNumberOfDaysWithSnapshot() {
-    PastSnapshot pastSnapshot = new PastSnapshot(CoreProperties.TIMEMACHINE_MODE_DAYS, new Date(), new Snapshot().setCreatedAt(System.currentTimeMillis())).setModeParameter("30");
+    PastSnapshot pastSnapshot = new PastSnapshot(CoreProperties.TIMEMACHINE_MODE_DAYS, new Date(), new Snapshot().setCreatedAtMs(System.currentTimeMillis())).setModeParameter("30");
     assertThat(pastSnapshot.toString()).startsWith("Compare over 30 days (");
   }
 
@@ -87,13 +87,13 @@ public class PastSnapshotTest {
 
   @Test
   public void testToStringForDateWithSnapshot() {
-    PastSnapshot pastSnapshot = new PastSnapshot(CoreProperties.TIMEMACHINE_MODE_DATE, new Date(), new Snapshot().setCreatedAt(System.currentTimeMillis()));
+    PastSnapshot pastSnapshot = new PastSnapshot(CoreProperties.TIMEMACHINE_MODE_DATE, new Date(), new Snapshot().setCreatedAtMs(System.currentTimeMillis()));
     assertThat(pastSnapshot.toString()).startsWith("Compare to date ");
   }
 
   @Test
   public void testToStringForPreviousAnalysis() {
-    PastSnapshot pastSnapshot = new PastSnapshot(CoreProperties.TIMEMACHINE_MODE_PREVIOUS_ANALYSIS, new Date(), new Snapshot().setCreatedAt(System.currentTimeMillis()));
+    PastSnapshot pastSnapshot = new PastSnapshot(CoreProperties.TIMEMACHINE_MODE_PREVIOUS_ANALYSIS, new Date(), new Snapshot().setCreatedAtMs(System.currentTimeMillis()));
     assertThat(pastSnapshot.toString()).startsWith("Compare to previous analysis ");
   }
 
index 406161ed75891ff746e33b5f35ad46cf96e6d729..8c802c2ca9813aa0d8040f0180b2b00c284ce85d 100644 (file)
@@ -125,7 +125,7 @@ public class Event extends BaseIdentifiable {
   public final void setSnapshot(Snapshot snapshot) {
     this.snapshot = snapshot;
     if (snapshot != null) {
-      this.date = (snapshot.getCreatedAt() == null ? null : new Date(snapshot.getCreatedAt()));
+      this.date = (snapshot.getCreatedAtMs() == null ? null : new Date(snapshot.getCreatedAtMs()));
       this.resourceId = snapshot.getResourceId();
     }
   }
index 347690a8a21122db54db3a5ad4a88e411d9c1bfd..2a3a99726534ba6e2a52fdc8a3309844e279b2dc 100644 (file)
@@ -29,9 +29,13 @@ import org.sonar.api.database.DatabaseSession;
 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.Table;
+
 import java.io.Serializable;
 import java.util.Date;
 
+import static org.sonar.api.utils.DateUtils.dateToLong;
+import static org.sonar.api.utils.DateUtils.longToDate;
+
 /**
  * A class to map a snapshot with its hibernate model
  */
@@ -153,7 +157,7 @@ public class Snapshot extends BaseIdentifiable<Snapshot> implements Serializable
     } else {
       this.parentId = parent.getId();
       this.rootId = (parent.getRootId() == null ? parent.getId() : parent.getRootId());
-      this.createdAt = parent.getCreatedAt();
+      this.createdAt = parent.getCreatedAtMs();
       this.depth = parent.getDepth() + 1;
       this.path = new StringBuilder()
         .append(parent.getPath())
@@ -191,7 +195,11 @@ public class Snapshot extends BaseIdentifiable<Snapshot> implements Serializable
    *
    * @since 2.14
    */
-  public Long getBuildDate() {
+  public Date getBuildDate() {
+    return longToDate(buildDate);
+  }
+
+  public Long getBuildDateMs() {
     return buildDate;
   }
 
@@ -200,16 +208,30 @@ public class Snapshot extends BaseIdentifiable<Snapshot> implements Serializable
    *
    * @since 2.14
    */
-  public Snapshot setBuildDate(Long d) {
+  public Snapshot setBuildDate(Date date) {
+    this.buildDate = dateToLong(date);
+    return this;
+  }
+
+  public Snapshot setBuildDateMs(Long d) {
     this.buildDate = d;
     return this;
   }
 
-  public Long getCreatedAt() {
+  public Date getCreatedAt() {
+    return longToDate(createdAt);
+  }
+
+  public Long getCreatedAtMs() {
     return createdAt;
   }
 
-  public Snapshot setCreatedAt(Long createdAt) {
+  public Snapshot setCreatedAt(Date createdAt) {
+    this.createdAt = dateToLong(createdAt);
+    return this;
+  }
+
+  public Snapshot setCreatedAtMs(Long createdAt) {
     this.createdAt = createdAt;
     return this;
   }
@@ -482,7 +504,11 @@ public class Snapshot extends BaseIdentifiable<Snapshot> implements Serializable
     return this;
   }
 
-  public Long getPeriod1Date() {
+  public Date getPeriod1Date() {
+    return longToDate(period1Date);
+  }
+
+  public Long getPeriod1DateMs() {
     return period1Date;
   }
 
@@ -491,12 +517,21 @@ public class Snapshot extends BaseIdentifiable<Snapshot> implements Serializable
    *
    * @since 2.5
    */
-  public Snapshot setPeriod1Date(Long period1Date) {
+  public Snapshot setPeriod1Date(Date period1Date) {
+    this.period1Date = dateToLong(period1Date);
+    return this;
+  }
+
+  public Snapshot setPeriod1DateMs(Long period1Date) {
     this.period1Date = period1Date;
     return this;
   }
 
-  public Long getPeriod2Date() {
+  public Date getPeriod2Date() {
+    return longToDate(period2Date);
+  }
+
+  public Long getPeriod2DateMs() {
     return period2Date;
   }
 
@@ -505,12 +540,21 @@ public class Snapshot extends BaseIdentifiable<Snapshot> implements Serializable
    *
    * @since 2.5
    */
-  public Snapshot setPeriod2Date(Long period2Date) {
+  public Snapshot setPeriod2Date(Date period2Date) {
+    this.period2Date = dateToLong(period2Date);
+    return this;
+  }
+
+  public Snapshot setPeriod2DateMs(Long period2Date) {
     this.period2Date = period2Date;
     return this;
   }
 
-  public Long getPeriod3Date() {
+  public Date getPeriod3Date() {
+    return longToDate(period3Date);
+  }
+
+  public Long getPeriod3DateMs() {
     return period3Date;
   }
 
@@ -519,12 +563,21 @@ public class Snapshot extends BaseIdentifiable<Snapshot> implements Serializable
    *
    * @since 2.5
    */
-  public Snapshot setPeriod3Date(Long period3Date) {
+  public Snapshot setPeriod3Date(Date period3Date) {
+    this.period3Date = dateToLong(period3Date);
+    return this;
+  }
+
+  public Snapshot setPeriod3DateMs(Long period3Date) {
     this.period3Date = period3Date;
     return this;
   }
 
-  public Long getPeriod4Date() {
+  public Date getPeriod4Date() {
+    return longToDate(period4Date);
+  }
+
+  public Long getPeriod4DateMs() {
     return period4Date;
   }
 
@@ -533,12 +586,21 @@ public class Snapshot extends BaseIdentifiable<Snapshot> implements Serializable
    *
    * @since 2.5
    */
-  public Snapshot setPeriod4Date(Long period4Date) {
+  public Snapshot setPeriod4Date(Date period4Date) {
+    this.period4Date = dateToLong(period4Date);
+    return this;
+  }
+
+  public Snapshot setPeriod4DateMs(Long period4Date) {
     this.period4Date = period4Date;
     return this;
   }
 
-  public Long getPeriod5Date() {
+  public Date getPeriod5Date() {
+    return longToDate(period5Date);
+  }
+
+  public Long getPeriod5DateMs() {
     return period5Date;
   }
 
@@ -547,7 +609,12 @@ public class Snapshot extends BaseIdentifiable<Snapshot> implements Serializable
    *
    * @since 2.5
    */
-  public Snapshot setPeriod5Date(Long period5Date) {
+  public Snapshot setPeriod5Date(Date period5Date) {
+    this.period5Date = dateToLong(period5Date);
+    return this;
+  }
+
+  public Snapshot setPeriod5DateMs(Long period5Date) {
     this.period5Date = period5Date;
     return this;
   }
@@ -647,7 +714,7 @@ public class Snapshot extends BaseIdentifiable<Snapshot> implements Serializable
    *
    * @since 2.5
    */
-  public Snapshot setPeriodDate(int periodIndex, Long date) {
+  public Snapshot setPeriodDateMs(int periodIndex, Long date) {
     switch (periodIndex) {
       case 1:
         period1Date = date;
@@ -698,7 +765,7 @@ public class Snapshot extends BaseIdentifiable<Snapshot> implements Serializable
     Snapshot other = (Snapshot) obj;
     return new EqualsBuilder()
       .append(resourceId, other.getResourceId())
-      .append(createdAt, other.getCreatedAt())
+      .append(createdAt, other.getCreatedAtMs())
       .isEquals();
   }
 
index c102f84423457af7e0935655e520be2091c8d23c..148572c83fb10c1107e103b5674a91200a4fb457 100644 (file)
@@ -29,11 +29,11 @@ public class SnapshotTest {
   @Test
   public void testGetDate() {
     Snapshot snapshot = new Snapshot();
-    assertNull(snapshot.getCreatedAt());
+    assertNull(snapshot.getCreatedAtMs());
 
     Long now = System.currentTimeMillis();
-    snapshot.setCreatedAt(now);
-    assertEquals(now, snapshot.getCreatedAt());
+    snapshot.setCreatedAtMs(now);
+    assertEquals(now, snapshot.getCreatedAtMs());
   }
 
   @Test