jicarilla-sandbox/platform/components/http/impl/src/test/org/jicarilla/io FilesystemTestCase.java,1.2,1.3
| Newsgroups | gmane.comp.java.jicarilla.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/jicarilla/jicarilla-sandbox/platform/components/http/impl/src/test/org/jicarilla/io
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15519/platform/components/http/impl/src/test/org/jicarilla/io
Modified Files:
FilesystemTestCase.java
Log Message:
it's a bit difficult to write unit tests that are all about filesystem interaction. After all, you need to get at the files. One common file is the rt.jar of the JDK/JRE. At least it worksforme :D
Index: FilesystemTestCase.java
===================================================================
RCS file: /cvsroot/jicarilla/jicarilla-sandbox/platform/components/http/impl/src/test/org/jicarilla/io/FilesystemTestCase.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- FilesystemTestCase.java 4 Jan 2004 16:10:18 -0000 1.2
+++ FilesystemTestCase.java 19 Feb 2004 20:29:26 -0000 1.3
@@ -59,7 +59,10 @@
{
super.setUp();
- system = new FilesystemImpl( "." );
+ String javaHome = System.getProperty( "java.home" );
+ String slash = System.getProperty( "file.separator" );
+
+ system = new FilesystemImpl( javaHome + slash + "lib" );
}
protected void tearDown() throws Exception
@@ -72,7 +75,7 @@
// ----------------------------------------------------------------------
public void testGetFile() throws Exception
{
- ReadableByteChannel channel = system.getFile( "startup.bsh" );
+ ReadableByteChannel channel = system.getFile( "rt.jar" );
assertNotNull( channel );
assertTrue( channel.isOpen() );
@@ -129,7 +132,7 @@
// ----------------------------------------------------------------------
public void testReturnFile() throws Exception
{
- ReadableByteChannel channel = system.getFile( "create-pipeline.bsh" );
+ ReadableByteChannel channel = system.getFile( "rt.jar" );
assertNotNull( channel );
assertTrue( channel.isOpen() );
system.returnFile( channel );
@@ -148,7 +151,11 @@
public void testReturnFileDoesNotModifyChannelsItDidNotCreate() throws Exception
{
- File f = new File("startup.bsh");
+ String javaHome = System.getProperty( "java.home" );
+ String slash = System.getProperty( "file.separator" );
+ String file = javaHome + slash + "lib" + slash + "rt.jar";
+
+ File f = new File( file );
FileInputStream fs = new FileInputStream( f );
FileChannel fc = fs.getChannel();
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click