use of com.sequenceiq.cloudbreak.workspace.model.Workspace in project cloudbreak by hortonworks.
the class SecurityConfigServiceTest method setUp.
@Before
public void setUp() throws TransactionService.TransactionExecutionException {
when(transactionService.required(any(Supplier.class))).then(invocationOnMock -> ((Supplier) invocationOnMock.getArgument(0)).get());
stack = new Stack();
stack.setId(123L);
stack.setWorkspace(new Workspace());
}
use of com.sequenceiq.cloudbreak.workspace.model.Workspace in project cloudbreak by hortonworks.
the class RdsConfigServiceTest method setUp.
@Before
public void setUp() {
initMocks(this);
defaultWorkspace = new Workspace();
defaultWorkspace.setName("HortonWorkspace");
defaultWorkspace.setId(1L);
defaultWorkspace.setStatus(WorkspaceStatus.ACTIVE);
defaultWorkspace.setDescription("This is a real Horton defaultWorkspace!");
defaultWorkspace.setTenant(new Tenant());
testRdsConfig = new RDSConfig();
testRdsConfig.setId(1L);
testRdsConfig.setName(TEST_RDS_CONFIG_NAME);
doNothing().when(rdsConfigRepository).delete(any());
when(userService.getOrCreate(any())).thenReturn(user);
when(legacyRestRequestThreadLocalService.getCloudbreakUser()).thenReturn(cloudbreakUser);
when(workspaceService.get(anyLong(), any())).thenReturn(defaultWorkspace);
}
use of com.sequenceiq.cloudbreak.workspace.model.Workspace in project cloudbreak by hortonworks.
the class MeteringAzureMetadataPatchServiceTest method createStack.
private Stack createStack() {
Stack stack = new Stack();
stack.setId(1L);
stack.setType(StackType.WORKLOAD);
stack.setCloudPlatform(CloudPlatform.AZURE.name());
stack.setResourceCrn("crn:cdp:datahub:us-west-1:accountId:cluster:name");
Cluster cluster = new Cluster();
cluster.setId(1L);
Workspace workspace = new Workspace();
workspace.setId(1L);
stack.setWorkspace(workspace);
stack.setCluster(cluster);
InstanceGroup instanceGroup = createInstanceGroup();
instanceGroup.setInstanceMetaData(Set.of(createInstanceMetaData()));
stack.setInstanceGroups(Set.of(instanceGroup));
return stack;
}
use of com.sequenceiq.cloudbreak.workspace.model.Workspace in project cloudbreak by hortonworks.
the class DatalakeServiceTest method testGetDatalakeCrnHasResult.
@Test
public void testGetDatalakeCrnHasResult() {
StackV4Request source = new StackV4Request();
Workspace workspace = new Workspace();
source.setSharedService(new SharedServiceV4Request());
source.getSharedService().setDatalakeName("name");
Stack output = new Stack();
output.setResourceCrn("resultCrn");
when(stackService.findStackByNameOrCrnAndWorkspaceId(any(), any())).thenReturn(Optional.of(output));
String res = underTest.getDatalakeCrn(source, workspace);
Assertions.assertTrue("resultCrn".equals(res));
}
use of com.sequenceiq.cloudbreak.workspace.model.Workspace in project cloudbreak by hortonworks.
the class ClusterUpgradeAvailabilityServiceTest method createStack.
private Stack createStack(StackStatus stackStatus, StackType stackType) {
Cluster cluster = new Cluster();
cluster.setId(1L);
Stack stack = new Stack();
stack.setId(2L);
stack.setCloudPlatform(CLOUD_PLATFORM);
stack.setStackStatus(stackStatus);
stack.setCluster(cluster);
stack.setType(stackType);
stack.setRegion(REGION);
stack.setResourceCrn("crn:cdp:datahub:us-west-1:" + ACCOUNT_ID + ":cluster:cluster");
Tenant t = new Tenant();
t.setName(ACCOUNT_ID);
User creator = new User();
creator.setTenant(t);
stack.setCreator(creator);
Workspace workspace = new Workspace();
workspace.setId(WORKSPACE_ID);
stack.setWorkspace(workspace);
return stack;
}
Aggregations