use of org.jenkins.plugins.audit2db.DbAuditPublisher in project selenium_java by sergueik.
the class WhenSchedulingJob method testParameterisedJobShouldSaveAllParameters.
@Test
public void testParameterisedJobShouldSaveAllParameters() throws Exception {
final FreeStyleProject project = createFreeStyleProject("ParameterisedJob");
// set parameters
final ParameterDefinition param1 = new StringParameterDefinition("myStringParam", "myStringValue", "My String Parameter");
final ParameterDefinition param2 = new BooleanParameterDefinition("myBooleanParam", false, "My Boolean Parameter");
project.addProperty(new ParametersDefinitionProperty(param1, param2));
// enable audit2db plugin
final DbAuditPublisher plugin = getPlugin();
project.getPublishersList().add((Publisher) plugin);
// build now
final Future<FreeStyleBuild> futureBuild = project.scheduleBuild2(0);
final FreeStyleBuild build = futureBuild.get();
Assert.assertNotNull(build);
Assert.assertEquals("Unexpected build result", Result.SUCCESS, build.getResult());
// check data persistence
final BuildDetailsRepository repository = plugin.getRepository();
final BuildDetails actual = repository.getBuildDetailsForBuild(build);
final BuildDetails expected = new BuildDetailsImpl(build);
Assert.assertEquals("Unexpected build details", expected, actual);
Assert.assertNotNull("Unexpected null end date", actual.getEndDate());
Assert.assertTrue("Unexpected duration", actual.getDuration() > 0L);
Assert.assertEquals("Unexpected number of params", 2, actual.getParameters().size());
}
use of org.jenkins.plugins.audit2db.DbAuditPublisher in project selenium_java by sergueik.
the class WhenTestingDataSource method testInvalidJdbcDriverShouldFail.
@Test
public void testInvalidJdbcDriverShouldFail() throws Exception {
final DbAuditPublisher publisher = new DbAuditPublisherImpl();
final DbAuditPublisherDescriptor descriptor = (DbAuditPublisherDescriptor) publisher.getDescriptor();
final FormValidation testResult = descriptor.doTestJdbcConnection("WrongDriver", jdbcUrl, jdbcUser, jdbcPassword);
Assert.assertEquals("Unexpected successful connection.", FormValidation.Kind.ERROR, testResult.kind);
}
use of org.jenkins.plugins.audit2db.DbAuditPublisher in project selenium_java by sergueik.
the class WhenSchedulingJob method getPlugin.
private DbAuditPublisher getPlugin() {
final DbAuditPublisher publisher = new DbAuditPublisherImpl();
final DbAuditPublisherDescriptor descriptor = (DbAuditPublisherDescriptor) publisher.getDescriptor();
descriptor.setJdbcDriver(jdbcDriver);
descriptor.setJdbcUrl(jdbcUrl);
descriptor.setJdbcUser(jdbcUser);
descriptor.setJdbcPassword(jdbcPassword);
return publisher;
}
use of org.jenkins.plugins.audit2db.DbAuditPublisher in project selenium_java by sergueik.
the class WhenSchedulingJob method testPlainJobShouldSaveNoParameters.
@Test
public void testPlainJobShouldSaveNoParameters() throws Exception {
final FreeStyleProject project = createFreeStyleProject("PlainJob");
// enable audit2db plugin
final DbAuditPublisher plugin = getPlugin();
project.getPublishersList().add((Publisher) plugin);
// build now
final Future<FreeStyleBuild> futureBuild = project.scheduleBuild2(0);
final FreeStyleBuild build = futureBuild.get();
Assert.assertNotNull(build);
Assert.assertEquals("Unexpected build result", Result.SUCCESS, build.getResult());
// check data persistence
final BuildDetailsRepository repository = plugin.getRepository();
final BuildDetails actual = repository.getBuildDetailsForBuild(build);
final BuildDetails expected = new BuildDetailsImpl(build);
Assert.assertEquals("Unexpected build details", expected, actual);
Assert.assertNotNull("Unexpected null end date", actual.getEndDate());
Assert.assertTrue("Unexpected duration", actual.getDuration() > 0L);
Assert.assertEquals("Unexpected number of params", 0, actual.getParameters().size());
}
use of org.jenkins.plugins.audit2db.DbAuditPublisher in project selenium_java by sergueik.
the class WhenTestingDataSource method testGeneratingDdlWithValidJdbcDetailsShouldSucceed.
@Test
public void testGeneratingDdlWithValidJdbcDetailsShouldSucceed() throws Exception {
final DbAuditPublisher publisher = new DbAuditPublisherImpl();
final DbAuditPublisherDescriptor descriptor = (DbAuditPublisherDescriptor) publisher.getDescriptor();
final FormValidation testResult = descriptor.doGenerateDdl(jdbcDriver, jdbcUrl, jdbcUser, jdbcPassword);
Assert.assertEquals("Unexpected connection error.", FormValidation.Kind.OK, testResult.kind);
}
Aggregations