use of com.sequenceiq.cloudbreak.domain.CloudbreakUsage in project cloudbreak by hortonworks.
the class UsageService method closeUsagesForStack.
public void closeUsagesForStack(Long stackId) {
List<CloudbreakUsage> usages = usageRepository.findOpensForStack(stackId);
for (CloudbreakUsage usage : usages) {
closeUsage(usage);
usageRepository.save(usage);
}
}
use of com.sequenceiq.cloudbreak.domain.CloudbreakUsage in project cloudbreak by hortonworks.
the class UsageService method openUsagesForStack.
public void openUsagesForStack(Stack stack) {
LocalDateTime ldt = LocalDateTime.now();
List<CloudbreakUsage> usages = Lists.newArrayList();
for (InstanceGroup ig : stack.getInstanceGroups()) {
Template template = ig.getTemplate();
String instanceType = template == null ? "undefined" : template.getInstanceType();
String groupName = ig.getGroupName();
Integer instanceNum = ig.getNodeCount();
usages.add(usageGeneratorService.openNewUsage(stack, instanceType, instanceNum, groupName, ldt));
}
usageRepository.save(usages);
}
use of com.sequenceiq.cloudbreak.domain.CloudbreakUsage in project cloudbreak by hortonworks.
the class CloudbreakUsageRequestToCloudbreakUsageConverterTest method testConvert.
@Test
public void testConvert() {
// GIVEN
// WHEN
CloudbreakUsage result = underTest.convert(getRequest("usage/cloudbreak-usage.json"));
// THEN
assertAllFieldsNotNull(result, asList("day", "costs", "periodStarted", "duration", "status", "flexId", "stackUuid", "instanceNum", "peak", "parentUuid", "smartSenseId"));
}
Aggregations