RemoteResourceManager { protected boolean isResourceUploadedAndUpToDate(Resource localResource, long localChecksum) throws SSHClientException, IOException { boolean fileExistsOnRemote = fileExistOnRemote(String.format("%s%s%s", remoteResourcesDir, remoteSeparator, localResource.getName())); if (fileExistsOnRemote) { String remoteCrcFile = getRemoteCrcFile(localResource); String output = execute(String.format("cat %s", remoteCrcFile)).trim(); long remoteCrc; try { remoteCrc = Long.parseLong(output); } catch(NumberFormatException ex) { return false; } return localChecksum == remoteCrc; } else { return false; } } RemoteResourceManager(SSHClient sshClient, String remoteResourcesDirPath, 
            String remoteResourcesDirName, String remoteSeparator);  RemoteResourceManager(SSHClient sshClient); void addResource(Resource resource); void removeResource(Resource resource); void uploadResources(); void deployResources(); void prepareResourceDirectory(); String getRemoteFile(Resource resource); static final String DEFAULT_REMOTE_RESOURCES_DIR_NAME; static final String DEFAULT_REMOTE_SEPARATOR; }
@Test public void testIsResourceUploadedAndUpToDate() throws Exception { boolean upToDate = resourceManager.isResourceUploadedAndUpToDate( dummyResource, DUMMY_RESOURCE_CHECKSUM); assertThat(upToDate, is(equalTo(false))); upToDate = resourceManager.isResourceUploadedAndUpToDate( uploadedUndeployedResource, DUMMY_RESOURCE_CHECKSUM); assertThat(upToDate, is(equalTo(true))); }