text:
require 'date'
require 'json'
require 'logger'
require 'tempfile'
require 'typhoeus'
require 'uri'
require 'openssl'

module BitmexApi
  class ApiClient

    attr_accessor :host

    # Defines the headers to be used in HTTP requests of all API calls by default.
    #
    # @return [Hash]
    attr_accessor :default_headers

    # Stores the HTTP response from the last API call using this API client.
    attr_accessor :last_response
    attr_accessor :access_token

    def initialize(host = nil, access_token = nil)
      @host = host || Configuration.base_url
      @format = 'json'
      @user_agent = "ruby-swagger-#{VERSION}"
      @default_headers = {
        'Content-Type' => "application/#{@format.downcase}",
        'User-Agent' => @user_agent
      }
      @access_token = access_token
    end

    def call_api(http_method, path, opts = {})
      request = build_request(http_method, path, opts)
      response = request.run

      # record as last response
      @last_response = response

      if Configuration.debugging
        Configuration.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n"
      end

      unless response.success?
        fail ApiError.new(:code => response.code,
                          :response_headers => response.headers,
                          :response_body => response.body),
             response.status_message
      end

      if opts[:return_type]
        deserialize(response, opts[:return_type])
      else
        nil
      end
    end

    def build_auth_header(http_method, path, query, data)
      if @access_token
        return { "AccessToken" => @access_token }
      end
      http_method = http_method.to_s.upcase
      nonce = (Time.now.to_f * 1000).to_i
      query_string = "?" + URI.encode_www_form(query)
      path = path + query_string if query_string.length > 1

      request_path = (Configuration.base_path + path).gsub(/\/+/, '/')

      signature = OpenSSL::HMAC.hexdigest(
        OpenSSL::Digest.new('sha256'),
        Configuration.api_secret,
        http_method + request_path + nonce.to_s + data
      )

      if Configuration.debugging
        data_log = {
          nonce: nonce,
          http_method: http_method,
          request_path: request_path,
          data: data,
          signed: http_method + request_path + nonce.to_s + data,
          api_key: Configuration.api_key,
          api_secret: Configuration.api_secret
        }

        Configuration.logger.debug "[AuthHeader]#{data_log}"
      end

      {
        "api-nonce" => nonce,
        "api-key" => Configuration.api_key,
        "api-signature" => signature
      }
    end

    def build_request(http_method, path, opts = {})
      url = build_request_url(path)
      http_method = http_method.to_sym.downcase

      header_params = @default_headers.merge(opts[:header_params] || {})
      query_params = opts[:query_params] || {}
      form_params = opts[:form_params] || {}

      req_opts = {
        :method => http_method,
        :headers => header_params,
        :params => query_params,
        :ssl_verifypeer => Configuration.verify_ssl,
        :sslcert => Configuration.cert_file,
        :sslkey => Configuration.key_file,
        :cainfo => Configuration.ssl_ca_cert,
        :verbose => Configuration.debugging
      }

      body = ''
      if [:post, :patch, :put, :delete].include?(http_method)
        header_params['Content-Type'] = 'application/x-www-form-urlencoded'

        req_body = build_request_body(header_params, form_params, opts[:body])
        body = req_body ? URI.encode_www_form(req_body) : ''
        req_opts.update :body => body
        if Configuration.debugging
          Configuration.logger.debug "HTTP request body param ~BEGIN~\n#{body}\n~END~\n"
        end
      end
      req_opts[:headers].merge!(build_auth_header(http_method, path, query_params, body))
      if Configuration.debugging
        Configuration.logger.debug "HTTP request header params ~BEGIN~\n#{req_opts[:headers]}\n~END~\n"
      end

      Typhoeus::Request.new(url, req_opts)
    end

    # Deserialize the response to the given return type.
    #
    # @param [String] return_type some examples: "User", "Array[User]", "Hash[String,Integer]"
    def deserialize(response, return_type)
      body = response.body
      return nil if body.nil? || body.empty?

      # handle file downloading - save response body into a tmp file and return the File instance
      return download_file(response) if return_type == 'File'

      # ensuring a default content type
      content_type = response.headers['Content-Type'] || 'application/json'

      unless content_type.start_with?('application/json')
        fail "Content-Type is not supported: #{content_type}"
      end

      begin
        data = JSON.parse("[#{body}]", :symbolize_names => true)[0]
      rescue JSON::ParserError => e
        if %w(String Date DateTime).include?(return_type)
          data = body
        else
          raise e
        end
      end

      convert_to_type data, return_type
    end

    # Convert data to the given return type.
    def convert_to_type(data, return_type)
      return nil if data.nil?
      case return_type
      when 'String'
        data.to_s
      when 'Integer'
        data.to_i
      when 'Float'
        data.to_f
      when 'BOOLEAN'
        data == true
      when 'DateTime'
        # parse date time (expecting ISO 8601 format)
        DateTime.parse data
      when 'Date'
        # parse date time (expecting ISO 8601 format)
        Date.parse data
      when 'Object'
        # generic object, return directly
        data
      when /\AArray<(.+)>\z/
        # e.g. Array<Pet>
        sub_type = $1
        data.map {|item| convert_to_type(item, sub_type) }
      when /\AHash\<String, (.+)\>\z/
        # e.g. Hash<String, Integer>
        sub_type = $1
        {}.tap do |hash|
          data.each {|k, v| hash[k] = convert_to_type(v, sub_type) }
        end
      else
        # models, e.g. Pet
        BitmexApi.const_get(return_type).new.tap do |model|
          model.build_from_hash data
        end
      end
    end

    # Save response body into a file in (the defined) temporary folder, using the filename
    # from the "Content-Disposition" header if provided, otherwise a random filename.
    #
    # @see Configuration#temp_folder_path
    # @return [File] the file downloaded
    def download_file(response)
      tmp_file = Tempfile.new '', Configuration.temp_folder_path
      content_disposition = response.headers['Content-Disposition']
      if content_disposition
        filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
        path = File.join File.dirname(tmp_file), filename
      else
        path = tmp_file.path
      end
      # close and delete temp file
      tmp_file.close!

      File.open(path, 'w') { |file| file.write(response.body) }
      Configuration.logger.info "File written to #{path}. Please move the file to a proper "\
                                "folder for further processing and delete the temp afterwards"
      File.new(path)
    end

    def build_request_url(path)
      # Add leading and trailing slashes to path
      path = "/#{path}".gsub(/\/+/, '/')
      URI.encode(host + path)
    end

    def build_request_body(header_params, form_params, body)
      # http form
      if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||
          header_params['Content-Type'] == 'multipart/form-data'
        data = form_params.dup
        data.each do |key, value|
          data[key] = value.to_s if value && !value.is_a?(File)
        end
      elsif body
        data = body.is_a?(String) ? body : body.to_json
      else
        data = nil
      end
      data
    end

    # Update hearder and query params based on authentication settings.
    def update_params_for_auth!(header_params, query_params, auth_names)
      Array(auth_names).each do |auth_name|
        auth_setting = Configuration.auth_settings[auth_name]
        next unless auth_setting
        case auth_setting[:in]
        when 'header' then header_params[auth_setting[:key]] = auth_setting[:value]
        when 'query'  then query_params[auth_setting[:key]] = auth_setting[:value]
        else fail ArgumentError, 'Authentication token must be in `query` of `header`'
        end
      end
    end

    def user_agent=(user_agent)
      @user_agent = user_agent
      @default_headers['User-Agent'] = @user_agent
    end

    # Return Accept header based on an array of accepts provided.
    # @param [Array] accepts array for Accept
    # @return [String] the Accept header (e.g. application/json)
    def select_header_accept(accepts)
      if accepts.empty?
        return
      elsif accepts.any?{ |s| s.casecmp('application/json') == 0 }
        'application/json' # look for json data by default
      else
        accepts.join(',')
      end
    end

    # Return Content-Type header based on an array of content types provided.
    # @param [Array] content_types array for Content-Type
    # @return [String] the Content-Type header  (e.g. application/json)
    def select_header_content_type(content_types)
      if content_types.empty?
        'application/json' # use application/json by default
      elsif content_types.any?{ |s| s.casecmp('application/json')==0 }
        'application/json' # use application/json if it's included
      else
        content_types[0] # otherwise, use the first one
      end
    end

    # Convert object (array, hash, object, etc) to JSON string.
    # @param [Object] model object to be converted into JSON string
    # @return [String] JSON string representation of the object
    def object_to_http_body(model)
      return if model.nil?
      _body = nil
      if model.is_a?(Array)
        _body = model.map{|m| object_to_hash(m) }
      else
        _body = object_to_hash(model)
      end
      _body.to_json
    end

    # Convert object(non-array) to hash.
    # @param [Object] obj object to be converted into JSON string
    # @return [String] JSON string representation of the object
    def object_to_hash(obj)
      if obj.respond_to?(:to_hash)
        obj.to_hash
      else
        obj
      end
    end
  end
end


text:
//  ----------------------------------------------------------------------------------
//  Copyright Microsoft Corporation
//  Licensed under the Apache License, Version 2.0 (the "License");
//  you may not use this file except in compliance with the License.
//  You may obtain a copy of the License at
//  http://www.apache.org/licenses/LICENSE-2.0
//  Unless required by applicable law or agreed to in writing, software
//  distributed under the License is distributed on an "AS IS" BASIS,
//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//  See the License for the specific language governing permissions and
//  limitations under the License.
//  ----------------------------------------------------------------------------------

namespace DurableTask.AzureStorage.Partitioning
{
    using System.Collections.Generic;
    using System.Threading.Tasks;

    interface IPartitionManager
    {
        Task StartAsync();

        Task StopAsync();

        Task CreateLeaseStore();

        Task CreateLease(string leaseName);

        Task DeleteLeases();

        Task<IEnumerable<BlobLease>> GetOwnershipBlobLeases();
    }
}

redpajama_set_name: RedPajamaGithub


text:
/*
	Explodable
	An Engine By Tinfoilboy
	Tinfoilboy © 2014
*/
#include "ExplodableMain.hpp"

#include <SFML/System.hpp>

#include <SFML/Graphics.hpp>

namespace Explodable {

	Main::Main(int width, int height, int antialiasing, sf::String title) {
		sf::ContextSettings windowSettings;
		windowSettings.antialiasingLevel = antialiasing;
		this->width = width;
		this->height = height;
		window = new sf::RenderWindow(sf::VideoMode(width, height), title, sf::Style::Default, windowSettings);
	}

	void Main::setTitle(sf::String title) {
		this->title = title;
		window->setTitle(title);
	}

	void Main::setFullscreen(bool fullscreen) {
		if (!this->fullscreen && fullscreen) {
			window->create(sf::VideoMode(width, height), title, sf::Style::Fullscreen);
		}
		else if (this->fullscreen && !fullscreen) {
			window->create(sf::VideoMode(width, height), title);
		}
		this->fullscreen = fullscreen;
	}

	void Main::setVsync(bool vsync) {
		vsyncEnabled = vsync;
		window->setVerticalSyncEnabled(vsyncEnabled);
	}

	void Main::setFPS(int fps) {
		fixedFPS = fps;
		if (!vsyncEnabled) {
			window->setFramerateLimit(fixedFPS);
		}
		else {
			printf("VSync is enabled, so therefor, the frames per second is already fixed.");
		}
	}

	void Main::dispose() {
		delete window;
	}

	sf::RenderWindow* Main::getWindow() {
		return window;
	}
}


text:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--
    JBoss, Home of Professional Open Source
    Copyright 2015, Red Hat, Inc. and/or its affiliates, and individual
    contributors by the @authors tag. See the copyright.txt in the
    distribution for a full listing of individual contributors.

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at
    http://www.apache.org/licenses/LICENSE-2.0
    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
-->
<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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.jboss.quickstarts.eap</groupId>
    <artifactId>jboss-contacts-jquerymobile</artifactId>
    <version>7.1.0-SNAPSHOT</version>
    <packaging>war</packaging>
    <name>JBoss EAP Quickstart: contacts-jquerymobile</name>
    <description>A Java EE HTML5 mobile web application for use with JBoss EAP</description>
    <url>http://www.jboss.org/products/eap</url>

    <licenses>
        <license>
            <name>Apache License, Version 2.0</name>
            <distribution>repo</distribution>
            <url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
        </license>
    </licenses>

    <!-- Activate the JBoss Enterprise Maven Repository.

        NOTE: Configuring the Maven repository in the pom.xml file is not a recommended procedure
        and is only done here to make it easier to use the quickstarts.

        For more information about how to configure Maven for your application,
        see the section entitled 'Use the Maven Repository'
        in the Development Guide for Red Hat JBoss Enterprise Application Platform located here:

        https://access.redhat.com/documentation/en/red-hat-jboss-enterprise-application-platform/
    -->
    <repositories>
        <repository>
            <id>jboss-developer-staging-repository</id>
            <url>http://jboss-developer.github.io/temp-maven-repo/</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
        <repository>
            <id>jboss-enterprise-maven-repository</id>
            <url>https://maven.repository.redhat.com/ga/</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>

    <pluginRepositories>
        <pluginRepository>
            <id>jboss-developer-staging-repository</id>
            <url>http://jboss-developer.github.io/temp-maven-repo/</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>
        <pluginRepository>
            <id>jboss-enterprise-maven-repository</id>
            <url>https://maven.repository.redhat.com/ga/</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>

    <properties>
        <!-- Explicitly declaring the source encoding eliminates the following
            message: [WARNING] Using platform encoding (UTF-8 actually) to copy
            filtered resources, i.e. build is platform dependent! -->
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <!-- JBoss dependency versions -->
        <version.wildfly.maven.plugin>1.0.2.Final</version.wildfly.maven.plugin>

        <!-- Define the version of the JBoss BOMs we want to import to specify tested stacks. -->
        <version.jboss.bom.eap>7.0.0-build-12</version.jboss.bom.eap>

        <!-- Other dependency versions -->
        <version.ro.isdc.wro4j>1.7.9</version.ro.isdc.wro4j>

        <!-- other plug-in versions -->
        <version.surefire.plugin>2.19</version.surefire.plugin>
        <version.war.plugin>2.6</version.war.plugin>

        <!-- maven-compiler-plugin -->
        <maven.compiler.target>1.8</maven.compiler.target>
        <maven.compiler.source>1.8</maven.compiler.source>
    </properties>

    <dependencyManagement>
        <dependencies>
            <!-- Define the version of the JBoss Java EE APIs we want to import.
                 Any dependencies from org.jboss.spec will have their version defined by this BOM

                 JBoss distributes a complete set of Java EE APIs including
                 a Bill of Materials (BOM). A BOM specifies the versions of a "stack" (or
                 a collection) of artifacts. We use this here so that we always get the correct
                 versions of artifacts. Here we use the jboss-javaee-7.0 stack (you can
                 read this as the JBoss stack of the Java EE APIs). You can actually
                 use this stack with any version of JBoss EAP that implements Java EE. -->
            <dependency>
                <groupId>org.jboss.bom</groupId>
                <artifactId>jboss-eap-javaee7-with-tools</artifactId>
                <version>${version.jboss.bom.eap}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.apache.httpcomponents</groupId>
                <artifactId>httpclient</artifactId>
                <version>4.5.1</version>
            </dependency>
            <dependency>
                <groupId>commons-io</groupId>
                <artifactId>commons-io</artifactId>
                <version>2.4</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <!-- First declare the APIs we depend on and need for compilation. All of them are provided by EAP -->

        <!-- Import the CDI API, we use provided scope as the API is included in EAP -->
        <dependency>
            <groupId>javax.enterprise</groupId>
            <artifactId>cdi-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- Import the Common Annotations API (JSR-250), we use provided scope as the API is included in EAP -->
        <dependency>
            <groupId>org.jboss.spec.javax.annotation</groupId>
            <artifactId>jboss-annotations-api_1.2_spec</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- Import the JAX-RS API, we use provided scope as the API is included in EAP -->
        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-jaxrs</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- Import the JPA API, we use provided scope as the API is included in EAP -->
        <dependency>
            <groupId>org.hibernate.javax.persistence</groupId>
            <artifactId>hibernate-jpa-2.1-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- Import the EJB API, we use provided scope as the API is included in EAP -->
        <dependency>
            <groupId>org.jboss.spec.javax.ejb</groupId>
            <artifactId>jboss-ejb-api_3.2_spec</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- Import the Servlet API, we use provided scope as the API is included in EAP -->
        <dependency>
            <groupId>org.jboss.spec.javax.servlet</groupId>
            <artifactId>jboss-servlet-api_3.1_spec</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- Import the Bean Validation, we use provided scope as the API is included in EAP -->
        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- Bean Validation Implementation
             Provides portable constraints such as @Email
             Hibernate Validator is shipped in JBoss EAP -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator</artifactId>
            <scope>provided</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-jackson2-provider</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- Now we declare any tools needed -->

        <!-- Annotation processor to generate the JPA metamodel classes for typesafe criteria queries -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-jpamodelgen</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- Needed for running tests (you may also use TestNG) -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>

        <!-- Test dependencies required for testing REST services -->
        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-client</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <scope>test</scope>
        </dependency>

        <!-- Optional, but highly recommended, Arquillian allows you to test enterprise code
             such as EJBs and Transactional(JTA) JPA from JUnit/TestNG -->
        <dependency>
            <groupId>org.jboss.arquillian.junit</groupId>
            <artifactId>arquillian-junit-container</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.jboss.shrinkwrap.resolver</groupId>
            <artifactId>shrinkwrap-resolver-api-maven</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <!-- Set the name of the WAR, used as the context root when the app is deployed -->
        <finalName>${project.artifactId}</finalName>
        <plugins>
            <!-- This skips all tests, though you can tune it to run just unit tests based on a custom pattern.
                 Separate profiles are provided for running all tests, including Arquillian tests that execute in the specified container -->
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${version.surefire.plugin}</version>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <version>${version.war.plugin}</version>
                <configuration>
                    <!-- Java EE doesn't require web.xml, Maven needs to catch up! -->
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                </configuration>
            </plugin>
            <!-- The WildFly plug-in deploys the WAR to a local JBoss EAP container.
                 To use, run: mvn package wildfly:deploy -->
            <plugin>
                <groupId>org.wildfly.plugins</groupId>
                <artifactId>wildfly-maven-plugin</artifactId>
                <version>${version.wildfly.maven.plugin}</version>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <!-- When built in OpenShift the 'openshift' profile will be used when invoking mvn.
                 Use this profile for any OpenShift specific customization your app will need.
                 By default that is to put the resulting archive into the 'deployments' folder.
                 http://maven.apache.org/guides/mini/guide-building-for-different-environments.html -->
            <id>openshift</id>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-war-plugin</artifactId>
                        <version>${version.war.plugin}</version>
                        <configuration>
                            <outputDirectory>deployments</outputDirectory>
                            <warName>ROOT</warName>
                            <packagingExcludes>WEB-INF/contacts-quickstart-ds.xml</packagingExcludes>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <!-- Use this profile to use the wro4j plug-in for validation, concatenation and
                minification of JavaScript and CSS files during the build -->
            <id>minify</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>

            <build>
                <plugins>
                    <plugin>
                        <groupId>ro.isdc.wro4j</groupId>
                        <artifactId>wro4j-maven-plugin</artifactId>
                        <version>${version.ro.isdc.wro4j}</version>
                        <executions>
                            <execution>
                                <phase>compile</phase>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <targetGroups>app.min,formSetup.min,namespace.min,submissions.min,theming.min,util.min,validation.min,app-style.min,validator.min</targetGroups>
                            <cssDestinationFolder>${project.build.directory}/${project.build.finalName}/css/</cssDestinationFolder>
                            <jsDestinationFolder>${project.build.directory}/${project.build.finalName}/js/</jsDestinationFolder>
                            <wroManagerFactory>ro.isdc.wro.maven.plugin.manager.factory.ConfigurableWroManagerFactory</wroManagerFactory>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <!-- An optional Arquillian testing profile that executes tests in your JBoss EAP instance.
                 This profile will start a new JBoss EAP instance, and execute the test, shutting it down when done.
                 Run with: mvn clean test -Parq-wildfly-managed -->
            <id>arq-wildfly-managed</id>
            <dependencies>
                <dependency>
                    <groupId>org.wildfly.arquillian</groupId>
                    <artifactId>wildfly-arquillian-container-managed</artifactId>
                    <scope>test</scope>
                </dependency>
            </dependencies>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>${version.surefire.plugin}</version>
                        <configuration>
                            <skip>false</skip>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
           <!-- An optional Arquillian testing profile that executes tests in a remote JBoss EAP instance.
                Run with: mvn clean test -Parq-wildfly-remote -->
            <id>arq-wildfly-remote</id>
            <dependencies>
                <dependency>
                    <groupId>org.wildfly.arquillian</groupId>
                    <artifactId>wildfly-arquillian-container-remote</artifactId>
                    <scope>test</scope>
                </dependency>
            </dependencies>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>${version.surefire.plugin}</version>
                        <configuration>
                            <skip>false</skip>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>


text:
Creates objects without exposing the instantiation logic to the client.

## Applicability
Use the Simple Factory pattern when
* you want to provide a class library of products, and you want to reveal just their interfaces, not their implementations.
* a system should be independent of how its products are created, composed, and represented.

## Structure
![simple-factory](./etc/simple-factory.png)

## Participants
* **SimpleFactory**
    - define a static factory method to create concrete product objects.
* **Product**
    - defines the interface of objects the static factory method creates.
* **ConcreteProduct**
    - implements the Product interface.
* **Client**
    - creates a new object using simple factory.

## Example
Imagine you are creating a calculator. You want to execute different operations according to operator(+,-,*,/),
which means you need create different concrete operations according to different operator.
This example demonstrates how to achieve it.

Participants in this example:
* Operation's companion object is the **SimpleFactory**, and the apply() function is the static factory method.
* Operation is the **Prodcut**.
* AddOperation/SubOperation/MulOperation/DivOperation is the **ConcreteProduct**.
* App is the **Client**.

## Scala Tips
* in scala, the **apply** function of **companion object** is the best place to implement the static factory method of simple factory.

## Reference


text:
/* Combine all available reducers to a single root reducer.
 *
 * CAUTION: When using the generators, this file is modified in some places.
 *          This is done via AST traversal - Some of your formatting may be lost
 *          in the process - no functionality should be broken though.
 *          This modifications only run once when the generator is invoked - if
 *          you edit them, they are not updated again.
 */

import tutorial from './tutorial';
import cube from './cube';

import { combineReducers } from 'redux';
/* Populated by react-webpack-redux:reducer */
const reducers = {
  tutorial,
  cube,
};
module.exports = combineReducers(reducers);


text:
<?php

/**
 * Module Name: Post by Email
 * Module Description: Publish posts to your blog directly from your personal email account.
 * First Introduced: 2.0
 * Sort Order: 4
 */

add_action( 'jetpack_modules_loaded', array( 'Jetpack_Post_By_Email', 'init' ) );

Jetpack_Sync::sync_options( __FILE__,
	'large_size_w',
	'large_size_h',
	'thumbnail_size_w',
	'thumbnail_size_h',
	'medium_size_w',
	'medium_size_h'
);

add_action( 'jetpack_activate_module_post-by-email',   array( 'Jetpack_Post_By_Email', 'module_toggle' ) );
add_action( 'jetpack_deactivate_module_post-by-email', array( 'Jetpack_Post_By_Email', 'module_toggle' ) );

Jetpack::enable_module_configurable( __FILE__ );
Jetpack::module_configuration_load( __FILE__, array( 'Jetpack_Post_By_Email', 'configuration_redirect' ) );

class Jetpack_Post_By_Email {
	function &init() {
		static $instance = NULL;

		if ( !$instance ) {
			$instance = new Jetpack_Post_By_Email;
		}

		return $instance;
	}

	function __construct() {
		add_action( 'init', array( &$this, 'action_init' ) );
	}

	function module_toggle() {
		$jetpack = Jetpack::init();
		$jetpack->sync->register( 'noop' );
	}

	function configuration_redirect() {
		wp_safe_redirect( get_edit_profile_url( get_current_user_id() ) . '#post-by-email' );
		exit;
	}

	function action_init() {
		if ( ! current_user_can( 'edit_posts' ) )
			return;

		add_action( 'profile_personal_options', array( &$this, 'user_profile' ) );
		add_action( 'admin_print_scripts-profile.php', array( &$this, 'profile_scripts' ) );

		add_action( 'wp_ajax_jetpack_post_by_email_enable', array( &$this, 'create_post_by_email_address' ) );
		add_action( 'wp_ajax_jetpack_post_by_email_regenerate', array( &$this, 'regenerate_post_by_email_address' ) );
		add_action( 'wp_ajax_jetpack_post_by_email_disable', array( &$this, 'delete_post_by_email_address' ) );
	}

	function profile_scripts() {
		wp_enqueue_script( 'post-by-email', plugins_url( 'post-by-email/post-by-email.js', __FILE__ ), array( 'jquery' ) );
		wp_enqueue_style( 'post-by-email', plugins_url( 'post-by-email/post-by-email.css', __FILE__ ) );
		Jetpack::init()->admin_styles();
	}

	function check_user_connection() {
		$user_token = Jetpack_Data::get_access_token( get_current_user_id() );
		$is_user_connected = $user_token && !is_wp_error( $user_token );

		// If the user is already connected via Jetpack, then we're good
		if ( $is_user_connected )
			return true;

		return false;
	}

	function user_profile() {
		$blog_name = get_bloginfo( 'blogname' );
		if ( empty( $blog_name ) ) {
			$blog_name = home_url( '/' );
		}

		?>

<?php esc_html_e( 'Post by Email', 'jetpack' ); ?>

				<?php esc_html_e( 'Email Address', 'jetpack' ); ?>

 <?php

				if ( $this->check_user_connection() ) {
					$email = $this->get_post_by_email_address();

					if ( empty( $email ) ) {
						$enable_hidden = '';
						$info_hidden = ' style="display: none;"';
					} else {
						$enable_hidden = ' style="display: none;"';
						$info_hidden = '';
					} ?>

					<input type="button" name="jp-pbe-enable" id="jp-pbe-enable" class="button" value="<?php esc_attr_e( 'Enable Post By Email', 'jetpack' ); ?> "<?php echo $enable_hidden; ?> />
					<div id="jp-pbe-info"<?php echo $info_hidden; ?>>

							<input type="text" id="jp-pbe-email" value="<?php echo esc_attr( $email ); ?>" readonly="readonly" class="regular-text" />
							<?php esc_html_e( 'More information', 'jetpack' ); ?>

							<input type="button" name="jp-pbe-regenerate" id="jp-pbe-regenerate" class="button" value="<?php esc_attr_e( 'Regenerate Address', 'jetpack' ); ?> " />
							<input type="button" name="jp-pbe-disable" id="jp-pbe-disable" class="button" value="<?php esc_attr_e( 'Disable Post By Email', 'jetpack' ); ?> " />

 <?php
				} else {
					$jetpack = Jetpack::init(); ?>

						<?php printf(
							esc_html( wptexturize( __( 'To use Post By Email, you need to link your %s account to your WordPress.com account.', 'jetpack' ) ) ),
							'' . esc_html( $blog_name ) . ''
						); ?>

						<?php echo esc_html( wptexturize( __( "If you don't have a WordPress.com account yet, you can sign up for free in just a few seconds.", 'jetpack' ) ) ); ?>

						<a href="<?php echo $jetpack->build_connect_url( false, get_edit_profile_url( get_current_user_id() ) . '#post-by-email' ); ?>" class="button button-connector" id="wpcom-connect"><?php esc_html_e( 'Link account with WordPress.com', 'jetpack' ); ?>

					<?php
				} ?>

	<?php
	}

	function get_post_by_email_address() {
		Jetpack::load_xml_rpc_client();
		$xml = new Jetpack_IXR_Client( array(
			'user_id' => get_current_user_id(),
		) );
		$xml->query( 'jetpack.getPostByEmailAddress' );

		if ( $xml->isError() )
			return NULL;

		$response = $xml->getResponse();
		if ( empty( $response ) )
			return NULL;

		return $response;
	}

	function create_post_by_email_address() {
		Jetpack::load_xml_rpc_client();
		$xml = new Jetpack_IXR_Client( array(
			'user_id' => get_current_user_id(),
		) );
		$xml->query( 'jetpack.createPostByEmailAddress' );

		if ( $xml->isError() ) {
			echo json_encode( array(
				'response' => 'error',
				'message' => __( 'Unable to create your Post By Email address. Please try again later.', 'jetpack' )
			) );
			die();
		}

		$response = $xml->getResponse();
		if ( empty( $response ) ) {
			echo json_encode( array(
				'response' => 'error',
				'message' => __( 'Unable to create your Post By Email address. Please try again later.', 'jetpack' )
			) );
			die();
		}

		echo $response;
		die();
	}

	function regenerate_post_by_email_address() {
		Jetpack::load_xml_rpc_client();
		$xml = new Jetpack_IXR_Client( array(
			'user_id' => get_current_user_id(),
		) );
		$xml->query( 'jetpack.regeneratePostByEmailAddress' );

		if ( $xml->isError() ) {
			echo json_encode( array(
				'response' => 'error',
				'message' => __( 'Unable to regenerate your Post By Email address. Please try again later.', 'jetpack' )
			) );
			die();
		}

		$response = $xml->getResponse();
		if ( empty( $response ) ) {
			echo json_encode( array(
				'response' => 'error',
				'message' => __( 'Unable to regenerate your Post By Email address. Please try again later.', 'jetpack' )
			) );
			die();
		}

		echo $response;
		die();
	}

	function delete_post_by_email_address() {
		Jetpack::load_xml_rpc_client();
		$xml = new Jetpack_IXR_Client( array(
			'user_id' => get_current_user_id(),
		) );
		$xml->query( 'jetpack.deletePostByEmailAddress' );

		if ( $xml->isError() ) {
			echo json_encode( array(
				'response' => 'error',
				'message' => __( 'Unable to disable your Post By Email address. Please try again later.', 'jetpack' )
			) );
			die();
		}

		$response = $xml->getResponse();
		if ( empty( $response ) ) {
			echo json_encode( array(
				'response' => 'error',
				'message' => __( 'Unable to disable your Post By Email address. Please try again later.', 'jetpack' )
			) );
			die();
		}

		echo $response;
		die();
	}
}


text:
package com.github.mizool.technology.cassandra;

import javax.enterprise.inject.Disposes;
import javax.enterprise.inject.Produces;
import javax.inject.Singleton;

import com.datastax.driver.core.Cluster;
import com.datastax.driver.core.Session;

class SessionProducer
{
    @Produces
    @Singleton
    public Session produce(Cluster cluster)
    {
        return cluster.connect();
    }

    public void dispose(@Disposes Session session)
    {
        session.close();
    }
}


text:
namespace spdlog
{

//
// Return an existing logger or nullptr if a logger with such name doesn't exist.
// example: spdlog::get("my_logger")->info("hello {}", "world");
//
std::shared_ptr<logger> get(const std::string& name);

//
// Set global formatting
// example: spdlog::set_pattern("%Y-%m-%d %H:%M:%S.%e %l : %v");
//
void set_pattern(const std::string& format_string);
void set_formatter(formatter_ptr f);

//
// Set global logging level for
//
void set_level(level::level_enum log_level);

//
// Set global error handler
//
void set_error_handler(log_err_handler);

//
// Turn on async mode (off by default) and set the queue size for each async_logger.
// effective only for loggers created after this call.
// queue_size: size of queue (must be power of 2):
//    Each logger will pre-allocate a dedicated queue with queue_size entries upon construction.
//
// async_overflow_policy (optional, block_retry by default):
//    async_overflow_policy::block_retry - if queue is full, block until queue has room for the new log entry.
//    async_overflow_policy::discard_log_msg - never block and discard any new messages when queue  overflows.
//
// worker_warmup_cb (optional):
//     callback function that will be called in worker thread upon start (can be used to init stuff like thread affinity)
//
// worker_teardown_cb (optional):
//     callback function that will be called in worker thread upon exit
//
void set_async_mode(size_t queue_size, const async_overflow_policy overflow_policy = async_overflow_policy::block_retry, const std::function<void()>& worker_warmup_cb = nullptr, const std::chrono::milliseconds& flush_interval_ms = std::chrono::milliseconds::zero(), const std::function<void()>& worker_teardown_cb = nullptr);

// Turn off async mode
void set_sync_mode();

//
// Create and register multi/single threaded basic file logger.
// Basic logger simply writes to given file without any limitatons or rotations.
//
std::shared_ptr<logger> basic_logger_mt(const std::string& logger_name, const filename_t& filename, bool truncate = false);
std::shared_ptr<logger> basic_logger_st(const std::string& logger_name, const filename_t& filename, bool truncate = false);

//
// Create and register multi/single threaded rotating file logger
//
std::shared_ptr<logger> rotating_logger_mt(const std::string& logger_name, const filename_t& filename, size_t max_file_size, size_t max_files);
std::shared_ptr<logger> rotating_logger_st(const std::string& logger_name, const filename_t& filename, size_t max_file_size, size_t max_files);

//
// Create file logger which creates new file on the given time (default in  midnight):
//
std::shared_ptr<logger> daily_logger_mt(const std::string& logger_name, const filename_t& filename, int hour=0, int minute=0);
std::shared_ptr<logger> daily_logger_st(const std::string& logger_name, const filename_t& filename, int hour=0, int minute=0);

//
// Create and register stdout/stderr loggers
//
std::shared_ptr<logger> stdout_logger_mt(const std::string& logger_name);
std::shared_ptr<logger> stdout_logger_st(const std::string& logger_name);
std::shared_ptr<logger> stderr_logger_mt(const std::string& logger_name);
std::shared_ptr<logger> stderr_logger_st(const std::string& logger_name);
//
// Create and register colored stdout/stderr loggers
//
std::shared_ptr<logger> stdout_color_mt(const std::string& logger_name);
std::shared_ptr<logger> stdout_color_st(const std::string& logger_name);
std::shared_ptr<logger> stderr_color_mt(const std::string& logger_name);
std::shared_ptr<logger> stderr_color_st(const std::string& logger_name);

//
// Create and register a syslog logger
//
#ifdef SPDLOG_ENABLE_SYSLOG
std::shared_ptr<logger> syslog_logger(const std::string& logger_name, const std::string& ident = "", int syslog_option = 0);
#endif

#if defined(__ANDROID__)
std::shared_ptr<logger> android_logger(const std::string& logger_name, const std::string& tag = "spdlog");
#endif

// Create and register a logger with a single sink
std::shared_ptr<logger> create(const std::string& logger_name, const sink_ptr& sink);

// Create and register a logger with multiple sinks
std::shared_ptr<logger> create(const std::string& logger_name, sinks_init_list sinks);
template<class It>
std::shared_ptr<logger> create(const std::string& logger_name, const It& sinks_begin, const It& sinks_end);

// Create and register a logger with templated sink type
// Example:
// spdlog::create<daily_file_sink_st>("mylog", "dailylog_filename");
template <typename Sink, typename... Args>
std::shared_ptr<spdlog::logger> create(const std::string& logger_name, Args...);

// Create and register an async logger with a single sink
std::shared_ptr<logger> create_async(const std::string& logger_name, const sink_ptr& sink, size_t queue_size, const async_overflow_policy overflow_policy = async_overflow_policy::block_retry, const std::function<void()>& worker_warmup_cb = nullptr, const std::chrono::milliseconds& flush_interval_ms = std::chrono::milliseconds::zero(), const std::function<void()>& worker_teardown_cb = nullptr);

// Create and register an async logger with multiple sinks
std::shared_ptr<logger> create_async(const std::string& logger_name, sinks_init_list sinks, size_t queue_size, const async_overflow_policy overflow_policy = async_overflow_policy::block_retry, const std::function<void()>& worker_warmup_cb = nullptr, const std::chrono::milliseconds& flush_interval_ms = std::chrono::milliseconds::zero(), const std::function<void()>& worker_teardown_cb = nullptr);
template<class It>
std::shared_ptr<logger> create_async(const std::string& logger_name, const It& sinks_begin, const It& sinks_end, size_t queue_size, const async_overflow_policy overflow_policy = async_overflow_policy::block_retry, const std::function<void()>& worker_warmup_cb = nullptr, const std::chrono::milliseconds& flush_interval_ms = std::chrono::milliseconds::zero(), const std::function<void()>& worker_teardown_cb = nullptr);

// Register the given logger with the given name
void register_logger(std::shared_ptr<logger> logger);

// Apply a user defined function on all registered loggers
// Example:
// spdlog::apply_all([&](std::shared_ptr<spdlog::logger> l) {l->flush();});
void apply_all(std::function<void(std::shared_ptr<logger>)> fun);

// Drop the reference to the given logger
void drop(const std::string &name);

// Drop all references from the registry
void drop_all();

///////////////////////////////////////////////////////////////////////////////
//
// Trace & Debug can be switched on/off at compile time for zero cost debug statements.
// Uncomment SPDLOG_DEBUG_ON/SPDLOG_TRACE_ON in teakme.h to enable.
// SPDLOG_TRACE(..) will also print current file and line.
//
// Example:
// spdlog::set_level(spdlog::level::trace);
// SPDLOG_TRACE(my_logger, "some trace message");
// SPDLOG_TRACE(my_logger, "another trace message {} {}", 1, 2);
// SPDLOG_DEBUG(my_logger, "some debug message {} {}", 3, 4);
// SPDLOG_DEBUG_IF(my_logger, true, "some debug message {} {}", 3, 4);
///////////////////////////////////////////////////////////////////////////////

#ifdef SPDLOG_TRACE_ON
#define SPDLOG_STR_H(x) #x
#define SPDLOG_STR_HELPER(x) SPDLOG_STR_H(x)
#define SPDLOG_TRACE(logger, ...) logger->trace("[" __FILE__ " line #" SPDLOG_STR_HELPER(__LINE__) "] " __VA_ARGS__)
#define SPDLOG_TRACE_IF(logger, flag, ...) logger->trace_if(flag, "[" __FILE__ " line #" SPDLOG_STR_HELPER(__LINE__) "] " __VA_ARGS__)
#else
#define SPDLOG_TRACE(logger, ...)
#define SPDLOG_TRACE_IF(logger, flag, ...)
#endif

#ifdef SPDLOG_DEBUG_ON
#define SPDLOG_DEBUG(logger, ...) logger->debug(__VA_ARGS__)
#define SPDLOG_DEBUG_IF(logger, flag, ...) logger->debug_if(flag, __VA_ARGS__)
#else
#define SPDLOG_DEBUG(logger, ...)
#define SPDLOG_DEBUG_IF(logger, flag, ...)
#endif

}

#include "spdlog/details/spdlog_impl.h"


text:
'use strict';

module.exports = function(config) {
	config.set({
		basePath : '../..',

		files : [ 'src/app/lib/jquery/jquery-1.10.2.js',
				'src/app/lib/angular/angular.js',
				'src/app/lib/angular/angular-*.js',
				'src/app/lib/underscore/underscore.min.js',
				'vendor/angular/angular-mocks.js', 'src/app/js/**/*.js',
				'test/unit/controllers/blogSpec.js', ],

		autoWatch : true,
		frameworks : [ 'jasmine' ],
		// browsers : ['Chrome'],
		browsers : [ 'Firefox' ],
		plugins : [ 'karma-junit-reporter', 'karma-chrome-launcher',
				'karma-firefox-launcher', 'karma-jasmine' ],

		junitReporter : {
			outputFile : 'test_out/unit.xml',
			suite : 'unit'
		}
	});
};


text:
package korolev.state

trait StateSerializer[T] {
  def serialize(value: T): Array[Byte]
}


text:
from mod_pywebsocket import msgutil
import urllib

import time

def web_socket_do_extra_handshake(request):
	pass

def web_socket_transfer_data(request):
	time.sleep(10)
	msgutil._write(request, urllib.unquote(request.ws_location.split('?', 1)[1]).decode("string-escape"))


text:
import six
from .compat import unicode
from .BaseScraperList import BaseScraperList
from .DimensionValue import DimensionValue

class ValueList(BaseScraperList):
    """A list of dimension values.

    allowed_values uses this class, to allow checking membership.
    """

    def __getitem__(self, key):
        """Make it possible to get value by value or value identity."""
        if isinstance(key, six.string_types):
            if isinstance(key, unicode):
                def f(x):
                    return (x.value == key)
            else:
                def f(x):
                    return (x.value == unicode(key, encoding="utf-8"))
        elif isinstance(key, DimensionValue):
            def f(x):
                return (x is key)
        else:
            return list.__getitem__(self, key)
        try:
            val = next(iter(filter(f, self)))
            return val
        except IndexError:
            # No such id
            raise NoSuchItem("No such value")

    def __contains__(self, item):
        """ in should look for value, not id. """
        if isinstance(item, six.string_types):
            return bool(len(list(filter(lambda x: x.value == item, self))))
        else:
            return super(ValueList, self).__contains__(item)


text:
SYNONYM

#### According to
Index Fungorum

#### Published in
Haupt- und Nebenfruchtformen der Ascomyzeten (Leipzig) 1: 132 (1918)

#### Original name
Cercosphaerella Kleb.

### Remarks
null


text:
#include <Project/Project.hpp>
#include <Project/BuildAssetHelper.hpp>
#include "FxcCommand.hpp"

int FxcCommand::execute(const ln::Path& inputFile)
{
	auto result = lna::BuildAssetHelper::buildShader(inputFile, outputFile);
	return result ? 1 : 0;
}


text:
Template.listPlaylists.helpers({
  playlists: function() {
    return Playlists.find({});
  }
});


text:
<?php

/**
 *
 * Source model for signature notification
 *
 * @author Aymeric Berthelot <aberthelot@hipay.com>
 * @copyright   Copyright (c) 2018 - HiPay
 * @license     https://github.com/hipay/hipay-fullservice-sdk-magento1/blob/master/LICENSE.md
 * @link    https://github.com/hipay/hipay-fullservice-sdk-magento1
 */
require_once(dirname(__FILE__) . '/../../Helper/Enum/HashingCode.php');

class Allopass_Hipay_Model_Source_HashingAlgorithm
{

    /**
     * Options getter
     *
     * @return array
     */
    public function toOptionArray()
    {
        return array(
            array('value' => HashingCode::SHA1, 'label' => 'SHA-1'),
            array('value' => HashingCode::SHA256, 'label' => 'SHA-256'),
            array('value' => HashingCode::SHA512, 'label' => 'SHA-512'),
        );
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<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/maven-v4_0_0.xsd">
  <parent>
    <groupId>io.hawt</groupId>
    <artifactId>project</artifactId>
    <version>1.5-SNAPSHOT</version>
  </parent>

  <modelVersion>4.0.0</modelVersion>
  <artifactId>hawtio-maven-indexer</artifactId>
  <name>${project.artifactId}</name>
  <description>hawtio :: hawtio-maven-indexer</description>
  <packaging>bundle</packaging>

  <properties>
    <fuse.osgi.export>
    </fuse.osgi.export>
    <fuse.osgi.import>
      !org.apache.avalon.*,
      !org.apache.xerces.*,
      !org.apache.log4j.*,
      *;resolution:=optional
    </fuse.osgi.import>
  </properties>

  <dependencies>
    <!-- logging -->
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>${slf4j-version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>io.hawt</groupId>
      <artifactId>hawtio-core</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>org.apache.maven.indexer</groupId>
      <artifactId>indexer-core</artifactId>
      <version>5.1.1</version>
    </dependency>
    <dependency>
      <groupId>org.apache.maven.wagon</groupId>
      <artifactId>wagon-http-lightweight</artifactId>
<!--
      <version>2.2</version>
-->
      <!-- lets use the old crusty one to avoid clashes with pax-url-mvn and insight-log4j -->
      <version>1.0</version>
    </dependency>

    <!-- Runtime: Plexus IoC compat (is compile since in this example we "boot" plexus) -->
    <!-- Newer releases such as 2.4.3/2.5.1 does not work as it hangs the indexer thread -->
    <dependency>
      <groupId>org.sonatype.sisu</groupId>
      <artifactId>sisu-inject-plexus</artifactId>
      <version>2.3.4</version>
    </dependency>

    <!-- testing -->
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>${junit-version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-log4j12</artifactId>
      <version>${slf4j-version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>log4j</groupId>
      <artifactId>log4j</artifactId>
      <version>${log4j-version}</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>${maven-surefire-plugin-version}</version>
        <configuration>
          <excludes>
            <!-- lets avoid this test as it can be flaky due to the fuse nexus repo -->
            <exclude>**/Fuse*.*</exclude>
            <!-- lets avoid this test by default as it downloads large indices -->
            <exclude>**/MavenIndexFacadeTest.*</exclude>
          </excludes>
          <systemPropertyVariables>
            <basedir>${basedir}</basedir>
          </systemPropertyVariables>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <version>${maven-bundle-plugin-version}</version>
        <extensions>true</extensions>
        <executions>
          <execution>
            <id>bundle-manifest</id>
            <phase>process-classes</phase>
            <goals>
              <goal>manifest</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <instructions>
            <Embed-Directory>lib</Embed-Directory>
            <Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
            <Embed-Transitive>true</Embed-Transitive>
            <Bundle-ClassPath>.</Bundle-ClassPath>
            <Bundle-Name>${project.description}</Bundle-Name>
            <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
            <Import-Package>${fuse.osgi.import}</Import-Package>
            <Export-Package>${fuse.osgi.export}</Export-Package>
            <Implementation-Title>hawtio</Implementation-Title>
            <Implementation-Version>${project.version}</Implementation-Version>
          </instructions>
        </configuration>
      </plugin>

    </plugins>
  </build>

  <profiles>
    <profile>
      <id>itest</id>
      <activation>
        <activeByDefault>false</activeByDefault>
      </activation>

      <build>
        <plugins>
          <plugin>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>${maven-surefire-plugin-version}</version>
            <configuration>
              <includes>
                <include>**/*Test.*</include>
              </includes>
              <excludes>
              </excludes>
              <systemPropertyVariables>
                <basedir>${basedir}</basedir>
              </systemPropertyVariables>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>