diff --git a/src/test/AS400JDBC/AS400JDBCConnectionPoolDataSourceBeanInfoTestcase.java b/src/test/AS400JDBC/AS400JDBCConnectionPoolDataSourceBeanInfoTestcase.java index 62476f4..7c31e8c 100644 --- a/src/test/AS400JDBC/AS400JDBCConnectionPoolDataSourceBeanInfoTestcase.java +++ b/src/test/AS400JDBC/AS400JDBCConnectionPoolDataSourceBeanInfoTestcase.java @@ -464,7 +464,7 @@ public void Var009() BeanInfo[] bis = bi.getAdditionalBeanInfo(); PropertyDescriptor[] pd = bis[0].getPropertyDescriptors(); - if (pd.length != 113) //@A1C //@A5C //@A6C //@B1C //@C1C //@PDC //@D1C //@PDC //@D3C @ac1 cc1 @dmy 91=query replace truncated parameter + if (pd.length != 115) { failMessage.append("Wrong number of property descriptors returned: " + String.valueOf(pd.length)+"\n"); passed = false; @@ -597,7 +597,12 @@ public void Var009() propertyTypes.put("maxRetriesForClientReroute","int"); propertyTypes.put("retryIntervalForClientReroute","int"); propertyTypes.put("enableSeamlessFailover","int"); - +propertyTypes.put("additionalAuthenticationFactore", "[C"); +propertyTypes.put("stayAlive", "int"); + + + + for (int i=0; i< pd.length; i++) { String value = (String)propertyTypes.get(pd[i].getName()); @@ -725,7 +730,8 @@ public void Var009() getPropertyMethods.put("maxRetriesForClientReroute","getMaxRetriesForClientReroute"); getPropertyMethods.put("retryIntervalForClientReroute","getRetryIntervalForClientReroute"); getPropertyMethods.put("enableSeamlessFailover","getEnableSeamlessFailover"); - +getPropertyMethods.put("additionalAuthenticationFactor","getAdditionalAuthenticationFactor"); +getPropertyMethods.put("stayAlive","getStayAlive"); for (int i=0; i< pd.length; i++) @@ -887,7 +893,8 @@ public void Var009() setPropertyMethods.put("maxRetriesForClientReroute","setMaxRetriesForClientReroute"); setPropertyMethods.put("retryIntervalForClientReroute","setRetryIntervalForClientReroute"); setPropertyMethods.put("enableSeamlessFailover","setEnableSeamlessFailover"); - +setPropertyMethods.put("additionalAuthenticationFactor","setAdditionalAuthenticationFactor"); +setPropertyMethods.put("stayAlive","setStayAlive"); Properties setPropertyMethods2 = new Properties() ; @@ -1063,7 +1070,9 @@ public void Var009() propertyShortDescs.put("maxRetriesForClientReroute","The maximum number of connection retries for automatic client reroute."); propertyShortDescs.put("retryIntervalForClientReroute","The number of seconds between consecutive connection retries."); propertyShortDescs.put("enableSeamlessFailover","Specifies whether the JTOpen JDBC driver uses seamless failover for client reroute."); - + propertyShortDescs.put("additionalAuthenticationFactor","Specifies the additional authentication factor to be used in conjunction with the password."); + propertyShortDescs.put("stayAlive","Specifies the number of seconds between pings to the Host Server. This is used to prevent a connection from being viewed as inactive."); + for (int i=0; i< pd.length; i++) { diff --git a/src/test/AS400JDBC/AS400JDBCRowSetTestcase.java b/src/test/AS400JDBC/AS400JDBCRowSetTestcase.java index ccb413e..51b542b 100644 --- a/src/test/AS400JDBC/AS400JDBCRowSetTestcase.java +++ b/src/test/AS400JDBC/AS400JDBCRowSetTestcase.java @@ -232,7 +232,7 @@ public void setup() env_.put("java.naming.security.credentials", authorityPwd_); //@A2A } //@A2A else - env_.put(Context.PROVIDER_URL,"file:."); //@pda for linux authority. default is "/" location of file created + env_.put(Context.PROVIDER_URL,"file:."); env_.put(Context.INITIAL_CONTEXT_FACTORY, jndiType_); diff --git a/src/test/JDCleanCore.java b/src/test/JDCleanCore.java index 529ae03..6ed8159 100644 --- a/src/test/JDCleanCore.java +++ b/src/test/JDCleanCore.java @@ -143,7 +143,7 @@ private static void cleanRelatedFiles(AS400 as400, IFSFile javacorefile) throws "Failed to create thread", }; - // Search strings in rder they are found in field + // Search strings in order they are found in field // Once the a string has been found, the algorithm will // try to find the remaining strings in the current set // without checking the other sets diff --git a/src/test/JDCleanSplfJdbc.java b/src/test/JDCleanSplfJdbc.java index ae5246c..6a97ffd 100644 --- a/src/test/JDCleanSplfJdbc.java +++ b/src/test/JDCleanSplfJdbc.java @@ -315,8 +315,8 @@ public static JDCleanSplfJdbcResults deleteUselessSpoolFiles(PrintStream out, Co } } - public static void runCleaningQuery(Statement stmt, String query, JDCleanSplfJdbc clean) throws SQLException { - System.out.println("Running query " + query); + public static void runCleaningQuery(PrintStream out, Statement stmt, String query, JDCleanSplfJdbc clean) throws SQLException { + out.println("Running query " + query); ResultSet rs = stmt.executeQuery(query); while (rs.next()) { @@ -357,7 +357,7 @@ public static JDCleanSplfJdbcResults deleteSpoolFilesAttempt(PrintStream out, Co + " FROM QSYS2 . OUTPUT_QUEUE_ENTRIES_BASIC WHERE CREATE_TIMESTAMP >= '" + startTimestamp.toString() + "'" + " AND CREATE_TIMESTAMP <= '" + endTimestamp.toString() + "'"; System.out.println(query); - runCleaningQuery(stmt, query, clean); + runCleaningQuery(out, stmt, query, clean); stmt.close(); } else { @@ -375,8 +375,8 @@ public static JDCleanSplfJdbcResults deleteSpoolFilesAttempt(PrintStream out, Co + " FROM QSYS2 . OUTPUT_QUEUE_ENTRIES_BASIC WHERE " + " USER_NAME IN (" + userInClause + ") AND " + " CREATE_TIMESTAMP >= '" + startTimestamp.toString() + "'" + " AND CREATE_TIMESTAMP <= '" + endTimestamp.toString() + "'"; - System.out.println(query); - runCleaningQuery(stmt, query, clean); + out.println(query); + runCleaningQuery(out,stmt, query, clean); stmt.close(); } long finishMillis = System.currentTimeMillis(); @@ -402,7 +402,7 @@ public static JDCleanSplfJdbcResults deleteUselessSpoolFilesAttempt(PrintStream String query = " SELECT USER_NAME, SPOOLED_FILE_NAME, FILE_NUMBER ,JOB_NAME , CREATE_TIMESTAMP , TOTAL_PAGES, SIZE , USER_DATA " + " FROM QSYS2 . OUTPUT_QUEUE_ENTRIES_BASIC WHERE CREATE_TIMESTAMP >= '" + startTimestamp.toString() + "'" + " AND CREATE_TIMESTAMP <= '" + endTimestamp.toString() + "'"; - runCleaningQuery(stmt, query, clean); + runCleaningQuery(out, stmt, query, clean); stmt.close(); System.out.println("Running query " + query); diff --git a/src/test/JDJSTPOutputThread.java b/src/test/JDJSTPOutputThread.java index 8ed2daa..f25c5bb 100644 --- a/src/test/JDJSTPOutputThread.java +++ b/src/test/JDJSTPOutputThread.java @@ -86,6 +86,9 @@ public void addOutputString(String currentString ) { } if (writer != null) { writer.print(currentString); + if (currentString.indexOf(TestDriver.RUN_COMPLETED) >= 0) { + flushOnce= true; + } if (doFlush || flushOnce ) { if (flushOnce) flushOnce = false; writer.flush(); diff --git a/src/test/JDReport.java b/src/test/JDReport.java index 33f42ee..5ec4190 100644 --- a/src/test/JDReport.java +++ b/src/test/JDReport.java @@ -123,15 +123,21 @@ public static String extractFDTestcase(String x) { /** * Return array containing the following information * - * @return String[0] Notatt Count String[1] Regressed Count String[2] Failed - * Count String[3] Success Count String[4] Regressed Testcases - * String[5] Run minutes String[6] Failed Testcases + * @return String[0] Notatt Count + * String[1] Regressed Count + * String[2] Failed Count + * String[3] Success Count + * String[4] Regressed Testcases + * String[5] Run minutes + * String[6] Failed Testcases + * String[7] Scheduled Count + * */ - public static String[] getStats(File htmlFile) { + public static String[] getStats(File htmlFile, Connection c) { int iRegressedCount = 0; int iFailedCount = 0; - String[] output = new String[7]; + String[] output = new String[8]; output[0] = "0"; output[1] = "Unknown"; output[2] = "Unknown"; @@ -139,6 +145,7 @@ public static String[] getStats(File htmlFile) { output[4] = ""; output[5] = "Unknown"; output[6] = ""; + output[7] = ""; StringBuffer regressedTestcases = new StringBuffer(); regressedTestcases.append(""); StringBuffer failedTestcases = new StringBuffer(); @@ -231,7 +238,24 @@ public static String[] getStats(File htmlFile) { output[6] = " in " + failedTestcasesCount + testsLabel; } - + + if (c != null) { + String filename = htmlFile.getName(); + int latestIndex = filename.indexOf("latest"); + int htmlIndex = filename.indexOf(".html"); + if (latestIndex >= 0 && htmlIndex > 0) { + String initials = filename.substring(6,htmlIndex); + String sql = "select count(*) from JDTESTINFO.SCHED1 WHERE INITIALS = ?"; + PreparedStatement ps = c.prepareStatement(sql); + ps.setString(1, initials); + ResultSet rs = ps.executeQuery(); + if (rs.next()) { + output[7] = rs.getString(1); + } + rs.close(); + ps.close(); + } + } reader.close(); } catch (Exception e) { e.printStackTrace(); @@ -239,12 +263,12 @@ public static String[] getStats(File htmlFile) { return output; } - public static String formatLine(String next, Timestamp jarTimestamp) { + public static String formatLine(String next, Timestamp jarTimestamp, Connection c) { File htmlFile = new File("ct/" + next); Timestamp changeDate = new Timestamp(htmlFile.lastModified()); String changeDateString = changeDate.toString(); String compactDateString = changeDateString.replace(' ', 'x'); - String[] stats = getStats(htmlFile); + String[] stats = getStats(htmlFile, c); long jarTime = 0; if (jarTimestamp != null) @@ -275,31 +299,36 @@ public static String formatLine(String next, Timestamp jarTimestamp) { returnString = "
" + changeDateString; } } + String schedCount = stats[7]; + if (Integer.parseInt(schedCount) > 0) { + schedCount=" ** " + schedCount + " ** "; + } + if ("0".equals(stats[0])) { returnString += "" + describeTest(next) + " Test Results"; if ("0".equals(stats[1])) { returnString += "" + stats[0] + "" + stats[1] + "" + stats[4] + "" + stats[2] + stats[6] - + "" + stats[3] + "" + stats[5]; + + "" + stats[3] + "" + stats[5]+ "" + schedCount; } else { returnString += "" + stats[0] + "" + stats[1] + stats[4] + "" + stats[2] + stats[6] + "" + stats[3] + "" - + stats[5]; + + stats[5]+ "" + schedCount; } } else { returnString += "" + describeTest(next) + " Test ResultsERROR " + stats[0] + "" + stats[1] + stats[4] + "" + stats[2] + stats[6] - + "" + stats[3] + "" + stats[5]; + + "" + stats[3] + "" + stats[5] + "" + schedCount; } return returnString; } public static String formatHeader() { - return "DateTestNotAttRegressedFailedSuccessRunMinutes"; + return "DateTestNotAttRegressedFailedSuccessRunMinutesScheduledCount"; } public static boolean isNativeJDBC(String initials) { @@ -678,7 +707,7 @@ public static String describeTest(String input) { return input + " " + description; } - public static void createIndex() throws Exception { + public static void createIndex(Connection nativeConnection) throws Exception { String filename = "ct/index.html"; System.out.println("Creating index file " + filename); @@ -745,7 +774,7 @@ public static void createIndex() throws Exception { while (iterator.hasNext()) { String next = (String) iterator.next(); if (isMustRun(next)) { - String line = formatLine(next, null); + String line = formatLine(next, null, nativeConnection); totalRunMinutes += getRunMinutesFromLine(line); sb.append(line); sb.append("\n"); @@ -760,11 +789,11 @@ public static void createIndex() throws Exception { String[] cliSuffixes = { "R.html", "S.html", "W.html", "Y.html", "Z.html" }; totalRunMinutes += addSection(writer, sortedSet, "CLI TESTING", cliSuffixes, - null); + null,nativeConnection); String[] jccSuffixes = { "J.html" }; totalRunMinutes += addSection(writer, sortedSet, "JCC TESTING ", - jccSuffixes, null); + jccSuffixes, null,nativeConnection); Timestamp nativeTimestamp = null; String nativeInfo = "db2_classes.jar:"; @@ -787,7 +816,7 @@ public static void createIndex() throws Exception { String[] jdbcNativeSuffixes = { "N.html", "M.html", "K.html" }; totalRunMinutes += addSection(writer, sortedSet, "JDBC NATIVE TESTING " + nativeInfo, jdbcNativeSuffixes, - nativeTimestamp); + nativeTimestamp,nativeConnection); nativeTimestamp = null; nativeInfo = "/home/jdbcsrcj/com/ibm/db2/jdbc/app/DB2Driver.class:"; @@ -806,7 +835,7 @@ public static void createIndex() throws Exception { String[] jdbcNativeDebugSuffixes = { "D.html" }; addSection(writer, sortedSet, "JDBC NATIVE DEBUG TESTING " + nativeInfo, - jdbcNativeDebugSuffixes, nativeTimestamp); + jdbcNativeDebugSuffixes, nativeTimestamp,nativeConnection); Timestamp jstpTimestamp = null; String jstpInfo = "db2_classes.jar:"; @@ -828,7 +857,7 @@ public static void createIndex() throws Exception { String[] jstpSuffixes = { "O.html" }; totalRunMinutes += addSection(writer, sortedSet, "JAVA STORED PROCEDURES TESTING " + jstpInfo, jstpSuffixes, - jstpTimestamp); + jstpTimestamp,nativeConnection); Timestamp toolboxTimestamp = null; Timestamp toolboxBuildTimestamp = null; @@ -913,49 +942,49 @@ public static void createIndex() throws Exception { "Q.html", "1.html", "2.html", "P.html", }; totalRunMinutes += addSection(writer, sortedSet, "JDBC TOOLBOX TESTING " + toolboxInfo, jdbcToolboxSuffixes, - toolboxTimestamp); + toolboxTimestamp,nativeConnection); String[] jdbcToolboxNativeSuffixes = { "U.html" }; totalRunMinutes += addSection(writer, sortedSet, "JDBC TOOLBOX NATIVE TESTING " + toolboxInfo, jdbcToolboxNativeSuffixes, - toolboxTimestamp); + toolboxTimestamp,nativeConnection); String[] toolboxProxySuffixes = { "V.html" }; totalRunMinutes += addSection(writer, sortedSet, "JDBC TOOLBOX PROXY TESTING " + toolboxInfo, toolboxProxySuffixes, - toolboxTimestamp); + toolboxTimestamp,nativeConnection); String[] toolboxSuffixes = { "A.html" }; totalRunMinutes += addSection(writer, sortedSet, - "TOOLBOX TESTING " + toolboxInfo, toolboxSuffixes, toolboxTimestamp); + "TOOLBOX TESTING " + toolboxInfo, toolboxSuffixes, toolboxTimestamp,nativeConnection); String[] toolboxNativeSuffixes = { "B.html" }; totalRunMinutes += addSection(writer, sortedSet, "TOOLBOX NATIVE TESTING " + toolboxInfo, toolboxNativeSuffixes, - toolboxTimestamp); + toolboxTimestamp,nativeConnection); String[] jtopenliteSuffixes = { "L.html" }; totalRunMinutes += addSection(writer, sortedSet, "JDBC jtopenlite TESTING " + jtopenliteInfo, jtopenliteSuffixes, - jtopenliteTimestamp); + jtopenliteTimestamp,nativeConnection); String[] androidSuffixes = { "G.html" }; totalRunMinutes += addSection(writer, sortedSet, "JDBC toolbox android TESTING " + jt400androidInfo, androidSuffixes, - jt400androidTimestamp); + jt400androidTimestamp,nativeConnection); String[] java11Strings = { "B6","BO" }; totalRunMinutes += addSection(writer, sortedSet, "JAVA 11 TESTING " + toolboxInfo+ " " + nativeInfo, java11Strings, - toolboxTimestamp); + toolboxTimestamp,nativeConnection); String[] java17Strings = { "C6" }; totalRunMinutes += addSection(writer, sortedSet, "JAVA 17 TESTING " + toolboxInfo+ " " + nativeInfo, java17Strings, - toolboxTimestamp); + toolboxTimestamp,nativeConnection); writer.println("
Total Run Minutes=" + totalRunMinutes @@ -973,7 +1002,7 @@ public static void createIndex() throws Exception { } - public static void createToolboxIndex() throws Exception { + public static void createToolboxIndex(Connection nativeConnection) throws Exception { String filename = "ct/toolbox.html"; System.out.println("Creating index file " + filename); @@ -1088,36 +1117,36 @@ public static void createToolboxIndex() throws Exception { "I.html", "1.html", "2.html" }; totalRunMinutes += addSection(writer, sortedSet, "JDBC TOOLBOX TESTING " + toolboxInfo, jdbcToolboxSuffixes, - toolboxTimestamp); + toolboxTimestamp,nativeConnection); String[] jdbcToolboxNativeSuffixes = { "U.html" }; totalRunMinutes += addSection(writer, sortedSet, "JDBC TOOLBOX NATIVE TESTING " + toolboxInfo, jdbcToolboxNativeSuffixes, - toolboxTimestamp); + toolboxTimestamp,nativeConnection); String[] toolboxProxySuffixes = { "V.html" }; totalRunMinutes += addSection(writer, sortedSet, "JDBC TOOLBOX PROXY TESTING " + toolboxInfo, toolboxProxySuffixes, - toolboxTimestamp); + toolboxTimestamp,nativeConnection); String[] toolboxSuffixes = { "A.html" }; totalRunMinutes += addSection(writer, sortedSet, - "TOOLBOX TESTING " + toolboxInfo, toolboxSuffixes, toolboxTimestamp); + "TOOLBOX TESTING " + toolboxInfo, toolboxSuffixes, toolboxTimestamp,nativeConnection); String[] toolboxNativeSuffixes = { "B.html" }; totalRunMinutes += addSection(writer, sortedSet, "TOOLBOX NATIVE TESTING " + toolboxInfo, toolboxNativeSuffixes, - toolboxTimestamp); + toolboxTimestamp,nativeConnection); String[] jtopenliteSuffixes = { "L.html" }; totalRunMinutes += addSection(writer, sortedSet, "JDBC jtopenlite TESTING " + jtopenliteInfo, jtopenliteSuffixes, - jtopenliteTimestamp); + jtopenliteTimestamp,nativeConnection); String[] androidSuffixes = { "G.html" }; totalRunMinutes += addSection(writer, sortedSet, "JDBC toolbox android TESTING " + jt400androidInfo, androidSuffixes, - jt400androidTimestamp); + jt400androidTimestamp,nativeConnection); writer.println("
Total Run Minutes=" + totalRunMinutes + " Total run hours=" + (totalRunMinutes / 60) + " Total run days=" @@ -1134,7 +1163,7 @@ public static void createToolboxIndex() throws Exception { } - public static void createNativeIndex() throws Exception { + public static void createNativeIndex(Connection nativeConnection) throws Exception { String filename = "ct/native.html"; System.out.println("Creating index file " + filename); @@ -1215,7 +1244,7 @@ public static void createNativeIndex() throws Exception { String[] jdbcNativeSuffixes = { "N.html", "P.html", "M.html" }; totalRunMinutes += addSection(writer, sortedSet, "JDBC NATIVE TESTING " + nativeInfo, jdbcNativeSuffixes, - nativeTimestamp); + nativeTimestamp,nativeConnection); writer.println("
Total Run Minutes=" + totalRunMinutes + " Total run hours=" + (totalRunMinutes / 60) + " Total run days=" @@ -1232,7 +1261,7 @@ public static void createNativeIndex() throws Exception { } - public static void createJvmIndex() throws Exception { + public static void createJvmIndex(Connection nativeConnection) throws Exception { String filename = "ct/jvm.html"; System.out.println("Creating index file " + filename); @@ -1309,7 +1338,7 @@ public static void createJvmIndex() throws Exception { String jvm = (String) iterator.next(); // System.out.println("Processing JVM "+jvm); - addJvmSection(writer, sortedSet, "JVM " + jvm, jvm, null); + addJvmSection(writer, sortedSet, "JVM " + jvm, jvm, null, nativeConnection); } @@ -1327,7 +1356,7 @@ public static void createJvmIndex() throws Exception { // return the run minutes public static double addJvmSection(PrintWriter writer, TreeSet sortedSet, - String header, String jvm, Timestamp jarTimestamp) { + String header, String jvm, Timestamp jarTimestamp, Connection nativeConnection) { int sectionCount = 0; StringBuffer sb = new StringBuffer(); double totalRunMinutes = 0.0; @@ -1345,7 +1374,7 @@ public static double addJvmSection(PrintWriter writer, TreeSet sortedSet String thisJvm = next.substring(latestIndex + 8, latestIndex + 10); // System.out.println("This JVM ="+thisJvm+" compare to "+jvm); if (thisJvm.equals(jvm)) { - String line = formatLine(next, jarTimestamp); + String line = formatLine(next, jarTimestamp, nativeConnection); sb.append(line); totalRunMinutes += getRunMinutesFromLine(line); @@ -1369,7 +1398,7 @@ public static double addJvmSection(PrintWriter writer, TreeSet sortedSet // return the run minutes public static double addSection(PrintWriter writer, TreeSet sortedSet, - String header, String[] suffixes, Timestamp jarTimestamp) { + String header, String[] suffixes, Timestamp jarTimestamp, Connection nativeConnection) { int sectionCount = 0; StringBuffer sb = new StringBuffer(); double totalRunMinutes = 0.0; @@ -1382,7 +1411,7 @@ public static double addSection(PrintWriter writer, TreeSet sortedSet, String next = (String) iterator.next(); for (int i = 0; i < suffixes.length; i++) { if ((next.indexOf(suffixes[i]) > 0)) { - String line = formatLine(next, jarTimestamp); + String line = formatLine(next, jarTimestamp, nativeConnection); sb.append(line); totalRunMinutes += getRunMinutesFromLine(line); @@ -1851,6 +1880,61 @@ public static void main(String args[]) { Timestamp compareTimestamp = null; String query = null; + String osName = System.getProperty("os.name"); + if ("OS/400".equals(osName)) { + /* check to see if anything is running */ + try { + PreparedStatement ps = connection.prepareStatement("SELECT CURRENT TIMESTAMP, ACTION,STARTED_TS FROM JDTESTINFO.SCRUN1 WHERE INITIALS=?"); + ps.setString(1, initials); + rs = ps.executeQuery(); + while (rs.next()) { + String test = rs.getString(2); + if (! "REPORT".equals(test) && (!"EMAIL".equals(test))) { + writer.println("

At "+ rs.getString(1) +" currently running: "+test+" started at "+rs.getString(3)+"

"); + break; + } + } + rs.close(); + ps.close(); + + ps = connection.prepareStatement("SELECT CURRENT TIMESTAMP, INITIALS, COUNT(*),MAX(ADDED_TS) FROM JDTESTINFO.SCHED1 WHERE INITIALS= ? GROUP BY INITIALS" ); + ps.setString(1, initials); + rs = ps.executeQuery(); + if (rs.next()) { + int scheduledCount = rs.getInt(3); + String summary = "

At "+rs.getString(1)+" "+rs.getString(3)+" tests currently scheduled with max add time = "+rs.getString(4)+"

"; + + rs.close(); + ps.close(); + ps = connection.prepareStatement("SELECT ACTION, PRIORITY, ADDED_TS FROM JDTESTINFO.SCHED1 WHERE INITIALS= ? ORDER BY PRIORITY,ADDED_TS" ); + ps.setString(1, initials); + rs = ps.executeQuery(); + if (rs.next()) { + String action = rs.getString(1); + if (!"EMAIL".equals(action) || scheduledCount > 2 ) { + writer.println(summary); + writer.println("

Next scheduled action is "+action+"

"); + } + } + rs.close(); + ps.close(); + + + } else { + rs.close(); + ps.close(); + + } + + + + } catch (SQLException sqlex) { + System.out.println("Error generating running information"); + sqlex.printStackTrace(System.out); + } + } + + if (true) { System.out.print( @@ -3209,13 +3293,21 @@ public static void main(String args[]) { touchFile.setLastModified(maxFinishTimestamp.getTime()); } - connection.close(); System.out.println("Creating index"); - createIndex(); - createJvmIndex(); - createToolboxIndex(); - createNativeIndex(); + if ("OS/400".equals(osName)) { + createIndex(connection); + createJvmIndex(connection); + createToolboxIndex(connection); + createNativeIndex(connection); + } else { + createIndex(null); + createJvmIndex(null); + createToolboxIndex(null); + createNativeIndex(null ); + + } + connection.close(); if (!noExit) { System.out.println("JDReport calling System.exit(0)"); diff --git a/src/test/JDRunit.java b/src/test/JDRunit.java index 32e09e6..a25d713 100644 --- a/src/test/JDRunit.java +++ b/src/test/JDRunit.java @@ -164,7 +164,8 @@ public class JDRunit { "JVMDUMP", "Exception in thread \"main\" java.lang.NoClassDefFoundError:", "IncompatibleClassChangeError", - "connection to \":9.0\" refused by server", }; + "connection to \":9.0\" refused by server", + TestDriver.RUN_COMPLETED}; static String[] hangMessagesException = { "User requested", "JVMDUMP034I","/tmp/passwordLeakCoreDump"}; @@ -2706,7 +2707,7 @@ public JDRunitGoOutput go() throws Exception { if (debug) System.out.println("JDRunit: osVersion=" + JTOpenTestEnvironment.osVersion); if (JTOpenTestEnvironment.isWindows && cmdArray1[0].indexOf("/bin") >= 0) { - cmdArray1[0] = JTOpenTestEnvironment.cygwinBase+ cmdArray1[0].replace('/', '\\'); + cmdArray1[0] = JTOpenTestEnvironment.cygwinBase + cmdArray1[0].replace('/', '\\'); } if (debug) @@ -2719,28 +2720,24 @@ public JDRunitGoOutput go() throws Exception { System.out.println("Shell binary2 is " + shellBinary); cmdArray1[1] = shellArgs; if (debug) - System.out.println("JDRunit: Shell command (with args) is: " - + cmdArray1[0] + " " + cmdArray1[1]); + System.out.println("JDRunit: Shell command (with args) is: " + cmdArray1[0] + " " + cmdArray1[1]); } if (on400) { - JDJobName.sendProgramMessage("GD "+Thread.currentThread().getName()+" " + date.toString() + " Running " - + initials + " " + testArgs); - } + JDJobName.sendProgramMessage( + "GD " + Thread.currentThread().getName() + " " + date.toString() + " Running " + initials + " " + testArgs); + } Process shellTestProcess; String shellTestProcessInfo = ""; // If current JVM is PASE, but target JVM is classic. Don't inherit // any environment variables. // This scenario should only typically happened on V6R1 - if ((System.getProperty("java.home").indexOf("QOpenSys") > 0) - && (javaHome.indexOf("QOpenSys") == -1)) { - String[] envp = { "PATH=/usr/bin:", "HOME="+testcaseCode, }; + if ((System.getProperty("java.home").indexOf("QOpenSys") > 0) && (javaHome.indexOf("QOpenSys") == -1)) { + String[] envp = { "PATH=/usr/bin:", "HOME=" + testcaseCode, }; if (debug) - System.out.println("Calling exec1 with envp and cmdArray[0]=" - + cmdArray1[0]); + System.out.println("Calling exec1 with envp and cmdArray[0]=" + cmdArray1[0]); shellTestProcess = runtime.exec(cmdArray1, envp); - shellTestProcessInfo = "Running with envp cmdArray1[" + cmdArray1.length - + "] "; + shellTestProcessInfo = "Running with envp cmdArray1[" + cmdArray1.length + "] "; for (int i = 0; i < cmdArray1.length; i++) { shellTestProcessInfo += cmdArray1[i] + " "; } @@ -2759,10 +2756,10 @@ public JDRunitGoOutput go() throws Exception { OutputStream stdin = shellTestProcess.getOutputStream(); JDJSTPInputThread inputThread; int encoding = JDJSTPOutputThread.ENCODING_UNKNOWN; - if (debug) - System.out.println("InputStream is ASCII"); - inputThread = new JDJSTPInputThread(stdin, runitInputFile); - encoding = JDJSTPOutputThread.ENCODING_ASCII; + if (debug) + System.out.println("InputStream is ASCII"); + inputThread = new JDJSTPInputThread(stdin, runitInputFile); + encoding = JDJSTPOutputThread.ENCODING_ASCII; if (debug) JDJSTPTestcase.debug = true; @@ -2770,9 +2767,8 @@ public JDRunitGoOutput go() throws Exception { /* Assynchronously start the process output threads */ Vector hangMessagesFound = new Vector(); - JDJSTPOutputThread stdoutThread = JDJSTPTestcase.startProcessOutput( - shellTestProcess, runitOutputFile, true, hangMessages, hangMessagesException, - hangMessagesFound, encoding); + JDJSTPOutputThread stdoutThread = JDJSTPTestcase.startProcessOutput(shellTestProcess, runitOutputFile, true, + hangMessages, hangMessagesException, hangMessagesFound, encoding); /* start the input after output is ready */ inputThread.start(); @@ -2790,8 +2786,7 @@ public JDRunitGoOutput go() throws Exception { // There is not a wait mechanism for the process. // So loop and wait for process completion currentTime = System.currentTimeMillis(); - while (!processCompleted && currentTime < endTime - && hangMessagesFound.size() == 0) { + while (!processCompleted && currentTime < endTime && hangMessagesFound.size() == 0) { // System.out.println("JDEBUG: process checked " + currentTime + "<"+ // endTime); try { @@ -2802,7 +2797,7 @@ public JDRunitGoOutput go() throws Exception { System.out.println("Running info: " + shellTestProcessInfo); if (on400) { Date d = new Date(); - JDJobName.sendProgramMessage("LD " +Thread.currentThread().getName()+" " + d.toString() + " Rc=" + rc + JDJobName.sendProgramMessage("LD " + Thread.currentThread().getName() + " " + d.toString() + " Rc=" + rc + " from " + initials + " " + testArgs); } @@ -2821,201 +2816,189 @@ public JDRunitGoOutput go() throws Exception { stdoutThread.addOutputString("Done at " + (new Date()) + "\n"); if (hangMessagesFound.size() > 0) { - StringBuffer body = new StringBuffer(); - String outString = " Severe Error Running " + initials + " " + testArgs - + "\n"; - stdoutThread.addOutputString(outString); - body.append(outString); - if (on400) { - Date d = new Date(); - JDJobName.sendProgramMessage("LD " +Thread.currentThread().getName()+" " + d.toString() + outString); - } - String hangMessage = (String) hangMessagesFound.elementAt(0); - outString = "ERROR: JDRunit: Hang message found : " + hangMessage + "\n"; - stdoutThread.addOutputString(outString); - body.append(outString); - System.out.print(outString); - if (on400) { - Date d = new Date(); - JDJobName.sendProgramMessage("LD "+Thread.currentThread().getName()+" " + d.toString() + outString); - } - - // - // Check to see if we can recover - // - boolean recovered = false; - if (on400) { - if ((hangMessage.indexOf("sun.awt.X11GraphicsEnvironment") > 0) - || (hangMessage.indexOf("connection to \":9.0\"") > 0)) { - /* Something went wrong with the VNC server */ - /* kill it */ - String command = "SBMJOB CMD(QSH CMD('system wrkactjob | grep vnc | " - + "grep -i " - + System.getProperty("user.name") - + " | " - + " sed ''s%^ *\\([^ ][^ ]*\\) *\\([^ ][^ ]*\\) *\\([^ ][^ ]*\\) .*%system endjob \"job(\\3/\\2/\\1)\"%'' |" - + " sh'))"; - System.out.println("Attempting kill using " + command); - stdoutThread.addOutputString("Attempting kill using " + command - + "\n"); - - JDJobName.system(command); - recovered = true; - } - } - - if (onLinux) { - System.out.println("on linux"); - if ((hangMessage.indexOf("sun.awt.X11GraphicsEnvironment") > 0) - || (hangMessage.indexOf("connection to \":9.0\"") > 0)) { - /* Something went wrong with the VNC server */ - /* kill it */ - String commands[] = new String[4]; - commands[0] = "/bin/bash"; - commands[1] = "--verbose"; - commands[2] = "-c"; - commands[3] = "/bin/ps -ef | grep Xvnc | grep -v grep | sed 's%^\\([^ ][^ ]*\\) *\\([^ ][^ ]*\\) .*%kill -9 \\2%' | sh "; - System.out.println("Attempting kill using " + commands[3]); - Process shellProcess = runtime.exec(commands); - StringBuffer outputBuffer = new StringBuffer(); - JDJSTPOutputThread cmdStdoutThread = new JDJSTPOutputThread( - shellProcess.getInputStream(), outputBuffer, null, - JDJSTPOutputThread.ENCODING_ASCII); - JDJSTPOutputThread stderrThread = new JDJSTPOutputThread( - shellProcess.getErrorStream(), outputBuffer, null, - JDJSTPOutputThread.ENCODING_ASCII); - cmdStdoutThread.start(); - stderrThread.start(); - cmdStdoutThread.join(); - stderrThread.join(); - - shellProcess.waitFor(); - System.out.println("Process complete exitValue = " - + shellProcess.exitValue()); - System.out.println(outputBuffer.toString()); - - recovered = true; - } - - } - if (!recovered) { - // Try to dump the job log - - String jobname = stdoutThread.getParsedJobName(); - outString = "Job name was " + jobname + "\n"; + if (hangMessage.indexOf(TestDriver.RUN_COMPLETED) >= 0) { + /* + * We can exit this test. If the job is hung after this point, it will need to + * be manually cleaned up + */ + processCompleted = true; + } else { + StringBuffer body = new StringBuffer(); + String outString = " Severe Error Running " + initials + " " + testArgs + "\n"; stdoutThread.addOutputString(outString); - System.out.println(outString); - if (jobname != null) { - if (on400) { - String command = "DSPJOBLOG JOB(" + jobname + ") OUTPUT(*PRINT)"; - outString = "Dumping job log to *PRINT using " + command + "\n"; - stdoutThread.addOutputString(outString); - System.out.println(outString); - JDJobName.system(command); - } + body.append(outString); + if (on400) { + Date d = new Date(); + JDJobName.sendProgramMessage("LD " + Thread.currentThread().getName() + " " + d.toString() + outString); } - System.out - .println("ERROR: JDRunit: Generating report and sleeping for 60 seconds"); + + outString = "ERROR: JDRunit: Hang message found : " + hangMessage + "\n"; + stdoutThread.addOutputString(outString); + body.append(outString); + System.out.print(outString); if (on400) { Date d = new Date(); - JDJobName - .sendProgramMessage("LD "+Thread.currentThread().getName()+" " - + d.toString() - + "ERROR: JDRunit: Generating report and sleeping for 60 seconds"); + JDJobName.sendProgramMessage("LD " + Thread.currentThread().getName() + " " + d.toString() + outString); } - /* Wait for 1 minutes to allow dump output to occur */ - fatalError = true; - try { - long waitDumpStartTime = System.currentTimeMillis(); - String[] reportArgs = new String[1]; - reportArgs[0] = initials; - JDReport.main(reportArgs); - long waitDumpEndTime = System.currentTimeMillis(); - while ((waitDumpEndTime - waitDumpStartTime) < 60000) { - Thread.sleep(1000); - waitDumpEndTime = System.currentTimeMillis(); + // + // Check to see if we can recover + // + boolean recovered = false; + if (on400) { + if ((hangMessage.indexOf("sun.awt.X11GraphicsEnvironment") > 0) + || (hangMessage.indexOf("connection to \":9.0\"") > 0)) { + /* Something went wrong with the VNC server */ + /* kill it */ + String command = "SBMJOB CMD(QSH CMD('system wrkactjob | grep vnc | " + "grep -i " + + System.getProperty("user.name") + " | " + + " sed ''s%^ *\\([^ ][^ ]*\\) *\\([^ ][^ ]*\\) *\\([^ ][^ ]*\\) .*%system endjob \"job(\\3/\\2/\\1)\"%'' |" + + " sh'))"; + System.out.println("Attempting kill using " + command); + stdoutThread.addOutputString("Attempting kill using " + command + "\n"); + + JDJobName.system(command); + recovered = true; } - forceReport = true; - } catch (Exception sleepEx) { - /* ignore */ } - // If the hang messages include JVMDUMP -- wait for processing to be - // complete (another 5 minutes). + if (onLinux) { + System.out.println("on linux"); + if ((hangMessage.indexOf("sun.awt.X11GraphicsEnvironment") > 0) + || (hangMessage.indexOf("connection to \":9.0\"") > 0)) { + /* Something went wrong with the VNC server */ + /* kill it */ + String commands[] = new String[4]; + commands[0] = "/bin/bash"; + commands[1] = "--verbose"; + commands[2] = "-c"; + commands[3] = "/bin/ps -ef | grep Xvnc | grep -v grep | sed 's%^\\([^ ][^ ]*\\) *\\([^ ][^ ]*\\) .*%kill -9 \\2%' | sh "; + System.out.println("Attempting kill using " + commands[3]); + Process shellProcess = runtime.exec(commands); + StringBuffer outputBuffer = new StringBuffer(); + JDJSTPOutputThread cmdStdoutThread = new JDJSTPOutputThread(shellProcess.getInputStream(), outputBuffer, + null, JDJSTPOutputThread.ENCODING_ASCII); + JDJSTPOutputThread stderrThread = new JDJSTPOutputThread(shellProcess.getErrorStream(), outputBuffer, null, + JDJSTPOutputThread.ENCODING_ASCII); + cmdStdoutThread.start(); + stderrThread.start(); + cmdStdoutThread.join(); + stderrThread.join(); + + shellProcess.waitFor(); + System.out.println("Process complete exitValue = " + shellProcess.exitValue()); + System.out.println(outputBuffer.toString()); + + recovered = true; + } + + } + if (!recovered) { + // Try to dump the job log - int MAXRETRIES = 15; - if (vectorContainsString(hangMessagesFound, "JVM requested System dump")) { - int retryCount = 1; - boolean shellTestProcessAlive = true; - while (shellTestProcessAlive - && retryCount <= MAXRETRIES - && (!vectorContainsString(hangMessagesFound, "Snap dump written"))) { - System.out - .println("JVM requested System dump, waiting for dump to complete. RetryCount=" - + retryCount - + "/" - + MAXRETRIES - + " Sleeping for 60 seconds "); + String jobname = stdoutThread.getParsedJobName(); + outString = "Job name was " + jobname + "\n"; + stdoutThread.addOutputString(outString); + System.out.println(outString); + if (jobname != null) { if (on400) { - Date d = new Date(); - JDJobName - .sendProgramMessage("LD "+Thread.currentThread().getName()+" " - + d.toString() - + "JVM requested System dump, waiting for dump to complete. RetryCount=" - + retryCount + "/" + MAXRETRIES - + " Sleeping for 60 seconds "); + String command = "DSPJOBLOG JOB(" + jobname + ") OUTPUT(*PRINT)"; + outString = "Dumping job log to *PRINT using " + command + "\n"; + stdoutThread.addOutputString(outString); + System.out.println(outString); + JDJobName.system(command); } + } + System.out.println("ERROR: JDRunit: Generating report and sleeping for 60 seconds"); + if (on400) { + Date d = new Date(); + JDJobName.sendProgramMessage("LD " + Thread.currentThread().getName() + " " + d.toString() + + "ERROR: JDRunit: Generating report and sleeping for 60 seconds"); + } - retryCount++; - try { - Thread.sleep(60000); - } catch (Exception sleepEx) { - /* ignore */ + /* Wait for 1 minutes to allow dump output to occur */ + fatalError = true; + try { + long waitDumpStartTime = System.currentTimeMillis(); + String[] reportArgs = new String[1]; + reportArgs[0] = initials; + JDReport.main(reportArgs); + long waitDumpEndTime = System.currentTimeMillis(); + while ((waitDumpEndTime - waitDumpStartTime) < 60000) { + Thread.sleep(1000); + waitDumpEndTime = System.currentTimeMillis(); } - try { - shellTestProcess.exitValue(); - shellTestProcessAlive = false; - } catch (IllegalThreadStateException itse) { - // Process is still alive. + forceReport = true; + } catch (Exception sleepEx) { + /* ignore */ + } + + // If the hang messages include JVMDUMP -- wait for processing to be + // complete (another 5 minutes). + + int MAXRETRIES = 15; + if (vectorContainsString(hangMessagesFound, "JVM requested System dump")) { + int retryCount = 1; + boolean shellTestProcessAlive = true; + while (shellTestProcessAlive && retryCount <= MAXRETRIES + && (!vectorContainsString(hangMessagesFound, "Snap dump written"))) { + System.out.println("JVM requested System dump, waiting for dump to complete. RetryCount=" + retryCount + + "/" + MAXRETRIES + " Sleeping for 60 seconds "); + if (on400) { + Date d = new Date(); + JDJobName.sendProgramMessage("LD " + Thread.currentThread().getName() + " " + d.toString() + + "JVM requested System dump, waiting for dump to complete. RetryCount=" + retryCount + "/" + + MAXRETRIES + " Sleeping for 60 seconds "); + } + + retryCount++; + try { + Thread.sleep(60000); + } catch (Exception sleepEx) { + /* ignore */ + } + try { + shellTestProcess.exitValue(); + shellTestProcessAlive = false; + } catch (IllegalThreadStateException itse) { + // Process is still alive. + } } } - } - // - // Send an e-mail about the hung message - // - try { - String toAddress = iniProperties.getProperty("EMAIL"); - if (!toAddress.equals("xxx@github.com")) { - String fromAddress = iniProperties.getProperty("EMAIL"); - String subject = " Severe Error Running " + initials + " " - + testArgs; + // + // Send an e-mail about the hung message + // + try { + String toAddress = iniProperties.getProperty("EMAIL"); + if (!toAddress.equals("xxx@github.com")) { + String fromAddress = iniProperties.getProperty("EMAIL"); + String subject = " Severe Error Running " + initials + " " + testArgs; - String hostname = JDHostName.getHostName(); - hostname = hostname.toUpperCase(); + String hostname = JDHostName.getHostName(); + hostname = hostname.toUpperCase(); - if (hostname.indexOf('.') < 0) { - hostname = hostname + "." + getDomain(hostname); - } + if (hostname.indexOf('.') < 0) { + hostname = hostname + "." + getDomain(hostname); + } - String URLBASE = "http://" + hostname + ":6050/"; - String htmlFile = JDReport.getReportName(initials); + String URLBASE = "http://" + hostname + ":6050/"; + String htmlFile = JDReport.getReportName(initials); - if (htmlFile.indexOf("ct/") == 0) - htmlFile = htmlFile.substring(3); - body.append("\n\nSee details at " + URLBASE + htmlFile + "\n"); - body.append("Test output " + URLBASE + "/out/" + initials + "/runit." - + dateStringNoSpace + "\n"); + if (htmlFile.indexOf("ct/") == 0) + htmlFile = htmlFile.substring(3); + body.append("\n\nSee details at " + URLBASE + htmlFile + "\n"); + body.append("Test output " + URLBASE + "/out/" + initials + "/runit." + dateStringNoSpace + "\n"); - sendEMail(toAddress, fromAddress, subject, body, iniProperties.getProperty("mail.smtp.host")); + sendEMail(toAddress, fromAddress, subject, body, iniProperties.getProperty("mail.smtp.host")); + } + } catch (Exception e) { + System.out.println("Error sending mail"); + e.printStackTrace(); } - } catch (Exception e) { - System.out.println("Error sending mail"); - e.printStackTrace(); } - } + } /* RUN_COMPLETED_ NOT FOUND */ } /* hangMessages found */ if (!processCompleted) { diff --git a/src/test/JDSchedulerServer.java b/src/test/JDSchedulerServer.java index e4a9fd4..0e24097 100644 --- a/src/test/JDSchedulerServer.java +++ b/src/test/JDSchedulerServer.java @@ -355,12 +355,12 @@ public static void runServer(PrintStream out, String serverId) { || (jobsInSystem > 400000)) { String[] cleanArgs = { "localhost" }; JDJobName.sendProgramMessage( - "calling JDCleanSplf for testcases "); + "calling JDCleanSplfJdbc for testcases "); try { - JDCleanSplf.main(cleanArgs); + JDCleanSplfJdbc.main(cleanArgs); } catch (Exception e) { JDJobName.sendProgramMessage( - "exception in JDCleanSplf" + e); + "exception in JDCleanSplfJdbc" + e); } systemStatus.reset(); @@ -368,26 +368,26 @@ public static void runServer(PrintStream out, String serverId) { .getPercentSystemASPUsed(); jobsInSystem = systemStatus.getJobsInSystem(); JDJobName.sendProgramMessage( - "back from JDCleanSplf aspUsed = " + "back from JDCleanSplfJdbc aspUsed = " + percentSystemASPUsed + "jobsInSystem=" + jobsInSystem); String[] cleanArgsAll = { "localhost", "null", "null", "10", "ALL" }; JDJobName.sendProgramMessage( - "calling JDCleanSplf for all splf older than 10 days"); + "calling JDCleanSplfJdbc for all splf older than 10 days"); try { - JDCleanSplf.main(cleanArgsAll); + JDCleanSplfJdbc.main(cleanArgsAll); } catch (Exception e) { JDJobName.sendProgramMessage( - "exception in JDCleanSplf" + e); + "exception in JDCleanSplfJdbc" + e); } systemStatus.reset(); percentSystemASPUsed = systemStatus .getPercentSystemASPUsed(); jobsInSystem = systemStatus.getJobsInSystem(); JDJobName.sendProgramMessage( - "back from JDCleanSplf aspUsed =" + "back from JDCleanSplfJdbc aspUsed =" + percentSystemASPUsed + " jobsInSystem=" + jobsInSystem); diff --git a/src/test/JDTestDriver.java b/src/test/JDTestDriver.java index 08631c6..461b3c1 100644 --- a/src/test/JDTestDriver.java +++ b/src/test/JDTestDriver.java @@ -1103,7 +1103,7 @@ public Connection getConnection(String url, String testInfo) throws Exception { } } - postConnectProcessing(connection, testInfo); + postConnectProcessing(connection, testInfo, url); return connection; } @@ -1216,7 +1216,7 @@ public Connection getConnection(String url, Properties info, String testInfo) } } - postConnectProcessing(connection, testInfo); + postConnectProcessing(connection, testInfo, url); return connection; } @@ -1434,7 +1434,7 @@ public Connection getConnection(String url, String uid, char[] encryptedPwd, } } - postConnectProcessing(connection, testInfo); + postConnectProcessing(connection, testInfo, url); return connection; } @@ -1472,7 +1472,7 @@ public static String calculateTestInfoFromStack() { return testInfo.toString(); } - public void postConnectProcessing(Connection connection, String testInfo) + public void postConnectProcessing(Connection connection, String testInfo, String url) throws Exception { String dbmon = System.getProperty("dbmon"); @@ -1535,29 +1535,33 @@ public void postConnectProcessing(Connection connection, String testInfo) String databaseProductName = dmd.getDatabaseProductName(); if (databaseProductName.indexOf("400") >= 0) { - // Always change the job to leave a joblog - Statement stmt = connection.createStatement(); - String sql = ""; - try { - sql = "call qsys2.qcmdexc('CHGJOB LOG(4 00 *SECLVL) ')"; - stmt.executeUpdate(sql); - } catch (Exception e) { - System.out.println("Warning: SQL failed -- "+sql); - e.printStackTrace(System.out); - try { - sql = "VALUES CURRENT USER"; - ResultSet rs = stmt.executeQuery(sql); - rs.next(); - System.out.println("... current User is "+rs.getString(1)); - rs.close(); - } catch (SQLException sqlex) { - System.out.println("Warning: SQL failed -- "+sql); - e.printStackTrace(System.out); + // Always change the job to leave a joblog -- unless a readonly connection + Statement stmt = connection.createStatement(); + String sql = ""; + if (url.toLowerCase().indexOf("access=read only") < 0) { + try { + sql = "call qsys2.qcmdexc('CHGJOB LOG(4 00 *SECLVL) ')"; + stmt.executeUpdate(sql); + } catch (Exception e) { + System.out.println("Warning: SQL failed -- " + sql); + e.printStackTrace(System.out); + try { + sql = "VALUES CURRENT USER"; + ResultSet rs = stmt.executeQuery(sql); + rs.next(); + System.out.println("... current User is " + rs.getString(1)); + rs.close(); + } catch (SQLException sqlex) { + System.out.println("Warning: SQL failed -- " + sql); + e.printStackTrace(System.out); - } + } + } + } + // Disable self unless connection is readonly + if ((url.toLowerCase().indexOf("access=read only") < 0) && (url.toLowerCase().indexOf("access=read call") < 0 )) { + stmt.executeUpdate("set sysibmadm.selfcodes=''"); } - // Always disable SELF - stmt.executeUpdate("set sysibmadm.selfcodes=''"); stmt.close(); } diff --git a/src/test/Message/MessageQueueTestcase.java b/src/test/Message/MessageQueueTestcase.java index 425621c..41ab30f 100644 --- a/src/test/Message/MessageQueueTestcase.java +++ b/src/test/Message/MessageQueueTestcase.java @@ -1943,7 +1943,7 @@ public void Var078() { } if (m.getUser() != null) { - String expectedUser = "USER"; + String expectedUser = "QUSER"; if (getRelease() > JDTestDriver.RELEASE_V7R5M0) expectedUser="QUSER_NC"; if (!m.getUser().trim().equals(expectedUser)) { diff --git a/src/test/Sec/SecPTMiscTestcase.java b/src/test/Sec/SecPTMiscTestcase.java index dd2f1ed..a5ecf92 100644 --- a/src/test/Sec/SecPTMiscTestcase.java +++ b/src/test/Sec/SecPTMiscTestcase.java @@ -239,7 +239,7 @@ public void Var005() args[3] = new Integer(444); argTypes[3] = Integer.TYPE; args[4] = new Boolean(false); - args[4] = Boolean.TYPE; + argTypes[4] = Boolean.TYPE; // Create the token object. ProfileTokenCredential pt = (ProfileTokenCredential) JDReflectionUtil.createObject("com.ibm.as400.security.auth.ProfileTokenCredential",argTypes, args); diff --git a/src/test/TestDriver.java b/src/test/TestDriver.java index 4caef5d..4fbfb1d 100644 --- a/src/test/TestDriver.java +++ b/src/test/TestDriver.java @@ -102,7 +102,7 @@ public abstract class TestDriver implements TestDriverI, Runnable, static final long serialVersionUID = 1L; static TestDriverTimeoutThread timeoutThread = null; - + static final String RUN_COMPLETED="TESTDRIVER RUN COMPLETED"; protected String outputFileName_ = null; // Set of Testcase objects for this component. This is filled in by the // createTestcases() method. @@ -1130,6 +1130,37 @@ public void run() { } else { } + out_.println(RUN_COMPLETED); + out_.flush(); + // Check to see if there is an extra AS400 Read Daemon thread. If so, call System.exit to make sure the test ends. + ThreadGroup rootThreadGroup = Thread.currentThread().getThreadGroup(); + ThreadGroup parentThreadGroup = rootThreadGroup.getParent(); + while (parentThreadGroup != null) { + rootThreadGroup = parentThreadGroup; + parentThreadGroup = rootThreadGroup.getParent(); + } + if (threadGroupHasAS400ReadDaemon(rootThreadGroup)) { + out_.println("Calling System.exit(0) because AS400ReadDaemon found"); + System.exit(0); + + } + + + } + + private boolean threadGroupHasAS400ReadDaemon(ThreadGroup threadGroup) { + int threadCount = threadGroup.activeCount(); + + Thread[] threadList = new Thread[threadCount+10]; + threadCount = threadGroup.enumerate(threadList ); + for (int i = 0; i < threadCount; i++) { + String threadName = threadList[i].getName(); + if (threadName.indexOf("AS400 Read Daemon")>=0) { + return true; + } + } + + return false; } /** @@ -1423,7 +1454,10 @@ public void outputSummary() { out_.println(heading1); if (totalFail_ == 0) { out_.println("NO FAILURES DETECTED DURING THIS RUN"); + } else { + out_.println(totalFail_ + " FAILURES DETECTED DURING THIS RUN"); } + } static String arrayToString(String[] strings) {