Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5000 update rsal utils #5001

Merged
merged 4 commits into from
Aug 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ static String getLocalDataAccessDirectory(String localDataAccessParentDir, Datas
if (localDataAccessParentDir == null) {
localDataAccessParentDir = File.separator + "UNCONFIGURED ( " + SettingsServiceBean.Key.LocalDataAccessPath + " )";
}
boolean leafDirectoryOnly = false;
boolean leafDirectoryOnly = true;
return localDataAccessParentDir + File.separator + getDirectoryContainingTheData(dataset, leafDirectoryOnly);
}

Expand Down Expand Up @@ -64,9 +64,10 @@ public static String getDirectoryContainingTheData(Dataset dataset, boolean leaf
if (onlyOnPackagePerDatasetIsSupported) {
String leafDirectory = dataset.getIdentifier();
if (leafDirectoryOnly) {
return leafDirectory;
File f = new File( leafDirectory );
return f.getName();
} else {
// The "authority" is something like "10.5072/FK2".
// The "authority" is something like "FK2".
String relativePathToLeafDir = dataset.getAuthority();
return relativePathToLeafDir + File.separator + leafDirectory;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ public class RepositoryStorageAbstractionLayerUtilTest {
public void testGetRsalSites_3args() {
System.out.println("getRsalSites");
Dataset dataset = new Dataset();
dataset.setIdentifier("identifierPartOfPersistentID");
dataset.setAuthority("10.5072/FK2");
dataset.setIdentifier("FK2/identifierPartOfPersistentID");
dataset.setAuthority("10.5072");
List<StorageSite> storageLocations = new ArrayList<>();
StorageSite sbgrid = new StorageSite();
sbgrid.setHostname("dv.sbgrid.org");
Expand Down Expand Up @@ -51,17 +51,17 @@ public void testGetLocalDataAccessDirectory() {
System.out.println("getLocalDataAccessDirectory");
String localDataAccessParentDir = "/opt/data";
Dataset dataset = new Dataset();
dataset.setIdentifier("identifierPartOfPersistentID");
dataset.setAuthority("10.5072/FK2");
dataset.setIdentifier("FK2/identifierPartOfPersistentID");
dataset.setAuthority("10.5072");
String result = RepositoryStorageAbstractionLayerUtil.getLocalDataAccessDirectory(localDataAccessParentDir, dataset);
assertEquals("/opt/data/10.5072/FK2/identifierPartOfPersistentID", result);
assertEquals("/opt/data/identifierPartOfPersistentID", result);
}

@Test
public void testGetVerifyDataCommand() {
System.out.println("getVerifyDataCommand");
Dataset dataset = new Dataset();
dataset.setIdentifier("identifierPartOfPersistentID");
dataset.setIdentifier("FK2/identifierPartOfPersistentID");
String result = RepositoryStorageAbstractionLayerUtil.getVerifyDataCommand(dataset);
assertEquals("cd identifierPartOfPersistentID ; shasum -c files.sha", result);
}
Expand Down