Package org.opengis.cite.iso19142.transaction

# Class InsertTests

java.lang.Object
org.opengis.cite.iso19142.BaseFixture
org.opengis.cite.iso19142.transaction.TransactionFixture
org.opengis.cite.iso19142.transaction.InsertTests

public class InsertTests extends TransactionFixture
Tests the response to a Transaction request that includes one or more insert actions.

See Also:
  - "ISO 19142:2010, cl. 15.2.4: Insert action"

- ## Field Summary

  ### Fields inherited from class org.opengis.cite.iso19142.transaction.TransactionFixture

  `dataSampler, model`

  ### Fields inherited from class org.opengis.cite.iso19142.BaseFixture

  `docBuilder, ETS_PKG, featureInfo, featureTypes, reqEntity, rspEntity, supportedBindings, TNS_PREFIX, wfsClient, wfsMetadata, wfsVersion`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `InsertTests()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static String`
  `addRandomName(Element feature)`
  Adds a gml:name element to the given feature representation.
  `(package private) Node`
  `createFeatureInstance(QName featureType)`
  Creates a new representation of a feature instance.
  `void`
  `deleteInsertedFeatures()`
  Restores the WFS data store to its previous state by deleting all features that were successfully inserted by test methods in this class.
  `static List<ResourceId>`
  `extractFeatureIdentifiers(Document entity, WFS2.Transaction action)`
  Extracts a list of resource identifiers for features that were affected by a successful transaction request.
  `void`
  `insertInvalidFeature()`
  [`Test`] Submits a Transaction request to insert a feature instance of a type not recognized by the SUT.
  `static UUID`
  `insertRandomIdentifier(Element feature)`
  Inserts a user-assigned gml:identifier element having a random UUID value.
  `void`
  `insertSupportedFeature(ProtocolBinding binding, QName featureType)`
  [`Test`] Submits a Transaction request to insert a feature instance of a type supported by the SUT.

  ### Methods inherited from class org.opengis.cite.iso19142.transaction.TransactionFixture

  `buildTransactionRequest, initTransactionFixture, setModel, trxTestParameters`

  ### Methods inherited from class org.opengis.cite.iso19142.BaseFixture

  `addAttributesOnTestFailure, allProtocolsAndFeatureTypes, bindingAndAvailFeatureTypeProductSet, extractBodyAsDocument, getFeatureTypes, getInstantiatedFeatureTypes, getProtocolBindings, initBaseFixture, initParser, setWfsClient`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### InsertTests

    public InsertTests()

- ## Method Details

  - ### deleteInsertedFeatures

    @AfterClass public void deleteInsertedFeatures()
    Restores the WFS data store to its previous state by deleting all features that were successfully inserted by test methods in this class.

  - ### insertSupportedFeature

    public void insertSupportedFeature(ProtocolBinding binding, QName featureType)
    [`Test`] Submits a Transaction request to insert a feature instance of a type supported by the SUT. The test is run for all supported Transaction request bindings and feature types. The response entity (wfs:TransactionResponse) must be schema-valid and contain the wfs:InsertResults element.
    Parameters:
      `binding` - A supported message binding.
      `featureType` - A QName representing the qualified name of some feature type.
    See Also:
      - "ISO 19142:2010, cl. 15.3.3: TransactionSummary element"
      - "ISO 19142:2010, cl. 15.3.4: InsertResults element"

  - ### insertInvalidFeature

    public void insertInvalidFeature()
    [`Test`] Submits a Transaction request to insert a feature instance of a type not recognized by the SUT. An ExceptionReport (with status code 400) containing the exception code `InvalidValue` is expected in response.
    See Also:
      - "ISO 19142:2010, Table 3: WFS exception codes"

  - ### extractFeatureIdentifiers

    public static List<ResourceId> extractFeatureIdentifiers(Document entity, WFS2.Transaction action)
    Extracts a list of resource identifiers for features that were affected by a successful transaction request. The identifiers are found using this XPath expression: "//{wfs:ActionResultsType}/wfs:Feature/fes:ResourceId", where wfs:ActionResultsType denotes an element of this type.
    Parameters:
      `entity` - A Document representing a successful transaction response entity (wfs:TransactionResponse).
      `action` - The transaction results of interest.
    Returns:
      A List containing zero or more feature identifiers.

  - ### createFeatureInstance

    Node createFeatureInstance(QName featureType)
    Creates a new representation of a feature instance. First, an attempt is made to retrieve a feature representation from the SUT; if this fails or no instances exist then one is generated using an application schema (Note: this facility is not yet implemented). The gml:id attribute is modified and a new gml:identifier is added.
    Parameters:
      `featureType` - A QName representing the qualified name of some feature type.
    Returns:
      A Node (Element) node representing a feature instance.

  - ### insertRandomIdentifier

    public static UUID insertRandomIdentifier(Element feature)
    Inserts a user-assigned gml:identifier element having a random UUID value. An existing identifier is replaced.
    Parameters:
      `feature` - An Element node representing a GML feature.
    Returns:
      The UUID that was assigned to the feature instance.

  - ### addRandomName

    public static String addRandomName(Element feature)
    Adds a gml:name element to the given feature representation. The first name will be replaced if one or more are already present.
    Parameters:
      `feature` - An Element node representing a GML feature.
    Returns:
      The name that was assigned to the feature instance.