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;
}
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();
}
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");
}
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:.*"));
}
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;
}
Aggregations