use of org.jenkins.plugins.audit2db.model.BuildDetails in project selenium_java by sergueik.
the class BuildDetailsHibernateRepositoryTests method retrievalByMatchingUserNameShouldReturnNonEmptyList.
@Test
public void retrievalByMatchingUserNameShouldReturnNonEmptyList() {
final BuildDetails build = TestUtils.createRandomBuildDetails();
final Object buildId = repository.saveBuildDetails(build);
Assert.assertNotNull("Unexpected null build id", buildId);
final List<BuildDetails> builds = repository.getBuildDetailsByUserName(build.getUserName().toLowerCase());
Assert.assertNotNull("Unexpected null list of builds", builds);
Assert.assertFalse("Unexpected empty list of builds", builds.isEmpty());
Assert.assertEquals("Unexpected number of builds", 1, builds.size());
Assert.assertEquals("Mismatching build details found", build, builds.get(0));
}
use of org.jenkins.plugins.audit2db.model.BuildDetails in project selenium_java by sergueik.
the class BuildDetailsHibernateRepositoryTests method createBuildsWithSameNodeShouldReuseNodeEntity.
@Test
public void createBuildsWithSameNodeShouldReuseNodeEntity() {
final BuildDetails build1 = TestUtils.createRandomBuildDetails();
build1.setId("BUILD_1");
final BuildDetails build2 = TestUtils.createRandomBuildDetails();
build2.setId("BUILD_2");
repository.saveBuildDetails(build1);
repository.saveBuildDetails(build2);
final HibernateTemplate hibernate = new HibernateTemplate();
hibernate.setSessionFactory(((AbstractHibernateRepository) repository).getSessionFactory());
final List<BuildNode> nodes = hibernate.loadAll(BuildNode.class);
Assert.assertEquals("Unexpected number of node entities", 1, nodes.size());
}
use of org.jenkins.plugins.audit2db.model.BuildDetails in project selenium_java by sergueik.
the class BuildDetailsHibernateRepositoryTests method retrievingBuildNodeByNonExistingUrlShouldReturnNull.
@Test
public void retrievingBuildNodeByNonExistingUrlShouldReturnNull() {
final BuildDetails build = TestUtils.createRandomBuildDetails();
final Object buildId = repository.saveBuildDetails(build);
Assert.assertNotNull("Unexpected null build id", buildId);
final BuildNode actual = repository.getBuildNodeByUrl("NON_EXISTING_URL");
Assert.assertNull("Unexppected non-null build node", actual);
}
use of org.jenkins.plugins.audit2db.model.BuildDetails in project selenium_java by sergueik.
the class BuildDetailsHibernateRepositoryTests method retrievalByNonMatchingNameShouldReturnEmptyList.
@Test
public void retrievalByNonMatchingNameShouldReturnEmptyList() {
final BuildDetails build = TestUtils.createRandomBuildDetails();
final Object buildId = repository.saveBuildDetails(build);
Assert.assertNotNull("Unexpected null build id", buildId);
final List<BuildDetails> builds = repository.getBuildDetailsByName(build.getName() + "NOMATCH");
Assert.assertNotNull("Unexpected null list of builds", builds);
Assert.assertTrue("Unexpected non-empty list of builds", builds.isEmpty());
}
use of org.jenkins.plugins.audit2db.model.BuildDetails in project selenium_java by sergueik.
the class BuildDetailsHibernateRepositoryTests method retrievalByNonMatchingFullNameShouldReturnEmptyList.
@Test
public void retrievalByNonMatchingFullNameShouldReturnEmptyList() {
final BuildDetails build = TestUtils.createRandomBuildDetails();
final Object buildId = repository.saveBuildDetails(build);
Assert.assertNotNull("Unexpected null build id", buildId);
final List<BuildDetails> builds = repository.getBuildDetailsByFullName(build.getFullName() + "NOMATCH");
Assert.assertNotNull("Unexpected null list of builds", builds);
Assert.assertTrue("Unexpected non-empty list of builds", builds.isEmpty());
}
Aggregations