<commit_before>@api @TestAlsoOnExternalUserBackend @smokeTest @public_link_share-feature-required @skipOnOcV10.0 @skipOnOcis @issue-ocis-reva-172
Feature: set timeouts of LOCKS

  Background:
    Given user "Alice" has been created with default attributes and skeleton files

  Scenario Outline: do not set timeout on folder and check the default timeout
    Given using <dav-path> DAV path
    And parameter "lock_timeout_default" of app "core" has been set to "<default-timeout>"
    And parameter "lock_timeout_max" of app "core" has been set to "<max-timeout>"
    When user "Alice" locks folder "PARENT" using the WebDAV API setting following properties
      | lockscope | exclusive |
    And user "Alice" gets the following properties of folder "PARENT" using the WebDAV API
      | propertyName    |
      | d:lockdiscovery |
    Then the value of the item "//d:timeout" in the response should match "<result>"
    When user "Alice" gets the following properties of folder "PARENT/CHILD" using the WebDAV API
      | propertyName    |
      | d:lockdiscovery |
    Then the value of the item "//d:timeout" in the response should match "<result>"
    When user "Alice" gets the following properties of folder "PARENT/parent.txt" using the WebDAV API
      | propertyName    |
      | d:lockdiscovery |
    Then the value of the item "//d:timeout" in the response should match "<result>"
    # consider a drift of 5 seconds between setting the lock and retrieving it
    Examples:
      | dav-path | default-timeout | max-timeout | result                     |
      | old      | 120             | 3600        | /Second-(120\|11[5-9])$/   |
      | old      | 99999           | 3600        | /Second-(3600\|359[5-9])$/ |
      | new      | 120             | 3600        | /Second-(120\|11[5-9])$/   |
      | new      | 99999           | 3600        | /Second-(3600\|359[5-9])$/ |

  Scenario Outline: set timeout on folder
    Given using <dav-path> DAV path
    When user "Alice" locks folder "PARENT" using the WebDAV API setting following properties
      | lockscope | shared    |
      | timeout   | <timeout> |
    And user "Alice" gets the following properties of folder "PARENT" using the WebDAV API
      | propertyName    |
      | d:lockdiscovery |
    Then the value of the item "//d:timeout" in the response to user "Alice" should match "<result>"
    When user "Alice" gets the following properties of folder "PARENT/CHILD" using the WebDAV API
      | propertyName    |
      | d:lockdiscovery |
    Then the value of the item "//d:timeout" in the response to user "Alice" should match "<result>"
    When user "Alice" gets the following properties of folder "PARENT/parent.txt" using the WebDAV API
      | propertyName    |
      | d:lockdiscovery |
    Then the value of the item "//d:timeout" in the response to user "Alice" should match "<result>"
    Examples:
      | dav-path | timeout         | result          |
      | old      | second-999      | /Second-\d{3}$/ |
      | old      | second-99999999 | /Second-\d{5}$/ |
      | old      | infinite        | /Second-\d{5}$/ |
      | old      | second--1       | /Second-\d{5}$/ |
      | old      | second-0        | /Second-\d{4}$/ |
      | new      | second-999      | /Second-\d{3}$/ |
      | new      | second-99999999 | /Second-\d{5}$/ |
      | new      | infinite        | /Second-\d{5}$/ |
      | new      | second--1       | /Second-\d{5}$/ |
      | new      | second-0        | /Second-\d{4}$/ |

  Scenario Outline: set timeout over the maximum on folder
    Given using <dav-path> DAV path
    And parameter "lock_timeout_default" of app "core" has been set to "<default-timeout>"
    And parameter "lock_timeout_max" of app "core" has been set to "<max-timeout>"
    When user "Alice" locks folder "PARENT" using the WebDAV API setting following properties
      | lockscope | shared    |
      | timeout   | <timeout> |
    And user "Alice" gets the following properties of folder "PARENT" using the WebDAV API
      | propertyName    |
      | d:lockdiscovery |
    Then the value of the item "//d:timeout" in the response should match "<result>"
    When user "Alice" gets the following properties of folder "PARENT/CHILD" using the WebDAV API
      | propertyName    |
      | d:lockdiscovery |
    Then the value of the item "//d:timeout" in the response should match "<result>"<commit_msg>skip new 'set lock timeout' tests when running against old core versions<commit_after>@api @TestAlsoOnExternalUserBackend @smokeTest @public_link_share-feature-required @skipOnOcV10.0 @skipOnOcis @issue-ocis-reva-172
Feature: set timeouts of LOCKS

  Background:
    Given user "Alice" has been created with default attributes and skeleton files

  @skipOnOcV10.3 @skipOnOcV10.4
  Scenario Outline: do not set timeout on folder and check the default timeout
    Given using <dav-path> DAV path
    And parameter "lock_timeout_default" of app "core" has been set to "<default-timeout>"
    And parameter "lock_timeout_max" of app "core" has been set to "<max-timeout>"
    When user "Alice" locks folder "PARENT" using the WebDAV API setting following properties
      | lockscope | exclusive |
    And user "Alice" gets the following properties of folder "PARENT" using the WebDAV API
      | propertyName    |
      | d:lockdiscovery |
    Then the value of the item "//d:timeout" in the response should match "<result>"
    When user "Alice" gets the following properties of folder "PARENT/CHILD" using the WebDAV API
      | propertyName    |
      | d:lockdiscovery |
    Then the value of the item "//d:timeout" in the response should match "<result>"
    When user "Alice" gets the following properties of folder "PARENT/parent.txt" using the WebDAV API
      | propertyName    |
      | d:lockdiscovery |
    Then the value of the item "//d:timeout" in the response should match "<result>"
    # consider a drift of 5 seconds between setting the lock and retrieving it
    Examples:
      | dav-path | default-timeout | max-timeout | result                     |
      | old      | 120             | 3600        | /Second-(120\|11[5-9])$/   |
      | old      | 99999           | 3600        | /Second-(3600\|359[5-9])$/ |
      | new      | 120             | 3600        | /Second-(120\|11[5-9])$/   |
      | new      | 99999           | 3600        | /Second-(3600\|359[5-9])$/ |

  Scenario Outline: set timeout on folder
    Given using <dav-path> DAV path
    When user "Alice" locks folder "PARENT" using the WebDAV API setting following properties
      | lockscope | shared    |
      | timeout   | <timeout> |
    And user "Alice" gets the following properties of folder "PARENT" using the WebDAV API
      | propertyName    |
      | d:lockdiscovery |
    Then the value of the item "//d:timeout" in the response to user "Alice" should match "<result>"
    When user "Alice" gets the following properties of folder "PARENT/CHILD" using the WebDAV API
      | propertyName    |
      | d:lockdiscovery |
    Then the value of the item "//d:timeout" in the response to user "Alice" should match "<result>"
    When user "Alice" gets the following properties of folder "PARENT/parent.txt" using the WebDAV API
      | propertyName    |
      | d:lockdiscovery |
    Then the value of the item "//d:timeout" in the response to user "Alice" should match "<result>"
    Examples:
      | dav-path | timeout         | result          |
      | old      | second-999      | /Second-\d{3}$/ |
      | old      | second-99999999 | /Second-\d{5}$/ |
      | old      | infinite        | /Second-\d{5}$/ |
      | old      | second--1       | /Second-\d{5}$/ |
      | old      | second-0        | /Second-\d{4}$/ |
      | new      | second-999      | /Second-\d{3}$/ |
      | new      | second-99999999 | /Second-\d{5}$/ |
      | new      | infinite        | /Second-\d{5}$/ |
      | new      | second--1       | /Second-\d{5}$/ |
      | new      | second-0        | /Second-\d{4}$/ |

  @skipOnOcV10.3 @skipOnOcV10.4
  Scenario Outline: set timeout over the maximum on folder
    Given using <dav-path> DAV path
    And parameter "lock_timeout_default" of app "core" has been set to "<default-timeout>"
    And parameter "lock_timeout_max" of app "core" has been set to "<max-timeout>"
    When user "Alice" locks folder "PARENT" using the WebDAV API setting following properties
      | lockscope | shared    |
      | timeout   | <timeout> |
    And user "Alice" gets the following properties of folder "PARENT" using the WebDAV API
      | propertyName    |
      | d:lockdiscovery |
    Then the value of the item "//d:timeout" in the response should match "<result>"
    When user "Alice" gets the following properties of folder "PARENT/CHILD" using the WebDAV API
      | propertyName    |
      | d:lockdiscovery |
    Then the value of the item "//d:timeout" in the response should match "<result>"
{'fraction_non_alphanumeric': 0.103421200224341, 'fraction_numerical': 0.025350532809871006, 'mean_word_length': 2.3544018058690743, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 4, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '979435', 'n_tokens_mistral': 2774, 'n_tokens_neox': 2587, 'n_words': 954}