Search in sources :

Example 1 with JobsByParamReportImpl

use of org.jenkins.plugins.audit2db.internal.reports.JobsByParamReportImpl 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)

Example 2 with JobsByParamReportImpl

use of org.jenkins.plugins.audit2db.internal.reports.JobsByParamReportImpl in project selenium_java by sergueik.

the class JobsByParamReportTests method matchingParametersShouldReturnNonEmptyResults.

@Test
public void matchingParametersShouldReturnNonEmptyResults() {
    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(), 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)

Example 3 with JobsByParamReportImpl

use of org.jenkins.plugins.audit2db.internal.reports.JobsByParamReportImpl in project selenium_java by sergueik.

the class JobsByParamReportTests method invalidParamNameShouldReturnEmptyResults.

@Test
public void invalidParamNameShouldReturnEmptyResults() {
    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() + " INVALID", param.getValue(), TestUtils.NOW, TestUtils.NOW);
    Assert.assertTrue("Unexpected results collection", 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)

Example 4 with JobsByParamReportImpl

use of org.jenkins.plugins.audit2db.internal.reports.JobsByParamReportImpl 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());
}
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)

Example 5 with JobsByParamReportImpl

use of org.jenkins.plugins.audit2db.internal.reports.JobsByParamReportImpl 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());
}
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

List (java.util.List)5 JobsByParamReportImpl (org.jenkins.plugins.audit2db.internal.reports.JobsByParamReportImpl)5 BuildDetails (org.jenkins.plugins.audit2db.model.BuildDetails)5 BuildParameter (org.jenkins.plugins.audit2db.model.BuildParameter)5 JobsByParamReport (org.jenkins.plugins.audit2db.reports.JobsByParamReport)5 Test (org.junit.Test)5