From e4c50a4a218a4089efa3a271db17c84506294179 Mon Sep 17 00:00:00 2001 From: Borude Date: Mon, 30 Sep 2024 11:17:30 +0530 Subject: [PATCH] Fix for remove unused object --- .../testdesign/or/ObjectPopupMenu.java | 1 + .../components/testdesign/or/ObjectTree.java | 37 +- Resources/Engine/pom.xml | 512 ++++++++++-------- 3 files changed, 306 insertions(+), 244 deletions(-) diff --git a/IDE/src/main/java/com/ing/ide/main/mainui/components/testdesign/or/ObjectPopupMenu.java b/IDE/src/main/java/com/ing/ide/main/mainui/components/testdesign/or/ObjectPopupMenu.java index 0a9152f..661cfeb 100644 --- a/IDE/src/main/java/com/ing/ide/main/mainui/components/testdesign/or/ObjectPopupMenu.java +++ b/IDE/src/main/java/com/ing/ide/main/mainui/components/testdesign/or/ObjectPopupMenu.java @@ -152,6 +152,7 @@ private void forObject() { private void forRoot() { addPage.setEnabled(true); + removeUnusedObject.setEnabled(false); renamePage.setEnabled(false); deletePage.setEnabled(false); diff --git a/IDE/src/main/java/com/ing/ide/main/mainui/components/testdesign/or/ObjectTree.java b/IDE/src/main/java/com/ing/ide/main/mainui/components/testdesign/or/ObjectTree.java index e5640dc..f5e0f9d 100644 --- a/IDE/src/main/java/com/ing/ide/main/mainui/components/testdesign/or/ObjectTree.java +++ b/IDE/src/main/java/com/ing/ide/main/mainui/components/testdesign/or/ObjectTree.java @@ -59,7 +59,9 @@ import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; - +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; /** * * @@ -505,18 +507,20 @@ private void removeUnusedObject() { } - public Map usedObject() { + public Map usedObject() { Map> attributeMap = new HashMap<>(); - ArrayList records = new ArrayList(); + ArrayList records = new ArrayList<>(); try { String testPlanPath = getProject().getLocation() + "/TestPlan"; String[] scenarioList = getFolderOrFileList(testPlanPath); - for (int i = 0; i < scenarioList.length; i++) { - String[] csvList = getFolderOrFileList(testPlanPath + "/" + scenarioList[i]); - for (int j = 0; j < csvList.length; j++) { - String csvFilePath = testPlanPath + "/" + scenarioList[i] + "/" + csvList[j]; + for (String scenario : scenarioList) { + Path path = Paths.get(testPlanPath + "/" + scenario); + if(Files.isDirectory(path)) + { + String[] csvList = getFolderOrFileList(testPlanPath + "/" + scenario); + for (String csv : csvList) { + String csvFilePath = testPlanPath + "/" + scenario + "/" + csv; String[] values = null; - List objList = null; try (BufferedReader br = new BufferedReader(new FileReader(csvFilePath))) { String line; while ((line = br.readLine()) != null) { @@ -524,7 +528,7 @@ public Map usedObject() { if (!values[1].equals("Browser") && !values[1].equals("ObjectName") && (values.length == 7)) {//&& (values[1])!= "Browser" ) records.add(values[1]); if (!(attributeMap.containsKey(values[6]))) { - attributeMap.put(values[6], new ArrayList()); + attributeMap.put(values[6], new ArrayList<>()); attributeMap.get(values[6]).add(values[1]); } else { attributeMap.get(values[6]).add(values[1]); @@ -537,6 +541,7 @@ public Map usedObject() { } } } + } } catch (Exception e) { e.printStackTrace(); @@ -584,7 +589,17 @@ public Map UnusedObject(Map allSelectedObject, Map u } } } - + else{ + for(int s=0;s()); + unUsedObject.get(selectedPage.toString()).add((String) allSelectedObject.get(selectedPage).get(s)); + } else { + unUsedObject.get(selectedPage.toString()).add((String) allSelectedObject.get(selectedPage).get(s)); + } + } + } } return unUsedObject; @@ -606,7 +621,7 @@ public void deleteUnusedObject(String page, String object) { Transformer t = tf.newTransformer(); StreamResult result = new StreamResult(new File(orFilePath)); t.transform(new DOMSource(document), result); - result.getOutputStream().close(); +// result.getOutputStream().close(); } catch (Exception e) { e.printStackTrace(); diff --git a/Resources/Engine/pom.xml b/Resources/Engine/pom.xml index 75dacd9..ed8b60c 100644 --- a/Resources/Engine/pom.xml +++ b/Resources/Engine/pom.xml @@ -1,53 +1,55 @@ - - + 4.0.0 ingenious-playwright ingenious-engine 1.0 - UTF-8 - LATEST - 1.4 - 1.4.7 - 1.1.1 - 1.4.0 - 17.0.2 - 2.15.2 - 1.10.0 - 1.16.0 - 2.15.0 - 3.12.0 - 3.0.5 - 9.4.43.v20210629 - 5.0.0 - 3.0.0 - 5.2.5 - 4.1.2 - 4.5.14 - LATEST - LATEST - 7.7.1 - 2.3.32 - 1.0.1 - 3.0.2 - 2.4.0 - 2.0.0 - 2.0.0 - 2.17.2 - 3.33.0 - 2.18.0 - 2.10.1 - 2.8 - 2.0.7 - 2.6 - 4.4.16 - 32.0.1-jre - ../Dist/release - ../Resources - 11 - ${java.version} - ${java.version} - + UTF-8 + LATEST + 1.4 + 1.4.7 + 1.1.1 + 1.4.0 + 17.0.2 + 2.15.2 + 1.10.0 + 1.16.0 + 2.15.0 + 3.12.0 + 3.0.5 + 9.4.43.v20210629 + 5.0.0 + 3.0.0 + 5.2.5 + 4.1.2 + 4.5.14 + LATEST + LATEST + 7.7.1 + 2.3.32 + 1.0.1 + 3.0.2 + 2.4.0 + 2.0.0 + 2.0.0 + 2.17.2 + 3.33.0 + 2.18.0 + 2.10.1 + 2.8 + 2.0.7 + 2.6 + 4.4.16 + 32.0.1-jre + + ../Dist/release + ../Resources + + 11 + ${java.version} + ${java.version} + + @@ -148,156 +150,200 @@ - - com.fifesoft - rsyntaxtextarea - ${autocomplete.version} - - - org.apache.commons - commons-csv - ${commonscsv.version} - - - eu.infomas - annotation-detector - ${annon.detect} - - - - com.ing - ingenious-testdata-csv - ${project.version} - - - com.fasterxml.jackson.dataformat - jackson-dataformat-xml - ${jackson.version} - - - org.freemarker - freemarker - ${freemarker.version} - - - org.apache.poi - poi - ${apache.poi.version} - - - org.apache.poi - poi-ooxml - ${apache.poi.version} - - - org.apache.poi - poi-ooxml-schemas - ${apache.poi.schemas.version} - - - stax - stax-api - ${stax-api.version} - - - org.apache.xmlbeans - xmlbeans - ${xmlbeans.version} - - - xml-apis - xml-apis - - - - - com.microsoft.playwright - playwright - ${playwright.version} - - - com.deque.html.axe-core - playwright - ${playwright.axe.version} - - - javax.mail - mail - ${javamail.version} - - - org.testng - testng - ${testng.version} - test - - - com.jayway.jsonpath - json-path - ${json-path.version} - - - com.aventstack - extentreports - ${extentreport.version} - - - org.checkerframework - checker-compat-qual - ${checker-compat-qual.version} - - - info.debatty - java-string-similarity - ${java-string-similarity.version} - - - org.apache.logging.log4j - log4j-core - ${log4j.version} - - - org.apache.logging.log4j - log4j-api - ${log4j.version} - - - org.checkerframework - checker-qual - ${checker-qual.version} - - - com.google.errorprone - error_prone_annotations - ${error_prone_annotations.version} - - - com.google.code.gson - gson - ${gson.version} - - - com.google.j2objc - j2objc-annotations - ${j2objc-annotations.version} - - - org.slf4j - slf4j-api - ${slf4j-api.version} - - - commons-lang - commons-lang - ${commons-lang.version} - jar - - - org.apache.httpcomponents - httpcore - ${httpcore.version} - jar - + + + + + com.fifesoft + rsyntaxtextarea + ${autocomplete.version} + + + + + org.apache.commons + commons-csv + ${commonscsv.version} + + + + + eu.infomas + annotation-detector + ${annon.detect} + + + + + + + + com.ing + ingenious-testdata-csv + ${project.version} + + + + + com.fasterxml.jackson.dataformat + jackson-dataformat-xml + ${jackson.version} + + + + + org.freemarker + freemarker + ${freemarker.version} + + + + org.apache.poi + poi + ${apache.poi.version} + + + + org.apache.poi + poi-ooxml + ${apache.poi.version} + + + + org.apache.poi + poi-ooxml-schemas + ${apache.poi.schemas.version} + + + + + stax + stax-api + ${stax-api.version} + + + + + org.apache.xmlbeans + xmlbeans + ${xmlbeans.version} + + + xml-apis + xml-apis + + + + + + com.microsoft.playwright + playwright + ${playwright.version} + + + + com.deque.html.axe-core + playwright + ${playwright.axe.version} + + + + + javax.mail + mail + ${javamail.version} + + + + org.testng + testng + ${testng.version} + test + + + + com.jayway.jsonpath + json-path + ${json-path.version} + + + + com.aventstack + extentreports + ${extentreport.version} + + + + org.checkerframework + checker-compat-qual + ${checker-compat-qual.version} + + + + info.debatty + java-string-similarity + ${java-string-similarity.version} + + + + org.apache.logging.log4j + log4j-core + ${log4j.version} + + + + org.apache.logging.log4j + log4j-api + ${log4j.version} + + + + org.checkerframework + checker-qual + ${checker-qual.version} + + + + com.google.errorprone + error_prone_annotations + ${error_prone_annotations.version} + + + + com.google.code.gson + gson + ${gson.version} + + + + com.google.j2objc + j2objc-annotations + ${j2objc-annotations.version} + + + + org.slf4j + slf4j-api + ${slf4j-api.version} + + + + + commons-lang + commons-lang + ${commons-lang.version} + jar + + + org.apache.httpcomponents + httpcore + ${httpcore.version} + jar + + + + + com.ing ingenious-datalib @@ -360,43 +406,6 @@ ${javafx.version} win - - - org.openjfx - javafx-web - ${javafx.version} - mac-aarch64 - - - org.openjfx - javafx-media - ${javafx.version} - mac-aarch64 - - - org.openjfx - javafx-swing - ${javafx.version} - mac-aarch64 - - - org.openjfx - javafx-graphics - ${javafx.version} - mac-aarch64 - - - org.openjfx - javafx-controls - ${javafx.version} - mac-aarch64 - - - org.openjfx - javafx-base - ${javafx.version} - mac-aarch64 - org.openjfx @@ -487,7 +496,44 @@ ${jetty.version} jar - + + + org.openjfx + javafx-web + ${javafx.version} + mac-aarch64 + + + org.openjfx + javafx-media + ${javafx.version} + mac-aarch64 + + + org.openjfx + javafx-swing + ${javafx.version} + mac-aarch64 + + + org.openjfx + javafx-graphics + ${javafx.version} + mac-aarch64 + + + org.openjfx + javafx-controls + ${javafx.version} + mac-aarch64 + + + org.openjfx + javafx-base + ${javafx.version} + mac-aarch64 + +