Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
Signed-off-by: automike <[email protected]>
  • Loading branch information
mikeliucc committed Mar 6, 2019
1 parent 2c7da28 commit 979727d
Show file tree
Hide file tree
Showing 24 changed files with 9 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@ internal class Replace : Modification("replace", true) {
}

override fun handleModification(target: Element, content: String?) {
target.setContent(Text(content))
val index = target.parent.content.indexOf(target)
target.parent.addContent(index, Text(content))
target.parent.removeContent(target)
}

override fun handleModification(target: Attribute, content: String?) {
Expand Down
16 changes: 5 additions & 11 deletions src/test/java/org/nexial/core/plugins/xml/XmlCommandTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -983,15 +983,15 @@ public void replace_text() throws Exception {
" <COUNTRY>USA</COUNTRY>\n" +
" <COMPANY>Columbia</COMPANY>\n" +
" <PRICE>10.90</PRICE>\n" +
" <YEAR>UNKNOWN</YEAR>\n" +
" UNKNOWN\n" +
" </CD>\n" +
" <CD>\n" +
" <TITLE>Eros</TITLE>\n" +
" <ARTIST>Eros Ramazzotti</ARTIST>\n" +
" <COUNTRY>EU</COUNTRY>\n" +
" <COMPANY>BMG</COMPANY>\n" +
" <PRICE>9.90</PRICE>\n" +
" <YEAR>UNKNOWN</YEAR>\n" +
" UNKNOWN\n" +
" </CD>\n" +
"</CATALOG>", newXml);
}
Expand Down Expand Up @@ -1095,12 +1095,8 @@ public void replace_multiple() throws Exception {
newXml = context.getStringData("newXml");
System.out.println("newXml = " + newXml);
Assert.assertEquals("<CATALOG>\n" +
" <CD>\n" +
" <MESSAGE>Not available at this time</MESSAGE>\n" +
" </CD>\n" +
" <CD>\n" +
" <MESSAGE>Not available at this time</MESSAGE>\n" +
" </CD>\n" +
" <CD>Not available at this time</CD>\n" +
" <CD>Not available at this time</CD>\n" +
"</CATALOG>", newXml);

result = fixture.replace(newXml, "//CATALOG/CD[position()=1]", "<CD id=\"123\">Not available</CD>", "newXml");
Expand All @@ -1111,9 +1107,7 @@ public void replace_multiple() throws Exception {
System.out.println("newXml = " + newXml);
Assert.assertEquals("<CATALOG>\n" +
" <CD id=\"123\">Not available</CD>\n" +
" <CD>\n" +
" <MESSAGE>Not available at this time</MESSAGE>\n" +
" </CD>\n" +
" <CD>Not available at this time</CD>\n" +
"</CATALOG>", newXml);
}

Expand Down
Binary file modified src/test/resources/showcase/artifact/data/sqs-showcase.data.xlsx
Binary file not shown.
Binary file not shown.
Binary file modified src/test/resources/showcase/artifact/script/base-showcase.xlsx
Binary file not shown.
Binary file not shown.
Binary file modified src/test/resources/showcase/artifact/script/disable-showcase.xlsx
Binary file not shown.
Binary file modified src/test/resources/showcase/artifact/script/electron-showcase.xlsx
Binary file not shown.
Binary file not shown.
Binary file modified src/test/resources/showcase/artifact/script/failafter-showcase.xlsx
Binary file not shown.
Binary file modified src/test/resources/showcase/artifact/script/image-showcase.xlsx
Binary file not shown.
Binary file modified src/test/resources/showcase/artifact/script/io-showcase.xlsx
Binary file not shown.
Binary file modified src/test/resources/showcase/artifact/script/jmeter-showcase.xlsx
Binary file not shown.
Binary file modified src/test/resources/showcase/artifact/script/json-showcase.xlsx
Binary file not shown.
Binary file modified src/test/resources/showcase/artifact/script/mail-showcase.xlsx
Binary file not shown.
Binary file modified src/test/resources/showcase/artifact/script/number-showcase.xlsx
Binary file not shown.
Binary file modified src/test/resources/showcase/artifact/script/redis-showcase.xlsx
Binary file not shown.
Binary file modified src/test/resources/showcase/artifact/script/sqs-showcase.xlsx
Binary file not shown.
Binary file modified src/test/resources/showcase/artifact/script/step-showcase.xlsx
Binary file not shown.
Binary file not shown.
Binary file modified src/test/resources/showcase/artifact/script/web-showcase.xlsx
Binary file not shown.
Binary file modified src/test/resources/showcase/artifact/script/ws.async-showcase.xlsx
Binary file not shown.
Binary file modified src/test/resources/showcase/artifact/script/xml-showcase.xlsx
Binary file not shown.
1 change: 1 addition & 0 deletions src/test/resources/unittesting/.meta/project.id
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
unittesting

0 comments on commit 979727d

Please sign in to comment.