Java Code Examples for org.springframework.mock.jndi.SimpleNamingContextBuilder#emptyActivatedContextBuilder()
The following examples show how to use
org.springframework.mock.jndi.SimpleNamingContextBuilder#emptyActivatedContextBuilder() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestEntandoJndiUtils.java From entando-core with GNU Lesser General Public License v3.0 | 6 votes |
public static void setupJndi() { SimpleNamingContextBuilder builder = null; try { String path = "target/test/conf/contextTestParams.properties"; logger.debug("CREATING JNDI RESOURCES BASED ON {} (test)", path); InputStream in = new FileInputStream(path); builder = SimpleNamingContextBuilder.emptyActivatedContextBuilder(); Properties testConfig = new Properties(); testConfig.load(in); in.close(); buildContextProperties(builder, testConfig); createDatasources(builder, testConfig); builder.activate(); } catch (Throwable t) { t.printStackTrace(); throw new RuntimeException("Error on creation naming context", t); } }
Example 2
Source File: ConfigTestUtils.java From entando-core with GNU Lesser General Public License v3.0 | 5 votes |
protected SimpleNamingContextBuilder createNamingContext() { SimpleNamingContextBuilder builder = null; try { builder = SimpleNamingContextBuilder.emptyActivatedContextBuilder(); InputStream in = new FileInputStream("target/test/conf/contextTestParams.properties"); Properties testConfig = new Properties(); testConfig.load(in); in.close(); builder.bind("java:comp/env/logName", testConfig.getProperty("logName")); builder.bind("java:comp/env/logFileRotatePattern", testConfig.getProperty("logFileRotatePattern")); builder.bind("java:comp/env/logLevel", testConfig.getProperty("logLevel")); builder.bind("java:comp/env/logFileSize", testConfig.getProperty("logFileSize")); builder.bind("java:comp/env/logFilesCount", testConfig.getProperty("logFilesCount")); builder.bind("java:comp/env/configVersion", testConfig.getProperty("configVersion")); builder.bind("java:comp/env/applicationBaseURL", testConfig.getProperty("applicationBaseURL")); builder.bind("java:comp/env/resourceRootURL", testConfig.getProperty("resourceRootURL")); builder.bind("java:comp/env/protectedResourceRootURL", testConfig.getProperty("protectedResourceRootURL")); builder.bind("java:comp/env/resourceDiskRootFolder", testConfig.getProperty("resourceDiskRootFolder")); builder.bind("java:comp/env/protectedResourceDiskRootFolder", testConfig.getProperty("protectedResourceDiskRootFolder")); builder.bind("java:comp/env/indexDiskRootFolder", testConfig.getProperty("indexDiskRootFolder")); Iterator<Entry<Object, Object>> configIter = testConfig.entrySet().iterator(); while (configIter.hasNext()) { Entry<Object, Object> entry = configIter.next(); builder.bind("java:comp/env/" + (String) entry.getKey(), (String) entry.getValue()); } this.createDatasources(builder, testConfig); } catch (Throwable t) { t.printStackTrace(); throw new RuntimeException("Error on creation naming context", t); } return builder; }
Example 3
Source File: JndiTestUtils.java From flexy-pool with Apache License 2.0 | 5 votes |
public JndiTestUtils() { try { namingContext = SimpleNamingContextBuilder.emptyActivatedContextBuilder(); namingContext.clear(); } catch (NamingException e) { throw new IllegalArgumentException(e); } }
Example 4
Source File: JtaConfigurerTest.java From rice with Educational Community License v2.0 | 5 votes |
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); }
Example 5
Source File: JndiRule.java From logging-log4j2 with Apache License 2.0 | 5 votes |
@Override public Statement apply(final Statement base, final Description description) { return new Statement() { @Override public void evaluate() throws Throwable { final SimpleNamingContextBuilder builder = SimpleNamingContextBuilder.emptyActivatedContextBuilder(); for (final Map.Entry<String, Object> entry : initialBindings.entrySet()) { builder.bind(entry.getKey(), entry.getValue()); } base.evaluate(); } }; }
Example 6
Source File: JndiUtilsTest.java From flexy-pool with Apache License 2.0 | 4 votes |
@Before public void init() throws NamingException { namingContext = SimpleNamingContextBuilder.emptyActivatedContextBuilder(); }
Example 7
Source File: JndiExporter.java From flexy-pool with Apache License 2.0 | 4 votes |
public JndiExporter(String jndiName, T jndiValue) throws NamingException { this.jndiName = jndiName; this.jndiValue = jndiValue; this.namingContextBuilder = SimpleNamingContextBuilder.emptyActivatedContextBuilder(); }
Example 8
Source File: SimpleNamingContextBuilderManualTest.java From tutorials with MIT License | 4 votes |
@BeforeEach public void init() throws Exception { SimpleNamingContextBuilder.emptyActivatedContextBuilder(); this.initContext = new InitialContext(); }
Example 9
Source File: AndHowCoreTestBase.java From andhow with Apache License 2.0 | 3 votes |
/** * Simple consistent way to get an empty JNDI context. * * bind() each variable, then call build(). * * @return * @throws NamingException */ public SimpleNamingContextBuilder getJndi() throws NamingException { if (builder == null) { builder = SimpleNamingContextBuilder.emptyActivatedContextBuilder(); } return builder; }
Example 10
Source File: AndHowTestBase.java From andhow with Apache License 2.0 | 3 votes |
/** * Simple consistent way to get an empty JNDI context. * * bind() each variable, then call build(). * * @return * @throws NamingException */ public SimpleNamingContextBuilder getJndi() throws NamingException { if (builder == null) { builder = SimpleNamingContextBuilder.emptyActivatedContextBuilder(); } return builder; }