summaryrefslogtreecommitdiffstats
path: root/adapters/mso-requests-db-adapter/src
diff options
context:
space:
mode:
authorYulian Han <elaine.hanyulian@huawei.com>2018-11-21 17:01:04 +0800
committerYulian Han <elaine.hanyulian@huawei.com>2018-11-23 03:58:02 +0000
commit7373add0c99ae0220a62212bf187aa74542d931a (patch)
treeebae8c2098bb3dc842153feace1ac1e7c3f5e70f /adapters/mso-requests-db-adapter/src
parent223efc103433ff63c12b5bd55e319f5dfd4fac63 (diff)
insert service progress into db if no record
Change-Id: Idaa55084f5ecb0dd3636c232cebc14fa5f064409 Issue-ID: SO-1235 Signed-off-by: Yulian Han <elaine.hanyulian@huawei.com>
Diffstat (limited to 'adapters/mso-requests-db-adapter/src')
-rw-r--r--adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java5
-rw-r--r--adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java33
2 files changed, 8 insertions, 30 deletions
diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java
index dc6abce759..c8ea1652f7 100644
--- a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java
+++ b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java
@@ -201,7 +201,10 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter {
String error = "Entity not found. Unable to retrieve OperationStatus Object ServiceId: " + serviceId + " operationId: "
+ operationId;
logger.error(error);
- throw new MsoRequestsDbException(error,MsoLogger.ErrorCode.BusinessProcesssError);
+// throw new MsoRequestsDbException(error,MsoLogger.ErrorCode.BusinessProcesssError);
+ operStatus = new OperationStatus();
+ operStatus.setOperationId(operationId);
+ operStatus.setServiceId(serviceId);
}
operStatus.setUserId(userId);
diff --git a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java
index 7c2dd1241f..103e216229 100644
--- a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java
+++ b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java
@@ -365,35 +365,10 @@ public class MSORequestDBImplTest {
updatedOperationStatus.setReason(reason);
updatedOperationStatus.setOperationContent(operationContent);
- try {
- dbAdapter.updateServiceOperationStatus(serviceId, operationId, operation, userId,
- result, operationContent, progress, reason);
- fail("Expected MsoRequestsDbException to be thrown");
- } catch (Exception e) {
- assertEquals("Entity not found. Unable to retrieve OperationStatus Object ServiceId: " + serviceId + " operationId: " + operationId,e.getMessage());
- for(ILoggingEvent logEvent : TestAppender.events)
- if(logEvent.getLoggerName().equals("org.onap.so.logging.cxf.interceptor.SOAPLoggingInInterceptor") &&
- logEvent.getMarker().getName().equals("ENTRY")
- ){
- Map<String,String> mdc = logEvent.getMDCPropertyMap();
- assertNotNull(mdc.get(ONAPLogConstants.MDCs.INSTANCE_UUID));
- assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
- assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID));
- assertEquals("",mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME));
- assertEquals("/services/RequestsDbAdapter",mdc.get(ONAPLogConstants.MDCs.SERVICE_NAME));
- assertEquals("INPROGRESS",mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE));
- }else if(logEvent.getLoggerName().equals("org.onap.so.logging.cxf.interceptor.SOAPLoggingOutInterceptor") &&
- logEvent.getMarker()!= null && logEvent.getMarker().getName().equals("EXIT")){
- Map<String,String> mdc = logEvent.getMDCPropertyMap();
- assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
- assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID));
- assertEquals("500",mdc.get(ONAPLogConstants.MDCs.RESPONSE_CODE));
- assertEquals("",mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME));
- assertEquals("/services/RequestsDbAdapter",mdc.get(ONAPLogConstants.MDCs.SERVICE_NAME));
- assertEquals("ERROR",mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE));
- }
- }
-
+ dbAdapter.updateServiceOperationStatus(serviceId, operationId, operation, userId,
+ result, operationContent, progress, reason);
+ OperationStatus dbOpStatus = operationStatusRepository.findOneByServiceIdAndOperationId(serviceId,operationId);
+ assertThat(dbOpStatus, sameBeanAs(updatedOperationStatus).ignoring("operateAt").ignoring("finishedAt"));
}
@Test