Configure log4j to write logs to local filesystem – FileAppender
Three main components that needs to be configured in log4j.properties file are: 1. logger => log messages. 2. appender => specifies the output destination like console or a file....
Three main components that needs to be configured in log4j.properties file are: 1. logger => log messages. 2. appender => specifies the output destination like console or a file....
Following code snippet can be used to convert an Array to Map in java import org.apache.commons.lang3.ArrayUtils; import java.util.Map; import java.util.Map.Entry; import java.util.Set; public class ArraysToMap { public static void...
// Create DesiredCapabilities class object DesiredCapabilities cap=DesiredCapabilities.chrome(); // Set ACCEPT_SSL_CERTS variable to true cap.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true); // Set the driver path System.setProperty(“webdriver.chrome.driver”,”Chrome driver path”); // Open browser with capability WebDriver...
In order to invoke a task / function periodically (say every one minute) we can use following code snippet. Step 1: Create a class which calls “function” to be...
Following code snippet can be used to compare two Maps package map; import java.util.HashMap; import java.util.Map; public class ComparingMaps { public static void main(String args) { Map map1 =...
Following code snippet can be used to read an entire Excel file as HashMap import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import...
mvn archetype:generate -DarchetypeArtifactId=maven.archetype.quickstart -DgroupId=org.example -DartifactId=skeleton.web.services -DinteractiveMode=false mvn spring-boot:run mvn clean package and java -jar target/skeleton.web.services-1.0-SNAPSHOT.jar
/* * Read all contents of atmTransactionFile into Map<index, List<String, String>> */ public Map<Integer, List<String>> readCSVFile(String fileName) { int rowdata1= 0; String csvRow = null; List<String> rowData = new...
/* * Get number of columns in a CSV File Input: CSVFileName Output: integer * numberOfColumns or numberOfHeaders */ public int getNumberOfColumns(String fileName) { int columns = 0; String...
/* * Get row number where first column contains specific value */ public int getRowId(String fileName, String valueToSearch) { int rows = 0; String currentRow; try (BufferedReader csvDataFile =...