Class ScriptModelBuilder

java.lang.Object
org.junit.rules.ExternalResource
de.hybris.platform.integrationservices.scripting.ScriptModelBuilder
All Implemented Interfaces:
org.junit.rules.TestRule

public final class ScriptModelBuilder extends org.junit.rules.ExternalResource
A builder for creating scripts in the integration tests.
  • Method Details

    • groovyScript

      public static ScriptModelBuilder groovyScript()
      Creates a script builder with GROOVY script type already specified.
      Returns:
      a new script builder to use
    • script

      public static ScriptModelBuilder script()
      Creates a script builder without a script type specified.
      Returns:
      a new script builder to use
    • withCode

      public ScriptModelBuilder withCode(String code)
      Specifies code (ID) of the script in the model to create.
      Parameters:
      code - unique identifier of the script
      Returns:
      a builder with the code specified.
    • withType

      public ScriptModelBuilder withType(ScriptType type)
      Specifies a programming language to be used for the script content. If script type is not specified, i.e. this method is not called, then default ScriptType.GROOVY will be used.
      Parameters:
      type - a script type (language) to use for the script being created.
      Returns:
      a builder with the script type specified.
    • withContent

      public ScriptModelBuilder withContent(String content)
      Specifies content of the script.
      Parameters:
      content - the script content written in the ScriptType language.
      Returns:
      a builder with the script content specified
    • withDisabled

      public ScriptModelBuilder withDisabled(boolean disabled)
      Specifies whether this script is disabled or not.
      Parameters:
      disabled - true if script will be disabled otherwise false.
      Returns:
      a builder with the script disabled value specified
    • build

      public void build() throws ImpExException
      Builds a script model with the values specified by with... methods.
      Throws:
      ImpExException - if provided values are not correct for the impex script to create the model in the database.
    • cleanup

      public void cleanup()
      Removes all script models from the database.
    • before

      protected void before() throws ImpExException
      Overrides:
      before in class org.junit.rules.ExternalResource
      Throws:
      ImpExException
    • after

      protected void after()
      Overrides:
      after in class org.junit.rules.ExternalResource