use of com.sequenceiq.cloudbreak.domain.SmartSenseSubscription in project cloudbreak by hortonworks.
the class SmartSenseSubscriptionController method createSmartSenseSubscription.
private SmartSenseSubscriptionJson createSmartSenseSubscription(SmartSenseSubscriptionJson json, boolean publicInAccount) {
IdentityUser identityUser = authenticatedUserService.getCbUser();
SmartSenseSubscription subscription = toSmartSenseSubscriptionConverter.convert(json);
subscription.setAccount(identityUser.getAccount());
subscription.setOwner(identityUser.getUserId());
subscription.setPublicInAccount(publicInAccount);
subscription = smartSenseSubService.create(subscription);
return toJsonConverter.convert(subscription);
}
use of com.sequenceiq.cloudbreak.domain.SmartSenseSubscription in project cloudbreak by hortonworks.
the class StackToBlueprintPreparationObjectConverter method convert.
@Override
public BlueprintPreparationObject convert(Stack source) {
try {
Optional<SmartSenseSubscription> aDefault = smartSenseSubscriptionService.getDefault();
Cluster cluster = clusterService.getById(source.getCluster().getId());
FileSystem fileSystem = cluster.getFileSystem();
LdapConfig ldapConfig = cluster.getLdapConfig();
StackRepoDetails hdpRepo = clusterComponentConfigProvider.getHDPRepo(cluster.getId());
String stackRepoDetailsHdpVersion = hdpRepo != null ? hdpRepo.getHdpVersion() : null;
Map<String, List<InstanceMetaData>> groupInstances = instanceGroupMetadataCollector.collectMetadata(source);
HdfConfigs hdfConfigs = hdfConfigProvider.createHdfConfig(cluster.getHostGroups(), groupInstances, cluster.getBlueprint().getBlueprintText());
BlueprintStackInfo blueprintStackInfo = stackInfoService.blueprintStackInfo(cluster.getBlueprint().getBlueprintText());
FileSystemConfigurationView fileSystemConfigurationView = null;
if (source.getCluster().getFileSystem() != null) {
fileSystemConfigurationView = new FileSystemConfigurationView(fileSystemConfigurationProvider.fileSystemConfiguration(fileSystem, source), fileSystem == null ? false : fileSystem.isDefaultFs());
}
IdentityUser identityUser = userDetailsService.getDetails(cluster.getOwner(), UserFilterField.USERID);
return BlueprintPreparationObject.Builder.builder().withFlexSubscription(source.getFlexSubscription()).withRdsConfigs(postgresConfigService.createRdsConfigIfNeeded(source, cluster)).withHostgroups(hostGroupService.getByCluster(cluster.getId())).withGateway(cluster.getGateway()).withBlueprintView(new BlueprintView(cluster, blueprintStackInfo)).withStackRepoDetailsHdpVersion(stackRepoDetailsHdpVersion).withFileSystemConfigurationView(fileSystemConfigurationView).withGeneralClusterConfigs(generalClusterConfigsProvider.generalClusterConfigs(source, cluster, identityUser)).withSmartSenseSubscriptionId(aDefault.isPresent() ? aDefault.get().getSubscriptionId() : null).withLdapConfig(ldapConfig).withHdfConfigs(hdfConfigs).withKerberosConfig(cluster.isSecure() ? cluster.getKerberosConfig() : null).build();
} catch (BlueprintProcessingException e) {
throw new CloudbreakServiceException(e.getMessage(), e);
} catch (IOException e) {
throw new CloudbreakServiceException(e.getMessage(), e);
}
}
use of com.sequenceiq.cloudbreak.domain.SmartSenseSubscription in project cloudbreak by hortonworks.
the class SmartSenseSubscriptionService method delete.
public void delete(String subscriptionId, IdentityUser cbUser) {
SmartSenseSubscription subscription = repository.findBySubscriptionIdAndAccount(subscriptionId, cbUser.getAccount());
delete(subscription);
}
use of com.sequenceiq.cloudbreak.domain.SmartSenseSubscription in project cloudbreak by hortonworks.
the class SmartSenseSubscriptionService method delete.
public void delete(Long id) {
SmartSenseSubscription subscription = repository.findOneById(id);
delete(subscription);
}
use of com.sequenceiq.cloudbreak.domain.SmartSenseSubscription in project cloudbreak by hortonworks.
the class AmbariSmartSenseCapturerTest method testCaptureWhenNoTriggerNeedsToBeDone.
@Test
public void testCaptureWhenNoTriggerNeedsToBeDone() {
Optional<SmartSenseSubscription> smartSenseSubscription = Optional.empty();
AmbariClient ambariClient = Mockito.mock(AmbariClient.class);
when(smartSenseSubscriptionService.getDefault()).thenReturn(smartSenseSubscription);
when(smartsenseConfigurationLocator.smartsenseConfigurable(smartSenseSubscription)).thenReturn(false);
underTest.capture(1, ambariClient);
verify(ambariClient, times(0)).smartSenseCapture(anyInt());
}
Aggregations