001    /**
002     * Copyright 2005-2011 The Kuali Foundation
003     *
004     * Licensed under the Educational Community License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     * http://www.opensource.org/licenses/ecl2.php
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package org.kuali.rice.krms.test;
017    
018    import org.junit.Before;
019    import org.junit.Test;
020    import org.kuali.rice.krms.api.repository.type.KrmsTypeDefinition;
021    import org.kuali.rice.krms.api.repository.type.KrmsTypeRepositoryService;
022    import org.kuali.rice.krms.impl.repository.KrmsTypeBoServiceImpl;
023    import org.kuali.rice.krms.impl.repository.PropositionBoService;
024    import org.kuali.rice.test.BaselineTestCase.BaselineMode;
025    import org.kuali.rice.test.BaselineTestCase.Mode;
026    
027    @BaselineMode(Mode.CLEAR_DB)
028    public class PropositionBoServiceTest extends AbstractBoTest {
029    //public class PropositionBoServiceTest extends LightWeightBoTest {
030            
031            private PropositionBoService propositionBoService;
032            private KrmsTypeRepositoryService krmsTypeRepository;
033            
034            @Before
035            public void setup() {
036    
037                    krmsTypeRepository = new KrmsTypeBoServiceImpl();
038                    ((KrmsTypeBoServiceImpl) krmsTypeRepository).setBusinessObjectService(getBoService());
039                    
040    //              dao.setJcdAlias("krmsDataSource");
041    //              
042    //              // wire up BO services
043    //              
044    //              propositionBoService = new PropositionBoServiceImpl();
045    //              ((PropositionBoServiceImpl)propositionBoService).setBusinessObjectService(getBoService());
046    //
047    //              contextRepository = new ContextBoServiceImpl();
048    //              ((ContextBoServiceImpl)contextRepository).setBusinessObjectService(getBoService());
049    //              
050    //              krmsTypeRepository = new KrmsTypeBoServiceImpl();
051    //              ((KrmsTypeBoServiceImpl)krmsTypeRepository).setBusinessObjectService(getBoService());
052            }
053            
054            @Test
055            public void creationTest() {
056    
057                    // KrmsType for context
058                    KrmsTypeDefinition krmsContextTypeDefinition = KrmsTypeDefinition.Builder.create("KrmsTestContextType", "KRMS").build();
059                    krmsContextTypeDefinition = krmsTypeRepository.createKrmsType(krmsContextTypeDefinition);
060    
061    //              // Context
062    //              ContextDefinition.Builder contextBuilder = ContextDefinition.Builder.create("KRMS", "testContext");
063    //              contextBuilder.setTypeId(krmsContextTypeDefinition.getId());
064    //              ContextDefinition contextDefinition = contextBuilder.build();
065    //              contextDefinition = contextRepository.createContext(contextDefinition);
066    //              
067    //              // output TermSpec
068    //              TermSpecificationDefinition outputTermSpec = 
069    //                      TermSpecificationDefinition.Builder.create(null, contextDefinition.getId(), 
070    //                                      "outputTermSpec", "java.lang.String").build();
071    //              outputTermSpec = propositionBoService.createTermSpecification(outputTermSpec);
072    //
073    //              // prereq TermSpec
074    //              TermSpecificationDefinition prereqTermSpec = 
075    //                      TermSpecificationDefinition.Builder.create(null, contextDefinition.getId(), 
076    //                                      "prereqTermSpec", "java.lang.String").build();
077    //              prereqTermSpec = propositionBoService.createTermSpecification(prereqTermSpec);
078    //
079    //              // KrmsType for TermResolver
080    //              KrmsTypeDefinition krmsTermResolverTypeDefinition = KrmsTypeDefinition.Builder.create(null, "KrmsTestResolverType", "KRMS").build();
081    //              krmsTermResolverTypeDefinition = krmsTypeRepository.createKrmsType(krmsTermResolverTypeDefinition);
082    //
083    //              // TermResolver
084    //              TermResolverDefinition termResolverDef = 
085    //                      TermResolverDefinition.Builder.create(null, "KRMS", "testResolver", krmsTermResolverTypeDefinition.getId(), 
086    //                                      TermSpecificationDefinition.Builder.create(outputTermSpec), 
087    //                                      Collections.singleton(TermSpecificationDefinition.Builder.create(prereqTermSpec)), 
088    //                                      null, 
089    //                                      Collections.singleton("testParamName")).build();
090    //              termResolverDef = propositionBoService.createTermResolver(termResolverDef);
091    //
092    //              // Term Param
093    //              TermParameterDefinition.Builder termParamBuilder = 
094    //                      TermParameterDefinition.Builder.create(null, null, "testParamName", "testParamValue");
095    //              
096    //              // Term
097    //              TermDefinition termDefinition = 
098    //                      TermDefinition.Builder.create(null, TermSpecificationDefinition.Builder.create(outputTermSpec), Collections.singleton(termParamBuilder)).build();
099    //              propositionBoService.createTerm(termDefinition);
100            }
101    
102    }