Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions galasa-simbank-tests/dev.galasa.simbank.obr/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
<parent>
<groupId>dev.galasa</groupId>
<artifactId>galasa-simbanktests-parent</artifactId>
<version>0.16.0</version>
<version>0.23.0</version>
</parent>

<name>Galasa SimBank OBR</name>

<artifactId>dev.galasa.simbank.obr</artifactId>
<version>0.16.0</version>
<version>0.23.0</version>
<!-- If updating version, reflect change in build/docker/testcatalogs/pom.xml -->
<packaging>galasa-obr</packaging>

Expand All @@ -25,7 +25,7 @@
<dependency>
<groupId>dev.galasa</groupId>
<artifactId>dev.galasa.simbank.tests</artifactId>
<version>0.16.0</version>
<version>0.23.0</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion galasa-simbank-tests/dev.galasa.simbank.tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<name>Galasa SimBank Example Tests</name>

<artifactId>dev.galasa.simbank.tests</artifactId>
<version>0.16.0</version>
<version>0.23.0</version>
<!-- If updating version, reflect in dev.galasa.simbank.feature and dev.galasa.simbank.obr -->
<packaging>bundle</packaging>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,91 +5,75 @@
*/
package dev.galasa.simbank.tests;

import java.io.IOException;
import static org.assertj.core.api.Assertions.assertThat;

import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;

import org.apache.commons.logging.Log;
import org.assertj.core.api.Fail;

import dev.galasa.Test;
import dev.galasa.artifact.BundleResources;
import dev.galasa.artifact.IBundleResources;
import dev.galasa.artifact.TestBundleResourceException;
import dev.galasa.core.manager.Logger;
import dev.galasa.zos.IZosImage;
import dev.galasa.zos.ZosImage;
import dev.galasa.zosbatch.IZosBatch;
import dev.galasa.zosbatch.IZosBatchJob;
import dev.galasa.zosbatch.IZosBatchJobname;
import dev.galasa.zosbatch.ZosBatch;
import dev.galasa.zosbatch.ZosBatchException;
import dev.galasa.zosbatch.ZosBatchJobname;

@Test
public class BatchAccountsOpenTest {

@ZosImage(imageTag = "SIMBANK")
public IZosImage image;

@ZosBatch(imageTag="SIMBANK")
public IZosBatch zosBatch;

@ZosBatchJobname(imageTag="SIMBANK")
public IZosBatchJobname zosBatchJobname;
@ZosBatch(imageTag = "SIMBANK")
public IZosBatch zosBatch;

@BundleResources
public IBundleResources resources;

@Logger
public Log logger;

/**
* Test which uses the SIMBANK batch job to open a number of new accounts.
* The test passes if the job completes successfully (RC=0000)
* @throws TestBundleResourceException
* @throws IOException
* @throws ZosBatchException
* @throws Exception
*/
@Test
public void batchOpenAccountsTest() throws TestBundleResourceException, IOException, ZosBatchException {
public void batchOpenAccountsTest() throws Exception {
// Create a list of accounts to create
List<String> accountList = new LinkedList<>();
accountList.add("901000001,20-40-60,1000");
accountList.add("901000002,20-40-60,1000");
accountList.add("901000003,20-40-60,1000");
accountList.add("901000004,20-40-60,1000");
accountList.add("901000005,20-40-60,1000");
accountList.add("901000006,20-40-60,1000");
accountList.add("901000007,20-40-60,1000");
accountList.add("901000008,20-40-60,1000");
accountList.add("901000009,20-40-60,1000");

//Adds accounts 901000001-9 to the accountList.
for(int x=1; x<10; x++) {
accountList.add("90100000"+x+",20-40-60,1000");
logger.info("Account 90100000"+x+" Has been added to the acctList");
}

// Create the substitution parameters for the JCL
HashMap<String, Object> parameters = new HashMap<>();
parameters.put("CONTROL", "ACCOUNT_OPEN");
parameters.put("DATAIN", String.join("\n", accountList));
logger.info("Added accountList to the JCL substitution parameters.");

// Load the JCL with the given substitution parameters
String jcl = resources.retrieveSkeletonFileAsString("/resources/skeletons/SIMBANK.jcl", parameters);

// Submit the JCL
IZosBatchJob batchJob = zosBatch.submitJob(jcl, zosBatchJobname);
IZosBatchJob batchJob = zosBatch.submitJob(jcl, null);

// Wait for the batch job to complete
logger.info("batchJob.toString() = " + batchJob.toString());
int rc = batchJob.waitForJob();

// If highest CC was not 0, fail the test
if (rc != 0) {
// Print the job output to the run log
batchJob.retrieveOutput().forEach(jobOutput ->
logger.info("batchJob.retrieveOutput(): " + jobOutput.getDdname() + "\n" + jobOutput.getRecords() + "\n")
);
Fail.fail("Batch job failed RETCODE=" + batchJob.getRetcode() + " Check batch job output");

}
logger.info("Batch job complete RETCODE=" + batchJob.getRetcode());
assertThat(rc).withFailMessage("The return code for the JCL Job was not equal to 0, indicating a failure").isEqualTo(0);

assertThat(batchJob.getSpoolFile("SYSOUT").getRecords()).withFailMessage("The JCL SYSOUT Contains a line indicating a test failure.").doesNotContain("0 Error Report");

logger.info("Batch job complete RETCODE=" + rc);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,21 @@

import static org.assertj.core.api.Assertions.assertThat;

import java.io.IOException;
import java.net.URISyntaxException;
import org.apache.commons.logging.Log;

import dev.galasa.ICredentialsUsernamePassword;
import dev.galasa.Test;
import dev.galasa.artifact.BundleResources;
import dev.galasa.artifact.IBundleResources;
import dev.galasa.artifact.TestBundleResourceException;
import dev.galasa.core.manager.CoreManager;
import dev.galasa.core.manager.ICoreManager;
import dev.galasa.core.manager.Logger;
import dev.galasa.http.HttpClient;
import dev.galasa.http.HttpClientException;
import dev.galasa.http.IHttpClient;
import dev.galasa.zos.IZosImage;
import dev.galasa.zos.ZosImage;
import dev.galasa.zos.ZosManagerException;
import dev.galasa.zos3270.FieldNotFoundException;
import dev.galasa.zos3270.ITerminal;
import dev.galasa.zos3270.KeyboardLockedException;
import dev.galasa.zos3270.TerminalInterruptedException;
import dev.galasa.zos3270.TextNotFoundException;
import dev.galasa.zos3270.TimeoutException;
import dev.galasa.zos3270.Zos3270Terminal;
import dev.galasa.zos3270.spi.DatastreamException;
import dev.galasa.zos3270.spi.NetworkException;

@Test
public class SimBankIVT {
Expand All @@ -49,56 +40,52 @@ public class SimBankIVT {

@CoreManager
public ICoreManager coreManager;

@Test
public void testNotNull() {
// Check all objects loaded
assertThat(terminal).isNotNull();
assertThat(resources).isNotNull();
assertThat(client).isNotNull();
}

@Logger
public Log logger;

private ICredentialsUsernamePassword userPass;

/**
* Test which checks the initial balance of an account, uses the webservice to
* credit the account, then checks the balance again. The test passes if the
* final balance is equal to the old balance + the credited amount.
*
* @throws TestBundleResourceException
* @throws URISyntaxException
* @throws IOException
* @throws HttpClientException
* @throws ZosManagerException
* @throws TextNotFoundException
* @throws FieldNotFoundException
* @throws NetworkException
* @throws KeyboardLockedException
* @throws TimeoutException
* @throws DatastreamException
* @throws InterruptedException
* @throws Exception
*/

@Test
public void checkBankIsAvailable() throws TestBundleResourceException, URISyntaxException, IOException,
HttpClientException, ZosManagerException, DatastreamException, TimeoutException, KeyboardLockedException,
NetworkException, FieldNotFoundException, TextNotFoundException, TerminalInterruptedException {
public void checkBankIsAvailable() throws Exception {

// Register the password to the confidential text filtering service
coreManager.registerConfidentialText("SYS1", "IBMUSER password");
userPass = (ICredentialsUsernamePassword)image.getDefaultCredentials();
coreManager.registerConfidentialText(userPass.getPassword(), "Password for SIMBANK application");

// Logon through the session manager
terminal.waitForKeyboard().positionCursorToFieldContaining("Userid").tab().type("IBMUSER")
.positionCursorToFieldContaining("Password").tab().type("SYS1").enter().waitForKeyboard();
logger.info("Now entering username and password.");
terminal.wfk(); //Wait for text in field perhaps?
terminal.positionCursorToFieldContaining("Userid").tab().type(userPass.getUsername());

terminal.positionCursorToFieldContaining("Password").tab().type(userPass.getPassword());
terminal.enter().wfk();
logger.info("Username and password have now been input");

// Assert that the session manager has a bank session available
assertThat(terminal.retrieveScreen()).containsOnlyOnce("SIMPLATFORM MAIN MENU");
assertThat(terminal.retrieveScreen()).containsOnlyOnce("BANKTEST");


logger.info("There is a Simbank Session available.");

// Open banking application
terminal.pf1().waitForKeyboard().clear().waitForKeyboard();
terminal.type("bank").enter().waitForKeyboard();
terminal.pf1().wfk().clear().wfk();

terminal.type("bank").enter().wfk();

// Assert that the bank menu is showing
terminal.waitForTextInField("SIMBANK MAIN MENU");
assertThat(terminal.retrieveScreen()).containsOnlyOnce("Options Description PFKey ");
assertThat(terminal.retrieveScreen()).containsOnlyOnce("BROWSE Browse Accounts PF1");
assertThat(terminal.retrieveScreen()).containsOnlyOnce("TRANSF Transfer Money PF4");
logger.info("Simbank Main Menu has been reached");
}
}
}
2 changes: 1 addition & 1 deletion galasa-simbank-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<groupId>dev.galasa</groupId>
<artifactId>galasa-simbanktests-parent</artifactId>
<version>0.16.0</version>
<version>0.23.0</version>
<!-- If updating version, reflect change in dev.galasa.simbank.ui -->
<packaging>pom</packaging>

Expand Down