r115 - in trunk: diswork-daemon/src/main/java/org/nuiton/diswork/daemon diswork-fs/src/main/java/org/nuiton/diswork/fs diswork-fs/src/main/java/org/nuiton/diswork/fs/storage diswork-fs/src/test/java/org/nuiton/diswork/fs diswork-fs/src/test/java/org/nuiton/diswork/fs/storage
Author: bleny Date: 2010-07-28 14:24:33 +0200 (Wed, 28 Jul 2010) New Revision: 115 Url: http://nuiton.org/repositories/revision/diswork/115 Log: gestion des exceptions dans le FS Added: trunk/diswork-fs/src/main/java/org/nuiton/diswork/fs/DisworkAlreadyExistsException.java Modified: trunk/diswork-daemon/src/main/java/org/nuiton/diswork/daemon/DisworkDaemon.java trunk/diswork-fs/src/main/java/org/nuiton/diswork/fs/DisworkFileSystem.java trunk/diswork-fs/src/main/java/org/nuiton/diswork/fs/DisworkFileSystemException.java trunk/diswork-fs/src/main/java/org/nuiton/diswork/fs/storage/KademliaDisworkMap.java trunk/diswork-fs/src/main/java/org/nuiton/diswork/fs/storage/PastryDisworkMap.java trunk/diswork-fs/src/main/java/org/nuiton/diswork/fs/storage/Storage.java trunk/diswork-fs/src/test/java/org/nuiton/diswork/fs/AbstractDisworkFileSystemTest.java trunk/diswork-fs/src/test/java/org/nuiton/diswork/fs/storage/KademliaDisworkMapTest.java Modified: trunk/diswork-daemon/src/main/java/org/nuiton/diswork/daemon/DisworkDaemon.java =================================================================== --- trunk/diswork-daemon/src/main/java/org/nuiton/diswork/daemon/DisworkDaemon.java 2010-07-28 12:22:28 UTC (rev 114) +++ trunk/diswork-daemon/src/main/java/org/nuiton/diswork/daemon/DisworkDaemon.java 2010-07-28 12:24:33 UTC (rev 115) @@ -42,10 +42,10 @@ import org.apache.commons.io.IOUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.nuiton.diswork.fs.DisworkAlreadyExistsException; import org.nuiton.diswork.fs.DisworkFileSystem; import org.nuiton.diswork.fs.DisworkFileSystemConfig; import org.nuiton.diswork.fs.DisworkFileSystemException; -import org.nuiton.diswork.fs.DisworkFileSystemException.Type; import org.nuiton.util.FileUtil; /** @@ -609,13 +609,9 @@ // there is a risk that jobs be proposed at the same time fileSystem.createSymbolicLink(TODO + "/" + linkName, jobDir); success = true; - } catch (DisworkFileSystemException e) { - if (e.getType() == Type.ALREADY_EXISTS) { - // retry - success = false; - } else { - throw e; - } + } catch (DisworkAlreadyExistsException e) { + // retry + success = false; } } config.addOneJobSubmitted(); Added: trunk/diswork-fs/src/main/java/org/nuiton/diswork/fs/DisworkAlreadyExistsException.java =================================================================== --- trunk/diswork-fs/src/main/java/org/nuiton/diswork/fs/DisworkAlreadyExistsException.java (rev 0) +++ trunk/diswork-fs/src/main/java/org/nuiton/diswork/fs/DisworkAlreadyExistsException.java 2010-07-28 12:24:33 UTC (rev 115) @@ -0,0 +1,20 @@ +package org.nuiton.diswork.fs; + +/** thrown when if path lead to something that already exists */ +public class DisworkAlreadyExistsException extends DisworkFileSystemException { + + private static final long serialVersionUID = 1L; + + public DisworkAlreadyExistsException(String message, Throwable cause) { + super(message, cause); + } + + public DisworkAlreadyExistsException(String message) { + super(message); + } + + public DisworkAlreadyExistsException(Throwable cause) { + super(cause); + } + +} Modified: trunk/diswork-fs/src/main/java/org/nuiton/diswork/fs/DisworkFileSystem.java =================================================================== --- trunk/diswork-fs/src/main/java/org/nuiton/diswork/fs/DisworkFileSystem.java 2010-07-28 12:22:28 UTC (rev 114) +++ trunk/diswork-fs/src/main/java/org/nuiton/diswork/fs/DisworkFileSystem.java 2010-07-28 12:24:33 UTC (rev 115) @@ -33,7 +33,6 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.nuiton.diswork.fs.DisworkFileSystemException.Type; import org.nuiton.diswork.fs.storage.DisworkMap; import org.nuiton.diswork.fs.storage.EntryUtil; import org.nuiton.diswork.fs.storage.Storage; @@ -145,7 +144,7 @@ String newTarget = EntryUtil.resolveLink(path, link); result = read(newTarget); } else if (EntryUtil.isDirectory(entry)) { - throw new DisworkFileSystemException(Type.NOT_FILE, "target is not a file: " + path); + throw new IllegalArgumentException(path + " is not a file but a directory"); } else if (EntryUtil.isFile(entry)) { log.info("reading file " + path); String id = EntryUtil.getIdFromEntry(entry); @@ -178,8 +177,7 @@ String entryParent = walk(parent); if (entryParent == null) { - throw new DisworkFileSystemException(Type.NO_SUCH_DIRECTORY, parent - + " directory doesn't exists"); + throw new IllegalArgumentException(parent + " directory doesn't exists"); } if (EntryUtil.isDirectory(entryParent)) { @@ -223,7 +221,7 @@ Thread.sleep(LOCK_WAIT); } catch (InterruptedException e) { log.info("wait for lock interrupted", e); - throw new DisworkFileSystemException(Type.INTERRUPTION, + throw new DisworkFileSystemException( "interrupted while trying to acquire lock", e); } } @@ -240,11 +238,10 @@ String newTarget = EntryUtil.resolveLink(parent, linkTarget); write(newTarget, fileName, source); } else if (EntryUtil.isFile(entryParent)) { - throw new DisworkFileSystemException(Type.NOT_DIRECTORY, parent); + throw new IllegalArgumentException(parent + " is not a directory"); } else { log.warn("strange entry" + entryParent); - throw new DisworkFileSystemException(Type.CORRUPTED_DATA, - "strange entry" + entryParent); + throw new DisworkFileSystemException("strange entry" + entryParent); } } @@ -268,7 +265,7 @@ String entryParent = walk(parent); if (entryParent == null) { - throw new DisworkFileSystemException(Type.NO_SUCH_DIRECTORY, parent); + throw new IllegalArgumentException(parent + " directory doesn't exists"); } if (EntryUtil.isDirectory(entryParent)) { @@ -279,7 +276,7 @@ String findResult = EntryUtil.findEntryInDirectory (content, dirName); if (findResult != null) { - throw new DisworkFileSystemException(Type.ALREADY_EXISTS, parent + throw new DisworkAlreadyExistsException(parent + " already contains an element named " + dirName); } @@ -306,7 +303,7 @@ Thread.sleep(LOCK_WAIT); } catch (InterruptedException e) { log.info("wait for lock interrupted", e); - throw new DisworkFileSystemException(Type.INTERRUPTION, + throw new DisworkFileSystemException( "interrupted while trying to acquire lock", e); } } @@ -323,11 +320,10 @@ String newTarget = EntryUtil.resolveLink(parent, linkTarget); createDirectory(newTarget, dirName); } else if (EntryUtil.isFile(entryParent)) { - throw new DisworkFileSystemException(Type.NOT_DIRECTORY, parent); + throw new IllegalArgumentException(parent + " is not a directory"); } else { log.warn("strange entry" + entryParent); - throw new DisworkFileSystemException(Type.CORRUPTED_DATA, - "strange entry" + entryParent); + throw new DisworkFileSystemException("strange entry" + entryParent); } } @@ -340,6 +336,9 @@ */ public void createSymbolicLink(String path, String target) throws DisworkFileSystemException { + if (exists(path)) { + throw new DisworkAlreadyExistsException(path); + } checkPathSyntax(path); String parent = EntryUtil.getParentFromPath(path); String name = EntryUtil.getNameFromPath(path); @@ -367,8 +366,7 @@ String entryParent = walk(parent); if (entryParent == null) { - throw new DisworkFileSystemException(Type.NO_SUCH_DIRECTORY, - parent); + throw new IllegalArgumentException(parent + " doesn't exists"); } if (EntryUtil.isDirectory(entryParent)) { @@ -380,7 +378,7 @@ String findResult = EntryUtil.findEntryInDirectory (content, name); if (findResult != null) { - throw new DisworkFileSystemException(Type.ALREADY_EXISTS, + throw new DisworkFileSystemException( parent + " already contains an element named " + name); } @@ -406,7 +404,7 @@ Thread.sleep(LOCK_WAIT); } catch (InterruptedException e) { log.info("wait for lock interrupted", e); - throw new DisworkFileSystemException(Type.INTERRUPTION, + throw new DisworkFileSystemException( "interrupted while trying to acquire lock", e); } } @@ -424,16 +422,15 @@ String newTarget = EntryUtil.resolveLink(parent, linkTarget); createSymbolicLink(newTarget, name, target); } else if (EntryUtil.isFile(entryParent)) { - throw new DisworkFileSystemException(Type.NOT_DIRECTORY, parent); + throw new IllegalArgumentException(parent + " is not a directory"); } else { log.warn("strange entry" + entryParent); - throw new DisworkFileSystemException(Type.CORRUPTED_DATA, + throw new DisworkFileSystemException( "strange entry" + entryParent); } - - } else { - throw new DisworkFileSystemException(Type.INVALID_TARGET, target); + throw new IllegalArgumentException(target + " is not a valid " + + "target (do not exists)"); } } @@ -446,7 +443,7 @@ public void delete(String path) throws DisworkFileSystemException { checkPathSyntax(path); if (!exists(path)) { - throw new DisworkFileSystemException(Type.NO_SUCH_ENTITY, path); + throw new DisworkFileSystemException(path + " doesn't not exists"); } String parent = EntryUtil.getParentFromPath(path); String name = EntryUtil.getNameFromPath(path); @@ -478,7 +475,7 @@ if (!innerDirectoryContent.equals( EntryUtil.EMPTY_DIRECTORY_CONTENT)) { // directory is not empty - throw new DisworkFileSystemException(Type.DIRECTORY_NOT_EMPTY, + throw new IllegalArgumentException( "trying to remove a non-empty directory"); } @@ -491,7 +488,7 @@ storage.removeLink(idToRemove); } else { log.warn("strange entry" + entryParent); - throw new DisworkFileSystemException(Type.CORRUPTED_DATA, + throw new DisworkFileSystemException( "strange entry" + entryParent); } @@ -513,7 +510,7 @@ Thread.sleep(LOCK_WAIT); } catch (InterruptedException e) { log.info("wait for lock interrupted", e); - throw new DisworkFileSystemException(Type.INTERRUPTION, + throw new DisworkFileSystemException( "interrupted while trying to acquire lock", e); } } @@ -531,11 +528,10 @@ String newTarget = EntryUtil.resolveLink(parent, linkTarget); delete(newTarget, name); } else if (EntryUtil.isFile(entryParent)) { - throw new DisworkFileSystemException(Type.NOT_DIRECTORY, parent); + throw new IllegalArgumentException(parent + " is not a directory"); } else { log.warn("strange entry" + entryParent); - throw new DisworkFileSystemException(Type.CORRUPTED_DATA, - "strange entry" + entryParent); + throw new DisworkFileSystemException("strange entry" + entryParent); } } @@ -552,7 +548,7 @@ List<String> result = null; if (entry == null) { - throw new DisworkFileSystemException(Type.NO_SUCH_DIRECTORY, path); + throw new IllegalArgumentException(path + " directory doesn't exists"); } else { // path may be a link, if it's the case, // entry become the actual directory @@ -574,12 +570,10 @@ } } } else if (EntryUtil.isFile(entry)) { - throw new DisworkFileSystemException(Type.NOT_DIRECTORY, path + - " is not a directory but a file"); + throw new IllegalArgumentException(path + " is not a directory but a file"); } else { log.warn("strange entry" + entry); - throw new DisworkFileSystemException(Type.CORRUPTED_DATA, - "strange entry" + entry); + throw new DisworkFileSystemException("strange entry" + entry); } } @@ -600,8 +594,7 @@ checkPathSyntax(destination); if (exists(destination)) { - throw new DisworkFileSystemException(Type.ALREADY_EXISTS, - destination + " already exists"); + throw new DisworkAlreadyExistsException(destination + " already exists"); } String pathParent = EntryUtil.getParentFromPath(path); @@ -620,16 +613,14 @@ String entryParent = walk(pathParent); if (entryParent == null) { - throw new DisworkFileSystemException(Type.NO_SUCH_DIRECTORY, - pathParent); + throw new IllegalArgumentException(pathParent + " doesn't exists"); } if (EntryUtil.isDirectory(entryParent)) { String destinationParentEntry = walk(destinationParent); if (destinationParentEntry == null) { - throw new DisworkFileSystemException(Type.NO_SUCH_DIRECTORY, - destinationParentEntry); + throw new IllegalArgumentException(destinationParent + " doesn't exists"); } if (EntryUtil.isDirectory(destinationParentEntry)) { @@ -641,8 +632,7 @@ String oldEntry = EntryUtil.findEntryInDirectory(parentContent, pathName); if (oldEntry == null) { - throw new DisworkFileSystemException(Type.NO_SUCH_ENTITY, - "no element " + pathName + " in " + pathParent); + throw new IllegalArgumentException("no element " + pathName + " in " + pathParent); } String parentId = EntryUtil.getIdFromEntry(entryParent); @@ -676,7 +666,7 @@ Thread.sleep(LOCK_WAIT); } catch (InterruptedException e) { log.info("wait for lock interrupted", e); - throw new DisworkFileSystemException(Type.INTERRUPTION, + throw new DisworkFileSystemException( "interrupted while trying to acquire lock", e); } } @@ -694,11 +684,11 @@ String newTarget = EntryUtil.resolveLink(destinationParent, linkTarget); move(newTarget, pathName, destinationParent, destinationName); } else if (EntryUtil.isFile(destinationParentEntry)) { - throw new DisworkFileSystemException(Type.NOT_DIRECTORY, destinationParent); + throw new IllegalArgumentException(destinationParent + " is not a directory"); } else { log.warn("strange entry" + destinationParentEntry); - throw new DisworkFileSystemException(Type.CORRUPTED_DATA, - "strange entry" + destinationParentEntry); + throw new DisworkFileSystemException("strange entry" + + destinationParentEntry); } } else if (EntryUtil.isLink(entryParent)) { @@ -707,11 +697,10 @@ String newTarget = EntryUtil.resolveLink(pathParent, linkTarget); move(pathParent, pathName, newTarget, destinationName); } else if (EntryUtil.isFile(entryParent)) { - throw new DisworkFileSystemException(Type.NOT_DIRECTORY, pathParent); + throw new IllegalArgumentException(pathParent + " is not a directory"); } else { log.warn("strange entry" + entryParent); - throw new DisworkFileSystemException(Type.CORRUPTED_DATA, - "strange entry" + entryParent); + throw new DisworkFileSystemException("strange entry" + entryParent); } } @@ -720,7 +709,7 @@ checkPathSyntax(path); String entry = walk(path); if (entry == null) { - throw new DisworkFileSystemException(Type.NO_SUCH_ENTITY, path); + throw new IllegalArgumentException(path + " doesn't not exists"); } return EntryUtil.isLink(entry); } @@ -729,7 +718,7 @@ checkPathSyntax(path); String entry = walk(path); if (entry == null) { - throw new DisworkFileSystemException(Type.NO_SUCH_FILE, path); + throw new IllegalArgumentException(path + " doesn't not exists"); } return EntryUtil.isFile(entry); } @@ -738,7 +727,7 @@ checkPathSyntax(path); String entry = walk(path); if (entry == null) { - throw new DisworkFileSystemException(Type.NO_SUCH_FILE, path); + throw new IllegalArgumentException(path + " doesn't not exists"); } return EntryUtil.isDirectory(entry); } Modified: trunk/diswork-fs/src/main/java/org/nuiton/diswork/fs/DisworkFileSystemException.java =================================================================== --- trunk/diswork-fs/src/main/java/org/nuiton/diswork/fs/DisworkFileSystemException.java 2010-07-28 12:22:28 UTC (rev 114) +++ trunk/diswork-fs/src/main/java/org/nuiton/diswork/fs/DisworkFileSystemException.java 2010-07-28 12:24:33 UTC (rev 115) @@ -35,60 +35,17 @@ private static final long serialVersionUID = 1L; - public static enum Type { - /** Something with this path already exists */ - ALREADY_EXISTS, - /** Error while writing because another node is writing at this place */ - CONCURRENT_MODIFICATION, - /** The directory has a content */ - DIRECTORY_NOT_EMPTY, - /** directory doesn't exists */ - NO_SUCH_DIRECTORY, - /** file doesn't exists */ - NO_SUCH_FILE, - /** nothing at a given path */ - NO_SUCH_ENTITY, - /** The path leads to something that exists but is not a directory */ - NOT_DIRECTORY, - /** The path leads to something that exists but is not a file */ - NOT_FILE, - /** The connection to the DHT failed - * this is due to a network failure or a bad configuration - */ - BOOTSTRAP_FAILURE, - /** an IO errors at low-level network occured */ - NETWORK_FAILURE, - /** a source data on the local OS is not readable */ - READ_LOCAL_DATA_FAILURE, - /** error while reading data in the map */ - READ_MAP_DATA_FAILURE, - /** a process was interrupted */ - INTERRUPTION, - /** if map contains corrupted data */ - CORRUPTED_DATA, - /** the symlink point to a target that is not valid */ - INVALID_TARGET - } - - protected Type type; - public DisworkFileSystemException(Type type, String message, - Throwable cause) { - super("[" + type + "]" + message, cause); - this.type = type; + public DisworkFileSystemException(String message, Throwable cause) { + super(message, cause); } - public DisworkFileSystemException(Type type, String message) { - super("[" + type + "]" + message); - this.type = type; + public DisworkFileSystemException(String message) { + super(message); } - public DisworkFileSystemException(Type type, Throwable cause) { - this(type, "", cause); + public DisworkFileSystemException(Throwable cause) { + super(cause); } - - public Type getType() { - return type; - } } Modified: trunk/diswork-fs/src/main/java/org/nuiton/diswork/fs/storage/KademliaDisworkMap.java =================================================================== --- trunk/diswork-fs/src/main/java/org/nuiton/diswork/fs/storage/KademliaDisworkMap.java 2010-07-28 12:22:28 UTC (rev 114) +++ trunk/diswork-fs/src/main/java/org/nuiton/diswork/fs/storage/KademliaDisworkMap.java 2010-07-28 12:24:33 UTC (rev 115) @@ -39,7 +39,6 @@ import org.apache.commons.logging.LogFactory; import org.nuiton.diswork.fs.DisworkFileSystemConfig; import org.nuiton.diswork.fs.DisworkFileSystemException; -import org.nuiton.diswork.fs.DisworkFileSystemException.Type; import org.planx.xmlstore.routing.Identifier; import org.planx.xmlstore.routing.Kademlia; import org.planx.xmlstore.routing.RoutingException; @@ -66,8 +65,8 @@ kad.connect(bootstrap); } catch (RoutingException e) { log.error("bootstrap node is unreachable", e); - throw new DisworkFileSystemException(Type.BOOTSTRAP_FAILURE, - "bootstrap node is unreachable", e); + throw new DisworkFileSystemException("bootstrap failure : " + + "bootstrap node is unreachable", e); } } @@ -76,8 +75,7 @@ //Identifier.IDSIZE = 1024; log.info("using " + Identifier.IDSIZE + " bytes for identifiers"); } catch (IOException e) { - throw new DisworkFileSystemException(Type.NETWORK_FAILURE, - "failure while bootstraping", e); + throw new DisworkFileSystemException("failure while bootstraping", e); } } Modified: trunk/diswork-fs/src/main/java/org/nuiton/diswork/fs/storage/PastryDisworkMap.java =================================================================== --- trunk/diswork-fs/src/main/java/org/nuiton/diswork/fs/storage/PastryDisworkMap.java 2010-07-28 12:22:28 UTC (rev 114) +++ trunk/diswork-fs/src/main/java/org/nuiton/diswork/fs/storage/PastryDisworkMap.java 2010-07-28 12:24:33 UTC (rev 115) @@ -38,7 +38,6 @@ import org.apache.commons.logging.LogFactory; import org.nuiton.diswork.fs.DisworkFileSystemConfig; import org.nuiton.diswork.fs.DisworkFileSystemException; -import org.nuiton.diswork.fs.DisworkFileSystemException.Type; import rice.Continuation; import rice.environment.Environment; @@ -219,7 +218,8 @@ "" ); } catch (IOException e) { - throw new DisworkFileSystemException(Type.NETWORK_FAILURE, e); + throw new DisworkFileSystemException("network failure while" + + " bootstraping", e); } } Modified: trunk/diswork-fs/src/main/java/org/nuiton/diswork/fs/storage/Storage.java =================================================================== --- trunk/diswork-fs/src/main/java/org/nuiton/diswork/fs/storage/Storage.java 2010-07-28 12:22:28 UTC (rev 114) +++ trunk/diswork-fs/src/main/java/org/nuiton/diswork/fs/storage/Storage.java 2010-07-28 12:24:33 UTC (rev 115) @@ -36,7 +36,6 @@ import org.apache.commons.logging.LogFactory; import org.nuiton.diswork.fs.DisworkFileSystemConfig; import org.nuiton.diswork.fs.DisworkFileSystemException; -import org.nuiton.diswork.fs.DisworkFileSystemException.Type; /** * This class is the middle layer between the File System operations and @@ -232,7 +231,7 @@ log.debug("getDirectory(\"" + id + "\") returns \n" + content); return content; } catch (IOException e) { - throw new DisworkFileSystemException(Type.READ_MAP_DATA_FAILURE, e); + throw new DisworkFileSystemException(e); } } @@ -261,7 +260,7 @@ + " bytes)"); put(id, content); } catch (IOException e) { - throw new DisworkFileSystemException(Type.READ_LOCAL_DATA_FAILURE, e); + throw new DisworkFileSystemException(e); } } @@ -368,12 +367,12 @@ unLock(key); } catch (IOException e) { throw new DisworkFileSystemException - (Type.READ_LOCAL_DATA_FAILURE, "can't read value", e); + ("can't read value", e); } } else { - throw new DisworkFileSystemException(Type.CONCURRENT_MODIFICATION, - "key " + key + " is locked"); + throw new DisworkFileSystemException("key " + key + " is locked" + + " another node way being writing it"); } } @@ -407,8 +406,7 @@ map.close(); } catch (IOException e) { log.error("error while closing map", e); - throw new DisworkFileSystemException(Type.NETWORK_FAILURE, - "unable to close the map", e); + throw new DisworkFileSystemException("unable to close the map", e); } } Modified: trunk/diswork-fs/src/test/java/org/nuiton/diswork/fs/AbstractDisworkFileSystemTest.java =================================================================== --- trunk/diswork-fs/src/test/java/org/nuiton/diswork/fs/AbstractDisworkFileSystemTest.java 2010-07-28 12:22:28 UTC (rev 114) +++ trunk/diswork-fs/src/test/java/org/nuiton/diswork/fs/AbstractDisworkFileSystemTest.java 2010-07-28 12:24:33 UTC (rev 115) @@ -44,7 +44,6 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; -import org.nuiton.diswork.fs.DisworkFileSystemException.Type; import org.nuiton.util.FileUtil; @@ -231,8 +230,8 @@ source = new FileInputStream(randomFilePath); fileSystem.write("/my_folder/my_file", source); fail(); - } catch (DisworkFileSystemException e ){ - assertEquals(Type.NO_SUCH_DIRECTORY, e.getType()); + } catch (IllegalArgumentException e ){ + assertTrue(true); } finally { IOUtils.closeQuietly(source); } @@ -339,8 +338,8 @@ try { fileSystem.createSymbolicLink("/my_link", "/wrong_target_path"); fail(); - } catch (DisworkFileSystemException e) { - assertEquals(Type.INVALID_TARGET, e.getType()); + } catch (IllegalArgumentException e) { + assertTrue(true); } } @@ -387,8 +386,8 @@ try { fileSystem.delete("/my_folder"); fail(); - } catch (DisworkFileSystemException e) { - assertEquals(Type.DIRECTORY_NOT_EMPTY, e.getType()); + } catch (IllegalArgumentException e) { + assertTrue(true); } } @@ -516,8 +515,8 @@ fileSystem.createDirectory("/dir2"); try { fileSystem.move("/dir", "/dir2"); - } catch (DisworkFileSystemException e) { - assertEquals(Type.ALREADY_EXISTS, e.getType()); + } catch (IllegalArgumentException e) { + assertTrue(true); } } Modified: trunk/diswork-fs/src/test/java/org/nuiton/diswork/fs/storage/KademliaDisworkMapTest.java =================================================================== --- trunk/diswork-fs/src/test/java/org/nuiton/diswork/fs/storage/KademliaDisworkMapTest.java 2010-07-28 12:22:28 UTC (rev 114) +++ trunk/diswork-fs/src/test/java/org/nuiton/diswork/fs/storage/KademliaDisworkMapTest.java 2010-07-28 12:24:33 UTC (rev 115) @@ -26,6 +26,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import java.util.ArrayList; @@ -37,7 +38,6 @@ import org.junit.Test; import org.nuiton.diswork.fs.DisworkFileSystemConfig; import org.nuiton.diswork.fs.DisworkFileSystemException; -import org.nuiton.diswork.fs.DisworkFileSystemException.Type; import org.planx.xmlstore.routing.Identifier; public class KademliaDisworkMapTest extends AbstractDisworkMapTest { @@ -104,7 +104,7 @@ new KademliaDisworkMap(config1); fail(); } catch (DisworkFileSystemException e) { - assertEquals(Type.BOOTSTRAP_FAILURE, e.getType()); + assertTrue(true); } } }
participants (1)
-
bleny@users.nuiton.org