You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by oh...@apache.org on 2011/09/15 22:33:25 UTC
svn commit: r1171260 - in /commons/proper/configuration/trunk: ./ conf/
src/main/resources/ src/test/java/org/apache/commons/configuration/
Author: oheger
Date: Thu Sep 15 20:33:24 2011
New Revision: 1171260
URL: http://svn.apache.org/viewvc?rev=1171260&view=rev
Log:
[CONFIGURATION-461] Moved main resources to maven default location; some tests had to be adapted.
Added:
commons/proper/configuration/trunk/src/main/resources/
commons/proper/configuration/trunk/src/main/resources/PropertyList-1.0.dtd (props changed)
- copied unchanged from r1164911, commons/proper/configuration/trunk/conf/PropertyList-1.0.dtd
commons/proper/configuration/trunk/src/main/resources/digesterRules.xml (props changed)
- copied unchanged from r1164911, commons/proper/configuration/trunk/conf/digesterRules.xml
commons/proper/configuration/trunk/src/main/resources/properties.dtd (props changed)
- copied unchanged from r1164911, commons/proper/configuration/trunk/conf/properties.dtd
Modified:
commons/proper/configuration/trunk/conf/PropertyList-1.0.dtd
commons/proper/configuration/trunk/conf/digesterRules.xml
commons/proper/configuration/trunk/conf/properties.dtd
commons/proper/configuration/trunk/pom.xml
commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestConfigurationFactory.java
commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestDefaultConfigurationBuilder.java
commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestVFSConfigurationBuilder.java
commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestXMLConfiguration.java
Modified: commons/proper/configuration/trunk/pom.xml
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/pom.xml?rev=1171260&r1=1171259&r2=1171260&view=diff
==============================================================================
--- commons/proper/configuration/trunk/pom.xml (original)
+++ commons/proper/configuration/trunk/pom.xml Thu Sep 15 20:33:24 2011
@@ -438,6 +438,9 @@
<build>
<resources>
<resource>
+ <directory>src/main/resources</directory>
+ </resource>
+ <resource>
<directory>.</directory>
<targetPath>META-INF</targetPath>
<includes>
@@ -445,14 +448,6 @@
<include>LICENSE.txt</include>
</includes>
</resource>
- <resource>
- <directory>conf</directory>
- <includes>
- <include>digesterRules.xml</include>
- <include>properties.dtd</include>
- <include>PropertyList-1.0.dtd</include>
- </includes>
- </resource>
</resources>
<testResources>
<testResource>
@@ -480,6 +475,12 @@
<include>**/*.properties</include>
</includes>
</testResource>
+ <testResource>
+ <directory>src/main/resources</directory>
+ <includes>
+ <include>*.dtd</include>
+ </includes>
+ </testResource>
</testResources>
<plugins>
<plugin>
Propchange: commons/proper/configuration/trunk/src/main/resources/PropertyList-1.0.dtd
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/proper/configuration/trunk/src/main/resources/digesterRules.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/proper/configuration/trunk/src/main/resources/digesterRules.xml
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: commons/proper/configuration/trunk/src/main/resources/properties.dtd
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/proper/configuration/trunk/src/main/resources/properties.dtd
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestConfigurationFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestConfigurationFactory.java?rev=1171260&r1=1171259&r2=1171260&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestConfigurationFactory.java (original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestConfigurationFactory.java Thu Sep 15 20:33:24 2011
@@ -19,6 +19,7 @@ package org.apache.commons.configuration
import java.io.File;
import java.io.FileWriter;
+import java.net.URL;
import java.util.Collection;
import java.util.List;
@@ -34,7 +35,7 @@ import org.xml.sax.SAXException;
public class TestConfigurationFactory extends TestCase
{
/** The Files that we test with */
- private File digesterRules = new File("conf/digesterRules.xml");
+ private URL digesterRules = getClass().getResource("/digesterRules.xml");
private File testDigesterFile =
new File("conf/testDigesterConfiguration.xml");
private File testDigesterFileReverseOrder =
@@ -105,7 +106,7 @@ public class TestConfigurationFactory ex
public void testLoadingConfigurationWithRulesXML() throws Exception
{
factory.setConfigurationFileName(testDigesterFile.toString());
- factory.setDigesterRules(digesterRules.toURL());
+ factory.setDigesterRules(digesterRules);
compositeConfiguration = (CompositeConfiguration) factory.getConfiguration();
@@ -142,7 +143,6 @@ public class TestConfigurationFactory ex
public void testLoadingConfigurationNamespaceAware() throws Exception
{
factory.setConfigurationFileName(testDigesterFileNamespaceAware.toString());
- //factory.setDigesterRules(digesterRules.toURL());
factory.setDigesterRuleNamespaceURI("namespace-one");
checkCompositeConfiguration();
@@ -154,7 +154,6 @@ public class TestConfigurationFactory ex
factory.setBasePath(testBasePath);
- //factory.setDigesterRules(digesterRules.toURL());
//factory.setDigesterRuleNamespaceURI("namespace-one");
checkCompositeConfiguration();
Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestDefaultConfigurationBuilder.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestDefaultConfigurationBuilder.java?rev=1171260&r1=1171259&r2=1171260&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestDefaultConfigurationBuilder.java (original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestDefaultConfigurationBuilder.java Thu Sep 15 20:33:24 2011
@@ -22,6 +22,7 @@ import java.io.StringWriter;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
+import java.net.URL;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
@@ -912,15 +913,14 @@ public class TestDefaultConfigurationBui
{
File confDir = new File("conf");
File targetDir = new File("target");
- File testXMLSource = new File(confDir, "testDtd.xml");
File testXMLValidationSource = new File(confDir,
"testValidateInvalid.xml");
File testSavedXML = new File(targetDir, "testSave.xml");
File testSavedFactory = new File(targetDir, "testSaveFactory.xml");
- File dtdFile = new File(confDir, "properties.dtd");
+ URL dtdFile = getClass().getResource("/properties.dtd");
final String publicId = "http://commons.apache.org/test.dtd";
- XMLConfiguration config = new XMLConfiguration(testXMLSource);
+ XMLConfiguration config = new XMLConfiguration("testDtd.xml");
config.setPublicID(publicId);
config.save(testSavedXML);
factory.addProperty("xml[@fileName]", testSavedXML.getAbsolutePath());
@@ -933,7 +933,7 @@ public class TestDefaultConfigurationBui
factory = new DefaultConfigurationBuilder();
factory.setFile(testSavedFactory);
- factory.registerEntityId(publicId, dtdFile.toURI().toURL());
+ factory.registerEntityId(publicId, dtdFile);
factory.clearErrorListeners();
Configuration c = factory.getConfiguration();
assertEquals("Wrong property value", "value1", c.getString("entry(0)"));
Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestVFSConfigurationBuilder.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestVFSConfigurationBuilder.java?rev=1171260&r1=1171259&r2=1171260&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestVFSConfigurationBuilder.java (original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestVFSConfigurationBuilder.java Thu Sep 15 20:33:24 2011
@@ -22,6 +22,7 @@ import java.io.FileWriter;
import java.io.IOException;
import java.io.Reader;
import java.io.Writer;
+import java.net.URL;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
@@ -762,15 +763,14 @@ public class TestVFSConfigurationBuilder
{
File confDir = new File("conf");
File targetDir = new File("target");
- File testXMLSource = new File(confDir, "testDtd.xml");
File testXMLValidationSource = new File(confDir,
"testValidateInvalid.xml");
File testSavedXML = new File(targetDir, "testSave.xml");
File testSavedFactory = new File(targetDir, "testSaveFactory.xml");
- File dtdFile = new File(confDir, "properties.dtd");
+ URL dtdFile = getClass().getResource("/properties.dtd");
final String publicId = "http://commons.apache.org/test.dtd";
- XMLConfiguration config = new XMLConfiguration(testXMLSource);
+ XMLConfiguration config = new XMLConfiguration("testDtd.xml");
config.setPublicID(publicId);
config.save(testSavedXML);
factory.addProperty("xml[@fileName]", testSavedXML.getAbsolutePath());
@@ -783,7 +783,7 @@ public class TestVFSConfigurationBuilder
factory = new DefaultConfigurationBuilder();
factory.setFile(testSavedFactory);
- factory.registerEntityId(publicId, dtdFile.toURL());
+ factory.registerEntityId(publicId, dtdFile);
factory.clearErrorListeners();
Configuration c = factory.getConfiguration();
assertEquals("Wrong property value", "value1", c.getString("entry(0)"));
Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestXMLConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestXMLConfiguration.java?rev=1171260&r1=1171259&r2=1171260&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestXMLConfiguration.java (original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestXMLConfiguration.java Thu Sep 15 20:33:24 2011
@@ -1036,7 +1036,7 @@ public class TestXMLConfiguration extend
+ "<properties version=\"1.0\"><entry key=\"test\">value</entry></properties>";
StringReader in = new StringReader(content);
conf = new XMLConfiguration();
- conf.setFileName("conf/testDtd.xml");
+ conf.setFileName("testDtd.xml");
conf.load();
conf.clear();
conf.load(in);
@@ -1457,14 +1457,14 @@ public class TestXMLConfiguration extend
public void testRegisterEntityId() throws ConfigurationException,
IOException
{
- File dtdFile = new File("conf/properties.dtd");
+ URL dtdURL = getClass().getResource("/properties.dtd");
final String publicId = "http://commons.apache.org/test/properties.dtd";
conf = new XMLConfiguration("testDtd.xml");
conf.setPublicID(publicId);
conf.save(testSaveConf);
XMLConfiguration checkConfig = new XMLConfiguration();
checkConfig.setFile(testSaveConf);
- checkConfig.registerEntityId(publicId, dtdFile.toURI().toURL());
+ checkConfig.registerEntityId(publicId, dtdURL);
checkConfig.setValidating(true);
checkSavedConfig(checkConfig);
}