Capability / Support

The assertions below can be performed on both clientCapStmt and serverCapStmt variables offered by the Touchstone Rules-Engine. These assertions confirm the presence or absence of a capability in the test system. They rely on evaluation of FHIRPath, XPath, or JSONPath expressions against the contents of the capability statement. They can be useful in ensuring that the test system supports a certain capability before other assertions are made on test execution results.

The clientCapStmt variable represents the capability statement of the client/origin test system and will only be set by the Rules Engine in Peer-to-Peer interactions and if the statement has been downloaded or uploaded into Touchstone. In other interactions, Touchstone serves as the client.

The serverCapStmt variable represents the capability statement of the server/destination test system and will be set by the Rules Engine if the statement has been downloaded or uploaded into Touchstone.

See Capability Statement and Test System List for details on how to download or upload a Capability Statement into Touchstone.

The advantage of assertSupportViaFhirPath assertions over assertSupportViaNonFhirPath, assertSupportViaXPath, and assertSupportViaJsonPath assertions is that only one FHIRPath expression is needed and will work regardless of the content type (XML or JSON) of the capability statement that was downloaded or uploaded into Touchstone. The disadvantage is that it will run significantly slower than XPath and JSONPath evaluation.

Warning

Avoid using assertSupportViaXPath, and assertSupportViaJsonPath assertions as they make assumptions about the content type of the capability statement downloaded or uploaded into Touchstone. Use either assertSupportViaFhirPath or assertSupportViaNonFhirPath assertions instead as they’ll work with either content type.

  • assertSupportViaFhirPath(fhirpath, expectedConfPathValue, operator, pathLabel)

    • Asserts that the provided fhirpath evaluates to the provided expectedConfPathValue using the provided operator against the capability statement represented by the provided capStmt. The pathLabel is a short label/description that will be used for informational messages in place of the long fhirpath to describe the capability.

    • Example:

      serverCapStmt.assertSupportViaFhirPath(
         "rest.where(mode.value='server').resource.where(type.value='Patient').versioning",
          "versioned,versioned-update", "in", "Patient versioning")
      
    • Equivalent to these:

      assertSupportViaFhirPath(
         "rest.where(mode.value='server').resource.where(type.value='Patient').versioning",
          "versioned,versioned-update", "in", "Patient versioning", serverCapStmt)
      
      boolean supports = serverCapStmt.supportsViaFhirPath(
          "rest.where(mode.value='server').resource.where(type.value='Patient').versioning",
          "versioned,versioned-update", "in", "Patient versioning")
      
      assert supports: "Expected Patient versioning to be supported by server capability statement"
      
      boolean supports = supportsViaFhirPath(
          "rest.where(mode.value='server').resource.where(type.value='Patient').versioning",
          "versioned,versioned-update", "in", "Patient versioning", serverCapStmt)
      
      assert supports: "Expected Patient versioning to be supported by server capability statement"
      
      def versioning = serverCapStmt.fhirPathValue(
            "rest.where(mode.value='server').resource.where(type.value='Patient').versioning")
      
      assert versioning in ["versioned","versioned-update"]: "Expected Patient versioning to be
            supported by server capability statement"
      
  • assertSupportViaNonFhirPath(xPath, jsonPath, expectedConfPathValue, operator, pathLabel)

    • Asserts that the provided xPath or jsonPath evaluates to the provided expectedConfPathValue using the provided operator against the capability statement represented by the provided capStmt. The pathLabel is a short label/description that will be used for informational messages in place of the long xPath or jsonPath to describe the capability.

      If the capability statement downloaded or uploaded into Touchstone is in XML, then the provided xPath expression is used. And if the statement is in JSON, then the provided jsonPath expression is used.

    • Example:

      serverCapStmt.assertSupportViaNonFhirPath(
         "rest[mode/@value='server']/resource[type/@value='Patient']/versioning",
         "versioned,versioned-update", "in", "Patient versioning")
      
    • Equivalent to these:

      assertSupportViaNonFhirPath(
         "rest[mode/@value='server']/resource[type/@value='Patient']/versioning",
         ".rest[?(@.mode=='server')].resource[?(@.type=='Patient')].versioning"
         "versioned,versioned-update", "in", "Patient versioning", serverCapStmt)
      
      boolean supports = serverCapStmt.supportsViaNonFhirPath(
         "rest[mode/@value='server']/resource[type/@value='Patient']/versioning",
         ".rest[?(@.mode=='server')].resource[?(@.type=='Patient')].versioning"
         "versioned,versioned-update", "in", "Patient versioning")
      
      assert supports: "Expected Patient versioning to be supported by server capability statement"
      
      boolean supports = supportsViaNonFhirPath(
         "rest[mode/@value='server']/resource[type/@value='Patient']/versioning",
         ".rest[?(@.mode=='server')].resource[?(@.type=='Patient')].versioning"
         "versioned,versioned-update", "in", "Patient versioning", serverCapStmt)
      
      assert supports: "Expected Patient versioning to be supported by server capability statement"
      
      def versioning = serverCapStmt.nonFhirPathValue(
         "rest[mode/@value='server']/resource[type/@value='Patient']/versioning",
         ".rest[?(@.mode=='server')].resource[?(@.type=='Patient')].versioning")
      
      assert versioning in ["versioned", "versioned-update"]: "Expected Patient versioning to be
            supported by server capability statement"
      
  • assertSupportViaXPath(xpath, expectedConfPathValue, operator, pathLabel)

    • Asserts that the provided xpath evaluates to the provided expectedConfPathValue using the provided operator against the capability statement represented by the provided capStmt. The pathLabel is a short label/description that will be used for informational messages in place of the long xpath to describe the capability.

    • Example:

      serverCapStmt.assertSupportViaXPath(
         "rest[mode/@value='server']/resource[type/@value='Patient']/versioning",
         "versioned,versioned-update", "in", "Patient versioning")
      
    • Equivalent to these:

      assertSupportViaXPath(
         "rest[mode/@value='server']/resource[type/@value='Patient']/versioning",
         "versioned,versioned-update", "in", "Patient versioning", serverCapStmt)
      
      boolean supports = serverCapStmt.supportsViaXPath(
         "rest[mode/@value='server']/resource[type/@value='Patient']/versioning",
         "versioned,versioned-update", "in", "Patient versioning")
      
      assert supports: "Expected Patient versioning to be supported by server capability statement"
      
      boolean supports = supportsViaXPath(
         "rest[mode/@value='server']/resource[type/@value='Patient']/versioning",
         "versioned,versioned-update", "in", "Patient versioning", serverCapStmt)
      
      assert supports: "Expected Patient versioning to be supported by server capability statement"
      
      def versioning = serverCapStmt.xPathValue(
            "rest[mode/@value='server']/resource[type/@value='Patient']/versioning")
      
      assert isIn("versioned, versioned-update", versioning): "Expected Patient versioning to be
            supported by server capability statement"
      
  • assertSupportViaJsonPath(jsonPath, expectedConfPathValue, operator, pathLabel)

    • Asserts that the provided jsonPath evaluates to the provided expectedConfPathValue using the provided operator against the capability statement represented by the provided capStmt. The pathLabel is a short label/description that will be used for informational messages in place of the long jsonPath to describe the capability.

    • Example:

      serverCapStmt.assertSupportViaJsonPath(
         ".rest[?(@.mode=='server')].resource[?(@.type=='Patient')].versioning",
         "versioned,versioned-update", "in", "Patient versioning")
      
    • Equivalent to these:

      assertSupportViaJsonPath(
         ".rest[?(@.mode=='server')].resource[?(@.type=='Patient')].versioning",
         "versioned,versioned-update", "in", "Patient versioning", serverCapStmt)
      
      boolean supports = serverCapStmt.supportsViaJsonPath(
         ".rest[?(@.mode=='server')].resource[?(@.type=='Patient')].versioning",
         "versioned,versioned-update", "in", "Patient versioning")
      
      assert supports: "Expected Patient versioning to be supported by server capability statement"
      
      boolean supports = supportsViaJsonPath(
         ".rest[?(@.mode=='server')].resource[?(@.type=='Patient')].versioning",
         "versioned,versioned-update", "in", "Patient versioning", serverCapStmt)
      
      assert supports: "Expected Patient versioning to be supported by server capability statement"
      
      def versioning = serverCapStmt.jsonPathValue(
            ".rest[?(@.mode=='server')].resource[?(@.type=='Patient')].versioning")
      
      assert isIn("versioned, versioned-update", versioning): "Expected Patient versioning to be
            supported by server capability statement"