Search in sources :

Example 16 with BuildDetails

use of org.jenkins.plugins.audit2db.model.BuildDetails in project selenium_java by sergueik.

the class BuildDetailsImplTests method differentIdShouldBreakEquality.

@Test
public void differentIdShouldBreakEquality() {
    final BuildDetails expected = getBuildDetails();
    final BuildDetails actual = getBuildDetails();
    Assert.assertEquals("Broken equality", expected, actual);
    actual.setId(actual.getId() + "CHANGED");
    Assert.assertFalse("Broken inequality logic", actual.equals(expected));
}
Also used : BuildDetails(org.jenkins.plugins.audit2db.model.BuildDetails) Test(org.junit.Test)

Example 17 with BuildDetails

use of org.jenkins.plugins.audit2db.model.BuildDetails in project selenium_java by sergueik.

the class JobHistoryReportTests method invalidProjectNameShouldReturnEmptyResults.

@Test
public void invalidProjectNameShouldReturnEmptyResults() {
    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.substring(0) + " INVALID", TestUtils.NOW, TestUtils.NOW);
    Assert.assertTrue("Unexpected results collection", results.isEmpty());
}
Also used : JobHistoryReportImpl(org.jenkins.plugins.audit2db.internal.reports.JobHistoryReportImpl) BuildDetails(org.jenkins.plugins.audit2db.model.BuildDetails) JobHistoryReport(org.jenkins.plugins.audit2db.reports.JobHistoryReport) List(java.util.List) Test(org.junit.Test)

Example 18 with BuildDetails

use of org.jenkins.plugins.audit2db.model.BuildDetails in project selenium_java by sergueik.

the class JobHistoryReportTests method projectNameWithWildcardShouldReturnNonEmptyResults.

@Test
public void projectNameWithWildcardShouldReturnNonEmptyResults() {
    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.substring(0) + "%", TestUtils.NOW, TestUtils.NOW);
    Assert.assertFalse("Unexpected empty results", results.isEmpty());
}
Also used : JobHistoryReportImpl(org.jenkins.plugins.audit2db.internal.reports.JobHistoryReportImpl) BuildDetails(org.jenkins.plugins.audit2db.model.BuildDetails) JobHistoryReport(org.jenkins.plugins.audit2db.reports.JobHistoryReport) List(java.util.List) Test(org.junit.Test)

Example 19 with BuildDetails

use of org.jenkins.plugins.audit2db.model.BuildDetails in project selenium_java by sergueik.

the class JobsByDateReportTests method invalidDateRangeShouldReturnEmptyResults.

@Test
public void invalidDateRangeShouldReturnEmptyResults() {
    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);
    }
    Map<String, List<BuildDetails>> results = report.getProjectExecutions(TestUtils.YESTERDAY, TestUtils.YESTERDAY);
    Assert.assertTrue("Unexpected results collection", results.isEmpty());
    results = report.getProjectExecutions(TestUtils.TOMORROW, TestUtils.TOMORROW);
    Assert.assertTrue("Unexpected results collection", results.isEmpty());
}
Also used : BuildDetails(org.jenkins.plugins.audit2db.model.BuildDetails) List(java.util.List) JobsByDateReport(org.jenkins.plugins.audit2db.reports.JobsByDateReport) JobsByDateReportImpl(org.jenkins.plugins.audit2db.internal.reports.JobsByDateReportImpl) Test(org.junit.Test)

Example 20 with BuildDetails

use of org.jenkins.plugins.audit2db.model.BuildDetails in project selenium_java by sergueik.

the class JobsByParamReportTests method paramValueWithWildcardShouldReturnNonEmptyResults.

@Test
public void paramValueWithWildcardShouldReturnNonEmptyResults() {
    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().substring(0) + "%", TestUtils.NOW, TestUtils.NOW);
    Assert.assertFalse("Unexpected empty results", results.isEmpty());
}
Also used : BuildParameter(org.jenkins.plugins.audit2db.model.BuildParameter) BuildDetails(org.jenkins.plugins.audit2db.model.BuildDetails) JobsByParamReportImpl(org.jenkins.plugins.audit2db.internal.reports.JobsByParamReportImpl) List(java.util.List) JobsByParamReport(org.jenkins.plugins.audit2db.reports.JobsByParamReport) 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