@Test public void testCreateAsync() { final AssetCurrentValueRequest assetCurrentValueRequest = new AssetCurrentValueRequest(); assetCurrentValueRequest.setAssetCurrentValues(getAssetCurrentValuesForCreateAsync()); final AuditDetails auditDetails = getAuditDetails(); final List<Long> idList = getAssetIds(); when(assetCommonService.getAuditDetails(any(RequestInfo.class))).thenReturn(auditDetails); when(sequenceGenService.getIds(any(Integer.class), any(String.class))).thenReturn(idList); when(applicationProperties.getSaveCurrentvalueTopic()).thenReturn("save-currentvalue-db"); currentValueService.createCurrentValue(assetCurrentValueRequest); }
public AssetCurrentValueResponse createCurrentValue(final AssetCurrentValueRequest assetCurrentValueRequest) { final RequestInfo requestInfo = assetCurrentValueRequest.getRequestInfo(); final List<AssetCurrentValue> assetCurrentValues = assetCurrentValueRequest.getAssetCurrentValues(); final AuditDetails auditDetails = assetCommonService.getAuditDetails(requestInfo); final List<Long> idList = sequenceGenService.getIds(assetCurrentValues.size(), Sequence.CURRENTVALUESEQUENCE.toString()); int i = 0; for (final AssetCurrentValue assetCurrentValue : assetCurrentValues) { assetCurrentValue.setAuditDetails(auditDetails); assetCurrentValue.setId(idList.get(i++)); } saveCurrentValue(assetCurrentValueRequest); return new AssetCurrentValueResponse(responseInfoFactory.createResponseInfoFromRequestHeaders(requestInfo), assetCurrentValues); }
CurrentValueService { public AssetCurrentValueResponse createCurrentValue(final AssetCurrentValueRequest assetCurrentValueRequest) { final RequestInfo requestInfo = assetCurrentValueRequest.getRequestInfo(); final List<AssetCurrentValue> assetCurrentValues = assetCurrentValueRequest.getAssetCurrentValues(); final AuditDetails auditDetails = assetCommonService.getAuditDetails(requestInfo); final List<Long> idList = sequenceGenService.getIds(assetCurrentValues.size(), Sequence.CURRENTVALUESEQUENCE.toString()); int i = 0; for (final AssetCurrentValue assetCurrentValue : assetCurrentValues) { assetCurrentValue.setAuditDetails(auditDetails); assetCurrentValue.setId(idList.get(i++)); } saveCurrentValue(assetCurrentValueRequest); return new AssetCurrentValueResponse(responseInfoFactory.createResponseInfoFromRequestHeaders(requestInfo), assetCurrentValues); } }
CurrentValueService { public AssetCurrentValueResponse createCurrentValue(final AssetCurrentValueRequest assetCurrentValueRequest) { final RequestInfo requestInfo = assetCurrentValueRequest.getRequestInfo(); final List<AssetCurrentValue> assetCurrentValues = assetCurrentValueRequest.getAssetCurrentValues(); final AuditDetails auditDetails = assetCommonService.getAuditDetails(requestInfo); final List<Long> idList = sequenceGenService.getIds(assetCurrentValues.size(), Sequence.CURRENTVALUESEQUENCE.toString()); int i = 0; for (final AssetCurrentValue assetCurrentValue : assetCurrentValues) { assetCurrentValue.setAuditDetails(auditDetails); assetCurrentValue.setId(idList.get(i++)); } saveCurrentValue(assetCurrentValueRequest); return new AssetCurrentValueResponse(responseInfoFactory.createResponseInfoFromRequestHeaders(requestInfo), assetCurrentValues); }  }
CurrentValueService { public AssetCurrentValueResponse createCurrentValue(final AssetCurrentValueRequest assetCurrentValueRequest) { final RequestInfo requestInfo = assetCurrentValueRequest.getRequestInfo(); final List<AssetCurrentValue> assetCurrentValues = assetCurrentValueRequest.getAssetCurrentValues(); final AuditDetails auditDetails = assetCommonService.getAuditDetails(requestInfo); final List<Long> idList = sequenceGenService.getIds(assetCurrentValues.size(), Sequence.CURRENTVALUESEQUENCE.toString()); int i = 0; for (final AssetCurrentValue assetCurrentValue : assetCurrentValues) { assetCurrentValue.setAuditDetails(auditDetails); assetCurrentValue.setId(idList.get(i++)); } saveCurrentValue(assetCurrentValueRequest); return new AssetCurrentValueResponse(responseInfoFactory.createResponseInfoFromRequestHeaders(requestInfo), assetCurrentValues); }  AssetCurrentValueResponse getCurrentValues(final Set<Long> assetIds, final String tenantId,
            final RequestInfo requestInfo); AssetCurrentValueResponse createCurrentValue(final AssetCurrentValueRequest assetCurrentValueRequest); void saveCurrentValue(final AssetCurrentValueRequest assetCurrentValueRequest); void saveUpdatedCurrentValue(final AssetCurrentValueRequest assetCurrentValueRequest); }
CurrentValueService { public AssetCurrentValueResponse createCurrentValue(final AssetCurrentValueRequest assetCurrentValueRequest) { final RequestInfo requestInfo = assetCurrentValueRequest.getRequestInfo(); final List<AssetCurrentValue> assetCurrentValues = assetCurrentValueRequest.getAssetCurrentValues(); final AuditDetails auditDetails = assetCommonService.getAuditDetails(requestInfo); final List<Long> idList = sequenceGenService.getIds(assetCurrentValues.size(), Sequence.CURRENTVALUESEQUENCE.toString()); int i = 0; for (final AssetCurrentValue assetCurrentValue : assetCurrentValues) { assetCurrentValue.setAuditDetails(auditDetails); assetCurrentValue.setId(idList.get(i++)); } saveCurrentValue(assetCurrentValueRequest); return new AssetCurrentValueResponse(responseInfoFactory.createResponseInfoFromRequestHeaders(requestInfo), assetCurrentValues); }  AssetCurrentValueResponse getCurrentValues(final Set<Long> assetIds, final String tenantId,
            final RequestInfo requestInfo); AssetCurrentValueResponse createCurrentValue(final AssetCurrentValueRequest assetCurrentValueRequest); void saveCurrentValue(final AssetCurrentValueRequest assetCurrentValueRequest); void saveUpdatedCurrentValue(final AssetCurrentValueRequest assetCurrentValueRequest);  }