text:
require 'spec_helper'

describe 'React::State', js: true do
  it "can create dynamically initialized exported states" do
    expect_evaluate_ruby do
      class Foo
        include React::Component
        export_state(:foo) { 'bar' }
      end
      Hyperloop::Application::Boot.run
      Foo.foo
    end.to eq('bar')
  end

  # these will all require async operations and testing to see if things get
  # re-rendered see spec_helper the "render" test method

  # if Foo.foo is used during rendering then when Foo.foo changes we will
  # rerender
  it "sets up observers when exported states are read"

  # React::State.set_state(object, attribute, value) +
  # React::State.get_state(object, attribute)
  it "can be accessed outside of react using get/set_state"

  it 'ignores state updates during rendering' do
    client_option render_on: :both
    evaluate_ruby do
      class StateTest < React::Component::Base
        export_state :boom
        before_mount do
          # force boom to be on the observing list during the current rendering cycle
          StateTest.boom! !StateTest.boom
          # this is automatically called by after_mount / after_update, but we don't want
          # to have to setup a complicated async test, so we just force it now.
          # if we don't do this, then updating boom will have no effect on the first render
          React::State.update_states_to_observe
        end
        def render
          (StateTest.boom ? "Boom" : "No Boom").tap { StateTest.boom! !StateTest.boom }
        end
      end
      MARKUP = React::Server.render_to_static_markup(React.create_element(StateTest))
    end
    expect_evaluate_ruby("MARKUP").to eq('Boom')
    expect_evaluate_ruby("StateTest.boom").to be_falsy
    expect(page.driver.browser.manage.logs.get(:browser).reject { |entry|
      entry_s = entry.to_s
      entry_s.include?("Deprecated feature") || entry_s.include?("Mount() on the server. This is a no-op.")
    }.size).to eq(0)
  end
end


text:
package control

import (
	"os"
	"os/exec"
	"syscall"

	"github.com/codegangsta/cli"
	"github.com/rancher/os/log"
	"golang.org/x/net/context"

	"github.com/rancher/os/cmd/cloudinitexecute"
	"github.com/rancher/os/config"
	"github.com/rancher/os/docker"
	"github.com/rancher/os/util"
)

const (
	ca     = "/etc/ssl/certs/ca-certificates.crt"
	caBase = "/etc/ssl/certs/ca-certificates.crt.rancher"
)

func entrypointAction(c *cli.Context) error {
	if _, err := os.Stat("/host/dev"); err == nil {
		cmd := exec.Command("mount", "--rbind", "/host/dev", "/dev")
		if err := cmd.Run(); err != nil {
			log.Errorf("Failed to mount /dev: %v", err)
		}
	}

	if err := util.FileCopy(caBase, ca); err != nil && !os.IsNotExist(err) {
		log.Error(err)
	}

	cfg := config.LoadConfig()

	shouldWriteFiles := false
	for _, file := range cfg.WriteFiles {
		if file.Container != "" {
			shouldWriteFiles = true
		}
	}

	if shouldWriteFiles {
		writeFiles(cfg)
	}

	setupCommandSymlinks()

	if len(os.Args) < 3 {
		return nil
	}

	binary, err := exec.LookPath(os.Args[2])
	if err != nil {
		return err
	}

	return syscall.Exec(binary, os.Args[2:], os.Environ())
}

func writeFiles(cfg *config.CloudConfig) error {
	id, err := util.GetCurrentContainerID()
	if err != nil {
		return err
	}
	client, err := docker.NewSystemClient()
	if err != nil {
		return err
	}
	info, err := client.ContainerInspect(context.Background(), id)
	if err != nil {
		return err
	}

	cloudinitexecute.WriteFiles(cfg, info.Name[1:])
	return nil
}

func setupCommandSymlinks() {
	for _, link := range []symlink{
		{config.RosBin, "/usr/bin/autologin"},
		{config.RosBin, "/usr/bin/recovery"},
		{config.RosBin, "/usr/bin/cloud-init-execute"},
		{config.RosBin, "/usr/bin/cloud-init-save"},
		{config.RosBin, "/usr/bin/dockerlaunch"},
		{config.RosBin, "/usr/bin/respawn"},
		{config.RosBin, "/usr/bin/system-docker"},
		{config.RosBin, "/usr/sbin/netconf"},
		{config.RosBin, "/usr/sbin/wait-for-docker"},
		{config.RosBin, "/usr/sbin/poweroff"},
		{config.RosBin, "/usr/sbin/reboot"},
		{config.RosBin, "/usr/sbin/halt"},
		{config.RosBin, "/usr/sbin/shutdown"},
		{config.RosBin, "/sbin/poweroff"},
		{config.RosBin, "/sbin/reboot"},
		{config.RosBin, "/sbin/halt"},
		{config.RosBin, "/sbin/shutdown"},
	} {
		os.Remove(link.newname)
		if err := os.Symlink(link.oldname, link.newname); err != nil {
			log.Error(err)
		}
	}
}

redpajama_set_name: RedPajamaGithub


text:
<?php
namespace common\models\permissions;

use yii\db\ActiveRecord;
use yii\rbac\Item;

/**
 * Class ItemRecord
 * @package backend\models
 *
 * @property string $name
 * @property int $type
 * @property string $description
 * @property string $rule_name
 * @property string $data
 * @property int $created_at
 * @property int $updated_at
 */
class ItemRecord extends ActiveRecord
{
    /**
     * @var array
     */
    public $permissions = [];

    /**
     * @return string
     */
    public static function tableName()
    {
        return '{{%auth_item}}';
    }

    public function rules()
    {
        return [
            [['name', 'description'], 'required', 'on' => ['create', 'update']],
            [['name', 'description'], 'safe', 'on' => ['search']],
            ['name', 'unique'],
            [['permissions', 'type'], 'safe']
        ];
    }

    public function attributeLabels()
    {
        return [
            'name' => 'Название',
            'description' => 'Описание',
            'permissions' => 'Доступные действия',
            'created_at' => 'Дата создания',
            'updated_at' => 'Дата обновления'
        ];
    }

    public function getAssignment()
    {
        return $this->hasOne(AuthAssignmentRecord::className(), ['item_name' => 'name']);
    }

    public function getChild()
    {
        return $this->hasMany(ItemChildRecord::className(), ['parent' => 'name']);
    }

    public function getChildByParams($child)
    {
        return $this->hasOne(ItemChildRecord::className(), ['parent' => 'name'])->onCondition(['child' => $child]);
    }

    public static function getRoles()
    {
        return static::find()->where(['type'=> Item::TYPE_ROLE])->all();
    }
}


text:
package org.openntf.domino.xsp.session;

import org.openntf.domino.Session;

import com.ibm.domino.xsp.module.nsf.NotesContext;

public class XPageSignerSessionFactory extends AbstractXPageSessionFactory {
	private static final long serialVersionUID = 1L;
	private boolean fullAccess_;

	public XPageSignerSessionFactory(final boolean fullAccess) {
		fullAccess_ = fullAccess;
	}

	@Override
	public Session createSession() {
		lotus.domino.Session rawSession = NotesContext.getCurrent().getSessionAsSigner(fullAccess_);
		return wrapSession(rawSession, false); //contextDB is set in notesContext
	}

}


text:
use std::sync::atomic::*;

use futures::channel::mpsc;
use futures::{FutureExt, SinkExt, StreamExt, TryFutureExt};
use grpcio::{self, *};
use kvproto::backup::*;
use tikv_util::worker::*;

use super::Task;

/// Service handles the RPC messages for the `Backup` service.
#[derive(Clone)]
pub struct Service {
    scheduler: Scheduler<Task>,
}

impl Service {
    /// Create a new backup service.
    pub fn new(scheduler: Scheduler<Task>) -> Service {
        Service { scheduler }
    }
}

impl Backup for Service {
    fn backup(
        &mut self,
        ctx: RpcContext,
        req: BackupRequest,
        mut sink: ServerStreamingSink<BackupResponse>,
    ) {
        let mut cancel = None;
        // TODO: make it a bounded channel.
        let (tx, rx) = mpsc::unbounded();
        if let Err(status) = match Task::new(req, tx) {
            Ok((task, c)) => {
                cancel = Some(c);
                self.scheduler.schedule(task).map_err(|e| {
                    RpcStatus::new(RpcStatusCode::INVALID_ARGUMENT, Some(format!("{:?}", e)))
                })
            }
            Err(e) => Err(RpcStatus::new(
                RpcStatusCode::UNKNOWN,
                Some(format!("{:?}", e)),
            )),
        } {
            error!("backup task initiate failed"; "error" => ?status);
            ctx.spawn(
                sink.fail(status)
                    .unwrap_or_else(|e| error!("backup failed to send error"; "error" => ?e)),
            );
            return;
        };

        let send_task = async move {
            let mut s = rx.map(|resp| Ok((resp, WriteFlags::default())));
            sink.send_all(&mut s).await?;
            sink.close().await?;
            Ok(())
        }
        .map(|res: Result<()>| {
            match res {
                Ok(_) => {
                    info!("backup closed");
                }
                Err(e) => {
                    if let Some(c) = cancel {
                        // Cancel the running task.
                        c.store(true, Ordering::SeqCst);
                    }
                    error!("backup canceled"; "error" => ?e);
                }
            }
        });

        ctx.spawn(send_task);
    }
}

#[cfg(test)]
mod tests {
    use std::sync::Arc;
    use std::time::Duration;

    use super::*;
    use crate::endpoint::tests::*;
    use external_storage::make_local_backend;
    use tikv::storage::txn::tests::{must_commit, must_prewrite_put};
    use tikv_util::worker::{dummy_scheduler, ReceiverWrapper};
    use txn_types::TimeStamp;

    fn new_rpc_suite() -> (Server, BackupClient, ReceiverWrapper<Task>) {
        let env = Arc::new(EnvBuilder::new().build());
        let (scheduler, rx) = dummy_scheduler();
        let backup_service = super::Service::new(scheduler);
        let builder =
            ServerBuilder::new(env.clone()).register_service(create_backup(backup_service));
        let mut server = builder.bind("127.0.0.1", 0).build().unwrap();
        server.start();
        let (_, port) = server.bind_addrs().next().unwrap();
        let addr = format!("127.0.0.1:{}", port);
        let channel = ChannelBuilder::new(env).connect(&addr);
        let client = BackupClient::new(channel);
        (server, client, rx)
    }

    #[test]
    fn test_client_stop() {
        let (_server, client, mut rx) = new_rpc_suite();

        let (tmp, endpoint) = new_endpoint();
        let engine = endpoint.engine.clone();
        endpoint.region_info.set_regions(vec![
            (b"".to_vec(), b"2".to_vec(), 1),
            (b"2".to_vec(), b"5".to_vec(), 2),
        ]);

        let mut ts: TimeStamp = 1.into();
        let mut alloc_ts = || *ts.incr();
        for i in 0..5 {
            let start = alloc_ts();
            let key = format!("{}", i);
            must_prewrite_put(
                &engine,
                key.as_bytes(),
                key.as_bytes(),
                key.as_bytes(),
                start,
            );
            let commit = alloc_ts();
            must_commit(&engine, key.as_bytes(), start, commit);
        }

        let now = alloc_ts();
        let mut req = BackupRequest::default();
        req.set_start_key(vec![]);
        req.set_end_key(vec![b'5']);
        req.set_start_version(now.into_inner());
        req.set_end_version(now.into_inner());
        // Set an unique path to avoid AlreadyExists error.
        req.set_storage_backend(make_local_backend(&tmp.path().join(now.to_string())));

        let stream = client.backup(&req).unwrap();
        let task = rx.recv_timeout(Duration::from_secs(5)).unwrap();
        // Drop stream without start receiving will cause cancel error.
        drop(stream);
        // A stopped remote must not cause panic.
        endpoint.handle_backup_task(task.unwrap());

        // Set an unique path to avoid AlreadyExists error.
        req.set_storage_backend(make_local_backend(&tmp.path().join(alloc_ts().to_string())));
        let mut stream = client.backup(&req).unwrap();
        // Drop steam once it received something.
        client.spawn(async move {
            let _ = stream.next().await;
        });
        let task = rx.recv_timeout(Duration::from_secs(5)).unwrap();
        // A stopped remote must not cause panic.
        endpoint.handle_backup_task(task.unwrap());

        // Set an unique path to avoid AlreadyExists error.
        req.set_storage_backend(make_local_backend(&tmp.path().join(alloc_ts().to_string())));
        let stream = client.backup(&req).unwrap();
        let task = rx.recv().unwrap();
        // Drop stream without start receiving will cause cancel error.
        drop(stream);
        // Wait util the task is canceled in map_err.
        loop {
            std::thread::sleep(Duration::from_millis(100));
            if task.resp.unbounded_send(Default::default()).is_err() {
                break;
            }
        }
        // The task should be canceled.
        assert!(task.has_canceled());
        // A stopped remote must not cause panic.
        endpoint.handle_backup_task(task);
    }
}


text:
package com.amazonaws.services.supportapp.model;

import java.io.Serializable;
import javax.annotation.Generated;

/**
 *
 * @see AWS API Documentation
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class RegisterSlackWorkspaceForOrganizationResult extends com.amazonaws.AmazonWebServiceResult<com.amazonaws.ResponseMetadata> implements Serializable,
        Cloneable {

    /**
     *

     * Whether the Amazon Web Services account is a management or member account that's part of an organization in
     * Organizations.
     *

     */
    private String accountType;
    /**
     *

     * The team ID in Slack. This ID uniquely identifies a Slack workspace, such as T012ABCDEFG.
     *

     */
    private String teamId;
    /**
     *

     * The name of the Slack workspace.
     *

     */
    private String teamName;

    /**
     *

     * Whether the Amazon Web Services account is a management or member account that's part of an organization in
     * Organizations.
     *

     *
     * @param accountType
     *        Whether the Amazon Web Services account is a management or member account that's part of an organization
     *        in Organizations.
     * @see AccountType
     */

    public void setAccountType(String accountType) {
        this.accountType = accountType;
    }

    /**
     *

     * Whether the Amazon Web Services account is a management or member account that's part of an organization in
     * Organizations.
     *

     *
     * @return Whether the Amazon Web Services account is a management or member account that's part of an organization
     *         in Organizations.
     * @see AccountType
     */

    public String getAccountType() {
        return this.accountType;
    }

    /**
     *

     * Whether the Amazon Web Services account is a management or member account that's part of an organization in
     * Organizations.
     *

     *
     * @param accountType
     *        Whether the Amazon Web Services account is a management or member account that's part of an organization
     *        in Organizations.
     * @return Returns a reference to this object so that method calls can be chained together.
     * @see AccountType
     */

    public RegisterSlackWorkspaceForOrganizationResult withAccountType(String accountType) {
        setAccountType(accountType);
        return this;
    }

    /**
     *

     * Whether the Amazon Web Services account is a management or member account that's part of an organization in
     * Organizations.
     *

     *
     * @param accountType
     *        Whether the Amazon Web Services account is a management or member account that's part of an organization
     *        in Organizations.
     * @return Returns a reference to this object so that method calls can be chained together.
     * @see AccountType
     */

    public RegisterSlackWorkspaceForOrganizationResult withAccountType(AccountType accountType) {
        this.accountType = accountType.toString();
        return this;
    }

    /**
     *

     * The team ID in Slack. This ID uniquely identifies a Slack workspace, such as T012ABCDEFG.
     *

     *
     * @param teamId
     *        The team ID in Slack. This ID uniquely identifies a Slack workspace, such as T012ABCDEFG.
     */

    public void setTeamId(String teamId) {
        this.teamId = teamId;
    }

    /**
     *

     * The team ID in Slack. This ID uniquely identifies a Slack workspace, such as T012ABCDEFG.
     *

     *
     * @return The team ID in Slack. This ID uniquely identifies a Slack workspace, such as T012ABCDEFG.
     */

    public String getTeamId() {
        return this.teamId;
    }

    /**
     *

     * The team ID in Slack. This ID uniquely identifies a Slack workspace, such as T012ABCDEFG.
     *

     *
     * @param teamId
     *        The team ID in Slack. This ID uniquely identifies a Slack workspace, such as T012ABCDEFG.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public RegisterSlackWorkspaceForOrganizationResult withTeamId(String teamId) {
        setTeamId(teamId);
        return this;
    }

    /**
     *

     * The name of the Slack workspace.
     *

     *
     * @param teamName
     *        The name of the Slack workspace.
     */

    public void setTeamName(String teamName) {
        this.teamName = teamName;
    }

    /**
     *

     * The name of the Slack workspace.
     *

     *
     * @return The name of the Slack workspace.
     */

    public String getTeamName() {
        return this.teamName;
    }

    /**
     *

     * The name of the Slack workspace.
     *

     *
     * @param teamName
     *        The name of the Slack workspace.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public RegisterSlackWorkspaceForOrganizationResult withTeamName(String teamName) {
        setTeamName(teamName);
        return this;
    }

    /**
     * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
     * redacted from this string using a placeholder value.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getAccountType() != null)
            sb.append("AccountType: ").append(getAccountType()).append(",");
        if (getTeamId() != null)
            sb.append("TeamId: ").append(getTeamId()).append(",");
        if (getTeamName() != null)
            sb.append("TeamName: ").append(getTeamName());
        sb.append("}");
        return sb.toString();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;

        if (obj instanceof RegisterSlackWorkspaceForOrganizationResult == false)
            return false;
        RegisterSlackWorkspaceForOrganizationResult other = (RegisterSlackWorkspaceForOrganizationResult) obj;
        if (other.getAccountType() == null ^ this.getAccountType() == null)
            return false;
        if (other.getAccountType() != null && other.getAccountType().equals(this.getAccountType()) == false)
            return false;
        if (other.getTeamId() == null ^ this.getTeamId() == null)
            return false;
        if (other.getTeamId() != null && other.getTeamId().equals(this.getTeamId()) == false)
            return false;
        if (other.getTeamName() == null ^ this.getTeamName() == null)
            return false;
        if (other.getTeamName() != null && other.getTeamName().equals(this.getTeamName()) == false)
            return false;
        return true;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;

        hashCode = prime * hashCode + ((getAccountType() == null) ? 0 : getAccountType().hashCode());
        hashCode = prime * hashCode + ((getTeamId() == null) ? 0 : getTeamId().hashCode());
        hashCode = prime * hashCode + ((getTeamName() == null) ? 0 : getTeamName().hashCode());
        return hashCode;
    }

    @Override
    public RegisterSlackWorkspaceForOrganizationResult clone() {
        try {
            return (RegisterSlackWorkspaceForOrganizationResult) super.clone();
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
        }
    }

}


text:
package com.baidu.cc.configuration.bo;

/**
 * This bo is map to table : cc_user Table description : .
 *
 * @author BJF
 */
public class User extends UserBase {
    /** serial Version UID. */
    private static final long serialVersionUID = -1L;

    /** status value of ok. */
    public static final byte STAUTS_OK = 0;
}


text:
using UnityEngine;
using System.Collections;

[ExecuteInEditMode]
public class StickFigureRenderer : MonoBehaviour {

	public Transform[] joints;
	public LineRenderer lineRenderer;

	// Use this for initialization
	void Start () {
		lineRenderer.SetVertexCount(joints.Length);
	}

	// Update is called once per frame
	void Update () {
		for (int i = 0; i < joints.Length; i++)
		{
			lineRenderer.SetPosition(i, joints[i].position);
		}
	}
}


text:
cask 'klayout' do
  version '0.24.9'
  sha256 '3c439d3fc0b5779278d5ce606136edbd945a58be5059068a78baa420e008cc9f'

  # klayout.org was verified as official when first introduced to the cask
  url "http://www.klayout.org/downloads/MacOS/klayout-#{version}-MacOSX-Yosemite-1-Qt487mp.dmg.bz2"
  name 'KLayout'
  homepage 'https://www.klayout.de/'

  suite 'KLayout'

  preflight do
    # There is no sub-folder in the DMG; the root *is* the folder
    FileUtils.mv(staged_path.children, staged_path.join('KLayout').tap(&:mkpath))
  end

  uninstall pkgutil: 'klayout.de',
            quit:    'klayout.de'
end


text:
<?php

namespace RdnException;

/**
 * If server was unable to locate the requested resource. The message is public.
 */
class NotFoundException extends HttpException
{
	protected $code = 404;
}


text:
create table t1 (i1 integer,i2 integer);

insert into t1 values (1,1),(2,2),(3,3);

alter table t1 add index idx (i1,i2);

select * from t1 order by 1,2;
-- MYSQL : OK, CUBRID should fail
alter table t1 change column i2 i2 char(2);

select * from t1 order by 1,2;

drop table t1;

-------------- compound index , type changes , name changes
create table t1 (i1 integer,i2 integer);

insert into t1 values (1,1),(2,2),(3,3);

alter table t1 add index idx (i1,i2);

select * from t1 order by 1,2;

show columns in t1;
-- MYSQL : OK, CUBRID should fail
alter table t1 change column i2 c2 char(2);

select * from t1 order by 1,2;
show columns in t1;

drop table t1;

-------------- compound index , type changes, same name
create table t1 (i1 integer,i2 integer);

insert into t1 values (1,1),(2,2),(3,3);

alter table t1 add index idx (i1,i2);

show columns in t1;

select * from t1 order by 1,2;
-- OK:
alter table t1 change column i2 i2 char(11);

show columns in t1;

select * from t1 order by 1,2;

drop table t1;


text:
namespace Microsoft.Azure.Management.Network
{
    using Microsoft.Rest;
    using Microsoft.Rest.Azure;
    using Models;
    using System.Threading;
    using System.Threading.Tasks;

    /// <summary>
    /// Extension methods for VirtualNetworkGatewayConnectionsOperations.
    /// </summary>
    public static partial class VirtualNetworkGatewayConnectionsOperationsExtensions
    {
            /// <summary>
            /// Creates or updates a virtual network gateway connection in the specified
            /// resource group.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='virtualNetworkGatewayConnectionName'>
            /// The name of the virtual network gateway connection.
            /// </param>
            /// <param name='parameters'>
            /// Parameters supplied to the create or update virtual network gateway
            /// connection operation.
            /// </param>
            public static VirtualNetworkGatewayConnection CreateOrUpdate(this IVirtualNetworkGatewayConnectionsOperations operations, string resourceGroupName, string virtualNetworkGatewayConnectionName, VirtualNetworkGatewayConnection parameters)
            {
                return operations.CreateOrUpdateAsync(resourceGroupName, virtualNetworkGatewayConnectionName, parameters).GetAwaiter().GetResult();
            }

            /// <summary>
            /// Creates or updates a virtual network gateway connection in the specified
            /// resource group.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='virtualNetworkGatewayConnectionName'>
            /// The name of the virtual network gateway connection.
            /// </param>
            /// <param name='parameters'>
            /// Parameters supplied to the create or update virtual network gateway
            /// connection operation.
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async Task<VirtualNetworkGatewayConnection> CreateOrUpdateAsync(this IVirtualNetworkGatewayConnectionsOperations operations, string resourceGroupName, string virtualNetworkGatewayConnectionName, VirtualNetworkGatewayConnection parameters, CancellationToken cancellationToken = default(CancellationToken))
            {
                using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, null, cancellationToken).ConfigureAwait(false))
                {
                    return _result.Body;
                }
            }

            /// <summary>
            /// Gets the specified virtual network gateway connection by resource group.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='virtualNetworkGatewayConnectionName'>
            /// The name of the virtual network gateway connection.
            /// </param>
            public static VirtualNetworkGatewayConnection Get(this IVirtualNetworkGatewayConnectionsOperations operations, string resourceGroupName, string virtualNetworkGatewayConnectionName)
            {
                return operations.GetAsync(resourceGroupName, virtualNetworkGatewayConnectionName).GetAwaiter().GetResult();
            }

            /// <summary>
            /// Gets the specified virtual network gateway connection by resource group.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='virtualNetworkGatewayConnectionName'>
            /// The name of the virtual network gateway connection.
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async Task<VirtualNetworkGatewayConnection> GetAsync(this IVirtualNetworkGatewayConnectionsOperations operations, string resourceGroupName, string virtualNetworkGatewayConnectionName, CancellationToken cancellationToken = default(CancellationToken))
            {
                using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, virtualNetworkGatewayConnectionName, null, cancellationToken).ConfigureAwait(false))
                {
                    return _result.Body;
                }
            }

            /// <summary>
            /// Deletes the specified virtual network Gateway connection.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='virtualNetworkGatewayConnectionName'>
            /// The name of the virtual network gateway connection.
            /// </param>
            public static void Delete(this IVirtualNetworkGatewayConnectionsOperations operations, string resourceGroupName, string virtualNetworkGatewayConnectionName)
            {
                operations.DeleteAsync(resourceGroupName, virtualNetworkGatewayConnectionName).GetAwaiter().GetResult();
            }

            /// <summary>
            /// Deletes the specified virtual network Gateway connection.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='virtualNetworkGatewayConnectionName'>
            /// The name of the virtual network gateway connection.
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async Task DeleteAsync(this IVirtualNetworkGatewayConnectionsOperations operations, string resourceGroupName, string virtualNetworkGatewayConnectionName, CancellationToken cancellationToken = default(CancellationToken))
            {
                (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, virtualNetworkGatewayConnectionName, null, cancellationToken).ConfigureAwait(false)).Dispose();
            }

            /// <summary>
            /// Updates a virtual network gateway connection tags.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='virtualNetworkGatewayConnectionName'>
            /// The name of the virtual network gateway connection.
            /// </param>
            /// <param name='parameters'>
            /// Parameters supplied to update virtual network gateway connection tags.
            /// </param>
            public static VirtualNetworkGatewayConnectionListEntity UpdateTags(this IVirtualNetworkGatewayConnectionsOperations operations, string resourceGroupName, string virtualNetworkGatewayConnectionName, TagsObject parameters)
            {
                return operations.UpdateTagsAsync(resourceGroupName, virtualNetworkGatewayConnectionName, parameters).GetAwaiter().GetResult();
            }

            /// <summary>
            /// Updates a virtual network gateway connection tags.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='virtualNetworkGatewayConnectionName'>
            /// The name of the virtual network gateway connection.
            /// </param>
            /// <param name='parameters'>
            /// Parameters supplied to update virtual network gateway connection tags.
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async Task<VirtualNetworkGatewayConnectionListEntity> UpdateTagsAsync(this IVirtualNetworkGatewayConnectionsOperations operations, string resourceGroupName, string virtualNetworkGatewayConnectionName, TagsObject parameters, CancellationToken cancellationToken = default(CancellationToken))
            {
                using (var _result = await operations.UpdateTagsWithHttpMessagesAsync(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, null, cancellationToken).ConfigureAwait(false))
                {
                    return _result.Body;
                }
            }

            /// <summary>
            /// The Put VirtualNetworkGatewayConnectionSharedKey operation sets the virtual
            /// network gateway connection shared key for passed virtual network gateway
            /// connection in the specified resource group through Network resource
            /// provider.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='virtualNetworkGatewayConnectionName'>
            /// The virtual network gateway connection name.
            /// </param>
            /// <param name='parameters'>
            /// Parameters supplied to the Begin Set Virtual Network Gateway connection
            /// Shared key operation throughNetwork resource provider.
            /// </param>
            public static ConnectionSharedKey SetSharedKey(this IVirtualNetworkGatewayConnectionsOperations operations, string resourceGroupName, string virtualNetworkGatewayConnectionName, ConnectionSharedKey parameters)
            {
                return operations.SetSharedKeyAsync(resourceGroupName, virtualNetworkGatewayConnectionName, parameters).GetAwaiter().GetResult();
            }

            /// <summary>
            /// The Put VirtualNetworkGatewayConnectionSharedKey operation sets the virtual
            /// network gateway connection shared key for passed virtual network gateway
            /// connection in the specified resource group through Network resource
            /// provider.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='virtualNetworkGatewayConnectionName'>
            /// The virtual network gateway connection name.
            /// </param>
            /// <param name='parameters'>
            /// Parameters supplied to the Begin Set Virtual Network Gateway connection
            /// Shared key operation throughNetwork resource provider.
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async Task<ConnectionSharedKey> SetSharedKeyAsync(this IVirtualNetworkGatewayConnectionsOperations operations, string resourceGroupName, string virtualNetworkGatewayConnectionName, ConnectionSharedKey parameters, CancellationToken cancellationToken = default(CancellationToken))
            {
                using (var _result = await operations.SetSharedKeyWithHttpMessagesAsync(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, null, cancellationToken).ConfigureAwait(false))
                {
                    return _result.Body;
                }
            }

            /// <summary>
            /// The Get VirtualNetworkGatewayConnectionSharedKey operation retrieves
            /// information about the specified virtual network gateway connection shared
            /// key through Network resource provider.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='virtualNetworkGatewayConnectionName'>
            /// The virtual network gateway connection shared key name.
            /// </param>
            public static ConnectionSharedKey GetSharedKey(this IVirtualNetworkGatewayConnectionsOperations operations, string resourceGroupName, string virtualNetworkGatewayConnectionName)
            {
                return operations.GetSharedKeyAsync(resourceGroupName, virtualNetworkGatewayConnectionName).GetAwaiter().GetResult();
            }

            /// <summary>
            /// The Get VirtualNetworkGatewayConnectionSharedKey operation retrieves
            /// information about the specified virtual network gateway connection shared
            /// key through Network resource provider.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='virtualNetworkGatewayConnectionName'>
            /// The virtual network gateway connection shared key name.
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async Task<ConnectionSharedKey> GetSharedKeyAsync(this IVirtualNetworkGatewayConnectionsOperations operations, string resourceGroupName, string virtualNetworkGatewayConnectionName, CancellationToken cancellationToken = default(CancellationToken))
            {
                using (var _result = await operations.GetSharedKeyWithHttpMessagesAsync(resourceGroupName, virtualNetworkGatewayConnectionName, null, cancellationToken).ConfigureAwait(false))
                {
                    return _result.Body;
                }
            }

            /// <summary>
            /// The List VirtualNetworkGatewayConnections operation retrieves all the
            /// virtual network gateways connections created.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            public static IPage<VirtualNetworkGatewayConnection> List(this IVirtualNetworkGatewayConnectionsOperations operations, string resourceGroupName)
            {
                return operations.ListAsync(resourceGroupName).GetAwaiter().GetResult();
            }

            /// <summary>
            /// The List VirtualNetworkGatewayConnections operation retrieves all the
            /// virtual network gateways connections created.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async Task<IPage<VirtualNetworkGatewayConnection>> ListAsync(this IVirtualNetworkGatewayConnectionsOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken))
            {
                using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false))
                {
                    return _result.Body;
                }
            }

            /// <summary>
            /// The VirtualNetworkGatewayConnectionResetSharedKey operation resets the
            /// virtual network gateway connection shared key for passed virtual network
            /// gateway connection in the specified resource group through Network resource
            /// provider.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='virtualNetworkGatewayConnectionName'>
            /// The virtual network gateway connection reset shared key Name.
            /// </param>
            /// <param name='parameters'>
            /// Parameters supplied to the begin reset virtual network gateway connection
            /// shared key operation through network resource provider.
            /// </param>
            public static ConnectionResetSharedKey ResetSharedKey(this IVirtualNetworkGatewayConnectionsOperations operations, string resourceGroupName, string virtualNetworkGatewayConnectionName, ConnectionResetSharedKey parameters)
            {
                return operations.ResetSharedKeyAsync(resourceGroupName, virtualNetworkGatewayConnectionName, parameters).GetAwaiter().GetResult();
            }

            /// <summary>
            /// The VirtualNetworkGatewayConnectionResetSharedKey operation resets the
            /// virtual network gateway connection shared key for passed virtual network
            /// gateway connection in the specified resource group through Network resource
            /// provider.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='virtualNetworkGatewayConnectionName'>
            /// The virtual network gateway connection reset shared key Name.
            /// </param>
            /// <param name='parameters'>
            /// Parameters supplied to the begin reset virtual network gateway connection
            /// shared key operation through network resource provider.
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async Task<ConnectionResetSharedKey> ResetSharedKeyAsync(this IVirtualNetworkGatewayConnectionsOperations operations, string resourceGroupName, string virtualNetworkGatewayConnectionName, ConnectionResetSharedKey parameters, CancellationToken cancellationToken = default(CancellationToken))
            {
                using (var _result = await operations.ResetSharedKeyWithHttpMessagesAsync(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, null, cancellationToken).ConfigureAwait(false))
                {
                    return _result.Body;
                }
            }

            /// <summary>
            /// Creates or updates a virtual network gateway connection in the specified
            /// resource group.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='virtualNetworkGatewayConnectionName'>
            /// The name of the virtual network gateway connection.
            /// </param>
            /// <param name='parameters'>
            /// Parameters supplied to the create or update virtual network gateway
            /// connection operation.
            /// </param>
            public static VirtualNetworkGatewayConnection BeginCreateOrUpdate(this IVirtualNetworkGatewayConnectionsOperations operations, string resourceGroupName, string virtualNetworkGatewayConnectionName, VirtualNetworkGatewayConnection parameters)
            {
                return operations.BeginCreateOrUpdateAsync(resourceGroupName, virtualNetworkGatewayConnectionName, parameters).GetAwaiter().GetResult();
            }

            /// <summary>
            /// Creates or updates a virtual network gateway connection in the specified
            /// resource group.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='virtualNetworkGatewayConnectionName'>
            /// The name of the virtual network gateway connection.
            /// </param>
            /// <param name='parameters'>
            /// Parameters supplied to the create or update virtual network gateway
            /// connection operation.
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async Task<VirtualNetworkGatewayConnection> BeginCreateOrUpdateAsync(this IVirtualNetworkGatewayConnectionsOperations operations, string resourceGroupName, string virtualNetworkGatewayConnectionName, VirtualNetworkGatewayConnection parameters, CancellationToken cancellationToken = default(CancellationToken))
            {
                using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, null, cancellationToken).ConfigureAwait(false))
                {
                    return _result.Body;
                }
            }

            /// <summary>
            /// Deletes the specified virtual network Gateway connection.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='virtualNetworkGatewayConnectionName'>
            /// The name of the virtual network gateway connection.
            /// </param>
            public static void BeginDelete(this IVirtualNetworkGatewayConnectionsOperations operations, string resourceGroupName, string virtualNetworkGatewayConnectionName)
            {
                operations.BeginDeleteAsync(resourceGroupName, virtualNetworkGatewayConnectionName).GetAwaiter().GetResult();
            }

            /// <summary>
            /// Deletes the specified virtual network Gateway connection.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='virtualNetworkGatewayConnectionName'>
            /// The name of the virtual network gateway connection.
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async Task BeginDeleteAsync(this IVirtualNetworkGatewayConnectionsOperations operations, string resourceGroupName, string virtualNetworkGatewayConnectionName, CancellationToken cancellationToken = default(CancellationToken))
            {
                (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, virtualNetworkGatewayConnectionName, null, cancellationToken).ConfigureAwait(false)).Dispose();
            }

            /// <summary>
            /// Updates a virtual network gateway connection tags.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='virtualNetworkGatewayConnectionName'>
            /// The name of the virtual network gateway connection.
            /// </param>
            /// <param name='parameters'>
            /// Parameters supplied to update virtual network gateway connection tags.
            /// </param>
            public static VirtualNetworkGatewayConnectionListEntity BeginUpdateTags(this IVirtualNetworkGatewayConnectionsOperations operations, string resourceGroupName, string virtualNetworkGatewayConnectionName, TagsObject parameters)
            {
                return operations.BeginUpdateTagsAsync(resourceGroupName, virtualNetworkGatewayConnectionName, parameters).GetAwaiter().GetResult();
            }

            /// <summary>
            /// Updates a virtual network gateway connection tags.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='virtualNetworkGatewayConnectionName'>
            /// The name of the virtual network gateway connection.
            /// </param>
            /// <param name='parameters'>
            /// Parameters supplied to update virtual network gateway connection tags.
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async Task<VirtualNetworkGatewayConnectionListEntity> BeginUpdateTagsAsync(this IVirtualNetworkGatewayConnectionsOperations operations, string resourceGroupName, string virtualNetworkGatewayConnectionName, TagsObject parameters, CancellationToken cancellationToken = default(CancellationToken))
            {
                using (var _result = await operations.BeginUpdateTagsWithHttpMessagesAsync(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, null, cancellationToken).ConfigureAwait(false))
                {
                    return _result.Body;
                }
            }

            /// <summary>
            /// The Put VirtualNetworkGatewayConnectionSharedKey operation sets the virtual
            /// network gateway connection shared key for passed virtual network gateway
            /// connection in the specified resource group through Network resource
            /// provider.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='virtualNetworkGatewayConnectionName'>
            /// The virtual network gateway connection name.
            /// </param>
            /// <param name='parameters'>
            /// Parameters supplied to the Begin Set Virtual Network Gateway connection
            /// Shared key operation throughNetwork resource provider.
            /// </param>
            public static ConnectionSharedKey BeginSetSharedKey(this IVirtualNetworkGatewayConnectionsOperations operations, string resourceGroupName, string virtualNetworkGatewayConnectionName, ConnectionSharedKey parameters)
            {
                return operations.BeginSetSharedKeyAsync(resourceGroupName, virtualNetworkGatewayConnectionName, parameters).GetAwaiter().GetResult();
            }

            /// <summary>
            /// The Put VirtualNetworkGatewayConnectionSharedKey operation sets the virtual
            /// network gateway connection shared key for passed virtual network gateway
            /// connection in the specified resource group through Network resource
            /// provider.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='virtualNetworkGatewayConnectionName'>
            /// The virtual network gateway connection name.
            /// </param>
            /// <param name='parameters'>
            /// Parameters supplied to the Begin Set Virtual Network Gateway connection
            /// Shared key operation throughNetwork resource provider.
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async Task<ConnectionSharedKey> BeginSetSharedKeyAsync(this IVirtualNetworkGatewayConnectionsOperations operations, string resourceGroupName, string virtualNetworkGatewayConnectionName, ConnectionSharedKey parameters, CancellationToken cancellationToken = default(CancellationToken))
            {
                using (var _result = await operations.BeginSetSharedKeyWithHttpMessagesAsync(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, null, cancellationToken).ConfigureAwait(false))
                {
                    return _result.Body;
                }
            }

            /// <summary>
            /// The VirtualNetworkGatewayConnectionResetSharedKey operation resets the
            /// virtual network gateway connection shared key for passed virtual network
            /// gateway connection in the specified resource group through Network resource
            /// provider.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='virtualNetworkGatewayConnectionName'>
            /// The virtual network gateway connection reset shared key Name.
            /// </param>
            /// <param name='parameters'>
            /// Parameters supplied to the begin reset virtual network gateway connection
            /// shared key operation through network resource provider.
            /// </param>
            public static ConnectionResetSharedKey BeginResetSharedKey(this IVirtualNetworkGatewayConnectionsOperations operations, string resourceGroupName, string virtualNetworkGatewayConnectionName, ConnectionResetSharedKey parameters)
            {
                return operations.BeginResetSharedKeyAsync(resourceGroupName, virtualNetworkGatewayConnectionName, parameters).GetAwaiter().GetResult();
            }

            /// <summary>
            /// The VirtualNetworkGatewayConnectionResetSharedKey operation resets the
            /// virtual network gateway connection shared key for passed virtual network
            /// gateway connection in the specified resource group through Network resource
            /// provider.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='resourceGroupName'>
            /// The name of the resource group.
            /// </param>
            /// <param name='virtualNetworkGatewayConnectionName'>
            /// The virtual network gateway connection reset shared key Name.
            /// </param>
            /// <param name='parameters'>
            /// Parameters supplied to the begin reset virtual network gateway connection
            /// shared key operation through network resource provider.
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async Task<ConnectionResetSharedKey> BeginResetSharedKeyAsync(this IVirtualNetworkGatewayConnectionsOperations operations, string resourceGroupName, string virtualNetworkGatewayConnectionName, ConnectionResetSharedKey parameters, CancellationToken cancellationToken = default(CancellationToken))
            {
                using (var _result = await operations.BeginResetSharedKeyWithHttpMessagesAsync(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, null, cancellationToken).ConfigureAwait(false))
                {
                    return _result.Body;
                }
            }

            /// <summary>
            /// The List VirtualNetworkGatewayConnections operation retrieves all the
            /// virtual network gateways connections created.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='nextPageLink'>
            /// The NextLink from the previous successful call to List operation.
            /// </param>
            public static IPage<VirtualNetworkGatewayConnection> ListNext(this IVirtualNetworkGatewayConnectionsOperations operations, string nextPageLink)
            {
                return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult();
            }

            /// <summary>
            /// The List VirtualNetworkGatewayConnections operation retrieves all the
            /// virtual network gateways connections created.
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='nextPageLink'>
            /// The NextLink from the previous successful call to List operation.
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async Task<IPage<VirtualNetworkGatewayConnection>> ListNextAsync(this IVirtualNetworkGatewayConnectionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken))
            {
                using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false))
                {
                    return _result.Body;
                }
            }

    }
}


text:
package com.linkedin.norbert
package network
package netty

import java.net.InetSocketAddress
import java.util.UUID

import com.linkedin.norbert.cluster.{InvalidNodeException, Node}
import com.linkedin.norbert.network.common.{AlwaysAvailableRequestStrategy, CachedNetworkStatistics}
import com.linkedin.norbert.util.WaitFor
import org.jboss.netty.bootstrap.ClientBootstrap
import org.specs2.mock.Mockito
import org.specs2.mutable.SpecificationWithJUnit
import org.specs2.specification.Scope

class NettyClusterIoClientComponentSpec extends SpecificationWithJUnit with Mockito with WaitFor {

  trait NettyClusterIoClientSetup extends Scope with NettyClusterIoClientComponent {
    val messageRegistry = null

    val channelPoolFactory = mock[ChannelPoolFactory]
    val channelPool = mock[ChannelPool]

    val clusterIoClient = new NettyClusterIoClient(channelPoolFactory, AlwaysAvailableRequestStrategy)

    val node = Node(1, "localhost:31313", true)
    val address = new InetSocketAddress("localhost", 31313)
  }

  "NettyClusterIoClient" should {
    "create a new ChannelPool if no pool is available" in new NettyClusterIoClientSetup {
      doNothing.when(channelPool).sendRequest(any[Request[_, _]])
      channelPoolFactory.newChannelPool(address) returns channelPool

      clusterIoClient.sendMessage(node, mock[Request[_, _]])

      got {
        one(channelPool).sendRequest(any[Request[_, _]])
        one(channelPoolFactory).newChannelPool(address)
      }
    }

    "not create a ChannelPool if a pool is available" in new NettyClusterIoClientSetup {
      channelPoolFactory.newChannelPool(address) returns channelPool
      doNothing.when(channelPool).sendRequest(any[Request[_, _]])

      clusterIoClient.sendMessage(node, mock[Request[_, _]])
      clusterIoClient.sendMessage(node, mock[Request[_, _]])

      got {
        two(channelPool).sendRequest(any[Request[_, _]])
        one(channelPoolFactory).newChannelPool(address)
      }
    }

    "close an open ChannelPool if the Node is no longer available" in new NettyClusterIoClientSetup {
      doNothing.when(channelPool).sendRequest(any[Request[_, _]])
      doNothing.when(channelPool).close
      channelPoolFactory.newChannelPool(address) returns channelPool

      clusterIoClient.sendMessage(node, mock[Request[_, _]])
      clusterIoClient.nodesChanged(Set())

      got {
        one(channelPoolFactory).newChannelPool(address)
        one(channelPool).close
      }
    }

    "throw an InvalidNodeException if a Node with an invalid url is provided" in new NettyClusterIoClientSetup {
      channelPoolFactory.newChannelPool(address) returns channelPool
      clusterIoClient.sendMessage(Node(1, "foo", true), mock[Request[_, _]]) must throwA[InvalidNodeException]
      clusterIoClient.sendMessage(Node(1, "foo:foo", true), mock[Request[_, _]]) must throwA[InvalidNodeException]
    }

    "close all ChannelPools when shutdown is called" in new NettyClusterIoClientSetup {
      channelPoolFactory.newChannelPool(address) returns channelPool
      doNothing.when(channelPool).close
      doNothing.when(channelPoolFactory).shutdown

      clusterIoClient.sendMessage(node, mock[Request[_, _]])
      clusterIoClient.shutdown

      got {
        one(channelPool).close
        one(channelPoolFactory).shutdown
      }
    }

    "retry sending a request a fixed number of times" in new NettyClusterIoClientSetup {
      // we need an actual ChannelPool object here as we have to invoke the close method on it.
      val dummyPool = new ChannelPoolFactory(1, 1, 1, mock[ClientBootstrap], None, 1, 1, 1L, mock[CachedNetworkStatistics[Node, UUID]]).newChannelPool(address)
      dummyPool.close
      channelPoolFactory.newChannelPool(address) returns dummyPool
      clusterIoClient.sendMessage(node, mock[Request[_, _]]) must throwA[InvalidNodeException]
    }
  }
}


text:
'use strict';

const util = require('util');
const errors = require('../errors');

/** @module policies/speculativeExecution */

/**
 * @classdesc
 * The policy that decides if the driver will send speculative queries to the next hosts when the current host takes too
 * long to respond.
 *
Note that only idempotent statements will be speculatively retried.

 * @constructor
 * @abstract
 */
function SpeculativeExecutionPolicy() {

}

/**
 * Initialization method that gets invoked on Client startup.
 * @param {Client} client
 * @abstract
 */
SpeculativeExecutionPolicy.prototype.init = function (client) {

};

/**
 * Gets invoked at client shutdown, giving the opportunity to the implementor to perform cleanup.
 * @abstract
 */
SpeculativeExecutionPolicy.prototype.shutdown = function () {

};

/**
 * Gets the plan to use for a new query.
 * Returns an object with a nextExecution() method, which returns a positive number representing the
 * amount of milliseconds to delay the next execution or a non-negative number to avoid further executions.
 * @param {String} keyspace The currently logged keyspace.
 * @param {String|Array<String>} queryInfo The query, or queries in the case of batches, for which to build a plan.
 * @return {{nextExecution: function}}
 * @abstract
 */
SpeculativeExecutionPolicy.prototype.newPlan = function (keyspace, queryInfo) {
  throw new Error('You must implement newPlan() method in the SpeculativeExecutionPolicy');
};

/**
 * Gets an associative array containing the policy options.
 */
SpeculativeExecutionPolicy.prototype.getOptions = function () {
  return new Map();
};

/**
 * Creates a new instance of NoSpeculativeExecutionPolicy.
 * @classdesc
 * A {@link SpeculativeExecutionPolicy} that never schedules speculative executions.
 * @constructor
 * @extends {SpeculativeExecutionPolicy}
 */
function NoSpeculativeExecutionPolicy() {
  this._plan = {
    nextExecution: function () {
      return -1;
    }
  };
}

util.inherits(NoSpeculativeExecutionPolicy, SpeculativeExecutionPolicy);

NoSpeculativeExecutionPolicy.prototype.newPlan = function () {
  return this._plan;
};

/**
 * Creates a new instance of ConstantSpeculativeExecutionPolicy.
 * @classdesc
 * A {@link SpeculativeExecutionPolicy} that schedules a given number of speculative executions,
 * separated by a fixed delay.
 * @constructor
 * @param {Number} delay The delay between each speculative execution.
 * @param {Number} maxSpeculativeExecutions The amount of speculative executions that should be scheduled after the
 * initial execution. Must be strictly positive.
 * @extends {SpeculativeExecutionPolicy}
 */
function ConstantSpeculativeExecutionPolicy(delay, maxSpeculativeExecutions) {
  if (!(delay >= 0)) {
    throw new errors.ArgumentError('delay must be a positive number or zero');
  }
  if (!(maxSpeculativeExecutions > 0)) {
    throw new errors.ArgumentError('maxSpeculativeExecutions must be a positive number');
  }
  this._delay = delay;
  this._maxSpeculativeExecutions = maxSpeculativeExecutions;
}

util.inherits(ConstantSpeculativeExecutionPolicy, SpeculativeExecutionPolicy);

ConstantSpeculativeExecutionPolicy.prototype.newPlan = function () {
  let executions = 0;
  const self = this;
  return {
    nextExecution: function () {
      if (executions++ < self._maxSpeculativeExecutions) {
        return self._delay;
      }
      return -1;
    }
  };
};

/**
 * Gets an associative array containing the policy options.
 */
ConstantSpeculativeExecutionPolicy.prototype.getOptions = function () {
  return new Map([
    ['delay', this._delay ],
    ['maxSpeculativeExecutions', this._maxSpeculativeExecutions ]
  ]);
};

exports.NoSpeculativeExecutionPolicy = NoSpeculativeExecutionPolicy;
exports.SpeculativeExecutionPolicy = SpeculativeExecutionPolicy;
exports.ConstantSpeculativeExecutionPolicy = ConstantSpeculativeExecutionPolicy;


text:
package org.dasein.cloud.network;

public enum VpnState {
    PENDING, AVAILABLE, DELETING, DELETED;
}


text:
package io.github.resilience4j.ratelimiter.autoconfigure;

import io.github.resilience4j.ratelimiter.RateLimiterConfig;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.time.Duration;
import java.util.HashMap;
import java.util.Map;

@ConfigurationProperties(prefix = "resilience4j.ratelimiter")
@Component
public class RateLimiterProperties {
    // This property gives you control over RateLimiter aspect application order.
    // Integer.MAX_VALUE means that RateLimiter aspect will be last one applied to any decorated bean.
    // It also means that by default RateLimiter will be executed AFTER CircuitBreaker.
    // Be adjusting RateLimiterProperties.rateLimiterAspectOrder and CircuitBreakerProperties.circuitBreakerAspectOrder
    // you explicitly define aspects CircuitBreaker and RateLimiter execution sequence.
    private int rateLimiterAspectOrder = Integer.MAX_VALUE;
    private Map<String, LimiterProperties> limiters = new HashMap<>();

    private LimiterProperties getLimiterProperties(String limiter) {
        return limiters.get(limiter);
    }

    public RateLimiterConfig createRateLimiterConfig(String limiter) {
        return createRateLimiterConfig(getLimiterProperties(limiter));
    }

    public int getRateLimiterAspectOrder() {
        return rateLimiterAspectOrder;
    }

    public void setRateLimiterAspectOrder(int rateLimiterAspectOrder) {
        this.rateLimiterAspectOrder = rateLimiterAspectOrder;
    }

    public static RateLimiterConfig createRateLimiterConfig(LimiterProperties limiterProperties) {
        if (limiterProperties == null) {
            return RateLimiterConfig.ofDefaults();
        }

        RateLimiterConfig.Builder rateLimiterConfigBuilder = RateLimiterConfig.custom();

        if (limiterProperties.getLimitForPeriod() != null) {
            rateLimiterConfigBuilder.limitForPeriod(limiterProperties.getLimitForPeriod());
        }

        if (limiterProperties.getLimitRefreshPeriodInMillis() != null) {
            rateLimiterConfigBuilder.limitRefreshPeriod(Duration.ofMillis(limiterProperties.getLimitRefreshPeriodInMillis()));
        }

        if (limiterProperties.getTimeoutInMillis() != null) {
            rateLimiterConfigBuilder.timeoutDuration(Duration.ofMillis(limiterProperties.getTimeoutInMillis()));
        }

        return rateLimiterConfigBuilder.build();
    }

    public Map<String, LimiterProperties> getLimiters() {
        return limiters;
    }

    /**
     * Class storing property values for configuring {@link io.github.resilience4j.ratelimiter.RateLimiterConfig} instances.
     */
    public static class LimiterProperties {

        private Integer limitForPeriod;
        private Integer limitRefreshPeriodInMillis;
        private Integer timeoutInMillis;
        private Boolean subscribeForEvents = false;
        private Boolean registerHealthIndicator = false;
        private Integer eventConsumerBufferSize = 100;

        /**
         * Configures the permissions limit for refresh period.
         * Count of permissions available during one rate limiter period
         * specified by {@link RateLimiterConfig#limitRefreshPeriod} value.
         * Default value is 50.
         *
         * @return the permissions limit for refresh period
         */
        public Integer getLimitForPeriod() {
            return limitForPeriod;
        }

        /**
         * Configures the permissions limit for refresh period.
         * Count of permissions available during one rate limiter period
         * specified by {@link RateLimiterConfig#limitRefreshPeriod} value.
         * Default value is 50.
         *
         * @param limitForPeriod the permissions limit for refresh period
         */
        public void setLimitForPeriod(Integer limitForPeriod) {
            this.limitForPeriod = limitForPeriod;
        }

        /**
         * Configures the period of limit refresh.
         * After each period rate limiter sets its permissions
         * count to {@link RateLimiterConfig#limitForPeriod} value.
         * Default value is 500 nanoseconds.
         *
         * @return the period of limit refresh
         */
        public Integer getLimitRefreshPeriodInMillis() {
            return limitRefreshPeriodInMillis;
        }

        /**
         * Configures the period of limit refresh.
         * After each period rate limiter sets its permissions
         * count to {@link RateLimiterConfig#limitForPeriod} value.
         * Default value is 500 nanoseconds.
         *
         * @param limitRefreshPeriodInMillis the period of limit refresh
         */
        public void setLimitRefreshPeriodInMillis(Integer limitRefreshPeriodInMillis) {
            this.limitRefreshPeriodInMillis = limitRefreshPeriodInMillis;
        }

        /**
         * Configures the default wait for permission duration.
         * Default value is 5 seconds.
         *
         * @return wait for permission duration
         */
        public Integer getTimeoutInMillis() {
            return timeoutInMillis;
        }

        /**
         * Configures the default wait for permission duration.
         * Default value is 5 seconds.
         *
         * @param timeoutInMillis wait for permission duration
         */
        public void setTimeoutInMillis(Integer timeoutInMillis) {
            this.timeoutInMillis = timeoutInMillis;
        }

        public Boolean getSubscribeForEvents() {
            return subscribeForEvents;
        }

        public void setSubscribeForEvents(Boolean subscribeForEvents) {
            this.subscribeForEvents = subscribeForEvents;
        }

        public Integer getEventConsumerBufferSize() {
            return eventConsumerBufferSize;
        }

        public void setEventConsumerBufferSize(Integer eventConsumerBufferSize) {
            this.eventConsumerBufferSize = eventConsumerBufferSize;
        }

        public Boolean getRegisterHealthIndicator() {
            return registerHealthIndicator;
        }

        public void setRegisterHealthIndicator(Boolean registerHealthIndicator) {
            this.registerHealthIndicator = registerHealthIndicator;
        }
    }

}


text:
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "nsDOMMessageEvent.h"
#include "nsContentUtils.h"
#include "jsapi.h"
#include "nsDOMClassInfoID.h"

NS_IMPL_CYCLE_COLLECTION_CLASS(nsDOMMessageEvent)

NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsDOMMessageEvent, nsDOMEvent)
  if (tmp->mDataRooted) {
    tmp->UnrootData();
  }
  NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mSource)
NS_IMPL_CYCLE_COLLECTION_UNLINK_END

NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsDOMMessageEvent, nsDOMEvent)
  NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
  NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mSource)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END

NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsDOMMessageEvent)
  NS_IMPL_CYCLE_COLLECTION_TRACE_JSVAL_MEMBER_CALLBACK(mData)
NS_IMPL_CYCLE_COLLECTION_TRACE_END

DOMCI_DATA(MessageEvent, nsDOMMessageEvent)

NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsDOMMessageEvent)
  NS_INTERFACE_MAP_ENTRY(nsIDOMMessageEvent)
  NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(MessageEvent)
NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent)

NS_IMPL_ADDREF_INHERITED(nsDOMMessageEvent, nsDOMEvent)
NS_IMPL_RELEASE_INHERITED(nsDOMMessageEvent, nsDOMEvent)

nsDOMMessageEvent::nsDOMMessageEvent(nsPresContext* aPresContext,
                                     nsEvent* aEvent)
  : nsDOMEvent(aPresContext, aEvent),
    mData(JSVAL_VOID),
    mDataRooted(false)
{
}

nsDOMMessageEvent::~nsDOMMessageEvent()
{
  if (mDataRooted)
    UnrootData();
}

void
nsDOMMessageEvent::RootData()
{
  NS_ASSERTION(!mDataRooted, "...");
  NS_HOLD_JS_OBJECTS(this, nsDOMMessageEvent);
  mDataRooted = true;
}

void
nsDOMMessageEvent::UnrootData()
{
  NS_ASSERTION(mDataRooted, "...");
  mDataRooted = false;
  mData = JSVAL_VOID;
  NS_DROP_JS_OBJECTS(this, nsDOMMessageEvent);
}

NS_IMETHODIMP
nsDOMMessageEvent::GetData(JSContext* aCx, jsval* aData)
{
  *aData = mData;
  if (!JS_WrapValue(aCx, aData))
    return NS_ERROR_FAILURE;
  return NS_OK;
}

NS_IMETHODIMP
nsDOMMessageEvent::GetOrigin(nsAString& aOrigin)
{
  aOrigin = mOrigin;
  return NS_OK;
}

NS_IMETHODIMP
nsDOMMessageEvent::GetLastEventId(nsAString& aLastEventId)
{
  aLastEventId = mLastEventId;
  return NS_OK;
}

NS_IMETHODIMP
nsDOMMessageEvent::GetSource(nsIDOMWindow** aSource)
{
  NS_IF_ADDREF(*aSource = mSource);
  return NS_OK;
}

NS_IMETHODIMP
nsDOMMessageEvent::InitMessageEvent(const nsAString& aType,
                                    bool aCanBubble,
                                    bool aCancelable,
                                    const jsval& aData,
                                    const nsAString& aOrigin,
                                    const nsAString& aLastEventId,
                                    nsIDOMWindow* aSource)
{
  nsresult rv = nsDOMEvent::InitEvent(aType, aCanBubble, aCancelable);
  NS_ENSURE_SUCCESS(rv, rv);

  // Allowing double-initialization seems a little silly, but we have a test
  // for it so it might be important ...
  if (mDataRooted)
    UnrootData();
  mData = aData;
  RootData();
  mOrigin = aOrigin;
  mLastEventId = aLastEventId;
  mSource = aSource;

  return NS_OK;
}

nsresult
NS_NewDOMMessageEvent(nsIDOMEvent** aInstancePtrResult,
                      nsPresContext* aPresContext,
                      nsEvent* aEvent)
{
  nsDOMMessageEvent* it = new nsDOMMessageEvent(aPresContext, aEvent);

  return CallQueryInterface(it, aInstancePtrResult);
}


text:
using System;
namespace _01.SchoolClasses
{
    // All Students, classes, teachers and disciplines could have optional comments
    class IOptionalComment
    {
        string Comment { get; set; }
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:visibility="gone" >

    <RatingBar
        android:id="@+id/review_form_rating"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:numStars="5"
        android:stepSize="1" />

    <EditText
        android:id="@+id/review_form_title"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_toLeftOf="@id/review_form_rating"
        android:hint="@string/review_form_title_hint"
        android:inputType="text|textCapSentences|textAutoCorrect"
        android:lines="1" />

    <EditText
        android:id="@+id/review_form_review"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/review_form_title"
        android:gravity="top"
        android:hint="@string/review_form_content_hint"
        android:inputType="text|textCapSentences|textAutoCorrect|textMultiLine"
        android:minLines="3"
        android:singleLine="false"
        android:visibility="gone" />

    <Button
        android:id="@+id/review_form_submit"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_below="@id/review_form_review"
        android:text="@string/submit"
        android:visibility="gone" />

    <Button
        android:id="@+id/review_form_cancel"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/review_form_review"
        android:layout_toLeftOf="@id/review_form_submit"
        android:text="@string/cancel"
        android:visibility="gone" />

</RelativeLayout>


text:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
 <item android:state_pressed="true" android:drawable="@color/color_9bccfc"/>
    <item android:drawable="@color/color_blue"/>
</selector>


text:
package com.amazonaws.geo.model;

import com.amazonaws.services.dynamodbv2.model.QueryRequest;

public class GeoQueryRequest extends GeoDataRequest {
	private QueryRequest queryRequest;

	public GeoQueryRequest() {
		queryRequest = new QueryRequest();
	}

	public QueryRequest getQueryRequest() {
		return queryRequest;
	}
}


text:
require "spec_helper"
require "support/shared/unit/resource/static_provider_resolution"

describe Chef::Resource::DeployRevision do

  static_provider_resolution(
    resource: Chef::Resource::DeployRevision,
    provider: Chef::Provider::Deploy::Revision,
    name: :deploy_revision,
    action: :deploy
  )

end

describe Chef::Resource::DeployBranch do

  static_provider_resolution(
    resource: Chef::Resource::DeployBranch,
    provider: Chef::Provider::Deploy::Revision,
    name: :deploy_branch,
    action: :deploy
  )

end


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="app_name"> 純真IP查詢</string>
</resources>


text:
package com.mailrest.maildal.model;

/**
 *  DomainVerificationStatus very in different situations
 *
 *  When domain just added it will have ACCEPTED status
 *  When domain successfully verified it will have VERIFIED status
 *  If some error happens in verification process then domain has FAILED status
 *  After N attempts domain marks as SUSPENDED and only User can restart verification in UI
 */

public enum DomainVerificationStatus {

	// New domain added for verification
	ACCEPTED,

	// Domain successfully verified
	VERIFIED,

	// Fail to verify domain
	FAILED,

	// Do not do periodic check
	SUSPENDED;

}