forked from hpsa/hpe-application-automation-tools-plugin
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Advanced trending option and Support automatically finding and creati…
…ng Test Instance (#198) * index on master: ab83a3d Merge remote-tracking branch 'remotes/origin/5.0.1-beta-SNAPSHOT' * Revert pom changes * Merge branch '5.0.1-beta-SNAPSHOT' of https://github.com/hpsa/hp-application-automation-tools-plugin into development # Conflicts: # .github/PULL_REQUEST_TEMPLATE.md * Added some comments * changes according to sonarlint * changes for sonarlint * Remove some comments * Comments * * Fix for supporting SECURITY-170 changes * https://jenkins.io/blog/2016/05/11/security-update/ * https://issues.jenkins-ci.org/browse/JENKINS-39654 * code changes for sonarlint * Changes in PC configuration section header * Adding support for Jenkins using proxy: https://issues.jenkins-ci.org/browse/JENKINS-44314 Changing the HTTPS checkbox position * Adding link under Test ID text box for browsing to the PC Server * Added support for creating TESTINSTANCEID before running a test. Still needs to add: 1. TestSetID is a stub, we need to check if there is one and to create if not exists 2. Need to check if a test instance id is already exists * Adding support for createTestInstance if test instance is not available. * SonarLint Changes * Support auto trending options https://issues.jenkins-ci.org/browse/JENKINS-44723 * Added Unit Testing for new Tests Rest API * Minor change in UI * Small change regarding the flow of the Auto Trending feature
- Loading branch information
Showing
16 changed files
with
534 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/main/java/com/hp/application/automation/tools/pc/PcTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.hp.application.automation.tools.pc; | ||
|
||
/** | ||
* Created by bemh on 6/5/2017. | ||
* Partial implementation of the test xml structure | ||
*/ | ||
public class PcTest { | ||
|
||
|
||
private int testId; | ||
private String testName; | ||
|
||
private int trendReportId = -1; | ||
|
||
|
||
|
||
public int getTestId() { | ||
return testId; | ||
} | ||
|
||
public String getTestName() { | ||
return testName; | ||
} | ||
|
||
public void setTrendReportId(int trendReportId) { | ||
this.trendReportId = trendReportId; | ||
} | ||
|
||
public int getTrendReportId() { | ||
return trendReportId; | ||
} | ||
|
||
public void setTestId(int testId){this.testId = testId;} | ||
|
||
public void setTestName(String testName){this.testName = testName;} | ||
} |
71 changes: 71 additions & 0 deletions
71
src/main/java/com/hp/application/automation/tools/pc/PcTestData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package com.hp.application.automation.tools.pc; | ||
|
||
import com.thoughtworks.xstream.XStream; | ||
import org.w3c.dom.Document; | ||
import org.w3c.dom.Element; | ||
import org.w3c.dom.Node; | ||
import org.w3c.dom.NodeList; | ||
import org.xml.sax.InputSource; | ||
import org.xml.sax.SAXException; | ||
|
||
import javax.xml.parsers.DocumentBuilder; | ||
import javax.xml.parsers.DocumentBuilderFactory; | ||
import javax.xml.parsers.ParserConfigurationException; | ||
import java.io.ByteArrayInputStream; | ||
import java.io.IOException; | ||
import java.io.StringReader; | ||
|
||
/** | ||
* Created by bemh on 6/5/2017. | ||
* Partial implementation of the test xml structure | ||
*/ | ||
public class PcTestData { | ||
|
||
|
||
|
||
|
||
static Document dom; | ||
static DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); | ||
|
||
|
||
public static PcTest xmlToObject(String xml){ | ||
|
||
PcTest pcTest = new PcTest(); | ||
|
||
try { | ||
DocumentBuilder db = dbf.newDocumentBuilder(); | ||
dom = db.parse(new InputSource(new StringReader(xml))); | ||
Element doc = dom.getDocumentElement(); | ||
NodeList nListTestNodes = doc.getElementsByTagName("AutomaticTrending"); | ||
if (nListTestNodes.getLength() >0 ) | ||
{ | ||
NodeList nListChild = nListTestNodes.item(0).getChildNodes(); | ||
for (int j=0;j < nListChild.getLength();j++) { | ||
if (nListChild.item(j).getNodeName().equals("ReportId")){ | ||
pcTest.setTrendReportId(Integer.parseInt(nListChild.item(j).getTextContent())); | ||
break; | ||
} | ||
} | ||
} | ||
|
||
nListTestNodes = doc.getElementsByTagName("ID"); | ||
pcTest.setTestId(Integer.parseInt(nListTestNodes.item(0).getFirstChild().getNodeValue())); | ||
|
||
nListTestNodes = doc.getElementsByTagName("Name"); | ||
pcTest.setTestName(nListTestNodes.item(0).getFirstChild().getNodeValue()); | ||
|
||
|
||
|
||
|
||
}catch (ParserConfigurationException pce) { | ||
System.out.println(pce.getMessage()); | ||
} catch (SAXException se) { | ||
System.out.println(se.getMessage()); | ||
} catch (IOException ioe) { | ||
System.err.println(ioe.getMessage()); | ||
} | ||
|
||
return pcTest; | ||
} | ||
|
||
} |
Oops, something went wrong.