@Test public void testGetWhenNameOrCrnNameFilledThenProperGetCalled() { StackV4Response expected = stackResponse(); NameOrCrn nameOrCrn = NameOrCrn.ofName(stack.getName()); when(stackCommonService.findStackByNameOrCrnAndWorkspaceId(nameOrCrn, stack.getWorkspace().getId(), STACK_ENTRIES, STACK_TYPE)) .thenReturn(expected); StackV4Response result = underTest.get(nameOrCrn, stack.getWorkspace().getId(), STACK_ENTRIES, STACK_TYPE); assertEquals(expected, result); verify(stackCommonService, times(1)).findStackByNameOrCrnAndWorkspaceId(nameOrCrn, stack.getWorkspace().getId(), STACK_ENTRIES, STACK_TYPE); }
public StackV4Response get(NameOrCrn nameOrCrn, Long workspaceId, Set<String> entries, StackType stackType) { LOGGER.info("Validate stack in workspace {}.", workspaceId); StackV4Response stackResponse = stackCommonService.findStackByNameOrCrnAndWorkspaceId(nameOrCrn, workspaceId, entries, stackType); LOGGER.info("Adding environment name and credential to the response."); environmentServiceDecorator.prepareEnvironmentAndCredentialName(stackResponse); LOGGER.info("Adding SDX CRN and name to the response."); sdxServiceDecorator.prepareSdxAttributes(stackResponse); LOGGER.info("Query Stack successfully decorated."); return stackResponse; }
StackOperations implements ResourceBasedCrnProvider { public StackV4Response get(NameOrCrn nameOrCrn, Long workspaceId, Set<String> entries, StackType stackType) { LOGGER.info("Validate stack in workspace {}.", workspaceId); StackV4Response stackResponse = stackCommonService.findStackByNameOrCrnAndWorkspaceId(nameOrCrn, workspaceId, entries, stackType); LOGGER.info("Adding environment name and credential to the response."); environmentServiceDecorator.prepareEnvironmentAndCredentialName(stackResponse); LOGGER.info("Adding SDX CRN and name to the response."); sdxServiceDecorator.prepareSdxAttributes(stackResponse); LOGGER.info("Query Stack successfully decorated."); return stackResponse; } }
StackOperations implements ResourceBasedCrnProvider { public StackV4Response get(NameOrCrn nameOrCrn, Long workspaceId, Set<String> entries, StackType stackType) { LOGGER.info("Validate stack in workspace {}.", workspaceId); StackV4Response stackResponse = stackCommonService.findStackByNameOrCrnAndWorkspaceId(nameOrCrn, workspaceId, entries, stackType); LOGGER.info("Adding environment name and credential to the response."); environmentServiceDecorator.prepareEnvironmentAndCredentialName(stackResponse); LOGGER.info("Adding SDX CRN and name to the response."); sdxServiceDecorator.prepareSdxAttributes(stackResponse); LOGGER.info("Query Stack successfully decorated."); return stackResponse; }  }
StackOperations implements ResourceBasedCrnProvider { public StackV4Response get(NameOrCrn nameOrCrn, Long workspaceId, Set<String> entries, StackType stackType) { LOGGER.info("Validate stack in workspace {}.", workspaceId); StackV4Response stackResponse = stackCommonService.findStackByNameOrCrnAndWorkspaceId(nameOrCrn, workspaceId, entries, stackType); LOGGER.info("Adding environment name and credential to the response."); environmentServiceDecorator.prepareEnvironmentAndCredentialName(stackResponse); LOGGER.info("Adding SDX CRN and name to the response."); sdxServiceDecorator.prepareSdxAttributes(stackResponse); LOGGER.info("Query Stack successfully decorated."); return stackResponse; }  StackViewV4Responses listByEnvironmentName(Long workspaceId, String environmentName, List<StackType> stackTypes); StackViewV4Responses listByEnvironmentCrn(Long workspaceId, String environmentCrn, List<StackType> stackTypes); StackV4Response post(Long workspaceId, @Valid StackV4Request request, boolean distroxRequest); StackV4Response get(NameOrCrn nameOrCrn, Long workspaceId, Set<String> entries, StackType stackType); StackViewV4Response getForInternalCrn(NameOrCrn nameOrCrn, StackType stackType); FlowIdentifier deleteInstance(@NotNull NameOrCrn nameOrCrn, Long workspaceId, boolean forced, String instanceId); FlowIdentifier deleteInstances(NameOrCrn nameOrCrn, Long workspaceId, List<String> instanceIds, boolean forced); FlowIdentifier sync(NameOrCrn nameOrCrn, Long workspaceId); FlowIdentifier retry(NameOrCrn nameOrCrn, Long workspaceId); FlowIdentifier putStop(NameOrCrn nameOrCrn, Long workspaceId); FlowIdentifier putStart(NameOrCrn nameOrCrn, Long workspaceId); FlowIdentifier putScaling(@NotNull NameOrCrn nameOrCrn, Long workspaceId, @Valid StackScaleV4Request updateRequest); FlowIdentifier repairCluster(@NotNull NameOrCrn nameOrCrn, Long workspaceId, @Valid ClusterRepairV4Request clusterRepairRequest); FlowIdentifier upgradeOs(@NotNull NameOrCrn nameOrCrn, Long workspaceId); UpgradeOptionV4Response checkForOsUpgrade(@NotNull NameOrCrn nameOrCrn, Long workspaceId); FlowIdentifier upgradeCluster(@NotNull NameOrCrn nameOrCrn, Long workspaceId, String imageId); FlowIdentifier updateSalt(@NotNull NameOrCrn nameOrCrn, Long workspaceId); FlowIdentifier updatePillarConfiguration(@NotNull NameOrCrn nameOrCrn, Long workspaceId); UpgradeV4Response checkForClusterUpgrade(@NotNull NameOrCrn nameOrCrn, Long workspaceId, UpgradeV4Request request); GeneratedBlueprintV4Response postStackForBlueprint(@Valid StackV4Request stackRequest); FlowIdentifier changeImage(@NotNull NameOrCrn nameOrCrn, Long workspaceId, @Valid StackImageChangeV4Request stackImageChangeRequest); void delete(@NotNull NameOrCrn nameOrCrn, Long workspaceId, boolean forced); StackV4Request getRequest(@NotNull NameOrCrn nameOrCrn, Long workspaceId); StackStatusV4Response getStatus(@NotNull NameOrCrn nameOrCrn, Long workspaceId); StackStatusV4Response getStatusByCrn(@NotNull NameOrCrn nameOrCrn, Long workspaceId); StackStatusV4Response getStatus(@NotNull String crn); FlowIdentifier putPassword(@NotNull NameOrCrn nameOrCrn, Long workspaceId, @Valid UserNamePasswordV4Request userNamePasswordJson); FlowIdentifier setClusterMaintenanceMode(@NotNull NameOrCrn nameOrCrn, Long workspaceId, @NotNull MaintenanceModeV4Request maintenanceMode); FlowIdentifier putCluster(@NotNull NameOrCrn nameOrCrn, Long workspaceId, @Valid UpdateClusterV4Request updateJson); String getClusterHostsInventory(Long workspaceId, String name); Stack getStackByName(String name); Stack getStackByCrn(String crn); List<RetryableFlow> getRetryableFlows(String name, Long workspaceId); FlowIdentifier backupClusterDatabase(@NotNull NameOrCrn nameOrCrn, Long workspaceId, String location, String backupId); FlowIdentifier restoreClusterDatabase(@NotNull NameOrCrn nameOrCrn, Long workspaceId, String location, String backupId); @Override String getResourceCrnByResourceName(String resourceName); @Override List<String> getResourceCrnListByResourceNameList(List<String> resourceName); @Override List<String> getResourceCrnsInAccount(); @Override AuthorizationResourceType getResourceType(); @Override Optional<String> getEnvironmentCrnByResourceCrn(String resourceCrn); CertificatesRotationV4Response rotateClusterCertificates(@NotNull NameOrCrn nameOrCrn, Long workspaceId,
            CertificatesRotationV4Request certificatesRotationV4Request); }
StackOperations implements ResourceBasedCrnProvider { public StackV4Response get(NameOrCrn nameOrCrn, Long workspaceId, Set<String> entries, StackType stackType) { LOGGER.info("Validate stack in workspace {}.", workspaceId); StackV4Response stackResponse = stackCommonService.findStackByNameOrCrnAndWorkspaceId(nameOrCrn, workspaceId, entries, stackType); LOGGER.info("Adding environment name and credential to the response."); environmentServiceDecorator.prepareEnvironmentAndCredentialName(stackResponse); LOGGER.info("Adding SDX CRN and name to the response."); sdxServiceDecorator.prepareSdxAttributes(stackResponse); LOGGER.info("Query Stack successfully decorated."); return stackResponse; }  StackViewV4Responses listByEnvironmentName(Long workspaceId, String environmentName, List<StackType> stackTypes); StackViewV4Responses listByEnvironmentCrn(Long workspaceId, String environmentCrn, List<StackType> stackTypes); StackV4Response post(Long workspaceId, @Valid StackV4Request request, boolean distroxRequest); StackV4Response get(NameOrCrn nameOrCrn, Long workspaceId, Set<String> entries, StackType stackType); StackViewV4Response getForInternalCrn(NameOrCrn nameOrCrn, StackType stackType); FlowIdentifier deleteInstance(@NotNull NameOrCrn nameOrCrn, Long workspaceId, boolean forced, String instanceId); FlowIdentifier deleteInstances(NameOrCrn nameOrCrn, Long workspaceId, List<String> instanceIds, boolean forced); FlowIdentifier sync(NameOrCrn nameOrCrn, Long workspaceId); FlowIdentifier retry(NameOrCrn nameOrCrn, Long workspaceId); FlowIdentifier putStop(NameOrCrn nameOrCrn, Long workspaceId); FlowIdentifier putStart(NameOrCrn nameOrCrn, Long workspaceId); FlowIdentifier putScaling(@NotNull NameOrCrn nameOrCrn, Long workspaceId, @Valid StackScaleV4Request updateRequest); FlowIdentifier repairCluster(@NotNull NameOrCrn nameOrCrn, Long workspaceId, @Valid ClusterRepairV4Request clusterRepairRequest); FlowIdentifier upgradeOs(@NotNull NameOrCrn nameOrCrn, Long workspaceId); UpgradeOptionV4Response checkForOsUpgrade(@NotNull NameOrCrn nameOrCrn, Long workspaceId); FlowIdentifier upgradeCluster(@NotNull NameOrCrn nameOrCrn, Long workspaceId, String imageId); FlowIdentifier updateSalt(@NotNull NameOrCrn nameOrCrn, Long workspaceId); FlowIdentifier updatePillarConfiguration(@NotNull NameOrCrn nameOrCrn, Long workspaceId); UpgradeV4Response checkForClusterUpgrade(@NotNull NameOrCrn nameOrCrn, Long workspaceId, UpgradeV4Request request); GeneratedBlueprintV4Response postStackForBlueprint(@Valid StackV4Request stackRequest); FlowIdentifier changeImage(@NotNull NameOrCrn nameOrCrn, Long workspaceId, @Valid StackImageChangeV4Request stackImageChangeRequest); void delete(@NotNull NameOrCrn nameOrCrn, Long workspaceId, boolean forced); StackV4Request getRequest(@NotNull NameOrCrn nameOrCrn, Long workspaceId); StackStatusV4Response getStatus(@NotNull NameOrCrn nameOrCrn, Long workspaceId); StackStatusV4Response getStatusByCrn(@NotNull NameOrCrn nameOrCrn, Long workspaceId); StackStatusV4Response getStatus(@NotNull String crn); FlowIdentifier putPassword(@NotNull NameOrCrn nameOrCrn, Long workspaceId, @Valid UserNamePasswordV4Request userNamePasswordJson); FlowIdentifier setClusterMaintenanceMode(@NotNull NameOrCrn nameOrCrn, Long workspaceId, @NotNull MaintenanceModeV4Request maintenanceMode); FlowIdentifier putCluster(@NotNull NameOrCrn nameOrCrn, Long workspaceId, @Valid UpdateClusterV4Request updateJson); String getClusterHostsInventory(Long workspaceId, String name); Stack getStackByName(String name); Stack getStackByCrn(String crn); List<RetryableFlow> getRetryableFlows(String name, Long workspaceId); FlowIdentifier backupClusterDatabase(@NotNull NameOrCrn nameOrCrn, Long workspaceId, String location, String backupId); FlowIdentifier restoreClusterDatabase(@NotNull NameOrCrn nameOrCrn, Long workspaceId, String location, String backupId); @Override String getResourceCrnByResourceName(String resourceName); @Override List<String> getResourceCrnListByResourceNameList(List<String> resourceName); @Override List<String> getResourceCrnsInAccount(); @Override AuthorizationResourceType getResourceType(); @Override Optional<String> getEnvironmentCrnByResourceCrn(String resourceCrn); CertificatesRotationV4Response rotateClusterCertificates(@NotNull NameOrCrn nameOrCrn, Long workspaceId,
            CertificatesRotationV4Request certificatesRotationV4Request);  }