use of com.blackducksoftware.bdio2.model.Project in project uPMT by coco35700.
the class Main method start.
public void start(Stage primaryStage) throws IOException {
loadProperties();
initProjects();
createBasicSchema();
/*if(!projects.isEmpty()){
currentProject = projects.getFirst();
//System.out.println(currentProject.getSchemaProjet());
}
else {
currentProject = new Projet("projetTMP", new Schema("SchemaTemporaire"));
}*/
currentProject = new Project("--emptyProject--", new Schema("SchemaTemporaire"));
this.primaryStage = primaryStage;
this.primaryStage.setTitle(_langBundle.getString("main_title"));
// Launching layouts
initRootLayout();
showLaunchingScreen();
}
use of com.blackducksoftware.bdio2.model.Project in project uPMT by coco35700.
the class Main method initProjects.
/**
* Method used to load all the projects
*/
private void initProjects() {
this.projects = new LinkedList<Project>();
LoadDataProjects dc = LoadDataProjects.instance();
dc.setProjets(projects);
if (Utils.checkRecovery()) {
this.mainViewController.alertRecovery();
}
Utils.loadProjects(projects, this);
}
use of com.blackducksoftware.bdio2.model.Project in project uPMT by coco35700.
the class Utils method loadProjects.
public static void loadProjects(LinkedList<Project> projects, Main main) {
HashSet<String> projectNames = loadProjectsNames();
if (projectNames.isEmpty()) {
// For debug purposes
// System.out.println("No projects to load");
} else {
System.out.println("Loading projects");
for (String s : projectNames) {
if (s.contains(Project.FORMAT)) {
// projects.add(Projet.load(s));
Project p = Project.loadData(s);
if (p == null) {
Alert alert = new Alert(AlertType.CONFIRMATION);
// alert.setTitle("Error, version conflict");
alert.setTitle(main._langBundle.getString("error_version"));
// alert.setHeaderText("Your saves are in conflict with this new version.");
alert.setHeaderText(main._langBundle.getString("error_version_text_alarm"));
// alert.setContentText("Please contact us in the github repository.");
alert.setContentText(main._langBundle.getString("error_version_text_contact"));
Optional<ButtonType> result = alert.showAndWait();
if (result.get() == ButtonType.OK) {
alert.close();
} else {
alert.close();
}
} else
projects.add(p);
}
}
}
}
use of com.blackducksoftware.bdio2.model.Project in project terra-workspace-manager by DataBiosphere.
the class WorkspaceServiceTest method deleteWorkspaceWithGoogleContext.
@Test
@DisabledIfEnvironmentVariable(named = "TEST_ENV", matches = BUFFER_SERVICE_DISABLED_ENVS_REG_EX)
void deleteWorkspaceWithGoogleContext() throws Exception {
Workspace request = defaultRequestBuilder(UUID.randomUUID()).spendProfileId(spendUtils.defaultSpendId()).workspaceStage(WorkspaceStage.MC_WORKSPACE).build();
workspaceService.createWorkspace(request, USER_REQUEST);
String jobId = UUID.randomUUID().toString();
workspaceService.createGcpCloudContext(request.getWorkspaceId(), jobId, USER_REQUEST, "/fake/value");
jobService.waitForJob(jobId);
assertNull(jobService.retrieveJobResult(jobId, Object.class, USER_REQUEST).getException());
Workspace workspace = workspaceService.getWorkspace(request.getWorkspaceId(), USER_REQUEST);
String projectId = workspaceService.getAuthorizedRequiredGcpProject(workspace.getWorkspaceId(), USER_REQUEST);
// Verify project exists by retrieving it.
crl.getCloudResourceManagerCow().projects().get(projectId).execute();
workspaceService.deleteWorkspace(request.getWorkspaceId(), USER_REQUEST);
// Check that project is now being deleted.
Project project = crl.getCloudResourceManagerCow().projects().get(projectId).execute();
assertEquals("DELETE_REQUESTED", project.getState());
}
use of com.blackducksoftware.bdio2.model.Project in project terra-workspace-manager by DataBiosphere.
the class CreateGcpContextFlightV2Test method successCreatesProjectAndContext.
@Test
@DisabledIfEnvironmentVariable(named = "TEST_ENV", matches = BUFFER_SERVICE_DISABLED_ENVS_REG_EX)
void successCreatesProjectAndContext() throws Exception {
UUID workspaceUuid = createWorkspace(spendUtils.defaultSpendId());
AuthenticatedUserRequest userRequest = userAccessUtils.defaultUserAuthRequest();
assertTrue(testUtils.getAuthorizedGcpCloudContext(workspaceUuid, userRequest).isEmpty());
// Retry steps once to validate idempotency.
Map<String, StepStatus> retrySteps = getStepNameToStepStatusMap();
FlightDebugInfo debugInfo = FlightDebugInfo.newBuilder().doStepFailures(retrySteps).build();
FlightState flightState = StairwayTestUtils.blockUntilFlightCompletes(jobService.getStairway(), CreateGcpContextFlightV2.class, createInputParameters(workspaceUuid, userRequest), STAIRWAY_FLIGHT_TIMEOUT, debugInfo);
assertEquals(FlightStatus.SUCCESS, flightState.getFlightStatus());
String projectId = flightState.getResultMap().get().get(WorkspaceFlightMapKeys.GCP_PROJECT_ID, String.class);
assertTrue(testUtils.getAuthorizedGcpCloudContext(workspaceUuid, userRequest).isPresent());
String contextProjectId = workspaceService.getAuthorizedRequiredGcpProject(workspaceUuid, userRequest);
assertEquals(projectId, contextProjectId);
// Verify that the policies were properly stored
Optional<GcpCloudContext> optionalCloudContext = testUtils.getAuthorizedGcpCloudContext(workspaceUuid, userRequest);
assertTrue(optionalCloudContext.isPresent(), "has cloud context");
GcpCloudContext cloudContext = optionalCloudContext.get();
assertTrue(cloudContext.getSamPolicyOwner().isPresent(), "has owner policy");
assertTrue(cloudContext.getSamPolicyWriter().isPresent(), "has writer policy");
assertTrue(cloudContext.getSamPolicyReader().isPresent(), "has reader policy");
assertTrue(cloudContext.getSamPolicyApplication().isPresent(), "has application policy");
Project project = crl.getCloudResourceManagerCow().projects().get(projectId).execute();
assertEquals(projectId, project.getProjectId());
assertEquals("billingAccounts/" + spendUtils.defaultBillingAccountId(), crl.getCloudBillingClientCow().getProjectBillingInfo("projects/" + projectId).getBillingAccountName());
assertRolesExist(project);
assertPolicyGroupsSynced(workspaceUuid, project);
}
Aggregations