use of org.jaffa.persistence.engines.IPersistenceEngineFactory in project jaffa-framework by jaffa-projects.
the class TestSupport method setupContext.
/**
* Common initializations
*
* @throws Exception
*/
@BeforeClass
public static void setupContext() throws Exception {
synchronized (lockObject) {
if (appContext != null) {
return;
}
// System.out.println("setupContext()");
appContext = new AnnotationConfigApplicationContext(JaffaRulesConfig.class, TestConfig.class);
assertNotNull(appContext);
Rule label = new Rule();
label.setName("label");
Parameter value = new Parameter();
value.setName("value");
label.addParameter(value);
Parameter condition = new Parameter();
condition.setName("condition");
label.addParameter(condition);
RuleRepository.instance().addRule(label);
// get fake model bean from combined app context
fakeModel = appContext.getBean("fakeModel", FakeModel.class);
assertNotNull(fakeModel);
engine = mock(IPersistenceEngine.class);
IPersistenceEngineFactory persistenceEngineFactory = mock(IPersistenceEngineFactory.class);
when(persistenceEngineFactory.newPersistenceEngine()).thenReturn(engine);
PersistenceEngineFactory.setFactory(persistenceEngineFactory);
}
}
Aggregations