Skip to content

Commit

Permalink
Testcase updates (#112)
Browse files Browse the repository at this point in the history
Signed-off-by: John Eberhard <[email protected]>
  • Loading branch information
jeber-ibm authored Dec 11, 2024
1 parent 35cdfae commit f019ca6
Show file tree
Hide file tree
Showing 14 changed files with 2,021 additions and 1,635 deletions.
67 changes: 66 additions & 1 deletion src/test/AS400/AS400NewInstance.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,28 @@ public void Var001() {
char[] password = PasswordVault.decryptPassword(encryptedPassword_);
testAs400.setPassword(password);
testAs400.connectService(AS400.SIGNON);
testAs400.connectService(AS400.RECORDACCESS);
PasswordVault.clearPassword(password);
Job[] jobs = testAs400.getJobs(AS400.SIGNON);
if (jobs.length == 0) {
sb.append("Error: no jobs for SIGNON");
succeeded = false;
}
for (int i = 0; i < jobs.length; i++) {
String serverJobName = jobs[i].getNumber() + "/" + jobs[i].getUser() + "/" + jobs[i].getName();
sb.append("connected to " + serverJobName);
}
assertCondition(jobs.length > 0 && succeeded, sb);
Job[] jobs2 = testAs400.getJobs(AS400.RECORDACCESS);
if (jobs2.length == 0) {
sb.append("Error: no jobs for RECORDACCESS");
succeeded = false;
}
for (int i = 0; i < jobs2.length; i++) {
String serverJobName = jobs2[i].getNumber() + "/" + jobs2[i].getUser() + "/" + jobs2[i].getName();
sb.append("connected to " + serverJobName);
}

assertCondition(succeeded, sb);
} catch (Exception e) {
failed(e, "Unexpected Exception: " + sb.toString());
}
Expand Down Expand Up @@ -139,4 +154,54 @@ public void Var002() {
}
}

/* Save as Var001 but with MFA */

public void Var003() {
boolean succeeded = true;
if (checkAdditionalAuthenticationFactor(systemName_)) {

try {

sb.setLength(0);
sb.append("Java home is " + System.getProperty("java.home"));
sb.append(AboutToolbox.getVersionDescription() + "\n");
sb.append("Calling newInstance to " + systemName_ + "\n");
AS400 testAs400 = (AS400) JDReflectionUtil.callStaticMethod_O("com.ibm.as400.access.AS400", "newInstance", true,
systemName_);
testAs400.setGuiAvailable(false);
initMfaUser();
testAs400.setUserId(mfaUserid_);
testAs400.setPassword(mfaPassword_);
testAs400.setAdditionalAuthenticationFactor(mfaFactor_);
sb.append("Connecting to SIGNON with "+mfaUserid_+"/"+new String(mfaPassword_)+" and factor "+new String(mfaFactor_)+"\n");
testAs400.connectService(AS400.SIGNON);
testAs400.connectService(AS400.RECORDACCESS);
sb.append("Connecting to RECORD with "+mfaUserid_+"/"+new String(mfaPassword_)+" and factor "+ new String(mfaFactor_)+"\n");

Job[] jobs = testAs400.getJobs(AS400.SIGNON);
if (jobs.length == 0) {
sb.append("Error: no jobs for SIGNON");
succeeded = false;
}
for (int i = 0; i < jobs.length; i++) {
String serverJobName = jobs[i].getNumber() + "/" + jobs[i].getUser() + "/" + jobs[i].getName();
sb.append("connected to " + serverJobName);
}
Job[] jobs2 = testAs400.getJobs(AS400.RECORDACCESS);
if (jobs2.length == 0) {
sb.append("Error: no jobs for RECORDACCESS");
succeeded = false;
}
for (int i = 0; i < jobs2.length; i++) {
String serverJobName = jobs2[i].getNumber() + "/" + jobs2[i].getUser() + "/" + jobs2[i].getName();
sb.append("connected to " + serverJobName);
}

assertCondition(succeeded, sb);
} catch (Exception e) {
failed(e, "Unexpected Exception: " + sb.toString());
}
}
}

}
1 change: 1 addition & 0 deletions src/test/AS400CertificateTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
//
///////////////////////////////////////////////////////////////////////////////


package test;

import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ public void Var009()
propertyTypes.put("maxRetriesForClientReroute","int");
propertyTypes.put("retryIntervalForClientReroute","int");
propertyTypes.put("enableSeamlessFailover","int");
propertyTypes.put("additionalAuthenticationFactore", "[C");
propertyTypes.put("additionalAuthenticationFactor", "[C");
propertyTypes.put("stayAlive", "int");


Expand Down
15 changes: 12 additions & 3 deletions src/test/AS400JDBC/AS400JDBCDataSourceBeanInfoTestcase.java
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ public void Var007()
boolean passed = true;
try
{
int expectedCount = 113;
int expectedCount = 115;
AS400JDBCDataSourceBeanInfo bi = new AS400JDBCDataSourceBeanInfo();
PropertyDescriptor[] pd = bi.getPropertyDescriptors();
if (pd.length != expectedCount) //@A1C @W1c @A3C @A4C //@B1C //@C1C //@PDC //@pdc //@pdc //@D3C //@AC1 //@cc1 @dmy 90=query timeout mechanism 91=query replace truncated parameter
Expand Down Expand Up @@ -430,7 +430,7 @@ public void Var007()
propertyTypes.put("packageCriteria", "java.lang.String");
propertyTypes.put("packageError", "java.lang.String");
propertyTypes.put("packageLibrary", "java.lang.String");
propertyTypes.put("password", "java.lang.String");
propertyTypes.put("password", "[C");
propertyTypes.put("portNumber", "int");
propertyTypes.put("prefetch", "boolean");
propertyTypes.put("prompt", "boolean");
Expand Down Expand Up @@ -512,7 +512,9 @@ public void Var007()
propertyTypes.put("maxRetriesForClientReroute","int");
propertyTypes.put("retryIntervalForClientReroute","int");
propertyTypes.put("enableSeamlessFailover","int");

propertyTypes.put("additionalAuthenticationFactor","[C");
propertyTypes.put("stayAlive","int");



for (int i=0; i< pd.length; i++)
Expand Down Expand Up @@ -645,6 +647,8 @@ public void Var007()
getPropertyMethods.put("retryIntervalForClientReroute","getRetryIntervalForClientReroute");
getPropertyMethods.put("enableSeamlessFailover","getEnableSeamlessFailover");

getPropertyMethods.put("additionalAuthenticationFactor","getAdditionalAuthenticationFactor");
getPropertyMethods.put("stayAlive","getStayAlive");

for (int i=0; i< pd.length; i++)
{
Expand Down Expand Up @@ -807,6 +811,9 @@ public void Var007()
setPropertyMethods.put("retryIntervalForClientReroute","setRetryIntervalForClientReroute");
setPropertyMethods.put("enableSeamlessFailover","setEnableSeamlessFailover");

setPropertyMethods.put("additionalAuthenticationFactor","setAdditionalAuthenticationFactor");
setPropertyMethods.put("stayAlive","setStayAlive");



Properties setPropertyMethods2 = new Properties() ;
Expand Down Expand Up @@ -981,6 +988,8 @@ public void Var007()

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");

for (int i=0; i< pd.length; i++)
{
Expand Down
6 changes: 6 additions & 0 deletions src/test/AS400Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,12 @@ public void createTestcases()
new AS400NewInstance(systemObject_,
namesAndVars_, runMode_,
fileOutputStream_, testLib_, password_, PwrSys);
tc.setTestcaseParameters(systemObject_, pwrSys_, systemName_, userId_, password_,
proxy_, mustUseSockets_, isNative_, isLocal_, onAS400_,
namesAndVars_, runMode_, fileOutputStream_,
pwrSysUserID_, pwrSysPassword_);


testcases_.addElement(tc);
namesAndVars_.remove("AS400NewInstance");
}
Expand Down
12 changes: 12 additions & 0 deletions src/test/JD/Statement/JDStatementStressTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1322,7 +1322,19 @@ public void cleanup() throws Exception {
* basic multithreaded case with Callable, Select, and Update
**/
public void Var001() {

if (getSubDriver() == JDTestDriver.SUBDRIVER_JTOPENCA) {
notApplicable("Multiple threads uses same connection causes problems for JDTOPENCA");
return;
}

if (getSubDriver() == JDTestDriver.SUBDRIVER_JTOPENSF) {
notApplicable("Multiple threads uses same connection causes problems for JDTOPENSF");
return;
}

try {

JDStatementStressUpdate ust[] = new JDStatementStressUpdate[2];
for (int i = 1; i <= ust.length; i++) {
ust[i - 1] = new JDStatementStressUpdate(testDriver_, connection_, i,
Expand Down
Loading

0 comments on commit f019ca6

Please sign in to comment.