当前位置: 首页>>代码示例>>Java>>正文


Java SimpleConfig类代码示例

本文整理汇总了Java中org.kuali.rice.core.framework.config.property.SimpleConfig的典型用法代码示例。如果您正苦于以下问题:Java SimpleConfig类的具体用法?Java SimpleConfig怎么用?Java SimpleConfig使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SimpleConfig类属于org.kuali.rice.core.framework.config.property包,在下文中一共展示了SimpleConfig类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initGRL

import org.kuali.rice.core.framework.config.property.SimpleConfig; //导入依赖的package包/类
@Before
public void initGRL() throws Exception {
    GlobalResourceLoader.stop();
    SimpleConfig config = new SimpleConfig();
    config.putProperty(CoreConstants.Config.APPLICATION_ID, "APPID");
    ConfigContext.init(config);

    StaticListableBeanFactory testBf = new StaticListableBeanFactory();
    when(kualiModuleService.getInstalledModuleServices()).thenReturn(installedModuleServices);

    testBf.addBean(KRADServiceLocator.PROVIDER_REGISTRY, mock(ProviderRegistry.class));
    testBf.addBean(KRADServiceLocatorWeb.KUALI_MODULE_SERVICE, kualiModuleService);

    ResourceLoader rl = new BeanFactoryResourceLoader(new QName("moduleservicebase-unittest"), testBf);
    GlobalResourceLoader.addResourceLoader(rl);
    GlobalResourceLoader.start();
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:18,代码来源:ModuleServiceBaseTest.java

示例2: initGrl

import org.kuali.rice.core.framework.config.property.SimpleConfig; //导入依赖的package包/类
@BeforeClass
public static void initGrl() throws Exception {

    ConfigContext.init(new SimpleConfig());
    ConfigContext.getCurrentContextConfig().putProperty(CoreConstants.Config.APPLICATION_ID, LegacyUtilsTest.class.getName());

    // have to mock these because LegacyDetectionAdvice is calling LegacyUtils
    MetadataRepository metadataRepository = mock(MetadataRepository.class);
    DataDictionaryService dataDictionaryService = mock(DataDictionaryService.class);
    ResourceLoader resourceLoader = mock(ResourceLoader.class);
    when(resourceLoader.getName()).thenReturn(QName.valueOf(LegacyUtilsTest.class.getName()));
    when(resourceLoader.getService(QName.valueOf("metadataRepository"))).thenReturn(metadataRepository);
    when(resourceLoader.getService(QName.valueOf("dataDictionaryService"))).thenReturn(dataDictionaryService);
    GlobalResourceLoader.addResourceLoader(resourceLoader);
    GlobalResourceLoader.start();
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:17,代码来源:LegacyDetectionAdviceTest.java

示例3: initGrl

import org.kuali.rice.core.framework.config.property.SimpleConfig; //导入依赖的package包/类
@BeforeClass
public static void initGrl() throws Exception {

    MetadataRepository metadataRepository = mock(MetadataRepository.class);
    DataDictionaryService dataDictionaryService = mock(DataDictionaryService.class);
    ResourceLoader resourceLoader = mock(ResourceLoader.class);

    SimpleConfig config = new SimpleConfig();
    config.putProperty(CoreConstants.Config.APPLICATION_ID, LegacyUtilsTest.class.getName());
    config.putProperty(KRADConstants.Config.ENABLE_LEGACY_DATA_FRAMEWORK, "true");
    ConfigContext.init(config);

    when(resourceLoader.getName()).thenReturn(QName.valueOf(LegacyUtilsTest.class.getName()));
    when(resourceLoader.getService(QName.valueOf("metadataRepository"))).thenReturn(metadataRepository);
    when(resourceLoader.getService(QName.valueOf("dataDictionaryService"))).thenReturn(dataDictionaryService);

    GlobalResourceLoader.addResourceLoader(resourceLoader);
    GlobalResourceLoader.start();
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:20,代码来源:LegacyUtilsTest.java

示例4: installRiceKualiModuleService

import org.kuali.rice.core.framework.config.property.SimpleConfig; //导入依赖的package包/类
@Before
public void installRiceKualiModuleService() throws Exception {
    GlobalResourceLoader.stop();
    SimpleConfig config = new SimpleConfig();
    config.putProperty(CoreConstants.Config.APPLICATION_ID, "APPID");
    ConfigContext.init(config);

    StaticListableBeanFactory testBf = new StaticListableBeanFactory();

    KualiModuleService riceKualiModuleService = mock(KualiModuleService.class);
    when(riceKualiModuleService.getInstalledModuleServices()).thenReturn(riceModuleServices);

    testBf.addBean(KRADServiceLocatorWeb.KUALI_MODULE_SERVICE, riceKualiModuleService);

    ResourceLoader rl = new BeanFactoryResourceLoader(new QName("moduleservicebase-unittest"), testBf);
    GlobalResourceLoader.addResourceLoader(rl);
    GlobalResourceLoader.start();
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:19,代码来源:KualiModuleServiceImplTest.java

示例5: testCustomIncrementerDatasourceVersion

import org.kuali.rice.core.framework.config.property.SimpleConfig; //导入依赖的package包/类
@Test
public void testCustomIncrementerDatasourceVersion() throws Exception {
    SimpleConfig config = new SimpleConfig();
    config.putProperty("rice.krad.data.platform.incrementer.mysql.5",
            "org.kuali.rice.krad.data.platform.testincrementers.CustomIncrementerMySQLVersion5");
    config.putProperty("rice.krad.data.platform.incrementer.oracle.11",
            "org.kuali.rice.krad.data.platform.testincrementers.CustomIncrementerOracleVersion11");
    ConfigContext.init(config);

    DataFieldMaxValueIncrementer mySQLMaxVal = MaxValueIncrementerFactory.getIncrementer(mysql,"test_mySQL");
    assertTrue("Found MySQL custom incrementer",mySQLMaxVal != null);
    assertTrue("Custom incrementer for MySQL should be mySQL5 for String val",
                    StringUtils.equals(mySQLMaxVal.nextStringValue(),"mySQL5"));

    DataFieldMaxValueIncrementer oracleMaxVal = MaxValueIncrementerFactory.getIncrementer(oracle,"test_oracle");
    assertTrue("Found Oracle custom incrementer", oracleMaxVal != null);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:18,代码来源:MaxValueIncrementerFactoryTest.java

示例6: testCustomIncrementerDatasourceNoVersion

import org.kuali.rice.core.framework.config.property.SimpleConfig; //导入依赖的package包/类
@Test
public void testCustomIncrementerDatasourceNoVersion() throws Exception {
    SimpleConfig config = new SimpleConfig();
    config.putProperty("rice.krad.data.platform.incrementer.mysql",
            "org.kuali.rice.krad.data.platform.testincrementers.CustomIncrementerMySQLVersion5");
    config.putProperty("rice.krad.data.platform.incrementer.oracle",
            "org.kuali.rice.krad.data.platform.testincrementers.CustomIncrementerOracleVersion11");
    ConfigContext.init(config);

    DataFieldMaxValueIncrementer mySQLMaxVal = MaxValueIncrementerFactory.getIncrementer(mysql,"test_mySQL");
    assertTrue("Found MySQL custom incrementer",mySQLMaxVal != null);
    assertTrue("Custom incrementer for MySQL should be mySQL5 for String val",
            StringUtils.equals(mySQLMaxVal.nextStringValue(),"mySQL5"));

    DataFieldMaxValueIncrementer oracleMaxVal = MaxValueIncrementerFactory.getIncrementer(oracle,"test_oracle");
    assertTrue("Found Oracle custom incrementer", oracleMaxVal != null);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:18,代码来源:MaxValueIncrementerFactoryTest.java

示例7: setUp

import org.kuali.rice.core.framework.config.property.SimpleConfig; //导入依赖的package包/类
@Before
public void setUp() throws Exception {

	String formats = "MM/dd/yy;MM/dd/yyyy;MM-dd-yy;MM-dd-yyyy";

	Properties props = new Properties();
	props.put(CoreConstants.STRING_TO_DATE_FORMATS, formats);
	Config config = new SimpleConfig(props);

	ConfigContext.init(config);
	ConfigContext.getCurrentContextConfig().putProperty(CoreConstants.STRING_TO_DATE_FORMATS, formats);

	processor = new ValidCharactersConstraintProcessor();

	dictionaryValidationResult = new DictionaryValidationResult();
	dictionaryValidationResult.setErrorLevel(ErrorLevel.NOCONSTRAINT);

	validDate = "07-28-2011";
	validDate1 = "12-31-83";
	invalidDateEmpty = "";
	invalidDate = "31-12-2010";
	invalidDate1 = "31-12-2010 12:30:45.456";
	invalidDate2 = "2011-07-28 IST";
	invalidDate3 = "12/31/2011";

	List<String> allowedFormats = new ArrayList<String>();
	allowedFormats.add("MM-dd-yy");
	allowedFormats.add("MM-dd-yyyy");

	datePatternConstraint = new DatePatternConstraint();
       datePatternConstraint.setMessageKey("validate.dummykey");
       datePatternConstraint.setValidationMessageParams( new ArrayList<String>());
	datePatternConstraint.setAllowedFormats(allowedFormats);

	dateDefinition = new AttributeDefinition();
	dateDefinition.setName("date");
	dateDefinition.setValidCharactersConstraint(datePatternConstraint);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:39,代码来源:DatePatternConstraintTest.java

示例8: initGRL

import org.kuali.rice.core.framework.config.property.SimpleConfig; //导入依赖的package包/类
@Before
public void initGRL() throws Exception {
    GlobalResourceLoader.stop();
    SimpleConfig config = new SimpleConfig();
    config.putProperty(CoreConstants.Config.APPLICATION_ID, "APPID");
    ConfigContext.init(config);
    StaticListableBeanFactory testBf = new StaticListableBeanFactory();
    testBf.addBean(KRADServiceLocator.PROVIDER_REGISTRY, prMock);
    ResourceLoader rl = new BeanFactoryResourceLoader(new QName("moduleconfiguration-unittest"), testBf);
    GlobalResourceLoader.addResourceLoader(rl);
    GlobalResourceLoader.start();
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:13,代码来源:ModuleConfigurationTest.java

示例9: setup

import org.kuali.rice.core.framework.config.property.SimpleConfig; //导入依赖的package包/类
@Before
public void setup() throws Exception {
    GlobalResourceLoader.stop();

    SimpleConfig config = new SimpleConfig();
    config.putProperty(CoreConstants.Config.APPLICATION_ID, getClass().getName());
    ConfigContext.init(config);
    ConfigContext.getCurrentContextConfig().removeProperty(KRADConstants.Config.ENABLE_LEGACY_DATA_FRAMEWORK);
    ConfigContext.getCurrentContextConfig().removeProperty(KRADConstants.Config.KNS_ENABLED);

    StaticListableBeanFactory testBf = new StaticListableBeanFactory();
    testBf.addBean("metadataRepository", metadataRepository);
    testBf.addBean("dataDictionaryService", dataDictionaryService);
    testBf.addBean("knsLegacyDataAdapter", knsLegacyDataAdapter);
    testBf.addBean("kradLegacyDataAdapter", kradLegacyDataAdapter);

    ResourceLoader rl = new BeanFactoryResourceLoader(new QName(getClass().getName()), testBf);
    GlobalResourceLoader.addResourceLoader(rl);
    GlobalResourceLoader.start();

    MetadataManager mm = MetadataManager.getInstance();

    // register Legacy object
    ClassDescriptor legacyDescriptor = new ClassDescriptor(mm.getGlobalRepository());
    legacyDescriptor.setClassOfObject(Legacy.class);
    mm.getGlobalRepository().put(Legacy.class, legacyDescriptor);

    // register LegacyDocument object
    ClassDescriptor legacyDocumentDescriptor = new ClassDescriptor(mm.getGlobalRepository());
    legacyDocumentDescriptor.setClassOfObject(LegacyDocument.class);
    mm.getGlobalRepository().put(LegacyDocument.class, legacyDocumentDescriptor);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:33,代码来源:LegacyDataAdapterImplTest.java

示例10: setUp

import org.kuali.rice.core.framework.config.property.SimpleConfig; //导入依赖的package包/类
@Before
public void setUp() throws Exception {

    DescriptorRepository descriptorRepository = new DescriptorRepository();
    when(metadataManager.getGlobalRepository()).thenReturn(descriptorRepository);
    this.existingMetadataManager = hackOjb(metadataManager);

    when(metadataRepository.contains(any(Class.class))).thenAnswer(new Answer() {
        @Override
        public Object answer(InvocationOnMock invocation) {
            Class<?> type = (Class<?>)invocation.getArguments()[0];
            return nonLegacyClasses.contains(type);
        }
    });

    when(dataDictionaryService.getDataDictionary()).thenReturn(dataDictionary);

    nonLegacyClasses.clear();

    ConfigContext.init(new SimpleConfig());
    ConfigContext.getCurrentContextConfig().removeProperty(KRADConstants.Config.KNS_ENABLED);
    ConfigContext.getCurrentContextConfig().removeProperty(KRADConstants.Config.ENABLE_LEGACY_DATA_FRAMEWORK);

    this.detector = new LegacyDetector(this.metadataRepository, this.dataDictionaryService);

    addOjbClass(DummyDataObjectOjb.class);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:28,代码来源:LegacyDetectorTest.java

示例11: testCustomIncrementerDatasourceInvalidClass

import org.kuali.rice.core.framework.config.property.SimpleConfig; //导入依赖的package包/类
@Test(expected = InstantiationError.class)
public void testCustomIncrementerDatasourceInvalidClass() throws Exception {
    SimpleConfig config = new SimpleConfig();
    config.putProperty("rice.krad.data.platform.incrementer.mysql",
            "org.kuali.rice.krad.data.platform.testincrementers.NonExistent");
    ConfigContext.init(config);

    DataFieldMaxValueIncrementer mySQLMaxVal = MaxValueIncrementerFactory.getIncrementer(mysql,"test_mySQL");
    assertTrue("Cannot create incrementer", mySQLMaxVal == null);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:11,代码来源:MaxValueIncrementerFactoryTest.java

示例12: initializeConfig

import org.kuali.rice.core.framework.config.property.SimpleConfig; //导入依赖的package包/类
private void initializeConfig() {
    SimpleConfig config = new SimpleConfig();
    config.putProperty("rice.krad.jpa.global.randomProperty", "randomValue");
    config.putProperty("rice.krad.jpa.global.eclipselink.weaving", "false");
    config.putProperty("rice.krad.jpa.global.jpa.vendor.adapter.class", "org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter");
    ConfigContext.init(config);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:8,代码来源:KradEclipseLinkEntityManagerFactoryBeanTest.java

示例13: getMockServiceMap

import org.kuali.rice.core.framework.config.property.SimpleConfig; //导入依赖的package包/类
/**
 * Getter for the mockServiceMap, which on first call constructs it and also initializes our hack of the GRL.
 *
 * @return the mockServiceMap
 */
private static synchronized Map<String, Object> getMockServiceMap() {
    // the first time this is called, inject our special resource loader
    if (mockServiceMap == null) {
        mockServiceMap = new ConcurrentHashMap<String, Object>();

        // this little dance is required to prevent issues when

        SimpleConfig config = new SimpleConfig();
        config.putProperty(CoreConstants.Config.APPLICATION_ID, "TEST");
        ConfigContext.init(config);

        try {
            GlobalResourceLoader.stop();
        } catch (Exception e) {
            throw new RiceRuntimeException(e);
        }

        // Add to the front of the line our hacked resource loader which will fetch services from the mockServiceMap
        GlobalResourceLoader.addResourceLoaderFirst(new BaseResourceLoader(new QName("TEST", "TEST")) {
            @Override
            public Object getService(QName serviceQName) {

                String localPart = serviceQName.getLocalPart();
                return mockServiceMap.get(localPart);
            }
        });
    }

    return mockServiceMap;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:36,代码来源:GlobalResourceLoaderTestUtils.java

示例14: testGetObject_SpringTransactionManager

import org.kuali.rice.core.framework.config.property.SimpleConfig; //导入依赖的package包/类
@Test
public void testGetObject_SpringTransactionManager() throws Exception {
    Jta.configure(transactionManager, userTransaction);
    SimpleConfig config = new SimpleConfig();
    config.putObject(RiceConstants.SPRING_TRANSACTION_MANAGER, new JtaTransactionManager());
    ConfigContext.init(config);

    // since a spring configuration transaction manager has been configured, getObject will always return null, even
    // though we have JTA setup (i'm suppose it's questionable that it should be doing this, but that's how it's
    // always worked
    assertNull(transactionManagerFactoryBean.getObject());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:13,代码来源:TransactionManagerFactoryBeanTest.java

示例15: initializeJtaJndiConfig

import org.kuali.rice.core.framework.config.property.SimpleConfig; //导入依赖的package包/类
private void initializeJtaJndiConfig() throws Exception {
    this.builder = SimpleNamingContextBuilder.emptyActivatedContextBuilder();
    builder.bind(TRANSACTION_MANAGER_JNDI_NAME, transactionManager);
    builder.bind(USER_TRANSACTION_JNDI_NAME, userTransaction);
    this.config = new SimpleConfig();
    this.config.putProperty(RiceConstants.TRANSACTION_MANAGER_JNDI, TRANSACTION_MANAGER_JNDI_NAME);
    this.config.putProperty(RiceConstants.USER_TRANSACTION_JNDI, USER_TRANSACTION_JNDI_NAME);
    ConfigContext.init(this.config);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:10,代码来源:JtaConfigurerTest.java


注:本文中的org.kuali.rice.core.framework.config.property.SimpleConfig类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。