Skip to content

Commit d0becb4

Browse files
authored
Merge pull request #68 from ing-bank/release/2.3
Release v2.3
2 parents ed68555 + f90412b commit d0becb4

File tree

163 files changed

+4776
-1132
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

163 files changed

+4776
-1132
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ nb-configuration.xml
2525
.settings/
2626
.classpath
2727
.idea/
28+
.project
2829

2930
# System Files
3031
.DS_Store

Common/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>com.ing</groupId>
77
<artifactId>ingenious-playwright</artifactId>
8-
<version>2.2</version>
8+
<version>2.3</version>
99
</parent>
1010
<artifactId>Common</artifactId>
1111
<properties>

Common/src/main/java/com/ing/parent/createParentPOM.java

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,23 @@ public static void main(String[] args) {
3131
// Get target pom and source pom for properties
3232
String targetPath = args[0];
3333
String propertiesSourcePath = args[1];
34-
34+
3535
// Copy properties from main pom to target pom
3636
String sourcePomContent = Files.readString(Paths.get(propertiesSourcePath));
3737
String propertiesContent = getPropertiesContent(sourcePomContent);
3838
String destinationPomContent = Files.readString(Paths.get(targetPath));
3939
String updatedDestinationPomContent = updatePropertiesContent(destinationPomContent, propertiesContent);
4040
Files.write(Paths.get(targetPath), updatedDestinationPomContent.getBytes());
4141
System.out.println("Properties copied successfully!");
42+
43+
// Create a new document for the source/parent pom.xml file
44+
Document parentDocument = createSourceDocument(propertiesSourcePath);
4245

4346
// Create a new document for the target pom.xml file
4447
Document targetDocument = createTargetDocument(targetPath);
48+
49+
// Copy the version value from the source/parent pom.xml file to the target pom.xml
50+
copySourceVersionValue(parentDocument, targetDocument);
4551

4652
System.out.println("TargetPath = " + targetPath);
4753
// Remove content under dependencies,repositories and pluginRepositories tag from target document
@@ -94,7 +100,7 @@ private static Document createTargetDocument(String targetPath) throws ParserCon
94100
}
95101

96102
private static Document createSourceDocument(String sourcePath) throws ParserConfigurationException, SAXException, IOException {
97-
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
103+
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
98104
DocumentBuilder document = dbFactory.newDocumentBuilder();
99105
File sourcePomPath = new File(sourcePath);
100106
return document.parse(sourcePomPath);
@@ -177,6 +183,29 @@ private static void removeEngineArtifact(Document targetDocument) throws XPathEx
177183
parent.removeChild(dependencyNode);
178184
}
179185
}
186+
187+
private static Node getVersionNode(Document doc) throws XPathExpressionException {
188+
XPathFactory xpathFactory = XPathFactory.newInstance();
189+
XPath xpath = xpathFactory.newXPath();
190+
XPathExpression expr = xpath.compile("//project/version");
191+
NodeList nodeList = (NodeList) expr.evaluate(doc,
192+
XPathConstants.NODE);
193+
return nodeList.getLength() > 0 ? nodeList.item(0) : null;
194+
}
195+
196+
private static void copySourceVersionValue(Document source, Document target) throws XPathExpressionException {
197+
String version = getSourceVersionNumber(source);
198+
System.out.println("Setting version value to: " + version);
199+
Node node = getVersionNode(target);
200+
node.setNodeValue(version);
201+
}
202+
203+
private static String getSourceVersionNumber(Document parentDocument) throws XPathExpressionException {
204+
XPathFactory xpathFactory = XPathFactory.newInstance();
205+
XPath xpath = xpathFactory.newXPath();
206+
XPathExpression expr = xpath.compile("//project/version");
207+
return (String) expr.evaluate(parentDocument, XPathConstants.STRING);
208+
}
180209

181210
private static Node getNodes(Document doc, String tagName) {
182211
NodeList nodeList = doc.getElementsByTagName(tagName);

Datalib/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>com.ing</groupId>
66
<artifactId>ingenious-playwright</artifactId>
7-
<version>2.2</version>
7+
<version>2.3</version>
88
</parent>
99
<artifactId>ingenious-datalib</artifactId>
1010
<packaging>jar</packaging>

Datalib/src/main/java/com/ing/datalib/component/EnvTestData.java

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
21
package com.ing.datalib.component;
32

43
import com.ing.datalib.testdata.TestDataFactory;
54
import com.ing.datalib.testdata.model.AbstractDataModel;
65
import com.ing.datalib.testdata.model.TestDataModel;
6+
import java.io.BufferedWriter;
77
import java.io.File;
88
import java.io.FileInputStream;
99
import java.io.FileOutputStream;
1010
import java.io.IOException;
11+
import java.io.OutputStreamWriter;
1112
import java.util.ArrayList;
1213
import java.util.Collection;
1314
import java.util.LinkedHashMap;
@@ -20,7 +21,7 @@
2021

2122
/**
2223
*
23-
*
24+
*
2425
*/
2526
public class EnvTestData {
2627

@@ -201,11 +202,24 @@ public void save() {
201202
testData.save();
202203
}
203204
environmentProperties.put("Environment", getEnvironmentsAsString());
204-
try (FileOutputStream fout = new FileOutputStream(new File(getPropertiesLocation()));) {
205-
environmentProperties.store(fout, "List of Environments in comma seperated order");
205+
saveProperties(environmentProperties, getPropertiesLocation());
206+
}
207+
208+
private static void saveProperties(Properties prop, String filename) {
209+
File file = new File(filename);
210+
try (BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), "ISO_8859_1"))) {
211+
synchronized (prop) {
212+
for (Map.Entry<Object, Object> e : prop.entrySet()) {
213+
String key = (String) e.getKey();
214+
String val = (String) e.getValue();
215+
bw.write(key + "=" + val);
216+
bw.newLine();
217+
}
218+
}
206219
} catch (IOException ex) {
207220
Logger.getLogger(EnvTestData.class.getName()).log(Level.SEVERE, null, ex);
208221
}
222+
209223
}
210224

211225
private String getEnvironmentsAsString() {

Datalib/src/main/java/com/ing/datalib/component/TestStep.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,4 +340,8 @@ public Boolean isWebserviceStartStep() {
340340
public Boolean isWebserviceStopStep() {
341341
return (getObject().equals("Webservice") && getAction().contains("closeConnection"));
342342
}
343+
344+
public Boolean isStringOperationsStep() {
345+
return getObject().equals("String Operations");
346+
}
343347
}

Datalib/src/main/java/com/ing/datalib/settings/AbstractPropSettings.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
*/
12-
public class AbstractPropSettings extends LinkedProperties {
12+
public class AbstractPropSettings extends LinkedProperties {
1313

1414
private String location;
1515

0 commit comments

Comments
 (0)