- Plugin name:
sfdc - Plugin class:
io.gatehill.imposter.plugin.sfdc.SfdcPluginImpl
- Basic Salesforce mock implementation.
- Non-persistent SObject creation.
- Non-persistent SObject update.
- SObject retrieval by ID.
- Dummy SOQL queries.
To use this plugin, install it with the Imposter CLI:
imposter plugin install -d mock-sfdc
This will install the plugin version matching the current engine version used by the CLI. The next time you run imposter up, the plugin will be available.
To use this plugin, download the imposter-plugin-mock-sfdc.jar JAR file from the Releases page.
Enable it with the following environment variables:
IMPOSTER_PLUGIN_DIR="/path/to/dir/containing/plugin"
Read the Configuration section to understand how to configure Imposter.
Note: Clients interacting with this plugin often require TLS/SSL to be enabled. If this is the case for your client, ensure that you use an https:// scheme for accessing the mock server. See the TLS/SSL section in the TLS/SSL section for more details.
Note: Typically, an OAuth2 login step precedes interactions with the SFDC API. As part of this, the mock server is required to return an instance_url to the client. Imposter uses the 'server URL', which is described in the Usage section.
For working examples, see:
mock/sfdc/src/test/resources/config
Let's assume your configuration is in a folder named config.
CLI example:
imposter up ./config --engine-type docker-all
Docker example:
docker run -ti -p 8080:8080 \
-v $PWD/config:/opt/imposter/config \
outofcoffee/imposter-all \
--serverUrl http://localhost:8080
Standalone Java example:
java -jar distro/all/build/libs/imposter-all.jar \
--configDir ./config \
--serverUrl http://localhost:8080
This starts a mock server using the SFDC plugin. Responses are served based on the configuration files inside the config folder.
Using the example above, you can connect a Salesforce client, such as ForceApi, to http://localhost:8080/ to interact with the API. In this example, you can interact with the Account SObject, as defined in sfdc-plugin-config.json and sfdc-plugin-data.json.
There are no additional script context objects available.