You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by oh...@apache.org on 2005/11/03 21:53:29 UTC

svn commit: r330630 - in /jakarta/commons/proper/configuration/trunk: ./ src/test/org/apache/commons/configuration/ src/test/org/apache/commons/configuration/reloading/

Author: oheger
Date: Thu Nov  3 12:53:13 2005
New Revision: 330630

URL: http://svn.apache.org/viewcvs?rev=330630&view=rev
Log:
Removed fake dependency resources.jar; updated tests correspondingly

Modified:
    jakarta/commons/proper/configuration/trunk/build.xml
    jakarta/commons/proper/configuration/trunk/project.xml
    jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestConfigurationFactory.java
    jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestPropertiesConfiguration.java
    jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestXMLConfiguration.java
    jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/reloading/TestFileChangedReloadingStrategy.java

Modified: jakarta/commons/proper/configuration/trunk/build.xml
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/configuration/trunk/build.xml?rev=330630&r1=330629&r2=330630&view=diff
==============================================================================
--- jakarta/commons/proper/configuration/trunk/build.xml (original)
+++ jakarta/commons/proper/configuration/trunk/build.xml Thu Nov  3 12:53:13 2005
@@ -124,11 +124,6 @@
         </pathelement>
         <!-- Manual changes for dealing with the conf directory -->
         <pathelement path="${targetconfdir}"/>
-        <path>
-          <fileset dir="${targetconfdir}">
-            <include name="resources.jar"/>
-          </fileset>
-        </path>
         <!-- Manual changes end -->
         
       </classpath>
@@ -184,7 +179,6 @@
         </include>
         <include name="*.dtd">
         </include>
-        <include name="resources.jar"/>
       </fileset>
     </copy>
     <mkdir dir="${targetconfdir}/org/apache/commons/configuration">
@@ -270,8 +264,6 @@
     </get>
     <get dest="${libdir}/mockobjects-jdk1.4-j2ee1.3-0.09.jar" usetimestamp="true" ignoreerrors="true" src="http://www.ibiblio.org/maven/mockobjects/jars/mockobjects-jdk1.4-j2ee1.3-0.09.jar">
     </get>
-<!--    <get dest="${libdir}/resources-1.0.jar" usetimestamp="true" ignoreerrors="true" src="http://www.ibiblio.org/maven/resources/jars/resources-1.0.jar">
-    </get>  -->
     <get dest="${libdir}/maven-tasks-plugin-1.1.0.jar" usetimestamp="true" ignoreerrors="true" src="http://www.ibiblio.org/maven/maven-plugins/plugins/maven-tasks-plugin-1.1.0.jar">
     </get>
     <get dest="${libdir}/maven-findbugs-plugin-0.8.4.jar" usetimestamp="true" ignoreerrors="true" src="http://www.ibiblio.org/maven/maven-plugins/plugins/maven-findbugs-plugin-0.8.4.jar">

Modified: jakarta/commons/proper/configuration/trunk/project.xml
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/configuration/trunk/project.xml?rev=330630&r1=330629&r2=330630&view=diff
==============================================================================
--- jakarta/commons/proper/configuration/trunk/project.xml (original)
+++ jakarta/commons/proper/configuration/trunk/project.xml Thu Nov  3 12:53:13 2005
@@ -355,13 +355,6 @@
       <scope>test</scope>
     </dependency>
 
-    <!-- Fake dependency to test loading configuration files from a JAR -->
-    <dependency>
-      <id>resources</id>
-      <version>1.0</version>
-      <scope>test</scope>
-    </dependency>
-
     <dependency>
       <groupId>maven-plugins</groupId>
       <artifactId>maven-tasks-plugin</artifactId>

Modified: jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestConfigurationFactory.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestConfigurationFactory.java?rev=330630&r1=330629&r2=330630&view=diff
==============================================================================
--- jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestConfigurationFactory.java (original)
+++ jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestConfigurationFactory.java Thu Nov  3 12:53:13 2005
@@ -181,16 +181,6 @@
         }
     }
 
-    public void testLoadingFromJAR() throws Exception
-    {
-        URL url = Thread.currentThread().getContextClassLoader().getResource("config-jar.xml");
-        assertNotNull("config-jar.xml not found on the classpath", url);
-        factory.setConfigurationURL(url);
-
-        Configuration conf = factory.getConfiguration();
-        assertFalse("The configuration is empty", conf.isEmpty());
-    }
-
     public void testThrowingConfigurationInitializationException() throws Exception
     {
         factory.setConfigurationFileName(testDigesterBadXML.toString());

Modified: jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestPropertiesConfiguration.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestPropertiesConfiguration.java?rev=330630&r1=330629&r2=330630&view=diff
==============================================================================
--- jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestPropertiesConfiguration.java (original)
+++ jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestPropertiesConfiguration.java Thu Nov  3 12:53:13 2005
@@ -223,17 +223,6 @@
         assertTrue("Make sure we have multiple keys", pc.getBoolean("test.boolean"));
     }
 
-    public void testLoadFromJAR() throws Exception
-    {
-        conf = new PropertiesConfiguration();
-        conf.setIncludesAllowed(true);
-        conf.setFileName("test-jar.properties");
-        conf.load();
-
-        assertEquals("jar", conf.getProperty("configuration.location"));
-        assertEquals("property in an included file", "jar", conf.getProperty("include.location"));
-    }
-
     public void testLoadFromFile() throws Exception
     {
         File file = new File("conf/test.properties");

Modified: jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestXMLConfiguration.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestXMLConfiguration.java?rev=330630&r1=330629&r2=330630&view=diff
==============================================================================
--- jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestXMLConfiguration.java (original)
+++ jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestXMLConfiguration.java Thu Nov  3 12:53:13 2005
@@ -323,15 +323,6 @@
         assertEquals("I'm complex!", conf.getProperty("element2.subelement.subsubelement"));
     }
 
-    public void testLoadFromJAR() throws Exception
-    {
-        conf = new XMLConfiguration();
-        conf.setFileName("test-jar.xml");
-        conf.load();
-
-        assertEquals("I'm complex!", conf.getProperty("element2.subelement.subsubelement"));
-    }
-    
     /**
      * Tests constructing an XMLConfiguration from a non existing file and
      * later saving to this file.

Modified: jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/reloading/TestFileChangedReloadingStrategy.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/reloading/TestFileChangedReloadingStrategy.java?rev=330630&r1=330629&r2=330630&view=diff
==============================================================================
--- jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/reloading/TestFileChangedReloadingStrategy.java (original)
+++ jakarta/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/reloading/TestFileChangedReloadingStrategy.java Thu Nov  3 12:53:13 2005
@@ -18,6 +18,7 @@
 
 import java.io.File;
 import java.io.FileWriter;
+import java.net.URL;
 
 import junit.framework.TestCase;
 import org.apache.commons.configuration.PropertiesConfiguration;
@@ -124,13 +125,12 @@
     public void testFromJar() throws Exception
     {
         XMLConfiguration config = new XMLConfiguration();
-        config.setFileName("test-jar.xml");
-        config.load();
+        // use some jar: URL; the jar need not exist
+        config.setURL(new URL("jar:file:/D:/data/projects/OpenSource/commons-configuration/conf/resources.jar!/test-jar.xml"));
         FileChangedReloadingStrategy strategy = new FileChangedReloadingStrategy();
         config.setReloadingStrategy(strategy);
         File file = strategy.getFile();
-        assertNotNull(file);
-        assertTrue(file.exists());
-        assertEquals("resources.jar", file.getName());
+        assertNotNull("Strategy's file is null", file);
+        assertEquals("Strategy does not monitor the jar file", "resources.jar", file.getName());
     }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org