<commit_before>Feature: Support SIRI GeneralMessage for Situation

  Background:
      Given a Referential "test" is created

  Scenario: 3797 - Ignore situations associatd to the Commercial channel
    Given a Situation exists with the following attributes:
      | ObjectIDs               | "internal" : "1"                                 |
      | RecordedAt              | 2017-01-01T03:30:06+02:00                        |
      | Version                 | 1                                                |
      | Channel                 | Commercial                                       |
      | ValidUntil              | 2017-01-01T20:30:06+02:00                        |
      | Messages[0]#MessageType | longMessage                                      |
      | Messages[0]#MessageText | Les situations commercials doivent être ignorées |
      | References[0]           | LineRef:{"internal":"NINOXE:Line:3:LOC"}         |
    And a Situation exists with the following attributes:
      | ObjectIDs               | "internal" : "2"                         |
      | RecordedAt              | 2017-01-01T03:30:06+02:00                |
      | Version                 | 1                                        |
      | Channel                 | Perturbations                            |
      | ValidUntil              | 2017-01-01T20:30:06+02:00                |
      | Messages[0]#MessageType | longMessage                              |
      | Messages[0]#MessageText | Les autres non                           |
      | References[0]           | LineRef:{"internal":"NINOXE:Line:3:LOC"} |
    And a Line exists with the following attributes:
      | ObjectIDs | "internal": "NINOXE:Line:3:LOC" |
      | Name      | Ligne 3 Metro                   |
    And a Partner "test" exists with connectors [siri-general-message-request-broadcaster] and the following settings:
      | local_credential     | TestPartner |
      | remote_objectid_kind | internal    |
    When I send this SIRI request
      """
      <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
      <S:Body>
        <ns7:GetGeneralMessage xmlns:ns2="http://www.siri.org.uk/siri" xmlns:ns3="http://www.ifopt.org.uk/acsb" xmlns:ns4="http://www.ifopt.org.uk/ifopt" xmlns:ns5="http://datex2.eu/schema/2_0RC1/2_0" xmlns:ns6="http://wsdl.siri.org.uk/siri" xmlns:ns7="http://wsdl.siri.org.uk">
          <ServiceRequestInfo>
            <ns2:RequestTimestamp>2017-01-01T12:00:00.000Z</ns2:RequestTimestamp>
            <ns2:RequestorRef>TestPartner</ns2:RequestorRef>
            <ns2:MessageIdentifier>GeneralMessage:Test:0</ns2:MessageIdentifier>
          </ServiceRequestInfo>
          <Request version="2.0:FR-IDF-2.4">
            <ns2:RequestTimestamp>2017-01-01T12:00:00.000Z</ns2:RequestTimestamp>
            <ns2:MessageIdentifier>GeneralMessage:Test:0</ns2:MessageIdentifier>
            <ns2:Extensions>
              <ns6:IDFGeneralMessageRequestFilter>
              </ns6:IDFGeneralMessageRequestFilter>
            </ns2:Extensions>
          </Request>
          <RequestExtension/>
        </ns7:GetGeneralMessage>
      </S:Body>
    </S:Envelope>
      """
    Then I should receive this SIRI response
      """
      <?xml version='1.0' encoding='utf-8'?>
      <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
        <S:Body>
          <ns8:GetGeneralMessageResponse xmlns:ns3="http://www.siri.org.uk/siri"
          xmlns:ns4="http://www.ifopt.org.uk/acsb"
          xmlns:ns5="http://www.ifopt.org.uk/ifopt"
          xmlns:ns6="http://datex2.eu/schema/2_0RC1/2_0"
          xmlns:ns7="http://scma/siri"
          xmlns:ns8="http://wsdl.siri.org.uk"
          xmlns:ns9="http://wsdl.siri.org.uk/siri">
            <ServiceDeliveryInfo>
              <ns3:ResponseTimestamp>2017-01-01T12:00:00.000Z</ns3:ResponseTimestamp>
              <ns3:ProducerRef>Edwig</ns3:ProducerRef>
              <ns3:ResponseMessageIdentifier>RATPDev:ResponseMessage::6ba7b814-9dad-11d1-5-00c04fd430c8:LOC</ns3:ResponseMessageIdentifier>
              <ns3:RequestMessageRef>GeneralMessage:Test:0</ns3:RequestMessageRef>
            </ServiceDeliveryInfo>
            <Answer>
              <ns3:GeneralMessageDelivery version="2.0:FR-IDF-2.4">
                <ns3:ResponseTimestamp>2017-01-01T12:00:00.000Z</ns3:ResponseTimestamp>
                <ns3:Status>true</ns3:Status>
                <ns3:GeneralMessage formatRef="STIF-IDF">
                  <ns3:RecordedAtTime>2017-01-01T03:30:06.000+02:00</ns3:RecordedAtTime>
                  <ns3:ItemIdentifier>RATPDev:Item::6ba7b814-9dad-11d1-6-00c04fd430c8:LOC</ns3:ItemIdentifier>
                  <ns3:InfoMessageIdentifier>2</ns3:InfoMessageIdentifier>
                  <ns3:InfoMessageVersion>1</ns3:InfoMessageVersion>
                  <ns3:InfoChannelRef>Perturbations</ns3:InfoChannelRef>
                  <ns3:ValidUntilTime>2017-01-01T20:30:06.000+02:00</ns3:ValidUntilTime>
                  <ns3:Content xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:type='ns9:IDFLineSectionStructure'>
                    <ns3:LineRef>NINOXE:Line:3:LOC</ns3:LineRef>
                    <ns3:Message>
                      <ns3:MessageType>longMessage</ns3:MessageType>
                      <ns3:MessageText>Les autres non</ns3:MessageText>
                    </ns3:Message>
                  </ns3:Content>
                </ns3:GeneralMessage>
              </ns3:GeneralMessageDelivery>
            </Answer>
            <AnswerExtension />
          </ns8:GetGeneralMessageResponse>
        </S:Body>
      </S:Envelope>
      """

  # Should be fixed by 3800 and 3801
  # Same as previous scenario
  @wip
  Scenario: 3008 - Handle a SIRI GetGeneralMessage request
    Given a Situation exists with the following attributes:
      | ObjectIDs               | "external" : "test"                                                        |
      | RecordedAt              | 2017-01-01T03:30:06+02:00                                                  |
      | Version                 | 1                                                                          |
      | Channel                 | Perturbation                                                               |
      | ValidUntil              | 2017-01-01T20:30:06+02:00                                                  |
      | Messages[0]#MessageType | longMessage                                                                |
      | Messages[0]#MessageText | La nouvelle carte d'abonnement est disponible au points de vente du réseau |
      | References[0]           | LineRef:{"internal":"NINOXE:Line:3:LOC"} |
    And a Line exists with the following attributes:
      | ObjectIDs | "internal": "NINOXE:Line:3:LOC" |
      | Name      | Ligne 3 Metro                   |
    And a Partner "test" exists with connectors [siri-general-message-request-broadcaster] and the following settings:
      | local_credential     | NINOXE:default |
      | remote_objectid_kind | external       |
    When I send this SIRI request
      """
      <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
      <S:Body>
        <ns7:GetGeneralMessage xmlns:ns2="http://www.siri.org.uk/siri" xmlns:ns3="http://www.ifopt.org.uk/acsb" xmlns:ns4="http://www.ifopt.org.uk/ifopt" xmlns:ns5="http://datex2.eu/schema/2_0RC1/2_0" xmlns:ns6="http://wsdl.siri.org.uk/siri" xmlns:ns7="http://wsdl.siri.org.uk">
          <ServiceRequestInfo>
            <ns2:RequestTimestamp>2017-01-01T12:00:00.000Z</ns2:RequestTimestamp>
            <ns2:RequestorRef>NINOXE:default</ns2:RequestorRef>
            <ns2:MessageIdentifier>GeneralMessage:Test:0</ns2:MessageIdentifier>
          </ServiceRequestInfo>
          <Request version="2.0:FR-IDF-2.4">
            <ns2:RequestTimestamp>2017-01-01T12:00:00.000Z</ns2:RequestTimestamp>
            <ns2:MessageIdentifier>GeneralMessage:Test:0</ns2:MessageIdentifier>
            <ns2:Extensions>
              <ns6:IDFGeneralMessageRequestFilter>
              </ns6:IDFGeneralMessageRequestFilter>
            </ns2:Extensions>
          </Request>
          <RequestExtension/>
        </ns7:GetGeneralMessage>
      </S:Body>
    </S:Envelope>
      """
    Then I should receive this SIRI response
      """
      <?xml version='1.0' encoding='utf-8'?>
      <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
        <S:Body>
          <ns8:GetGeneralMessageResponse xmlns:ns3="http://www.siri.org.uk/siri"
          xmlns:ns4="http://www.ifopt.org.uk/acsb"
          xmlns:ns5="http://www.ifopt.org.uk/ifopt"
          xmlns:ns6="http://datex2.eu/schema/2_0RC1/2_0"
          xmlns:ns7="http://scma/siri"
          xmlns:ns8="http://wsdl.siri.org.uk"
          xmlns:ns9="http://wsdl.siri.org.uk/siri">
            <ServiceDeliveryInfo>
              <ns3:ResponseTimestamp>2017-01-01T12:00:00.000Z</ns3:ResponseTimestamp>
              <ns3:ProducerRef>Edwig</ns3:ProducerRef>
              <ns3:ResponseMessageIdentifier>RATPDev:ResponseMessage::6ba7b814-9dad-11d1-4-00c04fd430c8:LOC</ns3:ResponseMessageIdentifier>
              <ns3:RequestMessageRef>GeneralMessage:Test:0</ns3:RequestMessageRef>
            </ServiceDeliveryInfo>
            <Answer>
              <ns3:GeneralMessageDelivery version="2.0:FR-IDF-2.4">
                <ns3:ResponseTimestamp>2017-01-01T12:00:00.000Z</ns3:ResponseTimestamp>
                <ns3:Status>true</ns3:Status>
                <ns3:GeneralMessage>
                  <ns3:formatRef>STIF-IDF</ns3:formatRef>
                  <ns3:RecordedAtTime>2017-01-01T03:30:06.000+02:00</ns3:RecordedAtTime>
                  <ns3:ItemIdentifier>RATPDev:Item::6ba7b814-9dad-11d1-4-00c04fd430c8:LOC</ns3:ItemIdentifier>
                  <ns3:InfoMessageIdentifier>test</ns3:InfoMessageIdentifier>
                  <ns3:InfoMessageVersion>1</ns3:InfoMessageVersion>
                  <ns3:InfoChannelRef>Perturbation</ns3:InfoChannelRef>
                  <ns3:ValidUntilTime>2017-01-01T20:30:06.000+02:00</ns3:ValidUntilTime>
                  <ns3:Content xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns9:IDFLineSectionStructure">
                    <ns3:LineRef>NINOXE:Line:3:LOC</ns3:LineRef>
                    <ns3:Message>
                      <ns3:MessageType>longMessage</ns3:MessageType>
                      <ns3:MessageText>La nouvelle carte d'abonnement est disponible au points de vente du réseau</ns3:MessageText>
                    </ns3:Message>
                  </ns3:Content>
                </ns3:GeneralMessage>
              </ns3:GeneralMessageDelivery><commit_msg>Fix wrong objectid kind in cucumber test<commit_after>Feature: Support SIRI GeneralMessage for Situation

  Background:
      Given a Referential "test" is created

  Scenario: 3797 - Ignore situations associatd to the Commercial channel
    Given a Situation exists with the following attributes:
      | ObjectIDs               | "internal" : "1"                                 |
      | RecordedAt              | 2017-01-01T03:30:06+02:00                        |
      | Version                 | 1                                                |
      | Channel                 | Commercial                                       |
      | ValidUntil              | 2017-01-01T20:30:06+02:00                        |
      | Messages[0]#MessageType | longMessage                                      |
      | Messages[0]#MessageText | Les situations commercials doivent être ignorées |
      | References[0]           | LineRef:{"internal":"NINOXE:Line:3:LOC"}         |
    And a Situation exists with the following attributes:
      | ObjectIDs               | "internal" : "2"                         |
      | RecordedAt              | 2017-01-01T03:30:06+02:00                |
      | Version                 | 1                                        |
      | Channel                 | Perturbations                            |
      | ValidUntil              | 2017-01-01T20:30:06+02:00                |
      | Messages[0]#MessageType | longMessage                              |
      | Messages[0]#MessageText | Les autres non                           |
      | References[0]           | LineRef:{"internal":"NINOXE:Line:3:LOC"} |
    And a Line exists with the following attributes:
      | ObjectIDs | "internal": "NINOXE:Line:3:LOC" |
      | Name      | Ligne 3 Metro                   |
    And a Partner "test" exists with connectors [siri-general-message-request-broadcaster] and the following settings:
      | local_credential     | TestPartner |
      | remote_objectid_kind | internal    |
    When I send this SIRI request
      """
      <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
      <S:Body>
        <ns7:GetGeneralMessage xmlns:ns2="http://www.siri.org.uk/siri" xmlns:ns3="http://www.ifopt.org.uk/acsb" xmlns:ns4="http://www.ifopt.org.uk/ifopt" xmlns:ns5="http://datex2.eu/schema/2_0RC1/2_0" xmlns:ns6="http://wsdl.siri.org.uk/siri" xmlns:ns7="http://wsdl.siri.org.uk">
          <ServiceRequestInfo>
            <ns2:RequestTimestamp>2017-01-01T12:00:00.000Z</ns2:RequestTimestamp>
            <ns2:RequestorRef>TestPartner</ns2:RequestorRef>
            <ns2:MessageIdentifier>GeneralMessage:Test:0</ns2:MessageIdentifier>
          </ServiceRequestInfo>
          <Request version="2.0:FR-IDF-2.4">
            <ns2:RequestTimestamp>2017-01-01T12:00:00.000Z</ns2:RequestTimestamp>
            <ns2:MessageIdentifier>GeneralMessage:Test:0</ns2:MessageIdentifier>
            <ns2:Extensions>
              <ns6:IDFGeneralMessageRequestFilter>
              </ns6:IDFGeneralMessageRequestFilter>
            </ns2:Extensions>
          </Request>
          <RequestExtension/>
        </ns7:GetGeneralMessage>
      </S:Body>
    </S:Envelope>
      """
    Then I should receive this SIRI response
      """
      <?xml version='1.0' encoding='utf-8'?>
      <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
        <S:Body>
          <ns8:GetGeneralMessageResponse xmlns:ns3="http://www.siri.org.uk/siri"
          xmlns:ns4="http://www.ifopt.org.uk/acsb"
          xmlns:ns5="http://www.ifopt.org.uk/ifopt"
          xmlns:ns6="http://datex2.eu/schema/2_0RC1/2_0"
          xmlns:ns7="http://scma/siri"
          xmlns:ns8="http://wsdl.siri.org.uk"
          xmlns:ns9="http://wsdl.siri.org.uk/siri">
            <ServiceDeliveryInfo>
              <ns3:ResponseTimestamp>2017-01-01T12:00:00.000Z</ns3:ResponseTimestamp>
              <ns3:ProducerRef>Edwig</ns3:ProducerRef>
              <ns3:ResponseMessageIdentifier>RATPDev:ResponseMessage::6ba7b814-9dad-11d1-5-00c04fd430c8:LOC</ns3:ResponseMessageIdentifier>
              <ns3:RequestMessageRef>GeneralMessage:Test:0</ns3:RequestMessageRef>
            </ServiceDeliveryInfo>
            <Answer>
              <ns3:GeneralMessageDelivery version="2.0:FR-IDF-2.4">
                <ns3:ResponseTimestamp>2017-01-01T12:00:00.000Z</ns3:ResponseTimestamp>
                <ns3:Status>true</ns3:Status>
                <ns3:GeneralMessage formatRef="STIF-IDF">
                  <ns3:RecordedAtTime>2017-01-01T03:30:06.000+02:00</ns3:RecordedAtTime>
                  <ns3:ItemIdentifier>RATPDev:Item::6ba7b814-9dad-11d1-6-00c04fd430c8:LOC</ns3:ItemIdentifier>
                  <ns3:InfoMessageIdentifier>2</ns3:InfoMessageIdentifier>
                  <ns3:InfoMessageVersion>1</ns3:InfoMessageVersion>
                  <ns3:InfoChannelRef>Perturbations</ns3:InfoChannelRef>
                  <ns3:ValidUntilTime>2017-01-01T20:30:06.000+02:00</ns3:ValidUntilTime>
                  <ns3:Content xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:type='ns9:IDFLineSectionStructure'>
                    <ns3:LineRef>NINOXE:Line:3:LOC</ns3:LineRef>
                    <ns3:Message>
                      <ns3:MessageType>longMessage</ns3:MessageType>
                      <ns3:MessageText>Les autres non</ns3:MessageText>
                    </ns3:Message>
                  </ns3:Content>
                </ns3:GeneralMessage>
              </ns3:GeneralMessageDelivery>
            </Answer>
            <AnswerExtension />
          </ns8:GetGeneralMessageResponse>
        </S:Body>
      </S:Envelope>
      """

  Scenario: 3008 - Handle a SIRI GetGeneralMessage request
    Given a Situation exists with the following attributes:
      | ObjectIDs               | "external" : "test"                                                        |
      | RecordedAt              | 2017-01-01T03:30:06+02:00                                                  |
      | Version                 | 1                                                                          |
      | Channel                 | Perturbation                                                               |
      | ValidUntil              | 2017-01-01T20:30:06+02:00                                                  |
      | Messages[0]#MessageType | longMessage                                                                |
      | Messages[0]#MessageText | La nouvelle carte d'abonnement est disponible au points de vente du réseau |
      | References[0]           | LineRef:{"external":"NINOXE:Line:3:LOC"} |
    And a Line exists with the following attributes:
      | ObjectIDs | "external": "NINOXE:Line:3:LOC" |
      | Name      | Ligne 3 Metro                   |
    And a Partner "test" exists with connectors [siri-general-message-request-broadcaster] and the following settings:
      | local_credential     | NINOXE:default |
      | remote_objectid_kind | external       |
    When I send this SIRI request
      """
      <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
      <S:Body>
        <ns7:GetGeneralMessage xmlns:ns2="http://www.siri.org.uk/siri" xmlns:ns3="http://www.ifopt.org.uk/acsb" xmlns:ns4="http://www.ifopt.org.uk/ifopt" xmlns:ns5="http://datex2.eu/schema/2_0RC1/2_0" xmlns:ns6="http://wsdl.siri.org.uk/siri" xmlns:ns7="http://wsdl.siri.org.uk">
          <ServiceRequestInfo>
            <ns2:RequestTimestamp>2017-01-01T12:00:00.000Z</ns2:RequestTimestamp>
            <ns2:RequestorRef>NINOXE:default</ns2:RequestorRef>
            <ns2:MessageIdentifier>GeneralMessage:Test:0</ns2:MessageIdentifier>
          </ServiceRequestInfo>
          <Request version="2.0:FR-IDF-2.4">
            <ns2:RequestTimestamp>2017-01-01T12:00:00.000Z</ns2:RequestTimestamp>
            <ns2:MessageIdentifier>GeneralMessage:Test:0</ns2:MessageIdentifier>
            <ns2:Extensions>
              <ns6:IDFGeneralMessageRequestFilter>
              </ns6:IDFGeneralMessageRequestFilter>
            </ns2:Extensions>
          </Request>
          <RequestExtension/>
        </ns7:GetGeneralMessage>
      </S:Body>
    </S:Envelope>
      """
    Then I should receive this SIRI response
      """
      <?xml version='1.0' encoding='utf-8'?>
      <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
        <S:Body>
          <ns8:GetGeneralMessageResponse xmlns:ns3="http://www.siri.org.uk/siri"
          xmlns:ns4="http://www.ifopt.org.uk/acsb"
          xmlns:ns5="http://www.ifopt.org.uk/ifopt"
          xmlns:ns6="http://datex2.eu/schema/2_0RC1/2_0"
          xmlns:ns7="http://scma/siri"
          xmlns:ns8="http://wsdl.siri.org.uk"
          xmlns:ns9="http://wsdl.siri.org.uk/siri">
            <ServiceDeliveryInfo>
              <ns3:ResponseTimestamp>2017-01-01T12:00:00.000Z</ns3:ResponseTimestamp>
              <ns3:ProducerRef>Edwig</ns3:ProducerRef>
              <ns3:ResponseMessageIdentifier>RATPDev:ResponseMessage::6ba7b814-9dad-11d1-4-00c04fd430c8:LOC</ns3:ResponseMessageIdentifier>
              <ns3:RequestMessageRef>GeneralMessage:Test:0</ns3:RequestMessageRef>
            </ServiceDeliveryInfo>
            <Answer>
              <ns3:GeneralMessageDelivery version="2.0:FR-IDF-2.4">
                <ns3:ResponseTimestamp>2017-01-01T12:00:00.000Z</ns3:ResponseTimestamp>
                <ns3:Status>true</ns3:Status>
                <ns3:GeneralMessage formatRef="STIF-IDF">
                  <ns3:RecordedAtTime>2017-01-01T03:30:06.000+02:00</ns3:RecordedAtTime>
                  <ns3:ItemIdentifier>RATPDev:Item::6ba7b814-9dad-11d1-5-00c04fd430c8:LOC</ns3:ItemIdentifier>
                  <ns3:InfoMessageIdentifier>test</ns3:InfoMessageIdentifier>
                  <ns3:InfoMessageVersion>1</ns3:InfoMessageVersion>
                  <ns3:InfoChannelRef>Perturbation</ns3:InfoChannelRef>
                  <ns3:ValidUntilTime>2017-01-01T20:30:06.000+02:00</ns3:ValidUntilTime>
                  <ns3:Content xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns9:IDFLineSectionStructure">
                    <ns3:LineRef>NINOXE:Line:3:LOC</ns3:LineRef>
                    <ns3:Message>
                      <ns3:MessageType>longMessage</ns3:MessageType>
                      <ns3:MessageText>La nouvelle carte d'abonnement est disponible au points de vente du réseau</ns3:MessageText>
                    </ns3:Message>
                  </ns3:Content>
                </ns3:GeneralMessage>
              </ns3:GeneralMessageDelivery>
{'fraction_non_alphanumeric': 0.12291529256572128, 'fraction_numerical': 0.06030340148874022, 'mean_word_length': 1.8794085729788388, 'pattern_counts': {'":': 10, '<': 295, '<?xml version=': 4, '>': 295, 'https://': 0, 'lorem ipsum': 0, 'www.': 28, 'xml': 76}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 42, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3106671', 'n_tokens_mistral': 7171, 'n_tokens_neox': 6480, 'n_words': 761}