Skip to content

Commit

Permalink
enhacement : Jenkins Plugin Upgrade to 2.440.1 (#32)
Browse files Browse the repository at this point in the history
* Configuration Changes related to java 11

* version change

* Jenkins Plugin Upgrade

* Re Run Test cases

* Reverted extra space
  • Loading branch information
Munishh992 authored Apr 15, 2024
1 parent b5a65f0 commit e0d8cdb
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 183 deletions.
72 changes: 10 additions & 62 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,20 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.24</version>
<version>4.80</version>
<relativePath />
</parent>
<groupId>io.jenkins.plugins</groupId>
<artifactId>leapwork</artifactId>
<version>${revision}${changelist}</version>
<packaging>hpi</packaging>
<properties>
<revision>4.0.10</revision>
<revision>4.0.11</revision>
<changelist>-SNAPSHOT</changelist>
<gitHubRepo>jenkinsci/leapwork-plugin</gitHubRepo>
<changelist>-SNAPSHOT</changelist>
<!-- Baseline Jenkins version you use to build the plugin. Users must have
this version or newer to run. -->
<jenkins.version>2.277.1</jenkins.version>
<java.level>8</java.level>
<jenkins.version>2.440.1</jenkins.version>
<gitHubRepo>jenkinsci/leapwork-plugin</gitHubRepo>
</properties>
<name>Leapwork</name>
Expand All @@ -30,65 +28,22 @@
<dependency>
<!-- Pick up common dependencies for the selected LTS line: https://github.com/jenkinsci/bom#usage -->
<groupId>io.jenkins.tools.bom</groupId>
<artifactId>bom-2.277.x</artifactId>
<version>923.v08bdc07cd40f</version>
<artifactId>bom-2.440.x</artifactId>
<version>2815.vf5d6f093b_23e</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<dependency>
<groupId>io.jenkins.plugins</groupId>
<artifactId>jakarta-activation-api</artifactId>
<version>2.0.0-2</version>
</dependency>

</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>structs</artifactId>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-cps</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-job</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-basic-steps</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.ning</groupId>
<artifactId>async-http-client</artifactId>
<version>1.9.40</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.32</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-nop</artifactId>
<version>1.7.32</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.0</version>
</dependency>

<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>anything-goes-formatter</artifactId>
<version>1.0</version>
<groupId>io.jenkins.plugins</groupId>
<artifactId>gson-api</artifactId>
</dependency>
<dependency>
<groupId>jakarta.xml.bind</groupId>
Expand All @@ -101,17 +56,10 @@
<version>3.0.0</version>
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>annotations</artifactId>
<version>3.0.1u2</version>
</dependency>


<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-durable-task-step</artifactId>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-nop</artifactId>
<version>1.7.32</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
@XmlRootElement(name = "testsuites")
@XmlAccessorType(XmlAccessType.NONE)
public final class RunCollection {

public int totalTests = 0;
private int totalTests = 0;

Check warning on line 15 in src/main/java/com/Leapwork/Leapwork_plugin/model/RunCollection.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 15 is not covered by tests

private int passedTests = 0;

Expand Down
194 changes: 75 additions & 119 deletions src/main/webapp/buttonscript.js
Original file line number Diff line number Diff line change
@@ -1,43 +1,45 @@


function GetSch() {
var closestElement = $(event.target).closest('.repeated-chunk');
if (closestElement != null) { var closestEle = closestElement.firstElementChild }
else { closestEle = document }
var closestElement = (jQuery)(event.target).closest('.repeated-chunk');
var closestEle;
if (closestElement != null) {
closestEle = closestElement[0].firstElementChild;
} else {
closestEle = document;
}

const leapworkHostname = closestEle.getElementsBySelector("#leapworkHostname").first().value;
const leapworkPort = closestEle.getElementsBySelector("#leapworkPort").first().value;
const leapworkHostname = (jQuery)(closestEle).find("#leapworkHostname").first().val();
const leapworkPort = (jQuery)(closestEle).find("#leapworkPort").first().val();

if (!leapworkHostname || !leapworkPort) {
alert('"hostname or/and field is empty! Cannot connect to controller!"');
}
else {
} else {
let myAddress = "";
if(closestEle.getElementsBySelector("#chkEnableHttps").first().checked){myAddress = "https://" + leapworkHostname + ":" + leapworkPort;}
else{myAddress = "http://" + leapworkHostname + ":" + leapworkPort;}
if ((jQuery)(closestEle).find("#chkEnableHttps").first().prop('checked')) {
myAddress = "https://" + leapworkHostname + ":" + leapworkPort;
} else {
myAddress = "http://" + leapworkHostname + ":" + leapworkPort;
}
const address = myAddress;
const accessKey = closestEle.getElementsBySelector("#leapworkAccessKey").first().value;

if (closestEle.getElementsBySelector('#LeapworkContainer').first().innerHTML == "") {
const accessKey = (jQuery)(closestEle).find("#leapworkAccessKey").first().val();

if ((jQuery)(closestEle).find('#LeapworkContainer').first().html() == "") {
(jQuery).ajax({
url: address + "/api/v4/schedules/hierarchy",
headers: { 'AccessKey': accessKey },
type: 'GET',
dataType: "json",
success: function (json) {
const container = closestEle.getElementsBySelector('#LeapworkContainer').first();

const container = (jQuery)(closestEle).find('#LeapworkContainer').first();

(jQuery)(document).click(function (event) {
if ((jQuery)(event.target).closest('#LeapworkContainer').length == 0 && (jQuery)(event.target).attr('id') != 'mainButton') {
(jQuery)("#LeapworkContainer input:checkbox").remove();
(jQuery)("#LeapworkContainer li").remove();
(jQuery)("#LeapworkContainer ul").remove();
(jQuery)("#LeapworkContainer br").remove();
(jQuery)("#LeapworkContainer div").remove();
(jQuery)("#LeapworkContainer input").remove();
container.style.display = 'none';
container.find("input:checkbox").remove();
container.find("li").remove();
container.find("ul").remove();
container.find("br").remove();
container.find("div").remove();
container.find("input").remove();
container.css('display', 'none');
}
});

Expand All @@ -46,130 +48,86 @@ function GetSch() {
createFolders(scheduleHierarchies, scheduleInfo, container);

function createFolders(ScheduleHeirarchies, scheduleInfo, root) {

for (const ScheduleHierarchy of ScheduleHeirarchies) {

const title = ScheduleHierarchy["Title"]
if (
ScheduleHierarchy["Type"] == "Folder" &&
ScheduleHierarchy.Parent.length == 0
) {
if (ScheduleHierarchy["Type"] == "Folder" && ScheduleHierarchy.Parent.length == 0) {
if (!document.getElementById(`${ScheduleHierarchy.Id}`))
root.innerHTML += `<div id="${ScheduleHierarchy.Id}" class="Folder" style="color: red;">${title}</div>`;
} else if (
ScheduleHierarchy["Type"] == "Folder" &&
ScheduleHierarchy.Parent.length
) {
root.append(`<div id="${ScheduleHierarchy.Id}" class="Folder" style="color: red;">${title}</div>`);
} else if (ScheduleHierarchy["Type"] == "Folder" && ScheduleHierarchy.Parent.length) {
if (!document.getElementById(`${ScheduleHierarchy.Parent[0].Id}`))
createFolders(ScheduleHierarchy.Parent, scheduleInfo, root);

let myParent = document.getElementById(
`${ScheduleHierarchy.Parent[0].Id}`
);
let myParent = document.getElementById(`${ScheduleHierarchy.Parent[0].Id}`);
myParent.innerHTML += `<div id="${ScheduleHierarchy.Id}" class="Folder" style="color: darkblue; padding-left:20px;">${title}</div>`;
}

else if (ScheduleHierarchy["Type"] == "RunList" &&
ScheduleHierarchy.Parent.length == 0) {
} else if (ScheduleHierarchy["Type"] == "RunList" && ScheduleHierarchy.Parent.length == 0) {
if (!document.getElementById(`${ScheduleHierarchy.Id}`))
root.innerHTML += `<div id="${ScheduleHierarchy.Id}" class="RunList" style="color: black; padding-left:20px;">${title}</div>`;
}

else if (ScheduleHierarchy["Type"] == "RunList") {
root.append(`<div id="${ScheduleHierarchy.Id}" class="RunList" style="color: black; padding-left:20px;">${title}</div>`);
} else if (ScheduleHierarchy["Type"] == "RunList") {
if (!document.getElementById(`${ScheduleHierarchy.Parent[0].Id}`))
createFolders(ScheduleHierarchy.Parent, scheduleInfo, root);

let myParent = document.getElementById(
`${ScheduleHierarchy.Parent[0].Id}`
);
let myParent = document.getElementById(`${ScheduleHierarchy.Parent[0].Id}`);
myParent.innerHTML += `<div id="${ScheduleHierarchy.Id}" class="RunList" style="color: black; padding-left:20px;">${title}</div>`;
} else if (ScheduleHierarchy["Type"] == "ScheduleInfo") {
var scheduleId = ScheduleHierarchy.Id;
if (!document.getElementById(`${ScheduleHierarchy.Parent[0].Id}`))
createFolders(
ScheduleHierarchy.Parent,
scheduleInfo,
container
);

let myParent = document.getElementById(
`${ScheduleHierarchy.Parent[0].Id}`
);

createFolders(ScheduleHierarchy.Parent, scheduleInfo, container);
let myParent = document.getElementById(`${ScheduleHierarchy.Parent[0].Id}`);
for (schedule of scheduleInfo) {

if (schedule.Id == scheduleId) {
if (schedule.IsEnabled) {
myParent.innerHTML += `<div style="color: green; padding-left:30px;">
<input type = "checkBox" id="${ScheduleHierarchy.Id}" class="ScheduleInfo" name="${title}">${title}</div>`;
}
else {
<input type="checkBox" id="${ScheduleHierarchy.Id}" class="ScheduleInfo" name="${title}">${title}</div>`;
} else {
var element = `<div style="color:grey; padding-left:30px;">
<input type = "checkBox" disabled = "true" id="${ScheduleHierarchy.Id}" class="ScheduleInfoDisabled" name="${title}"><s>${title}</s></div>`;
<input type="checkBox" disabled="true" id="${ScheduleHierarchy.Id}" class="ScheduleInfoDisabled" name="${title}"><s>${title}</s></div>`;
myParent.innerHTML += element
}

}
}

}
}
}


container.innerHTML += '<br>';


container.innerHTML += '<br>';

container.style.display = 'block';

(jQuery)(".ul-dropfree").find("li:has(ul)").prepend('<div class="drop"></div>');
(jQuery)(".ul-dropfree div.drop").click(function () {
if ((jQuery)(this).nextAll("ul").css('display') == 'none') {
(jQuery)(this).nextAll("ul").slideDown(400);
(jQuery)(this).css({ 'background-position': "-11px 0" });
container.append('<br>');
container.append('<br>');
container.css('display', 'block');
container.find(".ul-dropfree").find("li:has(ul)").prepend('<div class="drop"></div>');
container.find(".ul-dropfree div.drop").click(function () {
if ($(this).nextAll("ul").css('display') == 'none') {
$(this).nextAll("ul").slideDown(400);
$(this).css({ 'background-position': "-11px 0" });
} else {
(jQuery)(this).nextAll("ul").slideUp(400);
(jQuery)(this).css({ 'background-position': "0 0" });
$(this).nextAll("ul").slideUp(400);
$(this).css({ 'background-position': "0 0" });
}
});
(jQuery)(".ul-dropfree").find("ul").slideUp(400).parents("li").children("div.drop").css({ 'background-position': "0 0" });

let TestNames = closestEle.getElementsBySelector("#schNames").first();
let TestIds = closestEle.getElementsBySelector("#schIds").first();

let boxes = closestEle.getElementsBySelector("#LeapworkContainer input:checkbox");
let existingTests = new Array();
existingTests = TestIds.value.split(/\r\n|\n|\s+,\s+|,\s+|\s+,|,/);
container.find(".ul-dropfree").find("ul").slideUp(400).parents("li").children("div.drop").css({ 'background-position': "0 0" });

if (TestNames.value != null && TestIds.value != null) {
let TestNames = (jQuery)(closestEle).find("#schNames").first();
let TestIds = (jQuery)(closestEle).find("#schIds").first();
let boxes = (jQuery)(closestEle).find("#LeapworkContainer input:checkbox");
let existingTests = TestIds.val().split(/\r\n|\n|\s+,\s+|,\s+|\s+,|,/);
if (TestNames.val() !== null && TestIds.val() !== null) {
for (let i = 0; i < existingTests.length; i++) {
for (j = 0; j < boxes.length; j++) {

if (existingTests[i] == boxes[j].getAttributeNode('id').value) {
if (boxes[j].disabled == false)
if (existingTests[i] == (jQuery)(boxes[j]).attr('id')) {
if (!boxes[j].disabled)
(jQuery)(boxes[j]).prop('checked', 'checked');

}
}
}

}

(jQuery)(closestEle.getElementsBySelector("#LeapworkContainer input:checkbox")).on("change", function () {
let NamesArray = new Array();
let IdsArray = new Array();
for (let i = 0; i < boxes.length; i++) {
let box = boxes[i];
if ((jQuery)(box).prop('checked')) {
NamesArray[NamesArray.length] = (jQuery)(box).attr('name');
IdsArray[IdsArray.length] = (jQuery)(box).attr('id');
(jQuery)(closestEle).find("#LeapworkContainer input:checkbox").on("change", function () {
let NamesArray = [];
let IdsArray = [];
(jQuery)(boxes).each(function () {
if ((jQuery)(this).prop('checked')) {
NamesArray.push((jQuery)(this).attr('name'));
IdsArray.push((jQuery)(this).attr('id'));
}
}
TestNames.value = NamesArray.join("\n");
TestIds.value = IdsArray.join("\n");
console.log(TestIds.value)
});
TestNames.val(NamesArray.join("\n"));
TestIds.val(IdsArray.join("\n"));
console.log(TestIds.val());
});

},
Expand All @@ -189,16 +147,14 @@ function GetSch() {
);
}
});
}
else {
(jQuery)("#LeapworkContainer input:checkbox").remove();
(jQuery)("#LeapworkContainer li").remove();
(jQuery)("#LeapworkContainer ul").remove();
(jQuery)("#LeapworkContainer br").remove();
(jQuery)("#LeapworkContainer div").remove();
(jQuery)("#LeapworkContainer input").remove();
} else {
container.find("input:checkbox").remove();
container.find("li").remove();
container.find("ul").remove();
container.find("br").remove();
container.find("div").remove();
container.find("input").remove();
GetSch();
}

}
}
}

0 comments on commit e0d8cdb

Please sign in to comment.