org.kuali.rice.krms.test
Class RuleManagementBaseTest

java.lang.Object
  extended by org.kuali.rice.test.BaseRiceTestCase
      extended by org.kuali.rice.test.RiceTestCase
          extended by org.kuali.rice.test.RiceInternalSuiteDataTestCase
              extended by org.kuali.rice.test.BaseModuleTestCase
                  extended by org.kuali.rice.test.BaselineTestCase
                      extended by org.kuali.rice.krms.test.KRMSTestCase
                          extended by org.kuali.rice.krms.test.RuleManagementBaseTest
All Implemented Interfaces:
MethodAware
Direct Known Subclasses:
RuleManagementActionDefinitionTest, RuleManagementAgendaItemDefinitionTest, RuleManagementAgendaTest, RuleManagementAgendaTreeDefinitionTest, RuleManagementContextDefinitionTest, RuleManagementNaturalLanguageTemplateTest, RuleManagementNaturalLanguageUsageTest, RuleManagementPropositionDefinitionTest, RuleManagementReferenceObjectBindingTest, RuleManagementRuleDefinitionTest

public abstract class RuleManagementBaseTest
extends KRMSTestCase

Base test case and methods for testing RuleManagementServiceImpl


Nested Class Summary
 
Nested classes/interfaces inherited from class org.kuali.rice.test.BaselineTestCase
BaselineTestCase.BaselineMode, BaselineTestCase.Mode
 
Field Summary
protected  ActionBoService actionBoService
           
protected  AgendaBoService agendaBoService
           
protected  String CLASS_DISCRIMINATOR
           
protected  ContextBoService contextRepository
           
protected  FunctionBoServiceImpl functionBoService
           
protected  KrmsAttributeDefinitionService krmsAttributeDefinitionService
           
protected  KrmsTypeRepositoryService krmsTypeRepository
           
protected  RuleBoService ruleBoService
           
protected  RuleManagementService ruleManagementService
           
protected  TermBoService termBoService
           
 
Fields inherited from class org.kuali.rice.test.BaselineTestCase
dirty
 
Fields inherited from class org.kuali.rice.test.BaseModuleTestCase
LOG, moduleName
 
Fields inherited from class org.kuali.rice.test.RiceTestCase
DEFAULT_TEST_HARNESS_SPRING_BEANS, failedSuiteTestName, perTestLifeCycles, SUITE_LIFE_CYCLES_FAILED, SUITE_LIFE_CYCLES_RAN, suiteLifeCycles
 
Fields inherited from class org.kuali.rice.test.BaseRiceTestCase
log, method
 
Constructor Summary
RuleManagementBaseTest()
           
 
Method Summary
protected  AgendaDefinition.Builder buildComplexAgenda(RuleManagementBaseTestObjectNames names)
           
protected  ActionDefinition buildTestActionDefinition(String actionId, String actionName, String actionDescr, int actionSequence, String ruleId, String namespace)
          buildTestActionDefinition creates Actions in the database for testing
protected  AgendaItemDefinition buildTestAgendaItemDefinition(String agendaItemId, String agendaId, String ruleId)
          buildTestAgendaItemDefinition will build aAgendaItemDefinition for testing
protected  ContextDefinition buildTestContext(String objectDiscriminator)
          Used to build a ContextDefinition in the database for testing.
protected  NaturalLanguageUsage buildTestNaturalLanguageUsage(String namespace, String nlUsageName)
          Used to build a NaturalLanguageUsage entry in the database for testing.
protected  RuleDefinition buildTestRuleDefinition(String namespace, String objectDiscriminator)
          buildTestRuleDefinition will create a RuleDefinition entry in the database
protected  AgendaDefinition.Builder createComplexAgenda(String namespace, String namespaceType, RuleManagementBaseTestObjectNames names)
          createComplexAgenda creates a "complex" agenda object in the database for testing Structure of the created agenda is as shown here.
protected  KrmsTypeDefinition createKrmsActionTypeDefinition(String nameSpace)
           
protected  KrmsTypeDefinition createKrmsTypeDefinition(String typeId, String nameSpace, String typeName, String serviceName)
          createKrmsTypeDefinition
protected  ReferenceObjectBinding.Builder createReferenceObjectBinding(String collectionName, String krmsObjectId, String krmsDiscriminatorType, String namespace, String referenceObjectId, String referenceDiscriminatorType, boolean active)
          createReferenceObjectBinding create a ReferenceObjectBinding entry in the database for testing
protected  AgendaDefinition createTestAgenda(String objectDiscriminator)
          createTestAgenda creates a Agenda set of entries in the database for testing Context ("ContextId0", "Namespace0", "ContextName0") Agenda ("AgendaId0", "AgendaName0") AgendaItem ("AI0") Rule ("RuleId0") where 0 represents a discriminator value
protected  PropositionDefinition createTestCompoundProposition(RuleManagementBaseTestObjectNames t0)
          createTestCompoundProposition Create a complex Compound Proposition entry in the database // ************************** // Compound Proposition (True if Account is 54321 and Occasion is either a Conference or Training) // *************************** // C1_compound_proposition "COMPOUND" "S1_simple_proposition" "S2_simple_proposition" "&" // S1_simple_proposition "SIMPLE" "Account" "54321" "=" // S2_simple_proposition "SIMPLE" "Occasion" "Conference" "="
protected  KrmsAttributeDefinition createTestKrmsAttribute(String id, String name, String namespace)
          createTestKrmsAttribute create KrmsAttribute in the database
protected  NaturalLanguageTemplate createTestNaturalLanguageTemplate(String namespace, String langCode, String nlObjectName, String template)
          Used to create a NaturalLanguageTemplate in the database for testing.
protected  NaturalLanguageTemplate createTestNaturalLanguageTemplate(String namespace, String langCode, String nlObjectName, String template, String nlUsage)
          Used to create a NaturalLanguageTemplate in the database for testing.
protected  PropositionDefinition createTestPropositionForRule(String objectDiscriminator)
          createTestPropositionForRule will create a PropositionDefinition entry in the database for test purposes The form of the Proposition is propId_simple_proposition "SIMPLE" "TSI_" + propId "ABC" "="
protected  PropositionDefinition createTestPropositionForTranslation(String objectDiscriminator, String namespace, String typeName)
          createTestPropositionForTranslation
protected  ReferenceObjectBinding.Builder createTestReferenceObjectBinding(String objectDiscriminator)
          createTestReferenceObjectBinding creates a ReferenceObjectBinding entry in the database for testing
protected  PropositionDefinition createTestSimpleProposition(String namespace, String propId, String termSpecId, String propConstant, String propOperator, String termSpecType, String ruleId, String termSpecDescr)
          createTestSimpleProposition creates a SIMPLE PropositionDefinition set of entries in the database
protected  TermSpecificationDefinition createTestTermSpecification(String termSpecId, String termSpecName, String namespace, String type, String termSpecDescr)
          createTestTermSpecification
protected  List<String> getPerTestTablesNotToClear()
          Setting it up so that KRMS tables are not reset between test methods to make it run much faster
 void setClassDiscriminator()
          Extending test classes can override setClassDiscriminator method and set a unique value for the class The override method should be called @before tests to ensure a unique discriminator for the class Test object naming is comprised of class, test and object uniqueness discriminators.
 void setup()
           
 
Methods inherited from class org.kuali.rice.krms.test.KRMSTestCase
getLoadApplicationLifecycle, getModuleName, getPerTestTablesToClear, getSuiteLifecycles, loadSuiteTestData
 
Methods inherited from class org.kuali.rice.test.BaselineTestCase
getClearDbPerTestLifecycles, getMode, getPerTestLifecycles, getRollbackClearDbPerTestLifecycles, getRollbackTestLifecycles, setUp
 
Methods inherited from class org.kuali.rice.test.RiceInternalSuiteDataTestCase
getKIMDataLoadOrderFile, getKIMSqlFileBaseLocation, getKRADDefaultSuiteTestData
 
Methods inherited from class org.kuali.rice.test.RiceTestCase
configureLogging, dumpMemory, getBaseDir, getConfigLocations, getFullTestName, getModuleTestConfigLocation, getRiceMasterDefaultConfigFile, getTestHarnessConfig, getTestHarnessSpringBeansLocation, getTestHarnessSpringResourceLoader, getUserDir, loadPerTestData, logAfterRun, logBeforeRun, report, setBaseDirSystemProperty, setClearTables, setModuleName, setUpInternal, startLifecycles, startSuiteDataLoaderLifecycles, stopLifecycles, tearDown
 
Methods inherited from class org.kuali.rice.test.BaseRiceTestCase
getName, getPerTestDataLoaderLifecycle, resetLogLevels, setLogLevel, setName, setTestMethod
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ruleManagementService

protected RuleManagementService ruleManagementService

termBoService

protected TermBoService termBoService

contextRepository

protected ContextBoService contextRepository

krmsTypeRepository

protected KrmsTypeRepositoryService krmsTypeRepository

ruleBoService

protected RuleBoService ruleBoService

agendaBoService

protected AgendaBoService agendaBoService

actionBoService

protected ActionBoService actionBoService

functionBoService

protected FunctionBoServiceImpl functionBoService

krmsAttributeDefinitionService

protected KrmsAttributeDefinitionService krmsAttributeDefinitionService

CLASS_DISCRIMINATOR

protected String CLASS_DISCRIMINATOR
Constructor Detail

RuleManagementBaseTest

public RuleManagementBaseTest()
Method Detail

setup

public void setup()

setClassDiscriminator

public void setClassDiscriminator()
Extending test classes can override setClassDiscriminator method and set a unique value for the class The override method should be called @before tests to ensure a unique discriminator for the class Test object naming is comprised of class, test and object uniqueness discriminators. The Class Discriminator is set by this method A Test Discriminator may be used to set unique test names at the start of each test. ex: RuleManagementBaseTestObjectNames.setTestObjectNames(testDiscriminator) The Object Discriminators are Sequential (object0, object1 ...)


getPerTestTablesNotToClear

protected List<String> getPerTestTablesNotToClear()
Setting it up so that KRMS tables are not reset between test methods to make it run much faster

Overrides:
getPerTestTablesNotToClear in class KRMSTestCase
Returns:

buildTestRuleDefinition

protected RuleDefinition buildTestRuleDefinition(String namespace,
                                                 String objectDiscriminator)
buildTestRuleDefinition will create a RuleDefinition entry in the database

Parameters:
namespace -
objectDiscriminator -
Returns:
RuleDefinition

buildTestAgendaItemDefinition

protected AgendaItemDefinition buildTestAgendaItemDefinition(String agendaItemId,
                                                             String agendaId,
                                                             String ruleId)
buildTestAgendaItemDefinition will build aAgendaItemDefinition for testing

Parameters:
agendaItemId -
agendaId -
ruleId -
Returns:
AgendaItemDefinition

buildTestActionDefinition

protected ActionDefinition buildTestActionDefinition(String actionId,
                                                     String actionName,
                                                     String actionDescr,
                                                     int actionSequence,
                                                     String ruleId,
                                                     String namespace)
buildTestActionDefinition creates Actions in the database for testing

Parameters:
actionId -
actionName -
actionDescr -
actionSequence -
ruleId -
namespace -
Returns:
ActionDefinition

createTestPropositionForRule

protected PropositionDefinition createTestPropositionForRule(String objectDiscriminator)
createTestPropositionForRule will create a PropositionDefinition entry in the database for test purposes The form of the Proposition is propId_simple_proposition "SIMPLE" "TSI_" + propId "ABC" "="

Parameters:
objectDiscriminator -
Returns:
PropositionDefinition

createTestPropositionForTranslation

protected PropositionDefinition createTestPropositionForTranslation(String objectDiscriminator,
                                                                    String namespace,
                                                                    String typeName)
createTestPropositionForTranslation

Parameters:
objectDiscriminator -
namespace -
typeId -
Returns:
PropositionDefinition

createTestSimpleProposition

protected PropositionDefinition createTestSimpleProposition(String namespace,
                                                            String propId,
                                                            String termSpecId,
                                                            String propConstant,
                                                            String propOperator,
                                                            String termSpecType,
                                                            String ruleId,
                                                            String termSpecDescr)
createTestSimpleProposition creates a SIMPLE PropositionDefinition set of entries in the database

Parameters:
namespace - of the proposition type
propId -
termSpecId -
propConstant -
propOperator -
termSpecType -
ruleId -
termSpecDescr -
Returns:
PropositionDefinition

createTestTermSpecification

protected TermSpecificationDefinition createTestTermSpecification(String termSpecId,
                                                                  String termSpecName,
                                                                  String namespace,
                                                                  String type,
                                                                  String termSpecDescr)
createTestTermSpecification

Parameters:
termSpecId -
termSpecName -
namespace -
type -
termSpecDescr -
Returns:
TermSpecificationDefinition

createKrmsTypeDefinition

protected KrmsTypeDefinition createKrmsTypeDefinition(String typeId,
                                                      String nameSpace,
                                                      String typeName,
                                                      String serviceName)
createKrmsTypeDefinition

Parameters:
nameSpace -
typeName -
serviceName -
Returns:
KrmsTypeDefinition

createTestAgenda

protected AgendaDefinition createTestAgenda(String objectDiscriminator)
createTestAgenda creates a Agenda set of entries in the database for testing Context ("ContextId0", "Namespace0", "ContextName0") Agenda ("AgendaId0", "AgendaName0") AgendaItem ("AI0") Rule ("RuleId0") where 0 represents a discriminator value

Parameters:
objectDiscriminator -
Returns:
AgendaDefinition.Builder

buildComplexAgenda

protected AgendaDefinition.Builder buildComplexAgenda(RuleManagementBaseTestObjectNames names)

createComplexAgenda

protected AgendaDefinition.Builder createComplexAgenda(String namespace,
                                                       String namespaceType,
                                                       RuleManagementBaseTestObjectNames names)
createComplexAgenda creates a "complex" agenda object in the database for testing Structure of the created agenda is as shown here. // agenda // agendaItem0 ( rule0) // WhenTrue agendaItem1( rule1 ) // WhenFalse agendaItem2( rule2 ) // Always agendaItem3( rule3 ) // agendaItem1 ( rule1 ) // Always agendaItem5 // agendaItem2 ( rule2 ) // WhenFalse agendaItem4 // Always agendaItem6 // agendaItem3 ( rule3 ) // agendaItem4 ( rule4 ) // agendaItem5 ( rule5 ) // agendaItem6 ( rule6 )

Parameters:
namespace - of the KRMS Agenda to be created
namespaceType - of the namepace passed (Namespace will be created if it does not exist.)
{@link - RuleManagementBaseTestObjectNames} Unique discriminator names to base created Agenda upon
Returns:
AgendaDefinition.Builder populated from the built agenda

createTestReferenceObjectBinding

protected ReferenceObjectBinding.Builder createTestReferenceObjectBinding(String objectDiscriminator)
createTestReferenceObjectBinding creates a ReferenceObjectBinding entry in the database for testing

Parameters:
objectDiscriminator -
Returns:
ReferenceObjectBinding.Builder

createReferenceObjectBinding

protected ReferenceObjectBinding.Builder createReferenceObjectBinding(String collectionName,
                                                                      String krmsObjectId,
                                                                      String krmsDiscriminatorType,
                                                                      String namespace,
                                                                      String referenceObjectId,
                                                                      String referenceDiscriminatorType,
                                                                      boolean active)
createReferenceObjectBinding create a ReferenceObjectBinding entry in the database for testing

Parameters:
collectionName -
krmsObjectId -
krmsDiscriminatorType -
namespace -
referenceObjectId -
referenceDiscriminatorType -
active -
Returns:
ReferenceObjectBinding.Builder

createTestNaturalLanguageTemplate

protected NaturalLanguageTemplate createTestNaturalLanguageTemplate(String namespace,
                                                                    String langCode,
                                                                    String nlObjectName,
                                                                    String template)
Used to create a NaturalLanguageTemplate in the database for testing.

Parameters:
namespace - of the KRMS Type which may be created
langCode - The two character code of applicable language
nlObjectName - Seed value to create unique Template and Usage records
template - The text of the template for the Template record
Returns:
NaturalLanguageTemplate for the created Template

createTestNaturalLanguageTemplate

protected NaturalLanguageTemplate createTestNaturalLanguageTemplate(String namespace,
                                                                    String langCode,
                                                                    String nlObjectName,
                                                                    String template,
                                                                    String nlUsage)
Used to create a NaturalLanguageTemplate in the database for testing.

Parameters:
namespace - of the KRMS Type which may be created
langCode - The two character code of applicable language
nlObjectName - Seed value to create unique Template and Usage records
template - The text of the template for the Template record
nlUsage - NaturalLanguateUsageId for the Template record
Returns:
NaturalLanguageTemplate for the created Template

createTestKrmsAttribute

protected KrmsAttributeDefinition createTestKrmsAttribute(String id,
                                                          String name,
                                                          String namespace)
createTestKrmsAttribute create KrmsAttribute in the database

Parameters:
id -
name -
namespace -
Returns:
KrmsAttributeDefinition

buildTestNaturalLanguageUsage

protected NaturalLanguageUsage buildTestNaturalLanguageUsage(String namespace,
                                                             String nlUsageName)
Used to build a NaturalLanguageUsage entry in the database for testing. The test NaturalLanguageUsage object wll have the form Namespace as passed Name nlUsageName as passed Id "krms.nl." with nlUsageName appended Description "Description" with nlUsageName appended Active set to true A krms type entry will be created for the namespace name passed (if it doesn't already exist)

Parameters:
namespace - will be used as namespace name
nlUsageName - is the name of the NaturalLanguageUsage to be create
Returns:
NaturalLanguageUsage

buildTestContext

protected ContextDefinition buildTestContext(String objectDiscriminator)
Used to build a ContextDefinition in the database for testing. The test Context created will have the form ContextId0", "Namespace0", "ContextName0" where 0 represents the objectDiscriminator passed

Parameters:
objectDiscriminator - is a value use to create a unique test Context
Returns:
ContextDefinition for the created Template

createTestCompoundProposition

protected PropositionDefinition createTestCompoundProposition(RuleManagementBaseTestObjectNames t0)
createTestCompoundProposition Create a complex Compound Proposition entry in the database // ************************** // Compound Proposition (True if Account is 54321 and Occasion is either a Conference or Training) // *************************** // C1_compound_proposition "COMPOUND" "S1_simple_proposition" "S2_simple_proposition" "&" // S1_simple_proposition "SIMPLE" "Account" "54321" "=" // S2_simple_proposition "SIMPLE" "Occasion" "Conference" "="

Parameters:
t0 -
Returns:

createKrmsActionTypeDefinition

protected KrmsTypeDefinition createKrmsActionTypeDefinition(String nameSpace)


Copyright © 2005-2013 The Kuali Foundation. All Rights Reserved.