|
From: <ls...@us...> - 2009-03-30 11:06:50
|
Revision: 5184
http://jnode.svn.sourceforge.net/jnode/?rev=5184&view=rev
Author: lsantha
Date: 2009-03-30 11:06:44 +0000 (Mon, 30 Mar 2009)
Log Message:
-----------
Fixed fs testsuite to be runnable outside JNode.
Modified Paths:
--------------
trunk/core/src/classpath/vm/java/io/VMIOUtils.java
trunk/fs/src/fs/org/jnode/fs/service/FileSystemService.java
trunk/fs/src/fs/org/jnode/fs/service/def/FileSystemAPIImpl.java
trunk/fs/src/fs/org/jnode/fs/service/def/FileSystemPlugin.java
trunk/fs/src/test/org/jnode/test/fs/filesystem/FSTestSuite.java
trunk/fs/src/test/org/jnode/test/support/ContextManager.java
Removed Paths:
-------------
trunk/core/src/classpath/vm/java/io/VMFileSystemAPI.java
Deleted: trunk/core/src/classpath/vm/java/io/VMFileSystemAPI.java
===================================================================
--- trunk/core/src/classpath/vm/java/io/VMFileSystemAPI.java 2009-03-30 11:03:18 UTC (rev 5183)
+++ trunk/core/src/classpath/vm/java/io/VMFileSystemAPI.java 2009-03-30 11:06:44 UTC (rev 5184)
@@ -1,155 +0,0 @@
-/*
- * $Id$
- *
- * Copyright (C) 2003-2009 JNode.org
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; If not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-package java.io;
-
-import org.jnode.java.io.VMFileHandle;
-
-/**
- * The implementation of this interface is used to connect the java.io package with the JNode
- * filesystem services.
- * The file paths given to the various methods are absolute and canonical.
- *
- * @modif add mkDir mkFile Yves Galante (yve...@jm...) 01.04.2004
- * @author epr
- */
-public interface VMFileSystemAPI {
-
- /**
- * Does a given file exist?
- */
- public boolean fileExists(String file);
-
- /**
- * Is the given File a plain file?
- */
- public boolean isFile(String file);
-
- /**
- * Is the given File a directory?
- */
- public boolean isDirectory(String file);
-
- /**
- * Can the given file be read?
- *
- * @param file
- */
- public boolean canRead(String file) throws IOException;
-
- /**
- * Can the given file be written to?
- *
- * @param file
- */
- public boolean canWrite(String file) throws IOException;
-
- public boolean canExecute(String file) throws IOException;
-
- /**
- * Gets the length in bytes of the given file or 0 if the file does not exist.
- *
- * @param file
- */
- public long getLength(String file);
-
- /**
- * Gets the last modification date of the given file.
- *
- * @param file
- */
- public long getLastModified(String file);
-
- /**
- * Sets the last modification date of the given file.
- *
- * @param file
- */
- public void setLastModified(String file, long time) throws IOException;
-
- /**
- * Mark the given file as readonly.
- *
- * @param file
- * @throws IOException
- */
- public void setReadOnly(String file) throws IOException;
-
- public boolean setReadable(String normalizedPath, boolean enable,
- boolean owneronly) throws IOException;
-
- public boolean setWritable(String normalizedPath, boolean enable,
- boolean owneronly) throws IOException;
-
- public boolean setExecutable(String normalizedPath, boolean enable,
- boolean owneronly) throws IOException;
-
- /**
- * Delete the given file.
- *
- * @param file
- * @throws IOException
- */
- public void delete(String file) throws IOException;
-
- /**
- * This method returns an array of filesystem roots.
- */
- public File[] getRoots();
-
- /**
- * Gets an array of names of all entries of the given directory. All names are relative to the
- * given directory.
- *
- * @param directory
- * @param filter
- */
- public String[] list(String directory) throws IOException;
-
- /**
- * Open a given file
- *
- * @param file
- * @throws IOException
- */
- public VMFileHandle open(String file, VMOpenMode mode) throws IOException;
-
- /**
- * Make a directory
- *
- * @param file
- * @throws IOException
- */
- public boolean mkDir(String file) throws IOException;
-
- /**
- * Make a file
- *
- * @param file
- * @throws IOException
- */
- public boolean mkFile(String file, VMOpenMode mode) throws IOException;
-
- public long getTotalSpace(String normalizedPath) throws IOException;
-
- public long getFreeSpace(String normalizedPath) throws IOException;
-
- public long getUsableSpace(String normalizedPath) throws IOException;
-}
Modified: trunk/core/src/classpath/vm/java/io/VMIOUtils.java
===================================================================
--- trunk/core/src/classpath/vm/java/io/VMIOUtils.java 2009-03-30 11:03:18 UTC (rev 5183)
+++ trunk/core/src/classpath/vm/java/io/VMIOUtils.java 2009-03-30 11:06:44 UTC (rev 5184)
@@ -22,6 +22,7 @@
import org.jnode.vm.annotation.SharedStatics;
import org.jnode.java.io.VMFileHandle;
+import org.jnode.java.io.VMFileSystemAPI;
//todo serious review is needed
/**
Modified: trunk/fs/src/fs/org/jnode/fs/service/FileSystemService.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/service/FileSystemService.java 2009-03-30 11:03:18 UTC (rev 5183)
+++ trunk/fs/src/fs/org/jnode/fs/service/FileSystemService.java 2009-03-30 11:06:44 UTC (rev 5184)
@@ -21,7 +21,7 @@
package org.jnode.fs.service;
import java.io.IOException;
-import java.io.VMFileSystemAPI;
+import org.jnode.java.io.VMFileSystemAPI;
import java.util.Collection;
import java.util.Map;
Modified: trunk/fs/src/fs/org/jnode/fs/service/def/FileSystemAPIImpl.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/service/def/FileSystemAPIImpl.java 2009-03-30 11:03:18 UTC (rev 5183)
+++ trunk/fs/src/fs/org/jnode/fs/service/def/FileSystemAPIImpl.java 2009-03-30 11:06:44 UTC (rev 5184)
@@ -23,7 +23,7 @@
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
-import java.io.VMFileSystemAPI;
+import org.jnode.java.io.VMFileSystemAPI;
import java.io.VMOpenMode;
import java.util.ArrayList;
import java.util.HashMap;
Modified: trunk/fs/src/fs/org/jnode/fs/service/def/FileSystemPlugin.java
===================================================================
--- trunk/fs/src/fs/org/jnode/fs/service/def/FileSystemPlugin.java 2009-03-30 11:03:18 UTC (rev 5183)
+++ trunk/fs/src/fs/org/jnode/fs/service/def/FileSystemPlugin.java 2009-03-30 11:06:44 UTC (rev 5184)
@@ -22,7 +22,7 @@
import java.io.IOException;
import java.io.VMFile;
-import java.io.VMFileSystemAPI;
+import org.jnode.java.io.VMFileSystemAPI;
import java.io.VMIOUtils;
import java.security.AccessController;
import java.security.PrivilegedAction;
Modified: trunk/fs/src/test/org/jnode/test/fs/filesystem/FSTestSuite.java
===================================================================
--- trunk/fs/src/test/org/jnode/test/fs/filesystem/FSTestSuite.java 2009-03-30 11:03:18 UTC (rev 5183)
+++ trunk/fs/src/test/org/jnode/test/fs/filesystem/FSTestSuite.java 2009-03-30 11:06:44 UTC (rev 5184)
@@ -38,6 +38,7 @@
import org.jnode.test.fs.filesystem.tests.FileFSTest;
import org.jnode.test.fs.filesystem.tests.TreeFSTest;
import org.jnode.util.OsUtils;
+import javax.naming.NamingException;
/**
* This class runs a suite of functional tests on the JNode file system
@@ -49,13 +50,22 @@
* @author cr...@jn...
*/
public class FSTestSuite extends JFuncSuite {
+ private static boolean setup = false;
public static void main(String[] args) throws Throwable {
- if (!OsUtils.isJNode()) {
+ setUp();
+
+ JFuncRunner.run(FSTestSuite.suite());
+ //JFuncRunner.main(new String[]{"-v", "--color", FSTestSuite.class.getName()});
+ //JFuncRunner.main(new String[]{"-v", FSTestSuite.class.getName()});
+ }
+
+ private static void setUp() throws NamingException {
+ if (!setup && !OsUtils.isJNode()) {
// We are not running in JNode, emulate a JNode environment.
-
+
InitialNaming.setNameSpace(new BasicNameSpace());
-
- // Build a plugin descriptor that is sufficient for the FileSystemPlugin to
+
+ // Build a plugin descriptor that is sufficient for the FileSystemPlugin to
// configure file system types for testing.
DummyPluginDescriptor desc = new DummyPluginDescriptor(true);
DummyExtensionPoint ep = new DummyExtensionPoint("types", "org.jnode.fs.types", "types");
@@ -67,17 +77,15 @@
extension.addElement(element);
ep.addExtension(extension);
}
-
+
FileSystemService fss = new FileSystemPlugin(desc);
InitialNaming.bind(FileSystemService.class, fss);
}
-
- JFuncRunner.run(FSTestSuite.suite());
- //JFuncRunner.main(new String[]{"-v", "--color", FSTestSuite.class.getName()});
- //JFuncRunner.main(new String[]{"-v", FSTestSuite.class.getName()});
+ setup = true;
}
public static JFuncSuite suite() throws Throwable {
+ setUp();
JFuncSuite suite = new JFuncSuite();
for (FSTestConfig config : new FSConfigurations()) {
Modified: trunk/fs/src/test/org/jnode/test/support/ContextManager.java
===================================================================
--- trunk/fs/src/test/org/jnode/test/support/ContextManager.java 2009-03-30 11:03:18 UTC (rev 5183)
+++ trunk/fs/src/test/org/jnode/test/support/ContextManager.java 2009-03-30 11:06:44 UTC (rev 5184)
@@ -37,6 +37,7 @@
import org.jnode.test.fs.driver.stubs.StubDeviceManager;
import org.jnode.test.fs.driver.stubs.StubNameSpace;
import org.jnode.test.fs.filesystem.config.OsType;
+import org.jnode.emu.naming.BasicNameSpace;
public class ContextManager {
@@ -88,7 +89,7 @@
protected void initNaming() throws PluginException {
if (OsType.OTHER_OS.isCurrentOS()) {
- NameSpace namespace = new StubNameSpace();
+ NameSpace namespace = new BasicNameSpace();
InitialNaming.setNameSpace(namespace);
populateNameSpace(namespace);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|