This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--To center an image--> | |
<p align="center"> | |
![alt]() | |
</p> | |
<!--To right align an image--> | |
<p align="right"> | |
![alt]() | |
</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package Base.db_connection; | |
import org.json.JSONObject; | |
import java.sql.*; | |
import static Base.TestPropertiesLoader.getDbConnectionDetails; | |
public class DbConnection { | |
public Connection con = null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.json.JSONArray; | |
import org.json.JSONObject; | |
import java.sql.ResultSet; | |
import java.text.DecimalFormat; | |
import java.text.DecimalFormatSymbols; | |
import java.util.Locale; | |
/** | |
* Utility for converting ResultSets into some Output formats |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.net.*; | |
import java.util.ArrayList; | |
import java.util.HashMap; | |
import java.io.IOException; | |
/** | |
* this class is needed for Java to connect to SOCKS proxy server | |
* Unfortunately Java cannot resolve remote DNS and therefore, when we set System.properties | |
* with our proxy server details, we hit incorrect server . This is because | |
* Java is connecting to Proxy, but DNS is resolving with system details and therefore goes to server directly. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import yaml | |
import json | |
yml = "file_path" | |
data = yaml.load(open(yml,'r')) | |
json = json.dumps(data) | |
print(json) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static JSONObject getJSONFromFile(String path) throws JSONException, IOException, ParseException { | |
JSONParser parser = new JSONParser(); | |
Object obj = parser.parse(new FileReader(path)); | |
return new JSONObject(obj.toString()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void refreshPage(){ | |
driver.navigate().refresh(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This method allows to generate time stamp with predefined format, but not only from today, but from date that we | |
* pass as a parameter to the method. | |
* If days = 0 , then we return current date stamp | |
* If number is > 0, then we return date in the future | |
* If number is < 0 then we return date from the past | |
* @param days number of days since stated date | |
* @param format it's a format in which date string will be returned | |
* @return date as a String | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This method will return as a date string of the last day of the month. | |
* @param month if 0 then we look for current month | |
* @param format format in which date should be returned as a string | |
* @return | |
*/ | |
public static String getEndOfTheMonth(int month, String format){ | |
SimpleDateFormat dateFormat = new SimpleDateFormat(format); | |
Date today = new Date(); | |
Calendar calendar = Calendar.getInstance(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static String getResourcePath(String relativePath) { | |
return new Utils().getClass().getResource("/").getPath() + relativePath; | |
} |