Class EventConfigurationBuilder
java.lang.Object
org.junit.rules.ExternalResource
de.hybris.platform.webhookservices.EventConfigurationBuilder
- All Implemented Interfaces:
org.junit.rules.TestRule
public class EventConfigurationBuilder
extends org.junit.rules.ExternalResource
A helper to be used in integration tests for creating and persisting
EventConfigurations-
Method Summary
Modifier and TypeMethodDescriptionprotected voidafter()build()Persists anEventConfigurationModelaccording to the specifications done so far in this builder.voidcleanup()Deletes all data created by this builder.static EventConfigurationBuilderInstantiates this builder.Specifies destination for event export.withDestination(DestinationTargetBuilder builder) Specifies destination for event export.withDestination(String code) Specifies destination for event export.withEventClass(Class<?> c) Specifies event class, for which the configuration has to be created.withEventClass(String className) Specifies event class, for which the configuration has to be created.withExport(Boolean flag) Specifies whether the event should be exported.withExportName(String name) Specifies name of the event in the export.withExtensionName(String name) Specifies name of the extension that owns the event configuration.Specifies that the event should not be exported.Specifies priority of the event export.withVersion(int v) Specifies version of the event configuration.Methods inherited from class org.junit.rules.ExternalResource
apply, before
-
Method Details
-
eventConfiguration
Instantiates this builder.- Returns:
- a builder instance to be used for further specification.
-
withEventClass
Specifies event class, for which the configuration has to be created. If this method is not called, the event class will default toAfterSaveEvent- Parameters:
c- an event class to build configuration for.- Returns:
- a builder with the event class specified
-
withEventClass
Specifies event class, for which the configuration has to be created. If this method is not called, the event class will default toItemSavedEvent- Parameters:
className- class name, i.e.Class.getName(), to be used for the event configuration.- Returns:
- a builder with the event class specified
-
withVersion
Specifies version of the event configuration.- Parameters:
v- version number to use for the event configuration being built. If the specified version has a non-positive value or this method is not called, default value of 1 will be used.- Returns:
- a builder with the event configuration version specified
-
withExportName
Specifies name of the event in the export. If this method is not called, default value of"webhookservices.<event_class_simple_name>"will be used. For example, if event class isde.hybris.platform.tx.AfterSaveEvent, then the default export name will be"webhookservices.AfterSaveEvent".- Parameters:
name- export name to be used for the event configuration being built- Returns:
- a builder with the event export name specified
-
withDestination
Specifies destination for event export. If this method is not called, default destination will be used.- Parameters:
builder- a builder specifying destination target parameters- Returns:
- a builder with the event export destination specified
-
withDestination
Specifies destination for event export. If this method is not called, default destination will be used.- Parameters:
code- a destination target to use for the event configuration being built- Returns:
- a builder with the event export destination specified
-
withDestination
Specifies destination for event export. If this method is not called, default destination will be used.- Parameters:
model- a destination target to use for the event configuration being built- Returns:
- a builder with the event export destination specified
-
withoutExport
Specifies that the event should not be exported. If this method is not called, then theexportFlagof the built configuration will have value oftrue.- Returns:
- a builder with
falseexport flag specified
-
withExport
Specifies whether the event should be exported. If this method is not called, then theexportFlagof the built configuration will have value oftrue.- Parameters:
flag-trueornull, if the event should be exported;false, otherwise.- Returns:
- a builder with
falseexport flag specified
-
withExtensionName
Specifies name of the extension that owns the event configuration. If this method is not called, then the extension name will be defaulted to"webhookservices".- Returns:
- a builder with the extension name specified
-
withPriority
Specifies priority of the event export. If this method is not called, defaultEventPriority.LOWwill be used.- Returns:
- a builder with the priority specified
-
build
Persists anEventConfigurationModelaccording to the specifications done so far in this builder.- Returns:
- the persisted event configuration or
null, if the created configuration was not saved in the database for some reason. - Throws:
ImpExException- if persistence crashes
-
after
protected void after()- Overrides:
afterin classorg.junit.rules.ExternalResource
-
cleanup
public void cleanup()Deletes all data created by this builder.
-