CodeSVby CA Technologies

Class Repository

Prerequisite httpclient-4.5.1.jar httpcore-4.4.4.jar commons-logging-1.2.jar gson-2.6.2.jar From release 1.3.0, CodeSV provides functionality for defining class repositories containing predefined transactions. The main advantage of class repositories is the easy reuse of defined transactions between different tests and test classes in the same project. It also improves the combination of transactions and provides a single place to configure […]

Read more

Post Call Verification

Post Call Verification CodeSV supports post execution verification. This makes it possible to check how many times a specific request was invoked. It is possible to check all possible HTTP methods using verify methods for example; verifyGet(String url). It is also possible to create complex verification’s using matchers with which you can filter only specific request matching criteria. […]

Read more

Magic Strings

CodeSV supports generation of Magic Strings. Magic Strings are basically references to information/data from an incoming request that will be replaced with actual values in the response from the service. Magic strings functionality is turned ON by default and it is possible to disable it using disableMagicStrings() in the API as seen in the example: forGet(URL) .doReturn( okMessage() .withJsonBody(JSON_EXAMPLES_PORTFOLIO) […]

Read more

Magic Dates

CodeSV supports generation of magic dates. There are two possible magic dates, the first one is based on the current date that is computed when the response is created and the second one is based on information from the request. The functionality of magic dates is by default turned ON but it is possible to disable it […]

Read more

Encoding

Encoded Request and Response (Compressed Payloads) CodeSV supports encoded requests and can work with them effortlessly as shown in the example below. The only requirement for working with compressed payloads is to define the header Content-Enconding with an algorithm. At the moment supported algorithms are deflate and gzip. This means that even when a compressed payload is sent in the […]

Read more

Basic Authorization

Basic Authorization CodeSV supports matching basic authorization requests with predefined methods. It is possible to directly match the username and password or use different matchers to do more complex assertions. You can combine more than one virtualized service to create more complex use cases as shown in the example below. It is also important to […]

Read more

URL Parameters

This service is configured to respond to GET requests. These are defined using the forGet(String url) method with a URL that contains a parameter {year}, that is matched against the real request URL. You can reference this parameter in the response body using the annotation ${attribute.year}, which is replaced with a real parameter from the request. URL […]

Read more

SOAP Virtualization

Both examples use an application generated from WSDL by Spring Boot called HelloWorldClient, that uses SOAP. This client is set to receive a SOAP request with name and surname and responds with a greeting that includes these details. TestRealService shows the request created by HelloWorldClient as it hits the real WebService, and as it sends […]

Read more

HTTPs

Using HTTPs protocol CodeSV supports the HTTPs protocol that is easily enabled by using the usingHttps() method. There are three required parameters to be specified: keystorePath points to the location of the keystore on the file system. keystorePassword specifies a password for the provided keystore. keyPassword specifies the password to a key. Note: In the provided example, we are using […]

Read more

Exporting Virtual Services from CodeSV

Use our handy export feature to share your virtualized assets with other team members and integrate seamlessly with our CA Service Virtualization solution. After you have created your custom service, you can export the executed HTTP requests from that service and the responses in to text files. These text files are created in a Request-Response […]

Read more