Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,10 @@ private void updateAwxJobIdIntoProjectComponents(ProvisionActionWrapper provisio

var projectKey = provisionActionWrapper.getProjectKey();
var componentId = provisionActionWrapper.getComponentId();
var catalogItemId = provisionActionWrapper.getCatalogItemId();
var accessToken = authenticationProvider.getAccessToken();

componentCatalogService.setWorkflowJobId(projectKey, componentId, awxJobId, accessToken);
componentCatalogService.setWorkflowJobId(projectKey, componentId, catalogItemId, awxJobId, accessToken);
} else {
log.warn("Not updating project components with AWX job id since the AWX request was not successful. HTTP status code: {}", awxResponse.httpStatusCode());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,13 @@ public void notifyComponentCatalogProvisionStarts(String projectKey,

public void setWorkflowJobId(String projectKey,
String componentId,
String catalogItemId,
String workflowJobId,
String accessToken) {

var provisionStatusUpdateRequest = ProvisioningStatusUpdateRequest.builder()
.componentId(componentId)
.catalogItemId(catalogItemId)
.workflowJobId(workflowJobId)
.build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,7 @@ void givenValidInput_whenSetWorkflowJobId_thenInvokesProvisionerActionsApiWithPa
// given
String projectKey = "PRJ-KEY";
String componentId = "CMP-001";
String catalogItemId = "CAT-001";
String workflowJobId = "WFJ-123";
String accessToken = "secret";

Expand All @@ -462,7 +463,7 @@ void givenValidInput_whenSetWorkflowJobId_thenInvokesProvisionerActionsApiWithPa
ArgumentCaptor.forClass(ProvisioningStatusUpdateRequest.class);

// when
componentCatalogService.setWorkflowJobId(projectKey, componentId, workflowJobId, accessToken);
componentCatalogService.setWorkflowJobId(projectKey, componentId, catalogItemId, workflowJobId, accessToken);

// then
verify(provisionerActionsApi).notifyProvisioningStatusUpdatePartially(
Expand All @@ -476,6 +477,7 @@ void givenValidInput_whenSetWorkflowJobId_thenInvokesProvisionerActionsApiWithPa

ProvisioningStatusUpdateRequest captured = requestCaptor.getValue();
assertThat(captured.getComponentId()).isEqualTo(componentId);
assertThat(captured.getCatalogItemId()).isEqualTo(catalogItemId);
assertThat(captured.getWorkflowJobId()).isEqualTo(workflowJobId);
}

Expand Down Expand Up @@ -536,14 +538,15 @@ void givenProjectKeyAndWorkflowJobId_whenSetWorkflowJobId_thenInvokesProvisioner
// given
var projectKey = "PRJ";
var componentId = "CID";
var catalogItemId = "CAT";
var workflowJobId = "WFJ123";
var accessToken = "TOKEN";

when(componentCatalogServiceProps.getBaseRestUrl()).thenReturn(new URL("http://catalog"));
when(apiClientsBuilder.provisionerActionsApi(accessToken, "http://catalog")).thenReturn(provisionerActionsApi);

// when
componentCatalogService.setWorkflowJobId(projectKey, componentId, workflowJobId, accessToken);
componentCatalogService.setWorkflowJobId(projectKey, componentId, catalogItemId, workflowJobId, accessToken);

// then
verify(provisionerActionsApi).notifyProvisioningStatusUpdatePartially(eq(projectKey), eq(ProvisioningStatus.CREATING), any(ProvisioningStatusUpdateRequest.class));
Expand Down
Loading