Class WebhookConfigurationBuilder
- java.lang.Object
-
- org.junit.rules.ExternalResource
-
- de.hybris.platform.webhookservices.WebhookConfigurationBuilder
-
- All Implemented Interfaces:
org.junit.rules.TestRule
public class WebhookConfigurationBuilder extends org.junit.rules.ExternalResourceA helper to be used in integration tests for creating and persistingWebhookConfigurations
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidafter()protected voidbefore()WebhookConfigurationModelbuild()Creates and persists a web hook configuration according to the specification performed so far on this builder.voidcleanup()Deletes all items persisted by this builder.static WebhookConfigurationBuilderwebhookConfiguration()Instantiates a web hook configuration builder, that is initialized to the default state.WebhookConfigurationBuilderwithDestination(ConsumedDestinationModel dest)Specifies destination for the web hook notifications.WebhookConfigurationBuilderwithDestination(ConsumedDestinationBuilder builder)Specifies destination for the web hook notifications.WebhookConfigurationBuilderwithEvent(java.lang.Class<? extends AbstractEvent> type)Specifies event type for the web hook configuration being builtWebhookConfigurationBuilderwithIntegrationObject(IntegrationObjectModelBuilder builder)Specifies integration object to be used for payload creation of the web hook notificationWebhookConfigurationBuilderwithIntegrationObject(java.lang.String ioCode)Specifies integration object to be used for payload creation of the web hook notificationWebhookConfigurationBuilderwithScriptFilter(java.lang.String scriptCode)Specifies a script that will be used as a filter for the items processed by the webhook being built.
-
-
-
Method Detail
-
webhookConfiguration
public static WebhookConfigurationBuilder webhookConfiguration()
Instantiates a web hook configuration builder, that is initialized to the default state.- Returns:
- a builder ready for further specifications
-
withEvent
public WebhookConfigurationBuilder withEvent(java.lang.Class<? extends AbstractEvent> type)
Specifies event type for the web hook configuration being built- Parameters:
type- type of the event that will be processed by the web hook configuration- Returns:
- a builder with the event type specified
-
withDestination
public WebhookConfigurationBuilder withDestination(ConsumedDestinationBuilder builder)
Specifies destination for the web hook notifications.- Parameters:
builder- a builder specifying the destination- Returns:
- a builder with the destination specified
-
withDestination
public WebhookConfigurationBuilder withDestination(ConsumedDestinationModel dest)
Specifies destination for the web hook notifications.- Parameters:
dest- a destination to be used by the web hook configuration- Returns:
- a builder with the destination specified
-
withIntegrationObject
public WebhookConfigurationBuilder withIntegrationObject(java.lang.String ioCode)
Specifies integration object to be used for payload creation of the web hook notification- Parameters:
ioCode- code of the integration object to be associated with the web hook configuration- Returns:
- a builder with the integration object specified
-
withIntegrationObject
public WebhookConfigurationBuilder withIntegrationObject(IntegrationObjectModelBuilder builder)
Specifies integration object to be used for payload creation of the web hook notification- Parameters:
builder- an integration object builder specifying the integration object to be used by the webhook.- Returns:
- a builder with the integration object specified
-
withScriptFilter
public WebhookConfigurationBuilder withScriptFilter(java.lang.String scriptCode)
Specifies a script that will be used as a filter for the items processed by the webhook being built.- Parameters:
scriptCode- code of the script existing in the system, that will be used as a filter for the webhook. Ifnull, or blank or this method was not called, then no filter will be used.- Returns:
- a builder with the filter specified
-
build
public WebhookConfigurationModel build() throws ImpExException
Creates and persists a web hook configuration according to the specification performed so far on this builder.- Returns:
- The created WebhookConfigurationModel
- Throws:
ImpExException- if the createdWebhookConfigurationfailed to persist
-
before
protected void before() throws ImpExException- Overrides:
beforein classorg.junit.rules.ExternalResource- Throws:
ImpExException
-
after
protected void after()
- Overrides:
afterin classorg.junit.rules.ExternalResource
-
cleanup
public void cleanup()
Deletes all items persisted by this builder.
-
-