XDRHelper { public RegistryErrorList validateDocumentMetaData(ProvideAndRegisterDocumentSetRequestType body) { RegistryErrorList result = new RegistryErrorList(); LOG.debug("begin validateDocumentMetaData()"); if (body == null) { RegistryError error = createRegistryError(XDR_EC_XDSMissingDocument, NhincConstants.XDS_REGISTRY_ERROR_SEVERITY_ERROR, "ProvideAndRegisterDocumentSetRequestType was null"); result.getRegistryError().add(error); return processErrorList(result); } if (validateDocumentData(body, result)) { return processErrorList(result); } validateSubmittedObjectsRequest(body.getSubmitObjectsRequest(), result, body.getDocument()); return processErrorList(result); }  static RegistryResponseType createErrorResponse(RegistryErrorList errorList); static RegistryResponseType createPositiveAck(); RegistryErrorList validateDocumentMetaData(ProvideAndRegisterDocumentSetRequestType body); static List<String> getIntendedRecepients(ProvideAndRegisterDocumentSetRequestType body); static List<String> getRoutingBeans(List<String> intendedRecipients); static String getSubmissionSetPatientId(ProvideAndRegisterDocumentSetRequestType body); static String getSourcePatientId(ProvideAndRegisterDocumentSetRequestType body); static final String XDR_EC_XDSMissingDocument; static final String XDR_EC_XDSMissingDocumentMetadata; static final String XDR_EC_XDSUnknownPatientId; static final String XDR_EC_XDSPatientIdDoesNotMatch; static final String XDS_RETRIEVE_RESPONSE_STATUS_FAILURE; static final String XDS_RETRIEVE_RESPONSE_STATUS_SUCCESS; static final String XDS_SOURCE_PATIENT_ID_SLOT; static final String XDS_INTENDED_RECIPIENT_SLOT; }
@Test public void testValidateDocumentMetaData_Null() { System.out.println("testValidateDocumentMetaData_Null"); ProvideAndRegisterDocumentSetRequestType body = null; XDRHelper instance = createHelper(); RegistryErrorList result = instance.validateDocumentMetaData(body); assertNotNull(result); assertEquals(1, result.getRegistryError().size()); assertEquals(NhincConstants.XDS_REGISTRY_ERROR_SEVERITY_ERROR, result.getHighestSeverity()); assertEquals(NhincConstants.XDS_REGISTRY_ERROR_SEVERITY_ERROR, result.getRegistryError().get(0).getSeverity()); assertEquals(XDRHelper.XDR_EC_XDSMissingDocument, result.getRegistryError().get(0).getErrorCode()); assertNotNull(result.getRegistryError().get(0).getCodeContext()); }
@Test public void testValidateDocumentMetaData_MissingDoc() { System.out.println("testValidateDocumentMetaData_ValidMessage"); ProvideAndRegisterDocumentSetRequestType body = new XDRMessageHelper().getSampleMessage(); body.getDocument().clear(); XDRHelper instance = createHelper(); RegistryErrorList result = instance.validateDocumentMetaData(body); assertNotNull(result); assertEquals(1, result.getRegistryError().size()); assertEquals(NhincConstants.XDS_REGISTRY_ERROR_SEVERITY_ERROR, result.getHighestSeverity()); assertEquals(NhincConstants.XDS_REGISTRY_ERROR_SEVERITY_ERROR, result.getRegistryError().get(0).getSeverity()); assertEquals(XDRHelper.XDR_EC_XDSMissingDocument, result.getRegistryError().get(0).getErrorCode()); assertNotNull(result.getRegistryError().get(0).getCodeContext()); }
@Test public void testValidateDocumentMetaData_UnsupportedMimeType() { System.out.println("testValidateDocumentMetaData_UnsupportedMimeType"); ProvideAndRegisterDocumentSetRequestType body = XDRMessageHelper.getSampleMessage(); XDRHelper instance = createHelper(false); RegistryErrorList result = instance.validateDocumentMetaData(body); assertNotNull(result); assertEquals(1, result.getRegistryError().size()); assertEquals(NhincConstants.XDS_REGISTRY_ERROR_SEVERITY_ERROR, result.getHighestSeverity()); assertEquals(NhincConstants.XDS_REGISTRY_ERROR_SEVERITY_ERROR, result.getRegistryError().get(0).getSeverity()); assertNotNull(result.getRegistryError().get(0).getCodeContext()); }
@Test public void testValidateDocumentMetaData_SupportedMimeType() { System.out.println("testValidateDocumentMetaData_SupportedMimeType"); ProvideAndRegisterDocumentSetRequestType body = XDRMessageHelper.getSampleMessage(); XDRHelper instance = createHelper(true); RegistryErrorList result = instance.validateDocumentMetaData(body); assertNotNull(result); }
@Test public void testValidateDocumentMetaData_PatIdsNoMatch() { System.out.println("testValidateDocumentMetaData_PatIdsNoMatch"); ProvideAndRegisterDocumentSetRequestType body = XDRMessageHelper .getSampleMessage("ProvideAndRegisterDocumentSet-MultiPat.xml"); XDRHelper instance = createHelper(true); RegistryErrorList result = instance.validateDocumentMetaData(body); assertNotNull(result); assertEquals(1, result.getRegistryError().size()); assertEquals(NhincConstants.XDS_REGISTRY_ERROR_SEVERITY_ERROR, result.getHighestSeverity()); assertEquals(NhincConstants.XDS_REGISTRY_ERROR_SEVERITY_ERROR, result.getRegistryError().get(0).getSeverity()); assertEquals(XDRHelper.XDR_EC_XDSPatientIdDoesNotMatch, result.getRegistryError().get(0).getErrorCode()); assertNotNull(result.getRegistryError().get(0).getCodeContext()); }