Class Scenario

  • All Implemented Interfaces:
    org.kie.soup.project.datamodel.imports.HasImports

    public class Scenario
    extends Object
    implements org.kie.soup.project.datamodel.imports.HasImports
    This represents a test scenario. It also encapsulates the result of a scenario run.
    • Constructor Detail

      • Scenario

        public Scenario()
      • Scenario

        public Scenario​(String packageName,
                        String name)
    • Method Detail

      • wasSuccessful

        public boolean wasSuccessful()
        Returns true if this was a totally successful scenario, based on the results contained.
      • insertBetween

        public void insertBetween​(Fixture fixtureBeforeTheNewOne,
                                  Fixture newFixture)
        Will slip in a fixture after the specified one, but before the next execution trace.
      • removeFixture

        public void removeFixture​(Fixture f)
        Remove the specified fixture.
      • removeExecutionTrace

        public void removeExecutionTrace​(ExecutionTrace executionTrace)
        Remove fixtures between this ExecutionTrace and the previous one.
      • getFactTypes

        public Map<String,​FactData> getFactTypes()
        Returns:
        A mapping of variable names to their fact data.
      • getVariableTypes

        public Map<String,​String> getVariableTypes()
        Returns:
        A mapping of variable names to their fact type.
      • getFactTypesToFactData

        public Map<String,​List<FactData>> getFactTypesToFactData()
        Returns:
        A mapping of Fact types to their Fact definitions.
      • getFactNamesInScope

        public List<String> getFactNamesInScope​(ExecutionTrace executionTrace,
                                                boolean includeGlobals)
        This will return a list of fact names that are in scope (including globals).
        Returns:
        List
      • isFactNameReserved

        public boolean isFactNameReserved​(String factName)
        Returns:
        true if a fact name is already in use.
      • isFactNameUsedInFactDataFixtures

        protected boolean isFactNameUsedInFactDataFixtures​(String factName)
      • isFactNameUsedInGlobals

        protected boolean isFactNameUsedInGlobals​(String factName)
      • isFactDataReferenced

        public boolean isFactDataReferenced​(FactData factData)
        Returns:
        true if a fact is actually used (ie if its not, its safe to remove it).
      • getFailureMessages

        public List<String> getFailureMessages()
        Returns:
        the list of failure messages
      • countFailuresTotal

        public int[] countFailuresTotal()
        Returns:
        int[0] = failures, int[1] = total;
      • fieldExpectationFailed

        protected boolean fieldExpectationFailed​(VerifyField verifyField)
      • ruleFailedToFire

        protected boolean ruleFailedToFire​(VerifyRuleFired verifyRuleFired)
      • getMaxRuleFirings

        public int getMaxRuleFirings()
      • setLastRunResult

        public void setLastRunResult​(Date lastRunResult)
      • getLastRunResult

        public Date getLastRunResult()
      • setInclusive

        public void setInclusive​(boolean inclusive)
      • isInclusive

        public boolean isInclusive()
      • setName

        public void setName​(String name)
      • getName

        public String getName()
      • setImports

        public void setImports​(org.kie.soup.project.datamodel.imports.Imports imports)
        Specified by:
        setImports in interface org.kie.soup.project.datamodel.imports.HasImports
      • getImports

        public org.kie.soup.project.datamodel.imports.Imports getImports()
        Specified by:
        getImports in interface org.kie.soup.project.datamodel.imports.HasImports
      • getPackageName

        public String getPackageName()
      • getKSessions

        public List<String> getKSessions()
      • setPackageName

        public void setPackageName​(String packageName)
      • getModelName

        public String getModelName()
      • setModelName

        public void setModelName​(String modelName)