use of com.blackducksoftware.bdio2.model.Project in project terra-cloud-resource-lib by DataBiosphere.
the class ServiceUsageCowTest method listAndEnableServices.
@Test
public void listAndEnableServices() throws Exception {
ServiceUsageCow serviceUsage = defaultServiceUsage();
Project project = ProjectUtils.executeCreateProject();
String projectName = projectIdToName(project.getProjectId());
String storageServiceName = serviceName(project, STORAGE_SERVICE_ID);
ListServicesResponse response1 = serviceUsage.services().list(projectName).setFilter(ENABLED_FILTER).execute();
assertNull(response1.getServices());
Operation operation = serviceUsage.services().batchEnable(projectName, new BatchEnableServicesRequest().setServiceIds(ImmutableList.of(STORAGE_SERVICE_ID))).execute();
OperationTestUtils.pollAndAssertSuccess(serviceUsage.operations().operationCow(operation), Duration.ofSeconds(5), Duration.ofSeconds(60));
ListServicesResponse response2 = serviceUsage.services().list(projectName).setFilter(ENABLED_FILTER).execute();
List<String> services2 = response2.getServices().stream().map(Service::getName).collect(Collectors.toList());
assertThat(services2, Matchers.hasItem(storageServiceName));
}
use of com.blackducksoftware.bdio2.model.Project in project uPMT by coco35700.
the class NewProjectDialogController method createProject.
public void createProject() {
Project p = new Project(nomProjet.getText(), this.choixSchema.getValue());
p.getSchema().setName(nomProjet.getText());
main.setProjectInCreation(p);
// main.getProjects().add(p);
// main.setCurrentProject(p);
// p.save();
window.close();
launchingScreenWindow.close();
// in case the center was set to null because of automatic interview Creation
/*if (main.getRootLayout().getCenter() == null) {
main.launchMainView();
}*/
// main.launchMainView();
// main.refreshDataTreeView();
// main.needToSave();
}
use of com.blackducksoftware.bdio2.model.Project in project uPMT by coco35700.
the class NewProjectDialogController method initialize.
@Override
public void initialize(URL location, ResourceBundle resources) {
// TODO Auto-generated method stub
choixSchema.getItems().add(main.getDefaultSchema());
for (Project p : main.getProjects()) {
choixSchema.getItems().add(p.getSchema());
}
// change the text to make it pretty
choixSchema.setConverter(new StringConverter<Schema>() {
@Override
public String toString(Schema object) {
// TODO Auto-generated method stub
return object.getName();
}
@Override
public Schema fromString(String string) {
// TODO Auto-generated method stub
return new Schema(string);
}
});
choixSchema.setValue(main.getDefaultSchema());
}
use of com.blackducksoftware.bdio2.model.Project in project terra-workspace-manager by DataBiosphere.
the class DeleteGcpContextFlightTest method deleteContextDo.
@Test
@DisabledIfEnvironmentVariable(named = "TEST_ENV", matches = BUFFER_SERVICE_DISABLED_ENVS_REG_EX)
void deleteContextDo() throws Exception {
FlightMap createParameters = new FlightMap();
AuthenticatedUserRequest userRequest = userAccessUtils.defaultUserAuthRequest();
createParameters.put(WorkspaceFlightMapKeys.WORKSPACE_ID, workspaceUuid.toString());
createParameters.put(JobMapKeys.AUTH_USER_INFO.getKeyName(), userRequest);
// Create the google context.
FlightState flightState = StairwayTestUtils.blockUntilFlightCompletes(jobService.getStairway(), CreateGcpContextFlightV2.class, createParameters, CREATION_FLIGHT_TIMEOUT, null);
assertEquals(FlightStatus.SUCCESS, flightState.getFlightStatus());
String projectId = workspaceService.getAuthorizedGcpProject(workspaceUuid, userRequest).orElse(null);
assertNotNull(projectId);
// validate that required project does not throw and gives the same answer
String projectId2 = workspaceService.getAuthorizedRequiredGcpProject(workspaceUuid, userRequest);
assertEquals(projectId, projectId2);
Project project = crl.getCloudResourceManagerCow().projects().get(projectId).execute();
assertEquals("ACTIVE", project.getState());
// Delete the google context.
FlightMap deleteParameters = new FlightMap();
deleteParameters.put(WorkspaceFlightMapKeys.WORKSPACE_ID, workspaceUuid.toString());
// Force each step to be retried once to ensure proper behavior.
Map<String, StepStatus> doFailures = new HashMap<>();
doFailures.put(DeleteControlledSamResourcesStep.class.getName(), StepStatus.STEP_RESULT_FAILURE_RETRY);
doFailures.put(DeleteControlledDbResourcesStep.class.getName(), StepStatus.STEP_RESULT_FAILURE_RETRY);
doFailures.put(DeleteGcpProjectStep.class.getName(), StepStatus.STEP_RESULT_FAILURE_RETRY);
doFailures.put(DeleteGcpContextStep.class.getName(), StepStatus.STEP_RESULT_FAILURE_RETRY);
FlightDebugInfo debugInfo = FlightDebugInfo.newBuilder().doStepFailures(doFailures).build();
flightState = StairwayTestUtils.blockUntilFlightCompletes(jobService.getStairway(), DeleteGcpContextFlight.class, deleteParameters, DELETION_FLIGHT_TIMEOUT, debugInfo);
assertEquals(FlightStatus.SUCCESS, flightState.getFlightStatus());
assertTrue(testUtils.getAuthorizedGcpCloudContext(workspaceUuid, userRequest).isEmpty());
// make sure required really requires
assertThrows(CloudContextRequiredException.class, () -> workspaceService.getAuthorizedRequiredGcpProject(workspaceUuid, userRequest));
project = crl.getCloudResourceManagerCow().projects().get(projectId).execute();
assertEquals("DELETE_REQUESTED", project.getState());
}
use of com.blackducksoftware.bdio2.model.Project in project terra-cloud-resource-lib by DataBiosphere.
the class CloudBillingClientCowTest method getSetProjectBillingInfo.
@Test
public void getSetProjectBillingInfo() throws Exception {
Project project = ProjectUtils.executeCreateProject();
try (CloudBillingClientCow billingCow = defaultBillingCow()) {
ProjectBillingInfo initialBilling = billingCow.getProjectBillingInfo("projects/" + project.getProjectId());
assertEquals(project.getProjectId(), initialBilling.getProjectId());
assertEquals("", initialBilling.getBillingAccountName());
ProjectBillingInfo setBilling = ProjectBillingInfo.newBuilder().setBillingAccountName(BILLING_ACCOUNT_NAME).build();
ProjectBillingInfo updatedBilling = billingCow.updateProjectBillingInfo("projects/" + project.getProjectId(), setBilling);
assertEquals(project.getProjectId(), updatedBilling.getProjectId());
assertEquals(BILLING_ACCOUNT_NAME, updatedBilling.getBillingAccountName());
}
ProjectUtils.getManagerCow().projects().delete(project.getProjectId());
}
Aggregations