use of bio.terra.cli.serialization.userfacing.UFWorkspace in project terra-cli by DataBiosphere.
the class Describe method execute.
/**
* Describe the current workspace.
*/
@Override
protected void execute() {
workspaceOption.overrideIfSpecified();
formatOption.printReturnValue(new UFWorkspace(Context.requireWorkspace()), this::printText);
}
use of bio.terra.cli.serialization.userfacing.UFWorkspace in project terra-cli by DataBiosphere.
the class Update method execute.
/**
* Update the mutable properties of an existing workspace.
*/
@Override
protected void execute() {
workspaceOption.overrideIfSpecified();
Workspace updatedWorkspace = Context.requireWorkspace().update(argGroup.displayName, argGroup.description);
formatOption.printReturnValue(new UFWorkspace(updatedWorkspace), this::printText);
}
use of bio.terra.cli.serialization.userfacing.UFWorkspace in project terra-cli by DataBiosphere.
the class WorkspaceOverride method matchingCurrentWorkspace.
@Test
@DisplayName("workspace commands ignore workspace override when it matches current workspace")
void matchingCurrentWorkspace() throws IOException {
workspaceCreator.login();
// `terra workspace create`
UFWorkspace workspace3 = TestCommand.runAndParseCommandExpectSuccess(UFWorkspace.class, "workspace", "create");
// `terra workspace set --id=$id3`
TestCommand.runCommandExpectSuccess("workspace", "set", "--id=" + workspace3.id);
// `terra workspace update --name=$newName --description=$newDescription --workspace=$id3`
String newName = "workspace3_name_NEW";
String newDescription = "workspace3 description NEW";
TestCommand.runCommandExpectSuccess("workspace", "update", "--name=" + newName, "--description=" + newDescription, "--workspace=" + workspace3.id);
// Check that current workspace status is updated, despite the --workspace flag.
// `terra status`
UFStatus status = TestCommand.runAndParseCommandExpectSuccess(UFStatus.class, "status");
assertEquals(newName, status.workspace.name);
assertEquals(newDescription, status.workspace.description);
// `terra workspace delete --workspace=$id3`
TestCommand.runCommandExpectSuccess("workspace", "delete", "--workspace=" + workspace3.id, "--quiet");
// Confirm current workspace status was cleared, despite the --workspace flag.
UFStatus clearedStatus = TestCommand.runAndParseCommandExpectSuccess(UFStatus.class, "status");
assertNull(clearedStatus.workspace);
}
use of bio.terra.cli.serialization.userfacing.UFWorkspace in project terra-cli by DataBiosphere.
the class WorkspaceOverride method workspace.
@Test
@DisplayName("workspace commands respect workspace override")
void workspace() throws IOException {
workspaceCreator.login();
// `terra workspace create`
UFWorkspace workspace3 = TestCommand.runAndParseCommandExpectSuccess(UFWorkspace.class, "workspace", "create");
// `terra workspace set --id=$id1`
TestCommand.runCommandExpectSuccess("workspace", "set", "--id=" + workspace1.id);
// `terra workspace update --name=$newName --description=$newDescription --workspace=$id3`
String newName = "workspace3_name_NEW";
String newDescription = "workspace3 description NEW";
TestCommand.runCommandExpectSuccess("workspace", "update", "--name=" + newName, "--description=" + newDescription, "--workspace=" + workspace3.id);
// check that the workspace 3 description has been updated, and the workspace 1 has not
// `terra workspace describe --workspace=$id3`
UFWorkspace workspaceDescribe = TestCommand.runAndParseCommandExpectSuccess(UFWorkspace.class, "workspace", "describe", "--workspace=" + workspace3.id);
assertEquals(newName, workspaceDescribe.name, "workspace 3 name matches update");
assertEquals(newDescription, workspaceDescribe.description, "workspace 3 description matches update");
// `terra workspace describe`
workspaceDescribe = TestCommand.runAndParseCommandExpectSuccess(UFWorkspace.class, "workspace", "describe");
assertEquals(workspace1.name, workspaceDescribe.name, "workspace 1 name matches create");
assertEquals(workspace1.description, workspaceDescribe.description, "workspace 1 description matches create");
// check the workspace 3 has been deleted, and workspace 1 has not
// `terra workspace delete --workspace=$id3`
TestCommand.runCommandExpectSuccess("workspace", "delete", "--workspace=" + workspace3.id, "--quiet");
// `terra workspace list`
List<UFWorkspaceLight> matchingWorkspaces = listWorkspacesWithId(workspace3.id);
assertEquals(0, matchingWorkspaces.size(), "deleted workspace 3 is not included in list");
// `terra workspace list`
matchingWorkspaces = listWorkspacesWithId(workspace1.id);
assertEquals(1, matchingWorkspaces.size(), "workspace 1 is still included in list");
}
use of bio.terra.cli.serialization.userfacing.UFWorkspace in project terra-cli by DataBiosphere.
the class WorkspaceSetDeferLogin method setupOnce.
@BeforeAll
protected void setupOnce() throws Exception {
super.setupOnce();
// `terra workspace create --format=json`
UFWorkspace createWorkspace = TestCommand.runAndParseCommandExpectSuccess(UFWorkspace.class, "workspace", "create");
sharedWorkspaceId = createWorkspace.id;
workspaceSharee = TestUser.chooseTestUserWhoIsNot(workspaceCreator);
// `terra workspace add-user --email=$sharee --role=READER`
TestCommand.runCommandExpectSuccess("workspace", "add-user", "--email=" + workspaceSharee.email, "--role=READER");
}
Aggregations