An internally used helper class for creating new XPath context objects.
This class is used by {@link XPathExpressionEngine}. It simplifies testing.
272273274275276277278279280281
* @throws ConfigurationException if an error occurs */ private static void checkTestConfiguration(FileHandler handler) throws ConfigurationException { XMLConfiguration config = new XMLConfiguration(); FileHandler h2 = new FileHandler(config, handler); h2.load(); assertEquals("Wrong content", "value", config.getString("element")); }
268269270271272273274275276277278
throws ConfigurationException { FileBasedConfigurationBuilder<XMLConfiguration> builder = new FileBasedConfigurationBuilder<XMLConfiguration>( XMLConfiguration.class); builder.configure(new Parameters().fileBased().setFile(testFile)); config = builder.getConfiguration(); CountDownLatch startLatch = new CountDownLatch(1); Collection<SubNodeAccessThread> threads = new ArrayList<SubNodeAccessThread>();
1470147114721473147414751476147714781479
*/ @Test public void testGetDateNoFormatPropertyConversionHandler() throws Exception { conf.clearProperty(DataConfiguration.DATE_FORMAT_KEY); DefaultConversionHandler handler = new DefaultConversionHandler(); handler.setDateFormat(DATE_PATTERN); conf.setConversionHandler(handler); assertEquals("Wrong result", expectedDate(), conf.getDate("date.string")); }
5657585960616263
map.put("key2", "value2"); map.put("list", "value1, value2"); map.put("listesc", "value1\\,value2"); MapConfiguration config = new MapConfiguration(map); config.setListDelimiterHandler(new DefaultListDelimiterHandler(',')); return config; }
274275276277278279280281282283284285
* from the parent. */ @Test public void testSetListDelimiterHandler() { ListDelimiterHandler handler1 = new DefaultListDelimiterHandler('/'); ListDelimiterHandler handler2 = new DefaultListDelimiterHandler(';'); parent.setListDelimiterHandler(handler1); setUpSubnodeConfig(); parent.setListDelimiterHandler(handler2); assertEquals("List delimiter handler not obtained from parent", handler1, config.getListDelimiterHandler());
421422423424425426427428429430431
*/ @Test public void testConfigurationAtWithUpdateInitialized() { String key = "tables.table"; config.setListDelimiterHandler(new DefaultListDelimiterHandler(';')); config.setThrowExceptionOnMissing(true); List<HierarchicalConfiguration<ImmutableNode>> subs = config.configurationsAt(key, true); BaseHierarchicalConfiguration sub = (BaseHierarchicalConfiguration) subs.get(0);
526527528529530531532533534535536
* Tests obtaining a configuration with all variables substituted. */ @Test public void testInterpolatedConfiguration() { config.setListDelimiterHandler(new DefaultListDelimiterHandler(',')); BaseHierarchicalConfiguration c = (BaseHierarchicalConfiguration) InterpolationTestHelper .testInterpolatedConfiguration(config); // tests whether the hierarchical structure has been maintained checkContent(c);
6465666768697071727374
@Before public void setUp() throws Exception { BaseConfiguration baseConfig = new BaseConfiguration(); baseConfig.setListDelimiterHandler(new DefaultListDelimiterHandler(',')); conf = new DataConfiguration(baseConfig); // empty value conf.addProperty("empty", "");
620621622623624625626627628629
*/ @Test public void testEscapeListDelimiters() { PropertiesConfiguration sub = new PropertiesConfiguration(); sub.setListDelimiterHandler(new DefaultListDelimiterHandler(',')); sub.addProperty("test.pi", "3\\,1415"); config.addConfiguration(sub); assertEquals("Wrong value", "3,1415", config.getString("test.pi")); }
651652653654655656657658659660661
*/ @Test public void testConversionExpressionEngine() { PropertiesConfiguration child = new PropertiesConfiguration(); child.setListDelimiterHandler(new DefaultListDelimiterHandler(',')); child.addProperty("test(a)", "1,2,3"); config.addConfiguration(child); DefaultExpressionEngine engineQuery = new DefaultExpressionEngine( new DefaultExpressionEngineSymbols.Builder(