/** * when only fake uris are provided to mountAny, verify that an exception is received * * @throws Exception */ @Test(expected = FileSystemException.class) public void testMountAnyKo() throws Exception { logger.info("*************** testMountAnyKo"); ArrayList<String> urlsToMount = new ArrayList<String>(fakeFileUrls); urlsToMount.addAll(fakeUrls); ConcurrentHashMap<String, FileObject> fileSystems = new ConcurrentHashMap<String, FileObject>(); VFSMountManagerHelper.mountAny(urlsToMount, fileSystems); }
/** * - Insert a valid file vfs root and a valid proactive vfs root in the list of fake uris - * verifies that mountAny returns the file system corresponding to the valid uri - do that for all * valid uris of the file system server * * @throws Exception */ @Test public void testMountAnyOk() throws Exception { logger.info("*************** testMountAnyOk"); String[] validUris = server.getVFSRootURLs(); for (String validUrl : validUris) { ConcurrentHashMap<String, FileObject> fileSystems = new ConcurrentHashMap<String, FileObject>(); ArrayList<String> uriToMount = new ArrayList<String>(fakeFileUrls); uriToMount.add(spacesDir.toURI().toString()); // adds a valid file uri uriToMount.addAll(fakeUrls); uriToMount.add((int) Math.floor(Math.random() * uriToMount.size()), validUrl); VFSMountManagerHelper.mountAny(uriToMount, fileSystems); logger.info("Content of map : " + fileSystems.toString()); Assert.assertTrue("map contains valid Url", fileSystems.containsKey(validUrl)); } }