text:
// ------------------------------------------------------------------------------
//  <auto-generated>
//      This code was generated by SpecFlow (http://www.specflow.org/).
//      SpecFlow Version:2.1.0.0
//      SpecFlow Generator Version:2.0.0.0
//
//      Changes to this file may cause incorrect behavior and will be lost if
//      the code is regenerated.
//  </auto-generated>
// ------------------------------------------------------------------------------
#region Designer generated code
#pragma warning disable
namespace PerfectSystemTestsDesign
{
    using TechTalk.SpecFlow;

    [System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "2.1.0.0")]
    [System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    [Microsoft.VisualStudio.TestTools.UnitTesting.TestClassAttribute()]
    public partial class CreatePurchaseInAmazonFeature
    {

        private static TechTalk.SpecFlow.ITestRunner testRunner;

#line 1 "AmazonPurchase.feature"
#line hidden

        [Microsoft.VisualStudio.TestTools.UnitTesting.ClassInitializeAttribute()]
        public static void FeatureSetup(Microsoft.VisualStudio.TestTools.UnitTesting.TestContext testContext)
        {
            testRunner = TechTalk.SpecFlow.TestRunnerManager.GetTestRunner(null, 0);
            TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Create Purchase in Amazon", "\tIn order to receive a book online\r\n\tAs a client\r\n\tI want to be able to choose it" +
                    " through the browser and pay for it online", ProgrammingLanguage.CSharp, ((string[])(null)));
            testRunner.OnFeatureStart(featureInfo);
        }

        [Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupAttribute()]
        public static void FeatureTearDown()
        {
            testRunner.OnFeatureEnd();
            testRunner = null;
        }

        [Microsoft.VisualStudio.TestTools.UnitTesting.TestInitializeAttribute()]
        public virtual void TestInitialize()
        {
            if (((testRunner.FeatureContext != null)
                        && (testRunner.FeatureContext.FeatureInfo.Title != "Create Purchase in Amazon")))
            {
                PerfectSystemTestsDesign.CreatePurchaseInAmazonFeature.FeatureSetup(null);
            }
        }

        [Microsoft.VisualStudio.TestTools.UnitTesting.TestCleanupAttribute()]
        public virtual void ScenarioTearDown()
        {
            testRunner.OnScenarioEnd();
        }

        public virtual void ScenarioSetup(TechTalk.SpecFlow.ScenarioInfo scenarioInfo)
        {
            testRunner.OnScenarioStart(scenarioInfo);
        }

        public virtual void ScenarioCleanup()
        {
            testRunner.CollectScenarioErrors();
        }

        [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()]
        [Microsoft.VisualStudio.TestTools.UnitTesting.DescriptionAttribute("Create Successfull Purchase When Billing Country Is United States with American E" +
            "xpress Card")]
        [Microsoft.VisualStudio.TestTools.UnitTesting.TestPropertyAttribute("FeatureTitle", "Create Purchase in Amazon")]
        [Microsoft.VisualStudio.TestTools.UnitTesting.TestCategoryAttribute("testingFramework")]
        public virtual void CreateSuccessfullPurchaseWhenBillingCountryIsUnitedStatesWithAmericanExpressCard()
        {
            TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Create Successfull Purchase When Billing Country Is United States with American E" +
                    "xpress Card", new string[] {
                        "testingFramework"});
#line 7
this.ScenarioSetup(scenarioInfo);
#line 8
 testRunner.When("I navigate to \"/Selenium-Testing-Cookbook-Gundecha-Unmesh/dp/1849515743\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 9
 testRunner.And("I click the \'buy now\' button", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 10
 testRunner.And("then I click the \'proceed to checkout\' button", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 11
 testRunner.And("I login with email = \"g3984159@trbvm.com\" and pass = \"ASDFG_12345\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 12
 testRunner.And("I type full name = \"John Smith\", country = \"United States\", Adress = \"950 Avenue " +
                    "of the Americas\", city = \"New Your City\", state = \"New Your\", zip = \"10001-2121\"" +
                    " and phone = \"00164644885569\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 13
 testRunner.And("I choose to fill different billing, full name = \"John Smith\", country = \"United S" +
                    "tates\", Adress = \"950 Avenue of the Americas\", city = \"New Your City\", state = \"" +
                    "New Your\", zip = \"10001-2121\" and phone = \"00164644885569\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 14
 testRunner.And("click shipping address page \'continue\' button", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 15
 testRunner.And("click shipping payment top \'continue\' button", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 16
 testRunner.Then("assert that order total price = \"40.49\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line hidden
            this.ScenarioCleanup();
        }
    }
}
#pragma warning restore
#endregion


text:
namespace Hudl.FFmpeg.Enums
{
    /// <summary>
    /// enumaration containing the know and extended codec libraries for the Hudl server
    /// </summary>
    /// <remarks></remarks>
    public enum VideoCodecType
    {
        /// <summary>
        /// indicates that the output video codec should be copied from the input
        /// </summary>
        Copy,
        /// <summary>
        /// indicates that the output video should use the h.264 codec
        /// </summary>
        Libx264
    }
}

redpajama_set_name: RedPajamaGithub


text:
<?php namespace ForeverPHP\Auth;

interface AuthInterface {
	// PARA TODAS LAS VERSIONES
}


text:
class SensorReadError(Exception):
    pass

class CommunicationErrorException(Exception):
    pass


text:
namespace JSON_Image_Generator
{
    partial class mainForm
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.menuStrip1 = new System.Windows.Forms.MenuStrip();
            this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.menuStrip1.SuspendLayout();
            this.SuspendLayout();
            //
            // menuStrip1
            //
            this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.fileToolStripMenuItem});
            this.menuStrip1.Location = new System.Drawing.Point(0, 0);
            this.menuStrip1.Name = "menuStrip1";
            this.menuStrip1.Size = new System.Drawing.Size(624, 24);
            this.menuStrip1.TabIndex = 0;
            this.menuStrip1.Text = "menuStrip1";
            //
            // fileToolStripMenuItem
            //
            this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.openToolStripMenuItem,
            this.saveToolStripMenuItem,
            this.exitToolStripMenuItem});
            this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
            this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
            this.fileToolStripMenuItem.Text = "File";
            //
            // openToolStripMenuItem
            //
            this.openToolStripMenuItem.Name = "openToolStripMenuItem";
            this.openToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
            this.openToolStripMenuItem.Text = "Open";
            this.openToolStripMenuItem.Click += new System.EventHandler(this.openToolStripMenuItem_Click);
            //
            // saveToolStripMenuItem
            //
            this.saveToolStripMenuItem.Name = "saveToolStripMenuItem";
            this.saveToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
            this.saveToolStripMenuItem.Text = "Save";
            //
            // exitToolStripMenuItem
            //
            this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
            this.exitToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
            this.exitToolStripMenuItem.Text = "Exit";
            this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
            //
            // mainForm
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(624, 441);
            this.Controls.Add(this.menuStrip1);
            this.MainMenuStrip = this.menuStrip1;
            this.Name = "mainForm";
            this.Text = "JSON Image Generator";
            this.menuStrip1.ResumeLayout(false);
            this.menuStrip1.PerformLayout();
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.MenuStrip menuStrip1;
        private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
        private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem;
        private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem;
        private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
    }
}


text:
namespace Envoy {
namespace Extensions {
namespace NetworkFilters {
namespace MySQLProxy {

// https://dev.mysql.com/doc/internals/en/connection-phase-packets.html#packet-Protocol::AuthSwitchRequest
DecodeStatus AuthSwitchMessage::parseMessage(Buffer::Instance& buffer, uint32_t remain_len) {
  int origin_len = buffer.length();
  if (BufferHelper::readUint8(buffer, resp_code_) != DecodeStatus::Success) {
    ENVOY_LOG(debug, "error parsing resp code of auth switch msg");
    return DecodeStatus::Failure;
  }
  ASSERT(resp_code_ == MYSQL_RESP_AUTH_SWITCH);
  // OldAuthSwitchRequest
  if (BufferHelper::endOfBuffer(buffer)) {
    setIsOldAuthSwitch(true);
    return DecodeStatus::Success;
  }
  if (BufferHelper::readString(buffer, auth_plugin_name_) != DecodeStatus::Success) {
    ENVOY_LOG(debug, "error parsing auth plugin name mysql Login response msg");
    return DecodeStatus::Failure;
  }
  int consumed_len = origin_len - buffer.length();
  if (BufferHelper::readVectorBySize(buffer, remain_len - consumed_len, auth_plugin_data_) !=
      DecodeStatus::Success) {
    ENVOY_LOG(debug, "error parsing auth plugin data code of auth switch msg");

    return DecodeStatus::Failure;
  }
  setIsOldAuthSwitch(false);
  return DecodeStatus::Success;
}

// https://dev.mysql.com/doc/internals/en/packet-OK_Packet.html
DecodeStatus OkMessage::parseMessage(Buffer::Instance& buffer, uint32_t len) {
  uint32_t init_len = buffer.length();
  if (BufferHelper::readUint8(buffer, resp_code_) != DecodeStatus::Success) {
    ENVOY_LOG(debug, "error parsing resp code of ok msg");
    return DecodeStatus::Failure;
  }
  ASSERT(resp_code_ == MYSQL_RESP_OK);
  if (BufferHelper::readLengthEncodedInteger(buffer, affected_rows_) != DecodeStatus::Success) {
    ENVOY_LOG(debug, "error parsing affected_rows of  ok msg");
    return DecodeStatus::Failure;
  }
  if (BufferHelper::readLengthEncodedInteger(buffer, last_insert_id_) != DecodeStatus::Success) {
    ENVOY_LOG(debug, "error parsing last_insert_id of ok msg");
    return DecodeStatus::Failure;
  }

  if (BufferHelper::readUint16(buffer, status_) != DecodeStatus::Success) {
    ENVOY_LOG(debug, "error parsing status of ok msg");
    return DecodeStatus::Failure;
  }
  // the exist of warning field is determined by server cap flag, but a decoder can not know the
  // cap flag, so just assume the CLIENT_PROTOCOL_41 is always set. ref
  // https://github.com/mysql/mysql-connector-j/blob/release/8.0/src/main/protocol-impl/java/com/mysql/cj/protocol/a/result/OkPacket.java#L48
  if (BufferHelper::readUint16(buffer, warnings_) != DecodeStatus::Success) {
    ENVOY_LOG(debug, "error parsing warnings of ok msg");
    return DecodeStatus::Failure;
  }
  uint32_t consumed_len = init_len - buffer.length();
  // The tail might contain debug base on cap flag and status flag, but just consume all
  if (BufferHelper::readStringBySize(buffer, len - consumed_len, info_) != DecodeStatus::Success) {
    ENVOY_LOG(debug, "error parsing debug of ok msg");
    return DecodeStatus::Failure;
  }
  return DecodeStatus::Success;
}

// https://dev.mysql.com/doc/internals/en/packet-ERR_Packet.html
DecodeStatus ErrMessage::parseMessage(Buffer::Instance& buffer, uint32_t remain_len) {
  int origin_len = buffer.length();
  if (BufferHelper::readUint8(buffer, resp_code_) != DecodeStatus::Success) {
    ENVOY_LOG(debug, "error parsing resp code of error msg");
    return DecodeStatus::Failure;
  }
  ASSERT(resp_code_ == MYSQL_RESP_ERR);
  if (BufferHelper::readUint16(buffer, error_code_) != DecodeStatus::Success) {
    ENVOY_LOG(debug, "error parsing error code of error msg");
    return DecodeStatus::Failure;
  }
  if (BufferHelper::readUint8(buffer, marker_) != DecodeStatus::Success) {
    ENVOY_LOG(debug, "error parsing sql state marker of error msg");
    return DecodeStatus::Failure;
  }
  if (BufferHelper::readStringBySize(buffer, MYSQL_SQL_STATE_LEN, sql_state_) !=
      DecodeStatus::Success) {
    ENVOY_LOG(debug, "error parsing sql state of error msg");
    return DecodeStatus::Failure;
  }
  int consumed_len = origin_len - buffer.length();
  if (BufferHelper::readStringBySize(buffer, remain_len - consumed_len, error_message_) !=
      DecodeStatus::Success) {
    ENVOY_LOG(debug, "error parsing error message of error msg");
    return DecodeStatus::Failure;
  }
  return DecodeStatus::Success;
}

// https://dev.mysql.com/doc/internals/en/connection-phase-packets.html#packet-Protocol::AuthMoreData
DecodeStatus AuthMoreMessage::parseMessage(Buffer::Instance& buffer, uint32_t remain_len) {
  if (BufferHelper::readUint8(buffer, resp_code_) != DecodeStatus::Success) {
    ENVOY_LOG(debug, "error parsing resp code of auth more msg");
    return DecodeStatus::Failure;
  }
  ASSERT(resp_code_ == MYSQL_RESP_MORE);
  if (BufferHelper::readVectorBySize(buffer, remain_len - sizeof(uint8_t), more_plugin_data_) !=
      DecodeStatus::Success) {
    ENVOY_LOG(debug, "error parsing more plugin data of auth more msg");
    return DecodeStatus::Failure;
  }
  return DecodeStatus::Success;
}

void AuthSwitchMessage::encode(Buffer::Instance& out) const {
  BufferHelper::addUint8(out, resp_code_);
  if (isOldAuthSwitch()) {
    return;
  }
  BufferHelper::addString(out, auth_plugin_name_);
  BufferHelper::addUint8(out, 0);
  BufferHelper::addVector(out, auth_plugin_data_);
}

void OkMessage::encode(Buffer::Instance& out) const {
  BufferHelper::addUint8(out, resp_code_);
  BufferHelper::addLengthEncodedInteger(out, affected_rows_);
  BufferHelper::addLengthEncodedInteger(out, last_insert_id_);
  BufferHelper::addUint16(out, status_);
  BufferHelper::addUint16(out, warnings_);
  BufferHelper::addString(out, info_);
}

void ErrMessage::encode(Buffer::Instance& out) const {
  BufferHelper::addUint8(out, resp_code_);
  BufferHelper::addUint16(out, error_code_);
  BufferHelper::addUint8(out, marker_);
  BufferHelper::addString(out, sql_state_);
  BufferHelper::addString(out, error_message_);
}

void AuthMoreMessage::encode(Buffer::Instance& out) const {
  BufferHelper::addUint8(out, resp_code_);
  BufferHelper::addVector(out, more_plugin_data_);
}

} // namespace MySQLProxy
} // namespace NetworkFilters
} // namespace Extensions
} // namespace Envoy


text:
<?xml version="1.0"?>
<pof-config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns="http://xmlns.oracle.com/coherence/coherence-pof-config"
	xsi:schemaLocation="http://xmlns.oracle.com/coherence/coherence-pof-config coherence-pof-config.xsd">
	<user-type-list>
		<!-- include all "standard" Coherence POF user types -->
		<include>coherence-pof-config.xml</include>
		<user-type>
			<type-id>1001</type-id>
			<class-name>test.com.simukappu.coherence.entity.TestParentEntity
			</class-name>
		</user-type>
		<user-type>
			<type-id>1002</type-id>
			<class-name>test.com.simukappu.coherence.entity.TestChildEntity
			</class-name>
		</user-type>
	</user-type-list>
</pof-config>


text:
import { Routes } from '@angular/router';
import { UIRouterModule } from 'ui-router-ng2';
import { components } from './components';

export let statesConfig: any = {
  useHash: true,
  otherwise: '/list',
  states: [
    {
      name: 'product',
      url: '/product',
      component: components.RegisterProductComponent
    },
    {
      name: 'list',
      url: '/list',
      component: components.ListsComponent
    },
    {
      name: 'location',
      url: '/location',
      component: components.RegisterLocationComponent
    },
    {
      name: 'code',
      url: '/code',
      component: components.CodeGeneratorComponent
    }
  ]
};


text:
package stream

import stream.Fns.{IntIntIntFn, IntBoolFn, IntIntFn}

object Iterators {
  trait IntIterator {
    def empty : Boolean
    def current : Int
    def next()
  }

  class IntFilterStream(stream : IntIterator, pred : IntBoolFn) extends IntIterator {
    def current = stream.current
    def empty = stream.empty

    def next() {
      stream.next()
      findNext()
    }

    def findNext() {
      while (!stream.empty && !pred(current))
        stream.next()
    }

    findNext()
  }

  class IntMapStream(stream : IntIterator, fn : IntIntFn) extends IntIterator {
    def next() = stream.next()
    def current = fn(stream.current)
    def empty = stream.empty
  }

  class IntArrayStream(a : Array[Int], var index : Int, endIndex : Int) extends IntIterator {
    def next() = index += 1
    def current = a(index)
    def empty = index >= endIndex
  }

  def fold(s : IntIterator, fn : IntIntIntFn, v : Int) = {
    var r = v

    while (!s.empty) {
      r = fn(r, s.current)
      s.next()
    }

    r
  }

  def sum(s : IntIterator) : Int = {
    fold(s, new IntIntIntFn { def apply(a1 : Int, a2 : Int) = a1 + a2 }, 0)
  }

  def sum(a : Array[Int]) : Int = {
    sum(new IntArrayStream(a, 0, a.length))
  }

  def filterSum(a : Array[Int]) = {
    val s = new IntFilterStream(new IntArrayStream(a, 0, a.length), new IntBoolFn { def apply(a : Int) = (a % 37) == 0 })
    sum(s)
  }

  def mapFilterSum(a : Array[Int]) = {
    val s = new IntMapStream(new IntFilterStream(new IntArrayStream(a, 0, a.length), new IntBoolFn { def apply(a : Int) = (a % 37) == 0 }), new IntIntFn { def apply(a : Int) = a * 3 + 7 })
    sum(s)
  }

}


text:
angular.module('ui.chart', [])
    .directive('uiChart', function () {
        return {
            restrict: 'EACM',
            template: '

',
            replace: true,
            link: function (scope, elem, attrs) {
                var renderChart = function () {
                    var data = scope.$eval(attrs.uiChart);
                    elem.html('');
                    if (!angular.isArray(data)) {
                        return;
                    }

                    var opts = {};
                    if (!angular.isUndefined(attrs.chartOptions)) {
                        opts = scope.$eval(attrs.chartOptions);
                        if (!angular.isObject(opts)) {
                            throw 'Invalid ui.chart options attribute';
                        }
                    }

                    elem.jqplot(data, opts);
                };

                scope.$watch(attrs.uiChart, function () {
                    renderChart();
                }, true);

                scope.$watch(attrs.chartOptions, function () {
                    renderChart();
                });
            }
        };
    });


text:
import { Store, Unsubscribe } from 'redux';

export type Listener = () => void;

interface IListenerCollection {
  clear: () => void;
  notify: () => void;
  subscribe: (listener: Listener) => Unsubscribe;
}

const CLEARED = null;
// tslint:disable-next-line:no-empty
const nullSubscriptionHandler: Unsubscribe = () => {};
const nullListenerCollection: IListenerCollection = {
  // tslint:disable-next-line:no-empty
  clear: () => {},
  // tslint:disable-next-line:no-empty
  notify: () => {},
  subscribe: (_: Listener) => nullSubscriptionHandler
};

const createListenerCollection = (): IListenerCollection => {
  // the current/next pattern is copied from redux's createStore code.
  let current: Listener[] | null = [];
  let next: Listener[] | null = [];

  return {
    clear: () => {
      next = CLEARED;
      current = CLEARED;
    },

    notify: () => {
      const listeners = (current = next!);
      for (let i = 0; i < listeners.length; ++i) {
        listeners[i]();
      }
    },

    subscribe: (listener: Listener) => {
      let isSubscribed = true;
      if (next === current) {
        next = current!.slice();
      }
      next!.push(listener);

      return () => {
        if (!isSubscribed || current === null) {
          return;
        }

        isSubscribed = false;
        if (next === current) {
          next = current.slice();
        }
        next!.splice(next!.indexOf(listener), 1);
      };
    }
  };
};

export class Subscription {
  private store: Store<any>;
  private parentSub: Subscription | null;
  private onStateChange: () => void;
  private unsubscribe: Unsubscribe | null;
  private listeners: IListenerCollection;
  constructor(store: Store<any>, parentSub: Subscription | null, onStateChange: () => void) {
    this.store = store;
    this.parentSub = parentSub;
    this.onStateChange = onStateChange;
    this.unsubscribe = null;
    this.listeners = nullListenerCollection;
  }

  public addNestedSub(listener) {
    this.trySubscribe();
    return this.listeners.subscribe(listener);
  }

  public notifyNestedSubs() {
    this.listeners.notify();
  }

  public isSubscribed() {
    return Boolean(this.unsubscribe);
  }

  public trySubscribe() {
    if (!this.unsubscribe) {
      this.unsubscribe = this.parentSub ? this.parentSub.addNestedSub(this.onStateChange) : this.store.subscribe(this.onStateChange);

      this.listeners = createListenerCollection();
    }
  }

  public tryUnsubscribe() {
    if (this.unsubscribe) {
      this.unsubscribe();
      this.unsubscribe = null;
      this.listeners.clear();
      this.listeners = nullListenerCollection;
    }
  }
}


text:
<!DOCTYPE html>

  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1"/>
  <title>Gearpump Connectors - GearPump 0.7.0 Documentation</title>

  <link rel="stylesheet" href="css/bootstrap-3.3.5.min.css">

  <link rel="stylesheet" href="css/main.css">
  <link rel="stylesheet" href="css/pygments-default.css">

        GearPump
          0.7.0

Overview

            Introduction

Submit Your 1st Application

Client Command Line

Basic Concepts

Technical Highlights

Reliable Message Delivery

Performance

Gearpump Internals

            Deploying

Deployment

Docker

Local

Standalone

YARN

High Availability

Reliable Message Delivery

Configuration

Security

            Programming Guide

Write Your 1st App

Customized Message Passing

Scala API

Java API

RESTful API

Gearpump Connectors

Storm Compatibility

            More

How to Contribute

Coding Style

FAQ

About

Gearpump Connectors

Basic Concepts

DataSource and DataSink are the two main concepts Gearpump use to connect with the outside world.

DataSource

DataSource is the concept in Gearpump that without input and will output messages. So, basically, DataSource is the start point of a streaming processing flow.

As Gearpump depends on DataSource to be replayable to ensure at-least-once message delivery and exactly-once message delivery, for some data sources, we will need a io.gearpump.streaming.transaction.api.OffsetStorageFactory to store the offset (progress) of current DataSource. So that, when a replay is needed, Gearpump can guide DataSource to replay from certain offset.

Currently Gearpump DataSource only support infinite stream. Finite stream support will be added in a near future release.

DataSink

DataSink is the concept that without output but will consume messages. So, Sink is the end point of a streaming processing flow.

Implemented Connectors

DataSource implemented

Currently, we have following DataSource supported.

      Name
      Description

      CollectionDataSource
      Convert a collection to a recursive data source. E.g. seq(1, 2, 3) will output 1,2,3,1,2,3....

      KafkaSource
      Read from Kafka.

DataSink implemented

Currently, we have following DataSink supported.

      Name
      Description

      HBaseSink
      Write the message to HBase. The message to write must be HBase Put or a tuple of (rowKey, family, column, value).

      KafkaSink
      Write to Kafka.

Use of Connectors

### Use of KafkaSource
To use kafkaSource in your application, you first need to add the gearpump-external-Kafka library dependency in your application:

"com.github.intel-hadoop" %% "gearpump-external-kafka" % 0.7.0

<dependency>
  <groupId>com.github.intel-hadoop</groupId>
  <artifactId>gearpump-external-kafka</artifactId>
  <version>0.7.0</version>
</dependency>

To connect to Kafka, you need to provide following info:
 - the Zookeeper address
 - the Kafka topic

Then, you can use KafkaSource in your application:

   //Specify the offset storage.
   //Here we use the same zookeeper as the offset storage.
   //A set of corresponding topics will be created to store the offsets.
   //You are free to specify your own offset storage
   val offsetStorageFactory = new KafkaStorageFactory(zookeepers, brokers)

   //create the kafka data source
   val source = new KafkaSource(topic, zookeepers, offsetStorageFactory)

   //create Gearpump Processor
   val reader = DataSourceProcessor(source, parallelism)

  //specify the offset storage
  //here we use the same zookeeper as the offset storage (a set of corresponding topics will be created to store the offsets)
  //you are free to specify your own offset storage
  val offsetStorageFactory = new KafkaStorageFactory(zookeepers, brokers)

  val source = KafkaDSLUtil.createStream(app, parallelism, "Kafka Source", topics, zookeepers, offsetStorageFactory)
  ...

Use of HBaseSink

To use HBaseSink in your application, you first need to add the gearpump-external-hbase library dependency in your application:

"com.github.intel-hadoop" %% "gearpump-external-hbase" % 0.7.0

<dependency>
  <groupId>com.github.intel-hadoop</groupId>
  <artifactId>gearpump-external-hbase</artifactId>
  <version>0.7.0</version>
</dependency>

To connect to HBase, you need to provide following info:
 - the HBase configuration to tell which HBase service to connect
 - the table name

Then, you can use HBaseSink in your application:

   //create the HBase data sink
   val sink = HBaseSink(tableName, configuration)

   //create Gearpump Processor
   val sinkProcessor = DataSinkProcessor(source, parallelism)

  //assume stream is a normal `Stream` in DSL
  stream.writeToHbase(tableName, parallelism, "write to HBase")

You can tune the connection to HBase via the HBase configuration passed in. If not passed, Gearpump will try to check local classpath to find a valid HBase configuration (hbase-site.xml).

How to implement your own DataSource

To implement your own DataSource, you need to implement two things:

The data source itself

a helper class to make it easy use in DSL

Implement your own DataSource

You need to implement a class derived from io.gearpump.streaming.transaction.api.TimeReplayableSource.

Implement DSL helper (Optional)

To make DSL easy of use this customized stream, it is better that if you can implement your own DSL helper.
You can refer KafkaDSLUtil as an example in Gearpump source.

Below is some code snippet from KafkaDSLUtil:

object KafkaDSLUtil {
  //T is the message type
  def createStream[T: ClassTag](
      app: StreamApp,
      parallelism: Int,
      description: String,
      topics: String,
      zkConnect: String,
      offsetStorageFactory: OffsetStorageFactory): dsl.Stream[T] = {
    app.source[T](new KafkaSource(topics, zkConnect, offsetStorageFactory)
        with TypedDataSource[T], parallelism, description)
  }
}

How to implement your own DataSink

To implement your own DataSink, you need to implement two things:

The data sink itself

a helper class to make it easy use in DSL

Implement your own DataSink

You need to implement a class derived from io.gearpump.streaming.sink.DataSink.

Implement DSL helper (Optional)

To make DSL easy of use this customized stream, it is better that if you can implement your own DSL helper.
You can refer HBaseDSLSink as an example in Gearpump source.

Below is some code snippet from KafkaDSLUtil:

class HBaseDSLSink[T: ClassTag](stream: Stream[T]) {
  def writeToHbase(table: String, parallism: Int, description: String): Stream[T] = {
    stream.sink(HBaseSink(table), parallism, description)
  }
}

object HBaseDSLSink {
  implicit def streamToHBaseDSLSink[T: ClassTag](stream: Stream[T]): HBaseDSLSink[T] = {
    new HBaseDSLSink[T](stream)
  }
}


text:
package avro

//go:generate $GOPATH/bin/gogen-avro --containers . message.avsc


text:
import { customElement, GenericTypes } from '@blaze-elements/common';
import RawAccordion, { AccordionProps, Attrs, Events } from './Accordion';

const Accordion = customElement( 'bl-accordion' )( RawAccordion ) as typeof RawAccordion;

export {
  Accordion
};

declare global {
  namespace JSX {
    interface IntrinsicElements {
      'bl-accordion': GenericTypes.IntrinsicCustomElement<AccordionProps>
      & GenericTypes.IntrinsicBoreElement<Attrs, Events>
    }
  }
}


text:
/*************************************************************************//**
 * @file
 * @brief    	This file is part of the AFBR-S50 hardware API.
 * @details		Defines the generic device calibration API.
 *
 * @copyright
 *
 * Copyright (c) 2021, Broadcom Inc
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * 1. Redistributions of source code must retain the above copyright notice, this
 *    list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright notice,
 *    this list of conditions and the following disclaimer in the documentation
 *    and/or other materials provided with the distribution.
 *
 * 3. Neither the name of the copyright holder nor the names of its
 *    contributors may be used to endorse or promote products derived from
 *    this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *****************************************************************************/

#ifndef ARGUS_XTALK_H
#define ARGUS_XTALK_H

/*!***************************************************************************
 * @addtogroup 	arguscal
 * @{
 *****************************************************************************/

#include "api/argus_def.h"

/*!***************************************************************************
 * @brief	Pixel Crosstalk Compensation Vector.
 * @details	Contains calibration data (per pixel) that belongs to the
 * 			RX-TX-Crosstalk compensation feature.
 *****************************************************************************/

/*! Pixel Crosstalk Vector */
typedef struct {
	/*! Crosstalk Vector - Sine component.
	 *  Special Value: Q11_4_MIN == not available */
	q11_4_t dS;

	/*! Crosstalk Vector - Cosine component.
	 *  Special Value: Q11_4_MIN == not available */
	q11_4_t dC;

} xtalk_t;

/*!***************************************************************************
 * @brief	Pixel-To-Pixel Crosstalk Compensation Parameters.
 * @details	Contains calibration data that belongs to the pixel-to-pixel
 * 			crosstalk compensation feature.
 *****************************************************************************/
typedef struct {
	/*! Pixel-To-Pixel Compensation on/off. */
	bool Enabled;

	/*! The relative threshold determines when the compensation is active for
	 *  each individual pixel. The value determines the ratio of the individual
	 *  pixel signal is with respect to the overall average signal. If the
	 *  ratio is smaller than the value, the compensation is active. Absolute
	 *  and relative conditions are connected with AND logic. */
	uq0_8_t RelativeThreshold;

	/*! The absolute threshold determines the minimum total crosstalk
	 *  amplitude (i.e. the average amplitude of all pixels weighted by
	 *  the Kc factor) that is required for the compensation to become
	 *  active. Set to 0 to always enable. Absolute and relative
	 *  conditions are connected with AND logic. */
	uq12_4_t AbsoluteTreshold;

	/*! The sine component of the Kc factor that determines the amount of the total
	 *  signal of all pixels that influences the individual signal of each pixel.
	 *  Higher values determine more influence on the individual pixel signal. */
	q3_12_t KcFactorS;

	/*! The cosine component of the Kc factor that determines the amount of the total
	 *  signal of all pixels that influences the individual signal of each pixel.
	 *  Higher values determine more influence on the individual pixel signal. */
	q3_12_t KcFactorC;

	/*! The sine component of the reference pixel Kc factor that determines the
	 *  amount of the total signal on all pixels that influences the individual
	 *  signal of the reference pixel.
	 *  Higher values determine more influence on the reference pixel signal. */
	q3_12_t KcFactorSRefPx;

	/*! The cosine component of the reference pixel Kc factor that determines the
	 *  amount of the total signal on all pixels that influences the individual
	 *  signal of the reference pixel.
	 *  Higher values determine more influence on the reference pixel signal. */
	q3_12_t KcFactorCRefPx;

} argus_cal_p2pxtalk_t;

/*! @} */
#endif /* ARGUS_XTALK_H */


text:
   /**
    *  Gets URI that identifies the test.
    *  @return uri identifier of test
    */
function getTargetURI() {
      return "http://www.w3.org/2001/DOM-Test-Suite/level3/core/nodecomparedocumentposition27";
   }

var docsLoaded = -1000000;
var builder = null;

//
//   This function is called by the testing framework before
//      running the test suite.
//
//   If there are no configuration exceptions, asynchronous
//        document loading is started.  Otherwise, the status
//        is set to complete and the exception is immediately
//        raised when entering the body of the test.
//
function setUpPage() {
   setUpPageStatus = 'running';
   try {
     //
     //   creates test document builder, may throw exception
     //
     builder = createConfiguredBuilder();

      docsLoaded = 0;

      var docRef = null;
      if (typeof(this.doc) != 'undefined') {
        docRef = this.doc;
      }
      docsLoaded += preload(docRef, "doc", "hc_staff");

       if (docsLoaded == 1) {
          setUpPageStatus = 'complete';
       }
    } catch(ex) {
    	catchInitializationError(builder, ex);
        setUpPageStatus = 'complete';
    }
}

//
//   This method is called on the completion of
//      each asychronous load started in setUpTests.
//
//   When every synchronous loaded document has completed,
//      the page status is changed which allows the
//      body of the test to be executed.
function loadComplete() {
    if (++docsLoaded == 1) {
        setUpPageStatus = 'complete';
    }
}

/**
*
	Using compareDocumentPosition to check if the EntityReference node contains and precedes it's last
	childElement, and that this childElement is contained and follows the EntityReference node.

* @author IBM
* @author Jenny Hsu
* @see http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-compareDocumentPosition
*/
function nodecomparedocumentposition27() {
   var success;
    if(checkInitialization(builder, "nodecomparedocumentposition27") != null) return;
    var doc;
      var varList;
      var varElem;
      var entRef;
      var entRefChild1;
      var entRefPosition;
      var entRefChild1Position;

      var docRef = null;
      if (typeof(this.doc) != 'undefined') {
        docRef = this.doc;
      }
      doc = load(docRef, "doc", "hc_staff");

	if(
	(getImplementationAttribute("expandEntityReferences") == false)
	) {
	varList = doc.getElementsByTagName("var");
      varElem = varList.item(2);
      assertNotNull("varElemNotNull",varElem);
entRef = varElem.firstChild;

      assertNotNull("entRefNotNull",entRef);

	}

		else {
			entRef = doc.createEntityReference("ent4");

		}
	entRefChild1 = entRef.lastChild;

      assertNotNull("entRefChild1NotNull",entRefChild1);
entRefPosition = entRef.compareDocumentPosition(entRefChild1);
      assertEquals("nodecomparedocumentpositionIsContainedFollowing27",20,entRefPosition);
       entRefChild1Position = entRefChild1.compareDocumentPosition(entRef);
      assertEquals("nodecomparedocumentpositionContainsPRECEDING",10,entRefChild1Position);

}

function runTest() {
   nodecomparedocumentposition27();
}


text:
package org.apereo.cas.web.flow;

import org.apereo.cas.config.CasCoreMultifactorAuthenticationConfiguration;
import org.apereo.cas.config.CoreSamlConfiguration;
import org.apereo.cas.support.wsfederation.config.WsFederationAuthenticationConfiguration;
import org.apereo.cas.support.wsfederation.config.support.authentication.WsFedAuthenticationEventExecutionPlanConfiguration;
import org.apereo.cas.web.flow.config.CasMultifactorAuthenticationWebflowConfiguration;
import org.apereo.cas.web.flow.config.WsFederationAuthenticationWebflowConfiguration;

import lombok.val;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.springframework.context.annotation.Import;
import org.springframework.test.context.TestPropertySource;
import org.springframework.webflow.engine.Flow;
import org.springframework.webflow.engine.TransitionableState;

import static org.junit.jupiter.api.Assertions.*;

/**
 * This is {@link WsFederationWebflowConfigurerTests}.
 *
 * @author Misagh Moayyed
 * @since 6.2.0
 */
@Import({
    CoreSamlConfiguration.class,
    WsFederationAuthenticationConfiguration.class,
    WsFedAuthenticationEventExecutionPlanConfiguration.class,
    WsFederationAuthenticationWebflowConfiguration.class,
    CasCoreMultifactorAuthenticationConfiguration.class,
    CasMultifactorAuthenticationWebflowConfiguration.class,
    BaseWebflowConfigurerTests.SharedTestConfiguration.class
})
@TestPropertySource(properties = {
    "cas.authn.wsfed[0].identityProviderUrl=https://example.org/adfs/ls/",
    "cas.authn.wsfed[0].identityProviderIdentifier=https://example.org/adfs/services/trust",
    "cas.authn.wsfed[0].relyingPartyIdentifier=urn:cas:example",
    "cas.authn.wsfed[0].signingCertificateResources=classpath:adfs-signing.cer",
    "cas.authn.wsfed[0].identityAttribute=upn"
})
@Tag("Webflow")
public class WsFederationWebflowConfigurerTests extends BaseWebflowConfigurerTests {
    @Test
    public void verifyOperation() {
        assertFalse(casWebflowExecutionPlan.getWebflowConfigurers().isEmpty());
        val flow = (Flow) this.loginFlowDefinitionRegistry.getFlowDefinition(CasWebflowConfigurer.FLOW_ID_LOGIN);
        assertNotNull(flow);
        var state = (TransitionableState) flow.getState(WsFederationWebflowConfigurer.STATE_ID_WS_FEDERATION_ACTION);
        assertNotNull(state);
    }
}