NfsSecondaryStorageResource extends ServerResourceBase implements SecondaryStorageResource { protected void mount(String localRootPath, String remoteDevice, URI uri) { s_logger.debug("mount " + uri.toString() + " on " + localRootPath); ensureLocalRootPathExists(localRootPath, uri); if (mountExists(localRootPath, uri)) { return; } attemptMount(localRootPath, remoteDevice, uri); checkForSnapshotsDir(localRootPath); checkForVolumesDir(localRootPath); }  int getTimeout(); void setTimeout(int timeout); void setParentPath(String path); String getMountingRoot(); @Override void disconnected(); void setInSystemVM(boolean inSystemVM); @Override Answer executeRequest(Command cmd); Answer execute(DeleteSnapshotsDirCommand cmd); String allowOutgoingOnPrivate(String destCidr); @Override synchronized String getRootDir(String secUrl); @Override Type getType(); @Override PingCommand getCurrentStatus(final long id); @Override boolean configure(String name, Map<String, Object> params); @Override boolean start(); @Override boolean stop(); @Override StartupCommand[] initialize(); @Override void setName(String name); @Override void setConfigParams(Map<String, Object> params); @Override Map<String, Object> getConfigParams(); @Override int getRunLevel(); @Override void setRunLevel(int level); @Override void fillNetworkInformation(final StartupCommand cmd); UploadEntity createUploadEntity(String uuid, String metadata, long contentLength); String postUpload(String uuid, String filename); void updateStateMapWithError(String uuid,String errorMessage); void validatePostUploadRequest(String signature, String metadata, String timeout, String hostname,long contentLength, String uuid);  }
@Test public void testMount() throws Exception { String sampleUriStr = "cifs: URI sampleUri = new URI(sampleUriStr); s_logger.info("Check HostIp parsing"); String hostIpStr = resource.getUriHostIp(sampleUri); Assert.assertEquals("Expected host IP " + sampleUri.getHost() + " and actual host IP " + hostIpStr + " differ.", sampleUri.getHost(), hostIpStr); s_logger.info("Check option parsing"); String expected = "user=administrator,password=1pass@word1,foo=bar,"; String actualOpts = resource.parseCifsMountOptions(sampleUri); Assert.assertEquals("Options should be " + expected + " and not " + actualOpts, expected, actualOpts); final Map<String, Object> params = PropertiesUtil.toMap(loadProperties()); String sampleMount = (String)params.get("testCifsMount"); if (!sampleMount.isEmpty()) { s_logger.info("functional test, mount " + sampleMount); URI realMntUri = new URI(sampleMount); String mntSubDir = resource.mountUri(realMntUri); s_logger.info("functional test, umount " + mntSubDir); resource.umount(resource.getMountingRoot() + mntSubDir, realMntUri); } else { s_logger.info("no entry for testCifsMount in " + "./conf/agent.properties - skip functional test"); } }