diff --git a/src/ini/regressionBase5.ini b/src/ini/regressionBase5.ini index 616b4562..0258e8ed 100644 --- a/src/ini/regressionBase5.ini +++ b/src/ini/regressionBase5.ini @@ -44,8 +44,6 @@ JDASPTest AS400JDBCConnectionPoolTest AS400JDBCDataSourceTest AS400JDBCRowSetTest -# Test stand alone programs -JDJSTPjdbc # AlternateServer Test JDASAffinityFailback diff --git a/src/ini/regressionBaseH.ini b/src/ini/regressionBaseH.ini new file mode 100644 index 00000000..c6b2e62a --- /dev/null +++ b/src/ini/regressionBaseH.ini @@ -0,0 +1,87 @@ +# java test.BSOAuthenticate +# +# Regression tests for Toolbox JDBC +# + +JDCleanupTest +JDDriverTest + +JDDataSourceTest + +JDBIDITestcase +# +# Remove this later +# + +JDConnectionTest +JDStatementTest + + + +# Don't run parm tests +# JDParmTest +# + +JDBUTest +JDCSTest + +JDPSTest +JDRSTest +JDRSStressTest +JDRSMDTest + +JDDMDTest + +JDPMDTest +JDLobTest +# +# Don't run TC tests -- native only +# JDTCTest +# +JDDSTest + +# Need to cleanup for JTA tests +java test.JTACleanupTx `hostname | sed 's/\..*//'` ThisIsDangerous all +JTAStdTest +JTATest + +# More JTA Cleanup +java test.JTACleanupTx `hostname | sed 's/\..*//'` ThisIsDangerous all + +# Run these later +# JDJSTPTest +JDSavepointTest +JDASPTest + + +# Toolbox only tests +AS400JDBCConnectionPoolTest +AS400JDBCDataSourceTest +AS400JDBCRowSetTest +# Test stand alone programs +JDJSTPjdbc + +# AlternateServer Test +# JDASTest +JDASEnableCALTestcase +JDASClientRegisters +JDASClientReroute1 +JDASClientReroute2 +JDASClientReroute3 +JDASClientReroute4 +JDASClientReroute5 +JDASClientReroute6 +JDASClientReroute7 +JDASDefaultRetry +JDASRetry +JDASSeamlessFailover1 +JDASSeamlessFailover2 +JDASSeamlessFailover3 +JDASSeamlessFailover4 +JDASSeamlessFailover5 +JDASSFStatement +JDASSFPreparedStatement +JDASSFCallableStatement + +# JDBC client Test +JDCTest diff --git a/src/ini/regressionBaseI.ini b/src/ini/regressionBaseI.ini new file mode 100644 index 00000000..c6b2e62a --- /dev/null +++ b/src/ini/regressionBaseI.ini @@ -0,0 +1,87 @@ +# java test.BSOAuthenticate +# +# Regression tests for Toolbox JDBC +# + +JDCleanupTest +JDDriverTest + +JDDataSourceTest + +JDBIDITestcase +# +# Remove this later +# + +JDConnectionTest +JDStatementTest + + + +# Don't run parm tests +# JDParmTest +# + +JDBUTest +JDCSTest + +JDPSTest +JDRSTest +JDRSStressTest +JDRSMDTest + +JDDMDTest + +JDPMDTest +JDLobTest +# +# Don't run TC tests -- native only +# JDTCTest +# +JDDSTest + +# Need to cleanup for JTA tests +java test.JTACleanupTx `hostname | sed 's/\..*//'` ThisIsDangerous all +JTAStdTest +JTATest + +# More JTA Cleanup +java test.JTACleanupTx `hostname | sed 's/\..*//'` ThisIsDangerous all + +# Run these later +# JDJSTPTest +JDSavepointTest +JDASPTest + + +# Toolbox only tests +AS400JDBCConnectionPoolTest +AS400JDBCDataSourceTest +AS400JDBCRowSetTest +# Test stand alone programs +JDJSTPjdbc + +# AlternateServer Test +# JDASTest +JDASEnableCALTestcase +JDASClientRegisters +JDASClientReroute1 +JDASClientReroute2 +JDASClientReroute3 +JDASClientReroute4 +JDASClientReroute5 +JDASClientReroute6 +JDASClientReroute7 +JDASDefaultRetry +JDASRetry +JDASSeamlessFailover1 +JDASSeamlessFailover2 +JDASSeamlessFailover3 +JDASSeamlessFailover4 +JDASSeamlessFailover5 +JDASSFStatement +JDASSFPreparedStatement +JDASSFCallableStatement + +# JDBC client Test +JDCTest diff --git a/src/ini/regressionBaseT.ini b/src/ini/regressionBaseT.ini index a85fec96..72add7d0 100644 --- a/src/ini/regressionBaseT.ini +++ b/src/ini/regressionBaseT.ini @@ -44,8 +44,7 @@ JDASPTest AS400JDBCConnectionPoolTest AS400JDBCDataSourceTest AS400JDBCRowSetTest -# Test stand alone programs -JDJSTPjdbc + # AlternateServer Test JDASAffinityFailback diff --git a/src/ini/regressionBaseV.ini b/src/ini/regressionBaseV.ini new file mode 100644 index 00000000..76115064 --- /dev/null +++ b/src/ini/regressionBaseV.ini @@ -0,0 +1,205 @@ +# java test.BSOAuthenticate +# +# Regression tests for 7153V +# + +JDCleanupTest +JDDriverTest + +JDBIDITestcase + +JDConnectionTest + +#JDStatementTest +#Run all but JDStatementPackageCache +JDStatementBatch +JDStatementClose +JDStatementCursorName +JDStatementDelimiters +JDStatementDRDA +JDStatementExceptions +JDStatementExecute +JDStatementGetGeneratedKeys +JDStatementGetGeneratedKeys2 +JDStatementMisc +JDStatementMisc2 +JDStatementResults +JDStatementStressTest +JDStatementWarnings +JDStatementWrapper + + +# Don't run parm tests +# JDParmTest +# + +JDBUTest +JDCSTest + +# JDPSTest +# Don't run JDRowSetPSTestcase for proxy +JDPSBatch +JDPSBatchNative +JDPSBatchStress +JDPSClearParameters +JDPSClose +JDPSDataTruncation +JDPSExecute +JDPSMisc +JDPSResults +JDPSSetArray +JDPSSetAsciiStream +JDPSSetBigDecimal +JDPSSetBinaryStream +JDPSSetBlob40 +JDPSSetBlob +JDPSSetBoolean +JDPSSetByte +JDPSSetBytes +JDPSSetCharacterStream +JDPSSetClob40 +JDPSSetClob +JDPSSetDB2Default +JDPSSetDB2Unassigned +JDPSSetDBDefault +JDPSSetDBUnassigned +JDPSSetDate +JDPSSetDouble +JDPSSetFloat +JDPSSetInt +JDPSSetLong +JDPSSetNCharacterStream +JDPSSetNClob +JDPSSetNString +JDPSSetNull +JDPSSetObject2 +JDPSSetObject3 +JDPSSetObject4 +JDPSSetRef +JDPSSetRowId +JDPSSetSQLXML +JDPSSetShort +JDPSSetString +JDPSSetTime +JDPSSetTimestamp +JDPSSetUnicodeStream +# JDRowSetPSTestcase + + + +# JDRSTest +# Don't run JDRowSetRSTestcase for proxy +JDRSAbsolute +JDRSAfterLast +JDRSBeforeFirst +JDRSCachedRowSet +JDRSCursorScroll +JDRSCursorScrollSensitiveFromCall +JDRSCursorScrollInsensitiveFromCall +JDRSCursorSensitivity +JDRSDataCompression +JDRSDeleteRow +JDRSFetchSize +JDRSFindColumn +JDRSFirst +JDRSGetArray +JDRSGetAsciiStream +JDRSGetBigDecimal +JDRSGetBinaryStream +JDRSGetBlob +JDRSGetBoolean +JDRSGetByte +JDRSGetBytes +JDRSGetBytesBinary +JDRSGetCharacterStream +JDRSGetClob +JDRSGetDate +JDRSGetDouble +JDRSGetFloat +JDRSGetInt +JDRSGetLong +JDRSGetNCharacterStream +JDRSGetNClob +JDRSGetNString +JDRSGetObject +JDRSGetRef +JDRSGetRow +JDRSGetRowId +JDRSGetSQLXML +JDRSGetShort +JDRSGetString +JDRSGetTime +JDRSGetTimestamp +JDRSGetURL +JDRSGetUnicodeStream +JDRSInsertRow +JDRSLast +JDRSMisc +JDRSMoveToCurrentRow +JDRSMoveToInsertRow +JDRSNext +JDRSPrevious +JDRSRefreshRow +JDRSRelative +JDRSStress +JDRSStressDirectMap +JDRSStressNoBlockPSDirectMap +JDRSStressPS +JDRSStressPSDirectMap +JDRSStressScroll +JDRSStressScrollDirectMap +JDRSStressScrollPS +JDRSStressScrollPSDirectMap +JDRSStressUpdatePS +JDRSStressUpdatePSDirectMap +JDRSUpdateAsciiStream +JDRSUpdateBigDecimal +JDRSUpdateBinaryStream +JDRSUpdateBoolean +JDRSUpdateByte +JDRSUpdateBytes +JDRSUpdateCharacterStream +JDRSUpdateClob +JDRSUpdateDB2Default +JDRSUpdateDBDefault +JDRSUpdateDate +JDRSUpdateDouble +JDRSUpdateFloat +JDRSUpdateInt +JDRSUpdateLong +JDRSUpdateNCharacterStream +JDRSUpdateNClob +JDRSUpdateNString +JDRSUpdateNull +JDRSUpdateObject +JDRSUpdateRow +JDRSUpdateRowId +JDRSUpdateSQLXML +JDRSUpdateShort +JDRSUpdateString +JDRSUpdateTime +JDRSUpdateTimestamp +JDRSWarnings +JDRSWasNull +JDRSWrapper +# JDRowSetRSTestcase + + +JDRSMDTest + +JDDMDTest + +JDPMDTest +JDLobTest +# +# Don't run TC tests -- native only +# JDTCTest +# +# Don't run JDDSTest for proxy. +# JDDSTest + +# Run these later +# JDJSTPTest +JDSavepointTest + +JDASPTest diff --git a/src/ini/regressionBaseX.ini b/src/ini/regressionBaseX.ini new file mode 100644 index 00000000..6775f846 --- /dev/null +++ b/src/ini/regressionBaseX.ini @@ -0,0 +1,61 @@ +# java test.BSOAuthenticate +# +# Regression tests for 6163T +# + +# Do not do cleanup. It deletes the library +# JDCleanupTest + +JDDriverTest + +JDBIDITestcase +# +# Remove this later +# + +JDConnectionTest +JDStatementTest + + + +# Don't run parm tests +# JDParmTest +# + +JDBUTest +JDCSTest + +JDPSTest +JDRSTest +JDRSStressTest +JDRSMDTest + +JDDMDTest + +JDPMDTest +JDLobTest +# +# Don't run TC tests -- native only +# JDTCTest +# +JDDSTest + +# Need to cleanup for JTA tests +# Do not run JTA. It drops the collection +#java JTACleanupTx `hostname | sed 's/\..*//'` ThisIsDangerous all +#JTAStdTest +#JTATest +# More JTA Cleanup +# java JTACleanupTx `hostname | sed 's/\..*//'` ThisIsDangerous all + +# Run these later +# JDJSTPTest +JDSavepointTest +JDASPTest + +# Toolbox only tests +AS400JDBCConnectionPoolTest +AS400JDBCDataSourceTest +AS400JDBCRowSetTest +# Test stand alone programs +JDJSTPjdbc diff --git a/src/ini/runitxxxxH.ini b/src/ini/runitxxxxH.ini new file mode 100644 index 00000000..d0d68ab3 --- /dev/null +++ b/src/ini/runitxxxxH.ini @@ -0,0 +1,8 @@ + +descriptionTest=Toolbox JDBC Client Affinities +driver=jtopenCA + + +defaultSecondary=sq740 +otherSecondary=sq750 + diff --git a/src/ini/runitxxxxI.ini b/src/ini/runitxxxxI.ini new file mode 100644 index 00000000..eba831f2 --- /dev/null +++ b/src/ini/runitxxxxI.ini @@ -0,0 +1,8 @@ + +descriptionTest=Toolbox JDBC seamless failover +driver=jtopenSF + + +defaultSecondary=sq740 +otherSecondary=sq750 + diff --git a/src/ini/runitxxxxX.ini b/src/ini/runitxxxxX.ini new file mode 100644 index 00000000..649bd366 --- /dev/null +++ b/src/ini/runitxxxxX.ini @@ -0,0 +1,5 @@ + +descriptionTest=Toolbox JDBC extended dynamic +driver=toolbox +finalArgs= -extendedDynamic + diff --git a/src/test/AS400JDBC/AS400JDBCDataSourceBeanInfoTestcase.java b/src/test/AS400JDBC/AS400JDBCDataSourceBeanInfoTestcase.java index f4b2a411..18b81d6a 100644 --- a/src/test/AS400JDBC/AS400JDBCDataSourceBeanInfoTestcase.java +++ b/src/test/AS400JDBC/AS400JDBCDataSourceBeanInfoTestcase.java @@ -12,7 +12,6 @@ /////////////////////////////////////////////////////////////////////////////// package test.AS400JDBC; - import java.beans.BeanDescriptor; import java.beans.EventSetDescriptor; import java.beans.FeatureDescriptor; @@ -28,1002 +27,957 @@ import test.Testcase; /** - Testcase AS400JDBCDataSourceBeanInfoTestcase. + * Testcase AS400JDBCDataSourceBeanInfoTestcase. **/ -public class AS400JDBCDataSourceBeanInfoTestcase extends Testcase -{ +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. - **/ - public AS400JDBCDataSourceBeanInfoTestcase(AS400 systemObject, - Vector variationsToRun, - int runMode, - FileOutputStream fileOutputStream, - - String password) - { - super(systemObject, "AS400JDBCDataSourceBeanInfoTestcase", variationsToRun, - runMode, fileOutputStream, password); - } - - - private boolean verifyFeatureDescriptor(FeatureDescriptor fd, String dspName, String shortDesc, boolean exp, boolean hid) { - StringBuffer sb = new StringBuffer(); - boolean passed = verifyFeatureDescriptor(fd, dspName, shortDesc, exp, hid, sb); - if (!passed) { - failed(sb.toString()); - } - return passed; - } - - private boolean verifyFeatureDescriptor(FeatureDescriptor fd, String dspName, String shortDesc, boolean exp, boolean hid, StringBuffer sb ) - { - boolean passed = true; - if (!fd.getDisplayName().equals(dspName) && !(dspName.equals("serverTraceCategories") && fd.getDisplayName().equals("serverTrace"))) //Note: serverTraceCategories maps to serverTrace - { - sb.append("Wrong display name: " + fd.getDisplayName()+" sb "+dspName+"\n"); - passed = false; - } - if (!fd.getShortDescription().equals(shortDesc)) - { - sb.append("Wrong short description for '"+ dspName +"' : " + fd.getShortDescription()+" sb "+shortDesc+"\n"); - passed = false; - } - if (fd.isExpert() != exp) - { - sb.append("Wrong isExpert(): " + String.valueOf(fd.isExpert())+"\n"); - passed=false; + 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. + **/ + public AS400JDBCDataSourceBeanInfoTestcase(AS400 systemObject, Vector variationsToRun, int runMode, + FileOutputStream fileOutputStream, + + String password) { + super(systemObject, "AS400JDBCDataSourceBeanInfoTestcase", variationsToRun, runMode, fileOutputStream, password); + } + + private boolean verifyFeatureDescriptor(FeatureDescriptor fd, String dspName, String shortDesc, boolean exp, + boolean hid) { + StringBuffer sb = new StringBuffer(); + boolean passed = verifyFeatureDescriptor(fd, dspName, shortDesc, exp, hid, sb); + if (!passed) { + failed(sb.toString()); + } + return passed; + } + + private boolean verifyFeatureDescriptor(FeatureDescriptor fd, String dspName, String shortDesc, boolean exp, + boolean hid, StringBuffer sb) { + boolean passed = true; + if (!fd.getDisplayName().equals(dspName) + && !(dspName.equals("serverTraceCategories") && fd.getDisplayName().equals("serverTrace"))) // Note: + // serverTraceCategories + // maps to + // serverTrace + { + sb.append("Wrong display name: " + fd.getDisplayName() + " sb " + dspName + "\n"); + passed = false; + } + if (!fd.getShortDescription().equals(shortDesc)) { + sb.append( + "Wrong short description for '" + dspName + "' : " + fd.getShortDescription() + " sb " + shortDesc + "\n"); + passed = false; + } + if (fd.isExpert() != exp) { + sb.append("Wrong isExpert(): " + String.valueOf(fd.isExpert()) + "\n"); + passed = false; + } + if (fd.isHidden() != hid) { + sb.append("Wrong isHidden(): " + String.valueOf(fd.isHidden()) + "\n"); + passed = false; + } + return passed; + } + + /** + * Verify the constructor, AS400JDBCDataSourceBeanInfo().
+ * Expected results: + * + **/ + public void Var001() { + try { + AS400JDBCDataSourceBeanInfo bi = new AS400JDBCDataSourceBeanInfo(); + assertCondition(true, bi.toString()); + } catch (Throwable e) { + failed(e, "Unexpected exception"); + } + } + + /** + * Verify AS400JDBCDataSourceBeanInfo::getBeanDescriptor().
+ * Expected results: + * + **/ + public void Var002() { + try { + AS400JDBCDataSourceBeanInfo bi = new AS400JDBCDataSourceBeanInfo(); + BeanDescriptor bd = bi.getBeanDescriptor(); + if (!bd.getBeanClass().getName().equals("com.ibm.as400.access.AS400JDBCDataSource") + || bd.getCustomizerClass() != null) { + failed("getBeanDescriptor"); + return; } - if (fd.isHidden() != hid) - { - sb.append("Wrong isHidden(): " + String.valueOf(fd.isHidden())+"\n"); - passed = false; + if (!verifyFeatureDescriptor(bd, "AS400JDBCDataSource", "AS400JDBCDataSource", false, false)) { + return; // failed msg issued from verifyFeatureDescriptor() } - return passed ; - } - - /** - Verify the constructor, AS400JDBCDataSourceBeanInfo(). -
- Expected results: - + } catch (Exception e) { + failed(e, "Unexpected exception"); + return; + } + succeeded(); + } + + /** + * Verify AS400JDBCDataSourceBeanInfo::getDefaultEventIndex().
+ * Expected results: + * **/ - public void Var001() - { - try - { - AS400JDBCDataSourceBeanInfo bi = new AS400JDBCDataSourceBeanInfo(); - assertCondition(true, bi.toString()); + public void Var003() { + try { + AS400JDBCDataSourceBeanInfo bi = new AS400JDBCDataSourceBeanInfo(); + int index = bi.getDefaultEventIndex(); + if (index != 0) { + failed("Wrong default event index returned: " + String.valueOf(index)); + return; } - catch(Throwable e) - { - failed(e, "Unexpected exception"); + } catch (Exception e) { + failed(e, "Unexpected exception"); + return; + } + succeeded(); + } + + /** + * Verify AS400JDBCDataSourceBeanInfo::getDefaultPropertyIndex().
+ * Expected results: + * + **/ + public void Var004() { + try { + AS400JDBCDataSourceBeanInfo bi = new AS400JDBCDataSourceBeanInfo(); + int index = bi.getDefaultPropertyIndex(); + if (index != 0) { + failed("Wrong default property index returned: " + String.valueOf(index)); + return; } - } - - /** - Verify AS400JDBCDataSourceBeanInfo::getBeanDescriptor(). -
- Expected results: - + } catch (Exception e) { + failed(e, "Unexpected exception"); + return; + } + succeeded(); + } + + /** + * Verify AS400JDBCDataSourceBeanInfo::getEventSetDescriptors().
+ * Expected results: + * + * **/ - public void Var002() - { - try - { - AS400JDBCDataSourceBeanInfo bi = new AS400JDBCDataSourceBeanInfo(); - BeanDescriptor bd = bi.getBeanDescriptor(); - if (!bd.getBeanClass().getName().equals("com.ibm.as400.access.AS400JDBCDataSource") || bd.getCustomizerClass() != null) - { - failed("getBeanDescriptor"); - return; - } - if (!verifyFeatureDescriptor(bd, "AS400JDBCDataSource", "AS400JDBCDataSource", false, false)) - { - return; // failed msg issued from verifyFeatureDescriptor() - } + public void Var005() { + try { + AS400JDBCDataSourceBeanInfo bi = new AS400JDBCDataSourceBeanInfo(); + EventSetDescriptor[] ed = bi.getEventSetDescriptors(); + if (ed.length != 1) { + failed("Wrong number of event descriptors returned: " + String.valueOf(ed.length)); + return; } - catch(Exception e) - { - failed(e, "Unexpected exception"); - return; + if (!ed[0].getAddListenerMethod().getName().equals("addPropertyChangeListener")) { + failed("Wrong add listener method returned: " + ed[0].getAddListenerMethod().getName()); + return; } - succeeded(); - } - - /** - Verify AS400JDBCDataSourceBeanInfo::getDefaultEventIndex(). -
- Expected results: - - **/ - public void Var003() - { - try - { - AS400JDBCDataSourceBeanInfo bi = new AS400JDBCDataSourceBeanInfo(); - int index = bi.getDefaultEventIndex(); - if (index != 0) - { - failed("Wrong default event index returned: " + String.valueOf(index)); - return; - } + MethodDescriptor[] md0 = ed[0].getListenerMethodDescriptors(); + if (md0.length != 1) { + failed("Wrong number of listener method descriptors returned: " + String.valueOf(md0.length)); + return; } - catch(Exception e) - { - failed(e, "Unexpected exception"); - return; + if (!md0[0].getMethod().getName().equals("propertyChange")) { + failed("Wrong methods returned from the method descriptors from getListenerMethodDescriptors: " + + md0[0].getMethod().getName()); + return; } - succeeded(); - } - - /** - Verify AS400JDBCDataSourceBeanInfo::getDefaultPropertyIndex(). -
- Expected results: - - **/ - public void Var004() - { - try - { - AS400JDBCDataSourceBeanInfo bi = new AS400JDBCDataSourceBeanInfo(); - int index = bi.getDefaultPropertyIndex(); - if (index != 0) - { - failed("Wrong default property index returned: " + String.valueOf(index)); - return; - } + if (ed[0].getListenerMethods().length != 1) { + failed("Wrong number of methods returned from getListenerMethods: " + + String.valueOf(ed[0].getListenerMethods().length)); + return; } - catch(Exception e) - { - failed(e, "Unexpected exception"); - return; + if (!ed[0].getListenerMethods()[0].getName().equals("propertyChange")) { + failed("Wrong methods returned from getListenerMethods: " + ed[0].getListenerMethods()[0].getName()); + return; } - succeeded(); - } - - /** - Verify AS400JDBCDataSourceBeanInfo::getEventSetDescriptors(). -
- Expected results: - - - **/ - public void Var005() - { - try - { - AS400JDBCDataSourceBeanInfo bi = new AS400JDBCDataSourceBeanInfo(); - EventSetDescriptor[] ed = bi.getEventSetDescriptors(); - if (ed.length != 1) - { - failed("Wrong number of event descriptors returned: " + String.valueOf(ed.length)); - return; - } - if (!ed[0].getAddListenerMethod().getName().equals("addPropertyChangeListener")) - { - failed("Wrong add listener method returned: " + - ed[0].getAddListenerMethod().getName()); - return; - } - MethodDescriptor[] md0 = ed[0].getListenerMethodDescriptors(); - if (md0.length != 1) - { - failed("Wrong number of listener method descriptors returned: " + - String.valueOf(md0.length)); - return; - } - if (!md0[0].getMethod().getName().equals("propertyChange")) - { - failed("Wrong methods returned from the method descriptors from getListenerMethodDescriptors: " + - md0[0].getMethod().getName()); - return; - } - if (ed[0].getListenerMethods().length != 1) - { - failed("Wrong number of methods returned from getListenerMethods: " + - String.valueOf(ed[0].getListenerMethods().length)); - return; - } - if (!ed[0].getListenerMethods()[0].getName().equals("propertyChange")) - { - failed("Wrong methods returned from getListenerMethods: " + - ed[0].getListenerMethods()[0].getName()); - return; - } - if (!ed[0].getListenerType().getName().equals("java.beans.PropertyChangeListener")) - { - failed("Wrong listener type returned: " + - ed[0].getListenerType().getName()); - return; - } - if (!ed[0].getRemoveListenerMethod().getName().equals("removePropertyChangeListener")) - { - failed("Wrong Remove listener method returned: " + - ed[0].getRemoveListenerMethod().getName()); - return; - } - if (!ed[0].isInDefaultEventSet()) - { - failed("Wrong value returned from isInDefaultEventSet: " + - String.valueOf(ed[0].isInDefaultEventSet())); - return; - } - if (ed[0].isUnicast()) - { - failed("Wrong value returned from isInDefaultEventSet: " + - String.valueOf(ed[0].isUnicast())); - return; - } - if (!verifyFeatureDescriptor(ed[0], "propertyChange", "A bound property has changed.", false, false)) - { - return; // failed msg issued from verifyFeatureDescriptor() - } + if (!ed[0].getListenerType().getName().equals("java.beans.PropertyChangeListener")) { + failed("Wrong listener type returned: " + ed[0].getListenerType().getName()); + return; } - catch(Exception e) - { - failed(e, "Unexpected exception"); - return; + if (!ed[0].getRemoveListenerMethod().getName().equals("removePropertyChangeListener")) { + failed("Wrong Remove listener method returned: " + ed[0].getRemoveListenerMethod().getName()); + return; } - succeeded(); - } - - /** - Verify AS400JDBCDataSourceBeanInfo::getXIcon(int). -
- Expected results: - - **/ - public void Var006() - { - - // - // Variation does not work on OS/400 - // - if (System.getProperty("os.name").indexOf("400") >= 0) { - notApplicable("Icon testcase not working on OS/400"); - return; - } - // Icons / GUI components no longer available in JTOpen 20.0.X - AS400JDBCDataSourceBeanInfo bi; - try - { - bi = new AS400JDBCDataSourceBeanInfo(); + if (!ed[0].isInDefaultEventSet()) { + failed("Wrong value returned from isInDefaultEventSet: " + String.valueOf(ed[0].isInDefaultEventSet())); + return; + } + if (ed[0].isUnicast()) { + failed("Wrong value returned from isInDefaultEventSet: " + String.valueOf(ed[0].isUnicast())); + return; } - catch(Exception e) - { - failed(e, "Unexpected exception"); - return; + if (!verifyFeatureDescriptor(ed[0], "propertyChange", "A bound property has changed.", false, false)) { + return; // failed msg issued from verifyFeatureDescriptor() } - assertCondition(true, "Create bi="+bi); - } - - - /** - Verify AS400JDBCDataSourceBeanInfo::getPropertyDescriptors(). -
- Expected results: - - + } catch (Exception e) { + failed(e, "Unexpected exception"); + return; + } + succeeded(); + } + + /** + * Verify AS400JDBCDataSourceBeanInfo::getXIcon(int).
+ * Expected results: + * **/ - public void Var007() - { - StringBuffer failMessage = new StringBuffer(); - boolean passed = true; - try - { - int expectedCount = 118; - AS400JDBCDataSourceBeanInfo bi = new AS400JDBCDataSourceBeanInfo(); - PropertyDescriptor[] pd = bi.getPropertyDescriptors(); - if (pd.length != expectedCount) - { - failMessage.append("Wrong number of property descriptors returned: " + String.valueOf(pd.length)+" sb "+expectedCount+" \n"); - passed = false; - } - - for (int i=0; i< pd.length; i++) - { - if (pd[i].getPropertyEditorClass() != null) - { - failMessage.append("Property editor class not null\n"); - passed = false; - } - } - - Properties propertyTypes = new Properties(); - propertyTypes.put("access", "java.lang.String"); - propertyTypes.put("behaviorOverride", "int"); //@A4A - propertyTypes.put("bidiStringType", "int"); //@A1A //@A2C - propertyTypes.put("bigDecimal", "boolean"); - propertyTypes.put("blockCriteria", "int"); - propertyTypes.put("blockSize", "int"); - propertyTypes.put("cursorHold", "boolean"); - propertyTypes.put("cursorSensitivity", "java.lang.String"); - propertyTypes.put("databaseName", "java.lang.String"); - propertyTypes.put("dataCompression", "boolean"); - propertyTypes.put("dataSourceName", "java.lang.String"); - propertyTypes.put("dataTruncation", "boolean"); - propertyTypes.put("dateFormat", "java.lang.String"); - propertyTypes.put("dateSeparator", "java.lang.String"); - propertyTypes.put("decimalSeparator", "java.lang.String"); - propertyTypes.put("description", "java.lang.String"); - propertyTypes.put("driver", "java.lang.String"); - propertyTypes.put("errors", "java.lang.String"); - propertyTypes.put("extendedDynamic", "boolean"); - propertyTypes.put("extendedMetaData", "boolean"); - propertyTypes.put("fullOpen", "boolean"); // @W1a - propertyTypes.put("lazyClose", "boolean"); - propertyTypes.put("libraries", "java.lang.String"); - propertyTypes.put("lobThreshold", "int"); - propertyTypes.put("naming", "java.lang.String"); - propertyTypes.put("package", "java.lang.String"); - propertyTypes.put("packageAdd", "boolean"); - propertyTypes.put("packageCache", "boolean"); - propertyTypes.put("packageClear", "boolean"); - propertyTypes.put("packageCriteria", "java.lang.String"); - propertyTypes.put("packageError", "java.lang.String"); - propertyTypes.put("packageLibrary", "java.lang.String"); - propertyTypes.put("password", "[C"); - propertyTypes.put("portNumber", "int"); - propertyTypes.put("prefetch", "boolean"); - propertyTypes.put("prompt", "boolean"); - propertyTypes.put("proxyServer", "java.lang.String"); - propertyTypes.put("remarks", "java.lang.String"); - propertyTypes.put("savePasswordWhenSerialized", "boolean"); //@A3A - propertyTypes.put("secondaryUrl", "java.lang.String"); - propertyTypes.put("secure", "boolean"); - propertyTypes.put("serverName", "java.lang.String"); - propertyTypes.put("serverTrace", "int"); - propertyTypes.put("sort", "java.lang.String"); - propertyTypes.put("sortLanguage", "java.lang.String"); - propertyTypes.put("sortTable", "java.lang.String"); - propertyTypes.put("sortWeight", "java.lang.String"); - propertyTypes.put("timeFormat", "java.lang.String"); - propertyTypes.put("timeSeparator", "java.lang.String"); - propertyTypes.put("threadUsed", "boolean"); - propertyTypes.put("trace", "boolean"); - propertyTypes.put("transactionIsolation", "java.lang.String"); - propertyTypes.put("translateBinary", "boolean"); - propertyTypes.put("user", "java.lang.String"); - propertyTypes.put("toolboxTrace", "java.lang.String"); - propertyTypes.put("qaqqiniLibrary", "java.lang.String"); - propertyTypes.put("keepAlive", "boolean"); - propertyTypes.put("receiveBufferSize", "int"); - propertyTypes.put("sendBufferSize", "int"); - propertyTypes.put("soLinger", "int"); - propertyTypes.put("soTimeout", "int"); - propertyTypes.put("tcpNoDelay", "boolean"); - propertyTypes.put("packageCCSID", "int"); - propertyTypes.put("minimumDivideScale", "int"); - propertyTypes.put("maximumPrecision", "int"); - propertyTypes.put("maximumScale", "int"); - propertyTypes.put("translateHex", "java.lang.String"); - propertyTypes.put("serverTraceCategories", "int"); - propertyTypes.put("loginTimeout", "int"); - propertyTypes.put("trueAutoCommit", "boolean"); - propertyTypes.put("bidiImplicitReordering", "boolean"); - propertyTypes.put("bidiNumericOrdering", "boolean"); - propertyTypes.put("holdInputLocators", "boolean"); - propertyTypes.put("holdStatements", "boolean"); - propertyTypes.put("rollbackCursorHold", "boolean"); //@C1A - propertyTypes.put("variableFieldCompression", "java.lang.String"); //@C1A - propertyTypes.put("queryOptimizeGoal", "int"); //@C1A - propertyTypes.put("xaLooselyCoupledSupport", "int"); //@PDA - propertyTypes.put("translateBoolean", "boolean"); //@PDA - propertyTypes.put("metaDataSource", "int"); //@D1A - propertyTypes.put("queryStorageLimit", "int"); //@pda - propertyTypes.put("decfloatRoundingMode", "java.lang.String"); //@pda - propertyTypes.put("autocommitException", "boolean"); //@D3A - propertyTypes.put("autoCommit", "boolean"); //@AC1 - propertyTypes.put("ignoreWarnings", "java.lang.String"); - propertyTypes.put("secureCurrentUser", "boolean"); - propertyTypes.put("concurrentAccessResolution", "int"); - propertyTypes.put("jvm16Synchronize", "boolean"); //@dmy - propertyTypes.put("socketTimeout", "int"); - propertyTypes.put("maximumBlockedInputRows", "int"); - propertyTypes.put("queryTimeoutMechanism", "java.lang.String"); - propertyTypes.put("queryReplaceTruncatedParameter","java.lang.String"); + public void Var006() { + + // + // Variation does not work on OS/400 + // + if (System.getProperty("os.name").indexOf("400") >= 0) { + notApplicable("Icon testcase not working on OS/400"); + return; + } + // Icons / GUI components no longer available in JTOpen 20.0.X + AS400JDBCDataSourceBeanInfo bi; + try { + bi = new AS400JDBCDataSourceBeanInfo(); + } catch (Exception e) { + failed(e, "Unexpected exception"); + return; + } + assertCondition(true, "Create bi=" + bi); + } + + /** + * Verify AS400JDBCDataSourceBeanInfo::getPropertyDescriptors().
+ * Expected results: + * + * + **/ + public void Var007() { + StringBuffer failMessage = new StringBuffer(); + boolean passed = true; + try { + int expectedCount = 118; + AS400JDBCDataSourceBeanInfo bi = new AS400JDBCDataSourceBeanInfo(); + PropertyDescriptor[] pd = bi.getPropertyDescriptors(); + if (pd.length != expectedCount) { + failMessage.append("Wrong number of property descriptors returned: " + String.valueOf(pd.length) + " sb " + + expectedCount + " \n"); + passed = false; + } - propertyTypes.put("numericRangeError","java.lang.String"); - propertyTypes.put("characterTruncation","java.lang.String"); - propertyTypes.put("secondaryURL","java.lang.String"); - propertyTypes.put("packageCcsid","int"); - propertyTypes.put("qaqqinilib","java.lang.String"); - propertyTypes.put("trueAutocommit","boolean"); - propertyTypes.put("useBlockUpdate","boolean"); - propertyTypes.put("describeOption","java.lang.String"); - propertyTypes.put("decimalDataErrors","java.lang.String"); - propertyTypes.put("timestampFormat","java.lang.String"); - propertyTypes.put("useDrdaMetadataVersion","boolean"); - propertyTypes.put("extendedMetadata","boolean"); - propertyTypes.put("toolboxTraceCategory", "java.lang.String"); - propertyTypes.put("metadataSource", "int"); //@D1A -propertyTypes.put("enableClientAffinitiesList", "int"); -propertyTypes.put("affinityFailbackInterval","int"); -propertyTypes.put("clientRerouteAlternateServerName","java.lang.String"); -propertyTypes.put("clientRerouteAlternatePortNumber","java.lang.String"); -propertyTypes.put("maxRetriesForClientReroute","int"); -propertyTypes.put("retryIntervalForClientReroute","int"); -propertyTypes.put("enableSeamlessFailover","int"); -propertyTypes.put("additionalAuthenticationFactor","[C"); - propertyTypes.put("stayAlive","int"); - propertyTypes.put("tlsTruststore","java.lang.String"); - propertyTypes.put("tlsTruststorePassword","java.lang.String"); -propertyTypes.put("useSock5", "boolean"); + for (int i = 0; i < pd.length; i++) { + if (pd[i].getPropertyEditorClass() != null) { + failMessage.append("Property editor class not null\n"); + passed = false; + } + } - + Properties propertyTypes = new Properties(); + propertyTypes.put("access", "java.lang.String"); + propertyTypes.put("behaviorOverride", "int"); // @A4A + propertyTypes.put("bidiStringType", "int"); // @A1A //@A2C + propertyTypes.put("bigDecimal", "boolean"); + propertyTypes.put("blockCriteria", "int"); + propertyTypes.put("blockSize", "int"); + propertyTypes.put("cursorHold", "boolean"); + propertyTypes.put("cursorSensitivity", "java.lang.String"); + propertyTypes.put("databaseName", "java.lang.String"); + propertyTypes.put("dataCompression", "boolean"); + propertyTypes.put("dataSourceName", "java.lang.String"); + propertyTypes.put("dataTruncation", "boolean"); + propertyTypes.put("dateFormat", "java.lang.String"); + propertyTypes.put("dateSeparator", "java.lang.String"); + propertyTypes.put("decimalSeparator", "java.lang.String"); + propertyTypes.put("description", "java.lang.String"); + propertyTypes.put("driver", "java.lang.String"); + propertyTypes.put("errors", "java.lang.String"); + propertyTypes.put("extendedDynamic", "boolean"); + propertyTypes.put("extendedMetaData", "boolean"); + propertyTypes.put("fullOpen", "boolean"); // @W1a + propertyTypes.put("lazyClose", "boolean"); + propertyTypes.put("libraries", "java.lang.String"); + propertyTypes.put("lobThreshold", "int"); + propertyTypes.put("naming", "java.lang.String"); + propertyTypes.put("package", "java.lang.String"); + propertyTypes.put("packageAdd", "boolean"); + propertyTypes.put("packageCache", "boolean"); + propertyTypes.put("packageClear", "boolean"); + propertyTypes.put("packageCriteria", "java.lang.String"); + propertyTypes.put("packageError", "java.lang.String"); + propertyTypes.put("packageLibrary", "java.lang.String"); + propertyTypes.put("password", "[C"); + propertyTypes.put("portNumber", "int"); + propertyTypes.put("prefetch", "boolean"); + propertyTypes.put("prompt", "boolean"); + propertyTypes.put("proxyServer", "java.lang.String"); + propertyTypes.put("remarks", "java.lang.String"); + propertyTypes.put("savePasswordWhenSerialized", "boolean"); // @A3A + propertyTypes.put("secondaryUrl", "java.lang.String"); + propertyTypes.put("secure", "boolean"); + propertyTypes.put("serverName", "java.lang.String"); + propertyTypes.put("serverTrace", "int"); + propertyTypes.put("sort", "java.lang.String"); + propertyTypes.put("sortLanguage", "java.lang.String"); + propertyTypes.put("sortTable", "java.lang.String"); + propertyTypes.put("sortWeight", "java.lang.String"); + propertyTypes.put("timeFormat", "java.lang.String"); + propertyTypes.put("timeSeparator", "java.lang.String"); + propertyTypes.put("threadUsed", "boolean"); + propertyTypes.put("trace", "boolean"); + propertyTypes.put("transactionIsolation", "java.lang.String"); + propertyTypes.put("translateBinary", "boolean"); + propertyTypes.put("user", "java.lang.String"); + propertyTypes.put("toolboxTrace", "java.lang.String"); + propertyTypes.put("qaqqiniLibrary", "java.lang.String"); + propertyTypes.put("keepAlive", "boolean"); + propertyTypes.put("receiveBufferSize", "int"); + propertyTypes.put("sendBufferSize", "int"); + propertyTypes.put("soLinger", "int"); + propertyTypes.put("soTimeout", "int"); + propertyTypes.put("tcpNoDelay", "boolean"); + propertyTypes.put("packageCCSID", "int"); + propertyTypes.put("minimumDivideScale", "int"); + propertyTypes.put("maximumPrecision", "int"); + propertyTypes.put("maximumScale", "int"); + propertyTypes.put("translateHex", "java.lang.String"); + propertyTypes.put("serverTraceCategories", "int"); + propertyTypes.put("loginTimeout", "int"); + propertyTypes.put("trueAutoCommit", "boolean"); + propertyTypes.put("bidiImplicitReordering", "boolean"); + propertyTypes.put("bidiNumericOrdering", "boolean"); + propertyTypes.put("holdInputLocators", "boolean"); + propertyTypes.put("holdStatements", "boolean"); + propertyTypes.put("rollbackCursorHold", "boolean"); // @C1A + propertyTypes.put("variableFieldCompression", "java.lang.String"); // @C1A + propertyTypes.put("queryOptimizeGoal", "int"); // @C1A + propertyTypes.put("xaLooselyCoupledSupport", "int"); // @PDA + propertyTypes.put("translateBoolean", "boolean"); // @PDA + propertyTypes.put("metaDataSource", "int"); // @D1A + propertyTypes.put("queryStorageLimit", "int"); // @pda + propertyTypes.put("decfloatRoundingMode", "java.lang.String"); // @pda + propertyTypes.put("autocommitException", "boolean"); // @D3A + propertyTypes.put("autoCommit", "boolean"); // @AC1 + propertyTypes.put("ignoreWarnings", "java.lang.String"); + propertyTypes.put("secureCurrentUser", "boolean"); + propertyTypes.put("concurrentAccessResolution", "int"); + propertyTypes.put("jvm16Synchronize", "boolean"); // @dmy + propertyTypes.put("socketTimeout", "int"); + propertyTypes.put("maximumBlockedInputRows", "int"); + propertyTypes.put("queryTimeoutMechanism", "java.lang.String"); + propertyTypes.put("queryReplaceTruncatedParameter", "java.lang.String"); + + propertyTypes.put("numericRangeError", "java.lang.String"); + propertyTypes.put("characterTruncation", "java.lang.String"); + propertyTypes.put("secondaryURL", "java.lang.String"); + propertyTypes.put("packageCcsid", "int"); + propertyTypes.put("qaqqinilib", "java.lang.String"); + propertyTypes.put("trueAutocommit", "boolean"); + propertyTypes.put("useBlockUpdate", "boolean"); + propertyTypes.put("describeOption", "java.lang.String"); + propertyTypes.put("decimalDataErrors", "java.lang.String"); + propertyTypes.put("timestampFormat", "java.lang.String"); + propertyTypes.put("useDrdaMetadataVersion", "boolean"); + propertyTypes.put("extendedMetadata", "boolean"); + propertyTypes.put("toolboxTraceCategory", "java.lang.String"); + propertyTypes.put("metadataSource", "int"); // @D1A + propertyTypes.put("enableClientAffinitiesList", "int"); + propertyTypes.put("affinityFailbackInterval", "int"); + propertyTypes.put("clientRerouteAlternateServerName", "java.lang.String"); + propertyTypes.put("clientRerouteAlternatePortNumber", "java.lang.String"); + propertyTypes.put("maxRetriesForClientReroute", "int"); + propertyTypes.put("retryIntervalForClientReroute", "int"); + propertyTypes.put("enableSeamlessFailover", "int"); + propertyTypes.put("additionalAuthenticationFactor", "[C"); + propertyTypes.put("stayAlive", "int"); + propertyTypes.put("tlsTruststore", "java.lang.String"); + propertyTypes.put("tlsTruststorePassword", "java.lang.String"); + propertyTypes.put("useSock5", "boolean"); + + for (int i = 0; i < pd.length; i++) { + String value = (String) propertyTypes.get(pd[i].getName()); + if (!pd[i].getPropertyType().getName().equals(value)) { + if ("password".equals(pd[i].getName()) && "java.lang.String".equals(pd[i].getPropertyType().toString())) { + /* valid case */ + } else { + failMessage.append("Wrong property types returned: [" + i + "] (" + pd[i].getName() + ") " + + pd[i].getPropertyType().toString() + " should be " + value + "\n"); + passed = false; + } + } + } - - for (int i=0; i< pd.length; i++) - { - String value = (String)propertyTypes.get(pd[i].getName()); - if (!pd[i].getPropertyType().getName().equals(value)) - { - if ("password".equals(pd[i].getName()) && "String".equals(pd[i].getPropertyType().toString())) { - /* valid case */ + Properties getPropertyMethods = new Properties(); + getPropertyMethods.put("access", "getAccess"); + getPropertyMethods.put("behaviorOverride", "getBehaviorOverride"); + getPropertyMethods.put("bidiStringType", "getBidiStringType"); // @A1A + getPropertyMethods.put("bigDecimal", "isBigDecimal"); + getPropertyMethods.put("blockCriteria", "getBlockCriteria"); + getPropertyMethods.put("blockSize", "getBlockSize"); + getPropertyMethods.put("cursorHold", "isCursorHold"); + getPropertyMethods.put("cursorSensitivity", "getCursorSensitivity"); + getPropertyMethods.put("databaseName", "getDatabaseName"); + getPropertyMethods.put("dataCompression", "isDataCompression"); + getPropertyMethods.put("dataSourceName", "getDataSourceName"); + getPropertyMethods.put("dataTruncation", "isDataTruncation"); + getPropertyMethods.put("dateFormat", "getDateFormat"); + getPropertyMethods.put("dateSeparator", "getDateSeparator"); + getPropertyMethods.put("decimalSeparator", "getDecimalSeparator"); + getPropertyMethods.put("description", "getDescription"); + getPropertyMethods.put("driver", "getDriver"); + getPropertyMethods.put("errors", "getErrors"); + getPropertyMethods.put("extendedDynamic", "isExtendedDynamic"); + getPropertyMethods.put("extendedMetaData", "isExtendedMetaData"); // @A3A + getPropertyMethods.put("fullOpen", "isFullOpen"); // @W1a + getPropertyMethods.put("lazyClose", "isLazyClose"); + getPropertyMethods.put("libraries", "getLibraries"); + getPropertyMethods.put("lobThreshold", "getLobThreshold"); + getPropertyMethods.put("naming", "getNaming"); + getPropertyMethods.put("package", "getPackage"); + getPropertyMethods.put("packageAdd", "isPackageAdd"); + getPropertyMethods.put("packageCache", "isPackageCache"); + getPropertyMethods.put("packageClear", "isPackageClear"); + getPropertyMethods.put("packageCriteria", "getPackageCriteria"); + getPropertyMethods.put("packageError", "getPackageError"); + getPropertyMethods.put("packageLibrary", "getPackageLibrary"); + getPropertyMethods.remove("password"); + getPropertyMethods.put("portNumber", "getPortNumber"); + getPropertyMethods.put("prefetch", "isPrefetch"); + getPropertyMethods.put("prompt", "isPrompt"); + getPropertyMethods.put("proxyServer", "getProxyServer"); + getPropertyMethods.put("remarks", "getRemarks"); + getPropertyMethods.put("savePasswordWhenSerialized", "isSavePasswordWhenSerialized"); // @A3A + getPropertyMethods.put("secondaryUrl", "getSecondaryUrl"); + getPropertyMethods.put("secure", "isSecure"); + getPropertyMethods.put("serverName", "getServerName"); + getPropertyMethods.put("serverTrace", "getServerTrace"); + getPropertyMethods.put("sort", "getSort"); + getPropertyMethods.put("sortLanguage", "getSortLanguage"); + getPropertyMethods.put("sortTable", "getSortTable"); + getPropertyMethods.put("sortWeight", "getSortWeight"); + getPropertyMethods.put("timeFormat", "getTimeFormat"); + getPropertyMethods.put("timeSeparator", "getTimeSeparator"); + getPropertyMethods.put("threadUsed", "isThreadUsed"); + getPropertyMethods.put("trace", "isTrace"); + getPropertyMethods.put("transactionIsolation", "getTransactionIsolation"); + getPropertyMethods.put("translateBinary", "isTranslateBinary"); + getPropertyMethods.put("user", "getUser"); + getPropertyMethods.put("toolboxTrace", "getToolboxTraceCategory"); + getPropertyMethods.put("qaqqiniLibrary", "getQaqqiniLibrary"); + getPropertyMethods.put("keepAlive", "isKeepAlive"); + getPropertyMethods.put("receiveBufferSize", "getReceiveBufferSize"); + getPropertyMethods.put("sendBufferSize", "getSendBufferSize"); + getPropertyMethods.put("soLinger", "getSoLinger"); + getPropertyMethods.put("soTimeout", "getSoTimeout"); + getPropertyMethods.put("tcpNoDelay", "getTcpNoDelay"); + getPropertyMethods.put("packageCCSID", "getPackageCCSID"); + getPropertyMethods.put("minimumDivideScale", "getMinimumDivideScale"); + getPropertyMethods.put("maximumPrecision", "getMaximumPrecision"); + getPropertyMethods.put("maximumScale", "getMaximumScale"); + getPropertyMethods.put("translateHex", "getTranslateHex"); + getPropertyMethods.put("serverTraceCategories", "getServerTraceCategories"); + getPropertyMethods.put("loginTimeout", "getLoginTimeout"); + getPropertyMethods.put("trueAutoCommit", "isTrueAutoCommit"); + getPropertyMethods.put("bidiImplicitReordering", "isBidiImplicitReordering"); + getPropertyMethods.put("bidiNumericOrdering", "isBidiNumericOrdering"); + getPropertyMethods.put("holdInputLocators", "isHoldInputLocators"); + getPropertyMethods.put("holdStatements", "isHoldStatements"); + getPropertyMethods.put("rollbackCursorHold", "isRollbackCursorHold"); // @C1A + getPropertyMethods.put("variableFieldCompression", "getVariableFieldCompression"); // @C1A + getPropertyMethods.put("queryOptimizeGoal", "getQueryOptimizeGoal"); // @C1A + getPropertyMethods.put("xaLooselyCoupledSupport", "getXALooselyCoupledSupport"); // @PDA + getPropertyMethods.put("translateBoolean", "isTranslateBoolean"); // @PDA + getPropertyMethods.put("metaDataSource", "getMetaDataSource"); // @D1A + getPropertyMethods.put("queryStorageLimit", "getQueryStorageLimit"); // @pda + getPropertyMethods.put("decfloatRoundingMode", "getDecfloatRoundingMode"); // @pda + getPropertyMethods.put("autocommitException", "isAutocommitException"); // @D3A + getPropertyMethods.put("autoCommit", "isAutoCommit"); + getPropertyMethods.put("ignoreWarnings", "getIgnoreWarnings"); + getPropertyMethods.put("secureCurrentUser", "isSecureCurrentUser"); + getPropertyMethods.put("concurrentAccessResolution", "getConcurrentAccessResolution"); + getPropertyMethods.put("jvm16Synchronize", "isJvm16Synchronize"); // @dmy + getPropertyMethods.put("socketTimeout", "getSocketTimeout"); + getPropertyMethods.put("maximumBlockedInputRows", "getMaximumBlockedInputRows"); + getPropertyMethods.put("queryTimeoutMechanism", "getQueryTimeoutMechanism"); + getPropertyMethods.put("queryReplaceTruncatedParameter", "getQueryReplaceTruncatedParameter"); + getPropertyMethods.put("portNumber", "getPortNumber"); + + getPropertyMethods.put("extendedMetadata", "isExtendedMetadata"); + getPropertyMethods.put("keepAlive", "isKeepAlive"); + getPropertyMethods.put("numericRangeError", "getNumericRangeError"); + getPropertyMethods.put("characterTruncation", "getCharacterTruncation"); + getPropertyMethods.put("secondaryURL", "getSecondaryURL"); + getPropertyMethods.put("packageCcsid", "getPackageCcsid"); + getPropertyMethods.put("qaqqinilib", "getQaqqinilib"); + getPropertyMethods.put("trueAutocommit", "isTrueAutocommit"); + getPropertyMethods.put("metadataSource", "getMetadataSource"); + getPropertyMethods.put("useBlockUpdate", "isUseBlockUpdate"); + getPropertyMethods.put("describeOption", "getDescribeOption"); + getPropertyMethods.put("decimalDataErrors", "getDecimalDataErrors"); + getPropertyMethods.put("timestampFormat", "getTimestampFormat"); + getPropertyMethods.put("useDrdaMetadataVersion", "isUseDrdaMetadataVersion"); + getPropertyMethods.put("toolboxTraceCategory", "getToolboxTraceCategory"); + + getPropertyMethods.put("enableClientAffinitiesList", "getEnableClientAffinitiesList"); + getPropertyMethods.put("affinityFailbackInterval", "getAffinityFailbackInterval"); + getPropertyMethods.put("clientRerouteAlternateServerName", "getClientRerouteAlternateServerName"); + getPropertyMethods.put("clientRerouteAlternatePortNumber", "getClientRerouteAlternatePortNumber"); + getPropertyMethods.put("maxRetriesForClientReroute", "getMaxRetriesForClientReroute"); + getPropertyMethods.put("retryIntervalForClientReroute", "getRetryIntervalForClientReroute"); + getPropertyMethods.put("enableSeamlessFailover", "getEnableSeamlessFailover"); + + getPropertyMethods.put("additionalAuthenticationFactor", "getAdditionalAuthenticationFactor"); + getPropertyMethods.put("stayAlive", "getStayAlive"); + getPropertyMethods.put("tlsTruststore", "getTlsTruststore"); + getPropertyMethods.put("tlsTruststorePassword", "getTlsTruststorePassword"); + getPropertyMethods.put("useSock5", "isUseSock5"); + + for (int i = 0; i < pd.length; i++) { + if (pd[i].getName().equals("password")) // password. + { + if (pd[i].getReadMethod() != null) { + failMessage.append("Wrong read method: " + pd[i].getReadMethod().getName() + "\n"); + passed = false; + } + } else { + String name = pd[i].getName(); + String value = (String) getPropertyMethods.get(name); + if (!pd[i].getReadMethod().getName().equals(value)) { + // Check for weird cases + if (name.equals("toolboxTrace") && pd[i].getReadMethod().getName().equals("getToolboxTrace")) { + // OK Skip + } else if (name.equals("serverTrace") + && pd[i].getReadMethod().getName().equals("getServerTraceCategories")) { + } else { + + if (pd[i].getReadMethod().getName().equals("isTcpNoDelay") && value.equals("getTcpNoDelay")) { + // Ignore this mismatch } else { - failMessage.append("Wrong property types returned: [" + i + "] ("+pd[i].getName()+") " + pd[i].getPropertyType().toString()+" should be "+value+"\n"); - passed = false; - } - } - } - - Properties getPropertyMethods = new Properties() ; - getPropertyMethods.put("access", "getAccess"); - getPropertyMethods.put("behaviorOverride", "getBehaviorOverride"); - getPropertyMethods.put("bidiStringType", "getBidiStringType"); //@A1A - getPropertyMethods.put("bigDecimal", "isBigDecimal"); - getPropertyMethods.put("blockCriteria", "getBlockCriteria"); - getPropertyMethods.put("blockSize", "getBlockSize"); - getPropertyMethods.put("cursorHold", "isCursorHold"); - getPropertyMethods.put("cursorSensitivity", "getCursorSensitivity"); - getPropertyMethods.put("databaseName", "getDatabaseName"); - getPropertyMethods.put("dataCompression", "isDataCompression"); - getPropertyMethods.put("dataSourceName", "getDataSourceName"); - getPropertyMethods.put("dataTruncation", "isDataTruncation"); - getPropertyMethods.put("dateFormat", "getDateFormat"); - getPropertyMethods.put("dateSeparator", "getDateSeparator"); - getPropertyMethods.put("decimalSeparator", "getDecimalSeparator"); - getPropertyMethods.put("description", "getDescription"); - getPropertyMethods.put("driver", "getDriver"); - getPropertyMethods.put("errors", "getErrors"); - getPropertyMethods.put("extendedDynamic", "isExtendedDynamic"); - getPropertyMethods.put("extendedMetaData", "isExtendedMetaData"); //@A3A - getPropertyMethods.put("fullOpen", "isFullOpen"); //@W1a - getPropertyMethods.put("lazyClose", "isLazyClose"); - getPropertyMethods.put("libraries", "getLibraries"); - getPropertyMethods.put("lobThreshold", "getLobThreshold"); - getPropertyMethods.put("naming", "getNaming"); - getPropertyMethods.put("package", "getPackage"); - getPropertyMethods.put("packageAdd", "isPackageAdd"); - getPropertyMethods.put("packageCache", "isPackageCache"); - getPropertyMethods.put("packageClear", "isPackageClear"); - getPropertyMethods.put("packageCriteria", "getPackageCriteria"); - getPropertyMethods.put("packageError", "getPackageError"); - getPropertyMethods.put("packageLibrary", "getPackageLibrary"); - getPropertyMethods.remove("password"); - getPropertyMethods.put("portNumber", "getPortNumber"); - getPropertyMethods.put("prefetch", "isPrefetch"); - getPropertyMethods.put("prompt", "isPrompt"); - getPropertyMethods.put("proxyServer", "getProxyServer"); - getPropertyMethods.put("remarks", "getRemarks"); - getPropertyMethods.put("savePasswordWhenSerialized", "isSavePasswordWhenSerialized"); //@A3A - getPropertyMethods.put("secondaryUrl", "getSecondaryUrl"); - getPropertyMethods.put("secure", "isSecure"); - getPropertyMethods.put("serverName", "getServerName"); - getPropertyMethods.put("serverTrace", "getServerTrace"); - getPropertyMethods.put("sort", "getSort"); - getPropertyMethods.put("sortLanguage", "getSortLanguage"); - getPropertyMethods.put("sortTable", "getSortTable"); - getPropertyMethods.put("sortWeight", "getSortWeight"); - getPropertyMethods.put("timeFormat", "getTimeFormat"); - getPropertyMethods.put("timeSeparator", "getTimeSeparator"); - getPropertyMethods.put("threadUsed", "isThreadUsed"); - getPropertyMethods.put("trace", "isTrace"); - getPropertyMethods.put("transactionIsolation", "getTransactionIsolation"); - getPropertyMethods.put("translateBinary", "isTranslateBinary"); - getPropertyMethods.put("user", "getUser"); - getPropertyMethods.put("toolboxTrace", "getToolboxTraceCategory"); - getPropertyMethods.put("qaqqiniLibrary", "getQaqqiniLibrary"); - getPropertyMethods.put("keepAlive", "isKeepAlive"); - getPropertyMethods.put("receiveBufferSize", "getReceiveBufferSize"); - getPropertyMethods.put("sendBufferSize", "getSendBufferSize"); - getPropertyMethods.put("soLinger", "getSoLinger"); - getPropertyMethods.put("soTimeout", "getSoTimeout"); - getPropertyMethods.put("tcpNoDelay", "getTcpNoDelay"); - getPropertyMethods.put("packageCCSID", "getPackageCCSID"); - getPropertyMethods.put("minimumDivideScale", "getMinimumDivideScale"); - getPropertyMethods.put("maximumPrecision", "getMaximumPrecision"); - getPropertyMethods.put("maximumScale", "getMaximumScale"); - getPropertyMethods.put("translateHex", "getTranslateHex"); - getPropertyMethods.put("serverTraceCategories", "getServerTraceCategories"); - getPropertyMethods.put("loginTimeout", "getLoginTimeout"); - getPropertyMethods.put("trueAutoCommit", "isTrueAutoCommit"); - getPropertyMethods.put("bidiImplicitReordering", "isBidiImplicitReordering"); - getPropertyMethods.put("bidiNumericOrdering", "isBidiNumericOrdering"); - getPropertyMethods.put("holdInputLocators", "isHoldInputLocators"); - getPropertyMethods.put("holdStatements", "isHoldStatements"); - getPropertyMethods.put("rollbackCursorHold", "isRollbackCursorHold"); //@C1A - getPropertyMethods.put("variableFieldCompression", "getVariableFieldCompression"); //@C1A - getPropertyMethods.put("queryOptimizeGoal", "getQueryOptimizeGoal"); //@C1A - getPropertyMethods.put("xaLooselyCoupledSupport", "getXALooselyCoupledSupport"); //@PDA - getPropertyMethods.put("translateBoolean", "isTranslateBoolean"); //@PDA - getPropertyMethods.put("metaDataSource", "getMetaDataSource"); //@D1A - getPropertyMethods.put("queryStorageLimit", "getQueryStorageLimit"); //@pda - getPropertyMethods.put("decfloatRoundingMode", "getDecfloatRoundingMode"); //@pda - getPropertyMethods.put("autocommitException", "isAutocommitException"); //@D3A - getPropertyMethods.put("autoCommit", "isAutoCommit"); - getPropertyMethods.put("ignoreWarnings", "getIgnoreWarnings"); - getPropertyMethods.put("secureCurrentUser", "isSecureCurrentUser"); - getPropertyMethods.put("concurrentAccessResolution", "getConcurrentAccessResolution"); - getPropertyMethods.put("jvm16Synchronize", "isJvm16Synchronize"); //@dmy - getPropertyMethods.put("socketTimeout", "getSocketTimeout"); - getPropertyMethods.put("maximumBlockedInputRows", "getMaximumBlockedInputRows"); - getPropertyMethods.put("queryTimeoutMechanism", "getQueryTimeoutMechanism"); - getPropertyMethods.put("queryReplaceTruncatedParameter", "getQueryReplaceTruncatedParameter"); - getPropertyMethods.put("portNumber", "getPortNumber"); - - -getPropertyMethods.put("extendedMetadata","isExtendedMetadata"); -getPropertyMethods.put("keepAlive","isKeepAlive"); -getPropertyMethods.put("numericRangeError","getNumericRangeError"); -getPropertyMethods.put("characterTruncation","getCharacterTruncation"); -getPropertyMethods.put("secondaryURL","getSecondaryURL"); -getPropertyMethods.put("packageCcsid","getPackageCcsid"); -getPropertyMethods.put("qaqqinilib","getQaqqinilib"); -getPropertyMethods.put("trueAutocommit","isTrueAutocommit"); -getPropertyMethods.put("metadataSource","getMetadataSource"); -getPropertyMethods.put("useBlockUpdate","isUseBlockUpdate"); -getPropertyMethods.put("describeOption","getDescribeOption"); -getPropertyMethods.put("decimalDataErrors","getDecimalDataErrors"); -getPropertyMethods.put("timestampFormat","getTimestampFormat"); -getPropertyMethods.put("useDrdaMetadataVersion","isUseDrdaMetadataVersion"); -getPropertyMethods.put("toolboxTraceCategory", "getToolboxTraceCategory"); - -getPropertyMethods.put("enableClientAffinitiesList", "getEnableClientAffinitiesList"); -getPropertyMethods.put("affinityFailbackInterval","getAffinityFailbackInterval"); -getPropertyMethods.put("clientRerouteAlternateServerName","getClientRerouteAlternateServerName"); -getPropertyMethods.put("clientRerouteAlternatePortNumber","getClientRerouteAlternatePortNumber"); -getPropertyMethods.put("maxRetriesForClientReroute","getMaxRetriesForClientReroute"); -getPropertyMethods.put("retryIntervalForClientReroute","getRetryIntervalForClientReroute"); -getPropertyMethods.put("enableSeamlessFailover","getEnableSeamlessFailover"); - -getPropertyMethods.put("additionalAuthenticationFactor","getAdditionalAuthenticationFactor"); -getPropertyMethods.put("stayAlive","getStayAlive"); -getPropertyMethods.put("tlsTruststore","getTlsTruststore"); -getPropertyMethods.put("tlsTruststorePassword","getTlsTruststorePassword"); -getPropertyMethods.put("useSock5","isUseSock5"); - - - for (int i=0; i< pd.length; i++) - { - if (pd[i].getName().equals("password")) // password. - { - if (pd[i].getReadMethod() != null) - { - failMessage.append("Wrong read method: " + pd[i].getReadMethod().getName()+"\n"); - passed = false; - } - } - else - { - String name = pd[i].getName(); - String value = (String)getPropertyMethods.get(name); - if (!pd[i].getReadMethod().getName().equals(value)) - { - // Check for weird cases - if (name.equals("toolboxTrace") && - pd[i].getReadMethod().getName().equals("getToolboxTrace")) - { - // OK Skip - } else if (name.equals("serverTrace") && - pd[i].getReadMethod().getName().equals("getServerTraceCategories")) - { - } else { - - if (pd[i].getReadMethod().getName().equals("isTcpNoDelay") && - value.equals("getTcpNoDelay") ) { - // Ignore this mismatch - } else { - - failMessage.append("Wrong read method for "+pd[i].getName()+": " + pd[i].getReadMethod().getName()+" not "+value+"\n"); - passed=false; - } - } - } - } - } - - Properties setPropertyMethods = new Properties() ; - setPropertyMethods.put("access", "setAccess"); - setPropertyMethods.put("behaviorOverride", "setBehaviorOverride"); - setPropertyMethods.put("bidiStringType", "setBidiStringType"); //@A1A - setPropertyMethods.put("bigDecimal", "setBigDecimal"); - setPropertyMethods.put("blockCriteria", "setBlockCriteria"); - setPropertyMethods.put("blockSize", "setBlockSize"); - setPropertyMethods.put("cursorHold", "setCursorHold"); - setPropertyMethods.put("cursorSensitivity", "setCursorSensitivity"); - setPropertyMethods.put("databaseName", "setDatabaseName"); - setPropertyMethods.put("dataCompression", "setDataCompression"); - setPropertyMethods.put("dataSourceName", "setDataSourceName"); - setPropertyMethods.put("dataTruncation", "setDataTruncation"); - setPropertyMethods.put("dateFormat", "setDateFormat"); - setPropertyMethods.put("dateSeparator", "setDateSeparator"); - setPropertyMethods.put("decimalSeparator", "setDecimalSeparator"); - setPropertyMethods.put("description", "setDescription"); - setPropertyMethods.put("driver", "setDriver"); - setPropertyMethods.put("errors", "setErrors"); - setPropertyMethods.put("extendedDynamic", "setExtendedDynamic"); - setPropertyMethods.put("extendedMetaData", "setExtendedMetaData"); //@A3A - setPropertyMethods.put("fullOpen", "setFullOpen"); // @W1a - setPropertyMethods.put("lazyClose", "setLazyClose"); - setPropertyMethods.put("libraries", "setLibraries"); - setPropertyMethods.put("lobThreshold", "setLobThreshold"); - setPropertyMethods.put("naming", "setNaming"); - setPropertyMethods.put("package", "setPackage"); - setPropertyMethods.put("packageAdd", "setPackageAdd"); - setPropertyMethods.put("packageCache", "setPackageCache"); - setPropertyMethods.put("packageClear", "setPackageClear"); - setPropertyMethods.put("packageCriteria", "setPackageCriteria"); - setPropertyMethods.put("packageError", "setPackageError"); - setPropertyMethods.put("packageLibrary", "setPackageLibrary"); - setPropertyMethods.put("password", "setPassword"); - setPropertyMethods.put("portNumber", "setPortNumber"); - setPropertyMethods.put("prefetch", "setPrefetch"); - setPropertyMethods.put("prompt", "setPrompt"); - setPropertyMethods.put("proxyServer", "setProxyServer"); - setPropertyMethods.put("remarks", "setRemarks"); - setPropertyMethods.put("savePasswordWhenSerialized", "setSavePasswordWhenSerialized"); //@A3A - setPropertyMethods.put("secondaryUrl", "setSecondaryUrl"); - setPropertyMethods.put("secure", "setSecure"); - setPropertyMethods.put("serverName", "setServerName"); - setPropertyMethods.put("serverTrace", "setServerTraceCategories"); - setPropertyMethods.put("sort", "setSort"); - setPropertyMethods.put("sortLanguage", "setSortLanguage"); - setPropertyMethods.put("sortTable", "setSortTable"); - setPropertyMethods.put("sortWeight", "setSortWeight"); - setPropertyMethods.put("timeFormat", "setTimeFormat"); - setPropertyMethods.put("timeSeparator", "setTimeSeparator"); - setPropertyMethods.put("threadUsed", "setThreadUsed"); - setPropertyMethods.put("trace", "setTrace"); - setPropertyMethods.put("transactionIsolation", "setTransactionIsolation"); - setPropertyMethods.put("translateBinary", "setTranslateBinary"); - setPropertyMethods.put("user", "setUser"); - setPropertyMethods.put("toolboxTrace", "setToolboxTraceCategory"); - setPropertyMethods.put("qaqqiniLibrary", "setQaqqiniLibrary"); - setPropertyMethods.put("keepAlive", "setKeepAlive"); - setPropertyMethods.put("receiveBufferSize", "setReceiveBufferSize"); - setPropertyMethods.put("sendBufferSize", "setSendBufferSize"); - setPropertyMethods.put("soLinger", "setSoLinger"); - setPropertyMethods.put("soTimeout", "setSoTimeout"); - setPropertyMethods.put("tcpNoDelay", "setTcpNoDelay"); - setPropertyMethods.put("packageCCSID", "setPackageCCSID"); - setPropertyMethods.put("minimumDivideScale", "setMinimumDivideScale"); - setPropertyMethods.put("maximumPrecision", "setMaximumPrecision"); - setPropertyMethods.put("maximumScale", "setMaximumScale"); - setPropertyMethods.put("translateHex", "setTranslateHex"); - setPropertyMethods.put("serverTraceCategories", "setServerTraceCategories"); - setPropertyMethods.put("loginTimeout", "setLoginTimeout"); - setPropertyMethods.put("trueAutoCommit", "setTrueAutoCommit"); - setPropertyMethods.put("bidiImplicitReordering", "setBidiImplicitReordering"); - setPropertyMethods.put("bidiNumericOrdering", "setBidiNumericOrdering"); - setPropertyMethods.put("holdInputLocators", "setHoldInputLocators"); - setPropertyMethods.put("holdStatements", "setHoldStatements"); - setPropertyMethods.put("rollbackCursorHold", "setRollbackCursorHold"); //@C1A - setPropertyMethods.put("variableFieldCompression", "setVariableFieldCompression"); //@C1A - setPropertyMethods.put("queryOptimizeGoal", "setQueryOptimizeGoal"); //@C1A - setPropertyMethods.put("xaLooselyCoupledSupport", "setXALooselyCoupledSupport"); //@PDA - setPropertyMethods.put("translateBoolean", "setTranslateBoolean"); //@PDA - setPropertyMethods.put("metaDataSource", "setMetaDataSource"); //@D1A - setPropertyMethods.put("queryStorageLimit", "setQueryStorageLimit"); //@pda - setPropertyMethods.put("decfloatRoundingMode", "setDecfloatRoundingMode"); //@pda - setPropertyMethods.put("autocommitException", "setAutocommitException"); //@D3a - setPropertyMethods.put("autoCommit", "setAutoCommit"); - setPropertyMethods.put("ignoreWarnings", "setIgnoreWarnings"); - setPropertyMethods.put("secureCurrentUser", "setSecureCurrentUser"); - setPropertyMethods.put("concurrentAccessResolution", "setConcurrentAccessResolution"); - setPropertyMethods.put("jvm16Synchronize", "setJvm16Synchronize"); //@dmy - setPropertyMethods.put("socketTimeout", "setSocketTimeout"); - setPropertyMethods.put("maximumBlockedInputRows", "setMaximumBlockedInputRows"); - setPropertyMethods.put("queryTimeoutMechanism", "setQueryTimeoutMechanism"); - setPropertyMethods.put("queryReplaceTruncatedParameter", "setQueryReplaceTruncatedParameter"); - - -setPropertyMethods.put("extendedMetadata","setExtendedMetadata"); -setPropertyMethods.put("numericRangeError","setNumericRangeError"); -setPropertyMethods.put("characterTruncation","setCharacterTruncation"); -setPropertyMethods.put("secondaryURL","setSecondaryURL"); -setPropertyMethods.put("serverTrace","setServerTraceCategories"); -setPropertyMethods.put("packageCcsid","setPackageCcsid"); -setPropertyMethods.put("toolboxTrace","setToolboxTraceCategory"); -setPropertyMethods.put("toolboxTraceCategory","setToolboxTraceCategory"); -setPropertyMethods.put("qaqqinilib","setQaqqinilib"); -setPropertyMethods.put("trueAutocommit","setTrueAutocommit"); -setPropertyMethods.put("metadataSource","setMetadataSource"); -setPropertyMethods.put("useBlockUpdate","setUseBlockUpdate"); -setPropertyMethods.put("describeOption","setDescribeOption"); -setPropertyMethods.put("decimalDataErrors","setDecimalDataErrors"); -setPropertyMethods.put("timestampFormat","setTimestampFormat"); -setPropertyMethods.put("useDrdaMetadataVersion","setUseDrdaMetadataVersion"); - - - - -setPropertyMethods.put("enableClientAffinitiesList", "setEnableClientAffinitiesList"); -setPropertyMethods.put("affinityFailbackInterval","setAffinityFailbackInterval"); -setPropertyMethods.put("clientRerouteAlternateServerName","setClientRerouteAlternateServerName"); -setPropertyMethods.put("clientRerouteAlternatePortNumber","setClientRerouteAlternatePortNumber"); -setPropertyMethods.put("maxRetriesForClientReroute","setMaxRetriesForClientReroute"); -setPropertyMethods.put("retryIntervalForClientReroute","setRetryIntervalForClientReroute"); -setPropertyMethods.put("enableSeamlessFailover","setEnableSeamlessFailover"); - -setPropertyMethods.put("additionalAuthenticationFactor","setAdditionalAuthenticationFactor"); -setPropertyMethods.put("stayAlive","setStayAlive"); -setPropertyMethods.put("tlsTruststore","setTlsTruststore"); -setPropertyMethods.put("tlsTruststorePassword","setTlsTruststorePassword"); -setPropertyMethods.put("useSock5","setUseSock5"); - - - -Properties setPropertyMethods2 = new Properties() ; -setPropertyMethods2.put("toolboxTrace","setToolboxTrace"); -setPropertyMethods2.put("serverTrace","setServerTrace"); - - - for (int i=0; i< pd.length; i++) - { - String value = (String)setPropertyMethods.get(pd[i].getName()); - if (!pd[i].getWriteMethod().getName().equals(value)) - { - String value2 = (String)setPropertyMethods2.get(pd[i].getName()); - if (!pd[i].getWriteMethod().getName().equals(value2)) - { - - failMessage.append("Wrong write method for "+pd[i].getName()+": " - + pd[i].getWriteMethod().getName()+" expected "+value+"or "+value2+"\n"); - passed=false; - } - } - } - - for (int i=0; i< pd.length; i++) - { - if (!pd[i].isBound()) - { - failMessage.append("Bound problem on index "+i+" name="+pd[i].getName()+"\n"); - passed = false; - } - } - - for (int i=0; i< pd.length; i++) - { - if (pd[i].isConstrained()) - { - failMessage.append("Constrained problem on index "+i+"\n"); - passed = false; ; + failMessage.append("Wrong read method for " + pd[i].getName() + ": " + pd[i].getReadMethod().getName() + + " not " + value + "\n"); + passed = false; + } } - } - - Properties propertyShortDescs = new Properties() ; - // Set the property short descriptions to validate. - propertyShortDescs.put("access", "Specifies the level of database access for the connection."); - propertyShortDescs.put("behaviorOverride", "Specifies the Toolbox JDBC driver behavior to override."); - propertyShortDescs.put("bidiStringType", "Specifies the output string type of bidi data."); //@A1A - propertyShortDescs.put("bigDecimal", "Specifies whether an intermediate java.math.BigDecimal object is used for packed and zoned decimal conversions."); - propertyShortDescs.put("blockCriteria", "Specifies the criteria for retrieving data from the system in blocks of records."); //@A1C //@D2C - propertyShortDescs.put("blockSize", "Specifies the block size (in kilobytes) to retrieve from the system and cache on the client."); - propertyShortDescs.put("cursorHold", "Specifies whether to hold the cursor across transactions."); - propertyShortDescs.put("cursorSensitivity", "Specifies the cursor sensitivity to request from the database."); - propertyShortDescs.put("databaseName", "Specifies the name of the database."); - propertyShortDescs.put("dataCompression", "Specifies whether result set data is compressed."); - propertyShortDescs.put("dataSourceName", "Specifies the name of the data source."); - propertyShortDescs.put("dataTruncation", "Specifies whether data truncation exceptions are thrown."); - propertyShortDescs.put("dateFormat", "Specifies the date format used in date literals within SQL statements."); - propertyShortDescs.put("dateSeparator", "Specifies the date separator used in date literals within SQL statements."); - propertyShortDescs.put("decimalSeparator", "Specifies the decimal separator used in numeric constants within SQL statements."); - propertyShortDescs.put("description", "Specifies the description of the data source."); - propertyShortDescs.put("driver", "Specifies the JDBC driver implementation."); - propertyShortDescs.put("errors", "Specifies the amount of detail to be returned in the message for errors that occur on the system."); - propertyShortDescs.put("extendedDynamic", "Specifies whether to use extended dynamic support."); - propertyShortDescs.put("extendedMetaData", "Specifies whether to request extended metadata from the system."); //@A3A @D2C - propertyShortDescs.put("fullOpen", "Specifies whether to use an optimized query." ); //@W1a - propertyShortDescs.put("lazyClose", "Specifies whether to delay closing cursors until subsequent requests."); - propertyShortDescs.put("libraries", "Specifies the libraries to add to the server job's library list."); //@A1C - propertyShortDescs.put("lobThreshold", "Specifies the maximum LOB (large object) size (in kilobytes) that can be retrieved as part of a result set."); - propertyShortDescs.put("naming", "Specifies the naming convention used when referring to tables."); - propertyShortDescs.put("package", "Specifies the name of the SQL package."); - propertyShortDescs.put("packageAdd", "Specifies whether to add statements to an existing SQL package."); - propertyShortDescs.put("packageCache", "Specifies whether to cache SQL packages in memory."); - propertyShortDescs.put("packageClear", "Specifies whether to clear SQL packages when they become full."); - propertyShortDescs.put("packageCriteria", "Specifies the type of SQL statements to be stored in the SQL package"); - propertyShortDescs.put("packageError", "Specifies the action to take when SQL package errors occur."); - propertyShortDescs.put("packageLibrary", "Specifies the library for the SQL package."); - propertyShortDescs.put("password", "Specifies the password for connecting to the system."); - propertyShortDescs.put("prefetch", "Specifies whether to prefetch data when running a SELECT statement."); - propertyShortDescs.put("portNumber", "Specifies the port number used to connect to the ZDA server."); - - propertyShortDescs.put("prompt", "Specifies whether the user should be prompted if a user name or password is needed to connect to the system."); //@A1C @D2C - propertyShortDescs.put("proxyServer", "Specifies the host name and (optionally) port number of the middle-tier machine where the proxy server is running."); - propertyShortDescs.put("remarks", "Specifies the source of the text for REMARKS columns in ResultSet objects returned by DatabaseMetaData methods."); - propertyShortDescs.put("savePasswordWhenSerialized", "Specifies whether to save the password when the data source object is serialized."); //@A3A - propertyShortDescs.put("secondaryUrl", "Specifies the secondary URL to be used for a connection on the middle-tier's DriverManager in a multiple tier environment."); - propertyShortDescs.put("secondaryURL", "Specifies the secondary URL to be used for a connection on the middle-tier's DriverManager in a multiple tier environment."); - propertyShortDescs.put("secure", "Specifies whether a Secure Sockets Layer (SSL) connection is used to communicate with the system."); //@D2C - propertyShortDescs.put("serverName", "Specifies the name of the system."); //@A1C //@D2C - propertyShortDescs.put("serverTrace", "Specifies whether the job on the system should be traced."); //@D2C - propertyShortDescs.put("sort", "Specifies how the system sorts records before sending them to the client."); //@D2C - propertyShortDescs.put("sortLanguage", "Specifies a 3-character language ID to use for selection of a sort sequence."); - propertyShortDescs.put("sortTable", "Specifies the library and file name of a sort sequence table stored on the system."); //@A1C @D2C - propertyShortDescs.put("sortWeight", "Specifies how the system treats case while sorting records."); //@D2C - propertyShortDescs.put("threadUsed", "Specifies whether to use threads in communication with the host servers."); - propertyShortDescs.put("timeFormat", "Specifies the time format used in time literals within SQL statements."); - propertyShortDescs.put("timeSeparator", "Specifies the time separator used in time literals within SQL statements."); - propertyShortDescs.put("trace", "Specifies whether trace messages should be logged."); - propertyShortDescs.put("transactionIsolation", "Specifies the default transaction isolation."); - propertyShortDescs.put("translateBinary", "Specifies whether binary data is translated."); - propertyShortDescs.put("user", "Specifies the user name for connecting to the system."); //@A1C @D2C - propertyShortDescs.put("toolboxTrace", "Specifies what category of a toolbox trace to log."); - propertyShortDescs.put("toolboxTraceCategory", "Specifies what category of a toolbox trace to log."); - propertyShortDescs.put("qaqqiniLibrary", "Specifies a QAQQINI library name."); - propertyShortDescs.put("qaqqinilibrary", "Specifies a QAQQINI library name."); - propertyShortDescs.put("qaqqinilib", "Specifies a QAQQINI library name."); - - propertyShortDescs.put("keepAlive", "Specifies the socket keep alive value to use when connecting to the system."); //@D2C - propertyShortDescs.put("receiveBufferSize", "Specifies the socket receive buffer size to use when connecting to the system."); //@D2C - propertyShortDescs.put("sendBufferSize", "Specifies the socket send buffer size to use when connecting to the system."); //@D2C - propertyShortDescs.put("soLinger", "Specifies the socket linger value to use when connecting to the system."); //@D2C - propertyShortDescs.put("soTimeout", "Specifies the socket timeout value to use when connecting to the system."); //@D2C - propertyShortDescs.put("tcpNoDelay", "Specifies the socket TCP no delay value to use when connecting to the system."); //@D2C - propertyShortDescs.put("packageCCSID", "Specifies the character encoding to use for the SQL package and any statements sent to the system."); //@D2C - propertyShortDescs.put("packageCcsid", "Specifies the character encoding to use for the SQL package and any statements sent to the system."); //@D2C - propertyShortDescs.put("minimumDivideScale", "Specifies the minimum scale value for the result of decimal division."); - propertyShortDescs.put("maximumPrecision", "Specifies the maximum decimal precision the database should use."); - propertyShortDescs.put("maximumScale", "Specifies the maximum scale the database should use."); - propertyShortDescs.put("translateHex", "Specifies how hexadecimal constants are interpreted."); - propertyShortDescs.put("serverTraceCategories", "Specifies whether the job on the system should be traced."); //@D2C - propertyShortDescs.put("loginTimeout", "Specifies the maximum time in seconds that this data source can wait while attempting to connect to a database."); - propertyShortDescs.put("trueAutoCommit", "Specifies whether the connection should use true auto commit support."); - propertyShortDescs.put("trueAutocommit", "Specifies whether the connection should use true auto commit support."); - propertyShortDescs.put("holdInputLocators", "Specifies if input locators should be of type \"hold\" or \"no hold\"."); - propertyShortDescs.put("bidiImplicitReordering", "Specifies if bidi implicit LTR-RTL reordering should be used."); - propertyShortDescs.put("bidiNumericOrdering", "Specifies if the numeric ordering round trip feature should be used."); - propertyShortDescs.put("holdStatements", "Specifies if statements should remain open until a transaction boundary."); - propertyShortDescs.put("rollbackCursorHold", "Specifies whether to hold cursors across a rollback."); //@C1A - propertyShortDescs.put("variableFieldCompression", "Specifies whether variable-length fields should be compressed."); //@C1A - propertyShortDescs.put("queryOptimizeGoal", "Specifies the goal the system should use with optimization of queries."); //@C1A @D2C - propertyShortDescs.put("xaLooselyCoupledSupport", "Specifies whether lock sharing is allowed for loosely coupled transaction branches."); //@PDA - propertyShortDescs.put("translateBoolean", "Specifies how Boolean objects are interpreted when setting the value for a character field/parameter."); //@PDA - propertyShortDescs.put("metaDataSource", "Specifies how to retrieve DatabaseMetaData."); //@D1A - propertyShortDescs.put("metadataSource", "Specifies how to retrieve DatabaseMetaData."); //@D1A - propertyShortDescs.put("queryStorageLimit", "Specifies the query storage limit to be used when statements in a connection are executed."); //@pda - propertyShortDescs.put("decfloatRoundingMode", "Specifies the rounding mode to use when working with decfloat data type."); //@pda - propertyShortDescs.put("autocommitException", "Specifies whether to throw an SQLException when Connection.commit() or Connection.rollback() is called if autocommit is enabled."); //@D3A - propertyShortDescs.put("autoCommit", "Specifies whether auto-commit mode is the default connection mode for new connections."); //@AC1 - propertyShortDescs.put("ignoreWarnings", "Specifies a list of SQL states for which the driver should not create warning objects."); - propertyShortDescs.put("secureCurrentUser", "Specifies whether to disallow \"\" and *current as user name and password."); - propertyShortDescs.put("concurrentAccessResolution", "Specifies whether \"currently committed\" access is used on the connection."); //@cc1 - propertyShortDescs.put("jvm16Synchronize", "Specifies whether to enable temporary workaround fix for JVM 1.6."); //@dmy - propertyShortDescs.put("socketTimeout", "Specifies the socket timeout value in milliseconds."); - - propertyShortDescs.put("maximumBlockedInputRows", "Specifies the maximum number of rows to be sent to the database engine when using a blocked insert or update operation."); - - - propertyShortDescs.put("queryTimeoutMechanism", "Specifies the method used to implement the query timeout."); - - propertyShortDescs.put("queryReplaceTruncatedParameter", "Specifies the string value to be used when a query parameter is truncated."); - - - -propertyShortDescs.put("numericRangeError","Specifies the behavior when a numeric range error occurs."); -propertyShortDescs.put("characterTruncation","Specifies the behavior when character truncation occurs."); - - - - - - + } + } + } -propertyShortDescs.put("useBlockUpdate","Specifies the use of a block update mode when inserting or updating blocks of data into the database."); -propertyShortDescs.put("describeOption","Specifies the type of describe information returned from ther server."); -propertyShortDescs.put("decimalDataErrors","Specifies how decimal data errors are handled."); -propertyShortDescs.put("timestampFormat","Specifies the format for timestamps retrieved via getString."); -propertyShortDescs.put("useDrdaMetadataVersion","Specifies if the DRDA metadata version information should be returned."); + Properties setPropertyMethods = new Properties(); + setPropertyMethods.put("access", "setAccess"); + setPropertyMethods.put("behaviorOverride", "setBehaviorOverride"); + setPropertyMethods.put("bidiStringType", "setBidiStringType"); // @A1A + setPropertyMethods.put("bigDecimal", "setBigDecimal"); + setPropertyMethods.put("blockCriteria", "setBlockCriteria"); + setPropertyMethods.put("blockSize", "setBlockSize"); + setPropertyMethods.put("cursorHold", "setCursorHold"); + setPropertyMethods.put("cursorSensitivity", "setCursorSensitivity"); + setPropertyMethods.put("databaseName", "setDatabaseName"); + setPropertyMethods.put("dataCompression", "setDataCompression"); + setPropertyMethods.put("dataSourceName", "setDataSourceName"); + setPropertyMethods.put("dataTruncation", "setDataTruncation"); + setPropertyMethods.put("dateFormat", "setDateFormat"); + setPropertyMethods.put("dateSeparator", "setDateSeparator"); + setPropertyMethods.put("decimalSeparator", "setDecimalSeparator"); + setPropertyMethods.put("description", "setDescription"); + setPropertyMethods.put("driver", "setDriver"); + setPropertyMethods.put("errors", "setErrors"); + setPropertyMethods.put("extendedDynamic", "setExtendedDynamic"); + setPropertyMethods.put("extendedMetaData", "setExtendedMetaData"); // @A3A + setPropertyMethods.put("fullOpen", "setFullOpen"); // @W1a + setPropertyMethods.put("lazyClose", "setLazyClose"); + setPropertyMethods.put("libraries", "setLibraries"); + setPropertyMethods.put("lobThreshold", "setLobThreshold"); + setPropertyMethods.put("naming", "setNaming"); + setPropertyMethods.put("package", "setPackage"); + setPropertyMethods.put("packageAdd", "setPackageAdd"); + setPropertyMethods.put("packageCache", "setPackageCache"); + setPropertyMethods.put("packageClear", "setPackageClear"); + setPropertyMethods.put("packageCriteria", "setPackageCriteria"); + setPropertyMethods.put("packageError", "setPackageError"); + setPropertyMethods.put("packageLibrary", "setPackageLibrary"); + setPropertyMethods.put("password", "setPassword"); + setPropertyMethods.put("portNumber", "setPortNumber"); + setPropertyMethods.put("prefetch", "setPrefetch"); + setPropertyMethods.put("prompt", "setPrompt"); + setPropertyMethods.put("proxyServer", "setProxyServer"); + setPropertyMethods.put("remarks", "setRemarks"); + setPropertyMethods.put("savePasswordWhenSerialized", "setSavePasswordWhenSerialized"); // @A3A + setPropertyMethods.put("secondaryUrl", "setSecondaryUrl"); + setPropertyMethods.put("secure", "setSecure"); + setPropertyMethods.put("serverName", "setServerName"); + setPropertyMethods.put("serverTrace", "setServerTraceCategories"); + setPropertyMethods.put("sort", "setSort"); + setPropertyMethods.put("sortLanguage", "setSortLanguage"); + setPropertyMethods.put("sortTable", "setSortTable"); + setPropertyMethods.put("sortWeight", "setSortWeight"); + setPropertyMethods.put("timeFormat", "setTimeFormat"); + setPropertyMethods.put("timeSeparator", "setTimeSeparator"); + setPropertyMethods.put("threadUsed", "setThreadUsed"); + setPropertyMethods.put("trace", "setTrace"); + setPropertyMethods.put("transactionIsolation", "setTransactionIsolation"); + setPropertyMethods.put("translateBinary", "setTranslateBinary"); + setPropertyMethods.put("user", "setUser"); + setPropertyMethods.put("toolboxTrace", "setToolboxTraceCategory"); + setPropertyMethods.put("qaqqiniLibrary", "setQaqqiniLibrary"); + setPropertyMethods.put("keepAlive", "setKeepAlive"); + setPropertyMethods.put("receiveBufferSize", "setReceiveBufferSize"); + setPropertyMethods.put("sendBufferSize", "setSendBufferSize"); + setPropertyMethods.put("soLinger", "setSoLinger"); + setPropertyMethods.put("soTimeout", "setSoTimeout"); + setPropertyMethods.put("tcpNoDelay", "setTcpNoDelay"); + setPropertyMethods.put("packageCCSID", "setPackageCCSID"); + setPropertyMethods.put("minimumDivideScale", "setMinimumDivideScale"); + setPropertyMethods.put("maximumPrecision", "setMaximumPrecision"); + setPropertyMethods.put("maximumScale", "setMaximumScale"); + setPropertyMethods.put("translateHex", "setTranslateHex"); + setPropertyMethods.put("serverTraceCategories", "setServerTraceCategories"); + setPropertyMethods.put("loginTimeout", "setLoginTimeout"); + setPropertyMethods.put("trueAutoCommit", "setTrueAutoCommit"); + setPropertyMethods.put("bidiImplicitReordering", "setBidiImplicitReordering"); + setPropertyMethods.put("bidiNumericOrdering", "setBidiNumericOrdering"); + setPropertyMethods.put("holdInputLocators", "setHoldInputLocators"); + setPropertyMethods.put("holdStatements", "setHoldStatements"); + setPropertyMethods.put("rollbackCursorHold", "setRollbackCursorHold"); // @C1A + setPropertyMethods.put("variableFieldCompression", "setVariableFieldCompression"); // @C1A + setPropertyMethods.put("queryOptimizeGoal", "setQueryOptimizeGoal"); // @C1A + setPropertyMethods.put("xaLooselyCoupledSupport", "setXALooselyCoupledSupport"); // @PDA + setPropertyMethods.put("translateBoolean", "setTranslateBoolean"); // @PDA + setPropertyMethods.put("metaDataSource", "setMetaDataSource"); // @D1A + setPropertyMethods.put("queryStorageLimit", "setQueryStorageLimit"); // @pda + setPropertyMethods.put("decfloatRoundingMode", "setDecfloatRoundingMode"); // @pda + setPropertyMethods.put("autocommitException", "setAutocommitException"); // @D3a + setPropertyMethods.put("autoCommit", "setAutoCommit"); + setPropertyMethods.put("ignoreWarnings", "setIgnoreWarnings"); + setPropertyMethods.put("secureCurrentUser", "setSecureCurrentUser"); + setPropertyMethods.put("concurrentAccessResolution", "setConcurrentAccessResolution"); + setPropertyMethods.put("jvm16Synchronize", "setJvm16Synchronize"); // @dmy + setPropertyMethods.put("socketTimeout", "setSocketTimeout"); + setPropertyMethods.put("maximumBlockedInputRows", "setMaximumBlockedInputRows"); + setPropertyMethods.put("queryTimeoutMechanism", "setQueryTimeoutMechanism"); + setPropertyMethods.put("queryReplaceTruncatedParameter", "setQueryReplaceTruncatedParameter"); + + setPropertyMethods.put("extendedMetadata", "setExtendedMetadata"); + setPropertyMethods.put("numericRangeError", "setNumericRangeError"); + setPropertyMethods.put("characterTruncation", "setCharacterTruncation"); + setPropertyMethods.put("secondaryURL", "setSecondaryURL"); + setPropertyMethods.put("serverTrace", "setServerTraceCategories"); + setPropertyMethods.put("packageCcsid", "setPackageCcsid"); + setPropertyMethods.put("toolboxTrace", "setToolboxTraceCategory"); + setPropertyMethods.put("toolboxTraceCategory", "setToolboxTraceCategory"); + setPropertyMethods.put("qaqqinilib", "setQaqqinilib"); + setPropertyMethods.put("trueAutocommit", "setTrueAutocommit"); + setPropertyMethods.put("metadataSource", "setMetadataSource"); + setPropertyMethods.put("useBlockUpdate", "setUseBlockUpdate"); + setPropertyMethods.put("describeOption", "setDescribeOption"); + setPropertyMethods.put("decimalDataErrors", "setDecimalDataErrors"); + setPropertyMethods.put("timestampFormat", "setTimestampFormat"); + setPropertyMethods.put("useDrdaMetadataVersion", "setUseDrdaMetadataVersion"); + + setPropertyMethods.put("enableClientAffinitiesList", "setEnableClientAffinitiesList"); + setPropertyMethods.put("affinityFailbackInterval", "setAffinityFailbackInterval"); + setPropertyMethods.put("clientRerouteAlternateServerName", "setClientRerouteAlternateServerName"); + setPropertyMethods.put("clientRerouteAlternatePortNumber", "setClientRerouteAlternatePortNumber"); + setPropertyMethods.put("maxRetriesForClientReroute", "setMaxRetriesForClientReroute"); + setPropertyMethods.put("retryIntervalForClientReroute", "setRetryIntervalForClientReroute"); + setPropertyMethods.put("enableSeamlessFailover", "setEnableSeamlessFailover"); + + setPropertyMethods.put("additionalAuthenticationFactor", "setAdditionalAuthenticationFactor"); + setPropertyMethods.put("stayAlive", "setStayAlive"); + setPropertyMethods.put("tlsTruststore", "setTlsTruststore"); + setPropertyMethods.put("tlsTruststorePassword", "setTlsTruststorePassword"); + setPropertyMethods.put("useSock5", "setUseSock5"); + + Properties setPropertyMethods2 = new Properties(); + setPropertyMethods2.put("toolboxTrace", "setToolboxTrace"); + setPropertyMethods2.put("serverTrace", "setServerTrace"); + + for (int i = 0; i < pd.length; i++) { + String value = (String) setPropertyMethods.get(pd[i].getName()); + if (!pd[i].getWriteMethod().getName().equals(value)) { + String value2 = (String) setPropertyMethods2.get(pd[i].getName()); + if (!pd[i].getWriteMethod().getName().equals(value2)) { + + failMessage.append("Wrong write method for " + pd[i].getName() + ": " + pd[i].getWriteMethod().getName() + + " expected " + value + "or " + value2 + "\n"); + passed = false; + } + } + } - propertyShortDescs.put("enableClientAffinitiesList", "Specifies if alternate servers should be used."); - propertyShortDescs.put("affinityFailbackInterval","Specifies the length, in seconds, of the interval after which the primary connection will be re-established."); - propertyShortDescs.put("clientRerouteAlternateServerName","Specifies the list of alternate servers."); - propertyShortDescs.put("clientRerouteAlternatePortNumber","Specifies the list of alternate port numbers."); - 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."); + for (int i = 0; i < pd.length; i++) { + if (!pd[i].isBound()) { + failMessage.append("Bound problem on index " + i + " name=" + pd[i].getName() + "\n"); + passed = false; + } + } - propertyShortDescs.put("extendedMetadata", "extendedMetadata"); - propertyShortDescs.put("portNumber", "Specifies the port number used to connect to the ZDA server."); - 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. A value of 0 means to not send pings to keep the connection alive."); - propertyShortDescs.put("tlsTruststore","Specifies a file to be used as the truststore for TLS connections."); - propertyShortDescs.put("tlsTruststorePassword","Specifies the password associated with the configured TLS truststore."); - propertyShortDescs.put("useSock5","Specifies that Socks5 should be used for the proxy support."); - - for (int i=0; i< pd.length; i++) - { - - if (!verifyFeatureDescriptor(pd[i], pd[i].getDisplayName(), (String)propertyShortDescs.get(pd[i].getDisplayName()), false, false, failMessage)) - passed=false; - } - assertCondition(passed, failMessage.toString()); + for (int i = 0; i < pd.length; i++) { + if (pd[i].isConstrained()) { + failMessage.append("Constrained problem on index " + i + "\n"); + passed = false; + ; + } } - catch(Exception e) - { - failed(e, "Unexpected exception FailMessage="+failMessage.toString()); - return; + + Properties propertyShortDescs = new Properties(); + // Set the property short descriptions to validate. + propertyShortDescs.put("access", "Specifies the level of database access for the connection."); + propertyShortDescs.put("behaviorOverride", "Specifies the Toolbox JDBC driver behavior to override."); + propertyShortDescs.put("bidiStringType", "Specifies the output string type of bidi data."); // @A1A + propertyShortDescs.put("bigDecimal", + "Specifies whether an intermediate java.math.BigDecimal object is used for packed and zoned decimal conversions."); + propertyShortDescs.put("blockCriteria", + "Specifies the criteria for retrieving data from the system in blocks of records."); // @A1C //@D2C + propertyShortDescs.put("blockSize", + "Specifies the block size (in kilobytes) to retrieve from the system and cache on the client."); + propertyShortDescs.put("cursorHold", "Specifies whether to hold the cursor across transactions."); + propertyShortDescs.put("cursorSensitivity", "Specifies the cursor sensitivity to request from the database."); + propertyShortDescs.put("databaseName", "Specifies the name of the database."); + propertyShortDescs.put("dataCompression", "Specifies whether result set data is compressed."); + propertyShortDescs.put("dataSourceName", "Specifies the name of the data source."); + propertyShortDescs.put("dataTruncation", "Specifies whether data truncation exceptions are thrown."); + propertyShortDescs.put("dateFormat", "Specifies the date format used in date literals within SQL statements."); + propertyShortDescs.put("dateSeparator", + "Specifies the date separator used in date literals within SQL statements."); + propertyShortDescs.put("decimalSeparator", + "Specifies the decimal separator used in numeric constants within SQL statements."); + propertyShortDescs.put("description", "Specifies the description of the data source."); + propertyShortDescs.put("driver", "Specifies the JDBC driver implementation."); + propertyShortDescs.put("errors", + "Specifies the amount of detail to be returned in the message for errors that occur on the system."); + propertyShortDescs.put("extendedDynamic", "Specifies whether to use extended dynamic support."); + propertyShortDescs.put("extendedMetaData", "Specifies whether to request extended metadata from the system."); // @A3A + // @D2C + propertyShortDescs.put("fullOpen", "Specifies whether to use an optimized query."); // @W1a + propertyShortDescs.put("lazyClose", "Specifies whether to delay closing cursors until subsequent requests."); + propertyShortDescs.put("libraries", "Specifies the libraries to add to the server job's library list."); // @A1C + propertyShortDescs.put("lobThreshold", + "Specifies the maximum LOB (large object) size (in kilobytes) that can be retrieved as part of a result set."); + propertyShortDescs.put("naming", "Specifies the naming convention used when referring to tables."); + propertyShortDescs.put("package", "Specifies the name of the SQL package."); + propertyShortDescs.put("packageAdd", "Specifies whether to add statements to an existing SQL package."); + propertyShortDescs.put("packageCache", "Specifies whether to cache SQL packages in memory."); + propertyShortDescs.put("packageClear", "Specifies whether to clear SQL packages when they become full."); + propertyShortDescs.put("packageCriteria", "Specifies the type of SQL statements to be stored in the SQL package"); + propertyShortDescs.put("packageError", "Specifies the action to take when SQL package errors occur."); + propertyShortDescs.put("packageLibrary", "Specifies the library for the SQL package."); + propertyShortDescs.put("password", "Specifies the password for connecting to the system."); + propertyShortDescs.put("prefetch", "Specifies whether to prefetch data when running a SELECT statement."); + propertyShortDescs.put("portNumber", "Specifies the port number used to connect to the ZDA server."); + + propertyShortDescs.put("prompt", + "Specifies whether the user should be prompted if a user name or password is needed to connect to the system."); // @A1C + // @D2C + propertyShortDescs.put("proxyServer", + "Specifies the host name and (optionally) port number of the middle-tier machine where the proxy server is running."); + propertyShortDescs.put("remarks", + "Specifies the source of the text for REMARKS columns in ResultSet objects returned by DatabaseMetaData methods."); + propertyShortDescs.put("savePasswordWhenSerialized", + "Specifies whether to save the password when the data source object is serialized."); // @A3A + propertyShortDescs.put("secondaryUrl", + "Specifies the secondary URL to be used for a connection on the middle-tier's DriverManager in a multiple tier environment."); + propertyShortDescs.put("secondaryURL", + "Specifies the secondary URL to be used for a connection on the middle-tier's DriverManager in a multiple tier environment."); + propertyShortDescs.put("secure", + "Specifies whether a Secure Sockets Layer (SSL) connection is used to communicate with the system."); // @D2C + propertyShortDescs.put("serverName", "Specifies the name of the system."); // @A1C //@D2C + propertyShortDescs.put("serverTrace", "Specifies whether the job on the system should be traced."); // @D2C + propertyShortDescs.put("sort", "Specifies how the system sorts records before sending them to the client."); // @D2C + propertyShortDescs.put("sortLanguage", + "Specifies a 3-character language ID to use for selection of a sort sequence."); + propertyShortDescs.put("sortTable", + "Specifies the library and file name of a sort sequence table stored on the system."); // @A1C @D2C + propertyShortDescs.put("sortWeight", "Specifies how the system treats case while sorting records."); // @D2C + propertyShortDescs.put("threadUsed", "Specifies whether to use threads in communication with the host servers."); + propertyShortDescs.put("timeFormat", "Specifies the time format used in time literals within SQL statements."); + propertyShortDescs.put("timeSeparator", + "Specifies the time separator used in time literals within SQL statements."); + propertyShortDescs.put("trace", "Specifies whether trace messages should be logged."); + propertyShortDescs.put("transactionIsolation", "Specifies the default transaction isolation."); + propertyShortDescs.put("translateBinary", "Specifies whether binary data is translated."); + propertyShortDescs.put("user", "Specifies the user name for connecting to the system."); // @A1C @D2C + propertyShortDescs.put("toolboxTrace", "Specifies what category of a toolbox trace to log."); + propertyShortDescs.put("toolboxTraceCategory", "Specifies what category of a toolbox trace to log."); + propertyShortDescs.put("qaqqiniLibrary", "Specifies a QAQQINI library name."); + propertyShortDescs.put("qaqqinilibrary", "Specifies a QAQQINI library name."); + propertyShortDescs.put("qaqqinilib", "Specifies a QAQQINI library name."); + + propertyShortDescs.put("keepAlive", + "Specifies the socket keep alive value to use when connecting to the system."); // @D2C + propertyShortDescs.put("receiveBufferSize", + "Specifies the socket receive buffer size to use when connecting to the system."); // @D2C + propertyShortDescs.put("sendBufferSize", + "Specifies the socket send buffer size to use when connecting to the system."); // @D2C + propertyShortDescs.put("soLinger", "Specifies the socket linger value to use when connecting to the system."); // @D2C + propertyShortDescs.put("soTimeout", "Specifies the socket timeout value to use when connecting to the system."); // @D2C + propertyShortDescs.put("tcpNoDelay", + "Specifies the socket TCP no delay value to use when connecting to the system."); // @D2C + propertyShortDescs.put("packageCCSID", + "Specifies the character encoding to use for the SQL package and any statements sent to the system."); // @D2C + propertyShortDescs.put("packageCcsid", + "Specifies the character encoding to use for the SQL package and any statements sent to the system."); // @D2C + propertyShortDescs.put("minimumDivideScale", + "Specifies the minimum scale value for the result of decimal division."); + propertyShortDescs.put("maximumPrecision", "Specifies the maximum decimal precision the database should use."); + propertyShortDescs.put("maximumScale", "Specifies the maximum scale the database should use."); + propertyShortDescs.put("translateHex", "Specifies how hexadecimal constants are interpreted."); + propertyShortDescs.put("serverTraceCategories", "Specifies whether the job on the system should be traced."); // @D2C + propertyShortDescs.put("loginTimeout", + "Specifies the maximum time in seconds that this data source can wait while attempting to connect to a database."); + propertyShortDescs.put("trueAutoCommit", "Specifies whether the connection should use true auto commit support."); + propertyShortDescs.put("trueAutocommit", "Specifies whether the connection should use true auto commit support."); + propertyShortDescs.put("holdInputLocators", + "Specifies if input locators should be of type \"hold\" or \"no hold\"."); + propertyShortDescs.put("bidiImplicitReordering", "Specifies if bidi implicit LTR-RTL reordering should be used."); + propertyShortDescs.put("bidiNumericOrdering", + "Specifies if the numeric ordering round trip feature should be used."); + propertyShortDescs.put("holdStatements", + "Specifies if statements should remain open until a transaction boundary."); + propertyShortDescs.put("rollbackCursorHold", "Specifies whether to hold cursors across a rollback."); // @C1A + propertyShortDescs.put("variableFieldCompression", + "Specifies whether variable-length fields should be compressed."); // @C1A + propertyShortDescs.put("queryOptimizeGoal", + "Specifies the goal the system should use with optimization of queries."); // @C1A @D2C + propertyShortDescs.put("xaLooselyCoupledSupport", + "Specifies whether lock sharing is allowed for loosely coupled transaction branches."); // @PDA + propertyShortDescs.put("translateBoolean", + "Specifies how Boolean objects are interpreted when setting the value for a character field/parameter."); // @PDA + propertyShortDescs.put("metaDataSource", "Specifies how to retrieve DatabaseMetaData."); // @D1A + propertyShortDescs.put("metadataSource", "Specifies how to retrieve DatabaseMetaData."); // @D1A + propertyShortDescs.put("queryStorageLimit", + "Specifies the query storage limit to be used when statements in a connection are executed."); // @pda + propertyShortDescs.put("decfloatRoundingMode", + "Specifies the rounding mode to use when working with decfloat data type."); // @pda + propertyShortDescs.put("autocommitException", + "Specifies whether to throw an SQLException when Connection.commit() or Connection.rollback() is called if autocommit is enabled."); // @D3A + propertyShortDescs.put("autoCommit", + "Specifies whether auto-commit mode is the default connection mode for new connections."); // @AC1 + propertyShortDescs.put("ignoreWarnings", + "Specifies a list of SQL states for which the driver should not create warning objects."); + propertyShortDescs.put("secureCurrentUser", + "Specifies whether to disallow \"\" and *current as user name and password."); + propertyShortDescs.put("concurrentAccessResolution", + "Specifies whether \"currently committed\" access is used on the connection."); // @cc1 + propertyShortDescs.put("jvm16Synchronize", "Specifies whether to enable temporary workaround fix for JVM 1.6."); // @dmy + propertyShortDescs.put("socketTimeout", "Specifies the socket timeout value in milliseconds."); + + propertyShortDescs.put("maximumBlockedInputRows", + "Specifies the maximum number of rows to be sent to the database engine when using a blocked insert or update operation."); + + propertyShortDescs.put("queryTimeoutMechanism", "Specifies the method used to implement the query timeout."); + + propertyShortDescs.put("queryReplaceTruncatedParameter", + "Specifies the string value to be used when a query parameter is truncated."); + + propertyShortDescs.put("numericRangeError", "Specifies the behavior when a numeric range error occurs."); + propertyShortDescs.put("characterTruncation", "Specifies the behavior when character truncation occurs."); + + propertyShortDescs.put("useBlockUpdate", + "Specifies the use of a block update mode when inserting or updating blocks of data into the database."); + propertyShortDescs.put("describeOption", "Specifies the type of describe information returned from ther server."); + propertyShortDescs.put("decimalDataErrors", "Specifies how decimal data errors are handled."); + propertyShortDescs.put("timestampFormat", "Specifies the format for timestamps retrieved via getString."); + propertyShortDescs.put("useDrdaMetadataVersion", + "Specifies if the DRDA metadata version information should be returned."); + + propertyShortDescs.put("enableClientAffinitiesList", "Specifies if alternate servers should be used."); + propertyShortDescs.put("affinityFailbackInterval", + "Specifies the length, in seconds, of the interval after which the primary connection will be re-established."); + propertyShortDescs.put("clientRerouteAlternateServerName", "Specifies the list of alternate servers."); + propertyShortDescs.put("clientRerouteAlternatePortNumber", "Specifies the list of alternate port numbers."); + 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("extendedMetadata", "extendedMetadata"); + propertyShortDescs.put("portNumber", "Specifies the port number used to connect to the ZDA server."); + 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. A value of 0 means to not send pings to keep the connection alive."); + propertyShortDescs.put("tlsTruststore", "Specifies a file to be used as the truststore for TLS connections."); + propertyShortDescs.put("tlsTruststorePassword", + "Specifies the password associated with the configured TLS truststore."); + propertyShortDescs.put("useSock5", "Specifies that Socks5 should be used for the proxy support."); + + for (int i = 0; i < pd.length; i++) { + + if (!verifyFeatureDescriptor(pd[i], pd[i].getDisplayName(), + (String) propertyShortDescs.get(pd[i].getDisplayName()), false, false, failMessage)) + passed = false; } - } + assertCondition(passed, failMessage.toString()); + } catch (Exception e) { + failed(e, "Unexpected exception FailMessage=" + failMessage.toString()); + return; + } + } } diff --git a/src/test/AllQshCompileScript b/src/test/AllQshCompileScript index c5b479ee..a52d3565 100644 --- a/src/test/AllQshCompileScript +++ b/src/test/AllQshCompileScript @@ -115,4 +115,5 @@ else echo not cleaning because of error $COMPILELIST.* fi +echo Compile done error = $error exit $error diff --git a/src/test/BidiEngineWrapper.java b/src/test/BidiEngineWrapper.java index e5d431f3..3f847552 100644 --- a/src/test/BidiEngineWrapper.java +++ b/src/test/BidiEngineWrapper.java @@ -143,7 +143,8 @@ public static void main(String[] args) { //System.out.println("TransFromLogRTLtoVisRTLEx \n"+ RLE + str + PDF + "\n > \n" + RLO + bidiTransform(str, 6,9) + PDF);//8? } - public static String getProbe(String value_, AS400JDBCConnection connection, int source_ccsid_type, int target_ccsid_type, boolean use_packageCCSID) throws SQLException{ + @SuppressWarnings("resource") + public static String getProbe(String value_, AS400JDBCConnection connection, int source_ccsid_type, int target_ccsid_type, boolean use_packageCCSID) throws SQLException{ // JDProperties prop = connection.getProperties(); // int host_bidi_format; @@ -177,7 +178,8 @@ public static String getProbe(String value_, AS400JDBCConnection connection, int return value_; } - public static boolean checkRoundTrip(String value_, String probe, AS400JDBCConnection connection, int source_ccsid_type, int target_ccsid_type, boolean use_packageCCSID) throws SQLException{ + @SuppressWarnings("resource") + public static boolean checkRoundTrip(String value_, String probe, AS400JDBCConnection connection, int source_ccsid_type, int target_ccsid_type, boolean use_packageCCSID) throws SQLException{ // JDProperties prop = connection.getProperties(); int host_bidi_format, host_ccsid, package_bidi_format, package_ccsid; int bidi_format = source_ccsid_type; diff --git a/src/test/CleanupJavaTestJobs.java b/src/test/CleanupJavaTestJobs.java index 89f9f0b0..98c6137b 100644 --- a/src/test/CleanupJavaTestJobs.java +++ b/src/test/CleanupJavaTestJobs.java @@ -26,273 +26,256 @@ import com.ibm.as400.access.QueuedMessage; public class CleanupJavaTestJobs { - public static void usage() { - System.out - .println("Usage: java CleanupJavaTestJobs [ ]"); - System.out - .println(" Ends all the QJVAEXEC and CLIJOBURN jobs that are used by testcases and older than 1 hour"); - } + public static void usage() { + System.out.println("Usage: java CleanupJavaTestJobs [ ]"); + System.out.println(" Ends all the QJVAEXEC and CLIJOBURN jobs that are used by testcases and older than 1 hour"); + } - public static void main(String args[]) { - String system = null; - String userid = null; - String password = null; - try { - if (args.length >= 3) { - system = args[0]; - userid = args[1]; - password = args[2]; - } - - cleanup(system, userid, password); - } catch (Exception e) { - e.printStackTrace(); - } - } + public static void main(String args[]) { + String system = null; + String userid = null; + String password = null; + try { + if (args.length >= 3) { + system = args[0]; + userid = args[1]; + password = args[2]; + } - public final static int OS_OS400 = 1; - public final static int OS_WINDOWS = 2; - public final static int OS_LINUX = 3; + cleanup(system, userid, password); + } catch (Exception e) { + e.printStackTrace(); + } + } - public static void cleanup(String system, String userid, String password) { - try { - int os; - + public final static int OS_OS400 = 1; + public final static int OS_WINDOWS = 2; + public final static int OS_LINUX = 3; - if (JTOpenTestEnvironment.isOS400) { - os = OS_OS400; - } else if (JTOpenTestEnvironment.isWindows) { - os = OS_WINDOWS; - } else if (JTOpenTestEnvironment.isLinux) { - os = OS_LINUX; - } else { - throw new Exception("Unsupported OS " + JTOpenTestEnvironment.osVersion); - } - boolean jobNotFoundStackPrinted = false; - if (os == OS_OS400 || os==OS_WINDOWS) { - AS400 as400; + public static void cleanup(String system, String userid, String password) { + try { + int os; - if (system == null || "localhost" == system) { - as400 = new AS400(); + if (JTOpenTestEnvironment.isOS400) { + os = OS_OS400; + } else if (JTOpenTestEnvironment.isWindows) { + os = OS_WINDOWS; + } else if (JTOpenTestEnvironment.isLinux) { + os = OS_LINUX; + } else { + throw new Exception("Unsupported OS " + JTOpenTestEnvironment.osVersion); + } + boolean jobNotFoundStackPrinted = false; + if (os == OS_OS400 || os == OS_WINDOWS) { + AS400 as400; - } else { - as400 = new AS400(system, userid, password.toCharArray()); - } - Hashtable userSet = new Hashtable(); + if (system == null || "localhost" == system) { + as400 = new AS400(); - for (int i = 0; i < 2; i++) { + } else { + as400 = new AS400(system, userid, password.toCharArray()); + } + Hashtable userSet = new Hashtable(); - JobList joblist = new JobList(as400); - if (i == 0) { - joblist.addJobSelectionCriteria(JobList.SELECTION_JOB_NAME, "QJVAEXEC"); - System.out.println("Searching for QJVAEXEC"); - } else if (i == 1) { - joblist.addJobSelectionCriteria(JobList.SELECTION_JOB_NAME, "QP0ZSPWT"); - System.out.println("Searching for QP0ZSPWTC"); - } - joblist.addJobSelectionCriteria( - JobList.SELECTION_PRIMARY_JOB_STATUS_ACTIVE, Boolean.TRUE); - joblist.addJobSelectionCriteria( - JobList.SELECTION_PRIMARY_JOB_STATUS_JOBQ, Boolean.FALSE); - joblist.addJobSelectionCriteria( - JobList.SELECTION_PRIMARY_JOB_STATUS_OUTQ, Boolean.FALSE); + for (int i = 0; i < 2; i++) { - SimpleDateFormat simpleDateFormat = new SimpleDateFormat(); - joblist.load(); - Enumeration enumeration = joblist.getJobs(); - long currentTimeMillis = System.currentTimeMillis(); - boolean continueLoop=true; - int jobCount = 0; - while (enumeration.hasMoreElements() && continueLoop) { - Job j = null; - try { - j = (Job) enumeration.nextElement(); - jobCount++; - String functionName = j.getFunctionName(); - String user = j.getStringValue(Job.CURRENT_USER); - userSet.put(user, user); - // System.out.println("Job name is "+j.getNumber()+"/"+j.getUser()+"/"+j.getName()+" user is "+user+" function name is "+functionName); - if (user.equalsIgnoreCase("JAVA") - || user.equalsIgnoreCase("NEWTONJUDF") - || user.equalsIgnoreCase("SQLJTEST") - || user.equalsIgnoreCase("JDPWRSYS")) { - System.out.println("-------------------"); - System.out.println("Job name is " + j.getNumber() + "/" - + j.getUser() + "/" + j.getName() + " user is " + user +" function name is "+functionName); - JobLog joblog = j.getJobLog(); - Enumeration messageEnumeration = joblog.getMessages(); - boolean endJob = false; - // - // Look for message of the following form. If the - // message is older than 1 hour then - // end the job. - // Message ID . . . . . . : CPF9898 Severity . . . . . . - // . : 40 - // Message type . . . . . : Diagnostic - // Date sent . . . . . . : 01/15/17 Time sent . . . . . - // . : 19:17:03 - // - // Message . . . . : Sun Jan 15 19:17:03 CST 2017 - // Running test.JDLobTest -tc - // JDLobClobLocator -lib JDT7163N -system UT30P58 -uid - // JDPWRSYS -pwd xxxxxxxx - // -pwrSys JDPWRSYS,xxxxxxxx -directory / -misc - // native,v7r1m0 -asp IASP. - // - boolean connectingJobMessageFound = false; - while (!connectingJobMessageFound - && messageEnumeration.hasMoreElements()) { - QueuedMessage message = (QueuedMessage) messageEnumeration - .nextElement(); - if (message.getID().equals("CPF9898")) { - // System.out.println("CPF9898 found"); - String text = "Text is " + message.getText(); - System.out.println(text); - if ((text.indexOf("Running test") >= 0) || - (text.indexOf("starting worker") >= 0)) { - connectingJobMessageFound = true; + JobList joblist = new JobList(as400); + if (i == 0) { + joblist.addJobSelectionCriteria(JobList.SELECTION_JOB_NAME, "QJVAEXEC"); + System.out.println("Searching for QJVAEXEC"); + } else if (i == 1) { + joblist.addJobSelectionCriteria(JobList.SELECTION_JOB_NAME, "QP0ZSPWT"); + System.out.println("Searching for QP0ZSPWTC"); + } + joblist.addJobSelectionCriteria(JobList.SELECTION_PRIMARY_JOB_STATUS_ACTIVE, Boolean.TRUE); + joblist.addJobSelectionCriteria(JobList.SELECTION_PRIMARY_JOB_STATUS_JOBQ, Boolean.FALSE); + joblist.addJobSelectionCriteria(JobList.SELECTION_PRIMARY_JOB_STATUS_OUTQ, Boolean.FALSE); - Calendar date = message.getDate(); - long millis = date.getTimeInMillis(); - if (currentTimeMillis - millis > 3600000) { - System.out.println("Message send over an hour ago " - + simpleDateFormat.format(date.getTime())); - if (i == 1) { - System.out.println("jobFunction is "+functionName); - if (functionName.indexOf("CLIJOBRUN") >= 0) { - System.out.println(" .. ending CLIJOBRUN"); - endJob = true; - } - } else { - endJob = true; - } - } else { - System.out.println("New message " - + simpleDateFormat.format(date.getTime())); - } + SimpleDateFormat simpleDateFormat = new SimpleDateFormat(); + joblist.load(); + Enumeration enumeration = joblist.getJobs(); + long currentTimeMillis = System.currentTimeMillis(); + boolean continueLoop = true; + int jobCount = 0; + while (enumeration.hasMoreElements() && continueLoop) { + Job j = null; + try { + j = (Job) enumeration.nextElement(); + jobCount++; + String functionName = j.getFunctionName(); + String user = j.getStringValue(Job.CURRENT_USER); + userSet.put(user, user); + // System.out.println("Job name is + // "+j.getNumber()+"/"+j.getUser()+"/"+j.getName()+" user is "+user+" function + // name is "+functionName); + if (user.equalsIgnoreCase("JAVA") || user.equalsIgnoreCase("NEWTONJUDF") + || user.equalsIgnoreCase("SQLJTEST") || user.equalsIgnoreCase("JDPWRSYS")) { + System.out.println("-------------------"); + System.out.println("Job name is " + j.getNumber() + "/" + j.getUser() + "/" + j.getName() + " user is " + + user + " function name is " + functionName); + JobLog joblog = j.getJobLog(); + Enumeration messageEnumeration = joblog.getMessages(); + boolean endJob = false; + // + // Look for message of the following form. If the + // message is older than 1 hour then + // end the job. + // Message ID . . . . . . : CPF9898 Severity . . . . . . + // . : 40 + // Message type . . . . . : Diagnostic + // Date sent . . . . . . : 01/15/17 Time sent . . . . . + // . : 19:17:03 + // + // Message . . . . : Sun Jan 15 19:17:03 CST 2017 + // Running test.JDLobTest -tc + // JDLobClobLocator -lib JDT7163N -system UT30P58 -uid + // JDPWRSYS -pwd xxxxxxxx + // -pwrSys JDPWRSYS,xxxxxxxx -directory / -misc + // native,v7r1m0 -asp IASP. + // + boolean connectingJobMessageFound = false; + while (!connectingJobMessageFound && messageEnumeration.hasMoreElements()) { + QueuedMessage message = (QueuedMessage) messageEnumeration.nextElement(); + if (message.getID().equals("CPF9898")) { + // System.out.println("CPF9898 found"); + String text = "Text is " + message.getText(); + System.out.println(text); + if ((text.indexOf("Running test") >= 0) || (text.indexOf("starting worker") >= 0)) { + connectingJobMessageFound = true; - } - } else if (message.getID().equals("JVAB302")) { - Calendar date = message.getDate(); - long millis = date.getTimeInMillis(); - if (currentTimeMillis - millis > 3600000) { - System.out.println(i+": JVAB302 Message send over an hour ago " - + simpleDateFormat.format(date.getTime())); - if (i == 0) { - if (functionName.indexOf("test.") >= 0) { - System.out.println(" .. ending test. job"); - endJob = true; - } - } - } else { - System.out.println(i+": JVAB302 Recent message " - + simpleDateFormat.format(date.getTime())); - } + Calendar date = message.getDate(); + long millis = date.getTimeInMillis(); + if (currentTimeMillis - millis > 3600000) { + System.out.println("Message send over an hour ago " + simpleDateFormat.format(date.getTime())); + if (i == 1) { + System.out.println("jobFunction is " + functionName); + if (functionName.indexOf("CLIJOBRUN") >= 0) { + System.out.println(" .. ending CLIJOBRUN"); + endJob = true; + } + } else { + endJob = true; + } + } else { + System.out.println("New message " + simpleDateFormat.format(date.getTime())); + } - } - } - if (endJob) { - System.out.println("Ending job"); - try { - j.end(0); - } catch (Exception e) { - String message = e.toString(); - if (message.indexOf("not allowed") >= 0) { - System.out.println("Job already ending"); - } else { - e.printStackTrace(); - } - } - } - } - } catch (Exception e) { - if (e instanceof java.util.NoSuchElementException) { - System.out.println("Warning: Unexpected NoSuchElementException "); - e.printStackTrace(System.out); - } else { - String message = e.toString(); - if (message.indexOf("CPF3C53") >= 0 ) { - /* for now, ignore other cases where job not found */ - if (!jobNotFoundStackPrinted) { - jobNotFoundStackPrinted = true; - System.out.println("Warning: Unexpected Job not found "); - System.out.println("job was "+j); - e.printStackTrace(System.out); - } - } else { - System.out.println("Error : Unexpected exception exiting loop "); - e.printStackTrace(System.out); - continueLoop = false; - } - } + } + } else if (message.getID().equals("JVAB302")) { + Calendar date = message.getDate(); + long millis = date.getTimeInMillis(); + if (currentTimeMillis - millis > 3600000) { + System.out.println( + i + ": JVAB302 Message send over an hour ago " + simpleDateFormat.format(date.getTime())); + if (i == 0) { + if (functionName.indexOf("test.") >= 0) { + System.out.println(" .. ending test. job"); + endJob = true; + } + } + } else { + System.out.println(i + ": JVAB302 Recent message " + simpleDateFormat.format(date.getTime())); + } - } - } /* while enumeration.hasMoreElements */ - System.out.println("jobCount was "+jobCount); - } /* for i */ - System.out.println("-----------------------------------------"); - System.out.println("Here are the users found on the system"); - Enumeration userEnumeration = userSet.keys(); - while (userEnumeration.hasMoreElements()) { - System.out.println(userEnumeration.nextElement()); - } - - } else if (os == OS_WINDOWS) { - // How to get list of processes on Windows - String line; - String command = "wmic path win32_process get /format:list"; - Process process = Runtime.getRuntime().exec(command); - BufferedReader input = new BufferedReader(new InputStreamReader( - process.getInputStream())); - String savedCaption = null; - String savedCommandLine = null; - String savedCreationDate = null; - while ((line = input.readLine()) != null) { - line = line.trim(); - if (line.length() > 0) { - if (line.indexOf("Caption=") == 0 ) { - savedCaption = line.substring(8); - } else if (line.indexOf("CommandLine=") == 0) { - savedCommandLine = line.substring(12); - } else if (line.indexOf("CreationDate=") == 0) { - savedCreationDate = line.substring(13); - } else if (line.indexOf("ProcessId=") == 0) { - String processId = line.substring(10); - - // System.out.println(">"+processId+","+savedCaption+","+savedCreationDate+","+savedCommandLine); - - // Check for a testcase process - if (savedCaption.indexOf("java.exe") >= 0) { - System.out.println(">"+processId+","+savedCaption+","+savedCreationDate+","+savedCommandLine); - command = "TASKKILL /PID "+processId+" /F /T"; - // TODO: Working here - } + } + } + if (endJob) { + System.out.println("Ending job"); + try { + j.end(0); + } catch (Exception e) { + String message = e.toString(); + if (message.indexOf("not allowed") >= 0) { + System.out.println("Job already ending"); + } else { + e.printStackTrace(); + } + } + } + } + } catch (Exception e) { + if (e instanceof java.util.NoSuchElementException) { + System.out.println("Warning: Unexpected NoSuchElementException "); + e.printStackTrace(System.out); + } else { + String message = e.toString(); + if (message.indexOf("CPF3C53") >= 0) { + /* for now, ignore other cases where job not found */ + if (!jobNotFoundStackPrinted) { + jobNotFoundStackPrinted = true; + System.out.println("Warning: Unexpected Job not found "); + System.out.println("job was " + j); + e.printStackTrace(System.out); + } + } else { + System.out.println("Error : Unexpected exception exiting loop "); + e.printStackTrace(System.out); + continueLoop = false; + } + } - - - - - - savedCaption = "NONE"; - savedCommandLine = "NONE"; - savedCreationDate = "NONE"; - } - - } - } - input.close(); + } + } /* while enumeration.hasMoreElements */ + System.out.println("jobCount was " + jobCount); + } /* for i */ + System.out.println("-----------------------------------------"); + System.out.println("Here are the users found on the system"); + Enumeration userEnumeration = userSet.keys(); + while (userEnumeration.hasMoreElements()) { + System.out.println(userEnumeration.nextElement()); + } + as400.close(); + } else if (os == OS_WINDOWS) { + // How to get list of processes on Windows + String line; + String command = "wmic path win32_process get /format:list"; + Process process = Runtime.getRuntime().exec(command); + BufferedReader input = new BufferedReader(new InputStreamReader(process.getInputStream())); + String savedCaption = null; + String savedCommandLine = null; + String savedCreationDate = null; + while ((line = input.readLine()) != null) { + line = line.trim(); + if (line.length() > 0) { + if (line.indexOf("Caption=") == 0) { + savedCaption = line.substring(8); + } else if (line.indexOf("CommandLine=") == 0) { + savedCommandLine = line.substring(12); + } else if (line.indexOf("CreationDate=") == 0) { + savedCreationDate = line.substring(13); + } else if (line.indexOf("ProcessId=") == 0) { + String processId = line.substring(10); - } else if (os == OS_LINUX) { - throw new Exception("Linux not yet supported"); - } else { - throw new Exception("Unsupported OS = "+os); - - } + // System.out.println(">"+processId+","+savedCaption+","+savedCreationDate+","+savedCommandLine); - } catch (Exception e) { - e.printStackTrace(); - usage(); - } + // Check for a testcase process + if (savedCaption.indexOf("java.exe") >= 0) { + System.out + .println(">" + processId + "," + savedCaption + "," + savedCreationDate + "," + savedCommandLine); + command = "TASKKILL /PID " + processId + " /F /T"; + // TODO: Working here + } - } + savedCaption = "NONE"; + savedCommandLine = "NONE"; + savedCreationDate = "NONE"; + } + + } + } + input.close(); + + } else if (os == OS_LINUX) { + throw new Exception("Linux not yet supported"); + } else { + throw new Exception("Unsupported OS = " + os); + + } + + } catch (Exception e) { + e.printStackTrace(); + usage(); + } + + } } diff --git a/src/test/CleanupPsrwJobs.java b/src/test/CleanupPsrwJobs.java index c9c6a2f3..b4d5c343 100644 --- a/src/test/CleanupPsrwJobs.java +++ b/src/test/CleanupPsrwJobs.java @@ -26,97 +26,98 @@ import com.ibm.as400.access.ObjectDoesNotExistException; public class CleanupPsrwJobs { - public static void usage() { - System.out.println("Usage: java CleanupPsrwJobs [ ]"); - System.out.println(" Ends all the PSRW database jobs"); + public static void usage() { + System.out.println("Usage: java CleanupPsrwJobs [ ]"); + System.out.println(" Ends all the PSRW database jobs"); } - public static void main(String args[]) { - String system = null ; - String userid = null; - String password = null; - - try { + String system = null; + String userid = null; + String password = null; + + try { if (args.length >= 3) { - system=args[0]; - userid=args[1]; - password=args[2]; + system = args[0]; + userid = args[1]; + password = args[2]; } - PrintWriter writer = new PrintWriter(System.out) ; + PrintWriter writer = new PrintWriter(System.out); clean(system, userid, password, writer); - } catch (Exception e) { - e.printStackTrace(); - usage(); + } catch (Exception e) { + e.printStackTrace(); + usage(); } } - public static void clean(String system, String userid, String password, PrintWriter out ) throws PropertyVetoException, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, IOException, ObjectDoesNotExistException { - AS400 as400; - - if (system == null) { - as400 = new AS400(); - } else { - as400 = new AS400(system, userid, password.toCharArray()); - } - - JobList joblist = new JobList(as400); - joblist.addJobSelectionCriteria(JobList.SELECTION_PRIMARY_JOB_STATUS_ACTIVE, Boolean.TRUE); - joblist.addJobSelectionCriteria(JobList.SELECTION_PRIMARY_JOB_STATUS_OUTQ, Boolean.FALSE); - joblist.addJobSelectionCriteria(JobList.SELECTION_ACTIVE_JOB_STATUS, Job.ACTIVE_JOB_STATUS_WAIT_PRESTART); + public static void clean(String system, String userid, String password, PrintWriter out) + throws PropertyVetoException, AS400SecurityException, ErrorCompletingRequestException, InterruptedException, + IOException, ObjectDoesNotExistException { + AS400 as400; - Enumeration enumeration = joblist.getJobs(); - StringBuffer endedJobInfo = new StringBuffer(); - - while (enumeration.hasMoreElements()) { - Job j = enumeration.nextElement(); - - String status = j.getStatus(); - if (status.equals(Job.JOB_STATUS_ACTIVE)) { - boolean endjob = false; - String name = j.getName(); - if (name.equals("QDBMSRVR")) { - endjob = true; - } else if (name.equals("QZDASOINIT")) { - endjob = true; - } else if (name.equals("QSQSRVR")) { - endjob = true; - } else if (name.equals("QRWTSRVR")) { - endjob = true; - } else if (name.equals("QP0ZSPWP")) { - endjob = true; - } else if (name.equals("QP0ZSPWT")) { - endjob = true; - } else if (name.equals("QZSOSIGN")) { - endjob = true; - } else if (name.equals("QZRCSRVS")) { - endjob = true; - } else if (name.equals("QNPSERVS")) { - endjob = true; - } else { - out.println("Not ending job "+ j.toString()) ; - } - - if (endjob) { - endedJobInfo.append("Ending job " + j.toString()+"\n"); - try { - j.end(0); - } catch (Exception e) { - String message = e.toString(); - if (message.indexOf("not allowed") >= 0) { - System.out.println("Job already ending"); - } else { - e.printStackTrace(); - } - } /* catch */ - } /* endjob */ - } + if (system == null) { + as400 = new AS400(); + } else { + as400 = new AS400(system, userid, password.toCharArray()); } - /* while */ - out.println(endedJobInfo.toString()) ; - out.flush(); + JobList joblist = new JobList(as400); + joblist.addJobSelectionCriteria(JobList.SELECTION_PRIMARY_JOB_STATUS_ACTIVE, Boolean.TRUE); + joblist.addJobSelectionCriteria(JobList.SELECTION_PRIMARY_JOB_STATUS_OUTQ, Boolean.FALSE); + joblist.addJobSelectionCriteria(JobList.SELECTION_ACTIVE_JOB_STATUS, Job.ACTIVE_JOB_STATUS_WAIT_PRESTART); + + Enumeration enumeration = joblist.getJobs(); + StringBuffer endedJobInfo = new StringBuffer(); + + while (enumeration.hasMoreElements()) { + Job j = enumeration.nextElement(); + + String status = j.getStatus(); + if (status.equals(Job.JOB_STATUS_ACTIVE)) { + boolean endjob = false; + String name = j.getName(); + if (name.equals("QDBMSRVR")) { + endjob = true; + } else if (name.equals("QZDASOINIT")) { + endjob = true; + } else if (name.equals("QSQSRVR")) { + endjob = true; + } else if (name.equals("QRWTSRVR")) { + endjob = true; + } else if (name.equals("QP0ZSPWP")) { + endjob = true; + } else if (name.equals("QP0ZSPWT")) { + endjob = true; + } else if (name.equals("QZSOSIGN")) { + endjob = true; + } else if (name.equals("QZRCSRVS")) { + endjob = true; + } else if (name.equals("QNPSERVS")) { + endjob = true; + } else { + out.println("Not ending job " + j.toString()); + } + + if (endjob) { + endedJobInfo.append("Ending job " + j.toString() + "\n"); + try { + j.end(0); + } catch (Exception e) { + String message = e.toString(); + if (message.indexOf("not allowed") >= 0) { + System.out.println("Job already ending"); + } else { + e.printStackTrace(); + } + } /* catch */ + } /* endjob */ + } + } + /* while */ + out.println(endedJobInfo.toString()); + out.flush(); + as400.close(); } } diff --git a/src/test/CleanupQzrcsrvsJobs.java b/src/test/CleanupQzrcsrvsJobs.java index aae36e10..29ee3028 100644 --- a/src/test/CleanupQzrcsrvsJobs.java +++ b/src/test/CleanupQzrcsrvsJobs.java @@ -25,115 +25,117 @@ import com.ibm.as400.access.QueuedMessage; public class CleanupQzrcsrvsJobs { - public static void usage() { + public static void usage() { System.out.println("Usage: java CleanupQzrcsrvsJobs [ ]"); - System.out.println(" Ends all the QZRCSRVS jobs that are used by testcases and older than 1 hour"); + System.out.println(" Ends all the QZRCSRVS jobs that are used by testcases and older than 1 hour"); } + public static void main(String args[]) { - String system = null ; - String userid = null; - String password = null; - - try { + String system = null; + String userid = null; + String password = null; + + try { if (args.length >= 3) { - system=args[0]; - userid=args[1]; - password=args[2]; + system = args[0]; + userid = args[1]; + password = args[2]; } - AS400 as400; - - if (system == null) { - as400 = new AS400(); - } else { - as400 = new AS400(system, userid, password.toCharArray()); + AS400 as400; + + if (system == null) { + as400 = new AS400(); + } else { + as400 = new AS400(system, userid, password.toCharArray()); } - - JobList joblist = new JobList(as400); + + JobList joblist = new JobList(as400); joblist.addJobSelectionCriteria(JobList.SELECTION_PRIMARY_JOB_STATUS_ACTIVE, Boolean.TRUE); joblist.addJobSelectionCriteria(JobList.SELECTION_PRIMARY_JOB_STATUS_OUTQ, Boolean.FALSE); - joblist.addJobSelectionCriteria(JobList.SELECTION_JOB_NAME, "QZRCSRVS"); - Hashtable userSet = new Hashtable(); - SimpleDateFormat simpleDateFormat = new SimpleDateFormat(); - Enumeration enumeration = joblist.getJobs(); - long currentTimeMillis = System.currentTimeMillis(); - while (enumeration.hasMoreElements()) { + joblist.addJobSelectionCriteria(JobList.SELECTION_JOB_NAME, "QZRCSRVS"); + Hashtable userSet = new Hashtable(); + SimpleDateFormat simpleDateFormat = new SimpleDateFormat(); + Enumeration enumeration = joblist.getJobs(); + long currentTimeMillis = System.currentTimeMillis(); + while (enumeration.hasMoreElements()) { Job j = (Job) enumeration.nextElement(); - String user = j.getStringValue(Job.CURRENT_USER); - userSet.put(user,user); - // System.out.println("Job name is "+j.getNumber()+"/"+j.getUser()+"/"+j.getName()+" user is "+user); - if (user.equalsIgnoreCase("JAVA") || - user.equalsIgnoreCase("NEWTONJUDF") || - user.equalsIgnoreCase("SQLJTEST") || - user.equalsIgnoreCase("JDPWRSYS")) { - System.out.println("-------------------"); - System.out.println("Job name is "+j.getNumber()+"/"+j.getUser()+"/"+j.getName()+" user is "+user); - JobLog joblog = j.getJobLog(); - Enumeration messageEnumeration = joblog.getMessages(); - boolean endJob = false; - // - // Look for message of the following form. If the message is older than 1 hour then - // end the job. - // Message ID . . . . . . : CPF9898 Severity . . . . . . . : 40 - // Message type . . . . . : Diagnostic - // Date sent . . . . . . : 01/15/17 Time sent . . . . . . : 19:17:03 - // - // Message . . . . : Sun Jan 15 19:17:03 CST 2017 Running test.JDLobTest -tc - // JDLobClobLocator -lib JDT7163N -system UT30P58 -uid JDPWRSYS -pwd xxxxxxxx - // -pwrSys JDPWRSYS,xxxxxxxx -directory / -misc native,v7r1m0 -asp IASP. - // - boolean connectingJobMessageFound = false; - while (!connectingJobMessageFound && messageEnumeration.hasMoreElements()) { - QueuedMessage message = (QueuedMessage) messageEnumeration.nextElement(); - if (message.getID().equals("CPIAD02")) { - // System.out.println("CPF9898 found"); - String text = "Text is "+message.getText(); - System.out.println(text); - if (text.indexOf("connected") >= 0) { - connectingJobMessageFound = true; - - Calendar date = message.getDate(); - long millis = date.getTimeInMillis(); - if (currentTimeMillis - millis > 3600000) { - System.out.println("Message send over an hour ago "+ simpleDateFormat.format(date.getTime())); - endJob=true; - } else { - System.out.println("New message "+simpleDateFormat.format(date.getTime())); - } - - } - } - } - if (endJob) { - System.out.println("Ending job"); - try { - j.end(0); - } catch (Exception e) { - String message = e.toString(); - if (message.indexOf("not allowed") >= 0) { - System.out.println("Job already ending"); - } else { - e.printStackTrace(); - } - } - } - } else { - System.out.println("-------------------"); - System.out.println("Skipping job for user "+user); - } + String user = j.getStringValue(Job.CURRENT_USER); + userSet.put(user, user); + // System.out.println("Job name is + // "+j.getNumber()+"/"+j.getUser()+"/"+j.getName()+" user is "+user); + if (user.equalsIgnoreCase("JAVA") || user.equalsIgnoreCase("NEWTONJUDF") || user.equalsIgnoreCase("SQLJTEST") + || user.equalsIgnoreCase("JDPWRSYS")) { + System.out.println("-------------------"); + System.out + .println("Job name is " + j.getNumber() + "/" + j.getUser() + "/" + j.getName() + " user is " + user); + JobLog joblog = j.getJobLog(); + Enumeration messageEnumeration = joblog.getMessages(); + boolean endJob = false; + // + // Look for message of the following form. If the message is older than 1 hour + // then + // end the job. + // Message ID . . . . . . : CPF9898 Severity . . . . . . . : 40 + // Message type . . . . . : Diagnostic + // Date sent . . . . . . : 01/15/17 Time sent . . . . . . : 19:17:03 + // + // Message . . . . : Sun Jan 15 19:17:03 CST 2017 Running test.JDLobTest -tc + // JDLobClobLocator -lib JDT7163N -system UT30P58 -uid JDPWRSYS -pwd xxxxxxxx + // -pwrSys JDPWRSYS,xxxxxxxx -directory / -misc native,v7r1m0 -asp IASP. + // + boolean connectingJobMessageFound = false; + while (!connectingJobMessageFound && messageEnumeration.hasMoreElements()) { + QueuedMessage message = (QueuedMessage) messageEnumeration.nextElement(); + if (message.getID().equals("CPIAD02")) { + // System.out.println("CPF9898 found"); + String text = "Text is " + message.getText(); + System.out.println(text); + if (text.indexOf("connected") >= 0) { + connectingJobMessageFound = true; + + Calendar date = message.getDate(); + long millis = date.getTimeInMillis(); + if (currentTimeMillis - millis > 3600000) { + System.out.println("Message send over an hour ago " + simpleDateFormat.format(date.getTime())); + endJob = true; + } else { + System.out.println("New message " + simpleDateFormat.format(date.getTime())); + } + + } + } + } + if (endJob) { + System.out.println("Ending job"); + try { + j.end(0); + } catch (Exception e) { + String message = e.toString(); + if (message.indexOf("not allowed") >= 0) { + System.out.println("Job already ending"); + } else { + e.printStackTrace(); + } + } + } + } else { + System.out.println("-------------------"); + System.out.println("Skipping job for user " + user); + } } - - System.out.println("-----------------------------------------"); - System.out.println("Here are the users found on the system"); - Enumeration userEnumeration = userSet.keys(); + + System.out.println("-----------------------------------------"); + System.out.println("Here are the users found on the system"); + Enumeration userEnumeration = userSet.keys(); while (userEnumeration.hasMoreElements()) { - System.out.println(userEnumeration.nextElement()); + System.out.println(userEnumeration.nextElement()); } - - } catch (Exception e) { - e.printStackTrace(); - usage(); + as400.close(); + } catch (Exception e) { + e.printStackTrace(); + usage(); } - + } } diff --git a/src/test/CleanupSockets.java b/src/test/CleanupSockets.java index ee1ff9eb..dd8a797b 100644 --- a/src/test/CleanupSockets.java +++ b/src/test/CleanupSockets.java @@ -18,13 +18,13 @@ import java.sql.*; public class CleanupSockets { - public static void usage() { + public static void usage() { System.out.println("Usage: java CleanupSockets [System] [userid] [password]"); - System.out.println(" Cleans up sockets on the specified connection. If the system is not specifed then the local system is used. "); + System.out.println( + " Cleans up sockets on the specified connection. If the system is not specifed then the local system is used. "); } - public static void cleanup(PrintWriter printWriter, String system, - String userid, String password) throws Exception { + public static void cleanup(PrintWriter printWriter, String system, String userid, String password) throws Exception { Connection c = null; Timestamp ts; @@ -39,7 +39,7 @@ public static void cleanup(PrintWriter printWriter, String system, // Restart interface if needed. String query = "select 'ENDTCPIFC INTNETADR(''' CONCAT INTERNET_ADDRESS CONCAT ''')' ,INTERNET_ADDRESS, LINE_DESCRIPTION, INTERFACE_STATUS from QSYS2.NETSTAT_INTERFACE_INFO WHERE CONNECTION_TYPE='IPV4' AND INTERFACE_STATUS <> 'ACTIVE'"; - ts = new Timestamp(System.currentTimeMillis()); + ts = new Timestamp(System.currentTimeMillis()); printWriter.println(ts + " : running query " + query + "\n"); ResultSet rs = queryStatement.executeQuery(query); @@ -51,7 +51,8 @@ public static void cleanup(PrintWriter printWriter, String system, qcmdExcStatement.setString(1, command); qcmdExcStatement.execute(); } - + rs.close(); + query = "select 'STRTCPIFC INTNETADR(''' CONCAT INTERNET_ADDRESS CONCAT ''')' ,INTERNET_ADDRESS, LINE_DESCRIPTION, INTERFACE_STATUS from QSYS2.NETSTAT_INTERFACE_INFO WHERE CONNECTION_TYPE='IPV4' AND INTERFACE_STATUS <> 'ACTIVE'"; printWriter.println(ts + " : running query " + query + "\n"); @@ -65,7 +66,8 @@ public static void cleanup(PrintWriter printWriter, String system, qcmdExcStatement.setString(1, command); qcmdExcStatement.execute(); } - + rs.close(); + // Cleanup ports ts = new Timestamp(System.currentTimeMillis()); query = "select 'ENDTCPCNN PROTOCOL(*TCP) LCLINTNETA('''||LOCAL_ADDRESS||''') LCLPORT('||LOCAL_PORT||') RMTINTNETA('''||REMOTE_ADDRESS||''') RMTPORT('||REMOTE_PORT|| ') ', " @@ -81,9 +83,8 @@ public static void cleanup(PrintWriter printWriter, String system, printWriter.println(ts + " : exeuting command " + command + "\n"); qcmdExcStatement.setString(1, command); qcmdExcStatement.execute(); - } - - + } + rs.close(); // Cleanup scanner hanging on port 6042 ts = new Timestamp(System.currentTimeMillis()); @@ -98,40 +99,39 @@ public static void cleanup(PrintWriter printWriter, String system, printWriter.println(ts + " : exeuting command " + command + "\n"); qcmdExcStatement.setString(1, command); qcmdExcStatement.execute(); - } - - - - c.close(); - - + } + rs.close(); + queryStatement.close(); + qcmdExcStatement.close(); + c.close(); } + public static void main(String args[]) { - String system = null ; - String userid = null; - String password = null; - PrintWriter printWriter = null; - - try { + String system = null; + String userid = null; + String password = null; + PrintWriter printWriter = null; + + try { printWriter = new PrintWriter(new FileWriter("/tmp/CleanupSockets.out", true)); if (args.length >= 3) { - system=args[0]; - userid=args[1]; - password=args[2]; + system = args[0]; + userid = args[1]; + password = args[2]; } - cleanup(printWriter, system,userid,password); - - } catch (Exception e) { - StringBuffer sb = new StringBuffer(); - e.printStackTrace(); - Testcase.printStackTraceToStringBuffer(e, sb); - printWriter.append("Error: "+sb.toString()+"\n"); - usage(); + cleanup(printWriter, system, userid, password); + + } catch (Exception e) { + StringBuffer sb = new StringBuffer(); + e.printStackTrace(); + Testcase.printStackTraceToStringBuffer(e, sb); + printWriter.append("Error: " + sb.toString() + "\n"); + usage(); } - if (printWriter != null) { - printWriter.close(); + if (printWriter != null) { + printWriter.close(); } } } diff --git a/src/test/Conv/ConvTableThreadTestcase.java b/src/test/Conv/ConvTableThreadTestcase.java index 37c117fa..219290f3 100644 --- a/src/test/Conv/ConvTableThreadTestcase.java +++ b/src/test/Conv/ConvTableThreadTestcase.java @@ -80,7 +80,9 @@ public void run() catch (Exception e) { keepRunning_ = false; - error_ = "Exception occurred in thread for ccsid " + ccsid_ + ": " + e.getMessage(); + StringBuffer sb = new StringBuffer(); + printStackTraceToStringBuffer(e, sb); + error_ = "Exception occurred in thread for ccsid " + ccsid_ + ": " + e.getMessage()+sb.toString(); } } } @@ -215,7 +217,8 @@ public void Var002() try { - output_.println("This variation will take approximately 120 seconds."); + NLS.setForceJavaConversion(true); + output_.println("Var002 will take approximately 120 seconds."); ct = new CTThread[4]; int c = 0; // ConvTableSingleMap @@ -224,7 +227,8 @@ public void Var002() ct[c++] = new CTThread(1282, "JKLMN", new byte[] { (byte)0x4A, (byte)0x4B, (byte)0x4C, (byte)0x4D, (byte)0x4E }); ct[c++] = new CTThread(913, "OPQR", new byte[] { (byte)0x4F, (byte)0x50, (byte)0x51, (byte)0x52 }); ct[c++] = new CTThread(5054, "ZYX", new byte[] { (byte)0x5A, (byte)0x59, (byte)0x58 }); - + NLS.setForceJavaConversion(false); + t = new Thread[ct.length]; for (int i = 0; i < t.length; ++i) { diff --git a/src/test/DDM/DDMMultipleFormat.java b/src/test/DDM/DDMMultipleFormat.java index ba55ad4d..b9599760 100644 --- a/src/test/DDM/DDMMultipleFormat.java +++ b/src/test/DDM/DDMMultipleFormat.java @@ -15,6 +15,7 @@ import java.io.BufferedReader; import java.io.FileOutputStream; +import java.io.IOException; import java.io.InputStreamReader; import java.math.BigDecimal; import java.util.Vector; @@ -24,33 +25,36 @@ import com.ibm.as400.access.AS400File; import com.ibm.as400.access.AS400FileRecordDescription; import com.ibm.as400.access.AS400Message; +import com.ibm.as400.access.AS400SecurityException; import com.ibm.as400.access.CommandCall; +import com.ibm.as400.access.ErrorCompletingRequestException; +import com.ibm.as400.access.Job; import com.ibm.as400.access.KeyedFile; +import com.ibm.as400.access.ObjectDoesNotExistException; import com.ibm.as400.access.Record; import com.ibm.as400.access.RecordFormat; import com.ibm.as400.access.SequentialFile; import test.Testcase; - /** - *Testcase DDMMultipleFormat. This test class verifies using multiple format logical files: - *
    - *
  • reading - *
  • writing - *
-**/ -public class DDMMultipleFormat extends Testcase -{ + * Testcase DDMMultipleFormat. This test class verifies using multiple format + * logical files:
    + *
  • reading + *
  • writing + *
+ **/ +public class DDMMultipleFormat extends Testcase { public static void main(String args[]) throws Exception { - String[] newArgs = new String[args.length+2]; - newArgs[0] = "-tc"; - newArgs[1] = "DDMMultipleFormat"; - for (int i = 0; i < args.length; i++) { - newArgs[2+i]=args[i]; - } - test.DDMTest.main(newArgs); - } + String[] newArgs = new String[args.length + 2]; + newArgs[0] = "-tc"; + newArgs[1] = "DDMMultipleFormat"; + for (int i = 0; i < args.length; i++) { + newArgs[2 + i] = args[i]; + } + test.DDMTest.main(newArgs); + } + // AS400 pwrSys_ = DDMTest.PwrSys; long start; long time; @@ -60,35 +64,25 @@ public static void main(String args[]) throws Exception { Record[] recordsFmt2_ = new Record[100]; /** - Constructor. This is called from the DDMTest constructor. - **/ -/* public DDMMultipleFormat(AS400 systemObject, - Vector variationsToRun, - int runMode, - FileOutputStream fileOutputStream, - ) - { - // The third parameter is the total number of variations in this class. - super(systemObject, "DDMMultipleFormat", 1, variationsToRun, runMode, - fileOutputStream); - pwrSys_ = pwrSys; - } -*/ + * Constructor. This is called from the DDMTest constructor. + **/ + /* + * public DDMMultipleFormat(AS400 systemObject, Vector variationsToRun, + * int runMode, FileOutputStream fileOutputStream, ) { // The third parameter is + * the total number of variations in this class. super(systemObject, + * "DDMMultipleFormat", 1, variationsToRun, runMode, fileOutputStream); pwrSys_ + * = pwrSys; } + */ /** - Constructor. This is called from the DDMTest constructor. - **/ - public DDMMultipleFormat(AS400 systemObject, - Vector variationsToRun, - int runMode, - FileOutputStream fileOutputStream, - - String testLib, - AS400 pwrSys) - { + * Constructor. This is called from the DDMTest constructor. + **/ + public DDMMultipleFormat(AS400 systemObject, Vector variationsToRun, int runMode, + FileOutputStream fileOutputStream, + + String testLib, AS400 pwrSys) { // The third parameter is the total number of variations in this class. - super(systemObject, "DDMMultipleFormat", 1, variationsToRun, runMode, - fileOutputStream); + super(systemObject, "DDMMultipleFormat", 1, variationsToRun, runMode, fileOutputStream); pwrSys_ = pwrSys; // if (testLib != null) // { @@ -97,42 +91,24 @@ public DDMMultipleFormat(AS400 systemObject, } /** - Runs the variations requested. - **/ - public void run() - { + * Runs the variations requested. + **/ + public void runX() { boolean allVariations = (variationsToRun_.size() == 0); - // Connect to the AS/400 for the record level access service - try - { - systemObject_.connectService(AS400.RECORDACCESS); - } - catch(Exception e) - { - output_.println("Unable to connect to the AS/400"); - return; - } - - // Do any necessary setup work for the variations - try - { + try { setup(); - } - catch (Exception e) - { + } catch (Exception e) { // Testcase setup did not complete successfully output_.println("Unable to complete setup; variations not run"); return; } - if (runMode_ != ATTENDED) - { + if (runMode_ != ATTENDED) { // Run all unattended variations. if (allVariations || variationsToRun_.contains("1")) Var001(); -/* if (allVariations || variationsToRun_.contains("2")) Var002(); if (allVariations || variationsToRun_.contains("3")) @@ -163,17 +139,13 @@ public void run() Var015(); if (allVariations || variationsToRun_.contains("16")) Var016(); -*/ - } + } // Do any necessary cleanup work for the variations - try - { + try { cleanup(); - } - catch (Exception e) - { + } catch (Exception e) { output_.println("Unable to complete cleanup."); } @@ -182,24 +154,28 @@ public void run() } /** - @exception Exception If an exception occurs. + * @exception Exception If an exception occurs. **/ - protected void setup() - throws Exception - { - try - { - lockSystem("DDMTESTSAV",600); + protected void setup() throws Exception { + try { + + lockSystem("DDMTESTSAV", 600); + + // Connect to the AS/400 for the record level access service + try { + systemObject_.connectService(AS400.RECORDACCESS); + } catch (Exception e) { + output_.println("Unable to connect to the AS/400"); + return; + } fileName_ = "/qsys.lib/ddmtestsav.lib/mltfmt.file/%file%.mbr"; // Verify the existence of library DDMTESTSAV on the system CommandCall c = new CommandCall(pwrSys_, "CHKOBJ OBJ(DDMTESTSAV) OBJTYPE(*LIB)"); c.run(); AS400Message[] msgs = c.getMessageList(); - if (msgs.length != 0) - { - for (int i = 0; i < msgs.length; ++i) - { + if (msgs.length != 0) { + for (int i = 0; i < msgs.length; ++i) { output_.println(msgs[i]); } output_.println("Either library DDMTESTSAV does not exist or you"); @@ -210,46 +186,48 @@ protected void setup() output_.println("Use RSTLIB to restore library DDMTESTSAV to the system."); throw new Exception(""); } - // Make sure the user has access - String command = " GRTOBJAUT OBJ(DDMTESTSAV) OBJTYPE(*LIB) USER("+userId_+") "; - boolean result = c.run(command); + // Make sure the user has access + String command = " GRTOBJAUT OBJ(DDMTESTSAV) OBJTYPE(*LIB) USER(" + userId_ + ") "; + boolean result = c.run(command); if (!result) { - output_.println("Warning: Command failed : "+command); + output_.println("Warning: Command failed : " + command); } - - command = "QSYS/GRTOBJAUT OBJ(DDMTESTSAV/*ALL) OBJTYPE(*ALL) USER("+userId_+") "; - result = c.run(command); + + command = "QSYS/GRTOBJAUT OBJ(DDMTESTSAV/*ALL) OBJTYPE(*ALL) USER(" + userId_ + ") "; + result = c.run(command); if (!result) { - output_.println("Warning: Command failed : "+command); + output_.println("Warning: Command failed : " + command); } - + // Delete and re-create the file SequentialFile f = new SequentialFile(pwrSys_, fileName_); - try - { + try { f.delete(); - f.close(); - } - catch(Exception e) {} // may not exist, so ignore faliures - + } catch (Exception e) { + } // may not exist, so ignore faliures + + try { + f.close(); + } catch (Exception e) { + } // may not exist, so ignore faliures + c.run("QSYS/CRTLF FILE(DDMTESTSAV/MLTFMT) SRCFILE(DDMTESTSAV/QDDSSRC)"); - c.run("QSYS/GRTOBJAUT OBJ(DDMTESTSAV/MLTFMT) OBJTYPE(*ALL) USER("+userId_+")"); - + c.run("QSYS/GRTOBJAUT OBJ(DDMTESTSAV/MLTFMT) OBJTYPE(*ALL) USER(" + userId_ + ")"); + // Populate file simpleseq - this is the file over which mltfmt is built // Clear the file first c.run("QSYS/CLRPFM FILE(DDMTESTSAV/SIMPLESEQ)"); - AS400FileRecordDescription rd = new AS400FileRecordDescription(systemObject_, "/qsys.lib/ddmtestsav.lib/simpleseq.file"); + AS400FileRecordDescription rd = new AS400FileRecordDescription(systemObject_, + "/qsys.lib/ddmtestsav.lib/simpleseq.file"); SequentialFile f2 = new SequentialFile(pwrSys_, "/qsys.lib/ddmtestsav.lib/simpleseq.file"); f2.setRecordFormat(rd.retrieveRecordFormat()[0]); f2.open(AS400File.WRITE_ONLY, 0, AS400File.COMMIT_LOCK_LEVEL_NONE); RecordFormat rf = f2.getRecordFormat(); String field1 = null; - for (int i = 0; i < 100; ++i) - { + for (int i = 0; i < 100; ++i) { records_[i] = rf.getNewRecord(); field1 = "Record " + String.valueOf(i); - for (int j = field1.length(); j < 10; ++j) - { + for (int j = field1.length(); j < 10; ++j) { field1 += " "; } records_[i].setField(0, field1); @@ -264,80 +242,108 @@ protected void setup() RecordFormat[] rfs = rd.retrieveRecordFormat(); k.setRecordFormat(rfs[0]); k.open(AS400File.READ_ONLY, 100, AS400File.COMMIT_LOCK_LEVEL_NONE); - for (int i = 0; i < 100; ++i) - { + for (int i = 0; i < 100; ++i) { recordsFmt1_[i] = k.readNext(); } k.close(); k.setRecordFormat(rfs[1]); k.open(AS400File.READ_ONLY, 100, AS400File.COMMIT_LOCK_LEVEL_NONE); - for (int i = 0; i < 100; ++i) - { + for (int i = 0; i < 100; ++i) { recordsFmt2_[i] = k.readNext(); } k.close(); - } - catch(Exception e) - { + + // Create the necessary files for this testcase + SequentialFile f1 = new SequentialFile(systemObject_, "/QSYS.LIB/DDMTESTSAV.LIB/DDMLOCK.FILE/MBR1.MBR"); + try { + f1.create(new DDMLockFormat(systemObject_), "DDMLocking file"); + } catch (Exception e) { + String message = e.toString(); + if (message.indexOf("already exists") < 0) { + f1.close(); + f1.commit(); + throw e; + } + + } + f1.close(); + f1.commit(); + } catch (Exception e) { e.printStackTrace(output_); throw e; } } /** - @exception Exception If an exception occurs. + * @exception Exception If an exception occurs. **/ - protected void cleanup() - throws Exception - { - unlockSystem(); + protected void cleanup() throws Exception { + unlockSystem(); } /** - *Verify multpiple format logical file.. - *
    - *
  • Read from the file specifying the different formats associated with the file. - *
- *Expected results: - *
    - *
  • Record read will have the correct format. - *
- **/ - public void Var001() - { + * Change the default wait time so that the tests run faster. This did not work + * as the open does not respect the default wait time on the open + * + * @param as400 + * @throws AS400SecurityException + * @throws IOException + * @throws ErrorCompletingRequestException + * @throws InterruptedException + * @throws ObjectDoesNotExistException + */ + private void changeWaitTime(AS400 as400) throws AS400SecurityException, IOException, ErrorCompletingRequestException, + InterruptedException, ObjectDoesNotExistException { + + as400.connectService(AS400.RECORDACCESS); + + Job[] jobs = as400.getJobs(AS400.RECORDACCESS); + + for (int i = 0; i < jobs.length; i++) { + Job job = jobs[i]; + job.setDefaultWait(5); + job.commitChanges(); + } + + } + + /** + * Verify multpiple format logical file..
    + *
  • Read from the file specifying the different formats associated with the + * file. + *
+ * Expected results:
    + *
  • Record read will have the correct format. + *
+ **/ + public void Var001() { setVariation(1); KeyedFile file1 = null; KeyedFile file2 = null; - try - { + try { AS400FileRecordDescription rd = new AS400FileRecordDescription(systemObject_, fileName_); RecordFormat[] rfs = rd.retrieveRecordFormat(); - if (rfs.length != 2) - { + if (rfs.length != 2) { failed("Wrong number of record formats returned"); return; } - Object [] key = new Object[1]; + Object[] key = new Object[1]; key[0] = "Record 1 "; - file1 = - new KeyedFile(systemObject_, fileName_); + file1 = new KeyedFile(systemObject_, fileName_); file1.setRecordFormat(rfs[0]); file1.open(AS400File.READ_ONLY, 0, AS400File.COMMIT_LOCK_LEVEL_NONE); - file2 = - new KeyedFile(systemObject_, fileName_); + file2 = new KeyedFile(systemObject_, fileName_); file2.setRecordFormat(rfs[1]); file2.open(AS400File.READ_ONLY, 0, AS400File.COMMIT_LOCK_LEVEL_NONE); Record record = file1.read(key); - if (!record.toString().equals(recordsFmt1_[1].toString())) - { + if (!record.toString().equals(recordsFmt1_[1].toString())) { failed("Wrong record for first format: " + record.toString() + ".\n" + recordsFmt1_[1].toString() + "."); file1.close(); file2.close(); return; } record = file2.read(key); - if (!record.toString().equals(recordsFmt2_[1].toString())) - { + if (!record.toString().equals(recordsFmt2_[1].toString())) { failed("Wrong record for second format: " + record.toString()); file1.close(); file2.close(); @@ -345,1023 +351,897 @@ record = file2.read(key); } file1.close(); file2.close(); - } - catch(Exception e) - { + + } catch (Exception e) { failed(e, "Unexpected exception"); - try - { + try { file1.close(); + } catch (Exception e1) { + } + try { file2.close(); + } catch (Exception e1) { } - catch(Exception e1) {} return; } succeeded(); } /** - *Verify AS400File.lock(int) with a lock type of READ_EXCLUSIVE_LOCK. - *
    - *
  • Set the lock when the file is closed. - *
- *Expected results: - *
    - *
  • Another connection should not be able to open the file for read, read/write or write. - *
+ * Verify AS400File.lock(int) with a lock type of READ_EXCLUSIVE_LOCK.
    + *
  • Set the lock when the file is closed. + *
+ * Expected results:
    + *
  • Another connection should not be able to open the file for read, + * read/write or write. + *
+ **/ + public void Var002() { + setVariation(2); + SequentialFile file = null; + SequentialFile violator = null; + AS400 violatorAS400 = null; + + try { + + file = new SequentialFile(systemObject_, "/QSYS.LIB/DDMTESTSAV.LIB/DDMLOCK.FILE/MBR1.MBR"); + file.lock(AS400File.READ_EXCLUSIVE_LOCK); + + violatorAS400 = new AS400(systemObject_); + changeWaitTime(violatorAS400); + violator = new SequentialFile(violatorAS400, file.getPath()); + violator.setRecordFormat(new DDMLockFormat(systemObject_)); + + try { + violator.open(AS400File.READ_ONLY, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); + failed("No exception with READ_ONLY"); + } catch (AS400Exception e) { + AS400Message msg = e.getAS400Message(); + if (msg.getID().toUpperCase().indexOf("CPF4128") == -1) { + failed(e, "Wrong exception id with READ_ONLY."); + } else { + try { + violator.open(AS400File.READ_WRITE, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); + failed("Exception didn't occur with READ_WRITE."); + } catch (AS400Exception e1) { + msg = e1.getAS400Message(); + if (msg.getID().toUpperCase().indexOf("CPF4128") == -1) { + failed(e1, "Wrong exception id with READ_WRITE."); + } else { + try { + violator.open(AS400File.WRITE_ONLY, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); + failed("Exception didn't occur with WRITE_ONLY."); + } catch (AS400Exception e2) { + msg = e.getAS400Message(); + if (msg.getID().toUpperCase().indexOf("CPF4128") == -1) { + failed(e2, "Wrong exception id with WRITE_ONLY."); + } else { + succeeded(); + } + } + } + } + } + } catch (Exception e) { + failed(e, "Incorrect exception."); + } + } catch (Exception e) { + failed(e, "Unexpected exception."); + } + // Release the lock obtained + try { + file.releaseExplicitLocks(); + } catch (Exception e) { + output_.println("Failed to release explicit locks for " + file.getPath()); + } + try { + file.close(); + } catch (Exception e) { + } + // Disconnect from the system for violator. This is to prevent the subsystem + // from filling up with jobs. + try { + violator.close(); + } catch (Exception e) { + } + try { + violatorAS400.close(); + } catch (Exception e) { + } + } + + /** + * Verify AS400File.lock(int) with a lock type of READ_EXCLUSIVE_LOCK.
    + *
  • Set the lock when the file is open. + *
+ * Expected results:
    + *
  • Another connection should not be able to open the file for read only. + *
**/ - public void Var002() - { - setVariation(2); - SequentialFile file = null; - SequentialFile violator = null; - try - { - file = new SequentialFile(systemObject_, - "/QSYS.LIB/DDMTEST.LIB/DDMLOCK.FILE/MBR1.MBR"); - file.lock(AS400File.READ_EXCLUSIVE_LOCK); - violator = new SequentialFile(new AS400(systemObject_), file.getPath()); - violator.setRecordFormat(new DDMLockFormat(systemObject_)); - try - { - violator.open(AS400File.READ_ONLY, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); - failed("No exception with READ_ONLY"); - } - catch(AS400Exception e) - { - AS400Message msg = e.getAS400Message(); - if (msg.getID().toUpperCase().indexOf("CPF4128") == -1) - { - failed(e, "Wrong exception id with READ_ONLY."); - } - else - { - try - { - violator.open(AS400File.READ_WRITE, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); - failed("Exception didn't occur with READ_WRITE."); - } - catch(AS400Exception e1) - { - msg = e1.getAS400Message(); - if (msg.getID().toUpperCase().indexOf("CPF4128") == -1) - { - failed(e1, "Wrong exception id with READ_WRITE."); - } - else - { - try - { - violator.open(AS400File.WRITE_ONLY, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); - failed("Exception didn't occur with WRITE_ONLY."); - } - catch(AS400Exception e2) - { - msg = e.getAS400Message(); - if (msg.getID().toUpperCase().indexOf("CPF4128") == -1) - { - failed(e2, "Wrong exception id with WRITE_ONLY."); - } - else - { - succeeded(); - } - } - } - } - } - } - catch(Exception e) - { - failed(e, "Incorrect exception."); - } - } - catch(Exception e) - { - failed(e, "Unexpected exception."); - } - // Release the lock obtained - try - { - file.releaseExplicitLocks(); - file.close(); - } - catch(Exception e) - { - output_.println("Failed to release explicit locks for " + file.getPath()); - } - // Disconnect from the system for violator. This is to prevent the subsystem - // from filling up with jobs. - violator.getSystem().disconnectService(AS400.RECORDACCESS); - try { + public void Var003() { + setVariation(3); + SequentialFile file = null; + SequentialFile violator = null; + AS400 violatorAS400 = null; + try { + file = new SequentialFile(systemObject_, "/QSYS.LIB/DDMTESTSAV.LIB/DDMLOCK.FILE/MBR1.MBR"); + file.setRecordFormat(new DDMLockFormat(systemObject_)); + file.open(AS400File.READ_ONLY, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); + file.lock(AS400File.READ_EXCLUSIVE_LOCK); + violatorAS400 = new AS400(systemObject_); + changeWaitTime(violatorAS400); + violator = new SequentialFile(violatorAS400, file.getPath()); + violator.setRecordFormat(file.getRecordFormat()); + violator.open(AS400File.READ_ONLY, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); + failed("Exception didn't occur."); + } catch (AS400Exception e) { + AS400Message msg = e.getAS400Message(); + if (msg.getID().toUpperCase().indexOf("CPF4128") == -1) { + failed(e, "Wrong exception id."); + } else { + succeeded(); + } + } catch (Exception e) { + failed(e, "Incorrect exception."); + } + + try { + file.close(); + } catch (Exception e) { + } + // Disconnect from the system for violator. This is to prevent the subsystem + // from filling up with jobs. + try { violator.close(); } catch (Exception e) { + } + try { + violatorAS400.close(); + } catch (Exception e) { + } + + } + + /** + * Verify AS400File.lock(int) with a lock type of READ_ALLOW_SHARED_READ_LOCK. + *
    + *
  • Set the lock when the file is closed. + *
+ * Expected results:
    + *
  • Another connection should be able to open the file for reading. + *
  • Another connection should not be able to open the file for writing. + *
+ **/ + public void Var004() { + setVariation(4); + SequentialFile file1 = null; + SequentialFile file2 = null; + SequentialFile violator = null; + AS400 violatorAS400 = null; + AS400 file2AS400 = null; + + try { + file1 = new SequentialFile(systemObject_, "/QSYS.LIB/DDMTESTSAV.LIB/DDMLOCK.FILE/MBR1.MBR"); + file1.lock(AS400File.READ_ALLOW_SHARED_READ_LOCK); + file2AS400 = new AS400(systemObject_); + file2 = new SequentialFile(file2AS400, file1.getPath()); + file2.setRecordFormat(new DDMLockFormat(systemObject_)); + file2.open(AS400File.READ_ONLY, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); + file2.close(); + violatorAS400 = new AS400(systemObject_); + changeWaitTime(violatorAS400); + + violator = new SequentialFile(violatorAS400, file1.getPath()); + violator.setRecordFormat(file2.getRecordFormat()); + try { + violator.open(AS400File.READ_WRITE, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); + failed("Exception didn't occur."); + } catch (AS400Exception e) { + AS400Message msg = e.getAS400Message(); + if (msg.getID().toUpperCase().indexOf("CPF4128") == -1) { + failed(e, "Wrong exception id returned."); + } else { + succeeded(); + } + } catch (Exception e) { + failed(e, "Incorrect exception."); + } + } catch (Exception e) { + failed(e, "Unexpected exception occurred"); + } + + // Release the lock on the file + try { + file1.releaseExplicitLocks(); + } catch (Exception e) { + e.printStackTrace(); + } + try { + file1.close(); + } catch (Exception e) { + e.printStackTrace(); + } + + // Disconnect from the other connections + + try { + file2.close(); + } catch (Exception e) { } - } + file2AS400.close(); + if (violator != null) + try { + violator.close(); + } catch (Exception e) { + } + if (violatorAS400 != null) violatorAS400.close(); + + } /** - *Verify AS400File.lock(int) with a lock type of READ_EXCLUSIVE_LOCK. - *
    - *
  • Set the lock when the file is open. - *
- *Expected results: - *
    - *
  • Another connection should not be able to open the file for read only. - *
+ * Verify AS400File.lock(int) with a lock type of READ_ALLOW_SHARED_READ_LOCK. + *
    + *
  • Set the lock when the file is open. + *
+ * Expected results:
    + *
  • Another connection should be able to open the file for reading. + *
  • Another connection should not be able to open the file for writing. + *
**/ - public void Var003() - { - setVariation(3); - SequentialFile file = null; - SequentialFile violator = null; - try - { - file = new SequentialFile(systemObject_, - "/QSYS.LIB/DDMTEST.LIB/DDMLOCK.FILE/MBR1.MBR"); - file.setRecordFormat(new DDMLockFormat(systemObject_)); - file.open(AS400File.READ_ONLY, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); - file.lock(AS400File.READ_EXCLUSIVE_LOCK); - violator = new SequentialFile(new AS400(systemObject_), file.getPath()); - violator.setRecordFormat(file.getRecordFormat()); - violator.open(AS400File.READ_ONLY, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); - failed("Exception didn't occur."); - } - catch(AS400Exception e) - { - AS400Message msg = e.getAS400Message(); - if (msg.getID().toUpperCase().indexOf("CPF4128") == -1) - { - failed(e, "Wrong exception id."); - } - else - { - succeeded(); - } - } - catch(Exception e) - { - failed(e, "Incorrect exception."); - } - - try - { - file.close(); - } - catch(Exception e) {} - // Disconnect from the system for violator. This is to prevent the subsystem from filling - // up with jobs. - violator.getSystem().disconnectService(AS400.RECORDACCESS); - } + public void Var005() { + setVariation(5); + SequentialFile file1 = null; + SequentialFile file2 = null; + SequentialFile violator = null; + AS400 file2AS400 = null; + AS400 violatorAS400 = null; + + try { + file1 = new SequentialFile(systemObject_, "/QSYS.LIB/DDMTESTSAV.LIB/DDMLOCK.FILE/MBR1.MBR"); + file1.setRecordFormat(new DDMLockFormat(systemObject_)); + file1.open(AS400File.READ_ONLY, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); + file1.lock(AS400File.READ_ALLOW_SHARED_READ_LOCK); + file2AS400 = new AS400(systemObject_); + file2 = new SequentialFile(file2AS400, file1.getPath()); + file2.setRecordFormat(file1.getRecordFormat()); + file2.open(AS400File.READ_ONLY, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); + file2.close(); + violatorAS400 = new AS400(systemObject_); + changeWaitTime(violatorAS400); + + violator = new SequentialFile(violatorAS400, file1.getPath()); + violator.setRecordFormat(file1.getRecordFormat()); + try { + violator.open(AS400File.READ_WRITE, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); + failed("Exception didn't occur."); + } catch (AS400Exception e) { + AS400Message msg = e.getAS400Message(); + if (msg.getID().toUpperCase().indexOf("CPF4128") == -1) { + failed(e, "Wrong exception id returned."); + } else { + succeeded(); + } + } catch (Exception e) { + failed(e, "Incorrect exception."); + } + } catch (Exception e) { + failed(e, "Unexpected exception occurred"); + } + + // Release the lock on the file + try { + file1.close(); + } catch (Exception e) { + e.printStackTrace(); + } + // Disconnect from the other connections + try { + file2.close(); + } catch (Exception e) { + } + if (file2AS400 != null) file2AS400.close(); + if (violatorAS400 != null) violatorAS400.close(); + + } + + /** + * Verify AS400File.lock(int) with a lock type of READ_ALLOW_SHARED_WRITE_LOCK. + *
    + *
  • Set the lock when the file is closed. + *
+ * Expected results:
    + *
  • Another connection should be able to open the file for read, read/write + * or write. + *
  • No exceptions should occur. + *
+ **/ + public void Var006() { + setVariation(6); + SequentialFile file1 = null; + SequentialFile file2 = null; + try { + file1 = new SequentialFile(systemObject_, "/QSYS.LIB/DDMTESTSAV.LIB/DDMLOCK.FILE/MBR1.MBR"); + file1.lock(AS400File.READ_ALLOW_SHARED_WRITE_LOCK); + file2 = new SequentialFile(new AS400(systemObject_), file1.getPath()); + file2.setRecordFormat(new DDMLockFormat(systemObject_)); + file2.open(AS400File.WRITE_ONLY, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); + file2.close(); + file2.open(AS400File.READ_ONLY, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); + file2.close(); + file2.open(AS400File.READ_WRITE, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); + file2.close(); + file1.close(); + succeeded(); + } catch (Exception e) { + failed(e, "Unexpected exception."); + } + // Disconnect from the other connection + file2.getSystem().disconnectService(AS400.RECORDACCESS); + } /** - *Verify AS400File.lock(int) with a lock type of READ_ALLOW_SHARED_READ_LOCK. - *
    - *
  • Set the lock when the file is closed. - *
- *Expected results: - *
    - *
  • Another connection should be able to open the file for reading. - *
  • Another connection should not be able to open the file for writing. - *
+ * Verify AS400File.lock(int) with a lock type of READ_ALLOW_SHARED_WRITE_LOCK. + *
    + *
  • Set the lock when the file is open. + *
+ * Expected results:
    + *
  • Another connection should be able to open the file for read, read/write + * or write. + *
  • No exceptions should occur. + *
**/ - public void Var004() - { - setVariation(4); - SequentialFile file1 = null; - SequentialFile file2 = null; - SequentialFile violator = null; - try - { - file1 = new SequentialFile(systemObject_, - "/QSYS.LIB/DDMTEST.LIB/DDMLOCK.FILE/MBR1.MBR"); - file1.lock(AS400File.READ_ALLOW_SHARED_READ_LOCK); - file2 = new SequentialFile(new AS400(systemObject_), file1.getPath()); - file2.setRecordFormat(new DDMLockFormat(systemObject_)); - file2.open(AS400File.READ_ONLY, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); - file2.close(); - violator = new SequentialFile(new AS400(systemObject_), file1.getPath()); - violator.setRecordFormat(file2.getRecordFormat()); - try - { - violator.open(AS400File.READ_WRITE, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); - failed("Exception didn't occur."); - } - catch(AS400Exception e) - { - AS400Message msg = e.getAS400Message(); - if (msg.getID().toUpperCase().indexOf("CPF4128") == -1) - { - failed(e, "Wrong exception id returned."); - } - else - { - succeeded(); - } - } - catch(Exception e) - { - failed(e, "Incorrect exception."); - } - } - catch(Exception e) - { - failed(e, "Unexpected exception occurred"); - } - - // Release the lock on the file - try - { - file1.releaseExplicitLocks(); - file1.close(); - } - catch(Exception e) {e.printStackTrace();} - // Disconnect from the other connections - file2.getSystem().disconnectService(AS400.RECORDACCESS); - violator.getSystem().disconnectService(AS400.RECORDACCESS); - } + public void Var007() { + setVariation(7); + SequentialFile file1 = null; + SequentialFile file2 = null; + try { + file1 = new SequentialFile(systemObject_, "/QSYS.LIB/DDMTESTSAV.LIB/DDMLOCK.FILE/MBR1.MBR"); + file1.setRecordFormat(new DDMLockFormat(systemObject_)); + file1.open(AS400File.READ_ONLY, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); + file1.lock(AS400File.READ_ALLOW_SHARED_WRITE_LOCK); + file2 = new SequentialFile(new AS400(systemObject_), file1.getPath()); + file2.setRecordFormat(file1.getRecordFormat()); + file2.open(AS400File.WRITE_ONLY, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); + file2.close(); + file2.open(AS400File.READ_ONLY, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); + file2.close(); + file2.open(AS400File.READ_WRITE, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); + file2.close(); + succeeded(); + } catch (Exception e) { + failed(e, "Unexpected exception."); + } + + try { + file1.close(); + } catch (Exception e) { + e.printStackTrace(); + } + // Disconnect from the other connection + file2.getSystem().disconnectService(AS400.RECORDACCESS); + } /** - *Verify AS400File.lock(int) with a lock type of READ_ALLOW_SHARED_READ_LOCK. - *
    - *
  • Set the lock when the file is open. - *
- *Expected results: - *
    - *
  • Another connection should be able to open the file for reading. - *
  • Another connection should not be able to open the file for writing. - *
+ * Verify AS400File.lock(int) with a lock type of WRITE_EXCLUSIVE_LOCK.
    + *
  • Set the lock when the file is closed. + *
+ * Expected results:
    + *
  • Another connection should not be able to open the file for read, + * read/write or write. + *
**/ - public void Var005() - { - setVariation(5); - SequentialFile file1 = null; - SequentialFile file2 = null; - SequentialFile violator = null; - try - { - file1 = new SequentialFile(systemObject_, - "/QSYS.LIB/DDMTEST.LIB/DDMLOCK.FILE/MBR1.MBR"); - file1.setRecordFormat(new DDMLockFormat(systemObject_)); - file1.open(AS400File.READ_ONLY, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); - file1.lock(AS400File.READ_ALLOW_SHARED_READ_LOCK); - file2 = new SequentialFile(new AS400(systemObject_), file1.getPath()); - file2.setRecordFormat(file1.getRecordFormat()); - file2.open(AS400File.READ_ONLY, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); - file2.close(); - - violator = new SequentialFile(new AS400(systemObject_), file1.getPath()); - violator.setRecordFormat(file1.getRecordFormat()); - try - { - violator.open(AS400File.READ_WRITE, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); - failed("Exception didn't occur."); - } - catch(AS400Exception e) - { - AS400Message msg = e.getAS400Message(); - if (msg.getID().toUpperCase().indexOf("CPF4128") == -1) - { - failed(e, "Wrong exception id returned."); - } - else - { - succeeded(); - } - } - catch(Exception e) - { - failed(e, "Incorrect exception."); - } - } - catch(Exception e) - { - failed(e, "Unexpected exception occurred"); - } - - // Release the lock on the file - try - { - file1.close(); - } - catch(Exception e) {e.printStackTrace();} - // Disconnect from the other connections - file2.getSystem().disconnectService(AS400.RECORDACCESS); - violator.getSystem().disconnectService(AS400.RECORDACCESS); - } + public void Var008() { + setVariation(8); + StringBuffer failMsg = new StringBuffer(); + SequentialFile file = null; + SequentialFile violator = null; + AS400 violatorAS400 = null; + + try { + file = new SequentialFile(systemObject_, "/QSYS.LIB/DDMTESTSAV.LIB/DDMLOCK.FILE/MBR1.MBR"); + file.lock(AS400File.WRITE_EXCLUSIVE_LOCK); + violatorAS400 = new AS400(systemObject_); + changeWaitTime(violatorAS400); + + violator = new SequentialFile(violatorAS400, file.getPath()); + violator.setRecordFormat(new DDMLockFormat(systemObject_)); + try { + violator.open(AS400File.READ_ONLY, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); + failMsg.append("Exception didn't occur with READ_ONLY."); + } catch (AS400Exception e) { + AS400Message msg = e.getAS400Message(); + if (msg.getID().toUpperCase().indexOf("CPF4128") == -1) { + e.printStackTrace(output_); + failMsg.append("Wrong exception id with READ_ONLY."); + } + } catch (Exception e) { + e.printStackTrace(output_); + failMsg.append("Incorrect exception with READ_ONLY."); + } + try { + violator.open(AS400File.READ_WRITE, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); + failMsg.append("Exception didn't occur with READ_WRITE."); + } catch (AS400Exception e) { + AS400Message msg = e.getAS400Message(); + if (msg.getID().toUpperCase().indexOf("CPF4128") == -1) { + e.printStackTrace(output_); + failMsg.append("Wrong exception id with READ_WRITE."); + } + } catch (Exception e) { + e.printStackTrace(output_); + failMsg.append("Incorrect exception with READ_WRITE."); + } + try { + violator.open(AS400File.WRITE_ONLY, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); + failMsg.append("Exception didn't occur with WRITE_ONLY."); + } catch (AS400Exception e) { + AS400Message msg = e.getAS400Message(); + if (msg.getID().toUpperCase().indexOf("CPF4128") == -1) { + e.printStackTrace(output_); + failMsg.append("Wrong exception id with WRITE_ONLY."); + } + } catch (Exception e) { + e.printStackTrace(output_); + failMsg.append("Incorrect exception with WRITE_ONLY."); + } + } catch (Exception e) { + failed(e, "Unexpected exception."); + } + // Release the lock obtained + try { + file.releaseExplicitLocks(); + file.close(); + } catch (Exception e) { + } + // Disconnect from the system for violator. This is to prevent the subsystem + // from filling + // up with jobs. + violator.getSystem().disconnectService(AS400.RECORDACCESS); + if (failMsg.length() == 0) { + succeeded(); + } else { + failed(failMsg.toString()); + } + } /** - *Verify AS400File.lock(int) with a lock type of READ_ALLOW_SHARED_WRITE_LOCK. - *
    - *
  • Set the lock when the file is closed. - *
- *Expected results: - *
    - *
  • Another connection should be able to open the file for read, read/write or write. - *
  • No exceptions should occur. - *
+ * Verify AS400File.lock(int) with a lock type of WRITE_EXCLUSIVE_LOCK.
    + *
  • Set the lock when the file is open. + *
+ * Expected results:
    + *
  • Another connection should not be able to open the file for read, + * read/write or write. + *
**/ - public void Var006() - { - setVariation(6); - SequentialFile file1 = null; - SequentialFile file2 = null; - try - { - file1 = new SequentialFile(systemObject_, - "/QSYS.LIB/DDMTEST.LIB/DDMLOCK.FILE/MBR1.MBR"); - file1.lock(AS400File.READ_ALLOW_SHARED_WRITE_LOCK); - file2 = new SequentialFile(new AS400(systemObject_), file1.getPath()); - file2.setRecordFormat(new DDMLockFormat(systemObject_)); - file2.open(AS400File.WRITE_ONLY, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); - file2.close(); - file2.open(AS400File.READ_ONLY, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); - file2.close(); - file2.open(AS400File.READ_WRITE, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); - file2.close(); - file1.close(); - succeeded(); - } - catch(Exception e) - { - failed(e, "Unexpected exception."); - } - // Disconnect from the other connection - file2.getSystem().disconnectService(AS400.RECORDACCESS); - } + public void Var009() { + setVariation(9); + StringBuffer failMsg = new StringBuffer(); + SequentialFile file = null; + SequentialFile violator = null; + AS400 violatorAS400 = null; + + try { + file = new SequentialFile(systemObject_, "/QSYS.LIB/DDMTESTSAV.LIB/DDMLOCK.FILE/MBR1.MBR"); + file.setRecordFormat(new DDMLockFormat(systemObject_)); + file.open(AS400File.READ_WRITE, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); + file.lock(AS400File.WRITE_EXCLUSIVE_LOCK); + violatorAS400 = new AS400(systemObject_); + changeWaitTime(violatorAS400); + + violator = new SequentialFile(violatorAS400, file.getPath()); + violator.setRecordFormat(new DDMLockFormat(systemObject_)); + try { + violator.open(AS400File.READ_ONLY, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); + failMsg.append("Exception didn't occur with READ_ONLY."); + } catch (AS400Exception e) { + AS400Message msg = e.getAS400Message(); + if (msg.getID().toUpperCase().indexOf("CPF4128") == -1) { + e.printStackTrace(output_); + failMsg.append("Wrong exception id with READ_ONLY."); + } + } catch (Exception e) { + e.printStackTrace(output_); + failMsg.append("Incorrect exception with READ_ONLY."); + } + try { + violator.open(AS400File.READ_WRITE, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); + failMsg.append("Exception didn't occur with READ_WRITE."); + } catch (AS400Exception e) { + AS400Message msg = e.getAS400Message(); + if (msg.getID().toUpperCase().indexOf("CPF4128") == -1) { + e.printStackTrace(output_); + failMsg.append("Wrong exception id with READ_WRITE."); + } + } catch (Exception e) { + e.printStackTrace(output_); + failMsg.append("Incorrect exception with READ_WRITE."); + } + try { + violator.open(AS400File.WRITE_ONLY, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); + failMsg.append("Exception didn't occur with WRITE_ONLY."); + } catch (AS400Exception e) { + AS400Message msg = e.getAS400Message(); + if (msg.getID().toUpperCase().indexOf("CPF4128") == -1) { + e.printStackTrace(output_); + failMsg.append("Wrong exception id with WRITE_ONLY."); + } + } catch (Exception e) { + e.printStackTrace(output_); + failMsg.append("Incorrect exception with WRITE_ONLY."); + } + } catch (Exception e) { + failed(e, "Unexpected exception."); + } + // Close the file + try { + file.close(); + } catch (Exception e) { + } + // Disconnect from the system for violator. This is to prevent the subsystem + // from filling + // up with jobs. + violator.getSystem().disconnectService(AS400.RECORDACCESS); + if (failMsg.length() == 0) { + succeeded(); + } else { + failed(failMsg.toString()); + } + } /** - *Verify AS400File.lock(int) with a lock type of READ_ALLOW_SHARED_WRITE_LOCK. - *
    - *
  • Set the lock when the file is open. - *
- *Expected results: - *
    - *
  • Another connection should be able to open the file for read, read/write or write. - *
  • No exceptions should occur. - *
+ * Verify AS400File.lock(int) with a lock type of WRITE_ALLOW_SHARED_READ_LOCK. + *
    + *
  • Set the lock when the file is closed. + *
+ * Expected results:
    + *
  • Another connection should be able to open the file for reading. + *
  • Another connection should not be able to open the file for writing. + *
**/ - public void Var007() - { - setVariation(7); - SequentialFile file1 = null; - SequentialFile file2 = null; - try - { - file1 = new SequentialFile(systemObject_, - "/QSYS.LIB/DDMTEST.LIB/DDMLOCK.FILE/MBR1.MBR"); - file1.setRecordFormat(new DDMLockFormat(systemObject_)); - file1.open(AS400File.READ_ONLY, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); - file1.lock(AS400File.READ_ALLOW_SHARED_WRITE_LOCK); - file2 = new SequentialFile(new AS400(systemObject_), file1.getPath()); - file2.setRecordFormat(file1.getRecordFormat()); - file2.open(AS400File.WRITE_ONLY, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); - file2.close(); - file2.open(AS400File.READ_ONLY, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); - file2.close(); - file2.open(AS400File.READ_WRITE, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); - file2.close(); - succeeded(); - } - catch(Exception e) - { - failed(e, "Unexpected exception."); - } - - try - { - file1.close(); - } - catch(Exception e) {e.printStackTrace();} - // Disconnect from the other connection - file2.getSystem().disconnectService(AS400.RECORDACCESS); - } + public void Var010() { + setVariation(10); + SequentialFile file1 = null; + SequentialFile file2 = null; + SequentialFile violator = null; + AS400 violatorAS400 = null; + + try { + file1 = new SequentialFile(systemObject_, "/QSYS.LIB/DDMTESTSAV.LIB/DDMLOCK.FILE/MBR1.MBR"); + file1.lock(AS400File.WRITE_ALLOW_SHARED_READ_LOCK); + file2 = new SequentialFile(new AS400(systemObject_), file1.getPath()); + file2.setRecordFormat(new DDMLockFormat(systemObject_)); + file2.open(AS400File.READ_ONLY, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); + file2.close(); + violatorAS400 = new AS400(systemObject_); + changeWaitTime(violatorAS400); + + violator = new SequentialFile(violatorAS400, file1.getPath()); + violator.setRecordFormat(file2.getRecordFormat()); + try { + violator.open(AS400File.WRITE_ONLY, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); + violator.close(); + failed("Exception didn't occur."); + } catch (AS400Exception e) { + AS400Message msg = e.getAS400Message(); + if (msg.getID().toUpperCase().indexOf("CPF4128") == -1) { + failed(e, "Wrong exception id returned"); + } else { + succeeded(); + } + } catch (Exception e) { + failed(e, "Incorrect exception."); + } + } catch (Exception e) { + failed(e, "Unexpected exception."); + } + + try { + file1.releaseExplicitLocks(); + file1.close(); + } catch (Exception e) { + e.printStackTrace(); + } + // Disconnect from the other connections + file2.getSystem().disconnectService(AS400.RECORDACCESS); + violator.getSystem().disconnectService(AS400.RECORDACCESS); + } /** - *Verify AS400File.lock(int) with a lock type of WRITE_EXCLUSIVE_LOCK. - *
    - *
  • Set the lock when the file is closed. - *
- *Expected results: - *
    - *
  • Another connection should not be able to open the file for read, read/write or write. - *
+ * Verify AS400File.lock(int) with a lock type of WRITE_ALLOW_SHARED_READ_LOCK. + *
    + *
  • Set the lock when the file is open. + *
+ * Expected results:
    + *
  • Another connection should be able to open the file for reading. + *
  • Another connection should not be able to open the file for writing. + *
**/ - public void Var008() - { - setVariation(8); - StringBuffer failMsg = new StringBuffer(); - SequentialFile file = null; - SequentialFile violator = null; - try - { - file = new SequentialFile(systemObject_, - "/QSYS.LIB/DDMTEST.LIB/DDMLOCK.FILE/MBR1.MBR"); - file.lock(AS400File.WRITE_EXCLUSIVE_LOCK); - violator = new SequentialFile(new AS400(systemObject_), file.getPath()); - violator.setRecordFormat(new DDMLockFormat(systemObject_)); - try - { - violator.open(AS400File.READ_ONLY, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); - failMsg.append("Exception didn't occur with READ_ONLY."); - } - catch(AS400Exception e) - { - AS400Message msg = e.getAS400Message(); - if (msg.getID().toUpperCase().indexOf("CPF4128") == -1) - { - e.printStackTrace(output_); - failMsg.append("Wrong exception id with READ_ONLY."); - } - } - catch(Exception e) - { - e.printStackTrace(output_); - failMsg.append("Incorrect exception with READ_ONLY."); - } - try - { - violator.open(AS400File.READ_WRITE, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); - failMsg.append("Exception didn't occur with READ_WRITE."); - } - catch(AS400Exception e) - { - AS400Message msg = e.getAS400Message(); - if (msg.getID().toUpperCase().indexOf("CPF4128") == -1) - { - e.printStackTrace(output_); - failMsg.append("Wrong exception id with READ_WRITE."); - } - } - catch(Exception e) - { - e.printStackTrace(output_); - failMsg.append("Incorrect exception with READ_WRITE."); - } - try - { - violator.open(AS400File.WRITE_ONLY, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); - failMsg.append("Exception didn't occur with WRITE_ONLY."); - } - catch(AS400Exception e) - { - AS400Message msg = e.getAS400Message(); - if (msg.getID().toUpperCase().indexOf("CPF4128") == -1) - { - e.printStackTrace(output_); - failMsg.append("Wrong exception id with WRITE_ONLY."); - } - } - catch(Exception e) - { - e.printStackTrace(output_); - failMsg.append("Incorrect exception with WRITE_ONLY."); - } - } - catch(Exception e) - { - failed(e, "Unexpected exception."); - } - // Release the lock obtained - try - { - file.releaseExplicitLocks(); - file.close(); - } - catch(Exception e) - { - } - // Disconnect from the system for violator. This is to prevent the subsystem from filling - // up with jobs. - violator.getSystem().disconnectService(AS400.RECORDACCESS); - if (failMsg.length() == 0) - { - succeeded(); - } - else - { - failed(failMsg.toString()); - } - } + public void Var011() { + setVariation(11); + SequentialFile file1 = null; + SequentialFile file2 = null; + SequentialFile violator = null; + AS400 violatorAS400 = null; + + try { + file1 = new SequentialFile(systemObject_, "/QSYS.LIB/DDMTESTSAV.LIB/DDMLOCK.FILE/MBR1.MBR"); + file1.setRecordFormat(new DDMLockFormat(systemObject_)); + file1.open(AS400File.READ_WRITE, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); + file1.lock(AS400File.WRITE_ALLOW_SHARED_READ_LOCK); + file2 = new SequentialFile(new AS400(systemObject_), file1.getPath()); + file2.setRecordFormat(new DDMLockFormat(systemObject_)); + file2.open(AS400File.READ_ONLY, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); + file2.close(); + violatorAS400 = new AS400(systemObject_); + changeWaitTime(violatorAS400); + + violator = new SequentialFile(violatorAS400, file1.getPath()); + violator.setRecordFormat(file2.getRecordFormat()); + try { + violator.open(AS400File.WRITE_ONLY, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); + violator.close(); + failed("Exception didn't occur."); + } catch (AS400Exception e) { + AS400Message msg = e.getAS400Message(); + if (msg.getID().toUpperCase().indexOf("CPF4128") == -1) { + failed(e, "Wrong exception id returned"); + } else { + succeeded(); + } + } catch (Exception e) { + failed(e, "Incorrect exception."); + } + } catch (Exception e) { + failed(e, "Unexpected exception."); + } + + try { + file1.close(); + } catch (Exception e) { + e.printStackTrace(); + } + // Disconnect from the other connections + file2.getSystem().disconnectService(AS400.RECORDACCESS); + violator.getSystem().disconnectService(AS400.RECORDACCESS); + } /** - *Verify AS400File.lock(int) with a lock type of WRITE_EXCLUSIVE_LOCK. - *
    - *
  • Set the lock when the file is open. - *
- *Expected results: - *
    - *
  • Another connection should not be able to open the file for read, read/write or write. - *
+ * Verify AS400File.lock(int) with a lock type of WRITE_ALLOW_SHARED_WRITE_LOCK. + *
    + *
  • Set the lock when the file is closed. + *
+ * Expected results:
    + *
  • Another connection should be able to open the file for read, read/write + * or write. + *
  • No exceptions should occur. + *
**/ - public void Var009() - { - setVariation(9); - StringBuffer failMsg = new StringBuffer(); - SequentialFile file = null; - SequentialFile violator = null; - try - { - file = new SequentialFile(systemObject_, - "/QSYS.LIB/DDMTEST.LIB/DDMLOCK.FILE/MBR1.MBR"); - file.setRecordFormat(new DDMLockFormat(systemObject_)); - file.open(AS400File.READ_WRITE, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); - file.lock(AS400File.WRITE_EXCLUSIVE_LOCK); - violator = new SequentialFile(new AS400(systemObject_), file.getPath()); - violator.setRecordFormat(new DDMLockFormat(systemObject_)); - try - { - violator.open(AS400File.READ_ONLY, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); - failMsg.append("Exception didn't occur with READ_ONLY."); - } - catch(AS400Exception e) - { - AS400Message msg = e.getAS400Message(); - if (msg.getID().toUpperCase().indexOf("CPF4128") == -1) - { - e.printStackTrace(output_); - failMsg.append("Wrong exception id with READ_ONLY."); - } - } - catch(Exception e) - { - e.printStackTrace(output_); - failMsg.append("Incorrect exception with READ_ONLY."); - } - try - { - violator.open(AS400File.READ_WRITE, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); - failMsg.append("Exception didn't occur with READ_WRITE."); - } - catch(AS400Exception e) - { - AS400Message msg = e.getAS400Message(); - if (msg.getID().toUpperCase().indexOf("CPF4128") == -1) - { - e.printStackTrace(output_); - failMsg.append("Wrong exception id with READ_WRITE."); - } - } - catch(Exception e) - { - e.printStackTrace(output_); - failMsg.append("Incorrect exception with READ_WRITE."); - } - try - { - violator.open(AS400File.WRITE_ONLY, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); - failMsg.append("Exception didn't occur with WRITE_ONLY."); - } - catch(AS400Exception e) - { - AS400Message msg = e.getAS400Message(); - if (msg.getID().toUpperCase().indexOf("CPF4128") == -1) - { - e.printStackTrace(output_); - failMsg.append("Wrong exception id with WRITE_ONLY."); - } - } - catch(Exception e) - { - e.printStackTrace(output_); - failMsg.append("Incorrect exception with WRITE_ONLY."); - } - } - catch(Exception e) - { - failed(e, "Unexpected exception."); - } - // Close the file - try - { - file.close(); - } - catch(Exception e) - { - } - // Disconnect from the system for violator. This is to prevent the subsystem from filling - // up with jobs. - violator.getSystem().disconnectService(AS400.RECORDACCESS); - if (failMsg.length() == 0) - { - succeeded(); - } - else - { - failed(failMsg.toString()); - } - } + public void Var012() { + setVariation(12); + SequentialFile file1 = null; + SequentialFile file2 = null; + try { + file1 = new SequentialFile(systemObject_, "/QSYS.LIB/DDMTESTSAV.LIB/DDMLOCK.FILE/MBR1.MBR"); + file1.lock(AS400File.WRITE_ALLOW_SHARED_WRITE_LOCK); + file2 = new SequentialFile(new AS400(systemObject_), file1.getPath()); + file2.setRecordFormat(new DDMLockFormat(systemObject_)); + file2.open(AS400File.WRITE_ONLY, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); + file2.close(); + file2.open(AS400File.READ_ONLY, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); + file2.close(); + file2.open(AS400File.READ_WRITE, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); + file2.close(); + file1.close(); + succeeded(); + } catch (Exception e) { + failed(e, "Unexpected exception."); + } + // Disconnect from the other connection + file2.getSystem().disconnectService(AS400.RECORDACCESS); + } /** - *Verify AS400File.lock(int) with a lock type of WRITE_ALLOW_SHARED_READ_LOCK. - *
    - *
  • Set the lock when the file is closed. - *
- *Expected results: - *
    - *
  • Another connection should be able to open the file for reading. - *
  • Another connection should not be able to open the file for writing. - *
+ * Verify AS400File.lock(int) with a lock type of WRITE_ALLOW_SHARED_WRITE_LOCK. + *
    + *
  • Set the lock when the file is open. + *
+ * Expected results:
    + *
  • Another connection should be able to open the file for read, read/write + * or write. + *
  • No exceptions should occur. + *
**/ - public void Var010() - { - setVariation(10); - SequentialFile file1 = null; - SequentialFile file2 = null; - SequentialFile violator = null; - try - { - file1 = new SequentialFile(systemObject_, - "/QSYS.LIB/DDMTEST.LIB/DDMLOCK.FILE/MBR1.MBR"); - file1.lock(AS400File.WRITE_ALLOW_SHARED_READ_LOCK); - file2 = new SequentialFile(new AS400(systemObject_), file1.getPath()); - file2.setRecordFormat(new DDMLockFormat(systemObject_)); - file2.open(AS400File.READ_ONLY, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); - file2.close(); - violator = new SequentialFile(new AS400(systemObject_), file1.getPath()); - violator.setRecordFormat(file2.getRecordFormat()); - try - { - violator.open(AS400File.WRITE_ONLY, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); - violator.close(); - failed("Exception didn't occur."); - } - catch(AS400Exception e) - { - AS400Message msg = e.getAS400Message(); - if (msg.getID().toUpperCase().indexOf("CPF4128") == -1) - { - failed(e, "Wrong exception id returned"); - } - else - { - succeeded(); - } - } - catch(Exception e) - { - failed(e, "Incorrect exception."); - } - } - catch(Exception e) - { - failed(e, "Unexpected exception."); - } - - try - { - file1.releaseExplicitLocks(); - file1.close(); - } - catch(Exception e) {e.printStackTrace();} - // Disconnect from the other connections - file2.getSystem().disconnectService(AS400.RECORDACCESS); - violator.getSystem().disconnectService(AS400.RECORDACCESS); - } + public void Var013() { + setVariation(13); + SequentialFile file1 = null; + SequentialFile file2 = null; + try { + file1 = new SequentialFile(systemObject_, "/QSYS.LIB/DDMTESTSAV.LIB/DDMLOCK.FILE/MBR1.MBR"); + file1.setRecordFormat(new DDMLockFormat(systemObject_)); + file1.open(AS400File.READ_ONLY, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); + file1.lock(AS400File.WRITE_ALLOW_SHARED_WRITE_LOCK); + file2 = new SequentialFile(new AS400(systemObject_), file1.getPath()); + file2.setRecordFormat(file1.getRecordFormat()); + file2.open(AS400File.WRITE_ONLY, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); + file2.close(); + file2.open(AS400File.READ_ONLY, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); + file2.close(); + file2.open(AS400File.READ_WRITE, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); + file2.close(); + succeeded(); + } catch (Exception e) { + failed(e, "Unexpected exception."); + } + + try { + file1.close(); + } catch (Exception e) { + e.printStackTrace(); + } + // Disconnect from the other connection + file2.getSystem().disconnectService(AS400.RECORDACCESS); + } /** - *Verify AS400File.lock(int) with a lock type of WRITE_ALLOW_SHARED_READ_LOCK. - *
    - *
  • Set the lock when the file is open. - *
- *Expected results: - *
    - *
  • Another connection should be able to open the file for reading. - *
  • Another connection should not be able to open the file for writing. - *
+ * Verify AS400File.getExplicitLocks().
    + *
  • With no locks set. + *
  • With one lock set. + *
  • With all locks set. + *
+ * Expected results:
    + *
  • No locks set will return an int[] of size 0. + *
  • One lock set will return an int[] of size one containing the lock that + * was set. + *
  • All locks set will return an int[] of size six containing the locks that + * were set. + *
**/ - public void Var011() - { - setVariation(11); - SequentialFile file1 = null; - SequentialFile file2 = null; - SequentialFile violator = null; - try - { - file1 = new SequentialFile(systemObject_, - "/QSYS.LIB/DDMTEST.LIB/DDMLOCK.FILE/MBR1.MBR"); - file1.setRecordFormat(new DDMLockFormat(systemObject_)); - file1.open(AS400File.READ_WRITE, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); - file1.lock(AS400File.WRITE_ALLOW_SHARED_READ_LOCK); - file2 = new SequentialFile(new AS400(systemObject_), file1.getPath()); - file2.setRecordFormat(new DDMLockFormat(systemObject_)); - file2.open(AS400File.READ_ONLY, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); - file2.close(); - violator = new SequentialFile(new AS400(systemObject_), file1.getPath()); - violator.setRecordFormat(file2.getRecordFormat()); - try - { - violator.open(AS400File.WRITE_ONLY, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); - violator.close(); - failed("Exception didn't occur."); - } - catch(AS400Exception e) - { - AS400Message msg = e.getAS400Message(); - if (msg.getID().toUpperCase().indexOf("CPF4128") == -1) - { - failed(e, "Wrong exception id returned"); - } - else - { - succeeded(); - } - } - catch(Exception e) - { - failed(e, "Incorrect exception."); - } - } - catch(Exception e) - { - failed(e, "Unexpected exception."); - } - - try - { - file1.close(); - } - catch(Exception e) {e.printStackTrace();} - // Disconnect from the other connections - file2.getSystem().disconnectService(AS400.RECORDACCESS); - violator.getSystem().disconnectService(AS400.RECORDACCESS); - } + public void Var014() { + setVariation(14); + SequentialFile file = null; + try { + file = new SequentialFile(systemObject_, "/QSYS.LIB/DDMTESTSAV.LIB/DDMLOCK.FILE/MBR1.MBR"); + if (file.getExplicitLocks().length == 0) { + file.lock(AS400File.READ_EXCLUSIVE_LOCK); + int[] locks = file.getExplicitLocks(); + if (locks.length == 1 && locks[0] == AS400File.READ_EXCLUSIVE_LOCK) { + file.lock(AS400File.READ_ALLOW_SHARED_READ_LOCK); + file.lock(AS400File.READ_ALLOW_SHARED_WRITE_LOCK); + file.lock(AS400File.WRITE_EXCLUSIVE_LOCK); + file.lock(AS400File.WRITE_ALLOW_SHARED_READ_LOCK); + file.lock(AS400File.WRITE_ALLOW_SHARED_WRITE_LOCK); + locks = file.getExplicitLocks(); + Vector v = new Vector(locks.length); + for (int i = 0; i < locks.length; i++) { + v.addElement(Integer.valueOf(locks[i])); + } + assertCondition(locks.length == 6 && v.contains(Integer.valueOf(AS400File.READ_EXCLUSIVE_LOCK)) + && v.contains(Integer.valueOf(AS400File.READ_ALLOW_SHARED_READ_LOCK)) + && v.contains(Integer.valueOf(AS400File.READ_ALLOW_SHARED_WRITE_LOCK)) + && v.contains(Integer.valueOf(AS400File.WRITE_EXCLUSIVE_LOCK)) + && v.contains(Integer.valueOf(AS400File.WRITE_ALLOW_SHARED_READ_LOCK)) + && v.contains(Integer.valueOf(AS400File.WRITE_ALLOW_SHARED_WRITE_LOCK))); + } else { + failed("Incorrect lock information."); + } + } else { + failed("Incorrect lock information."); + } + } catch (Exception e) { + failed(e); + } + } /** - *Verify AS400File.lock(int) with a lock type of WRITE_ALLOW_SHARED_WRITE_LOCK. - *
    - *
  • Set the lock when the file is closed. - *
- *Expected results: - *
    - *
  • Another connection should be able to open the file for read, read/write or write. - *
  • No exceptions should occur. - *
+ * Verify AS400File.releaseExplicitLocks().
    + *
  • When no locks are set and the file is closed. + *
  • When no locks are set and the file is open. + *
+ * Expected results:
    + *
  • No exceptions are thrown. + *
**/ - public void Var012() - { - setVariation(12); - SequentialFile file1 = null; - SequentialFile file2 = null; - try - { - file1 = new SequentialFile(systemObject_, - "/QSYS.LIB/DDMTEST.LIB/DDMLOCK.FILE/MBR1.MBR"); - file1.lock(AS400File.WRITE_ALLOW_SHARED_WRITE_LOCK); - file2 = new SequentialFile(new AS400(systemObject_), file1.getPath()); - file2.setRecordFormat(new DDMLockFormat(systemObject_)); - file2.open(AS400File.WRITE_ONLY, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); - file2.close(); - file2.open(AS400File.READ_ONLY, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); - file2.close(); - file2.open(AS400File.READ_WRITE, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); - file2.close(); - file1.close(); - succeeded(); - } - catch(Exception e) - { - failed(e, "Unexpected exception."); - } - // Disconnect from the other connection - file2.getSystem().disconnectService(AS400.RECORDACCESS); - } - - /** - *Verify AS400File.lock(int) with a lock type of WRITE_ALLOW_SHARED_WRITE_LOCK. - *
    - *
  • Set the lock when the file is open. - *
- *Expected results: - *
    - *
  • Another connection should be able to open the file for read, read/write or write. - *
  • No exceptions should occur. - *
+ public void Var015() { + setVariation(15); + SequentialFile file = null; + try { + file = new SequentialFile(systemObject_, "/QSYS.LIB/DDMTESTSAV.LIB/DDMLOCK.FILE/MBR1.MBR"); + file.setRecordFormat(new DDMLockFormat(systemObject_)); + file.open(AS400File.WRITE_ONLY, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); + file.releaseExplicitLocks(); + file.close(); + file.releaseExplicitLocks(); + succeeded(); + } catch (Exception e) { + failed(e, "Unexpected exception."); + } + } + + /** + * Verify AS400File.releaseExplicitLocks().
    + *
  • With one lock obtained and the file is closed. + *
  • With one lock obtained and the file is open. + *
  • With all locks obtained and the file is closed. + *
  • With all locks obtained and the file is open. **/ - public void Var013() - { - setVariation(13); - SequentialFile file1 = null; - SequentialFile file2 = null; - try - { - file1 = new SequentialFile(systemObject_, - "/QSYS.LIB/DDMTEST.LIB/DDMLOCK.FILE/MBR1.MBR"); - file1.setRecordFormat(new DDMLockFormat(systemObject_)); - file1.open(AS400File.READ_ONLY, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); - file1.lock(AS400File.WRITE_ALLOW_SHARED_WRITE_LOCK); - file2 = new SequentialFile(new AS400(systemObject_), file1.getPath()); - file2.setRecordFormat(file1.getRecordFormat()); - file2.open(AS400File.WRITE_ONLY, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); - file2.close(); - file2.open(AS400File.READ_ONLY, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); - file2.close(); - file2.open(AS400File.READ_WRITE, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); - file2.close(); - succeeded(); - } - catch(Exception e) - { - failed(e, "Unexpected exception."); - } - - try - { - file1.close(); - } - catch(Exception e) {e.printStackTrace();} - // Disconnect from the other connection - file2.getSystem().disconnectService(AS400.RECORDACCESS); - } - - /** - *Verify AS400File.getExplicitLocks(). - *
      - *
    • With no locks set. - *
    • With one lock set. - *
    • With all locks set. - *
    - *Expected results: - *
      - *
    • No locks set will return an int[] of size 0. - *
    • One lock set will return an int[] of size one containing the lock that was set. - *
    • All locks set will return an int[] of size six containing the locks that were set. - *
    - **/ - public void Var014() - { - setVariation(14); - SequentialFile file = null; - try - { - file = new SequentialFile(systemObject_, - "/QSYS.LIB/DDMTEST.LIB/DDMLOCK.FILE/MBR1.MBR"); - if (file.getExplicitLocks().length == 0) - { - file.lock(AS400File.READ_EXCLUSIVE_LOCK); - int[] locks = file.getExplicitLocks(); - if (locks.length == 1 && locks[0] == AS400File.READ_EXCLUSIVE_LOCK) - { - file.lock(AS400File.READ_ALLOW_SHARED_READ_LOCK); - file.lock(AS400File.READ_ALLOW_SHARED_WRITE_LOCK); - file.lock(AS400File.WRITE_EXCLUSIVE_LOCK); - file.lock(AS400File.WRITE_ALLOW_SHARED_READ_LOCK); - file.lock(AS400File.WRITE_ALLOW_SHARED_WRITE_LOCK); - locks = file.getExplicitLocks(); - Vector v = new Vector(locks.length); - for (int i = 0; i < locks.length; i++) - { - v.addElement(Integer.valueOf(locks[i])); - } - assertCondition(locks.length == 6 && - v.contains(Integer.valueOf(AS400File.READ_EXCLUSIVE_LOCK)) && - v.contains(Integer.valueOf(AS400File.READ_ALLOW_SHARED_READ_LOCK)) && - v.contains(Integer.valueOf(AS400File.READ_ALLOW_SHARED_WRITE_LOCK)) && - v.contains(Integer.valueOf(AS400File.WRITE_EXCLUSIVE_LOCK)) && - v.contains(Integer.valueOf(AS400File.WRITE_ALLOW_SHARED_READ_LOCK)) && - v.contains(Integer.valueOf(AS400File.WRITE_ALLOW_SHARED_WRITE_LOCK))); - } - else - { - failed("Incorrect lock information."); - } - } - else - { - failed("Incorrect lock information."); - } - } - catch(Exception e) - { - failed(e); - } - } - - /** - *Verify AS400File.releaseExplicitLocks(). - *
      - *
    • When no locks are set and the file is closed. - *
    • When no locks are set and the file is open. - *
    - *Expected results: - *
      - *
    • No exceptions are thrown. - *
    - **/ - public void Var015() - { - setVariation(15); - SequentialFile file = null; - try - { - file = new SequentialFile(systemObject_, - "/QSYS.LIB/DDMTEST.LIB/DDMLOCK.FILE/MBR1.MBR"); - file.setRecordFormat(new DDMLockFormat(systemObject_)); - file.open(AS400File.WRITE_ONLY, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); - file.releaseExplicitLocks(); - file.close(); - file.releaseExplicitLocks(); - succeeded(); - } - catch(Exception e) - { - failed(e, "Unexpected exception."); - } - } - - /** - *Verify AS400File.releaseExplicitLocks(). - *
      - *
    • With one lock obtained and the file is closed. - *
    • With one lock obtained and the file is open. - *
    • With all locks obtained and the file is closed. - *
    • With all locks obtained and the file is open. - **/ - public void Var016() - { - setVariation(16); - SequentialFile file = null; - try - { - file = new SequentialFile(systemObject_, - "/QSYS.LIB/DDMTEST.LIB/DDMLOCK.FILE/MBR1.MBR"); - file.setRecordFormat(new DDMLockFormat(systemObject_)); - file.lock(AS400File.READ_EXCLUSIVE_LOCK); - file.open(AS400File.WRITE_ONLY, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); - file.releaseExplicitLocks(); - if (file.getExplicitLocks().length == 0) - { - file.close(); - file.lock(AS400File.READ_EXCLUSIVE_LOCK); - file.releaseExplicitLocks(); - if (file.getExplicitLocks().length == 0) - { - file.lock(AS400File.READ_EXCLUSIVE_LOCK); - file.lock(AS400File.READ_ALLOW_SHARED_READ_LOCK); - file.lock(AS400File.READ_ALLOW_SHARED_WRITE_LOCK); - file.lock(AS400File.WRITE_EXCLUSIVE_LOCK); - file.lock(AS400File.WRITE_ALLOW_SHARED_READ_LOCK); - file.lock(AS400File.WRITE_ALLOW_SHARED_WRITE_LOCK); - file.open(AS400File.WRITE_ONLY, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); - file.releaseExplicitLocks(); - if (file.getExplicitLocks().length == 0) - { - file.close(); - file.lock(AS400File.READ_EXCLUSIVE_LOCK); - file.lock(AS400File.READ_ALLOW_SHARED_READ_LOCK); - file.lock(AS400File.READ_ALLOW_SHARED_WRITE_LOCK); - file.lock(AS400File.WRITE_EXCLUSIVE_LOCK); - file.lock(AS400File.WRITE_ALLOW_SHARED_READ_LOCK); - file.lock(AS400File.WRITE_ALLOW_SHARED_WRITE_LOCK); - file.releaseExplicitLocks(); - assertCondition(file.getExplicitLocks().length == 0); - } - else - { - failed("Incorrect lock information."); - } - } - else - { - failed("Incorrect lock information."); - } - } - else - { - failed("Incorrect lock information."); - } - } - catch(Exception e) - { - failed(e, "Unexpected exception."); - } - } + public void Var016() { + setVariation(16); + SequentialFile file = null; + try { + file = new SequentialFile(systemObject_, "/QSYS.LIB/DDMTESTSAV.LIB/DDMLOCK.FILE/MBR1.MBR"); + file.setRecordFormat(new DDMLockFormat(systemObject_)); + file.lock(AS400File.READ_EXCLUSIVE_LOCK); + file.open(AS400File.WRITE_ONLY, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); + file.releaseExplicitLocks(); + if (file.getExplicitLocks().length == 0) { + file.close(); + file.lock(AS400File.READ_EXCLUSIVE_LOCK); + file.releaseExplicitLocks(); + if (file.getExplicitLocks().length == 0) { + file.lock(AS400File.READ_EXCLUSIVE_LOCK); + file.lock(AS400File.READ_ALLOW_SHARED_READ_LOCK); + file.lock(AS400File.READ_ALLOW_SHARED_WRITE_LOCK); + file.lock(AS400File.WRITE_EXCLUSIVE_LOCK); + file.lock(AS400File.WRITE_ALLOW_SHARED_READ_LOCK); + file.lock(AS400File.WRITE_ALLOW_SHARED_WRITE_LOCK); + file.open(AS400File.WRITE_ONLY, 1, AS400File.COMMIT_LOCK_LEVEL_NONE); + file.releaseExplicitLocks(); + if (file.getExplicitLocks().length == 0) { + file.close(); + file.lock(AS400File.READ_EXCLUSIVE_LOCK); + file.lock(AS400File.READ_ALLOW_SHARED_READ_LOCK); + file.lock(AS400File.READ_ALLOW_SHARED_WRITE_LOCK); + file.lock(AS400File.WRITE_EXCLUSIVE_LOCK); + file.lock(AS400File.WRITE_ALLOW_SHARED_READ_LOCK); + file.lock(AS400File.WRITE_ALLOW_SHARED_WRITE_LOCK); + file.releaseExplicitLocks(); + assertCondition(file.getExplicitLocks().length == 0); + } else { + failed("Incorrect lock information."); + } + } else { + failed("Incorrect lock information."); + } + } else { + failed("Incorrect lock information."); + } + } catch (Exception e) { + failed(e, "Unexpected exception."); + } + } /** - *Verify record locks when file opened for read_only with - *commitment control locking of *CS.
      - *Note: This is an attended variation. - *
        - *
      • SequentialFile - *
      - *Expected results: - *
        - *
      • A record lock of *READ will be held on a read record until - *the cursor is moved from that record. - *
      - **/ - public void Var017() - { + * Verify record locks when file opened for read_only with commitment control + * locking of *CS.
      + * Note: This is an attended variation. + *
        + *
      • SequentialFile + *
      + * Expected results: + *
        + *
      • A record lock of *READ will be held on a read record until the cursor is + * moved from that record. + *
      + **/ + public void Var017() { + if (true) { + notApplicable("Testcase needs work"); + } else { setVariation(17); SequentialFile file = null; - try - { + try { file = new SequentialFile(systemObject_, fileName_); - file.setRecordFormat(new DDMLockFormat(systemObject_)); + DDMLockFormat lockFormat = new DDMLockFormat(systemObject_); + lockFormat.setName("FMT1"); + file.setRecordFormat(lockFormat); // Populate the file file.open(AS400File.WRITE_ONLY, 0, AS400File.COMMIT_LOCK_LEVEL_NONE); Record[] recs = new Record[5]; - for (int i = 0; i < 5; ++i) - { + for (int i = 0; i < 5; ++i) { recs[i] = file.getRecordFormat().getNewRecord(); } file.write(recs); @@ -1371,12 +1251,12 @@ public void Var017() file.startCommitmentControl(AS400File.COMMIT_LOCK_LEVEL_CURSOR_STABILITY); file.open(AS400File.READ_ONLY, 0, AS400File.COMMIT_LOCK_LEVEL_CURSOR_STABILITY); file.readFirst(); - output_.println("Does a *READ record lock exist on record number 1 of file DDMLOCK in " + "DDMTest" + "(Y/N)? (DSPRCDLCK)"); + output_.println( + "Does a *READ record lock exist on record number 1 of file DDMLOCK in " + "DDMTest" + "(Y/N)? (DSPRCDLCK)"); InputStreamReader r = new InputStreamReader(System.in); BufferedReader inBuf = new BufferedReader(r); String resp = inBuf.readLine(); - if (!resp.equals("y") && !resp.equals("Y")) - { + if (!resp.equals("y") && !resp.equals("Y")) { failed("Verification of record lock after readFirst failed"); file.commit(); file.close(); @@ -1384,10 +1264,10 @@ public void Var017() return; } file.readNext(); - output_.println("Does a *READ record lock exist on record number 2 of file DDMLOCK in " + "DDMTest" + "(Y/N)? (DSPRCDLCK)"); + output_.println( + "Does a *READ record lock exist on record number 2 of file DDMLOCK in " + "DDMTest" + "(Y/N)? (DSPRCDLCK)"); resp = inBuf.readLine(); - if (!resp.equals("y") && !resp.equals("Y")) - { + if (!resp.equals("y") && !resp.equals("Y")) { failed("Verification of record lock after readFirst failed"); file.commit(); file.close(); @@ -1397,49 +1277,47 @@ public void Var017() file.commit(); file.close(); file.endCommitmentControl(); - } - catch(Exception e) - { + } catch (Exception e) { failed(e, "Unexpected exception"); - try - { + try { file.commit(); file.close(); file.endCommitmentControl(); return; + } catch (Exception e1) { } - catch(Exception e1) - {} } succeeded(); + } } /** - *Verify record locks when file opened for read_only with - *commitment control locking of *ALL.
      - *Note: This is an attended variation. - *
        - *
      • SequentialFile - *
      - *Expected results: - *
        - *
      • A record lock of *READ will be held on a read record until - *the cursor is moved from that record. - *
      - **/ - public void Var018() - { + * Verify record locks when file opened for read_only with commitment control + * locking of *ALL.
      + * Note: This is an attended variation. + *
        + *
      • SequentialFile + *
      + * Expected results: + *
        + *
      • A record lock of *READ will be held on a read record until the cursor is + * moved from that record. + *
      + **/ + public void Var018() { + if (true) { + notApplicable("Testcase needs work"); + } else { + setVariation(18); SequentialFile file = null; - try - { + try { file = new SequentialFile(systemObject_, fileName_); file.setRecordFormat(new DDMLockFormat(systemObject_)); // Populate the file file.open(AS400File.WRITE_ONLY, 0, AS400File.COMMIT_LOCK_LEVEL_NONE); Record[] recs = new Record[5]; - for (int i = 0; i < 5; ++i) - { + for (int i = 0; i < 5; ++i) { recs[i] = file.getRecordFormat().getNewRecord(); } file.write(recs); @@ -1449,12 +1327,12 @@ public void Var018() file.startCommitmentControl(AS400File.COMMIT_LOCK_LEVEL_ALL); file.open(AS400File.READ_ONLY, 0, AS400File.COMMIT_LOCK_LEVEL_ALL); file.readFirst(); - output_.println("Does a *READ record lock exist on record number 1 of file DDMLOCK in " + "DDMTest" + "(Y/N)? (DSPRCDLCK)"); + output_.println( + "Does a *READ record lock exist on record number 1 of file DDMLOCK in " + "DDMTest" + "(Y/N)? (DSPRCDLCK)"); InputStreamReader r = new InputStreamReader(System.in); BufferedReader inBuf = new BufferedReader(r); String resp = inBuf.readLine(); - if (!resp.equals("y") && !resp.equals("Y")) - { + if (!resp.equals("y") && !resp.equals("Y")) { failed("Verification of record lock after readFirst failed"); file.commit(); file.close(); @@ -1462,10 +1340,10 @@ public void Var018() return; } file.readNext(); - output_.println("Does a *READ record lock exist on record number 2 of file DDMLOCK in " + "DDMTest" + "(Y/N)? (DSPRCDLCK)"); + output_.println( + "Does a *READ record lock exist on record number 2 of file DDMLOCK in " + "DDMTest" + "(Y/N)? (DSPRCDLCK)"); resp = inBuf.readLine(); - if (!resp.equals("y") && !resp.equals("Y")) - { + if (!resp.equals("y") && !resp.equals("Y")) { failed("Verification of record lock after readFirst failed"); file.commit(); file.close(); @@ -1475,49 +1353,46 @@ public void Var018() file.commit(); file.close(); file.endCommitmentControl(); - } - catch(Exception e) - { + } catch (Exception e) { failed(e, "Unexpected exception"); - try - { + try { file.commit(); file.close(); file.endCommitmentControl(); return; + } catch (Exception e1) { } - catch(Exception e1) - {} } succeeded(); + } } /** - *Verify record locks when file opened for read_only with - *commitment control locking of *CS.
      - *Note: This is an attended variation. - *
        - *
      • KeyedFile - *
      - *Expected results: - *
        - *
      • A record lock of *READ will be held on a read record until - *the cursor is moved from that record. - *
      - **/ - public void Var019() - { + * Verify record locks when file opened for read_only with commitment control + * locking of *CS.
      + * Note: This is an attended variation. + *
        + *
      • KeyedFile + *
      + * Expected results: + *
        + *
      • A record lock of *READ will be held on a read record until the cursor is + * moved from that record. + *
      + **/ + public void Var019() { + if (true) { + notApplicable("Testcase needs work"); + } else { setVariation(19); KeyedFile file = null; - try - { + try { file = new KeyedFile(systemObject_, fileName_); file.setRecordFormat(new DDMLockFormat(systemObject_)); // Populate the file file.open(AS400File.WRITE_ONLY, 0, AS400File.COMMIT_LOCK_LEVEL_NONE); Record[] recs = new Record[5]; - for (int i = 0; i < 5; ++i) - { + for (int i = 0; i < 5; ++i) { recs[i] = file.getRecordFormat().getNewRecord(); } file.write(recs); @@ -1527,12 +1402,12 @@ public void Var019() file.startCommitmentControl(AS400File.COMMIT_LOCK_LEVEL_CURSOR_STABILITY); file.open(AS400File.READ_ONLY, 0, AS400File.COMMIT_LOCK_LEVEL_CURSOR_STABILITY); file.readFirst(); - output_.println("Does a *READ record lock exist on record number 1 of file DDMLOCK in " + "DDMTest" + "(Y/N)? (DSPRCDLCK)"); + output_.println( + "Does a *READ record lock exist on record number 1 of file DDMLOCK in " + "DDMTest" + "(Y/N)? (DSPRCDLCK)"); InputStreamReader r = new InputStreamReader(System.in); BufferedReader inBuf = new BufferedReader(r); String resp = inBuf.readLine(); - if (!resp.equals("y") && !resp.equals("Y")) - { + if (!resp.equals("y") && !resp.equals("Y")) { failed("Verification of record lock after readFirst failed"); file.commit(); file.close(); @@ -1540,10 +1415,10 @@ public void Var019() return; } file.readNext(); - output_.println("Does a *READ record lock exist on record number 2 of file DDMLOCK in " + "DDMTest" + "(Y/N)? (DSPRCDLCK)"); + output_.println( + "Does a *READ record lock exist on record number 2 of file DDMLOCK in " + "DDMTest" + "(Y/N)? (DSPRCDLCK)"); resp = inBuf.readLine(); - if (!resp.equals("y") && !resp.equals("Y")) - { + if (!resp.equals("y") && !resp.equals("Y")) { failed("Verification of record lock after readFirst failed"); file.commit(); file.close(); @@ -1553,49 +1428,48 @@ public void Var019() file.commit(); file.close(); file.endCommitmentControl(); - } - catch(Exception e) - { + } catch (Exception e) { failed(e, "Unexpected exception"); - try - { + try { file.commit(); file.close(); file.endCommitmentControl(); return; + } catch (Exception e1) { } - catch(Exception e1) - {} } succeeded(); + } } /** - *Verify record locks when file opened for read_only with - *commitment control locking of *ALL.
      - *Note: This is an attended variation. - *
        - *
      • KeyedFile - *
      - *Expected results: - *
        - *
      • A record lock of *READ will be held on a read record until - *the cursor is moved from that record. - *
      - **/ - public void Var020() - { + * Verify record locks when file opened for read_only with commitment control + * locking of *ALL.
      + * Note: This is an attended variation. + *
        + *
      • KeyedFile + *
      + * Expected results: + *
        + *
      • A record lock of *READ will be held on a read record until the cursor is + * moved from that record. + *
      + **/ + public void Var020() { + if (true) { + notApplicable("Testcase needs work"); + } else { + + setVariation(20); KeyedFile file = null; - try - { + try { file = new KeyedFile(systemObject_, fileName_); file.setRecordFormat(new DDMLockFormat(systemObject_)); // Populate the file file.open(AS400File.WRITE_ONLY, 0, AS400File.COMMIT_LOCK_LEVEL_NONE); Record[] recs = new Record[5]; - for (int i = 0; i < 5; ++i) - { + for (int i = 0; i < 5; ++i) { recs[i] = file.getRecordFormat().getNewRecord(); } file.write(recs); @@ -1605,12 +1479,12 @@ public void Var020() file.startCommitmentControl(AS400File.COMMIT_LOCK_LEVEL_ALL); file.open(AS400File.READ_ONLY, 0, AS400File.COMMIT_LOCK_LEVEL_ALL); file.readFirst(); - output_.println("Does a *READ record lock exist on record number 1 of file DDMLOCK in " + "DDMTest" + "(Y/N)? (DSPRCDLCK)"); + output_.println( + "Does a *READ record lock exist on record number 1 of file DDMLOCK in " + "DDMTest" + "(Y/N)? (DSPRCDLCK)"); InputStreamReader r = new InputStreamReader(System.in); BufferedReader inBuf = new BufferedReader(r); String resp = inBuf.readLine(); - if (!resp.equals("y") && !resp.equals("Y")) - { + if (!resp.equals("y") && !resp.equals("Y")) { failed("Verification of record lock after readFirst failed"); file.commit(); file.close(); @@ -1618,10 +1492,10 @@ public void Var020() return; } file.readNext(); - output_.println("Does a *READ record lock exist on record number 2 of file DDMLOCK in " + "DDMTest" + "(Y/N)? (DSPRCDLCK)"); + output_.println( + "Does a *READ record lock exist on record number 2 of file DDMLOCK in " + "DDMTest" + "(Y/N)? (DSPRCDLCK)"); resp = inBuf.readLine(); - if (!resp.equals("y") && !resp.equals("Y")) - { + if (!resp.equals("y") && !resp.equals("Y")) { failed("Verification of record lock after readFirst failed"); file.commit(); file.close(); @@ -1631,22 +1505,17 @@ public void Var020() file.commit(); file.close(); file.endCommitmentControl(); - } - catch(Exception e) - { + } catch (Exception e) { failed(e, "Unexpected exception"); - try - { + try { file.commit(); file.close(); file.endCommitmentControl(); return; + } catch (Exception e1) { } - catch(Exception e1) - {} } succeeded(); + } } } - - diff --git a/src/test/EVTest.java b/src/test/EVTest.java index a8c07cd7..fc638f69 100644 --- a/src/test/EVTest.java +++ b/src/test/EVTest.java @@ -101,6 +101,7 @@ public void createTestcases() @return The deserialized object. @exception Exception If an exception occurs. **/ + @SuppressWarnings("resource") public static Object serialize(EnvironmentVariable object, char[] encryptedPassword) throws Exception { // Serialize. @@ -139,6 +140,7 @@ public static Object serialize(EnvironmentVariable object, char[] encryptedPassw @return The deserialized object. @exception Exception If an exception occurs. **/ + @SuppressWarnings("resource") public static Object serialize(EnvironmentVariableList object, char[] encryptedPassword) throws Exception { // Serialize. diff --git a/src/test/FTPTest.java b/src/test/FTPTest.java index 3821528f..70774d25 100644 --- a/src/test/FTPTest.java +++ b/src/test/FTPTest.java @@ -124,7 +124,7 @@ public FTPTest(String[] args) **/ public void createTestcases() { - AS400 PwrSys_ = null; + // Instantiate all testcases to be run. // boolean allTestcases = (namesAndVars_.size() == 0); @@ -141,6 +141,7 @@ public void createTestcases() char[] decryptedPassword = PasswordVault.decryptPassword(pwrSysEncryptedPassword_); PwrSys_ = new AS400( systemObject_.getSystemName(), pwrSysUserID_, decryptedPassword); PasswordVault.clearPassword(decryptedPassword); + } diff --git a/src/test/GetMethodCount.java b/src/test/GetMethodCount.java index 31559e50..02de6d02 100644 --- a/src/test/GetMethodCount.java +++ b/src/test/GetMethodCount.java @@ -10,75 +10,65 @@ // others. All rights reserved. // /////////////////////////////////////////////////////////////////////////////// -package test; - +package test; import java.io.*; + /** * **/ -public class GetMethodCount -{ +public class GetMethodCount { - public static void main(String[] args) - { + public static void main(String[] args) { BufferedReader in = null; BufferedWriter out = null; - try - { + try { /////////////////////////////////////////////////////////////////// - // Help and error checking + // Help and error checking /////////////////////////////////////////////////////////////////// - if (args.length == 1 && args[0].equals("-h")) - { + if (args.length == 1 && args[0].equals("-h")) { System.out.println("Usage: java GetMethodCount "); System.out.println(" where is the file containing the results of the coverage tool."); System.out.println(""); } // Error checking File input = new File(args[0]); - if (!input.exists()) - { + if (!input.exists()) { System.out.println("Error: File " + args[0] + " does not exist."); return; } /////////////////////////////////////////////////////////////////// - // Extract the not tested classes and methods + // Extract the not tested classes and methods /////////////////////////////////////////////////////////////////// in = new BufferedReader(new FileReader(args[0])); out = new BufferedWriter(new FileWriter("NotCovered.html")); // Get to the beginning of the method information String line = null; - for (line = in.readLine(); line.indexOf(" Method") == -1; line = in.readLine()) - { + for (line = in.readLine(); line.indexOf(" Method") == -1; line = in.readLine()) { } int methodCount = 0; - while (line != null) - { - for (line = in.readLine(); line != null && !line.equals(""); methodCount++, line = in.readLine()) - { + while (line != null) { + for (line = in.readLine(); line != null && !line.equals(""); methodCount++, line = in.readLine()) { System.out.println(line); } // Get to beginning of next method info - for (line = in.readLine(); line != null && line.indexOf(" Method") == -1; line = in.readLine()) - { + for (line = in.readLine(); line != null && line.indexOf(" Method") == -1; line = in.readLine()) { } } System.out.println("Number of methods: " + String.valueOf(methodCount)); - } - catch(Exception e) - { + + } catch (Exception e) { System.out.println("Exception occurred:"); e.printStackTrace(); } - try - { + try { in.close(); - out.close(); + } catch (Exception e) { } - catch(Exception e) - { + try { + out.close(); + } catch (Exception e) { } } } diff --git a/src/test/GetNotTested.java b/src/test/GetNotTested.java index afefa10c..ce5c43ad 100644 --- a/src/test/GetNotTested.java +++ b/src/test/GetNotTested.java @@ -10,94 +10,82 @@ // others. All rights reserved. // /////////////////////////////////////////////////////////////////////////////// -package test; +package test; + import java.io.*; import java.util.*; + /** * **/ -public class GetNotTested -{ - public static String replaceLessThan(String line) - { +public class GetNotTested { + public static String replaceLessThan(String line) { int index = line.indexOf("<"); boolean firstTime = true; StringBuffer buf = null; String newLine = line; - while (index != -1) - { + while (index != -1) { // Replace the less than sign with "<" - if (firstTime) - { + if (firstTime) { buf = new StringBuffer(newLine.substring(0, index)); firstTime = false; } buf.append("<"); - buf.append(newLine.substring(index+1, newLine.length())); - newLine = newLine.substring(index+1, newLine.length()); + buf.append(newLine.substring(index + 1, newLine.length())); + newLine = newLine.substring(index + 1, newLine.length()); index = newLine.indexOf("<"); } - return (buf == null)? line : buf.toString(); + return (buf == null) ? line : buf.toString(); } - public static void main(String[] args) - { + public static void main(String[] args) { BufferedReader in = null; BufferedWriter out = null; - try - { + try { /////////////////////////////////////////////////////////////////// - // Help and error checking + // Help and error checking /////////////////////////////////////////////////////////////////// - if (args.length == 1 && args[0].equals("-h")) - { + if (args.length == 1 && args[0].equals("-h")) { System.out.println("Usage: java GetNotTested "); System.out.println(" where is the file containing the results of the coverage tool."); System.out.println(""); - System.out.println(" NOTE: Output will be written to file NotCovered.html and if the file exists, it will be overwritten."); + System.out.println( + " NOTE: Output will be written to file NotCovered.html and if the file exists, it will be overwritten."); return; } - if (args.length != 1) - { + if (args.length != 1) { System.out.println("Usage: java GetNotTested "); System.out.println(" where is the file containing the results of the coverage tool."); System.out.println(""); - System.out.println(" NOTE: Output will be written to file NotCovered.html and if the file exists, it will be overwritten."); + System.out.println( + " NOTE: Output will be written to file NotCovered.html and if the file exists, it will be overwritten."); return; } // Error checking File input = new File(args[0]); - if (!input.exists()) - { + if (!input.exists()) { System.out.println("Error: File " + args[0] + " does not exist."); return; } /////////////////////////////////////////////////////////////////// - // Extract the not tested classes and methods + // Extract the not tested classes and methods /////////////////////////////////////////////////////////////////// in = new BufferedReader(new FileReader(args[0])); out = new BufferedWriter(new FileWriter("NotCovered.html")); // Get to the beginning of the class information String line = null; - for (line = in.readLine(); line.indexOf("Class") == -1; line = in.readLine()) - { + for (line = in.readLine(); line.indexOf("Class") == -1; line = in.readLine()) { } Vector> classes = new Vector>(); Vector aClass; - while (line != null) - { + while (line != null) { aClass = new Vector(); aClass.addElement(line); - for (line = in.readLine(); line != null && line.indexOf("Class") != 0; line = in.readLine()) - { - if (line.endsWith(" 0") || line.endsWith("\t0")) - { - if (line.indexOf("getCopyright") != -1 || line.indexOf("Copyright") != -1) - { - } - else - { + for (line = in.readLine(); line != null && line.indexOf("Class") != 0; line = in.readLine()) { + if (line.endsWith(" 0") || line.endsWith("\t0")) { + if (line.indexOf("getCopyright") != -1 || line.indexOf("Copyright") != -1) { + } else { // Cleanup the line line = line.substring(0, line.length() - 1); line = line.trim(); @@ -106,8 +94,7 @@ public static void main(String[] args) } } } - if (aClass.size() > 1) - { + if (aClass.size() > 1) { classes.addElement(aClass); } } @@ -119,12 +106,9 @@ public static void main(String[] args) classes.copyInto(sorted); int length = sorted.length; Vector temp; - for (int j = 0; j < length; ++j) - { - for (int k = j + 1; k < length; ++k) - { - if (((String)sorted[k].elementAt(0)).compareTo(((String)sorted[j].elementAt(0))) < 0) - { + for (int j = 0; j < length; ++j) { + for (int k = j + 1; k < length; ++k) { + if (((String) sorted[k].elementAt(0)).compareTo(((String) sorted[j].elementAt(0))) < 0) { temp = sorted[j]; sorted[j] = sorted[k]; sorted[k] = temp; @@ -135,8 +119,7 @@ public static void main(String[] args) /////////////////////////////////////////////////////////////////// // Write the results to the output file /////////////////////////////////////////////////////////////////// - if (sorted.length != 0) - { // Write out html lines for heading and order list + if (sorted.length != 0) { // Write out html lines for heading and order list out.write("

      Classes and methods not yet covered

      "); out.newLine(); out.write("
        "); @@ -144,18 +127,15 @@ public static void main(String[] args) } int z; - for (int l = 0; l < sorted.length; ++l) - { + for (int l = 0; l < sorted.length; ++l) { z = 0; - for (Enumeration e = sorted[l].elements(); e.hasMoreElements();) - { - if (z == 1) - { + for (Enumeration e = sorted[l].elements(); e.hasMoreElements();) { + if (z == 1) { out.write("
          "); out.newLine(); } out.write("
        • "); - line = (z == 0)? ((String)e.nextElement()).substring(7) : (String)e.nextElement(); + line = (z == 0) ? ((String) e.nextElement()).substring(7) : (String) e.nextElement(); out.write(line, 0, line.length()); out.newLine(); ++z; @@ -167,19 +147,17 @@ public static void main(String[] args) out.write("
      "); out.newLine(); out.flush(); - } - catch(Exception e) - { + } catch (Exception e) { System.out.println("Exception occurred:"); e.printStackTrace(); } - try - { + try { in.close(); - out.close(); + } catch (Exception e) { } - catch(Exception e) - { + try { + out.close(); + } catch (Exception e) { } } } diff --git a/src/test/HLTest.java b/src/test/HLTest.java index 9f9f230d..beee3790 100644 --- a/src/test/HLTest.java +++ b/src/test/HLTest.java @@ -16,13 +16,13 @@ import test.MiscAH.HLTestcase; /** - Test driver for the HistoryLog object and associated classes. Refer to TestDriver for calling syntax. + * Test driver for the HistoryLog object and associated classes. Refer to + * TestDriver for calling syntax. **/ -public class HLTest extends TestDriver -{ - /** - Main for running standalone application tests. - **/ +public class HLTest extends TestDriver { + /** + * Main for running standalone application tests. + **/ public static void main(String args[]) { try diff --git a/src/test/JCIFSUtility.java b/src/test/JCIFSUtility.java index 365563cb..10d6fd8e 100644 --- a/src/test/JCIFSUtility.java +++ b/src/test/JCIFSUtility.java @@ -2,7 +2,7 @@ // // JTOpen (IBM Toolbox for Java - OSS version) // -// Filename: JDTestDriverSecurityManager.java +// Filename: JCIFSUtility.java // // The source code contained herein is licensed under the IBM Public License // Version 1.0, which has been approved by the Open Source Initiative. @@ -58,8 +58,8 @@ public class JCIFSUtility { public static boolean debug = false; public static boolean useJdbc = true; -private static Connection jdbcConnection_; -private static Blob blob; + private static Connection jdbcConnection_; + private static Blob blob; static { String debugString = System.getProperty("debug"); if (debugString != null) { @@ -72,17 +72,16 @@ public class JCIFSUtility { } // Turn on extended security. - jcifs.Config.setProperty("jcifs.util.loglevel","3"); + jcifs.Config.setProperty("jcifs.util.loglevel", "3"); jcifs.Config.setProperty("jcifs.smb.client.useExtendedSecurity", "false"); - jcifs.Config.setProperty("jcifs.smb.lmCompatibility", "0"); - - + jcifs.Config.setProperty("jcifs.smb.lmCompatibility", "0"); + } public static String fullyQualifySystem(String system) throws Exception { if (system.indexOf(".") < 0) { if (!"LOCALHOST".equals(system.toUpperCase())) { - system = system + "."+JTOpenTestEnvironment.getDefaultServerDomain(); + system = system + "." + JTOpenTestEnvironment.getDefaultServerDomain(); } else { system = "localhost"; } @@ -90,79 +89,79 @@ public static String fullyQualifySystem(String system) throws Exception { return system; } - public static void createFile(String system, String userId, char[] encryptedPassword, - String filename) throws Exception { + public static void createFile(String system, String userId, char[] encryptedPassword, String filename) + throws Exception { createFile(system, userId, encryptedPassword, filename, ""); } - public static void createFile(String system, String userId, char[] encryptedPassword, - String filename, String data) throws Exception { + public static void createFile(String system, String userId, char[] encryptedPassword, String filename, String data) + throws Exception { createFile(system, userId, encryptedPassword, filename, data.getBytes()); } @SuppressWarnings("resource") - public static void createFile(String system, String userId, char[] encryptedPassword, - String filename, byte[] data) throws Exception { - - if (useJdbc) { - if (jdbcConnection_ == null) { - setupJdbcConnection(system, userId, encryptedPassword); - } - PreparedStatement ps = jdbcConnection_.prepareStatement("CALL IFS_WRITE_BINARY(?,?,819,'REPLACE')"); - ps.setString(1, filename); - ps.setBytes(2, data); - ps.execute(); - ps.close(); - } else { - SmbFileOutputStream outputStream = null; + public static void createFile(String system, String userId, char[] encryptedPassword, String filename, byte[] data) + throws Exception { - String url; - system = fullyQualifySystem(system); - url = getUrl(system, userId, encryptedPassword, filename); + if (useJdbc) { + if (jdbcConnection_ == null) { + setupJdbcConnection(system, userId, encryptedPassword); + } + PreparedStatement ps = jdbcConnection_.prepareStatement("CALL IFS_WRITE_BINARY(?,?,819,'REPLACE')"); + ps.setString(1, filename); + ps.setBytes(2, data); + ps.execute(); + ps.close(); + } else { + SmbFileOutputStream outputStream = null; - if (debug) - System.out.println("JCIFSUtility.debug: createFile url=" + url); + String url; + system = fullyQualifySystem(system); + url = getUrl(system, userId, encryptedPassword, filename); - try { - int retryCount = 20; - while (retryCount > 0) { - try { - outputStream = new SmbFileOutputStream(url); - retryCount = 0; - } catch (jcifs.smb.SmbAuthException a) { - String message = a.getMessage(); - if (message.indexOf("Access is denied") >= 0) { - // Loop and try again. JCIFS is kind of quirky - try { - System.out.println("Warning: Access denied to " + url); - Thread.sleep(333); - } catch (Exception e) { + if (debug) + System.out.println("JCIFSUtility.debug: createFile url=" + url); - } - retryCount--; - if (retryCount == 0) { - outputStream.close(); + try { + int retryCount = 20; + while (retryCount > 0) { + try { + outputStream = new SmbFileOutputStream(url); + retryCount = 0; + } catch (jcifs.smb.SmbAuthException a) { + String message = a.getMessage(); + if (message.indexOf("Access is denied") >= 0) { + // Loop and try again. JCIFS is kind of quirky + try { + System.out.println("Warning: Access denied to " + url); + Thread.sleep(333); + } catch (Exception e) { + + } + retryCount--; + if (retryCount == 0) { + outputStream.close(); + throw a; + } + } else { + outputStream.close(); throw a; } - } else { - outputStream.close(); - throw a; - } + } } - } - outputStream.write(data); - outputStream.flush(); - outputStream.close(); - } catch (Exception e) { - String message = e.toString(); - if (message.indexOf("") >= 0) { - System.out.println("JDCFISUtility exception URL=" + url); + outputStream.write(data); + outputStream.flush(); + outputStream.close(); + } catch (Exception e) { + String message = e.toString(); + if (message.indexOf("") >= 0) { + System.out.println("JDCFISUtility exception URL=" + url); + } + throw e; } - throw e; } - } } private static void setupJdbcConnection(String system, String userId, char[] encryptedPassword) throws SQLException { @@ -174,8 +173,8 @@ private static void setupJdbcConnection(String system, String userId, char[] enc } -public static void deleteFile(String system, String userId, char[] encryptedPassword, - String filename) throws Exception { + public static void deleteFile(String system, String userId, char[] encryptedPassword, String filename) + throws Exception { SmbFile smbFile = null; system = fullyQualifySystem(system); @@ -190,8 +189,8 @@ public static void deleteFile(String system, String userId, char[] encryptedPass } - public static void createDirectory(String system, String userId, - char[] encryptedPassword, String directoryname) throws Exception { + public static void createDirectory(String system, String userId, char[] encryptedPassword, String directoryname) + throws Exception { SmbFile smbFile = null; system = fullyQualifySystem(system); @@ -240,8 +239,8 @@ public static void createDirectory(String system, String userId, } - public static String[] listDirectory(String system, String userId, - char[] encryptedPassword, String directoryname) throws Exception { + public static String[] listDirectory(String system, String userId, char[] encryptedPassword, String directoryname) + throws Exception { SmbFile smbFile = null; system = fullyQualifySystem(system); @@ -343,69 +342,67 @@ public static void recursiveDelete(SmbFile smbFile) throws Exception { smbFile.delete(); } - public static boolean deleteDirectory(String system, String userId, - char[] encryptedPassword, String filename) throws Exception { - - if (useJdbc) { - if (jdbcConnection_ == null) { - setupJdbcConnection(system, userId, encryptedPassword); - } - - Statement s = jdbcConnection_.createStatement(); - s.executeUpdate("CALL QSYS2.QCMDEXC('QSH CMD(''rm -fr "+filename+"'')')"); - s.close(); - return true; - } else { - SmbFile smbFile = null; - - system = fullyQualifySystem(system); - String url = getUrl(system, userId, encryptedPassword, filename); - - if (debug) - System.out.println("JCIFSUtility.debug: deleteFile url=" + url); - smbFile = new SmbFile(url); - if (smbFile.exists()) { - if (smbFile.isDirectory()) { - recursiveDelete(smbFile); - } - } - smbFile = new SmbFile(url); - if (smbFile.exists()) { - System.out.println("Delete of " + url + " failed"); - return false; - } - return true; - } + public static boolean deleteDirectory(String system, String userId, char[] encryptedPassword, String filename) + throws Exception { + + if (useJdbc) { + if (jdbcConnection_ == null) { + setupJdbcConnection(system, userId, encryptedPassword); + } + + Statement s = jdbcConnection_.createStatement(); + s.executeUpdate("CALL QSYS2.QCMDEXC('QSH CMD(''rm -fr " + filename + "'')')"); + s.close(); + return true; + } else { + SmbFile smbFile = null; + + system = fullyQualifySystem(system); + String url = getUrl(system, userId, encryptedPassword, filename); + + if (debug) + System.out.println("JCIFSUtility.debug: deleteFile url=" + url); + smbFile = new SmbFile(url); + if (smbFile.exists()) { + if (smbFile.isDirectory()) { + recursiveDelete(smbFile); + } + } + smbFile = new SmbFile(url); + if (smbFile.exists()) { + System.out.println("Delete of " + url + " failed"); + return false; + } + return true; + } } - public static DataInput openDataInput(String system, String userId, - char[] encryptedPassword, String filename, String mode) - throws Exception { + public static DataInput openDataInput(String system, String userId, char[] encryptedPassword, String filename, + String mode) throws Exception { system = fullyQualifySystem(system); if (system.equals("localhost")) { return new RandomAccessFile(filename, mode); } else { - if (useJdbc) { - - InputStream inputStream = getFileInputStream(system, userId, encryptedPassword, filename); - return new DataInputStream(inputStream); - } else { - String url = getUrl(system, userId, encryptedPassword, filename); - SmbFile smbFile = new SmbFile(url); - - if (debug) - System.out.println("JCIFSUtility.debug: openDataInput url=" + url); - return new SmbRandomAccessFile(smbFile, mode); - } + if (useJdbc) { + + InputStream inputStream = getFileInputStream(system, userId, encryptedPassword, filename); + return new DataInputStream(inputStream); + } else { + String url = getUrl(system, userId, encryptedPassword, filename); + SmbFile smbFile = new SmbFile(url); + + if (debug) + System.out.println("JCIFSUtility.debug: openDataInput url=" + url); + return new SmbRandomAccessFile(smbFile, mode); + } } } - public static DataOutput openDataOutput(String system, String userId, - char[] encryptedPassword, String filename, String mode) - throws Exception { - + public static DataOutput openDataOutput(String system, String userId, char[] encryptedPassword, String filename, + String mode) throws Exception { + system = fullyQualifySystem(system); String url = getUrl(system, userId, encryptedPassword, filename); SmbFile smbFile = new SmbFile(url); @@ -441,16 +438,14 @@ public JCIFSUtility(String system, String userId, char[] encryptedPassword) { System.out.println("JCIFSUtility attempting to map root directory"); char[] charPassword = PasswordVault.decryptPassword(encryptedPassword); AS400 as400 = new AS400(system, userId, charPassword); - PasswordVault.clearPassword(charPassword); - - ISeriesNetServer netServer = new ISeriesNetServer(as400); - netServer.createFileShare("root", "/", "ROOT", - ISeriesNetServerFileShare.READ_WRITE); + PasswordVault.clearPassword(charPassword); + ISeriesNetServer netServer = new ISeriesNetServer(as400); + netServer.createFileShare("root", "/", "ROOT", ISeriesNetServerFileShare.READ_WRITE); + as400.close(); // Try again to attach outputStream = new SmbFileOutputStream(url); - } else if (message - .indexOf("NTLMv2 requires extended security") >= 0) { + } else if (message.indexOf("NTLMv2 requires extended security") >= 0) { if (retryCount > 0) { retry = true; } else { @@ -461,8 +456,7 @@ public JCIFSUtility(String system, String userId, char[] encryptedPassword) { } } } - String info = "Connected from " + InetAddress.getLocalHost().getHostName() - + "at " + new Date(); + String info = "Connected from " + InetAddress.getLocalHost().getHostName() + "at " + new Date(); outputStream.write(info.getBytes()); outputStream.flush(); outputStream.write(0x41); @@ -510,25 +504,22 @@ public void close() { public static void main(String args[]) { try { if (args.length < 3) { - System.out.println( - "Usage: java test.JCIFSUtility "); + System.out.println("Usage: java test.JCIFSUtility "); return; } String system = args[0]; String userId = args[1]; String password = args[2]; System.out.println("Creating new utility"); - char[] encryptedPassword = PasswordVault.getEncryptedPassword(password); + char[] encryptedPassword = PasswordVault.getEncryptedPassword(password); JCIFSUtility util = new JCIFSUtility(args[0], args[1], encryptedPassword); System.out.println("Utility created"); System.out.println("Waiting for input"); - BufferedReader reader = new BufferedReader( - new InputStreamReader(System.in)); + BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); String line = reader.readLine(); - while (line != null && (!(line.equalsIgnoreCase("quit"))) - && (!(line.equalsIgnoreCase("exit")))) { + while (line != null && (!(line.equalsIgnoreCase("quit"))) && (!(line.equalsIgnoreCase("exit")))) { try { System.out.println("Executing " + line); line = line.trim(); @@ -549,8 +540,7 @@ public static void main(String args[]) { } else if (command.equalsIgnoreCase("quit")) { } else if (command.equalsIgnoreCase("exit")) { } else { - System.out.println( - "Did not understand command: Valid commands are the following "); + System.out.println("Did not understand command: Valid commands are the following "); System.out.println("createFile FILENAME"); System.out.println("createDirectory DIRECTORYNAME"); System.out.println("deleteDirectory DIRECTORYNAME"); @@ -572,57 +562,62 @@ public static void main(String args[]) { } } - public static InputStream getFileInputStream(String system, String userId, - char[] encryptedPassword, String ifsPathName) throws SmbException, - MalformedURLException, UnknownHostException, FileNotFoundException, SQLException { + public static InputStream getFileInputStream(String system, String userId, char[] encryptedPassword, + String ifsPathName) + throws SmbException, MalformedURLException, UnknownHostException, FileNotFoundException, SQLException { InputStream fis = null; - if (system == "localhost") { - // System.out.println("Using local input stream"); - fis = new FileInputStream(ifsPathName); - } else { - if (useJdbc) { - if (jdbcConnection_ == null) { - setupJdbcConnection(system, userId, encryptedPassword); - } - String sql = "SELECT LINE FROM TABLE(QSYS2.IFS_READ_BINARY(?))"; - PreparedStatement ps = jdbcConnection_.prepareStatement(sql); - ps.setString(1, ifsPathName); - ; - ResultSet rs = ps.executeQuery(); - if (rs.next()) { - blob = rs.getBlob(1); - - } else { - SQLWarning rsWarning = rs.getWarnings(); - if (rsWarning != null) { throw rsWarning; }; - SQLWarning psWarning = ps.getWarnings(); - if (psWarning != null) { throw psWarning; }; - - // File is empty - blob = jdbcConnection_.createBlob(); - } - fis = blob.getBinaryStream(); - } else { - String url = getUrl(system, userId, encryptedPassword, ifsPathName); + if (system == "localhost") { + // System.out.println("Using local input stream"); + fis = new FileInputStream(ifsPathName); + } else { + if (useJdbc) { + if (jdbcConnection_ == null) { + setupJdbcConnection(system, userId, encryptedPassword); + } + String sql = "SELECT LINE FROM TABLE(QSYS2.IFS_READ_BINARY(?))"; + try (PreparedStatement ps = jdbcConnection_.prepareStatement(sql)) { + ps.setString(1, ifsPathName); + ; + try (ResultSet rs = ps.executeQuery()) { + if (rs.next()) { + blob = rs.getBlob(1); - if (debug) - System.out - .println("JCIFSUtility.debug: getFileInputStream url=" + url); - try { - fis = new SmbFileInputStream(url); - } catch (SmbException e) { - System.err.println("Exception on new SmbFileInputStream(" + url + ")"); - throw e; + } else { + SQLWarning rsWarning = rs.getWarnings(); + if (rsWarning != null) { + throw rsWarning; + } + ; + SQLWarning psWarning = ps.getWarnings(); + if (psWarning != null) { + throw psWarning; + } + ; + } + // File is empty + blob = jdbcConnection_.createBlob(); + } + } + fis = blob.getBinaryStream(); + } else { + String url = getUrl(system, userId, encryptedPassword, ifsPathName); + + if (debug) + System.out.println("JCIFSUtility.debug: getFileInputStream url=" + url); + try { + fis = new SmbFileInputStream(url); + } catch (SmbException e) { + System.err.println("Exception on new SmbFileInputStream(" + url + ")"); + throw e; + } } - } } return fis; } - public static OutputStream getFileOutputStream(String system, String userId, - char[] encryptedPassword, String ifsPathName) - throws SmbException, MalformedURLException, UnknownHostException { + public static OutputStream getFileOutputStream(String system, String userId, char[] encryptedPassword, + String ifsPathName) throws SmbException, MalformedURLException, UnknownHostException { OutputStream fos = null; String url = getUrl(system, userId, encryptedPassword, ifsPathName); @@ -635,34 +630,29 @@ public static OutputStream getFileOutputStream(String system, String userId, return fos; } - public static String getUrl(String system, String userId, char[] encryptedPassword, - String ifsPathName) { + public static String getUrl(String system, String userId, char[] encryptedPassword, String ifsPathName) { String url; - char[] charPassword = PasswordVault.decryptPassword(encryptedPassword); - // For now use the string.. In the future, this will be removed. - String password = new String(charPassword); - PasswordVault.clearPassword(charPassword); - + char[] charPassword = PasswordVault.decryptPassword(encryptedPassword); + // For now use the string.. In the future, this will be removed. + String password = new String(charPassword); + PasswordVault.clearPassword(charPassword); + if (ifsPathName.charAt(0) == '/') { - url = "smb://" + userId + ":" + password + "@" + system + "/root" - + ifsPathName; + url = "smb://" + userId + ":" + password + "@" + system + "/root" + ifsPathName; } else { if (ifsPathName.charAt(0) == '\\') { - url = "smb://" + userId + ":" + password + "@" + system + "/root/" - + ifsPathName.substring(1); + url = "smb://" + userId + ":" + password + "@" + system + "/root/" + ifsPathName.substring(1); } else { - url = "smb://" + userId + ":" + password + "@" + system + "/root/" - + ifsPathName; + url = "smb://" + userId + ":" + password + "@" + system + "/root/" + ifsPathName; } } return url; } - public static DataOutput RandomAccessFileDataOutput(String system, - String userId, char[] encryptedPassword, String ifsPathName, String mode, - int shareAccess) + public static DataOutput RandomAccessFileDataOutput(String system, String userId, char[] encryptedPassword, + String ifsPathName, String mode, int shareAccess) throws SmbException, MalformedURLException, UnknownHostException { String url = getUrl(system, userId, encryptedPassword, ifsPathName); @@ -670,68 +660,71 @@ public static DataOutput RandomAccessFileDataOutput(String system, return new SmbRandomAccessFile(url, mode, shareAccess); } - public static boolean fileExists(String system, String userId, - char[] encryptedPassword, String filename) + public static boolean fileExists(String system, String userId, char[] encryptedPassword, String filename) throws MalformedURLException, SmbException, SQLException { - - - if (useJdbc) { - if (jdbcConnection_ == null) { - setupJdbcConnection(system, userId, encryptedPassword); - } - String sql = "SELECT LINE FROM TABLE(QSYS2.IFS_READ_BINARY(?))"; - PreparedStatement ps = jdbcConnection_.prepareStatement(sql); - ps.setString(1, filename); - ; - ResultSet rs = ps.executeQuery(); - if (rs.next()) { - return true; - - } else { - SQLWarning rsWarning = rs.getWarnings(); - if (rsWarning != null) { return false; }; - SQLWarning psWarning = ps.getWarnings(); - if (psWarning != null) { return false; }; - - // File is empty - return true; - } - - } else { - String url = getUrl(system, userId, encryptedPassword, filename); - SmbFile smbFile = new SmbFile(url); - return smbFile.exists(); - - - } + if (useJdbc) { + if (jdbcConnection_ == null) { + setupJdbcConnection(system, userId, encryptedPassword); + } + String sql = "SELECT LINE FROM TABLE(QSYS2.IFS_READ_BINARY(?))"; + PreparedStatement ps = jdbcConnection_.prepareStatement(sql); + ps.setString(1, filename); + ; + ResultSet rs = ps.executeQuery(); + if (rs.next()) { + return true; + + } else { + SQLWarning rsWarning = rs.getWarnings(); + if (rsWarning != null) { + return false; + } + ; + SQLWarning psWarning = ps.getWarnings(); + if (psWarning != null) { + return false; + } + ; + + // File is empty + return true; + } + + } else { + String url = getUrl(system, userId, encryptedPassword, filename); + + SmbFile smbFile = new SmbFile(url); + return smbFile.exists(); + + } } - public static long fileLength(String system, String userId, char[] encryptedPassword, - String filename) throws MalformedURLException, SmbException, SQLException { - if (useJdbc) { - long length = 0; + public static long fileLength(String system, String userId, char[] encryptedPassword, String filename) + throws MalformedURLException, SmbException, SQLException { + if (useJdbc) { + long length = 0; if (jdbcConnection_ == null) { setupJdbcConnection(system, userId, encryptedPassword); } - String sql="select DATA_SIZE FROM TABLE(QSYS2.IFS_OBJECT_STATISTICS(?,'NO','*STMF'))"; + String sql = "select DATA_SIZE FROM TABLE(QSYS2.IFS_OBJECT_STATISTICS(?,'NO','*STMF'))"; PreparedStatement ps = jdbcConnection_.prepareStatement(sql); ps.setString(1, filename); ResultSet rs = ps.executeQuery(); if (rs.next()) { - length = rs.getLong(1); + length = rs.getLong(1); } else { ps.close(); - throw new SQLException(filename+"not found"); + throw new SQLException(filename + "not found"); } - ps.close(); - return length; - - } else { - String url = getUrl(system, userId, encryptedPassword, filename); + ps.close(); + return length; - SmbFile smbFile = new SmbFile(url); - return smbFile.length(); + } else { + String url = getUrl(system, userId, encryptedPassword, filename); + + SmbFile smbFile = new SmbFile(url); + return smbFile.length(); } } diff --git a/src/test/JD/AS/JDASAffinityFailback.java b/src/test/JD/AS/JDASAffinityFailback.java index 1ceee3ff..7693e4c2 100644 --- a/src/test/JD/AS/JDASAffinityFailback.java +++ b/src/test/JD/AS/JDASAffinityFailback.java @@ -17,8 +17,6 @@ // Classes: AS400JDBCSeamlessFailover // //////////////////////////////////////////////////////////////////////////// -// -//////////////////////////////////////////////////////////////////////////// package test.JD.AS; diff --git a/src/test/JD/BU/JDBUPSArray.java b/src/test/JD/BU/JDBUPSArray.java index 7a572b23..c8e698e9 100644 --- a/src/test/JD/BU/JDBUPSArray.java +++ b/src/test/JD/BU/JDBUPSArray.java @@ -34,8 +34,10 @@ import com.ibm.as400.access.AS400; import test.JDBUTest; +import test.JDRSTest; import test.JDTestDriver; import test.JDTestcase; +import test.JD.JDSerializeFile; /** * Testcase JDBUPSArray. This tests the following method of the JDBC @@ -59,6 +61,7 @@ public static void main(String args[]) throws Exception { // Private data. private StringBuffer sb = new StringBuffer(); + private JDSerializeFile serializeBatchFile_; /** * Constructor. @@ -82,18 +85,14 @@ protected void setup() throws Exception { // to get the connection. connection_ = testDriver_.getConnection(baseURL_, userId_, encryptedPassword_); + serializeBatchFile_ = new JDSerializeFile(connection_, JDBUTest.BUTESTDATA); Statement s = connection_.createStatement(); - try { - s.executeUpdate("drop table " + JDBUTest.BUTESTDATA); - } catch (SQLException e) { - // Ignore it. - } - // Create a table that uses the largest row size the database will // allow me to use. - s.executeUpdate("create table " + JDBUTest.BUTESTDATA + " (col1 int, col2 int, col3 int)"); - + s.executeUpdate( + "create or replace table " + JDBUTest.BUTESTDATA + " (col1 int, col2 int, col3 int) on replace delete rows"); + s.executeUpdate("GRANT ALL ON "+JDBUTest.BUTESTDATA+" TO PUBLIC"); for (int i = 1; i <= 20; i++) { s.executeUpdate("insert into " + JDBUTest.BUTESTDATA + " values(" + i + ", " + i + ", " + i + ")"); } @@ -115,6 +114,9 @@ public void cleanup() { // Close the global connection opened in setup(). connection_.commit(); + serializeBatchFile_.close(); + serializeBatchFile_ = null; + connection_.commit(); connection_.close(); connection_ = null; @@ -130,6 +132,9 @@ public void newSetup(String connectionParms) { try { try { if (connection_ != null) { + connection_.commit(); + serializeBatchFile_.close(); + serializeBatchFile_ = null; connection_.commit(); connection_.close(); } @@ -138,23 +143,15 @@ public void newSetup(String connectionParms) { } connection_ = testDriver_.getConnection(baseURL_ + ";" + connectionParms, userId_, encryptedPassword_); + serializeBatchFile_ = new JDSerializeFile(connection_, JDBUTest.BUTESTDATA); connection_.setAutoCommit(false); s = connection_.createStatement(); - try { - s.executeUpdate("drop table " + JDBUTest.BUTEST); - } catch (SQLException e) { - String expectedException = "not found"; - String exInfo = e.toString(); - if (exInfo.indexOf(expectedException) < 0) { - output_.println("Unexpected exception -- expected " + expectedException); - e.printStackTrace(); - } - } - - s.executeUpdate("create table " + JDBUTest.BUTEST + " (col1 int primary key, col2 int, col3 int)"); - + s.executeUpdate("create or replace table " + JDBUTest.BUTEST + + " (col1 int primary key, col2 int, col3 int) on replace delete rows "); + s.executeUpdate("GRANT ALL ON "+JDBUTest.BUTEST+" TO PUBLIC"); + s.executeUpdate("insert into " + JDBUTest.BUTEST + " values(0, 0, 0)"); connection_.commit(); @@ -178,6 +175,9 @@ public void newSetupLobs(String connectionParms) { try { try { if (connection_ != null) { + connection_.commit(); + serializeBatchFile_.close(); + serializeBatchFile_ = null; connection_.commit(); connection_.close(); } @@ -188,16 +188,14 @@ public void newSetupLobs(String connectionParms) { connection_ = testDriver_.getConnection(baseURL_ + ";" + connectionParms, userId_, encryptedPassword_); connection_.setAutoCommit(false); + serializeBatchFile_ = new JDSerializeFile(connection_, JDBUTest.BUTESTDATA); + connection_.commit(); s = connection_.createStatement(); - try { - s.executeUpdate("drop table " + JDBUTest.BUTESTLOB); - } catch (SQLException e) { - // Ignore it... - } - - s.executeUpdate("create table " + JDBUTest.BUTESTLOB + " (col1 int primary key, col2 BLOB(200), col3 BLOB(200))"); - + s.executeUpdate("create or replace table " + JDBUTest.BUTESTLOB + + " (col1 int primary key, col2 BLOB(200), col3 BLOB(200)) on replace delete rows"); + s.executeUpdate("GRANT ALL ON "+JDBUTest.BUTESTLOB+" TO PUBLIC"); + // NOTE: It is important here for verification that the first byte is 0. byte[] blobBytes = new byte[] { (byte) 0, (byte) -12, (byte) 45, (byte) -33, (byte) 1 }; @@ -232,6 +230,9 @@ public void newSetupLobs2(String connectionParms) { try { try { if (connection_ != null) { + connection_.commit(); + serializeBatchFile_.close(); + serializeBatchFile_ = null; connection_.commit(); connection_.close(); } @@ -240,18 +241,15 @@ public void newSetupLobs2(String connectionParms) { } connection_ = testDriver_.getConnection(baseURL_ + ";" + connectionParms, userId_, encryptedPassword_); + serializeBatchFile_ = new JDSerializeFile(connection_, JDBUTest.BUTESTDATA); connection_.setAutoCommit(false); s = connection_.createStatement(); - try { - s.executeUpdate("drop table " + JDBUTest.BUTESTLOB); - } catch (SQLException e) { - // Ignore it... - } - - s.executeUpdate("create table " + JDBUTest.BUTESTLOB + " (col2 BLOB(200), col3 BLOB(200))"); - + s.executeUpdate("create or replace table " + JDBUTest.BUTESTLOB + + " (col2 BLOB(200), col3 BLOB(200)) on replace delete rows "); + s.executeUpdate("GRANT ALL ON "+JDBUTest.BUTESTLOB+" TO PUBLIC"); + // NOTE: It is important here for verification that the first byte is 0. byte[] blobBytes = new byte[] { (byte) 0, (byte) -12, (byte) 45, (byte) -33, (byte) 1 }; @@ -447,6 +445,7 @@ protected int verifyRows() throws SQLException { } + rs.close(); s.close(); return count; } @@ -481,7 +480,7 @@ protected int verifyRowsLobs() throws SQLException { count++; } - + rs.close(); s.close(); return count; } @@ -514,6 +513,7 @@ protected int verifyRowsLobs2() throws SQLException { count++; } + rs.close(); s.close(); return count; } @@ -541,7 +541,7 @@ public void Var001() { // Verify that the rows are in the table. int rowCount = verifyRows(); - + ps.close(); assertCondition(success1 && (rowCount == expected.length + 1), sb); } catch (Exception e) { @@ -560,14 +560,13 @@ public void Var002() { int arraySize = 20; int failurePos = 1; int[] expected = new int[] {}; - - try { + PreparedStatement ps = null ; + try { newSetup(""); - - PreparedStatement ps = buildBatch(arraySize, failurePos); - + ps = buildBatch(arraySize, failurePos); ps.executeBatch(); - + ps.close(); + ps = null; failed("Didn't throw a BatchUpdateException"); } catch (BatchUpdateException bue) { @@ -584,11 +583,17 @@ public void Var002() { } catch (SQLException e) { failed("can't obtain row count."); } - + assertCondition(success1 && (rowCount == expected.length + 1), sb); } catch (Exception e) { failed(e, "Unexpected Exception"); + } finally { + if (ps != null) + try { + ps.close(); + } catch (SQLException e) { + } } } @@ -611,13 +616,13 @@ public void Var003() { } sb.setLength(0); - try { + PreparedStatement ps = null; + try { newSetup(""); - - PreparedStatement ps = buildBatch(arraySize, failurePos); - + ps = buildBatch(arraySize, failurePos); ps.executeBatch(); - + ps.close(); + ps = null; failed("Didn't throw a BatchUpdateException"); } catch (BatchUpdateException bue) { @@ -640,6 +645,13 @@ public void Var003() { } catch (Exception e) { failed(e, "Unexpected Exception"); + } finally { + if (ps != null) { + try { + ps.close(); + } catch (SQLException e) { + } + } } } @@ -668,7 +680,7 @@ public void Var004() { PreparedStatement ps = buildBatch(arraySize, failurePos); ps.executeBatch(); - + ps.close(); failed("Didn't throw a BatchUpdateException"); } catch (BatchUpdateException bue) { diff --git a/src/test/JD/BU/JDBUPSFunctional.java b/src/test/JD/BU/JDBUPSFunctional.java index 8e2ac876..c077f10a 100644 --- a/src/test/JD/BU/JDBUPSFunctional.java +++ b/src/test/JD/BU/JDBUPSFunctional.java @@ -35,6 +35,7 @@ import test.JDBUTest; import test.JDTestDriver; import test.JDTestcase; +import test.JD.JDSerializeFile; @@ -60,6 +61,10 @@ public static void main(String args[]) throws Exception { + private JDSerializeFile serializeBatchFile_; + + + /** Constructor. @@ -92,18 +97,14 @@ protected void setup () // to get the connection. connection_ = testDriver_.getConnection(baseURL_, userId_, encryptedPassword_); Statement s = connection_.createStatement(); + serializeBatchFile_ = new JDSerializeFile(connection_, JDBUTest.BUTESTDATA); - // todo: butestdata is probably not needed.... - try { - s.executeUpdate("drop table " + JDBUTest.BUTESTDATA); - } catch (SQLException e) { - // Ignore it. - } + // Create a table that uses the largest row size the database will // allow me to use. - s.executeUpdate("create table " + JDBUTest.BUTESTDATA + - " (col1 int, col2 int, col3 int)"); + s.executeUpdate("create or replace table " + JDBUTest.BUTESTDATA + + " (col1 int, col2 int, col3 int) on replace delete rows"); for (int i = 1; i <= 20; i++) { s.executeUpdate("insert into " + JDBUTest.BUTESTDATA + @@ -129,8 +130,14 @@ public void newSetupLobs(String connectionParms) try { try { if (connection_ != null) { - connection_.commit(); + connection_.commit(); + serializeBatchFile_.close(); + serializeBatchFile_=null; + connection_.commit(); + + connection_.close(); + } } catch (SQLException e) { output_.println("Critical Error - couldn't close connection"); @@ -139,15 +146,13 @@ public void newSetupLobs(String connectionParms) connection_ = testDriver_.getConnection(baseURL_+";" + connectionParms, userId_, encryptedPassword_); connection_.setAutoCommit(false); s = connection_.createStatement(); + serializeBatchFile_ = new JDSerializeFile(connection_, JDBUTest.BUTESTDATA); + connection_.commit(); - try { - s.executeUpdate("drop table " + JDBUTest.BUTESTLOB); - } catch (SQLException e) { - // Ignore it... - } + - s.executeUpdate("create table " + JDBUTest.BUTESTLOB + - " (col1 int primary key, col2 BLOB(200), col3 BLOB(200))"); + s.executeUpdate("create or replace table " + JDBUTest.BUTESTLOB + + " (col1 int primary key, col2 BLOB(200), col3 BLOB(200)) on replace delete rows"); // NOTE: It is important here for verification that the first byte is 0. byte[] blobBytes = new byte[] { (byte) 0, (byte) -12, (byte) 45, (byte) -33, (byte) 1}; @@ -212,6 +217,9 @@ public void cleanup() { // Close the global connection opened in setup(). connection_.commit(); + serializeBatchFile_.close(); + serializeBatchFile_=null; + connection_.commit(); connection_.close(); connection_=null; @@ -231,24 +239,25 @@ public void newSetup(String connectionParms) try { if (connection_ != null) { connection_.commit(); - connection_.close(); + serializeBatchFile_.close(); + serializeBatchFile_=null; + connection_.commit(); + + connection_.close(); } } catch (SQLException e) { output_.println("Critical Error - couldn't close connection"); } connection_ = testDriver_.getConnection(baseURL_+";" + connectionParms, userId_, encryptedPassword_); + serializeBatchFile_ = new JDSerializeFile(connection_, JDBUTest.BUTESTDATA); connection_.setAutoCommit(false); s = connection_.createStatement(); - try { - s.executeUpdate("drop table " + JDBUTest.BUTEST); - } catch (SQLException e) { - // Ignore it... - } + - s.executeUpdate("create table " + JDBUTest.BUTEST + - " (col1 int primary key, col2 int, col3 int)"); + s.executeUpdate("create or replace table " + JDBUTest.BUTEST + + " (col1 int primary key, col2 int, col3 int) on replace delete rows"); s.executeUpdate("insert into " + JDBUTest.BUTEST + " values(0, 0, 0)"); diff --git a/src/test/JD/BU/JDBUStatementArray.java b/src/test/JD/BU/JDBUStatementArray.java index 5cf21d4e..1bbbf2f6 100644 --- a/src/test/JD/BU/JDBUStatementArray.java +++ b/src/test/JD/BU/JDBUStatementArray.java @@ -26,6 +26,7 @@ import test.JDBUTest; import test.JDTestDriver; import test.JDTestcase; +import test.JD.JDSerializeFile; import java.io.FileOutputStream; import java.sql.ResultSet; @@ -62,7 +63,8 @@ public static void main(String args[]) throws Exception { // private Statement statement_; // private String properties_; private String url; - private StringBuffer sb = new StringBuffer(); + private StringBuffer sb = new StringBuffer(); + private JDSerializeFile serializeBatchFile_; /** Constructor. **/ @@ -99,17 +101,18 @@ protected void setup () connection_ = testDriver_.getConnection (url, systemObject_.getUserId(), encryptedPassword_); Statement s = connection_.createStatement(); + serializeBatchFile_ = new JDSerializeFile(connection_, JDBUTest.BUTESTDATA); + - try { - s.executeUpdate("drop table " + JDBUTest.BUTESTDATA); - } catch (SQLException e) { - // Ignore it. - } + // Create a table that uses the largest row size the database will // allow me to use. - s.executeUpdate("create table " + JDBUTest.BUTESTDATA + - " (col1 int, col2 int, col3 int)"); + s.executeUpdate("create or replace table " + JDBUTest.BUTESTDATA + + " (col1 int, col2 int, col3 int) on replace delete rows"); + + s.executeUpdate("GRANT ALL ON "+JDBUTest.BUTESTDATA+" TO PUBLIC"); + for (int i = 1; i <= 20; i++) { s.executeUpdate("insert into " + JDBUTest.BUTESTDATA + @@ -135,6 +138,9 @@ public void cleanup() { // Close the global connection opened in setup(). connection_.commit(); + serializeBatchFile_.close(); + serializeBatchFile_ = null; + connection_.commit(); connection_.close(); connection_=null; @@ -152,8 +158,13 @@ public void newSetup(String connectionParms) sb.setLength(0); try { try { - if (connection_ != null) + if (connection_ != null) { + serializeBatchFile_.close(); + serializeBatchFile_ = null; + connection_.commit(); + connection_.close(); + } } catch (SQLException e) { output_.println("Critical Error - couldn't close connection"); } @@ -162,16 +173,14 @@ public void newSetup(String connectionParms) connection_ = testDriver_.getConnection (nowUrl); connection_.setAutoCommit(false); s = connection_.createStatement(); - - try { - s.executeUpdate("drop table " + JDBUTest.BUTEST); - } catch (SQLException e) { - // Ignore it... - } - - s.executeUpdate("create table " + JDBUTest.BUTEST + - " (col1 int primary key, col2 int, col3 int)"); - + serializeBatchFile_ = new JDSerializeFile(connection_, JDBUTest.BUTESTDATA); + connection_.commit(); + + + s.executeUpdate("create or replace table " + JDBUTest.BUTEST + + " (col1 int primary key, col2 int, col3 int) on replace delete rows"); + s.executeUpdate("GRANT ALL ON "+JDBUTest.BUTEST+" TO PUBLIC"); + s.executeUpdate("insert into " + JDBUTest.BUTEST + " values(0, 0, 0)"); diff --git a/src/test/JD/CS/JDCSGetArray.java b/src/test/JD/CS/JDCSGetArray.java index 143a7d4c..82f7e7ee 100644 --- a/src/test/JD/CS/JDCSGetArray.java +++ b/src/test/JD/CS/JDCSGetArray.java @@ -135,11 +135,7 @@ protected void cleanup() throws Exception { st.close(); - JDSetupProcedure.dropProcedure(connection_, - JDSetupProcedure.STP_CSARRSUM, output_); - JDSetupProcedure.dropProcedure(connection_, - JDSetupProcedure.STP_CSARRINT, output_); - + connection_.close(); connection_ = null; diff --git a/src/test/JD/CS/JDCSGetBigDecimal2.java b/src/test/JD/CS/JDCSGetBigDecimal2.java index 922cf117..f4628f37 100644 --- a/src/test/JD/CS/JDCSGetBigDecimal2.java +++ b/src/test/JD/CS/JDCSGetBigDecimal2.java @@ -61,12 +61,12 @@ public static void main(String args[]) throws Exception { test.JDCSTest.main(newArgs); } // table names - private static String INTEGER_TABLE = JDCSTest.COLLECTION + ".int_tab"; - private static String INTEGER_PROCEDURE = JDCSTest.COLLECTION + ".int_proc"; - private static String VARCHAR_TABLE = JDCSTest.COLLECTION + ".vc_tab"; - private static String VARCHAR_PROCEDURE = JDCSTest.COLLECTION + ".vc_proc"; - private static String NUMERIC_TABLE = JDCSTest.COLLECTION + ".num_tab"; - private static String NUMERIC_PROCEDURE = JDCSTest.COLLECTION + ".num_proc"; + private static String INTEGER_TABLE = JDCSTest.COLLECTION + ".int_tgb2"; + private static String INTEGER_PROCEDURE = JDCSTest.COLLECTION + ".int_pgb2"; + private static String VARCHAR_TABLE = JDCSTest.COLLECTION + ".vc_tgb2"; + private static String VARCHAR_PROCEDURE = JDCSTest.COLLECTION + ".vc_pgb2"; + private static String NUMERIC_TABLE = JDCSTest.COLLECTION + ".num_tgb2"; + private static String NUMERIC_PROCEDURE = JDCSTest.COLLECTION + ".num_pgb2"; // Private data. @@ -106,12 +106,12 @@ protected void setup () // // Reset names to use collection names set by -lib parameter // - INTEGER_TABLE = JDCSTest.COLLECTION + ".int_tab"; - INTEGER_PROCEDURE = JDCSTest.COLLECTION + ".int_proc"; - VARCHAR_TABLE = JDCSTest.COLLECTION + ".vc_tab"; - VARCHAR_PROCEDURE = JDCSTest.COLLECTION + ".vc_proc"; - NUMERIC_TABLE = JDCSTest.COLLECTION + ".num_tab"; - NUMERIC_PROCEDURE = JDCSTest.COLLECTION + ".num_proc"; + INTEGER_TABLE = JDCSTest.COLLECTION + ".int_tgb2"; + INTEGER_PROCEDURE = JDCSTest.COLLECTION + ".int_pgb2"; + VARCHAR_TABLE = JDCSTest.COLLECTION + ".vc_tgb2"; + VARCHAR_PROCEDURE = JDCSTest.COLLECTION + ".vc_pgb2"; + NUMERIC_TABLE = JDCSTest.COLLECTION + ".num_tgb2"; + NUMERIC_PROCEDURE = JDCSTest.COLLECTION + ".num_pgb2"; diff --git a/src/test/JD/CS/JDCSSetArray.java b/src/test/JD/CS/JDCSSetArray.java index cf3b6d25..cac44109 100644 --- a/src/test/JD/CS/JDCSSetArray.java +++ b/src/test/JD/CS/JDCSSetArray.java @@ -168,85 +168,8 @@ protected void cleanup() throws Exception { try { reconnect(); - ////v7r1 array SPs - if(areArraysSupported() ) - { - String[] procedures = { - JDSetupProcedure.STP_CSARRSUM, - JDSetupProcedure.STP_CSARRINT3, - JDSetupProcedure.STP_CSARRINTN, - JDSetupProcedure.STP_CSARRINT, - JDSetupProcedure.STP_CSARRVCH3, - - JDSetupProcedure.STP_CSARRINT2, - JDSetupProcedure.STP_CSARRINT4, - JDSetupProcedure.STP_CSARRSIN, - JDSetupProcedure.STP_CSARRIN, - JDSetupProcedure.STP_CSARRIN2, - JDSetupProcedure.STP_CSARRBIN, - JDSetupProcedure.STP_CSARRREA, - JDSetupProcedure.STP_CSARRFLO, - JDSetupProcedure.STP_CSARRDOU, - JDSetupProcedure.STP_CSARRDEC, - JDSetupProcedure.STP_CSARRNUM, - JDSetupProcedure.STP_CSARRCH1, - JDSetupProcedure.STP_CSARRCH50, - JDSetupProcedure.STP_CSARRVCH, - JDSetupProcedure.STP_CSARRVCH2, - JDSetupProcedure.STP_CSARRGR, - JDSetupProcedure.STP_CSARRVGR, - JDSetupProcedure.STP_CSARRCLO, - JDSetupProcedure.STP_CSARRBLO, - JDSetupProcedure.STP_CSARRDAT, - JDSetupProcedure.STP_CSARRTIM, - JDSetupProcedure.STP_CSARRTS, - JDSetupProcedure.STP_CSARRBY, - JDSetupProcedure.STP_CSARRVBY, - JDSetupProcedure.STP_CSARRXML, - }; - for (int i = 0; i < procedures.length; i++) { - if (createdProceduresHashtable.get(procedures[i]) != null ) { - JDSetupProcedure.dropProcedure(connection_, procedures[i], output_); - } - } - - Statement st = connection_.createStatement(); - try{ - - //THESE ARE CREATEED IN JDSetupProcedures right before procedure create - st.execute("drop type " + JDSetupProcedure.COLLECTION + ".JDINTARRAY "); - st.execute("drop type " + JDSetupProcedure.COLLECTION + ".JDVCHARRAY "); - st.execute("drop type " + JDSetupProcedure.COLLECTION + ".ARRSIN"); //smallint - st.execute("drop type " + JDSetupProcedure.COLLECTION + ".ARRIN "); //int - st.execute("drop type " + JDSetupProcedure.COLLECTION + ".ARRIN2 "); //int and non-array type - st.execute("drop type " + JDSetupProcedure.COLLECTION + ".ARRBIN "); //bigint - st.execute("drop type " + JDSetupProcedure.COLLECTION + ".ARRREA "); //read - st.execute("drop type " + JDSetupProcedure.COLLECTION + ".ARRFLO "); //float - st.execute("drop type " + JDSetupProcedure.COLLECTION + ".ARRDOU "); //double - st.execute("drop type " + JDSetupProcedure.COLLECTION + ".ARRDEC "); // decimal - st.execute("drop type " + JDSetupProcedure.COLLECTION + ".ARRNUM "); //numberic - st.execute("drop type " + JDSetupProcedure.COLLECTION + ".ARRCH1 "); //char(1) - st.execute("drop type " + JDSetupProcedure.COLLECTION + ".ARRCH50 "); //char(50) - st.execute("drop type " + JDSetupProcedure.COLLECTION + ".ARRVCH "); //varchar(50) - st.execute("drop type " + JDSetupProcedure.COLLECTION + ".ARRVCH2 "); //varchar(50) and non-array type - st.execute("drop type " + JDSetupProcedure.COLLECTION + ".ARRGR "); //graphic - st.execute("drop type " + JDSetupProcedure.COLLECTION + ".ARRVGR "); //vargraphvi - st.execute("drop type " + JDSetupProcedure.COLLECTION + ".ARRCLO "); //clob - st.execute("drop type " + JDSetupProcedure.COLLECTION + ".ARRBLO "); //blob - st.execute("drop type " + JDSetupProcedure.COLLECTION + ".ARRDAT "); //date - st.execute("drop type " + JDSetupProcedure.COLLECTION + ".ARRTIM "); //time - st.execute("drop type " + JDSetupProcedure.COLLECTION + ".ARRTS "); //timestamp - st.execute("drop type " + JDSetupProcedure.COLLECTION + ".ARRBY "); //binary - st.execute("drop type " + JDSetupProcedure.COLLECTION + ".ARRVBY "); //varbinary - if(isJdbc40()) - st.execute("drop type " + JDSetupProcedure.COLLECTION + ".ARRXML "); //xml - - } catch(Exception e){ } - - st.close(); - } - - + // do not cleanup procedures as they could be in use concurrently + super.cleanup(); } catch (Exception e) { diff --git a/src/test/JD/CS/JDCSSetArrayN.java b/src/test/JD/CS/JDCSSetArrayN.java index 41167660..aa69f3a6 100644 --- a/src/test/JD/CS/JDCSSetArrayN.java +++ b/src/test/JD/CS/JDCSSetArrayN.java @@ -167,85 +167,8 @@ public void reconnect(String connectionProperties)throws Exception protected void cleanup() throws Exception { try { + // Do not drop the procedures as they could be used by other concurrent testcases. reconnect(); - ////v7r1 array SPs - if(areArraysSupported() ) - { - String[] procedures = { - JDSetupProcedure.STP_CSARRSUM, - JDSetupProcedure.STP_CSARRINT3, - JDSetupProcedure.STP_CSARRINTN, - JDSetupProcedure.STP_CSARRINT, - JDSetupProcedure.STP_CSARRVCH3, - - JDSetupProcedure.STP_CSARRINT2, - JDSetupProcedure.STP_CSARRINT4, - JDSetupProcedure.STP_CSARRSIN, - JDSetupProcedure.STP_CSARRIN, - JDSetupProcedure.STP_CSARRIN2, - JDSetupProcedure.STP_CSARRBIN, - JDSetupProcedure.STP_CSARRREA, - JDSetupProcedure.STP_CSARRFLO, - JDSetupProcedure.STP_CSARRDOU, - JDSetupProcedure.STP_CSARRDEC, - JDSetupProcedure.STP_CSARRNUM, - JDSetupProcedure.STP_CSARRCH1, - JDSetupProcedure.STP_CSARRCH50, - JDSetupProcedure.STP_CSARRVCH, - JDSetupProcedure.STP_CSARRVCH2, - JDSetupProcedure.STP_CSARRGR, - JDSetupProcedure.STP_CSARRVGR, - JDSetupProcedure.STP_CSARRCLO, - JDSetupProcedure.STP_CSARRBLO, - JDSetupProcedure.STP_CSARRDAT, - JDSetupProcedure.STP_CSARRTIM, - JDSetupProcedure.STP_CSARRTS, - JDSetupProcedure.STP_CSARRBY, - JDSetupProcedure.STP_CSARRVBY, - JDSetupProcedure.STP_CSARRXML, - }; - for (int i = 0; i < procedures.length; i++) { - if (createdProceduresHashtable1.get(procedures[i]) != null ) { - JDSetupProcedure.dropProcedure(connection_, procedures[i], output_); - } - } - - Statement st = connection_.createStatement(); - try{ - - //THESE ARE CREATEED IN JDSetupProcedures right before procedure create - st.execute("drop type " + JDSetupProcedure.COLLECTION + ".JDINTARRAY "); - st.execute("drop type " + JDSetupProcedure.COLLECTION + ".JDVCHARRAY "); - st.execute("drop type " + JDSetupProcedure.COLLECTION + ".ARRSIN"); //smallint - st.execute("drop type " + JDSetupProcedure.COLLECTION + ".ARRIN "); //int - st.execute("drop type " + JDSetupProcedure.COLLECTION + ".ARRIN2 "); //int and non-array type - st.execute("drop type " + JDSetupProcedure.COLLECTION + ".ARRBIN "); //bigint - st.execute("drop type " + JDSetupProcedure.COLLECTION + ".ARRREA "); //read - st.execute("drop type " + JDSetupProcedure.COLLECTION + ".ARRFLO "); //float - st.execute("drop type " + JDSetupProcedure.COLLECTION + ".ARRDOU "); //double - st.execute("drop type " + JDSetupProcedure.COLLECTION + ".ARRDEC "); // decimal - st.execute("drop type " + JDSetupProcedure.COLLECTION + ".ARRNUM "); //numberic - st.execute("drop type " + JDSetupProcedure.COLLECTION + ".ARRCH1 "); //char(1) - st.execute("drop type " + JDSetupProcedure.COLLECTION + ".ARRCH50 "); //char(50) - st.execute("drop type " + JDSetupProcedure.COLLECTION + ".ARRVCH "); //varchar(50) - st.execute("drop type " + JDSetupProcedure.COLLECTION + ".ARRVCH2 "); //varchar(50) and non-array type - st.execute("drop type " + JDSetupProcedure.COLLECTION + ".ARRGR "); //graphic - st.execute("drop type " + JDSetupProcedure.COLLECTION + ".ARRVGR "); //vargraphvi - st.execute("drop type " + JDSetupProcedure.COLLECTION + ".ARRCLO "); //clob - st.execute("drop type " + JDSetupProcedure.COLLECTION + ".ARRBLO "); //blob - st.execute("drop type " + JDSetupProcedure.COLLECTION + ".ARRDAT "); //date - st.execute("drop type " + JDSetupProcedure.COLLECTION + ".ARRTIM "); //time - st.execute("drop type " + JDSetupProcedure.COLLECTION + ".ARRTS "); //timestamp - st.execute("drop type " + JDSetupProcedure.COLLECTION + ".ARRBY "); //binary - st.execute("drop type " + JDSetupProcedure.COLLECTION + ".ARRVBY "); //varbinary - if(isJdbc40()) - st.execute("drop type " + JDSetupProcedure.COLLECTION + ".ARRXML "); //xml - - } catch(Exception e){ } - - st.close(); - } - super.cleanup(); diff --git a/src/test/JD/Connection/JDConnectionAbort.java b/src/test/JD/Connection/JDConnectionAbort.java index 82ccae94..acf8bf9a 100644 --- a/src/test/JD/Connection/JDConnectionAbort.java +++ b/src/test/JD/Connection/JDConnectionAbort.java @@ -554,11 +554,7 @@ public void Var006 () { public void Var007 () { // SecurityManager has been deprecated so calls to security manager were removed. if (checkJdbc41()) { - - testExecutor("java.util.concurrent.ForkJoinPool"); - - } } diff --git a/src/test/JD/Connection/JDConnectionCCSID.java b/src/test/JD/Connection/JDConnectionCCSID.java index 9d114e8b..bbcb8964 100644 --- a/src/test/JD/Connection/JDConnectionCCSID.java +++ b/src/test/JD/Connection/JDConnectionCCSID.java @@ -29,8 +29,6 @@ import test.JDTestcase; import test.PasswordVault; -import java.io.FileOutputStream; -import java.io.InputStream; import java.sql.CallableStatement; import java.sql.Connection; import java.sql.ResultSet; @@ -57,14 +55,9 @@ public static void main(String args[]) throws Exception { test.JDConnectionTest.main(newArgs); } - - - // Private data. - String pwrUID_; - String pwrPwd_; - char[] encryptedPwrPwd_; - Hashtable userProfiles = new Hashtable(); + Hashtable userProfiles = new Hashtable(); + private Connection pwrConnection_; /** Constructor. @@ -79,10 +72,7 @@ public JDConnectionCCSID (AS400 systemObject, String pwrPwd) { //@H2A super (systemObject, "JDConnectionCCSID", namesAndVars, runMode, fileOutputStream, - password); - pwrUID_ = pwrUID; //@H2A - pwrPwd_ = pwrPwd; //@H2A - encryptedPwrPwd_ = PasswordVault.getEncryptedPassword(pwrPwd); + password, pwrUID, pwrPwd); } @@ -96,16 +86,20 @@ public JDConnectionCCSID (AS400 systemObject, protected void setup () throws Exception { + + pwrConnection_ = testDriver_.getConnection (baseURL_, pwrSysUserID_, pwrSysEncryptedPassword_); { if (getDriver() == JDTestDriver.DRIVER_NATIVE) { String currentUser = System.getProperty("user.name"); try { // Grant current user access to the QP0ZMAINT program - Connection c = testDriver_.getConnection (baseURL_, pwrUID_, encryptedPwrPwd_); - Statement s = c.createStatement(); - s.execute("call QSYS.QCMDEXC('GRTOBJAUT OBJ(QSYS/QP0ZMAINT) OBJTYPE(*PGM) USER(" +currentUser+") AUT(*USE) ',000000080.00000)"); - c.close(); + + Statement s = pwrConnection_.createStatement(); + + s.execute("call QSYS2.QCMDEXC('GRTOBJAUT OBJ(QSYS/QP0ZMAINT) OBJTYPE(*PGM) USER(" +currentUser+") AUT(*USE) ')"); + s.close(); + } catch (Exception e) { output_.println("Warning: unable to grant currentUser access to QP0ZMAINT"); } @@ -243,6 +237,7 @@ protected void cleanup () throws Exception { cleanupProfiles(); + pwrConnection_.close(); connection_.close (); connection_ = null; @@ -257,7 +252,7 @@ public String setupProfile(int ccsid) throws SQLException { String profile = "JDCON"+ccsid; if (userProfiles.get(profile) == null) { // The profile has not been created. Create it - Statement s = connection_.createStatement(); + Statement s = pwrConnection_.createStatement(); String sql = "CALL QSYS2.QCMDEXC('" + "QSYS/CRTUSRPRF USRPRF(" + profile + ") PASSWORD(DUMMY) JOBD(QGPL/QDFTJOBD) ')"; try { s.executeUpdate(sql); @@ -283,7 +278,7 @@ public void cleanupProfiles() { String sql=""; try { Enumeration keys = userProfiles.keys(); - Statement s = connection_.createStatement(); + Statement s = pwrConnection_.createStatement(); while (keys.hasMoreElements()) { String key = (String) keys.nextElement(); sql = "CALL QSYS.QCMDEXC('" + "QSYS/DLTUSRPRF USRPRF(" + key @@ -302,49 +297,57 @@ public void cleanupProfiles() { * @throws Exception **/ - public int getConnectionWcbCCSID(Connection inputConnection) throws Exception { +public int getConnectionWcbCCSID(Connection inputConnection, StringBuffer sb) throws Exception { + String sql = ""; - String jobname = (String) JDReflectionUtil.callMethod_S(inputConnection, "getServerJobName"); - int slashIndex = jobname.indexOf('/'); - String jobNumber = jobname.substring(0,slashIndex); + try { - Runtime rt = Runtime.getRuntime(); + Statement stmt = inputConnection.createStatement(); + ResultSet rs; + sql = "values job_name"; + rs = stmt.executeQuery(sql); + rs.next(); + String jobname = rs.getString(1); + rs.close(); - String[] cmd = new String[3]; - cmd[0] = "/usr/bin/qsh"; - cmd[1] = "-c"; - cmd[2] = "/QSYS.LIB/QP0ZMAINT.PGM '30' "+jobNumber+" '0' '1' | grep ':001250' | sed 's/.*:...... ........ ........ \\(....\\).*/\\1/'"; + int slashIndex = jobname.indexOf('/'); + String jobNumber = jobname.substring(0, slashIndex); - int ccsid = 0; - // output_.println("Debug: Running "+cmd[2]); - try { - Process p = rt.exec(cmd); - InputStream iStream = p.getInputStream(); - int readByte = iStream.read(); - while (readByte != -1) { - int value; - if ( ((readByte >= 0xf0) && (readByte <=0xf9)) || - ((readByte >= 0x30) && (readByte <=0x39))) { - value = readByte & 0xf; - ccsid=ccsid*16 +value; - } else if ( ((readByte >= 0x41) && (readByte <=0x46) || - ((readByte >= 0xc1) && (readByte <=0xc6)))) { - value = 9 + readByte & 0xf; - ccsid=ccsid*16 +value; - } - - readByte=iStream.read(); - } - iStream.close(); + sql = "call qsys2.qcmdexc('QSH CMD(''rm -f /tmp/output.ccsid" + jobNumber + "'')')"; + stmt.executeUpdate(sql); - return ccsid; - } catch (Throwable e) { - e.printStackTrace(); + sql = "call qsys2.qcmdexc('QSH CMD(''/QSYS.LIB/QP0ZMAINT.PGM 30 " + jobNumber + " 0 1 > /tmp/output.ccsid" + + jobNumber + "'')')"; + stmt.executeUpdate(sql); - return ccsid = 0; - } + sql = " select * from TABLE(IFS_READ('/tmp/output.ccsid" + jobNumber + "'))"; + rs = stmt.executeQuery(sql); + int ccsid = -1; + while (rs.next() && ccsid == -1) { + String line = rs.getString(2); + int colonIndex = line.indexOf(":001250"); + if (colonIndex > 0) { + String hexData = line.substring(colonIndex + 26, colonIndex + 30); + ccsid = Integer.parseInt(hexData, 16); + System.out.println("CCSID is " + ccsid); + } + } + if (ccsid != -1) { + sql = "call qsys2.qcmdexc('QSH CMD(''rm -f /tmp/output.ccsid" + jobNumber + "'')')"; + stmt.executeUpdate(sql); + } + rs.close(); + stmt.close(); + sb.append("\n returning ccsid " + ccsid+ " from /tmp/output.ccsid"+jobNumber+" "); + return ccsid; + } catch (Throwable e) { + System.out.println("Error on "+sql); + e.printStackTrace(); + + return 0; + } } @@ -375,7 +378,6 @@ public void changeCcsidAndGetFromQusrjobi(int ccsid) { public void changeCcsidAndGetFromWcb(int ccsid) { try { - if (checkNative()) { CallableStatement cmd = connection_ .prepareCall("call QGPL.JDCMDEXEC(?,?)"); @@ -393,12 +395,12 @@ public void changeCcsidAndGetFromWcb(int ccsid) { } s.close(); - - int outCcsid = getConnectionWcbCCSID(connection_); - - assertCondition(outCcsid == ccsid, "changeCcsidAndGetFromWcb(): input ccsid=" + ccsid - + " output ccsid=" + outCcsid); - } + StringBuffer sb = new StringBuffer(); + sb.append("changeCcsidAndGetFromWcb(): input ccsid=" + ccsid); + int outCcsid = getConnectionWcbCCSID(connection_, sb); + sb.append(" output ccsid=" + outCcsid); + assertCondition(outCcsid == ccsid, sb); + } catch (Exception e) { failed(e, "Unexpected Exception"); } @@ -499,13 +501,16 @@ public void loginCcsidAndGetFromWcb(int ccsid) { while(rs.next()) { } + rs.close(); s.close(); - - int outCcsid = getConnectionWcbCCSID(profileConnection); - String extraInfo=""; - - int expectedCcsid = ccsid; + StringBuffer sb = new StringBuffer(); + sb.append("loginCcsidAndGetFromWcb() input ccsid=" + ccsid); + int outCcsid = getConnectionWcbCCSID(profileConnection, sb); + int expectedCcsid = ccsid; + sb.append(" output ccsid=" + outCcsid+" expected ccsid="+expectedCcsid); + + boolean passed = (outCcsid == expectedCcsid); if (interactive_ && (!passed)) { @@ -517,9 +522,8 @@ public void loginCcsidAndGetFromWcb(int ccsid) { profileConnection.close(); - assertCondition(passed, "loginCcsidAndGetFromWcb() input ccsid=" + ccsid - + " output ccsid=" + outCcsid+" expected ccsid="+expectedCcsid+extraInfo); - + assertCondition(passed, sb); + } } catch (Exception e) { failed(e, "Unexpected Exception"); diff --git a/src/test/JD/DMD/JDDMDGetTables.java b/src/test/JD/DMD/JDDMDGetTables.java index fc92f0fd..2eb020a3 100644 --- a/src/test/JD/DMD/JDDMDGetTables.java +++ b/src/test/JD/DMD/JDDMDGetTables.java @@ -70,6 +70,7 @@ import test.JDReflectionUtil; import test.JDTestDriver; import test.JDTestcase; +import test.JD.JDParallelCounter; /** Testcase JDDMDGetTables. This tests the following methods @@ -110,6 +111,11 @@ public static void main(String args[]) throws Exception { String setupSysibmVersion = ""; StringBuffer message = new StringBuffer(); boolean is400 = true; + private JDParallelCounter parallelCounter_; + private JDParallelCounter parallelCounter2_; + private JDParallelCounter parallelCounterXX_; + private JDParallelCounter parallelCounterGT_; + private JDParallelCounter parallelCounter128_; @@ -197,11 +203,14 @@ protected void setup() throws Exception { /* Make sure that the schema is valid. In newer releases, sometimes */ /* the SYSTABLES view is missing. */ - + parallelCounter_ = new JDParallelCounter(connection_, JDDMDTest.COLLECTION); validateCollection(connection_, JDDMDTest.COLLECTION); + parallelCounter2_ = new JDParallelCounter(connection_, JDDMDTest.COLLECTION2); validateCollection(connection_, JDDMDTest.COLLECTION2); + parallelCounterXX_ = new JDParallelCounter(connection_, JDDMDTest.COLLECTIONXX); validateCollection(connection_, JDDMDTest.COLLECTIONXX); jddmdCol_ = JDDMDTest.COLLECTION+"GT"; + parallelCounterGT_ = new JDParallelCounter(connection_, jddmdCol_); validateCollection(connection_,jddmdCol_); if (!is400) { // @@ -223,86 +232,43 @@ protected void setup() throws Exception { dmd_ = connection_.getMetaData(); - - // - // Make sure it is clean before running - try { - s.executeUpdate("DROP VIEW " + JDDMDTest.COLLECTION + ".TABLESV"); - } catch (Exception e) { - } - try { - s.executeUpdate("DROP VIEW " + JDDMDTest.COLLECTION2 + ".TABLESV2"); - } catch (Exception e) { - } - try { - - s.executeUpdate("DROP TABLE " + JDDMDTest.COLLECTION + ".TABLES"); - } catch (Exception e) { - } - try { - s.executeUpdate("DROP TABLE " + JDDMDTest.COLLECTION + ".TABLES1"); - } catch (Exception e) { - } - try { - s.executeUpdate("DROP TABLE " + JDDMDTest.COLLECTION + ".TABLES2"); - } catch (Exception e) { - } - try { - s.executeUpdate("DROP TABLE " + JDDMDTest.COLLECTION + ".TABLESXX"); - } catch (Exception e) { - } - try { - s.executeUpdate("DROP TABLE " + JDDMDTest.COLLECTION2 + ".TABLES"); - } catch (Exception e) { - } - try { - s.executeUpdate("DROP TABLE " + JDDMDTest.COLLECTION2 + ".TABLES3"); - } catch (Exception e) { - } - try { - s.executeUpdate("DROP TABLE " + JDDMDTest.COLLECTION2 + ".TABLES4"); - } catch (Exception e) { - } - try { - s.executeUpdate("DROP TABLE " + JDDMDTest.COLLECTIONXX + ".TABLESXX"); - } catch (Exception e) { - } - - s.executeUpdate ("CREATE TABLE " + JDDMDTest.COLLECTION - + ".TABLES (NAME INTEGER)"); - s.executeUpdate ("CREATE TABLE " + JDDMDTest.COLLECTION - + ".TABLES1 (NAME INTEGER)"); - s.executeUpdate ("CREATE TABLE " + JDDMDTest.COLLECTION - + ".TABLES2 (NAME INTEGER)"); - s.executeUpdate ("CREATE TABLE " + JDDMDTest.COLLECTION - + ".TABLESXX (NAME INTEGER)"); - s.executeUpdate ("CREATE TABLE " + JDDMDTest.COLLECTION2 - + ".TABLES (NAME INTEGER)"); - s.executeUpdate ("CREATE TABLE " + JDDMDTest.COLLECTION2 - + ".TABLES3 (NAME INTEGER)"); - s.executeUpdate ("CREATE TABLE " + JDDMDTest.COLLECTION2 - + ".TABLES4 (NAME INTEGER)"); - s.executeUpdate ("CREATE TABLE " + JDDMDTest.COLLECTIONXX - + ".TABLESXX (NAME INTEGER)"); + s.executeUpdate ("CREATE OR REPLACE TABLE " + JDDMDTest.COLLECTION + + ".TABLES (NAME INTEGER) ON REPLACE DELETE ROWS "); + s.executeUpdate ("CREATE OR REPLACE TABLE " + JDDMDTest.COLLECTION + + ".TABLES1 (NAME INTEGER) ON REPLACE DELETE ROWS "); + s.executeUpdate ("CREATE OR REPLACE TABLE " + JDDMDTest.COLLECTION + + ".TABLES2 (NAME INTEGER) ON REPLACE DELETE ROWS "); + s.executeUpdate ("CREATE OR REPLACE TABLE " + JDDMDTest.COLLECTION + + ".TABLESXX (NAME INTEGER) ON REPLACE DELETE ROWS "); + s.executeUpdate ("CREATE OR REPLACE TABLE " + JDDMDTest.COLLECTION2 + + ".TABLES (NAME INTEGER) ON REPLACE DELETE ROWS "); + s.executeUpdate ("CREATE OR REPLACE TABLE " + JDDMDTest.COLLECTION2 + + ".TABLES3 (NAME INTEGER) ON REPLACE DELETE ROWS "); + s.executeUpdate ("CREATE OR REPLACE TABLE " + JDDMDTest.COLLECTION2 + + ".TABLES4 (NAME INTEGER) ON REPLACE DELETE ROWS "); + s.executeUpdate ("CREATE OR REPLACE TABLE " + JDDMDTest.COLLECTIONXX + + ".TABLESXX (NAME INTEGER) ON REPLACE DELETE ROWS "); - s.executeUpdate ("CREATE VIEW " + JDDMDTest.COLLECTION + s.executeUpdate ("CREATE OR REPLACE VIEW " + JDDMDTest.COLLECTION + ".TABLESV AS SELECT * FROM " + JDDMDTest.COLLECTION + ".TABLES"); - s.executeUpdate ("CREATE VIEW " + JDDMDTest.COLLECTION2 + s.executeUpdate ("CREATE OR REPLACE VIEW " + JDDMDTest.COLLECTION2 + ".TABLESV2 AS SELECT * FROM " + JDDMDTest.COLLECTION2 + ".TABLES3"); // @128sch if(true) { - String sql = "CREATE TABLE " + JDDMDTest.SCHEMAS_LEN128 + parallelCounter128_ = new JDParallelCounter(connection_, JDDMDTest.SCHEMAS_LEN128); + + String sql = "CREATE OR REPLACE TABLE " + JDDMDTest.SCHEMAS_LEN128 + ".TABLE1 (COL1 CHAR(15) DEFAULT 'DEFAULTVAL'," - + " COL2 CHAR(15) )"; + + " COL2 CHAR(15) ) ON REPLACE DELETE ROWS "; try{ s.executeUpdate(sql); } @@ -332,41 +298,49 @@ protected void cleanup () throws Exception { Statement s = connection_.createStatement (); + try { + if (parallelCounter_.doCleanup()) { + s.executeUpdate("DROP VIEW " + JDDMDTest.COLLECTION + ".TABLESV"); + s.executeUpdate("DROP TABLE " + JDDMDTest.COLLECTION + ".TABLES"); + s.executeUpdate("DROP TABLE " + JDDMDTest.COLLECTION + ".TABLES1"); + s.executeUpdate("DROP TABLE " + JDDMDTest.COLLECTION + ".TABLES2"); + s.executeUpdate("DROP TABLE " + JDDMDTest.COLLECTION + ".TABLESXX"); + } + } finally { + parallelCounter_.close(); + } + try { + if (parallelCounter2_.doCleanup()) { + s.executeUpdate("DROP VIEW " + JDDMDTest.COLLECTION2 + ".TABLESV2"); + s.executeUpdate("DROP TABLE " + JDDMDTest.COLLECTION2 + ".TABLES"); + s.executeUpdate("DROP TABLE " + JDDMDTest.COLLECTION2 + ".TABLES3"); + s.executeUpdate("DROP TABLE " + JDDMDTest.COLLECTION2 + ".TABLES4"); + } + } finally { + parallelCounter2_.close(); + } + try { + if (parallelCounterXX_.doCleanup()) { - s.executeUpdate ("DROP VIEW " + JDDMDTest.COLLECTION - + ".TABLESV"); - s.executeUpdate ("DROP VIEW " + JDDMDTest.COLLECTION2 - + ".TABLESV2"); - - s.executeUpdate ("DROP TABLE " + JDDMDTest.COLLECTION - + ".TABLES"); - s.executeUpdate ("DROP TABLE " + JDDMDTest.COLLECTION - + ".TABLES1"); - s.executeUpdate ("DROP TABLE " + JDDMDTest.COLLECTION - + ".TABLES2"); - s.executeUpdate ("DROP TABLE " + JDDMDTest.COLLECTION - + ".TABLESXX"); - s.executeUpdate ("DROP TABLE " + JDDMDTest.COLLECTION2 - + ".TABLES"); - s.executeUpdate ("DROP TABLE " + JDDMDTest.COLLECTION2 - + ".TABLES3"); - s.executeUpdate ("DROP TABLE " + JDDMDTest.COLLECTION2 - + ".TABLES4"); - s.executeUpdate ("DROP TABLE " + JDDMDTest.COLLECTIONXX - + ".TABLESXX"); - - if(true) //@128sch - { - try{ - s.executeUpdate("DROP TABLE " + JDDMDTest.SCHEMAS_LEN128 + ".TABLE1"); - } - catch(Exception e){ - output_.println("Warning.. drop table failed"); - e.printStackTrace(); + s.executeUpdate("DROP TABLE " + JDDMDTest.COLLECTIONXX + ".TABLESXX"); + } + } finally { + parallelCounterXX_.doCleanup(); + } + try { + if (parallelCounter128_.doCleanup()) { + try { + s.executeUpdate("DROP TABLE " + JDDMDTest.SCHEMAS_LEN128 + ".TABLE1"); + } catch (Exception e) { + output_.println("Warning.. drop table failed"); + e.printStackTrace(); } + } + } finally { + parallelCounter128_.close(); } - - + parallelCounterGT_.close(); + s.close (); connection_.close (); connection_ = null; diff --git a/src/test/JD/Driver/JDDriverGetPropertyInfo.java b/src/test/JD/Driver/JDDriverGetPropertyInfo.java index 2cff0c84..11a7bcc4 100644 --- a/src/test/JD/Driver/JDDriverGetPropertyInfo.java +++ b/src/test/JD/Driver/JDDriverGetPropertyInfo.java @@ -87,7 +87,7 @@ protected void setup() throws Exception { driver_ = DriverManager.getDriver(baseURL_); if (getDriver() == JDTestDriver.DRIVER_TOOLBOX) { - NUMBER_OF_PROPERTIES = 106; // useSock5 + NUMBER_OF_PROPERTIES = 107; // virtual threads } else if (getDriver() == JDTestDriver.DRIVER_NATIVE) { int vrm_ = testDriver_.getRelease(); @@ -526,6 +526,7 @@ private Hashtable getBeanMethods(String string) Hashtable returnMethods = new Hashtable(); // Also check out the bean information + java.beans.Introspector.flushCaches(); BeanInfo beanInfo = java.beans.Introspector.getBeanInfo(thisClass); PropertyDescriptor[] descriptors = beanInfo.getPropertyDescriptors(); @@ -618,7 +619,15 @@ private String generateGetMethodName(String property) { public void Var042() { testProperty("cursor sensitivity","sensitive"); } public void Var043() { if (checkNative()) testProperty("direct map","false"); } public void Var044() { testProperty("query optimize goal","1"); } - public void Var045() { testProperty("decfloat rounding mode","round ceiling"); } + + public void Var045() { + if (getDriver() == JDTestDriver.DRIVER_NATIVE) { + testProperty("decfloat rounding mode", "round ceiling"); + } else { + testProperty("decfloat rounding mode", "ceiling"); + } + } + public void Var046() { if (checkNative()) testProperty("qaqqinilib","QGPL"); } public void Var047() { if (checkNative()) testProperty("ignore warnings","0100C"); } public void Var048() { testProperty("commit hold","false"); } @@ -633,5 +642,12 @@ private String generateGetMethodName(String property) { public void Var057() { testProperty("authenticationLocalPort","30"); } public void Var058() { testProperty("authenticationRemoteIP","2.3.4.5"); } public void Var059() { testProperty("authenticationRemotePort","50"); } + + + public void Var060() { if (checkToolbox()) testProperty("stay alive","60"); } + public void Var061() { if (checkToolbox()) testProperty("tls truststore","/tmp/mystore.jks");} + public void Var062() { if (checkToolbox()) testProperty("tls truststore password","p@ssw0rd");} + public void Var063() { if (checkToolbox()) testProperty("use sock5","true"); } + public void Var064() { if (checkToolbox()) testProperty("virtual threads","true"); } } diff --git a/src/test/JD/JDDataAreaLock.java b/src/test/JD/JDDataAreaLock.java index 1c2aad95..c4286b3d 100644 --- a/src/test/JD/JDDataAreaLock.java +++ b/src/test/JD/JDDataAreaLock.java @@ -26,8 +26,9 @@ public class JDDataAreaLock { private String library_; public JDDataAreaLock(Statement s, String dataArea) throws SQLException { - if (dataArea.length() > 10) { - throw new SQLException("Too long :"+dataArea); + int len = dataArea.length(); + if (len > 10) { + dataArea = dataArea.substring(0,6) + dataArea.substring(len-4); } s_ = s; dataArea_ = dataArea; @@ -36,8 +37,9 @@ public JDDataAreaLock(Statement s, String dataArea) throws SQLException { public JDDataAreaLock(Statement s, String library, String dataArea) throws SQLException { - if (dataArea.length() > 10) { - throw new SQLException("Too long :"+dataArea); + int len = dataArea.length(); + if (len > 10) { + dataArea = dataArea.substring(0,6) + dataArea.substring(len-4); } s_ = s; dataArea_ = dataArea; diff --git a/src/test/JD/JDParallelCounter.java b/src/test/JD/JDParallelCounter.java index cceca96a..7884bf4a 100644 --- a/src/test/JD/JDParallelCounter.java +++ b/src/test/JD/JDParallelCounter.java @@ -104,6 +104,10 @@ public JDParallelCounter(Connection c, String name) throws Exception { sql = "CREATE OR REPLACE TABLE "+filename_+" (LOCKJOBNAME VARCHAR(80), STARTTIME TIMESTAMP) ON REPLACE PRESERVE ROWS"; System.out.println("Running "+sql); statement_.executeUpdate(sql); + + sql = "GRANT ALL ON "+filename_+" TO PUBLIC"; + statement_.executeUpdate(sql); + c.commit(); } else { rs.close(); @@ -162,29 +166,31 @@ public String getName() { */ public boolean doCleanup() throws SQLException { boolean cleanup = false; - + cleanupSet_ = false; dataAreaLock_.lock("JDparallelCounter", 3600); + try { + /* Check the files. If we are the only job then */ + /* add a CLEANUP entry to prevent new counters from being added */ + + String sql = "SELECT count(*) FROM " + filename_; + ResultSet rs = statement_.executeQuery(sql); + rs.next(); + int count = rs.getInt(1); + if (count == 1) { + sql = "INSERT INTO " + filename_ + " VALUES('CLEANUP',CURRENT TIMESTAMP)"; + statement_.execute(sql); + cleanupSet_ = true; + cleanup = true; + } + rs.close(); + + } finally { + if (!cleanupSet_) { + dataAreaLock_.unlock("JDSerializeFile", null); + } + statement_.getConnection().commit(); - /* Check the files. If we are the only job then */ - /* add a CLEANUP entry to prevent new counters from being added */ - - - String sql = "SELECT count(*) FROM "+filename_; - ResultSet rs = statement_.executeQuery(sql); - rs.next(); - int count = rs.getInt(1); - if (count == 1) { - sql = "INSERT INTO "+filename_+" VALUES('CLEANUP',CURRENT TIMESTAMP)"; - statement_.execute(sql); - cleanupSet_ = true; - cleanup = true; - } - rs.close(); - - if (!cleanupSet_) { - dataAreaLock_.unlock("JDSerializeFile", null); } - statement_.getConnection().commit(); return cleanup; } diff --git a/src/test/JD/Parm/JDParmHelper.java b/src/test/JD/Parm/JDParmHelper.java index d85d08f1..a3667a04 100644 --- a/src/test/JD/Parm/JDParmHelper.java +++ b/src/test/JD/Parm/JDParmHelper.java @@ -24,22 +24,14 @@ import java.sql.*; import java.io.PrintWriter; -import test.JDParmTest; + /** This function contains various helper classes used by the JDParm tests. **/ public class JDParmHelper { - public static boolean verifyString(String column, - String value, - Connection connection, - PrintWriter output) - { - return verifyString(column,value,connection,JDParmTest.COLLECTION+".strings", output); - } - - public static boolean verifyString(String column, + public static boolean verifyString(String column, String value, Connection connection, String tablename, PrintWriter output_) { @@ -48,7 +40,8 @@ public static boolean verifyString(String column, ResultSet rs = s.executeQuery("select " + column + " from " + tablename); // @KKASHIR: added space before the word from to avoid exceptions rs.next(); String test = rs.getString(1); - + rs.close(); + s.close(); if (value == null) { if (test == null) { return true; @@ -125,15 +118,16 @@ public static boolean verifyString(String column, public static boolean verifyGraphic(String column, String compare, int length, - Connection connection) + Connection connection, + String stringsTable) { try { Statement s = connection.createStatement(); - ResultSet rs = s.executeQuery("select " + column + " from "+JDParmTest.COLLECTION+".strings"); + ResultSet rs = s.executeQuery("select " + column + " from "+stringsTable); rs.next(); String actual = rs.getString(1); - - + rs.close(); + s.close(); if (compare == null) { if (actual == null) return true; @@ -156,15 +150,7 @@ public static boolean verifyGraphic(String column, } - public static void purgeStringsTable(Connection connection, PrintWriter output_) { - try { - Statement s = connection.createStatement(); - s.executeUpdate("delete from "+JDParmTest.COLLECTION+".strings"); - s.close(); - } catch (SQLException e) { - output_.println("Table purge function filed."); - } - } + public static void purgeStringsTable(Connection connection, String tablename, PrintWriter output_) { try { diff --git a/src/test/JD/Parm/JDParmStringBinary.java b/src/test/JD/Parm/JDParmStringBinary.java index d1601d11..927dac40 100644 --- a/src/test/JD/Parm/JDParmStringBinary.java +++ b/src/test/JD/Parm/JDParmStringBinary.java @@ -69,6 +69,7 @@ public static void main(String args[]) throws Exception { public PreparedStatement col5 = null; public PreparedStatement col6 = null; public String largeValue = ""; + private String stringsTable_; /** @@ -105,31 +106,26 @@ protected void setup () Statement s = connection.createStatement(); - try { - s.executeUpdate("drop table "+JDParmTest.COLLECTION+".strings"); - } catch (SQLException e) { - JDParmHelper.handleDropException(e,output_); - - - } + stringsTable_ = JDParmTest.COLLECTION+".strbin "; + // Create a table that uses the largest row size the database will // allow me to use. - s.executeUpdate("create table "+JDParmTest.COLLECTION+".strings " + + s.executeUpdate("create or replace table "+ stringsTable_ + "(col1 char(1) CCSID 65535, " + "col2 char(20) CCSID 65535, " + - "col3 char (32744) CCSID 65535)"); + "col3 char (32744) CCSID 65535) on replace delete rows"); s.close(); - col1 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col1) values(?)"); - col2 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col2) values(?)"); - col3 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col3) values(?)"); + col1 = connection.prepareStatement("insert into "+stringsTable_+" (col1) values(?)"); + col2 = connection.prepareStatement("insert into "+stringsTable_+" (col2) values(?)"); + col3 = connection.prepareStatement("insert into "+stringsTable_+" (col3) values(?)"); - col4 = connection2.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col1) values(?)"); - col5 = connection2.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col2) values(?)"); - col6 = connection2.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col3) values(?)"); + col4 = connection2.prepareStatement("insert into "+stringsTable_+" (col1) values(?)"); + col5 = connection2.prepareStatement("insert into "+stringsTable_+" (col2) values(?)"); + col6 = connection2.prepareStatement("insert into "+stringsTable_+" (col3) values(?)"); String shortValue = "abcdefghijklmnopqrstuvwxy"; @@ -174,7 +170,7 @@ public void Var001() { col1.setString(1, "X"); int count = col1.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col1", "X", connection,output_)); + assertCondition(JDParmHelper.verifyString("col1", "X", connection,stringsTable_,output_)); else failed("invalid update count"); @@ -185,7 +181,7 @@ public void Var001() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_, output_); } } @@ -202,7 +198,7 @@ public void Var002() { if (getDriver () == JDTestDriver.DRIVER_TOOLBOX) expected = "\u0030\u0030"; if (count == 1) - assertCondition(JDParmHelper.verifyString("col1", expected, connection,output_)); + assertCondition(JDParmHelper.verifyString("col1", expected, connection,stringsTable_,output_)); else failed("invalid update count"); @@ -210,7 +206,7 @@ public void Var002() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -224,7 +220,7 @@ public void Var003() { col1.setString(1, null); int count = col1.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col1", null, connection,output_)); + assertCondition(JDParmHelper.verifyString("col1", null, connection,stringsTable_,output_)); else failed("invalid update count"); @@ -232,7 +228,7 @@ public void Var003() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -269,7 +265,7 @@ public void Var004() { else failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -286,7 +282,7 @@ public void Var005() { if (getDriver () == JDTestDriver.DRIVER_TOOLBOX) expected = "0123456789012345678900000000000000000000"; if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", expected, connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", expected, connection,stringsTable_,output_)); else failed("invalid update count"); @@ -294,7 +290,7 @@ public void Var005() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -312,7 +308,7 @@ public void Var006() { expected = "0123456789000000000000000000000000000000"; if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", expected, connection, output_)); + assertCondition(JDParmHelper.verifyString("col2", expected, connection, stringsTable_, output_)); else failed("invalid update count"); @@ -320,7 +316,7 @@ public void Var006() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -336,7 +332,7 @@ public void Var007() { if (getDriver () == JDTestDriver.DRIVER_TOOLBOX) expected = "0000000000000000000000000000000000000000"; if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", expected, connection, output_)); + assertCondition(JDParmHelper.verifyString("col2", expected, connection, stringsTable_, output_)); else failed("invalid update count"); @@ -344,7 +340,7 @@ public void Var007() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -361,7 +357,7 @@ public void Var008() { if (getDriver () == JDTestDriver.DRIVER_TOOLBOX) expected = "0000000000000000000000000000000000000000"; if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", expected, connection, output_)); + assertCondition(JDParmHelper.verifyString("col2", expected, connection, stringsTable_, output_)); else failed("invalid update count"); @@ -369,7 +365,7 @@ public void Var008() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -383,7 +379,7 @@ public void Var009() { col2.setString(1, null); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", null, connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", null, connection,stringsTable_,output_)); else failed("invalid update count"); @@ -391,7 +387,7 @@ public void Var009() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -424,7 +420,7 @@ public void Var010() { } catch (SQLException e) { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -439,7 +435,7 @@ public void Var011() { col3.setString(1, largeValue); int count = col3.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col3", largeValue, connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", largeValue, connection,stringsTable_,output_)); else failed("invalid update count"); @@ -450,7 +446,7 @@ public void Var011() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -475,7 +471,7 @@ public void Var012() { for (; 32744 - expected.length() > 0; ) { expected.append("\0"); } - assertCondition(JDParmHelper.verifyString("col3", expected.toString(), connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", expected.toString(), connection,stringsTable_,output_)); } else failed("invalid update count"); @@ -484,7 +480,7 @@ public void Var012() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -506,7 +502,7 @@ public void Var013() { for (; 32744 - expected.length() > 0; ) { expected.append("\0"); } - assertCondition(JDParmHelper.verifyString("col3", expected.toString(), connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", expected.toString(), connection,stringsTable_,output_)); } else failed("invalid update count"); @@ -515,7 +511,7 @@ public void Var013() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -538,7 +534,7 @@ public void Var014() { for (int i = 0; i < 32744; i++) { expected.append("\0"); } - assertCondition(JDParmHelper.verifyString("col3", expected.toString(), connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", expected.toString(), connection,stringsTable_,output_)); } else failed("invalid update count"); @@ -547,7 +543,7 @@ public void Var014() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -561,7 +557,7 @@ public void Var015() { col3.setString(1, null); int count = col3.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col3", null, connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", null, connection,stringsTable_,output_)); else failed("invalid update count"); @@ -569,7 +565,7 @@ public void Var015() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -599,7 +595,7 @@ public void Var016() { else failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -613,7 +609,7 @@ public void Var017() { col4.setString(1, "X"); int count = col4.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col1", "X", connection2,output_)); + assertCondition(JDParmHelper.verifyString("col1", "X", connection2,stringsTable_,output_)); else failed("invalid update count"); @@ -621,7 +617,7 @@ public void Var017() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection2,output_); + JDParmHelper.purgeStringsTable(connection2,stringsTable_,output_); } } @@ -634,7 +630,7 @@ public void Var018() { col4.setString(1, ""); int count = col4.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col1", " ", connection2,output_)); + assertCondition(JDParmHelper.verifyString("col1", " ", connection2,stringsTable_,output_)); else failed("invalid update count"); @@ -642,7 +638,7 @@ public void Var018() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection2,output_); + JDParmHelper.purgeStringsTable(connection2,stringsTable_,output_); } } @@ -656,7 +652,7 @@ public void Var019() { col4.setString(1, null); int count = col4.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col1", null, connection2,output_)); + assertCondition(JDParmHelper.verifyString("col1", null, connection2,stringsTable_,output_)); else failed("invalid update count"); @@ -664,7 +660,7 @@ public void Var019() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection2,output_); + JDParmHelper.purgeStringsTable(connection2,stringsTable_,output_); } } @@ -692,7 +688,7 @@ public void Var020() { } catch (SQLException e) { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -706,7 +702,7 @@ public void Var021() { col5.setString(1, "01234567890123456789"); int count = col5.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", "01234567890123456789", connection2,output_)); + assertCondition(JDParmHelper.verifyString("col2", "01234567890123456789", connection2,stringsTable_,output_)); else failed("invalid update count"); @@ -714,7 +710,7 @@ public void Var021() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection2,output_); + JDParmHelper.purgeStringsTable(connection2,stringsTable_,output_); } } @@ -728,7 +724,7 @@ public void Var022() { col5.setString(1, "0123456789"); int count = col5.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", "0123456789 ", connection2,output_)); + assertCondition(JDParmHelper.verifyString("col2", "0123456789 ", connection2,stringsTable_,output_)); else failed("invalid update count"); @@ -736,7 +732,7 @@ public void Var022() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection2,output_); + JDParmHelper.purgeStringsTable(connection2,stringsTable_,output_); } } @@ -749,7 +745,7 @@ public void Var023() { col5.setString(1, "0"); int count = col5.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", "0 ", connection2,output_)); + assertCondition(JDParmHelper.verifyString("col2", "0 ", connection2,stringsTable_,output_)); else failed("invalid update count"); @@ -757,7 +753,7 @@ public void Var023() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection2,output_); + JDParmHelper.purgeStringsTable(connection2,stringsTable_,output_); } } @@ -771,7 +767,7 @@ public void Var024() { col5.setString(1, ""); int count = col5.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", " ", connection2,output_)); + assertCondition(JDParmHelper.verifyString("col2", " ", connection2,stringsTable_,output_)); else failed("invalid update count"); @@ -779,7 +775,7 @@ public void Var024() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection2,output_); + JDParmHelper.purgeStringsTable(connection2,stringsTable_,output_); } } @@ -793,7 +789,7 @@ public void Var025() { col5.setString(1, null); int count = col5.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", null, connection2,output_)); + assertCondition(JDParmHelper.verifyString("col2", null, connection2,stringsTable_,output_)); else failed("invalid update count"); @@ -801,7 +797,7 @@ public void Var025() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection2,output_); + JDParmHelper.purgeStringsTable(connection2,stringsTable_,output_); } } @@ -828,7 +824,7 @@ public void Var026() { } catch (SQLException e) { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -842,7 +838,7 @@ public void Var027() { col6.setString(1, largeValue); int count = col6.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col3", largeValue, connection2,output_)); + assertCondition(JDParmHelper.verifyString("col3", largeValue, connection2,stringsTable_,output_)); else failed("invalid update count"); @@ -850,7 +846,7 @@ public void Var027() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection2,output_); + JDParmHelper.purgeStringsTable(connection2,stringsTable_,output_); } } @@ -868,7 +864,7 @@ public void Var028() { for (; 32744 - expected.length() > 0; ) { expected.append(" "); } - assertCondition(JDParmHelper.verifyString("col3", expected.toString(), connection2,output_)); + assertCondition(JDParmHelper.verifyString("col3", expected.toString(), connection2,stringsTable_,output_)); } else failed("invalid update count"); @@ -877,7 +873,7 @@ public void Var028() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection2,output_); + JDParmHelper.purgeStringsTable(connection2,stringsTable_,output_); } } @@ -894,7 +890,7 @@ public void Var029() { for (; 32744 - expected.length() > 0; ) { expected.append(" "); } - assertCondition(JDParmHelper.verifyString("col3", expected.toString(), connection2,output_)); + assertCondition(JDParmHelper.verifyString("col3", expected.toString(), connection2,stringsTable_,output_)); } else failed("invalid update count"); @@ -903,7 +899,7 @@ public void Var029() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection2,output_); + JDParmHelper.purgeStringsTable(connection2,stringsTable_,output_); } } @@ -921,7 +917,7 @@ public void Var030() { for (int i = 0; i < 32744; i++) { expected.append(" "); } - assertCondition(JDParmHelper.verifyString("col3", expected.toString(), connection2,output_)); + assertCondition(JDParmHelper.verifyString("col3", expected.toString(), connection2,stringsTable_,output_)); } else failed("invalid update count"); @@ -930,7 +926,7 @@ public void Var030() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection2,output_); + JDParmHelper.purgeStringsTable(connection2,stringsTable_,output_); } } @@ -944,7 +940,7 @@ public void Var031() { col6.setString(1, null); int count = col6.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col3", null, connection2,output_)); + assertCondition(JDParmHelper.verifyString("col3", null, connection2,stringsTable_,output_)); else failed("invalid update count"); @@ -952,7 +948,7 @@ public void Var031() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection2,output_); + JDParmHelper.purgeStringsTable(connection2,stringsTable_, output_); } } @@ -979,7 +975,7 @@ public void Var032() { } catch (SQLException e) { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } diff --git a/src/test/JD/Parm/JDParmStringChar.java b/src/test/JD/Parm/JDParmStringChar.java index 39652d2b..1449e691 100644 --- a/src/test/JD/Parm/JDParmStringChar.java +++ b/src/test/JD/Parm/JDParmStringChar.java @@ -30,6 +30,7 @@ import java.io.FileOutputStream; import java.sql.Connection; import java.sql.PreparedStatement; +import java.sql.ResultSet; import java.sql.SQLException; import java.sql.SQLWarning; import java.sql.Statement; @@ -66,6 +67,7 @@ public static void main(String args[]) throws Exception { public PreparedStatement col2 = null; public PreparedStatement col3 = null; public String largeValue = ""; + private String stringsTable_; /** @@ -100,9 +102,9 @@ protected void setup () connection = testDriver_.getConnection(baseURL_, userId_, encryptedPassword_); Statement s = connection.createStatement(); - + stringsTable_ = JDParmTest.COLLECTION+".strings"; try { - s.executeUpdate("drop table "+JDParmTest.COLLECTION+".strings"); + s.executeUpdate("drop table "+stringsTable_+""); } catch (SQLException e) { JDParmHelper.handleDropException(e,output_); @@ -111,15 +113,15 @@ protected void setup () // Create a table that uses the largest row size the database will // allow me to use. - s.executeUpdate("create table "+JDParmTest.COLLECTION+".strings " + + s.executeUpdate("create table "+stringsTable_+" " + "(col1 char(1), col2 char(20), col3 char (32744))"); s.close(); - col1 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col1) values(?)"); - col2 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col2) values(?)"); - col3 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col3) values(?)"); + col1 = connection.prepareStatement("insert into "+stringsTable_+" (col1) values(?)"); + col2 = connection.prepareStatement("insert into "+stringsTable_+" (col2) values(?)"); + col3 = connection.prepareStatement("insert into "+stringsTable_+" (col3) values(?)"); String shortValue = "abcdefghijklmnopqrstuvwxy"; @@ -165,14 +167,14 @@ public void Var001() { int count = col1.executeUpdate(); if (count == 1) // assertCondition(JDParmHelper.verifyString("col1", "X", connection)); - assertCondition(JDParmHelper.verifyString("col1", "X", connection,output_)); + assertCondition(JDParmHelper.verifyString("col1", "X", connection,stringsTable_,output_)); else failed ("invalid update count"); } catch (SQLException e) { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -185,7 +187,7 @@ public void Var002() { col1.setString(1, ""); int count = col1.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col1", " ", connection,output_)); + assertCondition(JDParmHelper.verifyString("col1", " ", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -193,7 +195,7 @@ public void Var002() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -207,7 +209,7 @@ public void Var003() { col1.setString(1, null); int count = col1.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col1", null, connection,output_)); + assertCondition(JDParmHelper.verifyString("col1", null, connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -215,7 +217,7 @@ public void Var003() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -244,7 +246,7 @@ public void Var004() { } catch (SQLException e) { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -258,7 +260,7 @@ public void Var005() { col2.setString(1, "01234567890123456789"); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", "01234567890123456789", connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", "01234567890123456789", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -266,7 +268,7 @@ public void Var005() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -280,7 +282,7 @@ public void Var006() { col2.setString(1, "0123456789"); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", "0123456789 ", connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", "0123456789 ", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -288,7 +290,7 @@ public void Var006() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -301,7 +303,7 @@ public void Var007() { col2.setString(1, "0"); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", "0 ", connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", "0 ", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -309,7 +311,7 @@ public void Var007() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -323,7 +325,7 @@ public void Var008() { col2.setString(1, ""); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", " ", connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", " ", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -331,7 +333,7 @@ public void Var008() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -345,7 +347,7 @@ public void Var009() { col2.setString(1, null); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", null, connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", null, connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -353,7 +355,7 @@ public void Var009() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -380,7 +382,7 @@ public void Var010() { } catch (SQLException e) { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -394,7 +396,7 @@ public void Var011() { col3.setString(1, largeValue); int count = col3.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col3", largeValue, connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", largeValue, connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -402,7 +404,7 @@ public void Var011() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -420,7 +422,7 @@ public void Var012() { for (; 32744 - expected.length() > 0; ) { expected.append(" "); } - assertCondition(JDParmHelper.verifyString("col3", expected.toString(), connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", expected.toString(), connection,stringsTable_,output_)); } else failed ("invalid update count"); @@ -429,7 +431,7 @@ public void Var012() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -446,7 +448,7 @@ public void Var013() { for (; 32744 - expected.length() > 0; ) { expected.append(" "); } - assertCondition(JDParmHelper.verifyString("col3", expected.toString(), connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", expected.toString(), connection,stringsTable_,output_)); } else failed ("invalid update count"); @@ -455,7 +457,7 @@ public void Var013() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -473,7 +475,7 @@ public void Var014() { for (int i = 0; i < 32744; i++) { expected.append(" "); } - assertCondition(JDParmHelper.verifyString("col3", expected.toString(), connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", expected.toString(), connection,stringsTable_,output_)); } else failed ("invalid update count"); @@ -482,7 +484,7 @@ public void Var014() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -496,7 +498,7 @@ public void Var015() { col3.setString(1, null); int count = col3.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col3", null, connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", null, connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -504,7 +506,7 @@ public void Var015() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -531,7 +533,7 @@ public void Var016() { } catch (SQLException e) { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } /** @@ -571,13 +573,13 @@ public void Var017() { ( 12000 < i && i < 14000) || ( 28000 < i && i < 29000) || ( 57000 < i && i < 63000 )) { - try { - PreparedStatement ps = connection.prepareStatement("SELECT CAST(? AS CHAR(4) CCSID "+i+" ) FROM SYSIBM.SYSDUMMY1"); - try { + try (PreparedStatement ps = connection.prepareStatement("SELECT CAST(? AS CHAR(4) CCSID "+i+" ) FROM SYSIBM.SYSDUMMY1"); ) { + + try { output_.println("Testing CCSID "+i); ps.setString(1,value); SQLWarning warning = ps.getWarnings(); - ps.executeQuery(); + ResultSet rs = ps.executeQuery(); if (warning == null) { warning = ps.getWarnings(); } @@ -611,6 +613,7 @@ public void Var017() { } } + rs.close(); } catch (Exception e) { passed = false; sb.append("Unexpected exception for CCSID "+i); diff --git a/src/test/JD/Parm/JDParmStringCharHex.java b/src/test/JD/Parm/JDParmStringCharHex.java index bd4aaf49..c66b8cd5 100644 --- a/src/test/JD/Parm/JDParmStringCharHex.java +++ b/src/test/JD/Parm/JDParmStringCharHex.java @@ -72,6 +72,7 @@ public static void main(String args[]) throws Exception { public Connection connection = null; public Statement s = null; public ResultSet rs = null; + private String stringsTable_; /** @@ -105,30 +106,20 @@ protected void setup () // to get the connection. connection = testDriver_.getConnection(baseURL_, userId_, encryptedPassword_); + stringsTable_ = JDParmTest.COLLECTION+".strchrhex"; s = connection.createStatement(); - try { - s.executeUpdate("drop table "+JDParmTest.COLLECTION+".strings"); - } catch (SQLException e) { - String message = e.toString(); - if (message.indexOf("not found") > 0 && - message.indexOf("type *FILE") > 0) { - } else { - output_.println("Warning .. could not delete strings"); - e.printStackTrace(); + - } - } + s.executeUpdate("create or replace table "+stringsTable_+" (col1 char(10)) on replace delete rows"); - s.executeUpdate("create table "+JDParmTest.COLLECTION+".strings (col1 char(10)) "); + s.executeUpdate("insert into "+stringsTable_+" values(x'00000000000000000000') "); + s.executeUpdate("insert into "+stringsTable_+" values(x'0000000000C100000000') "); + s.executeUpdate("insert into "+stringsTable_+" values(x'C1C1C1C1C100C1C1C1C1') "); + s.executeUpdate("insert into "+stringsTable_+" values(x'00C1C1C1C1C1C1C1C1C1') "); + s.executeUpdate("insert into "+stringsTable_+" values(x'C1C1C1C1C1C1C1C1C100') "); - s.executeUpdate("insert into "+JDParmTest.COLLECTION+".strings values(x'00000000000000000000') "); - s.executeUpdate("insert into "+JDParmTest.COLLECTION+".strings values(x'0000000000C100000000') "); - s.executeUpdate("insert into "+JDParmTest.COLLECTION+".strings values(x'C1C1C1C1C100C1C1C1C1') "); - s.executeUpdate("insert into "+JDParmTest.COLLECTION+".strings values(x'00C1C1C1C1C1C1C1C1C1') "); - s.executeUpdate("insert into "+JDParmTest.COLLECTION+".strings values(x'C1C1C1C1C1C1C1C1C100') "); - - rs = s.executeQuery("select * from "+JDParmTest.COLLECTION+".strings"); + rs = s.executeQuery("select * from "+stringsTable_+""); } catch (Exception e) { output_.println("Caught exception: " + e.getMessage()); diff --git a/src/test/JD/Parm/JDParmStringClob.java b/src/test/JD/Parm/JDParmStringClob.java index 23da0ff9..4281d794 100644 --- a/src/test/JD/Parm/JDParmStringClob.java +++ b/src/test/JD/Parm/JDParmStringClob.java @@ -68,6 +68,7 @@ public static void main(String args[]) throws Exception { public PreparedStatement col4 = null; public String largeValue = ""; public String hugeValue = ""; + private String stringsTable_; /** @@ -102,29 +103,25 @@ protected void setup () connection = testDriver_.getConnection(baseURL_, userId_, encryptedPassword_); Statement s = connection.createStatement(); - - try { - s.executeUpdate("drop table "+JDParmTest.COLLECTION+".strings"); - } catch (SQLException e) { - // Ignore it. - } + + stringsTable_ = JDParmTest.COLLECTION+".strclob"; // Create a table that uses the largest row size the database will // allow me to use. - s.executeUpdate("create table "+JDParmTest.COLLECTION+".strings " + + s.executeUpdate("create or replace table "+stringsTable_+" " + "(col1 clob(1), " + "col2 clob(20), " + "col3 clob (32714), " + - "col4 clob (2000000) )"); + "col4 clob (2000000) ) on replace delete rows "); s.close(); - col1 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col1) values(?)"); - col2 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col2) values(?)"); - col3 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col3) values(?)"); - col4 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col4) values(?)"); + col1 = connection.prepareStatement("insert into "+stringsTable_+" (col1) values(?)"); + col2 = connection.prepareStatement("insert into "+stringsTable_+" (col2) values(?)"); + col3 = connection.prepareStatement("insert into "+stringsTable_+" (col3) values(?)"); + col4 = connection.prepareStatement("insert into "+stringsTable_+" (col4) values(?)"); String shortValue = "abcdefghijklmnopqrstuvwxy"; @@ -171,7 +168,7 @@ public void Var001() { col1.setString(1, "X"); int count = col1.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col1", "X", connection,output_)); + assertCondition(JDParmHelper.verifyString("col1", "X", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -179,7 +176,7 @@ public void Var001() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -192,7 +189,7 @@ public void Var002() { col1.setString(1, ""); int count = col1.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col1", "", connection,output_)); + assertCondition(JDParmHelper.verifyString("col1", "", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -200,7 +197,7 @@ public void Var002() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -214,7 +211,7 @@ public void Var003() { col1.setString(1, null); int count = col1.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col1", null, connection,output_)); + assertCondition(JDParmHelper.verifyString("col1", null, connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -222,7 +219,7 @@ public void Var003() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -257,7 +254,7 @@ public void Var004() { } catch (SQLException e) { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -271,7 +268,7 @@ public void Var005() { col2.setString(1, "01234567890123456789"); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", "01234567890123456789", connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", "01234567890123456789", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -279,7 +276,7 @@ public void Var005() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -293,7 +290,7 @@ public void Var006() { col2.setString(1, "0123456789"); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", "0123456789", connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", "0123456789", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -301,7 +298,7 @@ public void Var006() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -314,7 +311,7 @@ public void Var007() { col2.setString(1, "0"); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", "0", connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", "0", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -322,7 +319,7 @@ public void Var007() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -336,7 +333,7 @@ public void Var008() { col2.setString(1, ""); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", "", connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", "", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -344,7 +341,7 @@ public void Var008() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -358,7 +355,7 @@ public void Var009() { col2.setString(1, null); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", null, connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", null, connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -366,7 +363,7 @@ public void Var009() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -402,7 +399,7 @@ public void Var010() { } catch (SQLException e) { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -416,7 +413,7 @@ public void Var011() { col3.setString(1, largeValue); int count = col3.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col3", largeValue, connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", largeValue, connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -424,7 +421,7 @@ public void Var011() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -438,7 +435,7 @@ public void Var012() { col3.setString(1, "0123456789012345678901234567890123456789"); int count = col3.executeUpdate(); if (count == 1) { - assertCondition(JDParmHelper.verifyString("col3", "0123456789012345678901234567890123456789", connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", "0123456789012345678901234567890123456789", connection,stringsTable_,output_)); } else failed ("invalid update count"); @@ -446,7 +443,7 @@ public void Var012() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -459,7 +456,7 @@ public void Var013() { col3.setString(1, "0"); int count = col3.executeUpdate(); if (count == 1) { - assertCondition(JDParmHelper.verifyString("col3", "0", connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", "0", connection,stringsTable_,output_)); } else failed ("invalid update count"); @@ -467,7 +464,7 @@ public void Var013() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -481,7 +478,7 @@ public void Var014() { col3.setString(1, ""); int count = col3.executeUpdate(); if (count == 1) { - assertCondition(JDParmHelper.verifyString("col3", "", connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", "", connection,stringsTable_,output_)); } else failed ("invalid update count"); @@ -489,7 +486,7 @@ public void Var014() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -503,7 +500,7 @@ public void Var015() { col3.setString(1, null); int count = col3.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col3", null, connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", null, connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -511,7 +508,7 @@ public void Var015() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -545,7 +542,7 @@ public void Var016() { } catch (SQLException e) { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -559,7 +556,7 @@ public void Var017() { col4.setString(1, hugeValue); int count = col4.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col4", hugeValue, connection,output_)); + assertCondition(JDParmHelper.verifyString("col4", hugeValue, connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -567,7 +564,7 @@ public void Var017() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -581,7 +578,7 @@ public void Var018() { col4.setString(1, "0123456789012345678901234567890123456789"); int count = col4.executeUpdate(); if (count == 1) { - assertCondition(JDParmHelper.verifyString("col4", "0123456789012345678901234567890123456789", connection,output_)); + assertCondition(JDParmHelper.verifyString("col4", "0123456789012345678901234567890123456789", connection,stringsTable_,output_)); } else failed ("invalid update count"); @@ -589,7 +586,7 @@ public void Var018() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -602,7 +599,7 @@ public void Var019() { col4.setString(1, "0"); int count = col4.executeUpdate(); if (count == 1) { - assertCondition(JDParmHelper.verifyString("col4", "0", connection,output_)); + assertCondition(JDParmHelper.verifyString("col4", "0", connection,stringsTable_,output_)); } else failed ("invalid update count"); @@ -610,7 +607,7 @@ public void Var019() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -624,7 +621,7 @@ public void Var020() { col4.setString(1, ""); int count = col4.executeUpdate(); if (count == 1) { - assertCondition(JDParmHelper.verifyString("col4", "", connection,output_)); + assertCondition(JDParmHelper.verifyString("col4", "", connection,stringsTable_,output_)); } else failed ("invalid update count"); @@ -632,7 +629,7 @@ public void Var020() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -646,7 +643,7 @@ public void Var021() { col4.setString(1, null); int count = col4.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col4", null, connection,output_)); + assertCondition(JDParmHelper.verifyString("col4", null, connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -654,7 +651,7 @@ public void Var021() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -681,7 +678,7 @@ public void Var022() { } catch (SQLException e) { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } diff --git a/src/test/JD/Parm/JDParmStringDbclob.java b/src/test/JD/Parm/JDParmStringDbclob.java index 97e084a9..3224ed06 100644 --- a/src/test/JD/Parm/JDParmStringDbclob.java +++ b/src/test/JD/Parm/JDParmStringDbclob.java @@ -65,6 +65,7 @@ public static void main(String args[]) throws Exception { public PreparedStatement col2 = null; public PreparedStatement col3 = null; public PreparedStatement col4 = null; + private String stringsTable_; /** @@ -100,27 +101,24 @@ protected void setup () Statement s = connection.createStatement(); - try { - s.executeUpdate("drop table "+JDParmTest.COLLECTION+".strings"); - } catch (SQLException e) { - // Ignore it. - } + stringsTable_ = JDParmTest.COLLECTION+".strdbc"; + // Create a table that uses the largest row size the database will // allow me to use. - s.executeUpdate("create table "+JDParmTest.COLLECTION+".strings " + + s.executeUpdate("create or replace table "+stringsTable_+" " + "(col1 dbclob(1), " + "col2 dbclob(20), " + "col3 dbclob (32714), " + - "col4 dbclob (2000000) )"); + "col4 dbclob (2000000) ) on replace delete rows"); s.close(); - col1 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col1) values(?)"); - col2 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col2) values(?)"); - col3 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col3) values(?)"); - col4 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col4) values(?)"); + col1 = connection.prepareStatement("insert into "+stringsTable_+" (col1) values(?)"); + col2 = connection.prepareStatement("insert into "+stringsTable_+" (col2) values(?)"); + col3 = connection.prepareStatement("insert into "+stringsTable_+" (col3) values(?)"); + col4 = connection.prepareStatement("insert into "+stringsTable_+" (col4) values(?)"); } catch (Exception e) { output_.println("Caught exception: " + e.getMessage()); @@ -159,7 +157,7 @@ public void Var001() { col1.setString(1, inValue); int count = col1.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col1", inValue, connection,output_)); + assertCondition(JDParmHelper.verifyString("col1", inValue, connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -167,7 +165,7 @@ public void Var001() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -180,7 +178,7 @@ public void Var002() { col1.setString(1, ""); int count = col1.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col1", "", connection,output_)); + assertCondition(JDParmHelper.verifyString("col1", "", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -188,7 +186,7 @@ public void Var002() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -202,7 +200,7 @@ public void Var003() { col1.setString(1, null); int count = col1.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col1", null, connection,output_)); + assertCondition(JDParmHelper.verifyString("col1", null, connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -210,7 +208,7 @@ public void Var003() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -250,7 +248,7 @@ public void Var004() { } catch (SQLException e) { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -270,7 +268,7 @@ public void Var005() { col2.setString(1, inValue); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", inValue, connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", inValue, connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -278,7 +276,7 @@ public void Var005() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -298,7 +296,7 @@ public void Var006() { col2.setString(1, inValue); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", inValue, connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", inValue, connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -306,7 +304,7 @@ public void Var006() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -323,7 +321,7 @@ public void Var007() { col2.setString(1, inValue); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", inValue, connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", inValue, connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -331,7 +329,7 @@ public void Var007() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -345,7 +343,7 @@ public void Var008() { col2.setString(1, ""); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", "", connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", "", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -353,7 +351,7 @@ public void Var008() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -367,7 +365,7 @@ public void Var009() { col2.setString(1, null); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", null, connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", null, connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -375,7 +373,7 @@ public void Var009() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -415,7 +413,7 @@ public void Var010() { } catch (SQLException e) { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -435,7 +433,7 @@ public void Var011() { col3.setString(1, inValue); int count = col3.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col3", inValue, connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", inValue, connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -443,7 +441,7 @@ public void Var011() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -463,7 +461,7 @@ public void Var012() { col3.setString(1, inValue); int count = col3.executeUpdate(); if (count == 1) { - assertCondition(JDParmHelper.verifyString("col3", inValue, connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", inValue, connection,stringsTable_,output_)); } else failed ("invalid update count"); @@ -472,7 +470,7 @@ public void Var012() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -489,7 +487,7 @@ public void Var013() { col3.setString(1, inValue); int count = col3.executeUpdate(); if (count == 1) { - assertCondition(JDParmHelper.verifyString("col3", inValue, connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", inValue, connection,stringsTable_,output_)); } else failed ("invalid update count"); @@ -498,7 +496,7 @@ public void Var013() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -512,7 +510,7 @@ public void Var014() { col3.setString(1, ""); int count = col3.executeUpdate(); if (count == 1) { - assertCondition(JDParmHelper.verifyString("col3", "", connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", "", connection,stringsTable_,output_)); } else failed ("invalid update count"); @@ -521,7 +519,7 @@ public void Var014() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -535,7 +533,7 @@ public void Var015() { col3.setString(1, null); int count = col3.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col3", null, connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", null, connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -543,7 +541,7 @@ public void Var015() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -580,7 +578,7 @@ public void Var016() { } catch (SQLException e) { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -601,7 +599,7 @@ public void Var017() { col4.setString(1, inValue); int count = col4.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col4", inValue, connection,output_)); + assertCondition(JDParmHelper.verifyString("col4", inValue, connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -609,7 +607,7 @@ public void Var017() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -629,7 +627,7 @@ public void Var018() { col4.setString(1, inValue); int count = col4.executeUpdate(); if (count == 1) { - assertCondition(JDParmHelper.verifyString("col4", inValue, connection,output_)); + assertCondition(JDParmHelper.verifyString("col4", inValue, connection,stringsTable_,output_)); } else failed ("invalid update count"); @@ -638,7 +636,7 @@ public void Var018() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -655,7 +653,7 @@ public void Var019() { col4.setString(1, inValue); int count = col4.executeUpdate(); if (count == 1) { - assertCondition(JDParmHelper.verifyString("col4", inValue, connection,output_)); + assertCondition(JDParmHelper.verifyString("col4", inValue, connection,stringsTable_,output_)); } else failed ("invalid update count"); @@ -664,7 +662,7 @@ public void Var019() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -678,7 +676,7 @@ public void Var020() { col4.setString(1, ""); int count = col4.executeUpdate(); if (count == 1) { - assertCondition(JDParmHelper.verifyString("col4", "", connection,output_)); + assertCondition(JDParmHelper.verifyString("col4", "", connection,stringsTable_,output_)); } else failed ("invalid update count"); @@ -687,7 +685,7 @@ public void Var020() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -701,7 +699,7 @@ public void Var021() { col4.setString(1, null); int count = col4.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col4", null, connection,output_)); + assertCondition(JDParmHelper.verifyString("col4", null, connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -709,7 +707,7 @@ public void Var021() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -746,7 +744,7 @@ public void Var022() { } catch (SQLException e) { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } diff --git a/src/test/JD/Parm/JDParmStringDecimal.java b/src/test/JD/Parm/JDParmStringDecimal.java index c23cf5cb..96e3d92b 100644 --- a/src/test/JD/Parm/JDParmStringDecimal.java +++ b/src/test/JD/Parm/JDParmStringDecimal.java @@ -79,6 +79,7 @@ public static void main(String args[]) throws Exception { public PreparedStatement col5 = null; public PreparedStatement col6 = null; public String largeValue = ""; + private String stringsTable_; /** @@ -114,15 +115,18 @@ protected void setup () Statement s = connection.createStatement(); + stringsTable_ = JDParmTest.COLLECTION+".strdec"; + + try { - s.executeUpdate("drop table "+JDParmTest.COLLECTION+".strings"); + s.executeUpdate("drop table "+stringsTable_+""); } catch (SQLException e) { // Ignore it. } // Create a table that uses the largest row size the database will // allow me to use. - s.executeUpdate("create table "+JDParmTest.COLLECTION+".strings " + + s.executeUpdate("create table "+stringsTable_+" " + "(col1 Decimal (1, 0), " + " col2 Decimal (5, 0), " + " col3 Decimal (10, 0), " + @@ -132,11 +136,11 @@ protected void setup () s.close(); - col1 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col1) values(?)"); - col2 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col2) values(?)"); - col3 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col3) values(?)"); - col4 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col4) values(?)"); - col5 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col5) values(?)"); + col1 = connection.prepareStatement("insert into "+stringsTable_+" (col1) values(?)"); + col2 = connection.prepareStatement("insert into "+stringsTable_+" (col2) values(?)"); + col3 = connection.prepareStatement("insert into "+stringsTable_+" (col3) values(?)"); + col4 = connection.prepareStatement("insert into "+stringsTable_+" (col4) values(?)"); + col5 = connection.prepareStatement("insert into "+stringsTable_+" (col5) values(?)"); String shortValue = "abcdefghijklmnopqrstuvwxy"; @@ -181,7 +185,7 @@ public void Var001() { col1.setString(1, "1"); int count = col1.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col1", "1", connection,output_)); + assertCondition(JDParmHelper.verifyString("col1", "1", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -189,7 +193,7 @@ public void Var001() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -209,7 +213,7 @@ public void Var002() { assertCondition(true); //output_.println(e.getMessage()); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -229,7 +233,7 @@ public void Var003() { // TODO: Look this stuff up in the real SQL reference.... assertCondition(true); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -243,7 +247,7 @@ public void Var004() { col1.setString(1, null); int count = col1.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col1", null, connection,output_)); + assertCondition(JDParmHelper.verifyString("col1", null, connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -251,7 +255,7 @@ public void Var004() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -278,7 +282,7 @@ public void Var005() { } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -293,7 +297,7 @@ public void Var006() { col1.setString(1, "1.2"); int count = col1.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col1", "1", connection,output_)); + assertCondition(JDParmHelper.verifyString("col1", "1", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -301,7 +305,7 @@ public void Var006() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -315,7 +319,7 @@ public void Var007() { col2.setString(1, "12345"); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", "12345", connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", "12345", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -323,7 +327,7 @@ public void Var007() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -337,7 +341,7 @@ public void Var008() { col2.setString(1, "1"); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", "1", connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", "1", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -345,7 +349,7 @@ public void Var008() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -364,7 +368,7 @@ public void Var009() { // TODO: Look this stuff up in the real SQL reference.... assertCondition(true); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -378,7 +382,7 @@ public void Var010() { col2.setString(1, null); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", null, connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", null, connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -386,7 +390,7 @@ public void Var010() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -412,7 +416,7 @@ public void Var011() { assertSqlException(e, -99999, "07006", "Data type mismatch", "Mismatch instead of truncation in latest toolbox "); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -430,7 +434,7 @@ public void Var012() { col2.setString(1, "12345.6"); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", "12345", connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", "12345", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -438,7 +442,7 @@ public void Var012() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -452,7 +456,7 @@ public void Var013() { col3.setString(1, "1234567890"); int count = col3.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col3", "1234567890", connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", "1234567890", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -460,7 +464,7 @@ public void Var013() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -474,7 +478,7 @@ public void Var014() { col3.setString(1, "1"); int count = col3.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col3", "1", connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", "1", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -482,7 +486,7 @@ public void Var014() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -501,7 +505,7 @@ public void Var015() { // TODO: Look this stuff up in the real SQL reference.... assertCondition(true); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -515,7 +519,7 @@ public void Var016() { col3.setString(1, null); int count = col3.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col3", null, connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", null, connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -523,7 +527,7 @@ public void Var016() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -539,7 +543,7 @@ public void Var017() { col3.setString(1, value); int count = col3.executeUpdate(); failed("inserted a value without truncation "+count); - assertCondition(JDParmHelper.verifyString("col3", "12345", connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", "12345", connection,stringsTable_,output_)); } catch (DataTruncation dt) { assertCondition ((dt.getIndex() == 1) @@ -551,7 +555,7 @@ public void Var017() { assertSqlException(e, -99999, "07006", "Data type mismatch", "Mismatch instead of truncation in latest toolbox "); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -566,7 +570,7 @@ public void Var018() { col3.setString(1, "1234567890.1"); int count = col3.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col3", "1234567890", connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", "1234567890", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -574,7 +578,7 @@ public void Var018() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -588,7 +592,7 @@ public void Var019() { col4.setString(1, "0.12345"); int count = col4.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col4", "0.12345", connection,output_)); + assertCondition(JDParmHelper.verifyString("col4", "0.12345", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -596,7 +600,7 @@ public void Var019() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -610,7 +614,7 @@ public void Var020() { col4.setString(1, ".12345"); int count = col4.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col4", "0.12345", connection,output_)); + assertCondition(JDParmHelper.verifyString("col4", "0.12345", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -618,7 +622,7 @@ public void Var020() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -637,7 +641,7 @@ public void Var021() { col4.setString(1, ".1"); int count = col4.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col4", "0.10000", connection,output_)); + assertCondition(JDParmHelper.verifyString("col4", "0.10000", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -645,7 +649,7 @@ public void Var021() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -664,7 +668,7 @@ public void Var022() { // TODO: Look this stuff up in the real SQL reference.... assertCondition(true); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -678,7 +682,7 @@ public void Var023() { col4.setString(1, null); int count = col4.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col4", null, connection,output_)); + assertCondition(JDParmHelper.verifyString("col4", null, connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -686,7 +690,7 @@ public void Var023() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -700,7 +704,7 @@ public void Var024() { col4.setString(1, ".123456"); int count = col4.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col4", "0.12345", connection,output_)); + assertCondition(JDParmHelper.verifyString("col4", "0.12345", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -708,7 +712,7 @@ public void Var024() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -747,7 +751,7 @@ public void Var025() { assertSqlException(e, -99999, "07006", "Data type mismatch", "Mismatch instead of truncation in latest toolbox "); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -760,7 +764,7 @@ public void Var026() { col5.setString(1, "0."); int count = col5.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col5", "0.0", connection,output_)); + assertCondition(JDParmHelper.verifyString("col5", "0.0", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -768,7 +772,7 @@ public void Var026() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -782,7 +786,7 @@ public void Var027() { col5.setString(1, "0.2"); int count = col5.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col5", "0.2", connection,output_)); + assertCondition(JDParmHelper.verifyString("col5", "0.2", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -790,7 +794,7 @@ public void Var027() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -803,7 +807,7 @@ public void Var028() { col5.setString(1, "000000."); int count = col5.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col5", "0.0", connection,output_)); + assertCondition(JDParmHelper.verifyString("col5", "0.0", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -811,7 +815,7 @@ public void Var028() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } diff --git a/src/test/JD/Parm/JDParmStringGraphic.java b/src/test/JD/Parm/JDParmStringGraphic.java index acb59298..ed36fbf3 100644 --- a/src/test/JD/Parm/JDParmStringGraphic.java +++ b/src/test/JD/Parm/JDParmStringGraphic.java @@ -35,10 +35,10 @@ /* Some notes to myself... -create table "+JDParmTest.COLLECTION+".unicode (col1 graphic(10) ccsid 13488) -create table "+JDParmTest.COLLECTION+".mixed (col1 char(10) ccsid 937) -create table "+JDParmTest.COLLECTION+".char(col1 char(10) ccsid 37) -create table "+JDParmTest.COLLECTION+".graphic (col1 graphic(10) ccsid 835) +create table "+stringsTable_+".unicode (col1 graphic(10) ccsid 13488) +create table "+stringsTable_+".mixed (col1 char(10) ccsid 937) +create table "+stringsTable_+".char(col1 char(10) ccsid 37) +create table "+stringsTable_+".graphic (col1 graphic(10) ccsid 835) space char: unicode 0020 @@ -92,6 +92,7 @@ public static void main(String args[]) throws Exception { public PreparedStatement col2 = null; public PreparedStatement col3 = null; public String largeValue = ""; + private String stringsTable_; /** @@ -127,8 +128,10 @@ protected void setup () Statement s = connection.createStatement(); + stringsTable_ = JDParmTest.COLLECTION+".strgraphic"; + try { - s.executeUpdate("drop table "+JDParmTest.COLLECTION+".strings"); + s.executeUpdate("drop table "+stringsTable_+""); } catch (SQLException e) { JDParmHelper.handleDropException(e,output_); // Ignore it. @@ -136,7 +139,7 @@ protected void setup () // Create a table that uses the largest row size the database will // allow me to use. - s.executeUpdate("create table "+JDParmTest.COLLECTION+".strings " + + s.executeUpdate("create table "+stringsTable_+" " + "(col1 graphic(1) ccsid 835, " + " col2 graphic(20) ccsid 835, " + " col3 graphic (16361) ccsid 835)"); @@ -144,9 +147,9 @@ protected void setup () s.close(); - col1 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col1) values(?)"); - col2 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col2) values(?)"); - col3 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col3) values(?)"); + col1 = connection.prepareStatement("insert into "+stringsTable_+" (col1) values(?)"); + col2 = connection.prepareStatement("insert into "+stringsTable_+" (col2) values(?)"); + col3 = connection.prepareStatement("insert into "+stringsTable_+" (col3) values(?)"); } catch (Exception e) { output_.println("Caught exception: " + e.getMessage()); @@ -185,7 +188,7 @@ public void Var001() { col1.setString(1, inValue); int count = col1.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyGraphic("col1", inValue, 1, connection)); + assertCondition(JDParmHelper.verifyGraphic("col1", inValue, 1, connection, stringsTable_)); else failed ("invalid update count"); @@ -193,7 +196,7 @@ public void Var001() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -206,7 +209,7 @@ public void Var002() { col1.setString(1, ""); int count = col1.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyGraphic("col1", "", 1, connection)); + assertCondition(JDParmHelper.verifyGraphic("col1", "", 1, connection,stringsTable_)); else failed ("invalid update count"); @@ -214,7 +217,7 @@ public void Var002() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -228,7 +231,7 @@ public void Var003() { col1.setString(1, null); int count = col1.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyGraphic("col1", null, 0, connection)); + assertCondition(JDParmHelper.verifyGraphic("col1", null, 0, connection,stringsTable_)); else failed ("invalid update count"); @@ -236,7 +239,7 @@ public void Var003() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -276,7 +279,7 @@ public void Var004() { } catch (SQLException e) { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -296,7 +299,7 @@ public void Var005() { col2.setString(1, inValue); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyGraphic("col2", inValue, 20, connection)); + assertCondition(JDParmHelper.verifyGraphic("col2", inValue, 20, connection,stringsTable_)); else failed ("invalid update count"); @@ -304,7 +307,7 @@ public void Var005() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -324,7 +327,7 @@ public void Var006() { col2.setString(1, inValue); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyGraphic("col2", inValue, 20, connection)); + assertCondition(JDParmHelper.verifyGraphic("col2", inValue, 20, connection,stringsTable_)); else failed ("invalid update count"); @@ -332,7 +335,7 @@ public void Var006() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -349,7 +352,7 @@ public void Var007() { col2.setString(1, inValue); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyGraphic("col2", inValue, 20, connection)); + assertCondition(JDParmHelper.verifyGraphic("col2", inValue, 20, connection,stringsTable_)); else failed ("invalid update count"); @@ -357,7 +360,7 @@ public void Var007() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -371,7 +374,7 @@ public void Var008() { col2.setString(1, ""); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyGraphic("col2", "", 20, connection)); + assertCondition(JDParmHelper.verifyGraphic("col2", "", 20, connection,stringsTable_)); else failed ("invalid update count"); @@ -379,7 +382,7 @@ public void Var008() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -393,7 +396,7 @@ public void Var009() { col2.setString(1, null); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyGraphic("col2", null, 0, connection)); + assertCondition(JDParmHelper.verifyGraphic("col2", null, 0, connection,stringsTable_)); else failed ("invalid update count"); @@ -401,7 +404,7 @@ public void Var009() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -441,7 +444,7 @@ public void Var010() { } catch (SQLException e) { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -461,7 +464,7 @@ public void Var011() { col3.setString(1, inValue); int count = col3.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyGraphic("col3", inValue, 16361, connection)); + assertCondition(JDParmHelper.verifyGraphic("col3", inValue, 16361, connection,stringsTable_)); else failed ("invalid update count"); @@ -469,7 +472,7 @@ public void Var011() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -489,7 +492,7 @@ public void Var012() { col3.setString(1, inValue); int count = col3.executeUpdate(); if (count == 1) { - assertCondition(JDParmHelper.verifyGraphic("col3", inValue, 16361, connection)); + assertCondition(JDParmHelper.verifyGraphic("col3", inValue, 16361, connection,stringsTable_)); } else failed ("invalid update count"); @@ -498,7 +501,7 @@ public void Var012() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -515,7 +518,7 @@ public void Var013() { col3.setString(1, inValue); int count = col3.executeUpdate(); if (count == 1) { - assertCondition(JDParmHelper.verifyGraphic("col3", inValue, 16361, connection)); + assertCondition(JDParmHelper.verifyGraphic("col3", inValue, 16361, connection,stringsTable_)); } else failed ("invalid update count"); @@ -524,7 +527,7 @@ public void Var013() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -538,7 +541,7 @@ public void Var014() { col3.setString(1, ""); int count = col3.executeUpdate(); if (count == 1) { - assertCondition(JDParmHelper.verifyGraphic("col3", "", 16361, connection)); + assertCondition(JDParmHelper.verifyGraphic("col3", "", 16361, connection,stringsTable_)); } else failed ("invalid update count"); @@ -547,7 +550,7 @@ public void Var014() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -561,7 +564,7 @@ public void Var015() { col3.setString(1, null); int count = col3.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyGraphic("col3", null, 0, connection)); + assertCondition(JDParmHelper.verifyGraphic("col3", null, 0, connection,stringsTable_)); else failed ("invalid update count"); @@ -569,7 +572,7 @@ public void Var015() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -609,7 +612,7 @@ public void Var016() { } catch (SQLException e) { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } diff --git a/src/test/JD/Parm/JDParmStringLarge.java b/src/test/JD/Parm/JDParmStringLarge.java index 5544c998..be8f1dd0 100644 --- a/src/test/JD/Parm/JDParmStringLarge.java +++ b/src/test/JD/Parm/JDParmStringLarge.java @@ -11,12 +11,6 @@ // /////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////// -// -// -// -// -// //////////////////////////////////////////////////////////////////////// // // File Name: JDParmStringLarge.java @@ -24,11 +18,6 @@ // Classes: JDParmStringLarge // //////////////////////////////////////////////////////////////////////// -// -// -// -// -//////////////////////////////////////////////////////////////////////// package test.JD.Parm; @@ -107,7 +96,10 @@ public static void main(String args[]) throws Exception { public String largeSql = ""; public String hugeSql = ""; - int vrm = 0 ; + int vrm = 0 ; + + + private PreparedStatement ps1; @@ -156,51 +148,20 @@ protected void setup () graphictable = JDParmTest.COLLECTION+".jdparmlrg9"; vargraphictable = JDParmTest.COLLECTION+".jdparmlrgA"; - try { s.executeUpdate("drop table "+ chartable ); } catch (SQLException e) { - JDParmHelper.handleDropException(e,output_); -} - try { s.executeUpdate("drop table "+ varchartable ); } catch (SQLException e) { - JDParmHelper.handleDropException(e,output_); - } - try { s.executeUpdate("drop table "+ clobtable ); } catch (SQLException e) { - JDParmHelper.handleDropException(e,output_); - } - try { s.executeUpdate("drop table "+ dbclobtable ); } catch (SQLException e) { - JDParmHelper.handleDropException(e,output_); -} - try { s.executeUpdate("drop table "+ wchartable ); } catch (SQLException e) { - JDParmHelper.handleDropException(e,output_); - } - try { s.executeUpdate("drop table "+ wvarchartable );} catch (SQLException e) { - JDParmHelper.handleDropException(e,output_); -} - try { s.executeUpdate("drop table "+ numerictable ); } catch (SQLException e) { - JDParmHelper.handleDropException(e,output_); - } - try { s.executeUpdate("drop table "+ decimaltable ); } catch (SQLException e) { - JDParmHelper.handleDropException(e,output_); -} - try { s.executeUpdate("drop table "+ graphictable ); } catch (SQLException e) { - JDParmHelper.handleDropException(e,output_); - } - try { s.executeUpdate("drop table "+ vargraphictable );} catch (SQLException e) { -JDParmHelper.handleDropException(e,output_); - - } // Create with all types of columns - s.executeUpdate("create table "+chartable+ "(cchar char(32000))"); - s.executeUpdate("create table "+varchartable+ "(cvarchar varchar(32000)) "); - s.executeUpdate("create table "+clobtable+ "(cclob clob (40000000))"); - s.executeUpdate("create table "+dbclobtable+ "(cdbclob dbclob (40000000) CCSID 13488)"); - s.executeUpdate("create table "+wchartable+ "(cwchar graphic(16000) CCSID 13488) "); - s.executeUpdate("create table "+wvarchartable+ "(cwvarchar vargraphic(16000) CCSID 13488 )"); - s.executeUpdate("create table "+numerictable+ "(cnumeric numeric(10,10))"); - s.executeUpdate("create table "+decimaltable+ "(cdecimal decimal(10,10))"); - s.executeUpdate("create table "+graphictable+ "(cgraphic graphic(16000) CCSID 835 ) "); - s.executeUpdate("create table "+vargraphictable+ "(cvargraphic vargraphic(16000) CCSID 835 )"); + s.executeUpdate("create or replace table "+chartable+ "(cchar char(32000)) on replace delete rows"); + s.executeUpdate("create or replace table "+varchartable+ "(cvarchar varchar(32000)) on replace delete rows"); + s.executeUpdate("create or replace table "+clobtable+ "(cclob clob (40000000)) on replace delete rows"); + s.executeUpdate("create or replace table "+dbclobtable+ "(cdbclob dbclob (40000000) CCSID 13488) on replace delete rows"); + s.executeUpdate("create or replace table "+wchartable+ "(cwchar graphic(16000) CCSID 13488) on replace delete rows"); + s.executeUpdate("create or replace table "+wvarchartable+ "(cwvarchar vargraphic(16000) CCSID 13488 ) on replace delete rows"); + s.executeUpdate("create or replace table "+numerictable+ "(cnumeric numeric(10,10)) on replace delete rows"); + s.executeUpdate("create or replace table "+decimaltable+ "(cdecimal decimal(10,10)) on replace delete rows"); + s.executeUpdate("create or replace table "+graphictable+ "(cgraphic graphic(16000) CCSID 835 ) on replace delete rows "); + s.executeUpdate("create or replace table "+vargraphictable+ "(cvargraphic vargraphic(16000) CCSID 835 ) on replace delete rows"); s.close(); @@ -326,7 +287,7 @@ public void cleanup() { } - + s.close(); // Close the global connection opened in setup(). @@ -1013,7 +974,8 @@ public void Var023() { notApplicable("Native problem with huge strings not fixed in V5R2"); } else { try { - connection.prepareStatement(largeSql); + ps1 = connection.prepareStatement(largeSql); + ps1.close(); failed ("Didn't hit exception "+message); } catch (SQLException e) { assertCondition(true); @@ -1034,7 +996,8 @@ public void Var024() { try { // Clear up as much memory as possible System.gc(); - connection.prepareStatement(hugeSql); + ps1= connection.prepareStatement(hugeSql); + ps1.close(); failed ("Didn't hit exception "+message); } catch (SQLException e) { assertCondition(true); diff --git a/src/test/JD/Parm/JDParmStringMixed.java b/src/test/JD/Parm/JDParmStringMixed.java index 07edaa5f..9390ca7e 100644 --- a/src/test/JD/Parm/JDParmStringMixed.java +++ b/src/test/JD/Parm/JDParmStringMixed.java @@ -11,12 +11,6 @@ // /////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////// -// -// -// -// -// //////////////////////////////////////////////////////////////////////// // // File Name: JDParmStringMixed.java @@ -24,11 +18,6 @@ // Classes: JDParmStringMixed // //////////////////////////////////////////////////////////////////////// -// -// -// -// -//////////////////////////////////////////////////////////////////////// package test.JD.Parm; @@ -75,6 +64,7 @@ public static void main(String args[]) throws Exception { public PreparedStatement col2 = null; public PreparedStatement col3 = null; public String largeValue = ""; + private String stringsTable_; /** @@ -110,8 +100,11 @@ protected void setup () Statement s = connection.createStatement(); + stringsTable_ = JDParmTest.COLLECTION+".strmixed"; + + try { - s.executeUpdate("drop table "+JDParmTest.COLLECTION+".strings"); + s.executeUpdate("drop table "+stringsTable_+""); } catch (SQLException e) { JDParmHelper.handleDropException(e,output_); @@ -119,7 +112,7 @@ protected void setup () // Create a table that uses the largest row size the database will // allow me to use. - s.executeUpdate("create table "+JDParmTest.COLLECTION+".strings " + + s.executeUpdate("create table "+stringsTable_+" " + "(col1 char(4) ccsid 937, " + " col2 char(20) ccsid 937, " + " col3 char (32741) ccsid 937)"); @@ -127,9 +120,9 @@ protected void setup () s.close(); - col1 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col1) values(?)"); - col2 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col2) values(?)"); - col3 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col3) values(?)"); + col1 = connection.prepareStatement("insert into "+stringsTable_+" (col1) values(?)"); + col2 = connection.prepareStatement("insert into "+stringsTable_+" (col2) values(?)"); + col3 = connection.prepareStatement("insert into "+stringsTable_+" (col3) values(?)"); String shortValue = "abcdefghijklmnopqrstuvwxy"; @@ -174,7 +167,7 @@ public void Var001() { col1.setString(1, "XXXX"); int count = col1.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col1", "XXXX", connection,output_)); + assertCondition(JDParmHelper.verifyString("col1", "XXXX", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -182,7 +175,7 @@ public void Var001() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -195,7 +188,7 @@ public void Var002() { col1.setString(1, "XX"); int count = col1.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col1", "XX ", connection,output_)); + assertCondition(JDParmHelper.verifyString("col1", "XX ", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -203,7 +196,7 @@ public void Var002() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -216,7 +209,7 @@ public void Var003() { col1.setString(1, ""); int count = col1.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col1", " ", connection,output_)); + assertCondition(JDParmHelper.verifyString("col1", " ", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -224,7 +217,7 @@ public void Var003() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -238,7 +231,7 @@ public void Var004() { col1.setString(1, null); int count = col1.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col1", null, connection,output_)); + assertCondition(JDParmHelper.verifyString("col1", null, connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -246,7 +239,7 @@ public void Var004() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -279,7 +272,7 @@ public void Var005() { } catch (SQLException e) { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -293,7 +286,7 @@ public void Var006() { col2.setString(1, "01234567890123456789"); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", "01234567890123456789", connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", "01234567890123456789", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -301,7 +294,7 @@ public void Var006() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -315,7 +308,7 @@ public void Var007() { col2.setString(1, "0123456789"); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", "0123456789 ", connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", "0123456789 ", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -323,7 +316,7 @@ public void Var007() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -336,7 +329,7 @@ public void Var008() { col2.setString(1, "0"); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", "0 ", connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", "0 ", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -344,7 +337,7 @@ public void Var008() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -358,7 +351,7 @@ public void Var009() { col2.setString(1, ""); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", " ", connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", " ", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -366,7 +359,7 @@ public void Var009() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -380,7 +373,7 @@ public void Var010() { col2.setString(1, null); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", null, connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", null, connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -388,7 +381,7 @@ public void Var010() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -421,7 +414,7 @@ public void Var011() { } catch (SQLException e) { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -435,7 +428,7 @@ public void Var012() { col3.setString(1, largeValue); int count = col3.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col3", largeValue, connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", largeValue, connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -443,7 +436,7 @@ public void Var012() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -461,7 +454,7 @@ public void Var013() { for (; 32741 - expected.length() > 0; ) { expected.append(" "); } - assertCondition(JDParmHelper.verifyString("col3", expected.toString(), connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", expected.toString(), connection,stringsTable_,output_)); } else failed ("invalid update count"); @@ -470,7 +463,7 @@ public void Var013() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -487,7 +480,7 @@ public void Var014() { for (; 32741 - expected.length() > 0; ) { expected.append(" "); } - assertCondition(JDParmHelper.verifyString("col3", expected.toString(), connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", expected.toString(), connection,stringsTable_,output_)); } else failed ("invalid update count"); @@ -496,7 +489,7 @@ public void Var014() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -514,7 +507,7 @@ public void Var015() { for (int i = 0; i < 32741; i++) { expected.append(" "); } - assertCondition(JDParmHelper.verifyString("col3", expected.toString(), connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", expected.toString(), connection,stringsTable_,output_)); } else failed ("invalid update count"); @@ -523,7 +516,7 @@ public void Var015() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -537,7 +530,7 @@ public void Var016() { col3.setString(1, null); int count = col3.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col3", null, connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", null, connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -545,7 +538,7 @@ public void Var016() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -577,7 +570,7 @@ public void Var017() { } catch (SQLException e) { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } } diff --git a/src/test/JD/Parm/JDParmStringMixed2.java b/src/test/JD/Parm/JDParmStringMixed2.java index 2605aba0..adcaeca7 100644 --- a/src/test/JD/Parm/JDParmStringMixed2.java +++ b/src/test/JD/Parm/JDParmStringMixed2.java @@ -76,7 +76,8 @@ public static void main(String args[]) throws Exception { public PreparedStatement col2 = null; public PreparedStatement col3 = null; public String largeValue = ""; - boolean isNative = false; + boolean isNative = false; + private String stringsTable_; /** @@ -112,15 +113,17 @@ protected void setup () Statement s = connection.createStatement(); + stringsTable_ = JDParmTest.COLLECTION+".strmixed2"; + try { - s.executeUpdate("drop table "+JDParmTest.COLLECTION+".strings"); + s.executeUpdate("drop table "+stringsTable_+""); } catch (SQLException e) { JDParmHelper.handleDropException(e,output_); } // Create a table that uses the largest row size the database will // allow me to use. - s.executeUpdate("create table "+JDParmTest.COLLECTION+".strings " + + s.executeUpdate("create table "+stringsTable_+" " + "(col1 char(4) ccsid 937, " + " col2 char(20) ccsid 937, " + " col3 char (32741) ccsid 937)"); @@ -128,9 +131,9 @@ protected void setup () s.close(); - col1 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col1) values(?)"); - col2 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col2) values(?)"); - col3 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col3) values(?)"); + col1 = connection.prepareStatement("insert into "+stringsTable_+" (col1) values(?)"); + col2 = connection.prepareStatement("insert into "+stringsTable_+" (col2) values(?)"); + col3 = connection.prepareStatement("insert into "+stringsTable_+" (col3) values(?)"); String shortValue = "abcdefghijklmnopqrstuvwxy"; @@ -195,7 +198,7 @@ public void Var001() { expected = "\uFF21"; } */ - boolean passed = JDParmHelper.verifyString("col1", expected, connection,output_); + boolean passed = JDParmHelper.verifyString("col1", expected, connection,stringsTable_,output_); assertCondition(passed ,"col1 = " +col1+ ", inValue = " +inValue+ ", connection = " +connection); } else { failed ("invalid update count"); @@ -205,7 +208,7 @@ public void Var001() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -257,7 +260,7 @@ public void Var002() { failed (e, "Unexpected Exception"); } } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -309,7 +312,7 @@ public void Var003() { failed (e, "Unexpected Exception"); } } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -362,7 +365,7 @@ public void Var004() { else //@A1 failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -398,7 +401,7 @@ public void Var005() { String expected = inValue; - assertCondition(JDParmHelper.verifyString("col2", expected, connection,output_), "col2 = " +col2+ ", inValue = " +inValue+ ", connection = " +connection); + assertCondition(JDParmHelper.verifyString("col2", expected, connection,stringsTable_,output_), "col2 = " +col2+ ", inValue = " +inValue+ ", connection = " +connection); } else failed ("invalid update count"); @@ -406,7 +409,7 @@ public void Var005() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -445,7 +448,7 @@ public void Var006() { if (count == 1) { String expected = inValue; - assertCondition(JDParmHelper.verifyString("col2", expected, connection,output_), "col2 = " +col2+ ", inValue = " +inValue+ ", connection = " +connection); + assertCondition(JDParmHelper.verifyString("col2", expected, connection,stringsTable_,output_), "col2 = " +col2+ ", inValue = " +inValue+ ", connection = " +connection); } else failed ("invalid update count"); @@ -453,7 +456,7 @@ public void Var006() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -486,7 +489,7 @@ public void Var007() { if (count == 1) { String expected = inValue; - assertCondition(JDParmHelper.verifyString("col2", expected, connection,output_), "col2 = " +col2+ ", inValue = " +inValue+ ", connection = " +connection); + assertCondition(JDParmHelper.verifyString("col2", expected, connection,stringsTable_,output_), "col2 = " +col2+ ", inValue = " +inValue+ ", connection = " +connection); } else failed ("invalid update count"); @@ -494,7 +497,7 @@ public void Var007() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -526,7 +529,7 @@ public void Var008() { if (count == 1) { String expected = inValue; - assertCondition(JDParmHelper.verifyString("col2", expected, connection,output_), "col2 = " +col2+ ", inValue = " +inValue+ ", connection = " +connection); + assertCondition(JDParmHelper.verifyString("col2", expected, connection,stringsTable_,output_), "col2 = " +col2+ ", inValue = " +inValue+ ", connection = " +connection); } else failed ("invalid update count"); @@ -534,7 +537,7 @@ public void Var008() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -559,7 +562,7 @@ public void Var009() { // for(int i=0; i<17; i++) // @A1 // inValue += " "; // @A1 // if (count == 1) // @A1 - // assertCondition(JDParmHelper.verifyString("col2", inValue, connection,output_), // @A1 + // assertCondition(JDParmHelper.verifyString("col2", inValue, connection,stringsTable_,output_), // @A1 // "col2 = " +col2+ ", inValue = " +inValue+ // @A1 // ", connection = " +connection); // @A1 // else // @A1 @@ -571,7 +574,7 @@ public void Var009() { expected = inValue + " "; - assertCondition(JDParmHelper.verifyString("col2", expected , connection,output_), "col2 = " +col2+ ", inValue = " +inValue+ ", connection = " +connection); + assertCondition(JDParmHelper.verifyString("col2", expected , connection,stringsTable_,output_), "col2 = " +col2+ ", inValue = " +inValue+ ", connection = " +connection); } else failed ("invalid update count"); // } @@ -579,7 +582,7 @@ public void Var009() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -608,7 +611,7 @@ public void Var010() { // for(int i=0; i<14; i++) // @A1 // inValue += " "; // @A1 // if (count == 1) // @A1 - // assertCondition(JDParmHelper.verifyString("col2", inValue, connection,output_), // @A1 + // assertCondition(JDParmHelper.verifyString("col2", inValue, connection,stringsTable_,output_), // @A1 // "col2 = " +col2+ ", inValue = " +inValue+ // @A1 // ", connection = " +connection); // @A1 // else // @A1 @@ -623,7 +626,7 @@ public void Var010() { - assertCondition(JDParmHelper.verifyString("col2", expected, connection,output_), "col2 = " +col2+ ", inValue = " +inValue+ ", connection = " +connection); + assertCondition(JDParmHelper.verifyString("col2", expected, connection,stringsTable_,output_), "col2 = " +col2+ ", inValue = " +inValue+ ", connection = " +connection); } else failed ("invalid update count"); // } @@ -631,7 +634,7 @@ public void Var010() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -692,7 +695,7 @@ public void Var011() { else //@A1 failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -760,7 +763,7 @@ public void Var012() { else //@A1 failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -829,7 +832,7 @@ public void Var013() { else //@A1 failed (e, "Unexpecte d Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } diff --git a/src/test/JD/Parm/JDParmStringNumeric.java b/src/test/JD/Parm/JDParmStringNumeric.java index 0900dd91..b19437d2 100644 --- a/src/test/JD/Parm/JDParmStringNumeric.java +++ b/src/test/JD/Parm/JDParmStringNumeric.java @@ -69,6 +69,7 @@ public static void main(String args[]) throws Exception { public PreparedStatement col6 = null; public PreparedStatement combo = null; public String largeValue = ""; + private String stringsTable_; /** @@ -103,9 +104,10 @@ protected void setup () connection = testDriver_.getConnection(baseURL_, userId_, encryptedPassword_); Statement s = connection.createStatement(); + stringsTable_ = JDParmTest.COLLECTION+".strnum"; try { - s.executeUpdate("drop table "+JDParmTest.COLLECTION+".strings"); + s.executeUpdate("drop table "+stringsTable_+""); } catch (SQLException e) { JDParmHelper.handleDropException(e,output_); @@ -113,7 +115,7 @@ protected void setup () // Create a table that uses the largest row size the database will // allow me to use. - s.executeUpdate("create table "+JDParmTest.COLLECTION+".strings " + + s.executeUpdate("create table "+stringsTable_+" " + "(col1 numeric (1, 0), " + " col2 numeric (5, 0), " + " col3 numeric (10, 0), " + @@ -123,12 +125,12 @@ protected void setup () s.close(); - col1 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col1) values(?)"); - col2 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col2) values(?)"); - col3 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col3) values(?)"); - col4 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col4) values(?)"); - col5 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col5) values(?)"); - combo = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col1, col2) values(?, ?)"); + col1 = connection.prepareStatement("insert into "+stringsTable_+" (col1) values(?)"); + col2 = connection.prepareStatement("insert into "+stringsTable_+" (col2) values(?)"); + col3 = connection.prepareStatement("insert into "+stringsTable_+" (col3) values(?)"); + col4 = connection.prepareStatement("insert into "+stringsTable_+" (col4) values(?)"); + col5 = connection.prepareStatement("insert into "+stringsTable_+" (col5) values(?)"); + combo = connection.prepareStatement("insert into "+stringsTable_+" (col1, col2) values(?, ?)"); String shortValue = "abcdefghijklmnopqrstuvwxy"; @@ -173,7 +175,7 @@ public void Var001() { col1.setString(1, "1"); int count = col1.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col1", "1", connection,output_)); + assertCondition(JDParmHelper.verifyString("col1", "1", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -181,7 +183,7 @@ public void Var001() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -201,7 +203,7 @@ public void Var002() { assertCondition(true); //output_.println(e.getMessage()); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -221,7 +223,7 @@ public void Var003() { // TODO: Look this stuff up in the real SQL reference.... assertCondition(true); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -235,7 +237,7 @@ public void Var004() { col1.setString(1, null); int count = col1.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col1", null, connection,output_)); + assertCondition(JDParmHelper.verifyString("col1", null, connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -243,7 +245,7 @@ public void Var004() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -269,7 +271,7 @@ public void Var005() { assertSqlException(e, -99999, "07006", "Data type mismatch", "Mismatch instead of truncation in latest toolbox "); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -284,7 +286,7 @@ public void Var006() { col1.setString(1, "1.2"); int count = col1.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col1", "1", connection,output_)); + assertCondition(JDParmHelper.verifyString("col1", "1", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -292,7 +294,7 @@ public void Var006() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -306,7 +308,7 @@ public void Var007() { col2.setString(1, "12345"); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", "12345", connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", "12345", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -314,7 +316,7 @@ public void Var007() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -328,7 +330,7 @@ public void Var008() { col2.setString(1, "1"); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", "1", connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", "1", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -336,7 +338,7 @@ public void Var008() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -355,7 +357,7 @@ public void Var009() { // TODO: Look this stuff up in the real SQL reference.... assertCondition(true); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -369,7 +371,7 @@ public void Var010() { col2.setString(1, null); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", null, connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", null, connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -377,7 +379,7 @@ public void Var010() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -403,7 +405,7 @@ public void Var011() { assertSqlException(e, -99999, "07006", "Data type mismatch", "Mismatch instead of truncation in latest toolbox "); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -421,7 +423,7 @@ public void Var012() { col2.setString(1, "12345.6"); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", "12345", connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", "12345", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -429,7 +431,7 @@ public void Var012() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -443,7 +445,7 @@ public void Var013() { col3.setString(1, "1234567890"); int count = col3.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col3", "1234567890", connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", "1234567890", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -451,7 +453,7 @@ public void Var013() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -465,7 +467,7 @@ public void Var014() { col3.setString(1, "1"); int count = col3.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col3", "1", connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", "1", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -473,7 +475,7 @@ public void Var014() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -492,7 +494,7 @@ public void Var015() { // TODO: Look this stuff up in the real SQL reference.... assertCondition(true); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -506,7 +508,7 @@ public void Var016() { col3.setString(1, null); int count = col3.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col3", null, connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", null, connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -514,7 +516,7 @@ public void Var016() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -540,7 +542,7 @@ public void Var017() { assertSqlException(e, -99999, "07006", "Data type mismatch", "Mismatch instead of truncation in latest toolbox "); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -555,7 +557,7 @@ public void Var018() { col3.setString(1, "1234567890.1"); int count = col3.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col3", "1234567890", connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", "1234567890", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -563,7 +565,7 @@ public void Var018() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -577,7 +579,7 @@ public void Var019() { col4.setString(1, "0.12345"); int count = col4.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col4", "0.12345", connection,output_)); + assertCondition(JDParmHelper.verifyString("col4", "0.12345", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -585,7 +587,7 @@ public void Var019() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -599,7 +601,7 @@ public void Var020() { col4.setString(1, ".12345"); int count = col4.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col4", "0.12345", connection,output_)); + assertCondition(JDParmHelper.verifyString("col4", "0.12345", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -607,7 +609,7 @@ public void Var020() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -626,7 +628,7 @@ public void Var021() { col4.setString(1, ".1"); int count = col4.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col4", "0.10000", connection,output_)); + assertCondition(JDParmHelper.verifyString("col4", "0.10000", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -634,7 +636,7 @@ public void Var021() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -653,7 +655,7 @@ public void Var022() { // TODO: Look this stuff up in the real SQL reference.... assertCondition(true); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -667,7 +669,7 @@ public void Var023() { col4.setString(1, null); int count = col4.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col4", null, connection,output_)); + assertCondition(JDParmHelper.verifyString("col4", null, connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -675,7 +677,7 @@ public void Var023() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -689,7 +691,7 @@ public void Var024() { col4.setString(1, ".123456"); int count = col4.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col4", "0.12345", connection,output_)); + assertCondition(JDParmHelper.verifyString("col4", "0.12345", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -697,7 +699,7 @@ public void Var024() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -737,7 +739,7 @@ public void Var025() { assertSqlException(e, -99999, "07006", "Data type mismatch", "Mismatch instead of truncation in latest toolbox "); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -750,7 +752,7 @@ public void Var026() { col5.setString(1, "0."); int count = col5.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col5", "0.0", connection,output_)); + assertCondition(JDParmHelper.verifyString("col5", "0.0", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -758,7 +760,7 @@ public void Var026() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -772,7 +774,7 @@ public void Var027() { col5.setString(1, "0.2"); int count = col5.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col5", "0.2", connection,output_)); + assertCondition(JDParmHelper.verifyString("col5", "0.2", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -780,7 +782,7 @@ public void Var027() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -793,7 +795,7 @@ public void Var028() { col5.setString(1, "000000."); int count = col5.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col5", "0.0", connection,output_)); + assertCondition(JDParmHelper.verifyString("col5", "0.0", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -801,7 +803,7 @@ public void Var028() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -826,7 +828,7 @@ public void Var029() { } catch (SQLException e) { assertSqlException(e, -99999, "07006", "Data type mismatch", "Mismatch instead of truncation in latest toolbox "); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } } diff --git a/src/test/JD/Parm/JDParmStringVarbinary.java b/src/test/JD/Parm/JDParmStringVarbinary.java index 3b24b62d..20c07407 100644 --- a/src/test/JD/Parm/JDParmStringVarbinary.java +++ b/src/test/JD/Parm/JDParmStringVarbinary.java @@ -80,6 +80,7 @@ public static void main(String args[]) throws Exception { public PreparedStatement col5 = null; public PreparedStatement col6 = null; public String largeValue = ""; + private String stringsTable_; /** @@ -116,8 +117,10 @@ protected void setup () Statement s = connection.createStatement(); + stringsTable_ = JDParmTest.COLLECTION+".strvbin"; + try { - s.executeUpdate("drop table "+JDParmTest.COLLECTION+".strings"); + s.executeUpdate("drop table "+stringsTable_+""); } catch (SQLException e) { JDParmHelper.handleDropException(e,output_); @@ -125,7 +128,7 @@ protected void setup () // Create a table that uses the largest row size the database will // allow me to use. - s.executeUpdate("create table "+JDParmTest.COLLECTION+".strings " + + s.executeUpdate("create table "+stringsTable_+" " + "(col1 varchar(1) CCSID 65535, " + "col2 varchar(20) CCSID 65535, " + "col3 varchar (32714) CCSID 65535)"); @@ -133,13 +136,13 @@ protected void setup () s.close(); - col1 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col1) values(?)"); - col2 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col2) values(?)"); - col3 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col3) values(?)"); + col1 = connection.prepareStatement("insert into "+stringsTable_+" (col1) values(?)"); + col2 = connection.prepareStatement("insert into "+stringsTable_+" (col2) values(?)"); + col3 = connection.prepareStatement("insert into "+stringsTable_+" (col3) values(?)"); - col4 = connection2.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col1) values(?)"); - col5 = connection2.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col2) values(?)"); - col6 = connection2.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col3) values(?)"); + col4 = connection2.prepareStatement("insert into "+stringsTable_+" (col1) values(?)"); + col5 = connection2.prepareStatement("insert into "+stringsTable_+" (col2) values(?)"); + col6 = connection2.prepareStatement("insert into "+stringsTable_+" (col3) values(?)"); String shortValue = "abcdefghijklmnopqrstuvwxy"; @@ -185,7 +188,7 @@ public void Var001() { col1.setString(1, "X"); int count = col1.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col1", "X", connection,output_)); + assertCondition(JDParmHelper.verifyString("col1", "X", connection,stringsTable_,output_)); else failed("invalid update count"); @@ -196,7 +199,7 @@ public void Var001() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -209,7 +212,7 @@ public void Var002() { col1.setString(1, ""); int count = col1.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col1", "", connection,output_)); + assertCondition(JDParmHelper.verifyString("col1", "", connection,stringsTable_,output_)); else failed("invalid update count"); @@ -217,7 +220,7 @@ public void Var002() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -231,7 +234,7 @@ public void Var003() { col1.setString(1, null); int count = col1.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col1", null, connection,output_)); + assertCondition(JDParmHelper.verifyString("col1", null, connection,stringsTable_,output_)); else failed("invalid update count"); @@ -239,7 +242,7 @@ public void Var003() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -270,7 +273,7 @@ public void Var004() { else failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -284,7 +287,7 @@ public void Var005() { col2.setString(1, "01234567890123456789"); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", "01234567890123456789", connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", "01234567890123456789", connection,stringsTable_,output_)); else failed("invalid update count"); @@ -292,7 +295,7 @@ public void Var005() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -306,7 +309,7 @@ public void Var006() { col2.setString(1, "0123456789"); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", "0123456789", connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", "0123456789", connection,stringsTable_,output_)); else failed("invalid update count"); @@ -314,7 +317,7 @@ public void Var006() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -330,7 +333,7 @@ public void Var007() { col2.setString(1, "0"); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", expected, connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", expected, connection,stringsTable_,output_)); else failed("invalid update count"); @@ -338,7 +341,7 @@ public void Var007() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -352,7 +355,7 @@ public void Var008() { col2.setString(1, ""); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", "", connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", "", connection,stringsTable_,output_)); else failed("invalid update count"); @@ -360,7 +363,7 @@ public void Var008() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -374,7 +377,7 @@ public void Var009() { col2.setString(1, null); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", null, connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", null, connection,stringsTable_,output_)); else failed("invalid update count"); @@ -382,7 +385,7 @@ public void Var009() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -414,7 +417,7 @@ public void Var010() { } catch (SQLException e) { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -428,7 +431,7 @@ public void Var011() { col3.setString(1, largeValue); int count = col3.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col3", largeValue, connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", largeValue, connection,stringsTable_,output_)); else failed("invalid update count"); @@ -439,7 +442,7 @@ public void Var011() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -453,7 +456,7 @@ public void Var012() { col3.setString(1, "0123456789012345678901234567890123456789"); int count = col3.executeUpdate(); if (count == 1) { - assertCondition(JDParmHelper.verifyString("col3", "0123456789012345678901234567890123456789", connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", "0123456789012345678901234567890123456789", connection,stringsTable_,output_)); } else failed("invalid update count"); @@ -462,7 +465,7 @@ public void Var012() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -479,7 +482,7 @@ public void Var013() { col3.setString(1, "0"); int count = col3.executeUpdate(); if (count == 1) { - assertCondition(JDParmHelper.verifyString("col3", expected, connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", expected, connection,stringsTable_,output_)); } else failed("invalid update count"); @@ -488,7 +491,7 @@ public void Var013() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -502,7 +505,7 @@ public void Var014() { col3.setString(1, ""); int count = col3.executeUpdate(); if (count == 1) { - assertCondition(JDParmHelper.verifyString("col3", "", connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", "", connection,stringsTable_,output_)); } else failed("invalid update count"); @@ -511,7 +514,7 @@ public void Var014() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -525,7 +528,7 @@ public void Var015() { col3.setString(1, null); int count = col3.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col3", null, connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", null, connection,stringsTable_,output_)); else failed("invalid update count"); @@ -533,7 +536,7 @@ public void Var015() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -563,7 +566,7 @@ public void Var016() { else failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -577,7 +580,7 @@ public void Var017() { col4.setString(1, "X"); int count = col4.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col1", "X", connection2,output_)); + assertCondition(JDParmHelper.verifyString("col1", "X", connection2,stringsTable_,output_)); else failed("invalid update count"); @@ -585,7 +588,7 @@ public void Var017() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -598,7 +601,7 @@ public void Var018() { col4.setString(1, ""); int count = col4.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col1", "", connection2,output_)); + assertCondition(JDParmHelper.verifyString("col1", "", connection2,stringsTable_,output_)); else failed("invalid update count"); @@ -606,7 +609,7 @@ public void Var018() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection2,output_); + JDParmHelper.purgeStringsTable(connection2,stringsTable_, output_); } } @@ -620,7 +623,7 @@ public void Var019() { col4.setString(1, null); int count = col4.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col1", null, connection2,output_)); + assertCondition(JDParmHelper.verifyString("col1", null, connection2,stringsTable_,output_)); else failed("invalid update count"); @@ -628,7 +631,7 @@ public void Var019() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection2,output_); + JDParmHelper.purgeStringsTable(connection2,stringsTable_,output_); } } @@ -656,7 +659,7 @@ public void Var020() { } catch (SQLException e) { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -670,7 +673,7 @@ public void Var021() { col5.setString(1, "01234567890123456789"); int count = col5.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", "01234567890123456789", connection2,output_)); + assertCondition(JDParmHelper.verifyString("col2", "01234567890123456789", connection2,stringsTable_,output_)); else failed("invalid update count"); @@ -678,7 +681,7 @@ public void Var021() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection2,output_); + JDParmHelper.purgeStringsTable(connection2,stringsTable_,output_); } } @@ -692,7 +695,7 @@ public void Var022() { col5.setString(1, "0123456789"); int count = col5.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", "0123456789", connection2,output_)); + assertCondition(JDParmHelper.verifyString("col2", "0123456789", connection2,stringsTable_,output_)); else failed("invalid update count"); @@ -700,7 +703,7 @@ public void Var022() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection2,output_); + JDParmHelper.purgeStringsTable(connection2,stringsTable_,output_); } } @@ -713,7 +716,7 @@ public void Var023() { col5.setString(1, "0"); int count = col5.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", "0", connection2,output_)); + assertCondition(JDParmHelper.verifyString("col2", "0", connection2,stringsTable_,output_)); else failed("invalid update count"); @@ -721,7 +724,7 @@ public void Var023() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection2,output_); + JDParmHelper.purgeStringsTable(connection2,stringsTable_,output_); } } @@ -735,7 +738,7 @@ public void Var024() { col5.setString(1, ""); int count = col5.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", "", connection2,output_)); + assertCondition(JDParmHelper.verifyString("col2", "", connection2,stringsTable_,output_)); else failed("invalid update count"); @@ -743,7 +746,7 @@ public void Var024() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection2,output_); + JDParmHelper.purgeStringsTable(connection2,stringsTable_,output_); } } @@ -757,7 +760,7 @@ public void Var025() { col5.setString(1, null); int count = col5.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", null, connection2,output_)); + assertCondition(JDParmHelper.verifyString("col2", null, connection2,stringsTable_,output_)); else failed("invalid update count"); @@ -765,7 +768,7 @@ public void Var025() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection2,output_); + JDParmHelper.purgeStringsTable(connection2,stringsTable_,output_); } } @@ -792,7 +795,7 @@ public void Var026() { } catch (SQLException e) { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -806,7 +809,7 @@ public void Var027() { col6.setString(1, largeValue); int count = col6.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col3", largeValue, connection2,output_)); + assertCondition(JDParmHelper.verifyString("col3", largeValue, connection2,stringsTable_,output_)); else failed("invalid update count"); @@ -814,7 +817,7 @@ public void Var027() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection2,output_); + JDParmHelper.purgeStringsTable(connection2,stringsTable_,output_); } } @@ -828,7 +831,7 @@ public void Var028() { col6.setString(1, "0123456789012345678901234567890123456789"); int count = col6.executeUpdate(); if (count == 1) { - assertCondition(JDParmHelper.verifyString("col3", "0123456789012345678901234567890123456789", connection2,output_)); + assertCondition(JDParmHelper.verifyString("col3", "0123456789012345678901234567890123456789", connection2,stringsTable_,output_)); } else failed("invalid update count"); @@ -837,7 +840,7 @@ public void Var028() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection2,output_); + JDParmHelper.purgeStringsTable(connection2,stringsTable_,output_); } } @@ -850,7 +853,7 @@ public void Var029() { col6.setString(1, "0"); int count = col6.executeUpdate(); if (count == 1) { - assertCondition(JDParmHelper.verifyString("col3", "0", connection2,output_)); + assertCondition(JDParmHelper.verifyString("col3", "0", connection2,stringsTable_,output_)); } else failed("invalid update count"); @@ -859,7 +862,7 @@ public void Var029() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection2,output_); + JDParmHelper.purgeStringsTable(connection2,stringsTable_,output_); } } @@ -873,7 +876,7 @@ public void Var030() { col6.setString(1, ""); int count = col6.executeUpdate(); if (count == 1) { - assertCondition(JDParmHelper.verifyString("col3", "", connection2,output_)); + assertCondition(JDParmHelper.verifyString("col3", "", connection2,stringsTable_,output_)); } else failed("invalid update count"); @@ -882,7 +885,7 @@ public void Var030() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection2,output_); + JDParmHelper.purgeStringsTable(connection2,stringsTable_,output_); } } @@ -896,7 +899,7 @@ public void Var031() { col6.setString(1, null); int count = col6.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col3", null, connection2,output_)); + assertCondition(JDParmHelper.verifyString("col3", null, connection2,stringsTable_,output_)); else failed("invalid update count"); @@ -904,7 +907,7 @@ public void Var031() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection2,output_); + JDParmHelper.purgeStringsTable(connection2,stringsTable_,output_); } } @@ -931,7 +934,7 @@ public void Var032() { } catch (SQLException e) { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } diff --git a/src/test/JD/Parm/JDParmStringVarchar.java b/src/test/JD/Parm/JDParmStringVarchar.java index 9a2a1be9..6a779ab1 100644 --- a/src/test/JD/Parm/JDParmStringVarchar.java +++ b/src/test/JD/Parm/JDParmStringVarchar.java @@ -75,6 +75,7 @@ public static void main(String args[]) throws Exception { public PreparedStatement col2 = null; public PreparedStatement col3 = null; public String largeValue = ""; + private String stringsTable_; /** @@ -110,8 +111,10 @@ protected void setup () Statement s = connection.createStatement(); + stringsTable_ = JDParmTest.COLLECTION+".strvc"; + try { - s.executeUpdate("drop table "+JDParmTest.COLLECTION+".strings"); + s.executeUpdate("drop table "+stringsTable_+""); } catch (SQLException e) { JDParmHelper.handleDropException(e,output_); @@ -119,15 +122,15 @@ protected void setup () // Create a table that uses the largest row size the database will // allow me to use. - s.executeUpdate("create table "+JDParmTest.COLLECTION+".strings " + + s.executeUpdate("create table "+stringsTable_+" " + "(col1 varchar(1), col2 varchar(20), col3 varchar (32714))"); s.close(); - col1 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col1) values(?)"); - col2 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col2) values(?)"); - col3 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col3) values(?)"); + col1 = connection.prepareStatement("insert into "+stringsTable_+" (col1) values(?)"); + col2 = connection.prepareStatement("insert into "+stringsTable_+" (col2) values(?)"); + col3 = connection.prepareStatement("insert into "+stringsTable_+" (col3) values(?)"); String shortValue = "abcdefghijklmnopqrstuvwxy"; @@ -175,7 +178,7 @@ public void Var001() { col1.setString(1, "X"); int count = col1.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col1", "X", connection,output_)); + assertCondition(JDParmHelper.verifyString("col1", "X", connection,stringsTable_,output_)); else failed("invalid update count"); @@ -183,7 +186,7 @@ public void Var001() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -196,7 +199,7 @@ public void Var002() { col1.setString(1, ""); int count = col1.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col1", "", connection,output_)); + assertCondition(JDParmHelper.verifyString("col1", "", connection,stringsTable_,output_)); else failed("invalid update count"); @@ -204,7 +207,7 @@ public void Var002() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -218,7 +221,7 @@ public void Var003() { col1.setString(1, null); int count = col1.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col1", null, connection,output_)); + assertCondition(JDParmHelper.verifyString("col1", null, connection,stringsTable_,output_)); else failed("invalid update count"); @@ -226,7 +229,7 @@ public void Var003() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -254,7 +257,7 @@ public void Var004() { } catch (SQLException e) { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -268,7 +271,7 @@ public void Var005() { col2.setString(1, "01234567890123456789"); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", "01234567890123456789", connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", "01234567890123456789", connection,stringsTable_,output_)); else failed("invalid update count"); @@ -276,7 +279,7 @@ public void Var005() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -290,7 +293,7 @@ public void Var006() { col2.setString(1, "0123456789"); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", "0123456789", connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", "0123456789", connection,stringsTable_,output_)); else failed("invalid update count"); @@ -298,7 +301,7 @@ public void Var006() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -311,7 +314,7 @@ public void Var007() { col2.setString(1, "0"); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", "0", connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", "0", connection,stringsTable_,output_)); else failed("invalid update count"); @@ -319,7 +322,7 @@ public void Var007() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -333,7 +336,7 @@ public void Var008() { col2.setString(1, ""); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", "", connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", "", connection,stringsTable_,output_)); else failed("invalid update count"); @@ -341,7 +344,7 @@ public void Var008() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -355,7 +358,7 @@ public void Var009() { col2.setString(1, null); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", null, connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", null, connection,stringsTable_,output_)); else failed("invalid update count"); @@ -363,7 +366,7 @@ public void Var009() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -390,7 +393,7 @@ public void Var010() { } catch (SQLException e) { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -404,7 +407,7 @@ public void Var011() { col3.setString(1, largeValue); int count = col3.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col3", largeValue, connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", largeValue, connection,stringsTable_,output_)); else failed("invalid update count"); @@ -412,7 +415,7 @@ public void Var011() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -426,7 +429,7 @@ public void Var012() { col3.setString(1, "0123456789012345678901234567890123456789"); int count = col3.executeUpdate(); if (count == 1) { - assertCondition(JDParmHelper.verifyString("col3", "0123456789012345678901234567890123456789", connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", "0123456789012345678901234567890123456789", connection,stringsTable_,output_)); } else failed("invalid update count"); @@ -435,7 +438,7 @@ public void Var012() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -448,7 +451,7 @@ public void Var013() { col3.setString(1, "0"); int count = col3.executeUpdate(); if (count == 1) { - assertCondition(JDParmHelper.verifyString("col3", "0", connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", "0", connection,stringsTable_,output_)); } else failed("invalid update count"); @@ -457,7 +460,7 @@ public void Var013() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -471,7 +474,7 @@ public void Var014() { col3.setString(1, ""); int count = col3.executeUpdate(); if (count == 1) { - assertCondition(JDParmHelper.verifyString("col3", "", connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", "", connection,stringsTable_,output_)); } else failed("invalid update count"); @@ -480,7 +483,7 @@ public void Var014() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -494,7 +497,7 @@ public void Var015() { col3.setString(1, null); int count = col3.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col3", null, connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", null, connection,stringsTable_,output_)); else failed("invalid update count"); @@ -502,7 +505,7 @@ public void Var015() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -529,7 +532,7 @@ public void Var016() { } catch (SQLException e) { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } diff --git a/src/test/JD/Parm/JDParmStringVarcharHex.java b/src/test/JD/Parm/JDParmStringVarcharHex.java index 9a5d2438..5e8d7bbe 100644 --- a/src/test/JD/Parm/JDParmStringVarcharHex.java +++ b/src/test/JD/Parm/JDParmStringVarcharHex.java @@ -11,12 +11,6 @@ // /////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////// -// -// -// -// -// //////////////////////////////////////////////////////////////////////// // // File Name: JDParmStringVarcharHex.java @@ -24,11 +18,6 @@ // Classes: JDParmStringVarcharHex // //////////////////////////////////////////////////////////////////////// -// -// -// -// -//////////////////////////////////////////////////////////////////////// package test.JD.Parm; @@ -72,6 +61,7 @@ public static void main(String args[]) throws Exception { public Connection connection = null; public Statement s = null; public ResultSet rs = null; + private String stringsTable_; /** @@ -106,26 +96,22 @@ protected void setup () connection = testDriver_.getConnection(baseURL_, userId_, encryptedPassword_); s = connection.createStatement(); - - try { - s.executeUpdate("drop table "+JDParmTest.COLLECTION+".strings2"); - } catch (SQLException e) { - JDParmHelper.handleDropException(e,output_); - } - - s.executeUpdate("create table "+JDParmTest.COLLECTION+".strings2 (col1 varchar(10))"); - s.executeUpdate("insert into "+JDParmTest.COLLECTION+".strings2 values(x'00000000000000000000') "); - s.executeUpdate("insert into "+JDParmTest.COLLECTION+".strings2 values(x'0000000000C100000000') "); - s.executeUpdate("insert into "+JDParmTest.COLLECTION+".strings2 values(x'C1C1C1C1C100C1C1C1C1') "); - s.executeUpdate("insert into "+JDParmTest.COLLECTION+".strings2 values(x'00C1C1C1C1C1C1C1C1C1') "); - s.executeUpdate("insert into "+JDParmTest.COLLECTION+".strings2 values(x'C1C1C1C1C1C1C1C1C100') "); - s.executeUpdate("insert into "+JDParmTest.COLLECTION+".strings2 values(x'0000000000') "); - s.executeUpdate("insert into "+JDParmTest.COLLECTION+".strings2 values(x'0000C10000') "); - s.executeUpdate("insert into "+JDParmTest.COLLECTION+".strings2 values(x'C1C100C1C1') "); - s.executeUpdate("insert into "+JDParmTest.COLLECTION+".strings2 values(x'00C1C1C1C1') "); - s.executeUpdate("insert into "+JDParmTest.COLLECTION+".strings2 values(x'C1C1C1C100') "); - - rs = s.executeQuery("select * from "+JDParmTest.COLLECTION+".strings2"); + stringsTable_ = JDParmTest.COLLECTION+".strvchex"; + + + s.executeUpdate("create or replace table "+stringsTable_+"(col1 varchar(10)) on replace delete rows"); + s.executeUpdate("insert into "+stringsTable_+" values(x'00000000000000000000') "); + s.executeUpdate("insert into "+stringsTable_+" values(x'0000000000C100000000') "); + s.executeUpdate("insert into "+stringsTable_+" values(x'C1C1C1C1C100C1C1C1C1') "); + s.executeUpdate("insert into "+stringsTable_+" values(x'00C1C1C1C1C1C1C1C1C1') "); + s.executeUpdate("insert into "+stringsTable_+" values(x'C1C1C1C1C1C1C1C1C100') "); + s.executeUpdate("insert into "+stringsTable_+" values(x'0000000000') "); + s.executeUpdate("insert into "+stringsTable_+" values(x'0000C10000') "); + s.executeUpdate("insert into "+stringsTable_+" values(x'C1C100C1C1') "); + s.executeUpdate("insert into "+stringsTable_+" values(x'00C1C1C1C1') "); + s.executeUpdate("insert into "+stringsTable_+" values(x'C1C1C1C100') "); + + rs = s.executeQuery("select * from "+stringsTable_); } catch (Exception e) { output_.println("Caught exception: " + e.getMessage()); diff --git a/src/test/JD/Parm/JDParmStringVargraphic.java b/src/test/JD/Parm/JDParmStringVargraphic.java index a0fd8b6b..932dd4a8 100644 --- a/src/test/JD/Parm/JDParmStringVargraphic.java +++ b/src/test/JD/Parm/JDParmStringVargraphic.java @@ -35,10 +35,10 @@ /* Some notes to myself... -create table "+JDParmTest.COLLECTION+".unicode (col1 graphic(10) ccsid 13488) -create table "+JDParmTest.COLLECTION+".mixed (col1 char(10) ccsid 937) -create table "+JDParmTest.COLLECTION+".char(col1 char(10) ccsid 37) -create table "+JDParmTest.COLLECTION+".graphic (col1 graphic(10) ccsid 835) +create table "+stringsTable_+".unicode (col1 graphic(10) ccsid 13488) +create table "+stringsTable_+".mixed (col1 char(10) ccsid 937) +create table "+stringsTable_+".char(col1 char(10) ccsid 37) +create table "+stringsTable_+".graphic (col1 graphic(10) ccsid 835) space char: unicode 0020 @@ -92,6 +92,7 @@ public static void main(String args[]) throws Exception { public PreparedStatement col2 = null; public PreparedStatement col3 = null; public String largeValue = ""; + private String stringsTable_; /** @@ -126,9 +127,10 @@ protected void setup () connection = testDriver_.getConnection(baseURL_, userId_, encryptedPassword_); Statement s = connection.createStatement(); + stringsTable_ = JDParmTest.COLLECTION+".strvgraph"; try { - s.executeUpdate("drop table "+JDParmTest.COLLECTION+".strings"); + s.executeUpdate("drop table "+stringsTable_+""); } catch (SQLException e) { JDParmHelper.handleDropException(e,output_); @@ -136,7 +138,7 @@ protected void setup () // Create a table that uses the largest row size the database will // allow me to use. - s.executeUpdate("create table "+JDParmTest.COLLECTION+".strings " + + s.executeUpdate("create table "+stringsTable_+" " + "(col1 vargraphic(1) ccsid 835, " + " col2 vargraphic(20) ccsid 835, " + " col3 vargraphic (16346) ccsid 835)"); @@ -144,9 +146,9 @@ protected void setup () s.close(); - col1 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col1) values(?)"); - col2 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col2) values(?)"); - col3 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col3) values(?)"); + col1 = connection.prepareStatement("insert into "+stringsTable_+" (col1) values(?)"); + col2 = connection.prepareStatement("insert into "+stringsTable_+" (col2) values(?)"); + col3 = connection.prepareStatement("insert into "+stringsTable_+" (col3) values(?)"); } catch (Exception e) { @@ -186,7 +188,7 @@ public void Var001() { col1.setString(1, inValue); int count = col1.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col1", inValue, connection,output_)); + assertCondition(JDParmHelper.verifyString("col1", inValue, connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -194,7 +196,7 @@ public void Var001() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -207,7 +209,7 @@ public void Var002() { col1.setString(1, ""); int count = col1.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col1", "", connection,output_)); + assertCondition(JDParmHelper.verifyString("col1", "", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -215,7 +217,7 @@ public void Var002() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -229,7 +231,7 @@ public void Var003() { col1.setString(1, null); int count = col1.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col1", null, connection,output_)); + assertCondition(JDParmHelper.verifyString("col1", null, connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -237,7 +239,7 @@ public void Var003() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -275,7 +277,7 @@ public void Var004() { } catch (SQLException e) { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -295,7 +297,7 @@ public void Var005() { col2.setString(1, inValue); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", inValue, connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", inValue, connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -303,7 +305,7 @@ public void Var005() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -323,7 +325,7 @@ public void Var006() { col2.setString(1, inValue); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", inValue, connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", inValue, connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -331,7 +333,7 @@ public void Var006() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -348,7 +350,7 @@ public void Var007() { col2.setString(1, inValue); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", inValue, connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", inValue, connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -356,7 +358,7 @@ public void Var007() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -370,7 +372,7 @@ public void Var008() { col2.setString(1, ""); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", "", connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", "", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -378,7 +380,7 @@ public void Var008() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -392,7 +394,7 @@ public void Var009() { col2.setString(1, null); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", null, connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", null, connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -400,7 +402,7 @@ public void Var009() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -440,7 +442,7 @@ public void Var010() { } catch (SQLException e) { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -460,7 +462,7 @@ public void Var011() { col3.setString(1, inValue); int count = col3.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col3", inValue, connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", inValue, connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -468,7 +470,7 @@ public void Var011() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -488,7 +490,7 @@ public void Var012() { col3.setString(1, inValue); int count = col3.executeUpdate(); if (count == 1) { - assertCondition(JDParmHelper.verifyString("col3", inValue, connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", inValue, connection,stringsTable_,output_)); } else failed ("invalid update count"); @@ -497,7 +499,7 @@ public void Var012() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -514,7 +516,7 @@ public void Var013() { col3.setString(1, inValue); int count = col3.executeUpdate(); if (count == 1) { - assertCondition(JDParmHelper.verifyString("col3", inValue, connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", inValue, connection,stringsTable_,output_)); } else failed ("invalid update count"); @@ -523,7 +525,7 @@ public void Var013() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -537,7 +539,7 @@ public void Var014() { col3.setString(1, ""); int count = col3.executeUpdate(); if (count == 1) { - assertCondition(JDParmHelper.verifyString("col3", "", connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", "", connection,stringsTable_,output_)); } else failed ("invalid update count"); @@ -546,7 +548,7 @@ public void Var014() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -560,7 +562,7 @@ public void Var015() { col3.setString(1, null); int count = col3.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col3", null, connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", null, connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -568,7 +570,7 @@ public void Var015() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -606,7 +608,7 @@ public void Var016() { } catch (SQLException e) { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } diff --git a/src/test/JD/Parm/JDParmStringVarmixed.java b/src/test/JD/Parm/JDParmStringVarmixed.java index 1ccead73..1b28dcfd 100644 --- a/src/test/JD/Parm/JDParmStringVarmixed.java +++ b/src/test/JD/Parm/JDParmStringVarmixed.java @@ -75,6 +75,7 @@ public static void main(String args[]) throws Exception { public PreparedStatement col2 = null; public PreparedStatement col3 = null; public String largeValue = ""; + private String stringsTable_; /** @@ -110,8 +111,10 @@ protected void setup () Statement s = connection.createStatement(); + stringsTable_ = JDParmTest.COLLECTION+".strvmixed"; + try { - s.executeUpdate("drop table "+JDParmTest.COLLECTION+".strings"); + s.executeUpdate("drop table "+stringsTable_+""); } catch (SQLException e) { JDParmHelper.handleDropException(e,output_); @@ -119,15 +122,15 @@ protected void setup () // Create a table that uses the largest row size the database will // allow me to use. - s.executeUpdate("create table "+JDParmTest.COLLECTION+".strings " + + s.executeUpdate("create table "+stringsTable_+" " + "(col1 varchar(4) ccsid 937, col2 varchar(20) ccsid 937, col3 varchar (32711) ccsid 937)"); s.close(); - col1 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col1) values(?)"); - col2 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col2) values(?)"); - col3 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col3) values(?)"); + col1 = connection.prepareStatement("insert into "+stringsTable_+" (col1) values(?)"); + col2 = connection.prepareStatement("insert into "+stringsTable_+" (col2) values(?)"); + col3 = connection.prepareStatement("insert into "+stringsTable_+" (col3) values(?)"); String shortValue = "abcdefghijklmnopqrstuvwxy"; @@ -174,7 +177,7 @@ public void Var001() { col1.setString(1, "XXXX"); int count = col1.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col1", "XXXX", connection,output_)); + assertCondition(JDParmHelper.verifyString("col1", "XXXX", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -182,7 +185,7 @@ public void Var001() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -194,7 +197,7 @@ public void Var002() { col1.setString(1, "XX"); int count = col1.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col1", "XX", connection,output_)); + assertCondition(JDParmHelper.verifyString("col1", "XX", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -202,7 +205,7 @@ public void Var002() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -215,7 +218,7 @@ public void Var003() { col1.setString(1, ""); int count = col1.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col1", "", connection,output_)); + assertCondition(JDParmHelper.verifyString("col1", "", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -223,7 +226,7 @@ public void Var003() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -237,7 +240,7 @@ public void Var004() { col1.setString(1, null); int count = col1.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col1", null, connection,output_)); + assertCondition(JDParmHelper.verifyString("col1", null, connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -245,7 +248,7 @@ public void Var004() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -273,7 +276,7 @@ public void Var005() { } catch (SQLException e) { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -287,7 +290,7 @@ public void Var006() { col2.setString(1, "01234567890123456789"); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", "01234567890123456789", connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", "01234567890123456789", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -295,7 +298,7 @@ public void Var006() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -309,7 +312,7 @@ public void Var007() { col2.setString(1, "0123456789"); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", "0123456789", connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", "0123456789", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -317,7 +320,7 @@ public void Var007() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -330,7 +333,7 @@ public void Var008() { col2.setString(1, "0"); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", "0", connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", "0", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -338,7 +341,7 @@ public void Var008() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -352,7 +355,7 @@ public void Var009() { col2.setString(1, ""); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", "", connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", "", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -360,7 +363,7 @@ public void Var009() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -374,7 +377,7 @@ public void Var010() { col2.setString(1, null); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", null, connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", null, connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -382,7 +385,7 @@ public void Var010() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -409,7 +412,7 @@ public void Var011() { } catch (SQLException e) { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -423,7 +426,7 @@ public void Var012() { col3.setString(1, largeValue); int count = col3.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col3", largeValue, connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", largeValue, connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -431,7 +434,7 @@ public void Var012() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -445,7 +448,7 @@ public void Var013() { col3.setString(1, "0123456789012345678901234567890123456789"); int count = col3.executeUpdate(); if (count == 1) { - assertCondition(JDParmHelper.verifyString("col3", "0123456789012345678901234567890123456789", connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", "0123456789012345678901234567890123456789", connection,stringsTable_,output_)); } else failed ("invalid update count"); @@ -454,7 +457,7 @@ public void Var013() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -467,7 +470,7 @@ public void Var014() { col3.setString(1, "0"); int count = col3.executeUpdate(); if (count == 1) { - assertCondition(JDParmHelper.verifyString("col3", "0", connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", "0", connection,stringsTable_,output_)); } else failed ("invalid update count"); @@ -476,7 +479,7 @@ public void Var014() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -490,7 +493,7 @@ public void Var015() { col3.setString(1, ""); int count = col3.executeUpdate(); if (count == 1) { - assertCondition(JDParmHelper.verifyString("col3", "", connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", "", connection,stringsTable_,output_)); } else failed ("invalid update count"); @@ -499,7 +502,7 @@ public void Var015() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -513,7 +516,7 @@ public void Var016() { col3.setString(1, null); int count = col3.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col3", null, connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", null, connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -521,7 +524,7 @@ public void Var016() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -548,7 +551,7 @@ public void Var017() { } catch (SQLException e) { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } } diff --git a/src/test/JD/Parm/JDParmStringVarmixed2.java b/src/test/JD/Parm/JDParmStringVarmixed2.java index ffe6a2e7..820bea3e 100644 --- a/src/test/JD/Parm/JDParmStringVarmixed2.java +++ b/src/test/JD/Parm/JDParmStringVarmixed2.java @@ -76,6 +76,7 @@ public static void main(String args[]) throws Exception { public PreparedStatement col2 = null; public PreparedStatement col3 = null; public String largeValue = ""; + private String stringsTable_; /** @@ -111,15 +112,17 @@ protected void setup () Statement s = connection.createStatement(); + stringsTable_ = JDParmTest.COLLECTION+".strvmixed2"; + try { - s.executeUpdate("drop table "+JDParmTest.COLLECTION+".strings"); + s.executeUpdate("drop table "+stringsTable_+""); } catch (SQLException e) { JDParmHelper.handleDropException(e,output_); } // Create a table that uses the largest row size the database will // allow me to use. - s.executeUpdate("create table "+JDParmTest.COLLECTION+".strings " + + s.executeUpdate("create table "+stringsTable_+" " + "(col1 varchar(4) ccsid 937, " + " col2 varchar(20) ccsid 937, " + " col3 varchar (32711) ccsid 937)"); @@ -127,9 +130,9 @@ protected void setup () s.close(); - col1 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col1) values(?)"); - col2 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col2) values(?)"); - col3 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col3) values(?)"); + col1 = connection.prepareStatement("insert into "+stringsTable_+" (col1) values(?)"); + col2 = connection.prepareStatement("insert into "+stringsTable_+" (col2) values(?)"); + col3 = connection.prepareStatement("insert into "+stringsTable_+" (col3) values(?)"); String shortValue = "abcdefghijklmnopqrstuvwxy"; @@ -184,7 +187,7 @@ public void Var001() { col1.setString(1, inValue); int count = col1.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col1", inValue, connection,output_), "col1 = " +col1+ ", inValue = " +inValue+ ", connection = " +connection); + assertCondition(JDParmHelper.verifyString("col1", inValue, connection,stringsTable_,output_), "col1 = " +col1+ ", inValue = " +inValue+ ", connection = " +connection); else failed ("invalid update count"); @@ -192,7 +195,7 @@ public void Var001() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -247,7 +250,7 @@ public void Var002() { } } } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -297,7 +300,7 @@ public void Var003() { } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -348,7 +351,7 @@ public void Var004() { failed (e, "Unexpected Exception"); } } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -375,7 +378,7 @@ public void Var005() { col2.setString(1, inValue); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", inValue, connection,output_), "col2 = " +col2+ ", inValue = " +inValue+ ", connection = " +connection); + assertCondition(JDParmHelper.verifyString("col2", inValue, connection,stringsTable_,output_), "col2 = " +col2+ ", inValue = " +inValue+ ", connection = " +connection); else failed ("invalid update count"); @@ -383,7 +386,7 @@ public void Var005() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -414,7 +417,7 @@ public void Var006() { col2.setString(1, inValue); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", inValue, connection,output_), "col2 = " +col2+ ", inValue = " +inValue+ ", connection = " +connection); + assertCondition(JDParmHelper.verifyString("col2", inValue, connection,stringsTable_,output_), "col2 = " +col2+ ", inValue = " +inValue+ ", connection = " +connection); else failed ("invalid update count"); @@ -422,7 +425,7 @@ public void Var006() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -447,7 +450,7 @@ public void Var007() { col2.setString(1, inValue); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", inValue, connection,output_), "col2 = " +col2+ ", inValue = " +inValue+ ", connection = " +connection); + assertCondition(JDParmHelper.verifyString("col2", inValue, connection,stringsTable_,output_), "col2 = " +col2+ ", inValue = " +inValue+ ", connection = " +connection); else failed ("invalid update count"); @@ -455,7 +458,7 @@ public void Var007() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -480,7 +483,7 @@ public void Var008() { col2.setString(1, inValue); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", inValue, connection,output_), "col2 = " +col2+ ", inValue = " +inValue+ ", connection = " +connection); + assertCondition(JDParmHelper.verifyString("col2", inValue, connection,stringsTable_,output_), "col2 = " +col2+ ", inValue = " +inValue+ ", connection = " +connection); else failed ("invalid update count"); @@ -488,7 +491,7 @@ public void Var008() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -507,7 +510,7 @@ public void Var009() { col2.setString(1, inValue); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", inValue, connection,output_), "col2 = " +col2+ ", inValue = " +inValue+ ", connection = " +connection); + assertCondition(JDParmHelper.verifyString("col2", inValue, connection,stringsTable_,output_), "col2 = " +col2+ ", inValue = " +inValue+ ", connection = " +connection); else failed ("invalid update count"); @@ -515,7 +518,7 @@ public void Var009() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -538,7 +541,7 @@ public void Var010() { col2.setString(1, inValue); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", inValue, connection,output_), "col2 = " +col2+ ", inValue = " +inValue+ ", connection = " +connection); + assertCondition(JDParmHelper.verifyString("col2", inValue, connection,stringsTable_,output_), "col2 = " +col2+ ", inValue = " +inValue+ ", connection = " +connection); else failed ("invalid update count"); @@ -546,7 +549,7 @@ public void Var010() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -613,7 +616,7 @@ public void Var011() { } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -680,7 +683,7 @@ public void Var012() { } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -751,7 +754,7 @@ public void Var013() { } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } diff --git a/src/test/JD/Parm/JDParmStringWchar.java b/src/test/JD/Parm/JDParmStringWchar.java index 72bdd010..89c002fb 100644 --- a/src/test/JD/Parm/JDParmStringWchar.java +++ b/src/test/JD/Parm/JDParmStringWchar.java @@ -84,6 +84,7 @@ public static void main(String args[]) throws Exception { public String largeValue = ""; + private String stringsTable_; /** @@ -119,8 +120,10 @@ protected void setup () Statement s = connection.createStatement(); + stringsTable_ = JDParmTest.COLLECTION+".strvwchar"; + try { - s.executeUpdate("drop table "+JDParmTest.COLLECTION+".strings"); + s.executeUpdate("drop table "+stringsTable_+""); } catch (SQLException e) { String message = e.toString(); if (message.indexOf("not found") > 0 && @@ -133,7 +136,7 @@ protected void setup () } try { - s.executeUpdate("drop table "+JDParmTest.COLLECTION+".stringsChar1"); + s.executeUpdate("drop table "+stringsTable_+"Char1"); } catch (SQLException e) { String message = e.toString(); if (message.indexOf("not found") > 0 && @@ -146,41 +149,41 @@ protected void setup () } try { - s.executeUpdate("drop table "+JDParmTest.COLLECTION+".stringsGraphic1"); + s.executeUpdate("drop table "+stringsTable_+"Graphic1"); } catch (SQLException e) { JDParmHelper.handleDropException(e,output_); } // Create a table that uses the largest row size the database will // allow me to use. - s.executeUpdate("create table "+JDParmTest.COLLECTION+".strings " + + s.executeUpdate("create table "+stringsTable_+" " + "(col1 graphic(1) CCSID 13488, " + " col2 graphic(20) CCSID 13488, " + " col3 graphic(16361) CCSID 13488)"); if (true) { - s.executeUpdate("create table "+JDParmTest.COLLECTION+".stringsChar1 " + + s.executeUpdate("create table "+stringsTable_+"Char1 " + "(col4 char(1) CCSID 1208, " + " col5 char(20) CCSID 1208, " + " col6 char(16361) CCSID 1208)"); - s.executeUpdate("create table "+JDParmTest.COLLECTION+".stringsGraphic1" + + s.executeUpdate("create table "+stringsTable_+"Graphic1" + "(col7 graphic(1) CCSID 1200, " + " col8 graphic(20) CCSID 1200, " + " col9 graphic(16361) CCSID 1200)"); } s.close(); - col1 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col1) values(?)"); - col2 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col2) values(?)"); - col3 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col3) values(?)"); + col1 = connection.prepareStatement("insert into "+stringsTable_+" (col1) values(?)"); + col2 = connection.prepareStatement("insert into "+stringsTable_+" (col2) values(?)"); + col3 = connection.prepareStatement("insert into "+stringsTable_+" (col3) values(?)"); if (true) { - col4 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".stringsChar1 (col4) values(?)"); - col5 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".stringsChar1 (col5) values(?)"); - col6 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".stringsChar1 (col6) values(?)"); - col7 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".stringsGraphic1 (col7) values(?)"); - col8 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".stringsGraphic1 (col8) values(?)"); - col9 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".stringsGraphic1 (col9) values(?)"); + col4 = connection.prepareStatement("insert into "+stringsTable_+"Char1 (col4) values(?)"); + col5 = connection.prepareStatement("insert into "+stringsTable_+"Char1 (col5) values(?)"); + col6 = connection.prepareStatement("insert into "+stringsTable_+"Char1 (col6) values(?)"); + col7 = connection.prepareStatement("insert into "+stringsTable_+"Graphic1 (col7) values(?)"); + col8 = connection.prepareStatement("insert into "+stringsTable_+"Graphic1 (col8) values(?)"); + col9 = connection.prepareStatement("insert into "+stringsTable_+"Graphic1 (col9) values(?)"); } String shortValue = "abcdefghijklmnopqrstuvwxy"; @@ -222,7 +225,7 @@ public void Var001() { col1.setString(1, "X"); int count = col1.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col1", "X", connection,output_)); + assertCondition(JDParmHelper.verifyString("col1", "X", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -230,7 +233,7 @@ public void Var001() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -243,7 +246,7 @@ public void Var002() { col1.setString(1, ""); int count = col1.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col1", " ", connection,output_)); + assertCondition(JDParmHelper.verifyString("col1", " ", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -251,7 +254,7 @@ public void Var002() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -265,7 +268,7 @@ public void Var003() { col1.setString(1, null); int count = col1.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col1", null, connection,output_)); + assertCondition(JDParmHelper.verifyString("col1", null, connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -273,7 +276,7 @@ public void Var003() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -313,7 +316,7 @@ public void Var004() { } catch (SQLException e) { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -327,7 +330,7 @@ public void Var005() { col2.setString(1, "01234567890123456789"); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", "01234567890123456789", connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", "01234567890123456789", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -335,7 +338,7 @@ public void Var005() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -349,7 +352,7 @@ public void Var006() { col2.setString(1, "0123456789"); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", "0123456789 ", connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", "0123456789 ", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -357,7 +360,7 @@ public void Var006() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -370,7 +373,7 @@ public void Var007() { col2.setString(1, "0"); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", "0 ", connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", "0 ", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -378,7 +381,7 @@ public void Var007() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -392,7 +395,7 @@ public void Var008() { col2.setString(1, ""); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", " ", connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", " ", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -400,7 +403,7 @@ public void Var008() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -414,7 +417,7 @@ public void Var009() { col2.setString(1, null); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", null, connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", null, connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -422,7 +425,7 @@ public void Var009() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -464,7 +467,7 @@ public void Var010() { } catch (SQLException e) { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -478,7 +481,7 @@ public void Var011() { col3.setString(1, largeValue); int count = col3.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col3", largeValue, connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", largeValue, connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -486,7 +489,7 @@ public void Var011() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -504,7 +507,7 @@ public void Var012() { for (; 16361 - expected.length() > 0; ) { expected.append(" "); } - assertCondition(JDParmHelper.verifyString("col3", expected.toString(), connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", expected.toString(), connection,stringsTable_,output_)); } else failed ("invalid update count"); @@ -513,7 +516,7 @@ public void Var012() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -530,7 +533,7 @@ public void Var013() { for (; 16361 - expected.length() > 0; ) { expected.append(" "); } - assertCondition(JDParmHelper.verifyString("col3", expected.toString(), connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", expected.toString(), connection,stringsTable_,output_)); } else failed ("invalid update count"); @@ -539,7 +542,7 @@ public void Var013() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -557,7 +560,7 @@ public void Var014() { for (int i = 0; i < 16361; i++) { expected.append(" "); } - assertCondition(JDParmHelper.verifyString("col3", expected.toString(), connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", expected.toString(), connection,stringsTable_,output_)); } else failed ("invalid update count"); @@ -566,7 +569,7 @@ public void Var014() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -580,7 +583,7 @@ public void Var015() { col3.setString(1, null); int count = col3.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col3", null, connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", null, connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -588,7 +591,7 @@ public void Var015() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -627,7 +630,7 @@ public void Var016() { } catch (SQLException e) { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -640,7 +643,7 @@ public void Var017() { col4.setString(1, "X"); int count = col4.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col4", "X", connection, ""+JDParmTest.COLLECTION+".stringsChar1",output_)); + assertCondition(JDParmHelper.verifyString("col4", "X", connection, ""+stringsTable_+"Char1",output_)); else failed ("invalid update count"); @@ -648,7 +651,7 @@ public void Var017() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, ""+JDParmTest.COLLECTION+".stringsChar1",output_); + JDParmHelper.purgeStringsTable(connection, ""+stringsTable_+"Char1",output_); } } @@ -661,7 +664,7 @@ public void Var018() { col4.setString(1, ""); int count = col4.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col4", " ", connection, ""+JDParmTest.COLLECTION+".stringsChar1",output_)); + assertCondition(JDParmHelper.verifyString("col4", " ", connection, ""+stringsTable_+"Char1",output_)); else failed ("invalid update count"); @@ -669,7 +672,7 @@ public void Var018() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, ""+JDParmTest.COLLECTION+".stringsChar1",output_); + JDParmHelper.purgeStringsTable(connection, ""+stringsTable_+"Char1",output_); } } @@ -684,7 +687,7 @@ public void Var019() { col4.setString(1, null); int count = col4.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col4", null, connection, ""+JDParmTest.COLLECTION+".stringsChar1",output_)); + assertCondition(JDParmHelper.verifyString("col4", null, connection, ""+stringsTable_+"Char1",output_)); else failed ("invalid update count"); @@ -692,7 +695,7 @@ public void Var019() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, ""+JDParmTest.COLLECTION+".stringsChar1",output_); + JDParmHelper.purgeStringsTable(connection, ""+stringsTable_+"Char1",output_); } } @@ -734,7 +737,7 @@ public void Var020() { } catch (SQLException e) { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, ""+JDParmTest.COLLECTION+".stringsChar1",output_); + JDParmHelper.purgeStringsTable(connection, ""+stringsTable_+"Char1",output_); } } @@ -749,7 +752,7 @@ public void Var021() { col5.setString(1, "01234567890123456789"); int count = col5.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col5", "01234567890123456789", connection, ""+JDParmTest.COLLECTION+".stringsChar1",output_)); + assertCondition(JDParmHelper.verifyString("col5", "01234567890123456789", connection, ""+stringsTable_+"Char1",output_)); else failed ("invalid update count"); @@ -757,7 +760,7 @@ public void Var021() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, ""+JDParmTest.COLLECTION+".stringsChar1",output_); + JDParmHelper.purgeStringsTable(connection, ""+stringsTable_+"Char1",output_); } } @@ -772,7 +775,7 @@ public void Var022() { col5.setString(1, "0123456789"); int count = col5.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col5", "0123456789 ", connection, ""+JDParmTest.COLLECTION+".stringsChar1",output_)); + assertCondition(JDParmHelper.verifyString("col5", "0123456789 ", connection, ""+stringsTable_+"Char1",output_)); else failed ("invalid update count"); @@ -780,7 +783,7 @@ public void Var022() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, ""+JDParmTest.COLLECTION+".stringsChar1",output_); + JDParmHelper.purgeStringsTable(connection, ""+stringsTable_+"Char1",output_); } } @@ -794,7 +797,7 @@ public void Var023() { col5.setString(1, "0"); int count = col5.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col5", "0 ", connection, ""+JDParmTest.COLLECTION+".stringsChar1",output_)); + assertCondition(JDParmHelper.verifyString("col5", "0 ", connection, ""+stringsTable_+"Char1",output_)); else failed ("invalid update count"); @@ -802,7 +805,7 @@ public void Var023() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, ""+JDParmTest.COLLECTION+".stringsChar1",output_); + JDParmHelper.purgeStringsTable(connection, ""+stringsTable_+"Char1",output_); } } @@ -817,7 +820,7 @@ public void Var024() { col5.setString(1, ""); int count = col5.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col5", " ", connection, ""+JDParmTest.COLLECTION+".stringsChar1",output_)); + assertCondition(JDParmHelper.verifyString("col5", " ", connection, ""+stringsTable_+"Char1",output_)); else failed ("invalid update count"); @@ -825,7 +828,7 @@ public void Var024() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, ""+JDParmTest.COLLECTION+".stringsChar1",output_); + JDParmHelper.purgeStringsTable(connection, ""+stringsTable_+"Char1",output_); } } @@ -840,7 +843,7 @@ public void Var025() { col5.setString(1, null); int count = col5.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col5", null, connection, ""+JDParmTest.COLLECTION+".stringsChar1",output_)); + assertCondition(JDParmHelper.verifyString("col5", null, connection, ""+stringsTable_+"Char1",output_)); else failed ("invalid update count"); @@ -848,7 +851,7 @@ public void Var025() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, ""+JDParmTest.COLLECTION+".stringsChar1",output_); + JDParmHelper.purgeStringsTable(connection, ""+stringsTable_+"Char1",output_); } } @@ -888,7 +891,7 @@ public void Var026() { } catch (SQLException e) { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, ""+JDParmTest.COLLECTION+".stringsChar1",output_); + JDParmHelper.purgeStringsTable(connection, ""+stringsTable_+"Char1",output_); } } @@ -903,7 +906,7 @@ public void Var027() { col6.setString(1, largeValue); int count = col6.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col6", largeValue, connection, ""+JDParmTest.COLLECTION+".stringsChar1",output_)); + assertCondition(JDParmHelper.verifyString("col6", largeValue, connection, ""+stringsTable_+"Char1",output_)); else failed ("invalid update count"); @@ -911,7 +914,7 @@ public void Var027() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, ""+JDParmTest.COLLECTION+".stringsChar1",output_); + JDParmHelper.purgeStringsTable(connection, ""+stringsTable_+"Char1",output_); } } @@ -930,7 +933,7 @@ public void Var028() { for (; 16361 - expected.length() > 0; ) { expected.append(" "); } - assertCondition(JDParmHelper.verifyString("col6", expected.toString(), connection, ""+JDParmTest.COLLECTION+".stringsChar1",output_)); + assertCondition(JDParmHelper.verifyString("col6", expected.toString(), connection, ""+stringsTable_+"Char1",output_)); } else failed ("invalid update count"); @@ -939,7 +942,7 @@ public void Var028() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, ""+JDParmTest.COLLECTION+".stringsChar1",output_); + JDParmHelper.purgeStringsTable(connection, ""+stringsTable_+"Char1",output_); } } @@ -957,7 +960,7 @@ public void Var029() { for (; 16361 - expected.length() > 0; ) { expected.append(" "); } - assertCondition(JDParmHelper.verifyString("col6", expected.toString(), connection, ""+JDParmTest.COLLECTION+".stringsChar1",output_)); + assertCondition(JDParmHelper.verifyString("col6", expected.toString(), connection, ""+stringsTable_+"Char1",output_)); } else failed ("invalid update count"); @@ -966,7 +969,7 @@ public void Var029() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, ""+JDParmTest.COLLECTION+".stringsChar1",output_); + JDParmHelper.purgeStringsTable(connection, ""+stringsTable_+"Char1",output_); } } @@ -985,7 +988,7 @@ public void Var030() { for (int i = 0; i < 16361; i++) { expected.append(" "); } - assertCondition(JDParmHelper.verifyString("col6", expected.toString(), connection, ""+JDParmTest.COLLECTION+".stringsChar1",output_)); + assertCondition(JDParmHelper.verifyString("col6", expected.toString(), connection, ""+stringsTable_+"Char1",output_)); } else failed ("invalid update count"); @@ -994,7 +997,7 @@ public void Var030() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, ""+JDParmTest.COLLECTION+".stringsChar1",output_); + JDParmHelper.purgeStringsTable(connection, ""+stringsTable_+"Char1",output_); } } @@ -1009,7 +1012,7 @@ public void Var031() { col6.setString(1, null); int count = col6.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col6", null, connection, ""+JDParmTest.COLLECTION+".stringsChar1",output_)); + assertCondition(JDParmHelper.verifyString("col6", null, connection, ""+stringsTable_+"Char1",output_)); else failed ("invalid update count"); @@ -1017,7 +1020,7 @@ public void Var031() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, ""+JDParmTest.COLLECTION+".stringsChar1",output_); + JDParmHelper.purgeStringsTable(connection, ""+stringsTable_+"Char1",output_); } } @@ -1057,7 +1060,7 @@ public void Var032() { } catch (SQLException e) { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, ""+JDParmTest.COLLECTION+".stringsChar1",output_); + JDParmHelper.purgeStringsTable(connection, ""+stringsTable_+"Char1",output_); } } @@ -1070,7 +1073,7 @@ public void Var033() { col7.setString(1, "X"); int count = col7.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col7", "X", connection, ""+JDParmTest.COLLECTION+".stringsGraphic1",output_)); + assertCondition(JDParmHelper.verifyString("col7", "X", connection, ""+stringsTable_+"Graphic1",output_)); else failed ("invalid update count"); @@ -1078,7 +1081,7 @@ public void Var033() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, ""+JDParmTest.COLLECTION+".stringsGraphic1",output_); + JDParmHelper.purgeStringsTable(connection, ""+stringsTable_+"Graphic1",output_); } } @@ -1092,7 +1095,7 @@ public void Var034() { col7.setString(1, ""); int count = col7.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col7", " ", connection, ""+JDParmTest.COLLECTION+".stringsGraphic1",output_)); + assertCondition(JDParmHelper.verifyString("col7", " ", connection, ""+stringsTable_+"Graphic1",output_)); else failed ("invalid update count"); @@ -1100,7 +1103,7 @@ public void Var034() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, ""+JDParmTest.COLLECTION+".stringsGraphic1",output_); + JDParmHelper.purgeStringsTable(connection, ""+stringsTable_+"Graphic1",output_); } } @@ -1115,7 +1118,7 @@ public void Var035() { col7.setString(1, null); int count = col7.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col7", null, connection, ""+JDParmTest.COLLECTION+".stringsGraphic1",output_)); + assertCondition(JDParmHelper.verifyString("col7", null, connection, ""+stringsTable_+"Graphic1",output_)); else failed ("invalid update count"); @@ -1123,7 +1126,7 @@ public void Var035() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, ""+JDParmTest.COLLECTION+".stringsGraphic1",output_); + JDParmHelper.purgeStringsTable(connection, ""+stringsTable_+"Graphic1",output_); } } @@ -1164,7 +1167,7 @@ public void Var036() { } catch (SQLException e) { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, ""+JDParmTest.COLLECTION+".stringsGraphic1",output_); + JDParmHelper.purgeStringsTable(connection, ""+stringsTable_+"Graphic1",output_); } } @@ -1179,7 +1182,7 @@ public void Var037() { col8.setString(1, "01234567890123456789"); int count = col8.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col8", "01234567890123456789", connection, ""+JDParmTest.COLLECTION+".stringsGraphic1",output_)); + assertCondition(JDParmHelper.verifyString("col8", "01234567890123456789", connection, ""+stringsTable_+"Graphic1",output_)); else failed ("invalid update count"); @@ -1187,7 +1190,7 @@ public void Var037() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, ""+JDParmTest.COLLECTION+".stringsGraphic1",output_); + JDParmHelper.purgeStringsTable(connection, ""+stringsTable_+"Graphic1",output_); } } @@ -1202,7 +1205,7 @@ public void Var038() { col8.setString(1, "0123456789"); int count = col8.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col8", "0123456789 ", connection, ""+JDParmTest.COLLECTION+".stringsGraphic1",output_)); + assertCondition(JDParmHelper.verifyString("col8", "0123456789 ", connection, ""+stringsTable_+"Graphic1",output_)); else failed ("invalid update count"); @@ -1210,7 +1213,7 @@ public void Var038() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, ""+JDParmTest.COLLECTION+".stringsGraphic1",output_); + JDParmHelper.purgeStringsTable(connection, ""+stringsTable_+"Graphic1",output_); } } @@ -1224,7 +1227,7 @@ public void Var039() { col8.setString(1, "0"); int count = col8.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col8", "0 ", connection, ""+JDParmTest.COLLECTION+".stringsGraphic1",output_)); + assertCondition(JDParmHelper.verifyString("col8", "0 ", connection, ""+stringsTable_+"Graphic1",output_)); else failed ("invalid update count"); @@ -1232,7 +1235,7 @@ public void Var039() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, ""+JDParmTest.COLLECTION+".stringsGraphic1",output_); + JDParmHelper.purgeStringsTable(connection, ""+stringsTable_+"Graphic1",output_); } } @@ -1247,7 +1250,7 @@ public void Var040() { col8.setString(1, ""); int count = col8.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col8", " ", connection, ""+JDParmTest.COLLECTION+".stringsGraphic1",output_)); + assertCondition(JDParmHelper.verifyString("col8", " ", connection, ""+stringsTable_+"Graphic1",output_)); else failed ("invalid update count"); @@ -1255,7 +1258,7 @@ public void Var040() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, ""+JDParmTest.COLLECTION+".stringsGraphic1",output_); + JDParmHelper.purgeStringsTable(connection, ""+stringsTable_+"Graphic1",output_); } } @@ -1270,7 +1273,7 @@ public void Var041() { col8.setString(1, null); int count = col8.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col8", null, connection, ""+JDParmTest.COLLECTION+".stringsGraphic1",output_)); + assertCondition(JDParmHelper.verifyString("col8", null, connection, ""+stringsTable_+"Graphic1",output_)); else failed ("invalid update count"); @@ -1278,7 +1281,7 @@ public void Var041() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, ""+JDParmTest.COLLECTION+".stringsGraphic1",output_); + JDParmHelper.purgeStringsTable(connection, ""+stringsTable_+"Graphic1",output_); } } @@ -1318,7 +1321,7 @@ public void Var042() { } catch (SQLException e) { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, ""+JDParmTest.COLLECTION+".stringsGraphic1",output_); + JDParmHelper.purgeStringsTable(connection, ""+stringsTable_+"Graphic1",output_); } } @@ -1333,7 +1336,7 @@ public void Var043() { col9.setString(1, largeValue); int count = col9.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col9", largeValue, connection, ""+JDParmTest.COLLECTION+".stringsGraphic1",output_)); + assertCondition(JDParmHelper.verifyString("col9", largeValue, connection, ""+stringsTable_+"Graphic1",output_)); else failed ("invalid update count"); @@ -1341,7 +1344,7 @@ public void Var043() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, ""+JDParmTest.COLLECTION+".stringsGraphic1",output_); + JDParmHelper.purgeStringsTable(connection, ""+stringsTable_+"Graphic1",output_); } } @@ -1360,7 +1363,7 @@ public void Var044() { for (; 16361 - expected.length() > 0; ) { expected.append(" "); } - assertCondition(JDParmHelper.verifyString("col9", expected.toString(), connection, ""+JDParmTest.COLLECTION+".stringsGraphic1",output_)); + assertCondition(JDParmHelper.verifyString("col9", expected.toString(), connection, ""+stringsTable_+"Graphic1",output_)); } else failed ("invalid update count"); @@ -1369,7 +1372,7 @@ public void Var044() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, ""+JDParmTest.COLLECTION+".stringsGraphic1",output_); + JDParmHelper.purgeStringsTable(connection, ""+stringsTable_+"Graphic1",output_); } } @@ -1387,7 +1390,7 @@ public void Var045() { for (; 16361 - expected.length() > 0; ) { expected.append(" "); } - assertCondition(JDParmHelper.verifyString("col9", expected.toString(), connection, ""+JDParmTest.COLLECTION+".stringsGraphic1",output_)); + assertCondition(JDParmHelper.verifyString("col9", expected.toString(), connection, ""+stringsTable_+"Graphic1",output_)); } else failed ("invalid update count"); @@ -1396,7 +1399,7 @@ public void Var045() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, ""+JDParmTest.COLLECTION+".stringsGraphic1",output_); + JDParmHelper.purgeStringsTable(connection, ""+stringsTable_+"Graphic1",output_); } } @@ -1415,7 +1418,7 @@ public void Var046() { for (int i = 0; i < 16361; i++) { expected.append(" "); } - assertCondition(JDParmHelper.verifyString("col9", expected.toString(), connection, ""+JDParmTest.COLLECTION+".stringsGraphic1",output_)); + assertCondition(JDParmHelper.verifyString("col9", expected.toString(), connection, ""+stringsTable_+"Graphic1",output_)); } else failed ("invalid update count"); @@ -1424,7 +1427,7 @@ public void Var046() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, ""+JDParmTest.COLLECTION+".stringsGraphic1",output_); + JDParmHelper.purgeStringsTable(connection, ""+stringsTable_+"Graphic1",output_); } } @@ -1439,7 +1442,7 @@ public void Var047() { col9.setString(1, null); int count = col9.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col9", null, connection, ""+JDParmTest.COLLECTION+".stringsGraphic1",output_)); + assertCondition(JDParmHelper.verifyString("col9", null, connection, ""+stringsTable_+"Graphic1",output_)); else failed ("invalid update count"); @@ -1447,7 +1450,7 @@ public void Var047() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, ""+JDParmTest.COLLECTION+".stringsGraphic1",output_); + JDParmHelper.purgeStringsTable(connection, ""+stringsTable_+"Graphic1",output_); } } @@ -1489,7 +1492,7 @@ public void Var048() { } catch (SQLException e) { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, ""+JDParmTest.COLLECTION+".stringsGraphic1",output_); + JDParmHelper.purgeStringsTable(connection, ""+stringsTable_+"Graphic1",output_); } } diff --git a/src/test/JD/Parm/JDParmStringWvarchar.java b/src/test/JD/Parm/JDParmStringWvarchar.java index 25c138aa..58934160 100644 --- a/src/test/JD/Parm/JDParmStringWvarchar.java +++ b/src/test/JD/Parm/JDParmStringWvarchar.java @@ -11,12 +11,6 @@ // /////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////// -// -// -// -// -// //////////////////////////////////////////////////////////////////////// // // File Name: JDParmStringWvarchar.java @@ -24,11 +18,6 @@ // Classes: JDParmStringWvarchar // //////////////////////////////////////////////////////////////////////// -// -// -// -// -//////////////////////////////////////////////////////////////////////// package test.JD.Parm; @@ -83,6 +72,7 @@ public static void main(String args[]) throws Exception { public PreparedStatement col9 = null; public String largeValue = ""; +private String stringsTable_; /** @@ -118,15 +108,17 @@ protected void setup () Statement s = connection.createStatement(); + stringsTable_ = JDParmTest.COLLECTION+".strwvc"; + try { - s.executeUpdate("drop table "+JDParmTest.COLLECTION+".strings"); + s.executeUpdate("drop table "+stringsTable_+""); } catch (SQLException e) { JDParmHelper.handleDropException(e,output_); } try { - s.executeUpdate("drop table "+JDParmTest.COLLECTION+".stringsVarchar"); + s.executeUpdate("drop table "+stringsTable_+"Varchar"); } catch (SQLException e) { String message = e.toString(); if (message.indexOf("not found") > 0 && @@ -139,7 +131,7 @@ protected void setup () } try { - s.executeUpdate("drop table "+JDParmTest.COLLECTION+".stringsVargraphic"); + s.executeUpdate("drop table "+stringsTable_+"Vargraphic"); } catch (SQLException e) { String message = e.toString(); if (message.indexOf("not found") > 0 && @@ -153,34 +145,34 @@ protected void setup () // Create a table that uses the largest row size the database will // allow me to use. - s.executeUpdate("create table "+JDParmTest.COLLECTION+".strings " + + s.executeUpdate("create table "+stringsTable_+" " + "(col1 vargraphic(1) CCSID 13488, " + " col2 vargraphic(20) CCSID 13488, " + " col3 vargraphic(16346) CCSID 13488)"); if (true) { - s.executeUpdate("create table "+JDParmTest.COLLECTION+".stringsVarchar " + + s.executeUpdate("create table "+stringsTable_+"Varchar " + "(col4 varchar(1) CCSID 1208, " + " col5 varchar(20) CCSID 1208, " + " col6 varchar(16346) CCSID 1208)"); - s.executeUpdate("create table "+JDParmTest.COLLECTION+".stringsVargraphic " + + s.executeUpdate("create table "+stringsTable_+"Vargraphic " + "(col7 vargraphic(1) CCSID 1200, " + " col8 vargraphic(20) CCSID 1200, " + " col9 vargraphic(16346) CCSID 1200)"); } s.close(); - col1 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col1) values(?)"); - col2 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col2) values(?)"); - col3 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".strings (col3) values(?)"); + col1 = connection.prepareStatement("insert into "+stringsTable_+" (col1) values(?)"); + col2 = connection.prepareStatement("insert into "+stringsTable_+" (col2) values(?)"); + col3 = connection.prepareStatement("insert into "+stringsTable_+" (col3) values(?)"); if (true) { - col4 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".stringsVarchar (col4) values(?)"); - col5 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".stringsVarchar (col5) values(?)"); - col6 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".stringsVarchar (col6) values(?)"); - col7 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".stringsVargraphic (col7) values(?)"); - col8 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".stringsVargraphic (col8) values(?)"); - col9 = connection.prepareStatement("insert into "+JDParmTest.COLLECTION+".stringsVargraphic (col9) values(?)"); + col4 = connection.prepareStatement("insert into "+stringsTable_+"Varchar (col4) values(?)"); + col5 = connection.prepareStatement("insert into "+stringsTable_+"Varchar (col5) values(?)"); + col6 = connection.prepareStatement("insert into "+stringsTable_+"Varchar (col6) values(?)"); + col7 = connection.prepareStatement("insert into "+stringsTable_+"Vargraphic (col7) values(?)"); + col8 = connection.prepareStatement("insert into "+stringsTable_+"Vargraphic (col8) values(?)"); + col9 = connection.prepareStatement("insert into "+stringsTable_+"Vargraphic (col9) values(?)"); } String shortValue = "abcdefghijklmnopqrstuvwxy"; @@ -224,7 +216,7 @@ public void Var001() { col1.setString(1, "X"); int count = col1.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col1", "X", connection,output_)); + assertCondition(JDParmHelper.verifyString("col1", "X", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -232,7 +224,7 @@ public void Var001() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -245,7 +237,7 @@ public void Var002() { col1.setString(1, ""); int count = col1.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col1", "", connection,output_)); + assertCondition(JDParmHelper.verifyString("col1", "", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -253,7 +245,7 @@ public void Var002() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -267,7 +259,7 @@ public void Var003() { col1.setString(1, null); int count = col1.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col1", null, connection,output_)); + assertCondition(JDParmHelper.verifyString("col1", null, connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -275,7 +267,7 @@ public void Var003() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -312,7 +304,7 @@ public void Var004() { } catch (SQLException e) { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -326,7 +318,7 @@ public void Var005() { col2.setString(1, "01234567890123456789"); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", "01234567890123456789", connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", "01234567890123456789", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -334,7 +326,7 @@ public void Var005() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -348,7 +340,7 @@ public void Var006() { col2.setString(1, "0123456789"); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", "0123456789", connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", "0123456789", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -356,7 +348,7 @@ public void Var006() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -369,7 +361,7 @@ public void Var007() { col2.setString(1, "0"); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", "0", connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", "0", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -377,7 +369,7 @@ public void Var007() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -391,7 +383,7 @@ public void Var008() { col2.setString(1, ""); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", "", connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", "", connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -399,7 +391,7 @@ public void Var008() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -413,7 +405,7 @@ public void Var009() { col2.setString(1, null); int count = col2.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col2", null, connection,output_)); + assertCondition(JDParmHelper.verifyString("col2", null, connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -421,7 +413,7 @@ public void Var009() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -457,7 +449,7 @@ public void Var010() { } catch (SQLException e) { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -471,7 +463,7 @@ public void Var011() { col3.setString(1, largeValue); int count = col3.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col3", largeValue, connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", largeValue, connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -479,7 +471,7 @@ public void Var011() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -493,7 +485,7 @@ public void Var012() { col3.setString(1, "0123456789012345678901234567890123456789"); int count = col3.executeUpdate(); if (count == 1) { - assertCondition(JDParmHelper.verifyString("col3", "0123456789012345678901234567890123456789", connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", "0123456789012345678901234567890123456789", connection,stringsTable_,output_)); } else failed ("invalid update count"); @@ -502,7 +494,7 @@ public void Var012() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -515,7 +507,7 @@ public void Var013() { col3.setString(1, "0"); int count = col3.executeUpdate(); if (count == 1) { - assertCondition(JDParmHelper.verifyString("col3", "0", connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", "0", connection,stringsTable_,output_)); } else failed ("invalid update count"); @@ -524,7 +516,7 @@ public void Var013() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -538,7 +530,7 @@ public void Var014() { col3.setString(1, ""); int count = col3.executeUpdate(); if (count == 1) { - assertCondition(JDParmHelper.verifyString("col3", "", connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", "", connection,stringsTable_,output_)); } else failed ("invalid update count"); @@ -547,7 +539,7 @@ public void Var014() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -561,7 +553,7 @@ public void Var015() { col3.setString(1, null); int count = col3.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col3", null, connection,output_)); + assertCondition(JDParmHelper.verifyString("col3", null, connection,stringsTable_,output_)); else failed ("invalid update count"); @@ -569,7 +561,7 @@ public void Var015() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -603,7 +595,7 @@ public void Var016() { } catch (SQLException e) { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection,output_); + JDParmHelper.purgeStringsTable(connection,stringsTable_,output_); } } @@ -616,7 +608,7 @@ public void Var017() { col4.setString(1, "X"); int count = col4.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col4", "X", connection, JDParmTest.COLLECTION+".stringsVarchar",output_)); + assertCondition(JDParmHelper.verifyString("col4", "X", connection, stringsTable_+"Varchar",output_)); else failed ("invalid update count"); @@ -624,7 +616,7 @@ public void Var017() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, JDParmTest.COLLECTION+".stringsVarchar",output_); + JDParmHelper.purgeStringsTable(connection, stringsTable_+"Varchar",output_); } } @@ -638,7 +630,7 @@ public void Var018() { col4.setString(1, ""); int count = col4.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col4", "", connection, JDParmTest.COLLECTION+".stringsVarchar",output_)); + assertCondition(JDParmHelper.verifyString("col4", "", connection, stringsTable_+"Varchar",output_)); else failed ("invalid update count"); @@ -646,7 +638,7 @@ public void Var018() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, JDParmTest.COLLECTION+".stringsVarchar",output_); + JDParmHelper.purgeStringsTable(connection, stringsTable_+"Varchar",output_); } } @@ -661,7 +653,7 @@ public void Var019() { col4.setString(1, null); int count = col4.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col4", null, connection, JDParmTest.COLLECTION+".stringsVarchar",output_)); + assertCondition(JDParmHelper.verifyString("col4", null, connection, stringsTable_+"Varchar",output_)); else failed ("invalid update count"); @@ -669,7 +661,7 @@ public void Var019() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, JDParmTest.COLLECTION+".stringsVarchar",output_); + JDParmHelper.purgeStringsTable(connection, stringsTable_+"Varchar",output_); } } @@ -705,7 +697,7 @@ public void Var020() { } catch (SQLException e) { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, JDParmTest.COLLECTION+".stringsVarchar",output_); + JDParmHelper.purgeStringsTable(connection, stringsTable_+"Varchar",output_); } } @@ -720,7 +712,7 @@ public void Var021() { col5.setString(1, "01234567890123456789"); int count = col5.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col5", "01234567890123456789", connection, JDParmTest.COLLECTION+".stringsVarchar",output_)); + assertCondition(JDParmHelper.verifyString("col5", "01234567890123456789", connection, stringsTable_+"Varchar",output_)); else failed ("invalid update count"); @@ -728,7 +720,7 @@ public void Var021() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, JDParmTest.COLLECTION+".stringsVarchar",output_); + JDParmHelper.purgeStringsTable(connection, stringsTable_+"Varchar",output_); } } @@ -743,7 +735,7 @@ public void Var022() { col5.setString(1, "0123456789"); int count = col5.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col5", "0123456789", connection, JDParmTest.COLLECTION+".stringsVarchar",output_)); + assertCondition(JDParmHelper.verifyString("col5", "0123456789", connection, stringsTable_+"Varchar",output_)); else failed ("invalid update count"); @@ -751,7 +743,7 @@ public void Var022() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, JDParmTest.COLLECTION+".stringsVarchar",output_); + JDParmHelper.purgeStringsTable(connection, stringsTable_+"Varchar",output_); } } @@ -765,7 +757,7 @@ public void Var023() { col5.setString(1, "0"); int count = col5.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col5", "0", connection, JDParmTest.COLLECTION+".stringsVarchar",output_)); + assertCondition(JDParmHelper.verifyString("col5", "0", connection, stringsTable_+"Varchar",output_)); else failed ("invalid update count"); @@ -773,7 +765,7 @@ public void Var023() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, JDParmTest.COLLECTION+".stringsVarchar",output_); + JDParmHelper.purgeStringsTable(connection, stringsTable_+"Varchar",output_); } } @@ -788,7 +780,7 @@ public void Var024() { col5.setString(1, ""); int count = col5.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col5", "", connection, JDParmTest.COLLECTION+".stringsVarchar",output_)); + assertCondition(JDParmHelper.verifyString("col5", "", connection, stringsTable_+"Varchar",output_)); else failed ("invalid update count"); @@ -796,7 +788,7 @@ public void Var024() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, JDParmTest.COLLECTION+".stringsVarchar",output_); + JDParmHelper.purgeStringsTable(connection, stringsTable_+"Varchar",output_); } } @@ -811,7 +803,7 @@ public void Var025() { col5.setString(1, null); int count = col5.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col5", null, connection, JDParmTest.COLLECTION+".stringsVarchar",output_)); + assertCondition(JDParmHelper.verifyString("col5", null, connection, stringsTable_+"Varchar",output_)); else failed ("invalid update count"); @@ -819,7 +811,7 @@ public void Var025() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, JDParmTest.COLLECTION+".stringsVarchar",output_); + JDParmHelper.purgeStringsTable(connection, stringsTable_+"Varchar",output_); } } @@ -854,7 +846,7 @@ public void Var026() { } catch (SQLException e) { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, JDParmTest.COLLECTION+".stringsVarchar",output_); + JDParmHelper.purgeStringsTable(connection, stringsTable_+"Varchar",output_); } } @@ -869,7 +861,7 @@ public void Var027() { col6.setString(1, largeValue); int count = col6.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col6", largeValue, connection, JDParmTest.COLLECTION+".stringsVarchar",output_)); + assertCondition(JDParmHelper.verifyString("col6", largeValue, connection, stringsTable_+"Varchar",output_)); else failed ("invalid update count"); @@ -877,7 +869,7 @@ public void Var027() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, JDParmTest.COLLECTION+".stringsVarchar",output_); + JDParmHelper.purgeStringsTable(connection, stringsTable_+"Varchar",output_); } } @@ -892,7 +884,7 @@ public void Var028() { col6.setString(1, "0123456789012345678901234567890123456789"); int count = col6.executeUpdate(); if (count == 1) { - assertCondition(JDParmHelper.verifyString("col6", "0123456789012345678901234567890123456789", connection, JDParmTest.COLLECTION+".stringsVarchar",output_)); + assertCondition(JDParmHelper.verifyString("col6", "0123456789012345678901234567890123456789", connection, stringsTable_+"Varchar",output_)); } else failed ("invalid update count"); @@ -901,7 +893,7 @@ public void Var028() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, JDParmTest.COLLECTION+".stringsVarchar",output_); + JDParmHelper.purgeStringsTable(connection, stringsTable_+"Varchar",output_); } } @@ -915,7 +907,7 @@ public void Var029() { col6.setString(1, "0"); int count = col6.executeUpdate(); if (count == 1) { - assertCondition(JDParmHelper.verifyString("col6", "0", connection, JDParmTest.COLLECTION+".stringsVarchar",output_)); + assertCondition(JDParmHelper.verifyString("col6", "0", connection, stringsTable_+"Varchar",output_)); } else failed ("invalid update count"); @@ -924,7 +916,7 @@ public void Var029() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, JDParmTest.COLLECTION+".stringsVarchar",output_); + JDParmHelper.purgeStringsTable(connection, stringsTable_+"Varchar",output_); } } @@ -939,7 +931,7 @@ public void Var030() { col6.setString(1, ""); int count = col6.executeUpdate(); if (count == 1) { - assertCondition(JDParmHelper.verifyString("col6", "", connection, JDParmTest.COLLECTION+".stringsVarchar",output_)); + assertCondition(JDParmHelper.verifyString("col6", "", connection, stringsTable_+"Varchar",output_)); } else failed ("invalid update count"); @@ -948,7 +940,7 @@ public void Var030() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, JDParmTest.COLLECTION+".stringsVarchar",output_); + JDParmHelper.purgeStringsTable(connection, stringsTable_+"Varchar",output_); } } @@ -963,7 +955,7 @@ public void Var031() { col6.setString(1, null); int count = col6.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col6", null, connection, JDParmTest.COLLECTION+".stringsVarchar",output_)); + assertCondition(JDParmHelper.verifyString("col6", null, connection, stringsTable_+"Varchar",output_)); else failed ("invalid update count"); @@ -971,7 +963,7 @@ public void Var031() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, JDParmTest.COLLECTION+".stringsVarchar",output_); + JDParmHelper.purgeStringsTable(connection, stringsTable_+"Varchar",output_); } } @@ -1006,7 +998,7 @@ public void Var032() { } catch (SQLException e) { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, JDParmTest.COLLECTION+".stringsVarchar",output_); + JDParmHelper.purgeStringsTable(connection, stringsTable_+"Varchar",output_); } } @@ -1019,7 +1011,7 @@ public void Var033() { col7.setString(1, "X"); int count = col7.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col7", "X", connection, JDParmTest.COLLECTION+".stringsVargraphic",output_)); + assertCondition(JDParmHelper.verifyString("col7", "X", connection, stringsTable_+"Vargraphic",output_)); else failed ("invalid update count"); @@ -1027,7 +1019,7 @@ public void Var033() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, JDParmTest.COLLECTION+".stringsVargraphic",output_); + JDParmHelper.purgeStringsTable(connection, stringsTable_+"Vargraphic",output_); } } @@ -1041,7 +1033,7 @@ public void Var034() { col7.setString(1, ""); int count = col7.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col7", "", connection, JDParmTest.COLLECTION+".stringsVargraphic",output_)); + assertCondition(JDParmHelper.verifyString("col7", "", connection, stringsTable_+"Vargraphic",output_)); else failed ("invalid update count"); @@ -1049,7 +1041,7 @@ public void Var034() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, JDParmTest.COLLECTION+".stringsVargraphic",output_); + JDParmHelper.purgeStringsTable(connection, stringsTable_+"Vargraphic",output_); } } @@ -1064,7 +1056,7 @@ public void Var035() { col7.setString(1, null); int count = col7.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col7", null, connection, JDParmTest.COLLECTION+".stringsVargraphic",output_)); + assertCondition(JDParmHelper.verifyString("col7", null, connection, stringsTable_+"Vargraphic",output_)); else failed ("invalid update count"); @@ -1072,7 +1064,7 @@ public void Var035() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, JDParmTest.COLLECTION+".stringsVargraphic",output_); + JDParmHelper.purgeStringsTable(connection, stringsTable_+"Vargraphic",output_); } } @@ -1110,7 +1102,7 @@ public void Var036() { } catch (SQLException e) { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, JDParmTest.COLLECTION+".stringsVargraphic",output_); + JDParmHelper.purgeStringsTable(connection, stringsTable_+"Vargraphic",output_); } } @@ -1125,7 +1117,7 @@ public void Var037() { col8.setString(1, "01234567890123456789"); int count = col8.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col8", "01234567890123456789", connection, JDParmTest.COLLECTION+".stringsVargraphic",output_)); + assertCondition(JDParmHelper.verifyString("col8", "01234567890123456789", connection, stringsTable_+"Vargraphic",output_)); else failed ("invalid update count"); @@ -1133,7 +1125,7 @@ public void Var037() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, JDParmTest.COLLECTION+".stringsVargraphic",output_); + JDParmHelper.purgeStringsTable(connection, stringsTable_+"Vargraphic",output_); } } @@ -1148,7 +1140,7 @@ public void Var038() { col8.setString(1, "0123456789"); int count = col8.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col8", "0123456789", connection, JDParmTest.COLLECTION+".stringsVargraphic",output_)); + assertCondition(JDParmHelper.verifyString("col8", "0123456789", connection, stringsTable_+"Vargraphic",output_)); else failed ("invalid update count"); @@ -1156,7 +1148,7 @@ public void Var038() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, JDParmTest.COLLECTION+".stringsVargraphic",output_); + JDParmHelper.purgeStringsTable(connection, stringsTable_+"Vargraphic",output_); } } @@ -1170,7 +1162,7 @@ public void Var039() { col8.setString(1, "0"); int count = col8.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col8", "0", connection, JDParmTest.COLLECTION+".stringsVargraphic",output_)); + assertCondition(JDParmHelper.verifyString("col8", "0", connection, stringsTable_+"Vargraphic",output_)); else failed ("invalid update count"); @@ -1178,7 +1170,7 @@ public void Var039() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, JDParmTest.COLLECTION+".stringsVargraphic",output_); + JDParmHelper.purgeStringsTable(connection, stringsTable_+"Vargraphic",output_); } } @@ -1193,7 +1185,7 @@ public void Var040() { col8.setString(1, ""); int count = col8.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col8", "", connection, JDParmTest.COLLECTION+".stringsVargraphic",output_)); + assertCondition(JDParmHelper.verifyString("col8", "", connection, stringsTable_+"Vargraphic",output_)); else failed ("invalid update count"); @@ -1201,7 +1193,7 @@ public void Var040() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, JDParmTest.COLLECTION+".stringsVargraphic",output_); + JDParmHelper.purgeStringsTable(connection, stringsTable_+"Vargraphic",output_); } } @@ -1216,7 +1208,7 @@ public void Var041() { col8.setString(1, null); int count = col8.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col8", null, connection, JDParmTest.COLLECTION+".stringsVargraphic",output_)); + assertCondition(JDParmHelper.verifyString("col8", null, connection, stringsTable_+"Vargraphic",output_)); else failed ("invalid update count"); @@ -1224,7 +1216,7 @@ public void Var041() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, JDParmTest.COLLECTION+".stringsVargraphic",output_); + JDParmHelper.purgeStringsTable(connection, stringsTable_+"Vargraphic",output_); } } @@ -1261,7 +1253,7 @@ public void Var042() { } catch (SQLException e) { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, JDParmTest.COLLECTION+".stringsVargraphic",output_); + JDParmHelper.purgeStringsTable(connection, stringsTable_+"Vargraphic",output_); } } @@ -1276,7 +1268,7 @@ public void Var043() { col9.setString(1, largeValue); int count = col9.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col9", largeValue, connection, JDParmTest.COLLECTION+".stringsVargraphic",output_)); + assertCondition(JDParmHelper.verifyString("col9", largeValue, connection, stringsTable_+"Vargraphic",output_)); else failed ("invalid update count"); @@ -1284,7 +1276,7 @@ public void Var043() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, JDParmTest.COLLECTION+".stringsVargraphic",output_); + JDParmHelper.purgeStringsTable(connection, stringsTable_+"Vargraphic",output_); } } @@ -1299,7 +1291,7 @@ public void Var044() { col9.setString(1, "0123456789012345678901234567890123456789"); int count = col9.executeUpdate(); if (count == 1) { - assertCondition(JDParmHelper.verifyString("col9", "0123456789012345678901234567890123456789", connection, JDParmTest.COLLECTION+".stringsVargraphic",output_)); + assertCondition(JDParmHelper.verifyString("col9", "0123456789012345678901234567890123456789", connection, stringsTable_+"Vargraphic",output_)); } else failed ("invalid update count"); @@ -1308,7 +1300,7 @@ public void Var044() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, JDParmTest.COLLECTION+".stringsVargraphic",output_); + JDParmHelper.purgeStringsTable(connection, stringsTable_+"Vargraphic",output_); } } @@ -1322,7 +1314,7 @@ public void Var045() { col9.setString(1, "0"); int count = col9.executeUpdate(); if (count == 1) { - assertCondition(JDParmHelper.verifyString("col9", "0", connection, JDParmTest.COLLECTION+".stringsVargraphic",output_)); + assertCondition(JDParmHelper.verifyString("col9", "0", connection, stringsTable_+"Vargraphic",output_)); } else failed ("invalid update count"); @@ -1331,7 +1323,7 @@ public void Var045() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, JDParmTest.COLLECTION+".stringsVargraphic",output_); + JDParmHelper.purgeStringsTable(connection, stringsTable_+"Vargraphic",output_); } } @@ -1346,7 +1338,7 @@ public void Var046() { col9.setString(1, ""); int count = col9.executeUpdate(); if (count == 1) { - assertCondition(JDParmHelper.verifyString("col9", "", connection, JDParmTest.COLLECTION+".stringsVargraphic",output_)); + assertCondition(JDParmHelper.verifyString("col9", "", connection, stringsTable_+"Vargraphic",output_)); } else failed ("invalid update count"); @@ -1355,7 +1347,7 @@ public void Var046() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, JDParmTest.COLLECTION+".stringsVargraphic",output_); + JDParmHelper.purgeStringsTable(connection, stringsTable_+"Vargraphic",output_); } } @@ -1370,7 +1362,7 @@ public void Var047() { col9.setString(1, null); int count = col9.executeUpdate(); if (count == 1) - assertCondition(JDParmHelper.verifyString("col9", null, connection, JDParmTest.COLLECTION+".stringsVargraphic",output_)); + assertCondition(JDParmHelper.verifyString("col9", null, connection, stringsTable_+"Vargraphic",output_)); else failed ("invalid update count"); @@ -1378,7 +1370,7 @@ public void Var047() { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, JDParmTest.COLLECTION+".stringsVargraphic",output_); + JDParmHelper.purgeStringsTable(connection, stringsTable_+"Vargraphic",output_); } } @@ -1414,7 +1406,7 @@ public void Var048() { } catch (SQLException e) { failed (e, "Unexpected Exception"); } finally { - JDParmHelper.purgeStringsTable(connection, JDParmTest.COLLECTION+".stringsVargraphic",output_); + JDParmHelper.purgeStringsTable(connection, stringsTable_+"Vargraphic",output_); } } } diff --git a/src/test/JD/RS/JDRSUpdateRow.java b/src/test/JD/RS/JDRSUpdateRow.java index ed3d5ecc..0022c9fa 100644 --- a/src/test/JD/RS/JDRSUpdateRow.java +++ b/src/test/JD/RS/JDRSUpdateRow.java @@ -17,7 +17,6 @@ import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; -import java.sql.SQLException; import java.sql.Statement; import java.util.Hashtable; import java.util.Vector; @@ -1124,11 +1123,10 @@ public void Var024() { String url = baseURL_ + ";extended metadata=true"; - Connection c = null; String city = ""; - try { + try (Connection c = testDriver_.getConnection(url, systemObject_.getUserId(), encryptedPassword_)) { - c = testDriver_.getConnection(url, systemObject_.getUserId(), encryptedPassword_); + Statement s = c.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = s.executeQuery("SELECT CITY AS TOWN FROM " + table3); @@ -1146,6 +1144,7 @@ public void Var024() { } s.close(); + assertCondition(city.equals("Manhatten")); } catch (Exception e) { failed(e, "Unexpected Exception-New Testcase added by toolbox to test column alias support 9/17/03"); @@ -1164,9 +1163,8 @@ public void Var025() { + ";extended metadata=false"; // String city = ""; - Connection c = null; - try { - c = testDriver_.getConnection(url, systemObject_.getUserId(), encryptedPassword_); + try (Connection c = testDriver_.getConnection(url, systemObject_.getUserId(), encryptedPassword_);) { + Statement s = c.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = s.executeQuery("SELECT CITY AS TOWN FROM " + table3); @@ -1196,9 +1194,9 @@ public void Var026() { + ";extended metadata=true"; String city = ""; String state = ""; - Connection c = null; - try { - c = testDriver_.getConnection(url, systemObject_.getUserId(), encryptedPassword_); + + try (Connection c = testDriver_.getConnection(url, systemObject_.getUserId(), encryptedPassword_);) { + Statement s = c.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = s.executeQuery("SELECT CITY AS TOWN,STATE AS LOCATION FROM " + table3); diff --git a/src/test/JD/RS/JDRowSetRSTestcase.java b/src/test/JD/RS/JDRowSetRSTestcase.java index cffdc3cf..ebfa9fea 100644 --- a/src/test/JD/RS/JDRowSetRSTestcase.java +++ b/src/test/JD/RS/JDRowSetRSTestcase.java @@ -24,7 +24,6 @@ import test.JTOpenTestEnvironment; import test.PasswordVault; import test.Testcase; -import test.JD.JDSerializeFile; import test.JD.DataSource.JDDatabaseOverride; import java.io.ByteArrayInputStream; @@ -170,14 +169,15 @@ protected void setup() throws Exception { context.rebind(jndiName_, ds); } - // - // Must connect to the specified system.. Needed for IASP to - // work - // - conn_ = testDriver_.getConnection(baseURL_, userId_, encryptedPassword_); - stmt_ = conn_.createStatement(); } + // + // Must connect to the specified system.. Needed for IASP to + // work + // + conn_ = testDriver_.getConnection(baseURL_, userId_, encryptedPassword_); + stmt_ = conn_.createStatement(); + conn2_ = testDriver_.getConnection(baseURL_, userId_, encryptedPassword_, "JDRowSetRSTestcase"); Statement s2 = conn2_.createStatement(); @@ -698,10 +698,19 @@ public void Var004() { rowset.clearWarnings(); SQLWarning w2 = rowset.getWarnings(); + rowset.close(); assertCondition((w1 != null) && (w2 == null), "systemName=" + systemName + " databaseName=" + databaseName); - } else + } else { + rowset.close(); failed("Unexpected Results.systemName=" + systemName + " databaseName=" + databaseName); + } } catch (Exception e) { + if (rowset != null) + try { + rowset.close(); + } catch (SQLException e1) { + e1.printStackTrace(); + } failed(e, "Unexpected Exception systemName=" + systemName + " databaseName=" + databaseName); } finally { @@ -970,11 +979,18 @@ public void Var010() { position(rowset, "NUMBER_POS"); Array v = rowset.getArray("C_INTEGER"); + failed("Didn't throw SQLException but got " + v); } catch (Exception e) { assertExceptionIsInstanceOf(e, "java.sql.SQLException"); } finally { - + if (rowset != null) { + try { + rowset.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } } } } @@ -1783,7 +1799,12 @@ public void Var042() { } catch (Exception e) { assertExceptionIsInstanceOf(e, "java.sql.SQLException"); } finally { - + if (rowset != null) + try { + rowset.close(); + } catch (SQLException e) { + e.printStackTrace(); + } } } } @@ -2498,7 +2519,13 @@ public void Var072() { } catch (Exception e) { failed(e, "Unexpected Exception"); } finally { - + if (rowset != null) + try { + rowset.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } } @@ -2537,7 +2564,13 @@ public void Var074() { } catch (Exception e) { failed(e, "Unexpected Exception"); } finally { - + if (rowset != null) + try { + rowset.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } } @@ -2600,7 +2633,13 @@ public void Var077() { } catch (Exception e) { failed(e, "Unexpected Exception"); } finally { - + if (rowset != null) + try { + rowset.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } } @@ -2626,7 +2665,13 @@ public void Var078() { } else failed(e, "Unexpected Exception."); } finally { - + if (rowset != null) + try { + rowset.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } } @@ -2897,7 +2942,13 @@ public void Var089() { } catch (Exception e) { failed(e, "Unexpected Exception"); } finally { - + if (rowset != null) + try { + rowset.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } } diff --git a/src/test/JD/Statement/JDStatementStressTest.java b/src/test/JD/Statement/JDStatementStressTest.java index ad17a954..9f863e97 100644 --- a/src/test/JD/Statement/JDStatementStressTest.java +++ b/src/test/JD/Statement/JDStatementStressTest.java @@ -1230,6 +1230,7 @@ public void setup() throws Exception { initTable(statement_, TABLE_, " (BID DECIMAL(8,0), BDATA VARCHAR(320) FOR BIT DATA)"); + // make some data byte b[] = new byte[320]; for (int i = 0; i < 320; i++) { @@ -1246,21 +1247,13 @@ public void setup() throws Exception { String QIWS = JDSetupProcedure.setupQIWS(systemObject_, connection_, output_); - String drop = "DROP PROCEDURE " + PROC_; - try { - Statement s3 = connection_.createStatement(); - s3.executeUpdate(drop); - s3.close(); - - } catch (Exception e) { - } // create a procedure - String proc = "CREATE PROCEDURE " + PROC_ + String proc = "CREATE OR REPLACE PROCEDURE " + PROC_ + " (IN_1 INTEGER) RESULT SET 1 LANGUAGE SQL " + "BEGIN " + " DECLARE C3 CURSOR FOR SELECT * FROM " + QIWS + ".QCUSTCDT ; " + " OPEN C3 ; " + " SET RESULT SETS CURSOR C3 ; " + "END "; - + System.out.println("Running :"+proc); Statement s3 = connection_.createStatement(); s3.executeUpdate(proc); s3.close(); @@ -1307,8 +1300,6 @@ public void resetConnection() throws Exception { **/ public void cleanup() throws Exception { statement_ = connection_.createStatement(); - statement_.executeUpdate("DROP PROCEDURE " + PROC_); - statement_.executeUpdate("DROP TABLE " + TABLE_); statement_.close(); connection_.close(); diff --git a/src/test/JDBVTTest.java b/src/test/JDBVTTest.java index d12ea28d..a7285de7 100644 --- a/src/test/JDBVTTest.java +++ b/src/test/JDBVTTest.java @@ -271,7 +271,7 @@ public static boolean testPreparedStatement() int i = 0; while (rs.next()) i++; - + rs.close(); if (i == 1) { System.out.println("successful"); } else { @@ -358,6 +358,7 @@ public static boolean testCallableStatement() i++; if (i != 6) success = false; + rs.close(); s.close(); @@ -451,7 +452,7 @@ public static boolean testResultSet() break; } } - + rs.close(); s.close(); if (success) { @@ -533,7 +534,7 @@ public static boolean testResultSetMetaData() System.out.println("successful"); else System.out.println("failed - incorrect results"); - + rs.close(); } catch (SQLException e) { System.out.println("failed - SQLException"); System.out.println("Details: " ); diff --git a/src/test/JDCSTest.java b/src/test/JDCSTest.java index b126476b..36c75d0f 100644 --- a/src/test/JDCSTest.java +++ b/src/test/JDCSTest.java @@ -30,6 +30,7 @@ import com.ibm.as400.access.AS400SecurityException; import com.ibm.as400.access.Job; +import test.JD.JDParallelCounter; import test.JD.JDSetupCollection; import test.JD.CS.JDCSArrays; import test.JD.CS.JDCSExecute; @@ -129,8 +130,11 @@ **/ public class JDCSTest extends JDTestDriver { + Connection connection_; + private JDParallelCounter parallelCounter_; + /** * @@ -194,16 +198,19 @@ public void setup () { super.setup(); // @D1A - Connection c = getConnection (getBaseURL () + connection_ = getConnection (getBaseURL () + ";errors=full", systemObject_.getUserId (), encryptedPassword_); - System.out.println("JDCSTest.setup connectionClass="+c.getClass().getName()); + + parallelCounter_ = new JDParallelCounter(connection_, COLLECTION); + + System.out.println("JDCSTest.setup connectionClass="+connection_.getClass().getName()); if (testLib_ != null) { // @E1A COLLECTION = testLib_; } JDSetupCollection.create (systemObject_, - c, COLLECTION, out_); + connection_, COLLECTION, out_); String collection = COLLECTION; @@ -213,55 +220,55 @@ public void setup () } JDSupportedFeatures supportedFeatures_= new JDSupportedFeatures(this); JDSetupProcedure.create (systemObject_, - c, JDSetupProcedure.STP_RS0, supportedFeatures_, collection,out_); + connection_, JDSetupProcedure.STP_RS0, supportedFeatures_, collection,out_); JDSetupProcedure.create (systemObject_, - c, JDSetupProcedure.STP_RS1, supportedFeatures_, collection,out_); + connection_, JDSetupProcedure.STP_RS1, supportedFeatures_, collection,out_); JDSetupProcedure.create (systemObject_, - c, JDSetupProcedure.STP_RS3, supportedFeatures_, collection,out_); + connection_, JDSetupProcedure.STP_RS3, supportedFeatures_, collection,out_); JDSetupProcedure.create (systemObject_, - c, JDSetupProcedure.STP_CS0, supportedFeatures_, collection,out_); + connection_, JDSetupProcedure.STP_CS0, supportedFeatures_, collection,out_); JDSetupProcedure.create (systemObject_, - c, JDSetupProcedure.STP_CS1, supportedFeatures_, collection,out_); //@F2A + connection_, JDSetupProcedure.STP_CS1, supportedFeatures_, collection,out_); //@F2A JDSetupProcedure.create (systemObject_, - c, JDSetupProcedure.STP_CSPARMS, supportedFeatures_, collection,out_); + connection_, JDSetupProcedure.STP_CSPARMS, supportedFeatures_, collection,out_); JDSetupProcedure.create (systemObject_, - c, JDSetupProcedure.STP_CSPARMSRS, supportedFeatures_, collection,out_); + connection_, JDSetupProcedure.STP_CSPARMSRS, supportedFeatures_, collection,out_); JDSetupProcedure.create (systemObject_, - c, JDSetupProcedure.STP_CSTYPESOUT, supportedFeatures_, collection,out_); + connection_, JDSetupProcedure.STP_CSTYPESOUT, supportedFeatures_, collection,out_); JDSetupProcedure.create (systemObject_, - c, JDSetupProcedure.STP_CSTYPESOUTX, supportedFeatures_, collection,out_); + connection_, JDSetupProcedure.STP_CSTYPESOUTX, supportedFeatures_, collection,out_); JDSetupProcedure.create (systemObject_, - c, JDSetupProcedure.STP_CSTYPESOUTB, supportedFeatures_, collection,out_); + connection_, JDSetupProcedure.STP_CSTYPESOUTB, supportedFeatures_, collection,out_); JDSetupProcedure.create (systemObject_, - c, JDSetupProcedure.STP_CSTYPESIN, supportedFeatures_, collection,out_); + connection_, JDSetupProcedure.STP_CSTYPESIN, supportedFeatures_, collection,out_); JDSetupProcedure.create (systemObject_, - c, JDSetupProcedure.STP_CSTYPESINOUT, supportedFeatures_, collection,out_); + connection_, JDSetupProcedure.STP_CSTYPESINOUT, supportedFeatures_, collection,out_); JDSetupProcedure.create (systemObject_, - c, JDSetupProcedure.STP_CSTYPESINOUTX, supportedFeatures_, collection,out_); + connection_, JDSetupProcedure.STP_CSTYPESINOUTX, supportedFeatures_, collection,out_); JDSetupProcedure.create (systemObject_, - c, JDSetupProcedure.STP_CSTYPESNULL, supportedFeatures_, collection,out_); + connection_, JDSetupProcedure.STP_CSTYPESNULL, supportedFeatures_, collection,out_); JDSetupProcedure.create (systemObject_, //@F1A - c, JDSetupProcedure.STP_CSINOUT, supportedFeatures_, collection,out_); //@F1A + connection_, JDSetupProcedure.STP_CSINOUT, supportedFeatures_, collection,out_); //@F1A JDSetupProcedure.create (systemObject_, //@F1A - c, JDSetupProcedure.STP_CSNULLTEST, supportedFeatures_, collection,out_); //@F1A + connection_, JDSetupProcedure.STP_CSNULLTEST, supportedFeatures_, collection,out_); //@F1A JDSetupProcedure.create (systemObject_, //@KBA - c, JDSetupProcedure.STP_CSSRS, supportedFeatures_, collection,out_); //@KBA + connection_, JDSetupProcedure.STP_CSSRS, supportedFeatures_, collection,out_); //@KBA JDSetupProcedure.create (systemObject_, //@KBA - c, JDSetupProcedure.STP_CSMSRS, supportedFeatures_, collection,out_); //@KBA + connection_, JDSetupProcedure.STP_CSMSRS, supportedFeatures_, collection,out_); //@KBA if (areReturnValuesSupported()) { // @E2A JDSetupProcedure.create (systemObject_, // @E2A - c, JDSetupProcedure.STP_CSRV, supportedFeatures_, collection,out_); // @E2A + connection_, JDSetupProcedure.STP_CSRV, supportedFeatures_, collection,out_); // @E2A JDSetupProcedure.create (systemObject_, // @E2A - c, JDSetupProcedure.STP_CSPARMSRV, supportedFeatures_, collection,out_); // @E2A + connection_, JDSetupProcedure.STP_CSPARMSRV, supportedFeatures_, collection,out_); // @E2A JDSetupProcedure.create (systemObject_, // @E2A - c, JDSetupProcedure.STP_CSPARMSRSRV, supportedFeatures_, collection,out_); // @E2A + connection_, JDSetupProcedure.STP_CSPARMSRSRV, supportedFeatures_, collection,out_); // @E2A } // @E2A - c.close (); + } @@ -275,6 +282,8 @@ public void cleanup () throws Exception { /* Call the garbage collector to free still open Java objects */ + parallelCounter_.close(); + connection_.close(); System.gc(); } @@ -879,7 +888,8 @@ public static void assureProcedureExists(Connection connection, String collectio System.out.println("Warning: exception creating procedure in assureProcedureExists: SQL="+sql); e.printStackTrace(System.out); } - } + } + stmt.close(); return; } } diff --git a/src/test/JDCleanCore.java b/src/test/JDCleanCore.java index 6ed81592..5640a619 100644 --- a/src/test/JDCleanCore.java +++ b/src/test/JDCleanCore.java @@ -109,7 +109,7 @@ public static void clean(String system, String userid, String password, } out.println("Completed clean"); - + as400.close(); } private static void cleanRelatedFiles(AS400 as400, IFSFile javacorefile) throws IOException { diff --git a/src/test/JDCleanUsrSpc.java b/src/test/JDCleanUsrSpc.java index 1b87ad65..ac07db79 100644 --- a/src/test/JDCleanUsrSpc.java +++ b/src/test/JDCleanUsrSpc.java @@ -93,7 +93,7 @@ public static void clean(String system, String userid, char[] encryptedPassword, commandCall.run(deleteJTCommand); - + as400.close(); } diff --git a/src/test/JDDMDTest.java b/src/test/JDDMDTest.java index 3b5114a0..558f0c20 100644 --- a/src/test/JDDMDTest.java +++ b/src/test/JDDMDTest.java @@ -30,6 +30,7 @@ import com.ibm.as400.access.AS400SecurityException; import com.ibm.as400.access.Job; +import test.JD.JDParallelCounter; import test.JD.JDSetupCollection; import test.JD.DMD.JDDMDAxx; import test.JD.DMD.JDDMDCCSID65535; @@ -67,451 +68,329 @@ import test.JD.DMD.JDDMDWrapper; import test.JD.DMD.JDDMDXxxAreXxx; - - /** -Test driver for the JDBC DatabaseMetaData class. -**/ -public class JDDMDTest - extends JDTestDriver { - + * Test driver for the JDBC DatabaseMetaData class. + **/ +public class JDDMDTest extends JDTestDriver { - - /** - * - */ + /** + * + */ // Constants. - public static String COLLECTION = "JDTSTDMD"; - public static String COLLECTION2 = "JDTSTDMD2"; - public static String COLLECTIONXX = "JDTSTDMDXX"; - public static String COLLECTIONGETTAB = "JDDMDGTABA"; //@PDA add for cleanup. - - public static String SCHEMAS_PERCENT = "JDTSTDMD%"; - public static String SCHEMAS_UNDERSCORE = "JDTSTDMD_"; - public static String SCHEMAS_LEN128 = "JDTESTDMDB01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789ABCDEFGH"; //@128sch - - - - // Private data. - private Connection connection_; - - - -/** -Run the test as an application. This should be called -from the test driver's main(). + public static String COLLECTION = "JDTSTDMD"; + public static String COLLECTION2 = "JDTSTDMD2"; + public static String COLLECTIONXX = "JDTSTDMDXX"; + public static String COLLECTIONGETTAB = "JDDMDGTABA"; // @PDA add for cleanup. + + public static String SCHEMAS_PERCENT = "JDTSTDMD%"; + public static String SCHEMAS_UNDERSCORE = "JDTSTDMD_"; + public static String SCHEMAS_LEN128 = "JDTESTDMDB01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789ABCDEFGH"; // @128sch + + // Private data. + private Connection connection_; + private JDParallelCounter parallelCounter_; + + /** + * Run the test as an application. This should be called from the test driver's + * main(). + * + * @param args The command line arguments. + * + * @exception Exception If an exception occurs. + **/ + public static void main(String args[]) throws Exception { + runApplication(new JDDMDTest(args)); + } + + /** + * Constructs an object for applets. + * + * @exception Exception If an exception occurs. + **/ + public JDDMDTest() throws Exception { + super(); + } + + /** + * Constructs an object for testing applications. + * + * @param args The command line arguments. + * + * @exception Exception If an exception occurs. + **/ + public JDDMDTest(String[] args) throws Exception { + super(args); + } + + /** + * Performs setup needed before running testcases. + * + * @exception Exception If an exception occurs. + **/ + public void setup() throws Exception { + super.setup(); // @D1A + + connection_ = getConnection(getBaseURL(), systemObject_.getUserId(), encryptedPassword_); + + parallelCounter_ = new JDParallelCounter(connection_, COLLECTION); + + if (testLib_ != null) { // @E1A + COLLECTION = testLib_; + // Need to set the other two collection names also + int endIndex = 8; + if (COLLECTION.length() < 8) + endIndex = COLLECTION.length(); + COLLECTION2 = COLLECTION.substring(0, endIndex) + "2"; + COLLECTIONXX = COLLECTION.substring(0, endIndex) + "XX"; + SCHEMAS_PERCENT = COLLECTION.substring(0, endIndex) + "%"; + SCHEMAS_UNDERSCORE = COLLECTION.substring(0, endIndex) + "_"; + SCHEMAS_LEN128 = COLLECTION.substring(0, endIndex) + SCHEMAS_LEN128.substring(endIndex); + } + + JDSetupCollection.create(systemObject_, connection_, COLLECTION, out_); + JDSetupCollection.create(systemObject_, connection_, COLLECTION2, out_); + JDSetupCollection.create(systemObject_, connection_, COLLECTIONXX, out_); + JDSetupCollection.create(systemObject_, connection_, SCHEMAS_LEN128, out_); + + try { + // Ignore any exceptions from commit. JCC for DB2 V9 now throws exception + // if commit called on autocommit connection + connection_.commit(); // for xa + } catch (SQLException sqlex) { + + } + } + + /** + * Performs setup needed after running testcases. + * + * @exception Exception If an exception occurs. + **/ + public void cleanup() throws Exception { + + if (parallelCounter_.doCleanup()) { + + } + parallelCounter_.close(); + connection_.close(); + } + + /** + * Cleanup - - this does not run automatically - - it is called by JDCleanup. + **/ + public static void dropCollections(Connection c) { + dropCollection(c, COLLECTION); + dropCollection(c, COLLECTION2); + dropCollection(c, COLLECTIONXX); + dropCollection(c, COLLECTIONGETTAB); + dropCollection(c, SCHEMAS_LEN128); // @128sch + + } + + /** + * Checks the column names for a result set. + * + * @exception SQLException If an exception occurs. + **/ + public static boolean checkColumnNames(ResultSetMetaData rsmd, String[] expectedNames, StringBuffer message) + throws SQLException { + boolean rc = true; + int count = rsmd.getColumnCount(); + if (count != expectedNames.length) { // @F1 + message.append("columdCount=" + count + " sb " + expectedNames.length); + rc = false; + } + + for (int i = 0; i < count; ++i) { + if (i >= expectedNames.length) { + message.append("column[" + (i + 1) + "] = " + rsmd.getColumnName(i + 1) + " UNEXPECTED\n"); + } else { + // System.out.println ("Column name " + (i+1) + ":" + // + rsmd.getColumnName (i+1) + "==" + expectedNames[i] + // + ":"); + if (!rsmd.getColumnName(i + 1).equals(expectedNames[i])) { + rc = false; + message.append("column[" + (i + 1) + "] = " + rsmd.getColumnName(i + 1) + " sb " + expectedNames[i] + "\n"); + } + } + } + return rc; + } + + /** + * Checks the column types for a result set. + * + * @exception SQLException If an exception occurs. + **/ + public static boolean checkColumnTypes(ResultSetMetaData rsmd, int[] expectedTypes, StringBuffer message) + throws SQLException { + boolean rc = true; + int count = rsmd.getColumnCount(); + if (count != expectedTypes.length) { // @F1 + message.append("columnCount=" + count + " sb " + expectedTypes.length); + rc = false; + } + for (int i = 0; i < count; ++i) { + + if (i >= expectedTypes.length) { + message.append("column[" + (i + 1) + "] = " + rsmd.getColumnType(i + 1) + " UNEXPECTED\n"); + + } else { + + // System.out.println ("Column type " + (i+1) + ":" + // + rsmd.getColumnType (i+1) + "==" + expectedTypes[i] + // + ":"); + if (rsmd.getColumnType(i + 1) != expectedTypes[i]) { + message.append("column[" + (i + 1) + "] = " + rsmd.getColumnType(i + 1) + " sb " + expectedTypes[i] + "\n"); + + rc = false; + } + } -@param args The command line arguments. + } + return rc; + } + + /** + * Check the results + * + * @param result Result returned + * @param expected Expected result + * @param messageColumnName Column name being testing + * @param info More debugging information + * @param message The string buffer to append the message to + * @return + */ + public static boolean check(String result, String expected, String messageColumnName, String info, + StringBuffer message, boolean success) { + boolean checkOk; + if (result == null) { + checkOk = (expected == null); + } else { + int underscoreIndex = expected.indexOf('_'); + if (underscoreIndex > 0) { + String checkString = expected.substring(0, underscoreIndex); + checkOk = result.indexOf(checkString) >= 0; + } else { + checkOk = result.equals(expected); + } + } + if (!checkOk) { + message.append(info + "=\"" + result + "\" sb \"" + expected + "\" " + messageColumnName + "\n"); + } + return checkOk && success; + } + + public static boolean check(int result, int expected, String messageColumnName, String info, StringBuffer message, + boolean success) { + boolean checkOk; + checkOk = result == expected; + if (!checkOk) { + message.append(info + ":" + messageColumnName + "=\"" + result + "\" sb \"" + expected + "\"\n"); + } + return checkOk && success; + } + + /** + * Creates the testcases. + **/ + public void createTestcases2() { + + if (TestDriverStatic.pause_) { + try { + systemObject_.connectService(AS400.DATABASE); + } catch (AS400SecurityException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } -@exception Exception If an exception occurs. -**/ - public static void main (String args[]) - throws Exception - { - runApplication (new JDDMDTest (args)); - } + try { + Job[] jobs = systemObject_.getJobs(AS400.DATABASE); + System.out.println("Host Server job(s): "); + for (int i = 0; i < jobs.length; i++) { + System.out.println(jobs[i]); + } + } catch (Exception exc) { + } + try { + System.out.println("Toolbox is paused. Press ENTER to continue."); + System.in.read(); + } catch (Exception exc) { + } + ; + } -/** -Constructs an object for applets. + addTestcase(new JDDMDAxx(systemObject_, namesAndVars_, runMode_, fileOutputStream_, password_)); -@exception Exception If an exception occurs. -**/ - public JDDMDTest () - throws Exception - { - super(); - } + addTestcase(new JDDMDDxx(systemObject_, namesAndVars_, runMode_, fileOutputStream_, password_)); + addTestcase(new JDDMDGetBestRowIdentifier(systemObject_, namesAndVars_, runMode_, fileOutputStream_, password_)); + addTestcase(new JDDMDGetCatalogs(systemObject_, namesAndVars_, runMode_, fileOutputStream_, password_)); -/** -Constructs an object for testing applications. + addTestcase(new JDDMDGetColumnPrivileges(systemObject_, namesAndVars_, runMode_, fileOutputStream_, password_)); -@param args The command line arguments. + addTestcase(new JDDMDGetColumns(systemObject_, namesAndVars_, runMode_, fileOutputStream_, password_)); -@exception Exception If an exception occurs. -**/ - public JDDMDTest (String[] args) - throws Exception - { - super (args); - } + addTestcase(new JDDMDGetCrossReference(systemObject_, namesAndVars_, runMode_, fileOutputStream_, password_)); + addTestcase(new JDDMDGetExportedKeys(systemObject_, namesAndVars_, runMode_, fileOutputStream_, password_)); + addTestcase(new JDDMDGetFunctions(systemObject_, namesAndVars_, runMode_, fileOutputStream_, password_)); -/** -Performs setup needed before running testcases. - -@exception Exception If an exception occurs. -**/ - public void setup () - throws Exception - { - super.setup(); // @D1A - - connection_ = getConnection (getBaseURL (), - systemObject_.getUserId (), encryptedPassword_); - - if (testLib_ != null) { // @E1A - COLLECTION = testLib_; - // Need to set the other two collection names also - int endIndex = 8; - if (COLLECTION.length() < 8) - endIndex = COLLECTION.length() ; - COLLECTION2 = COLLECTION.substring(0, endIndex) + "2"; - COLLECTIONXX = COLLECTION.substring(0, endIndex) + "XX"; - SCHEMAS_PERCENT = COLLECTION.substring(0, endIndex) + "%"; - SCHEMAS_UNDERSCORE = COLLECTION.substring(0, endIndex) + "_"; - SCHEMAS_LEN128 = COLLECTION.substring(0, endIndex) + SCHEMAS_LEN128.substring(endIndex); - } + addTestcase(new JDDMDGetFunctionColumns(systemObject_, namesAndVars_, runMode_, fileOutputStream_, password_)); - JDSetupCollection.create (systemObject_, - connection_, COLLECTION, out_); - JDSetupCollection.create (systemObject_, - connection_, COLLECTION2, out_); - JDSetupCollection.create (systemObject_, - connection_, COLLECTIONXX, out_); - JDSetupCollection.create (systemObject_, - connection_, SCHEMAS_LEN128, out_); - - try { - // Ignore any exceptions from commit. JCC for DB2 V9 now throws exception - // if commit called on autocommit connection - connection_.commit(); // for xa - } catch (SQLException sqlex) { - - } - } + addTestcase(new JDDMDGetImportedKeys(systemObject_, namesAndVars_, runMode_, fileOutputStream_, password_)); + addTestcase(new JDDMDGetIndexInfo(systemObject_, namesAndVars_, runMode_, fileOutputStream_, password_)); + addTestcase(new JDDMDGetPrimaryKeys(systemObject_, namesAndVars_, runMode_, fileOutputStream_, password_)); -/** -Performs setup needed after running testcases. + addTestcase(new JDDMDGetProcedureColumns(systemObject_, namesAndVars_, runMode_, fileOutputStream_, password_)); -@exception Exception If an exception occurs. -**/ - public void cleanup () - throws Exception - { - connection_.close (); - } + addTestcase(new JDDMDGetProcedures(systemObject_, namesAndVars_, runMode_, fileOutputStream_, password_)); + addTestcase(new JDDMDGetSchemas(systemObject_, namesAndVars_, runMode_, fileOutputStream_, password_)); + addTestcase(new JDDMDGetTablePrivileges(systemObject_, namesAndVars_, runMode_, fileOutputStream_, password_)); -/** -Cleanup - - this does not run automatically - - it is called by JDCleanup. -**/ - public static void dropCollections(Connection c) - { - dropCollection(c, COLLECTION); - dropCollection(c, COLLECTION2); - dropCollection(c, COLLECTIONXX); - dropCollection(c, COLLECTIONGETTAB); - dropCollection(c, SCHEMAS_LEN128); //@128sch + addTestcase(new JDDMDGetTablePrivileges3(systemObject_, namesAndVars_, runMode_, fileOutputStream_, password_)); - } + addTestcase(new JDDMDGetTables(systemObject_, namesAndVars_, runMode_, fileOutputStream_, password_)); + addTestcase(new JDDMDGetTableTypes(systemObject_, namesAndVars_, runMode_, fileOutputStream_, password_)); + addTestcase(new JDDMDGetTypeInfo(systemObject_, namesAndVars_, runMode_, fileOutputStream_, password_)); -/** -Checks the column names for a result set. - -@exception SQLException If an exception occurs. -**/ - public static boolean checkColumnNames (ResultSetMetaData rsmd, - String[] expectedNames, - StringBuffer message) - throws SQLException - { - boolean rc = true; - int count = rsmd.getColumnCount (); - if(count != expectedNames.length) { // @F1 - message.append("columdCount="+count+" sb "+expectedNames.length); - rc = false; - } - - for (int i = 0; i < count; ++i) { - if (i >= expectedNames.length) { - message.append("column["+(i+1)+"] = "+rsmd.getColumnName(i+1)+" UNEXPECTED\n"); - } else { - //System.out.println ("Column name " + (i+1) + ":" - // + rsmd.getColumnName (i+1) + "==" + expectedNames[i] - //+ ":"); - if (! rsmd.getColumnName (i+1).equals (expectedNames[i])) { - rc = false; - message.append("column["+(i+1)+"] = "+rsmd.getColumnName(i+1)+" sb "+expectedNames[i]+"\n"); - } - } - } - return rc; - } + addTestcase(new JDDMDGetUDTs(systemObject_, namesAndVars_, runMode_, fileOutputStream_, password_)); + addTestcase(new JDDMDGetVersionColumns(systemObject_, namesAndVars_, runMode_, fileOutputStream_, password_)); + addTestcase(new JDDMDGetPseudoColumns(systemObject_, namesAndVars_, runMode_, fileOutputStream_, password_)); + addTestcase(new JDDMDGetXxx(systemObject_, namesAndVars_, runMode_, fileOutputStream_, password_)); -/** -Checks the column types for a result set. -@exception SQLException If an exception occurs. -**/ - public static boolean checkColumnTypes (ResultSetMetaData rsmd, - int[] expectedTypes, - StringBuffer message) - throws SQLException - { - boolean rc = true; - int count = rsmd.getColumnCount (); - if(count != expectedTypes.length) { // @F1 - message.append("columnCount="+count+" sb "+expectedTypes.length); - rc = false; - } - for (int i = 0; i < count; ++i) { + addTestcase(new JDDMDIsXxx(systemObject_, namesAndVars_, runMode_, fileOutputStream_, password_)); - if (i >= expectedTypes.length) { - message.append("column["+(i+1)+"] = "+rsmd.getColumnType(i+1)+" UNEXPECTED\n"); + addTestcase(new JDDMDMisc(systemObject_, namesAndVars_, runMode_, fileOutputStream_, password_)); + addTestcase(new JDDMDNullXxx(systemObject_, namesAndVars_, runMode_, fileOutputStream_, password_)); - } else { + addTestcase(new JDDMDStoresXxx(systemObject_, namesAndVars_, runMode_, fileOutputStream_, password_)); - // System.out.println ("Column type " + (i+1) + ":" - // + rsmd.getColumnType (i+1) + "==" + expectedTypes[i] - // + ":"); - if (rsmd.getColumnType (i+1) != expectedTypes[i]) { - message.append("column["+(i+1)+"] = "+rsmd.getColumnType(i+1)+" sb "+expectedTypes[i]+"\n"); + addTestcase(new JDDMDSupportsXxx(systemObject_, namesAndVars_, runMode_, fileOutputStream_, password_)); - rc=false; - } - } - - } - return rc; - } - - - - /** - * Check the results - * @param result Result returned - * @param expected Expected result - * @param messageColumnName Column name being testing - * @param info More debugging information - * @param message The string buffer to append the message to - * @return - */ - public static boolean check(String result, String expected, String messageColumnName, String info, StringBuffer message, boolean success) { - boolean checkOk; - if (result == null) { - checkOk = ( expected == null); - } else { - int underscoreIndex = expected.indexOf('_'); - if (underscoreIndex > 0) { - String checkString = expected.substring(0,underscoreIndex); - checkOk = result.indexOf(checkString) >= 0; - } else { - checkOk = result.equals(expected); - } - } - if (!checkOk) { - message.append(info+"=\""+result+"\" sb \""+expected+"\" "+messageColumnName+"\n"); - } - return checkOk && success; - } - - public static boolean check(int result, int expected, String messageColumnName, String info, StringBuffer message, boolean success) { - boolean checkOk; - checkOk = result == expected; - if (!checkOk) { - message.append(info+":"+messageColumnName+"=\""+result+"\" sb \""+expected+"\"\n"); - } - return checkOk && success; -} + addTestcase(new JDDMDUsesXxx(systemObject_, namesAndVars_, runMode_, fileOutputStream_, password_)); + addTestcase(new JDDMDXxxAreXxx(systemObject_, namesAndVars_, runMode_, fileOutputStream_, password_)); + addTestcase(new JDDMDWrapper(systemObject_, namesAndVars_, runMode_, fileOutputStream_, password_)); + addTestcase(new JDDMDPerformance(systemObject_, namesAndVars_, runMode_, fileOutputStream_, password_)); -/** -Creates the testcases. -**/ - public void createTestcases2 () - { - - if(TestDriverStatic.pause_) - { - try - { - systemObject_.connectService(AS400.DATABASE); - } - catch (AS400SecurityException e) - { - // TODO Auto-generated catch block - e.printStackTrace(); - } - catch (IOException e) - { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - try - { - Job[] jobs = systemObject_.getJobs(AS400.DATABASE); - System.out.println("Host Server job(s): "); - - for(int i = 0 ; i< jobs.length; i++) - { - System.out.println(jobs[i]); - } - } - catch(Exception exc){} - - try - { - System.out.println ("Toolbox is paused. Press ENTER to continue."); - System.in.read (); - } - catch (Exception exc) {}; - } - - - addTestcase (new JDDMDAxx (systemObject_, - namesAndVars_, runMode_, fileOutputStream_, - password_)); - - addTestcase (new JDDMDDxx (systemObject_, - namesAndVars_, runMode_, fileOutputStream_, - password_)); - - addTestcase (new JDDMDGetBestRowIdentifier (systemObject_, - namesAndVars_, runMode_, fileOutputStream_, - password_)); - - addTestcase (new JDDMDGetCatalogs (systemObject_, - namesAndVars_, runMode_, fileOutputStream_, - password_)); - - addTestcase (new JDDMDGetColumnPrivileges (systemObject_, - namesAndVars_, runMode_, fileOutputStream_, - password_)); - - addTestcase (new JDDMDGetColumns (systemObject_, - namesAndVars_, runMode_, fileOutputStream_, - password_)); - - addTestcase (new JDDMDGetCrossReference (systemObject_, - namesAndVars_, runMode_, fileOutputStream_, - password_)); - - addTestcase (new JDDMDGetExportedKeys (systemObject_, - namesAndVars_, runMode_, fileOutputStream_, - password_)); - - addTestcase (new JDDMDGetFunctions (systemObject_, - namesAndVars_, runMode_, fileOutputStream_, - password_)); - - addTestcase (new JDDMDGetFunctionColumns (systemObject_, - namesAndVars_, runMode_, fileOutputStream_, - password_)); - - - addTestcase (new JDDMDGetImportedKeys (systemObject_, - namesAndVars_, runMode_, fileOutputStream_, - password_)); - - addTestcase (new JDDMDGetIndexInfo (systemObject_, - namesAndVars_, runMode_, fileOutputStream_, - password_)); - - addTestcase (new JDDMDGetPrimaryKeys (systemObject_, - namesAndVars_, runMode_, fileOutputStream_, - password_)); - - addTestcase (new JDDMDGetProcedureColumns (systemObject_, - namesAndVars_, runMode_, fileOutputStream_, - password_)); - - addTestcase (new JDDMDGetProcedures (systemObject_, - namesAndVars_, runMode_, fileOutputStream_, - password_)); - - addTestcase (new JDDMDGetSchemas (systemObject_, - namesAndVars_, runMode_, fileOutputStream_, - password_)); - - addTestcase (new JDDMDGetTablePrivileges (systemObject_, - namesAndVars_, runMode_, fileOutputStream_, - password_)); - - addTestcase (new JDDMDGetTablePrivileges3 (systemObject_, - namesAndVars_, runMode_, fileOutputStream_, - password_)); - - addTestcase (new JDDMDGetTables (systemObject_, - namesAndVars_, runMode_, fileOutputStream_, - password_)); - - addTestcase (new JDDMDGetTableTypes (systemObject_, - namesAndVars_, runMode_, fileOutputStream_, - password_)); - - addTestcase (new JDDMDGetTypeInfo (systemObject_, - namesAndVars_, runMode_, fileOutputStream_, - password_)); - - addTestcase (new JDDMDGetUDTs (systemObject_, - namesAndVars_, runMode_, fileOutputStream_, - password_)); - - addTestcase (new JDDMDGetVersionColumns (systemObject_, - namesAndVars_, runMode_, fileOutputStream_, - password_)); - addTestcase (new JDDMDGetPseudoColumns (systemObject_, - namesAndVars_, runMode_, fileOutputStream_, - password_)); - - addTestcase (new JDDMDGetXxx (systemObject_, - namesAndVars_, runMode_, fileOutputStream_, - password_)); - - addTestcase (new JDDMDIsXxx (systemObject_, - namesAndVars_, runMode_, fileOutputStream_, - password_)); - - addTestcase (new JDDMDMisc (systemObject_, - namesAndVars_, runMode_, fileOutputStream_, - password_)); - - addTestcase (new JDDMDNullXxx (systemObject_, - namesAndVars_, runMode_, fileOutputStream_, - password_)); - - addTestcase (new JDDMDStoresXxx (systemObject_, - namesAndVars_, runMode_, fileOutputStream_, - password_)); - - addTestcase (new JDDMDSupportsXxx (systemObject_, - namesAndVars_, runMode_, fileOutputStream_, - password_)); - - addTestcase (new JDDMDUsesXxx (systemObject_, - namesAndVars_, runMode_, fileOutputStream_, - password_)); - - addTestcase (new JDDMDXxxAreXxx (systemObject_, - namesAndVars_, runMode_, fileOutputStream_, - password_)); - addTestcase (new JDDMDWrapper(systemObject_, - namesAndVars_, runMode_, fileOutputStream_, - password_)); - addTestcase (new JDDMDPerformance(systemObject_, - namesAndVars_, runMode_, fileOutputStream_, - password_)); - - addTestcase (new JDDMDCCSID65535(systemObject_, - namesAndVars_, runMode_, fileOutputStream_, - password_)); - - + addTestcase(new JDDMDCCSID65535(systemObject_, namesAndVars_, runMode_, fileOutputStream_, password_)); - } + } } - - diff --git a/src/test/JDHostName.java b/src/test/JDHostName.java index 951dedc3..c77f5260 100644 --- a/src/test/JDHostName.java +++ b/src/test/JDHostName.java @@ -37,13 +37,21 @@ static void initializeProperties() { renameProperties = new Properties(); File f = new File(INI_FILE); if (f.exists()) { - FileInputStream fileInputStream; + FileInputStream fileInputStream = null; try { fileInputStream = new FileInputStream(f); renameProperties.load(fileInputStream); fileInputStream.close(); } catch (Exception e) { e.printStackTrace(); + if (fileInputStream != null) + try { + fileInputStream.close(); + } catch (IOException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + } } } diff --git a/src/test/JDJSTPBlobUtil.java b/src/test/JDJSTPBlobUtil.java index 29a4a6f0..d46141bc 100644 --- a/src/test/JDJSTPBlobUtil.java +++ b/src/test/JDJSTPBlobUtil.java @@ -174,7 +174,7 @@ public static void main(String[] args) { System.out.println("Unrecognized option: \""+args[0]+"\""); usage(); } - + conn.close(); } } catch (Exception e) { diff --git a/src/test/JDJobName.java b/src/test/JDJobName.java index b75f5baa..672c3326 100644 --- a/src/test/JDJobName.java +++ b/src/test/JDJobName.java @@ -1434,7 +1434,7 @@ public static void showProcessOutput(Process p, String outfile) throws Exception writer.write((char) outByte); readByte = iStream.read(); } - + iStream.close(); // System.out.println(); if (debug) { if (bufferCount > 0) { @@ -1491,6 +1491,7 @@ public static void showProcessOutput(Process p, String outfile) throws Exception readByte = iStream.read(); } + iStream.close(); if (debug) { if (bufferCount > 0) { System.out.println(); diff --git a/src/test/JDPMDTest.java b/src/test/JDPMDTest.java index d9bd3530..629defd3 100644 --- a/src/test/JDPMDTest.java +++ b/src/test/JDPMDTest.java @@ -41,6 +41,8 @@ import com.ibm.as400.access.AS400SecurityException; import com.ibm.as400.access.Job; +import test.JD.JDParallelCounter; +import test.JD.JDSerializeFile; import test.JD.JDSetupCollection; import test.JD.PMD.JDPMDGetDB2ParameterName; import test.JD.PMD.JDPMDGetDirection; @@ -95,6 +97,8 @@ public class JDPMDTest private Connection connection_; private Statement statement_; + private JDParallelCounter parallelCounter_; + /** @@ -160,15 +164,10 @@ public void setup () PMDTEST_SET = COLLECTION + ".PMDTEST_SET"; } -/* - try { - Statement s = connection_.createStatement(); - s.executeUpdate("DROP COLLECTION " + COLLECTION); - s.close(); - } catch (SQLException e) { - // Don't worry if it doesn't drop - it probably doesn't exist. - } -*/ + parallelCounter_ = new JDParallelCounter(connection_, COLLECTION); + + + JDSetupCollection.create (systemObject_, connection_, COLLECTION, out_); @@ -179,8 +178,9 @@ public void setup () // Setup PMDTEST_SET table. boolean lobSupport = true; StringBuffer buffer = new StringBuffer (); - dropTable(statement_, PMDTEST_SET); - buffer.append ("CREATE TABLE "); + + JDSerializeFile serializeFile =new JDSerializeFile(connection_, PMDTEST_SET); + buffer.append ("CREATE OR REPLACE TABLE "); buffer.append (PMDTEST_SET); buffer.append ("(C_SMALLINT SMALLINT NOT NULL "); // 1 buffer.append (",C_INTEGER INTEGER "); // 2 @@ -206,9 +206,10 @@ public void setup () buffer.append(",C_BIGINT BIGINT NOT NULL"); // 19 else buffer.append(",C_BIGINT INTEGER NOT NULL"); // 19 - buffer.append (")"); + buffer.append (") ON REPLACE DELETE ROWS "); statement_.executeUpdate (buffer.toString ()); + serializeFile.close(); // Setup stored procedure. JDSupportedFeatures supportedFeatures_= new JDSupportedFeatures(this); @@ -245,7 +246,10 @@ public void setup () public void cleanup () throws Exception { + if (parallelCounter_.doCleanup()) { statement_.executeUpdate ("DROP TABLE " + PMDTEST_SET); + } + parallelCounter_.close(); statement_.close (); connection_.commit(); // for xa diff --git a/src/test/JDPSTest.java b/src/test/JDPSTest.java index e6013e65..aa3922a0 100644 --- a/src/test/JDPSTest.java +++ b/src/test/JDPSTest.java @@ -562,18 +562,20 @@ public void cleanup () System.out.println("JDPSTest.cleanup not cleaning because jobs are running"); } - parallelCounter_.close(); + + statement_.close (); + try { + connection_.commit(); // for xa + } catch (Exception e) { + } - statement_.close (); - try { - connection_.commit(); // for xa - } catch (Exception e) { - } + if (dropUDTfailed) { + System.out.println("Drop of UDT failed. Dropping collection so that next run will work"); + dropCollections(connection_); + } + + parallelCounter_.close(); - if (dropUDTfailed) { - System.out.println("Drop of UDT failed. Dropping collection so that next run will work"); - dropCollections(connection_); - } connection_.close (); diff --git a/src/test/JDRSTest.java b/src/test/JDRSTest.java index 77f38e8c..4bc46854 100644 --- a/src/test/JDRSTest.java +++ b/src/test/JDRSTest.java @@ -1264,15 +1264,24 @@ public void setup() throws Exception { || (exceptionInfo.indexOf("type *SQLUDT already exists") > 0)) { System.out.println( "WARNING: found '" + exceptionInfo + "': deleting collection"); - if (connection_ != null) + if (parallelCounter_.doCleanup()) { + parallelCounter_.close(); connection_.close(); - connection_ = getConnection(getBaseURL(), systemObject_.getUserId(), + connection_ = getConnection(getBaseURL(), systemObject_.getUserId(), encryptedPassword_, "INFO_JDRSTEST_SETUP"); - - JDTestDriver.dropCollection(connection_, COLLECTION); - - System.out.println("WARNING: attemping to run setup again"); - setup2(); + parallelCounter_ = new JDParallelCounter(connection_, COLLECTION); + if (parallelCounter_.doCleanup()) { + JDTestDriver.dropCollection(connection_, COLLECTION); + + System.out.println("WARNING: attemping to run setup again"); + setup2(); + parallelCounter_.close(); + parallelCounter_ = new JDParallelCounter(connection_, COLLECTION); + + } + } else { + throw e; + } } diff --git a/src/test/JDTestDriver.java b/src/test/JDTestDriver.java index 39428340..a7350830 100644 --- a/src/test/JDTestDriver.java +++ b/src/test/JDTestDriver.java @@ -16,6 +16,7 @@ import com.ibm.as400.access.AS400; import com.ibm.as400.access.AS400JDBCDriver; +import test.JD.JDParallelCounter; import test.JD.JDSerializeFile; import java.sql.Connection; @@ -410,39 +411,48 @@ public static void dropDistinctType(Statement s, String typeName) * Drops a collection. **/ public static void dropCollection(Connection c, String collection) { - String sql = ""; - Statement s = null; - try { - s = c.createStatement(); - // Make sure the sysreply list is being used - // - System.out.println("Dropping collection " + collection + "."); + String sql = ""; + try (Statement s = c.createStatement()) { + JDParallelCounter parallelCounter = new JDParallelCounter(c, collection); + if (parallelCounter.doCleanup()) { - sql = "CALL QSYS2.QCMDEXC('CHGJOB INQMSGRPY(*SYSRPYL) ')"; - s.executeUpdate(sql); - sql = "CALL QSYS2.QCMDEXC('ENDJRNPF FILE(*ALL) JRN("+collection+"/QSQJRN)')"; - try { - s.executeUpdate(sql); - } catch (SQLException e) { - if (JDCleanup.isImportantException(e )) { - System.out.println("Warning: sql failed in dropCollection:"+sql); - e.printStackTrace(System.out); - } - } - sql = "DROP COLLECTION " + collection; - try { + // Make sure the sysreply list is being used + // + System.out.println("Dropping collection " + collection + "."); + + sql = "CALL QSYS2.QCMDEXC('CHGJOB INQMSGRPY(*SYSRPYL) ')"; s.executeUpdate(sql); - } catch (SQLException e) { - int sqlcode = e.getErrorCode(); - if (sqlcode == -910) { /* pending change */ - sql = "CALL QSYS2.QCMDEXC('DLTLIB "+collection+"')"; + sql = "CALL QSYS2.QCMDEXC('ENDJRNPF FILE(*ALL) JRN(" + collection + "/QSQJRN)')"; + try { + s.executeUpdate(sql); + } catch (SQLException e) { + if (JDCleanup.isImportantException(e)) { + System.out.println("Warning: sql failed in dropCollection:" + sql); + e.printStackTrace(System.out); + } + } + sql = "DROP COLLECTION " + collection; + try { s.executeUpdate(sql); + } catch (SQLException e) { + int sqlcode = e.getErrorCode(); + if (sqlcode == -910) { /* pending change */ + sql = "CALL QSYS2.QCMDEXC('DLTLIB " + collection + "')"; + s.executeUpdate(sql); + } } + } else { + System.out.println("Not cleaning because parallelCounter indicates "+collection+" in use"); } - s.close(); - } catch (SQLException e) { - if (JDCleanup.isImportantException(e)) { - System.out.println(e.getMessage()+" SQL="+sql); + parallelCounter.close(); + } catch (Exception e) { + if (e instanceof SQLException) { + if (JDCleanup.isImportantException((SQLException) e)) { + System.out.println(e.getMessage() + " SQL=" + sql); + } + } else { + System.out.println("WARNING: cleanup failed"); + e.printStackTrace(System.out); } } } @@ -1155,10 +1165,10 @@ private void grantPackagePermissions(String url, String library, String userId) + packageName + " TO " + userId); } - + rs.close(); grantStatement.close(); queryStatement.close(); - + changeConnection.close(); } catch (Exception e) { System.out.println("Warning: exception caught granting " + userId + " permssion to packages in " + library); @@ -1338,6 +1348,7 @@ public static Connection getNativeConnection(String url, String uid, char[] encr connection = (Connection) JDReflectionUtil.callMethod_O(nativeDriver, "connect", url, uid, pwdChars); PasswordVault.clearPassword(pwdChars); } catch (Exception e) { + if (connection != null) connection.close(); String attemptedPassword; if (pwdChars != null) attemptedPassword = new String(pwdChars); @@ -1613,6 +1624,7 @@ void runCommand(Connection connection, String command, boolean SQLNaming) sql = "DROP PROCEDURE QCMDEXC"; statement.executeUpdate(sql); statement.close(); + pstmt.close(); } catch (Exception e) { System.out.println("Exception on " + sql); e.printStackTrace(); diff --git a/src/test/JDXMLTest.java b/src/test/JDXMLTest.java index 7b07191c..ae84d32e 100644 --- a/src/test/JDXMLTest.java +++ b/src/test/JDXMLTest.java @@ -1,4 +1,4 @@ -/////////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////////// // // JTOpen (IBM Toolbox for Java - OSS version) // diff --git a/src/test/JTA/JTAUDBIasp.java b/src/test/JTA/JTAUDBIasp.java index c124258d..71a5d7a2 100644 --- a/src/test/JTA/JTAUDBIasp.java +++ b/src/test/JTA/JTAUDBIasp.java @@ -111,25 +111,9 @@ protected void getIaspInfo() throws SQLException { } catch (Exception e) { } stmt.executeUpdate("Delete from QGPL.IASPSTATUS"); + + stmt.executeUpdate("INSERT INTO QGPL.IASPSTATUS (select DEVICE_DESCRIPTION_NaME, ASP_STATE from qsys2.asp_info where ASP_NUMBER > 32)"); - StringBuffer shellCommand = new StringBuffer( - "QSH CMD('system ''wrkcfgsts *dev *asp'' | grep DEV | sed ''s/^ *\\([^ ][^ ]*\\) *\\([^ ][^ ]*\\) *\\([^ ].*\\)/db2 \"insert into qgpl.iaspstatus values(''\"''\"''\\1''\"''\"'', ''\"''\"''\\3''\"''\"'')\"/'' | sh') "); - while (shellCommand.length() < 210) { - shellCommand.append(" "); - } - - try { - stmt.executeUpdate("CREATE PROCEDURE QGPL.QCMDEXC(IN :CMDSTR VARCHAR(1024),IN :CMDLENGTH DECIMAL(15,5)) EXTERNAL NAME QSYS.QCMDEXC LANGUAGE C GENERAL "); - } catch (Exception e) { - - } - CallableStatement cstmt = localConnection_ - .prepareCall("CALL QGPL.QCMDEXC(?,000000200.00000)"); - String commandString = shellCommand.toString(); - output_.println("Running " + commandString); - cstmt.setString(1, commandString); - cstmt.executeUpdate(); - cstmt.close(); ResultSet rs = stmt.executeQuery("Select * from QGPL.IASPSTATUS"); while (rs.next()) { @@ -143,7 +127,7 @@ protected void getIaspInfo() throws SQLException { } } } - + rs.close(); stmt.close(); } @@ -157,6 +141,7 @@ protected void setup () { super.setup(); + lockSystem("JTATEST",600); localConnection_ = testDriver_.getConnection (baseURL_, userId_, encryptedPassword_); @@ -247,6 +232,7 @@ protected void setup () protected void cleanup () throws Exception { + unlockSystem(); } public void doit(String test, String message) { diff --git a/src/test/JavaAppTestcase.java b/src/test/JavaAppTestcase.java index 7b8d58db..0cf506be 100644 --- a/src/test/JavaAppTestcase.java +++ b/src/test/JavaAppTestcase.java @@ -351,6 +351,7 @@ public void Var012 () assertCondition ((listener.lastEvent_.getPropertyName ().equals ("as400")) && (listener.lastEvent_.getOldValue () == systemObject_) && (listener.lastEvent_.getNewValue () == system2)," addPropertyChangeListener() runs incorrectly!"); + system2.close(); } catch (Exception e) { failed (e, "Unexpected Exception"); @@ -423,6 +424,7 @@ public void Var015 () assertCondition ((listener.lastEvent_.getPropertyName ().equals ("as400")) && (listener.lastEvent_.getOldValue () == systemObject_) && (listener.lastEvent_.getNewValue () == system2)," addVetoableChangeListener() runs incorrectly."); + system2.close(); } catch (Exception e) { failed (e, "addVetoableChangeListener() error."); @@ -1346,6 +1348,7 @@ public void Var059() Method tested:getSystem() - Ensure the method runs well. **/ + @SuppressWarnings("resource") public void Var060() { try @@ -1363,6 +1366,7 @@ public void Var060() Method tested:getSystem(),setSystem() - Ensure the method runs well. **/ + @SuppressWarnings("resource") public void Var061() { try @@ -1371,6 +1375,7 @@ public void Var061() AS400 as400 = new AS400(); s.setSystem(as400); assertCondition(s.getSystem().equals(as400)," getSystem() runs incorrectly!"); + as400.close(); } catch (Exception e) { diff --git a/src/test/Sec/SecVrmTestcase.java b/src/test/Sec/SecVrmTestcase.java index 698322e1..47693ee1 100644 --- a/src/test/Sec/SecVrmTestcase.java +++ b/src/test/Sec/SecVrmTestcase.java @@ -162,7 +162,7 @@ public void Var009() { } /** - * Signon to a V7R2 system and verify the release. + * Signon to the next release system and verify the release. **/ public void Var010() { try { @@ -174,7 +174,8 @@ public void Var010() { system.connectService(AS400.PRINT); try { int release = system.getRelease(); - assertCondition(release == 6, "Incorrect release =" + release + " - test runs to " + VNEXT_SYSTEM_NAME); + assertCondition(release == 7, /* guess on next name */ + "Incorrect release =" + release + " - test runs to " + VNEXT_SYSTEM_NAME); } finally { system.disconnectService(AS400.PRINT); system.close(); diff --git a/src/test/TestDriverStatic.java b/src/test/TestDriverStatic.java index 40523ac2..29d04d50 100644 --- a/src/test/TestDriverStatic.java +++ b/src/test/TestDriverStatic.java @@ -69,8 +69,7 @@ public class TestDriverStatic static SimpleDateFormat timeStampFormatter_ = new SimpleDateFormat( "yyyy-MM-dd HH:mm z" ); static void init() { - // Make sure the static constructor above is called to load the - // security manager + } /** @@ -194,7 +193,6 @@ public static void runApplication(TestDriverI testDriver) if (!servlet_ && !systemExitDisabled_) { - TestDriverSecurityManager.setAllowExit(true); System.exit(0); } }