From c4967585ce82bd1ec66f15898218dbe18edfc4a7 Mon Sep 17 00:00:00 2001 From: Appini Akhil Date: Mon, 23 Dec 2024 15:45:52 +0530 Subject: [PATCH 01/14] feat/CR-1799-Support data from uploads in ftp-file-upload addon --- ftp_file_upload 2/pom.xml | 2 +- .../testsigma/addons/web/FTPUploadFile.java | 58 +++++++++++++------ 2 files changed, 41 insertions(+), 19 deletions(-) diff --git a/ftp_file_upload 2/pom.xml b/ftp_file_upload 2/pom.xml index 169e9586..f1104a9e 100644 --- a/ftp_file_upload 2/pom.xml +++ b/ftp_file_upload 2/pom.xml @@ -6,7 +6,7 @@ 4.0.0 com.testsigma.addons ftp_file_upload - 1.0.0 + 1.0.1 jar diff --git a/ftp_file_upload 2/src/main/java/com/testsigma/addons/web/FTPUploadFile.java b/ftp_file_upload 2/src/main/java/com/testsigma/addons/web/FTPUploadFile.java index 9b37b31f..4b1d686f 100644 --- a/ftp_file_upload 2/src/main/java/com/testsigma/addons/web/FTPUploadFile.java +++ b/ftp_file_upload 2/src/main/java/com/testsigma/addons/web/FTPUploadFile.java @@ -11,14 +11,13 @@ import org.apache.commons.net.ftp.FTPClient; import org.openqa.selenium.NoSuchElementException; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; +import java.io.*; +import java.net.URL; +import java.nio.file.Paths; @Data -@Action(actionText = "FTP: Connect to FTP server and upload a file. FTP server details: Host: Host-Name, Port: Port-No UserName: User-Name, Password: User-Password, Upload from Local-File-Path to Remote-Directory(ex: /Users/username/Downloads) with file name Remote-File-Name. Uploaded file path will be stored in runtime variable: variable-name", - description = "Uploads a file from local system to remote server using FTP, and stores the uploaded file path in a runtime variable.", +@Action(actionText = "FTP: Connect to FTP server and upload a file. FTP server details: Host: Host-Name, Port: Port-No, UserName: User-Name, Password: User-Password, Upload from Local-File-Path to Remote-Directory(ex: /Users/username/Downloads) with file name Remote-File-Name. Uploaded file path will be stored in runtime variable: variable-name", + description = "Uploads a file from a local file or URL to a remote server using FTP, and stores the uploaded file path in a runtime variable.", applicationType = ApplicationType.WEB, useCustomScreenshot = false) public class FTPUploadFile extends WindowsAction { @@ -36,7 +35,7 @@ public class FTPUploadFile extends WindowsAction { private com.testsigma.sdk.TestData userPassword; @TestData(reference = "Local-File-Path") - private com.testsigma.sdk.TestData localFilePath; // Local file to upload + private com.testsigma.sdk.TestData localFilePath; // Local file path or URL @TestData(reference = "Remote-Directory") private com.testsigma.sdk.TestData remoteDirectory; // Remote directory to upload to @@ -63,21 +62,29 @@ public com.testsigma.sdk.Result execute() throws NoSuchElementException { String remoteFile = remoteFileName.getValue().toString(); FTPClient ftpClient = new FTPClient(); + File localFileToUpload = null; try { + // Determine if the localFile is a URL or a local path + if (localFile.startsWith("http://") || localFile.startsWith("https://")) { + localFileToUpload = downloadFile(localFile); + } else { + localFileToUpload = new File(localFile); + } + + // Verify the local file exists - File firstLocalFile = new File(localFile); - if (!firstLocalFile.exists()) { + if (!localFileToUpload.exists()) { setErrorMessage("Local file not found: " + localFile); return Result.FAILED; } // Append extension if remote file name has no extension if (!remoteFile.contains(".")) { - String localFileName = firstLocalFile.getName(); + String localFileName = localFileToUpload.getName(); int dotIndex = localFileName.lastIndexOf('.'); - if (dotIndex > 0) { // Local file has an extension - String extension = localFileName.substring(dotIndex); // Extract the extension - remoteFile += extension; // Append the extension to remote file name + if (dotIndex > 0) { + String extension = localFileName.substring(dotIndex); + remoteFile += extension; logger.info("Remote file name updated to include extension: " + remoteFile); } else { setErrorMessage("Local file does not have an extension: " + localFileName); @@ -85,7 +92,6 @@ public com.testsigma.sdk.Result execute() throws NoSuchElementException { } } - // Connect and login to the server ftpClient.connect(host, Integer.parseInt(port)); boolean loginSuccess = ftpClient.login(user, password); @@ -97,7 +103,6 @@ public com.testsigma.sdk.Result execute() throws NoSuchElementException { ftpClient.enterLocalPassiveMode(); ftpClient.setFileType(FTP.BINARY_FILE_TYPE); - // Set the target directory on the FTP server boolean changedDir = ftpClient.changeWorkingDirectory(remoteDir); if (changedDir) { logger.info("Changed to directory: " + remoteDir); @@ -106,8 +111,7 @@ public com.testsigma.sdk.Result execute() throws NoSuchElementException { return Result.FAILED; } - // Upload the file - try (InputStream inputStream = new FileInputStream(firstLocalFile)) { + try (InputStream inputStream = new FileInputStream(localFileToUpload)) { logger.info("Start uploading file to " + remoteDir + "/" + remoteFile); boolean done = ftpClient.storeFile(remoteFile, inputStream); @@ -137,6 +141,24 @@ public com.testsigma.sdk.Result execute() throws NoSuchElementException { } catch (IOException ex) { logger.warn("Error while closing FTP connection: " + ex); } + if (localFileToUpload != null && localFile.startsWith("http")) { + localFileToUpload.delete(); // delete temp file if it was a download + } + } + } + + private File downloadFile(String fileUrl) throws IOException { + URL url = new URL(fileUrl); + String fileName = Paths.get(url.getPath()).getFileName().toString(); + File tempFile = File.createTempFile("downloaded-", fileName); + try (InputStream in = url.openStream(); + OutputStream out = new FileOutputStream(tempFile)) { + byte[] buffer = new byte[1024]; + int bytesRead; + while ((bytesRead = in.read(buffer)) != -1) { + out.write(buffer, 0, bytesRead); + } } + return tempFile; } -} +} \ No newline at end of file From 867086585e0bf6d21c7606ca59b0c7c1f3706994 Mon Sep 17 00:00:00 2001 From: Appini Akhil Date: Mon, 23 Dec 2024 17:27:31 +0530 Subject: [PATCH 02/14] added file// type --- .../src/main/java/com/testsigma/addons/web/FTPUploadFile.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ftp_file_upload 2/src/main/java/com/testsigma/addons/web/FTPUploadFile.java b/ftp_file_upload 2/src/main/java/com/testsigma/addons/web/FTPUploadFile.java index 4b1d686f..a3919aa5 100644 --- a/ftp_file_upload 2/src/main/java/com/testsigma/addons/web/FTPUploadFile.java +++ b/ftp_file_upload 2/src/main/java/com/testsigma/addons/web/FTPUploadFile.java @@ -65,7 +65,7 @@ public com.testsigma.sdk.Result execute() throws NoSuchElementException { File localFileToUpload = null; try { // Determine if the localFile is a URL or a local path - if (localFile.startsWith("http://") || localFile.startsWith("https://")) { + if (localFile.startsWith("http://") || localFile.startsWith("https://") || localFile.startsWith("file://")) { localFileToUpload = downloadFile(localFile); } else { localFileToUpload = new File(localFile); From 655e81fe083a6173a380efe1e69dc203b836ccd0 Mon Sep 17 00:00:00 2001 From: Appini Akhil Date: Mon, 23 Dec 2024 18:21:35 +0530 Subject: [PATCH 03/14] added nlp to store the query result --- mysql_queries/dependency-reduced-pom.xml | 68 ++++++++++ mysql_queries/pom.xml | 99 ++++++++++++++ .../addons/android/Mysqlqueries.java | 61 +++++++++ .../addons/android/MysqlqueriesValidate.java | 77 +++++++++++ .../testsigma/addons/android/Mysqlselect.java | 60 +++++++++ .../addons/android/Mysqlselectandstore.java | 79 +++++++++++ .../addons/android/Mysqlselectvalidate.java | 70 ++++++++++ .../testsigma/addons/ios/Mysqlqueries.java | 61 +++++++++ .../addons/ios/MysqlqueriesValidate.java | 77 +++++++++++ .../com/testsigma/addons/ios/Mysqlselect.java | 60 +++++++++ .../addons/ios/Mysqlselectandstore.java | 79 +++++++++++ .../addons/ios/Mysqlselectvalidate.java | 70 ++++++++++ .../addons/mobileweb/Mysqlqueries.java | 61 +++++++++ .../mobileweb/MysqlqueriesValidate.java | 77 +++++++++++ .../addons/mobileweb/Mysqlselect.java | 60 +++++++++ .../addons/mobileweb/Mysqlselectandstore.java | 79 +++++++++++ .../addons/mobileweb/Mysqlselectvalidate.java | 70 ++++++++++ .../addons/mysql/util/DatabaseUtil.java | 15 +++ .../addons/web/MysqlCallProcedure.java | 72 ++++++++++ .../addons/web/MysqlCreateProcedure.java | 53 ++++++++ .../web/MysqlValidateQueriesonDatabases.java | 123 +++++++++++++++++ .../web/MysqlValidateQueriesonTables.java | 126 ++++++++++++++++++ .../testsigma/addons/web/Mysqlqueries.java | 71 ++++++++++ .../addons/web/MysqlqueriesValidate.java | 77 +++++++++++ .../testsigma/addons/web/Mysqlscriptfile.java | 60 +++++++++ .../com/testsigma/addons/web/Mysqlselect.java | 60 +++++++++ .../addons/web/Mysqlselectandstore.java | 80 +++++++++++ .../addons/web/Mysqlselectvalidate.java | 70 ++++++++++ .../addons/web/Mysqlupdatequeries.java | 55 ++++++++ .../com/testsigma/addons/web/Mysqlutil.java | 5 + .../main/resources/testsigma-sdk.properties | 1 + 31 files changed, 2076 insertions(+) create mode 100644 mysql_queries/dependency-reduced-pom.xml create mode 100644 mysql_queries/pom.xml create mode 100644 mysql_queries/src/main/java/com/testsigma/addons/android/Mysqlqueries.java create mode 100644 mysql_queries/src/main/java/com/testsigma/addons/android/MysqlqueriesValidate.java create mode 100644 mysql_queries/src/main/java/com/testsigma/addons/android/Mysqlselect.java create mode 100644 mysql_queries/src/main/java/com/testsigma/addons/android/Mysqlselectandstore.java create mode 100644 mysql_queries/src/main/java/com/testsigma/addons/android/Mysqlselectvalidate.java create mode 100644 mysql_queries/src/main/java/com/testsigma/addons/ios/Mysqlqueries.java create mode 100644 mysql_queries/src/main/java/com/testsigma/addons/ios/MysqlqueriesValidate.java create mode 100644 mysql_queries/src/main/java/com/testsigma/addons/ios/Mysqlselect.java create mode 100644 mysql_queries/src/main/java/com/testsigma/addons/ios/Mysqlselectandstore.java create mode 100644 mysql_queries/src/main/java/com/testsigma/addons/ios/Mysqlselectvalidate.java create mode 100644 mysql_queries/src/main/java/com/testsigma/addons/mobileweb/Mysqlqueries.java create mode 100644 mysql_queries/src/main/java/com/testsigma/addons/mobileweb/MysqlqueriesValidate.java create mode 100644 mysql_queries/src/main/java/com/testsigma/addons/mobileweb/Mysqlselect.java create mode 100644 mysql_queries/src/main/java/com/testsigma/addons/mobileweb/Mysqlselectandstore.java create mode 100644 mysql_queries/src/main/java/com/testsigma/addons/mobileweb/Mysqlselectvalidate.java create mode 100644 mysql_queries/src/main/java/com/testsigma/addons/mysql/util/DatabaseUtil.java create mode 100644 mysql_queries/src/main/java/com/testsigma/addons/web/MysqlCallProcedure.java create mode 100644 mysql_queries/src/main/java/com/testsigma/addons/web/MysqlCreateProcedure.java create mode 100644 mysql_queries/src/main/java/com/testsigma/addons/web/MysqlValidateQueriesonDatabases.java create mode 100644 mysql_queries/src/main/java/com/testsigma/addons/web/MysqlValidateQueriesonTables.java create mode 100644 mysql_queries/src/main/java/com/testsigma/addons/web/Mysqlqueries.java create mode 100644 mysql_queries/src/main/java/com/testsigma/addons/web/MysqlqueriesValidate.java create mode 100644 mysql_queries/src/main/java/com/testsigma/addons/web/Mysqlscriptfile.java create mode 100644 mysql_queries/src/main/java/com/testsigma/addons/web/Mysqlselect.java create mode 100644 mysql_queries/src/main/java/com/testsigma/addons/web/Mysqlselectandstore.java create mode 100644 mysql_queries/src/main/java/com/testsigma/addons/web/Mysqlselectvalidate.java create mode 100644 mysql_queries/src/main/java/com/testsigma/addons/web/Mysqlupdatequeries.java create mode 100644 mysql_queries/src/main/java/com/testsigma/addons/web/Mysqlutil.java create mode 100644 mysql_queries/src/main/resources/testsigma-sdk.properties diff --git a/mysql_queries/dependency-reduced-pom.xml b/mysql_queries/dependency-reduced-pom.xml new file mode 100644 index 00000000..7c5eef6c --- /dev/null +++ b/mysql_queries/dependency-reduced-pom.xml @@ -0,0 +1,68 @@ + + + 4.0.0 + com.testsigma.addons + mysql_queries + 1.0.7 + + mysql_queries + + + maven-shade-plugin + 3.2.4 + + + package + + shade + + + + + + maven-source-plugin + ${maven.source.plugin.version} + + + attach-sources + + jar + + + + + + + + + org.junit.jupiter + junit-jupiter-api + 5.8.0-M1 + test + + + apiguardian-api + org.apiguardian + + + opentest4j + org.opentest4j + + + junit-platform-commons + org.junit.platform + + + + + + 1.2.5_cloud + 1.18.20 + 3.2.1 + 11 + 11 + UTF-8 + 5.8.0-M1 + 1.0.0 + + diff --git a/mysql_queries/pom.xml b/mysql_queries/pom.xml new file mode 100644 index 00000000..11213c7a --- /dev/null +++ b/mysql_queries/pom.xml @@ -0,0 +1,99 @@ + + + 4.0.0 + com.testsigma.addons + mysql_queries + 1.0.7 + jar + + + UTF-8 + 11 + 11 + 1.2.5_cloud + 5.8.0-M1 + 1.0.0 + 3.2.1 + 1.18.20 + + + + + + com.testsigma + testsigma-java-sdk + ${testsigma.sdk.version} + + + org.projectlombok + lombok + ${lombok.version} + true + + + org.junit.jupiter + junit-jupiter-api + ${junit.jupiter.version} + test + + + org.testng + testng + 6.14.3 + + + + org.seleniumhq.selenium + selenium-java + 3.141.59 + + + + io.appium + java-client + 7.0.0 + + + + + org.mybatis + mybatis + 3.5.11 + + + + + mysql_queries + + + org.apache.maven.plugins + maven-shade-plugin + 3.2.4 + + + package + + shade + + + + + + org.apache.maven.plugins + maven-source-plugin + ${maven.source.plugin.version} + + + attach-sources + + jar + + + + + + + \ No newline at end of file diff --git a/mysql_queries/src/main/java/com/testsigma/addons/android/Mysqlqueries.java b/mysql_queries/src/main/java/com/testsigma/addons/android/Mysqlqueries.java new file mode 100644 index 00000000..d3620695 --- /dev/null +++ b/mysql_queries/src/main/java/com/testsigma/addons/android/Mysqlqueries.java @@ -0,0 +1,61 @@ +package com.testsigma.addons.android; + +import com.testsigma.sdk.Result; +import com.testsigma.sdk.WebAction; +import com.testsigma.addons.mysql.util.DatabaseUtil; +import com.testsigma.sdk.ApplicationType; +import com.testsigma.sdk.annotation.Action; +import com.testsigma.sdk.annotation.TestData; +import lombok.Data; + +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.Statement; + +import org.apache.commons.lang3.exception.ExceptionUtils; +import org.openqa.selenium.NoSuchElementException; + +@Data +@Action(actionText = "Execute MySQL Query on the Connection DB_Connection_URL", +description = "This action executes given query against the connection provided and prints the no. of affected/fetched rows.", +applicationType = ApplicationType.ANDROID) +public class Mysqlqueries extends WebAction { + + @TestData(reference = "Query") + private com.testsigma.sdk.TestData testData1; + @TestData(reference = "DB_Connection_URL") + private com.testsigma.sdk.TestData testData2; + + @Override + public com.testsigma.sdk.Result execute() throws NoSuchElementException { + Result result = Result.SUCCESS; + logger.info("Initiating execution"); + DatabaseUtil databaseUtil = new DatabaseUtil(); + int rowsUpdatedOrFetched = 0; + try{ + Connection connection = databaseUtil.getConnection(testData2.getValue().toString()); + Statement stmt = connection.createStatement(); + String query = testData1.getValue().toString(); + if(query.trim().toUpperCase().startsWith("SELECT")) { + ResultSet resultSet = stmt.executeQuery(query); + while (resultSet.next()){ + resultSet.getObject(1).toString(); + rowsUpdatedOrFetched ++; + } + setSuccessMessage("Successfully Executed Database Query, No. of Rows fetched from DB : " +rowsUpdatedOrFetched); + logger.info("Successfully Executed Database Query, No. of Rows fetched from DB : " +rowsUpdatedOrFetched); + }else { + rowsUpdatedOrFetched = stmt.executeUpdate(query); + setSuccessMessage("Successfully Executed Database Query, No. of rows affected in DB : " +rowsUpdatedOrFetched); + logger.info("Successfully Executed Database Query, No. of Rows fetched from DB : " +rowsUpdatedOrFetched); + } + } + catch (Exception e){ + String errorMessage = ExceptionUtils.getStackTrace(e); + result = com.testsigma.sdk.Result.FAILED; + setErrorMessage(errorMessage); + logger.warn(errorMessage); + } + return result; + } +} \ No newline at end of file diff --git a/mysql_queries/src/main/java/com/testsigma/addons/android/MysqlqueriesValidate.java b/mysql_queries/src/main/java/com/testsigma/addons/android/MysqlqueriesValidate.java new file mode 100644 index 00000000..bd76c5bc --- /dev/null +++ b/mysql_queries/src/main/java/com/testsigma/addons/android/MysqlqueriesValidate.java @@ -0,0 +1,77 @@ +package com.testsigma.addons.android; + +import com.testsigma.sdk.Result; +import com.testsigma.sdk.WebAction; +import com.testsigma.addons.mysql.util.DatabaseUtil; +import com.testsigma.sdk.ApplicationType; +import com.testsigma.sdk.annotation.Action; +import com.testsigma.sdk.annotation.TestData; +import lombok.Data; + +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.Statement; + +import org.apache.commons.lang3.exception.ExceptionUtils; +import org.openqa.selenium.NoSuchElementException; + +@Data +@Action(actionText = "Execute MySQL Query on the Connection DB_Connection_URL and verify affected rows count is Row-Count", +description = "This Action executes given SQL query and validates the affected rows.", +applicationType = ApplicationType.ANDROID) +public class MysqlqueriesValidate extends WebAction { + + @TestData(reference = "Query") + private com.testsigma.sdk.TestData testData1; + @TestData(reference = "DB_Connection_URL") + private com.testsigma.sdk.TestData testData2; + @TestData(reference = "Row-Count") + private com.testsigma.sdk.TestData testData3; + StringBuffer sb = new StringBuffer(); + + @Override + public com.testsigma.sdk.Result execute() throws NoSuchElementException { + Result result = Result.SUCCESS; + logger.info("Initiating execution"); + DatabaseUtil databaseUtil = new DatabaseUtil(); + int rowsUpdatedOrFetched = 0; + try{ + Connection connection = databaseUtil.getConnection(testData2.getValue().toString()); + Statement stmt = connection.createStatement(); + String query = testData1.getValue().toString(); + if(query.trim().toUpperCase().startsWith("SELECT")) { + ResultSet resultSet = stmt.executeQuery(query); + while (resultSet.next()){ + resultSet.getObject(1).toString(); + rowsUpdatedOrFetched ++; + } + sb.append("Successfully Executed Database Query and Rows fetched from DB : " +rowsUpdatedOrFetched + "
"); + }else { + rowsUpdatedOrFetched = stmt.executeUpdate(query); + sb.append("Successfully Executed Database Query, No. of rows affected in DB : " +rowsUpdatedOrFetched + "
"); + + } + if(rowsUpdatedOrFetched == Integer.parseInt(testData3.getValue().toString())) { + sb.append("Affected row count is matching with expected value." + "
"); + setSuccessMessage(sb.toString()); + logger.info(sb.toString()); + } + else { + result = com.testsigma.sdk.Result.FAILED; + sb.append("The affected rows does not match with expected rows:" + "
"); + sb.append("Expected no. of affected rows:"+testData3.getValue().toString() + "
"); + sb.append("Actual affected rows from query execution:"+rowsUpdatedOrFetched + "
"); + setErrorMessage(sb.toString()); + logger.warn(sb.toString()); + } + } + catch (Exception e){ + String errorMessage = ExceptionUtils.getStackTrace(e); + sb.append("
"+errorMessage); + result = com.testsigma.sdk.Result.FAILED; + setErrorMessage(sb.toString()); + logger.warn(sb.toString()); + } + return result; + } +} \ No newline at end of file diff --git a/mysql_queries/src/main/java/com/testsigma/addons/android/Mysqlselect.java b/mysql_queries/src/main/java/com/testsigma/addons/android/Mysqlselect.java new file mode 100644 index 00000000..851e3e8b --- /dev/null +++ b/mysql_queries/src/main/java/com/testsigma/addons/android/Mysqlselect.java @@ -0,0 +1,60 @@ +package com.testsigma.addons.android; + +import com.testsigma.sdk.Result; +import com.testsigma.sdk.WebAction; +import com.testsigma.addons.mysql.util.DatabaseUtil; +import com.testsigma.sdk.ApplicationType; +import com.testsigma.sdk.annotation.Action; +import com.testsigma.sdk.annotation.RunTimeData; +import com.testsigma.sdk.annotation.TestData; +import lombok.Data; + +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.Statement; + +import org.apache.commons.lang3.exception.ExceptionUtils; +import org.openqa.selenium.NoSuchElementException; + +@Data +@Action(actionText = "Execute MySQL Select-Query on the connection DB_Connection_URL and store output into a variable-name", +description = "This Action executes a given Select Query and stores the result(First cell data) into a provided runtime variable.", +applicationType = ApplicationType.ANDROID) +public class Mysqlselect extends WebAction { + + @TestData(reference = "Select-Query") + private com.testsigma.sdk.TestData testData1; + @TestData(reference = "DB_Connection_URL") + private com.testsigma.sdk.TestData testData2; + @TestData(reference = "variable-name" , isRuntimeVariable = true) + private com.testsigma.sdk.TestData testData3; + @RunTimeData + private com.testsigma.sdk.RunTimeData runTimeData; + + @Override + public com.testsigma.sdk.Result execute() throws NoSuchElementException { + Result result = Result.SUCCESS; + logger.info("Initiating execution"); + DatabaseUtil databaseUtil = new DatabaseUtil(); + try{ + Connection connection = databaseUtil.getConnection(testData2.getValue().toString()); + Statement stmt = connection.createStatement(); + String query = testData1.getValue().toString(); + ResultSet resultSet = stmt.executeQuery(query); + resultSet.next(); + String resultData = resultSet.getObject(1).toString(); + runTimeData = new com.testsigma.sdk.RunTimeData(); + runTimeData.setValue(resultData); + runTimeData.setKey(testData3.getValue().toString()); + setSuccessMessage("Successfully Executed Select Query and Resultset is : " +resultData); + logger.info("Successfully Executed Select Query and Resultset is : " +resultData); + } + catch (Exception e){ + String errorMessage = ExceptionUtils.getStackTrace(e); + result = com.testsigma.sdk.Result.FAILED; + setErrorMessage(errorMessage); + logger.warn(errorMessage); + } + return result; + } +} \ No newline at end of file diff --git a/mysql_queries/src/main/java/com/testsigma/addons/android/Mysqlselectandstore.java b/mysql_queries/src/main/java/com/testsigma/addons/android/Mysqlselectandstore.java new file mode 100644 index 00000000..cf46562a --- /dev/null +++ b/mysql_queries/src/main/java/com/testsigma/addons/android/Mysqlselectandstore.java @@ -0,0 +1,79 @@ +package com.testsigma.addons.android; + + +import com.testsigma.addons.mysql.util.DatabaseUtil; +import com.testsigma.sdk.ApplicationType; +import com.testsigma.sdk.Result; +import com.testsigma.sdk.WebAction; +import com.testsigma.sdk.annotation.Action; +import com.testsigma.sdk.annotation.RunTimeData; +import com.testsigma.sdk.annotation.TestData; +import lombok.Data; +import org.apache.commons.lang3.exception.ExceptionUtils; +import org.openqa.selenium.NoSuchElementException; + +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.Statement; + +@Data +@Action(actionText = "Execute MySQL Select-Query on the connection DB_Connection_URL and store the query result into a variable-name", + description = "This Action executes a given Select Query and stores the result(First cell data) into a provided runtime variable.", + applicationType = ApplicationType.WEB) +public class Mysqlselectandstore extends WebAction { + + @TestData(reference = "Select-Query") + private com.testsigma.sdk.TestData testData1; + @TestData(reference = "DB_Connection_URL") + private com.testsigma.sdk.TestData testData2; + @TestData(reference = "variable-name" , isRuntimeVariable = true) + private com.testsigma.sdk.TestData testData3; + StringBuffer sb = new StringBuffer(); + + @RunTimeData + private com.testsigma.sdk.RunTimeData runTimeData; + + @Override + public Result execute() throws NoSuchElementException { + Result result = Result.SUCCESS; + logger.info("Initiating execution"); + DatabaseUtil databaseUtil = new DatabaseUtil(); + try{ + Connection connection = databaseUtil.getConnection(testData2.getValue().toString()); + Statement stmt = connection.createStatement(); + String query = testData1.getValue().toString(); + ResultSet resultSet = stmt.executeQuery(query); + ResultSetMetaData rsmd = resultSet.getMetaData(); + int columnNo = resultSet.getMetaData().getColumnCount(); + for (int i = 1; i <= columnNo; i++) { + sb.append(rsmd.getColumnName(i)); + sb.append(", "); + } + sb.append("
"); + while (resultSet.next()) { + for (int j = 1; j <= columnNo; j++) { + if (j > 1) sb.append(", "); + String columnValue = resultSet.getString(j); + if (resultSet.wasNull()) { + sb.append(""); + } + sb.append(columnValue); + } + sb.append("
"); + } + runTimeData = new com.testsigma.sdk.RunTimeData(); + runTimeData.setValue(sb.toString()); + runTimeData.setKey(testData3.getValue().toString()); + setSuccessMessage("Successfully Executed Select Query and Resultset is : " + sb.toString()); + logger.info("Successfully Executed Select Query and Resultset is : " + sb.toString()); + } + catch (Exception e){ + String errorMessage = ExceptionUtils.getStackTrace(e); + result = Result.FAILED; + setErrorMessage(errorMessage); + logger.warn(errorMessage); + } + return result; + } +} \ No newline at end of file diff --git a/mysql_queries/src/main/java/com/testsigma/addons/android/Mysqlselectvalidate.java b/mysql_queries/src/main/java/com/testsigma/addons/android/Mysqlselectvalidate.java new file mode 100644 index 00000000..5f688369 --- /dev/null +++ b/mysql_queries/src/main/java/com/testsigma/addons/android/Mysqlselectvalidate.java @@ -0,0 +1,70 @@ +package com.testsigma.addons.android; + +import com.testsigma.sdk.Result; +import com.testsigma.sdk.WebAction; +import com.testsigma.addons.mysql.util.DatabaseUtil; +import com.testsigma.sdk.ApplicationType; +import com.testsigma.sdk.annotation.Action; +import com.testsigma.sdk.annotation.TestData; +import lombok.Data; + +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.Statement; + +import org.apache.commons.lang3.exception.ExceptionUtils; +import org.openqa.selenium.NoSuchElementException; + +@Data +@Action(actionText = "Execute MySQL Select_Query on the connection DB_Connection_URL and verify output is Expected_Value", +description = "This Action executes a given Select Query and validates the result(First cell data) aginst the expected value.", +applicationType = ApplicationType.ANDROID) +public class Mysqlselectvalidate extends WebAction { + + @TestData(reference = "Select_Query") + private com.testsigma.sdk.TestData testData1; + @TestData(reference = "DB_Connection_URL") + private com.testsigma.sdk.TestData testData2; + @TestData(reference = "Expected_Value") + private com.testsigma.sdk.TestData testData3; + StringBuffer sb = new StringBuffer(); + + @Override + public com.testsigma.sdk.Result execute() throws NoSuchElementException { + Result result = Result.SUCCESS; + logger.info("Initiating execution"); + DatabaseUtil databaseUtil = new DatabaseUtil(); + try{ + Connection connection = databaseUtil.getConnection(testData2.getValue().toString()); + Statement stmt = connection.createStatement(); + String query = testData1.getValue().toString(); + ResultSet resultSet = stmt.executeQuery(query); + resultSet.next(); + String resultData = resultSet.getObject(1).toString(); + + if(testData3.getValue().toString().equals(resultData)) { + sb.append("
The output from the Select Query is matching with expected value."); + sb.append("
Expected value:"+testData3.getValue().toString()); + sb.append("
Actual output from query:"+resultData); + setSuccessMessage(sb.toString()); + logger.info(sb.toString()); + } + else { + result = com.testsigma.sdk.Result.FAILED; + sb.append("The selected query value not match with expected rows:" + "
"); + sb.append("Expected value of select query:"+testData3.getValue().toString() + "
"); + sb.append("Actual value from query execution:"+resultData + "
"); + setErrorMessage(sb.toString()); + logger.warn(sb.toString()); + } + } + catch (Exception e){ + String errorMessage = ExceptionUtils.getStackTrace(e); + sb.append("
"+errorMessage); + result = com.testsigma.sdk.Result.FAILED; + setErrorMessage(sb.toString()); + logger.warn(sb.toString()); + } + return result; + } +} \ No newline at end of file diff --git a/mysql_queries/src/main/java/com/testsigma/addons/ios/Mysqlqueries.java b/mysql_queries/src/main/java/com/testsigma/addons/ios/Mysqlqueries.java new file mode 100644 index 00000000..c8dfc748 --- /dev/null +++ b/mysql_queries/src/main/java/com/testsigma/addons/ios/Mysqlqueries.java @@ -0,0 +1,61 @@ +package com.testsigma.addons.ios; + +import com.testsigma.sdk.Result; +import com.testsigma.sdk.WebAction; +import com.testsigma.addons.mysql.util.DatabaseUtil; +import com.testsigma.sdk.ApplicationType; +import com.testsigma.sdk.annotation.Action; +import com.testsigma.sdk.annotation.TestData; +import lombok.Data; + +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.Statement; + +import org.apache.commons.lang3.exception.ExceptionUtils; +import org.openqa.selenium.NoSuchElementException; + +@Data +@Action(actionText = "Execute MySQL Query on the Connection DB_Connection_URL", +description = "This action executes given query against the connection provided and prints the no. of affected/fetched rows.", +applicationType = ApplicationType.IOS) +public class Mysqlqueries extends WebAction { + + @TestData(reference = "Query") + private com.testsigma.sdk.TestData testData1; + @TestData(reference = "DB_Connection_URL") + private com.testsigma.sdk.TestData testData2; + + @Override + public com.testsigma.sdk.Result execute() throws NoSuchElementException { + Result result = Result.SUCCESS; + logger.info("Initiating execution"); + DatabaseUtil databaseUtil = new DatabaseUtil(); + int rowsUpdatedOrFetched = 0; + try{ + Connection connection = databaseUtil.getConnection(testData2.getValue().toString()); + Statement stmt = connection.createStatement(); + String query = testData1.getValue().toString(); + if(query.trim().toUpperCase().startsWith("SELECT")) { + ResultSet resultSet = stmt.executeQuery(query); + while (resultSet.next()){ + resultSet.getObject(1).toString(); + rowsUpdatedOrFetched ++; + } + setSuccessMessage("Successfully Executed Database Query, No. of Rows fetched from DB : " +rowsUpdatedOrFetched); + logger.info("Successfully Executed Database Query, No. of Rows fetched from DB : " +rowsUpdatedOrFetched); + }else { + rowsUpdatedOrFetched = stmt.executeUpdate(query); + setSuccessMessage("Successfully Executed Database Query, No. of rows affected in DB : " +rowsUpdatedOrFetched); + logger.info("Successfully Executed Database Query, No. of Rows fetched from DB : " +rowsUpdatedOrFetched); + } + } + catch (Exception e){ + String errorMessage = ExceptionUtils.getStackTrace(e); + result = com.testsigma.sdk.Result.FAILED; + setErrorMessage(errorMessage); + logger.warn(errorMessage); + } + return result; + } +} \ No newline at end of file diff --git a/mysql_queries/src/main/java/com/testsigma/addons/ios/MysqlqueriesValidate.java b/mysql_queries/src/main/java/com/testsigma/addons/ios/MysqlqueriesValidate.java new file mode 100644 index 00000000..58984ab0 --- /dev/null +++ b/mysql_queries/src/main/java/com/testsigma/addons/ios/MysqlqueriesValidate.java @@ -0,0 +1,77 @@ +package com.testsigma.addons.ios; + +import com.testsigma.sdk.Result; +import com.testsigma.sdk.WebAction; +import com.testsigma.addons.mysql.util.DatabaseUtil; +import com.testsigma.sdk.ApplicationType; +import com.testsigma.sdk.annotation.Action; +import com.testsigma.sdk.annotation.TestData; +import lombok.Data; + +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.Statement; + +import org.apache.commons.lang3.exception.ExceptionUtils; +import org.openqa.selenium.NoSuchElementException; + +@Data +@Action(actionText = "Execute MySQL Query on the Connection DB_Connection_URL and verify affected rows count is Row-Count", +description = "This Action executes given SQL query and validates the affected rows.", +applicationType = ApplicationType.IOS) +public class MysqlqueriesValidate extends WebAction { + + @TestData(reference = "Query") + private com.testsigma.sdk.TestData testData1; + @TestData(reference = "DB_Connection_URL") + private com.testsigma.sdk.TestData testData2; + @TestData(reference = "Row-Count") + private com.testsigma.sdk.TestData testData3; + StringBuffer sb = new StringBuffer(); + + @Override + public com.testsigma.sdk.Result execute() throws NoSuchElementException { + Result result = Result.SUCCESS; + logger.info("Initiating execution"); + DatabaseUtil databaseUtil = new DatabaseUtil(); + int rowsUpdatedOrFetched = 0; + try{ + Connection connection = databaseUtil.getConnection(testData2.getValue().toString()); + Statement stmt = connection.createStatement(); + String query = testData1.getValue().toString(); + if(query.trim().toUpperCase().startsWith("SELECT")) { + ResultSet resultSet = stmt.executeQuery(query); + while (resultSet.next()){ + resultSet.getObject(1).toString(); + rowsUpdatedOrFetched ++; + } + sb.append("Successfully Executed Database Query and Rows fetched from DB : " +rowsUpdatedOrFetched + "
"); + }else { + rowsUpdatedOrFetched = stmt.executeUpdate(query); + sb.append("Successfully Executed Database Query, No. of rows affected in DB : " +rowsUpdatedOrFetched + "
"); + + } + if(rowsUpdatedOrFetched == Integer.parseInt(testData3.getValue().toString())) { + sb.append("Affected row count is matching with expected value." + "
"); + setSuccessMessage(sb.toString()); + logger.info(sb.toString()); + } + else { + result = com.testsigma.sdk.Result.FAILED; + sb.append("The affected rows does not match with expected rows:" + "
"); + sb.append("Expected no. of affected rows:"+testData3.getValue().toString() + "
"); + sb.append("Actual affected rows from query execution:"+rowsUpdatedOrFetched + "
"); + setErrorMessage(sb.toString()); + logger.warn(sb.toString()); + } + } + catch (Exception e){ + String errorMessage = ExceptionUtils.getStackTrace(e); + sb.append("
"+errorMessage); + result = com.testsigma.sdk.Result.FAILED; + setErrorMessage(sb.toString()); + logger.warn(sb.toString()); + } + return result; + } +} \ No newline at end of file diff --git a/mysql_queries/src/main/java/com/testsigma/addons/ios/Mysqlselect.java b/mysql_queries/src/main/java/com/testsigma/addons/ios/Mysqlselect.java new file mode 100644 index 00000000..19ddcfe0 --- /dev/null +++ b/mysql_queries/src/main/java/com/testsigma/addons/ios/Mysqlselect.java @@ -0,0 +1,60 @@ +package com.testsigma.addons.ios; + +import com.testsigma.sdk.Result; +import com.testsigma.sdk.WebAction; +import com.testsigma.addons.mysql.util.DatabaseUtil; +import com.testsigma.sdk.ApplicationType; +import com.testsigma.sdk.annotation.Action; +import com.testsigma.sdk.annotation.RunTimeData; +import com.testsigma.sdk.annotation.TestData; +import lombok.Data; + +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.Statement; + +import org.apache.commons.lang3.exception.ExceptionUtils; +import org.openqa.selenium.NoSuchElementException; + +@Data +@Action(actionText = "Execute MySQL Select-Query on the connection DB_Connection_URL and store output into a variable-name", +description = "This Action executes a given Select Query and stores the result(First cell data) into a provided runtime variable.", +applicationType = ApplicationType.IOS) +public class Mysqlselect extends WebAction { + + @TestData(reference = "Select-Query") + private com.testsigma.sdk.TestData testData1; + @TestData(reference = "DB_Connection_URL") + private com.testsigma.sdk.TestData testData2; + @TestData(reference = "variable-name" , isRuntimeVariable = true) + private com.testsigma.sdk.TestData testData3; + @RunTimeData + private com.testsigma.sdk.RunTimeData runTimeData; + + @Override + public com.testsigma.sdk.Result execute() throws NoSuchElementException { + Result result = Result.SUCCESS; + logger.info("Initiating execution"); + DatabaseUtil databaseUtil = new DatabaseUtil(); + try{ + Connection connection = databaseUtil.getConnection(testData2.getValue().toString()); + Statement stmt = connection.createStatement(); + String query = testData1.getValue().toString(); + ResultSet resultSet = stmt.executeQuery(query); + resultSet.next(); + String resultData = resultSet.getObject(1).toString(); + runTimeData = new com.testsigma.sdk.RunTimeData(); + runTimeData.setValue(resultData); + runTimeData.setKey(testData3.getValue().toString()); + setSuccessMessage("Successfully Executed Select Query and Resultset is : " +resultData); + logger.info("Successfully Executed Select Query and Resultset is : " +resultData); + } + catch (Exception e){ + String errorMessage = ExceptionUtils.getStackTrace(e); + result = com.testsigma.sdk.Result.FAILED; + setErrorMessage(errorMessage); + logger.warn(errorMessage); + } + return result; + } +} \ No newline at end of file diff --git a/mysql_queries/src/main/java/com/testsigma/addons/ios/Mysqlselectandstore.java b/mysql_queries/src/main/java/com/testsigma/addons/ios/Mysqlselectandstore.java new file mode 100644 index 00000000..8a727bbf --- /dev/null +++ b/mysql_queries/src/main/java/com/testsigma/addons/ios/Mysqlselectandstore.java @@ -0,0 +1,79 @@ +package com.testsigma.addons.ios; + + +import com.testsigma.addons.mysql.util.DatabaseUtil; +import com.testsigma.sdk.ApplicationType; +import com.testsigma.sdk.Result; +import com.testsigma.sdk.WebAction; +import com.testsigma.sdk.annotation.Action; +import com.testsigma.sdk.annotation.RunTimeData; +import com.testsigma.sdk.annotation.TestData; +import lombok.Data; +import org.apache.commons.lang3.exception.ExceptionUtils; +import org.openqa.selenium.NoSuchElementException; + +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.Statement; + +@Data +@Action(actionText = "Execute MySQL Select-Query on the connection DB_Connection_URL and store the query result into a variable-name", + description = "This Action executes a given Select Query and stores the result(First cell data) into a provided runtime variable.", + applicationType = ApplicationType.WEB) +public class Mysqlselectandstore extends WebAction { + + @TestData(reference = "Select-Query") + private com.testsigma.sdk.TestData testData1; + @TestData(reference = "DB_Connection_URL") + private com.testsigma.sdk.TestData testData2; + @TestData(reference = "variable-name" , isRuntimeVariable = true) + private com.testsigma.sdk.TestData testData3; + StringBuffer sb = new StringBuffer(); + + @RunTimeData + private com.testsigma.sdk.RunTimeData runTimeData; + + @Override + public Result execute() throws NoSuchElementException { + Result result = Result.SUCCESS; + logger.info("Initiating execution"); + DatabaseUtil databaseUtil = new DatabaseUtil(); + try{ + Connection connection = databaseUtil.getConnection(testData2.getValue().toString()); + Statement stmt = connection.createStatement(); + String query = testData1.getValue().toString(); + ResultSet resultSet = stmt.executeQuery(query); + ResultSetMetaData rsmd = resultSet.getMetaData(); + int columnNo = resultSet.getMetaData().getColumnCount(); + for (int i = 1; i <= columnNo; i++) { + sb.append(rsmd.getColumnName(i)); + sb.append(", "); + } + sb.append("
"); + while (resultSet.next()) { + for (int j = 1; j <= columnNo; j++) { + if (j > 1) sb.append(", "); + String columnValue = resultSet.getString(j); + if (resultSet.wasNull()) { + sb.append(""); + } + sb.append(columnValue); + } + sb.append("
"); + } + runTimeData = new com.testsigma.sdk.RunTimeData(); + runTimeData.setValue(sb.toString()); + runTimeData.setKey(testData3.getValue().toString()); + setSuccessMessage("Successfully Executed Select Query and Resultset is : " + sb.toString()); + logger.info("Successfully Executed Select Query and Resultset is : " + sb.toString()); + } + catch (Exception e){ + String errorMessage = ExceptionUtils.getStackTrace(e); + result = Result.FAILED; + setErrorMessage(errorMessage); + logger.warn(errorMessage); + } + return result; + } +} \ No newline at end of file diff --git a/mysql_queries/src/main/java/com/testsigma/addons/ios/Mysqlselectvalidate.java b/mysql_queries/src/main/java/com/testsigma/addons/ios/Mysqlselectvalidate.java new file mode 100644 index 00000000..2047dbd7 --- /dev/null +++ b/mysql_queries/src/main/java/com/testsigma/addons/ios/Mysqlselectvalidate.java @@ -0,0 +1,70 @@ +package com.testsigma.addons.ios; + +import com.testsigma.sdk.Result; +import com.testsigma.sdk.WebAction; +import com.testsigma.addons.mysql.util.DatabaseUtil; +import com.testsigma.sdk.ApplicationType; +import com.testsigma.sdk.annotation.Action; +import com.testsigma.sdk.annotation.TestData; +import lombok.Data; + +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.Statement; + +import org.apache.commons.lang3.exception.ExceptionUtils; +import org.openqa.selenium.NoSuchElementException; + +@Data +@Action(actionText = "Execute MySQL Select_Query on the connection DB_Connection_URL and verify output is Expected_Value", +description = "This Action executes a given Select Query and validates the result(First cell data) aginst the expected value.", +applicationType = ApplicationType.IOS) +public class Mysqlselectvalidate extends WebAction { + + @TestData(reference = "Select_Query") + private com.testsigma.sdk.TestData testData1; + @TestData(reference = "DB_Connection_URL") + private com.testsigma.sdk.TestData testData2; + @TestData(reference = "Expected_Value") + private com.testsigma.sdk.TestData testData3; + StringBuffer sb = new StringBuffer(); + + @Override + public com.testsigma.sdk.Result execute() throws NoSuchElementException { + Result result = Result.SUCCESS; + logger.info("Initiating execution"); + DatabaseUtil databaseUtil = new DatabaseUtil(); + try{ + Connection connection = databaseUtil.getConnection(testData2.getValue().toString()); + Statement stmt = connection.createStatement(); + String query = testData1.getValue().toString(); + ResultSet resultSet = stmt.executeQuery(query); + resultSet.next(); + String resultData = resultSet.getObject(1).toString(); + + if(testData3.getValue().toString().equals(resultData)) { + sb.append("
The output from the Select Query is matching with expected value."); + sb.append("
Expected value:"+testData3.getValue().toString()); + sb.append("
Actual output from query:"+resultData); + setSuccessMessage(sb.toString()); + logger.info(sb.toString()); + } + else { + result = com.testsigma.sdk.Result.FAILED; + sb.append("The selected query value not match with expected rows:" + "
"); + sb.append("Expected value of select query:"+testData3.getValue().toString() + "
"); + sb.append("Actual value from query execution:"+resultData + "
"); + setErrorMessage(sb.toString()); + logger.warn(sb.toString()); + } + } + catch (Exception e){ + String errorMessage = ExceptionUtils.getStackTrace(e); + sb.append("
"+errorMessage); + result = com.testsigma.sdk.Result.FAILED; + setErrorMessage(sb.toString()); + logger.warn(sb.toString()); + } + return result; + } +} \ No newline at end of file diff --git a/mysql_queries/src/main/java/com/testsigma/addons/mobileweb/Mysqlqueries.java b/mysql_queries/src/main/java/com/testsigma/addons/mobileweb/Mysqlqueries.java new file mode 100644 index 00000000..454f7f79 --- /dev/null +++ b/mysql_queries/src/main/java/com/testsigma/addons/mobileweb/Mysqlqueries.java @@ -0,0 +1,61 @@ +package com.testsigma.addons.mobileweb; + +import com.testsigma.sdk.Result; +import com.testsigma.sdk.WebAction; +import com.testsigma.addons.mysql.util.DatabaseUtil; +import com.testsigma.sdk.ApplicationType; +import com.testsigma.sdk.annotation.Action; +import com.testsigma.sdk.annotation.TestData; +import lombok.Data; + +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.Statement; + +import org.apache.commons.lang3.exception.ExceptionUtils; +import org.openqa.selenium.NoSuchElementException; + +@Data +@Action(actionText = "Execute MySQL Query on the Connection DB_Connection_URL", +description = "This action executes given query against the connection provided and prints the no. of affected/fetched rows.", +applicationType = ApplicationType.MOBILE_WEB) +public class Mysqlqueries extends WebAction { + + @TestData(reference = "Query") + private com.testsigma.sdk.TestData testData1; + @TestData(reference = "DB_Connection_URL") + private com.testsigma.sdk.TestData testData2; + + @Override + public com.testsigma.sdk.Result execute() throws NoSuchElementException { + Result result = Result.SUCCESS; + logger.info("Initiating execution"); + DatabaseUtil databaseUtil = new DatabaseUtil(); + int rowsUpdatedOrFetched = 0; + try{ + Connection connection = databaseUtil.getConnection(testData2.getValue().toString()); + Statement stmt = connection.createStatement(); + String query = testData1.getValue().toString(); + if(query.trim().toUpperCase().startsWith("SELECT")) { + ResultSet resultSet = stmt.executeQuery(query); + while (resultSet.next()){ + resultSet.getObject(1).toString(); + rowsUpdatedOrFetched ++; + } + setSuccessMessage("Successfully Executed Database Query, No. of Rows fetched from DB : " +rowsUpdatedOrFetched); + logger.info("Successfully Executed Database Query, No. of Rows fetched from DB : " +rowsUpdatedOrFetched); + }else { + rowsUpdatedOrFetched = stmt.executeUpdate(query); + setSuccessMessage("Successfully Executed Database Query, No. of rows affected in DB : " +rowsUpdatedOrFetched); + logger.info("Successfully Executed Database Query, No. of Rows fetched from DB : " +rowsUpdatedOrFetched); + } + } + catch (Exception e){ + String errorMessage = ExceptionUtils.getStackTrace(e); + result = com.testsigma.sdk.Result.FAILED; + setErrorMessage(errorMessage); + logger.warn(errorMessage); + } + return result; + } +} \ No newline at end of file diff --git a/mysql_queries/src/main/java/com/testsigma/addons/mobileweb/MysqlqueriesValidate.java b/mysql_queries/src/main/java/com/testsigma/addons/mobileweb/MysqlqueriesValidate.java new file mode 100644 index 00000000..babe7cc4 --- /dev/null +++ b/mysql_queries/src/main/java/com/testsigma/addons/mobileweb/MysqlqueriesValidate.java @@ -0,0 +1,77 @@ +package com.testsigma.addons.mobileweb; + +import com.testsigma.sdk.Result; +import com.testsigma.sdk.WebAction; +import com.testsigma.addons.mysql.util.DatabaseUtil; +import com.testsigma.sdk.ApplicationType; +import com.testsigma.sdk.annotation.Action; +import com.testsigma.sdk.annotation.TestData; +import lombok.Data; + +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.Statement; + +import org.apache.commons.lang3.exception.ExceptionUtils; +import org.openqa.selenium.NoSuchElementException; + +@Data +@Action(actionText = "Execute MySQL Query on the Connection DB_Connection_URL and verify affected rows count is Row-Count", +description = "This Action executes given SQL query and validates the affected rows.", +applicationType = ApplicationType.MOBILE_WEB) +public class MysqlqueriesValidate extends WebAction { + + @TestData(reference = "Query") + private com.testsigma.sdk.TestData testData1; + @TestData(reference = "DB_Connection_URL") + private com.testsigma.sdk.TestData testData2; + @TestData(reference = "Row-Count") + private com.testsigma.sdk.TestData testData3; + StringBuffer sb = new StringBuffer(); + + @Override + public com.testsigma.sdk.Result execute() throws NoSuchElementException { + Result result = Result.SUCCESS; + logger.info("Initiating execution"); + DatabaseUtil databaseUtil = new DatabaseUtil(); + int rowsUpdatedOrFetched = 0; + try{ + Connection connection = databaseUtil.getConnection(testData2.getValue().toString()); + Statement stmt = connection.createStatement(); + String query = testData1.getValue().toString(); + if(query.trim().toUpperCase().startsWith("SELECT")) { + ResultSet resultSet = stmt.executeQuery(query); + while (resultSet.next()){ + resultSet.getObject(1).toString(); + rowsUpdatedOrFetched ++; + } + sb.append("Successfully Executed Database Query and Rows fetched from DB : " +rowsUpdatedOrFetched + "
"); + }else { + rowsUpdatedOrFetched = stmt.executeUpdate(query); + sb.append("Successfully Executed Database Query, No. of rows affected in DB : " +rowsUpdatedOrFetched + "
"); + + } + if(rowsUpdatedOrFetched == Integer.parseInt(testData3.getValue().toString())) { + sb.append("Affected row count is matching with expected value." + "
"); + setSuccessMessage(sb.toString()); + logger.info(sb.toString()); + } + else { + result = com.testsigma.sdk.Result.FAILED; + sb.append("The affected rows does not match with expected rows:" + "
"); + sb.append("Expected no. of affected rows:"+testData3.getValue().toString() + "
"); + sb.append("Actual affected rows from query execution:"+rowsUpdatedOrFetched + "
"); + setErrorMessage(sb.toString()); + logger.warn(sb.toString()); + } + } + catch (Exception e){ + String errorMessage = ExceptionUtils.getStackTrace(e); + sb.append("
"+errorMessage); + result = com.testsigma.sdk.Result.FAILED; + setErrorMessage(sb.toString()); + logger.warn(sb.toString()); + } + return result; + } +} \ No newline at end of file diff --git a/mysql_queries/src/main/java/com/testsigma/addons/mobileweb/Mysqlselect.java b/mysql_queries/src/main/java/com/testsigma/addons/mobileweb/Mysqlselect.java new file mode 100644 index 00000000..328517b0 --- /dev/null +++ b/mysql_queries/src/main/java/com/testsigma/addons/mobileweb/Mysqlselect.java @@ -0,0 +1,60 @@ +package com.testsigma.addons.mobileweb; + +import com.testsigma.sdk.Result; +import com.testsigma.sdk.WebAction; +import com.testsigma.addons.mysql.util.DatabaseUtil; +import com.testsigma.sdk.ApplicationType; +import com.testsigma.sdk.annotation.Action; +import com.testsigma.sdk.annotation.RunTimeData; +import com.testsigma.sdk.annotation.TestData; +import lombok.Data; + +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.Statement; + +import org.apache.commons.lang3.exception.ExceptionUtils; +import org.openqa.selenium.NoSuchElementException; + +@Data +@Action(actionText = "Execute MySQL Select-Query on the connection DB_Connection_URL and store output into a variable-name", +description = "This Action executes a given Select Query and stores the result(First cell data) into a provided runtime variable.", +applicationType = ApplicationType.MOBILE_WEB) +public class Mysqlselect extends WebAction { + + @TestData(reference = "Select-Query") + private com.testsigma.sdk.TestData testData1; + @TestData(reference = "DB_Connection_URL") + private com.testsigma.sdk.TestData testData2; + @TestData(reference = "variable-name" , isRuntimeVariable = true) + private com.testsigma.sdk.TestData testData3; + @RunTimeData + private com.testsigma.sdk.RunTimeData runTimeData; + + @Override + public com.testsigma.sdk.Result execute() throws NoSuchElementException { + Result result = Result.SUCCESS; + logger.info("Initiating execution"); + DatabaseUtil databaseUtil = new DatabaseUtil(); + try{ + Connection connection = databaseUtil.getConnection(testData2.getValue().toString()); + Statement stmt = connection.createStatement(); + String query = testData1.getValue().toString(); + ResultSet resultSet = stmt.executeQuery(query); + resultSet.next(); + String resultData = resultSet.getObject(1).toString(); + runTimeData = new com.testsigma.sdk.RunTimeData(); + runTimeData.setValue(resultData); + runTimeData.setKey(testData3.getValue().toString()); + setSuccessMessage("Successfully Executed Select Query and Resultset is : " +resultData); + logger.info("Successfully Executed Select Query and Resultset is : " +resultData); + } + catch (Exception e){ + String errorMessage = ExceptionUtils.getStackTrace(e); + result = com.testsigma.sdk.Result.FAILED; + setErrorMessage(errorMessage); + logger.warn(errorMessage); + } + return result; + } +} \ No newline at end of file diff --git a/mysql_queries/src/main/java/com/testsigma/addons/mobileweb/Mysqlselectandstore.java b/mysql_queries/src/main/java/com/testsigma/addons/mobileweb/Mysqlselectandstore.java new file mode 100644 index 00000000..40000d1b --- /dev/null +++ b/mysql_queries/src/main/java/com/testsigma/addons/mobileweb/Mysqlselectandstore.java @@ -0,0 +1,79 @@ +package com.testsigma.addons.mobileweb; + + +import com.testsigma.addons.mysql.util.DatabaseUtil; +import com.testsigma.sdk.ApplicationType; +import com.testsigma.sdk.Result; +import com.testsigma.sdk.WebAction; +import com.testsigma.sdk.annotation.Action; +import com.testsigma.sdk.annotation.RunTimeData; +import com.testsigma.sdk.annotation.TestData; +import lombok.Data; +import org.apache.commons.lang3.exception.ExceptionUtils; +import org.openqa.selenium.NoSuchElementException; + +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.Statement; + +@Data +@Action(actionText = "Execute MySQL Select-Query on the connection DB_Connection_URL and store the query result into a variable-name", + description = "This Action executes a given Select Query and stores the result(First cell data) into a provided runtime variable.", + applicationType = ApplicationType.WEB) +public class Mysqlselectandstore extends WebAction { + + @TestData(reference = "Select-Query") + private com.testsigma.sdk.TestData testData1; + @TestData(reference = "DB_Connection_URL") + private com.testsigma.sdk.TestData testData2; + @TestData(reference = "variable-name" , isRuntimeVariable = true) + private com.testsigma.sdk.TestData testData3; + StringBuffer sb = new StringBuffer(); + + @RunTimeData + private com.testsigma.sdk.RunTimeData runTimeData; + + @Override + public Result execute() throws NoSuchElementException { + Result result = Result.SUCCESS; + logger.info("Initiating execution"); + DatabaseUtil databaseUtil = new DatabaseUtil(); + try{ + Connection connection = databaseUtil.getConnection(testData2.getValue().toString()); + Statement stmt = connection.createStatement(); + String query = testData1.getValue().toString(); + ResultSet resultSet = stmt.executeQuery(query); + ResultSetMetaData rsmd = resultSet.getMetaData(); + int columnNo = resultSet.getMetaData().getColumnCount(); + for (int i = 1; i <= columnNo; i++) { + sb.append(rsmd.getColumnName(i)); + sb.append(", "); + } + sb.append("
"); + while (resultSet.next()) { + for (int j = 1; j <= columnNo; j++) { + if (j > 1) sb.append(", "); + String columnValue = resultSet.getString(j); + if (resultSet.wasNull()) { + sb.append(""); + } + sb.append(columnValue); + } + sb.append("
"); + } + runTimeData = new com.testsigma.sdk.RunTimeData(); + runTimeData.setValue(sb.toString()); + runTimeData.setKey(testData3.getValue().toString()); + setSuccessMessage("Successfully Executed Select Query and Resultset is : " + sb.toString()); + logger.info("Successfully Executed Select Query and Resultset is : " + sb.toString()); + } + catch (Exception e){ + String errorMessage = ExceptionUtils.getStackTrace(e); + result = Result.FAILED; + setErrorMessage(errorMessage); + logger.warn(errorMessage); + } + return result; + } +} \ No newline at end of file diff --git a/mysql_queries/src/main/java/com/testsigma/addons/mobileweb/Mysqlselectvalidate.java b/mysql_queries/src/main/java/com/testsigma/addons/mobileweb/Mysqlselectvalidate.java new file mode 100644 index 00000000..444a254b --- /dev/null +++ b/mysql_queries/src/main/java/com/testsigma/addons/mobileweb/Mysqlselectvalidate.java @@ -0,0 +1,70 @@ +package com.testsigma.addons.mobileweb; + +import com.testsigma.sdk.Result; +import com.testsigma.sdk.WebAction; +import com.testsigma.addons.mysql.util.DatabaseUtil; +import com.testsigma.sdk.ApplicationType; +import com.testsigma.sdk.annotation.Action; +import com.testsigma.sdk.annotation.TestData; +import lombok.Data; + +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.Statement; + +import org.apache.commons.lang3.exception.ExceptionUtils; +import org.openqa.selenium.NoSuchElementException; + +@Data +@Action(actionText = "Execute MySQL Select_Query on the connection DB_Connection_URL and verify output is Expected_Value", +description = "This Action executes a given Select Query and validates the result(First cell data) aginst the expected value.", +applicationType = ApplicationType.MOBILE_WEB) +public class Mysqlselectvalidate extends WebAction { + + @TestData(reference = "Select_Query") + private com.testsigma.sdk.TestData testData1; + @TestData(reference = "DB_Connection_URL") + private com.testsigma.sdk.TestData testData2; + @TestData(reference = "Expected_Value") + private com.testsigma.sdk.TestData testData3; + StringBuffer sb = new StringBuffer(); + + @Override + public com.testsigma.sdk.Result execute() throws NoSuchElementException { + Result result = Result.SUCCESS; + logger.info("Initiating execution"); + DatabaseUtil databaseUtil = new DatabaseUtil(); + try{ + Connection connection = databaseUtil.getConnection(testData2.getValue().toString()); + Statement stmt = connection.createStatement(); + String query = testData1.getValue().toString(); + ResultSet resultSet = stmt.executeQuery(query); + resultSet.next(); + String resultData = resultSet.getObject(1).toString(); + + if(testData3.getValue().toString().equals(resultData)) { + sb.append("
The output from the Select Query is matching with expected value."); + sb.append("
Expected value:"+testData3.getValue().toString()); + sb.append("
Actual output from query:"+resultData); + setSuccessMessage(sb.toString()); + logger.info(sb.toString()); + } + else { + result = com.testsigma.sdk.Result.FAILED; + sb.append("The selected query value not match with expected rows:" + "
"); + sb.append("Expected value of select query:"+testData3.getValue().toString() + "
"); + sb.append("Actual value from query execution:"+resultData + "
"); + setErrorMessage(sb.toString()); + logger.warn(sb.toString()); + } + } + catch (Exception e){ + String errorMessage = ExceptionUtils.getStackTrace(e); + sb.append("
"+errorMessage); + result = com.testsigma.sdk.Result.FAILED; + setErrorMessage(sb.toString()); + logger.warn(sb.toString()); + } + return result; + } +} \ No newline at end of file diff --git a/mysql_queries/src/main/java/com/testsigma/addons/mysql/util/DatabaseUtil.java b/mysql_queries/src/main/java/com/testsigma/addons/mysql/util/DatabaseUtil.java new file mode 100644 index 00000000..79f1a63a --- /dev/null +++ b/mysql_queries/src/main/java/com/testsigma/addons/mysql/util/DatabaseUtil.java @@ -0,0 +1,15 @@ +package com.testsigma.addons.mysql.util; + + +import java.sql.Connection; +import java.sql.DriverManager; + +public class DatabaseUtil { + private String dbClass = "com.mysql.jdbc.Driver"; + public Connection getConnection(String dbURL) throws Exception { + + Class.forName(dbClass).getDeclaredConstructor().newInstance(); + Connection con = DriverManager.getConnection(dbURL); + return con; + } +} diff --git a/mysql_queries/src/main/java/com/testsigma/addons/web/MysqlCallProcedure.java b/mysql_queries/src/main/java/com/testsigma/addons/web/MysqlCallProcedure.java new file mode 100644 index 00000000..cca22b6c --- /dev/null +++ b/mysql_queries/src/main/java/com/testsigma/addons/web/MysqlCallProcedure.java @@ -0,0 +1,72 @@ +package com.testsigma.addons.web; + +import com.testsigma.sdk.Result; +import com.testsigma.sdk.WebAction; +import com.testsigma.addons.mysql.util.DatabaseUtil; +import com.testsigma.sdk.ApplicationType; +import com.testsigma.sdk.annotation.Action; +import com.testsigma.sdk.annotation.TestData; +import lombok.Data; + +import java.sql.CallableStatement; +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.Statement; + +import org.apache.commons.lang3.exception.ExceptionUtils; +import org.openqa.selenium.NoSuchElementException; + +@Data +@Action(actionText = "Call MySQL Stored Procedure Query on the Connection DB_Connection_URL", +description = "This action executes given query against the connection provided and prints the values", +applicationType = ApplicationType.WEB) +public class MysqlCallProcedure extends WebAction { + + @TestData(reference = "Query") + private com.testsigma.sdk.TestData testData1; + @TestData(reference = "DB_Connection_URL") + private com.testsigma.sdk.TestData testData2; + StringBuffer sb = new StringBuffer(); + + @Override + public com.testsigma.sdk.Result execute() throws NoSuchElementException { + Result result = Result.SUCCESS; + logger.info("Initiating execution"); + DatabaseUtil databaseUtil = new DatabaseUtil(); + try{ + Connection connection = databaseUtil.getConnection(testData2.getValue().toString()); + String query = testData1.getValue().toString(); + CallableStatement callprocedure = connection.prepareCall(query); + ResultSet resultSet = callprocedure.executeQuery(); + ResultSetMetaData rsmd = resultSet.getMetaData(); + int columnNo = resultSet.getMetaData().getColumnCount(); + sb.append("Successfully Executed Query and Resultset is : " + "
"); + for (int i = 1; i <= columnNo; i++) { + sb.append(rsmd.getColumnName(i)); + sb.append(", "); + } + sb.append("
"); + while (resultSet.next()) { + for (int j = 1; j <= columnNo; j++) { + if (j > 1) sb.append(", "); + String columnValue = resultSet.getString(j); + if (resultSet.wasNull()) { + sb.append(""); + } + sb.append(columnValue); + } + sb.append("
"); + } + setSuccessMessage(sb.toString()); + logger.info(sb.toString()); + } + catch (Exception e){ + String errorMessage = ExceptionUtils.getStackTrace(e); + result = com.testsigma.sdk.Result.FAILED; + setErrorMessage(errorMessage); + logger.warn(errorMessage); + } + return result; + } +} \ No newline at end of file diff --git a/mysql_queries/src/main/java/com/testsigma/addons/web/MysqlCreateProcedure.java b/mysql_queries/src/main/java/com/testsigma/addons/web/MysqlCreateProcedure.java new file mode 100644 index 00000000..c04aa3b4 --- /dev/null +++ b/mysql_queries/src/main/java/com/testsigma/addons/web/MysqlCreateProcedure.java @@ -0,0 +1,53 @@ +package com.testsigma.addons.web; + +import com.testsigma.sdk.Result; +import com.testsigma.sdk.WebAction; +import com.testsigma.addons.mysql.util.DatabaseUtil; +import com.testsigma.sdk.ApplicationType; +import com.testsigma.sdk.annotation.Action; +import com.testsigma.sdk.annotation.TestData; +import lombok.Data; + +import java.sql.CallableStatement; +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.Statement; + +import org.apache.commons.lang3.exception.ExceptionUtils; +import org.openqa.selenium.NoSuchElementException; + +@Data +@Action(actionText = "Execute MySQL Create Procedure Query on the Connection DB_Connection_URL", +description = "This action executes given query against the connection and creates the procedure", +applicationType = ApplicationType.WEB) +public class MysqlCreateProcedure extends WebAction { + + @TestData(reference = "Query") + private com.testsigma.sdk.TestData testData1; + @TestData(reference = "DB_Connection_URL") + private com.testsigma.sdk.TestData testData2; + + @Override + public com.testsigma.sdk.Result execute() throws NoSuchElementException { + Result result = Result.SUCCESS; + logger.info("Initiating execution"); + DatabaseUtil databaseUtil = new DatabaseUtil(); + try{ + Connection connection = databaseUtil.getConnection(testData2.getValue().toString()); + Statement stmt = connection.createStatement(); + String query = testData1.getValue().toString(); + boolean resultSet = stmt.execute(query); + + setSuccessMessage("The procedure is created successfully: " +query); + logger.info("The procedure is created successfully: " +query); + } + catch (Exception e){ + String errorMessage = ExceptionUtils.getStackTrace(e); + result = com.testsigma.sdk.Result.FAILED; + setErrorMessage(errorMessage); + logger.warn(errorMessage); + } + return result; + } +} \ No newline at end of file diff --git a/mysql_queries/src/main/java/com/testsigma/addons/web/MysqlValidateQueriesonDatabases.java b/mysql_queries/src/main/java/com/testsigma/addons/web/MysqlValidateQueriesonDatabases.java new file mode 100644 index 00000000..7b6e0b1f --- /dev/null +++ b/mysql_queries/src/main/java/com/testsigma/addons/web/MysqlValidateQueriesonDatabases.java @@ -0,0 +1,123 @@ +package com.testsigma.addons.web; + +import com.testsigma.sdk.Result; +import com.testsigma.sdk.WebAction; +import com.testsigma.addons.mysql.util.DatabaseUtil; +import com.testsigma.sdk.ApplicationType; +import com.testsigma.sdk.annotation.Action; +import com.testsigma.sdk.annotation.TestData; +import lombok.Data; + +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.SQLException; +import java.sql.Statement; + +import org.apache.commons.lang3.exception.ExceptionUtils; +import org.openqa.selenium.NoSuchElementException; + +@Data +@Action(actionText = "Validate MySQL Query on the Connection DB_Connection_URL1 and compare with data from the Connection DB_Connection_URL2", +description = "This action validate queries of the two database connections", +applicationType = ApplicationType.WEB) +public class MysqlValidateQueriesonDatabases extends WebAction { + + @TestData(reference = "Query") + private com.testsigma.sdk.TestData testData1; + @TestData(reference = "DB_Connection_URL1") + private com.testsigma.sdk.TestData testData2; + @TestData(reference = "DB_Connection_URL2") + private com.testsigma.sdk.TestData testData3; + StringBuffer sb = new StringBuffer(); + + @Override + public com.testsigma.sdk.Result execute() throws NoSuchElementException { + Result result = Result.SUCCESS; + logger.info("Initiating execution"); + DatabaseUtil databaseUtil = new DatabaseUtil(); + try{ + + Connection connection1 = databaseUtil.getConnection(testData2.getValue().toString()); + Connection connection2 = databaseUtil.getConnection(testData3.getValue().toString()); + + Statement stmt1 = connection1.createStatement(); + Statement stmt2 = connection2.createStatement(); + String query = testData1.getValue().toString(); + ResultSet resultSet1 = stmt1.executeQuery(query); + ResultSet resultSet2 = stmt2.executeQuery(query); + + boolean metadataComparisonSuccess = compareMetadata(resultSet1,resultSet2); + if(!metadataComparisonSuccess) { + return com.testsigma.sdk.Result.FAILED; + } + boolean dataComparisonSuccess = compareQueryData(resultSet1, resultSet2); + if(!dataComparisonSuccess) { + return com.testsigma.sdk.Result.FAILED; + } + }catch (Exception e){ + String errorMessage = ExceptionUtils.getStackTrace(e); + result = com.testsigma.sdk.Result.FAILED; + setErrorMessage(errorMessage); + logger.warn(errorMessage); + } + setSuccessMessage("The two databases are have similar data"); + logger.info("The two databases are have similar data"); + return result; + } + + private boolean compareMetadata(ResultSet resultSet1, ResultSet resultSet2) throws SQLException { + + ResultSetMetaData rsmd1 = resultSet1.getMetaData(); + ResultSetMetaData rsmd2 = resultSet2.getMetaData(); + + int columnNo1 = resultSet1.getMetaData().getColumnCount(); + int columnNo2 = resultSet2.getMetaData().getColumnCount(); + + if(columnNo1 == columnNo2) + { + if(columnNo1 != 1) + { + for(int i=1;i<=columnNo1;i++) { + if (!rsmd1.getColumnName(i).equals(rsmd2.getColumnName(i))) { + sb.append("The ColumnNames does not match:
"); + sb.append("Column name from Connection-1:" +"'" +rsmd1.getColumnName(i) + "'" + "and Column name from Connection-2:" + "'" +rsmd2.getColumnName(i) +"'"); + setErrorMessage(sb.toString()); + logger.warn(sb.toString()); + return false; + } + } + } + return true; + } + sb.append("The Columns count does not match:
"); + sb.append("Columns from Connection-1:" +"'" +columnNo1 + "'" + "and Columns from Connection-2:" + "'" +columnNo2 +"'"); + setErrorMessage(sb.toString()); + logger.info(sb.toString()); + return false; + } + private boolean compareQueryData(ResultSet resultSet1, ResultSet resultSet2) throws SQLException { + + int columnNo1 = resultSet1.getMetaData().getColumnCount(); + + while (resultSet1.next() && resultSet2.next()) + { + for (int i = 1; i <= columnNo1; i++) { + if (!resultSet1.getObject(i).equals(resultSet2.getObject(i))) { + sb.append("The values does not match for column:Column Position(Starting from 1)"+i+" Row Number:"+resultSet1.getRow()); + sb.append("
"); + sb.append("value from Connection-1:" +"'" +resultSet1.getObject(i) +"'" + "and value from Connection-2:" + "'" +resultSet2.getObject(i) +"'"); + setErrorMessage(sb.toString()); + logger.warn(sb.toString()); + return false; + } + } + if ((resultSet2.isLast() == true && resultSet1.isLast() == false) || (resultSet2.isLast() == false && resultSet1.isLast() == true)) { + setErrorMessage("No of rows does not match."); + logger.warn("No. of rows from the query does not match."); + return false; + } + } + return true; + } +} \ No newline at end of file diff --git a/mysql_queries/src/main/java/com/testsigma/addons/web/MysqlValidateQueriesonTables.java b/mysql_queries/src/main/java/com/testsigma/addons/web/MysqlValidateQueriesonTables.java new file mode 100644 index 00000000..1e739d37 --- /dev/null +++ b/mysql_queries/src/main/java/com/testsigma/addons/web/MysqlValidateQueriesonTables.java @@ -0,0 +1,126 @@ +package com.testsigma.addons.web; + +import com.testsigma.sdk.Result; +import com.testsigma.sdk.WebAction; +import com.testsigma.addons.mysql.util.DatabaseUtil; +import com.testsigma.sdk.ApplicationType; +import com.testsigma.sdk.annotation.Action; +import com.testsigma.sdk.annotation.TestData; +import lombok.Data; + +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.SQLException; +import java.sql.Statement; + +import org.apache.commons.lang3.exception.ExceptionUtils; +import org.openqa.selenium.NoSuchElementException; + +@Data +@Action(actionText = "Validate MySQL Query Query1 and compare with the Query Query2 from the Connection DB_Connection_URL", +description = "This action validate queries on the database connections", +applicationType = ApplicationType.WEB) +public class MysqlValidateQueriesonTables extends WebAction { + + @TestData(reference = "Query1") + private com.testsigma.sdk.TestData testData1; + @TestData(reference = "Query2") + private com.testsigma.sdk.TestData testData2; + @TestData(reference = "DB_Connection_URL") + private com.testsigma.sdk.TestData testData3; + StringBuffer sb = new StringBuffer(); + + @Override + public com.testsigma.sdk.Result execute() throws NoSuchElementException { + Result result = Result.SUCCESS; + logger.info("Initiating execution"); + DatabaseUtil databaseUtil = new DatabaseUtil(); + try{ + + Connection connection1 = databaseUtil.getConnection(testData3.getValue().toString()); + Connection connection2 = databaseUtil.getConnection(testData3.getValue().toString()); + + Statement stmt1 = connection1.createStatement(); + Statement stmt2 = connection2.createStatement(); + + String query1 = testData1.getValue().toString(); + String query2 = testData2.getValue().toString(); + + ResultSet resultSet1 = stmt1.executeQuery(query1); + ResultSet resultSet2 = stmt2.executeQuery(query2); + + boolean metadataComparisonSuccess = compareMetadata(resultSet1,resultSet2); + if(!metadataComparisonSuccess) { + return com.testsigma.sdk.Result.FAILED; + } + boolean dataComparisonSuccess = compareQueryData(resultSet1, resultSet2); + if(!dataComparisonSuccess) { + return com.testsigma.sdk.Result.FAILED; + } + }catch (Exception e){ + String errorMessage = ExceptionUtils.getStackTrace(e); + result = com.testsigma.sdk.Result.FAILED; + setErrorMessage(errorMessage); + logger.warn(errorMessage); + } + setSuccessMessage("The two queries are have similar data"); + logger.info("The two queries are have similar data"); + return result; + } + + private boolean compareMetadata(ResultSet resultSet1, ResultSet resultSet2) throws SQLException { + + ResultSetMetaData rsmd1 = resultSet1.getMetaData(); + ResultSetMetaData rsmd2 = resultSet2.getMetaData(); + + int columnNo1 = resultSet1.getMetaData().getColumnCount(); + int columnNo2 = resultSet2.getMetaData().getColumnCount(); + + if(columnNo1 == columnNo2) + { + if(columnNo1 != 1) + { + for(int i=1;i<=columnNo1;i++) { + if (!rsmd1.getColumnName(i).equals(rsmd2.getColumnName(i))) { + sb.append("The ColumnNames does not match:
"); + sb.append("Column name from Query-1:" +"'" +rsmd1.getColumnName(i) + "'" + "and Column name from Query-2:" + "'" +rsmd2.getColumnName(i) +"'"); + setErrorMessage(sb.toString()); + logger.warn(sb.toString()); + return false; + } + } + } + return true; + } + sb.append("The Columns count does not match:
"); + sb.append("Columns from Query-1:" +"'" +columnNo1 + "'" + "and Columns from Query-2:" + "'" +columnNo2 +"'"); + setErrorMessage(sb.toString()); + logger.info(sb.toString()); + return false; + } + private boolean compareQueryData(ResultSet resultSet1, ResultSet resultSet2) throws SQLException { + + int columnNo1 = resultSet1.getMetaData().getColumnCount(); + + while (resultSet1.next() && resultSet2.next()) + { + for (int i = 1; i <= columnNo1; i++) { + if (!resultSet1.getObject(i).equals(resultSet2.getObject(i))) { + sb.append("The values does not match for column:Column Position(Starting from 1)"+i+" Row Number:"+resultSet1.getRow()); + sb.append("
"); + sb.append("value from Query-1:" +"'" +resultSet1.getObject(i) +"'" + "and value from Query-2:" + "'" +resultSet2.getObject(i) +"'"); + setErrorMessage(sb.toString()); + logger.warn(sb.toString()); + return false; + } + } + if ((resultSet2.isLast() == true && resultSet1.isLast() == false) || (resultSet2.isLast() == false && resultSet1.isLast() == true)) { + setErrorMessage("No of rows does not match."); + logger.warn("No. of rows from the query does not match."); + return false; + } + } + return true; + } +} \ No newline at end of file diff --git a/mysql_queries/src/main/java/com/testsigma/addons/web/Mysqlqueries.java b/mysql_queries/src/main/java/com/testsigma/addons/web/Mysqlqueries.java new file mode 100644 index 00000000..d9de2c3e --- /dev/null +++ b/mysql_queries/src/main/java/com/testsigma/addons/web/Mysqlqueries.java @@ -0,0 +1,71 @@ +package com.testsigma.addons.web; + +import com.testsigma.sdk.Result; +import com.testsigma.sdk.WebAction; +import com.testsigma.addons.mysql.util.DatabaseUtil; +import com.testsigma.sdk.ApplicationType; +import com.testsigma.sdk.annotation.Action; +import com.testsigma.sdk.annotation.TestData; +import lombok.Data; + +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.Statement; + +import org.apache.commons.lang3.exception.ExceptionUtils; +import org.openqa.selenium.NoSuchElementException; + +@Data +@Action(actionText = "Execute MySQL Query on the Connection DB_Connection_URL", +description = "This action executes given query against the connection provided and prints the no. of affected/fetched rows.", +applicationType = ApplicationType.WEB) +public class Mysqlqueries extends WebAction { + + @TestData(reference = "Query") + private com.testsigma.sdk.TestData testData1; + @TestData(reference = "DB_Connection_URL") + private com.testsigma.sdk.TestData testData2; + StringBuffer sb = new StringBuffer(); + + @Override + public com.testsigma.sdk.Result execute() throws NoSuchElementException { + Result result = Result.SUCCESS; + logger.info("Initiating execution"); + DatabaseUtil databaseUtil = new DatabaseUtil(); + try{ + Connection connection = databaseUtil.getConnection(testData2.getValue().toString()); + Statement stmt = connection.createStatement(); + String query = testData1.getValue().toString(); + ResultSet resultSet = stmt.executeQuery(query); + ResultSetMetaData rsmd = resultSet.getMetaData(); + int columnNo = resultSet.getMetaData().getColumnCount(); + sb.append("Successfully Executed Query and Resultset is : " + "
"); + for (int i = 1; i <= columnNo; i++) { + sb.append(rsmd.getColumnName(i)); + sb.append(", "); + } + sb.append("
"); + while (resultSet.next()) { + for (int j = 1; j <= columnNo; j++) { + if (j > 1) sb.append(", "); + String columnValue = resultSet.getString(j); + if (resultSet.wasNull()) { + sb.append(""); + } + sb.append(columnValue); + } + sb.append("
"); + } + setSuccessMessage(sb.toString()); + logger.info(sb.toString()); + } + catch (Exception e){ + String errorMessage = ExceptionUtils.getStackTrace(e); + result = com.testsigma.sdk.Result.FAILED; + setErrorMessage(errorMessage); + logger.warn(errorMessage); + } + return result; + } +} \ No newline at end of file diff --git a/mysql_queries/src/main/java/com/testsigma/addons/web/MysqlqueriesValidate.java b/mysql_queries/src/main/java/com/testsigma/addons/web/MysqlqueriesValidate.java new file mode 100644 index 00000000..31f3bc5b --- /dev/null +++ b/mysql_queries/src/main/java/com/testsigma/addons/web/MysqlqueriesValidate.java @@ -0,0 +1,77 @@ +package com.testsigma.addons.web; + +import com.testsigma.sdk.Result; +import com.testsigma.sdk.WebAction; +import com.testsigma.addons.mysql.util.DatabaseUtil; +import com.testsigma.sdk.ApplicationType; +import com.testsigma.sdk.annotation.Action; +import com.testsigma.sdk.annotation.TestData; +import lombok.Data; + +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.Statement; + +import org.apache.commons.lang3.exception.ExceptionUtils; +import org.openqa.selenium.NoSuchElementException; + +@Data +@Action(actionText = "Execute MySQL Query on the Connection DB_Connection_URL and verify affected rows count is Row-Count", +description = "This Action executes given SQL query and validates the affected rows.", +applicationType = ApplicationType.WEB) +public class MysqlqueriesValidate extends WebAction { + + @TestData(reference = "Query") + private com.testsigma.sdk.TestData testData1; + @TestData(reference = "DB_Connection_URL") + private com.testsigma.sdk.TestData testData2; + @TestData(reference = "Row-Count") + private com.testsigma.sdk.TestData testData3; + StringBuffer sb = new StringBuffer(); + + @Override + public com.testsigma.sdk.Result execute() throws NoSuchElementException { + Result result = Result.SUCCESS; + logger.info("Initiating execution"); + DatabaseUtil databaseUtil = new DatabaseUtil(); + int rowsUpdatedOrFetched = 0; + try{ + Connection connection = databaseUtil.getConnection(testData2.getValue().toString()); + Statement stmt = connection.createStatement(); + String query = testData1.getValue().toString(); + if(query.trim().toUpperCase().startsWith("SELECT")) { + ResultSet resultSet = stmt.executeQuery(query); + while (resultSet.next()){ + resultSet.getObject(1).toString(); + rowsUpdatedOrFetched ++; + } + sb.append("Successfully Executed Database Query and Rows fetched from DB : " +rowsUpdatedOrFetched + "
"); + }else { + rowsUpdatedOrFetched = stmt.executeUpdate(query); + sb.append("Successfully Executed Database Query, No. of rows affected in DB : " +rowsUpdatedOrFetched + "
"); + + } + if(rowsUpdatedOrFetched == Integer.parseInt(testData3.getValue().toString())) { + sb.append("Affected row count is matching with expected value." + "
"); + setSuccessMessage(sb.toString()); + logger.info(sb.toString()); + } + else { + result = com.testsigma.sdk.Result.FAILED; + sb.append("The affected rows does not match with expected rows:" + "
"); + sb.append("Expected no. of affected rows:"+testData3.getValue().toString() + "
"); + sb.append("Actual affected rows from query execution:"+rowsUpdatedOrFetched + "
"); + setErrorMessage(sb.toString()); + logger.warn(sb.toString()); + } + } + catch (Exception e){ + String errorMessage = ExceptionUtils.getStackTrace(e); + sb.append("
"+errorMessage); + result = com.testsigma.sdk.Result.FAILED; + setErrorMessage(sb.toString()); + logger.warn(sb.toString()); + } + return result; + } +} \ No newline at end of file diff --git a/mysql_queries/src/main/java/com/testsigma/addons/web/Mysqlscriptfile.java b/mysql_queries/src/main/java/com/testsigma/addons/web/Mysqlscriptfile.java new file mode 100644 index 00000000..94b1ed7e --- /dev/null +++ b/mysql_queries/src/main/java/com/testsigma/addons/web/Mysqlscriptfile.java @@ -0,0 +1,60 @@ +package com.testsigma.addons.web; + +import com.testsigma.sdk.Result; +import com.testsigma.sdk.WebAction; +import com.testsigma.addons.mysql.util.DatabaseUtil; +import com.testsigma.sdk.ApplicationType; +import com.testsigma.sdk.annotation.Action; +import com.testsigma.sdk.annotation.TestData; +import lombok.Data; + +import java.io.BufferedReader; +import java.io.FileReader; +import java.io.Reader; +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.Statement; + +import org.apache.commons.lang3.exception.ExceptionUtils; +import org.apache.ibatis.jdbc.ScriptRunner; +import org.openqa.selenium.NoSuchElementException; + +@Data +@Action(actionText = "Execute MySQLScriptFile filepath on the Connection DB_Connection_URL", +description = "This action executes given scriptfile against the connection provided and prints the data.", +applicationType = ApplicationType.WEB) +public class Mysqlscriptfile extends WebAction { + + @TestData(reference = "filepath") + private com.testsigma.sdk.TestData testData1; + @TestData(reference = "DB_Connection_URL") + private com.testsigma.sdk.TestData testData2; + StringBuffer sb = new StringBuffer(); + + @Override + public com.testsigma.sdk.Result execute() throws NoSuchElementException { + Result result = Result.SUCCESS; + logger.info("Initiating execution"); + DatabaseUtil databaseUtil = new DatabaseUtil(); + try{ + Connection connection = databaseUtil.getConnection(testData2.getValue().toString()); + String path = testData1.getValue().toString(); + + sb.append("Successfully Executed ScriptFile and Result : " + "
"); + ScriptRunner sr = new ScriptRunner(connection); + Reader reader = new BufferedReader(new FileReader(path)); + + sr.runScript(reader); + setSuccessMessage(sb.toString()); + logger.getValue(); + } + catch (Exception e){ + String errorMessage = ExceptionUtils.getStackTrace(e); + result = com.testsigma.sdk.Result.FAILED; + setErrorMessage(errorMessage); + logger.warn(errorMessage); + } + return result; + } +} \ No newline at end of file diff --git a/mysql_queries/src/main/java/com/testsigma/addons/web/Mysqlselect.java b/mysql_queries/src/main/java/com/testsigma/addons/web/Mysqlselect.java new file mode 100644 index 00000000..fbf859aa --- /dev/null +++ b/mysql_queries/src/main/java/com/testsigma/addons/web/Mysqlselect.java @@ -0,0 +1,60 @@ +package com.testsigma.addons.web; + +import com.testsigma.sdk.Result; +import com.testsigma.sdk.WebAction; +import com.testsigma.addons.mysql.util.DatabaseUtil; +import com.testsigma.sdk.ApplicationType; +import com.testsigma.sdk.annotation.Action; +import com.testsigma.sdk.annotation.RunTimeData; +import com.testsigma.sdk.annotation.TestData; +import lombok.Data; + +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.Statement; + +import org.apache.commons.lang3.exception.ExceptionUtils; +import org.openqa.selenium.NoSuchElementException; + +@Data +@Action(actionText = "Execute MySQL Select-Query on the connection DB_Connection_URL and store output into a variable-name", +description = "This Action executes a given Select Query and stores the result(First cell data) into a provided runtime variable.", +applicationType = ApplicationType.WEB) +public class Mysqlselect extends WebAction { + + @TestData(reference = "Select-Query") + private com.testsigma.sdk.TestData testData1; + @TestData(reference = "DB_Connection_URL") + private com.testsigma.sdk.TestData testData2; + @TestData(reference = "variable-name" , isRuntimeVariable = true) + private com.testsigma.sdk.TestData testData3; + @RunTimeData + private com.testsigma.sdk.RunTimeData runTimeData; + + @Override + public com.testsigma.sdk.Result execute() throws NoSuchElementException { + Result result = Result.SUCCESS; + logger.info("Initiating execution"); + DatabaseUtil databaseUtil = new DatabaseUtil(); + try{ + Connection connection = databaseUtil.getConnection(testData2.getValue().toString()); + Statement stmt = connection.createStatement(); + String query = testData1.getValue().toString(); + ResultSet resultSet = stmt.executeQuery(query); + resultSet.next(); + String resultData = resultSet.getObject(1).toString(); + runTimeData = new com.testsigma.sdk.RunTimeData(); + runTimeData.setValue(resultData); + runTimeData.setKey(testData3.getValue().toString()); + setSuccessMessage("Successfully Executed Select Query and Resultset is : " +resultData); + logger.info("Successfully Executed Select Query and Resultset is : " +resultData); + } + catch (Exception e){ + String errorMessage = ExceptionUtils.getStackTrace(e); + result = com.testsigma.sdk.Result.FAILED; + setErrorMessage(errorMessage); + logger.warn(errorMessage); + } + return result; + } +} \ No newline at end of file diff --git a/mysql_queries/src/main/java/com/testsigma/addons/web/Mysqlselectandstore.java b/mysql_queries/src/main/java/com/testsigma/addons/web/Mysqlselectandstore.java new file mode 100644 index 00000000..da4ae1bb --- /dev/null +++ b/mysql_queries/src/main/java/com/testsigma/addons/web/Mysqlselectandstore.java @@ -0,0 +1,80 @@ +package com.testsigma.addons.web; + + +import com.testsigma.addons.mysql.util.DatabaseUtil; +import com.testsigma.sdk.ApplicationType; +import com.testsigma.sdk.Result; +import com.testsigma.sdk.WebAction; +import com.testsigma.sdk.annotation.Action; +import com.testsigma.sdk.annotation.RunTimeData; +import com.testsigma.sdk.annotation.TestData; +import lombok.Data; + +import org.apache.commons.lang3.exception.ExceptionUtils; +import org.openqa.selenium.NoSuchElementException; + +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.Statement; + +@Data +@Action(actionText = "Execute MySQL Select-Query on the connection DB_Connection_URL and store the query result into a variable-name", + description = "This Action executes a given Select Query and stores the result(First cell data) into a provided runtime variable.", + applicationType = ApplicationType.WEB) +public class Mysqlselectandstore extends WebAction { + + @TestData(reference = "Select-Query") + private com.testsigma.sdk.TestData testData1; + @TestData(reference = "DB_Connection_URL") + private com.testsigma.sdk.TestData testData2; + @TestData(reference = "variable-name" , isRuntimeVariable = true) + private com.testsigma.sdk.TestData testData3; + StringBuffer sb = new StringBuffer(); + + @RunTimeData + private com.testsigma.sdk.RunTimeData runTimeData; + + @Override + public Result execute() throws NoSuchElementException { + Result result = Result.SUCCESS; + logger.info("Initiating execution"); + DatabaseUtil databaseUtil = new DatabaseUtil(); + try{ + Connection connection = databaseUtil.getConnection(testData2.getValue().toString()); + Statement stmt = connection.createStatement(); + String query = testData1.getValue().toString(); + ResultSet resultSet = stmt.executeQuery(query); + ResultSetMetaData rsmd = resultSet.getMetaData(); + int columnNo = resultSet.getMetaData().getColumnCount(); + for (int i = 1; i <= columnNo; i++) { + sb.append(rsmd.getColumnName(i)); + sb.append(", "); + } + sb.append("
"); + while (resultSet.next()) { + for (int j = 1; j <= columnNo; j++) { + if (j > 1) sb.append(", "); + String columnValue = resultSet.getString(j); + if (resultSet.wasNull()) { + sb.append(""); + } + sb.append(columnValue); + } + sb.append("
"); + } + runTimeData = new com.testsigma.sdk.RunTimeData(); + runTimeData.setValue(sb.toString()); + runTimeData.setKey(testData3.getValue().toString()); + setSuccessMessage("Successfully Executed Select Query and Resultset is : " + sb.toString()); + logger.info("Successfully Executed Select Query and Resultset is : " + sb.toString()); + } + catch (Exception e){ + String errorMessage = ExceptionUtils.getStackTrace(e); + result = Result.FAILED; + setErrorMessage(errorMessage); + logger.warn(errorMessage); + } + return result; + } +} \ No newline at end of file diff --git a/mysql_queries/src/main/java/com/testsigma/addons/web/Mysqlselectvalidate.java b/mysql_queries/src/main/java/com/testsigma/addons/web/Mysqlselectvalidate.java new file mode 100644 index 00000000..92de74dd --- /dev/null +++ b/mysql_queries/src/main/java/com/testsigma/addons/web/Mysqlselectvalidate.java @@ -0,0 +1,70 @@ +package com.testsigma.addons.web; + +import com.testsigma.sdk.Result; +import com.testsigma.sdk.WebAction; +import com.testsigma.addons.mysql.util.DatabaseUtil; +import com.testsigma.sdk.ApplicationType; +import com.testsigma.sdk.annotation.Action; +import com.testsigma.sdk.annotation.TestData; +import lombok.Data; + +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.Statement; + +import org.apache.commons.lang3.exception.ExceptionUtils; +import org.openqa.selenium.NoSuchElementException; + +@Data +@Action(actionText = "Execute MySQL Select_Query on the connection DB_Connection_URL and verify output is Expected_Value", +description = "This Action executes a given Select Query and validates the result(First cell data) aginst the expected value.", +applicationType = ApplicationType.WEB) +public class Mysqlselectvalidate extends WebAction { + + @TestData(reference = "Select_Query") + private com.testsigma.sdk.TestData testData1; + @TestData(reference = "DB_Connection_URL") + private com.testsigma.sdk.TestData testData2; + @TestData(reference = "Expected_Value") + private com.testsigma.sdk.TestData testData3; + StringBuffer sb = new StringBuffer(); + + @Override + public com.testsigma.sdk.Result execute() throws NoSuchElementException { + Result result = Result.SUCCESS; + logger.info("Initiating execution"); + DatabaseUtil databaseUtil = new DatabaseUtil(); + try{ + Connection connection = databaseUtil.getConnection(testData2.getValue().toString()); + Statement stmt = connection.createStatement(); + String query = testData1.getValue().toString(); + ResultSet resultSet = stmt.executeQuery(query); + resultSet.next(); + String resultData = resultSet.getObject(1).toString(); + + if(testData3.getValue().toString().equals(resultData)) { + sb.append("
The output from the Select Query is matching with expected value."); + sb.append("
Expected value:"+testData3.getValue().toString()); + sb.append("
Actual output from query:"+resultData); + setSuccessMessage(sb.toString()); + logger.info(sb.toString()); + } + else { + result = com.testsigma.sdk.Result.FAILED; + sb.append("The selected query value not match with expected rows:" + "
"); + sb.append("Expected value of select query:"+testData3.getValue().toString() + "
"); + sb.append("Actual value from query execution:"+resultData + "
"); + setErrorMessage(sb.toString()); + logger.warn(sb.toString()); + } + } + catch (Exception e){ + String errorMessage = ExceptionUtils.getStackTrace(e); + sb.append("
"+errorMessage); + result = com.testsigma.sdk.Result.FAILED; + setErrorMessage(sb.toString()); + logger.warn(sb.toString()); + } + return result; + } +} \ No newline at end of file diff --git a/mysql_queries/src/main/java/com/testsigma/addons/web/Mysqlupdatequeries.java b/mysql_queries/src/main/java/com/testsigma/addons/web/Mysqlupdatequeries.java new file mode 100644 index 00000000..8709df0f --- /dev/null +++ b/mysql_queries/src/main/java/com/testsigma/addons/web/Mysqlupdatequeries.java @@ -0,0 +1,55 @@ +package com.testsigma.addons.web; + +import com.testsigma.sdk.Result; +import com.testsigma.sdk.WebAction; +import com.testsigma.addons.mysql.util.DatabaseUtil; +import com.testsigma.sdk.ApplicationType; +import com.testsigma.sdk.annotation.Action; +import com.testsigma.sdk.annotation.TestData; +import lombok.Data; + +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.Statement; + +import org.apache.commons.lang3.exception.ExceptionUtils; +import org.openqa.selenium.NoSuchElementException; + +@Data +@Action(actionText = "Execute MySQL Update Query on the Connection DB_Connection_URL", +description = "This action executes given update query against the connection provided and prints the no. of affected/fetched rows.", +applicationType = ApplicationType.WEB) +public class Mysqlupdatequeries extends WebAction { + + @TestData(reference = "Query") + private com.testsigma.sdk.TestData testData1; + @TestData(reference = "DB_Connection_URL") + private com.testsigma.sdk.TestData testData2; + StringBuffer sb = new StringBuffer(); + + @Override + public com.testsigma.sdk.Result execute() throws NoSuchElementException { + Result result = Result.SUCCESS; + logger.info("Initiating execution"); + DatabaseUtil databaseUtil = new DatabaseUtil(); + try{ + Connection connection = databaseUtil.getConnection(testData2.getValue().toString()); + Statement stmt = connection.createStatement(); + String query = testData1.getValue().toString(); + int resultdata = stmt.executeUpdate(query); + + sb.append("Successfully Executed Query and affected rows are : " + "
" +resultdata); + + setSuccessMessage(sb.toString()); + logger.info(sb.toString()); + } + catch (Exception e){ + String errorMessage = ExceptionUtils.getStackTrace(e); + result = com.testsigma.sdk.Result.FAILED; + setErrorMessage(errorMessage); + logger.warn(errorMessage); + } + return result; + } +} \ No newline at end of file diff --git a/mysql_queries/src/main/java/com/testsigma/addons/web/Mysqlutil.java b/mysql_queries/src/main/java/com/testsigma/addons/web/Mysqlutil.java new file mode 100644 index 00000000..a5daad79 --- /dev/null +++ b/mysql_queries/src/main/java/com/testsigma/addons/web/Mysqlutil.java @@ -0,0 +1,5 @@ +package com.testsigma.addons.web; + +public class Mysqlutil { + +} diff --git a/mysql_queries/src/main/resources/testsigma-sdk.properties b/mysql_queries/src/main/resources/testsigma-sdk.properties new file mode 100644 index 00000000..3b485eaa --- /dev/null +++ b/mysql_queries/src/main/resources/testsigma-sdk.properties @@ -0,0 +1 @@ +testsigma-sdk.api.key=eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJuYWd1cG1AdGVzdHNpZ21hdGVjaC5jb20iLCJ1bmlxdWVJZCI6Mjc1fQ.mhHDv1GlTER4ytlZN6-orlnjir8P0YgJeN1BhTT2Z94tkRuOAa9oRjgFXQfPeYfOQPdPkYvgLZy5PN6nIIrwFQ \ No newline at end of file From 8b158e065c30b9a19ebe494a821a16ad16e8d05b Mon Sep 17 00:00:00 2001 From: Appini Akhil Date: Tue, 24 Dec 2024 11:52:33 +0530 Subject: [PATCH 04/14] changed nlp to Execute MySQL Select-Query on the connection DB_Connection_URL and store first column output into a variable-name --- .../src/main/java/com/testsigma/addons/android/Mysqlselect.java | 2 +- .../src/main/java/com/testsigma/addons/ios/Mysqlselect.java | 2 +- .../main/java/com/testsigma/addons/mobileweb/Mysqlselect.java | 2 +- .../src/main/java/com/testsigma/addons/web/Mysqlselect.java | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mysql_queries/src/main/java/com/testsigma/addons/android/Mysqlselect.java b/mysql_queries/src/main/java/com/testsigma/addons/android/Mysqlselect.java index 851e3e8b..bebb2ef2 100644 --- a/mysql_queries/src/main/java/com/testsigma/addons/android/Mysqlselect.java +++ b/mysql_queries/src/main/java/com/testsigma/addons/android/Mysqlselect.java @@ -17,7 +17,7 @@ import org.openqa.selenium.NoSuchElementException; @Data -@Action(actionText = "Execute MySQL Select-Query on the connection DB_Connection_URL and store output into a variable-name", +@Action(actionText = "Execute MySQL Select-Query on the connection DB_Connection_URL and store first column output into a variable-name", description = "This Action executes a given Select Query and stores the result(First cell data) into a provided runtime variable.", applicationType = ApplicationType.ANDROID) public class Mysqlselect extends WebAction { diff --git a/mysql_queries/src/main/java/com/testsigma/addons/ios/Mysqlselect.java b/mysql_queries/src/main/java/com/testsigma/addons/ios/Mysqlselect.java index 19ddcfe0..14a6c0f5 100644 --- a/mysql_queries/src/main/java/com/testsigma/addons/ios/Mysqlselect.java +++ b/mysql_queries/src/main/java/com/testsigma/addons/ios/Mysqlselect.java @@ -17,7 +17,7 @@ import org.openqa.selenium.NoSuchElementException; @Data -@Action(actionText = "Execute MySQL Select-Query on the connection DB_Connection_URL and store output into a variable-name", +@Action(actionText = "Execute MySQL Select-Query on the connection DB_Connection_URL and store first column output into a variable-name", description = "This Action executes a given Select Query and stores the result(First cell data) into a provided runtime variable.", applicationType = ApplicationType.IOS) public class Mysqlselect extends WebAction { diff --git a/mysql_queries/src/main/java/com/testsigma/addons/mobileweb/Mysqlselect.java b/mysql_queries/src/main/java/com/testsigma/addons/mobileweb/Mysqlselect.java index 328517b0..d9b0ca80 100644 --- a/mysql_queries/src/main/java/com/testsigma/addons/mobileweb/Mysqlselect.java +++ b/mysql_queries/src/main/java/com/testsigma/addons/mobileweb/Mysqlselect.java @@ -17,7 +17,7 @@ import org.openqa.selenium.NoSuchElementException; @Data -@Action(actionText = "Execute MySQL Select-Query on the connection DB_Connection_URL and store output into a variable-name", +@Action(actionText = "Execute MySQL Select-Query on the connection DB_Connection_URL and store first column output into a variable-name", description = "This Action executes a given Select Query and stores the result(First cell data) into a provided runtime variable.", applicationType = ApplicationType.MOBILE_WEB) public class Mysqlselect extends WebAction { diff --git a/mysql_queries/src/main/java/com/testsigma/addons/web/Mysqlselect.java b/mysql_queries/src/main/java/com/testsigma/addons/web/Mysqlselect.java index fbf859aa..0f16a99d 100644 --- a/mysql_queries/src/main/java/com/testsigma/addons/web/Mysqlselect.java +++ b/mysql_queries/src/main/java/com/testsigma/addons/web/Mysqlselect.java @@ -17,7 +17,7 @@ import org.openqa.selenium.NoSuchElementException; @Data -@Action(actionText = "Execute MySQL Select-Query on the connection DB_Connection_URL and store output into a variable-name", +@Action(actionText = "Execute MySQL Select-Query on the connection DB_Connection_URL and store first column output into a variable-name", description = "This Action executes a given Select Query and stores the result(First cell data) into a provided runtime variable.", applicationType = ApplicationType.WEB) public class Mysqlselect extends WebAction { From 1a0b347524f82d1356af024abf4664f689040e9f Mon Sep 17 00:00:00 2001 From: akhil-testsigma Date: Tue, 24 Dec 2024 12:12:42 +0530 Subject: [PATCH 05/14] Delete mysql_queries/src/main/java/com/testsigma/addons/android/Mysqlselect.java --- .../testsigma/addons/android/Mysqlselect.java | 60 ------------------- 1 file changed, 60 deletions(-) delete mode 100644 mysql_queries/src/main/java/com/testsigma/addons/android/Mysqlselect.java diff --git a/mysql_queries/src/main/java/com/testsigma/addons/android/Mysqlselect.java b/mysql_queries/src/main/java/com/testsigma/addons/android/Mysqlselect.java deleted file mode 100644 index bebb2ef2..00000000 --- a/mysql_queries/src/main/java/com/testsigma/addons/android/Mysqlselect.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.testsigma.addons.android; - -import com.testsigma.sdk.Result; -import com.testsigma.sdk.WebAction; -import com.testsigma.addons.mysql.util.DatabaseUtil; -import com.testsigma.sdk.ApplicationType; -import com.testsigma.sdk.annotation.Action; -import com.testsigma.sdk.annotation.RunTimeData; -import com.testsigma.sdk.annotation.TestData; -import lombok.Data; - -import java.sql.Connection; -import java.sql.ResultSet; -import java.sql.Statement; - -import org.apache.commons.lang3.exception.ExceptionUtils; -import org.openqa.selenium.NoSuchElementException; - -@Data -@Action(actionText = "Execute MySQL Select-Query on the connection DB_Connection_URL and store first column output into a variable-name", -description = "This Action executes a given Select Query and stores the result(First cell data) into a provided runtime variable.", -applicationType = ApplicationType.ANDROID) -public class Mysqlselect extends WebAction { - - @TestData(reference = "Select-Query") - private com.testsigma.sdk.TestData testData1; - @TestData(reference = "DB_Connection_URL") - private com.testsigma.sdk.TestData testData2; - @TestData(reference = "variable-name" , isRuntimeVariable = true) - private com.testsigma.sdk.TestData testData3; - @RunTimeData - private com.testsigma.sdk.RunTimeData runTimeData; - - @Override - public com.testsigma.sdk.Result execute() throws NoSuchElementException { - Result result = Result.SUCCESS; - logger.info("Initiating execution"); - DatabaseUtil databaseUtil = new DatabaseUtil(); - try{ - Connection connection = databaseUtil.getConnection(testData2.getValue().toString()); - Statement stmt = connection.createStatement(); - String query = testData1.getValue().toString(); - ResultSet resultSet = stmt.executeQuery(query); - resultSet.next(); - String resultData = resultSet.getObject(1).toString(); - runTimeData = new com.testsigma.sdk.RunTimeData(); - runTimeData.setValue(resultData); - runTimeData.setKey(testData3.getValue().toString()); - setSuccessMessage("Successfully Executed Select Query and Resultset is : " +resultData); - logger.info("Successfully Executed Select Query and Resultset is : " +resultData); - } - catch (Exception e){ - String errorMessage = ExceptionUtils.getStackTrace(e); - result = com.testsigma.sdk.Result.FAILED; - setErrorMessage(errorMessage); - logger.warn(errorMessage); - } - return result; - } -} \ No newline at end of file From bba8806711a2a5eb18042b56a6dfd758f7e1c1fa Mon Sep 17 00:00:00 2001 From: Appini Akhil Date: Tue, 24 Dec 2024 12:17:00 +0530 Subject: [PATCH 06/14] Revert "changed nlp to Execute MySQL Select-Query on the connection DB_Connection_URL and store first column output into a variable-name" This reverts commit 8b158e065c30b9a19ebe494a821a16ad16e8d05b. --- .../src/main/java/com/testsigma/addons/android/Mysqlselect.java | 2 +- .../src/main/java/com/testsigma/addons/ios/Mysqlselect.java | 2 +- .../main/java/com/testsigma/addons/mobileweb/Mysqlselect.java | 2 +- .../src/main/java/com/testsigma/addons/web/Mysqlselect.java | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mysql_queries/src/main/java/com/testsigma/addons/android/Mysqlselect.java b/mysql_queries/src/main/java/com/testsigma/addons/android/Mysqlselect.java index bebb2ef2..851e3e8b 100644 --- a/mysql_queries/src/main/java/com/testsigma/addons/android/Mysqlselect.java +++ b/mysql_queries/src/main/java/com/testsigma/addons/android/Mysqlselect.java @@ -17,7 +17,7 @@ import org.openqa.selenium.NoSuchElementException; @Data -@Action(actionText = "Execute MySQL Select-Query on the connection DB_Connection_URL and store first column output into a variable-name", +@Action(actionText = "Execute MySQL Select-Query on the connection DB_Connection_URL and store output into a variable-name", description = "This Action executes a given Select Query and stores the result(First cell data) into a provided runtime variable.", applicationType = ApplicationType.ANDROID) public class Mysqlselect extends WebAction { diff --git a/mysql_queries/src/main/java/com/testsigma/addons/ios/Mysqlselect.java b/mysql_queries/src/main/java/com/testsigma/addons/ios/Mysqlselect.java index 14a6c0f5..19ddcfe0 100644 --- a/mysql_queries/src/main/java/com/testsigma/addons/ios/Mysqlselect.java +++ b/mysql_queries/src/main/java/com/testsigma/addons/ios/Mysqlselect.java @@ -17,7 +17,7 @@ import org.openqa.selenium.NoSuchElementException; @Data -@Action(actionText = "Execute MySQL Select-Query on the connection DB_Connection_URL and store first column output into a variable-name", +@Action(actionText = "Execute MySQL Select-Query on the connection DB_Connection_URL and store output into a variable-name", description = "This Action executes a given Select Query and stores the result(First cell data) into a provided runtime variable.", applicationType = ApplicationType.IOS) public class Mysqlselect extends WebAction { diff --git a/mysql_queries/src/main/java/com/testsigma/addons/mobileweb/Mysqlselect.java b/mysql_queries/src/main/java/com/testsigma/addons/mobileweb/Mysqlselect.java index d9b0ca80..328517b0 100644 --- a/mysql_queries/src/main/java/com/testsigma/addons/mobileweb/Mysqlselect.java +++ b/mysql_queries/src/main/java/com/testsigma/addons/mobileweb/Mysqlselect.java @@ -17,7 +17,7 @@ import org.openqa.selenium.NoSuchElementException; @Data -@Action(actionText = "Execute MySQL Select-Query on the connection DB_Connection_URL and store first column output into a variable-name", +@Action(actionText = "Execute MySQL Select-Query on the connection DB_Connection_URL and store output into a variable-name", description = "This Action executes a given Select Query and stores the result(First cell data) into a provided runtime variable.", applicationType = ApplicationType.MOBILE_WEB) public class Mysqlselect extends WebAction { diff --git a/mysql_queries/src/main/java/com/testsigma/addons/web/Mysqlselect.java b/mysql_queries/src/main/java/com/testsigma/addons/web/Mysqlselect.java index 0f16a99d..fbf859aa 100644 --- a/mysql_queries/src/main/java/com/testsigma/addons/web/Mysqlselect.java +++ b/mysql_queries/src/main/java/com/testsigma/addons/web/Mysqlselect.java @@ -17,7 +17,7 @@ import org.openqa.selenium.NoSuchElementException; @Data -@Action(actionText = "Execute MySQL Select-Query on the connection DB_Connection_URL and store first column output into a variable-name", +@Action(actionText = "Execute MySQL Select-Query on the connection DB_Connection_URL and store output into a variable-name", description = "This Action executes a given Select Query and stores the result(First cell data) into a provided runtime variable.", applicationType = ApplicationType.WEB) public class Mysqlselect extends WebAction { From 9d2706e75c4febce83e11fc2de3ce7dfeefa9c6e Mon Sep 17 00:00:00 2001 From: Appini Akhil Date: Tue, 24 Dec 2024 12:21:31 +0530 Subject: [PATCH 07/14] added mysqlselect android --- .../src/main/java/com/testsigma/addons/android/Mysqlselect.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql_queries/src/main/java/com/testsigma/addons/android/Mysqlselect.java b/mysql_queries/src/main/java/com/testsigma/addons/android/Mysqlselect.java index 851e3e8b..bebb2ef2 100644 --- a/mysql_queries/src/main/java/com/testsigma/addons/android/Mysqlselect.java +++ b/mysql_queries/src/main/java/com/testsigma/addons/android/Mysqlselect.java @@ -17,7 +17,7 @@ import org.openqa.selenium.NoSuchElementException; @Data -@Action(actionText = "Execute MySQL Select-Query on the connection DB_Connection_URL and store output into a variable-name", +@Action(actionText = "Execute MySQL Select-Query on the connection DB_Connection_URL and store first column output into a variable-name", description = "This Action executes a given Select Query and stores the result(First cell data) into a provided runtime variable.", applicationType = ApplicationType.ANDROID) public class Mysqlselect extends WebAction { From 21d22da275a67d1554f685ddb7fb47a77ea19a68 Mon Sep 17 00:00:00 2001 From: Appini Akhil Date: Tue, 24 Dec 2024 12:22:18 +0530 Subject: [PATCH 08/14] added Mysqlselect.java file --- .../testsigma/addons/android/Mysqlselect.java | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 mysql_queries/src/main/java/com/testsigma/addons/android/Mysqlselect.java diff --git a/mysql_queries/src/main/java/com/testsigma/addons/android/Mysqlselect.java b/mysql_queries/src/main/java/com/testsigma/addons/android/Mysqlselect.java new file mode 100644 index 00000000..bebb2ef2 --- /dev/null +++ b/mysql_queries/src/main/java/com/testsigma/addons/android/Mysqlselect.java @@ -0,0 +1,60 @@ +package com.testsigma.addons.android; + +import com.testsigma.sdk.Result; +import com.testsigma.sdk.WebAction; +import com.testsigma.addons.mysql.util.DatabaseUtil; +import com.testsigma.sdk.ApplicationType; +import com.testsigma.sdk.annotation.Action; +import com.testsigma.sdk.annotation.RunTimeData; +import com.testsigma.sdk.annotation.TestData; +import lombok.Data; + +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.Statement; + +import org.apache.commons.lang3.exception.ExceptionUtils; +import org.openqa.selenium.NoSuchElementException; + +@Data +@Action(actionText = "Execute MySQL Select-Query on the connection DB_Connection_URL and store first column output into a variable-name", +description = "This Action executes a given Select Query and stores the result(First cell data) into a provided runtime variable.", +applicationType = ApplicationType.ANDROID) +public class Mysqlselect extends WebAction { + + @TestData(reference = "Select-Query") + private com.testsigma.sdk.TestData testData1; + @TestData(reference = "DB_Connection_URL") + private com.testsigma.sdk.TestData testData2; + @TestData(reference = "variable-name" , isRuntimeVariable = true) + private com.testsigma.sdk.TestData testData3; + @RunTimeData + private com.testsigma.sdk.RunTimeData runTimeData; + + @Override + public com.testsigma.sdk.Result execute() throws NoSuchElementException { + Result result = Result.SUCCESS; + logger.info("Initiating execution"); + DatabaseUtil databaseUtil = new DatabaseUtil(); + try{ + Connection connection = databaseUtil.getConnection(testData2.getValue().toString()); + Statement stmt = connection.createStatement(); + String query = testData1.getValue().toString(); + ResultSet resultSet = stmt.executeQuery(query); + resultSet.next(); + String resultData = resultSet.getObject(1).toString(); + runTimeData = new com.testsigma.sdk.RunTimeData(); + runTimeData.setValue(resultData); + runTimeData.setKey(testData3.getValue().toString()); + setSuccessMessage("Successfully Executed Select Query and Resultset is : " +resultData); + logger.info("Successfully Executed Select Query and Resultset is : " +resultData); + } + catch (Exception e){ + String errorMessage = ExceptionUtils.getStackTrace(e); + result = com.testsigma.sdk.Result.FAILED; + setErrorMessage(errorMessage); + logger.warn(errorMessage); + } + return result; + } +} \ No newline at end of file From 5a35cdeb4dc4a9297ad7fb0c12ddb55ff819a677 Mon Sep 17 00:00:00 2001 From: Appini Akhil Date: Tue, 24 Dec 2024 12:26:06 +0530 Subject: [PATCH 09/14] made the nlp same as before --- .../src/main/java/com/testsigma/addons/android/Mysqlselect.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql_queries/src/main/java/com/testsigma/addons/android/Mysqlselect.java b/mysql_queries/src/main/java/com/testsigma/addons/android/Mysqlselect.java index bebb2ef2..851e3e8b 100644 --- a/mysql_queries/src/main/java/com/testsigma/addons/android/Mysqlselect.java +++ b/mysql_queries/src/main/java/com/testsigma/addons/android/Mysqlselect.java @@ -17,7 +17,7 @@ import org.openqa.selenium.NoSuchElementException; @Data -@Action(actionText = "Execute MySQL Select-Query on the connection DB_Connection_URL and store first column output into a variable-name", +@Action(actionText = "Execute MySQL Select-Query on the connection DB_Connection_URL and store output into a variable-name", description = "This Action executes a given Select Query and stores the result(First cell data) into a provided runtime variable.", applicationType = ApplicationType.ANDROID) public class Mysqlselect extends WebAction { From 61856158977223c5df4af0c5de272415c41a95e4 Mon Sep 17 00:00:00 2001 From: Appini Akhil Date: Tue, 24 Dec 2024 13:21:59 +0530 Subject: [PATCH 10/14] feat/CR-18087-SFTP Upload File and support file path from upload section --- sftp_upload_file/sftp_upload_file/pom.xml | 112 ++++++++++ .../testsigma/addons/web/SFTPUploadFile.java | 205 ++++++++++++++++++ .../main/resources/testsigma-sdk.properties | 1 + 3 files changed, 318 insertions(+) create mode 100644 sftp_upload_file/sftp_upload_file/pom.xml create mode 100644 sftp_upload_file/sftp_upload_file/src/main/java/com/testsigma/addons/web/SFTPUploadFile.java create mode 100644 sftp_upload_file/sftp_upload_file/src/main/resources/testsigma-sdk.properties diff --git a/sftp_upload_file/sftp_upload_file/pom.xml b/sftp_upload_file/sftp_upload_file/pom.xml new file mode 100644 index 00000000..d57b6a3c --- /dev/null +++ b/sftp_upload_file/sftp_upload_file/pom.xml @@ -0,0 +1,112 @@ + + + 4.0.0 + com.testsigma.addons + sftp_upload_file + 1.0.1 + jar + + + UTF-8 + 11 + 11 + 1.2.13_cloud + 5.8.0-M1 + 1.0.0 + 3.2.1 + 1.18.20 + + + + + + com.testsigma + testsigma-java-sdk + ${testsigma.sdk.version} + + + org.projectlombok + lombok + ${lombok.version} + true + + + org.junit.jupiter + junit-jupiter-api + ${junit.jupiter.version} + test + + + org.testng + testng + 6.14.3 + + + + org.seleniumhq.selenium + selenium-java + 4.14.1 + + + + io.appium + java-client + 9.0.0 + + + com.fasterxml.jackson.core + jackson-annotations + 2.13.0 + + + com.jcraft + jsch + 0.1.55 + + + com.github.mwiede + jsch + 0.2.16 + + + org.apache.commons + commons-lang3 + 3.14.0 + + + + + sftp_upload_file + + + org.apache.maven.plugins + maven-shade-plugin + 3.2.4 + + + package + + shade + + + + + + org.apache.maven.plugins + maven-source-plugin + ${maven.source.plugin.version} + + + attach-sources + + jar + + + + + + + diff --git a/sftp_upload_file/sftp_upload_file/src/main/java/com/testsigma/addons/web/SFTPUploadFile.java b/sftp_upload_file/sftp_upload_file/src/main/java/com/testsigma/addons/web/SFTPUploadFile.java new file mode 100644 index 00000000..a9879651 --- /dev/null +++ b/sftp_upload_file/sftp_upload_file/src/main/java/com/testsigma/addons/web/SFTPUploadFile.java @@ -0,0 +1,205 @@ +package com.testsigma.addons.web; + +import com.jcraft.jsch.*; +import com.testsigma.sdk.ApplicationType; +import com.testsigma.sdk.Result; +import com.testsigma.sdk.WindowsAction; +import com.testsigma.sdk.annotation.Action; +import com.testsigma.sdk.annotation.RunTimeData; +import com.testsigma.sdk.annotation.TestData; +import lombok.Data; +import org.apache.commons.lang3.exception.ExceptionUtils; +import org.openqa.selenium.NoSuchElementException; + +import java.io.*; +import java.net.URL; +import java.nio.file.Paths; + +@Data +@Action(actionText = "SFTP: Connect to SFTP server and upload a file. SFTP server details: Host: Host-Name, UserName: User-Name, Password: User-Password, Upload from Local-File-Path to Remote-Directory(ex: /C:/Users/username/Downloads) with file name Remote-File-Name. Uploaded file path will be stored in runtime variable: variable-name", + description = "Uploads a file from local system or URL to remote server using SFTP, and stores the uploaded file path in a runtime variable, ensuring matching extensions.", + applicationType = ApplicationType.WEB, + useCustomScreenshot = false) +public class SFTPUploadFile extends WindowsAction { + + @TestData(reference = "Host-Name") + private com.testsigma.sdk.TestData hostName; + + @TestData(reference = "User-Name") + private com.testsigma.sdk.TestData userName; + + @TestData(reference = "User-Password") + private com.testsigma.sdk.TestData userPassword; + + @TestData(reference = "Local-File-Path") + private com.testsigma.sdk.TestData localFilePath; // Local file path or URL + + @TestData(reference = "Remote-Directory") + private com.testsigma.sdk.TestData remoteDirectory; // Remote directory to upload to + + @TestData(reference = "Remote-File-Name") + private com.testsigma.sdk.TestData remoteFileName; // Remote file name after upload + + @TestData(reference = "variable-name", isRuntimeVariable = true) + private com.testsigma.sdk.TestData uploadedFilePath; // Runtime variable for storing uploaded file path + + @RunTimeData + private com.testsigma.sdk.RunTimeData runTimeData; + + // Method to convert Windows path to SFTP compatible format + private String convertToSFTPPath(String path) { + String os = System.getProperty("os.name").toLowerCase(); + + if (os.contains("win")) { + // For Windows, convert the path to SFTP style + // Example: "C:\\Users\\sam.isaac\\Downloads" -> "/C:/Users/sam.isaac/Downloads" + path = path.replace("\\", "/"); + if (path.matches("^[a-zA-Z]:.*")) { + path = "/" + path.substring(0, 1).toUpperCase() + path.substring(2); + } + } + return path; + } + + @Override + public com.testsigma.sdk.Result execute() throws NoSuchElementException { + com.testsigma.sdk.Result result = com.testsigma.sdk.Result.SUCCESS; + logger.info("Initiating execution for SFTP file upload"); + + String user = userName.getValue().toString(); + String host = hostName.getValue().toString(); + String password = userPassword.getValue().toString(); + String localFile = localFilePath.getValue().toString(); + String remoteDir = remoteDirectory.getValue().toString(); + String remoteFile = remoteFileName.getValue().toString(); + File localFileToUpload = null; + + logger.info("remoteDir: " + remoteDir); + + // Convert paths to SFTP format (handles both local and remote paths) + remoteDir = convertToSFTPPath(remoteDir); + logger.info("Remote-Directory: " + remoteDir); + + JSch jsch = new JSch(); + ChannelSftp channelSftp = null; + Session session = null; + + try { + // Determine if the localFile is a URL or a local path + if (localFile.startsWith("http://") || localFile.startsWith("https://") || localFile.startsWith("file://")) { + localFileToUpload = downloadFile(localFile); + } else { + localFile = convertToSFTPPath(localFile); + localFileToUpload = new File(localFile); + } + + logger.info("Local-File-Path: " + localFileToUpload.getAbsolutePath()); + + + if (!localFileToUpload.exists()) { + setErrorMessage("Local file not found: " + localFile); + return Result.FAILED; + } + + String localFileName = localFileToUpload.getName(); + String fileExtension = ""; + int dotIndex = localFileName.lastIndexOf('.'); + if (dotIndex > 0) { + fileExtension = localFileName.substring(dotIndex); + } + + // Append extension if remote file name has no extension + if (!remoteFile.contains(".")) { + remoteFile += fileExtension; + logger.info("Remote file name updated to include extension: " + remoteFile); + }else{ + //check if extensions match + int remoteDotIndex = remoteFile.lastIndexOf('.'); + String remoteFileExtension = ""; + if(remoteDotIndex >0 ){ + remoteFileExtension = remoteFile.substring(remoteDotIndex); + if(!remoteFileExtension.equalsIgnoreCase(fileExtension)){ + setErrorMessage("Input and output file extensions do not match: " + fileExtension + " and "+ remoteFileExtension); + return Result.FAILED; + } + + } + } + + + // Setting up the session for SFTP connection + session = jsch.getSession(user, host); + session.setPassword(password); + + // Avoid host key checking (for simplicity) + java.util.Properties config = new java.util.Properties(); + config.put("StrictHostKeyChecking", "no"); + session.setConfig(config); + session.connect(); + logger.info("Session connected."); + + // Setting up the SFTP channel + channelSftp = (ChannelSftp) session.openChannel("sftp"); + channelSftp.connect(); + logger.info("SFTP channel connected."); + + // Check if the remote directory exists + try { + channelSftp.cd(remoteDir); + logger.info("Remote directory exists: " + remoteDir); + } catch (SftpException e) { + // If the directory does not exist, create it + logger.warn("Remote directory does not exist, creating: " + remoteDir); + channelSftp.mkdir(remoteDir); + channelSftp.cd(remoteDir); + } + + // Upload the file from the local machine to the remote server + String FilePath = null; + // Correct concatenation of remote directory and file name + FilePath = remoteDir.endsWith("/") ? remoteDir + remoteFile : remoteDir + "/" + remoteFile; + channelSftp.put(localFileToUpload.getAbsolutePath(), FilePath); + logger.info("File uploaded successfully to: " + FilePath); + + // Set success message and runtime data + setSuccessMessage("File uploaded successfully to: " + FilePath); + runTimeData.setKey(uploadedFilePath.getValue().toString()); + runTimeData.setValue(FilePath); + + } catch (Exception e) { + String errorStack = ExceptionUtils.getStackTrace(e); + logger.warn("Error occurred while uploading file: " + errorStack); + result = com.testsigma.sdk.Result.FAILED; + setErrorMessage("Error occurred during SFTP file upload: " + e.getMessage()); + } finally { + // Clean up and close connections + if (channelSftp != null && channelSftp.isConnected()) { + channelSftp.disconnect(); + } + if (session != null && session.isConnected()) { + session.disconnect(); + } + if (localFileToUpload != null && localFile.startsWith("http")) { + localFileToUpload.delete(); // delete temp file if it was a download + } + } + + return result; + } + + + private File downloadFile(String fileUrl) throws IOException { + URL url = new URL(fileUrl); + String fileName = Paths.get(url.getPath()).getFileName().toString(); + File tempFile = File.createTempFile("downloaded-", fileName); + try (InputStream in = url.openStream(); + OutputStream out = new FileOutputStream(tempFile)) { + byte[] buffer = new byte[1024]; + int bytesRead; + while ((bytesRead = in.read(buffer)) != -1) { + out.write(buffer, 0, bytesRead); + } + } + return tempFile; + } +} \ No newline at end of file diff --git a/sftp_upload_file/sftp_upload_file/src/main/resources/testsigma-sdk.properties b/sftp_upload_file/sftp_upload_file/src/main/resources/testsigma-sdk.properties new file mode 100644 index 00000000..d2a90b45 --- /dev/null +++ b/sftp_upload_file/sftp_upload_file/src/main/resources/testsigma-sdk.properties @@ -0,0 +1 @@ +testsigma-sdk.api.key=eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiIyMjMyMmM2Ni04NWYzLWIyN2UtN2FiOS0zM2U2M2Q4OWM1MGIiLCJ1bmlxdWVJZCI6IjM5NjEiLCJpZGVudGl0eUFjY291bnRVVUlkIjoiMzUifQ.l7GQjtQG-nlgdOW7sW_hoYM_1n3WW0qgLxAZWiHxFgJthQG3ENsUGXZwRRs9Ta2ppn5CloV2-5sDFoNdkKn8WQ \ No newline at end of file From e730fe5c04b4dbdf4723bf5c1737e6d0983d5e62 Mon Sep 17 00:00:00 2001 From: Appini Akhil Date: Tue, 24 Dec 2024 17:06:47 +0530 Subject: [PATCH 11/14] feat/TE-24019 - fixed the descending order and revamped the code --- validate_dateorder/pom.xml | 97 ++++++++++++++++ .../com/testsigma/addons/web/SortingDate.java | 108 ++++++++++++++++++ 2 files changed, 205 insertions(+) create mode 100644 validate_dateorder/pom.xml create mode 100644 validate_dateorder/src/main/java/com/testsigma/addons/web/SortingDate.java diff --git a/validate_dateorder/pom.xml b/validate_dateorder/pom.xml new file mode 100644 index 00000000..9641a953 --- /dev/null +++ b/validate_dateorder/pom.xml @@ -0,0 +1,97 @@ + + + 4.0.0 + com.testsigma.addons + validate_dateorder + 1.0.8 + jar + + + UTF-8 + 11 + 11 + 1.2.8_cloud + 5.8.0-M1 + 1.0.0 + 3.2.1 + 1.18.20 + + + + + + com.testsigma + testsigma-java-sdk + ${testsigma.sdk.version} + + + org.projectlombok + lombok + ${lombok.version} + true + + + org.junit.jupiter + junit-jupiter-api + ${junit.jupiter.version} + test + + + org.testng + testng + 6.14.3 + + + + org.seleniumhq.selenium + selenium-java + 4.14.1 + + + + io.appium + java-client + 9.0.0 + + + com.fasterxml.jackson.core + jackson-annotations + 2.13.0 + + + + + validate_dateorder + + + org.apache.maven.plugins + maven-shade-plugin + 3.2.4 + + + package + + shade + + + + + + org.apache.maven.plugins + maven-source-plugin + ${maven.source.plugin.version} + + + attach-sources + + jar + + + + + + + \ No newline at end of file diff --git a/validate_dateorder/src/main/java/com/testsigma/addons/web/SortingDate.java b/validate_dateorder/src/main/java/com/testsigma/addons/web/SortingDate.java new file mode 100644 index 00000000..fd0375cb --- /dev/null +++ b/validate_dateorder/src/main/java/com/testsigma/addons/web/SortingDate.java @@ -0,0 +1,108 @@ +package com.testsigma.addons.web; + +import com.testsigma.sdk.ApplicationType; +import com.testsigma.sdk.Result; +import com.testsigma.sdk.WebAction; +import com.testsigma.sdk.annotation.Action; +import com.testsigma.sdk.annotation.Element; +import com.testsigma.sdk.annotation.TestData; +import lombok.Data; +import org.openqa.selenium.NoSuchElementException; +import org.openqa.selenium.WebElement; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.*; + +@Data +@Action(actionText = "Verify if the column data is in Ascending/Descending order with specific format dateformat", + description = "Verifies if the data inside the column is in ascending or descending order with dateformat", + applicationType = ApplicationType.WEB) +public class SortingDate extends WebAction { + + @TestData(reference = "Ascending/Descending", allowedValues = {"ascending", "descending"}) + private com.testsigma.sdk.TestData operator; + @Element(reference = "column") + private com.testsigma.sdk.Element tableElement; + @TestData(reference = "dateformat") + private com.testsigma.sdk.TestData format; + + @Override + public Result execute() throws NoSuchElementException { + + com.testsigma.sdk.Result result = com.testsigma.sdk.Result.SUCCESS; + String operatorString = operator.getValue().toString(); + String formatdata = format.getValue().toString(); + + try { + List wb = driver.findElements(tableElement.getBy()); + + List beforeSort = new ArrayList<>(); + for (WebElement e : wb) { + beforeSort.add(e.getText()); + } + + List afterSort = new ArrayList<>(beforeSort); + DateComparator comparator = new DateComparator(formatdata); + + boolean isAscending = operatorString.equalsIgnoreCase("ascending"); + + if (isAscending) { + Collections.sort(afterSort, comparator); // Sort in ascending for ascending case + } else { + Collections.sort(afterSort,Collections.reverseOrder(comparator)); //Sort in descending for descending case + } + + if (isSorted(beforeSort, afterSort, isAscending)) { + logger.info("After sort data: " + afterSort); + logger.info("Before sort data: " + beforeSort); + setSuccessMessage("Assertion passed, the column is in " + operatorString + " order"); + + } else { + result = com.testsigma.sdk.Result.FAILED; + logger.warn("After sort data: " + afterSort); + logger.warn("Before sort data: " + beforeSort); + setErrorMessage("Assertion not passed, the column is not in " + operatorString + " order"); + } + } catch (Exception e) { + e.printStackTrace(); + logger.debug(e.getMessage() + e.getCause()); + result = com.testsigma.sdk.Result.FAILED; + setErrorMessage("Sorting Operation failed. Please check if the column is sorted in " + operatorString); + } + return result; + } + + public class DateComparator implements Comparator { + private SimpleDateFormat dateFormat; + + public DateComparator(String format) { + this.dateFormat = new SimpleDateFormat(format); + } + + public int compare(String s1, String s2) { + try { + Date d1 = dateFormat.parse(s1); + Date d2 = dateFormat.parse(s2); + return d1.compareTo(d2); + } catch (ParseException e) { + e.printStackTrace(); + return 0; // Or throw an exception if parsing fails are critical + } + } + } + + private boolean isSorted(List original, List sorted, boolean ascending) throws ParseException { + if (original.size() != sorted.size()) { + return false; // If size are different then it is not sorted + } + + for (int i = 0; i < original.size(); i++) { + if (!original.get(i).equals(sorted.get(i))) { + return false; + } + } + return true; // If loop completes without returning false, then they are the same. + + } +} From 2e52112c1aabf914da7213a563f6b492ad9feba1 Mon Sep 17 00:00:00 2001 From: Appini Akhil Date: Wed, 25 Dec 2024 02:53:06 +0530 Subject: [PATCH 12/14] revamped the code --- .../com/testsigma/addons/web/SortingDate.java | 147 ++++++++++++------ 1 file changed, 97 insertions(+), 50 deletions(-) diff --git a/validate_dateorder/src/main/java/com/testsigma/addons/web/SortingDate.java b/validate_dateorder/src/main/java/com/testsigma/addons/web/SortingDate.java index fd0375cb..f7df6e51 100644 --- a/validate_dateorder/src/main/java/com/testsigma/addons/web/SortingDate.java +++ b/validate_dateorder/src/main/java/com/testsigma/addons/web/SortingDate.java @@ -7,23 +7,31 @@ import com.testsigma.sdk.annotation.Element; import com.testsigma.sdk.annotation.TestData; import lombok.Data; -import org.openqa.selenium.NoSuchElementException; -import org.openqa.selenium.WebElement; import java.text.ParseException; import java.text.SimpleDateFormat; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.Date; +import java.util.List; + +import org.openqa.selenium.NoSuchElementException; +import org.openqa.selenium.WebElement; +import org.testng.Assert; @Data -@Action(actionText = "Verify if the column data is in Ascending/Descending order with specific format dateformat", - description = "Verifies if the data inside the column is in ascending or descending order with dateformat", +@Action(actionText = "Verify4 if the column data is in Ascending/Descending order with specific format dateformat", + description = "Verifies if the data inside the column is in ascending or descending order with date format", applicationType = ApplicationType.WEB) public class SortingDate extends WebAction { @TestData(reference = "Ascending/Descending", allowedValues = {"ascending", "descending"}) private com.testsigma.sdk.TestData operator; + @Element(reference = "column") private com.testsigma.sdk.Element tableElement; + @TestData(reference = "dateformat") private com.testsigma.sdk.TestData format; @@ -34,42 +42,76 @@ public Result execute() throws NoSuchElementException { String operatorString = operator.getValue().toString(); String formatdata = format.getValue().toString(); - try { - List wb = driver.findElements(tableElement.getBy()); - - List beforeSort = new ArrayList<>(); - for (WebElement e : wb) { - beforeSort.add(e.getText()); - } - - List afterSort = new ArrayList<>(beforeSort); - DateComparator comparator = new DateComparator(formatdata); - - boolean isAscending = operatorString.equalsIgnoreCase("ascending"); - - if (isAscending) { - Collections.sort(afterSort, comparator); // Sort in ascending for ascending case - } else { - Collections.sort(afterSort,Collections.reverseOrder(comparator)); //Sort in descending for descending case - } - - if (isSorted(beforeSort, afterSort, isAscending)) { - logger.info("After sort data: " + afterSort); - logger.info("Before sort data: " + beforeSort); - setSuccessMessage("Assertion passed, the column is in " + operatorString + " order"); - - } else { - result = com.testsigma.sdk.Result.FAILED; - logger.warn("After sort data: " + afterSort); - logger.warn("Before sort data: " + beforeSort); - setErrorMessage("Assertion not passed, the column is not in " + operatorString + " order"); - } - } catch (Exception e) { - e.printStackTrace(); - logger.debug(e.getMessage() + e.getCause()); - result = com.testsigma.sdk.Result.FAILED; - setErrorMessage("Sorting Operation failed. Please check if the column is sorted in " + operatorString); + switch (operatorString) { + case "ascending": + try { + List wb = driver.findElements(tableElement.getBy()); + List beforesort = new ArrayList<>(); + for (WebElement e : wb) { + String text = e.getText().trim(); + if (!text.isEmpty()) { + beforesort.add(text); + } + } + + List aftersort = new ArrayList<>(beforesort); + SortingDate.DateComparator comparator = new SortingDate.DateComparator(formatdata); + Collections.sort(aftersort, comparator); + + if (isSorted(beforesort, aftersort, true)) { + logger.info("After sort data " + aftersort); + logger.info("Before sort data " + beforesort); + setSuccessMessage("Assertion passed, the column is in ascending order"); + } else { + result = com.testsigma.sdk.Result.FAILED; + logger.warn("After sort data " + aftersort); + logger.warn("Before sort data " + beforesort); + setErrorMessage("Assertion failed, the column is not in ascending order"); + } + } catch (Exception e) { + e.printStackTrace(); + logger.debug(e.getMessage() + e.getCause()); + result = com.testsigma.sdk.Result.FAILED; + setErrorMessage("Sorting operation failed. Please check if the column is sorted in ascending order."); + } + break; + + case "descending": + try { + List wb = driver.findElements(tableElement.getBy()); + List beforesort = new ArrayList<>(); + for (WebElement e : wb) { + String text = e.getText().trim(); + if (!text.isEmpty()) { + beforesort.add(text); + } + } + + List aftersort = new ArrayList<>(beforesort); + SortingDate.DateComparator comparator = new SortingDate.DateComparator(formatdata); + Collections.sort(aftersort, comparator); + Collections.reverse(aftersort); + + if (isSorted(beforesort, aftersort, false)) { + logger.info("After sort data " + aftersort); + logger.info("Before sort data " + beforesort); + setSuccessMessage("Assertion passed, the column is in descending order"); + } else { + result = com.testsigma.sdk.Result.FAILED; + logger.warn("After sort data " + aftersort); + logger.warn("Before sort data " + beforesort); + setErrorMessage("Assertion failed, the column is not in descending order"); + } + + } catch (Exception e) { + e.printStackTrace(); + logger.debug(e.getMessage() + e.getCause()); + result = com.testsigma.sdk.Result.FAILED; + setErrorMessage("Sorting operation failed. Please check if the column is sorted in descending order."); + } + break; } + return result; } @@ -80,6 +122,7 @@ public DateComparator(String format) { this.dateFormat = new SimpleDateFormat(format); } + @Override public int compare(String s1, String s2) { try { Date d1 = dateFormat.parse(s1); @@ -87,22 +130,26 @@ public int compare(String s1, String s2) { return d1.compareTo(d2); } catch (ParseException e) { e.printStackTrace(); - return 0; // Or throw an exception if parsing fails are critical } + return 0; } } private boolean isSorted(List original, List sorted, boolean ascending) throws ParseException { - if (original.size() != sorted.size()) { - return false; // If size are different then it is not sorted - } - for (int i = 0; i < original.size(); i++) { - if (!original.get(i).equals(sorted.get(i))) { - return false; + Date date1 = new SimpleDateFormat(format.getValue().toString()).parse(original.get(i)); + Date date2 = new SimpleDateFormat(format.getValue().toString()).parse(sorted.get(i)); + + if (ascending) { + if (date1.compareTo(date2) > 0) { + return false; + } + } else { + if (date1.compareTo(date2) < 0) { + return false; + } } } - return true; // If loop completes without returning false, then they are the same. - + return true; } -} +} \ No newline at end of file From 1e79ab601086cadca327229872a6e9864918110e Mon Sep 17 00:00:00 2001 From: akhil-testsigma Date: Wed, 25 Dec 2024 14:54:43 +0530 Subject: [PATCH 13/14] Delete validate_dateorder/src/main/java/com/testsigma/addons/web/SortingDate.java --- .../com/testsigma/addons/web/SortingDate.java | 155 ------------------ 1 file changed, 155 deletions(-) delete mode 100644 validate_dateorder/src/main/java/com/testsigma/addons/web/SortingDate.java diff --git a/validate_dateorder/src/main/java/com/testsigma/addons/web/SortingDate.java b/validate_dateorder/src/main/java/com/testsigma/addons/web/SortingDate.java deleted file mode 100644 index f7df6e51..00000000 --- a/validate_dateorder/src/main/java/com/testsigma/addons/web/SortingDate.java +++ /dev/null @@ -1,155 +0,0 @@ -package com.testsigma.addons.web; - -import com.testsigma.sdk.ApplicationType; -import com.testsigma.sdk.Result; -import com.testsigma.sdk.WebAction; -import com.testsigma.sdk.annotation.Action; -import com.testsigma.sdk.annotation.Element; -import com.testsigma.sdk.annotation.TestData; -import lombok.Data; - -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.Date; -import java.util.List; - -import org.openqa.selenium.NoSuchElementException; -import org.openqa.selenium.WebElement; -import org.testng.Assert; - -@Data -@Action(actionText = "Verify4 if the column data is in Ascending/Descending order with specific format dateformat", - description = "Verifies if the data inside the column is in ascending or descending order with date format", - applicationType = ApplicationType.WEB) -public class SortingDate extends WebAction { - - @TestData(reference = "Ascending/Descending", allowedValues = {"ascending", "descending"}) - private com.testsigma.sdk.TestData operator; - - @Element(reference = "column") - private com.testsigma.sdk.Element tableElement; - - @TestData(reference = "dateformat") - private com.testsigma.sdk.TestData format; - - @Override - public Result execute() throws NoSuchElementException { - - com.testsigma.sdk.Result result = com.testsigma.sdk.Result.SUCCESS; - String operatorString = operator.getValue().toString(); - String formatdata = format.getValue().toString(); - - switch (operatorString) { - case "ascending": - try { - List wb = driver.findElements(tableElement.getBy()); - List beforesort = new ArrayList<>(); - for (WebElement e : wb) { - String text = e.getText().trim(); - if (!text.isEmpty()) { - beforesort.add(text); - } - } - - List aftersort = new ArrayList<>(beforesort); - SortingDate.DateComparator comparator = new SortingDate.DateComparator(formatdata); - Collections.sort(aftersort, comparator); - - if (isSorted(beforesort, aftersort, true)) { - logger.info("After sort data " + aftersort); - logger.info("Before sort data " + beforesort); - setSuccessMessage("Assertion passed, the column is in ascending order"); - } else { - result = com.testsigma.sdk.Result.FAILED; - logger.warn("After sort data " + aftersort); - logger.warn("Before sort data " + beforesort); - setErrorMessage("Assertion failed, the column is not in ascending order"); - } - } catch (Exception e) { - e.printStackTrace(); - logger.debug(e.getMessage() + e.getCause()); - result = com.testsigma.sdk.Result.FAILED; - setErrorMessage("Sorting operation failed. Please check if the column is sorted in ascending order."); - } - break; - - case "descending": - try { - List wb = driver.findElements(tableElement.getBy()); - List beforesort = new ArrayList<>(); - for (WebElement e : wb) { - String text = e.getText().trim(); - if (!text.isEmpty()) { - beforesort.add(text); - } - } - - List aftersort = new ArrayList<>(beforesort); - SortingDate.DateComparator comparator = new SortingDate.DateComparator(formatdata); - Collections.sort(aftersort, comparator); - Collections.reverse(aftersort); - - if (isSorted(beforesort, aftersort, false)) { - logger.info("After sort data " + aftersort); - logger.info("Before sort data " + beforesort); - setSuccessMessage("Assertion passed, the column is in descending order"); - } else { - result = com.testsigma.sdk.Result.FAILED; - logger.warn("After sort data " + aftersort); - logger.warn("Before sort data " + beforesort); - setErrorMessage("Assertion failed, the column is not in descending order"); - } - - } catch (Exception e) { - e.printStackTrace(); - logger.debug(e.getMessage() + e.getCause()); - result = com.testsigma.sdk.Result.FAILED; - setErrorMessage("Sorting operation failed. Please check if the column is sorted in descending order."); - } - break; - } - - return result; - } - - public class DateComparator implements Comparator { - private SimpleDateFormat dateFormat; - - public DateComparator(String format) { - this.dateFormat = new SimpleDateFormat(format); - } - - @Override - public int compare(String s1, String s2) { - try { - Date d1 = dateFormat.parse(s1); - Date d2 = dateFormat.parse(s2); - return d1.compareTo(d2); - } catch (ParseException e) { - e.printStackTrace(); - } - return 0; - } - } - - private boolean isSorted(List original, List sorted, boolean ascending) throws ParseException { - for (int i = 0; i < original.size(); i++) { - Date date1 = new SimpleDateFormat(format.getValue().toString()).parse(original.get(i)); - Date date2 = new SimpleDateFormat(format.getValue().toString()).parse(sorted.get(i)); - - if (ascending) { - if (date1.compareTo(date2) > 0) { - return false; - } - } else { - if (date1.compareTo(date2) < 0) { - return false; - } - } - } - return true; - } -} \ No newline at end of file From 4fecb65dbfda56b3de7cdc7f6c0061d915cd6e92 Mon Sep 17 00:00:00 2001 From: akhil-testsigma Date: Wed, 25 Dec 2024 14:55:08 +0530 Subject: [PATCH 14/14] Delete validate_dateorder/pom.xml --- validate_dateorder/pom.xml | 97 -------------------------------------- 1 file changed, 97 deletions(-) delete mode 100644 validate_dateorder/pom.xml diff --git a/validate_dateorder/pom.xml b/validate_dateorder/pom.xml deleted file mode 100644 index 9641a953..00000000 --- a/validate_dateorder/pom.xml +++ /dev/null @@ -1,97 +0,0 @@ - - - 4.0.0 - com.testsigma.addons - validate_dateorder - 1.0.8 - jar - - - UTF-8 - 11 - 11 - 1.2.8_cloud - 5.8.0-M1 - 1.0.0 - 3.2.1 - 1.18.20 - - - - - - com.testsigma - testsigma-java-sdk - ${testsigma.sdk.version} - - - org.projectlombok - lombok - ${lombok.version} - true - - - org.junit.jupiter - junit-jupiter-api - ${junit.jupiter.version} - test - - - org.testng - testng - 6.14.3 - - - - org.seleniumhq.selenium - selenium-java - 4.14.1 - - - - io.appium - java-client - 9.0.0 - - - com.fasterxml.jackson.core - jackson-annotations - 2.13.0 - - - - - validate_dateorder - - - org.apache.maven.plugins - maven-shade-plugin - 3.2.4 - - - package - - shade - - - - - - org.apache.maven.plugins - maven-source-plugin - ${maven.source.plugin.version} - - - attach-sources - - jar - - - - - - - \ No newline at end of file