use of com.sequenceiq.cloudbreak.workspace.model.Workspace in project cloudbreak by hortonworks.
the class ServiceEndpointCollectorTest method clusterkWithOrchestrator.
private Cluster clusterkWithOrchestrator(String orchestratorType) {
Cluster cluster = new Cluster();
Stack stack = new Stack();
Orchestrator orchestrator = new Orchestrator();
orchestrator.setType(orchestratorType);
Gateway gateway = new Gateway();
gateway.setPath(GATEWAY_PATH);
stack.setOrchestrator(orchestrator);
cluster.setStack(stack);
cluster.setGateway(gateway);
Blueprint blueprint = new Blueprint();
Workspace workspace = new Workspace();
Tenant tenant = new Tenant();
tenant.setName("tenant");
workspace.setTenant(tenant);
cluster.setWorkspace(workspace);
try {
String testBlueprint = FileReaderUtils.readFileFromClasspath("/test/defaults/blueprints/hdp26-data-science-spark2-text.bp");
blueprint.setBlueprintText(testBlueprint);
} catch (IOException e) {
throw new RuntimeException(e);
}
cluster.setBlueprint(blueprint);
return cluster;
}
use of com.sequenceiq.cloudbreak.workspace.model.Workspace in project cloudbreak by hortonworks.
the class ClusterDecoratorTest method testDecorateIfMethodCalledThenSharedServiceConfigProviderShouldBeCalledOnceToConfigureTheCluster.
@Test
void testDecorateIfMethodCalledThenSharedServiceConfigProviderShouldBeCalledOnceToConfigureTheCluster() {
Cluster expectedClusterInstance = new Cluster();
Blueprint blueprint = getBlueprint();
when(sharedServiceConfigProvider.configureCluster(any(Cluster.class), any(User.class), any(Workspace.class))).thenReturn(expectedClusterInstance);
when(embeddedDatabaseService.isEmbeddedDatabaseOnAttachedDiskEnabled(stack, expectedClusterInstance)).thenReturn(false);
Cluster result = underTest.decorate(expectedClusterInstance, createClusterV4Request(), blueprint, user, new Workspace(), stack);
assertEquals(expectedClusterInstance, result);
verify(sharedServiceConfigProvider, times(1)).configureCluster(any(Cluster.class), any(User.class), any(Workspace.class));
}
use of com.sequenceiq.cloudbreak.workspace.model.Workspace in project cloudbreak by hortonworks.
the class ScheduledLifetimeCheckerTest method testValidateWhenClusterNotExceededByTTLMoreThanRunningTime.
@Test
public void testValidateWhenClusterNotExceededByTTLMoreThanRunningTime() {
StackTtlViewImpl stack = new StackTtlViewImpl();
stack.setId(STACK_ID);
Workspace workspace = new Workspace();
Tenant tenant = new Tenant();
tenant.setName("tenant");
workspace.setTenant(tenant);
workspace.setName("workspace");
stack.setWorkspace(workspace);
StackStatus stackStatus = new StackStatus();
stackStatus.setStatus(Status.AVAILABLE);
stack.setStatus(stackStatus);
when(stackService.getAllAlive()).thenReturn(Collections.singletonList(stack));
underTest.validate();
verify(flowManager, times(0)).triggerTermination(stack.getId());
}
use of com.sequenceiq.cloudbreak.workspace.model.Workspace in project cloudbreak by hortonworks.
the class ImageServiceTest method getImageCatalog.
private ImageCatalog getImageCatalog() {
ImageCatalog imageCatalog = new ImageCatalog();
imageCatalog.setImageCatalogUrl(CUSTOM_IMAGE_CATALOG_URL);
imageCatalog.setName("default");
Workspace ws = new Workspace();
ws.setId(ORG_ID);
imageCatalog.setWorkspace(ws);
imageCatalog.setCreator("someone");
imageCatalog.setResourceCrn("someCrn");
return imageCatalog;
}
use of com.sequenceiq.cloudbreak.workspace.model.Workspace in project cloudbreak by hortonworks.
the class StackOperations method post.
public StackV4Response post(Long workspaceId, CloudbreakUser cloudbreakUser, @Valid StackV4Request request, boolean distroxRequest) {
LOGGER.info("Post for Stack in workspace {}.", workspaceId);
User user = userService.getOrCreate(cloudbreakUser);
LOGGER.info("Cloudbreak user for the requested stack is {}.", cloudbreakUser);
Workspace workspace = workspaceService.get(workspaceId, user);
StackV4Response stackV4Response = stackCommonService.createInWorkspace(request, user, workspace, distroxRequest);
LOGGER.info("Adding environment name and credential to the response.");
environmentServiceDecorator.prepareEnvironmentAndCredentialName(stackV4Response);
LOGGER.info("Adding SDX CRN and name to the response.");
sdxServiceDecorator.prepareSdxAttributes(stackV4Response);
return stackV4Response;
}
Aggregations