Search in sources :

Example 1 with StaticContext

use of org.jaffa.beans.factory.config.StaticContext in project jaffa-framework by jaffa-projects.

the class PersistentConfigValidatorTest method setup.

/**
 * Common setup
 *
 * @throws Exception
 */
@Before
public void setup() throws Exception {
    // create app context, do not need to include PersistentContext directly
    AnnotationConfigApplicationContext appContext = new AnnotationConfigApplicationContext(JaffaRulesConfig.class, TestModelPersistentConfig.class);
    assertNotNull(appContext);
    new StaticContext().setApplicationContext(appContext);
    // get validator factory bean from combined app context
    ValidatorFactory target = appContext.getBean(ValidatorFactory.class);
    assertNotNull(target);
    Realm realm = new Realm("realm");
    realm.setSource("Test");
    realm.regex(TestModelPersistent.class.getName());
    realm.register();
    ClassMetaData classMetaData = new ClassMetaData();
    classMetaData.setName(TestModelPersistent.class.getName());
    classMetaData.setVariation("DEF");
    classMetaData.setExecutionRealm(realm.getName());
    classMetaData.register();
}
Also used : AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) ValidatorFactory(org.jaffa.rules.fieldvalidators.ValidatorFactory) Realm(org.jaffa.rules.realm.Realm) ClassMetaData(org.jaffa.rules.meta.ClassMetaData) StaticContext(org.jaffa.beans.factory.config.StaticContext) Before(org.junit.Before)

Aggregations

StaticContext (org.jaffa.beans.factory.config.StaticContext)1 ValidatorFactory (org.jaffa.rules.fieldvalidators.ValidatorFactory)1 ClassMetaData (org.jaffa.rules.meta.ClassMetaData)1 Realm (org.jaffa.rules.realm.Realm)1 Before (org.junit.Before)1 AnnotationConfigApplicationContext (org.springframework.context.annotation.AnnotationConfigApplicationContext)1