예제 #1
0
  @Test
  public void testValidateDocumentMetaData_SupportedMimeType() {
    System.out.println("testValidateDocumentMetaData_SupportedMimeType");
    ProvideAndRegisterDocumentSetRequestType body = new XDRMessageHelper().getSampleMessage();

    XDRHelper instance = createHelper(true);

    RegistryErrorList result = instance.validateDocumentMetaData(body);
    assertNotNull(result);
  }
예제 #2
0
  /** Test of validateDocumentMetaData method, of class XDRHelper. */
  @Ignore
  public void testgetSourcePatientId() {
    System.out.println("testgetSourcePatientId");
    ProvideAndRegisterDocumentSetRequestType body = new XDRMessageHelper().getSampleMessage();
    XDRHelper instance = createHelper();

    String result = instance.getSourcePatientId(body);
    assertNotNull(result);
    assertEquals("ST-1000^^^&1.3.6.1.4.1.21367.2003.3.9&ISO", result);
  }
예제 #3
0
  @Ignore
  public void testgetIntendedRecepients_NoRecip() {
    System.out.println("testgetIntendedRecepients_NoRecip");
    ProvideAndRegisterDocumentSetRequestType body = new XDRMessageHelper().getSampleMessage();
    XDRHelper instance = createHelper();

    List<String> result = instance.getIntendedRecepients(body);

    assertNotNull(result);
  }
예제 #4
0
  @Test
  public void testgetIntendedRecepients_Null() {
    System.out.println("testgetIntendedRecepients_Null");
    ProvideAndRegisterDocumentSetRequestType body = null;
    XDRHelper instance = createHelper();

    List<String> result = instance.getIntendedRecepients(body);

    assertNull(result);
  }
예제 #5
0
  @Ignore
  public void testValidateDocumentMetaData_ValidMessage() {
    System.out.println("testValidateDocumentMetaData_ValidMessage");
    ProvideAndRegisterDocumentSetRequestType body = new XDRMessageHelper().getSampleMessage();
    XDRHelper instance = createHelper();

    RegistryErrorList result = instance.validateDocumentMetaData(body);
    assertNotNull(result);
    assertEquals(0, result.getRegistryError().size());
    assertEquals("", result.getHighestSeverity());
  }
예제 #6
0
  @Test
  public void testgetIntendedRecepients_NullSubmitObj() {
    System.out.println("testgetIntendedRecepients_NullSubmitObj");
    ProvideAndRegisterDocumentSetRequestType body = new XDRMessageHelper().getSampleMessage();
    XDRHelper instance = createHelper();

    body.setSubmitObjectsRequest(null);

    List<String> result = instance.getIntendedRecepients(body);

    assertNull(result);
  }
예제 #7
0
  @Test
  public void testgetIntendedRecepients_Valid() {
    System.out.println("testgetIntendedRecepients_Valid");
    ProvideAndRegisterDocumentSetRequestType body =
        new XDRMessageHelper()
            .getSampleMessage("ProvideAndRegisterDocumentSet-IntendedRecpient.xml");
    XDRHelper instance = createHelper();

    List<String> result = instance.getIntendedRecepients(body);

    assertNotNull(result);
    assertEquals(4, result.size());
  }
예제 #8
0
  @Test
  public void testValidateDocumentMetaData_UnsupportedMimeType() {
    System.out.println("testValidateDocumentMetaData_UnsupportedMimeType");
    ProvideAndRegisterDocumentSetRequestType body = new XDRMessageHelper().getSampleMessage();

    XDRHelper instance = createHelper(false);

    RegistryErrorList result = instance.validateDocumentMetaData(body);
    assertNotNull(result);
    assertEquals(1, result.getRegistryError().size());
    assertEquals(XDRHelper.XDS_ERROR_SEVERITY_ERROR, result.getHighestSeverity());
    assertEquals(
        XDRHelper.XDS_ERROR_SEVERITY_ERROR, result.getRegistryError().get(0).getSeverity());
    assertNotNull(result.getRegistryError().get(0).getCodeContext());
  }
예제 #9
0
  @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(XDRHelper.XDS_ERROR_SEVERITY_ERROR, result.getHighestSeverity());
    assertEquals(
        XDRHelper.XDS_ERROR_SEVERITY_ERROR, result.getRegistryError().get(0).getSeverity());
    assertEquals(
        XDRHelper.XDR_EC_XDSMissingDocument, result.getRegistryError().get(0).getErrorCode());
    assertNotNull(result.getRegistryError().get(0).getCodeContext());
  }
예제 #10
0
  @Test
  public void testValidateDocumentMetaData_PatIdsNoMatch() {
    System.out.println("testValidateDocumentMetaData_PatIdsNoMatch");
    ProvideAndRegisterDocumentSetRequestType body =
        new XDRMessageHelper().getSampleMessage("ProvideAndRegisterDocumentSet-MultiPat.xml");

    XDRHelper instance = createHelper(true);

    RegistryErrorList result = instance.validateDocumentMetaData(body);
    assertNotNull(result);
    assertEquals(1, result.getRegistryError().size());
    assertEquals(XDRHelper.XDS_ERROR_SEVERITY_ERROR, result.getHighestSeverity());
    assertEquals(
        XDRHelper.XDS_ERROR_SEVERITY_ERROR, result.getRegistryError().get(0).getSeverity());
    assertEquals(
        XDRHelper.XDR_EC_XDSPatientIdDoesNotMatch, result.getRegistryError().get(0).getErrorCode());
    assertNotNull(result.getRegistryError().get(0).getCodeContext());
  }
예제 #11
0
  @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());
  }
  public RegistryResponseType provideAndRegisterDocumentSetB(
      ProvideAndRegisterDocumentSetRequestType msg, AssertionType assertion) {
    LOG.debug("Begin provideAndRegisterDocumentSetb()");
    XDRHelper helper = new XDRHelper();
    RegistryErrorList errorList = helper.validateDocumentMetaData(msg);

    RegistryResponseType result = null;

    if (errorList.getHighestSeverity().equals(NhincConstants.XDS_REGISTRY_ERROR_SEVERITY_ERROR)) {
      result = helper.createErrorResponse(errorList);
    } else {
      LOG.info(" Request contained " + msg.getDocument().size() + " documents.");
      LOG.info(" Request Id: " + msg.getSubmitObjectsRequest().getId());

      List<String> recips = helper.getIntendedRecepients(msg);

      if (recips != null) {
        List<String> xdrBeans = helper.getRoutingBeans(recips);
        RoutingObjectFactory factory = new RoutingObjectFactory();

        for (String bean : xdrBeans) {
          LOG.debug("Bean name = " + bean);
          XDRRouting proxy = factory.getNhinXDRRouting(bean);
          result = proxy.provideAndRegisterDocumentSetB(msg, assertion);
        }
      } else {
        LOG.debug("No beans to forward the message to");
        result = helper.createPositiveAck();
      }
    }
    return result;
  }