text:
package protocpl;

import java.net.InetSocketAddress;
import java.text.SimpleDateFormat;
import java.util.Date;

import org.apache.mina.core.buffer.IoBuffer;
import org.apache.mina.core.session.IoSession;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.jlj.model.Devlog;
import com.jlj.model.Sig;
import com.jlj.service.IDevlogService;
import com.jlj.service.ISigService;
import com.jlj.service.ISignpublicparamService;
import com.jlj.util.Commands;

import mina.CmdFactoryBase;
import mina.CommandBase;
import mina.DataConvertor;
import mina.ICmdParser;
import mina.TimeServerHandler;
import mina.CmdFactoryBase.MONITOR_CMD_TYPE;

public class JcCmdFactory extends CmdFactoryBase implements ICmdParser{

	final static ApplicationContext ac=new ClassPathXmlApplicationContext("beans.xml");
	final static ISigService sigService = (ISigService)ac.getBean("sigService");
	final static IDevlogService devlogService = (IDevlogService)ac.getBean("devlogService");
	private  static int datatype = 0;//表示集成软件请求命令类型
	public static String curruntSigNumber;//表示当前集成软件查询的信号机的编号
	public static int[][] trafficlights = new int[4][5];//表示当前集成软件查询的信号机的实时状态
	public static int[] Countdown = new int[4];//表示当前集成软件查询的信号机的倒计时
	public JcCmdFactory(byte[] data) {
		super(data);
		// TODO Auto-generated constructor stub
		this.expected_cmd = MONITOR_CMD_TYPE.MONITOR_CMD_UPLOAD;
	}

	@Override
	public void Process(IoSession session, CommandBase cmd) throws Exception {
		// TODO Auto-generated method stub
		super.Process(session, cmd);
//		if(cmd.getCmdType() == this.expected_cmd)
//		{
			OnAfter_Ack(session, cmd);
//		}
	}

	private void send_ack(IoSession session){
		String Reply_cmd = "FF FF FF FF 01 F0 9F 00 00 08 01 98";
		String[] cmds = Reply_cmd.split(" ");
        byte[] aaa = new byte[cmds.length];
        int i = 0;
        for (String b : cmds) {
            if (b.equals("FF")) {
                aaa[i++] = -1;
            } else {
                aaa[i++] = Integer.valueOf(b, 16).byteValue();;
            }
        }
        session.write(IoBuffer.wrap(aaa));
	}

	public int GetByeAckFlag(CommandBase cmd) {
		// TODO Auto-generated method stub
		return 0;
	}

	public IoSession getCurrrenSession(String sigNumber)
	{
		for(IoSession session : TimeServerHandler.iosessions)
		{
			if(session.getAttribute("number")!=null)
			{
				if(session.getAttribute("number").equals(sigNumber))
				{
					return session;
				}
			}
		}
		return null;
	}

	public boolean OnAfter_Ack(IoSession session, CommandBase cmd) throws InterruptedException {
		// TODO Auto-generated method stub
		//this.m_oData
		//获得的请求xml数据
		String request_xmlmsg = DataConvertor.hexString2String(DataConvertor.bytesToHexString(this.m_oData));

		//模拟这边已经全部获得了

		if(request_xmlmsg.contains("SIGNALSART"))
		{
			datatype = 1;//表示集成软件请求发送实时状态开始

			//需上传的实时状态String 数据
			String upload_realtime_xmlMsg  = xmlRealtimeHandler(request_xmlmsg);

			byte[] datas = DataConvertor.hexString2Bytes(upload_realtime_xmlMsg);

			Upload_Jcrealtime(datas);
		}
		else if(request_xmlmsg.contains("SIGNALEND"))
		{
			datatype = 2;//表示集成软件请求发送实时状态关闭

		}
		else if(request_xmlmsg.contains("MANUALCTLCONTROL"))
		{
			datatype = 3;//表示集成软件请求手动控制开始(按指定相位运行==特勤控制)

		}
		else if(request_xmlmsg.contains("MANUALCTLEND"))
		{
			datatype = 4;//示集成软件请求手动控制关闭

		}

//		if(this.m_oData[7]==1){
//			Upload_time(session,this.m_oData);
//		}else if(this.m_oData[7]==2){
//			Upload_fault(session,this.m_oData);
//		}

		return false;
	}

	//这是用来处理xml msg的方法,返回所需上传的dataString
	private String xmlRealtimeHandler(String request_xmlmsg) {
		//roadid
		String sigNumber = request_xmlmsg.substring(request_xmlmsg.indexOf("<roadid>")+8,request_xmlmsg.indexOf("</roadid>"));

		curruntSigNumber  =  sigNumber;//确定当前信号机编号

		//sourceIP
		String sourceIP = request_xmlmsg.substring(request_xmlmsg.indexOf("<sourceIP>")+10,request_xmlmsg.indexOf("</roadid>"));

		//targetIP
		String targetIP = request_xmlmsg.substring(request_xmlmsg.indexOf("<targetIP>")+10,request_xmlmsg.indexOf("</roadid>"));

		//user
		String user = request_xmlmsg.substring(request_xmlmsg.indexOf("<user>")+6,request_xmlmsg.indexOf("</roadid>"));

		//password
		String password = request_xmlmsg.substring(request_xmlmsg.indexOf("<password>")+10,request_xmlmsg.indexOf("</roadid>"));

		return "";
	}

	private void Upload_Jcrealtime(byte[] datas) throws InterruptedException {
		// TODO Auto-generated method stub
		if(datatype==1)
		{

			Upload_Jcrealtime(datas);
		}else if(datatype==2)
		{
			Upload_Stoprealtime();
		}
	}

	private void Upload_Stoprealtime() {
		// TODO Auto-generated method stub

	}

	public void UpdatePushTask() {
		// TODO Auto-generated method stub

	}

	public byte[] getSerialNum() {
		// TODO Auto-generated method stub
		return null;
	}

	public void setSerialNum(byte[] serial) {
		// TODO Auto-generated method stub

	}

	private void Upload_time(IoSession session,byte[] data){
		int year;
		int month;
		int day;
		int weak;
		int hour;
		int minute;
		int second;

		// 对应data[10]开始 7个字节

	}

	private void Upload_fault(IoSession session,byte[] data){
		int error = data[10]>>7;        //如果大于0 发生故障   等于0 排除故障
        if(error>0){
        	int year = (data[10]&0x7F);     //  年
	        int mounth = data[11];
	        int day = data[12];
	        int hour = data[13];
	        int minute = data[14];
	        int secound = data[15];

	        int error_code = data[16];

	        System.out.println("故障代码是"+(error_code&0x7f));

        	String time = year+"-"+mounth+"-"+day+" "+hour+":"+minute+":"+secound;
        	//获取session中的IP
//    		String clientIP = ((InetSocketAddress)session.getRemoteAddress()).getAddress().getHostAddress();
//    		Sig sig = sigService.querySigByIpAddress(clientIP);
        	String number = (String)session.getAttribute("number");
			Sig sig = sigService.querySigByNumber(number);

    		if(sig!=null){
    			//若当前状态为正常状态,录入故障信息并插入数据库
    			if(sig.getIserror()!=null&&sig.getIserror()==0){
    				try {
                		//录入故障日志
                    	Devlog devlog = new Devlog();
                    	devlog.setSig(sig);
                    	SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    					Date errorDate = sdf.parse(time);
    					devlog.setDevtime(errorDate);
    					String errormessage = Commands.error_codes[error_code];
    					devlog.setIserror(1);
    					devlog.setDevevent(errormessage);
    					devlogService.add(devlog);

    				} catch (Exception e) {
    					// TODO Auto-generated catch block
    					e.printStackTrace();
    				}
                	//修改当前信号机故障状态以及故障代码
        			int sigStatus = 1;
        			sigService.updateSigStatus(sigStatus,error_code,sig.getId());
    			}

    		}
        }
	}
}


text:
using Gx.Rs.Api.Util;
using RestSharp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Gx.Rs.Api.Options
{
    /// <summary>
    /// A REST API request options helper providing cache control features. This is similar to the <see cref="Preconditions"/> class, but applies
    /// inverse logic.
    /// </summary>
    public class CacheDirectives : IStateTransitionOption
    {
        private readonly String etag;
        private readonly DateTime? lastModified;

        /// <summary>
        /// Initializes a new instance of the <see cref="CacheDirectives" /> class.
        /// </summary>
        /// <param name="state">The state with an <see cref="P:GedcomxApplicationState.ETag" /> and <see cref="P:GedcomxApplicationState.LastModified" /> properties
        /// to use for cache control. See remarks.</param>
        /// <remarks>
        /// If the ETag (entity tag) specified here does not match the server's ETag for a resource, the resource will be returned; otherwise, a not-modified status
        /// is returned. The same applies to last modified. If the server's last modified date for a resource is greater than the last modified specified here, the
        /// resource will be returned; otherwise, a not-modified status is returned.
        /// </remarks>
        public CacheDirectives(GedcomxApplicationState state)
            : this(state.ETag, state.LastModified)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="CacheDirectives" /> class.
        /// </summary>
        /// <param name="lastModified">
        /// The last modified date to send to the server for evaluation. See remarks.
        /// </param>
        /// <remarks>
        /// If the server's last modified date for a resource is greater than the last modified specified here, the
        /// resource will be returned; otherwise, a not-modified status is returned.
        /// </remarks>
        public CacheDirectives(DateTime? lastModified)
            : this(null, lastModified)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="CacheDirectives"/> class.
        /// </summary>
        /// <param name="etag">The ETag to send to the server for evaluation. See remarks.</param>
        /// <remarks>
        /// If the ETag (entity tag) specified here does not match the server's ETag for a resource, the resource will be returned; otherwise, a not-modified status
        /// is returned.
        /// </remarks>
        public CacheDirectives(String etag)
            : this(etag, null)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="CacheDirectives"/> class.
        /// </summary>
        /// <param name="etag">The ETag to send to the server for evaluation. See remarks.</param>
        /// <param name="lastModified">
        /// The last modified date to send to the server for evaluation. See remarks.
        /// </param>
        /// <remarks>
        /// If the ETag (entity tag) specified here does not match the server's ETag for a resource, the resource will be returned; otherwise, a not-modified status
        /// is returned. The same applies to last modified. If the server's last modified date for a resource is greater than the last modified specified here, the
        /// resource will be returned; otherwise, a not-modified status is returned.
        /// </remarks>
        public CacheDirectives(String etag, DateTime? lastModified)
        {
            this.etag = etag;
            this.lastModified = lastModified;
        }

        /// <summary>
        /// Applies the ETag or LastModified cache control headers to the specified REST API request. See remarks.
        /// </summary>
        /// <param name="request">The REST API request that will be modified.</param>
        /// <remarks>
        /// The cache control headers are applied conditionally. The ETag and LastModified values will only be applied if they are not null. Furthermore, the
        /// application of each are independent of the other. This could, therefore, only apply a LastModified cache control header and not an ETag cache control
        /// header if the ETag property of this instance were null and LastModified was not.
        /// </remarks>
        public void Apply(IRestRequest request)
        {
            if (this.etag != null)
            {
                request.AddHeader(HeaderParameter.IF_NONE_MATCH, this.etag);
            }

            if (this.lastModified != null)
            {
                request.AddHeader(HeaderParameter.IF_MODIFIED_SINCE, this.lastModified.Value.ToUniversalTime().ToString(ServiceHelper.DATE_FORMAT));
            }
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
/**
 * Success Criterion 2.2.1: Timing Adjustable
 *
 * @see http://www.w3.org/TR/UNDERSTANDING-WCAG20/time-limits-required-behaviors.html
 */
'use strict';

quail.guidelines.wcag.successCriteria['2.2.1'] = (function (quail) {
  /**
   * Determines if this Success Criteria applies to the document.
   */
  function preEvaluator() {
    return true;
  }

  // Create a new SuccessCriteria and pass it the evaluation callbacks.
  var sc = quail.lib.SuccessCriteria({
    name: 'wcag:2.2.1',
    preEvaluator: preEvaluator
  });

  // Techniques
  sc.techniques = {};

  // Failures
  sc.failures = {};

  return sc;
})(quail);


text:
package org.apache.camel.component.reactive.streams.api;

import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;

import org.apache.camel.CamelContext;
import org.apache.camel.component.reactive.streams.util.ReactiveStreamsServiceCreationHelper;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * This is the main entry-point for getting Camel streams associate to reactive-streams endpoints.
 *
 * It allows to retrieve the {@link CamelReactiveStreamsService} to access Camel streams.
 * This class returns the default implementation of the service unless the client requests a named service,
 */
public final class CamelReactiveStreams {

    private static final Logger LOG = LoggerFactory.getLogger(CamelReactiveStreams.class);

    private static Map<CamelContext, String> serviceNames = new ConcurrentHashMap<>();

    private CamelReactiveStreams() {
    }

    public static CamelReactiveStreamsService get(CamelContext context) {
        return get(context, null);
    }

    public static CamelReactiveStreamsService get(CamelContext context, String serviceName) {
        if (serviceName != null && serviceName.trim().length() == 0) {
            throw new IllegalArgumentException("the service name cannot be an empty String");
        }

        String lookupName = serviceName != null ? serviceName : "";
        serviceNames.computeIfAbsent(context, ctx -> {
            CamelReactiveStreamsService service = context.hasService(CamelReactiveStreamsService.class);
            if (service == null) {
                service = resolveReactiveStreamsService(context, serviceName);
                try {
                    context.addService(service, true, true);
                } catch (Exception ex) {
                    throw new IllegalStateException("Cannot add the CamelReactiveStreamsService to the Camel context", ex);
                }
            }

            return lookupName;
        });

        if (!ObjectHelper.equal(serviceNames.get(context), lookupName)) {
            // only a single implementation of the CamelReactiveStreamService can be present per Camel context
            throw new IllegalArgumentException("Cannot use two different implementations of CamelReactiveStreamsService in the same CamelContext: "
                    + "existing service name [" + serviceNames.get(context) + "] - requested [" + lookupName + "]");
        }

        return context.hasService(CamelReactiveStreamsService.class);
    }

    private static CamelReactiveStreamsService resolveReactiveStreamsService(CamelContext context, String serviceName) {
        CamelReactiveStreamsService service = null;
        if (serviceName != null) {
            // lookup in the registry
            service = context.getRegistry().lookupByNameAndType(serviceName, CamelReactiveStreamsService.class);

            if (service == null) {
                service = ReactiveStreamsServiceCreationHelper.createNewReactiveStreamsService(context, serviceName);
            }
        } else {
            Set<CamelReactiveStreamsService> set = context.getRegistry().findByType(CamelReactiveStreamsService.class);
            if (set.size() == 1) {
                service = set.iterator().next();
            }

            if (service == null) {
                LOG.info("Using default reactive stream service");
                service = ReactiveStreamsServiceCreationHelper.createNewReactiveStreamsService(context, null);
            }
        }

        return service;
    }

}


text:
package org.docksidestage.dockside.dbflute.exbhv;

import org.docksidestage.dockside.dbflute.bsbhv.BsMemberWithdrawalBhv;

/**
 * The behavior of MEMBER_WITHDRAWAL.
 * <p>
 * You can implement your original methods here.
 * This class remains when re-generating.
 * </p>
 * @author DBFlute(AutoGenerator)
 */
@org.springframework.stereotype.Component("memberWithdrawalBhv")
public class MemberWithdrawalBhv extends BsMemberWithdrawalBhv {
}


text:
package com.jimmoores.quandl;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;

import javax.ws.rs.client.WebTarget;

import com.jimmoores.quandl.util.ArgumentChecker;

/**
 * A class that packages the request for MetaData from Quandl.
 */
public final class MultiMetaDataRequest {
  private static final String COLUMNS_PARAM = "columns";
  private static final String EXTENSION = ".json";
  private static final String MULTI_SET_NAME = "multisets";
  private static final String EXCLUDE_DATA_PARAM = "trim_start";
  private static final String INFINITE_FUTURE = "2100-01-01";

  private List<String> _quandlCodes;

  private MultiMetaDataRequest(final List<String> quandlCodes) {
    _quandlCodes = Collections.unmodifiableList(new ArrayList<String>(quandlCodes));
  }

  /**
   * Factory method to create a meta data request instance.
   * @param quandlCodes the list of quandl codes for the meta data required, not null
   * @return an instance of the MetaDataRequest for the given quandlCode, not null
   */
  public static MultiMetaDataRequest of(final List<String> quandlCodes) {
    ArgumentChecker.notNullOrEmpty(quandlCodes, "quandlCodes");
    return new MultiMetaDataRequest(quandlCodes);
  }

  /**
   * Factory method to create a meta data request instance.
   * @param quandlCodes the list of quandl codes for the meta data required (varargs), not null
   * @return an instance of the MetaDataRequest for the given quandlCode, not null
   */
  public static MultiMetaDataRequest of(final String... quandlCodes) {
    ArgumentChecker.notNullOrEmpty(quandlCodes, "quandlCodes");
    return new MultiMetaDataRequest(Arrays.asList(quandlCodes));
  }

  /**
   * @return the list of quandl codes contained in this request.
   */
  public List<String> getQuandlCodes() {
	return _quandlCodes;
  }

  private String buildCodeList(final List<String> quandlCodes) {
    StringBuilder sb = new StringBuilder();
    Iterator<String> iter = quandlCodes.iterator();
    while (iter.hasNext()) {
      String quandlCode = iter.next();
      if (quandlCode == null) {
        throw new IllegalArgumentException("There was a null encountered in the argument list " + quandlCodes);
      }
      String transformedCode = quandlCode.replace('/', '.');
      sb.append(transformedCode);
      if (iter.hasNext()) {
        sb.append(",");
      }
    }
    return sb.toString();
  }

  /**
   * Append any specified parameters to the provided WebTarget.
   * @param webTarget a web target used by the Jersey Client API, not null
   * @return the WebTarget with any path and query parameters appended, not null
   */
  public WebTarget appendPathAndQueryParameters(final WebTarget webTarget) {
    ArgumentChecker.notNull(webTarget, "webTarget");
    WebTarget resultTarget = webTarget;
    resultTarget = resultTarget.path(MULTI_SET_NAME + EXTENSION);
    resultTarget = resultTarget.queryParam(COLUMNS_PARAM, buildCodeList(_quandlCodes));
    // This is a hack that stops Quandl from returning all the data as part of the query
    // because the exclude_data=true query parameter doesn't work on this call.
    resultTarget = resultTarget.queryParam(EXCLUDE_DATA_PARAM, INFINITE_FUTURE);
    return resultTarget;
  }

  @Override
  public int hashCode() {
    return _quandlCodes.hashCode();
  }

  @Override
  public boolean equals(final Object obj) {
    if (this == obj) {
      return true;
    }
    if (obj == null) {
      return false;
    }
    if (!(obj instanceof MultiMetaDataRequest)) {
      return false;
    }
    MultiMetaDataRequest other = (MultiMetaDataRequest) obj;
    if (!_quandlCodes.equals(other._quandlCodes)) {
      return false;
    }
    return true;
  }

  @Override
  public String toString() {
    return "MultiMetaDataRequest[" + _quandlCodes + "]";
  }
}


text:
<?php

namespace app\models;

use Yii;

/**
 * This is the model class for table "student".
 *
 * @property integer $user_id
 * @property string $stu_name
 * @property string $stu_birth
 * @property string $stu_ssn
 * @property string $stu_status
 * @property string $stu_gdata
 * @property string $stu_cost
 *
 * @property CourseStu[] $courseStus
 */
class Student extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'student';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['user_id', 'stu_name', 'stu_ssn', 'stu_status'], 'required'],
            [['user_id'], 'integer'],
            [['stu_birth', 'stu_gdata'], 'date','format'=>'yyyy-MM-dd'],
            [['stu_cost'], 'number'],
            [['stu_name', 'stu_ssn', 'stu_status'], 'string', 'max' => 32]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'user_id' => 'User ID',
            'stu_name' => 'Student Name',
            'stu_birth' => 'Student Birth',
            'stu_ssn' => 'Student Ssn',
            'stu_status' => 'Student Status',
            'stu_gdata' => 'graduate date',
            'stu_cost' => 'Student Cost',
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getCourseStus()
    {
        return $this->hasMany(CourseStu::className(), ['cs_stu' => 'user_id']);
    }

    public function getStudentList()
    {
        $list_t = Student::find()->all();
        $list = array();
        foreach($list_t as $value)
        {
            $list[$value->user_id] = $value->user_id .' ' .$value->stu_name;
        }
        return $list;
    }

    public static function getCourseList($id)
    {
        $list_t = CourseStudent::find()->where(['student_id'=>$id])->all();
        $list = array();
        foreach($list_t as $value)
        {
            $course_name = $value->course_name;
            $professor = $value->professor_name;
            $course_id = $value->cp_id;

            $cp_list = CpDate::find()->where(['cpd_cp'=>$course_id])->all();
            foreach($cp_list as $item)
            {
                $list[] = [$item->cpd_date,$item->cpd_time,$course_name,
                $professor,$item->cpd_place];
            }
        }
        return $list;
    }

    public static function getCourseNumList($id)
    {
        $list_t = CourseStu::find()->where(['cs_stu'=>$id])->all();
        $list = array();
        foreach($list_t as $value)
        {
                $list[] = [$value->cs_cp,$value->cs_type,$value->cs_id];
        }
        return $list;
    }

    public static function getCourseColorList($id)
    {
        $list_t = CourseStudent::find()->where(['student_id'=>$id])->all();
        $list = array();
        foreach($list_t as $value)
        {
            $course_id = $value->cp_id;
            $course_type = $value->course_type;

            $cp_list = CpDate::find()->where(['cpd_cp'=>$course_id])->all();
            foreach($cp_list as $item)
            {
                $list[] = [$item->cpd_date,$item->cpd_time,$course_type];
            }
        }
        return $list;
    }
}


text:
package org.interviewproblems.trainingweek.mon;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;

public class WordBreak {

   public boolean wordBreak(String s, Set<String> dict) {
      if (dict.contains(s) || s.length() == 0)
         return true;

      for (int i = 1; i < s.length(); i++) {
         if (dict.contains(s.substring(0, i)) && decorateWordBreak(s.substring(i), dict))
            return true;
      }
      return false;
   }

   HashMap<String, Boolean> cache = new HashMap<String, Boolean>();

   private boolean decorateWordBreak(String s, Set<String> dict) {
      if (cache.containsKey(s)) return cache.get(s);
      boolean b = wordBreak(s, dict);
      cache.put(s, b);
      System.out.println("S = " + s + " ->" + b);
      System.out.println("cache = " + cache.size());
      return b;
   }

   public static void main(String[] args) {
      String w1 = "abcdefgh"; Set<String> dictionary = new HashSet<String>();
      dictionary.add("a");
      dictionary.add("ab");
      dictionary.add("abc");
      dictionary.add("abcd");
      dictionary.add("abcde");
      dictionary.add("abcdef");
      dictionary.add("abcdefg");
      dictionary.add("b");
      dictionary.add("bc");
      dictionary.add("bcd");
      dictionary.add("bcde");
      dictionary.add("bcdef");
      dictionary.add("bcdefg");
      dictionary.add("bc");
      dictionary.add("bcd");
      dictionary.add("bcde");
      dictionary.add("bcdef");
      dictionary.add("bcdefg");
      dictionary.add("c");
      dictionary.add("d");
      dictionary.add("e");
      dictionary.add("f");
      dictionary.add("g");
      dictionary.add("xxxxxxxxxxxxxxxxxxx");

      boolean b = new WordBreak().wordBreak(w1, dictionary);
      System.out.println("b = " + b);

   }
}


text:
version="0.0.0"

source ../common/global.config

main() {
    if ! git diff-index --quiet HEAD . ../common; then
        echo "** WARNING: You have uncommitted changes that will NOT be reflected in the base box!"
        git status . ../common
	if yorn "\n** Do you want to abort? "; then
            echo "** ABORTED BY USER **"
            exit 0
        fi
    fi

    case $1 in
	help ) echo "$0: Choose build or package" ; exit 1 ;;
	package ) package_box ;;
	upload ) shift ; upload_box "$@" ;;
	build | * ) build_box ;;
    esac
}

build_box() {
    if [ ! -f .builder ]; then
	builder=$(cat .builder 2> /dev/null)

	while [ -z "$builder" ]
	do
	    read -p "What's your name? / Who's your daddy? " builder

	    if [[ $builder =~ .*[[:space:]].* ]]; then
		echo "** Sorry no spaces, just your base handle name please"
		builder=''
	    fi
	done

	echo "$builder" > .builder
    fi

    if [ -f package.box ]; then
	if yorn "** Do you want to remove the old base box? "; then
	    rm -f package.box
	else
	    echo "** ABORTED BY USER **"
	    exit 0
	fi
    fi

    vagrant destroy && echo "** Destoryed old basebox VM **"

    date

    if time vagrant up; then
        :
    else
        echo "** VARGANT FAILED! RET=$? **"
        exit 1
    fi

    echo "** Ran for $SECONDS Second(s) so far."

    sleep 5

    echo "** Update vbguest extensions"
    vagrant vbguest --do install && vagrant reload

    echo "** Trying to resize to 1280x800"
    vboxmanage controlvm $(<.vagrant/machines/default/virtualbox/id) setvideomodehint 1280 800 24

    echo "** Ran for $SECONDS Second(s) so far."

    # Use instructions from README.md
    echo
    echo "*** Manual Steps ***"
    sed -e '1,/^### Manual steps/d' -e '/^###/,$d' README.md

    if yorn "Have you completed these steps?"; then
	package_box
    else
	echo "** When you're ready to package type: ./build.sh package"
	exit 0
    fi

    echo "** Ran for $SECONDS Second(s)"
}

package_box() {
    get_version

    # Make sure it's up
    echo "** Checking to make sure your guest is up..."
    if vagrant up > /dev/null 2>&1; then
	:
    else
	echo "** Failed to start the box? ret=$?"
	exit 1
    fi

    local sshcfg=$(mktemp /tmp/build-basebox.XXXXXX)
    trap 'rm -f "'$sshcfg'"' 0

    echo "** Getting ssh configuration..."
    vagrant ssh-config > $sshcfg || error "Failed to get ssh config, GET HELP!" 11

    builder=$(cat .builder 2> /dev/null)

    local branch=$(git rev-parse --abbrev-ref HEAD)

    echo "** Pulling latest greatest ${ZONAMADEV_URL} using branch ${branch}"
    if ssh -t -F $sshcfg default "sudo rm -fr ZonamaDev;git clone -b ${branch} ${ZONAMADEV_URL}"; then
	:
    else
	msg "git clone ${ZONAMADEV_URL} SEEMS TO HAVE FAILED WITH ERR=$?, fix it and after that try: ./build.sh package"
	exit 1
    fi

    echo "** Executing package prep on guest..."

    if ssh -t -F $sshcfg default "exec sudo ZDUSER=\${USER} ZonamaDev/basebox/scripts/package-prep.sh '$version' '$builder'"; then
	msg "SUCCESS!"
    else
	local st=$?

	# When the server shuts us down ssh looks like it returns 255
	if [ $st -eq 255 ]; then
            :
	else
	    # Anything else was not expected
	    msg "package-prep.sh SEEMS TO HAVE FAILED WITH ERR=$?, fix it and after that try: ./build.sh package"
	    exit 1
	fi
    fi

    # Wait for virtualbox to cleanly exit
    sleep 5

    local box_name=$(egrep 'config.vm.box[[:space:]=]' ../fasttrack/Vagrantfile | tr -d '['"'"'"]' | sed -e 's/.*=[ ]*//' -e 's/;//')

    echo "** Removing old cached boxes"

    vagrant box remove ${box_name} --all

    echo "** Ok now build the package!"

    local state='unknown'

    while [ "$state" != "poweroff" ]
    do
        state=$(vagrant status --machine-readable | awk -F',' '$3 == "state" { print $4 }')

        if [ "$state" != "poweroff" ]; then
            echo "** Box state is: ${state} must be: poweroff"
            echo
            read -p "Fix it and press <ENTER>: " _
            sleep 1
        fi
    done

    # TODO - Include a Vagrantfile with hints/metadata?
    if vagrant package; then
	:
    else
	echo "** Something went wrong!?"
	exit 1
    fi

    if [ ! -f package.box ]; then
	echo "** Something strange happened did not get a package.box file!?"
        exit 2
    fi

    local fn=package-${version}.box
    mv package.box $fn
    ls -lh "$PWD/$fn"

    upload_box "${version}" "${fn}"

    echo -e "\nNEXT STEPS:\n"

    # Show instructions from README.md
    sed -e '1,/^### Publish/d' -e '/^###/,$d' -e 's/x\.y\.z/'"${version}"'/g' -e '/```/,/```/s/^/   * /' -e '/```/d' README.md

    echo -e "\nPlease make sure you upload the box named as: ${box_name} version ${version}"

    if [ -x ~/.config/ZonamaDev/upload-box.sh ]; then
        ~/.config/ZonamaDev/upload-box.sh "${PWD}/${fn}"
    fi

    if yorn "\nAfter you upload would you like to test [$version] in the ${PWD}/../fasttrack folder?"; then
        while :
        do
            if yorn "\nDid you upload the box and set it to release yet?"; then
                if vagrant box add ${box_name} --box-version $version; then
                    break
                else
                    echo "** vagrant box add failed!"
                fi
            else
                echo "** You can't test until you upload and release the new box"
                exit 4
            fi
        done

        if yorn "\nWARNING: This will destroy your existing fasttrack box (if any) in ${PWD}/../fastrack!\n\nContinue?"; then
            set -x
            cd ../fasttrack
            if sed -i '~' 's/config.vm.box_version = ".*"/config.vm.box_version = "'${version}'"/' Vagrantfile; then
                exec ./setup.sh
            else
                echo "** Unable to edit Vagrant file, you'll have to test manually. **"
                exit 1
            fi
        else
            echo "** Test aborted, please test the box manually **"
        fi
    fi

    exit 0
}

upload_box() {
    local version=$1
    local box=$2
    local box_name=$(egrep 'config.vm.box[[:space:]=]' ../fasttrack/Vagrantfile | tr -d '['"'"'"]' | sed -e 's/.*=[ ]*//' -e 's/;//')
    local user=''
    local token=''

    read user token <<<$(<~/.config/ZonamaDev/vagrantup.credentials)

    if [ -z "$user" -o -z "$token" ]; then
        echo "** Please manually upload the box to vagrantup via the web UI **"
        return
    fi

    echo "** curl -s 'https://app.vagrantup.com/api/v1/box/${box_name}/version/${version}/provider/virtualbox/upload?access_token=${token}' "
    local upload_url=$(curl -s "https://app.vagrantup.com/api/v1/box/${box_name}/version/${version}/provider/virtualbox/upload?access_token=${token}" | python -c 'import sys, json; print json.load(sys.stdin)["upload_path"]')

    if [ -z "$upload_url" ]; then
        echo "Failed to find upload URL"
        return
    fi

    echo "** curl -X PUT --upload-file $box '${upload_url}'"
    curl -X PUT --upload-file $box "${upload_url}" > /dev/null
}

get_version() {
    if [ -n "$2" ]; then
	version=$2
    else
	local suggest_version=""

	# Try to guess a good version number
	local prev_version=$(grep config.vm.box_version ../fasttrack/Vagrantfile | tr -d '['"'"'"]' | sed -e 's/.*=[ ]*//' -e 's/;//')

	if [ -n "$prev_version" ]; then
	    echo -e "\nPrevious version: $prev_version\n"

	    local point=$(echo $prev_version | cut -d. -f3)

	    let "point=$point + 1"

	    suggest_version=$(echo $prev_version | sed 's/\.[0-9][0-9]*$/.'$point'/')
	fi

	local suggest=""

	if [ -n "$suggest_version" ]; then
	    suggest=" (ENTER for default of '$suggest_version')"
	fi

	read -p "What version do you want to use for this box$suggest? " version

	if [ -z "$version" ]; then
	    version=$suggest_version
	fi
    fi

    # TODO should we check x.y.z format?
    if yorn "\nAre you sure you want to use version [$version] for this box?"; then
	echo -e "\nNew Version: ${version}\n"
    else
	echo "** ABORTED BY USER **"
	exit 0
    fi
}

msg() {
    local hd="##"$(echo "$1"|sed 's/./#/g')"##"
    echo -e "$hd\n# $1 #\n$hd"
}

error() {
    err_msg=$1
    err_code=251
    if [ "X$2" != "X" ]; then
	err_code=$2
    fi

    msg "ERROR: $err_msg ($err_code)"

    exit $err_code
}

yorn() {
  if tty -s; then
      echo -n -e "$@ Y\b" > /dev/tty
      read yorn < /dev/tty
      case $yorn in
	[Nn]* ) return 1;;
      esac
  else
      echo "Must have a tty"
      exit 1
  fi

  return 0
}

main $@

exit 0


text:
module Azure::Synapse::Mgmt::V2019_06_01_preview
  #
  # Azure Synapse Analytics Management Client
  #
  class PrivateLinkHubs
    include MsRestAzure

    #
    # Creates and initializes a new instance of the PrivateLinkHubs class.
    # @param client service class for accessing basic functionality.
    #
    def initialize(client)
      @client = client
    end

    # @return [SynapseManagementClient] reference to the SynapseManagementClient
    attr_reader :client

    #
    # Returns a list of privateLinkHubs in a resource group
    #
    # @param resource_group_name [String] The name of the resource group. The name
    # is case insensitive.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [Array<PrivateLinkHub>] operation results.
    #
    def list_by_resource_group(resource_group_name, custom_headers:nil)
      first_page = list_by_resource_group_as_lazy(resource_group_name, custom_headers:custom_headers)
      first_page.get_all_items
    end

    #
    # Returns a list of privateLinkHubs in a resource group
    #
    # @param resource_group_name [String] The name of the resource group. The name
    # is case insensitive.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
    #
    def list_by_resource_group_with_http_info(resource_group_name, custom_headers:nil)
      list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
    end

    #
    # Returns a list of privateLinkHubs in a resource group
    #
    # @param resource_group_name [String] The name of the resource group. The name
    # is case insensitive.
    # @param [Hash{String => String}] A hash of custom headers that will be added
    # to the HTTP request.
    #
    # @return [Concurrent::Promise] Promise object which holds the HTTP response.
    #
    def list_by_resource_group_async(resource_group_name, custom_headers:nil)
      fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
      fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
      fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
      fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
      fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
      fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
      fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
      fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?

      request_headers = {}
      request_headers['Content-Type'] = 'application/json; charset=utf-8'

      # Set Headers
      request_headers['x-ms-client-request-id'] = SecureRandom.uuid
      request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
      path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/privateLinkHubs'

      request_url = @base_url || @client.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name},
          query_params: {'api-version' => @client.api_version},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = @client.make_request_async(:get, path_template, options)

      promise = promise.then do |result|
        http_response = result.response
        status_code = http_response.status
        response_content = http_response.body
        unless status_code == 200
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
        result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
        # Deserialize Response
        if status_code == 200
          begin
            parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
            result_mapper = Azure::Synapse::Mgmt::V2019_06_01_preview::Models::PrivateLinkHubInfoListResult.mapper()
            result.body = @client.deserialize(result_mapper, parsed_response)
          rescue Exception => e
            fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
          end
        end

        result
      end

      promise.execute
    end

    #
    # Gets a privateLinkHub
    #
    # @param resource_group_name [String] The name of the resource group. The name
    # is case insensitive.
    # @param private_link_hub_name [String] Name of the privateLinkHub
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [PrivateLinkHub] operation results.
    #
    def get(resource_group_name, private_link_hub_name, custom_headers:nil)
      response = get_async(resource_group_name, private_link_hub_name, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Gets a privateLinkHub
    #
    # @param resource_group_name [String] The name of the resource group. The name
    # is case insensitive.
    # @param private_link_hub_name [String] Name of the privateLinkHub
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
    #
    def get_with_http_info(resource_group_name, private_link_hub_name, custom_headers:nil)
      get_async(resource_group_name, private_link_hub_name, custom_headers:custom_headers).value!
    end

    #
    # Gets a privateLinkHub
    #
    # @param resource_group_name [String] The name of the resource group. The name
    # is case insensitive.
    # @param private_link_hub_name [String] Name of the privateLinkHub
    # @param [Hash{String => String}] A hash of custom headers that will be added
    # to the HTTP request.
    #
    # @return [Concurrent::Promise] Promise object which holds the HTTP response.
    #
    def get_async(resource_group_name, private_link_hub_name, custom_headers:nil)
      fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
      fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
      fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
      fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
      fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
      fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
      fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
      fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
      fail ArgumentError, 'private_link_hub_name is nil' if private_link_hub_name.nil?

      request_headers = {}
      request_headers['Content-Type'] = 'application/json; charset=utf-8'

      # Set Headers
      request_headers['x-ms-client-request-id'] = SecureRandom.uuid
      request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
      path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/privateLinkHubs/{privateLinkHubName}'

      request_url = @base_url || @client.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'privateLinkHubName' => private_link_hub_name},
          query_params: {'api-version' => @client.api_version},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = @client.make_request_async(:get, path_template, options)

      promise = promise.then do |result|
        http_response = result.response
        status_code = http_response.status
        response_content = http_response.body
        unless status_code == 200
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
        result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
        # Deserialize Response
        if status_code == 200
          begin
            parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
            result_mapper = Azure::Synapse::Mgmt::V2019_06_01_preview::Models::PrivateLinkHub.mapper()
            result.body = @client.deserialize(result_mapper, parsed_response)
          rescue Exception => e
            fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
          end
        end

        result
      end

      promise.execute
    end

    #
    # Updates a privateLinkHub
    #
    # @param private_link_hub_patch_info [PrivateLinkHubPatchInfo] PrivateLinkHub
    # patch request properties
    # @param resource_group_name [String] The name of the resource group. The name
    # is case insensitive.
    # @param private_link_hub_name [String] Name of the privateLinkHub
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [PrivateLinkHub] operation results.
    #
    def update(private_link_hub_patch_info, resource_group_name, private_link_hub_name, custom_headers:nil)
      response = update_async(private_link_hub_patch_info, resource_group_name, private_link_hub_name, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Updates a privateLinkHub
    #
    # @param private_link_hub_patch_info [PrivateLinkHubPatchInfo] PrivateLinkHub
    # patch request properties
    # @param resource_group_name [String] The name of the resource group. The name
    # is case insensitive.
    # @param private_link_hub_name [String] Name of the privateLinkHub
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
    #
    def update_with_http_info(private_link_hub_patch_info, resource_group_name, private_link_hub_name, custom_headers:nil)
      update_async(private_link_hub_patch_info, resource_group_name, private_link_hub_name, custom_headers:custom_headers).value!
    end

    #
    # Updates a privateLinkHub
    #
    # @param private_link_hub_patch_info [PrivateLinkHubPatchInfo] PrivateLinkHub
    # patch request properties
    # @param resource_group_name [String] The name of the resource group. The name
    # is case insensitive.
    # @param private_link_hub_name [String] Name of the privateLinkHub
    # @param [Hash{String => String}] A hash of custom headers that will be added
    # to the HTTP request.
    #
    # @return [Concurrent::Promise] Promise object which holds the HTTP response.
    #
    def update_async(private_link_hub_patch_info, resource_group_name, private_link_hub_name, custom_headers:nil)
      fail ArgumentError, 'private_link_hub_patch_info is nil' if private_link_hub_patch_info.nil?
      fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
      fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
      fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
      fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
      fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
      fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
      fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
      fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
      fail ArgumentError, 'private_link_hub_name is nil' if private_link_hub_name.nil?

      request_headers = {}
      request_headers['Content-Type'] = 'application/json; charset=utf-8'

      # Set Headers
      request_headers['x-ms-client-request-id'] = SecureRandom.uuid
      request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

      # Serialize Request
      request_mapper = Azure::Synapse::Mgmt::V2019_06_01_preview::Models::PrivateLinkHubPatchInfo.mapper()
      request_content = @client.serialize(request_mapper,  private_link_hub_patch_info)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/privateLinkHubs/{privateLinkHubName}'

      request_url = @base_url || @client.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'privateLinkHubName' => private_link_hub_name},
          query_params: {'api-version' => @client.api_version},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = @client.make_request_async(:patch, path_template, options)

      promise = promise.then do |result|
        http_response = result.response
        status_code = http_response.status
        response_content = http_response.body
        unless status_code == 200 || status_code == 201
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
        result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
        # Deserialize Response
        if status_code == 200
          begin
            parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
            result_mapper = Azure::Synapse::Mgmt::V2019_06_01_preview::Models::PrivateLinkHub.mapper()
            result.body = @client.deserialize(result_mapper, parsed_response)
          rescue Exception => e
            fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
          end
        end
        # Deserialize Response
        if status_code == 201
          begin
            parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
            result_mapper = Azure::Synapse::Mgmt::V2019_06_01_preview::Models::PrivateLinkHub.mapper()
            result.body = @client.deserialize(result_mapper, parsed_response)
          rescue Exception => e
            fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
          end
        end

        result
      end

      promise.execute
    end

    #
    # Creates or updates a privateLinkHub
    #
    # @param private_link_hub_info [PrivateLinkHub] PrivateLinkHub create or update
    # request properties
    # @param resource_group_name [String] The name of the resource group. The name
    # is case insensitive.
    # @param private_link_hub_name [String] Name of the privateLinkHub
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [PrivateLinkHub] operation results.
    #
    def create_or_update(private_link_hub_info, resource_group_name, private_link_hub_name, custom_headers:nil)
      response = create_or_update_async(private_link_hub_info, resource_group_name, private_link_hub_name, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Creates or updates a privateLinkHub
    #
    # @param private_link_hub_info [PrivateLinkHub] PrivateLinkHub create or update
    # request properties
    # @param resource_group_name [String] The name of the resource group. The name
    # is case insensitive.
    # @param private_link_hub_name [String] Name of the privateLinkHub
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
    #
    def create_or_update_with_http_info(private_link_hub_info, resource_group_name, private_link_hub_name, custom_headers:nil)
      create_or_update_async(private_link_hub_info, resource_group_name, private_link_hub_name, custom_headers:custom_headers).value!
    end

    #
    # Creates or updates a privateLinkHub
    #
    # @param private_link_hub_info [PrivateLinkHub] PrivateLinkHub create or update
    # request properties
    # @param resource_group_name [String] The name of the resource group. The name
    # is case insensitive.
    # @param private_link_hub_name [String] Name of the privateLinkHub
    # @param [Hash{String => String}] A hash of custom headers that will be added
    # to the HTTP request.
    #
    # @return [Concurrent::Promise] Promise object which holds the HTTP response.
    #
    def create_or_update_async(private_link_hub_info, resource_group_name, private_link_hub_name, custom_headers:nil)
      fail ArgumentError, 'private_link_hub_info is nil' if private_link_hub_info.nil?
      fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
      fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
      fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
      fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
      fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
      fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
      fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
      fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
      fail ArgumentError, 'private_link_hub_name is nil' if private_link_hub_name.nil?

      request_headers = {}
      request_headers['Content-Type'] = 'application/json; charset=utf-8'

      # Set Headers
      request_headers['x-ms-client-request-id'] = SecureRandom.uuid
      request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

      # Serialize Request
      request_mapper = Azure::Synapse::Mgmt::V2019_06_01_preview::Models::PrivateLinkHub.mapper()
      request_content = @client.serialize(request_mapper,  private_link_hub_info)
      request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

      path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/privateLinkHubs/{privateLinkHubName}'

      request_url = @base_url || @client.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'privateLinkHubName' => private_link_hub_name},
          query_params: {'api-version' => @client.api_version},
          body: request_content,
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = @client.make_request_async(:put, path_template, options)

      promise = promise.then do |result|
        http_response = result.response
        status_code = http_response.status
        response_content = http_response.body
        unless status_code == 200 || status_code == 201
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
        result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
        # Deserialize Response
        if status_code == 200
          begin
            parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
            result_mapper = Azure::Synapse::Mgmt::V2019_06_01_preview::Models::PrivateLinkHub.mapper()
            result.body = @client.deserialize(result_mapper, parsed_response)
          rescue Exception => e
            fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
          end
        end
        # Deserialize Response
        if status_code == 201
          begin
            parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
            result_mapper = Azure::Synapse::Mgmt::V2019_06_01_preview::Models::PrivateLinkHub.mapper()
            result.body = @client.deserialize(result_mapper, parsed_response)
          rescue Exception => e
            fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
          end
        end

        result
      end

      promise.execute
    end

    #
    # Deletes a privateLinkHub
    #
    # @param resource_group_name [String] The name of the resource group. The name
    # is case insensitive.
    # @param private_link_hub_name [String] Name of the privateLinkHub
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    def delete(resource_group_name, private_link_hub_name, custom_headers:nil)
      response = delete_async(resource_group_name, private_link_hub_name, custom_headers:custom_headers).value!
      nil
    end

    #
    # @param resource_group_name [String] The name of the resource group. The name
    # is case insensitive.
    # @param private_link_hub_name [String] Name of the privateLinkHub
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [Concurrent::Promise] promise which provides async access to http
    # response.
    #
    def delete_async(resource_group_name, private_link_hub_name, custom_headers:nil)
      # Send request
      promise = begin_delete_async(resource_group_name, private_link_hub_name, custom_headers:custom_headers)

      promise = promise.then do |response|
        # Defining deserialization method.
        deserialize_method = lambda do |parsed_response|
        end

        # Waiting for response.
        @client.get_long_running_operation_result(response, deserialize_method)
      end

      promise
    end

    #
    # Returns a list of privateLinkHubs in a subscription
    #
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [Array<PrivateLinkHub>] operation results.
    #
    def list(custom_headers:nil)
      first_page = list_as_lazy(custom_headers:custom_headers)
      first_page.get_all_items
    end

    #
    # Returns a list of privateLinkHubs in a subscription
    #
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
    #
    def list_with_http_info(custom_headers:nil)
      list_async(custom_headers:custom_headers).value!
    end

    #
    # Returns a list of privateLinkHubs in a subscription
    #
    # @param [Hash{String => String}] A hash of custom headers that will be added
    # to the HTTP request.
    #
    # @return [Concurrent::Promise] Promise object which holds the HTTP response.
    #
    def list_async(custom_headers:nil)
      fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
      fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
      fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
      fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1

      request_headers = {}
      request_headers['Content-Type'] = 'application/json; charset=utf-8'

      # Set Headers
      request_headers['x-ms-client-request-id'] = SecureRandom.uuid
      request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
      path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Synapse/privateLinkHubs'

      request_url = @base_url || @client.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'subscriptionId' => @client.subscription_id},
          query_params: {'api-version' => @client.api_version},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = @client.make_request_async(:get, path_template, options)

      promise = promise.then do |result|
        http_response = result.response
        status_code = http_response.status
        response_content = http_response.body
        unless status_code == 200
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
        result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
        # Deserialize Response
        if status_code == 200
          begin
            parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
            result_mapper = Azure::Synapse::Mgmt::V2019_06_01_preview::Models::PrivateLinkHubInfoListResult.mapper()
            result.body = @client.deserialize(result_mapper, parsed_response)
          rescue Exception => e
            fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
          end
        end

        result
      end

      promise.execute
    end

    #
    # Deletes a privateLinkHub
    #
    # @param resource_group_name [String] The name of the resource group. The name
    # is case insensitive.
    # @param private_link_hub_name [String] Name of the privateLinkHub
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    #
    def begin_delete(resource_group_name, private_link_hub_name, custom_headers:nil)
      response = begin_delete_async(resource_group_name, private_link_hub_name, custom_headers:custom_headers).value!
      nil
    end

    #
    # Deletes a privateLinkHub
    #
    # @param resource_group_name [String] The name of the resource group. The name
    # is case insensitive.
    # @param private_link_hub_name [String] Name of the privateLinkHub
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
    #
    def begin_delete_with_http_info(resource_group_name, private_link_hub_name, custom_headers:nil)
      begin_delete_async(resource_group_name, private_link_hub_name, custom_headers:custom_headers).value!
    end

    #
    # Deletes a privateLinkHub
    #
    # @param resource_group_name [String] The name of the resource group. The name
    # is case insensitive.
    # @param private_link_hub_name [String] Name of the privateLinkHub
    # @param [Hash{String => String}] A hash of custom headers that will be added
    # to the HTTP request.
    #
    # @return [Concurrent::Promise] Promise object which holds the HTTP response.
    #
    def begin_delete_async(resource_group_name, private_link_hub_name, custom_headers:nil)
      fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
      fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
      fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
      fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
      fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
      fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
      fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
      fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
      fail ArgumentError, 'private_link_hub_name is nil' if private_link_hub_name.nil?

      request_headers = {}
      request_headers['Content-Type'] = 'application/json; charset=utf-8'

      # Set Headers
      request_headers['x-ms-client-request-id'] = SecureRandom.uuid
      request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
      path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/privateLinkHubs/{privateLinkHubName}'

      request_url = @base_url || @client.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'privateLinkHubName' => private_link_hub_name},
          query_params: {'api-version' => @client.api_version},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = @client.make_request_async(:delete, path_template, options)

      promise = promise.then do |result|
        http_response = result.response
        status_code = http_response.status
        response_content = http_response.body
        unless status_code == 200 || status_code == 202 || status_code == 204
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
        result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

        result
      end

      promise.execute
    end

    #
    # Returns a list of privateLinkHubs in a resource group
    #
    # @param next_page_link [String] The NextLink from the previous successful call
    # to List operation.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [PrivateLinkHubInfoListResult] operation results.
    #
    def list_by_resource_group_next(next_page_link, custom_headers:nil)
      response = list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Returns a list of privateLinkHubs in a resource group
    #
    # @param next_page_link [String] The NextLink from the previous successful call
    # to List operation.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
    #
    def list_by_resource_group_next_with_http_info(next_page_link, custom_headers:nil)
      list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
    end

    #
    # Returns a list of privateLinkHubs in a resource group
    #
    # @param next_page_link [String] The NextLink from the previous successful call
    # to List operation.
    # @param [Hash{String => String}] A hash of custom headers that will be added
    # to the HTTP request.
    #
    # @return [Concurrent::Promise] Promise object which holds the HTTP response.
    #
    def list_by_resource_group_next_async(next_page_link, custom_headers:nil)
      fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?

      request_headers = {}
      request_headers['Content-Type'] = 'application/json; charset=utf-8'

      # Set Headers
      request_headers['x-ms-client-request-id'] = SecureRandom.uuid
      request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
      path_template = '{nextLink}'

      request_url = @base_url || @client.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'nextLink' => next_page_link},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = @client.make_request_async(:get, path_template, options)

      promise = promise.then do |result|
        http_response = result.response
        status_code = http_response.status
        response_content = http_response.body
        unless status_code == 200
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
        result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
        # Deserialize Response
        if status_code == 200
          begin
            parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
            result_mapper = Azure::Synapse::Mgmt::V2019_06_01_preview::Models::PrivateLinkHubInfoListResult.mapper()
            result.body = @client.deserialize(result_mapper, parsed_response)
          rescue Exception => e
            fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
          end
        end

        result
      end

      promise.execute
    end

    #
    # Returns a list of privateLinkHubs in a subscription
    #
    # @param next_page_link [String] The NextLink from the previous successful call
    # to List operation.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [PrivateLinkHubInfoListResult] operation results.
    #
    def list_next(next_page_link, custom_headers:nil)
      response = list_next_async(next_page_link, custom_headers:custom_headers).value!
      response.body unless response.nil?
    end

    #
    # Returns a list of privateLinkHubs in a subscription
    #
    # @param next_page_link [String] The NextLink from the previous successful call
    # to List operation.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
    #
    def list_next_with_http_info(next_page_link, custom_headers:nil)
      list_next_async(next_page_link, custom_headers:custom_headers).value!
    end

    #
    # Returns a list of privateLinkHubs in a subscription
    #
    # @param next_page_link [String] The NextLink from the previous successful call
    # to List operation.
    # @param [Hash{String => String}] A hash of custom headers that will be added
    # to the HTTP request.
    #
    # @return [Concurrent::Promise] Promise object which holds the HTTP response.
    #
    def list_next_async(next_page_link, custom_headers:nil)
      fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?

      request_headers = {}
      request_headers['Content-Type'] = 'application/json; charset=utf-8'

      # Set Headers
      request_headers['x-ms-client-request-id'] = SecureRandom.uuid
      request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
      path_template = '{nextLink}'

      request_url = @base_url || @client.base_url

      options = {
          middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
          skip_encoding_path_params: {'nextLink' => next_page_link},
          headers: request_headers.merge(custom_headers || {}),
          base_url: request_url
      }
      promise = @client.make_request_async(:get, path_template, options)

      promise = promise.then do |result|
        http_response = result.response
        status_code = http_response.status
        response_content = http_response.body
        unless status_code == 200
          error_model = JSON.load(response_content)
          fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
        end

        result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
        result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
        result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
        # Deserialize Response
        if status_code == 200
          begin
            parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
            result_mapper = Azure::Synapse::Mgmt::V2019_06_01_preview::Models::PrivateLinkHubInfoListResult.mapper()
            result.body = @client.deserialize(result_mapper, parsed_response)
          rescue Exception => e
            fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
          end
        end

        result
      end

      promise.execute
    end

    #
    # Returns a list of privateLinkHubs in a resource group
    #
    # @param resource_group_name [String] The name of the resource group. The name
    # is case insensitive.
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [PrivateLinkHubInfoListResult] which provide lazy access to pages of
    # the response.
    #
    def list_by_resource_group_as_lazy(resource_group_name, custom_headers:nil)
      response = list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
      unless response.nil?
        page = response.body
        page.next_method = Proc.new do |next_page_link|
          list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers)
        end
        page
      end
    end

    #
    # Returns a list of privateLinkHubs in a subscription
    #
    # @param custom_headers [Hash{String => String}] A hash of custom headers that
    # will be added to the HTTP request.
    #
    # @return [PrivateLinkHubInfoListResult] which provide lazy access to pages of
    # the response.
    #
    def list_as_lazy(custom_headers:nil)
      response = list_async(custom_headers:custom_headers).value!
      unless response.nil?
        page = response.body
        page.next_method = Proc.new do |next_page_link|
          list_next_async(next_page_link, custom_headers:custom_headers)
        end
        page
      end
    end

  end
end


text:
// Testing
#include "mitkTestingMacros.h"
#include "mitkTestFixture.h"

// std includes
#include <string>

// MITK includes
#include "mitkConnectomicsNetworkCreator.h"
#include "mitkIOUtil.h"

// VTK includes
#include <vtkDebugLeaks.h>

class mitkConnectomicsNetworkCreationTestSuite : public mitk::TestFixture
{
  CPPUNIT_TEST_SUITE(mitkConnectomicsNetworkCreationTestSuite);

  /// \todo Fix VTK memory leaks. Bug 18097.
  vtkDebugLeaks::SetExitError(0);

  MITK_TEST(CreateNetworkFromFibersAndParcellation);
  CPPUNIT_TEST_SUITE_END();

private:

  std::string m_ParcellationPath;
  std::string m_FiberPath;
  std::string m_ReferenceNetworkPath;

public:

  /**
  * @brief Setup Always call this method before each Test-case to ensure correct and new intialization of the used members for a new test case. (If the members are not used in a test, the method does not need to be called).
  */
  void setUp()
  {
    m_ReferenceNetworkPath = GetTestDataFilePath("DiffusionImaging/Connectomics/reference.cnf");
    m_ParcellationPath = GetTestDataFilePath("DiffusionImaging/Connectomics/parcellation.nrrd");
    m_FiberPath = GetTestDataFilePath("DiffusionImaging/Connectomics/fiberBundle.fib");
  }

  void tearDown()
  {
    m_ReferenceNetworkPath = "";
    m_ParcellationPath = "";
    m_FiberPath = "";
  }

  void CreateNetworkFromFibersAndParcellation()
  {
    // load fiber image
    std::vector<mitk::BaseData::Pointer> fiberInfile = mitk::IOUtil::Load( m_FiberPath );
    if( fiberInfile.empty() )
    {
      std::string errorMessage = "Fiber Image at " + m_FiberPath + " could not be read. Aborting.";
      CPPUNIT_ASSERT_MESSAGE( errorMessage, false );
    }
    mitk::BaseData* fiberBaseData = fiberInfile.at(0);
    mitk::FiberBundleX* fiberBundle = dynamic_cast<mitk::FiberBundleX*>( fiberBaseData );

    // load parcellation
    std::vector<mitk::BaseData::Pointer> parcellationInFile = mitk::IOUtil::Load( m_ParcellationPath );
    if( parcellationInFile.empty() )
    {
      std::string errorMessage = "Parcellation at " + m_ParcellationPath + " could not be read. Aborting.";
      CPPUNIT_ASSERT_MESSAGE( errorMessage, false );
    }
    mitk::BaseData* parcellationBaseData = parcellationInFile.at(0);
    mitk::Image* parcellationImage = dynamic_cast<mitk::Image*>( parcellationBaseData );

    // do creation
    mitk::ConnectomicsNetworkCreator::Pointer connectomicsNetworkCreator = mitk::ConnectomicsNetworkCreator::New();
    connectomicsNetworkCreator->SetSegmentation( parcellationImage );
    connectomicsNetworkCreator->SetFiberBundle( fiberBundle );
    connectomicsNetworkCreator->CalculateCenterOfMass();
    connectomicsNetworkCreator->SetEndPointSearchRadius( 15 );
    connectomicsNetworkCreator->CreateNetworkFromFibersAndSegmentation();

    // load network
    std::vector<mitk::BaseData::Pointer> referenceFile = mitk::IOUtil::Load( m_ReferenceNetworkPath );
    if( referenceFile.empty() )
    {
      std::string errorMessage = "Reference Network at " + m_ReferenceNetworkPath + " could not be read. Aborting.";
      CPPUNIT_ASSERT_MESSAGE( errorMessage, false );
    }
    mitk::BaseData* referenceBaseData = referenceFile.at(0);
    mitk::ConnectomicsNetwork* referenceNetwork = dynamic_cast<mitk::ConnectomicsNetwork*>( referenceBaseData );

    mitk::ConnectomicsNetwork::Pointer network = connectomicsNetworkCreator->GetNetwork();

    CPPUNIT_ASSERT_MESSAGE( "Comparing created and reference network.", mitk::Equal( network.GetPointer(), referenceNetwork, mitk::eps, true) );

  }
};

MITK_TEST_SUITE_REGISTRATION(mitkConnectomicsNetworkCreation)


text:
package org.apache.camel.component.vertx.kafka.offset;

/**
 * Can be used for forcing manual offset commit when using Kafka consumer.
 */
public interface VertxKafkaManualCommit {

    /**
     * Commit offsets to Kafka
     */
    void commit();
}


text:
// ==========================================================================
//  Squidex Headless CMS
// ==========================================================================
//  Copyright (c) Squidex UG (haftungsbeschraenkt)
//  All rights reserved. Licensed under the MIT license.
// ==========================================================================

using System.Linq;
using System.Threading.Tasks;
using IdentityServer4.AccessTokenValidation;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using Squidex.Infrastructure.Security;
using Squidex.Infrastructure.Tasks;
using Squidex.Shared.Identity;

namespace Squidex.Pipeline
{
    public sealed class ApiPermissionAttribute : AuthorizeAttribute, IAsyncActionFilter
    {
        private readonly string[] permissionIds;

        public ApiPermissionAttribute(params string[] ids)
        {
            AuthenticationSchemes = IdentityServerAuthenticationDefaults.AuthenticationScheme;

            permissionIds = ids;
        }

        public Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
        {
            if (permissionIds.Length > 0)
            {
                var set = new PermissionSet(
                    context.HttpContext.User.FindAll(SquidexClaimTypes.Permissions)
                        .Select(x => x.Value)
                        .Select(x => new Permission(x)));

                var hasPermission = false;

                foreach (var permissionId in permissionIds)
                {
                    var id = permissionId;

                    foreach (var routeParam in context.RouteData.Values)
                    {
                        id = id.Replace($"{{{routeParam.Key}}}", routeParam.Value?.ToString());
                    }

                    hasPermission |= set.Allows(new Permission(id));
                }

                if (!hasPermission)
                {
                    context.Result = new StatusCodeResult(403);

                    return TaskHelper.Done;
                }
            }

            return next();
        }
    }
}


text:
<!-- Copyright (C) 2016 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<resources>
    <!-- Title for the application. [CHAR LIMIT=12] -->
    <string name="app_name">Learn Chinese</string>

    <!-- Category name for greetings [CHAR LIMIT=20] -->
    <string name="category_greetings">Greetings</string>
    <string name="hello_greeting">Hello</string>
    <string name="how_are_you_greeting">How are you?</string>
    <string name="i_am_fine_greeting">I\'m fine, thank you.</string>
    <string name="my_name_is_greeting">My name is...</string>
    <string name="nice_to_meet_you_greeting">Nice to meet you.</string>
    <string name="goodbye_greeting">Goodbye</string>
    <string name="speak_eng_question_greeting">Do you speak English?</string>
    <string name="yes_speak_eng_greeting">Yes, I speak English.</string>
    <string name="no_speak_eng_greeting">No, I don\'t speak English.</string>

    <!-- Category name for foods [CHAR LIMIT=20] -->
    <string name="category_foods">Foods</string>
    <string name="hungry_foods">hungry</string>
    <string name="thirsty_food">thirsty</string>
    <string name="eaten_enough_food">eaten enough</string>
    <string name="breakfast_food">breakfast</string>
    <string name="lunch_food">lunch</string>
    <string name="dinner_food">dinner</string>
    <string name="bread_food">bread</string>
    <string name="meat_food">meat</string>
    <string name="soup_food">soup</string>
    <string name="fruit_food">fruit</string>
    <string name="salad_food">salad</string>
    <string name="tea_food">tea</string>
    <string name="coffee_food">coffee</string>
    <string name="french_fries_food">french fries</string>
    <string name="sausage_food">sausage</string>
    <string name="cake_food">cake</string>
    <string name="cheese_food">cheese</string>
    <string name="apple_food">apple</string>
    <string name="orange_food">orange</string>
    <string name="banana_food">banana</string>
    <string name="sugar_food">sugar</string>
    <string name="salt_food">salt</string>
    <string name="pepper_food">pepper</string>

    <!-- Category name for the vocabulary words for colors [CHAR LIMIT=20] -->
    <string name="category_colors">Colors</string>
    <string name="white_color">white</string>
    <string name="black_color">black</string>
    <string name="red_color">red</string>
    <string name="yellow_color">yellow</string>
    <string name="green_color">green</string>
    <string name="blue_color">blue</string>
    <string name="brown_color">brown</string>
    <string name="orange_color">orange</string>
    <string name="grey_color">grey</string>
    <string name="pink_color">pink</string>
    <string name="purple_color">purple</string>

    <!-- Category name for the vocabulary words for numbers [CHAR LIMIT=20] -->
    <string name="category_numbers">Numbers</string>
    <string name="one_numbers">one</string>
    <string name="two_numbers">two</string>
    <string name="three_numbers">three</string>
    <string name="four_numbers">four</string>
    <string name="five_numbers">five</string>
    <string name="six_numbers">six</string>
    <string name="seven_numbers">seven</string>
    <string name="eight_numbers">eight</string>
    <string name="nine_numbers">nine</string>
    <string name="ten_numbers">ten</string>

    <!-- Category name for the vocabulary words for family members [CHAR LIMIT=20] -->
    <string name="category_family">Family</string>
    <string name="friend_family">friend</string>
    <string name="son_family">son</string>
    <string name="daughter_family">daughter</string>
    <string name="wife_family">wife</string>
    <string name="husband_family">husband</string>
    <string name="mother_family">mother</string>
    <string name="father_family">father</string>
    <string name="grandma_family">grandma</string>
    <string name="grandpa_family">grandpa</string>
    <string name="older_brother_family">older brother</string>
    <string name="younger_brother_family">younger brother</string>
    <string name="younger_sister_family">younger sister</string>
    <string name="older_sister_family">older sister</string>
</resources>


text:
require "spec_helper"

module RSpec::Rails
  describe HelperExampleGroup::InstanceMethods do
    module ::FoosHelper; end
    subject { HelperExampleGroup }

    it { should be_included_in_files_in('./spec/helpers/') }
    it { should be_included_in_files_in('.\\spec\\helpers\\') }

    it "provides a controller_path based on the helper module's name" do
      helper_spec = Object.new.extend HelperExampleGroup::InstanceMethods
      helper_spec.stub_chain(:example, :example_group, :describes).and_return(FoosHelper)
      helper_spec.__send__(:_controller_path).should == "foos"
    end

    it "adds :type => :helper to the metadata" do
      group = RSpec::Core::ExampleGroup.describe do
        include HelperExampleGroup
      end
      group.metadata[:type].should eq(:helper)
    end

    describe "#helper" do
      it "returns the instance of AV::Base provided by AV::TC::Behavior" do
        helper_spec = Object.new.extend HelperExampleGroup::InstanceMethods
        helper_spec.should_receive(:view_assigns)
        av_tc_b_view = double('_view')
        av_tc_b_view.should_receive(:assign)
        helper_spec.stub(:_view) { av_tc_b_view }
        helper_spec.helper.should eq(av_tc_b_view)
      end

      before do
        Object.const_set(:ApplicationHelper, Module.new)
      end

      after do
        Object.__send__(:remove_const, :ApplicationHelper)
      end

      it "includes ApplicationHelper" do
        group = RSpec::Core::ExampleGroup.describe do
          include HelperExampleGroup
          def _view
            ActionView::Base.new
          end
        end
        group.new.helper.should be_kind_of(ApplicationHelper)
      end
    end
  end

  describe HelperExampleGroup::ClassMethods do
    describe "determine_default_helper_class" do
      it "returns the helper module passed to describe" do
        helper_spec = Object.new.extend HelperExampleGroup::ClassMethods
        helper_spec.stub(:describes) { FoosHelper }
        helper_spec.determine_default_helper_class("ignore this").
          should eq(FoosHelper)
      end
    end
  end
end


text:
package com.twitter.server.handler

import com.twitter.conversions.time._
import com.twitter.finagle.client.StackClient
import com.twitter.finagle.util.StackRegistry
import com.twitter.finagle.{Stack, param}
import com.twitter.finagle.http.{Request, Status}
import com.twitter.server.util.MetricSourceTest
import com.twitter.util.Await
import com.twitter.util.Time
import org.junit.runner.RunWith
import org.scalatest.FunSuite
import org.scalatest.junit.JUnitRunner

@RunWith(classOf[JUnitRunner])
class ClientRegistryHandlerTest extends FunSuite {
  test("query a client") {
    val metricsCtx = new MetricSourceTest.Ctx
    import metricsCtx._

    val registry = new StackRegistry { def registryName: String = "client" }
    registry.register("localhost:8080", StackClient.newStack, Stack.Params.empty + param.Label("client0"))
    registry.register("localhost:8081", StackClient.newStack, Stack.Params.empty + param.Label("s/foo/bar"))
    val handler = new ClientRegistryHandler("/admin/clients/", source, registry)

    val res = Await.result(handler(Request("/admin/clients/client0")))
    assert(res.status == Status.Ok)
    val content = res.contentString
    assert(content.contains("client0"))
    assert(content.contains("localhost:8080"))

    val res2 = Await.result(handler(Request("/admin/clients/s/foo/bar")))
    assert(res2.status == Status.Ok)
    val content2 = res2.contentString
    assert(content2.contains("s/foo/bar"))
    assert(content2.contains("localhost:8081"))

    val res1 = Await.result(handler(Request("/admin/clients/client1")))
    assert(res1.status == Status.NotFound)
  }

  test("client profile") {
    Time.withCurrentTimeFrozen { tc =>
      val metricsCtx = new MetricSourceTest.Ctx
      import metricsCtx._

      val registry = new StackRegistry { def registryName: String = "client"}
      registry.register("localhost:8080", StackClient.newStack, Stack.Params.empty + param.Label("client0"))

      val handler = new ClientRegistryHandler("/admin/clients/", source, registry)

      tc.advance(1.second)
      val req = Request("/admin/clients/index.html")
      assert(Await.result(handler(req)).contentString == "")

      underlying = Map(
        "clnt/client0/loadbalancer/adds" -> Entry(10.0, 10.0),
        "clnt/client0/loadbalancer/size" -> Entry(10.0, 10.0),
        "clnt/client0/loadbalancer/available" -> Entry(5.0, 5.0),
        "clnt/client0/requests" -> Entry(50, 50),
        "clnt/client0/failures" -> Entry(1, 1))

      tc.advance(2.seconds)
      val res = Await.result(handler(req))
      val html = res.contentString
      assert(html.contains("client0"))
      assert(html.contains("localhost:8080"))
      assert(html.contains("5 unavailable"))
      assert(html.contains("98.00%"))
    }
  }
}