Class MongoUnitProperties

java.lang.Object
org.mongounit.config.MongoUnitProperties

public class MongoUnitProperties extends Object
MongoUnitProperties class is a holder for mongounit.properties property values.
  • Field Details

    • MONGO_UNIT_PROPERTIES_FILE_URI

      public static final String MONGO_UNIT_PROPERTIES_FILE_URI
      Classpath-based mongounit.properties URI.
      See Also:
    • BASE_URI_PROP_NAME

      public static final String BASE_URI_PROP_NAME
      Base URI property name that is looked for in mongounit.properties file.
      See Also:
    • BASE_URI_KEEP_AS_IS_PROP_NAME

      public static final String BASE_URI_KEEP_AS_IS_PROP_NAME
      'Base URI keep as is' property name that is looked for in mongounit.properties file.
      See Also:
    • MONGO_UNIT_FIELD_NAME_PROP_NAME

      public static final String MONGO_UNIT_FIELD_NAME_PROP_NAME
      Name of the property that specifies the field name to indicate that a document represents a special MongoUnit field instead of a regular document.
      See Also:
    • DROP_DATABASE_PROP_NAME

      public static final String DROP_DATABASE_PROP_NAME
      Name of the property that specifies if the test database should be dropped so there is no need for manual cleanup.
      See Also:
    • TIME_ZONE_ID_PROP_NAME

      public static final String TIME_ZONE_ID_PROP_NAME
      Name of the property that specifies the time zone ID to use for the database name pad.
      See Also:
    • DEFAULT_MONGO_UNIT_VALUE_INDICATOR_FIELD_NAME

      public static final String DEFAULT_MONGO_UNIT_VALUE_INDICATOR_FIELD_NAME
      Default field name to use in developer JSON files to signify that a document is a representation of a special MongoUnit value. If the JSON is meant to seed the database, the special field will be in the format of "indicatorBsonType": value, e.g., "$$DATE_TIME": value. The value of the 'BsonType' portion of the field name is to specify a BSON type value based on the naming in BsonType. If the JSON is meant as an expected assertion match, 'comparator' field is expected as a sibling field name.
      See Also:
  • Constructor Details

    • MongoUnitProperties

      public MongoUnitProperties()
      Default constructor.
    • MongoUnitProperties

      public MongoUnitProperties(String baseUri, Boolean baseUriKeepAsIs, String mongoUnitValueFieldNameIndicator, Boolean dropDatabase, String timeZoneId)
      Constructor. NOTE: Passing 'null' to any of the arguments sets those arguments to their default value.
      Parameters:
      baseUri - Base URI to base the dynamic database name on.
      baseUriKeepAsIs - Flag to indicate that the base URI should be used for testing as is, without appending anything to it.
      mongoUnitValueFieldNameIndicator - Field name to use as an indicator in developer JSON files to signify that a document is a representation of a special MongoUnit BSON value that specifies BSON value type based on the naming in BsonType enum.
      dropDatabase - Flag to indicate if the test database should be dropped after all the tests have run.
      timeZoneId - Time zone ID to use in the database name pad.
  • Method Details

    • getBaseUri

      public String getBaseUri()
      Returns:
      Base URI to base the dynamic database name on.
    • isBaseUriKeepAsIs

      public boolean isBaseUriKeepAsIs()
      Returns:
      Flag to indicate that the base URI should be used for testing as is, without appending anything to it.
    • getMongoUnitValueFieldNameIndicator

      public String getMongoUnitValueFieldNameIndicator()
      Returns ield name to use as an indicator in developer JSON files to signify that a document is a representation of a special MongoUnit value. If the JSON is meant to seed the database, 'bsonType' and 'value' field names are expected as sibling field names. The value of the 'bsonType' field is to specify a BSON type value based on the naming in BsonType. If the JSON is meant as an expected assertion match, 'comparator' field is expected as a singling fiend name.
      Returns:
      Field name to use as an indicator in developer JSON files to signify that a document is a representation of a special MongoUnit value.
    • isDropDatabase

      public boolean isDropDatabase()
      Returns:
      Flag to indicate if the test database should be dropped after all the tests have run.
    • getTimeZoneId

      public String getTimeZoneId()
      Returns:
      Time zone ID to use in the database name pad.
    • toString

      public String toString()
      Overrides:
      toString in class Object