text:
<?xml version="1.0" encoding="UTF-8"?>
<con:soapui-project abortOnError="false" name="EntityDocRetrieve" resourceRoot="${projectDir}" runType="SEQUENTIAL" soapui-version="5.1.2" activeEnvironment="Default" id="6c3e0978-6076-4cbc-9b33-031dea1e4798" xmlns:con="http://eviware.com/soapui/config">
  <con:settings/>
  <con:interface anonymous="optional" bindingName="{urn:gov:hhs:fha:nhinc:entitydocretrieve}EntityDocRetrieveBindingSoap" definition="../../../target/wsdl/EntityDocRetrieve.wsdl" name="EntityDocRetrieveBindingSoap" soapVersion="1_2" type="wsdl" wsaVersion="NONE" xsi:type="con:WsdlInterface" id="c7008579-cb78-4247-8fd8-cadac4072f81" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <con:settings/>
    <con:endpoints>
      <con:endpoint>http://localhost:${HttpDefaultPort}/Gateway/DocumentRetrieve/2_0/EntityService/EntityDocRetrieve</con:endpoint>
      <con:endpoint>http://localhost:${HttpDefaultPort}/NhinConnect/EntityDocRetrieve</con:endpoint>
    </con:endpoints>
    <con:operation action="urn:gov:hhs:fha:nhinc:entitydocretrieve:RespondingGateway_CrossGatewayRetrieveRequestMessage" anonymous="optional" bindingOperationName="RespondingGateway_CrossGatewayRetrieve" inputName="RespondingGateway_CrossGatewayRetrieveRequest" isOneWay="false" name="RespondingGateway_CrossGatewayRetrieve" outputName="RespondingGateway_CrossGatewayRetrieveResponse" receivesAttachments="false" sendsAttachments="false" type="Request-Response" id="f2648ca9-dddd-460d-9ad5-37544e330c94">
      <con:settings/>
      <con:call name="Request 1" id="fde8880f-349b-4332-9900-7e15a7ca7517">
        <con:settings/>
        <con:encoding>UTF-8</con:encoding>
        <con:endpoint>http://localhost:${HttpDefaultPort}/Gateway/DocumentRetrieve/2_0/EntityService/EntityDocRetrieve</con:endpoint>
        <con:request><![CDATA[<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:urn="urn:gov:hhs:fha:nhinc:common:nhinccommonentity" xmlns:urn1="urn:ihe:iti:xds-b:2007" xmlns:urn2="urn:gov:hhs:fha:nhinc:common:nhinccommon">
   <soap:Header/>
   <soap:Body>
      <urn:RespondingGateway_CrossGatewayRetrieveRequest>
         <urn1:RetrieveDocumentSetRequest>
            <!--1 or more repetitions:-->
            <urn1:DocumentRequest>
               <urn1:RepositoryUniqueId>?</urn1:RepositoryUniqueId>
               <urn1:DocumentUniqueId>?</urn1:DocumentUniqueId>
            </urn1:DocumentRequest>
         </urn1:RetrieveDocumentSetRequest>
         <urn:assertion>
            <urn2:address>
               <urn2:addressType>
                  <urn2:code>?</urn2:code>
                  <urn2:codeSystem>?</urn2:codeSystem>
                  <urn2:codeSystemName>?</urn2:codeSystemName>
                  <urn2:codeSystemVersion>?</urn2:codeSystemVersion>
                  <urn2:displayName>?</urn2:displayName>
                  <urn2:originalText>?</urn2:originalText>
               </urn2:addressType>
               <urn2:city>?</urn2:city>
               <urn2:country>?</urn2:country>
               <urn2:state>?</urn2:state>
               <urn2:streetAddress>?</urn2:streetAddress>
               <urn2:zipCode>?</urn2:zipCode>
            </urn2:address>
            <urn2:dateOfBirth>?</urn2:dateOfBirth>
            <urn2:explanationNonClaimantSignature>?</urn2:explanationNonClaimantSignature>
            <urn2:haveSecondWitnessSignature>?</urn2:haveSecondWitnessSignature>
            <urn2:haveSignature>?</urn2:haveSignature>
            <urn2:haveWitnessSignature>?</urn2:haveWitnessSignature>
            <urn2:homeCommunity>
               <urn2:description>?</urn2:description>
               <urn2:homeCommunityId>?</urn2:homeCommunityId>
               <urn2:name>?</urn2:name>
            </urn2:homeCommunity>
            <urn2:nationalProviderId>?</urn2:nationalProviderId>
            <urn2:personName>
               <urn2:familyName>?</urn2:familyName>
               <urn2:givenName>?</urn2:givenName>
               <urn2:nameType>
                  <urn2:code>?</urn2:code>
                  <urn2:codeSystem>?</urn2:codeSystem>
                  <urn2:codeSystemName>?</urn2:codeSystemName>
                  <urn2:codeSystemVersion>?</urn2:codeSystemVersion>
                  <urn2:displayName>?</urn2:displayName>
                  <urn2:originalText>?</urn2:originalText>
               </urn2:nameType>
               <urn2:secondNameOrInitials>?</urn2:secondNameOrInitials>
               <urn2:fullName>?</urn2:fullName>
               <urn2:prefix>?</urn2:prefix>
               <urn2:suffix>?</urn2:suffix>
            </urn2:personName>
            <urn2:phoneNumber>
               <urn2:areaCode>?</urn2:areaCode>
               <urn2:countryCode>?</urn2:countryCode>
               <urn2:extension>?</urn2:extension>
               <urn2:localNumber>?</urn2:localNumber>
               <urn2:phoneNumberType>
                  <urn2:code>?</urn2:code>
                  <urn2:codeSystem>?</urn2:codeSystem>
                  <urn2:codeSystemName>?</urn2:codeSystemName>
                  <urn2:codeSystemVersion>?</urn2:codeSystemVersion>
                  <urn2:displayName>?</urn2:displayName>
                  <urn2:originalText>?</urn2:originalText>
               </urn2:phoneNumberType>
            </urn2:phoneNumber>
            <urn2:secondWitnessAddress>
               <urn2:addressType>
                  <urn2:code>?</urn2:code>
                  <urn2:codeSystem>?</urn2:codeSystem>
                  <urn2:codeSystemName>?</urn2:codeSystemName>
                  <urn2:codeSystemVersion>?</urn2:codeSystemVersion>
                  <urn2:displayName>?</urn2:displayName>
                  <urn2:originalText>?</urn2:originalText>
               </urn2:addressType>
               <urn2:city>?</urn2:city>
               <urn2:country>?</urn2:country>
               <urn2:state>?</urn2:state>
               <urn2:streetAddress>?</urn2:streetAddress>
               <urn2:zipCode>?</urn2:zipCode>
            </urn2:secondWitnessAddress>
            <urn2:secondWitnessName>
               <urn2:familyName>?</urn2:familyName>
               <urn2:givenName>?</urn2:givenName>
               <urn2:nameType>
                  <urn2:code>?</urn2:code>
                  <urn2:codeSystem>?</urn2:codeSystem>
                  <urn2:codeSystemName>?</urn2:codeSystemName>
                  <urn2:codeSystemVersion>?</urn2:codeSystemVersion>
                  <urn2:displayName>?</urn2:displayName>
                  <urn2:originalText>?</urn2:originalText>
               </urn2:nameType>
               <urn2:secondNameOrInitials>?</urn2:secondNameOrInitials>
               <urn2:fullName>?</urn2:fullName>
               <urn2:prefix>?</urn2:prefix>
               <urn2:suffix>?</urn2:suffix>
            </urn2:secondWitnessName>
            <urn2:secondWitnessPhone>
               <urn2:areaCode>?</urn2:areaCode>
               <urn2:countryCode>?</urn2:countryCode>
               <urn2:extension>?</urn2:extension>
               <urn2:localNumber>?</urn2:localNumber>
               <urn2:phoneNumberType>
                  <urn2:code>?</urn2:code>
                  <urn2:codeSystem>?</urn2:codeSystem>
                  <urn2:codeSystemName>?</urn2:codeSystemName>
                  <urn2:codeSystemVersion>?</urn2:codeSystemVersion>
                  <urn2:displayName>?</urn2:displayName>
                  <urn2:originalText>?</urn2:originalText>
               </urn2:phoneNumberType>
            </urn2:secondWitnessPhone>
            <urn2:SSN>?</urn2:SSN>
            <!--1 or more repetitions:-->
            <urn2:uniquePatientId>?</urn2:uniquePatientId>
            <urn2:witnessAddress>
               <urn2:addressType>
                  <urn2:code>?</urn2:code>
                  <urn2:codeSystem>?</urn2:codeSystem>
                  <urn2:codeSystemName>?</urn2:codeSystemName>
                  <urn2:codeSystemVersion>?</urn2:codeSystemVersion>
                  <urn2:displayName>?</urn2:displayName>
                  <urn2:originalText>?</urn2:originalText>
               </urn2:addressType>
               <urn2:city>?</urn2:city>
               <urn2:country>?</urn2:country>
               <urn2:state>?</urn2:state>
               <urn2:streetAddress>?</urn2:streetAddress>
               <urn2:zipCode>?</urn2:zipCode>
            </urn2:witnessAddress>
            <urn2:witnessName>
               <urn2:familyName>?</urn2:familyName>
               <urn2:givenName>?</urn2:givenName>
               <urn2:nameType>
                  <urn2:code>?</urn2:code>
                  <urn2:codeSystem>?</urn2:codeSystem>
                  <urn2:codeSystemName>?</urn2:codeSystemName>
                  <urn2:codeSystemVersion>?</urn2:codeSystemVersion>
                  <urn2:displayName>?</urn2:displayName>
                  <urn2:originalText>?</urn2:originalText>
               </urn2:nameType>
               <urn2:secondNameOrInitials>?</urn2:secondNameOrInitials>
               <urn2:fullName>?</urn2:fullName>
               <urn2:prefix>?</urn2:prefix>
               <urn2:suffix>?</urn2:suffix>
            </urn2:witnessName>
            <urn2:witnessPhone>
               <urn2:areaCode>?</urn2:areaCode>
               <urn2:countryCode>?</urn2:countryCode>
               <urn2:extension>?</urn2:extension>
               <urn2:localNumber>?</urn2:localNumber>
               <urn2:phoneNumberType>
                  <urn2:code>?</urn2:code>
                  <urn2:codeSystem>?</urn2:codeSystem>
                  <urn2:codeSystemName>?</urn2:codeSystemName>
                  <urn2:codeSystemVersion>?</urn2:codeSystemVersion>
                  <urn2:displayName>?</urn2:displayName>
                  <urn2:originalText>?</urn2:originalText>
               </urn2:phoneNumberType>
            </urn2:witnessPhone>
            <urn2:userInfo>
               <urn2:personName>
                  <urn2:familyName>?</urn2:familyName>
                  <urn2:givenName>?</urn2:givenName>
                  <urn2:nameType>
                     <urn2:code>?</urn2:code>
                     <urn2:codeSystem>?</urn2:codeSystem>
                     <urn2:codeSystemName>?</urn2:codeSystemName>
                     <urn2:codeSystemVersion>?</urn2:codeSystemVersion>
                     <urn2:displayName>?</urn2:displayName>
                     <urn2:originalText>?</urn2:originalText>
                  </urn2:nameType>
                  <urn2:secondNameOrInitials>?</urn2:secondNameOrInitials>
                  <urn2:fullName>?</urn2:fullName>
                  <urn2:prefix>?</urn2:prefix>
                  <urn2:suffix>?</urn2:suffix>
               </urn2:personName>
               <urn2:userName>?</urn2:userName>
               <urn2:org>
                  <urn2:description>?</urn2:description>
                  <urn2:homeCommunityId>?</urn2:homeCommunityId>
                  <urn2:name>?</urn2:name>
               </urn2:org>
            </urn2:userInfo>
            <urn2:authorized>?</urn2:authorized>
            <!--1 or more repetitions:-->
            <urn2:relatesToList>?</urn2:relatesToList>
         </urn:assertion>
         <urn:NhinTargetCommunities>
            <!--1 or more repetitions:-->
            <urn2:nhinTargetCommunity>
               <urn2:homeCommunity>
                  <urn2:description>?</urn2:description>
                  <urn2:homeCommunityId>?</urn2:homeCommunityId>
                  <urn2:name>?</urn2:name>
               </urn2:homeCommunity>
               <urn2:list>?</urn2:list>
               <urn2:region>?</urn2:region>
            </urn2:nhinTargetCommunity>
         </urn:NhinTargetCommunities>
      </urn:RespondingGateway_CrossGatewayRetrieveRequest>
   </soap:Body>
</soap:Envelope>]]></con:request>
        <con:credentials>
          <con:authType>Global HTTP Settings</con:authType>
        </con:credentials>
        <con:jmsConfig JMSDeliveryMode="PERSISTENT"/>
        <con:jmsPropertyConfig/>
        <con:wsaConfig mustUnderstand="NONE" version="200508" action="urn:gov:hhs:fha:nhinc:entitydocretrieve:RespondingGateway_CrossGatewayRetrieveRequestMessage"/>
        <con:wsrmConfig version="1.2"/>
      </con:call>
    </con:operation>
  </con:interface>
  <con:testSuite name="EntityDocRetrieveTestSuite" id="1e88d773-8b9c-43bf-a787-0b9da67061a5">
    <con:settings/>
    <con:runType>SEQUENTIAL</con:runType>
    <con:testCase failOnError="true" failTestCaseOnErrors="true" id="f9ae55a3-041d-456c-8991-3f8768d021f0" keepSession="false" maxResults="0" name="Document Retrieve Fanout" searchProperties="true">
      <con:settings/>
      <con:testStep type="groovy" name="copy uddiConnectionInfo" id="a2f8d557-b265-4858-879e-33f224db5635">
        <con:settings/>
        <con:config>
          <script>//def sourceDir =  (new com.eviware.soapui.support.GroovyUtils(context)).projectPath;
def sourceFile = "uddiConnectionInfo_FANOUT.xml";
def destDir = context.findProperty( "GatewayPropDir" );
def destFile = "uddiConnectionInfo.xml";
def sourceDir = context.expand('${projectDir}')

nhinc.FileUtils.copyFile(sourceDir, sourceFile, destDir, destFile, log);</script>
        </con:config>
      </con:testStep>
      <con:testStep name="Set uddiConnectionInfo" type="groovy" id="804b7b27-cfc5-4da6-933a-380c54624a57">
        <con:settings/>
        <con:config>
          <script>def destConfigFileLocation = context.findProperty("GatewayPropDir");
def host2 = context.findProperty("Host2");
def HCID2 = context.findProperty( "RemoteHCID1" );
def docRetrieveURL2_20 = "https://" + host2 + ":8181/Gateway/DocumentRetrieve/2_0/NhinService/RespondingGateway_Retrieve_Service/DocRetrieve";
def docRetrieveURL2_30 = "https://" + host2 + ":8181/Gateway/DocumentRetrieve/3_0/NhinService/RespondingGateway_Retrieve_Service/DocRetrieve";

def host3 = context.findProperty("Host3");
def HCID3 = context.findProperty( "RemoteHCID2" );
def docRetrieveURL3_20 = "https://" + host3 + ":8181/Gateway/DocumentRetrieve/2_0/NhinService/RespondingGateway_Retrieve_Service/DocRetrieve";
def docRetrieveURL3_30 = "https://" + host3 + ":8181/Gateway/DocumentRetrieve/3_0/NhinService/RespondingGateway_Retrieve_Service/DocRetrieve";

nhinc.FileUtils.createOrUpdateConnection("uddiConnectionInfo.xml",destConfigFileLocation, HCID2, "RetrieveDocuments", docRetrieveURL2_20,"2.0", log)
//nhinc.FileUtils.createOrUpdateConnection("uddiConnectionInfo.xml",destConfigFileLocation, HCID2, "RetrieveDocuments", docRetrieveURL2_30,"3.0", log)

nhinc.FileUtils.createOrUpdateConnection("uddiConnectionInfo.xml",destConfigFileLocation, HCID3, "RetrieveDocuments", docRetrieveURL3_20,"2.0", log)
//nhinc.FileUtils.createOrUpdateConnection("uddiConnectionInfo.xml",destConfigFileLocation, HCID3, "RetrieveDocuments", docRetrieveURL3_30,"3.0", log)</script>
        </con:config>
      </con:testStep>
      <con:testStep name="Document Retrieve" type="request" id="37948658-346d-4ed7-b39f-563de37407f7">
        <con:settings/>
        <con:config xsi:type="con:RequestStep" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
          <con:interface>EntityDocRetrieveBindingSoap</con:interface>
          <con:operation>RespondingGateway_CrossGatewayRetrieve</con:operation>
          <con:request incomingWss="" name="Document Retrieve" outgoingWss="" wssPasswordType="" id="3412b55d-e7e6-412e-b001-6346568a09fd">
            <con:settings>
              <con:setting id="com.eviware.soapui.impl.wsdl.WsdlRequest@expand-mtom-attachments">true</con:setting>
              <con:setting id="com.eviware.soapui.impl.wsdl.WsdlRequest@request-headers"><xml-fragment/></con:setting>
            </con:settings>
            <con:encoding>UTF-8</con:encoding>
            <con:endpoint>${#Project#Endpoint-DocRetrieve}</con:endpoint>
            <con:request><![CDATA[<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" xmlns:urn="urn:gov:hhs:fha:nhinc:common:nhinccommonentity" xmlns:urn1="urn:ihe:iti:xds-b:2007" xmlns:urn2="urn:gov:hhs:fha:nhinc:common:nhinccommon">
   <soapenv:Header/>
   <soapenv:Body projectName="EntityDocRetrieve" testCase="Document Retrieve Fanout">
      <urn:RespondingGateway_CrossGatewayRetrieveRequest>
         <urn1:RetrieveDocumentSetRequest>
            <urn1:DocumentRequest>
               <urn1:HomeCommunityId>urn:oid:${#Project#RemoteHCID1}</urn1:HomeCommunityId>
               <urn1:RepositoryUniqueId>1</urn1:RepositoryUniqueId>
               <urn1:DocumentUniqueId>${#Project#DRDocID1}</urn1:DocumentUniqueId>
            </urn1:DocumentRequest>
            <urn1:DocumentRequest>
               <urn1:HomeCommunityId>urn:oid:${#Project#RemoteHCID2}</urn1:HomeCommunityId>
               <urn1:RepositoryUniqueId>1</urn1:RepositoryUniqueId>
               <urn1:DocumentUniqueId>${#Project#DRDocID2}</urn1:DocumentUniqueId>
            </urn1:DocumentRequest>
         </urn1:RetrieveDocumentSetRequest>
         <urn:assertion>
            <urn2:address xmlns:urn1="urn:gov:hhs:fha:nhinc:common:nhinccommon">
               <urn2:addressType>
                  <urn2:code>AddrCode</urn2:code>
                  <urn2:codeSystem>AddrCodeSyst</urn2:codeSystem>
                  <urn2:codeSystemName>AddrCodeSystName</urn2:codeSystemName>
                  <urn2:codeSystemVersion>1.0</urn2:codeSystemVersion>
                  <urn2:displayName>AddrCode</urn2:displayName>
                  <urn2:originalText>AddrCode</urn2:originalText>
               </urn2:addressType>
               <urn2:city>AddrCity</urn2:city>
               <urn2:country>AddrCountry</urn2:country>
               <urn2:state>AddrState</urn2:state>
               <urn2:streetAddress>AddrStreet</urn2:streetAddress>
               <urn2:zipCode>AddrZip</urn2:zipCode>
            </urn2:address>
            <urn2:dateOfBirth xmlns:urn1="urn:gov:hhs:fha:nhinc:common:nhinccommon">06/04/1959 05:21:00</urn2:dateOfBirth>
            <urn2:explanationNonClaimantSignature xmlns:urn1="urn:gov:hhs:fha:nhinc:common:nhinccommon">Electronic</urn2:explanationNonClaimantSignature>
            <urn2:haveSecondWitnessSignature xmlns:urn1="urn:gov:hhs:fha:nhinc:common:nhinccommon">false</urn2:haveSecondWitnessSignature>
            <urn2:haveSignature xmlns:urn1="urn:gov:hhs:fha:nhinc:common:nhinccommon">false</urn2:haveSignature>
            <urn2:haveWitnessSignature xmlns:urn1="urn:gov:hhs:fha:nhinc:common:nhinccommon">false</urn2:haveWitnessSignature>
            <urn2:homeCommunity xmlns:urn1="urn:gov:hhs:fha:nhinc:common:nhinccommon">
               <urn2:description>${#Project#LocalHCDescription}</urn2:description>
               <urn2:homeCommunityId>${#Project#LocalHCID}</urn2:homeCommunityId>
               <urn2:name>${#Project#LocalHCDescription}</urn2:name>
            </urn2:homeCommunity>
            <urn2:personName xmlns:urn1="urn:gov:hhs:fha:nhinc:common:nhinccommon">
               <urn2:familyName>Smith</urn2:familyName>
               <urn2:givenName>Sandy</urn2:givenName>
               <urn2:nameType>
                  <urn2:code>nameCode</urn2:code>
                  <urn2:codeSystem>nameCodeSyst</urn2:codeSystem>
                  <urn2:codeSystemName>nameCodeSystName</urn2:codeSystemName>
                  <urn2:codeSystemVersion>1.0</urn2:codeSystemVersion>
                  <urn2:displayName>nameCode</urn2:displayName>
                  <urn2:originalText>nameCode</urn2:originalText>
               </urn2:nameType>
               <urn2:secondNameOrInitials>S</urn2:secondNameOrInitials>
               <urn2:fullName>Sandy S. Smith</urn2:fullName>
            </urn2:personName>
            <urn2:phoneNumber xmlns:urn1="urn:gov:hhs:fha:nhinc:common:nhinccommon">
               <urn2:areaCode>321</urn2:areaCode>
               <urn2:countryCode>1</urn2:countryCode>
               <urn2:extension>5436</urn2:extension>
               <urn2:localNumber>253-6849</urn2:localNumber>
               <urn2:phoneNumberType>
                  <urn2:code>phoneCode</urn2:code>
                  <urn2:codeSystem>phoneCodeSyst</urn2:codeSystem>
                  <urn2:codeSystemName>phoneCodeSystName</urn2:codeSystemName>
                  <urn2:codeSystemVersion>1.0</urn2:codeSystemVersion>
                  <urn2:displayName>phoneCode</urn2:displayName>
                  <urn2:originalText>phoneCode</urn2:originalText>
               </urn2:phoneNumberType>
            </urn2:phoneNumber>
            <urn2:secondWitnessAddress xmlns:urn1="urn:gov:hhs:fha:nhinc:common:nhinccommon">
               <urn2:addressType>
                  <urn2:code>AddrCode</urn2:code>
                  <urn2:codeSystem>AddrCodeSyst</urn2:codeSystem>
                  <urn2:codeSystemName>AddrCodeSystName</urn2:codeSystemName>
                  <urn2:codeSystemVersion>1.0</urn2:codeSystemVersion>
                  <urn2:displayName>AddrCode</urn2:displayName>
                  <urn2:originalText>AddrCode</urn2:originalText>
               </urn2:addressType>
               <urn2:city>Addr2City</urn2:city>
               <urn2:country>Addr2Country</urn2:country>
               <urn2:state>Addr2State</urn2:state>
               <urn2:streetAddress>Addr2Street</urn2:streetAddress>
               <urn2:zipCode>Addr2Zip</urn2:zipCode>
            </urn2:secondWitnessAddress>
            <urn2:secondWitnessName xmlns:urn1="urn:gov:hhs:fha:nhinc:common:nhinccommon">
               <urn2:familyName>Smith</urn2:familyName>
               <urn2:givenName>Sammy</urn2:givenName>
               <urn2:nameType>
                  <urn2:code>nameCode</urn2:code>
                  <urn2:codeSystem>nameCodeSyst</urn2:codeSystem>
                  <urn2:codeSystemName>nameCodeSystName</urn2:codeSystemName>
                  <urn2:codeSystemVersion>1.0</urn2:codeSystemVersion>
                  <urn2:displayName>nameCode</urn2:displayName>
                  <urn2:originalText>nameCode</urn2:originalText>
               </urn2:nameType>
               <urn2:secondNameOrInitials>s</urn2:secondNameOrInitials>
               <urn2:fullName>Sammy S. Smith</urn2:fullName>
            </urn2:secondWitnessName>
            <urn2:secondWitnessPhone xmlns:urn1="urn:gov:hhs:fha:nhinc:common:nhinccommon">
               <urn2:areaCode>321</urn2:areaCode>
               <urn2:countryCode>1</urn2:countryCode>
               <urn2:extension>5424</urn2:extension>
               <urn2:localNumber>542-6823</urn2:localNumber>
               <urn2:phoneNumberType>
                  <urn2:code>phoneCode</urn2:code>
                  <urn2:codeSystem>phoneCodeSyst</urn2:codeSystem>
                  <urn2:codeSystemName>phoneCodeSystName</urn2:codeSystemName>
                  <urn2:codeSystemVersion>1.0</urn2:codeSystemVersion>
                  <urn2:displayName>phoneCode</urn2:displayName>
                  <urn2:originalText>phoneCode</urn2:originalText>
               </urn2:phoneNumberType>
            </urn2:secondWitnessPhone>
            <urn2:SSN xmlns:urn1="urn:gov:hhs:fha:nhinc:common:nhinccommon">253-98-7546</urn2:SSN>
            <urn2:uniquePatientId xmlns:urn1="urn:gov:hhs:fha:nhinc:common:nhinccommon">500000000</urn2:uniquePatientId>
            <urn2:witnessAddress xmlns:urn1="urn:gov:hhs:fha:nhinc:common:nhinccommon">
               <urn2:addressType>
                  <urn2:code>addrCode</urn2:code>
                  <urn2:codeSystem>addrCodeSyst</urn2:codeSystem>
                  <urn2:codeSystemName>addrCodeSystName</urn2:codeSystemName>
                  <urn2:codeSystemVersion>1.0</urn2:codeSystemVersion>
                  <urn2:displayName>addrCode</urn2:displayName>
                  <urn2:originalText>addrCode</urn2:originalText>
               </urn2:addressType>
               <urn2:city>Burnell</urn2:city>
               <urn2:country>USA</urn2:country>
               <urn2:state>FL</urn2:state>
               <urn2:streetAddress>825 North</urn2:streetAddress>
               <urn2:zipCode>32184</urn2:zipCode>
            </urn2:witnessAddress>
            <urn2:witnessName xmlns:urn1="urn:gov:hhs:fha:nhinc:common:nhinccommon">
               <urn2:familyName>Smith</urn2:familyName>
               <urn2:givenName>Scott</urn2:givenName>
               <urn2:nameType>
                  <urn2:code>nameCode</urn2:code>
                  <urn2:codeSystem>nameCodeSyst</urn2:codeSystem>
                  <urn2:codeSystemName>nameCodeSystName</urn2:codeSystemName>
                  <urn2:codeSystemVersion>1.0</urn2:codeSystemVersion>
                  <urn2:displayName>nameCode</urn2:displayName>
                  <urn2:originalText>nameCode</urn2:originalText>
               </urn2:nameType>
               <urn2:secondNameOrInitials>S.</urn2:secondNameOrInitials>
               <urn2:fullName>Scott S. Smith</urn2:fullName>
            </urn2:witnessName>
            <urn2:witnessPhone xmlns:urn1="urn:gov:hhs:fha:nhinc:common:nhinccommon">
               <urn2:areaCode>321</urn2:areaCode>
               <urn2:countryCode>1</urn2:countryCode>
               <urn2:extension>8432</urn2:extension>
               <urn2:localNumber>985-2239</urn2:localNumber>
               <urn2:phoneNumberType>
                  <urn2:code>phoneCode</urn2:code>
                  <urn2:codeSystem>phoneCodeSyst</urn2:codeSystem>
                  <urn2:codeSystemName>phoneCodeSystName</urn2:codeSystemName>
                  <urn2:codeSystemVersion>1.0</urn2:codeSystemVersion>
                  <urn2:displayName>phoneCode</urn2:displayName>
                  <urn2:originalText>phoneCode</urn2:originalText>
               </urn2:phoneNumberType>
            </urn2:witnessPhone>
            <urn2:userInfo xmlns:urn1="urn:gov:hhs:fha:nhinc:common:nhinccommon">
               <urn2:personName>
                  <urn2:familyName>Skagerberg</urn2:familyName>
                  <urn2:givenName>Karl</urn2:givenName>
                  <urn2:nameType>
                     <urn2:code>nameCode</urn2:code>
                     <urn2:codeSystem>nameCodeSyst</urn2:codeSystem>
                     <urn2:codeSystemName>nameCodeSystName</urn2:codeSystemName>
                     <urn2:codeSystemVersion>1.0</urn2:codeSystemVersion>
                     <urn2:displayName>nameCode</urn2:displayName>
                     <urn2:originalText>nameCode</urn2:originalText>
                  </urn2:nameType>
                  <urn2:secondNameOrInitials>S</urn2:secondNameOrInitials>
                  <urn2:fullName>Kasrl S. Skagerberg</urn2:fullName>
               </urn2:personName>
               <urn2:userName>kskagerb</urn2:userName>
               <urn2:org>
                  <urn2:description>${#Project#LocalHCDescription}</urn2:description>
                  <urn2:homeCommunityId>${#Project#LocalHCID}</urn2:homeCommunityId>
                  <urn2:name>${#Project#LocalHCDescription}</urn2:name>
               </urn2:org>
               <urn2:roleCoded>
                  <urn2:code>307969004</urn2:code>
                  <urn2:codeSystem>2.16.840.1.113883.6.96</urn2:codeSystem>
                  <urn2:codeSystemName>SNOMED_CT</urn2:codeSystemName>
                  <urn2:codeSystemVersion>1.0</urn2:codeSystemVersion>
                  <urn2:displayName>Public Health</urn2:displayName>
                  <urn2:originalText>Public Health</urn2:originalText>
               </urn2:roleCoded>
            </urn2:userInfo>
            <urn2:authorized xmlns:urn1="urn:gov:hhs:fha:nhinc:common:nhinccommon">true</urn2:authorized>
            <urn2:purposeOfDisclosureCoded xmlns:urn1="urn:gov:hhs:fha:nhinc:common:nhinccommon">
               <urn2:code>PUBLICHEALTH</urn2:code>
               <urn2:codeSystem>2.16.840.1.113883.3.18.7.1</urn2:codeSystem>
               <urn2:codeSystemName>nhin-purpose</urn2:codeSystemName>
               <urn2:codeSystemVersion>1.0</urn2:codeSystemVersion>
               <urn2:displayName>Use or disclosure of Psychotherapy Notes</urn2:displayName>
               <urn2:originalText>Use or disclosure of Psychotherapy Notes</urn2:originalText>
            </urn2:purposeOfDisclosureCoded>
            <urn2:samlAuthnStatement xmlns:urn1="urn:gov:hhs:fha:nhinc:common:nhinccommon">
               <urn2:authInstant>2009-04-16T13:15:39Z</urn2:authInstant>
               <urn2:sessionIndex>987</urn2:sessionIndex>
               <urn2:authContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:X509</urn2:authContextClassRef>
               <urn2:subjectLocalityAddress>158.147.185.168</urn2:subjectLocalityAddress>
               <urn2:subjectLocalityDNSName>cs.myharris.net</urn2:subjectLocalityDNSName>
            </urn2:samlAuthnStatement>
            <urn2:samlAuthzDecisionStatement xmlns:urn1="urn:gov:hhs:fha:nhinc:common:nhinccommon">
               <urn2:decision>Permit</urn2:decision>
               <urn2:resource>https://158.147.185.168:8181/SamlReceiveService/SamlProcessWS</urn2:resource>
               <urn2:action>TestSaml</urn2:action>
               <urn2:evidence>
                  <urn2:assertion>
                     <urn2:id>40df7c0a-ff3e-4b26-baeb-f2910f6d05a9</urn2:id>
                     <urn2:issueInstant>2009-04-16T13:10:39.093Z</urn2:issueInstant>
                     <urn2:version>2.0</urn2:version>
                     <urn2:issuerFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:X509SubjectName</urn2:issuerFormat>
                     <urn2:issuer>CN=SAML User,OU=Harris,O=HITS,L=Melbourne,ST=FL,C=US</urn2:issuer>
                     <urn2:conditions>
                        <urn2:notBefore>2009-04-16T13:10:39.093Z</urn2:notBefore>
                        <urn2:notOnOrAfter>2009-12-31T12:00:00.000Z</urn2:notOnOrAfter>
                     </urn2:conditions>
                     <urn2:accessConsentPolicy>urn:oid:1.2.3.4</urn2:accessConsentPolicy>
                     <urn2:instanceAccessConsentPolicy>urn:oid:1.2.3.4.123456789</urn2:instanceAccessConsentPolicy>
                  </urn2:assertion>
               </urn2:evidence>
            </urn2:samlAuthzDecisionStatement>
         </urn:assertion>
         <urn:NhinTargetCommunities>
            <urn2:nhinTargetCommunity>
               <urn2:homeCommunity>
                  <urn2:description>${#Project#RemoteHCDescription1}</urn2:description>
                  <urn2:homeCommunityId>${#Project#RemoteHCID1}</urn2:homeCommunityId>
                  <urn2:name>${#Project#RemoteHCDescription1}</urn2:name>
               </urn2:homeCommunity>
            </urn2:nhinTargetCommunity>
         </urn:NhinTargetCommunities>
      </urn:RespondingGateway_CrossGatewayRetrieveRequest>
   </soapenv:Body>
</soapenv:Envelope>]]></con:request>
            <con:assertion type="SOAP Response" id="75704507-dea5-4d30-8106-e8eb90357012"/>
            <con:assertion type="SOAP Fault Assertion" id="9161205b-dc2c-4691-b0a1-f6edc1232e52"/>
            <con:assertion name="DocumentResponseCount" type="XPath Match" id="e77adb56-f490-4350-8296-db2594f8cb0b">
              <con:configuration>
                <path>declare namespace ns16='urn:ihe:iti:xds-b:2007';
count(//ns16:RetrieveDocumentSetResponse[1]/ns16:DocumentResponse)</path>
                <content>2</content>
                <allowWildcards>false</allowWildcards>
                <ignoreNamspaceDifferences>true</ignoreNamspaceDifferences>
                <ignoreComments>false</ignoreComments>
              </con:configuration>
            </con:assertion>
            <con:credentials>
              <con:authType>Global HTTP Settings</con:authType>
            </con:credentials>
            <con:jmsConfig JMSDeliveryMode="PERSISTENT"/>
            <con:jmsPropertyConfig/>
            <con:wsaConfig action="urn:gov:hhs:fha:nhinc:entitydocretrieve/EntityDocRetrievePortType/RespondingGateway_CrossGatewayRetrieveRequest" mustUnderstand="NONE" version="200508"/>
            <con:wsrmConfig version="1.2"/>
          </con:request>
        </con:config>
      </con:testStep>
      <con:setupScript>nhinc.FileUtils.backupConfiguration(context.findProperty("GatewayPropDir"), log);</con:setupScript>
      <con:properties>
        <con:property>
          <con:name>startDate</con:name>
          <con:value>2013-09-03T18:18:44Z</con:value>
        </con:property>
        <con:property>
          <con:name>endDate</con:name>
          <con:value>2013-09-03T18:28:44Z</con:value>
        </con:property>
        <con:property>
          <con:name>sigDate</con:name>
          <con:value>09/03/2013 18:18:44</con:value>
        </con:property>
        <con:property>
          <con:name>expireDate</con:name>
          <con:value>2013-10-03T00:00:00Z</con:value>
        </con:property>
        <con:property>
          <con:name>CorrectedRemoteHCID1</con:name>
          <con:value>2.2</con:value>
        </con:property>
        <con:property>
          <con:name>CorrectedRemoteHCID2</con:name>
          <con:value>3.3</con:value>
        </con:property>
      </con:properties>
      <con:reportParameters/>
      <con:tearDownScript>nhinc.FileUtils.restoreConfiguration(context.findProperty("GatewayPropDir"), log);</con:tearDownScript>
    </con:testCase>
    <con:testCase failOnError="true" failTestCaseOnErrors="true" id="db9ed78d-5fc0-473b-a15a-4ed7a5ab27b2" keepSession="false" maxResults="0" name="Document Retrieve Fanout - bad endpoint" searchProperties="true">
      <con:settings/>
      <con:testStep type="groovy" name="copy uddiConnectionInfo" id="5ec89153-8ff1-49c2-aa1d-8f796429aa44">
        <con:settings/>
        <con:config>
          <script>//def sourceDir =  (new com.eviware.soapui.support.GroovyUtils(context)).projectPath;
def sourceDir = context.expand('${projectDir}')
def sourceFile = "uddiConnectionInfo_FANOUT.xml";
def destDir = context.findProperty( "GatewayPropDir" );
def destFile = "uddiConnectionInfo.xml";

nhinc.FileUtils.copyFile(sourceDir, sourceFile, destDir, destFile, log);</script>
        </con:config>
      </con:testStep>
      <con:testStep name="Set uddiConnectionInfo" type="groovy" id="2a002794-3572-40a4-ae43-c7049863bdf9">
        <con:settings/>
        <con:config>
          <script>def destConfigFileLocation = context.findProperty("GatewayPropDir");
def host2 = context.findProperty("Host2");
def HCID2 = context.findProperty( "RemoteHCID1" );
def docRetrieveURL2_20 = "https://" + host2 + ":8181/Gateway/DocumentRetrieve/2_0/NhinService/RespondingGateway_Retrieve_Service/DocRetrieve";
def docRetrieveURL2_30 = "https://" + host2 + ":8181/Gateway/DocumentRetrieve/3_0/NhinService/RespondingGateway_Retrieve_Service/DocRetrieve";

def host3 = context.findProperty("Host3");
def HCID3 = context.findProperty( "RemoteHCID2" );
def docRetrieveURL3_20_bad = "https://" + host3 + ":8181/bad_endpoint";
def docRetrieveURL3_30_bad = "https://" + host3 + ":8181/bad_endpoint";

nhinc.FileUtils.createOrUpdateConnection("uddiConnectionInfo.xml",destConfigFileLocation, HCID2, "RetrieveDocuments", docRetrieveURL2_20,"2.0", log)
nhinc.FileUtils.createOrUpdateConnection("uddiConnectionInfo.xml",destConfigFileLocation, HCID2, "RetrieveDocuments", docRetrieveURL2_30,"3.0", log)

nhinc.FileUtils.createOrUpdateConnection("uddiConnectionInfo.xml",destConfigFileLocation, HCID3, "RetrieveDocuments", docRetrieveURL3_20_bad,"2.0", log)
nhinc.FileUtils.createOrUpdateConnection("uddiConnectionInfo.xml",destConfigFileLocation, HCID3, "RetrieveDocuments", docRetrieveURL3_30_bad,"3.0", log)</script>
        </con:config>
      </con:testStep>
      <con:testStep name="Document Retrieve" type="request" id="4dc325ab-d1f1-43e3-956f-4327e21ec914">
        <con:settings/>
        <con:config xsi:type="con:RequestStep" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
          <con:interface>EntityDocRetrieveBindingSoap</con:interface>
          <con:operation>RespondingGateway_CrossGatewayRetrieve</con:operation>
          <con:request incomingWss="" name="Document Retrieve" outgoingWss="" wssPasswordType="" id="38d077ce-876e-4f44-8813-8c8998e66be0">
            <con:settings>
              <con:setting id="com.eviware.soapui.impl.wsdl.WsdlRequest@expand-mtom-attachments">true</con:setting>
              <con:setting id="com.eviware.soapui.impl.wsdl.WsdlRequest@request-headers"><xml-fragment/></con:setting>
            </con:settings>
            <con:encoding>UTF-8</con:encoding>
            <con:endpoint>${#Project#Endpoint-DocRetrieve}</con:endpoint>
            <con:request><![CDATA[<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" xmlns:urn="urn:gov:hhs:fha:nhinc:common:nhinccommonentity" xmlns:urn1="urn:ihe:iti:xds-b:2007" xmlns:urn2="urn:gov:hhs:fha:nhinc:common:nhinccommon">
   <soapenv:Header/>
   <soapenv:Body projectName="EntityDocRetrieve" testCase="Document Retrieve Fanout">
      <urn:RespondingGateway_CrossGatewayRetrieveRequest>
         <urn1:RetrieveDocumentSetRequest>
            <urn1:DocumentRequest>
               <urn1:HomeCommunityId>urn:oid:${#Project#RemoteHCID1}</urn1:HomeCommunityId>
               <urn1:RepositoryUniqueId>1</urn1:RepositoryUniqueId>
               <urn1:DocumentUniqueId>${#Project#DRDocID1}</urn1:DocumentUniqueId>
            </urn1:DocumentRequest>
            <urn1:DocumentRequest>
               <urn1:HomeCommunityId>urn:oid:${#Project#RemoteHCID2}</urn1:HomeCommunityId>
               <urn1:RepositoryUniqueId>1</urn1:RepositoryUniqueId>
               <urn1:DocumentUniqueId>${#Project#DRDocID2}</urn1:DocumentUniqueId>
            </urn1:DocumentRequest>
         </urn1:RetrieveDocumentSetRequest>
         <urn:assertion>
            <urn2:address xmlns:urn1="urn:gov:hhs:fha:nhinc:common:nhinccommon">
               <urn2:addressType>
                  <urn2:code>AddrCode</urn2:code>
                  <urn2:codeSystem>AddrCodeSyst</urn2:codeSystem>
                  <urn2:codeSystemName>AddrCodeSystName</urn2:codeSystemName>
                  <urn2:codeSystemVersion>1.0</urn2:codeSystemVersion>
                  <urn2:displayName>AddrCode</urn2:displayName>
                  <urn2:originalText>AddrCode</urn2:originalText>
               </urn2:addressType>
               <urn2:city>AddrCity</urn2:city>
               <urn2:country>AddrCountry</urn2:country>
               <urn2:state>AddrState</urn2:state>
               <urn2:streetAddress>AddrStreet</urn2:streetAddress>
               <urn2:zipCode>AddrZip</urn2:zipCode>
            </urn2:address>
            <urn2:dateOfBirth xmlns:urn1="urn:gov:hhs:fha:nhinc:common:nhinccommon">06/04/1959 05:21:00</urn2:dateOfBirth>
            <urn2:explanationNonClaimantSignature xmlns:urn1="urn:gov:hhs:fha:nhinc:common:nhinccommon">Electronic</urn2:explanationNonClaimantSignature>
            <urn2:haveSecondWitnessSignature xmlns:urn1="urn:gov:hhs:fha:nhinc:common:nhinccommon">false</urn2:haveSecondWitnessSignature>
            <urn2:haveSignature xmlns:urn1="urn:gov:hhs:fha:nhinc:common:nhinccommon">false</urn2:haveSignature>
            <urn2:haveWitnessSignature xmlns:urn1="urn:gov:hhs:fha:nhinc:common:nhinccommon">false</urn2:haveWitnessSignature>
            <urn2:homeCommunity xmlns:urn1="urn:gov:hhs:fha:nhinc:common:nhinccommon">
               <urn2:description>${#Project#LocalHCDescription}</urn2:description>
               <urn2:homeCommunityId>${#Project#LocalHCID}</urn2:homeCommunityId>
               <urn2:name>${#Project#LocalHCDescription}</urn2:name>
            </urn2:homeCommunity>
            <urn2:personName xmlns:urn1="urn:gov:hhs:fha:nhinc:common:nhinccommon">
               <urn2:familyName>Smith</urn2:familyName>
               <urn2:givenName>Sandy</urn2:givenName>
               <urn2:nameType>
                  <urn2:code>nameCode</urn2:code>
                  <urn2:codeSystem>nameCodeSyst</urn2:codeSystem>
                  <urn2:codeSystemName>nameCodeSystName</urn2:codeSystemName>
                  <urn2:codeSystemVersion>1.0</urn2:codeSystemVersion>
                  <urn2:displayName>nameCode</urn2:displayName>
                  <urn2:originalText>nameCode</urn2:originalText>
               </urn2:nameType>
               <urn2:secondNameOrInitials>S</urn2:secondNameOrInitials>
               <urn2:fullName>Sandy S. Smith</urn2:fullName>
            </urn2:personName>
            <urn2:phoneNumber xmlns:urn1="urn:gov:hhs:fha:nhinc:common:nhinccommon">
               <urn2:areaCode>321</urn2:areaCode>
               <urn2:countryCode>1</urn2:countryCode>
               <urn2:extension>5436</urn2:extension>
               <urn2:localNumber>253-6849</urn2:localNumber>
               <urn2:phoneNumberType>
                  <urn2:code>phoneCode</urn2:code>
                  <urn2:codeSystem>phoneCodeSyst</urn2:codeSystem>
                  <urn2:codeSystemName>phoneCodeSystName</urn2:codeSystemName>
                  <urn2:codeSystemVersion>1.0</urn2:codeSystemVersion>
                  <urn2:displayName>phoneCode</urn2:displayName>
                  <urn2:originalText>phoneCode</urn2:originalText>
               </urn2:phoneNumberType>
            </urn2:phoneNumber>
            <urn2:secondWitnessAddress xmlns:urn1="urn:gov:hhs:fha:nhinc:common:nhinccommon">
               <urn2:addressType>
                  <urn2:code>AddrCode</urn2:code>
                  <urn2:codeSystem>AddrCodeSyst</urn2:codeSystem>
                  <urn2:codeSystemName>AddrCodeSystName</urn2:codeSystemName>
                  <urn2:codeSystemVersion>1.0</urn2:codeSystemVersion>
                  <urn2:displayName>AddrCode</urn2:displayName>
                  <urn2:originalText>AddrCode</urn2:originalText>
               </urn2:addressType>
               <urn2:city>Addr2City</urn2:city>
               <urn2:country>Addr2Country</urn2:country>
               <urn2:state>Addr2State</urn2:state>
               <urn2:streetAddress>Addr2Street</urn2:streetAddress>
               <urn2:zipCode>Addr2Zip</urn2:zipCode>
            </urn2:secondWitnessAddress>
            <urn2:secondWitnessName xmlns:urn1="urn:gov:hhs:fha:nhinc:common:nhinccommon">
               <urn2:familyName>Smith</urn2:familyName>
               <urn2:givenName>Sammy</urn2:givenName>
               <urn2:nameType>
                  <urn2:code>nameCode</urn2:code>
                  <urn2:codeSystem>nameCodeSyst</urn2:codeSystem>
                  <urn2:codeSystemName>nameCodeSystName</urn2:codeSystemName>
                  <urn2:codeSystemVersion>1.0</urn2:codeSystemVersion>
                  <urn2:displayName>nameCode</urn2:displayName>
                  <urn2:originalText>nameCode</urn2:originalText>
               </urn2:nameType>
               <urn2:secondNameOrInitials>s</urn2:secondNameOrInitials>
               <urn2:fullName>Sammy S. Smith</urn2:fullName>
            </urn2:secondWitnessName>
            <urn2:secondWitnessPhone xmlns:urn1="urn:gov:hhs:fha:nhinc:common:nhinccommon">
               <urn2:areaCode>321</urn2:areaCode>
               <urn2:countryCode>1</urn2:countryCode>
               <urn2:extension>5424</urn2:extension>
               <urn2:localNumber>542-6823</urn2:localNumber>
               <urn2:phoneNumberType>
                  <urn2:code>phoneCode</urn2:code>
                  <urn2:codeSystem>phoneCodeSyst</urn2:codeSystem>
                  <urn2:codeSystemName>phoneCodeSystName</urn2:codeSystemName>
                  <urn2:codeSystemVersion>1.0</urn2:codeSystemVersion>
                  <urn2:displayName>phoneCode</urn2:displayName>
                  <urn2:originalText>phoneCode</urn2:originalText>
               </urn2:phoneNumberType>
            </urn2:secondWitnessPhone>
            <urn2:SSN xmlns:urn1="urn:gov:hhs:fha:nhinc:common:nhinccommon">253-98-7546</urn2:SSN>
            <urn2:uniquePatientId xmlns:urn1="urn:gov:hhs:fha:nhinc:common:nhinccommon">500000000</urn2:uniquePatientId>
            <urn2:witnessAddress xmlns:urn1="urn:gov:hhs:fha:nhinc:common:nhinccommon">
               <urn2:addressType>
                  <urn2:code>addrCode</urn2:code>
                  <urn2:codeSystem>addrCodeSyst</urn2:codeSystem>
                  <urn2:codeSystemName>addrCodeSystName</urn2:codeSystemName>
                  <urn2:codeSystemVersion>1.0</urn2:codeSystemVersion>
                  <urn2:displayName>addrCode</urn2:displayName>
                  <urn2:originalText>addrCode</urn2:originalText>
               </urn2:addressType>
               <urn2:city>Burnell</urn2:city>
               <urn2:country>USA</urn2:country>
               <urn2:state>FL</urn2:state>
               <urn2:streetAddress>825 North</urn2:streetAddress>
               <urn2:zipCode>32184</urn2:zipCode>
            </urn2:witnessAddress>
            <urn2:witnessName xmlns:urn1="urn:gov:hhs:fha:nhinc:common:nhinccommon">
               <urn2:familyName>Smith</urn2:familyName>
               <urn2:givenName>Scott</urn2:givenName>
               <urn2:nameType>
                  <urn2:code>nameCode</urn2:code>
                  <urn2:codeSystem>nameCodeSyst</urn2:codeSystem>
                  <urn2:codeSystemName>nameCodeSystName</urn2:codeSystemName>
                  <urn2:codeSystemVersion>1.0</urn2:codeSystemVersion>
                  <urn2:displayName>nameCode</urn2:displayName>
                  <urn2:originalText>nameCode</urn2:originalText>
               </urn2:nameType>
               <urn2:secondNameOrInitials>S.</urn2:secondNameOrInitials>
               <urn2:fullName>Scott S. Smith</urn2:fullName>
            </urn2:witnessName>
            <urn2:witnessPhone xmlns:urn1="urn:gov:hhs:fha:nhinc:common:nhinccommon">
               <urn2:areaCode>321</urn2:areaCode>
               <urn2:countryCode>1</urn2:countryCode>
               <urn2:extension>8432</urn2:extension>
               <urn2:localNumber>985-2239</urn2:localNumber>
               <urn2:phoneNumberType>
                  <urn2:code>phoneCode</urn2:code>
                  <urn2:codeSystem>phoneCodeSyst</urn2:codeSystem>
                  <urn2:codeSystemName>phoneCodeSystName</urn2:codeSystemName>
                  <urn2:codeSystemVersion>1.0</urn2:codeSystemVersion>
                  <urn2:displayName>phoneCode</urn2:displayName>
                  <urn2:originalText>phoneCode</urn2:originalText>
               </urn2:phoneNumberType>
            </urn2:witnessPhone>
            <urn2:userInfo xmlns:urn1="urn:gov:hhs:fha:nhinc:common:nhinccommon">
               <urn2:personName>
                  <urn2:familyName>Skagerberg</urn2:familyName>
                  <urn2:givenName>Karl</urn2:givenName>
                  <urn2:nameType>
                     <urn2:code>nameCode</urn2:code>
                     <urn2:codeSystem>nameCodeSyst</urn2:codeSystem>
                     <urn2:codeSystemName>nameCodeSystName</urn2:codeSystemName>
                     <urn2:codeSystemVersion>1.0</urn2:codeSystemVersion>
                     <urn2:displayName>nameCode</urn2:displayName>
                     <urn2:originalText>nameCode</urn2:originalText>
                  </urn2:nameType>
                  <urn2:secondNameOrInitials>S</urn2:secondNameOrInitials>
                  <urn2:fullName>Kasrl S. Skagerberg</urn2:fullName>
               </urn2:personName>
               <urn2:userName>kskagerb</urn2:userName>
               <urn2:org>
                  <urn2:description>${#Project#LocalHCDescription}</urn2:description>
                  <urn2:homeCommunityId>${#Project#LocalHCID}</urn2:homeCommunityId>
                  <urn2:name>${#Project#LocalHCDescription}</urn2:name>
               </urn2:org>
               <urn2:roleCoded>
                  <urn2:code>307969004</urn2:code>
                  <urn2:codeSystem>2.16.840.1.113883.6.96</urn2:codeSystem>
                  <urn2:codeSystemName>SNOMED_CT</urn2:codeSystemName>
                  <urn2:codeSystemVersion>1.0</urn2:codeSystemVersion>
                  <urn2:displayName>Public Health</urn2:displayName>
                  <urn2:originalText>Public Health</urn2:originalText>
               </urn2:roleCoded>
            </urn2:userInfo>
            <urn2:authorized xmlns:urn1="urn:gov:hhs:fha:nhinc:common:nhinccommon">true</urn2:authorized>
            <urn2:purposeOfDisclosureCoded xmlns:urn1="urn:gov:hhs:fha:nhinc:common:nhinccommon">
               <urn2:code>PUBLICHEALTH</urn2:code>
               <urn2:codeSystem>2.16.840.1.113883.3.18.7.1</urn2:codeSystem>
               <urn2:codeSystemName>nhin-purpose</urn2:codeSystemName>
               <urn2:codeSystemVersion>1.0</urn2:codeSystemVersion>
               <urn2:displayName>Use or disclosure of Psychotherapy Notes</urn2:displayName>
               <urn2:originalText>Use or disclosure of Psychotherapy Notes</urn2:originalText>
            </urn2:purposeOfDisclosureCoded>
            <urn2:samlAuthnStatement xmlns:urn1="urn:gov:hhs:fha:nhinc:common:nhinccommon">
               <urn2:authInstant>2009-04-16T13:15:39Z</urn2:authInstant>
               <urn2:sessionIndex>987</urn2:sessionIndex>
               <urn2:authContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:X509</urn2:authContextClassRef>
               <urn2:subjectLocalityAddress>158.147.185.168</urn2:subjectLocalityAddress>
               <urn2:subjectLocalityDNSName>cs.myharris.net</urn2:subjectLocalityDNSName>
            </urn2:samlAuthnStatement>
            <urn2:samlAuthzDecisionStatement xmlns:urn1="urn:gov:hhs:fha:nhinc:common:nhinccommon">
               <urn2:decision>Permit</urn2:decision>
               <urn2:resource>https://158.147.185.168:8181/SamlReceiveService/SamlProcessWS</urn2:resource>
               <urn2:action>TestSaml</urn2:action>
               <urn2:evidence>
                  <urn2:assertion>
                     <urn2:id>40df7c0a-ff3e-4b26-baeb-f2910f6d05a9</urn2:id>
                     <urn2:issueInstant>2009-04-16T13:10:39.093Z</urn2:issueInstant>
                     <urn2:version>2.0</urn2:version>
                     <urn2:issuerFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:X509SubjectName</urn2:issuerFormat>
                     <urn2:issuer>CN=SAML User,OU=Harris,O=HITS,L=Melbourne,ST=FL,C=US</urn2:issuer>
                     <urn2:conditions>
                        <urn2:notBefore>2009-04-16T13:10:39.093Z</urn2:notBefore>
                        <urn2:notOnOrAfter>2009-12-31T12:00:00.000Z</urn2:notOnOrAfter>
                     </urn2:conditions>
                     <urn2:accessConsentPolicy>urn:oid:1.2.3.4</urn2:accessConsentPolicy>
                     <urn2:instanceAccessConsentPolicy>urn:oid:1.2.3.4.123456789</urn2:instanceAccessConsentPolicy>
                  </urn2:assertion>
               </urn2:evidence>
            </urn2:samlAuthzDecisionStatement>
         </urn:assertion>
         <urn:NhinTargetCommunities>
            <urn2:nhinTargetCommunity>
               <urn2:homeCommunity>
                  <urn2:description>${#Project#RemoteHCDescription1}</urn2:description>
                  <urn2:homeCommunityId>${#Project#RemoteHCID1}</urn2:homeCommunityId>
                  <urn2:name>${#Project#RemoteHCDescription1}</urn2:name>
               </urn2:homeCommunity>
            </urn2:nhinTargetCommunity>
         </urn:NhinTargetCommunities>
      </urn:RespondingGateway_CrossGatewayRetrieveRequest>
   </soapenv:Body>
</soapenv:Envelope>]]></con:request>
            <con:assertion type="SOAP Response" id="26afdb5c-da28-4b1e-9fcd-1b932b949cbd"/>
            <con:assertion type="SOAP Fault Assertion" id="e0c9d398-6e32-4266-8dcb-753db872ea0b"/>
            <con:assertion name="DocumentResponseCount" type="XPath Match" id="e48aabe1-1cb9-4876-9024-509c2ec34fcd">
              <con:configuration>
                <path>declare namespace ns16='urn:ihe:iti:xds-b:2007';
count(//ns16:RetrieveDocumentSetResponse[1]/ns16:DocumentResponse)</path>
                <content>1</content>
                <allowWildcards>false</allowWildcards>
                <ignoreNamspaceDifferences>true</ignoreNamspaceDifferences>
                <ignoreComments>false</ignoreComments>
              </con:configuration>
            </con:assertion>
            <con:assertion type="XPath Match" name="XPath Match" id="c5fabce0-d09a-40e0-a0d2-3ec43a897e3b">
              <con:configuration>
                <path>declare namespace ns11='urn:ihe:iti:xds-b:2007';
declare namespace ns12='urn:oasis:names:tc:ebxml-regrep:xsd:rs:3.0';
count(//ns11:RetrieveDocumentSetResponse[1]/ns12:RegistryResponse[1]/ns12:RegistryErrorList[1]/ns12:RegistryError)</path>
                <content>1</content>
                <allowWildcards>false</allowWildcards>
                <ignoreNamspaceDifferences>false</ignoreNamspaceDifferences>
                <ignoreComments>false</ignoreComments>
              </con:configuration>
            </con:assertion>
            <con:credentials>
              <con:authType>Global HTTP Settings</con:authType>
            </con:credentials>
            <con:jmsConfig JMSDeliveryMode="PERSISTENT"/>
            <con:jmsPropertyConfig/>
            <con:wsaConfig action="urn:gov:hhs:fha:nhinc:entitydocretrieve/EntityDocRetrievePortType/RespondingGateway_CrossGatewayRetrieveRequest" mustUnderstand="NONE" version="200508"/>
            <con:wsrmConfig version="1.2"/>
          </con:request>
        </con:config>
      </con:testStep>
      <con:setupScript>nhinc.FileUtils.backupConfiguration(context.findProperty("GatewayPropDir"), log);</con:setupScript>
      <con:properties>
        <con:property>
          <con:name>startDate</con:name>
          <con:value>2013-09-03T18:18:47Z</con:value>
        </con:property>
        <con:property>
          <con:name>endDate</con:name>
          <con:value>2013-09-03T18:28:47Z</con:value>
        </con:property>
        <con:property>
          <con:name>sigDate</con:name>
          <con:value>09/03/2013 18:18:47</con:value>
        </con:property>
        <con:property>
          <con:name>expireDate</con:name>
          <con:value>2013-10-03T00:00:00Z</con:value>
        </con:property>
        <con:property>
          <con:name>CorrectedRemoteHCID1</con:name>
          <con:value>urn:oid:2.2</con:value>
        </con:property>
        <con:property>
          <con:name>CorrectedRemoteHCID2</con:name>
          <con:value>urn:oid:3.3</con:value>
        </con:property>
      </con:properties>
      <con:reportParameters/>
      <con:tearDownScript>nhinc.FileUtils.restoreConfiguration(context.findProperty("GatewayPropDir"), log);</con:tearDownScript>
    </con:testCase>
    <con:properties/>
    <con:reportParameters/>
  </con:testSuite>
  <con:requirements/>
  <con:properties>
    <con:property>
      <con:name>BadRemoteHCID</con:name>
      <con:value>5.10</con:value>
    </con:property>
    <con:property>
      <con:name>DRDocID1</con:name>
      <con:value>1.123401.11111</con:value>
    </con:property>
    <con:property>
      <con:name>DRDocID2</con:name>
      <con:value>1.123402.22222</con:value>
    </con:property>
    <con:property>
      <con:name>DRRepoID</con:name>
      <con:value>1</con:value>
    </con:property>
    <con:property>
      <con:name>Endpoint-DocRetrieve</con:name>
      <con:value>http://localhost:8080/Gateway/DocumentRetrieve/3_0/EntityService/EntityDocRetrieve</con:value>
    </con:property>
    <con:property>
      <con:name>Host2</con:name>
      <con:value>localhost</con:value>
    </con:property>
    <con:property>
      <con:name>Host3</con:name>
      <con:value>localhost</con:value>
    </con:property>
    <con:property>
      <con:name>LocalAA</con:name>
      <con:value>1.1</con:value>
    </con:property>
    <con:property>
      <con:name>LocalHCDescription</con:name>
      <con:value>InternalTest</con:value>
    </con:property>
    <con:property>
      <con:name>LocalHCID</con:name>
      <con:value>1.1</con:value>
    </con:property>
    <con:property>
      <con:name>LocalPatientID</con:name>
      <con:value>D123401</con:value>
    </con:property>
    <con:property>
      <con:name>RemoteAA1</con:name>
      <con:value>2.2</con:value>
    </con:property>
    <con:property>
      <con:name>RemoteAA2</con:name>
      <con:value>3.3</con:value>
    </con:property>
    <con:property>
      <con:name>RemoteHCDescription1</con:name>
      <con:value>InternalTest2</con:value>
    </con:property>
    <con:property>
      <con:name>RemoteHCDescription2</con:name>
      <con:value>InternalTest3</con:value>
    </con:property>
    <con:property>
      <con:name>RemoteHCID1</con:name>
      <con:value>2.2</con:value>
    </con:property>
    <con:property>
      <con:name>RemoteHCID2</con:name>
      <con:value>3.3</con:value>
    </con:property>
    <con:property>
      <con:name>GatewayPropDir</con:name>
      <con:value>c:\glassfish3\glassfish\domains\domain1\config\nhin</con:value>
    </con:property>
  </con:properties>
  <con:afterLoadScript>def propertiesFilename = project.path[0..(project.path.size()-4)] + 'properties'
def propertiesFile = new File(propertiesFilename)
if (propertiesFile.exists()) {
	def props = new Properties()
	props.load(new FileReader(propertiesFile))
	props.each { key, value ->
	    project.setPropertyValue(key, value)
	}
}

TimeZone.setDefault(TimeZone.getTimeZone("UTC"))
def testRunListener = [
  afterRun: { testRunner, runContext -> },
  afterStep: { testRunner, runContext, result -> },
  beforeStep: { testRunner, runContext -> },
  beforeStep: { testRunner, runContext, testStep -> },
  beforeRun: { testRunner, runContext ->
    use (org.codehaus.groovy.runtime.TimeCategory) {
      def startDate = 5.minutes.ago
      def endDate = 5.minutes.from.now
      def expireDate = 30.days.from.now

      def df = "yyyy-MM-dd'T'HH:mm:ss'Z'"
      def dfSig = "MM/dd/yyyy' 'HH:mm:ss"

      runContext.testCase.setPropertyValue("startDate", startDate.format(df))
      runContext.testCase.setPropertyValue("endDate", endDate.format(df))
      runContext.testCase.setPropertyValue("sigDate", startDate.format(dfSig))
      runContext.testCase.setPropertyValue("expireDate", expireDate.format(df))
    }
  }
] as com.eviware.soapui.model.testsuite.TestRunListener

project.testSuiteList*.testCaseList.flatten()*.addTestRunListener(testRunListener)

com.eviware.soapui.impl.wsdl.testcase.WsdlTestRunContext.metaClass.findProperty = { propertyName ->
    return delegate.getProperty(propertyName) ?:
                delegate.testCase.getPropertyValue(propertyName) ?:
                delegate.testCase.testSuite.getPropertyValue(propertyName) ?:
                delegate.testCase.testSuite.project.getPropertyValue(propertyName) ?:
                com.eviware.soapui.SoapUI.globalProperties.getPropertyValue(propertyName)
}

com.eviware.soapui.impl.wsdl.testcase.WsdlTestRunContext.metaClass.withSql = { dbOrPropertyName, block ->
  def dbName = delegate.findProperty(dbOrPropertyName) ?: dbOrPropertyName
  def host = delegate.findProperty('DBHost')
  def port = delegate.findProperty('DBPort')
  def user = delegate.findProperty('DBUser')
  def pass = delegate.findProperty('DBPass')

  def connectString = "jdbc:mysql://${host}:${port}/${dbName}"
  def sql = groovy.sql.Sql.newInstance(connectString, user, pass, "com.mysql.jdbc.Driver");
  try {
     block(sql)
  } finally {
    sql.close()
  }
}</con:afterLoadScript>
  <con:wssContainer/>
  <con:databaseConnectionContainer/>
  <con:oAuth2ProfileContainer/>
  <con:reporting>
    <con:xmlTemplates/>
    <con:xmlTemplates/>
    <con:xmlTemplates/>
    <con:xmlTemplates/>
    <con:xmlTemplates/>
    <con:xmlTemplates/>
    <con:xmlTemplates/>
    <con:xmlTemplates/>
    <con:xmlTemplates/>
    <con:xmlTemplates/>
    <con:xmlTemplates/>
    <con:xmlTemplates/>
    <con:xmlTemplates/>
    <con:xmlTemplates/>
    <con:xmlTemplates/>
    <con:xmlTemplates/>
    <con:xmlTemplates/>
    <con:xmlTemplates/>
    <con:xmlTemplates/>
    <con:xmlTemplates/>
    <con:xmlTemplates/>
    <con:xmlTemplates/>
    <con:xmlTemplates/>
    <con:xmlTemplates/>
    <con:xmlTemplates/>
    <con:parameters/>
  </con:reporting>
  <con:sensitiveInformation/>
</con:soapui-project>


text:
void GenerateEulersNumber() {
	int N = 9009, a[9009], x = 0;
	for (int n = N - 1; n > 0; --n) {
		a[n] = 1;
	}
	a[1] = 2;
	while (N > 9) {
		int n = N--;
		while (--n) {
			a[n] = x % n;
			x = 10 * a[n - 1] + x / n;
		}
		std::cout << x;
	}
	std::cout << std::endl;
}

// generate specific test case that you can trace with the trace conditions in cfloat.h
// for most bugs they are traceable with _trace_conversion and _trace_add
template<size_t nbits, size_t es, typename Ty>
void GenerateTestCase(Ty a) {
	Ty ref;
	sw::universal::cfloat<nbits, es> pa, pref, pexp;
	pa = a;
	ref = std::exp(a);
	pref = ref;
	pexp = sw::universal::exp(pa);
	std::cout << std::setprecision(nbits - 2);
	std::cout << std::setw(nbits) << a << " -> exp(" << a << ") = " << std::setw(nbits) << ref << std::endl;
	std::cout << to_binary(pa) << " -> exp( " << pa << ") = " << to_binary(pexp) << " (reference: " << to_binary(pref) << ")   ";
	std::cout << (pref == pexp ? "PASS" : "FAIL") << std::endl << std::endl;
	std::cout << std::setprecision(5);
}

#define MANUAL_TESTING 0
#define GENERATE_EXPONENT_TABLES 0

int main()
try {
	using namespace sw::universal;

//	GenerateEulersNumber();  // 9000 digits of e

	std::string test_suite  = "cfloat<> mathlib exponentiation validation";
	std::string test_tag    = "exponentiation";
	bool reportTestCases    = false;
	int nrOfFailedTestCases = 0;

	std::cout << test_suite << '\n';

#if MANUAL_TESTING
	// generate individual testcases to hand trace/debug
	GenerateTestCase<16, 1, float>(4.0f);

#if GENERATE_EXPONENT_TABLES

	GenerateExponentTable<5, 1>();
	GenerateExponentTable<5, 2>();
	GenerateExponentTable<6, 1>();
	GenerateExponentTable<6, 2>();
	GenerateExponentTable<6, 3>();
#endif

	cfloat<8, 2> a, aexp2, aref;
	a.setbits(0xFF);
	aexp2 = sw::universal::exp2(a);
	// generate reference
	double da = double(a);
	double dref = std::exp2(da);
	aref = dref;
	cout << to_binary(aref) << " : " << aref << " : " << to_binary(dref) << endl;
	cout << to_binary(ieee754_parameter<double>::fmask) << endl;
	cout << to_binary(ieee754_parameter<double>::snanmask) << endl;

	cout << endl;

	// manual exhaustive test
	nrOfFailedTestCases += ReportTestResult(VerifyExp< cfloat<8, 2, uint8_t> >(reportTestCases), "cfloat<8,2>", "exp");
	nrOfFailedTestCases += ReportTestResult(VerifyExp2< cfloat<8, 4, uint8_t> >(reportTestCases), "cfloat<8,4>", "exp2");

#else

	std::cout << "classic floating-point cfloat exponential function validation\n";

	nrOfFailedTestCases += ReportTestResult(VerifyExp< cfloat< 8, 2, uint8_t> >(reportTestCases), "cfloat<8,2>", "exp");
	nrOfFailedTestCases += ReportTestResult(VerifyExp< cfloat< 8, 3, uint8_t> >(reportTestCases), "cfloat<8,3>", "exp");
	nrOfFailedTestCases += ReportTestResult(VerifyExp< cfloat< 9, 2, uint8_t> >(reportTestCases), "cfloat<9,2>", "exp");
	nrOfFailedTestCases += ReportTestResult(VerifyExp< cfloat<10, 2, uint8_t> >(reportTestCases), "cfloat<10,2>", "exp");
	nrOfFailedTestCases += ReportTestResult(VerifyExp< cfloat<10, 3, uint8_t> >(reportTestCases), "cfloat<10,3>", "exp");
	nrOfFailedTestCases += ReportTestResult(VerifyExp< cfloat<12, 4, uint8_t> >(reportTestCases), "cfloat<12,4>", "exp");
	nrOfFailedTestCases += ReportTestResult(VerifyExp< cfloat<16, 5, uint8_t> >(reportTestCases), "cfloat<16,5>", "exp");

	// base-2 exponent testing
	nrOfFailedTestCases += ReportTestResult(VerifyExp2< cfloat<8, 2, uint8_t> >(reportTestCases), "cfloat<8,2>", "exp2");
	nrOfFailedTestCases += ReportTestResult(VerifyExp2< cfloat<8, 3, uint8_t> >(reportTestCases), "cfloat<8,3>", "exp2");
	nrOfFailedTestCases += ReportTestResult(VerifyExp2< cfloat<9, 2, uint8_t> >(reportTestCases), "cfloat<9,2>", "exp2");
	nrOfFailedTestCases += ReportTestResult(VerifyExp2< cfloat<10, 2, uint8_t> >(reportTestCases), "cfloat<10,2>", "exp2");
	nrOfFailedTestCases += ReportTestResult(VerifyExp2< cfloat<10, 3, uint8_t> >(reportTestCases), "cfloat<10,3>", "exp2");
	nrOfFailedTestCases += ReportTestResult(VerifyExp2< cfloat<12, 4, uint8_t> >(reportTestCases), "cfloat<12,4>", "exp2");
	nrOfFailedTestCases += ReportTestResult(VerifyExp2< cfloat<16, 5, uint8_t> >(reportTestCases), "cfloat<16,5>", "exp2");

	ReportTestSuiteResults(test_suite, nrOfFailedTestCases);
	return (nrOfFailedTestCases > 0 ? EXIT_FAILURE : EXIT_SUCCESS);

#endif  // MANUAL_TESTING
}
catch (char const* msg) {
	std::cerr << "Caught ad-hoc exception: " << msg << std::endl;
	return EXIT_FAILURE;
}
catch (const sw::universal::universal_arithmetic_exception& err) {
	std::cerr << "Caught unexpected universal arithmetic exception : " << err.what() << std::endl;
	return EXIT_FAILURE;
}
catch (const sw::universal::universal_internal_exception& err) {
	std::cerr << "Caught unexpected universal internal exception: " << err.what() << std::endl;
	return EXIT_FAILURE;
}
catch (const std::runtime_error& err) {
	std::cerr << "Caught runtime exception: " << err.what() << std::endl;
	return EXIT_FAILURE;
}
catch (...) {
	std::cerr << "Caught unknown exception" << std::endl;
	return EXIT_FAILURE;
}

redpajama_set_name: RedPajamaGithub


text:
package com.hazelcast.concurrent.countdownlatch.operations;

import com.hazelcast.concurrent.countdownlatch.LatchKey;
import com.hazelcast.nio.serialization.IdentifiedDataSerializable;
import com.hazelcast.spi.PartitionAwareOperation;
import com.hazelcast.spi.WaitNotifyKey;
import com.hazelcast.spi.impl.AbstractNamedOperation;

import static com.hazelcast.concurrent.countdownlatch.CountDownLatchDataSerializerHook.F_ID;
import static com.hazelcast.concurrent.countdownlatch.CountDownLatchService.SERVICE_NAME;

abstract class AbstractCountDownLatchOperation extends AbstractNamedOperation
        implements PartitionAwareOperation, IdentifiedDataSerializable {

    AbstractCountDownLatchOperation() {
    }

    AbstractCountDownLatchOperation(String name) {
        super(name);
    }

    @Override
    public final String getServiceName() {
        return SERVICE_NAME;
    }

    @Override
    public final int getFactoryId() {
        return F_ID;
    }

    WaitNotifyKey waitNotifyKey() {
        return new LatchKey(name);
    }
}


text:
import sys
if sys.maxsize > 2**32:
   from sws_python64 import *
else:
   from sws_python32 import *


text:
require "rails_helper"

describe Eve::UpdateTypeJob do
  it { should be_an(ApplicationJob) }

  it { expect(described_class.queue_name).to eq("default") }

  describe "#perform" do
    let(:type_id) { double }

    before do
      #
      # LanguageMapper::LANGUAGES.each_key do |locale|
      #   Eve::TypeImporter.new(type_id, locale).import
      # end
      #
      LanguageMapper::LANGUAGES.each_key do |locale|
        expect(Eve::TypeImporter).to receive(:new).with(type_id, locale) do
          double.tap do |a|
            expect(a).to receive(:import)
          end
        end
      end
    end

    specify { expect { subject.perform(type_id) }.not_to raise_error }
  end
end


text:
import { createStore, applyMiddleware } from 'redux';
import thunk from 'redux-thunk';
import rootReducer from '../reducer';

const configureStore = preloadedState => createStore(
  rootReducer,
  preloadedState,
  applyMiddleware(thunk)
);

export default configureStore;


text:
package com.dev.geochallenger.models;

import com.dev.geochallenger.models.api.GeoApi;
import com.dev.geochallenger.models.entities.DefaultResponse;
import com.dev.geochallenger.models.entities.LeaderBoardItem;
import com.dev.geochallenger.models.entities.Poi;
import com.dev.geochallenger.models.entities.PoiRequest;
import com.dev.geochallenger.models.entities.cities.PlacesEntity;
import com.dev.geochallenger.models.entities.cities.detailed.PlaceDetailedEntity;
import com.dev.geochallenger.models.entities.directions.GoogleDirectionsEntity;
import com.dev.geochallenger.models.entities.login.LoginResponce;
import com.dev.geochallenger.models.entities.login.UserResponce;
import com.dev.geochallenger.models.entities.routes.Route;
import com.dev.geochallenger.models.entities.routes.RouteResponse;
import com.dev.geochallenger.models.interfaces.IModel;
import com.dev.geochallenger.models.interfaces.OnDataLoaded;

import java.util.List;

import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

/**
 * Created by a_dibrivnyj on 4/16/16.
 */

public class RetrofitModel implements IModel {

    private static RetrofitModel instance;

    private static final String API_PATH = "http://testing-geochallenger-api.azurewebsites.net/";

    private volatile static GeoApi service;

    private RetrofitModel() {
        HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
        interceptor.setLevel(HttpLoggingInterceptor.Level.HEADERS);
        OkHttpClient client = new OkHttpClient.Builder().addInterceptor(interceptor).build();

        Retrofit retrofit = new Retrofit.Builder()
                .baseUrl(API_PATH)
                .client(client)
                .addConverterFactory(GsonConverterFactory.create())
                .build();

        service = retrofit.create(GeoApi.class);
    }

    public static RetrofitModel getInstance() {
        if (instance == null) {
            instance = new RetrofitModel();
        }
        return instance;
    }

    @Override
    public void getPoiList(final OnDataLoaded<List<Poi>> callback) {
        final Call<List<Poi>> listCall = service.listPois("", null, null, null, null);
        listCall.enqueue(new Callback<List<Poi>>() {
            @Override
            public void onResponse(Call<List<Poi>> call, Response<List<Poi>> response) {
                if (response.isSuccessful()) {
                    callback.onSuccess(response.body());
                } else {
                    callback.onError(new Throwable("error"), response.errorBody());
                }
            }

            @Override
            public void onFailure(Call<List<Poi>> call, Throwable t) {
                callback.onError(t, null);
            }
        });
    }

    @Override
    public void getPoiList(String query, Double topLeftLatitude, Double topLeftLongitude, Double bottomRightLatitude, Double bottomRightLongitude, final OnDataLoaded<List<Poi>> callback) {
        final Call<List<Poi>> listCall = service.listPois(query, topLeftLatitude, topLeftLongitude, bottomRightLatitude, bottomRightLongitude);
        listCall.enqueue(new Callback<List<Poi>>() {
            @Override
            public void onResponse(Call<List<Poi>> call, Response<List<Poi>> response) {
                if (response.isSuccessful()) {
                    callback.onSuccess(response.body());
                } else {
                    callback.onError(new Throwable("error"), response.errorBody());
                }
            }

            @Override
            public void onFailure(Call<List<Poi>> call, Throwable t) {
                callback.onError(t, null);
            }
        });
    }

    @Override
    public void getPoiList(String query, final OnDataLoaded<List<Poi>> callback) {
        final Call<List<Poi>> listCall = service.listPois(query);
        listCall.enqueue(new Callback<List<Poi>>() {
            @Override
            public void onResponse(Call<List<Poi>> call, Response<List<Poi>> response) {
                if (response.isSuccessful()) {
                    callback.onSuccess(response.body());
                } else {
                    callback.onError(new Throwable("error"), response.errorBody());
                }
            }

            @Override
            public void onFailure(Call<List<Poi>> call, Throwable t) {
                callback.onError(t, null);
            }
        });
    }

    @Override
    public void getPoiList(Double topLeftLatitude, Double topLeftLongitude, Double bottomRightLatitude, Double bottomRightLongitude, final OnDataLoaded<List<Poi>> callback) {
        final Call<List<Poi>> listCall = service.listPois(null, topLeftLatitude, topLeftLongitude, bottomRightLatitude, bottomRightLongitude);
        listCall.enqueue(new Callback<List<Poi>>() {
            @Override
            public void onResponse(Call<List<Poi>> call, Response<List<Poi>> response) {
                if (response.isSuccessful()) {
                    callback.onSuccess(response.body());
                } else {
                    callback.onError(new Throwable("error"), response.errorBody());
                }
            }

            @Override
            public void onFailure(Call<List<Poi>> call, Throwable t) {
                callback.onError(t, null);
            }
        });
    }

    @Override
    public void getPoiDetails(String id, final OnDataLoaded<Poi> callback) {
        final Call<Poi> poiCall = service.listPoiById(id);
        poiCall.enqueue(new Callback<Poi>() {
            @Override
            public void onResponse(Call<Poi> call, Response<Poi> response) {
                if (response.isSuccessful()) {
                    callback.onSuccess(response.body());
                } else {
                    callback.onError(new Throwable("error"), response.errorBody());
                }
            }

            @Override
            public void onFailure(Call<Poi> call, Throwable t) {
                callback.onError(t, null);
            }
        });
    }

    @Override
    public void calculateRoute(String origin, String destination, String waypoints, String key, final OnDataLoaded<GoogleDirectionsEntity> callback) {
        final Call<GoogleDirectionsEntity> poiCall = service.calculateRoute(origin, destination, waypoints, key);
        poiCall.enqueue(new Callback<GoogleDirectionsEntity>() {
            @Override
            public void onResponse(Call<GoogleDirectionsEntity> call, Response<GoogleDirectionsEntity> response) {
                if (response.isSuccessful()) {
                    callback.onSuccess(response.body());
                } else {
                    callback.onError(new Throwable("error"), response.errorBody());
                }
            }

            @Override
            public void onFailure(Call<GoogleDirectionsEntity> call, Throwable t) {
                callback.onError(t, null);
            }
        });
    }

    @Override
    public void getPlaces(String input, String key, final OnDataLoaded<PlacesEntity> callback) {
        final Call<PlacesEntity> cities = service.getPlaces(input, "en", key);
        cities.enqueue(new Callback<PlacesEntity>() {
            @Override
            public void onResponse(Call<PlacesEntity> call, Response<PlacesEntity> response) {
                if (response.isSuccessful()) {
                    callback.onSuccess(response.body());
                } else {
                    callback.onError(new Throwable("error"), response.errorBody());
                }
            }

            @Override
            public void onFailure(Call<PlacesEntity> call, Throwable t) {
                callback.onError(t, null);
            }
        });
    }

    @Override
    public void getPlace(String placeid, String key, final OnDataLoaded<PlaceDetailedEntity> callback) {
        final Call<PlaceDetailedEntity> cities = service.getPlaceDetailed(placeid, key);
        cities.enqueue(new Callback<PlaceDetailedEntity>() {
            @Override
            public void onResponse(Call<PlaceDetailedEntity> call, Response<PlaceDetailedEntity> response) {
                if (response.isSuccessful()) {
                    callback.onSuccess(response.body());
                } else {
                    callback.onError(new Throwable("error"), response.errorBody());
                }
            }

            @Override
            public void onFailure(Call<PlaceDetailedEntity> call, Throwable t) {
                callback.onError(t, null);
            }
        });
    }

    @Override
    public void createRoute(Route route, String token, final OnDataLoaded<DefaultResponse> callback) {
        final Call<DefaultResponse> response = service.createRoute("bearer " + token, route);
        response.enqueue(new Callback<DefaultResponse>() {
            @Override
            public void onResponse(Call<DefaultResponse> call, Response<DefaultResponse> response) {
                if (response.isSuccessful()) {
                    callback.onSuccess(response.body());
                } else {
                    callback.onError(new Throwable("error"), response.errorBody());
                }
            }

            @Override
            public void onFailure(Call<DefaultResponse> call, Throwable t) {
                callback.onError(t, null);
            }
        });
    }

    @Override
    public void updateRoute(int routeId, Route route, String token, final OnDataLoaded<DefaultResponse> callback) {
        final Call<DefaultResponse> response = service.updateRoute(routeId, "bearer " + token, route);
        response.enqueue(new Callback<DefaultResponse>() {
            @Override
            public void onResponse(Call<DefaultResponse> call, Response<DefaultResponse> response) {
                if (response.isSuccessful()) {
                    callback.onSuccess(response.body());
                } else {
                    callback.onError(new Throwable("error"), response.errorBody());
                }
            }

            @Override
            public void onFailure(Call<DefaultResponse> call, Throwable t) {
                callback.onError(t, null);
            }
        });
    }

    @Override
    public void deleteRoute(int routeId, String token, final OnDataLoaded<DefaultResponse> callback) {
        final Call<DefaultResponse> response = service.deleteRoute(routeId, "bearer " + token);
        response.enqueue(new Callback<DefaultResponse>() {
            @Override
            public void onResponse(Call<DefaultResponse> call, Response<DefaultResponse> response) {
                if (response.isSuccessful()) {
                    callback.onSuccess(response.body());
                } else {
                    callback.onError(new Throwable("error"), response.errorBody());
                }
            }

            @Override
            public void onFailure(Call<DefaultResponse> call, Throwable t) {
                callback.onError(t, null);
            }
        });
    }

    @Override
    public void getRoutesList(String token, final OnDataLoaded<List<RouteResponse>> callback) {
        final Call<List<RouteResponse>> response = service.getRoutesList("bearer " + token);
        response.enqueue(new Callback<List<RouteResponse>>() {
            @Override
            public void onResponse(Call<List<RouteResponse>> call, Response<List<RouteResponse>> response) {
                if (response.isSuccessful()) {
                    callback.onSuccess(response.body());
                } else {
                    callback.onError(new Throwable("error"), response.errorBody());
                }
            }

            @Override
            public void onFailure(Call<List<RouteResponse>> call, Throwable t) {
                callback.onError(t, null);
            }
        });
    }

    @Override
    public void login(String uid, String token, final OnDataLoaded<LoginResponce> callback) {
        final Call<LoginResponce> response = service.login("password", uid, token);
        response.enqueue(new Callback<LoginResponce>() {
            @Override
            public void onResponse(Call<LoginResponce> call, Response<LoginResponce> response) {
                if (response.isSuccessful()) {
                    callback.onSuccess(response.body());
                } else {
                    callback.onError(new Throwable("error"), response.errorBody());
                }
            }

            @Override
            public void onFailure(Call<LoginResponce> call, Throwable t) {
                callback.onError(t, null);
            }
        });
    }

    @Override
    public void getUser(String token, final OnDataLoaded<UserResponce> callback) {
        final Call<UserResponce> response = service.getUser("bearer " + token);
        response.enqueue(new Callback<UserResponce>() {
            @Override
            public void onResponse(Call<UserResponce> call, Response<UserResponce> response) {
                if (response.isSuccessful()) {
                    callback.onSuccess(response.body());
                } else {
                    callback.onError(new Throwable("error"), response.errorBody());
                }
            }

            @Override
            public void onFailure(Call<UserResponce> call, Throwable t) {
                callback.onError(t, null);
            }
        });
    }

    @Override
    public void createPoi(PoiRequest poiRequest, String token, final OnDataLoaded<Poi> callback) {
        final Call<Poi> response = service.createPoi("bearer " + token, poiRequest);
        response.enqueue(new Callback<Poi>() {
            @Override
            public void onResponse(Call<Poi> call, Response<Poi> response) {
                if (response.isSuccessful()) {
                    callback.onSuccess(response.body());
                } else {
                    callback.onError(new Throwable("error"), response.errorBody());
                }
            }

            @Override
            public void onFailure(Call<Poi> call, Throwable t) {
                callback.onError(t, null);
            }
        });
    }

    @Override
    public void updatePoi(PoiRequest poiRequest, String token, long id, final OnDataLoaded<Poi> callback) {
        final Call<Poi> response = service.updatePoi("bearer " + token, poiRequest, String.valueOf(id));
        response.enqueue(new Callback<Poi>() {
            @Override
            public void onResponse(Call<Poi> call, Response<Poi> response) {
                if (response.isSuccessful()) {
                    callback.onSuccess(response.body());
                } else {
                    callback.onError(new Throwable("error"), response.errorBody());
                }
            }

            @Override
            public void onFailure(Call<Poi> call, Throwable t) {
                callback.onError(t, null);
            }
        });
    }

    @Override
    public void checkinPoi(long poi, String token, Object object, final OnDataLoaded<DefaultResponse> callback) {
        final Call<DefaultResponse> response = service.checkinPoi(poi, "bearer " + token, object);
        response.enqueue(new Callback<DefaultResponse>() {
            @Override
            public void onResponse(Call<DefaultResponse> call, Response<DefaultResponse> response) {
                if (response.isSuccessful()) {
                    callback.onSuccess(response.body());
                } else {
                    callback.onError(new Throwable("error"), response.errorBody());
                }
            }

            @Override
            public void onFailure(Call<DefaultResponse> call, Throwable t) {
                callback.onError(t, null);
            }
        });
    }

    @Override
    public void getLeaderBoard(final OnDataLoaded<List<LeaderBoardItem>> callback) {
        final Call<List<LeaderBoardItem>> leaderboard = service.getLeaderboard(String.valueOf(30));
        leaderboard.enqueue(new Callback<List<LeaderBoardItem>>() {
            @Override
            public void onResponse(Call<List<LeaderBoardItem>> call, Response<List<LeaderBoardItem>> response) {
                if (response.isSuccessful()) {
                    callback.onSuccess(response.body());
                } else {
                    callback.onError(new Throwable("error"), response.errorBody());
                }
            }

            @Override
            public void onFailure(Call<List<LeaderBoardItem>> call, Throwable t) {
                callback.onError(t, null);
            }
        });
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<section version="5.0"
         xsi:schemaLocation="http://docbook.org/ns/docbook http://www.docbook.org/xml/5.0/xsd/docbook.xsd http://www.w3.org/1999/xlink http://www.docbook.org/xml/5.0/xsd/xlink.xsd"
         xml:base="../" xml:id="releaseNotes_6.0.0.Beta1" xmlns="http://docbook.org/ns/docbook"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema"
         xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude"
         xmlns:ns="http://docbook.org/ns/docbook">
  <title>What is New and Noteworthy in Drools 6.0.0</title>

    <title>Drools Expert</title>

      <title>TODO</title>
      <para>TODO</para>

    <title>Guvnor</title>

      <title>New Maven groupId: org.kie.guvnor</title>
      <para>The Maven groupId has changed from org.drools.guvnor to org.kie.guvnor.</para>
      <para>Before</para>
      <programlisting language="xml"><dependency>
  <groupId>org.drools.guvnor</groupId>
  ...
</dependency></programlisting>
      <para>After</para>
      <programlisting language="xml"><dependency>
        <groupId>org.kie.guvnor</groupId>
        ...
        </dependency></programlisting>

    <title>Planner</title>

      <title>TODO</title>
      <para>TODO</para>

    <title>Drools Integration</title>

      <title>TODO</title>
      <para>TODO</para>


text:
<?php

namespace Core\Controller;

class Base extends \Yaf\Controller_Abstract
{
    /**
     * config
     * @var null
     */
    protected $_conf = null;

    // 初始化
    public function init()
    {
        /**
         * config
         * @var [type]
         */
        $this->_conf = \Yaf\Registry::get("config");
        $this->_req = new \Core\Request($this->getRequest());
    }

    /**
     * 加载AppModule
     * @return [type] [description]
     */
    public function initAppModule()
    {
        $this->_view->assign('module', $this->_req->_module);
        $this->_view->assign('controller', $this->_req->_controller);
        $this->_view->assign('action', $this->_req->_action);
    }

    public function initSite()
    {

    }

    public function __get($key)
    {
        $val = '';
        switch (true) {
            case isset($this->_params[$key]):
                $val = $this->_params[$key];
                break;
            case isset($_GET[$key]):
                $val = $_GET[$key];
                break;
            case isset($_POST[$key]):
                $val = $_POST[$key];
                break;
            case isset($_COOKIE[$key]):
                $val = $_COOKIE[$key];
                break;
            case ($key == 'REQUEST_URI'):
                $val = $this->getRequestUri();
                break;
            case ($key == 'PATH_INFO'):
                $val = $this->getPathInfo();
                break;
            case isset($_SERVER[$key]):
                $val = $_SERVER[$key];
                break;
            case isset($_ENV[$key]):
                $val = $_ENV[$key];
                break;
            default:
                return null;
        }

        if(is_array($val)){
            foreach($val as $key=>$row){
                $val[$key] = htmlspecialchars(rawurldecode($row));
            }
        }else{
            $val = htmlspecialchars(rawurldecode($val));
        }
        return $val;
    }

    public function __isset($key)
    {
        switch (true) {
            case isset($this->_params[$key]):
                return true;
            case isset($_GET[$key]):
                return true;
            case isset($_POST[$key]):
                return true;
            case isset($_COOKIE[$key]):
                return true;
            case isset($_SERVER[$key]):
                return true;
            case isset($_ENV[$key]):
                return true;
            default:
                return false;
        }
    }

}


text:
package premun.mps.ingrid.parser;

import premun.mps.ingrid.model.*;
import premun.mps.ingrid.parser.model.*;
import premun.mps.ingrid.parser.exception.*;

import java.util.*;

/**
 * Class operates on a rule set generated by ANTLR parser.
 */
class GrammarResolver {
    /**
     * Resolves rules that weren't resolved during first parsing. That means
     * that everything that was discovered during first walk and is saved as
     * a string name will be replaced by reference to the this.rules element.
     * Flattens lexer rules so that they become either strings or regexes.
     *
     * @param parserResult Result of ANTLR parsing.
     * @return Resolved grammar ready to be imported to MPS.
     */
    public static GrammarInfo generateGrammar(ParserResult parserResult) throws IngridParserException {
        GrammarInfo grammar = new GrammarInfo(parserResult.grammarName);

        Map<String, Rule> rules = parserResult.rules;

        // Lexer rules must be resolved first so that parser rules can reference them
        // Lexer rules do not contain references to parser rules
        // We need to copy the array because we are changing it inside forEach
        new ArrayList<>(rules.keySet())
            .stream()
            .filter(name -> rules.get(name) instanceof LexerRule || rules.get(name) instanceof RegexRule)
            .forEach(name -> {
                FlatLexerRule flatRule = null;
                // We always get updated Rule from rule set again, because we might have updated it
                flatRule = flattenLexerRule(rules.get(name), rules);
                grammar.rules.put(name, flatRule);

                // We need to put it to the old set too, so resolving in the second step works too,
                // because we create new flatRule objects inside flattenLexerRule.
                rules.put(name, flatRule);
            });

        // We need to copy the array because we are changing it inside forEach
        new ArrayList<>(rules.values())
            .stream()
            .filter(r -> r instanceof ParserRule)
            .forEach(rule -> {
                resolveParserRule((ParserRule) rule, rules);

                // We do not call "new Rule" inside here, so we don't need to update old rule set.
                // Unlike in the first step, ParserRule objects stay the same, just their content is changed.
                grammar.rules.put(rule.name, rule);
            });

        grammar.rootRule = grammar.rules.get(parserResult.rootRule);

        return grammar;
    }

    /**
     *
     * Matches (string) references inside rule alternatives with actual
     * pointers to rule definitions.
     *
     * @param rule Rule to be resolved
     * @param rules Set of rules where we look up references.
     * @throws IngridParserException
     */
    private static void resolveParserRule(ParserRule rule, Map<String, Rule> rules) throws IngridParserException {
        // For each alternative line..
        for (Alternative alternative : rule.alternatives) {
            // For each element on the line..
            for (int i = 0; i < alternative.elements.size(); ++i) {
                RuleReference ref = alternative.elements.get(i);

                // Rule referenced in this alternative element
                Rule element = ref.rule;

                if (element instanceof UnresolvedRule) {
                    // Lexer rules were resolved first, so they are ready to be referenced
                    if (rules.containsKey(element.name)) {
                        Rule lookedUpRule = rules.get(element.name);
                        alternative.elements.set(i, new RuleReference(lookedUpRule, ref.quantity));
                    } else {
                        // Special EOF token might not be defined, but is a valid reference
                        if (element.name.equals("EOF")) {
                            // We can ignore this rule
                            alternative.elements.remove(i);
                            --i;
                            continue;
                        }

                        throw new IngridParserException(
                            "Couldn't resolve rule '" + element.name + "' (inside " + rule.name + ")");
                    }
                } else if (element instanceof QuantifierRule) {
                    if (i == 0) {
                        throw new IngridParserException(
                            "Quantifier suffix found with no previous reference");
                    }

                    // Apply quantifier to previous element of alternative
                    alternative.elements.get(i - 1).quantity = ((QuantifierRule) element).quantity;
                    // Remove quantifier itself
                    alternative.elements.remove(i);
                    --i;
                }
            }
        }
    }

    /**
     * Flattens rule into a regex or string literal.
     * When a cyclic rule is detected (references itself), an exception is raised.
     *
     * @param rule Rule to be resolved.
     * @param rules Set of rules where we look up references.
     */
    private static FlatLexerRule flattenLexerRule(Rule rule, Map<String, Rule> rules) {
        // Because some rules were resolved as a dependency of another rule,
        // it might happen that it is already flattened.
        if (rule instanceof FlatLexerRule) {
            return (FlatLexerRule) rule;
        }

        if (rule instanceof UnresolvedLexerRule) {
            throw new IngridParserException(
                "Rule '" + rule.name + "' must be resolved before flattening");
        }

        LexerRule lexerRule = (LexerRule) rule;

        // If we have only one element, we might be looking at a literal rule..
        // We count all elements of all alternatives:
        if (lexerRule.alternatives.size() == 1 && lexerRule.alternatives.get(0).size() == 1) {
            Rule only = lexerRule.alternatives.get(0).get(0);
            if (only instanceof LiteralRule) {
                return new LiteralRule(rule.name, ((LiteralRule) only).value);
            }
        }

        // We can construct one big regex out of sub rules
        List<List<String>> regexs = new ArrayList<>();

        // Gather all sub rule contents (or resolve them, if wasn't resolved before)
        for (List<Rule> alternative : lexerRule.alternatives) {
            List<String> subRegex = new ArrayList<>();

            for (Rule element : alternative) {
                // Is each sub element already resolved?
                if (!(element instanceof FlatLexerRule)) {
                    if (element instanceof QuantifierRule) {
                        int lastIndex = subRegex.size() - 1;

                        if (lastIndex < 0) {
                            throw new IngridParserException("Quantifier suffix found with no prefix regex");
                        }

                        // If more characters, we might need braces
                        // There are cases where we might not, such as [A-Z] or (foo), so might be improved a little
                        // It's tricky though, because of cases such as [A-Z][a-z], so simple heuristics is not enough
                        String prevRegex = subRegex.get(lastIndex);
                        if (prevRegex.length() > 1) {
                            prevRegex = '(' + prevRegex + ')';
                        }

                        // We append it to the previous rule
                        String quantifier = ((QuantifierRule) element).quantity.toString();

                        subRegex.set(lastIndex, prevRegex + quantifier);

                    } else if(element instanceof BlockStartRule) {
                        subRegex.add("(");
                    } else if(element instanceof BlockEndRule) {
                        subRegex.add(")");
                    } else if(element instanceof BlockAltRule) {
                        subRegex.add("|");
                    } else if (element instanceof UnresolvedLexerRule) {
                        if (!rules.containsKey(element.name)) {
                            throw new UnresolvableRuleException("Failed to resolve lexer rule '" + element.name + "'");
                        }

                        try {
                            FlatLexerRule flatRule = flattenLexerRule(rules.get(element.name), rules);
                            rules.put(element.name, flatRule);
                            subRegex.add(flatRule.getContent());
                        } catch (StackOverflowError t) {
                            throw new IngridParserException(
                                "Lexer rule '" + rule.name + "' or some of its subrules is recursive! " +
                                    "Ingrid cannot handle cyclic rules :(");
                        }
                    } else {
                        throw new IngridParserException(
                            "Rule '" + element.name + "' (" + element.getClass().getSimpleName() + ") failed to be flattened");
                    }
                } else {
                    // We need to escape literal rule
                    // e.g. <?xml   to   <\?xml
                    String regex;
                    if (element instanceof LiteralRule) {
                        regex = escapeLiteral((LiteralRule) element);
                    } else {
                        regex = ((FlatLexerRule) element).getContent();
                    }

                    subRegex.add(regex);
                }
            }

            regexs.add(subRegex);
        }

        // Build regex from gathered strings
        return new RegexRule(rule.name, buildLexerRegex(regexs));
    }

    /**
     * Helper method that turns {{a,b,c}, {d,(e|f)}} into ((a|b|c)|(d|(e|f))).
     *
     * @param alternatives Array of arrays of strings.
     * @return Flattened string ready for regex.
     */
    private static String buildLexerRegex(List<List<String>> alternatives) {
        StringBuilder expression = new StringBuilder();

        if (alternatives.size() == 1) {
            expression.append(String.join("", alternatives.get(0)));
        } else {
            expression.append('(');
            for (List<String> alt : alternatives) {
                // Here we are appending "|X" to "(Y|Z"
                if (expression.length() > 1) {
                    expression.append('|');
                }

                // If X does not contain a "|",
                // we don't need to put it in brackets..
                // This could be improved for cases such as "(a|b)",
                // which contains "|" but does not need brackets.
                String altRegex = String.join("", alt);
                if (altRegex.contains("|")) {
                    expression
                        .append('(')
                        .append(altRegex)
                        .append(')');
                } else {
                    expression
                        .append(altRegex);
                }
            }

            expression.append(')');
        }

        return expression.toString();
    }

    /**
     * Escapes special regex characters inside of a literal, so it can be used as regex.
     *
     * @param rule Literal rule
     */
    private static String escapeLiteral(LiteralRule rule) {
        String specialChars = "\\.[]{}()*+-?^$|";
        StringBuilder sb = new StringBuilder();

        for (int i = 0; i < rule.value.length(); ++i) {
            char c = rule.value.charAt(i);
            if (specialChars.indexOf(c) != -1) {
                sb.append("\\");
            }

            sb.append(c);
        }

        return sb.toString();
    }
}