1 /** 2 * Copyright 2005-2013 The Kuali Foundation 3 * 4 * Licensed under the Educational Community License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.opensource.org/licenses/ecl2.php 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package org.kuali.rice.krms.test; 17 18 import org.junit.Before; 19 import org.junit.Test; 20 import org.kuali.rice.krms.api.repository.type.KrmsTypeBoService; 21 import org.kuali.rice.krms.api.repository.type.KrmsTypeDefinition; 22 import org.kuali.rice.krms.impl.repository.KrmsTypeBoServiceImpl; 23 import org.kuali.rice.krms.impl.repository.PropositionBoService; 24 import org.kuali.rice.test.BaselineTestCase.BaselineMode; 25 import org.kuali.rice.test.BaselineTestCase.Mode; 26 27 @BaselineMode(Mode.CLEAR_DB) 28 public class PropositionBoServiceTest extends AbstractBoTest { 29 //public class PropositionBoServiceTest extends LightWeightBoTest { 30 31 private PropositionBoService propositionBoService; 32 private KrmsTypeBoService krmsTypeBoService; 33 34 @Before 35 public void setup() { 36 37 krmsTypeBoService = new KrmsTypeBoServiceImpl(); 38 ((KrmsTypeBoServiceImpl) krmsTypeBoService).setBusinessObjectService(getBoService()); 39 40 // dao.setJcdAlias("krmsDataSource"); 41 // 42 // // wire up BO services 43 // 44 // propositionBoService = new PropositionBoServiceImpl(); 45 // ((PropositionBoServiceImpl)propositionBoService).setBusinessObjectService(getBoService()); 46 // 47 // contextRepository = new ContextBoServiceImpl(); 48 // ((ContextBoServiceImpl)contextRepository).setBusinessObjectService(getBoService()); 49 // 50 // krmsTypeRepository = new KrmsTypeBoServiceImpl(); 51 // ((KrmsTypeBoServiceImpl)krmsTypeRepository).setBusinessObjectService(getBoService()); 52 } 53 54 @Test 55 public void creationTest() { 56 57 // KrmsType for context 58 KrmsTypeDefinition krmsContextTypeDefinition = KrmsTypeDefinition.Builder.create("KrmsTestContextType", "KRMS").build(); 59 krmsContextTypeDefinition = krmsTypeBoService.createKrmsType(krmsContextTypeDefinition); 60 61 // // Context 62 // ContextDefinition.Builder contextBuilder = ContextDefinition.Builder.create("KRMS", "testContext"); 63 // contextBuilder.setTypeId(krmsContextTypeDefinition.getId()); 64 // ContextDefinition contextDefinition = contextBuilder.build(); 65 // contextDefinition = contextRepository.createContext(contextDefinition); 66 // 67 // // output TermSpec 68 // TermSpecificationDefinition outputTermSpec = 69 // TermSpecificationDefinition.Builder.create(null, contextDefinition.getId(), 70 // "outputTermSpec", "java.lang.String").build(); 71 // outputTermSpec = propositionBoService.createTermSpecification(outputTermSpec); 72 // 73 // // prereq TermSpec 74 // TermSpecificationDefinition prereqTermSpec = 75 // TermSpecificationDefinition.Builder.create(null, contextDefinition.getId(), 76 // "prereqTermSpec", "java.lang.String").build(); 77 // prereqTermSpec = propositionBoService.createTermSpecification(prereqTermSpec); 78 // 79 // // KrmsType for TermResolver 80 // KrmsTypeDefinition krmsTermResolverTypeDefinition = KrmsTypeDefinition.Builder.create(null, "KrmsTestResolverType", "KRMS").build(); 81 // krmsTermResolverTypeDefinition = krmsTypeRepository.createKrmsType(krmsTermResolverTypeDefinition); 82 // 83 // // TermResolver 84 // TermResolverDefinition termResolverDef = 85 // TermResolverDefinition.Builder.create(null, "KRMS", "testResolver", krmsTermResolverTypeDefinition.getId(), 86 // TermSpecificationDefinition.Builder.create(outputTermSpec), 87 // Collections.singleton(TermSpecificationDefinition.Builder.create(prereqTermSpec)), 88 // null, 89 // Collections.singleton("testParamName")).build(); 90 // termResolverDef = propositionBoService.createTermResolver(termResolverDef); 91 // 92 // // Term Param 93 // TermParameterDefinition.Builder termParamBuilder = 94 // TermParameterDefinition.Builder.create(null, null, "testParamName", "testParamValue"); 95 // 96 // // Term 97 // TermDefinition termDefinition = 98 // TermDefinition.Builder.create(null, TermSpecificationDefinition.Builder.create(outputTermSpec), Collections.singleton(termParamBuilder)).build(); 99 // propositionBoService.createTerm(termDefinition); 100 } 101 102 }