Tests

Introduction

Some predefined tests are delivered as part of the AMPLIFY Managed File Transfer solution. They can be used to test whether the environment is correctly installed and set.
Test related objects are organized in the following way:

Test script installation

Test environment configuration

Environment information must be set in a common configuration file used by all test scripts: /conf/config.
This file must be updated with your environment specific values:

  • Information related to API Manager access
    • APIManagerAPIUserLogin
    • APIManagerAPIUserPwd
    • APIManagerbaseURL
  • Information related to Central Governance (CG) access:
    • CG_URL
    • CG_LOGIN
    • CG_ORG
    • CG_PASSWOR
    • CG_TOKEN_FILE
  • option to enable flow deployment
  • Information related to the Central Governance objects to use to test the flows:

NAME_APP_SOURCE1

Name of the Central Governance Application when used as source of a test flow
NAME_APP_TARGET1 Name of the Central Governance Application when used as target of a test flow
NAME_PARTNER_SOURCE1 Name of the Central Governance Partner when user as source of a test flow
NAME_PARTNER_TARGET1 Name of the Central Governance Partner when user as target of a test flow
NAME_CFT_SOURCE1

Name of the CFT as registered in Central Governance for the Application when used as source of a test flow

NAME_CFT_TARGET1 Name of the CFT as registered in Central Governance for the Application when used as target of a test flow
NAME_CFT_RELAY1 Name of the CFT as registered in Central Governance when used as a Relay of a test flow
NAME_SECURE_TRANSPORT1 Name of the Secure Transport as registered in Central Governance when used as a Relay of a test flow


Test configuration

Some setup must be performed before the test submission:

  • Central Governance configuration setup: some objects must exist in Central Governance to run the test
  • Test script configuration setup: some objects previously created in Central Governance must be referenced in the test configuration

Central Governance configuration

Before launching a test, check that:

  • SecureTransport (ST) is registered in Central Governance with the correct protocols (SecureTransport Server Communication Profiles in Central Governance). These protocols will depend on the patterns that you want to use.
  • Transfer CFT (CFT) is registered in Central Governance with the correct protocols. These protocols will depend on the patterns that you want to use.
  • The correct Client Communication profiles have been created:
  • For partners sending files to SecureTransport:
    To check that you can list these partners' Client Communication Profiles, use the Central Governance API:
    GET /partners/{businessId}/communicationprofiles
  • For SecureTransport sending files to partners
    To check that you can list these partners' Client Communication Profiles, use the Central Governance API
    GET /products/{businessId}/communicationprofiles

You'll probably need to create these Client Communication profiles, using the Central Governance APIs:

  • POST /partners/{businessId}/communicationprofiles
    or
  • POST /products/{businessId}/communicationprofiles

To know which JSON input to pass to these APIs, proceed as follows:

  1. First create the flow using the Central Governance GUI.
    This will create a Client Communication Profile.
  2. Then use the Central Governance APIs to get the JSON that describes the kind of Client Communication Profile that you need
    GET /partners/{businessId}/communicationprofiles or
    GET /products/{businessId}/communicationprofiles
  3. Remove the metadata
  4. For test purposes, you can call these APIs from the Central Governance API doc: http://apidocs.axway.com/swagger-ui/index.html?productname=CentralGovernance&productversion=1.1.3&filename=cg_public_api.json

Test script configuration

One file must be updated:

  • One common configuration file in which previously created Central Governance resources are listed

Optionally each pattern or sample model can be customized to fit test needs :

  • Update input payload
  • Change the deployment option for this unique test
  • Use specific Central Governance objects if required

Common test configuration file

Update the configuration file /conf/config by updating the section # CG Resources needed for tests , as follows:

  • The first part is used to set the name of Central Governance resources you need for tests (used resources are pattern dependent so you only need to fulfill resource names for resources you will use in your tests. For example, if you don't use SecureTransport, you don't need to create SecureTransport resource in Central Governance and you don't need to fulfill the related variable: NAME_SECURE_TRANSPORT1).
  • In front of each field, you need to add the name of the resource you create in Central Governance. For example, if you create an application named APP1 in Central Governance, you need to have NAME_APP_SOURCE1=APP1 in the configuration file.
  • All names defined in the configuration files are used by the test shell scripts.

CRUD specifics

<flow_number> \TestFlowToConf.sh  script is used as a payload while sending CREATE requests.

<flow_number> \TestFlowToConfUpdate.sh script is used as a payload while sending UPDATE requests. The script may contain properties which need to be updated only. It does not require the full set of the JSON object properties.

Test script submission

All tests are submitted from test root directory scripts :

  • To test model samples :

    ./TestFlowToConf.sh [<pattern id>]
  • To test patterns :

    ./TestPatternToConf.sh [<pattern id>]
  • To test model CRUD operations:

    ./TestCRUDFlowToConf.sh [<pattern id>]
  • To test pattern CRUD operations:

    ./TestCRUDPatternToConf.sh [<pattern id>]
  • To test model applications CRUD operations:

    ./TestCRUDBusinessApplications.sh [<application id>]
  • To test pattern applications CRUD operations:

    ./TestCRUDPatternApplications.sh [<application id>]
  • To test model partners CRUD operations:

    ./TestCRUDBusinessPartners.sh [<partner id>]
  • To test pattern partners CRUD operations:

    ./TestCRUDPatternPartners.sh [<partner id>]

If the command specifies a pattern Id, application id or partner id, then the tests will be limited to that entity. Otherwise the test will run for all patterns.

Test results

For all tests the scripts will first gather Central Governance Objetcs Id from the configured Central Governance instance. The result should be like this :

 #########################################
 #   Get Business IDs                    #
 #########################################

...

fetching Sales app2id...
Sales=6d58381b-0f4b-45fb-939b-f131b122522a
fetching Billing US app2id...
Billing US=2efae110-599a-4682-975e-9ce2ab0f55af
fetching elfy-refenv-cft2 product2id...
elfy-refenv-cft2=a63bda86-d8f9-448d-8e6a-773b1d74da24
fetching elfy-refenv-cft3 product2id...
elfy-refenv-cft3=f2ccbe7f-f7aa-46f1-90c2-2d37510a5486
fetching SFTP_Partner partner2id...
SFTP_Partner=31398af3-c172-47d8-9e11-850b9571a9c7
fetching SFTP_internal partner2id...
SFTP_internal=51c16e70-9bd5-4277-a8cf-4fc856f73c87
fetching elfy-refenv-cft4 product2id...
elfy-refenv-cft4=63a8c638-dc37-4b88-8380-8c31326fbe62
fetching st-refenv2 product2id...
st-refenv2=6fb95e01-dc2b-4b4d-8362-2468c34e7445


For OK tests

If the test is OK, a flow is created in Central Governance. The script will display one line with the HTML return code (201 CREATED)  and the name API URL :

 - 201 : BusinessAPI/RESTRICT-0000_APP_CFT_PESIT_PUSH_CFT_APP

If the CRUD tests are OK the script will output the HTTP return code with the API URL:

 - POST 201 : PatternAPI/flows/0045_MULTI_PARTNER_SFTP_PUSH_ST_SFTP_PUSH_PARTNER
{
    "status": "201",
    "message": "flows creation OK",
    "data": { },
    "statusFlow": "{code=Deployed, timestamp=1526465410937}"
}
 - GET 200 : PatternAPI/flows/511955b0-6296-4426-9be0-026fa2eba1e0
{
    "status": "200",
    "message": "Get one OK",
    "data": { }
}
 - PUT 200 : PatternAPI/flows/0045_MULTI_PARTNER_SFTP_PUSH_ST_SFTP_PUSH_PARTNER/511955b0-6296-4426-9be0-026fa2eba1e0
{
    "status": "200",
    "message": "flows Update OK",
    "data": {}
}
 - GET ALL 200 : PatternAPI/flows
{
    "status": "200",
    "message": "Get All OK",
    "data": [
        {
            "businessId": "8184ba1d-f36f-46df-bae4-e611e70e7c1d",
            "model": {},
            "flows": {},
			"statusFlow": "{code=Deployed, deployed=[], timestamp=1525851333600}"
        {
            "businessId": "b1e35f01-dfc3-405f-a0ac-65eaf4a8862f",
            "model": {},
            "flows": {},
			"statusFlow": "{code=Deployed, deployed=[], timestamp=1526399611556}"
    ]
}
 - DELETE 202 : PatternAPI/flows/511955b0-6296-4426-9be0-026fa2eba1e0
{
    "status": "202",
    "message": "flows Delete OK",
    "data": {
        "href": "https://cg:6900/Axway/CentralGovernance/default/CentralGovernance/api/v2/flows/b1e35f01-dfc3-405f-a0ac-65eaf4a8862f",
        "message": "Delete request was triggered for flow with id b1e35f01-dfc3-405f-a0ac-65eaf4a8862f"
    }
}

For KO tests

In case of an error during the creation of the flow, one line with the error code is displayed followed by the error message. The structure of the message is as follows:

{
    "status"  : "string", /* http return code */
    "code"    : "string", /* Digital MFT solution return code */
    "message" : "string", /* Digital MFT solution error label */
    "errors"  : "string", /* error label provided by CG */
    "context" : "string" /* Context positioned by API Gateway to help the error diagnosis */
} 


Example:

- 409 : BusinessAPI/RESTRICT-0000_APP_CFT_PESIT_PUSH_CFT_APP
{
    "status"  : "409",
    "code"    : "ERR-0001",
    "message" : "Flow creation KO",
    "errors"  : "A flow with the same name already exists.",
    "context" : "Error during CG Flow Creation API Call"
} 

CRUD example output:

 - POST 400 : PatternAPI/flows/0045_MULTI_PARTNER_SFTP_PUSH_ST_SFTP_PUSH_PARTNER
{
    "status": "400",
    "code": "ERR-0003",
    "message": "Pattern Mapping KO",
    "errors": "flow_idf is required",
    "context": "Error during mapping"
}
 - POST 409 : PatternAPI/flows/0045_MULTI_PARTNER_SFTP_PUSH_ST_SFTP_PUSH_PARTNER
{
    "status": "409",
    "code": "ERR-0001",
    "message": "flows creation KO",
    "errors": "A flow with the same name already exists.",
    "context": "Error during CG flows Creation API Call"
}
 - GET 404 : PatternAPI/flows/4d6d5eac-7eb8-417e-993a-77368d7e987b
{
    "status": "404",
    "code": "ERR-0001",
    "message": "Get One KO",
    "errors": "Resource 'flow' with business id '44ba08a7-3aae-4203-a9f3-30b72efcc' does not exist.",
    "context": "Error during CG flows API Call"
}
 - PUT 400 : PatternAPI/flows/0045_MULTI_PARTNER_SFTP_PUSH_ST_SFTP_PUSH_PARTNER/4d6d5eac-7eb8-417e-993a-77368d7e987b
{
  "status"      : "400",
  "code"        : "ERR-0003",
  "message"     : "Pattern Mapping KO",
  "errors"      : "invalid input for field 'source_protocol_sftp_transfer_mode' : 'INVALID_MODE' must be one of AUTODETECT,BINARY,ASCII",
  "context"     : "Error during mapping"
} 
 - PUT 404 : PatternAPI/flows/0045_MULTI_PARTNER_SFTP_PUSH_ST_SFTP_PUSH_PARTNER/44ba08a7-3aae-4203-a9f3-30b72efccb
{
    "status": "404",
    "code": "ERR-0001",
    "message": "flows was not updated in CG",
    "errors": "Resource 'flow' with business id '44ba08a7-3aae-4203-a9f3-30b72efccb' does not exist.",
    "context": "Error during CG flows Update API Call"
}
 - DELETE 404 : PatternAPI/flows/null
{
  "status"      : "404",
  "code"        : "ERR-0001",
  "message"     : "flows Delete KO",
  "errors"      : "Resource 'flow' with business id 'null' does not exist.",
  "context"     : "Error during CG flows Delete API Call"
} 

Related Links