dims 01/08/03 03:53:49
Modified: . build.xml
src/org/apache/cocoon/util IOUtils.java
Added: test/org/apache/cocoon/util IOUtilsTest.java
Log:
Patch from Stuart for IOUtils.java + JUnit Test cases for C2.1 repository.
Stuart,
Can you please check if all's well?
Revision Changes Path
1.44 +40 -0 xml-cocoon2/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/xml-cocoon2/build.xml,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- build.xml 2001/08/02 21:07:23 1.43
+++ build.xml 2001/08/03 10:53:49 1.44
@@ -169,6 +169,7 @@
<property name="target.vm" value="1.2"/>
<property name="src.dir" value="./src"/>
+ <property name="test.dir" value="./test"/>
<property name="lib.dir" value="./lib"/>
<property name="bin.dir" value="./bin"/>
<property name="docs.dir" value="./xdocs"/>
@@ -189,6 +190,7 @@
<property name="build.root" value="./build"/>
<property name="build.dir" value="${build.root}/${name}"/>
<property name="build.src" value="${build.dir}/src"/>
+ <property name="build.test" value="${build.dir}/test"/>
<property name="build.dest" value="${build.dir}/classes"/>
<property name="build.docs" value="${build.dir}/docs"/>
<property name="build.xdocs" value="${build.dir}/xdocs"/>
@@ -1018,6 +1020,44 @@
<delete file="${dist.target}/${Name}-${version}.tar"/>
<delete file="${dist.target}/${Name}-${version}.zip"/>
<delete dir="${dist.root}"/>
+ </target>
+
+ <!-- ===================================================================
-->
+ <!-- Test targets -->
+ <!-- ===================================================================
-->
+ <target name="test" depends="compile" description="Perform jUnit tests">
+ <mkdir dir="${build.test}"/>
+ <!-- Copy test files to build test dir -->
+ <copy todir="${build.test}" filtering="on">
+ <fileset dir="${test.dir}"/>
+ </copy>
+ <!-- Compile tests -->
+ <javac srcdir="${build.test}"
+ destdir="${build.test}"
+ debug="${debug}"
+ optimize="${optimize}"
+ deprecation="${deprecation}"
+ target="${target.vm}">
+ <classpath refid="classpath"/>
+ <classpath>
+ <pathelement path="${build.dest}" />
+ </classpath>
+ </javac>
+ <junit printsummary="yes" haltonfailure="no" fork="yes">
+ <classpath>
+ <pathelement location="${build.test}" />
+ <pathelement location="${build.dest}" />
+ <pathelement path="${java.class.path}" />
+ </classpath>
+ <formatter type="plain" usefile="no" />
+ <batchtest>
+ <fileset dir="${build.test}">
+ <include name="**/*Test.class" />
+ <exclude name="**/AllTest.class" />
+ <exclude name="**/*$$*Test.class" />
+ </fileset>
+ </batchtest>
+ </junit>
</target>
</project>
1.6 +2 -3 xml-cocoon2/src/org/apache/cocoon/util/IOUtils.java
Index: IOUtils.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/util/IOUtils.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- IOUtils.java 2001/07/05 01:05:04 1.5
+++ IOUtils.java 2001/08/03 10:53:49 1.6
@@ -28,7 +28,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Ricardo Rocha</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
- * @version CVS $Revision: 1.5 $ $Date: 2001/07/05 01:05:04 $
+ * @version CVS $Revision: 1.6 $ $Date: 2001/08/03 10:53:49 $
*/
public class IOUtils {
@@ -174,7 +174,7 @@
boolean isJavaKeyword = isJavaKeyword(path[i]);
char[] chars = path[i].toCharArray();
- if (chars.length < 1) buffer.append('_');
+ if (chars.length < 1 || !Character.isLetter(chars[0]))
buffer.append('_');
for (int j = 0; j < chars.length; j++) {
if (StringUtils.isAlphaNumeric(chars[j])) {
@@ -188,7 +188,6 @@
if(isJavaKeyword)
buffer.append(keywordSuffix);
}
-
return buffer.toString();
}
1.1 xml-cocoon2/test/org/apache/cocoon/util/IOUtilsTest.java
Index: IOUtilsTest.java
===================================================================
/*****************************************************************************
* Copyright (C) The Apache Software Foundation. All rights reserved. *
* ------------------------------------------------------------------------- *
* This software is published under the terms of the Apache Software License *
* version 1.1, a copy of which has been included with this distribution in *
* the LICENSE file. *
*****************************************************************************///
package org.apache.cocoon.util;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* Test Cases for the IOUtils Class.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stuart Roebuck</a>
* @version CVS $Revision: 1.1 $ $Date: 2001/08/03 10:53:49 $
*/
public class IOUtilsTest extends TestCase {
public IOUtilsTest(String name) {
super(name);
}
/**
* Test functionality of <code>normalizedFilename()</code> method.
*/
public void testNormalizedFilename() {
assertEquals("__", IOUtils.normalizedFilename("."));
assertEquals("", IOUtils.normalizedFilename(""));
assertEquals("_123", IOUtils.normalizedFilename("123"));
assertEquals("http_/_/_", IOUtils.normalizedFilename("http://"));
}
}
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]