use of com.sequenceiq.cloudbreak.workspace.model.Workspace in project cloudbreak by hortonworks.
the class DefaultCloudbreakEventService method cloudbreakEvents.
@Override
public List<StructuredNotificationEvent> cloudbreakEvents(Long workspaceId, Long since) {
User user = userService.getOrCreate(legacyRestRequestThreadLocalService.getCloudbreakUser());
Workspace workspace = workspaceService.get(workspaceId, user);
List<StructuredNotificationEvent> events;
events = null == since ? legacyStructuredEventService.getEventsForWorkspaceWithType(workspace, StructuredNotificationEvent.class) : legacyStructuredEventService.getEventsForWorkspaceWithTypeSince(workspace, StructuredNotificationEvent.class, since);
return events;
}
use of com.sequenceiq.cloudbreak.workspace.model.Workspace in project cloudbreak by hortonworks.
the class StackService method getByNameInWorkspaceWithEntries.
public StackV4Response getByNameInWorkspaceWithEntries(String name, Long workspaceId, Set<String> entries, User user, StackType stackType) {
try {
return transactionService.required(() -> {
Workspace workspace = workspaceService.get(workspaceId, user);
ShowTerminatedClustersAfterConfig showTerminatedClustersAfterConfig = showTerminatedClusterConfigService.get();
Optional<Stack> stack = findByNameAndWorkspaceIdWithLists(name, workspace.getId(), stackType, showTerminatedClustersAfterConfig);
if (stack.isEmpty()) {
throw new NotFoundException(format(STACK_NOT_FOUND_BY_NAME_EXCEPTION_MESSAGE, name));
}
StackV4Response stackResponse = stackToStackV4ResponseConverter.convert(stack.get());
stackResponse = stackResponseDecorator.decorate(stackResponse, stack.get(), entries);
return stackResponse;
});
} catch (TransactionExecutionException e) {
throw new TransactionRuntimeExecutionException(e);
}
}
use of com.sequenceiq.cloudbreak.workspace.model.Workspace in project cloudbreak by hortonworks.
the class ClusterTemplateService method updateDefaultClusterTemplates.
public void updateDefaultClusterTemplates(long workspaceId) {
Workspace workspace = getWorkspaceService().getByIdForCurrentUser(workspaceId);
updateDefaultClusterTemplates(workspace);
}
use of com.sequenceiq.cloudbreak.workspace.model.Workspace in project cloudbreak by hortonworks.
the class StackImageUpdateServiceTest method setUp.
@Before
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);
image = new Image("asdf", System.currentTimeMillis(), System.currentTimeMillis(), "asdf", "centos7", "uuid", "2.8.0", Collections.emptyMap(), Collections.singletonMap("AWS", Collections.emptyMap()), null, "centos", packageVersions, Collections.emptyList(), Collections.emptyList(), "1", true, null, null);
statedImage = StatedImage.statedImage(image, "url", "name");
when(packageVersionChecker.checkInstancesHaveAllMandatoryPackageVersion(anySet())).thenReturn(CheckResult.ok());
when(packageVersionChecker.checkInstancesHaveMultiplePackageVersions(anySet())).thenReturn(CheckResult.ok());
when(packageVersionChecker.compareImageAndInstancesMandatoryPackageVersion(any(StatedImage.class), anySet())).thenReturn(CheckResult.ok());
when(messagesService.getMessage(anyString(), anyCollection())).thenReturn("message");
}
use of com.sequenceiq.cloudbreak.workspace.model.Workspace in project cloudbreak by hortonworks.
the class StackStatusIntegrationTest method setUpStack.
private void setUpStack() {
underTest.setLocalId(STACK_ID.toString());
stack = new Stack();
stack.setId(STACK_ID);
Cluster cluster = new Cluster();
cluster.setVariant("AWS");
cluster.setClusterManagerIp("192.168.0.1");
cluster.setId(2L);
stack.setCluster(cluster);
stack.setResourceCrn("crn:stack");
User creator = new User();
creator.setUserId("user-id");
stack.setCreator(creator);
Workspace workspace = new Workspace();
workspace.setId(564L);
stack.setWorkspace(workspace);
when(stackService.get(STACK_ID)).thenReturn(stack);
when(instanceMetaDataService.findNotTerminatedAndNotZombieForStack(STACK_ID)).thenReturn(runningInstances);
when(instanceMetaDataService.findNotTerminatedAndNotZombieForStackWithoutInstanceGroups(STACK_ID)).thenReturn(runningInstances);
}
Aggregations