private String periodParam;
private Long periodDate;
+ /**
+ * SCM revision is provided by scanner and is optional.
+ */
+ @Nullable
+ private String revision;
+
public Long getId() {
return id;
}
return createdAt;
}
+ @Nullable
+ public String getRevision() {
+ return revision;
+ }
+
+ public SnapshotDto setRevision(@Nullable String revision) {
+ checkLength(100, revision, "revision");
+ this.revision = revision;
+ return this;
+ }
+
@Override
public boolean equals(Object o) {
if (this == o) {
s.build_string as buildString,
s.period1_mode as periodMode,
s.period1_param as periodParam,
- s.period1_date as periodDate
+ s.period1_date as periodDate,
+ s.revision as revision
</sql>
<sql id="viewsSnapshotColumns">
build_string,
period1_mode,
period1_param,
- period1_date
+ period1_date,
+ revision
)
values (
#{uuid, jdbcType=VARCHAR},
#{buildString, jdbcType=VARCHAR},
#{periodMode, jdbcType=VARCHAR},
#{periodParam, jdbcType=VARCHAR},
- #{periodDate, jdbcType=BIGINT}
+ #{periodDate, jdbcType=BIGINT},
+ #{revision, jdbcType=VARCHAR}
)
</insert>
</mapper>
import java.util.List;
import java.util.Optional;
import javax.annotation.Nullable;
-import org.apache.commons.lang.StringUtils;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import static org.apache.commons.lang.RandomStringUtils.randomAlphanumeric;
import static org.apache.commons.lang.math.RandomUtils.nextLong;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.fail;
import static org.assertj.core.groups.Tuple.tuple;
import static org.sonar.db.ce.CeActivityDto.Status.CANCELED;
import static org.sonar.db.ce.CeActivityDto.Status.SUCCESS;
.setProjectVersion("2.1.0")
.setBuildString("2.1.0.2336")
.setBuildDate(1500000000006L)
- .setCreatedAt(1403042400000L));
+ .setCreatedAt(1403042400000L)
+ .setRevision("sha1"));
SnapshotDto result = underTest.selectByUuid(db.getSession(), "ABCD").get();
assertThat(result.getId()).isNotNull();
assertThat(result.getPeriodDate()).isEqualTo(1500000000001L);
assertThat(result.getBuildDate()).isEqualTo(1500000000006L);
assertThat(result.getCreatedAt()).isEqualTo(1403042400000L);
+ assertThat(result.getRevision()).isEqualTo("sha1");
assertThat(underTest.selectByUuid(db.getSession(), "DOES_NOT_EXIST").isPresent()).isFalse();
}
.setStatus(SnapshotDto.STATUS_PROCESSED)
.setCreatedAt(System.currentTimeMillis())
.setBuildDate(System.currentTimeMillis())
+ .setRevision(randomAlphanumeric(50))
.setLast(true);
}