Skip to content

Commit

Permalink
Started other changes
Browse files Browse the repository at this point in the history
Signed-off-by: John Eberhard <[email protected]>
  • Loading branch information
jeber-ibm committed Sep 14, 2024
1 parent 7aeb373 commit d2b0d73
Show file tree
Hide file tree
Showing 19 changed files with 176 additions and 7 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ For example, the following will run the AS400JPingTest.
```
java AS400JPingTest -lib <libraryForTest> -system <systemName> -uid <userId> -pwd <password> -pwrSys <privilegedUserid,privilegedPassword> -directory / -misc <testtype>,<release> -asp <IASPname>
```
A recent change also allows running a test with no parameters. The needed parameters are taken from environment variables or from a ini/defaults.ini file that resides in the current diretory. A test run will indicate where those values are obtained from.
```
Java AS400JPingTestcase
```
Here is an example of running the JDAcceptsURL testcase (replace the $... variables with the correct values).
```
java -cp JTOpen-test.jar:jt400.jar test.JDDriverTest -tc JDDriverAcceptsURL -lib JDTEST -system $SYS -uid $UID -pwd $PWD -pwrSys $PWRUID,$PWRSYS -directory / -misc toolbox,v7r5m0 -asp IASP33
Expand Down
9 changes: 9 additions & 0 deletions src/test/AS400/AS400NewInstance.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@
* public static AS400 newInstance(boolean useSSL, AS400 system)
**/
public class AS400NewInstance extends Testcase {
public static void main(String args[]) throws Exception {
String[] newArgs = new String[args.length+2];
newArgs[0] = "-tc";
newArgs[1] = "AS400NewInstance";
for (int i = 0; i < args.length; i++) {
newArgs[2+i]=args[i];
}
test.AS400Test.main(newArgs);
}

StringBuffer sb = new StringBuffer();
private Connection connection_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@
**/
public class AS400JDBCConnectionPoolBeanInfoTestcase extends Testcase
{
public static void main(String args[]) throws Exception {
String[] newArgs = new String[args.length+2];
newArgs[0] = "-tc";
newArgs[1] = "AS400JDBCConnectionPoolBeanInfoTestcase";
for (int i = 0; i < args.length; i++) {
newArgs[2+i]=args[i];
}
test.AS400JDBCConnectionPoolTest.main(newArgs);
}
// private AS400JDBCConnectionPool pool_;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@
**/
public class AS400JDBCConnectionPoolDataSourceBeanInfoTestcase extends Testcase
{
public static void main(String args[]) throws Exception {
String[] newArgs = new String[args.length+2];
newArgs[0] = "-tc";
newArgs[1] = "AS400JDBCConnectionPoolDataSourceBeanInfoTestcase";
for (int i = 0; i < args.length; i++) {
newArgs[2+i]=args[i];
}
test.AS400JDBCDataSourceTest.main(newArgs);
}

/**
Constructor. This is called from the AS400JDBCDataSourceTest constructor.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@
**/
public class AS400JDBCConnectionPoolDataSourceTestcase extends Testcase
{
public static void main(String args[]) throws Exception {
String[] newArgs = new String[args.length+2];
newArgs[0] = "-tc";
newArgs[1] = "AS400JDBCConnectionPoolDataSourceTestcase";
for (int i = 0; i < args.length; i++) {
newArgs[2+i]=args[i];
}
test.AS400JDBCDataSourceTest.main(newArgs);
}
private PrintWriter writer_ = null;
private String filename_ = "/tmp/poolds.log";
private String tag = null;
Expand Down
9 changes: 9 additions & 0 deletions src/test/AS400JDBC/AS400JDBCDataSourceBeanInfoTestcase.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@
**/
public class AS400JDBCDataSourceBeanInfoTestcase extends Testcase
{
public static void main(String args[]) throws Exception {
String[] newArgs = new String[args.length+2];
newArgs[0] = "-tc";
newArgs[1] = "AS400JDBCDataSourceBeanInfoTestcase";
for (int i = 0; i < args.length; i++) {
newArgs[2+i]=args[i];
}
test.AS400JDBCDataSourceTest.main(newArgs);
}

/**
Constructor. This is called from the AS400JDBCDataSourcePropertiesTest constructor.
Expand Down
9 changes: 9 additions & 0 deletions src/test/AS400JDBC/AS400JDBCDataSourcePropertiesTestcase.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@
**/
public class AS400JDBCDataSourcePropertiesTestcase extends Testcase
{
public static void main(String args[]) throws Exception {
String[] newArgs = new String[args.length+2];
newArgs[0] = "-tc";
newArgs[1] = "AS400JDBCDataSourcePropertiesTestcase";
for (int i = 0; i < args.length; i++) {
newArgs[2+i]=args[i];
}
test.AS400JDBCDataSourceTest.main(newArgs);
}
private static String logFileName = "/tmp/AS400JDBCDSPT.log";
private AS400JDBCDataSource dataSource_;
private DataSourcePropertyListener dataSourcePropertyListener_;
Expand Down
9 changes: 9 additions & 0 deletions src/test/AS400JDBC/AS400JDBCDataSourceSerialTestcase.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@
**/
public class AS400JDBCDataSourceSerialTestcase extends Testcase
{
public static void main(String args[]) throws Exception {
String[] newArgs = new String[args.length+2];
newArgs[0] = "-tc";
newArgs[1] = "AS400JDBCDataSourceSerialTestcase";
for (int i = 0; i < args.length; i++) {
newArgs[2+i]=args[i];
}
test.AS400JDBCDataSourceTest.main(newArgs);
}
// Environment variables.
private static final int OS_AS400 = 0;
private static final int OS_WINDOWS = 1;
Expand Down
9 changes: 9 additions & 0 deletions src/test/AS400JDBC/AS400JDBCDataSourceTestcase.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@
**/
public class AS400JDBCDataSourceTestcase extends Testcase
{
public static void main(String args[]) throws Exception {
String[] newArgs = new String[args.length+2];
newArgs[0] = "-tc";
newArgs[1] = "AS400JDBCDataSourceTestcase";
for (int i = 0; i < args.length; i++) {
newArgs[2+i]=args[i];
}
test.AS400JDBCDataSourceTest.main(newArgs);
}
// Environment variables.
private static final int OS_AS400 = 0;
private static final int OS_WINDOWS = 1;
Expand Down
9 changes: 9 additions & 0 deletions src/test/AS400JDBC/AS400JDBCMCPDSTestcase.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@
**/
public class AS400JDBCMCPDSTestcase extends Testcase
{
public static void main(String args[]) throws Exception {
String[] newArgs = new String[args.length+2];
newArgs[0] = "-tc";
newArgs[1] = "AS400JDBCMCPDSTestcase";
for (int i = 0; i < args.length; i++) {
newArgs[2+i]=args[i];
}
test.AS400JDBCDataSourceTest.main(newArgs);
}
private PrintWriter writer_ = null;
private String filename_ = "/tmp/poolds.log";
// private String tag = null;
Expand Down
9 changes: 9 additions & 0 deletions src/test/AS400JDBC/AS400JDBCMDSTestcase.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@
**/
public class AS400JDBCMDSTestcase extends Testcase
{
public static void main(String args[]) throws Exception {
String[] newArgs = new String[args.length+2];
newArgs[0] = "-tc";
newArgs[1] = "AS400JDBCMDSTestcase";
for (int i = 0; i < args.length; i++) {
newArgs[2+i]=args[i];
}
test.AS400JDBCDataSourceTest.main(newArgs);
}

public static String logFileName = "/tmp/AJCTS.log";
// Environment variables.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,15 @@
**/
public class AS400JDBCManagedConnectionPool2Testcase extends Testcase
{
public static void main(String args[]) throws Exception {
String[] newArgs = new String[args.length+2];
newArgs[0] = "-tc";
newArgs[1] = "AS400JDBCManagedConnectionPool2Testcase";
for (int i = 0; i < args.length; i++) {
newArgs[2+i]=args[i];
}
test.AS400JDBCConnectionPoolTest.main(newArgs);
}
private static final boolean DEBUG = false;

// If you turn this flag on, be sure to also turn on the following flag:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,15 @@
**/
public class AS400JDBCManagedConnectionPoolTestcase extends Testcase
{
public static void main(String args[]) throws Exception {
String[] newArgs = new String[args.length+2];
newArgs[0] = "-tc";
newArgs[1] = "AS400JDBCManagedConnectionPoolTestcase";
for (int i = 0; i < args.length; i++) {
newArgs[2+i]=args[i];
}
test.AS400JDBCConnectionPoolTest.main(newArgs);
}
private static final boolean DEBUG = true;

// If you turn this flag on, be sure to also turn on the following flag:
Expand Down
9 changes: 9 additions & 0 deletions src/test/AS400JDBC/AS400JDBCPooledConnectionTestcase.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@
**/
public class AS400JDBCPooledConnectionTestcase extends Testcase
{
public static void main(String args[]) throws Exception {
String[] newArgs = new String[args.length+2];
newArgs[0] = "-tc";
newArgs[1] = "AS400JDBCPooledConnectionTestcase";
for (int i = 0; i < args.length; i++) {
newArgs[2+i]=args[i];
}
test.AS400JDBCConnectionPoolTest.main(newArgs);
}
// private PrintWriter print = null;
// private String tag = null;
// private boolean rejectChange = false;
Expand Down
9 changes: 9 additions & 0 deletions src/test/AS400JDBC/AS400JDBCRowSetBeanInfoTestcase.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@
**/
public class AS400JDBCRowSetBeanInfoTestcase extends Testcase
{
public static void main(String args[]) throws Exception {
String[] newArgs = new String[args.length+2];
newArgs[0] = "-tc";
newArgs[1] = "AS400JDBCRowSetBeanInfoTestcase";
for (int i = 0; i < args.length; i++) {
newArgs[2+i]=args[i];
}
test.AS400JDBCRowSetTest.main(newArgs);
}
private AS400JDBCRowSet rowset_;

/**
Expand Down
9 changes: 9 additions & 0 deletions src/test/AS400JDBC/AS400JDBCRowSetCtorTestcase.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@
**/
public class AS400JDBCRowSetCtorTestcase extends Testcase
{
public static void main(String args[]) throws Exception {
String[] newArgs = new String[args.length+2];
newArgs[0] = "-tc";
newArgs[1] = "AS400JDBCRowSetCtorTestcase";
for (int i = 0; i < args.length; i++) {
newArgs[2+i]=args[i];
}
test.AS400JDBCRowSetTest.main(newArgs);
}
private static final String JNDI_FILE = "com.sun.jndi.fscontext.RefFSContextFactory";
private static final String JNDI_LDAP = "com.ibm.jndi.LDAPCtxFactory";
private static final String TEST_FILE_NAME = "/tmp/AS400JDBCRowSetCtorTestcase.file";
Expand Down
9 changes: 9 additions & 0 deletions src/test/AS400JDBC/AS400JDBCRowSetTestcase.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@
**/
public class AS400JDBCRowSetTestcase extends Testcase
{
public static void main(String args[]) throws Exception {
String[] newArgs = new String[args.length+2];
newArgs[0] = "-tc";
newArgs[1] = "AS400JDBCRowSetTestcase";
for (int i = 0; i < args.length; i++) {
newArgs[2+i]=args[i];
}
test.AS400JDBCRowSetTest.main(newArgs);
}
// Environment variables.
// private static final int OS_AS400 = 0;
// private static final int OS_WINDOWS = 1;
Expand Down
25 changes: 18 additions & 7 deletions src/test/JTOpenDownloadDevJars.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ public static void main(String args[]) {
}

String disableSSL = System.getenv("DISABLESSL");
if (disableSSL != null) {
disableSSL = System.getProperty("DISABLESSL");
}
if (disableSSL != null) {
System.out.println("DISABLESSL set");
DisableSSL.go();
Expand All @@ -149,18 +152,19 @@ public static void main(String args[]) {
sql = "SELECT URL,"
+ "TIMESTAMP( SUBSTRING(UPDATED_AT,1,10) || ' ' || SUBSTRING(UPDATED_AT,12,8)) + CURRENT TIMEZONE AS UPDATED , "
+ "CURRENT TIMEZONE as CURRENT_TIMEZONE, "
+ " BRANCH"
+ " NAME, BRANCH"
+ " FROM JSON_TABLE( HTTP_GET('"+artifactsUrl+"','{\"headers\":{\"Accept\":\"application/vnd.github+json\"}, \"sslTolerate\":true}'), '$.artifacts[*]' "
+ "COLUMNS ( "
+ "URL VARCHAR(200) CCSID 1208 PATH '$.url', "
+ "UPDATED_AT VARCHAR(40) PATH '$.updated_at', "
+ "NAME VARCHAR(40) PATH '$.name',"
+ "BRANCH VARCHAR(120) PATH '$.workflow_run.head_branch' )) "
+ "ORDER BY UPDATED_AT desc FETCH FIRST 10 ROWS ONLY";
System.out.println("FYI: Latests artifacts are the following: "+sql);
ResultSet rs = stmt.executeQuery(sql);
System.out.println("URL,UPDATED_CURRENT_TIMEZONE,TIMEZONE,BRANCH");
System.out.println("URL,UPDATED_CURRENT_TIMEZONE,TIMEZONE,NAME,BRANCH");
while (rs.next()) {
System.out.println(rs.getString(1)+","+rs.getTimestamp(2)+","+rs.getString(3)+","+rs.getString(4));
System.out.println(rs.getString(1)+","+rs.getTimestamp(2)+","+rs.getString(3)+","+rs.getString(4)+","+rs.getString(5));
}
rs.close();
// run the query to get the latest URL
Expand All @@ -172,13 +176,20 @@ public static void main(String args[]) {
+ "COLUMNS ( "
+ "URL VARCHAR(200) CCSID 1208 PATH '$.url', "
+ "UPDATED_AT VARCHAR(40) PATH '$.updated_at', "
+ "BRANCH VARCHAR(120) PATH '$.workflow_run.head_branch' )) WHERE BRANCH='main' ORDER BY UPDATED_AT desc FETCH FIRST 1 ROWS ONLY";
+ "NAME VARCHAR(40) PATH '$.name',"
+ "BRANCH VARCHAR(120) PATH '$.workflow_run.head_branch' )) WHERE BRANCH='main' AND NAME='Package' ORDER BY UPDATED_AT desc FETCH FIRST 1 ROWS ONLY";
} else if ("ANY".equalsIgnoreCase(branch)) {
sql = "SELECT * FROM JSON_TABLE( HTTP_GET('"+artifactsUrl+"','{\"headers\":{\"Accept\":\"application/vnd.github+json\"}, \"sslTolerate\":true}'), '$.artifacts[*]' COLUMNS ( URL VARCHAR(200) CCSID 1208 PATH '$.url', UPDATED_AT VARCHAR(40) PATH '$.updated_at', BRANCH VARCHAR(120) PATH '$.workflow_run.head_branch' )) ORDER BY UPDATED_AT desc FETCH FIRST 1 ROWS ONLY";
sql = "SELECT * FROM JSON_TABLE( HTTP_GET('"+artifactsUrl+"','{\"headers\":{\"Accept\":\"application/vnd.github+json\"}, \"sslTolerate\":true}'), '$.artifacts[*]' "
+ "COLUMNS ( URL VARCHAR(200) CCSID 1208 PATH '$.url', UPDATED_AT VARCHAR(40) PATH '$.updated_at', "
+ "NAME VARCHAR(40) PATH '$.name',"
+ "BRANCH VARCHAR(120) PATH '$.workflow_run.head_branch' )) WHERE NAME='Package' ORDER BY UPDATED_AT desc FETCH FIRST 1 ROWS ONLY";
} else {
sql = "SELECT * FROM JSON_TABLE( HTTP_GET('"+artifactsUrl+"','{\"headers\":{\"Accept\":\"application/vnd.github+json\"}, \"sslTolerate\":true}'), '$.artifacts[*]' COLUMNS ( URL VARCHAR(200) CCSID 1208 PATH '$.url', UPDATED_AT VARCHAR(40) PATH '$.updated_at', BRANCH VARCHAR(120) PATH '$.workflow_run.head_branch' )) WHERE BRANCH='"+branch+"' ORDER BY UPDATED_AT desc FETCH FIRST 1 ROWS ONLY";
sql = "SELECT * FROM JSON_TABLE( HTTP_GET('"+artifactsUrl+"','{\"headers\":{\"Accept\":\"application/vnd.github+json\"}, \"sslTolerate\":true}'), '$.artifacts[*]' "
+ "COLUMNS ( URL VARCHAR(200) CCSID 1208 PATH '$.url', UPDATED_AT VARCHAR(40) PATH '$.updated_at', "
+ "NAME VARCHAR(40) PATH '$.name',"
+ "BRANCH VARCHAR(120) PATH '$.workflow_run.head_branch' )) WHERE NAME='Package' and BRANCH='"+branch+"' ORDER BY UPDATED_AT desc FETCH FIRST 1 ROWS ONLY";
}
System.out.println("Running to get latest artifact from BRANCH: "+sql);
System.out.println("Running to get latest Package artifact from BRANCH: "+sql);
rs = stmt.executeQuery(sql);
String downloadUrl;
String updatedAt;
Expand Down
10 changes: 10 additions & 0 deletions src/test/MiscAH/AS400JPingTestcase.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@
**/
public class AS400JPingTestcase extends Testcase
{
public static void main(String args[]) throws Exception {
String[] newArgs = new String[args.length+2];
newArgs[0] = "-tc";
newArgs[1] = "AS400JPingTestcase";
for (int i = 0; i < args.length; i++) {
newArgs[2+i]=args[i];
}
test.AS400JPingTest.main(newArgs);
}

boolean deleteFile(String fileName)
{
try
Expand Down

0 comments on commit d2b0d73

Please sign in to comment.