Пример #1
0
  /**
   * Check if expected error (XDSRegistryMetadataError) is returned if a required attribute (coded
   * as ExternalIdentifier with identificationScheme) is missing.
   *
   * <p>Required (see ITI TF-3: Cross-Transaction and Content Specifications, R and cP):
   * XDSDocumentEntry: patientId, uniqueId XDSFolder: patientId, uniqueId XDSSubmissionSet:
   * patientId, uniqueId, sourceId
   *
   * @throws Exception
   */
  @Test
  public void checkErrorMissingExternalIdentifier() throws Exception {
    log.info(
        "\n############################# TEST: check missing ExternalIdentifier ##################");
    SubmitObjectsRequest req = XDSTestUtil.getSubmitObjectsRequest(TEST_METADATA_FILENAME);
    // DocumentEntry
    checkRequiredExternalIdentifiers(
        req,
        new String[] {
          XDSConstants.UUID_XDSDocumentEntry_patientId, XDSConstants.UUID_XDSDocumentEntry_uniqueId
        },
        ((RegistryObjectType) req.getRegistryObjectList().getIdentifiable().get(0).getValue())
            .getExternalIdentifier(),
        "Check missing ExternalIdentifier in XDSDocument");
    // Folder
    checkRequiredExternalIdentifiers(
        req,
        new String[] {XDSConstants.UUID_XDSFolder_patientId, XDSConstants.UUID_XDSFolder_uniqueId},
        ((RegistryObjectType) req.getRegistryObjectList().getIdentifiable().get(1).getValue())
            .getExternalIdentifier(),
        "Check missing ExternalIdentifier in Folder");
    // SubmissionSet
    checkRequiredExternalIdentifiers(
        req,
        new String[] {
          XDSConstants.UUID_XDSSubmissionSet_patientId,
          XDSConstants.UUID_XDSSubmissionSet_uniqueId,
          XDSConstants.UUID_XDSSubmissionSet_sourceId
        },
        ((RegistryObjectType) req.getRegistryObjectList().getIdentifiable().get(2).getValue())
            .getExternalIdentifier(),
        "Check missing ExternalIdentifier in SubmissionSet");

    AuditTestManager.expectNumberOfMessages(7);
  }
Пример #2
0
  /**
   * Check if expected error (XDSRegistryMetadataError) is returned if a required attribute coded as
   * Slot is missing.
   *
   * <p>Required (see ITI TF-3: Cross-Transaction and Content Specifications, R and cP):
   * XDSDocumentEntry: creationTime, hash, repositoryUniqueId, size, sourcePatientId and
   * languageCode XDSSubmissionSet: submissionTime
   *
   * @throws Exception
   */
  @Test
  public void checkErrorMissingSlot() throws Exception {
    log.info(
        "\n############################# TEST: check missing slot ############################");
    SubmitObjectsRequest req = XDSTestUtil.getSubmitObjectsRequest(TEST_METADATA_FILENAME);
    // XDSDocument
    checkRequiredSlots(
        req,
        new String[] {
          XDSConstants.SLOT_NAME_CREATION_TIME,
          XDSConstants.SLOT_NAME_REPOSITORY_UNIQUE_ID,
          XDSConstants.SLOT_NAME_SIZE,
          XDSConstants.SLOT_NAME_HASH,
          XDSConstants.SLOT_NAME_SOURCE_PATIENT_ID,
          XDSConstants.SLOT_NAME_LANGUAGE_CODE
        },
        req.getRegistryObjectList().getIdentifiable().get(0).getValue().getSlot(),
        "Check missing Slots in XDSDocument");
    // SubmissionSet
    checkRequiredSlots(
        req,
        new String[] {XDSConstants.SLOT_NAME_SUBMISSION_TIME},
        req.getRegistryObjectList().getIdentifiable().get(2).getValue().getSlot(),
        "Check missing Slots in SubmissionSet");

    AuditTestManager.expectNumberOfMessages(7);
  }
Пример #3
0
 @Test
 public void checkMissingMimeType() throws Exception {
   log.info(
       "\n############################# TEST: missing mimeType in DocumentEntry  ############################");
   SubmitObjectsRequest req = XDSTestUtil.getSubmitObjectsRequest(TEST_METADATA_FILENAME);
   ExtrinsicObjectType doc =
       (ExtrinsicObjectType) req.getRegistryObjectList().getIdentifiable().get(0).getValue();
   doc.setMimeType("");
   doRegisterDocumentAndCheckError(
       req, XDSException.XDS_ERR_REGISTRY_METADATA_ERROR, "Check missing mimeType");
 }
Пример #4
0
 /**
  * Check if expected error (XDSPatientIdDoesNotMatch) is returned if an Association references two
  * XDSObjects with different patientId's.
  *
  * @throws Exception
  */
 @Test
 public void checkErrorPatIdDoesntMatch() throws Exception {
   log.info(
       "\n############################# TEST: check error PatId doesn't Match  ############################");
   SubmitObjectsRequest req = XDSTestUtil.getSubmitObjectsRequest(TEST_METADATA_FILENAME);
   RegistryObjectType obj =
       (RegistryObjectType) req.getRegistryObjectList().getIdentifiable().get(0).getValue();
   XDSTestUtil.setExternalIdentifierValue(
       obj.getExternalIdentifier(),
       XDSConstants.UUID_XDSDocumentEntry_patientId,
       "test1234_2^^^&1.2.3.45.4.3.2.1&ISO");
   doRegisterDocumentAndCheckError(
       req, XDSException.XDS_ERR_PATID_DOESNOT_MATCH, "Check Unknown PID");
 }
Пример #5
0
 @Test
 public void checkErrorMergedPatId() throws Exception {
   log.info(
       "\n############################# TEST: check merged PatId ############################");
   String mergedPID = XDSTestUtil.TEST_PID_MERGED + XDSTestUtil.TEST_ISSUER;
   session.linkPatient(mergedPID, XDSTestUtil.TEST_PID_1 + XDSTestUtil.TEST_ISSUER);
   SubmitObjectsRequest req = XDSTestUtil.getSubmitObjectsRequest(TEST_METADATA_FILENAME);
   RegistryObjectType obj =
       (RegistryObjectType) req.getRegistryObjectList().getIdentifiable().get(0).getValue();
   XDSTestUtil.setExternalIdentifierValue(
       obj.getExternalIdentifier(), XDSConstants.UUID_XDSDocumentEntry_patientId, mergedPID);
   doRegisterDocumentAndCheckError(
       req, XDSException.XDS_ERR_PATID_DOESNOT_MATCH, "Check merged PID");
   session.linkPatient(mergedPID, null);
 }
Пример #6
0
 private String[] getSubmissionUIDandPatID(SubmitObjectsRequest req) {
   String[] result = new String[2];
   List<JAXBElement<? extends IdentifiableType>> objs =
       req.getRegistryObjectList().getIdentifiable();
   IdentifiableType obj;
   whole:
   for (int i = 0, len = objs.size(); i < len; i++) {
     obj = objs.get(i).getValue();
     if (obj instanceof RegistryPackageType) {
       List<ExternalIdentifierType> list = ((RegistryPackageType) obj).getExternalIdentifier();
       if (list != null) {
         for (ExternalIdentifierType eiType : list) {
           if (XDSConstants.UUID_XDSSubmissionSet_patientId.equals(
               eiType.getIdentificationScheme())) {
             result[1] = eiType.getValue();
           } else if (XDSConstants.UUID_XDSSubmissionSet_uniqueId.equals(
               eiType.getIdentificationScheme())) {
             result[0] = eiType.getValue();
           } else {
             continue;
           }
           if (result[0] != null && result[1] != null) break whole;
         }
       }
     }
   }
   return result;
 }
Пример #7
0
 public static RegistryPackageType getRegistryPackage(
     SubmitObjectsRequest sor, String classificationUUID) {
   List<JAXBElement<? extends IdentifiableType>> list =
       sor.getRegistryObjectList().getIdentifiable();
   String id = null;
   IdentifiableType identifiable;
   if (classificationUUID != null) {
     ClassificationType ct;
     for (int i = 0, len = list.size(); i < len; i++) {
       identifiable = list.get(i).getValue();
       if (identifiable instanceof ClassificationType) {
         ct = (ClassificationType) identifiable;
         if (classificationUUID.equals(ct.getClassificationNode())) {
           id = ct.getClassifiedObject();
           break;
         }
       }
     }
   }
   RegistryPackageType rp;
   for (int i = 0, len = list.size(); i < len; i++) {
     identifiable = list.get(i).getValue();
     if (identifiable instanceof RegistryPackageType) {
       rp = (RegistryPackageType) identifiable;
       if (id == null || id.equals(rp.getId())) {
         return rp;
       }
     }
   }
   return null;
 }
Пример #8
0
  @Test
  public void checkMissingEntryUUID() throws Exception {
    log.info(
        "\n############################# TEST: missing entryUUID (RegistryObject.id) ############################");
    SubmitObjectsRequest req = XDSTestUtil.getSubmitObjectsRequest(TEST_METADATA_FILENAME);
    checkEntryUUID(
        req,
        req.getRegistryObjectList().getIdentifiable().get(0).getValue(),
        "Check Missing EntryUUID of XDSDocument");
    checkEntryUUID(
        req,
        req.getRegistryObjectList().getIdentifiable().get(1).getValue(),
        "Check Missing EntryUUID of Folder");
    checkEntryUUID(
        req,
        req.getRegistryObjectList().getIdentifiable().get(2).getValue(),
        "Check Missing EntryUUID of SubmissionSet");

    AuditTestManager.expectNumberOfMessages(3);
  }
Пример #9
0
 public static List<ExtrinsicObjectType> getExtrinsicObjects(SubmitObjectsRequest so) {
   List<ExtrinsicObjectType> extrObjs = new ArrayList<ExtrinsicObjectType>();
   List<JAXBElement<? extends IdentifiableType>> list =
       so.getRegistryObjectList().getIdentifiable();
   IdentifiableType o;
   for (int i = 0, len = list.size(); i < len; i++) {
     o = list.get(i).getValue();
     if (o instanceof ExtrinsicObjectType) {
       extrObjs.add((ExtrinsicObjectType) o);
     }
   }
   return extrObjs;
 }
Пример #10
0
 @Test
 public void checkErrorUnknownPatId() throws Exception {
   log.info(
       "\n############################# TEST: check unknown PatId ############################");
   SubmitObjectsRequest req = XDSTestUtil.getSubmitObjectsRequest(TEST_METADATA_FILENAME);
   List<JAXBElement<? extends IdentifiableType>> objList =
       req.getRegistryObjectList().getIdentifiable();
   RegistryObjectType obj = (RegistryObjectType) objList.get(0).getValue();
   String unknownPID = "11111^^^&1.2.3&ISO";
   XDSTestUtil.setExternalIdentifierValue(
       ((RegistryObjectType) objList.get(0).getValue()).getExternalIdentifier(),
       XDSConstants.UUID_XDSDocumentEntry_patientId,
       unknownPID);
   XDSTestUtil.setExternalIdentifierValue(
       ((RegistryObjectType) objList.get(1).getValue()).getExternalIdentifier(),
       XDSConstants.UUID_XDSFolder_patientId,
       unknownPID);
   XDSTestUtil.setExternalIdentifierValue(
       ((RegistryObjectType) objList.get(2).getValue()).getExternalIdentifier(),
       XDSConstants.UUID_XDSSubmissionSet_patientId,
       unknownPID);
   doRegisterDocumentAndCheckError(req, XDSException.XDS_ERR_UNKNOWN_PATID, "Check Unknown PID");
 }
Пример #11
0
  /**
   * Check if expected error (XDSRegistryMetadataError) is returned if a required code attribute
   * (coded as Classification with classificationScheme) is missing.
   *
   * <p>Required (see ITI TF-3: Cross-Transaction and Content Specifications, R and cP):
   * XDSDocumentEntry: confidentialityCode, formatCode, healthCareFacilityTypeCode,
   * practiceSettingCode, typeCode XDSFolder: codeList XDSSubmissionSet: contentTypeCode
   *
   * @throws Exception
   */
  @Test
  public void checkErrorMissingCode() throws Exception {
    log.info(
        "\n############################# TEST: check missing code ############################");
    SubmitObjectsRequest req = XDSTestUtil.getSubmitObjectsRequest(TEST_METADATA_FILENAME);
    // DocumentEntry
    checkRequiredCodes(
        req,
        new String[] {
          XDSConstants.UUID_XDSDocumentEntry_classCode,
          XDSConstants.UUID_XDSDocumentEntry_confidentialityCode,
          XDSConstants.UUID_XDSDocumentEntry_formatCode,
          XDSConstants.UUID_XDSDocumentEntry_healthCareFacilityTypeCode,
          XDSConstants.UUID_XDSDocumentEntry_practiceSettingCode,
          XDSConstants.UUID_XDSDocumentEntry_typeCode
        },
        ((RegistryObjectType) req.getRegistryObjectList().getIdentifiable().get(0).getValue())
            .getClassification(),
        "Check missing Code in XDSDocument");
    // Folder
    checkRequiredCodes(
        req,
        new String[] {XDSConstants.UUID_XDSFolder_codeList},
        ((RegistryObjectType) req.getRegistryObjectList().getIdentifiable().get(1).getValue())
            .getClassification(),
        "Check missing Code in Folder");
    // SubmissionSet
    checkRequiredCodes(
        req,
        new String[] {XDSConstants.UUID_XDSSubmissionSet_contentTypeCode},
        ((RegistryObjectType) req.getRegistryObjectList().getIdentifiable().get(2).getValue())
            .getClassification(),
        "Check missing Slots in SubmissionSet");

    AuditTestManager.expectNumberOfMessages(8);
  }