text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.kie.server</groupId>
    <artifactId>kie-server-parent</artifactId>
    <version>7.0.0-SNAPSHOT</version>
  </parent>

  <artifactId>kie-server-tests</artifactId>
  <packaging>pom</packaging>

  <name>KIE :: Execution Server :: Tests</name>
  <description>KIE Execution Server Tests Parent</description>

  <!-- Properties shared between the different test modules -->
  <properties>
    <!-- This property needs to be overridden when running tests against different version of the WAR (e.g. running
         SNAPSHOT tests against Beta3 WAR) so the tests actually know what exact version of server is being tested -->
    <kie.server.version>${project.version}</kie.server.version>
    <!-- Following properties are used only for testing -->
    <container.hostname>localhost</container.hostname>
    <!-- <container.port/> can't define the default port value, because the build-helper-maven-plugin:reserve-network-port
         is not able to override the value of the property. The port number would then always be the same
         (the default one, unless changed from outside) -->
    <kie.server.context>kie-server-services</kie.server.context>
    <cargo.container.id>valid-id-needs-to-be-specified-in-appropriate-container-profile</cargo.container.id>
    <kie.server.controller.context>kie-server-controller-services</kie.server.controller.context>
    <kie.server.classifier>ee7</kie.server.classifier>
    <!-- Path to Kie server WAR file. Used for referencing WAR file in on-demand deployment/undeployment. -->
    <kie.server.war.path>${org.kie.server:kie-server:war:ee7}</kie.server.war.path>
    <kie.server.base.http.url>http://${container.hostname}:${container.port}/${kie.server.context}/services/rest/server</kie.server.base.http.url>
    <kie.server.controller.base.http.url>http://${container.hostname}:${container.port}/${kie.server.controller.context}/rest/controller</kie.server.controller.base.http.url>
    <kie.server.testing.server.local.repo.dir>${project.build.directory}/kie-server-testing-server-local-repo</kie.server.testing.server.local.repo.dir>
    <kie.server.testing.remote.repo.dir>${project.build.directory}/kie-server-testing-remote-repo</kie.server.testing.remote.repo.dir>
    <!-- This property can be overridden when some other remote repo location should be used -->
    <kie.server.testing.remote.repo.url>file://${kie.server.testing.remote.repo.dir}</kie.server.testing.remote.repo.url>
    <!-- Custom settings.xml used when building the testing kjars. By default there is no additional configuration needed,
         but for testing e.g. stated builds it is necessary to pass additional repository with the staged artifacts. -->
    <kie.server.testing.kjars.build.settings.xml/>
    <org.jbpm.document.storage>${project.build.directory}/docs</org.jbpm.document.storage>

    <version.tomcat8>8.0.33</version.tomcat8>
    <version.wildfly10>10.0.0.Final</version.wildfly10>
    <!-- The EAP 7 binary can't be anonymously downloaded because of the license. It can be downloaded manually
         and for free (e.g. from http://jbossas.jboss.org/downloads.html) and the zip location needs to be specified
         here or via system property when running the build (don't forget to use the `file://` prefix when
         referencing the zip from local filesystem). -->
    <eap7.download.url>valid-url-for-eap-7-needs-to-be-specified-here-or-via-cmd-line</eap7.download.url>
  </properties>

  <modules>
    <module>kie-server-integ-tests-common</module>
    <module>kie-server-integ-tests-drools</module>
    <module>kie-server-integ-tests-jbpm</module>
    <module>kie-server-integ-tests-optaplanner</module>
    <module>kie-server-integ-tests-all</module>
    <module>kie-server-integ-tests-controller</module>
  </modules>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.kie.server</groupId>
        <artifactId>kie-server-integ-tests-common</artifactId>
        <version>${version.org.kie}</version>
      </dependency>
      <dependency>
        <groupId>org.kie.server</groupId>
        <artifactId>kie-server-integ-tests-drools</artifactId>
        <version>${version.org.kie}</version>
      </dependency>
      <dependency>
        <groupId>org.kie.server</groupId>
        <artifactId>kie-server-integ-tests-jbpm</artifactId>
        <version>${version.org.kie}</version>
      </dependency>
      <dependency>
        <groupId>org.kie.server</groupId>
        <artifactId>kie-server-integ-tests-optaplanner</artifactId>
        <version>${version.org.kie}</version>
      </dependency>
      <dependency>
        <groupId>org.kie.server</groupId>
        <artifactId>kie-server-integ-tests-controller</artifactId>
        <version>${version.org.kie}</version>
      </dependency>
      <dependency>
        <groupId>org.kie.server</groupId>
        <artifactId>kie-server-integ-tests-all</artifactId>
        <version>${version.org.kie}</version>
      </dependency>
      <dependency>
        <groupId>org.codehaus.cargo</groupId>
        <artifactId>cargo-core-uberjar</artifactId>
        <version>${version.org.codehaus.cargo}</version>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.codehaus.cargo</groupId>
          <artifactId>cargo-maven2-plugin</artifactId>
          <configuration>
            <container>
              <containerId>${cargo.container.id}</containerId>
              <systemProperties>
                <kie.maven.settings.custom>${project.build.testOutputDirectory}/kie-server-testing-server-custom-settings.xml</kie.maven.settings.custom>
                <!-- Fixes issue when Tomcat hangs during deployment due to insufficient amount of entropy.
                     The property specifies less secure source of entropy, which is fine for testing.
                     See https://wiki.apache.org/tomcat/HowTo/FasterStartUp#Entropy_Source for more info -->
                <java.security.egd>file:/dev/./urandom</java.security.egd>
                <org.jbpm.document.storage>${org.jbpm.document.storage}</org.jbpm.document.storage>
              </systemProperties>
            </container>
            <deployables>
              <deployable>
                <groupId>${project.groupId}</groupId>
                <artifactId>kie-server</artifactId>
                <!-- default, may be overridden in container specific profiles -->
                <classifier>${kie.server.classifier}</classifier>
                <type>war</type>
                <properties>
                  <context>${kie.server.context}</context>
                </properties>
                <pingURL>${kie.server.base.http.url}</pingURL>
                <pingTimeout>30000</pingTimeout>
              </deployable>
            </deployables>
            <configuration>
              <properties>
                <cargo.servlet.port>${container.port}</cargo.servlet.port>
                <!-- kie-server role for REST tests; guest for JMS tests -->
                <cargo.servlet.users>yoda:usetheforce123@:kie-server,guest|Administrator:usetheforce123@:kie-server,guest,Administrators|john:usetheforce123@:kie-server,guest,engineering</cargo.servlet.users>
              </properties>
            </configuration>
          </configuration>
          <executions>
            <execution>
              <id>start-container</id>
              <phase>pre-integration-test</phase>
              <goals>
                <goal>start</goal>
              </goals>
            </execution>
            <execution>
              <id>stop-container</id>
              <phase>post-integration-test</phase>
              <goals>
                <goal>stop</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-failsafe-plugin</artifactId>
          <executions>
            <execution>
              <goals>
                <goal>integration-test</goal>
                <goal>verify</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>set-properties-for-dependencies</id>
            <phase>initialize</phase>
            <goals>
              <goal>properties</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>reserve-network-port</id>
            <goals>
              <goal>reserve-network-port</goal>
            </goals>
            <phase>pre-integration-test</phase>
            <configuration>
              <portNames>
                <portName>container.port</portName>
              </portNames>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <id>create-custom-maven-repo-dir</id>
            <phase>pre-integration-test</phase>
            <configuration>
              <tasks>
                <mkdir dir="${kie.server.testing.server.local.repo.dir}"/>
                <mkdir dir="${kie.server.testing.remote.repo.dir}"/>
              </tasks>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>tomcat8</id>
      <properties>
        <org.kie.server.persistence.ds>java:comp/env/jdbc/jbpm</org.kie.server.persistence.ds>
        <kie.server.classifier>webc</kie.server.classifier>
        <kie.server.war.path>${org.kie.server:kie-server:war:webc}</kie.server.war.path>
        <cargo.container.id>tomcat8x</cargo.container.id>
      </properties>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.codehaus.cargo</groupId>
              <artifactId>cargo-maven2-plugin</artifactId>
              <configuration>
                <container>
                  <type>installed</type>
                  <artifactInstaller>
                    <groupId>org.apache.tomcat</groupId>
                    <artifactId>tomcat</artifactId>
                    <version>${version.tomcat8}</version>
                  </artifactInstaller>
                  <systemProperties>
                    <tomcat.home>${project.build.directory}/cargo/configurations/tomcat8x</tomcat.home>
                    <conf.directory>${project.build.testOutputDirectory}</conf.directory>
                    <tmp.directory>${project.build.directory}</tmp.directory>
                    <jbpm.tsr.jndi.lookup>java:comp/env/TransactionSynchronizationRegistry</jbpm.tsr.jndi.lookup>
                    <org.kie.server.persistence.tm>org.hibernate.service.jta.platform.internal.BitronixJtaPlatform</org.kie.server.persistence.tm>
                    <org.kie.server.persistence.ds>java:comp/env/jdbc/jbpm</org.kie.server.persistence.ds>
                    <org.jboss.logging.provider>jdk</org.jboss.logging.provider>
                    <org.kie.server.sync.deploy>true</org.kie.server.sync.deploy>
                  </systemProperties>
                  <dependencies>
                    <dependency>
                      <groupId>org.codehaus.btm</groupId>
                      <artifactId>btm</artifactId>
                    </dependency>
                    <dependency>
                      <groupId>org.codehaus.btm</groupId>
                      <artifactId>btm-tomcat55-lifecycle</artifactId>
                    </dependency>
                    <dependency>
                      <groupId>com.h2database</groupId>
                      <artifactId>h2</artifactId>
                    </dependency>
                    <dependency>
                      <groupId>org.jboss.spec.javax.transaction</groupId>
                      <artifactId>jboss-transaction-api_1.2_spec</artifactId>
                    </dependency>
                    <dependency>
                      <groupId>org.slf4j</groupId>
                      <artifactId>slf4j-api</artifactId>
                    </dependency>
                    <dependency>
                      <groupId>org.slf4j</groupId>
                      <artifactId>slf4j-jdk14</artifactId>
                    </dependency>
                    <dependency>
                      <groupId>org.jboss.spec.javax.security.jacc</groupId>
                      <artifactId>jboss-jacc-api_1.5_spec</artifactId>
                    </dependency>
                  </dependencies>
                </container>
                <configuration>
                  <properties>
                    <cargo.jvmargs>-Xmx1024m</cargo.jvmargs>
                  </properties>
                </configuration>
              </configuration>
            </plugin>
            <plugin>
              <artifactId>maven-failsafe-plugin</artifactId>
              <configuration>
                <excludedGroups>org.kie.server.integrationtests.category.JMSOnly,org.kie.server.integrationtests.category.Email,org.kie.server.integrationtests.category.RemotelyControlled</excludedGroups>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
      <dependencies>
        <!-- Deps needed by Tomcat 8 -->
        <dependency>
          <groupId>org.codehaus.btm</groupId>
          <artifactId>btm</artifactId>
          <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>org.codehaus.btm</groupId>
          <artifactId>btm-tomcat55-lifecycle</artifactId>
          <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>com.h2database</groupId>
          <artifactId>h2</artifactId>
          <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>org.jboss.spec.javax.transaction</groupId>
          <artifactId>jboss-transaction-api_1.2_spec</artifactId>
          <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-jdk14</artifactId>
        </dependency>
        <dependency>
          <groupId>org.jboss.spec.javax.security.jacc</groupId>
          <artifactId>jboss-jacc-api_1.5_spec</artifactId>
          <scope>test</scope>
        </dependency>
      </dependencies>
    </profile>
    <profile>
      <id>wildfly10</id>
      <properties>
        <kie.server.remoting.url>http-remoting://${container.hostname}:${container.port}</kie.server.remoting.url>
        <org.kie.server.persistence.ds>java:jboss/datasources/ExampleDS</org.kie.server.persistence.ds>
        <cargo.container.id>wildfly10x</cargo.container.id>
      </properties>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.codehaus.cargo</groupId>
              <artifactId>cargo-maven2-plugin</artifactId>
              <configuration>
                <container>
                  <type>installed</type>
                  <artifactInstaller>
                    <groupId>org.wildfly</groupId>
                    <artifactId>wildfly-dist</artifactId>
                    <version>${version.wildfly10}</version>
                  </artifactInstaller>
                  <systemProperties>
                    <!-- disable JMS support for executor to use same tests for all containers for jbpm executor -->
                    <org.kie.executor.jms>false</org.kie.executor.jms>
                    <org.kie.server.sync.deploy>true</org.kie.server.sync.deploy>
                  </systemProperties>
                </container>
                <configuration>
                  <properties>
                    <cargo.jboss.configuration>standalone-full</cargo.jboss.configuration>
                    <cargo.jvmargs>-Xmx1024m</cargo.jvmargs>
                  </properties>
                </configuration>
              </configuration>
            </plugin>
            <plugin>
              <artifactId>maven-failsafe-plugin</artifactId>
              <configuration>
                <excludedGroups>org.kie.server.integrationtests.category.Email</excludedGroups>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
      <dependencyManagement>
        <dependencies>
          <!-- This is far from ideal, as it is not designed as BOM. However, there is nothing like wildfly-bom,
               so this is the closest thing I could find.
               Important: this overrides lots of the versions coming from kie-p-w-d -->
          <dependency>
            <groupId>org.wildfly</groupId>
            <artifactId>wildfly-parent</artifactId>
            <version>${version.wildfly10}</version>
            <type>pom</type>
            <scope>import</scope>
          </dependency>
          <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>${version.com.google.guava}</version>
          </dependency>
          <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-jaxrs</artifactId>
            <version>${version.org.jboss.resteasy}</version>
          </dependency>
          <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-jaxb-provider</artifactId>
            <version>${version.org.jboss.resteasy}</version>
          </dependency>
          <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-jackson-provider</artifactId>
            <version>${version.org.jboss.resteasy}</version>
          </dependency>
          <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>${version.org.apache.httpcomponents.httpclient}</version>
          </dependency>
          <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpcore</artifactId>
            <version>${version.org.apache.httpcomponents.httpcore}</version>
          </dependency>
          <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-aether-provider</artifactId>
            <version>${version.org.apache.maven}</version>
          </dependency>
          <dependency>
            <groupId>org.eclipse.aether</groupId>
            <artifactId>aether-api</artifactId>
            <version>${version.org.eclipse.aether}</version>
          </dependency>
          <dependency>
            <groupId>org.eclipse.aether</groupId>
            <artifactId>aether-util</artifactId>
            <version>${version.org.eclipse.aether}</version>
          </dependency>
          <dependency>
            <groupId>org.eclipse.aether</groupId>
            <artifactId>aether-impl</artifactId>
            <version>${version.org.eclipse.aether}</version>
          </dependency>
          <dependency>
            <groupId>org.eclipse.aether</groupId>
            <artifactId>aether-connector-basic</artifactId>
            <version>${version.org.eclipse.aether}</version>
          </dependency>
          <dependency>
            <groupId>org.eclipse.aether</groupId>
            <artifactId>aether-spi</artifactId>
            <version>${version.org.eclipse.aether}</version>
          </dependency>
          <dependency>
            <groupId>org.eclipse.aether</groupId>
            <artifactId>aether-transport-file</artifactId>
            <version>${version.org.eclipse.aether}</version>
          </dependency>
          <dependency>
            <groupId>org.eclipse.aether</groupId>
            <artifactId>aether-transport-http</artifactId>
            <version>${version.org.eclipse.aether}</version>
          </dependency>
          <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-impl</artifactId>
            <version>${version.com.sun.xml.bind}</version>
          </dependency>
        </dependencies>
      </dependencyManagement>
      <dependencies>
        <dependency>
          <groupId>org.wildfly</groupId>
          <artifactId>wildfly-jms-client-bom</artifactId>
          <type>pom</type>
          <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>org.wildfly.core</groupId>
          <artifactId>wildfly-controller-client</artifactId>
          <scope>test</scope>
        </dependency>
      </dependencies>
    </profile>
    <profile>
      <id>eap7</id>
      <properties>
        <kie.server.remoting.url>http-remoting://${container.hostname}:${container.port}</kie.server.remoting.url>
        <org.kie.server.persistence.ds>java:jboss/datasources/ExampleDS</org.kie.server.persistence.ds>
        <!-- eap7 is basically wildfly10; until there is a EAP 7 specific containerId, 'wildfly10x' should work just fine -->
        <cargo.container.id>wildfly10x</cargo.container.id>
      </properties>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.codehaus.cargo</groupId>
              <artifactId>cargo-maven2-plugin</artifactId>
              <configuration>
                <container>
                  <type>installed</type>
                  <zipUrlInstaller>
                    <url>${eap7.download.url}</url>
                  </zipUrlInstaller>
                  <systemProperties>
                    <!-- disable JMS support for executor touse same tests for all containers for jbpm executor -->
                    <org.kie.executor.jms>false</org.kie.executor.jms>
                    <org.kie.server.sync.deploy>true</org.kie.server.sync.deploy>
                  </systemProperties>
                </container>
                <configuration>
                  <properties>
                    <cargo.jboss.configuration>standalone-full</cargo.jboss.configuration>
                    <cargo.jvmargs>-Xmx1024m</cargo.jvmargs>
                  </properties>
                </configuration>
              </configuration>
            </plugin>
            <plugin>
              <artifactId>maven-failsafe-plugin</artifactId>
              <configuration>
                <excludedGroups>org.kie.server.integrationtests.category.Email</excludedGroups>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
      <dependencyManagement>
        <dependencies>
          <!-- This is far from ideal, as it is not designed as BOM. However, there is nothing like wildfly-bom,
               so this is the closest thing I could find.
               Important: this overrides lots of the versions coming from kie-p-w-d -->
          <dependency>
            <groupId>org.wildfly</groupId>
            <artifactId>wildfly-parent</artifactId>
            <version>${version.wildfly10}</version>
            <type>pom</type>
            <scope>import</scope>
          </dependency>
          <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>${version.com.google.guava}</version>
          </dependency>
          <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-jaxrs</artifactId>
            <version>${version.org.jboss.resteasy}</version>
          </dependency>
          <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-jaxb-provider</artifactId>
            <version>${version.org.jboss.resteasy}</version>
          </dependency>
          <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-jackson-provider</artifactId>
            <version>${version.org.jboss.resteasy}</version>
          </dependency>
          <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>${version.org.apache.httpcomponents.httpclient}</version>
          </dependency>
          <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpcore</artifactId>
            <version>${version.org.apache.httpcomponents.httpcore}</version>
          </dependency>
          <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-aether-provider</artifactId>
            <version>${version.org.apache.maven}</version>
          </dependency>
          <dependency>
            <groupId>org.eclipse.aether</groupId>
            <artifactId>aether-api</artifactId>
            <version>${version.org.eclipse.aether}</version>
          </dependency>
          <dependency>
            <groupId>org.eclipse.aether</groupId>
            <artifactId>aether-util</artifactId>
            <version>${version.org.eclipse.aether}</version>
          </dependency>
          <dependency>
            <groupId>org.eclipse.aether</groupId>
            <artifactId>aether-impl</artifactId>
            <version>${version.org.eclipse.aether}</version>
          </dependency>
          <dependency>
            <groupId>org.eclipse.aether</groupId>
            <artifactId>aether-connector-basic</artifactId>
            <version>${version.org.eclipse.aether}</version>
          </dependency>
          <dependency>
            <groupId>org.eclipse.aether</groupId>
            <artifactId>aether-spi</artifactId>
            <version>${version.org.eclipse.aether}</version>
          </dependency>
          <dependency>
            <groupId>org.eclipse.aether</groupId>
            <artifactId>aether-transport-file</artifactId>
            <version>${version.org.eclipse.aether}</version>
          </dependency>
          <dependency>
            <groupId>org.eclipse.aether</groupId>
            <artifactId>aether-transport-http</artifactId>
            <version>${version.org.eclipse.aether}</version>
          </dependency>
          <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-impl</artifactId>
            <version>${version.com.sun.xml.bind}</version>
          </dependency>
        </dependencies>
      </dependencyManagement>
      <dependencies>
        <dependency>
          <groupId>org.wildfly</groupId>
          <artifactId>wildfly-jms-client-bom</artifactId>
          <type>pom</type>
          <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>org.wildfly.core</groupId>
          <artifactId>wildfly-controller-client</artifactId>
          <scope>test</scope>
        </dependency>
      </dependencies>
    </profile>
    <profile>
      <id>oracle-wls-12</id>
      <properties>
        <kie.server.remoting.url>t3://${container.hostname}:${container.port}</kie.server.remoting.url>
        <kie.server.context.factory>weblogic.jndi.WLInitialContextFactory</kie.server.context.factory>
        <kie.server.jndi.request.queue>jms/KIE.SERVER.REQUEST</kie.server.jndi.request.queue>
        <kie.server.jndi.response.queue>jms/KIE.SERVER.RESPONSE</kie.server.jndi.response.queue>
        <kie.server.connection.factory>jms/cf/KIE.SERVER.REQUEST</kie.server.connection.factory>
        <kie.server.context>kie-server-${project.version}-${kie.server.classifier}</kie.server.context>
        <kie.server.controller.context>kie-server-controller-${project.version}-${kie.server.classifier}</kie.server.controller.context>
        <org.kie.server.persistence.ds>jdbc/jbpm</org.kie.server.persistence.ds>
        <cargo.container.id>weblogic122x</cargo.container.id>
      </properties>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.codehaus.cargo</groupId>
              <artifactId>cargo-maven2-plugin</artifactId>
              <configuration>
                <container>
                  <type>installed</type>
                  <home>${weblogic.home}/wlserver</home>
                  <systemProperties>
                    <org.kie.server.persistence.tm>org.hibernate.service.jta.platform.internal.WeblogicJtaPlatform</org.kie.server.persistence.tm>
                    <org.kie.server.persistence.ds>jdbc/jbpm</org.kie.server.persistence.ds>
                    <org.kie.server.domain>OracleDefaultLoginConfiguration</org.kie.server.domain>
                    <org.kie.executor.jms.cf>jms/cf/KIE.SERVER.EXECUTOR</org.kie.executor.jms.cf>
                    <org.kie.executor.jms.queue>jms/KIE.SERVER.EXECUTOR</org.kie.executor.jms.queue>
                    <org.kie.server.controller.connect>50000</org.kie.server.controller.connect>
                    <!-- disable JMS support for executor touse same tests for all containers for jbpm excutor -->
                    <org.kie.executor.jms>false</org.kie.executor.jms>
                    <org.kie.server.sync.deploy>true</org.kie.server.sync.deploy>
                  </systemProperties>
                  <dependencies>
                    <dependency>
                      <groupId>com.h2database</groupId>
                      <artifactId>h2</artifactId>
                    </dependency>
                    <dependency>
                      <groupId>xerces</groupId>
                      <artifactId>xercesImpl</artifactId>
                    </dependency>
                  </dependencies>
                </container>
                <configuration>
                  <type>standalone</type>
                  <properties>
                    <cargo.jvmargs>-Xmx1024m -Dkie.server.jms.queues.response=jms/KIE.SERVER.RESPONSE</cargo.jvmargs>
                    <!-- CFs -->
                    <cargo.resource.resource.jms.cf.request>
                      cargo.resource.name=jms/cf/KIE.SERVER.REQUEST|
                      cargo.resource.type=javax.jms.ConnectionFactory|
                      cargo.resource.id=KIE.SERVER.REQUEST
                    </cargo.resource.resource.jms.cf.request>
                    <cargo.resource.resource.jms.cf.response>
                      cargo.resource.name=jms/cf/KIE.SERVER.RESPONSE|
                      cargo.resource.type=javax.jms.ConnectionFactory|
                      cargo.resource.id=KIE.SERVER.RESPONSE
                    </cargo.resource.resource.jms.cf.response>
                    <cargo.resource.resource.jms.executor.cf.request>
                      cargo.resource.name=jms/cf/KIE.SERVER.EXECUTOR|
                      cargo.resource.type=javax.jms.ConnectionFactory|
                      cargo.resource.id=KIE.SERVER.EXECUTOR
                    </cargo.resource.resource.jms.executor.cf.request>
                    <!-- Qs -->
                    <cargo.resource.resource.jms.queue.request>
                      cargo.resource.name=jms/KIE.SERVER.REQUEST|
                      cargo.resource.type=javax.jms.Queue|
                      cargo.resource.id=KIE.SERVER.REQUEST
                    </cargo.resource.resource.jms.queue.request>
                    <cargo.resource.resource.jms.queue.response>
                      cargo.resource.name=jms/KIE.SERVER.RESPONSE|
                      cargo.resource.type=javax.jms.Queue|
                      cargo.resource.id=KIE.SERVER.RESPONSE
                    </cargo.resource.resource.jms.queue.response>
                    <cargo.resource.resource.jms.executor.queue.request>
                      cargo.resource.name=jms/KIE.SERVER.EXECUTOR|
                      cargo.resource.type=javax.jms.Queue|
                      cargo.resource.id=KIE.SERVER.EXECUTOR
                    </cargo.resource.resource.jms.executor.queue.request>
                    <!-- Datasource -->
                    <cargo.datasource.datasource.h2>
                      cargo.datasource.driver=org.h2.Driver|
                      cargo.datasource.url=jdbc:h2:mem:test-db|
                      cargo.datasource.jndi=jdbc/jbpm|
                      cargo.datasource.username=sa|
                      cargo.datasource.password=|
                      cargo.datasource.transactionsupport=XA_TRANSACTION
                    </cargo.datasource.datasource.h2>
                  </properties>
                </configuration>
              </configuration>
            </plugin>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-failsafe-plugin</artifactId>
              <configuration>
                <additionalClasspathElements>
                  <additionalClasspathElement>${weblogic.home}/wlserver/server/lib/wljmsclient.jar</additionalClasspathElement>
                </additionalClasspathElements>
                <excludedGroups>org.kie.server.integrationtests.category.Email</excludedGroups>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
      <dependencies>
        <dependency>
          <groupId>com.h2database</groupId>
          <artifactId>h2</artifactId>
          <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>xerces</groupId>
          <artifactId>xercesImpl</artifactId>
          <scope>test</scope>
        </dependency>
      </dependencies>
    </profile>
    <profile>
      <id>was85x</id>
      <properties>
        <container.port>9080</container.port>
        <kie.server.remoting.url>iiop://${container.hostname}:2809</kie.server.remoting.url>
        <kie.server.context.factory>com.ibm.websphere.naming.WsnInitialContextFactory</kie.server.context.factory>
        <kie.server.jndi.request.queue>jms/KIE.SERVER.REQUEST</kie.server.jndi.request.queue>
        <kie.server.jndi.response.queue>jms/KIE.SERVER.RESPONSE</kie.server.jndi.response.queue>
        <kie.server.connection.factory>jms/cf/KIE.SERVER.REQUEST</kie.server.connection.factory>
        <org.kie.server.persistence.ds>jdbc/jbpm</org.kie.server.persistence.ds>
        <kie.server.classifier>ee6</kie.server.classifier>
        <cargo.container.id>websphere85x</cargo.container.id>
      </properties>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.codehaus.cargo</groupId>
              <artifactId>cargo-maven2-plugin</artifactId>
              <configuration>
                <container>
                  <type>installed</type>
                  <home>${websphere.home}</home>
                  <timeout>240000</timeout>
                  <systemProperties>
                    <org.kie.server.persistence.tm>org.hibernate.service.jta.platform.internal.WebSphereExtendedJtaPlatform</org.kie.server.persistence.tm>
                    <org.kie.server.persistence.ds>jdbc/jbpm</org.kie.server.persistence.ds>
                    <org.kie.server.domain>WSLogin</org.kie.server.domain>
                    <org.kie.executor.jms.cf>jms/cf/KIE.SERVER.EXECUTOR</org.kie.executor.jms.cf>
                    <org.kie.executor.jms.queue>jms/KIE.SERVER.EXECUTOR</org.kie.executor.jms.queue>
                    <kie.server.jms.queues.response>jms/KIE.SERVER.RESPONSE</kie.server.jms.queues.response>
                    <!-- disable JMS support for executor to use same tests for all containers for jbpm excutor -->
                    <org.kie.executor.jms>false</org.kie.executor.jms>
                    <org.kie.server.sync.deploy>true</org.kie.server.sync.deploy>
                  </systemProperties>
                  <dependencies>
                    <dependency>
                      <groupId>com.h2database</groupId>
                      <artifactId>h2</artifactId>
                    </dependency>
                  </dependencies>
                </container>
                <configuration>
                  <type>standalone</type>
                  <properties>
                    <cargo.websphere.profile>${project.artifactId}</cargo.websphere.profile>
                    <cargo.jvmargs>-Xms2g -Xmx2g</cargo.jvmargs>
                    <cargo.websphere.classloader.mode>PARENT_LAST</cargo.websphere.classloader.mode>
                    <cargo.websphere.war.classloader.policy>SINGLE</cargo.websphere.war.classloader.policy>
                    <!-- CFs -->
                    <cargo.resource.resource.jms.cf.request>
                      cargo.resource.name=jms/cf/KIE.SERVER.REQUEST|
                      cargo.resource.type=javax.jms.ConnectionFactory|
                      cargo.resource.id=KIE.SERVER.REQUEST
                    </cargo.resource.resource.jms.cf.request>
                    <cargo.resource.resource.jms.cf.response>
                      cargo.resource.name=jms/cf/KIE.SERVER.RESPONSE|
                      cargo.resource.type=javax.jms.ConnectionFactory|
                      cargo.resource.id=KIE.SERVER.RESPONSE
                    </cargo.resource.resource.jms.cf.response>
                    <cargo.resource.resource.jms.executor.cf.request>
                      cargo.resource.name=jms/cf/KIE.SERVER.EXECUTOR|
                      cargo.resource.type=javax.jms.ConnectionFactory|
                      cargo.resource.id=KIE.SERVER.EXECUTOR
                    </cargo.resource.resource.jms.executor.cf.request>
                    <!-- Qs -->
                    <cargo.resource.resource.jms.queue.request>
                      cargo.resource.name=jms/KIE.SERVER.REQUEST|
                      cargo.resource.type=javax.jms.Queue|
                      cargo.resource.id=KIE.SERVER.REQUEST
                    </cargo.resource.resource.jms.queue.request>
                    <cargo.resource.resource.jms.queue.response>
                      cargo.resource.name=jms/KIE.SERVER.RESPONSE|
                      cargo.resource.type=javax.jms.Queue|
                      cargo.resource.id=KIE.SERVER.RESPONSE
                    </cargo.resource.resource.jms.queue.response>
                    <cargo.resource.resource.jms.executor.queue.request>
                      cargo.resource.name=jms/KIE.SERVER.EXECUTOR|
                      cargo.resource.type=javax.jms.Queue|
                      cargo.resource.id=KIE.SERVER.EXECUTOR
                    </cargo.resource.resource.jms.executor.queue.request>
                    <!-- Datasource -->
                    <cargo.datasource.datasource.h2>
                      cargo.datasource.driver=org.h2.jdbcx.JdbcDataSource|
                      cargo.datasource.url=jdbc:h2:mem:test-db|
                      cargo.datasource.jndi=jdbc/jbpm|
                      cargo.datasource.username=sa|
                      cargo.datasource.password=|
                      cargo.datasource.transactionsupport=XA_TRANSACTION
                    </cargo.datasource.datasource.h2>
                    <!-- Binding -->
                    <cargo.websphere.ejb.act.binding>
                      kie-server-services:KieServerMDB:jms/KIE.SERVER.REQUEST|
                      kie-server-services:KieExecutorMDB:jms/KIE.SERVER.EXECUTOR
                    </cargo.websphere.ejb.act.binding>
                    <cargo.websphere.ejb.res.binding>
                      kie-server-services:KieServerMDB:org.kie.server.jms.KieServerMDB/factory:jms/cf/KIE.SERVER.REQUEST
                    </cargo.websphere.ejb.res.binding>
                  </properties>
                </configuration>
              </configuration>
            </plugin>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-failsafe-plugin</artifactId>
              <configuration>
                <additionalClasspathElements>
                  <additionalClasspathElement>${websphere.home}/runtimes/com.ibm.ws.ejb.thinclient_8.5.0.jar</additionalClasspathElement>
                  <additionalClasspathElement>${websphere.home}/runtimes/com.ibm.ws.sib.client.thin.jms_8.5.0.jar</additionalClasspathElement>
                  <additionalClasspathElement>${websphere.home}/runtimes/com.ibm.ws.orb_8.5.0.jar</additionalClasspathElement>
                </additionalClasspathElements>
                <excludedGroups>org.kie.server.integrationtests.category.Email,org.kie.server.integrationtests.category.RemotelyControlled</excludedGroups>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
      <dependencyManagement>
        <dependencies>
          <!-- Need to raise H2 version because of bug in H2 usage for WAS. -->
          <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>test</scope>
            <version>1.3.176</version>
          </dependency>
        </dependencies>
      </dependencyManagement>
      <dependencies>
        <dependency>
          <groupId>com.h2database</groupId>
          <artifactId>h2</artifactId>
        </dependency>
      </dependencies>
    </profile>
    <!-- This profile basically disables any cargo related execution. It can be used when the tests should run on
         a container that has already been started and it is not managed by cargo. It can also be used when doing
         a "no-test" build, as the container should not be used in that case. -->
    <profile>
      <id>custom-container</id>
      <activation>
        <!-- The tests are not executed unless specific container profile is used. Disable cargo by default. -->
        <activeByDefault>true</activeByDefault>
        <property>
          <name>custom-container</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven2-plugin</artifactId>
            <executions>
              <execution>
                <id>start-container</id>
                <phase>none</phase>
                <goals/>
                <!-- do nothing, container is not managed by cargo -->
              </execution>
              <execution>
                <id>stop-container</id>
                <phase>none</phase>
                <goals/>
                <!-- do nothing, container is not managed by cargo -->
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <!-- Run just smoke tests to check basic functionality. -->
      <id>smoke</id>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <artifactId>maven-failsafe-plugin</artifactId>
              <configuration>
                <groups>org.kie.server.integrationtests.category.Smoke</groups>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
    </profile>
    <profile>
      <!-- Integration tests are skipped by default. They are activated when specific container profile is used. -->
      <id>skipITs-by-default</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <artifactId>maven-failsafe-plugin</artifactId>
              <configuration>
                <skipITs>true</skipITs>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
    </profile>
  </profiles>
</project>


text:
namespace Microsoft.Azure.Management.IotHub
{
    using Microsoft.Rest;
    using Microsoft.Rest.Azure;
    using Models;
    using System.Collections;
    using System.Collections.Generic;
    using System.Threading;
    using System.Threading.Tasks;

    /// <summary>
    /// ResourceProviderCommonOperations operations.
    /// </summary>
    public partial interface IResourceProviderCommonOperations
    {
        /// <summary>
        /// Get the number of iot hubs in the subscription
        /// </summary>
        /// <remarks>
        /// Get the number of free and paid iot hubs in the subscription
        /// </remarks>
        /// <param name='customHeaders'>
        /// The headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="ErrorDetailsException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="Microsoft.Rest.SerializationException">
        /// Thrown when unable to deserialize the response
        /// </exception>
        /// <exception cref="Microsoft.Rest.ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        Task<AzureOperationResponse<UserSubscriptionQuotaListResult>> GetSubscriptionQuotaWithHttpMessagesAsync(Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
    }
}

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace Application;

use Zend\Mvc\ModuleRouteListener;
use Zend\Mvc\MvcEvent;

use Zend\Db\ResultSet\ResultSet;
use Zend\Db\TableGateway\TableGateway;

use Zend\Session\Container;

use Application\Model\BO\ActividadesBO;
use Application\Model\Entity\Actividades;

use Application\Model\BO\ObjetosBO;
use Application\Model\Entity\Objetos;

use Application\Model\BO\EtiquetasBO;
use Application\Model\Entity\Etiquetas;
use Application\Model\Entity\ObjetosEtiquetas;

use Application\Model\BO\TipoObjetosBO;
use Application\Model\Entity\TipoObjetos;

use Application\Model\BO\UsuariosBO;
use Application\Model\Entity\Usuarios;

use Application\Model\BO\AreasBO;
use Application\Model\Entity\Areas;

class Module
{

    public function onBootstrap(MvcEvent $e)
    {
        $app = $e->getParam("application");

        $app->getEventManager()->attach(
            'dispatch',
            array(
             $this,
             'initAuth',
            ),
            200
        );

        $moduleRouteListener = new ModuleRouteListener();
        $eventManager        = $e->getApplication()->getEventManager();
        $moduleRouteListener->attach($eventManager);

    }

    public function initAuth(MvcEvent $e)
    {
        $matches     = $e->getRouteMatch();

        $controller = $matches->getParam('controller');
        $action     = $matches->getParam('action');

        $sesion = new Container('reminderSesion');

        // ¿Es el controlador de errores?
        if ($controller === "Application\Controller\Error") {
            // No valida permisos
            return;
        }

        // No valida permisos
        if ($action == "error") {
            return;
        }

        // ¿es la página de Marketing?
        if ($controller === "Application\Controller\Index" && in_array($action, array('index'))) {
            // ¿Tiene una sesión activa ?
            if ($sesion->offsetExists('user_username')) {
                // Si se encuentra en la página de marketing y tiene una sesion activa
                // se lo envia de regreso a la página principal
                $matches->setParam("controller", "Application\Controller\Inicio");
                $matches->setParam("action", "index");
                // return;
            } else {
                // Si no tiene una sesion activa se lo deja permanecer en la página de marketing
                return;
            }
        }

        if ($controller === "Application\Controller\Admin" && in_array($action, array('colaborar'))) {
            return;
        }

        // ¿es el login o se está autenticando ?
        if ($controller === "Application\Controller\Login" && in_array($action, array('index', 'autenticar', 'logout'))) {
            if ($action == "logout") {
                return;
            }

            if ($sesion->offsetExists('user_username')) {
                // Si se encuentra en la página de marketing y tiene una sesion activa
                // se lo envia de regreso a la página principal
                $matches->setParam("controller", "Application\Controller\Inicio");
                $matches->setParam("action", "index");
                // return;
            } else {
                // Si no tiene una sesion activa se lo deja permanecer en la página de marketing
                return;
            }
        }

        // var_dump($sesion->offsetExists('user_username'));exit();
        // Si no hay acl con esto se valida que inicie sesión
        if (!$sesion->offsetExists('user_username')) {
            $matches->setParam("controller", "Application\Controller\Login");
            $matches->setParam("action", "index");
            return;
        }

    }

    public function getConfig()
    {
        return include __DIR__.'/config/module.config.php';

    }

    public function getAutoloaderConfig()
    {
        return array(
                'Zend\Loader\StandardAutoloader' => array(
                                                     'namespaces' => array(
                                                                      __NAMESPACE__ => __DIR__.'/src/'.__NAMESPACE__,
                                                                     ),
                                                    ),
               );

    }

    public function getControllerConfig()
    {
        return array(
                'factories' => array(
                                'Application\Controller\Login' => function ($sm) {

                                    $locator = $sm->getServiceLocator();
                                    // $logger = $locator->get('Zend\Log');
                                    $controller = new \Application\Controller\LoginController();
                                    $controller->setLogin($locator->get('Application\Model\Login'));
                                    // $controller->setLogger($logger);
                                    return $controller;
                                },

                               ),
               );

    }

    public function getServiceConfig()
    {
        return array(
                'factories' => array(
                                'Application\Model\Login'         => function ($sm) {

                                    $dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
                                    return new \Application\Model\Login($dbAdapter);
                                },
                                'Application\Model\ActividadesBO' => function ($sm) {

                                    $tableGateway = $sm->get("ActividadesTableGateway");
                                    $actividadesBO = new ActividadesBO($tableGateway);
                                    return $actividadesBO;
                                },
                                'ActividadesTableGateway'         => function ($sm) {

                                    $dbAdapter = $sm->get("Zend\Db\Adapter\Adapter");
                                    $resultSetPrototype = new ResultSet();
                                    $resultSetPrototype->setArrayObjectPrototype(new Actividades());
                                    return new TableGateway("actividades", $dbAdapter, null, $resultSetPrototype);
                                },
                                'Application\Model\ObjetosBO'     => function ($sm) {

                                    $tableGateway = $sm->get("ObjetosTableGateway");
                                    $objetosBO = new ObjetosBO($tableGateway);
                                    return $objetosBO;
                                },
                                'ObjetosTableGateway'             => function ($sm) {

                                    $dbAdapter = $sm->get("Zend\Db\Adapter\Adapter");
                                    $resultSetPrototype = new ResultSet();
                                    $resultSetPrototype->setArrayObjectPrototype(new Objetos());
                                    return new TableGateway("objetos", $dbAdapter, null, $resultSetPrototype);
                                },
                                'Application\Model\EtiquetasBO'   => function ($sm) {

                                    $etiquetasTableGateway = $sm->get("EtiquetasTableGateway");
                                    $objetosEtiquetasTableGateway = $sm->get("ObjetosEtiquetasTableGateway");
                                    $etiquetasBO = new EtiquetasBO($etiquetasTableGateway, $objetosEtiquetasTableGateway);
                                    return $etiquetasBO;
                                },
                                'EtiquetasTableGateway'           => function ($sm) {

                                    $dbAdapter = $sm->get("Zend\Db\Adapter\Adapter");
                                    $resultSetPrototype = new ResultSet();
                                    $resultSetPrototype->setArrayObjectPrototype(new Etiquetas());
                                    return new TableGateway("etiquetas", $dbAdapter, null, $resultSetPrototype);
                                },
                                'ObjetosEtiquetasTableGateway'    => function ($sm) {

                                    $dbAdapter = $sm->get("Zend\Db\Adapter\Adapter");
                                    $resultSetPrototype = new ResultSet();
                                    $resultSetPrototype->setArrayObjectPrototype(new ObjetosEtiquetas());
                                    return new TableGateway("objetos_etiquetas", $dbAdapter, null, $resultSetPrototype);
                                },
                                'Application\Model\TipoObjetosBO' => function ($sm) {

                                    $tableGateway = $sm->get("TipoObjetosTableGateway");
                                    $tipoObjetosBO = new TipoObjetosBO($tableGateway);
                                    return $tipoObjetosBO;
                                },
                                'TipoObjetosTableGateway'         => function ($sm) {

                                    $dbAdapter = $sm->get("Zend\Db\Adapter\Adapter");
                                    $resultSetPrototype = new ResultSet();
                                    $resultSetPrototype->setArrayObjectPrototype(new TipoObjetos());
                                    return new TableGateway("tipo_objeto", $dbAdapter, null, $resultSetPrototype);
                                },
                                'Application\Model\UsuariosBO'    => function ($sm) {

                                    $tableGateway = $sm->get("UsuariosTableGateway");
                                    $usuariosBO = new UsuariosBO($tableGateway);
                                    return $usuariosBO;
                                },
                                'UsuariosTableGateway'            => function ($sm) {

                                    $dbAdapter = $sm->get("Zend\Db\Adapter\Adapter");
                                    $resultSetPrototype = new ResultSet();
                                    $resultSetPrototype->setArrayObjectPrototype(new Usuarios());
                                    return new TableGateway("usuarios", $dbAdapter, null, $resultSetPrototype);
                                },
                                'Application\Model\AreasBO'       => function ($sm) {

                                    $tableGateway = $sm->get("AreasTableGateway");
                                    $areasBO = new AreasBO($tableGateway);
                                    return $areasBO;
                                },
                                'AreasTableGateway'               => function ($sm) {

                                    $dbAdapter = $sm->get("Zend\Db\Adapter\Adapter");
                                    $resultSetPrototype = new ResultSet();
                                    $resultSetPrototype->setArrayObjectPrototype(new Areas());
                                    return new TableGateway("areas", $dbAdapter, null, $resultSetPrototype);
                                },

                               ),
               );

    }

    public function getViewHelperConfig()
    {
        return array(
                'factories' => array(
                                'RetornaEtiquetas' => function ($sm) {

                                    $locator = $sm->getServiceLocator();
                                    $etiquetasBO = $locator->get('Application\Model\EtiquetasBO');
                                    return new View\Helper\RetornaEtiquetas($etiquetasBO);
                                },
                               ),
               );

    }

}


text:
<?php

namespace HybridLogic\DB\Driver;

/**
 * PDO Database Driver
 *
 * A driver wrapping around the PDO connection library.
 *
 * @package DB
 * @author Luke Lanchester <luke@lukelanchester.com>
 **/
class PDO extends \HybridLogic\DB\Driver {

	/**
	 * @var array Config
	 **/
	protected $config = array(
		'datasource' => null,
		'username'   => null,
		'password'   => null,
	);

	/**
	 * @var PDO Database connection
	 **/
	private $db;

	/**
	 * Connect to database
	 *
	 * @return void
	 **/
	public function connect() {

		if($this->db !== null) return $this->db;

		try {

			$this->db = new \PDO(
				$this->config['datasource'],
				$this->config['username'],
				$this->config['password']
			);

			$this->db->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);

			return true;

		} catch(\PDOException $e) {
			throw new \HybridLogic\DB\Exception\ConnectionException($e);
		}

	} // end func: connect

	/**
	 * Execute an SQL statement
	 *
	 * @param string SQL
	 * @param string Query Type
	 * @param string Result Type
	 * @return mixed Result
	 **/
	public function query($sql, $query_type = null, $result_type = null) {

		if($this->db === null) $this->connect();

		try {

			// SELECT
			if($query_type === \HybridLogic\DB::SELECT) {

				$stmt = $this->db->query($sql);

				if($result_type === null) {
					$results = $stmt->fetchAll(\PDO::FETCH_ASSOC);
				} else {
					$results = $stmt->fetchAll(\PDO::FETCH_CLASS, $result_type);
				}

				return $results;

			}

			// INSERT, UPDATE & DELETE
			$rows_affected = $this->db->exec($sql);

			if($query_type === \HybridLogic\DB::INSERT) {
				$result = array(
					'insert_id'     => $this->db->lastInsertId(),
					'rows_affected' => $rows_affected,
				);
			} else {
				$result = $rows_affected;
			}

			return $result;

		} catch(\PDOException $e) {
			throw new \HybridLogic\DB\Exception\QueryException($e);
		}

	} // end func: query

	/**
	 * Escape a Value
	 *
	 * @param string Raw value
	 * @return string Escaped value
	 **/
	public function escape($val) {
		if($this->db === null) $this->connect();
		return $this->db->quote($val);
	} // end func: escape

} // end class: Driver_PDO


text:
import java.util.ArrayList;
import java.util.List;

class Util<T> {

    private class WithPosition {}

    public void addNewlyAddedChildrenOf() {
        List<WithPosition> addings = new ArrayList<With<caret>Position>();
    }
}


text:
@Decorator('param', 2, true)
class MyClass {}

Reflect.defineMetadata('decorator', [{
  type: Decorator,
  parameters: ['param', 2, true]
}], MyClass)
export default MyClass;


text:
/**
 * Registers the "Package Settings" Handlebars helper.
 *
 * @param {object} handlebars The global Handlebars object used by kss-node's kssHandlebarsGenerator.
 */
module.exports.register = function(handlebars) {
  handlebars.registerHelper('if_equal', function(a, b, opts) {
    if(a == b)
      return opts.fn(this);
    else
      return opts.inverse(this);
  });
};


text:
namespace Meziantou.Framework.Win32;

public sealed class TokenGroupEntry
{
    public TokenGroupEntry(SecurityIdentifier sid, GroupSidAttributes attributes)
    {
        Sid = sid ?? throw new ArgumentNullException(nameof(sid));
        Attributes = attributes;
    }

    public SecurityIdentifier Sid { get; }
    public GroupSidAttributes Attributes { get; }
}


text:
package org.milvus.dictionary.graph;

public class MatchState {

  private final boolean isMatch;

  private final boolean moreMatchesPossible;

  private final Node nextNode;

  public MatchState(boolean isMatch, boolean moreMatchesPossible, Node nextNode) {
    super();
    this.isMatch = isMatch;
    this.moreMatchesPossible = moreMatchesPossible;
    this.nextNode = nextNode;
  }

  public boolean isMatch() {
    return this.isMatch;
  }

  public boolean isMoreMatchesPossible() {
    return this.moreMatchesPossible;
  }

  public Node getNextNode() {
    return this.nextNode;
  }

}


text:
package org.apache.hadoop.hbase.client;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.stream.Collectors;

import org.apache.hadoop.conf.Configuration;

import org.apache.hadoop.hbase.ipc.RpcControllerFactory;
import org.apache.hadoop.hbase.master.RegionState;
import org.apache.hadoop.hbase.ServerName;
import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil;
import org.apache.hadoop.hbase.shaded.protobuf.RequestConverter;
import org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos;
import org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.AssignsResponse;
import org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.BypassProcedureRequest;
import org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.BypassProcedureResponse;
import org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.FixMetaRequest;
import org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.GetTableStateResponse;
import org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.HbckService.BlockingInterface;
import org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.RunHbckChoreRequest;
import org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.RunHbckChoreResponse;
import org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.ScheduleServerCrashProcedureResponse;
import org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.UnassignsResponse;

import org.apache.hbase.thirdparty.com.google.protobuf.ServiceException;

import org.apache.yetus.audience.InterfaceAudience;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Use {@link Connection#getHbck()} to obtain an instance of {@link Hbck} instead of
 * constructing an HBaseHbck directly.
 *
 *
Connection should be an unmanaged connection obtained via
 * {@link ConnectionFactory#createConnection(Configuration)}.

 *
 *
NOTE: The methods in here can do damage to a cluster if applied in the wrong sequence or at
 * the wrong time. Use with caution. For experts only. These methods are only for the
 * extreme case where the cluster has been damaged or has achieved an inconsistent state because
 * of some unforeseen circumstance or bug and requires manual intervention.
 *
 *
An instance of this class is lightweight and not-thread safe. A new instance should be created
 * by each thread. Pooling or caching of the instance is not recommended.

 *
 * @see ConnectionFactory
 * @see Hbck
 */
@InterfaceAudience.Private
public class HBaseHbck implements Hbck {
  private static final Logger LOG = LoggerFactory.getLogger(HBaseHbck.class);

  private boolean aborted;
  private final BlockingInterface hbck;

  private RpcControllerFactory rpcControllerFactory;

  HBaseHbck(BlockingInterface hbck, RpcControllerFactory rpcControllerFactory) {
    this.hbck = hbck;
    this.rpcControllerFactory = rpcControllerFactory;
  }

  @Override
  public void close() throws IOException {
    // currently does nothing
  }

  @Override
  public void abort(String why, Throwable e) {
    this.aborted = true;
    // Currently does nothing but throw the passed message and exception
    throw new RuntimeException(why, e);
  }

  @Override
  public boolean isAborted() {
    return this.aborted;
  }

  @Override
  public TableState setTableStateInMeta(TableState state) throws IOException {
    try {
      GetTableStateResponse response = hbck.setTableStateInMeta(
        rpcControllerFactory.newController(),
        RequestConverter.buildSetTableStateInMetaRequest(state));
      return TableState.convert(state.getTableName(), response.getTableState());
    } catch (ServiceException se) {
      LOG.debug("table={}, state={}", state.getTableName(), state.getState(), se);
      throw new IOException(se);
    }
  }

  @Override
  public List<RegionState> setRegionStateInMeta(List<RegionState> states) throws IOException {
    try {
      if(LOG.isDebugEnabled()) {
        states.forEach(s ->
          LOG.debug("region={}, state={}", s.getRegion().getRegionName(), s.getState())
        );
      }
      MasterProtos.GetRegionStateInMetaResponse response = hbck.setRegionStateInMeta(
        rpcControllerFactory.newController(),
        RequestConverter.buildSetRegionStateInMetaRequest(states));
      final List<RegionState> result = new ArrayList<>();
      response.getStatesList().forEach(s -> result.add(RegionState.convert(s)));
      return result;
    } catch (ServiceException se) {
      throw new IOException(se);
    }
  }

  @Override
  public List<Long> assigns(List<String> encodedRegionNames, boolean override)
      throws IOException {
    try {
      AssignsResponse response = this.hbck.assigns(rpcControllerFactory.newController(),
          RequestConverter.toAssignRegionsRequest(encodedRegionNames, override));
      return response.getPidList();
    } catch (ServiceException se) {
      LOG.debug(toCommaDelimitedString(encodedRegionNames), se);
      throw new IOException(se);
    }
  }

  @Override
  public List<Long> unassigns(List<String> encodedRegionNames, boolean override)
      throws IOException {
    try {
      UnassignsResponse response = this.hbck.unassigns(rpcControllerFactory.newController(),
          RequestConverter.toUnassignRegionsRequest(encodedRegionNames, override));
      return response.getPidList();
    } catch (ServiceException se) {
      LOG.debug(toCommaDelimitedString(encodedRegionNames), se);
      throw new IOException(se);
    }
  }

  private static String toCommaDelimitedString(List<String> list) {
    return list.stream().collect(Collectors.joining(", "));
  }

  @Override
  public List<Boolean> bypassProcedure(List<Long> pids, long waitTime, boolean override,
      boolean recursive)
      throws IOException {
    BypassProcedureResponse response = ProtobufUtil.call(
        new Callable<BypassProcedureResponse>() {
          @Override
          public BypassProcedureResponse call() throws Exception {
            try {
              return hbck.bypassProcedure(rpcControllerFactory.newController(),
                  BypassProcedureRequest.newBuilder().addAllProcId(pids).
                      setWaitTime(waitTime).setOverride(override).setRecursive(recursive).build());
            } catch (Throwable t) {
              LOG.error(pids.stream().map(i -> i.toString()).
                  collect(Collectors.joining(", ")), t);
              throw t;
            }
          }
        });
    return response.getBypassedList();
  }

  @Override
  public List<Long> scheduleServerCrashProcedures(List<ServerName> serverNames)
      throws IOException {
    try {
      ScheduleServerCrashProcedureResponse response =
          this.hbck.scheduleServerCrashProcedure(rpcControllerFactory.newController(),
            RequestConverter.toScheduleServerCrashProcedureRequest(serverNames));
      return response.getPidList();
    } catch (ServiceException se) {
      LOG.debug(toCommaDelimitedString(
        serverNames.stream().map(serverName -> ProtobufUtil.toServerName(serverName).toString())
            .collect(Collectors.toList())),
        se);
      throw new IOException(se);
    }
  }

  @Override
  public boolean runHbckChore() throws IOException {
    try {
      RunHbckChoreResponse response = this.hbck.runHbckChore(rpcControllerFactory.newController(),
          RunHbckChoreRequest.newBuilder().build());
      return response.getRan();
    } catch (ServiceException se) {
      LOG.debug("Failed to run HBCK chore", se);
      throw new IOException(se);
    }
  }

  @Override
  public void fixMeta() throws IOException {
    try {
      this.hbck.fixMeta(rpcControllerFactory.newController(), FixMetaRequest.newBuilder().build());
    } catch (ServiceException se) {
      throw new IOException(se);
    }
  }
}


text:
namespace sync_file_system {

class MockRemoteFileSyncService : public RemoteFileSyncService {
 public:
  MockRemoteFileSyncService();

  MockRemoteFileSyncService(const MockRemoteFileSyncService&) = delete;
  MockRemoteFileSyncService& operator=(const MockRemoteFileSyncService&) =
      delete;

  ~MockRemoteFileSyncService() override;

  // RemoteFileSyncService overrides.
  MOCK_METHOD1(AddServiceObserver,
               void(RemoteFileSyncService::Observer* observer));
  MOCK_METHOD1(AddFileStatusObserver,
               void(FileStatusObserver* observer));
  MOCK_METHOD2(RegisterOrigin,
               void(const GURL& origin, SyncStatusCallback callback));
  MOCK_METHOD2(EnableOrigin,
               void(const GURL& origin, SyncStatusCallback callback));
  MOCK_METHOD2(DisableOrigin,
               void(const GURL& origin, SyncStatusCallback callback));
  MOCK_METHOD3(UninstallOrigin,
               void(const GURL& origin,
                    UninstallFlag flag,
                    SyncStatusCallback callback));
  MOCK_METHOD1(ProcessRemoteChange, void(SyncFileCallback callback));
  MOCK_METHOD1(SetRemoteChangeProcessor,
               void(RemoteChangeProcessor* processor));
  MOCK_METHOD0(GetLocalChangeProcessor, LocalChangeProcessor*());
  MOCK_CONST_METHOD0(GetCurrentState,
                     RemoteServiceState());
  MOCK_METHOD1(GetOriginStatusMap, void(StatusMapCallback callback));
  MOCK_METHOD1(SetSyncEnabled, void(bool enabled));
  MOCK_METHOD1(PromoteDemotedChanges, void(base::OnceClosure callback));

  void DumpFiles(const GURL& origin, ListCallback callback) override;
  void DumpDatabase(ListCallback callback) override;

  void SetServiceState(RemoteServiceState state);

  // Send notifications to the observers.
  // Can be used in the mock implementation.
  void NotifyRemoteChangeQueueUpdated(int64_t pending_changes);
  void NotifyRemoteServiceStateUpdated(
      RemoteServiceState state,
      const std::string& description);
  void NotifyFileStatusChanged(const storage::FileSystemURL& url,
                               SyncFileType file_type,
                               SyncFileStatus sync_status,
                               SyncAction action_taken,
                               SyncDirection direction);

 private:
  void AddServiceObserverStub(Observer* observer);
  void AddFileStatusObserverStub(FileStatusObserver* observer);
  void RegisterOriginStub(const GURL& origin, SyncStatusCallback callback);
  void DeleteOriginDirectoryStub(const GURL& origin,
                                 UninstallFlag flag,
                                 SyncStatusCallback callback);
  void ProcessRemoteChangeStub(SyncFileCallback callback);
  RemoteServiceState GetCurrentStateStub() const;

  // For default implementation.
  ::testing::NiceMock<MockLocalChangeProcessor> mock_local_change_processor_;

  base::ObserverList<Observer>::Unchecked service_observers_;
  base::ObserverList<FileStatusObserver>::Unchecked file_status_observers_;

  RemoteServiceState state_;
};

}  // namespace sync_file_system

#endif  // CHROME_BROWSER_SYNC_FILE_SYSTEM_MOCK_REMOTE_FILE_SYNC_SERVICE_H_


text:
@extends('layout.dashboard')

@section('content')

             {{ trans('dashboard.incidents.incidents') }}

        > {{ trans('dashboard.incidents.add.title') }}

                @include('partials.dashboard.errors')
                <form class="form-vertical" name="IncidentForm" role="form" method="POST" autocomplete="off">
                    {{ Form::token() }}
                    <fieldset>
                        @if($incidentTemplates->count() > 0)

                            {{ trans('forms.incidents.templates.template') }}
                            <select class="form-control" name="template">
                                <option selected></option>
                                @foreach($incidentTemplates as $tpl)
                                <option value="{{ $tpl->slug }}">{{ $tpl->name }}</option>
                                @endforeach
                            </select>

                        @endif

                            {{ trans('forms.incidents.name') }}
                            <input type="text" class="form-control" name="incident[name]" id="incident-name" required value="{{ Input::old('incident.name') }}">

                            {{ trans('forms.incidents.status') }}

                                <input type="radio" name="incident[status]" value="1">

                                {{ trans('cachet.incidents.status')[1] }}

                                <input type="radio" name="incident[status]" value="2">

                                {{ trans('cachet.incidents.status')[2] }}

                                <input type="radio" name="incident[status]" value="3">

                                {{ trans('cachet.incidents.status')[3] }}

                                <input type="radio" name="incident[status]" value="4">

                                {{ trans('cachet.incidents.status')[4] }}

                        @if(!$componentsInGroups->isEmpty() || !$componentsOutGroups->isEmpty())

                            {{ trans('forms.incidents.component') }}
                            <select name='incident[component_id]' class='form-control'>
                                <option value='0' selected></option>
                                @foreach($componentsInGroups as $group)
                                <optgroup label="{{ $group->name }}">
                                    @foreach($group->components as $component)
                                    <option value='{{ $component->id }}'>{{ $component->name }}</option>
                                    @endforeach
                                </optgroup>
                                @endforeach
                                @foreach($componentsOutGroups as $component)
                                <option value='{{ $component->id }}'>{{ $component->name }}</option>
                                @endforeach
                            </select>
                            {{ trans('forms.optional') }}

                        @endif

                                    @foreach(trans('cachet.components.status') as $statusID => $status)

                                            <input type="radio" name="incident[component_status]" value="{{ $statusID }}" >
                                            {{ $status }}

                                    @endforeach

                            {{ trans('forms.incidents.message') }}

                                <textarea name="incident[message]" class="form-control" rows="5" required>{{ Input::old('incident.message') }}</textarea>

                    </fieldset>

                            <button type="submit" class="btn btn-success">{{ trans('forms.add') }}</button>
                            {{ trans('forms.cancel') }}

                </form>

@stop


text:
using System;
using System.Web;
using System.Web.UI;

namespace Dnn.PersonaBar.Security.Components.Checks
{
    public class CheckViewstatemac : IAuditCheck
    {
        public string Id => "CheckViewstatemac";

        public bool LazyLoad => false;

        public CheckResult Execute()
        {
            var result = new CheckResult(SeverityEnum.Unverified, Id);
            var page = HttpContext.Current.Handler as Page;

            if (page != null)
            {
                if (page.EnableViewStateMac == false)
                {
                    result.Severity = SeverityEnum.Failure;
                }
                else
                {
                    result.Severity = SeverityEnum.Pass;
                }
            }
            return result;
        }
    }
}


text:
;[`log`, `warn`].forEach(function(method) {
  var old = console[method]
  console[method] = function() {
    var stack = new Error().stack.split(/\n/)
    // Chrome includes a single "Error" line, FF doesn't.
    if (stack[0].indexOf(`Error`) === 0) {
      stack = stack.slice(1)
    }
    var args = [].slice.apply(arguments).concat([stack[1].trim()])
    return old.apply(console, args)
  }
})


text:
#include <net/dns/client.hpp>
#include <net/inet>

namespace net::dns
{
#ifdef LIBFUZZER_ENABLED
  Timer::duration_t Client::DEFAULT_RESOLVE_TIMEOUT{std::chrono::seconds(9999)};
  uint16_t g_last_xid = 0;
#else
  Timer::duration_t Client::DEFAULT_RESOLVE_TIMEOUT{std::chrono::seconds(5)};
#endif
  Timer::duration_t Client::DEFAULT_FLUSH_INTERVAL{std::chrono::seconds(30)};
  std::chrono::seconds Client::DEFAULT_CACHE_TTL{std::chrono::seconds(60)};

  Client::Client(Stack& stack)
    : stack_{stack},
      cache_ttl_{DEFAULT_CACHE_TTL},
      flush_timer_{{this, &Client::flush_expired}}
  {
  }

  void Client::resolve(Address dns_server,
                       Hostname hostname,
                       Resolve_handler func,
                       Timer::duration_t timeout, bool force)
  {
    Expects(not hostname.empty());
    if(not is_FQDN(hostname) and not stack_.domain_name().empty())
    {
      hostname.append(".").append(stack_.domain_name());
    }
    if(not force)
    {
      auto it = cache_.find(hostname);
      if(it != cache_.end())
      {
        Error err;
        func(nullptr, err); // fix
        return;
      }
    }
    // Make sure we actually can bind to a socket
    auto& socket = (dns_server.is_v6()) ? stack_.udp().bind6() : stack_.udp().bind();

    // Create our query
    Query query{std::move(hostname), (dns_server.is_v6() ? Record_type::AAAA : Record_type::A)};
#ifdef LIBFUZZER_ENABLED
    g_last_xid = query.id;
#endif

    // store the request for later match
    auto emp = requests_.emplace(std::piecewise_construct,
      std::forward_as_tuple(query.id),
      std::forward_as_tuple(*this, socket, std::move(query), std::move(func)));

    Ensures(emp.second && "Unable to insert");
    auto& req = emp.first->second;
    req.resolve(dns_server, timeout);
  }

  Client::Request::Request(Client& cli, udp::Socket& sock,
                              dns::Query q, Resolve_handler cb)
    : client{cli},
      query{std::move(q)},
      response{nullptr},
      socket{sock},
      callback{std::move(cb)},
      timer({this, &Request::timeout})
  {
    socket.on_read({this, &Client::Request::parse_response});
  }

  void Client::Request::resolve(net::Addr server, Timer::duration_t timeout)
  {
    std::array<char, 256> buf;
    size_t len = query.write(buf.data());

    socket.sendto(server, dns::SERVICE_PORT, buf.data(), len, nullptr,
      {this, &Client::Request::handle_error});

    timer.start(timeout);
  }

  void Client::Request::parse_response(Addr, UDP::port_t, const char* data, size_t len)
  {
    if(UNLIKELY(len < sizeof(dns::Header)))
      return;

    const auto& reply = *(dns::Header*) data;

    // this is a response to our query
    if(query.id == ntohs(reply.id))
    {
      auto res = std::make_unique<dns::Response>();
      // TODO: Validate
      res->parse(data, len);

      this->response = std::move(res);

      // TODO: Cache
      /*if(client.cache_ttl_ > std::chrono::seconds::zero())
      {
        add_cache_entry(...);
      }*/

      finish({});
    }
    else
    {
      debug("<dns::Client::Request> Cannot find matching DNS Request with transid=%u\n",
        ntohs(reply.id));
    }
  }

  void Client::Request::finish(const Error& err)
  {
    callback(std::move(response), err);

    auto erased = client.requests_.erase(query.id);
    Ensures(erased == 1);
  }

  void Client::Request::timeout()
  {
    finish({Error::Type::timeout, "Request timed out"});
  }

  void Client::Request::handle_error(const Error& err)
  {
    // This will call the user callback - do we want that?
    finish(err);
  }

  Client::Request::~Request()
  {
    socket.close();
  }

  void Client::flush_cache()
  {
    cache_.clear();

    flush_timer_.stop();
  }

  void Client::add_cache_entry(const Hostname& hostname, Address addr, std::chrono::seconds ttl)
  {
    // cache the address
    cache_.emplace(std::piecewise_construct,
      std::forward_as_tuple(hostname),
      std::forward_as_tuple(addr, timestamp() + ttl.count()));

    debug("<DNSClient> Cache entry added: [%s] %s (%lld)\n",
      hostname.c_str(), addr.to_string().c_str(), ttl.count());

    // start the timer if not already active
    if(not flush_timer_.is_running())
      flush_timer_.start(DEFAULT_FLUSH_INTERVAL);
  }

  void Client::flush_expired()
  {
    const auto now = timestamp();
    for(auto it = cache_.begin(); it != cache_.end();)
    {
      if(it->second.expires > now)
        it++;
      else
        it = cache_.erase(it);
    }

    if(not cache_.empty())
      flush_timer_.start(DEFAULT_FLUSH_INTERVAL);
  }

}


text:
If using `train.lua`, `train2.lua` or `train3.lua`, random images generated by G/G1
will be saved in this directory (selection of N images per epoch). The random noise vectors are
initialized once at the start of the training.


text:
title: Gateway
summary: Illustrates Gateway capability of NServiceBus.
tags:
- Gateway
related:
- nservicebus/gateway
---

## Code walk-through

This sample demonstrates how logically different sites (such as a headquarters and a remote site) communicate using the NServiceBus Gateway feature.

## Headquarters.Shared

A shared class library for common code including message definitions.

## Headquarters

The central endpoint of the Sample.

### Gateway configuration

 * Maps the site key `RemoteSite` to `http://localhost:25899/RemoteSite`
 * Receives incoming messages on `http://localhost:25899/Headquarters/`

<!-- import HeadquatersGatewayConfig-->

## AcknowledgedHandler

Handles `PriceUpdateAcknowledged` from `RemoteSite`.

<!-- import AcknowledgedHandler -->

## UpdatePriceHandler

Handles `UpdatePrice` from `WebClient`.

<!-- import UpdatePriceHandler -->

## RemoteSite

### Gateway configuration

Receives incoming messages on `http://localhost:25899/RemoteSite/`

<!-- import RemoteSiteGatewayConfig-->

### PriceUpdatedHandler

<!-- import PriceUpdatedHandler -->

## WebClient

This project represents an external integration point. It sends a `UpdatePrice` to the channel `http://localhost:25899/Headquarter/`.

<!-- import SendUpdatePrice -->


text:
create class ddl_0001(col1 int, col2 string, col3 char(10), col4 varchar(10), col5 date );

create reverse unique index ru_ddl_0001_col1_col5  on ddl_0001(col1,col5);
create reverse unique index ddl_0001_index on ddl_0001(col1,col5);

select index_name, is_unique, is_reverse, class_name, key_count
from   db_index
where  class_name = 'ddl_0001';

drop class ddl_0001;


text:
#include <boost/test/auto_unit_test.hpp>
#include <iostream>
#include <climits>
#include <cassert>
#include <transport/TBufferTransports.h>
#include <protocol/TBinaryProtocol.h>
#include "gen-cpp/ThriftTest_types.h"

BOOST_AUTO_TEST_SUITE( TMemoryBufferTest )

BOOST_AUTO_TEST_CASE( test_roundtrip ) {
    using apache::thrift::transport::TMemoryBuffer;
    using apache::thrift::protocol::TBinaryProtocol;
    using boost::shared_ptr;

    shared_ptr<TMemoryBuffer> strBuffer(new TMemoryBuffer());
    shared_ptr<TBinaryProtocol> binaryProtcol(new TBinaryProtocol(strBuffer));

    thrift::test::Xtruct a;
    a.i32_thing = 10;
    a.i64_thing = 30;
    a.string_thing ="holla back a";

    a.write(binaryProtcol.get());
    std::string serialized = strBuffer->getBufferAsString();

    shared_ptr<TMemoryBuffer> strBuffer2(new TMemoryBuffer());
    shared_ptr<TBinaryProtocol> binaryProtcol2(new TBinaryProtocol(strBuffer2));

    strBuffer2->resetBuffer((uint8_t*)serialized.data(), serialized.length());
    thrift::test::Xtruct a2;
    a2.read(binaryProtcol2.get());

    assert(a == a2);
  }

BOOST_AUTO_TEST_CASE( test_copy )
  {
    using apache::thrift::transport::TMemoryBuffer;
    using std::string;
    using std::cout;
    using std::endl;

    string* str1 = new string("abcd1234");
    const char* data1 = str1->data();
    TMemoryBuffer buf((uint8_t*)str1->data(), str1->length(), TMemoryBuffer::COPY);
    delete str1;
    string* str2 = new string("plsreuse");
    bool obj_reuse = (str1 == str2);
    bool dat_reuse = (data1 == str2->data());
    cout << "Object reuse: " << obj_reuse << "   Data reuse: " << dat_reuse
      << ((obj_reuse && dat_reuse) ? "   YAY!" : "") << endl;
    delete str2;

    string str3 = "wxyz", str4 = "6789";
    buf.readAppendToString(str3, 4);
    buf.readAppendToString(str4, INT_MAX);

    assert(str3 == "wxyzabcd");
    assert(str4 == "67891234");
  }

BOOST_AUTO_TEST_CASE( test_exceptions )
  {
    using apache::thrift::transport::TTransportException;
    using apache::thrift::transport::TMemoryBuffer;
    using std::string;

    char data[] = "foo\0bar";

    TMemoryBuffer buf1((uint8_t*)data, 7, TMemoryBuffer::OBSERVE);
    string str = buf1.getBufferAsString();
    assert(str.length() == 7);
    buf1.resetBuffer();
    try {
      buf1.write((const uint8_t*)"foo", 3);
      assert(false);
    } catch (TTransportException& ex) {}

    TMemoryBuffer buf2((uint8_t*)data, 7, TMemoryBuffer::COPY);
    try {
      buf2.write((const uint8_t*)"bar", 3);
    } catch (TTransportException& ex) {
      assert(false);
    }
  }

BOOST_AUTO_TEST_SUITE_END()


text:
<?php

declare(strict_types=1);

namespace Sonata\AdminBundle\Twig;

use Sonata\AdminBundle\Admin\Pool;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;

/**
 * @final since sonata-project/admin-bundle 3.52
 *
 * NEXT_MAJOR: Remove this class.
 *
 * @deprecated since sonata-project/admin-bundle 3.83, will be removed in 4.0.
 *
 * @author Thomas Rabaix <thomas.rabaix@sonata-project.org>
 */
class GlobalVariables
{
    /**
     * @var ContainerInterface
     *
     * @deprecated since sonata-project/admin-bundle 3.5, will be removed in 4.0.
     * NEXT_MAJOR : remove this property
     */
    protected $container;

    /**
     * @var Pool
     */
    protected $adminPool;

    /**
     * @var string|null
     */
    private $mosaicBackground;

    /**
     * @param ContainerInterface|Pool $adminPool
     */
    public function __construct($adminPool, ?string $mosaicBackground = null)
    {
        $this->mosaicBackground = $mosaicBackground;

        // NEXT_MAJOR : remove this block and set adminPool from parameter.
        if ($adminPool instanceof ContainerInterface) {
            @trigger_error(sprintf(
                'Using an instance of %s is deprecated since version 3.5 and will be removed in 4.0. Use %s instead.',
                ContainerInterface::class,
                Pool::class
            ), \E_USER_DEPRECATED);

            /** @psalm-suppress UndefinedMethod */
            $adminPool = $adminPool->get('sonata.admin.pool');
        }

        if ($adminPool instanceof Pool) {
            $this->adminPool = $adminPool;

            return;
        }

        throw new \InvalidArgumentException(sprintf('$adminPool should be an instance of %s', Pool::class));
    }

    /**
     * @return Pool
     */
    public function getAdminPool()
    {
        if ('sonata_deprecation_mute' !== (\func_get_args()[0] ?? null)) {
            @trigger_error(sprintf(
                'Method "%s()" is deprecated since sonata-project/admin-bundle 3.83 and will be removed in version 4.0.',
                __METHOD__
            ), \E_USER_DEPRECATED);
        }

        return $this->adminPool;
    }

    /**
     * @param string $code
     * @param string $action
     * @param array  $parameters
     * @param int    $referenceType
     *
     * @return string
     */
    public function url($code, $action, $parameters = [], $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH)
    {
        @trigger_error(sprintf(
            'Method "%s()" is deprecated since sonata-project/admin-bundle 3.83 and will be removed in version 4.0.',
            __METHOD__
        ), \E_USER_DEPRECATED);

        [$action, $code] = $this->getCodeAction($code, $action);

        return $this->getAdminPool()->getAdminByAdminCode($code)->generateUrl($action, $parameters, $referenceType);
    }

    /**
     * @param string $code
     * @param string $action
     * @param object $object
     * @param array  $parameters
     * @param int    $referenceType
     *
     * @return string
     */
    public function objectUrl($code, $action, $object, $parameters = [], $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH)
    {
        @trigger_error(sprintf(
            'Method "%s()" is deprecated since sonata-project/admin-bundle 3.83 and will be removed in version 4.0.',
            __METHOD__
        ), \E_USER_DEPRECATED);

        [$action, $code] = $this->getCodeAction($code, $action);

        return $this->getAdminPool()->getAdminByAdminCode($code)->generateObjectUrl($action, $object, $parameters, $referenceType);
    }

    public function getMosaicBackground(): ?string
    {
        @trigger_error(sprintf(
            'Method "%s()" is deprecated since sonata-project/admin-bundle 3.83 and will be removed in version 4.0.'
            .' Use "sonata_config.getOption(\'mosaic_background\')" instead.',
            __METHOD__
        ), \E_USER_DEPRECATED);

        return $this->mosaicBackground;
    }

    /**
     * @return string[]
     */
    private function getCodeAction(string $code, string $action): array
    {
        if ($pipe = strpos($code, '|')) {
            // convert code=sonata.page.admin.page|sonata.page.admin.snapshot, action=list
            // to => sonata.page.admin.page|sonata.page.admin.snapshot.list
            $action = sprintf('%s.%s', $code, $action);
            $code = substr($code, 0, $pipe);
        }

        return [$action, $code];
    }
}