use of org.jenkins.plugins.audit2db.internal.model.BuildNodeImpl in project selenium_java by sergueik.
the class BuildNodeImplTests method differentAttributesWithSameUrlShouldPreserveEquality.
@Test
public void differentAttributesWithSameUrlShouldPreserveEquality() {
final BuildNode actual = new BuildNodeImpl(expected.getMasterAddress() + "DIFFERENT", expected.getMasterHostName() + "DIFFERENT", expected.getDisplayName() + "DIFFERENT", expected.getUrl(), expected.getName() + "DIFFERENT", expected.getDescription() + "DIFFERENT", expected.getLabel() + "DIFFERENT");
Assert.assertEquals("Broken equality", expected, actual);
}
use of org.jenkins.plugins.audit2db.internal.model.BuildNodeImpl in project selenium_java by sergueik.
the class BuildNodeImplTests method differentUrlShouldBreakEquality.
@Test
public void differentUrlShouldBreakEquality() {
final BuildNode actual = new BuildNodeImpl(expected.getMasterAddress(), expected.getMasterHostName(), expected.getDisplayName(), expected.getUrl() + "DIFFERENT", expected.getName(), expected.getDescription(), expected.getLabel());
Assert.assertFalse("Broken inequality logic", actual.equals(expected));
}
use of org.jenkins.plugins.audit2db.internal.model.BuildNodeImpl in project selenium_java by sergueik.
the class TestUtils method createRandomBuildDetails.
public static BuildDetails createRandomBuildDetails(final boolean withParams) {
final long salt = System.nanoTime();
final BuildDetails build = new BuildDetailsImpl();
build.setDuration(Long.valueOf(60 + (long) (Math.random() * 60)));
build.setEndDate(new Date(build.getStartDate().getTime() + (build.getDuration() * 1000)));
build.setFullName("BUILD FULL NAME " + salt);
build.setId("BUILD ID " + salt);
build.setName("BUILD NAME " + salt);
build.setUserId("BUILD USER ID " + salt);
build.setUserName("BUILD USER NAME " + salt);
if (withParams) {
final List<BuildParameter> params = new ArrayList<BuildParameter>();
params.add(new BuildParameterImpl("PARAM_ID 1 " + salt, "PARAM NAME 1 " + salt, "PARAM VALUE 1 " + salt, build));
params.add(new BuildParameterImpl("PARAM_ID 2 " + salt, "PARAM NAME 2 " + salt, "PARAM VALUE 2 " + salt, build));
build.setParameters(params);
}
final BuildNode node = new BuildNodeImpl("NODE ADDRESS", "NODE HOSTNAME", "NODE DISPLAYNAME", "NODE URL", "NODE NAME", "NODE DESCRIPTION", "NODE LABEL");
build.setNode(node);
return build;
}
use of org.jenkins.plugins.audit2db.internal.model.BuildNodeImpl in project selenium_java by sergueik.
the class BuildDetailsResolver method addBuildNodeFromContext.
private static void addBuildNodeFromContext(BuildDetailsImpl details, Run<?, ?> run, Computer computer) throws IOException, InterruptedException {
LOGGER.finer("resolving build node");
Jenkins jenkins = Jenkins.getInstance();
LOGGER.finer("jenkins: " + jenkins);
LOGGER.finer("computer: " + computer);
Node node = computer.getNode();
LOGGER.finer("node: " + node);
String rootUrl = jenkins != null ? jenkins.getRootUrl() : "http://unconfigured-jenkins-server/";
LOGGER.finer("rootUrl: " + rootUrl);
URL url = new URL(rootUrl);
String masterHostname = url.getHost();
String urlString = String.format("%s/%s", rootUrl, computer.getUrl()).replaceAll("(\\w)(\\/{2,})(\\w)", "$1/$3");
BuildNode buildNode = new BuildNodeImpl(resolveMasterIpAddress(computer), masterHostname, computer.getDisplayName(), // url
urlString, node.getNodeName(), node.getNodeDescription(), node.getLabelString());
LOGGER.finer("buildNode: " + buildNode);
details.setNode(buildNode);
}
Aggregations