REST test harness generator
The WebSphere Commerce REST framework is documented by a third-party API called
Swagger. Swagger documents each REST service in the form of JSON metadata, and is available for
download from the Swagger API discovery service. The CaslRestBuilder
generator tool
uses the metadata to generate the REST test harness API output to
CaslRestLib-Wc
.
You can verify that Swagger is working on your WebSphere Commerce Toolkit by starting the server. After the server is started, go to https://localhost/webapp/wcs/stores/servlet/swagger/index.jsp .
Generator usage
The example that is illustrated assumes that you already installed the Starter Store Test Automation assets, and are running the command from within the CaslRestBuilder project.
java WebServicesApiParser [-product <PRODUCT_TYPE>] [-wcHost <WC_HOSTNAME>] [--refresh-wc-lib]
[-outputDir <OUTPUT_DIR_PATH>] [--create-project] [-searchPort <SEARCH_PORT>] [-configDir
<CONFIG_DIR_PATH>] [-adminUsr <USER_NAME>] [-adminPass <PASSWORD>]
-product <PRODUCT_TYPE> |
A string that indicates the product type, such as wc to generate the REST API for. Currently, you can specify one product type to generate for, for example, the server to parse REST API metadata. Defaults to wc. |
-wcHost <WC_HOSTNAME> |
The host name of the machine that contains the running WebSphere Commerce Server, when it generates the REST API. Defaults to the localhost. |
--refresh-wc-lib |
The option to indicate that the parser must download and generate based on the most current
swagger metadata from the running server. If this option is not passed, the parser parses and
generates based on the JSON metadata that is provided with the supplied
|
-outputDir <OUTPUT_DIR> |
The path to the root folder to output the generated library code. Defaults to ../CaslRestLib |
--create-project |
Option to indicate to the generator to output project-specific files .project, .classpath, and build.gradle. If not passed, these files are not generated. |
-searchPort <SEARCH_PORT> |
The port of the running Search server. The default value is 80. |
-configDir <CONFIG_DIR> |
The relative path to the folder that contains all of the configuration files that are used by the generator. Defaults to config/ |
-adminUsr <USER_NAME> |
The administrative user who can access the Swagger documentation. |
-adminPass <PASSWORD> |
The administrative password for the user name who can access the Swagger documentation. |
java -cp
lib\*;..\StarterStoreTestAssetsDependencies\lib\*
com.ibm.commerce.qa.casl.generator.restservices.WebServicesApiParser -product WC -wcHost localhost
--refresh-wc-lib -outputDir ..\CaslRestLib-Wc