You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2010/06/08 14:00:58 UTC
svn commit: r952624 - in
/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration:
./ event/ plist/
Author: sebb
Date: Tue Jun 8 12:00:58 2010
New Revision: 952624
URL: http://svn.apache.org/viewvc?rev=952624&view=rev
Log:
Tab police
Modified:
commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestConfigurationUtils.java
commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestHierarchicalConfiguration.java
commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestINIConfiguration.java
commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestXMLConfiguration.java
commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/event/TestSubsetConfigurationEvents.java
commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/plist/TestPropertyListConfiguration.java
commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/plist/TestXMLPropertyListConfiguration.java
Modified: commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestConfigurationUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestConfigurationUtils.java?rev=952624&r1=952623&r2=952624&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestConfigurationUtils.java (original)
+++ commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestConfigurationUtils.java Tue Jun 8 12:00:58 2010
@@ -102,8 +102,8 @@ public class TestConfigurationUtils exte
absFile.toURI().toURL(),
ConfigurationUtils.getURL(null, absFile.getAbsolutePath()));
- assertEquals(absFile.toURI().toURL(),
- ConfigurationUtils.getURL(absFile.getParent(), "config.xml"));
+ assertEquals(absFile.toURI().toURL(),
+ ConfigurationUtils.getURL(absFile.getParent(), "config.xml"));
}
public void testGetBasePath() throws Exception
Modified: commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestHierarchicalConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestHierarchicalConfiguration.java?rev=952624&r1=952623&r2=952624&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestHierarchicalConfiguration.java (original)
+++ commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestHierarchicalConfiguration.java Tue Jun 8 12:00:58 2010
@@ -834,25 +834,25 @@ public class TestHierarchicalConfigurati
}
}
- /**
+ /**
* Tests the copy constructor.
*/
- public void testInitCopy()
- {
- HierarchicalConfiguration copy = new HierarchicalConfiguration(config);
- checkContent(copy);
- }
+ public void testInitCopy()
+ {
+ HierarchicalConfiguration copy = new HierarchicalConfiguration(config);
+ checkContent(copy);
+ }
- /**
+ /**
* Tests whether the nodes of a copied configuration are independent from
* the source configuration.
*/
- public void testInitCopyUpdate()
- {
- HierarchicalConfiguration copy = new HierarchicalConfiguration(config);
- config.setProperty("tables.table(0).name", "NewTable");
- checkContent(copy);
- }
+ public void testInitCopyUpdate()
+ {
+ HierarchicalConfiguration copy = new HierarchicalConfiguration(config);
+ config.setProperty("tables.table(0).name", "NewTable");
+ checkContent(copy);
+ }
/**
* Tests interpolation facilities.
@@ -959,16 +959,16 @@ public class TestHierarchicalConfigurati
testGetProperty();
}
- /**
+ /**
* Tests the copy constructor when a null reference is passed.
*/
- public void testInitCopyNull()
- {
- HierarchicalConfiguration copy = new HierarchicalConfiguration(null);
- assertTrue("Configuration not empty", copy.isEmpty());
- }
+ public void testInitCopyNull()
+ {
+ HierarchicalConfiguration copy = new HierarchicalConfiguration(null);
+ assertTrue("Configuration not empty", copy.isEmpty());
+ }
- /**
+ /**
* Tests the parents of nodes when setRootNode() is involved. This is
* related to CONFIGURATION-334.
*/
@@ -1015,7 +1015,7 @@ public class TestHierarchicalConfigurati
assertEquals("Wrong property value", "C:\\Temp", config.getString(key));
}
- /**
+ /**
* Helper method for testing the getKeys(String) method.
*
* @param prefix the key to pass into getKeys()
@@ -1081,27 +1081,27 @@ public class TestHierarchicalConfigurati
.contains("tables/table/fields/field/name"));
}
- /**
+ /**
* Checks the content of the passed in configuration object. Used by some
* tests that copy a configuration.
*
* @param c the configuration to check
*/
- private void checkContent(Configuration c)
- {
- for (int i = 0; i < tables.length; i++)
- {
- assertEquals(tables[i], c.getString("tables.table(" + i + ").name"));
- for (int j = 0; j < fields[i].length; j++)
- {
- assertEquals(fields[i][j], c.getString("tables.table(" + i
- + ").fields.field(" + j + ").name"));
- }
- }
- }
+ private void checkContent(Configuration c)
+ {
+ for (int i = 0; i < tables.length; i++)
+ {
+ assertEquals(tables[i], c.getString("tables.table(" + i + ").name"));
+ for (int j = 0; j < fields[i].length; j++)
+ {
+ assertEquals(fields[i][j], c.getString("tables.table(" + i
+ + ").fields.field(" + j + ").name"));
+ }
+ }
+ }
- private ExpressionEngine createAlternativeExpressionEngine()
- {
+ private ExpressionEngine createAlternativeExpressionEngine()
+ {
DefaultExpressionEngine engine = new DefaultExpressionEngine();
engine.setPropertyDelimiter("/");
engine.setIndexStart("[");
Modified: commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestINIConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestINIConfiguration.java?rev=952624&r1=952623&r2=952624&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestINIConfiguration.java (original)
+++ commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestINIConfiguration.java Tue Jun 8 12:00:58 2010
@@ -38,7 +38,7 @@ public class TestINIConfiguration extend
private static String LINE_SEPARATOR = System.getProperty("line.separator");
/** Constant for the content of an ini file. */
- private static final String INI_DATA =
+ private static final String INI_DATA =
"[section1]" + LINE_SEPARATOR
+ "var1 = foo" + LINE_SEPARATOR
+ "var2 = 451" + LINE_SEPARATOR
@@ -54,7 +54,7 @@ public class TestINIConfiguration extend
+ "multi = bar" + LINE_SEPARATOR
+ LINE_SEPARATOR;
- private static final String INI_DATA2 =
+ private static final String INI_DATA2 =
"[section4]" + LINE_SEPARATOR
+ "var1 = \"quoted value\"" + LINE_SEPARATOR
+ "var2 = \"quoted value\\nwith \\\"quotes\\\"\"" + LINE_SEPARATOR
@@ -65,97 +65,97 @@ public class TestINIConfiguration extend
/**
* Test of save method, of class {@link INIConfiguration}.
*/
- public void testSave() throws Exception
- {
- Writer writer = new StringWriter();
- INIConfiguration instance = new INIConfiguration();
- instance.addProperty("section1.var1", "foo");
- instance.addProperty("section1.var2", "451");
- instance.addProperty("section2.var1", "123.45");
- instance.addProperty("section2.var2", "bar");
- instance.addProperty("section3.var1", "true");
- instance.addProperty("section3.interpolated", "${section3.var1}");
- instance.addProperty("section3.multi", "foo");
- instance.addProperty("section3.multi", "bar");
- instance.save(writer);
+ public void testSave() throws Exception
+ {
+ Writer writer = new StringWriter();
+ INIConfiguration instance = new INIConfiguration();
+ instance.addProperty("section1.var1", "foo");
+ instance.addProperty("section1.var2", "451");
+ instance.addProperty("section2.var1", "123.45");
+ instance.addProperty("section2.var2", "bar");
+ instance.addProperty("section3.var1", "true");
+ instance.addProperty("section3.interpolated", "${section3.var1}");
+ instance.addProperty("section3.multi", "foo");
+ instance.addProperty("section3.multi", "bar");
+ instance.save(writer);
assertEquals("Wrong content of ini file", INI_DATA, writer.toString());
- }
+ }
- /**
+ /**
* Test of load method, of class {@link INIConfiguration}.
*/
- public void testLoad() throws Exception
- {
- checkLoad(INI_DATA);
- }
+ public void testLoad() throws Exception
+ {
+ checkLoad(INI_DATA);
+ }
- /**
+ /**
* Tests the load() method when the alternative value separator is used (a
* ':' for '=').
*/
- public void testLoadAlternativeSeparator() throws Exception
- {
- checkLoad(INI_DATA.replace('=', ':'));
- }
+ public void testLoadAlternativeSeparator() throws Exception
+ {
+ checkLoad(INI_DATA.replace('=', ':'));
+ }
- /**
+ /**
* Helper method for testing the load operation. Loads the specified content
* into a configuration and then checks some properties.
*
* @param data the data to load
*/
- private void checkLoad(String data) throws ConfigurationException, IOException
- {
- Reader reader = new StringReader(data);
- INIConfiguration instance = new INIConfiguration();
- instance.load(reader);
- reader.close();
- assertTrue(instance.getString("section1.var1").equals("foo"));
- assertTrue(instance.getInt("section1.var2") == 451);
- assertTrue(instance.getDouble("section2.var1") == 123.45);
- assertTrue(instance.getString("section2.var2").equals("bar"));
- assertTrue(instance.getBoolean("section3.var1"));
- assertTrue(instance.getSections().size() == 3);
- }
+ private void checkLoad(String data) throws ConfigurationException, IOException
+ {
+ Reader reader = new StringReader(data);
+ INIConfiguration instance = new INIConfiguration();
+ instance.load(reader);
+ reader.close();
+ assertTrue(instance.getString("section1.var1").equals("foo"));
+ assertTrue(instance.getInt("section1.var2") == 451);
+ assertTrue(instance.getDouble("section2.var1") == 123.45);
+ assertTrue(instance.getString("section2.var2").equals("bar"));
+ assertTrue(instance.getBoolean("section3.var1"));
+ assertTrue(instance.getSections().size() == 3);
+ }
- /**
+ /**
* Test of isCommentLine method, of class {@link INIConfiguration}.
*/
- public void testIsCommentLine()
- {
- INIConfiguration instance = new INIConfiguration();
- assertTrue(instance.isCommentLine("#comment1"));
- assertTrue(instance.isCommentLine(";comment1"));
- assertFalse(instance.isCommentLine("nocomment=true"));
- assertFalse(instance.isCommentLine(null));
- }
+ public void testIsCommentLine()
+ {
+ INIConfiguration instance = new INIConfiguration();
+ assertTrue(instance.isCommentLine("#comment1"));
+ assertTrue(instance.isCommentLine(";comment1"));
+ assertFalse(instance.isCommentLine("nocomment=true"));
+ assertFalse(instance.isCommentLine(null));
+ }
- /**
+ /**
* Test of isSectionLine method, of class {@link INIConfiguration}.
*/
- public void testIsSectionLine()
- {
- INIConfiguration instance = new INIConfiguration();
- assertTrue(instance.isSectionLine("[section]"));
- assertFalse(instance.isSectionLine("nosection=true"));
- assertFalse(instance.isSectionLine(null));
- }
+ public void testIsSectionLine()
+ {
+ INIConfiguration instance = new INIConfiguration();
+ assertTrue(instance.isSectionLine("[section]"));
+ assertFalse(instance.isSectionLine("nosection=true"));
+ assertFalse(instance.isSectionLine(null));
+ }
- /**
+ /**
* Test of getSections method, of class {@link INIConfiguration}.
*/
- public void testGetSections()
- {
- INIConfiguration instance = new INIConfiguration();
- instance.addProperty("test1.foo", "bar");
- instance.addProperty("test2.foo", "abc");
- Set expResult = new HashSet();
- expResult.add("test1");
- expResult.add("test2");
- Set result = instance.getSections();
- assertEquals(expResult, result);
- }
+ public void testGetSections()
+ {
+ INIConfiguration instance = new INIConfiguration();
+ instance.addProperty("test1.foo", "bar");
+ instance.addProperty("test2.foo", "abc");
+ Set expResult = new HashSet();
+ expResult.add("test1");
+ expResult.add("test2");
+ Set result = instance.getSections();
+ assertEquals(expResult, result);
+ }
public void testQuotedValue() throws Exception
{
Modified: commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestXMLConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestXMLConfiguration.java?rev=952624&r1=952623&r2=952624&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestXMLConfiguration.java (original)
+++ commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestXMLConfiguration.java Tue Jun 8 12:00:58 2010
@@ -1128,14 +1128,14 @@ public class TestXMLConfiguration extend
*/
public void testInitCopy() throws ConfigurationException
{
- XMLConfiguration copy = new XMLConfiguration(conf);
+ XMLConfiguration copy = new XMLConfiguration(conf);
assertEquals("value", copy.getProperty("element"));
assertNull("Document was copied, too", copy.getDocument());
ConfigurationNode root = copy.getRootNode();
for(Iterator it = root.getChildren().iterator(); it.hasNext();)
{
- ConfigurationNode node = (ConfigurationNode) it.next();
- assertNull("Reference was not cleared", node.getReference());
+ ConfigurationNode node = (ConfigurationNode) it.next();
+ assertNull("Reference was not cleared", node.getReference());
}
removeTestFile();
Modified: commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/event/TestSubsetConfigurationEvents.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/event/TestSubsetConfigurationEvents.java?rev=952624&r1=952623&r2=952624&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/event/TestSubsetConfigurationEvents.java (original)
+++ commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/event/TestSubsetConfigurationEvents.java Tue Jun 8 12:00:58 2010
@@ -29,8 +29,8 @@ import org.apache.commons.configuration.
*/
public class TestSubsetConfigurationEvents extends AbstractTestConfigurationEvents
{
- protected AbstractConfiguration createConfiguration()
- {
- return (SubsetConfiguration)new MapConfiguration(new HashMap()).subset("test");
- }
+ protected AbstractConfiguration createConfiguration()
+ {
+ return (SubsetConfiguration)new MapConfiguration(new HashMap()).subset("test");
+ }
}
Modified: commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/plist/TestPropertyListConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/plist/TestPropertyListConfiguration.java?rev=952624&r1=952623&r2=952624&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/plist/TestPropertyListConfiguration.java (original)
+++ commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/plist/TestPropertyListConfiguration.java Tue Jun 8 12:00:58 2010
@@ -261,7 +261,7 @@ public class TestPropertyListConfigurati
{
assertTrue(savedFile.delete());
}
-
+
// save the configuration
String filename = savedFile.getAbsolutePath();
config.save(filename);
@@ -323,8 +323,8 @@ public class TestPropertyListConfigurati
public void testInitCopy()
{
- PropertyListConfiguration copy = new PropertyListConfiguration(config);
- assertFalse("Nothing was copied", copy.isEmpty());
+ PropertyListConfiguration copy = new PropertyListConfiguration(config);
+ assertFalse("Nothing was copied", copy.isEmpty());
}
/**
Modified: commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/plist/TestXMLPropertyListConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/plist/TestXMLPropertyListConfiguration.java?rev=952624&r1=952623&r2=952624&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/plist/TestXMLPropertyListConfiguration.java (original)
+++ commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/plist/TestXMLPropertyListConfiguration.java Tue Jun 8 12:00:58 2010
@@ -336,11 +336,11 @@ public class TestXMLPropertyListConfigur
}
public void testInitCopy()
- {
- XMLPropertyListConfiguration copy = new XMLPropertyListConfiguration((HierarchicalConfiguration) config);
- StrictConfigurationComparator comp = new StrictConfigurationComparator();
- assertTrue("Configurations are not equal", comp.compare(config, copy));
- }
+ {
+ XMLPropertyListConfiguration copy = new XMLPropertyListConfiguration((HierarchicalConfiguration) config);
+ StrictConfigurationComparator comp = new StrictConfigurationComparator();
+ assertTrue("Configurations are not equal", comp.compare(config, copy));
+ }
/**
* Tests whether a configuration can be loaded that does not start with a