use of org.jenkins.plugins.audit2db.model.BuildDetails in project selenium_java by sergueik.
the class BuildDetailsHibernateRepositoryTests method retrievingOldProjectNamesShouldReturnEmptyList.
@Test
public void retrievingOldProjectNamesShouldReturnEmptyList() {
final Map<String, List<BuildDetails>> dataset = TestUtils.createRandomDataset(hostName);
// ideally we should persist dataset in a transaction and roll it back
// at the end of the test
final TransactionStatus tx = txmgr.getTransaction(null);
tx.setRollbackOnly();
for (final List<BuildDetails> detailsList : dataset.values()) {
repository.saveBuildDetailsList(detailsList);
}
final Calendar fromDate = Calendar.getInstance();
fromDate.add(Calendar.YEAR, -10);
final Calendar toDate = Calendar.getInstance();
toDate.add(Calendar.YEAR, -1);
final List<String> projectNames = repository.getProjectNames(hostName, fromDate.getTime(), toDate.getTime());
txmgr.rollback(tx);
Assert.assertNotNull("Unexpected null list of project names", projectNames);
Assert.assertTrue("Unexpected non-empty list of project names", projectNames.isEmpty());
}
use of org.jenkins.plugins.audit2db.model.BuildDetails in project selenium_java by sergueik.
the class BuildDetailsHibernateRepositoryTests method retrievingAllProjectNamesShouldMatchDataset.
@Test
public void retrievingAllProjectNamesShouldMatchDataset() {
final Map<String, List<BuildDetails>> dataset = TestUtils.createRandomDataset(hostName);
// ideally we should persist dataset in a transaction and roll it back
// at the end of the test
final TransactionStatus tx = txmgr.getTransaction(null);
tx.setRollbackOnly();
for (final List<BuildDetails> detailsList : dataset.values()) {
repository.saveBuildDetailsList(detailsList);
}
final Calendar fromDate = Calendar.getInstance();
fromDate.add(Calendar.YEAR, -1);
final Calendar toDate = Calendar.getInstance();
final List<String> projectNames = repository.getProjectNames(hostName, fromDate.getTime(), toDate.getTime());
txmgr.rollback(tx);
Assert.assertNotNull("Unexpected null list of project names", projectNames);
Assert.assertFalse("Unexpected empty list of project names", projectNames.isEmpty());
Assert.assertEquals("Unexpected number of project names", dataset.size(), projectNames.size());
}
use of org.jenkins.plugins.audit2db.model.BuildDetails in project selenium_java by sergueik.
the class BuildDetailsImplTests method getBuildDetails.
private BuildDetails getBuildDetails() {
final BuildDetails build = new BuildDetailsImpl();
build.setDuration(Long.valueOf(60));
build.setEndDate(new Date(build.getStartDate().getTime() + (build.getDuration() * 1000)));
build.setFullName("BUILD FULL NAME");
build.setId("BUILD ID");
build.setName("BUILD NAME");
build.setUserId("BUILD USER ID");
build.setUserName("BUILD USER NAME");
final List<BuildParameter> params = new ArrayList<BuildParameter>();
params.add(new BuildParameterImpl("PARAM_ID", "PARAM NAME", "PARAM VALUE", build));
build.setParameters(params);
return build;
}
use of org.jenkins.plugins.audit2db.model.BuildDetails in project selenium_java by sergueik.
the class BuildDetailsImplTests method equalsNullShouldBeFalse.
@Test
public void equalsNullShouldBeFalse() {
final BuildDetails actual = getBuildDetails();
Assert.assertFalse("Broken inequality logic", actual.equals(null));
}
use of org.jenkins.plugins.audit2db.model.BuildDetails in project selenium_java by sergueik.
the class BuildDetailsImplTests method equalsSomethingElseShouldBeFalse.
@Test
public void equalsSomethingElseShouldBeFalse() {
final BuildDetails actual = getBuildDetails();
Assert.assertFalse("Broken inequality logic", actual.equals("SOMESTRING"));
}
Aggregations