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


Java ConfigContext.init方法代码示例

本文整理汇总了Java中org.kuali.rice.core.api.config.property.ConfigContext.init方法的典型用法代码示例。如果您正苦于以下问题:Java ConfigContext.init方法的具体用法?Java ConfigContext.init怎么用?Java ConfigContext.init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.kuali.rice.core.api.config.property.ConfigContext的用法示例。


在下文中一共展示了ConfigContext.init方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initGRL

import org.kuali.rice.core.api.config.property.ConfigContext; //导入方法依赖的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.api.config.property.ConfigContext; //导入方法依赖的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.api.config.property.ConfigContext; //导入方法依赖的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: testCustomIncrementerDatasourceVersion

import org.kuali.rice.core.api.config.property.ConfigContext; //导入方法依赖的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

示例5: createKSBResourceLoaderNoApplicationIdImpl

import org.kuali.rice.core.api.config.property.ConfigContext; //导入方法依赖的package包/类
protected void createKSBResourceLoaderNoApplicationIdImpl(String configType) throws Exception {
	
	Properties props = new Properties();
	Config config = getConfigObject(configType,props);
	config.parseConfig();
	ConfigContext.init(config);
	
	boolean errorThrown = false;
	try {
		KSBResourceLoaderFactory.createRootKSBRemoteResourceLoader();
		fail("should have thrown configuration exception with no applicationId present");
	} catch (IllegalStateException ce) {
		errorThrown = true;
	}
	assertTrue(errorThrown);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:17,代码来源:KSBResourceLoaderFactoryTest.java

示例6: testGetObject_SpringTransactionManager

import org.kuali.rice.core.api.config.property.ConfigContext; //导入方法依赖的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

示例7: setUp

import org.kuali.rice.core.api.config.property.ConfigContext; //导入方法依赖的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.api.config.property.ConfigContext; //导入方法依赖的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.api.config.property.ConfigContext; //导入方法依赖的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.api.config.property.ConfigContext; //导入方法依赖的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: initializeJtaJndiConfig

import org.kuali.rice.core.api.config.property.ConfigContext; //导入方法依赖的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

示例12: testCustomIncrementerDatasourceInvalidClass

import org.kuali.rice.core.api.config.property.ConfigContext; //导入方法依赖的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

示例13: initializeConfig

import org.kuali.rice.core.api.config.property.ConfigContext; //导入方法依赖的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

示例14: testAfterPropertiesSet_NoJta

import org.kuali.rice.core.api.config.property.ConfigContext; //导入方法依赖的package包/类
@Test
public void testAfterPropertiesSet_NoJta() throws Exception {
    ConfigContext.init(new SimpleConfig()); // initialize empty config
    new JtaConfigurer().afterPropertiesSet();
    assertTrue(Jta.isFrozen());
    assertFalse(Jta.isEnabled());
    assertNull(Jta.getTransactionManager());
    assertNull(Jta.getUserTransaction());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:10,代码来源:JtaConfigurerTest.java

示例15: loadWithinContextClassLoader

import org.kuali.rice.core.api.config.property.ConfigContext; //导入方法依赖的package包/类
/**
 * Executes loading of the plugin within the current context classloader set to the Plugin's classloader.
 */
protected Plugin loadWithinContextClassLoader(PluginClassLoader classLoader) throws PluginException, IOException {
	URL url = getPluginConfigURL();
    PluginConfig pluginConfig = loadPluginConfig(url);
    QName qPluginName = getPluginName(pluginConfig);
    classLoader.setConfig(pluginConfig);
    ConfigContext.init(classLoader, pluginConfig);
    configureExtraClasspath(classLoader, pluginConfig);
    this.logPrefix = PluginUtils.getLogPrefix(qPluginName).toString();
    LOG.info("Constructing plugin '" + simplePluginName + "' with classloader: " + classLoader);
    Plugin plugin = new Plugin(qPluginName, pluginConfig, classLoader);
    installResourceLoader(plugin);
    installPluginListeners(plugin);
    return plugin;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:18,代码来源:BasePluginLoader.java


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