use of org.jenkins.plugins.audit2db.model.BuildDetails in project selenium_java by sergueik.
the class JobHistoryReportTests method matchingParametersShouldReturnNonEmptyResults.
@Test
public void matchingParametersShouldReturnNonEmptyResults() {
final JobHistoryReport report = new JobHistoryReportImpl();
report.setRepository(TestUtils.getTestRepository());
final Map<String, List<BuildDetails>> dataset = TestUtils.createRandomDataset(DbAuditUtil.getHostName());
// after each test run
for (final List<BuildDetails> detailsList : dataset.values()) {
TestUtils.getTestRepository().saveBuildDetailsList(detailsList);
}
final String projectName = dataset.keySet().iterator().next();
final Map<String, List<BuildDetails>> results = report.getProjectExecutions(projectName, TestUtils.NOW, TestUtils.NOW);
Assert.assertFalse("Unexpected empty results", results.isEmpty());
}
use of org.jenkins.plugins.audit2db.model.BuildDetails in project selenium_java by sergueik.
the class JobsByDateReportTests method matchingParametersShouldReturnNonEmptyResults.
@Test
public void matchingParametersShouldReturnNonEmptyResults() {
final JobsByDateReport report = new JobsByDateReportImpl();
report.setRepository(TestUtils.getTestRepository());
final Map<String, List<BuildDetails>> dataset = TestUtils.createRandomDataset(DbAuditUtil.getHostName());
// after each test run
for (final List<BuildDetails> detailsList : dataset.values()) {
TestUtils.getTestRepository().saveBuildDetailsList(detailsList);
}
final Map<String, List<BuildDetails>> results = report.getProjectExecutions(TestUtils.NOW, TestUtils.NOW);
Assert.assertFalse("Unexpected empty results", results.isEmpty());
}
use of org.jenkins.plugins.audit2db.model.BuildDetails in project selenium_java by sergueik.
the class JobsByParamReportTests method invalidParamValueShouldReturnEmptyResults.
@Test
public void invalidParamValueShouldReturnEmptyResults() {
final JobsByParamReport report = new JobsByParamReportImpl();
report.setRepository(TestUtils.getTestRepository());
final Map<String, List<BuildDetails>> dataset = TestUtils.createRandomDataset(DbAuditUtil.getHostName());
// after each test run
for (final List<BuildDetails> detailsList : dataset.values()) {
TestUtils.getTestRepository().saveBuildDetailsList(detailsList);
}
final BuildParameter param = dataset.values().iterator().next().get(0).getParameters().get(0);
final Map<String, List<BuildDetails>> results = report.getProjectExecutions(param.getName(), param.getValue() + " INVALID", TestUtils.NOW, TestUtils.NOW);
Assert.assertTrue("Unexpected results collection", results.isEmpty());
}
use of org.jenkins.plugins.audit2db.model.BuildDetails in project selenium_java by sergueik.
the class JobsByParamReportTests method paramNameWithWildcardShouldReturnNonEmptyResults.
@Test
public void paramNameWithWildcardShouldReturnNonEmptyResults() {
final JobsByParamReport report = new JobsByParamReportImpl();
report.setRepository(TestUtils.getTestRepository());
final Map<String, List<BuildDetails>> dataset = TestUtils.createRandomDataset(DbAuditUtil.getHostName());
// after each test run
for (final List<BuildDetails> detailsList : dataset.values()) {
TestUtils.getTestRepository().saveBuildDetailsList(detailsList);
}
final BuildParameter param = dataset.values().iterator().next().get(0).getParameters().get(0);
final Map<String, List<BuildDetails>> results = report.getProjectExecutions(param.getName().substring(0) + "%", param.getValue(), TestUtils.NOW, TestUtils.NOW);
Assert.assertFalse("Unexpected empty results", results.isEmpty());
}
use of org.jenkins.plugins.audit2db.model.BuildDetails in project selenium_java by sergueik.
the class TestUtils method createRandomBuildDetails.
public static BuildDetails createRandomBuildDetails(final boolean withParams) {
final long salt = System.nanoTime();
final BuildDetails build = new BuildDetailsImpl();
build.setDuration(Long.valueOf(60 + (long) (Math.random() * 60)));
build.setEndDate(new Date(build.getStartDate().getTime() + (build.getDuration() * 1000)));
build.setFullName("BUILD FULL NAME " + salt);
build.setId("BUILD ID " + salt);
build.setName("BUILD NAME " + salt);
build.setUserId("BUILD USER ID " + salt);
build.setUserName("BUILD USER NAME " + salt);
if (withParams) {
final List<BuildParameter> params = new ArrayList<BuildParameter>();
params.add(new BuildParameterImpl("PARAM_ID 1 " + salt, "PARAM NAME 1 " + salt, "PARAM VALUE 1 " + salt, build));
params.add(new BuildParameterImpl("PARAM_ID 2 " + salt, "PARAM NAME 2 " + salt, "PARAM VALUE 2 " + salt, build));
build.setParameters(params);
}
final BuildNode node = new BuildNodeImpl("NODE ADDRESS", "NODE HOSTNAME", "NODE DISPLAYNAME", "NODE URL", "NODE NAME", "NODE DESCRIPTION", "NODE LABEL");
build.setNode(node);
return build;
}
Aggregations