Search in sources :

Example 41 with BuildDetails

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));
}
Also used : BuildDetails(org.jenkins.plugins.audit2db.model.BuildDetails) Test(org.junit.Test)

Example 42 with BuildDetails

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());
}
Also used : BuildDetails(org.jenkins.plugins.audit2db.model.BuildDetails) HibernateTemplate(org.springframework.orm.hibernate3.HibernateTemplate) BuildNode(org.jenkins.plugins.audit2db.model.BuildNode) Test(org.junit.Test)

Example 43 with BuildDetails

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);
}
Also used : BuildDetails(org.jenkins.plugins.audit2db.model.BuildDetails) BuildNode(org.jenkins.plugins.audit2db.model.BuildNode) Test(org.junit.Test)

Example 44 with BuildDetails

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());
}
Also used : BuildDetails(org.jenkins.plugins.audit2db.model.BuildDetails) Test(org.junit.Test)

Example 45 with BuildDetails

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());
}
Also used : BuildDetails(org.jenkins.plugins.audit2db.model.BuildDetails) Test(org.junit.Test)

Aggregations

BuildDetails (org.jenkins.plugins.audit2db.model.BuildDetails)62 Test (org.junit.Test)50 List (java.util.List)25 Calendar (java.util.Calendar)11 BuildParameter (org.jenkins.plugins.audit2db.model.BuildParameter)11 Date (java.util.Date)9 ArrayList (java.util.ArrayList)8 TransactionStatus (org.springframework.transaction.TransactionStatus)8 BuildDetailsHibernateRepository (org.jenkins.plugins.audit2db.internal.data.BuildDetailsHibernateRepository)5 BuildDetailsImpl (org.jenkins.plugins.audit2db.internal.model.BuildDetailsImpl)5 JobsByParamReportImpl (org.jenkins.plugins.audit2db.internal.reports.JobsByParamReportImpl)5 JobHistoryReport (org.jenkins.plugins.audit2db.reports.JobHistoryReport)5 JobsByParamReport (org.jenkins.plugins.audit2db.reports.JobsByParamReport)5 HtmlPage (com.gargoylesoftware.htmlunit.html.HtmlPage)4 BuildNode (org.jenkins.plugins.audit2db.model.BuildNode)4 JobsByDateReport (org.jenkins.plugins.audit2db.reports.JobsByDateReport)4 HashMap (java.util.HashMap)3 Jenkins (jenkins.model.Jenkins)3 DetachedCriteria (org.hibernate.criterion.DetachedCriteria)3 BuildDetailsRepository (org.jenkins.plugins.audit2db.data.BuildDetailsRepository)3