Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer sapien purus, congue a tincidunt non, mollis vitae diam. Fusce pharetra massa interdum nisl ultrices mattis. Cras eget est ultricies magna auctor condimentum. Phasellus sed elit erat, a ultricies arcu. Proin vitae volutpat ante. Quisque porta tempor elit, non aliquam tortor sodales nec. Sed imperdiet metus sed orci adipiscing faucibus. Nulla facilisi. Nulla massa tortor, dapibus a vehicula vel, cursus vel mi. Integer sed lacus velit. Etiam dignissim varius turpis ut ullamcorper. Integer lobortis imperdiet dui, ut porta nulla interdum ac. Nulla neque lorem, bibendum et venenatis a, convallis in arcu. In sagittis neque ac mauris venenatis id elementum elit lacinia. Phasellus porttitor turpis eu ipsum pharetra eleifend. Integer ac magna sit amet mi luctus scelerisque at a odio. Quisque sed mi nibh, ac pretium felis. Nunc congue sapien sit amet ipsum elementum ac euismod justo mollis. Etiam dictum elementum libero sed sagittis.
Take a moment to familiarize yourself with the following Groovy constructs.
| Programming Construct | Example |
|---|---|
| To create a map |
map = [key1 : value1, key2 : value2] |
| To declare a new list |
list = [item1, item2] |
| To call static contract test helpers
Note: These methods are evaluated at the time of the user query. |
|
| Tip: |
You can avoid repeating the same prefix by grouping
statements inside of curly braces.
For example:
// path to bundle jar - property is set by ant - leave it as it is
testsuite.bundleJar=System.getProperty("bundleJar")
// ValidateApiOpTests
testsuite.Validate.iterations="3"
testsuite {
// path to bundle jar - property is set by ant - leave it as it is
bundleJar=System.getProperty("bundleJar")
// ValidateApiOpTests
Validate.iterations="3"
}
|
Contract test configuration files (groovy files) are loaded as classpath resources with connector class full qualified name as basic prefix:
| Main configuration file |
${connectorName}/config/config.groovy |
| Optional configuration file for resource specific configurations |
${connectorName}/config/${configuration}/config.groovy |
| Private Main configuration file |
${connectorName}/config-private/config.groovy |
| Private Optional configuration file for resource specific configurations |
${connectorName}/config-private/${configuration}/config.groovy |
Environment variables and properties should be defined as follows:
| Note: | Properties defined in Main configuration files are overridden if new definitions are defined in subsequent Optional configuration files. |
Define the following five properties in the connector's property file:
{$user.home}\.connectors\bundle-name\config\${connectorName}\config-private\config.groovy
Note: The following script fragments are from the DatabaseTable connector's configuration files .
|
For
more information
See
connector
configuration properties
and
defining
properties
in the
In-depth
Guide
to learn
|
ant run-contract-tests
ant -DtestConfig=
conf1 run-contract-tests
// run contract tests and store all parameters (attributes values) used by tests in
test.properties
file
ant -Dtest.parameters.outFile=generated.properties run-contract-tests
Create a new JUnit run configuration and set values on the Test tab according to the following screenshot. Don't forget to set JUnit 4 Test runner .
On the Arguments tab, add the following VM arguments :
Add all projects connector dependencies to the
Classpath
so that you can debug them all, and also add references to all required
proprietary JARs.
Easy Steps
<project name="connector-ad" default="all">
<property name="framework.dir" value="../../framework"/>
<property name="bundles.dir" value="../"/>
<property name="contracts.run" value="true"/>
<import file="${framework.dir}/connector_build.xml"/>
</project>
|
First please review the Quick start guide (if you have not done that already).
To run tests against connectors running behind the Server, it is necessary to create a new configuration. (The framework/test-contract project is recommended, but it is generally possible to configure it for every project which has build.xml and imports connector_build.xml.)
Set the following properties in
${bundle.dir}/config/${connectorName}/config.groovy: and the private part to
${user.home}/.connectors/bundle-name/config/${connectorName}/config-private/config.groovy:
testsuite.serverHost="hostAddress"
testsuite.serverPort=portNumber
// e.g. 8759
// connector server key is "changeit" by default
testsuite.serverKey="server key"
Before running tests, compile the contract test suite by
running
ant
from within
framework/test-contract. This
step is necessary because the
run-contract-tests
ant target creates a new
connector.jar
that includes proprietary JARs. This is not necessary for
Connector Server
testing and it will be updated in the near future.
Make sure the Server is running on the host and port that you specified
in the
properties, and that the connector is running behind the Server. All
libraries
upon which the connector depends must be available to the
Server on the
Server classpath.
Tests are run from the bundle's
directory using command:
Running tests on Connector Server inside Eclipse
|
These methods are evaluated just in time of call.
Uses RandomGenerator's pattern as an argument for dynamic generation of random string or other types (second argument). Escaping works the following way:
Lazy.random("AAA\s\u\p\e\rAAA") // generates XIOsuperBYK, use \ to generate a constant characterTo generate certain types, use: (requirement, the given type shall have a constructor accepting strings.
Lazy.random("###\\.##", Long.class) // generates a random Long value