use of org.onap.so.db.request.beans.RequestProcessingData in project so by onap.
the class StackStatusHandlerTest method recordExists_Test.
@Test
public final void recordExists_Test() throws MsoException, IOException {
RequestProcessingData requestProcessingData = new RequestProcessingData();
requestProcessingData.setValue("testMe");
String requestId = getRequestId();
doReturn(requestProcessingData).when(requestDBClient).getRequestProcessingDataBySoRequestIdAndNameAndGrouping(requestId, "stackName", "id");
Stack latestStack = new Stack();
latestStack.setId("id");
latestStack.setStackName("stackName");
latestStack.setStackStatus("CREATE_COMPLETE");
latestStack.setStackStatusReason("Stack Finished");
statusHandler.updateStackStatus(latestStack, requestId);
Mockito.verify(requestDBClient, times(1)).updateRequestProcessingData(requestProcessingData);
assertNotEquals("testMe", requestProcessingData.getValue());
}
use of org.onap.so.db.request.beans.RequestProcessingData in project so by onap.
the class StackStatusHandlerTest method record_Not_Exists_Test.
@Test
public final void record_Not_Exists_Test() throws MsoException, IOException {
String requestId = getRequestId();
ArgumentCaptor<RequestProcessingData> requestCaptor = ArgumentCaptor.forClass(RequestProcessingData.class);
doReturn(null).when(requestDBClient).getRequestProcessingDataBySoRequestIdAndNameAndGrouping(requestId, "stackName", "id");
Stack latestStack = new Stack();
latestStack.setId("id");
latestStack.setStackName("stackName");
latestStack.setStackStatus("CREATE_COMPLETE");
latestStack.setStackStatusReason("Stack Finished");
statusHandler.updateStackStatus(latestStack, requestId);
Mockito.verify(requestDBClient, times(1)).saveRequestProcessingData(requestCaptor.capture());
RequestProcessingData actualRequest = requestCaptor.getValue();
assertEquals("id", actualRequest.getGroupingId());
assertEquals("StackInformation", actualRequest.getTag());
assertEquals("stackName", actualRequest.getName());
assertNotNull(actualRequest.getValue());
}
use of org.onap.so.db.request.beans.RequestProcessingData in project so by onap.
the class RequestProcessingDataRequestDbQueryTest method RequestProcessingDataBySoRequestIdTest.
@Test
@Transactional
public void RequestProcessingDataBySoRequestIdTest() {
String soRequestId = "00032ab7-na18-42e5-965d-8ea592502018";
String tag = "pincFabricConfigRequest";
RequestProcessingData firstEntry = new RequestProcessingData();
RequestProcessingData secondEntry = new RequestProcessingData();
List<RequestProcessingData> expectedList = new ArrayList<>();
firstEntry.setSoRequestId(soRequestId);
firstEntry.setGroupingId("7d2e8c07-4d10-456d-bddc-37abf38ca715");
firstEntry.setName("configurationId");
firstEntry.setValue("52234bc0-d6a6-41d4-a901-79015e4877e2");
firstEntry.setTag(tag);
secondEntry.setSoRequestId(soRequestId);
secondEntry.setGroupingId("7d2e8c07-4d10-456d-bddc-37abf38ca714");
secondEntry.setName("requestAction");
secondEntry.setValue("assign");
secondEntry.setTag(tag);
expectedList.add(firstEntry);
expectedList.add(secondEntry);
List<RequestProcessingData> dataFound = client.getRequestProcessingDataBySoRequestId(soRequestId);
// bean comparison with shazam fails serialization: Forgot to register a type adapter?
assertEquals(dataFound.get(0).getSoRequestId(), firstEntry.getSoRequestId());
assertEquals(dataFound.get(0).getGroupingId(), firstEntry.getGroupingId());
assertEquals(dataFound.get(0).getName(), firstEntry.getName());
assertEquals(dataFound.get(0).getValue(), firstEntry.getValue());
assertEquals(dataFound.get(0).getTag(), firstEntry.getTag());
assertEquals(dataFound.get(1).getSoRequestId(), secondEntry.getSoRequestId());
assertEquals(dataFound.get(1).getGroupingId(), secondEntry.getGroupingId());
assertEquals(dataFound.get(1).getName(), secondEntry.getName());
assertEquals(dataFound.get(1).getValue(), secondEntry.getValue());
assertEquals(dataFound.get(1).getTag(), secondEntry.getTag());
}
use of org.onap.so.db.request.beans.RequestProcessingData in project so by onap.
the class RequestsDbClientTest method getRequestProcessingDataBySoRequestIdAndName.
@Test
public void getRequestProcessingDataBySoRequestIdAndName() {
RequestProcessingData requestProcessingData = requestsDbClient.getRequestProcessingDataBySoRequestIdAndNameAndGrouping("00032ab7-na18-42e5-965d-8ea592502018", "requestAction", "7d2e8c07-4d10-456d-bddc-37abf38ca714");
assertNotNull(requestProcessingData);
}
use of org.onap.so.db.request.beans.RequestProcessingData in project so by onap.
the class BBInputSetupUtils method loadOriginalFlowExecutionPath.
public List<ExecuteBuildingBlock> loadOriginalFlowExecutionPath(String requestId) {
if (requestId != null) {
InfraActiveRequests request = loadInfraActiveRequestById(requestId);
if (request.getOriginalRequestId() != null) {
RequestProcessingData requestProcessingData = this.requestsDbClient.getRequestProcessingDataBySoRequestIdAndName(request.getOriginalRequestId(), PROCESSING_DATA_NAME_EXECUTION_FLOWS);
try {
ObjectMapper om = new ObjectMapper();
TypeFactory typeFactory = om.getTypeFactory();
om.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
return om.readValue(requestProcessingData.getValue(), typeFactory.constructCollectionType(List.class, ExecuteBuildingBlock.class));
} catch (Exception e) {
logger.error(DATA_LOAD_ERROR, e);
throw new RuntimeException("Error Loading Original Request Data", e);
}
} else {
throw new RuntimeException("Original Request Id is null for record: " + requestId);
}
} else {
throw new RuntimeException("Null Request Id Passed in");
}
}
Aggregations