text:
// ==========================================================================
// Project:   SproutCore - JavaScript Application Framework
// Copyright: ©2006-2010 Apple Inc. and contributors.
// License:   Licensed under MIT license (see license.js)
// ==========================================================================
/*globals module ok equals same test MyApp */

var store, storeKey1, storeKey2, storeKey3, storeKey4, storeKey5, storeKey6;
var storeKey7, json, json1, json2, json3, json4, json5, json6, json7;
var ds ;

module("SC.Store#commitRecord", {
  setup: function() {

    ds = SC.DataSource.create({

      callCount: 0,

      commitRecords: function(store, toCreate, toUpdate, toDestroy, params) {
        this.toCreate = toCreate;
        this.toUpdate = toUpdate;
        this.toDestroy = toDestroy;
        this.params = params;
        this.callCount++;
      },

      reset: function() {
        this.toCreate = this.toUpdate = this.toDestroy = this.params = null;
        this.callCount = 0 ;
      },

      expect: function(callCount, toCreate, toUpdate, toDestroy, params) {
        if (callCount !== undefined) {
          equals(this.callCount, callCount, 'expect datasource.commitRecords to be called X times');
        }

        if (toCreate !== undefined) {
          same(this.toCreate, toCreate, 'expect toCreate to have items');
        }

        if (toUpdate !== undefined) {
          same(this.toUpdate, toUpdate, 'expect toUpdate to have items');
        }

        if (toDestroy !== undefined) {
          same(this.toDestroy, toDestroy, 'expect toDestroy to have items');
        }

        if (params !== undefined) {
          same(this.params, params, 'expect params to have items');
        }
      }

    });

    store = SC.Store.create().from(ds);

    json1 = {
      guid: "commitGUID1",
      string: "string",
      number: 23,
      bool:   YES
    };
    json2 = {
      guid: "commitGUID2",
      string: "string",
      number: 23,
      bool:   YES
    };
    json3 = {
      guid: "commitGUID3",
      string: "string",
      number: 23,
      bool:   YES
    };
    json4 = {
      guid: "commitGUID4",
      string: "string",
      number: 23,
      bool:   YES
    };
    json5 = {
      guid: "commitGUID5",
      string: "string",
      number: 23,
      bool:   YES
    };
    json6 = {
      guid: "commitGUID6",
      string: "string",
      number: 23,
      bool:   YES
    };
    json7 = {
      guid: "commitGUID7",
      string: "string",
      number: 23,
      bool:   YES
    };

    SC.RunLoop.begin();
    storeKey1 = SC.Store.generateStoreKey();
    store.writeDataHash(storeKey1, json1, SC.Record.READY_CLEAN);
    storeKey2 = SC.Store.generateStoreKey();
    store.writeDataHash(storeKey2, json2, SC.Record.READY_NEW);
    storeKey3 = SC.Store.generateStoreKey();
    store.writeDataHash(storeKey3, json3, SC.Record.READY_DIRTY);
    storeKey4 = SC.Store.generateStoreKey();
    store.writeDataHash(storeKey4, json4, SC.Record.DESTROYED_DIRTY);
    storeKey5 = SC.Store.generateStoreKey();
    store.writeDataHash(storeKey5, json5, SC.Record.READY_EMPTY);
    storeKey6 = SC.Store.generateStoreKey();
    store.writeDataHash(storeKey6, json6, SC.Record.READY_ERROR);
    storeKey7 = SC.Store.generateStoreKey();
    store.writeDataHash(storeKey7, json7, SC.Record.READY_DESTROYED_CLEAN);
    SC.RunLoop.end();
  }
});

test("Confirm that all the states are switched as expected after running commitRecord", function() {
  var throwError=false, msg, status;

  store.commitRecord(undefined, undefined, storeKey1);
  status = store.readStatus( storeKey1);
  equals(status, SC.Record.READY_CLEAN, "the status shouldn't have changed. It should be READY_CLEAN ");

  store.commitRecord(undefined, undefined, storeKey2);
  status = store.readStatus( storeKey2);
  equals(status, SC.Record.BUSY_CREATING, "the status should be SC.Record.BUSY_CREATING");

  store.commitRecord(undefined, undefined, storeKey3);
  status = store.readStatus( storeKey3);
  equals(status, SC.Record.BUSY_COMMITTING, "the status should be SC.Record.BUSY_COMMITTING");

  store.dataSourceDidComplete(storeKey3);
  status = store.readStatus( storeKey3);
  equals(status, SC.Record.READY_CLEAN, "the status should be SC.Record.READY_CLEAN");

  store.commitRecord(undefined, undefined, storeKey4);
  status = store.readStatus( storeKey4);
  equals(status, SC.Record.BUSY_DESTROYING, "the status should be SC.Record.BUSY_DESTROYING");

  try {
    store.commitRecord(undefined, undefined, storeKey5);
    throwError=false;
    msg='';
  }catch(error1){
    throwError=true;
    msg=error1.message;
  }
  equals(msg, SC.Record.NOT_FOUND_ERROR.message, "commitRecord should throw the following error");

  try{
    store.commitRecord(undefined, undefined, storeKey6);
    throwError=false;
    msg='';
  }catch(error2){
    throwError=true;
    msg=error2.message;
  }
  equals(msg, SC.Record.NOT_FOUND_ERROR.message, "commitRecord should throw the following error");

  try{
    store.commitRecord(undefined, undefined, storeKey7);
    throwError=false;
    msg='';
  }catch(error3){
    throwError=true;
    msg=error3.message;
  }
  equals(msg, SC.Record.NOT_FOUND_ERROR.message, "commitRecord should throw the following error");

});

test("calling commitRecords() without explicit storeKeys", function() {
  var st;
  store.changelog = [storeKey1, storeKey2, storeKey3, storeKey4];
  store.commitRecords();

  st = store.readStatus( storeKey1);
  equals(st, SC.Record.READY_CLEAN, "storeKey1 - the status shouldn't have changed. It should be READY_CLEAN ");

  st = store.readStatus( storeKey2);
  equals(st, SC.Record.BUSY_CREATING, "storeKey2 - the status should be SC.Record.BUSY_CREATING");

  st = store.readStatus( storeKey3);
  equals(st, SC.Record.BUSY_COMMITTING, "storeKey3 - the status should be SC.Record.BUSY_COMMITTING");

  st = store.readStatus( storeKey4);
  equals(st, SC.Record.BUSY_DESTROYING, "storeKey4 - the status should be SC.Record.BUSY_DESTROYING");

  ds.expect(1, [storeKey2], [storeKey3], [storeKey4]);
});

test("calling commitRecords() with params", function() {
  var p = { foo: "bar" };
  store.commitRecord(null, null, storeKey2, p);
  ds.expect(1, [storeKey2], [], [], p);
  ds.reset();

  // calling commit records with no storeKeys should still invoke if params
  store.commitRecords(null,null,null,p);
  ds.expect(1, [], [], [], p);
  ds.reset();

  // call commit records with no storeKeys and no params should not invoke ds
  store.commitRecords(null,null,null,null);
  ds.expect(0);
});

test("calling commitRecords() with callbacks", function() {
  var wasCalled = NO;
  var cb = function(){wasCalled = YES;};

  store.commitRecord(null, null, storeKey2, {}, cb);
  ok(store._callback_queue[storeKey2], "should have a callback in the queue");
  ok(!wasCalled, "wasn't called yet");
  store.dataSourceDidComplete(storeKey2);
  ok(wasCalled, "callback fired!");
});


text:
var common = require("./application-common");
var frame_1 = require("ui/frame");
var uiUtils = require("ui/utils");
global.moduleMerge(common, exports);
var typedExports = exports;
var Responder = (function (_super) {
    __extends(Responder, _super);
    function Responder() {
        _super.apply(this, arguments);
    }
    return Responder;
}(UIResponder));
var RootViewControllerImpl = (function (_super) {
    __extends(RootViewControllerImpl, _super);
    function RootViewControllerImpl() {
        _super.apply(this, arguments);
    }
    Object.defineProperty(RootViewControllerImpl.prototype, "contentController", {
        get: function () {
            return this._contentController;
        },
        set: function (contentController) {
            if (contentController.parentViewController !== null) {
                contentController.willMoveToParentViewController(null);
                contentController.view.removeFromSuperview();
                contentController.removeFromParentViewController();
                contentController.didMoveToParentViewController(this);
            }
            if (this._contentController) {
                this._contentController.willMoveToParentViewController(null);
                this._contentController.view.removeFromSuperview();
                this._contentController.removeFromParentViewController();
            }
            this.addChildViewController(contentController);
            this.view.addSubview(contentController.view);
            contentController.view.frame = this.view.bounds;
            contentController.view.autoresizingMask = UIViewAutoresizing.UIViewAutoresizingFlexibleWidth | UIViewAutoresizing.UIViewAutoresizingFlexibleHeight;
            this._contentController = contentController;
            this._contentController.didMoveToParentViewController(this);
        },
        enumerable: true,
        configurable: true
    });
    RootViewControllerImpl.prototype.viewDidLoad = function () {
        _super.prototype.viewDidLoad.call(this);
        this.view.backgroundColor = UIColor.whiteColor();
    };
    return RootViewControllerImpl;
}(UIViewController));
var Window = (function (_super) {
    __extends(Window, _super);
    function Window() {
        _super.apply(this, arguments);
    }
    Window.prototype.initWithFrame = function (frame) {
        var window = _super.prototype.initWithFrame.call(this, frame);
        if (window) {
            window.autoresizingMask = UIViewAutoresizing.UIViewAutoresizingNone;
        }
        return window;
    };
    Object.defineProperty(Window.prototype, "content", {
        get: function () {
            return this._content;
        },
        set: function (value) {
            this._content = value;
        },
        enumerable: true,
        configurable: true
    });
    Window.prototype.layoutSubviews = function () {
        uiUtils.ios._layoutRootView(this._content, UIScreen.mainScreen().bounds);
    };
    return Window;
}(UIWindow));
var NotificationObserver = (function (_super) {
    __extends(NotificationObserver, _super);
    function NotificationObserver() {
        _super.apply(this, arguments);
    }
    NotificationObserver.new = function () {
        return _super.new.call(this);
    };
    NotificationObserver.prototype.initWithCallback = function (onReceiveCallback) {
        this._onReceiveCallback = onReceiveCallback;
        return this;
    };
    NotificationObserver.prototype.onReceive = function (notification) {
        this._onReceiveCallback(notification);
    };
    NotificationObserver.ObjCExposedMethods = {
        "onReceive": { returns: interop.types.void, params: [NSNotification] }
    };
    return NotificationObserver;
}(NSObject));
var IOSApplication = (function () {
    function IOSApplication() {
        this._currentOrientation = UIDevice.currentDevice().orientation;
        this._observers = new Array();
        this.addNotificationObserver(UIApplicationDidFinishLaunchingNotification, this.didFinishLaunchingWithOptions.bind(this));
        this.addNotificationObserver(UIApplicationDidBecomeActiveNotification, this.didBecomeActive.bind(this));
        this.addNotificationObserver(UIApplicationDidEnterBackgroundNotification, this.didEnterBackground.bind(this));
        this.addNotificationObserver(UIApplicationWillTerminateNotification, this.willTerminate.bind(this));
        this.addNotificationObserver(UIApplicationDidReceiveMemoryWarningNotification, this.didReceiveMemoryWarning.bind(this));
        this.addNotificationObserver(UIDeviceOrientationDidChangeNotification, this.orientationDidChange.bind(this));
    }
    Object.defineProperty(IOSApplication.prototype, "nativeApp", {
        get: function () {
            return UIApplication.sharedApplication();
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(IOSApplication.prototype, "delegate", {
        get: function () {
            return this._delegate;
        },
        set: function (value) {
            if (this._delegate !== value) {
                this._delegate = value;
            }
        },
        enumerable: true,
        configurable: true
    });
    IOSApplication.prototype.addNotificationObserver = function (notificationName, onReceiveCallback) {
        var observer = NotificationObserver.new().initWithCallback(onReceiveCallback);
        NSNotificationCenter.defaultCenter().addObserverSelectorNameObject(observer, "onReceive", notificationName, null);
        this._observers.push(observer);
        return observer;
    };
    IOSApplication.prototype.removeNotificationObserver = function (observer, notificationName) {
        var index = this._observers.indexOf(observer);
        if (index >= 0) {
            this._observers.splice(index, 1);
            NSNotificationCenter.defaultCenter().removeObserverNameObject(observer, notificationName, null);
        }
    };
    IOSApplication.prototype.didFinishLaunchingWithOptions = function (notification) {
        this._window = Window.alloc().initWithFrame(UIScreen.mainScreen().bounds);
        this._window.backgroundColor = UIColor.whiteColor();
        if (typedExports.onLaunch) {
            typedExports.onLaunch(undefined);
        }
        var args = {
            eventName: typedExports.launchEvent,
            object: this,
            ios: notification.userInfo && notification.userInfo.objectForKey("UIApplicationLaunchOptionsLocalNotificationKey") || null
        };
        typedExports.notify(args);
        var rootView = args.root;
        var frame;
        var navParam;
        if (!rootView) {
            navParam = typedExports.mainEntry;
            if (!navParam) {
                navParam = typedExports.mainModule;
            }
            if (navParam) {
                frame = new frame_1.Frame();
                frame.navigate(navParam);
            }
            else {
                throw new Error("A Frame must be used to navigate to a Page.");
            }
            rootView = frame;
        }
        this._window.content = rootView;
        if (rootView instanceof frame_1.Frame) {
            var rootController = new RootViewControllerImpl();
            this.rootController = this._window.rootViewController = rootController;
            rootController.contentController = rootView.ios.controller;
        }
        else if (rootView.ios instanceof UIViewController) {
            this.rootController = this._window.rootViewController = rootView.ios;
        }
        else if (rootView.ios instanceof UIView) {
            var newController = new UIViewController();
            newController.view.addSubview(rootView.ios);
            this.rootController = newController;
        }
        else {
            throw new Error("Root should be either UIViewController or UIView");
        }
        this._window.makeKeyAndVisible();
    };
    IOSApplication.prototype.didBecomeActive = function (notification) {
        if (typedExports.onResume) {
            typedExports.onResume();
        }
        typedExports.notify({ eventName: typedExports.resumeEvent, object: this, ios: UIApplication.sharedApplication() });
    };
    IOSApplication.prototype.didEnterBackground = function (notification) {
        if (typedExports.onSuspend) {
            typedExports.onSuspend();
        }
        typedExports.notify({ eventName: typedExports.suspendEvent, object: this, ios: UIApplication.sharedApplication() });
    };
    IOSApplication.prototype.willTerminate = function (notification) {
        if (typedExports.onExit) {
            typedExports.onExit();
        }
        typedExports.notify({ eventName: typedExports.exitEvent, object: this, ios: UIApplication.sharedApplication() });
    };
    IOSApplication.prototype.didReceiveMemoryWarning = function (notification) {
        if (typedExports.onLowMemory) {
            typedExports.onLowMemory();
        }
        typedExports.notify({ eventName: typedExports.lowMemoryEvent, object: this, android: undefined, ios: UIApplication.sharedApplication() });
    };
    IOSApplication.prototype.orientationDidChange = function (notification) {
        var orientation = UIDevice.currentDevice().orientation;
        if (this._currentOrientation !== orientation) {
            this._currentOrientation = orientation;
            var enums = require("ui/enums");
            var newValue;
            switch (orientation) {
                case UIDeviceOrientation.UIDeviceOrientationLandscapeRight:
                case UIDeviceOrientation.UIDeviceOrientationLandscapeLeft:
                    newValue = enums.DeviceOrientation.landscape;
                    break;
                case UIDeviceOrientation.UIDeviceOrientationPortrait:
                case UIDeviceOrientation.UIDeviceOrientationPortraitUpsideDown:
                    newValue = enums.DeviceOrientation.portrait;
                    break;
                default:
                    newValue = enums.DeviceOrientation.unknown;
                    break;
            }
            typedExports.notify({
                eventName: typedExports.orientationChangedEvent,
                ios: this,
                newValue: newValue,
                object: this
            });
        }
    };
    return IOSApplication;
}());
var iosApp = new IOSApplication();
typedExports.ios = iosApp;
global.__onUncaughtError = function (error) {
    var types = require("utils/types");
    if (types.isFunction(typedExports.onUncaughtError)) {
        typedExports.onUncaughtError(error);
    }
    typedExports.notify({ eventName: typedExports.uncaughtErrorEvent, object: typedExports.ios, ios: error });
};
function loadCss() {
    typedExports.appSelectors = typedExports.loadCss(typedExports.cssFile) || [];
    if (typedExports.appSelectors.length > 0) {
        typedExports.mergeCssSelectors(typedExports);
    }
}
function addCss(cssText) {
    var parsed = typedExports.parseCss(cssText);
    if (parsed) {
        typedExports.additionalSelectors.push.apply(typedExports.additionalSelectors, parsed);
        typedExports.mergeCssSelectors(typedExports);
    }
}
exports.addCss = addCss;
var started = false;
typedExports.start = function (entry) {
    if (!started) {
        if (entry) {
            exports.mainEntry = entry;
        }
        started = true;
        loadCss();
        UIApplicationMain(0, null, null, typedExports.ios && typedExports.ios.delegate ? NSStringFromClass(typedExports.ios.delegate) : NSStringFromClass(Responder));
    }
    else {
        throw new Error("iOS Application already started!");
    }
};
global.__onLiveSync = function () {
    if (!started) {
        return;
    }
    var fileResolver = require("file-system/file-name-resolver");
    fileResolver.clearCache();
    loadCss();
    frame_1.reloadPage();
};

redpajama_set_name: RedPajamaGithub


text:
$:.unshift File.dirname(__FILE__)
$:.unshift File.join(File.dirname(__FILE__), '../lib')

ENV["RAILS_ENV"] = "test"
require 'rubygems'
require 'rspec'
require 'action_controller'
require 'auxiliary_addons'

module Rails
  module VERSION
    MAJOR = 3
  end
end unless defined? Rails

# AuxiliaryAddons.root = './'
RAILS_ROOT = './' unless defined?(RAILS_ROOT)
RAILS_ENV = 'test' unless defined?(RAILS_ENV)

RSpec.configure do |config|
  config.mock_with :rspec
end


text:
package com.monovore.coast
package machine

import com.monovore.coast.flow._
import com.monovore.coast.core._

import com.twitter.algebird.Semigroup

object Machine {

  sealed trait Label
  case class Named(name: String) extends Label
  case class Anonymous(index: Int) extends Label

  def compile(graph: Graph): Machine = {

    val newID = {

      var count = 0

      () => {
        count += 1
        Anonymous(count): Label
      }
    }

    def compile[A, B](
      downstream: Label,
      flow: Node[A, B]
    ): (Map[Label, Actor] -> Seq[Label -> Label]) = flow match {
      case Source(name) => {
        Map.empty[Label, Actor] -> Seq(Named(name) -> downstream)
      }
      case Transform(upstream, init, transformer) => {

        val id = newID()

        val (nodes -> edges) = compile(id, upstream)

        val node = Actor(State(init), { case (s, k, blob) =>
          val (newS, messages) = transformer(k.cast)(s.cast, blob.cast)
          State(newS) -> Map(k -> messages.map(Message(_)))
        })

        nodes.updated(id, node) -> (edges ++ Seq(id -> downstream))
      }
      case Merge(upstreams) => {

        val id = newID()

        val (nodes, edges) = upstreams
          .foldLeft(Map.empty[Label, Actor] -> Seq.empty[Label -> Label]) { (soFar, upstreamPair) =>

            val (_ -> upstream) = upstreamPair

            val (nodes, edges) = soFar

            val (newNodes, newEdges) = compile(id, upstream)

            (nodes ++ newNodes) -> (edges ++ newEdges)
          }

        nodes.updated(id, Actor.passthrough) -> (edges ++ Seq(id -> downstream))
      }
      case GroupBy(upstream, groupBy) => {

        val id = newID()

        val (nodes, edges) = compile(id, upstream)

        val actor = Actor(State(unit), { case (s, key, input) =>
          val group = groupBy(key.cast)(input.cast)
          (s, Map(Key(group) -> Seq(input)))
        })

        nodes.updated(id, actor) -> (edges ++ Seq(id -> downstream))
      }
    }

    val (nodes, edges) = graph.bindings
      .map { case (key -> Sink(flow)) =>

        val (nodes, edges) = compile(Named(key), flow)

        nodes -> edges
      }
      .unzip

    val edgeMap = edges.flatten.groupByKey

    val nodeMap = nodes.flatten.toMap

    Machine(System(nodes = nodeMap, edges = edgeMap), System.State())
  }
}

case class Machine(system: System[Machine.Label], state: System.State[Machine.Label]) {

  def push(messages: Messages): Machine = {

    val toSend = for {
      (name, data) <- messages.messageMap
      label = Machine.Named(name)
      (key, messages) <- data
      message <- messages
    } yield System.Send[Machine.Label](label, key, message)

    val newState = toSend.foldLeft(state) { (state, send) =>
      system.update(state, send)._1
    }

    Machine(system, newState)
  }

  def next: Seq[() => (Machine, Messages)] = {

    system.commands(state).map { command =>
      () => {

        val (newState, messageMap) = system.update(state, command)

        val messages = messageMap
          .flatMap {
            case (Machine.Named(name) -> value) => Some(name -> value)
            case _ => None
          }

        Machine(system, newState) -> Messages(messages)
      }
    }
  }
}

case class Messages(messageMap: Map[String, Map[Key, Seq[Message]]]) {

  def apply[A, B](name: Topic[A, B]): Map[A, Seq[B]] = {

    val keyed = messageMap.getOrElse(name.name, Map.empty)

    keyed.map { case (k -> v) => k.cast[A] -> v.map { _.cast[B] } }.withDefaultValue(Nil)
  }

  def ++(other: Messages): Messages = Messages(Semigroup.plus(messageMap, other.messageMap))

  def isEmpty: Boolean = messageMap.values.forall { _.values.forall { _.isEmpty } }
}

object Messages {

  val empty: Messages = Messages(Map.empty)

  def from[A, B](name: Topic[A, B], messages: Map[A, Seq[B]]): Messages = {

    Messages(Map(
      name.name -> messages
        .filter { case (_ -> v) => v.nonEmpty }
        .map { case (k -> v) => Key(k) -> v.map(Message) }
    ))
  }
}


text:
package org.jfree.chart.axis;

import java.io.Serializable;
import java.text.NumberFormat;
import org.jfree.chart.util.ParamChecks;

public class NumberTickUnit extends TickUnit implements Serializable {
    private static final long serialVersionUID = 3849459506627654442L;
    private NumberFormat formatter;

    public NumberTickUnit(double size) {
        this(size, NumberFormat.getNumberInstance());
    }

    public NumberTickUnit(double size, NumberFormat formatter) {
        super(size);
        ParamChecks.nullNotPermitted(formatter, "formatter");
        this.formatter = formatter;
    }

    public NumberTickUnit(double size, NumberFormat formatter, int minorTickCount) {
        super(size, minorTickCount);
        ParamChecks.nullNotPermitted(formatter, "formatter");
        this.formatter = formatter;
    }

    public String valueToString(double value) {
        return this.formatter.format(value);
    }

    public boolean equals(Object obj) {
        if (obj == this) {
            return true;
        }
        if (!(obj instanceof NumberTickUnit)) {
            return false;
        }
        if (!super.equals(obj)) {
            return false;
        }
        if (this.formatter.equals(((NumberTickUnit) obj).formatter)) {
            return true;
        }
        return false;
    }

    public String toString() {
        return "[size=" + valueToString(getSize()) + "]";
    }

    public int hashCode() {
        return (super.hashCode() * 29) + (this.formatter != null ? this.formatter.hashCode() : 0);
    }
}


text:
let seven = 7;
let three = "3";
console.log(seven + three);
// Add your code below this line


text: Option configuration console


text:
package wurmcraft.wurmatron.common.handler;

import com.bioxx.tfc.Entities.Mobs.EntityPigTFC;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.event.entity.living.LivingDeathEvent;

import java.util.Random;

public class ExplodingPigHandler {

		private final Random rand = new Random();

		@SubscribeEvent
		public void pigHurtDeath (LivingDeathEvent e) {
				if (e.entity instanceof EntityPigTFC) {
						EntityPigTFC pig = (EntityPigTFC) e.entity;
						if (!pig.worldObj.isRemote)
								if (pig.getHealth() <= pig.getMaxHealth() / 2)
										if (rand.nextInt(50) == 0) {
												pig.worldObj.createExplosion(pig, pig.posX, pig.posY, pig.posZ, 20f, false);
												pig.setDead();
										}
				}
		}
}


text:
#pragma once
#include <aws/pinpoint-email/PinpointEmail_EXPORTS.h>
#include <aws/pinpoint-email/PinpointEmailRequest.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>

namespace Aws
{
namespace PinpointEmail
{
namespace Model
{

  /**
   *
A request to delete an event destination from a configuration
   * set.

See Also:
   AWS
   * API Reference

   */
  class AWS_PINPOINTEMAIL_API DeleteConfigurationSetEventDestinationRequest : public PinpointEmailRequest
  {
  public:
    DeleteConfigurationSetEventDestinationRequest();

    // Service request name is the Operation name which will send this request out,
    // each operation should has unique request name, so that we can get operation's name from this request.
    // Note: this is not true for response, multiple operations may have the same response name,
    // so we can not get operation's name from response.
    inline virtual const char* GetServiceRequestName() const override { return "DeleteConfigurationSetEventDestination"; }

    Aws::String SerializePayload() const override;

    /**
     *
The name of the configuration set that contains the event destination that
     * you want to delete.

     */
    inline const Aws::String& GetConfigurationSetName() const{ return m_configurationSetName; }

    /**
     *
The name of the configuration set that contains the event destination that
     * you want to delete.

     */
    inline bool ConfigurationSetNameHasBeenSet() const { return m_configurationSetNameHasBeenSet; }

    /**
     *
The name of the configuration set that contains the event destination that
     * you want to delete.

     */
    inline void SetConfigurationSetName(const Aws::String& value) { m_configurationSetNameHasBeenSet = true; m_configurationSetName = value; }

    /**
     *
The name of the configuration set that contains the event destination that
     * you want to delete.

     */
    inline void SetConfigurationSetName(Aws::String&& value) { m_configurationSetNameHasBeenSet = true; m_configurationSetName = std::move(value); }

    /**
     *
The name of the configuration set that contains the event destination that
     * you want to delete.

     */
    inline void SetConfigurationSetName(const char* value) { m_configurationSetNameHasBeenSet = true; m_configurationSetName.assign(value); }

    /**
     *
The name of the configuration set that contains the event destination that
     * you want to delete.

     */
    inline DeleteConfigurationSetEventDestinationRequest& WithConfigurationSetName(const Aws::String& value) { SetConfigurationSetName(value); return *this;}

    /**
     *
The name of the configuration set that contains the event destination that
     * you want to delete.

     */
    inline DeleteConfigurationSetEventDestinationRequest& WithConfigurationSetName(Aws::String&& value) { SetConfigurationSetName(std::move(value)); return *this;}

    /**
     *
The name of the configuration set that contains the event destination that
     * you want to delete.

     */
    inline DeleteConfigurationSetEventDestinationRequest& WithConfigurationSetName(const char* value) { SetConfigurationSetName(value); return *this;}

    /**
     *
The name of the event destination that you want to delete.

     */
    inline const Aws::String& GetEventDestinationName() const{ return m_eventDestinationName; }

    /**
     *
The name of the event destination that you want to delete.

     */
    inline bool EventDestinationNameHasBeenSet() const { return m_eventDestinationNameHasBeenSet; }

    /**
     *
The name of the event destination that you want to delete.

     */
    inline void SetEventDestinationName(const Aws::String& value) { m_eventDestinationNameHasBeenSet = true; m_eventDestinationName = value; }

    /**
     *
The name of the event destination that you want to delete.

     */
    inline void SetEventDestinationName(Aws::String&& value) { m_eventDestinationNameHasBeenSet = true; m_eventDestinationName = std::move(value); }

    /**
     *
The name of the event destination that you want to delete.

     */
    inline void SetEventDestinationName(const char* value) { m_eventDestinationNameHasBeenSet = true; m_eventDestinationName.assign(value); }

    /**
     *
The name of the event destination that you want to delete.

     */
    inline DeleteConfigurationSetEventDestinationRequest& WithEventDestinationName(const Aws::String& value) { SetEventDestinationName(value); return *this;}

    /**
     *
The name of the event destination that you want to delete.

     */
    inline DeleteConfigurationSetEventDestinationRequest& WithEventDestinationName(Aws::String&& value) { SetEventDestinationName(std::move(value)); return *this;}

    /**
     *
The name of the event destination that you want to delete.

     */
    inline DeleteConfigurationSetEventDestinationRequest& WithEventDestinationName(const char* value) { SetEventDestinationName(value); return *this;}

  private:

    Aws::String m_configurationSetName;
    bool m_configurationSetNameHasBeenSet;

    Aws::String m_eventDestinationName;
    bool m_eventDestinationNameHasBeenSet;
  };

} // namespace Model
} // namespace PinpointEmail
} // namespace Aws


text:
: ${KUBECONFIG:?"Must set KUBECONFIG before running conformance test."}
echo "Conformance test using current-context of ${KUBECONFIG}"
echo -n "Conformance test run date:"
date
echo -n "Conformance test SHA:"
HEAD_SHA=$(git rev-parse HEAD)
echo $HEAD_SHA
echo "Conformance test version tag(s):"
git show-ref | grep $HEAD_SHA | grep refs/tags
echo
echo "Conformance test checking conformance with Kubernetes version 1.0"

# It runs a whitelist of tests: all tests which are flagged with [Conformance]
# somewhere in the description (i.e. either in the Describe part or the It part).
# The list of tagged conformance tests can be retrieved by:
#
# NUM_MINIONS=4 KUBERNETES_CONFORMANCE_TEST="y" \
# hack/ginkgo-e2e.sh -ginkgo.focus='\[Conformance\]' -ginkgo.dryRun=true

declare -x KUBERNETES_CONFORMANCE_TEST="y"
declare -x NUM_MINIONS=4
hack/ginkgo-e2e.sh -ginkgo.focus='\[Conformance\]'
exit $?


text:
<?php

namespace App\Controller;

use App\Entity\Task\Task;
use App\Event\TaskEvent;
use App\Request\Task\CancelRequest;
use Doctrine\ORM\EntityManagerInterface;
use App\Model\TaskCollection;
use App\Services\Request\Factory\Task\CancelRequestCollectionFactory;
use App\Services\Request\Factory\Task\CancelRequestFactory;
use App\Services\Request\Factory\Task\CreateRequestCollectionFactory;
use App\Services\TaskFactory;
use App\Services\TaskService;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;

class TaskController extends AbstractController
{
    /**
     * @var EntityManagerInterface
     */
    private $entityManager;

    /**
     * @var TaskService
     */
    private $taskService;

    public function __construct(EntityManagerInterface $entityManager, TaskService $taskService)
    {
        $this->entityManager = $entityManager;
        $this->taskService = $taskService;
    }

    /**
     * @param CreateRequestCollectionFactory $createRequestCollectionFactory
     * @param TaskFactory $taskFactory
     * @param EventDispatcherInterface $eventDispatcher
     *
     * @return JsonResponse
     */
    public function createCollectionAction(
        CreateRequestCollectionFactory $createRequestCollectionFactory,
        TaskFactory $taskFactory,
        EventDispatcherInterface $eventDispatcher
    ) {
        $createCollectionRequest = $createRequestCollectionFactory->create();

        $tasks = new TaskCollection();

        foreach ($createCollectionRequest->getCreateRequests() as $createRequest) {
            $task = $taskFactory->createFromRequest($createRequest);
            $tasks->add($task);

            $this->entityManager->persist($task);
        }

        $this->entityManager->flush();

        foreach ($tasks as $task) {
            $eventDispatcher->dispatch(TaskEvent::TYPE_CREATED, new TaskEvent($task));
        }

        return new JsonResponse($tasks->jsonSerialize());
    }

    /**
     * @param CancelRequestFactory $cancelRequestFactory
     *
     * @return JsonResponse
     */
    public function cancelAction(CancelRequestFactory $cancelRequestFactory)
    {
        $cancelRequest = $cancelRequestFactory->create();

        if (!$cancelRequest instanceof CancelRequest) {
            throw new BadRequestHttpException();
        }

        $task = $cancelRequest->getTask();
        $task->setState(Task::STATE_CANCELLED);

        $this->entityManager->remove($cancelRequest->getTask());
        $this->entityManager->flush();

        return new JsonResponse();
    }

    /**
     * @param CancelRequestCollectionFactory $cancelRequestCollectionFactory
     *
     * @return JsonResponse
     */
    public function cancelCollectionAction(CancelRequestCollectionFactory $cancelRequestCollectionFactory)
    {
        $cancelCollectionRequest = $cancelRequestCollectionFactory->create();

        $cancelledTaskCount = 0;
        foreach ($cancelCollectionRequest->getCancelRequests() as $cancelRequest) {
            $task = $cancelRequest->getTask();
            $task->setState(Task::STATE_CANCELLED);

            $this->entityManager->remove($cancelRequest->getTask());
            $cancelledTaskCount++;
        }

        if ($cancelledTaskCount > 0) {
            $this->entityManager->flush();
        }

        return new JsonResponse();
    }
}


text:
from __future__ import unicode_literals

from django.db import migrations, models

def mark_providers(apps, schema_editor):
    Company2Company = apps.get_model("core", "Company2Company")
    Company = apps.get_model("core", "Company")

    Company.objects.filter(
        pk__in=Company2Company.objects.filter(
            relationship_type__in=["Секретар", "Директор"]
        )
        .distinct("to_company")
        .values_list("to_company", flat=True)
    ).update(service_provider=True)

class Migration(migrations.Migration):

    dependencies = [("core", "0161_auto_20190801_2323")]

    operations = [
        migrations.RunPython(mark_providers, reverse_code=migrations.RunPython.noop)
    ]


text:
/**
 * Test-Function to be used in place of deepEquals which only tests for the existence of the given
 * values, not the absence of others.
 *
 * @param {object} oValue - The value to be tested
 * @param {object} oExpected - The value that is tested against, containing the structure expected inside oValue
 * @param {string} sMessage - Message prefix for every sub-test. The property names of the structure will be prepended to this string
 * @returns {void}
 */
function deepContains(oValue, oExpected, sMessage) {
	for (var sKey in oExpected) {

		if (Array.isArray(oExpected[sKey]) === Array.isArray(oValue[sKey])) {
			assert.equal(typeof oValue[sKey], typeof oExpected[sKey], sMessage + "/" + sKey + " have same type");
		} else {
			assert.ok(false, sMessage + "/" + sKey + " - one is an array, the other is not");
		}

		if (Array.isArray(oExpected[sKey]) && Array.isArray(oValue[sKey])) {
			assert.equal(oValue[sKey].length, oExpected[sKey].length, sMessage + "/" + sKey + " length matches");
		}

		if (oExpected[sKey] !== null && typeof oExpected[sKey] === "object" && typeof oValue[sKey] === "object") {
			// Go deeper
			deepContains(oValue[sKey], oExpected[sKey], sMessage + "/" + sKey);
		} else {
			// Compare directly
			assert.equal(oValue[sKey], oExpected[sKey], sMessage + "/" + sKey + " match");
		}
	}
}

jQuery.sap.require("sap.ui.model.odata.ODataMetadata");
jQuery.sap.require("sap.ui.model.odata.v2.ODataModel");
jQuery.sap.require("sap.ui.model.odata.v2.ODataAnnotations");

QUnit.config.testTimeout = 6000;

/* eslint-disable no-unused-vars */
function runODataAnnotationsV2Tests() {
/* eslint-enable no-unused-vars */
"use strict";

	var aServices = [{
		name             : "Northwind",
		service          : "fakeService://testdata/odata/northwind/",
		annotations      : "fakeService://testdata/odata/northwind-annotations-normal.xml",
		serviceValid     : true,
		annotationsValid : "all"
	}, {
		name             : "Northwind",
		service          : "fakeService://testdata/odata/northwind/",
		annotations      : "fakeService://testdata/odata/northwind-annotations-malformed.xml",
		serviceValid     : true,
		annotationsValid : "none"
	}, {
		name             : "Northwind",
		service          : "fakeService://testdata/odata/northwind/",
		annotations      : "fakeService://testdata/odata/NOT_EXISTENT",
		serviceValid     : true,
		annotationsValid : "none"
	},{
		name             : "Invalid",
		service          : "fakeService://testdata/odata/NOT_EXISTENT/",
		annotations      : "fakeService://testdata/odata/NOT_EXISTENT",
		serviceValid     : false,
		annotationsValid : "none"
	},{
		name             : "Complex EPM",
		service          : "fakeService://testdata/odata/northwind/",
		annotations      : "fakeService://testdata/odata/epm-annotations-complex.xml",
		serviceValid     : true,
		annotationsValid : "all"
	},{
		name             : "Northwind",
		service          : "fakeService://testdata/odata/northwind/",
		annotations      : "fakeService://testdata/odata/northwind-annotations-normal.xml",
		serviceValid     : true,
		annotationsValid : "all",
		sharedMetadata   : true
	}, {
		name             : "Northwind",
		service          : "fakeService://testdata/odata/northwind/",
		annotations      : "fakeService://testdata/odata/northwind-annotations-malformed.xml",
		serviceValid     : true,
		annotationsValid : "none",
		sharedMetadata   : true
	}, {
		name             : "Northwind",
		service          : "fakeService://testdata/odata/northwind/",
		annotations      : "fakeService://testdata/odata/NOT_EXISTENT",
		serviceValid     : true,
		annotationsValid : "none",
		sharedMetadata   : true
	},{
		name             : "Invalid",
		service          : "fakeService://testdata/odata/NOT_EXISTENT/",
		annotations      : "fakeService://testdata/odata/NOT_EXISTENT",
		serviceValid     : false,
		annotationsValid : "none",
		sharedMetadata   : true
	},{
		name             : "Northwind with annotated metadata",
		service          : "fakeService://testdata/odata/northwind-annotated/",
		annotations      : "fakeService://testdata/odata/northwind-annotated/$metadata",
		serviceValid     : true,
		annotationsValid : "all",
		sharedMetadata   : true
	},{
		name             : "Northwind with annotated metadata + annotations",
		service          : "fakeService://testdata/odata/northwind-annotated/",
		annotations      : [
			"fakeService://testdata/odata/northwind-annotated/$metadata",
			"fakeService://testdata/odata/northwind-annotations-normal.xml"
		],
		serviceValid     : true,
		annotationsValid : "all",
		sharedMetadata   : true
	},{
		name             : "Northwind with annotated metadata + annotations",
		service          : "fakeService://testdata/odata/northwind-annotated/",
		annotations      : [
			"fakeService://testdata/odata/northwind-annotated/$metadata",
			"fakeService://testdata/odata/northwind-annotations-malformed.xml"
		],
		serviceValid     : true,
		annotationsValid : "some",
		sharedMetadata   : true
	}];

	// Additional tests that have extra tests and should thus be referable by name. For this the name
	// of the test is not added as property of the test but as key in the map
	var mAdditionalTestsServices = {
		"Default Annotated Service": {
			service          : "fakeService://testdata/odata/northwind/",
			annotations      : "fakeService://testdata/odata/northwind-annotations-normal.xml",
			serviceValid     : true,
			annotationsValid : "all"
		},
		"Apply Function": {
			service          : "fakeService://testdata/odata/northwind/",
			annotations      : "fakeService://testdata/odata/apply-function-test.xml",
			serviceValid     : true,
			annotationsValid : "all"
		},
		"Multiple Property Annotations": {
			service          : "fakeService://testdata/odata/northwind/",
			annotations      : "fakeService://testdata/odata/multiple-property-annotations.xml",
			serviceValid     : true,
			annotationsValid : "all"
		},
		"Property Annotation Qualifiers": {
			service          : "fakeService://testdata/odata/northwind/",
			annotations      : "fakeService://testdata/odata/property-annotation-qualifiers.xml",
			serviceValid     : true,
			annotationsValid : "all"
		},
		"Other Property Values": {
			service          : "fakeService://testdata/odata/northwind/",
			annotations      : "fakeService://testdata/odata/other-property-values.xml",
			serviceValid     : true,
			annotationsValid : "all"
		},
		"Aliases in Namespaces": {
			service          : "fakeService://testdata/odata/northwind/",
			annotations      : "fakeService://testdata/odata/namespaces-aliases.xml",
			serviceValid     : true,
			annotationsValid : "all"
		},
		"Namespaces in Other Property Values": {
			service          : "fakeService://testdata/odata/northwind/",
			annotations      : "fakeService://testdata/odata/other-property-value-aliases.xml",
			serviceValid     : true,
			annotationsValid : "all"
		},
		"Text Properties" : {
			service          : "fakeService://testdata/odata/northwind/",
			annotations      : "fakeService://testdata/odata/other-property-textproperties.xml",
			serviceValid     : true,
			annotationsValid : "all"
		},
		"Entity Containers": {
			service          : "fakeService://testdata/odata/sapdata01/",
			annotations      : "fakeService://testdata/odata/sapdata01/$metadata",
			serviceValid     : true,
			annotationsValid : "all"
		},
		"Simple Values": {
			service          : "fakeService://testdata/odata/sapdata01/",
			annotations      : "fakeService://testdata/odata/simple-values.xml",
			serviceValid     : true,
			annotationsValid : "all"
		},
		"Collection with Namespace": {
			service          : "fakeService://testdata/odata/sapdata01/",
			annotations      : "fakeService://testdata/odata/collection-with-namespace.xml",
			serviceValid     : true,
			annotationsValid : "all"
		},
		"UrlRef": {
			service          : "fakeService://testdata/odata/sapdata01/",
			annotations      : "fakeService://testdata/odata/UrlRef.xml",
			serviceValid     : true,
			annotationsValid : "all"
		},
		"Delayed Loading": {
			service          : "fakeService://testdata/odata/sapdata01/",
			annotations      : [
				"fakeService://testdata/odata/multiple-annotations-01.xml",
				"fakeService://testdata/odata/multiple-annotations-02.xml",
				"fakeService://testdata/odata/multiple-annotations-03.xml"
			],
			serviceValid     : true,
			annotationsValid : "all"
		},
		"Alias Replacement": {
			service          : "fakeService://testdata/odata/sapdata01/",
			annotations      : "fakeService://testdata/odata/Aliases.xml",
			serviceValid     : true,
			annotationsValid : "all"
		},
		"DynamicExpressions": {
			service          : "fakeService://testdata/odata/sapdata01/",
			annotations      : "fakeService://testdata/odata/DynamicExpressions.xml",
			serviceValid     : true,
			annotationsValid : "all"
		},
		"DynamicExpressions2": {
			service          : "fakeService://testdata/odata/sapdata01/",
			annotations      : "fakeService://testdata/odata/DynamicExpressions2.xml",
			serviceValid     : true,
			annotationsValid : "all"
		},
		"CollectionsWithSimpleValues": {
			service          : "fakeService://testdata/odata/sapdata01/",
			annotations      : "fakeService://testdata/odata/collections-with-simple-values.xml",
			serviceValid     : true,
			annotationsValid : "all"
		},
		"Simple Values 2": {
			service          : "fakeService://testdata/odata/sapdata01/",
			annotations      : "fakeService://testdata/odata/simple-values-2.xml",
			serviceValid     : true,
			annotationsValid : "all"
		},
		"If in Apply": {
			service          : "fakeService://testdata/odata/sapdata01/",
			annotations      : "fakeService://testdata/odata/if-in-apply.xml",
			serviceValid     : true,
			annotationsValid : "all"
		},
		"Other Elements in LabeledElement": {
			service          : "fakeService://testdata/odata/sapdata01/",
			annotations      : "fakeService://testdata/odata/labeledelement-other-values.xml",
			serviceValid     : true,
			annotationsValid : "all"
		},
		"Annotated Metadata": {
			service          : "fakeService://testdata/odata/northwind-annotated/",
			annotations      : null,
			serviceValid     : true,
			annotationsValid : "metadata"
		},
		"Apply in If": {
			service          : "fakeService://testdata/odata/northwind/",
			annotations      : "fakeService://testdata/odata/apply-in-if.xml",
			serviceValid     : true,
			annotationsValid : "all"
		},
		"Joined Loading with automated $metadata parsing": {
			service          : "fakeService://testdata/odata/northwind-annotated/",
			annotations      : [
				"fakeService://testdata/odata/northwind-annotations-normal.xml",
				"fakeService://testdata/odata/multiple-annotations-01.xml",
				"fakeService://testdata/odata/multiple-annotations-02.xml",
				"fakeService://testdata/odata/multiple-annotations-03.xml"
			],
			serviceValid     : true,
			annotationsValid : "all"
		},
		"Empty collection": {
			service          : "fakeService://testdata/odata/northwind/",
			annotations      : "fakeService://testdata/odata/empty-collection.xml",
			serviceValid     : true,
			annotationsValid : "all"
		},
		"Multiple Enums": {
			service          : "fakeService://testdata/odata/northwind/",
			annotations      : "fakeService://testdata/odata/multiple-enums.xml",
			serviceValid     : true,
			annotationsValid : "all"
		},
		"Cached Value Lists": {
			service          : "fakeService://testdata/odata/valuelists/",
			annotations      : null,
			serviceValid     : true,
			annotationsValid : "metadata"
		},
		"Overwrite on Term Level": {
			service          : "fakeService://testdata/odata/valuelists/",
			annotations      : [
				"fakeService://testdata/odata/overwrite-on-term-level-1",
				"fakeService://testdata/odata/overwrite-on-term-level-2"
			],
			serviceValid     : true,
			annotationsValid : "all"
		},
		"LastModified Header": {
			service          : "fakeService://testdata/odata/sapdata01/",
			annotations      : [
				"fakeService://testdata/odata/multiple-annotations-01.xml",
				"fakeService://testdata/odata/multiple-annotations-02.xml",
				"fakeService://testdata/odata/multiple-annotations-03.xml"
			],
			serviceValid     : true,
			annotationsValid : "all"
		},
		"NoLastModified Header": {
			service          : "fakeService://testdata/odata/sapdata02/",
			serviceValid     : true,
			annotationsValid : "all"
		}
	};

	// Add additional tests to stadard tests as well
	for (var sName in mAdditionalTestsServices) {
		var mTest = mAdditionalTestsServices[sName];
		mTest.name = sName;
		aServices.push(mTest);
	}

	QUnit.module("Standard Tests for All Annotation Cases")

	var fnTestLoading = function(mService) {
		var done = assert.async();

		var oMetadata = new sap.ui.model.odata.ODataMetadata(mService.service + "$metadata", { asnc: true });

		var oAnnotationsLoader = new sap.ui.model.odata.v2.ODataAnnotations(oMetadata, {
			source: mService.annotations
		});
		var pLoaded = oAnnotationsLoader.loaded();

		var iNumAnnotations = 1; // One for $metadata
		if (Array.isArray(mService.annotations)) {
			iNumAnnotations += mService.annotations.length;
		} else if (mService.annotations) {
			iNumAnnotations++;
		}

		var iLoaded = 0;
		oAnnotationsLoader.attachSuccess(function() {
			iLoaded++;
		});
		oAnnotationsLoader.attachError(function() {
			iLoaded++;
		});

		function endTest() {
			oMetadata.destroy();
			oAnnotationsLoader.destroy();
			done();
		}

		pLoaded.then(function(aResults) {
			assert.equal(aResults.length, iNumAnnotations, "The right number of annotations were successfully loaded from sources");
			assert.equal(iLoaded, iNumAnnotations, "The right number of annotations were loaded including $metadata");

			if (mService.annotationsValid === "all") {
				var bNoErrors = (aResults.length === 0) || aResults.reduce(function(bLastResult, oResult) {
					if (!bLastResult) {
						return false;
					} else {
						return !(oResult instanceof Error);
					}
				}, true);
				assert.equal(bNoErrors, true, "No Errors in the results");
			}
			endTest();
		});

		pLoaded.catch(function(aResults) {
			assert.ok(false, "With a valid service at least the metadata should have been parsed for annotations successfully");
			endTest();
		});

	};

	for (var i = 0; i < aServices.length; ++i) {
		if (aServices[i].serviceValid && aServices[i].annotationsValid !== "some") {
			QUnit.test("External Annotation Loading - Service Case: " + aServices[i].name, fnTestLoading.bind(undefined, aServices[i]));
		}
	}

	var fnTestEventsAllSome = function(mService, bSkipMetadata) {
		var done = assert.async();

		var oMetadata = new sap.ui.model.odata.ODataMetadata(mService.service + "$metadata", { asnc: true });

		var oAnnotationsLoader = new sap.ui.model.odata.v2.ODataAnnotations(oMetadata, {
			skipMetadata: bSkipMetadata,
			source: mService.annotations
		});
		var pLoaded = oAnnotationsLoader.loaded();

		var iAnnotations = bSkipMetadata ? 0 : 1;
		if (Array.isArray(mService.annotations)) {
			iAnnotations += mService.annotations.length;
		} else if (typeof mService.annotations === "string") {
			iAnnotations += 1;
		}

		var fnCountErrors = function(aArray) {
			return aArray.reduce(function(iErrors, oEntry) {
				if (oEntry instanceof Error) {
					return iErrors + 1;
				} else {
					return iErrors;
				}
			}, 0);
		};

		var iSuccesses = 0;
		oAnnotationsLoader.attachSuccess(function(oEvent) {
			var mResult = oEvent.getParameter("result");
			iSuccesses++;
		});

		var iErrors = 0;
		oAnnotationsLoader.attachError(function(oEvent) {
			var oError = oEvent.getParameter("result");
			iErrors++;
		});

		var bSomeLoadedFired = false;
		oAnnotationsLoader.attachSomeLoaded(function(oEvent) {
			var DEBUGservice = mService;

			bSomeLoadedFired = true;
			var aResults = oEvent.getParameter("result");
			assert.ok(Array.isArray(aResults), "Result parameter contained an array of results");
			assert.equal(aResults.length, iAnnotations, "The correct number of Annotations was loaded");

			var iErrorsInResults = fnCountErrors(aResults);
			assert.ok(iErrorsInResults < iAnnotations, "The failed event parameter \"result\" should NOT contain ONLY Error objects");

			assert.equal(iErrorsInResults, iErrors, "The number of Errors in the Results is the same as the number of error-events that occurred")
			assert.equal(aResults.length - iErrorsInResults, iSuccesses, "The number of successfully parsed entries in the Results is the same as the number of success-events that occurred")
		});

		var bAllFailedFired = false;
		oAnnotationsLoader.attachAllFailed(function(oEvent) {
			var DEBUGservice = mService;

			bAllFailedFired = true;
			var aErrors = oEvent.getParameter("result");

			assert.ok(Array.isArray(aErrors), "Result parameter contained an array of errors");
			assert.equal(aErrors.length, iAnnotations, "The correct number of Annotations failed");

			var iErrorsInResults = fnCountErrors(aErrors);
			assert.equal(iErrorsInResults, iAnnotations, "The failed event parameter \"result\" should contain only Error objects");

			assert.equal(iErrorsInResults, iErrors, "The number of Errors in the Results is the same as the number of error-events that occurred")
			assert.equal(iSuccesses, 0, "No success events should have been fired")
		});

		var fnEndTest = function() {
			oMetadata.destroy();
			oAnnotationsLoader.destroy();
			done()
		};

		pLoaded.then(function() {
			assert.equal(bSomeLoadedFired, true, "Loaded event should have been fired");
			assert.equal(bAllFailedFired, false, "Failed event should NOT have been fired");
			fnEndTest();
		}).catch(function() {
			assert.equal(bSomeLoadedFired, false, "Loaded event should NOT have been fired");
			assert.equal(bAllFailedFired, true, "Failed event should have been fired");
			fnEndTest();
		});
	};

	for (var i = 0; i < aServices.length; ++i) {
		if (aServices[i].serviceValid) {
			// Test all valid services - parse metadata for annotations
			QUnit.test("Event (All/Some) Parameter Checks with Metadata - Service Case: " + aServices[i].name, fnTestEventsAllSome.bind(undefined, aServices[i], false));
		}
		if (aServices[i].serviceValid && aServices[i].annotations) {
			// Test all valid services - DO NOT parse metadata for annotations
			QUnit.test("Event (All/Some) Parameter Checks without Metadata - Service Case: " + aServices[i].name, fnTestEventsAllSome.bind(undefined, aServices[i], true));
		}
	}

	var fnTestEvents = function(mService, bSkipMetadata) {
		var done = assert.async();

		var oMetadata = new sap.ui.model.odata.ODataMetadata(mService.service + "$metadata", { asnc: true });

		var oAnnotationsLoader = new sap.ui.model.odata.v2.ODataAnnotations(oMetadata, {
			skipMetadata: bSkipMetadata,
			source: mService.annotations
		});
		var pLoaded = oAnnotationsLoader.loaded();

		var iAnnotations = bSkipMetadata ? 0 : 1;
		if (Array.isArray(mService.annotations)) {
			iAnnotations += mService.annotations.length;
		} else if (typeof mService.annotations === "string") {
			iAnnotations += 1;
		}

		var fnCountErrors = function(aArray) {
			return aArray.reduce(function(iErrors, oEntry) {
				if (oEntry instanceof Error) {
					return iErrors + 1;
				} else {
					return iErrors;
				}
			}, 0);
		};

		var iSuccesses = 0;
		oAnnotationsLoader.attachSuccess(function(oEvent) {
			var mResult = oEvent.getParameter("result");
			iSuccesses++;
		});

		var iErrors = 0;
		oAnnotationsLoader.attachError(function(oEvent) {
			var oError = oEvent.getParameter("result");
			iErrors++;
		});

		var bLoadedFired = false;
		oAnnotationsLoader.attachLoaded(function(oEvent) {
			var DEBUGservice = mService;

			bLoadedFired = true;
			var aResults = oEvent.getParameter("result");
			assert.ok(Array.isArray(aResults), "Result parameter contained an array of results");
			assert.equal(aResults.length, iAnnotations, "The correct number of Annotations was loaded");

			var iErrorsInResults = fnCountErrors(aResults);
			assert.equal(iErrorsInResults, 0, "The failed event parameter \"result\" should NOT contain ANY Error objects");

			assert.equal(iErrorsInResults, iErrors, "The number of Errors in the Results is the same as the number of error-events that occurred")
			assert.equal(aResults.length, iSuccesses, "The number of successfully parsed entries in the Results is the same as the number of success-events that occurred")
		});

		var bFailedFired = false;
		oAnnotationsLoader.attachFailed(function(oEvent) {
			var DEBUGservice = mService;

			bFailedFired = true;
			var aResults = oEvent.getParameter("result");

			assert.ok(Array.isArray(aResults), "Result parameter contained an array of errors");
			assert.equal(aResults.length, iAnnotations, "The correct number of Annotations failed");

			var iErrorsInResults = fnCountErrors(aResults);
			assert.ok(iErrorsInResults > 0, "The failed event parameter \"result\" should contain at least one Error object");

			assert.equal(iErrorsInResults, iErrors, "The number of Errors in the Results is the same as the number of error-events that occurred")
			assert.equal(iSuccesses, aResults.length - iErrorsInResults, "No success events should have been fired")
		});

		var fnEndTest = function() {
			oMetadata.destroy();
			oAnnotationsLoader.destroy();
			done()
		};

		pLoaded.catch(function() {}).then(function() {
			assert.ok(bLoadedFired !== bFailedFired, "Either loaded or failed shoud have been fired but not both");
			fnEndTest();
		});
	};

	for (var i = 0; i < aServices.length; ++i) {
		if (aServices[i].serviceValid) {
			// Test all valid services - parse metadata for annotations
			QUnit.test("Event Parameter Checks with Metadata - Service Case: " + aServices[i].name, fnTestEvents.bind(undefined, aServices[i], false));
		}
		if (aServices[i].serviceValid && aServices[i].annotations) {
			// Test all valid services - DO NOT parse metadata for annotations
			QUnit.test("Event Parameter Checks without Metadata - Service Case: " + aServices[i].name, fnTestEvents.bind(undefined, aServices[i], true));
		}
	}

	QUnit.module("v2.ODataModel Integration Test")

	var fnTestModelLoading = function(mService) {
		var done = assert.async();

		// sap.ui.model.odata.v2.ODataModel.mServiceData = {};
		var oModel = new sap.ui.model.odata.v2.ODataModel(mService.service, {
			annotationURI: mService.annotations,
			/* default: loadAnnotationsJoined: true, */
			skipMetadataAnnotationParsing: true
		});

		function endTest() {
			oModel.destroy();
			done();
		}

		var bAnnotationsLoaded = false;
		var bMetadataLoaded = false;

		oModel.attachAnnotationsLoaded(function() {
			bAnnotationsLoaded = true;
			assert.ok(mService.serviceValid, "Service annotations loaded");
			assert.notEqual(mService.annotationsValid, "none", "Service annotations loaded");
		});

		oModel.attachMetadataLoaded(function() {
			bMetadataLoaded = true;
			assert.ok(mService.serviceValid, "Service metadata loaded");

			if (mService.annotationsValid === "none") {
				assert.equal(bAnnotationsLoaded, false, "No Annotations loaded")
			} else if (mService.annotationsValid === "metadata") {
				assert.equal(bAnnotationsLoaded, false, "No Annotations loaded")
			} else {
				assert.equal(bAnnotationsLoaded, true, "Annotations loaded")
			}

			endTest();
		});

		oModel.attachMetadataFailed(function() {
			assert.ok(!mService.serviceValid || mService.annotationsValid === "none", "Service metadata or annotations failed");
			endTest();
		});

	};

	for (var i = 0; i < aServices.length; ++i) {
		if (aServices[i].serviceValid && aServices[i].annotations) {
			// FIXME: test doesn't work in headless PhantomJS test cycle => commented out!
			//  ==> PhantomJS doesn't fail when loading malformed XML!
			if (!sap.ui.Device.browser.phantomJS || (aServices[i].serviceValid && aServices[i].annotationsValid !== "none")) {
				QUnit.test("Annotations - Service Case: " + aServices[i].name, fnTestModelLoading.bind(undefined, aServices[i]));
			}
		}
	}

	var fnTestModelMetadataLoading = function(mService) {
		var done = assert.async();

		// sap.ui.model.odata.v2.ODataModel.mServiceData = {};
		var oModel = new sap.ui.model.odata.v2.ODataModel(mService.service, {
			annotationURI: mService.annotations,
			skipMetadataAnnotationParsing: false
		});

		function endTest() {
			oModel.destroy();
			done();
		}

		var bAnnotationsLoaded = false;
		var bMetadataLoaded = false;

		oModel.attachAnnotationsLoaded(function() {
			bAnnotationsLoaded = true;
			assert.ok(mService.serviceValid, "Service annotations loaded");
		});

		oModel.attachMetadataLoaded(function() {
			bMetadataLoaded = true;
			assert.ok(mService.serviceValid, "Service metadata failed");
			assert.equal(bAnnotationsLoaded, true, "Annotations loaded")

			endTest();
		});

		oModel.attachMetadataFailed(function() {
			assert.ok(!mService.serviceValid, "Service metadata failed");
			endTest();
		});

	};

	for (var i = 0; i < aServices.length; ++i) {
		if (aServices[i].serviceValid) {
			QUnit.test("Annotations and metadata - Service Case: " + aServices[i].name, fnTestModelMetadataLoading.bind(undefined, aServices[i]));
		}
	}

	QUnit.module("Misc Test to increase test coverage");

	var fnTestMisc1 = function() {
		var done = assert.async();

		var mService = mAdditionalTestsServices["LastModified Header"];

		var oModel = new sap.ui.model.odata.v2.ODataModel(mService.service, {
			annotationURI: mService.annotations,
			skipMetadataAnnotationParsing: false
		});

		// Instantiate without options argument - use defaults
		var oAnnotationsFromMetadata = new sap.ui.model.odata.v2.ODataAnnotations(oModel.oMetadata);

		assert.equal(oAnnotationsFromMetadata.getAnnotationsData(), oAnnotationsFromMetadata.getData(), "Check deprecated API");

		var oAnnotations = new sap.ui.model.odata.v2.ODataAnnotations(oModel.oMetadata, { skipMetadata: true });

		var fnEvent = function() {
			assert.ok(false, "Success/Error/Loaded handler should not be called for this instance");
		};
		oAnnotations.attachSuccess(fnEvent);
		oAnnotations.attachError(fnEvent);
		oAnnotations.attachLoaded(fnEvent);
		oAnnotations.attachFailed(fnEvent);

		// Add empty source
		oAnnotations.addSource().then(function() {
			// Add empty source as array
			oAnnotations.addSource([]).then(function() {
				oAnnotations.detachSuccess(fnEvent);
				oAnnotations.detachError(fnEvent);
				oAnnotations.detachLoaded(fnEvent);
				oAnnotations.detachFailed(fnEvent);

				// Add invalid source
				oAnnotations.addSource({
					type: "invalid"
				}).then(function() {
					assert.ok(false, "Adding invalid sources should not be successful");
				}).catch(function() {
					assert.ok(true, "Adding invalid sources should lead to an error");

					oAnnotations.addSource({
						type: "xml",
						xml: "I am not valid XML"
					}).then(function() {
						// This is a phantomJS bug...
						assert.ok(!!sap.ui.Device.browser.phantomJS, "Adding sources with invalid XML content should not be successful");

						if (sap.ui.Device.browser.phantomJS) {
							throw "Continue in catch block";
						}

					}).catch(function() {
						assert.ok(true, "Adding sources with invalid XML content should lead to an error");

						oAnnotations.addSource({
							type: "xml",
							document: { invalid: "I ain't no XML document..." }
						}).then(function() {
							// This is a phantomJS bug...
							assert.ok(!!sap.ui.Device.browser.phantomJS, "Adding sources with invalid XML content should not be successful");

							if (sap.ui.Device.browser.phantomJS) {
								throw "Continue in catch block";
							}

						}).catch(function() {
							assert.ok(true, "Adding sources with invalid XML documents should lead to an error");

							// XML Parser is not available should lead to an error
							var bIsIE = sap.ui.Device.browser.msie;
							sap.ui.Device.browser.internet_explorer = sap.ui.Device.browser.msie = false;
							var oOriginalDOMParser = window.DOMParser;
							window.DOMParser = function() {
								this.parseFromString = function() {}
							};

							oAnnotations.addSource({
								type: "url",
								data: "fakeService://testdata/odata/multiple-annotations-01.xml"
							}).then(function() {
								assert.ok(false, "Adding annotations without having a DOM parser should not be successful");
							}).catch(function() {
								assert.ok(true, "Adding annotations without having a DOM parser should lead to an error");

								sap.ui.Device.browser.internet_explorer = sap.ui.Device.browser.msie = bIsIE;
								window.DOMParser = oOriginalDOMParser;

								// Mock IE XML Parser
								bIsIE = sap.ui.Device.browser.msie;
								sap.ui.Device.browser.internet_explorer = sap.ui.Device.browser.msie = true;
								var oOriginalActiveXObject = window.ActiveXObject;
								window.ActiveXObject = function() {
									this.loadXML = function() {}
								};

								oAnnotations.addSource({
									type: "url",
									data: "fakeService://testdata/odata/multiple-annotations-01.xml"
								}).then(function() {
									assert.ok(false, "Adding annotations without having a DOM parser should not be successful");
								}).catch(function() {
									assert.ok(true, "Adding annotations without having a DOM parser should lead to an error");

									window.ActiveXObject = oOriginalActiveXObject;
									sap.ui.Device.browser.internet_explorer = sap.ui.Device.browser.msie = bIsIE;

									// Clean up
									oModel.destroy();
									oAnnotationsFromMetadata.destroy();
									oAnnotations.destroy();

									done();
								});
							});
						});
					});
				});
			});

		});

		var oAnnotationsObject = oModel.getServiceAnnotations();

	};

	QUnit.test("Loading and accessing annotations", fnTestMisc1);

	QUnit.module("Annotation Test Cases for Bugfixes and Specification Changes");

	var fnTestLastModified = function() {
		var done = assert.async();

		assert.expect(4);

		var mService = mAdditionalTestsServices["LastModified Header"];

		var oModel = new sap.ui.model.odata.v2.ODataModel(mService.service, {
			annotationURI: mService.annotations,
			skipMetadataAnnotationParsing: false
		});

		oModel.annotationsLoaded().then(function(aAnnotations) {
			var iLastModified = new Date("Wed, 15 Nov 1995 04:58:08 GMT").getTime();

			assert.equal(Date.parse(aAnnotations[0].lastModified), iLastModified, "LastModified header exists for first annotation document");
			assert.equal(Date.parse(aAnnotations[1].lastModified), iLastModified, "LastModified header exists for second annotation document");
			assert.equal(Date.parse(aAnnotations[2].lastModified), iLastModified, "LastModified header exists for third annotation document");
			assert.equal(Date.parse(aAnnotations[3].lastModified), iLastModified, "LastModified header exists for fourth annotation document");

			done();
		});

	};

	QUnit.test("Access to lastModified header", fnTestLastModified);

	var fnTestNoLastModified = function(assert) {
		var mService = mAdditionalTestsServices["NoLastModified Header"];

		var oModel = new sap.ui.model.odata.v2.ODataModel(mService.service, {
			annotationURI: mService.annotations,
			skipMetadataAnnotationParsing: false
		});

		return oModel.annotationsLoaded().then(function(aAnnotations) {
			assert.notOk(aAnnotations[0].lastModified, "LastModified header does not exist for annotation document");
		});
	};

	QUnit.test("Access to lastModified header which is not set", fnTestNoLastModified);

}


text:
require 'spec_helper'

describe Ivapi::Client::Account do
  before(:each) do
    Ivapi.configure do |config|
      config.username = 'foo'
      config.password = 'bar'
    end
  end

  after(:each) do
    Ivapi.reset!
  end

  describe 'account information' do
    before(:each) do
      stub_command('account_info')
        .to_return(json_response('account_info.json'))
      @info = Ivapi.account.information
    end

    it 'should return account name' do
      expect(@info.name).to eq('Name Surname')
    end

    it 'has alias info' do
      expect(Ivapi.account.info).to eq(Ivapi.account.information)
    end
  end

  describe 'account credits' do
    before(:each) do
      stub_command('account_credits', count: 10)
        .to_return(json_response('account_credits.json'))
      @account_orders = Ivapi.account.credits
    end

    it 'should return correct credits count' do
      expect(@account_orders.count).to eq(0)
    end
  end

  describe 'account orders' do
    before(:each) do
      stub_command('account_orders')
        .to_return(json_response('account_orders.json'))
      @account_orders = Ivapi.account.orders
      @order = @account_orders.first
    end

    it 'should return correct orders count' do
      expect(@account_orders.count).to eq(3)
    end

    it 'should return order cost' do
      expect(@order.cost).to eq('11.11')
    end
  end

  describe 'account services' do
    before(:each) do
      stub_command('account_services')
        .to_return(json_response('account_services.json'))
      @account_services = Ivapi.account.services
      @service = @account_services.first
    end

    it 'should return correct services count' do
      expect(@account_services.count).to eq(3)
    end

    it 'should return service description' do
      expect(@service.description)
        .to eq('Adreso metinis mokestis (example.com)')
    end
  end

  describe 'account bonuses' do
    before(:each) do
      stub_command('account_bonuses', count: 10)
        .to_return(json_response('account_bonuses.json'))
      @account_bonuses = Ivapi.account.bonuses
      @bonus = @account_bonuses[2]
    end

    it 'should return correct bonuses count' do
      expect(@account_bonuses.count).to eq(3)
    end

    it 'should return bonus description' do
      expect(@bonus.description)
        .to eq('SMS +370.61234569 (example)')
    end
  end
end


text:
<?xml version="1.0" encoding="UTF-8"?>
<actions>
        <action>
            <actionName>CUSTOM-install</actionName>
            <displayName>install</displayName>
            <goals>
                <goal>clean</goal>
                <goal>install</goal>
            </goals>
            <activatedProfiles>
                <activatedProfile>travis</activatedProfile>
                <activatedProfile>findbugs-jdk6</activatedProfile>
            </activatedProfiles>
        </action>
    </actions>


text:
package websocket

import (
	"encoding/hex"
	"github.com/zhouhui8915/engine.io-go/transport"
	"github.com/gorilla/websocket"
	"io/ioutil"
	"net/http"
	"net/http/httptest"
	"net/url"
	"sync"
	"testing"

	"github.com/zhouhui8915/engine.io-go/message"
	"github.com/zhouhui8915/engine.io-go/parser"
	. "github.com/smartystreets/goconvey/convey"
)

func TestWebsocket(t *testing.T) {

	Convey("Creater", t, func() {
		So(Creater.Name, ShouldEqual, "websocket")
		So(Creater.Server, ShouldEqual, NewServer)
		So(Creater.Client, ShouldEqual, NewClient)
	})

	Convey("Normal work, server part", t, func() {
		sync := make(chan int)
		server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
			f := newFakeCallback()
			s, err := NewServer(w, r, f)
			if err != nil {
				t.Fatal(err)
			}
			defer s.Close()

			{
				req, err := http.NewRequest("GET", "/", nil)
				if err != nil {
					t.Fatal(err)
				}
				recoder := httptest.NewRecorder()
				s.ServeHTTP(recoder, req)
				if recoder.Code != http.StatusBadRequest {
					t.Fatal(recoder.Code, "!=", http.StatusBadRequest)
				}
			}

			{
				w, err := s.NextWriter(message.MessageText, parser.OPEN)
				if err != nil {
					t.Fatal(err)
				}
				err = w.Close()
				if err != nil {
					t.Fatal(err)
				}
			}

			{
				<-f.onPacket
				if f.messageType != message.MessageBinary {
					t.Fatal(f.messageType, "!=", message.MessageBinary)
				}
				if f.packetType != parser.MESSAGE {
					t.Fatal(f.packetType, "!=", parser.MESSAGE)
				}
				if f.err != nil {
					t.Fatal(err)
				}
				if body := string(f.body); body != "测试" {
					t.Fatal(body, "!=", "测试")
				}
			}

			<-sync
			sync <- 1

			<-sync
			sync <- 1

			{
				w, err := s.NextWriter(message.MessageBinary, parser.NOOP)
				if err != nil {
					t.Fatal(err)
				}
				err = w.Close()
				if err != nil {
					t.Fatal(err)
				}
			}

			<-sync
			sync <- 1

			{
				<-f.onPacket
				if f.messageType != message.MessageText {
					t.Fatal(f.messageType, "!=", message.MessageText)
				}
				if f.packetType != parser.MESSAGE {
					t.Fatal(f.packetType, "!=", parser.MESSAGE)
				}
				if f.err != nil {
					t.Fatal(err)
				}
				if body := hex.EncodeToString(f.body); body != "e697a5e69cace8aa9e" {
					t.Fatal(body, "!=", "e697a5e69cace8aa9e")
				}
			}

			<-sync
			sync <- 1
		}))
		defer server.Close()

		u, _ := url.Parse(server.URL)
		u.Scheme = "ws"
		req, err := http.NewRequest("GET", u.String(), nil)
		So(err, ShouldBeNil)

		c, _ := NewClient(req)
		defer c.Close()

		{
			w, _ := c.NextWriter(message.MessageBinary, parser.MESSAGE)
			w.Write([]byte("测试"))
			w.Close()
		}

		sync <- 1
		<-sync

		{
			decoder, _ := c.NextReader()
			defer decoder.Close()
			ioutil.ReadAll(decoder)
		}

		sync <- 1
		<-sync

		{
			decoder, _ := c.NextReader()
			defer decoder.Close()
			ioutil.ReadAll(decoder)
		}

		sync <- 1
		<-sync

		{
			w, _ := c.NextWriter(message.MessageText, parser.MESSAGE)
			w.Write([]byte("日本語"))
			w.Close()
		}

		sync <- 1
		<-sync
	})

	Convey("Normal work, client part", t, func() {
		sync := make(chan int)
		server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
			f := newFakeCallback()
			if v := r.URL.Query().Get("key"); v != "value" {
				t.Fatal(v, "!=", "value")
			}
			s, _ := NewServer(w, r, f)
			defer s.Close()

			{
				w, _ := s.NextWriter(message.MessageText, parser.OPEN)
				w.Close()
			}

			{
				<-f.onPacket
			}

			<-sync
			sync <- 1

			<-sync
			sync <- 1

			{
				w, _ := s.NextWriter(message.MessageBinary, parser.NOOP)
				w.Close()
			}

			<-sync
			sync <- 1

			{
				<-f.onPacket
			}

			<-sync
			sync <- 1
		}))
		defer server.Close()

		u, err := url.Parse(server.URL)
		So(err, ShouldBeNil)
		u.Scheme = "ws"
		req, err := http.NewRequest("GET", u.String()+"/?key=value", nil)
		So(err, ShouldBeNil)

		c, err := NewClient(req)
		So(err, ShouldBeNil)
		defer c.Close()

		So(c.Response(), ShouldNotBeNil)
		So(c.Response().StatusCode, ShouldEqual, http.StatusSwitchingProtocols)

		{
			w, err := c.NextWriter(message.MessageBinary, parser.MESSAGE)
			So(err, ShouldBeNil)
			_, err = w.Write([]byte("测试"))
			So(err, ShouldBeNil)
			err = w.Close()
			So(err, ShouldBeNil)
		}

		sync <- 1
		<-sync

		{
			decoder, err := c.NextReader()
			So(err, ShouldBeNil)
			defer decoder.Close()
			So(decoder.MessageType(), ShouldEqual, message.MessageText)
			So(decoder.Type(), ShouldEqual, parser.OPEN)
			b, err := ioutil.ReadAll(decoder)
			So(err, ShouldBeNil)
			So(string(b), ShouldEqual, "")
		}

		sync <- 1
		<-sync

		{
			decoder, err := c.NextReader()
			So(err, ShouldBeNil)
			defer decoder.Close()
			So(decoder.MessageType(), ShouldEqual, message.MessageBinary)
			So(decoder.Type(), ShouldEqual, parser.NOOP)
			b, err := ioutil.ReadAll(decoder)
			So(err, ShouldBeNil)
			So(string(b), ShouldEqual, "")
		}

		sync <- 1
		<-sync

		{
			w, err := c.NextWriter(message.MessageText, parser.MESSAGE)
			So(err, ShouldBeNil)
			_, err = w.Write([]byte("日本語"))
			So(err, ShouldBeNil)
			err = w.Close()
			So(err, ShouldBeNil)
		}

		sync <- 1
		<-sync
	})

	Convey("Packet content", t, func() {
		sync := make(chan int)
		server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
			f := newFakeCallback()
			s, _ := NewServer(w, r, f)
			defer s.Close()

			{
				w, _ := s.NextWriter(message.MessageText, parser.MESSAGE)
				w.Write([]byte("日本語"))
				w.Close()
			}

			sync <- 1
			<-sync
		}))
		defer server.Close()

		u, err := url.Parse(server.URL)
		So(err, ShouldBeNil)
		u.Scheme = "ws"
		req, err := http.NewRequest("GET", u.String(), nil)
		So(err, ShouldBeNil)

		c, err := NewClient(req)
		So(err, ShouldBeNil)
		defer c.Close()

		{
			client := c.(*client)
			t, r, err := client.conn.NextReader()
			So(err, ShouldBeNil)
			So(t, ShouldEqual, websocket.TextMessage)
			b, err := ioutil.ReadAll(r)
			So(err, ShouldBeNil)
			So(string(b), ShouldEqual, "4日本語")
			So(hex.EncodeToString(b), ShouldEqual, "34e697a5e69cace8aa9e")
		}

		<-sync
		sync <- 1
	})

	Convey("Close", t, func() {
		f := newFakeCallback()
		var s transport.Server
		sync := make(chan int)
		server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
			s, _ = NewServer(w, r, f)
			s.Close()
			s.Close()
			s.Close()
			sync <- 1
		}))
		defer server.Close()

		u, err := url.Parse(server.URL)
		So(err, ShouldBeNil)
		u.Scheme = "ws"
		req, err := http.NewRequest("GET", u.String(), nil)
		So(err, ShouldBeNil)

		c, err := NewClient(req)
		So(err, ShouldBeNil)
		defer c.Close()

		<-sync
		So(f.ClosedCount(), ShouldEqual, 1)
		So(f.closeServer, ShouldEqual, s)
	})

	Convey("Closing by disconnected", t, func() {
		f := newFakeCallback()
		sync := make(chan int)
		server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
			s, _ := NewServer(w, r, f)
			server := s.(*Server)
			server.conn.Close()
			sync <- 1
		}))
		defer server.Close()

		u, err := url.Parse(server.URL)
		So(err, ShouldBeNil)
		u.Scheme = "ws"
		req, err := http.NewRequest("GET", u.String(), nil)
		So(err, ShouldBeNil)

		c, err := NewClient(req)
		So(err, ShouldBeNil)
		defer c.Close()

		<-sync
		So(f.ClosedCount(), ShouldEqual, 1)
	})

	Convey("Closing writer after closed", t, func() {
		f := newFakeCallback()
		sync := make(chan int)
		server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
			s, err := NewServer(w, r, f)
			if err != nil {
				t.Fatal(err)
			}
			writer, err := s.NextWriter(message.MessageText, parser.MESSAGE)
			if err != nil {
				t.Fatal(err)
			}
			err = s.Close()
			if err != nil {
				t.Fatal(err)
			}
			err = writer.Close()
			if err == nil {
				t.Fatal("err should not be nil")
			}
			sync <- 1
		}))
		defer server.Close()

		u, _ := url.Parse(server.URL)
		u.Scheme = "ws"
		req, _ := http.NewRequest("GET", u.String(), nil)

		c, _ := NewClient(req)
		defer c.Close()

		<-sync
	})
}

type fakeCallback struct {
	onPacket    chan bool
	messageType message.MessageType
	packetType  parser.PacketType
	body        []byte
	err         error
	closedCount int
	countLocker sync.Mutex
	closeServer transport.Server
}

func newFakeCallback() *fakeCallback {
	return &fakeCallback{
		onPacket: make(chan bool),
	}
}

func (f *fakeCallback) OnPacket(r *parser.PacketDecoder) {
	f.packetType = r.Type()
	f.messageType = r.MessageType()
	f.body, f.err = ioutil.ReadAll(r)
	f.onPacket <- true
}

func (f *fakeCallback) OnClose(s transport.Server) {
	f.countLocker.Lock()
	defer f.countLocker.Unlock()
	f.closedCount++
	f.closeServer = s
}

func (f *fakeCallback) ClosedCount() int {
	f.countLocker.Lock()
	defer f.countLocker.Unlock()
	return f.closedCount
}


text:
using System.IO;
using System.Net.Http.Headers;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace System.Net.Http
{
    public class StringContent : ByteArrayContent
    {
        private const string DefaultMediaType = "text/plain";

        public StringContent(string content)
            : this(content, null, null)
        {
        }

        public StringContent(string content, Encoding encoding)
            : this(content, encoding, null)
        {
        }

        public StringContent(string content, Encoding encoding, string mediaType)
            : base(GetContentByteArray(content, encoding))
        {
            // Initialize the 'Content-Type' header with information provided by parameters.
            MediaTypeHeaderValue headerValue = new MediaTypeHeaderValue((mediaType == null) ? DefaultMediaType : mediaType);
            headerValue.CharSet = (encoding == null) ? HttpContent.DefaultStringEncoding.WebName : encoding.WebName;

            Headers.ContentType = headerValue;
        }

        // A StringContent is essentially a ByteArrayContent. We serialize the string into a byte-array in the
        // constructor using encoding information provided by the caller (if any). When this content is sent, the
        // Content-Length can be retrieved easily (length of the array).
        private static byte[] GetContentByteArray(string content, Encoding encoding)
        {
            // In this case we treat 'null' strings different from string.Empty in order to be consistent with our
            // other *Content constructors: 'null' throws, empty values are allowed.
            if (content == null)
            {
                throw new ArgumentNullException(nameof(content));
            }

            if (encoding == null)
            {
                encoding = HttpContent.DefaultStringEncoding;
            }

            return encoding.GetBytes(content);
        }

        internal override Task SerializeToStreamAsync(Stream stream, TransportContext context, CancellationToken cancellationToken) =>
            // Only skip the original protected virtual SerializeToStreamAsync if this
            // isn't a derived type that may have overridden the behavior.
            GetType() == typeof(StringContent) ? SerializeToStreamAsyncCore(stream, cancellationToken) :
            base.SerializeToStreamAsync(stream, context, cancellationToken);

        internal override Stream TryCreateContentReadStream() =>
            GetType() == typeof(StringContent) ? CreateMemoryStreamForByteArray() : // type check ensures we use possible derived type's CreateContentReadStreamAsync override
            null;
    }
}


text:
Ext.override(Ext.layout.BorderLayout, {

        southTitleAdded  : false,

            // private

        onLayout : function(ct, target){

            var collapsed;

            if(!this.rendered){

                target.position();

                target.addClass('x-border-layout-ct');

                var items = ct.items.items;

                collapsed = [];

                for(var i = 0, len = items.length; i < len; i++) {

                    var c = items[i];

                    var pos = c.region;

                    if(c.collapsed){

                        collapsed.push(c);

                    }

                    c.collapsed = false;

                    if(!c.rendered){

                        c.cls = c.cls ? c.cls +' x-border-panel' : 'x-border-panel';

                        c.render(target, i);

                    }

                    this[pos] = pos != 'center' && c.split ?

                        new Ext.layout.BorderLayout.SplitRegion(this, c.initialConfig, pos) :

                        new Ext.layout.BorderLayout.Region(this, c.initialConfig, pos);

                    this[pos].render(target, c);

                }

                this.rendered = true;

            }

            var size = target.getViewSize();

            if(size.width < 20 || size.height < 20){ // display none?

                if(collapsed){

                    this.restoreCollapsed = collapsed;

                }

                return;

            }else if(this.restoreCollapsed){

                collapsed = this.restoreCollapsed;

                delete this.restoreCollapsed;

            }

            var w = size.width, h = size.height;

            var centerW = w, centerH = h, centerY = 0, centerX = 0;

            var n = this.north, s = this.south, west = this.west, e = this.east, c = this.center;

            if(!c){

                throw 'No center region defined in BorderLayout ' + ct.id;

            }

            if(n && n.isVisible()){

                var b = n.getSize();

                var m = n.getMargins();

                b.width = w - (m.left+m.right);

                b.x = m.left;

                b.y = m.top;

                centerY = b.height + b.y + m.bottom;

                centerH -= centerY;

                n.applyLayout(b);

            }

            if(s && s.isVisible()){

                var b = s.getSize();

                var m = s.getMargins();

                b.width = w - (m.left+m.right);

                b.x = m.left;

                var totalHeight = (b.height + m.top + m.bottom);

                b.y = h - totalHeight + m.top;

                centerH -= totalHeight;

                s.applyLayout(b);

                //new config options for south region:

                //  collapsedTitle        : 'string'

                //  collapsedTitleCls    :  'string'

                //  collapsedTitleStyle :  'string'

                if (typeof s.collapsedEl != 'undefined' && s.collapsedTitle && this.southTitleAdded == false) {

                    this.southTitleAdded = true;

                    var cDiv = s.collapsedEl;

                    var tpl  = new Ext.Template('
{txt}
');

                    var insertedHtml = tpl.insertFirst(cDiv,{ txt : s.collapsedTitle });

                    if (s.collapsedTitleStyle) {

                        cDiv.applyStyles(s.collapsedTitleStyle);

                    }

                    if (s.collapsedTitleCls) {

                        Ext.get(insertedHtml).addClass(s.collapsedTitleCls);

                    }
                }

            }

            if(west && west.isVisible()){

                var b = west.getSize();

                var m = west.getMargins();

                b.height = centerH - (m.top+m.bottom);

                b.x = m.left;

                b.y = centerY + m.top;

                var totalWidth = (b.width + m.left + m.right);

                centerX += totalWidth;

                centerW -= totalWidth;

                west.applyLayout(b);

            }

            if(e && e.isVisible()){

                var b = e.getSize();

                var m = e.getMargins();

                b.height = centerH - (m.top+m.bottom);

                var totalWidth = (b.width + m.left + m.right);

                b.x = w - totalWidth + m.left;

                b.y = centerY + m.top;

                centerW -= totalWidth;

                e.applyLayout(b);

            }

            var m = c.getMargins();

            var centerBox = {

                x: centerX + m.left,

                y: centerY + m.top,

                width: centerW - (m.left+m.right),

                height: centerH - (m.top+m.bottom)

            };

            c.applyLayout(centerBox);

            if(collapsed){

                for(var i = 0, len = collapsed.length; i < len; i++){

                    collapsed[i].collapse(false);

                }

            }

            if(Ext.isIE && Ext.isStrict){ // workaround IE strict repainting issue

                target.repaint();

            }

        }

});


text:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?><!DOCTYPE html>

<?php echo $title; ?>

<?php echo $msg; ?>

			<?php echo validation_errors(); ?>
			<?php echo form_open("user/dologin"); ?>

					Username
					<input type="text" name="username" id="username" placeholder="Username" class="form-control" value="<?php echo set_value('username'); ?>" />

					Password
					<input type="password" name="password" id="password" placeholder="Password" class="form-control" value="<?php echo set_value('password'); ?>" />

						<input type="checkbox" name="remember_me" /> Remember Me

				<input type="submit" value="LOGIN" class="btn btn-primary" />
			</form>


text:
package genesis

import (
	"fmt"
	"testing"
	"time"

	"github.com/hyperledger/burrow/acm"
	"github.com/hyperledger/burrow/acm/validator"
	"github.com/hyperledger/burrow/permission"
	"github.com/stretchr/testify/assert"
)

var genesisTime, _ = time.Parse("02-01-2006", "27-10-2017")

func TestMakeGenesisDocFromAccounts(t *testing.T) {
	genDoc := MakeGenesisDocFromAccounts("test-chain", nil, genesisTime,
		accountMap("Tinkie-winkie", "Lala", "Po", "Dipsy"),
		validatorMap("Foo", "Bar", "Baz"),
	)

	// Check we have matching serialisation after a round trip
	bs, err := genDoc.JSONBytes()
	assert.NoError(t, err)

	genDocOut, err := GenesisDocFromJSON(bs)
	assert.NoError(t, err)

	bsOut, err := genDocOut.JSONBytes()
	assert.NoError(t, err)

	assert.Equal(t, bs, bsOut)
	assert.Equal(t, genDoc.Hash(), genDocOut.Hash())
	fmt.Println(string(bs))
}

func accountMap(names ...string) map[string]*acm.Account {
	accounts := make(map[string]*acm.Account, len(names))
	for _, name := range names {
		accounts[name] = accountFromName(name)
	}
	return accounts
}

func validatorMap(names ...string) map[string]*validator.Validator {
	validators := make(map[string]*validator.Validator, len(names))
	for _, name := range names {
		acc := accountFromName(name)
		validators[name] = validator.FromAccount(acc, acc.Balance)
	}
	return validators
}

func accountFromName(name string) *acm.Account {
	ca := acm.NewAccountFromSecret(name)
	for _, c := range name {
		ca.Balance += uint64(c)
	}
	ca.Permissions = permission.AllAccountPermissions.Clone()
	return ca
}


text:
package me.chanjar.weixin.mp.bean.device;

import com.google.gson.annotations.SerializedName;
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;

/**
 * Created by keungtung on 10/12/2016.
 */
public class WxDeviceBindResult extends AbstractDeviceBean {
    @SerializedName("base_resp")
    private BaseResp baseResp;

    public static WxDeviceBindResult fromJson(String json) {
        return WxMpGsonBuilder.create().fromJson(json, WxDeviceBindResult.class);
    }

    public BaseResp getBaseResp() {
        return baseResp;
    }

    public void setBaseResp(BaseResp baseResp) {
        this.baseResp = baseResp;
    }
}


text:
/**
 *
 */
package org.w3c.odrl.W3COdrl2.parsers.json;

import org.w3c.odrl.W3COdrl2.parsers.AbstractContentProcessor;
import org.w3c.odrl.W3COdrl2.parsers.IOdrlParser;

/**
 * @author Jim Earley <xml.jim@gmail.com> Sep 5, 2014
 * @param <V>
 *
 */
public abstract class AbstractJsonContentProcessor<D> extends AbstractContentProcessor<String, D> implements
                IOdrlJsonContentProcessor<String, D> {

    /**
     *
     */
    public AbstractJsonContentProcessor(final IOdrlParser parser) {
        super(parser);
    }

}


text:
<Order OrderID="10345">
	<CustomerID>QUICK</CustomerID>
	<EmployeeID>2</EmployeeID>
	<OrderDate>1996-11-04T11:57:26</OrderDate>
	<RequiredDate>1996-12-02T10:06:41</RequiredDate>
	<ShippedDate>1996-11-11T19:54:15</ShippedDate>
	<ShipVia>2</ShipVia>
	<Freight>249.0600</Freight>
	<ShipName>QUICK-Stop</ShipName>
	<ShipAddress>Taucherstraße 10</ShipAddress>
	<ShipCity>Cunewalde</ShipCity>
	<ShipRegion/>
	<ShipPostalCode>01307</ShipPostalCode>
	<ShipCountry>Germany</ShipCountry>
	<OrderDetails>
		<OrderDetail>
			<ProductID>8</ProductID>
			<UnitPrice>32.0000</UnitPrice>
			<Quantity>70</Quantity>
			<Discount>0</Discount>
		</OrderDetail>
		<OrderDetail>
			<ProductID>19</ProductID>
			<UnitPrice>7.3000</UnitPrice>
			<Quantity>80</Quantity>
			<Discount>0</Discount>
		</OrderDetail>
		<OrderDetail>
			<ProductID>42</ProductID>
			<UnitPrice>11.2000</UnitPrice>
			<Quantity>9</Quantity>
			<Discount>0</Discount>
		</OrderDetail>
	</OrderDetails>
</Order>


text:
layout:     post
title:      "Hello Tehran!"
subtitle:   "Kyte, will change the way you ship your products and packages."
date:       "2017-04-10 12:00:00"
author:     "Aram Alipoor"
header-img: "img/post-bg-01.jpg"
---

We believe with the help of technology it is possible to change the way we all post packages and documents, forever, for good.
There is no need to wait in line in Postal Offices, waste half of your day, just to post a single paper, or a box of shoes.

Kyte heros are here to save you time, money and energy. So you can focus on what you do best.

Operations

We use technology in every part of our business, from operations in our fulfillment warehouse, to pickup couriers. From the start 'till the end of every day.

Product

Our product plays a key role in our success. By offering a first-class, smooth and seamless experience to our customers, we make sure none of them would ever leave the minute they start using our product.

Team

Like every successful company, our team is the top priority. If you want to change the things around you, and make them look better or work better, join us, we're waiting for you.


text:
<?php

declare(strict_types=1);

namespace Sylius\Bundle\ProductBundle\Form\Type;

use Sylius\Bundle\ResourceBundle\Form\EventSubscriber\AddCodeFormSubscriber;
use Sylius\Bundle\ResourceBundle\Form\Type\AbstractResourceType;
use Sylius\Bundle\ResourceBundle\Form\Type\ResourceTranslationsType;
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
use Symfony\Component\Form\FormBuilderInterface;

final class ProductOptionType extends AbstractResourceType
{
    public function buildForm(FormBuilderInterface $builder, array $options): void
    {
        $builder
            ->add('position', IntegerType::class, [
                'required' => false,
                'label' => 'sylius.form.option.position',
            ])
            ->add('translations', ResourceTranslationsType::class, [
                'entry_type' => ProductOptionTranslationType::class,
                'label' => 'sylius.form.option.name',
            ])
            ->add('values', CollectionType::class, [
                'entry_type' => ProductOptionValueType::class,
                'allow_add' => true,
                'by_reference' => false,
                'label' => false,
                'button_add_label' => 'sylius.form.option_value.add_value',
            ])
            ->addEventSubscriber(new AddCodeFormSubscriber())
        ;
    }

    public function getBlockPrefix(): string
    {
        return 'sylius_product_option';
    }
}


text: google-site-verification: google80446232d11b6f02.html


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Monograph of Clavaria and allied Genera (Annals of Botany Memoirs No. 1) 386 (1950)

#### Original name
Clavaria rufipes G.F. Atk., 1908

### Remarks
null