1   package test.tuigwaa;
2   
3   import org.seasar.framework.container.factory.SingletonS2ContainerFactory;
4   import org.seasar.tuigwaa.logic.LogicService;
5   import org.seasar.tuigwaa.logic.TgwEvent;
6   import org.seasar.tuigwaa.logic.TgwFunction;
7   import org.seasar.tuigwaa.logic.TgwLogic;
8   import org.seasar.tuigwaa.util.functor.TestProcedure;
9   import org.seasar.tuigwaa.util.functor.TruePredicate;
10  
11  
12  import junit.framework.TestCase;
13  
14  public class LogicServiceTest extends TestCase {
15  
16  	
17  	
18  	public void testBasicLogic(){
19  		if(!SingletonS2ContainerFactory.hasContainer()){
20  			SingletonS2ContainerFactory.init();
21  		}
22  		LogicService service = (LogicService)SingletonS2ContainerFactory.getContainer().getComponent(LogicService.class);
23  		
24  		
25  		TgwEvent tevent = new TgwEvent(TgwEvent.NOW, null);
26  		TgwFunction tfunction = new TgwFunction(TruePredicate.INSTANCE, new TestProcedure());
27  		TgwLogic tlogic = new TgwLogic("hoge", tevent, tfunction);	
28  		service.addLogic("junit", tlogic);
29  	
30  		service.saveLogics("junit");
31  		service.loadLogics("junit");
32  	}
33  }