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.ExternalResourceA helper to be used in integration tests for creating and persistingEventConfigurations
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidafter()EventConfigurationModelbuild()Persists anEventConfigurationModelaccording to the specifications done so far in this builder.voidcleanup()Deletes all data created by this builder.static EventConfigurationBuildereventConfiguration()Instantiates this builder.EventConfigurationBuilderwithDestination(DestinationTargetModel model)Specifies destination for event export.EventConfigurationBuilderwithDestination(DestinationTargetBuilder builder)Specifies destination for event export.EventConfigurationBuilderwithDestination(java.lang.String code)Specifies destination for event export.EventConfigurationBuilderwithEventClass(java.lang.Class<?> c)Specifies event class, for which the configuration has to be created.EventConfigurationBuilderwithEventClass(java.lang.String className)Specifies event class, for which the configuration has to be created.EventConfigurationBuilderwithExport(java.lang.Boolean flag)Specifies whether the event should be exported.EventConfigurationBuilderwithExportName(java.lang.String name)Specifies name of the event in the export.EventConfigurationBuilderwithExtensionName(java.lang.String name)Specifies name of the extension that owns the event configuration.EventConfigurationBuilderwithoutExport()Specifies that the event should not be exported.EventConfigurationBuilderwithPriority(EventPriority p)Specifies priority of the event export.EventConfigurationBuilderwithVersion(int v)Specifies version of the event configuration.
-
-
-
Method Detail
-
eventConfiguration
public static EventConfigurationBuilder eventConfiguration()
Instantiates this builder.- Returns:
- a builder instance to be used for further specification.
-
withEventClass
public EventConfigurationBuilder withEventClass(java.lang.Class<?> c)
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
public EventConfigurationBuilder withEventClass(java.lang.String className)
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
public EventConfigurationBuilder withVersion(int v)
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
public EventConfigurationBuilder withExportName(java.lang.String name)
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
public EventConfigurationBuilder withDestination(DestinationTargetBuilder builder)
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
public EventConfigurationBuilder withDestination(java.lang.String code)
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
public EventConfigurationBuilder withDestination(DestinationTargetModel model)
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
public EventConfigurationBuilder 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
public EventConfigurationBuilder withExport(java.lang.Boolean flag)
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
public EventConfigurationBuilder withExtensionName(java.lang.String name)
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
public EventConfigurationBuilder withPriority(EventPriority p)
Specifies priority of the event export. If this method is not called, defaultEventPriority.LOWwill be used.- Returns:
- a builder with the priority specified
-
build
public EventConfigurationModel build() throws ImpExException
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.
-
-