Search in sources :

Example 16 with Workspace

use of com.sequenceiq.cloudbreak.workspace.model.Workspace in project cloudbreak by hortonworks.

the class WorkspaceConfiguratorFilterTest method createWorkspace.

private Workspace createWorkspace() {
    Workspace workspace = new Workspace();
    workspace.setId(1L);
    return workspace;
}
Also used : Workspace(com.sequenceiq.cloudbreak.workspace.model.Workspace)

Example 17 with Workspace

use of com.sequenceiq.cloudbreak.workspace.model.Workspace in project cloudbreak by hortonworks.

the class RdsConfigToRdsDetailsConverterTest method testWhenSourceWorkspaceIdIsNotNullThenItsValueShouldBePassedBesideAllLogicIndependentData.

@ParameterizedTest(name = "Current RDS type - Database vendor pair: [{0} - {1}]")
@MethodSource("databaseTypeAndVendorDataProvider")
public void testWhenSourceWorkspaceIdIsNotNullThenItsValueShouldBePassedBesideAllLogicIndependentData(DatabaseType databaseType, DatabaseVendor vendor) {
    Workspace workspace = new Workspace();
    workspace.setId(23L);
    RDSConfig source = TestUtil.rdsConfig(databaseType, vendor);
    source.setWorkspace(workspace);
    RdsDetails result = underTest.convert(source);
    assertThat(result).isNotNull();
}
Also used : RDSConfig(com.sequenceiq.cloudbreak.domain.RDSConfig) RdsDetails(com.sequenceiq.cloudbreak.structuredevent.event.RdsDetails) Workspace(com.sequenceiq.cloudbreak.workspace.model.Workspace) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 18 with Workspace

use of com.sequenceiq.cloudbreak.workspace.model.Workspace in project cloudbreak by hortonworks.

the class StackImageServiceTest method setUp.

@BeforeEach
public void setUp() {
    MockitoAnnotations.initMocks(this);
    Workspace workspace = new Workspace();
    workspace.setId(WORKSPACE_ID);
    stack = new Stack();
    stack.setId(1L);
    stack.setName("stackname");
    stack.setRegion("region");
    stack.setCloudPlatform("AWS");
    stack.setWorkspace(workspace);
    stack.setResourceCrn("crn:cdp:datahub:us-west-1:accountId:cluster:name");
    image = anImage("uuid");
    statedImage = StatedImage.statedImage(image, "url", "name");
}
Also used : Workspace(com.sequenceiq.cloudbreak.workspace.model.Workspace) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 19 with Workspace

use of com.sequenceiq.cloudbreak.workspace.model.Workspace in project cloudbreak by hortonworks.

the class RecipeServiceTest method testCreateForLoggedInUser.

@Test
public void testCreateForLoggedInUser() {
    Recipe recipe = getRecipe();
    when(legacyRestRequestThreadLocalService.getCloudbreakUser()).thenReturn(mock(CloudbreakUser.class));
    when(userService.getOrCreate(any())).thenReturn(mock(User.class));
    Workspace workspace = mock(Workspace.class);
    when(workspaceService.get(eq(1L), any())).thenReturn(workspace);
    when(workspaceService.retrieveForUser(any())).thenReturn(Set.of(workspace));
    when(recipeRepository.save(any())).thenReturn(recipe);
    String userCrn = CrnTestUtil.getUserCrnBuilder().setResource("user_id").setAccountId("account_id").build().toString();
    ThreadBasedUserCrnProvider.doAs(userCrn, () -> underTest.createForLoggedInUser(recipe, 1L, "account_id", userCrn));
    assertThat(recipe.getCreator(), is(userCrn));
    assertTrue(recipe.getResourceCrn().matches("crn:cdp:datahub:us-west-1:account_id:recipe:.*"));
}
Also used : CloudbreakUser(com.sequenceiq.cloudbreak.common.user.CloudbreakUser) User(com.sequenceiq.cloudbreak.workspace.model.User) Recipe(com.sequenceiq.cloudbreak.domain.Recipe) CloudbreakUser(com.sequenceiq.cloudbreak.common.user.CloudbreakUser) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Workspace(com.sequenceiq.cloudbreak.workspace.model.Workspace) Test(org.junit.jupiter.api.Test)

Example 20 with Workspace

use of com.sequenceiq.cloudbreak.workspace.model.Workspace in project cloudbreak by hortonworks.

the class RecipeServiceTest method getWorkspace.

private Workspace getWorkspace() {
    Workspace ws = new Workspace();
    ws.setId(6L);
    return ws;
}
Also used : Workspace(com.sequenceiq.cloudbreak.workspace.model.Workspace)

Aggregations

Workspace (com.sequenceiq.cloudbreak.workspace.model.Workspace)75 User (com.sequenceiq.cloudbreak.workspace.model.User)26 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)24 Cluster (com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster)18 Blueprint (com.sequenceiq.cloudbreak.domain.Blueprint)17 Tenant (com.sequenceiq.cloudbreak.workspace.model.Tenant)12 CloudbreakUser (com.sequenceiq.cloudbreak.common.user.CloudbreakUser)9 Test (org.junit.jupiter.api.Test)9 HashMap (java.util.HashMap)8 BadRequestException (com.sequenceiq.cloudbreak.common.exception.BadRequestException)7 Before (org.junit.Before)7 Test (org.junit.Test)5 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)5 StackV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request)4 Json (com.sequenceiq.cloudbreak.common.json.Json)4 RDSConfig (com.sequenceiq.cloudbreak.domain.RDSConfig)4 StackStatus (com.sequenceiq.cloudbreak.domain.stack.StackStatus)4 ClusterTemplate (com.sequenceiq.cloudbreak.domain.stack.cluster.ClusterTemplate)4 HashSet (java.util.HashSet)4 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)4