Search in sources :

Example 16 with Project

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();
}
Also used : Project(model.Project) Schema(model.Schema)

Example 17 with Project

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);
}
Also used : Project(model.Project) LoadDataProjects(utils.LoadDataProjects)

Example 18 with Project

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);
            }
        }
    }
}
Also used : Project(model.Project) Alert(javafx.scene.control.Alert) ButtonType(javafx.scene.control.ButtonType)

Example 19 with Project

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());
}
Also used : Project(com.google.api.services.cloudresourcemanager.v3.model.Project) Workspace(bio.terra.workspace.service.workspace.model.Workspace) ApiClonedWorkspace(bio.terra.workspace.generated.model.ApiClonedWorkspace) Test(org.junit.jupiter.api.Test) BaseConnectedTest(bio.terra.workspace.common.BaseConnectedTest) DisabledIfEnvironmentVariable(org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable)

Example 20 with Project

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);
}
Also used : FlightState(bio.terra.stairway.FlightState) Project(com.google.api.services.cloudresourcemanager.v3.model.Project) FlightDebugInfo(bio.terra.stairway.FlightDebugInfo) AuthenticatedUserRequest(bio.terra.workspace.service.iam.AuthenticatedUserRequest) StepStatus(bio.terra.stairway.StepStatus) UUID(java.util.UUID) GcpCloudContext(bio.terra.workspace.service.workspace.model.GcpCloudContext) Test(org.junit.jupiter.api.Test) BaseConnectedTest(bio.terra.workspace.common.BaseConnectedTest) DisabledIfEnvironmentVariable(org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable)

Aggregations

Project (com.google.api.services.cloudresourcemanager.v3.model.Project)38 Test (org.junit.jupiter.api.Test)32 BaseIntegrationTest (bio.terra.buffer.common.BaseIntegrationTest)15 Pool (bio.terra.buffer.common.Pool)15 ResourceId (bio.terra.buffer.common.ResourceId)15 IntegrationUtils.preparePool (bio.terra.buffer.integration.IntegrationUtils.preparePool)15 FlightManager (bio.terra.buffer.service.resource.FlightManager)15 StepStatus (bio.terra.stairway.StepStatus)9 BaseConnectedTest (bio.terra.workspace.common.BaseConnectedTest)8 List (java.util.List)8 DisabledIfEnvironmentVariable (org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable)8 FlightDebugInfo (bio.terra.stairway.FlightDebugInfo)7 FlightState (bio.terra.stairway.FlightState)7 AuthenticatedUserRequest (bio.terra.workspace.service.iam.AuthenticatedUserRequest)7 IOException (java.io.IOException)7 ArrayList (java.util.ArrayList)7 Project (com.blackducksoftware.bdio2.model.Project)6 UUID (java.util.UUID)6 Resource (bio.terra.buffer.common.Resource)5 bio.terra.buffer.generated.model (bio.terra.buffer.generated.model)5