-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from iamakshayshar/feature/version-5.1
Feature/version 5.1
- Loading branch information
Showing
3 changed files
with
75 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<tns:soapui-listeners xmlns:tns="http://eviware.com/soapui/config"> | ||
<!--This will initialize TestStep level reporting--> | ||
<tns:listener id="TestStepListener" listenerClass="com.soapuiextentter.listener.ExtenterTestRunListener" | ||
listenerInterface="com.eviware.soapui.model.testsuite.TestRunListener" /> | ||
<!--This will initialize TestCase level reporting--> | ||
<tns:listener id="TestCaseListener" listenerClass="com.soapuiextentter.listener.ExtenterTestSuiteRunListener" | ||
listenerInterface="com.eviware.soapui.model.testsuite.TestSuiteRunListener" /> | ||
<!--This will initialize TestSuite level reporting--> | ||
<tns:listener id="TestSuiteListener" listenerClass="com.soapuiextentter.listener.ExtenterProjectRunListener" | ||
listenerInterface="com.eviware.soapui.model.testsuite.ProjectRunListener" /> | ||
<!--This will initialize TestStep level reporting--> | ||
<tns:listener id="TestStepListener" | ||
listenerClass="com.soapuiextentter.listener.ExtenterTestRunListener" | ||
listenerInterface="com.eviware.soapui.model.testsuite.TestRunListener" /> | ||
<!--This will initialize TestCase level reporting--> | ||
<tns:listener id="TestCaseListener" | ||
listenerClass="com.soapuiextentter.listener.ExtenterTestSuiteRunListener" | ||
listenerInterface="com.eviware.soapui.model.testsuite.TestSuiteRunListener" /> | ||
<!--This will initialize TestSuite level reporting--> | ||
<tns:listener id="TestSuiteListener" | ||
listenerClass="com.soapuiextentter.listener.ExtenterProjectRunListener" | ||
listenerInterface="com.eviware.soapui.model.testsuite.ProjectRunListener" /> | ||
</tns:soapui-listeners> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package com.soapuiextentter.utilities; | ||
|
||
import javax.xml.parsers.DocumentBuilderFactory; | ||
|
||
import org.json.JSONObject; | ||
import org.w3c.dom.bootstrap.DOMImplementationRegistry; | ||
import org.w3c.dom.ls.DOMImplementationLS; | ||
import org.w3c.dom.ls.LSSerializer; | ||
import org.xml.sax.InputSource; | ||
|
||
public class StringUtils { | ||
|
||
public static String prettyPrintXML(String xmlString) { | ||
String preetyXML = xmlString; | ||
try { | ||
InputSource src = new InputSource(new String(xmlString)); | ||
org.w3c.dom.Node document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(src) | ||
.getDocumentElement(); | ||
Boolean keepDeclaration = Boolean.valueOf(xmlString.startsWith("<?xml")); | ||
DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance(); | ||
DOMImplementationLS impl = (DOMImplementationLS) registry.getDOMImplementation("LS"); | ||
LSSerializer writer = impl.createLSSerializer(); | ||
writer.getDomConfig().setParameter("format-pretty-print", Boolean.TRUE); | ||
writer.getDomConfig().setParameter("xml-declaration", keepDeclaration); | ||
preetyXML = writer.writeToString(document); | ||
} catch (Exception e) { | ||
return preetyXML; | ||
} | ||
return preetyXML; | ||
} | ||
|
||
public static String prettyPrintJson(String jsonString) { | ||
String preetyJson = jsonString; | ||
try { | ||
preetyJson = (new JSONObject(jsonString)).toString(4); | ||
} catch (Exception e) { | ||
return preetyJson; | ||
} | ||
return preetyJson; | ||
} | ||
} |