text:
package io.truthencode.toad.verticle

import io.truthencode.toad.config.CommonImplicits._
import io.truthencode.toad.config.cfg
import io.vertx.core._
import io.vertx.core.dns.AddressResolverOptions
import io.vertx.core.eventbus.EventBusOptions
import monix.eval.Task
import monix.execution.Scheduler.Implicits.global
import org.slf4j.{Logger, LoggerFactory}

import java.net.{InetAddress, UnknownHostException}
import scala.concurrent.duration
import scala.language.postfixOps
/**
 * Created by adarr on 7/7/2016.
 */
object VertxService {

  import scala.concurrent.duration._

  final val DefaultDuration = 180 seconds

  private def toBilliSeconds(l: Long) = {
    l * 1000 * 1000000
  }

  final val DefaultTTL = 90
  val logger: Logger = LoggerFactory.getLogger(getClass.getSimpleName)
  @throws[UnknownHostException]
  private[verticle] def startClustered: Future[Vertx] = {

    val ipv4: String = InetAddress.getLocalHost.getHostAddress
    val options: VertxOptions =
      new VertxOptions().setEventBusOptions(new EventBusOptions().setHost(ipv4).setClusterPublicHost(ipv4))
    Vertx.clusteredVertx(options)
  }

  def startVertxSync(timeout: Duration = DefaultDuration): Promise[Vertx] = {
    val promise: Promise[Vertx] = startVertXAsync()
    val sleepTimer = 7.seconds
    val tooLong: Duration = Duration(timeout.toMillis / sleepTimer.toMillis, duration.SECONDS)

    logger.info(s"Synchronously starting VertX with ${tooLong.toSeconds} second Timeout")
    val task: Task[Boolean] =
      for {
        _ <- Task.sleep(sleepTimer)
        r <- Task { logger.info("Waiting..."); promise.future().isComplete }
      } yield r

    task
      .restartUntil((completed) => {
        completed
      })
      .runSyncUnsafe(tooLong)

    promise
  }

  /**
   * Initializes a clustered vertx instance Asynchronously
   *
   * @return
   *   Initialized Future containing Vertx instance or exception
   */
  def startVertXAsync(): Promise[Vertx] = {
    logger.info("Starting Vertx (Async)")
    val promise: Promise[Vertx] = Promise.promise()
    val addOpts = new AddressResolverOptions()
      .setCacheMinTimeToLive(DefaultTTL) // 90 second min cache ttl
      .setCacheNegativeTimeToLive(DefaultTTL)
    // FIXME: change MaxEventLoopExecutionTime back to a more reasonable number or fix blocking to accept the default
    val blockDelay: Long = toBilliSeconds(10)
    val options = new VertxOptions()
      .setMaxEventLoopExecuteTime(blockDelay)
      .setAddressResolverOptions(addOpts)

    // Launch SSL base verticle on success
    promise.future().onSuccess { server =>
      server.getOrCreateContext().config().mergeIn(cfg.root)

      val sslVerticle = classOf[WebSSLCapableServerVerticle].getName
      logger.info("Launching SSL Verticle")
      server.deployVerticle(sslVerticle, new DeploymentOptions().mergeConfig())
    }

    Vertx.clusteredVertx(options, promise)
    promise
  }

  /**
   * Initializes the Vertx engine synchronously
   *
   * @note
   *   internally calls [[io.truthencode.toad.verticle.VertxService#startVertXAsync()]] with a blocking call.
   * @param timeout
   *   maximum wait time to block before failing. (defaults to [[DefaultDuration]]
   * @return
   *   A Vertx instance or exception in the case of failure.
   */
  def startVertx(timeout: Duration = DefaultDuration): Vertx = {
    logger.info("Starting Vert.x Service")
    startVertxSync().future().result()
  }

  def fooBar(): Unit = {
    val ipv4 = InetAddress.getLocalHost.getHostAddress
    val options = new VertxOptions().setEventBusOptions(new EventBusOptions().setHost(ipv4).setClusterPublicHost(ipv4))
    Vertx.clusteredVertx(
      options,
      (ar: AsyncResult[Vertx]) => {
        def foo(ar: AsyncResult[Vertx]): Unit = if (ar.succeeded)
          ar.result.deployVerticle(new WebSSLCapableServerVerticle)
        else logger.error("Could not start", ar.cause)

        foo(ar)
      }
    )
  }
}


text:
<?php
/**
 * The template for displaying all single posts.
 *
 * @package _s
 */

get_header(); ?>

			<?php while ( have_posts() ) : the_post(); ?>

				<?php get_template_part( 'content', 'single' ); ?>

				<?php bootstrap2wordpress_post_nav(); ?>

				<?php
					// If comments are open or we have at least one comment, load up the comment template
					if ( comments_open() || get_comments_number() ) :
						comments_template();
					endif;
				?>

			<?php endwhile; // end of the loop. ?>

			<?php get_sidebar(); ?>

<?php get_footer(); ?>

redpajama_set_name: RedPajamaGithub


text: export {ProgressStatus, RecordStatus, UserAccess} from './value-objects/commons'


text:
require 'spec_helper'

describe Listen::Adapter::Linux do
  if linux?
    let(:listener) { double(Listen::Listener) }
    let(:adapter) { described_class.new(listener) }

    describe ".usable?" do
      it "returns always true" do
        expect(described_class).to be_usable
      end
    end

    describe '#initialize' do
      it 'requires rb-inotify gem' do
        described_class.new(listener)
        expect(defined?(INotify)).to be_true
      end
    end
  end

  if darwin?
    it "isn't usable on Darwin" do
      expect(described_class).to_not be_usable
    end
  end

  if windows?
    it "isn't usable on Windows" do
      expect(described_class).to_not be_usable
    end
  end

  if bsd?
    it "isn't usable on BSD" do
      expect(described_class).to_not be_usable
    end
  end
end


text:
package com.snowplowanalytics.snowplow.rdbloader
package interpreters

import java.io.ByteArrayInputStream
import java.nio.charset.StandardCharsets

import com.amazonaws.services.s3.AmazonS3
import com.amazonaws.services.s3.model.ObjectMetadata
import org.json4s.JObject
import com.snowplowanalytics.snowplow.scalatracker._
import com.snowplowanalytics.snowplow.scalatracker.emitters.{AsyncBatchEmitter, AsyncEmitter}

import scala.util.control.NonFatal

// This project
import config.SnowplowConfig.{Monitoring, GetMethod, PostMethod}

object TrackerInterpreter {

  val ApplicationContextSchema = "iglu:com.snowplowanalytics.monitoring.batch/application_context/jsonschema/1-0-0"
  val LoadSucceededSchema = "iglu:com.snowplowanalytics.monitoring.batch/load_succeeded/jsonschema/1-0-0"
  val LoadFailedSchema = "iglu:com.snowplowanalytics.monitoring.batch/load_failed/jsonschema/1-0-0"

  /**
   * Initialize Snowplow tracker, if `monitoring` section is properly configured
   *
   * @param monitoring config.yml `monitoring` section
   * @return some tracker if enabled, none otherwise
   */
  def initializeTracking(monitoring: Monitoring): Option[Tracker] = {
    monitoring.snowplow.flatMap(_.collector) match {
      case Some(Collector((host, port))) =>
        val emitter = monitoring.snowplow.flatMap(_.method) match {
          case Some(GetMethod) =>
            AsyncEmitter.createAndStart(host, port = port)
          case Some(PostMethod) =>
            AsyncBatchEmitter.createAndStart(host, port = port, bufferSize = 2)
          case None =>
            AsyncEmitter.createAndStart(host, port = port)
        }
        val tracker = new Tracker(List(emitter), "snowplow-rdb-loader", monitoring.snowplow.flatMap(_.appId).getOrElse("rdb-loader"))
        Some(tracker)
      case Some(_) => None
      case None => None
    }
  }

  /**
   * Track error if `tracker` is enabled. Print error otherwise
   *
   * @param tracker some tracker if enabled
   * @param error **sanitized** error message
   */
  def trackError(tracker: Option[Tracker], error: String): Unit = tracker match {
    case Some(t) =>
      t.trackUnstructEvent(SelfDescribingJson(LoadFailedSchema, JObject(Nil)))
    case None => println(error)
  }

  /**
   * Track error if `tracker` is enabled. Do nothing otherwise
   *
   * @param tracker some tracker if enabled
   */
  def trackSuccess(tracker: Option[Tracker]): Unit = tracker match {
    case Some(t) =>
      t.trackUnstructEvent(SelfDescribingJson(LoadSucceededSchema, JObject(Nil)))
    case None => ()
  }

  /**
   * Dump stdout to S3 logging object to be retrieved by EmrEtlRunner later
   *
   * @param s3Client AWS S3 client
   * @param key S3 object, retrieved from EmrEtlRunner
   * @param content plain text to write
   */
  def dumpStdout(s3Client: AmazonS3, key: S3.Key, content: String): Either[String, S3.Key] = {
    try {
      if (S3Interpreter.keyExists(s3Client, key)) {
        Left(s"RDB LOADER ERROR: S3 log object [$key] already exists")
      } else {
        val meta = new ObjectMetadata()
        meta.setContentLength(content.length)
        meta.setContentEncoding("text/plain")

        val (bucket, prefix) = S3.splitS3Key(key)
        val is = new ByteArrayInputStream(content.getBytes(StandardCharsets.UTF_8))
        s3Client.putObject(bucket, prefix, is, meta)
        Right(key)
      }

    } catch {
      case NonFatal(e) =>
        Left(e.toString)
    }
  }

  /**
   * Exit job with appropriate status code and printing
   * exit message (same as dumped to S3) to stdout
   *
   * @param result loading result
   * @param dumpResult S3 dumping result
   */
  def exit(result: Log, dumpResult: Either[String, S3.Key]): Int = {
    println(result)
    (result, dumpResult) match {
      case (Log.LoadingSucceeded(_), Right(key)) =>
        println(s"INFO: Logs successfully dumped to S3 [$key]")
        0
      case (Log.LoadingFailed(_, _), Right(key)) =>
        println(s"INFO: Logs successfully dumped to S3 [$key]")
        1
      case (_, Left(error)) =>
        println(s"ERROR: Log-dumping failed: [$error]")
        1
    }
  }

  /**
   * Config helper functions
   */
  private object Collector {
    def isInt(s: String): Boolean = try { s.toInt; true } catch { case _: NumberFormatException => false }

    def unapply(hostPort: String): Option[(String, Int)] =
      hostPort.split(":").toList match {
        case host :: port :: Nil if isInt(port) => Some((host, port.toInt))
        case host :: Nil => Some((host, 80))
        case _ => None
      }
  }
}


text:
//#define debug

using System;
using System.Collections.Generic;
using System.Text;
using System.IO;

namespace MapEditor.UI.FastColoredTextbox
{
    /// <summary>
    /// This class contains the source text (chars and styles).
    /// It stores a text lines, the manager of commands, undo/redo stack, styles.
    /// </summary>
    public class FileTextSource : TextSource, IDisposable
    {
        List<int> sourceFileLinePositions = new List<int>();
        FileStream fs;
        Encoding fileEncoding;
        System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer();

        /// <summary>
        /// Occurs when need to display line in the textbox
        /// </summary>
        public event EventHandler<LineNeededEventArgs> LineNeeded;

        /// <summary>
        /// Occurs when need to save line in the file
        /// </summary>
        public event EventHandler<LinePushedEventArgs> LinePushed;

        public FileTextSource(FastColoredTextBox currentTB)
            : base(currentTB)
        {
            timer.Interval = 10000;
            timer.Tick += new EventHandler(timer_Tick);
            timer.Enabled = true;
        }

        void timer_Tick(object sender, EventArgs e)
        {
            timer.Enabled = false;
            try
            {
                UnloadUnusedLines();
            }
            finally
            {
                timer.Enabled = true;
            }
        }

        private void UnloadUnusedLines()
        {
            const int margin = 2000;
            var iStartVisibleLine = CurrentTB.VisibleRange.Start.iLine;
            var iFinishVisibleLine = CurrentTB.VisibleRange.End.iLine;

            int count = 0;
            for (int i = 0; i < Count; i++)
                if (base.lines[i] != null && !base.lines[i].IsChanged && Math.Abs(i - iFinishVisibleLine) > margin)
                {
                    base.lines[i] = null;
                    count++;
                }
            #if debug
            Console.WriteLine("UnloadUnusedLines: " + count);
            #endif
        }

        public void OpenFile(string fileName, Encoding enc)
        {
            Clear();

            if (fs != null)
                fs.Dispose();

            //read lines of file
            fs = new FileStream(fileName, FileMode.Open);
            var length = fs.Length;
            //read signature
            enc = DefineEncoding(enc, fs);
            int shift = DefineShift(enc);
            //first line
            sourceFileLinePositions.Add((int)fs.Position);
            base.lines.Add(null);
            //other lines
            while(fs.Position < length)
            {
                var b = fs.ReadByte();
                if (b == 10)// char \n
                {
                    sourceFileLinePositions.Add((int)(fs.Position) + shift);
                    base.lines.Add(null);
                }
            }

            Line[] temp = new Line[100];
            var c = base.lines.Count;
            base.lines.AddRange(temp);
            base.lines.TrimExcess();
            base.lines.RemoveRange(c, temp.Length);

            int[] temp2 = new int[100];
            c = base.lines.Count;
            sourceFileLinePositions.AddRange(temp2);
            sourceFileLinePositions.TrimExcess();
            sourceFileLinePositions.RemoveRange(c, temp.Length);

            fileEncoding = enc;

            OnLineInserted(0, Count);
            //load first lines for calc width of the text
            var linesCount = Math.Min(lines.Count, CurrentTB.ClientRectangle.Height/CurrentTB.CharHeight);
            for (int i = 0; i < linesCount; i++)
                LoadLineFromSourceFile(i);
            //
            NeedRecalc(new TextChangedEventArgs(0, linesCount - 1));
            if (CurrentTB.WordWrap)
                OnRecalcWordWrap(new TextChangedEventArgs(0, linesCount - 1));
        }

        private int DefineShift(Encoding enc)
        {
            if (enc.IsSingleByte)
                return 0;

            if (enc.HeaderName == "unicodeFFFE")
                return 0;//UTF16 BE

            if (enc.HeaderName == "utf-16")
                return 1;//UTF16 LE

            if (enc.HeaderName == "utf-32BE")
                return 0;//UTF32 BE

            if (enc.HeaderName == "utf-32")
                return 3;//UTF32 LE

            return 0;
        }

        private static Encoding DefineEncoding(Encoding enc, FileStream fs)
        {
            int bytesPerSignature = 0;
            byte[] signature = new byte[4];
            int c = fs.Read(signature, 0, 4);
            if (signature[0] == 0xFF && signature[1] == 0xFE && signature[2] == 0x00 && signature[3] == 0x00 && c >= 4)
            {
                enc = Encoding.UTF32;//UTF32 LE
                bytesPerSignature = 4;
            }
            else
            if (signature[0] == 0x00 && signature[1] == 0x00 && signature[2] == 0xFE && signature[3] == 0xFF)
            {
                enc = new UTF32Encoding(true, true);//UTF32 BE
                bytesPerSignature = 4;
            }
            else
            if (signature[0] == 0xEF && signature[1] == 0xBB && signature[2] == 0xBF)
            {
                enc = Encoding.UTF8;//UTF8
                bytesPerSignature = 3;
            }
            else
            if (signature[0] == 0xFE && signature[1] == 0xFF)
            {
                enc = Encoding.BigEndianUnicode;//UTF16 BE
                bytesPerSignature = 2;
            }
            else
            if (signature[0] == 0xFF && signature[1] == 0xFE)
            {
                enc = Encoding.Unicode;//UTF16 LE
                bytesPerSignature = 2;
            }

            fs.Seek(bytesPerSignature, SeekOrigin.Begin);

            return enc;
        }

        public void CloseFile()
        {
            if(fs!=null)
                try
                {
                    fs.Dispose();
                }
                catch
                {
                    ;
                }
            fs = null;
        }

        public override void SaveToFile(string fileName, Encoding enc)
        {
            //
            var newLinePos = new List<int>(Count);
            //create temp file
            var dir = Path.GetDirectoryName(fileName);
            var tempFileName = Path.Combine(dir, Path.GetFileNameWithoutExtension(fileName) + ".tmp");

            StreamReader sr = new StreamReader(fs, fileEncoding);
            using (FileStream tempFs = new FileStream(tempFileName, FileMode.Create))
            using (StreamWriter sw = new StreamWriter(tempFs, enc))
            {
                sw.Flush();

                for (int i = 0; i < Count; i++)
                {
                    newLinePos.Add((int)tempFs.Length);

                    var sourceLine = ReadLine(sr, i);//read line from source file
                    string line;

                    bool lineIsChanged = lines[i] != null && lines[i].IsChanged;

                    if (lineIsChanged)
                        line = lines[i].Text;
                    else
                        line = sourceLine;

                    //call event handler
                    if (LinePushed != null)
                    {
                        var args = new LinePushedEventArgs(sourceLine, i, lineIsChanged ? line : null);
                        LinePushed(this, args);

                        if(args.SavedText != null)
                            line = args.SavedText;
                    }

                    //save line to file
                    if (i == Count - 1)
                        sw.Write(line);
                    else
                        sw.WriteLine(line);

                    sw.Flush();
                }
            }

            //clear lines buffer
            for (int i = 0; i < Count; i++)
                lines[i] = null;
            //deattach from source file
            sr.Dispose();
            fs.Dispose();
            //delete target file
            if (File.Exists(fileName))
                File.Delete(fileName);
            //rename temp file
            File.Move(tempFileName, fileName);

            //binding to new file
            sourceFileLinePositions = newLinePos;
            fs = new FileStream(fileName, FileMode.Open);
            this.fileEncoding = enc;
        }

        private string ReadLine(StreamReader sr, int i)
        {
            string line;
            var filePos = sourceFileLinePositions[i];
            if (filePos < 0)
                return "";
            fs.Seek(filePos, SeekOrigin.Begin);
            sr.DiscardBufferedData();
            line = sr.ReadLine();
            return line;
        }

        public override void ClearIsChanged()
        {
            foreach (var line in lines)
                if(line!=null)
                    line.IsChanged = false;
        }

        public override Line this[int i]
        {
            get
            {
                if (base.lines[i] != null)
                    return lines[i];
                else
                    LoadLineFromSourceFile(i);

                return lines[i];
            }
            set
            {
                throw new NotImplementedException();
            }
        }

        private void LoadLineFromSourceFile(int i)
        {
            var line = CreateLine();
            fs.Seek(sourceFileLinePositions[i], SeekOrigin.Begin);
            StreamReader sr = new StreamReader(fs, fileEncoding);

            var s = sr.ReadLine();
            if (s == null)
                s = "";

            //call event handler
            if(LineNeeded!=null)
            {
                var args = new LineNeededEventArgs(s, i);
                LineNeeded(this, args);
                s = args.DisplayedLineText;
                if (s == null)
                    return;
            }

            foreach (char c in s)
                line.Add(new Char(c));
            base.lines[i] = line;

            if (CurrentTB.WordWrap)
                OnRecalcWordWrap(new TextChangedEventArgs(i, i));
        }

        public override void InsertLine(int index, Line line)
        {
            sourceFileLinePositions.Insert(index, -1);
            base.InsertLine(index, line);
        }

        public override void RemoveLine(int index, int count)
        {
            sourceFileLinePositions.RemoveRange(index, count);
            base.RemoveLine(index, count);
        }

        public override void Clear()
        {
            base.Clear();
        }

        public override int GetLineLength(int i)
        {
            if (base.lines[i] == null)
                return 0;
            else
                return base.lines[i].Count;
        }

        public override bool LineHasFoldingStartMarker(int iLine)
        {
            if (lines[iLine] == null)
                return false;
            else
                return !string.IsNullOrEmpty(lines[iLine].FoldingStartMarker);
        }

        public override bool LineHasFoldingEndMarker(int iLine)
        {
            if (lines[iLine] == null)
                return false;
            else
                return !string.IsNullOrEmpty(lines[iLine].FoldingEndMarker);
        }

        public override void Dispose()
        {
            if (fs != null)
                fs.Dispose();

            timer.Dispose();
        }

        internal void UnloadLine(int iLine)
        {
            if (lines[iLine] != null && !lines[iLine].IsChanged)
                lines[iLine] = null;
        }
    }

    public class LineNeededEventArgs : EventArgs
    {
        public string SourceLineText { get; private set; }
        public int DisplayedLineIndex { get; private set; }
        /// <summary>
        /// This text will be displayed in textbox
        /// </summary>
        public string DisplayedLineText { get; set; }

        public LineNeededEventArgs(string sourceLineText, int displayedLineIndex)
        {
            this.SourceLineText = sourceLineText;
            this.DisplayedLineIndex = displayedLineIndex;
            this.DisplayedLineText = sourceLineText;
        }
    }

    public class LinePushedEventArgs : EventArgs
    {
        public string SourceLineText { get; private set; }
        public int DisplayedLineIndex { get; private set; }
        /// <summary>
        /// This property contains only changed text.
        /// If text of line is not changed, this property contains null.
        /// </summary>
        public string DisplayedLineText { get; private set; }
        /// <summary>
        /// This text will be saved in the file
        /// </summary>
        public string SavedText { get; set; }

        public LinePushedEventArgs(string sourceLineText, int displayedLineIndex, string displayedLineText)
        {
            this.SourceLineText = sourceLineText;
            this.DisplayedLineIndex = displayedLineIndex;
            this.DisplayedLineText = displayedLineText;
            this.SavedText = displayedLineText;
        }
    }
}


text:
package hudson.model;

import hudson.Extension;
import hudson.ExtensionList;
import hudson.ExtensionPoint;
import java.util.Collection;
import java.util.Collections;
import jenkins.model.TransientActionFactory;

/**
 * Extension point for inserting transient {@link Action}s into {@link Run}s.
 *
 * To register your implementation, put {@link Extension} on your subtype.
 *
 * @author Lucie Votypkova
 * @since 1.458
 * @see Action
 * @deprecated Does not contribute to {@link Run#getActions}. Use {@link TransientActionFactory} instead.
 */
@Deprecated
public abstract class TransientBuildActionFactory implements ExtensionPoint {
    /**
     * Creates actions for the given build.
     *
     * @param target for which the action objects are requested. Never null.
     * @return Can be empty but must not be null.
     */
    public Collection<? extends Action> createFor(Run target) {
        if (target instanceof AbstractBuild)
            return createFor((AbstractBuild)target);
        else
            return Collections.emptyList();
    }

    /**
     * @deprecated as of 1.461
     *      Override and call {@link #createFor(Run)} instead.
     */
    @Deprecated
    public Collection<? extends Action> createFor(AbstractBuild target) {
        return Collections.emptyList();
    }

    /**
     * Returns all the registered {@link TransientBuildActionFactory}s.
     */
    public static ExtensionList<TransientBuildActionFactory> all() {
        return ExtensionList.lookup(TransientBuildActionFactory.class);
    }
}


text:
class CreateRigPictures < ActiveRecord::Migration
  def change
    create_table :rig_pictures do |t|
      t.integer :rig_id

      t.timestamps
    end
  end
end


text:
package org.phpmaven.php.test;

import java.io.File;

import org.apache.maven.execution.MavenSession;
import org.codehaus.plexus.util.xml.Xpp3Dom;
import org.phpmaven.core.ExecutionUtils;
import org.phpmaven.core.IComponentFactory;
import org.phpmaven.exec.IPhpExecutableConfiguration;
import org.phpmaven.phpexec.library.PhpException;
import org.phpmaven.phpexec.library.PhpVersion;
import org.phpmaven.test.AbstractTestCase;

/**
 * test cases for PHP version detection.
 *
 * @author Martin Eisengardt <Martin.Eisengardt@googlemail.com>
 * @since 2.0.0
 */
public class GetVersionTest extends AbstractTestCase {

    /**
     * Tests if the version can be detected.
     *
     * @throws Exception thrown on errors
     */
    public void testGetVersion4() throws Exception {
        // look up the component factory
        final IComponentFactory factory = lookup(IComponentFactory.class);
        // create the execution config
        final MavenSession session = this.createSimpleSession("exec/version");
        final Xpp3Dom dom = new Xpp3Dom("configuration");
        final Xpp3Dom exec = new Xpp3Dom("executable");
        if (ExecutionUtils.isWindows()) {
            exec.setValue(session.getCurrentProject().getBasedir() + "/php4.cmd");
        } else {
            // try chmod
            final String[] cmd = {
                "chmod",
                "777",
                new File(session.getCurrentProject().getBasedir(), "php4").getAbsolutePath()};
            final Process p = Runtime.getRuntime().exec(cmd);
            p.waitFor();
            exec.setValue(session.getCurrentProject().getBasedir() + "/php4");
        }
        dom.addChild(exec);

        final IPhpExecutableConfiguration execConfig = factory.lookup(
                IPhpExecutableConfiguration.class,
                new Xpp3Dom[]{dom},
                session);

        assertEquals(PhpVersion.PHP4, execConfig.getPhpExecutable().getVersion());
    }

    /**
     * Tests if the version can be detected.
     *
     * @throws Exception thrown on errors
     */
    public void testGetVersion5() throws Exception {
        // look up the component factory
        final IComponentFactory factory = lookup(IComponentFactory.class);
        // create the execution config
        final MavenSession session = this.createSimpleSession("exec/version");
        final Xpp3Dom dom = new Xpp3Dom("configuration");
        final Xpp3Dom exec = new Xpp3Dom("executable");
        if (ExecutionUtils.isWindows()) {
            exec.setValue(session.getCurrentProject().getBasedir() + "/php5.cmd");
        } else {
            // try chmod
            final String[] cmd = {
                "chmod",
                "777",
                new File(session.getCurrentProject().getBasedir(), "php5").getAbsolutePath()};
            final Process p = Runtime.getRuntime().exec(cmd);
            p.waitFor();
            exec.setValue(session.getCurrentProject().getBasedir() + "/php5");
        }
        dom.addChild(exec);

        final IPhpExecutableConfiguration execConfig = factory.lookup(
                IPhpExecutableConfiguration.class,
                new Xpp3Dom[]{dom},
                session);

        assertEquals(PhpVersion.PHP5, execConfig.getPhpExecutable().getVersion());
    }

    /**
     * Tests if the version can be detected.
     *
     * @throws Exception thrown on errors
     */
    public void testGetVersion6() throws Exception {
        // look up the component factory
        final IComponentFactory factory = lookup(IComponentFactory.class);
        // create the execution config
        final MavenSession session = this.createSimpleSession("exec/version");
        final Xpp3Dom dom = new Xpp3Dom("configuration");
        final Xpp3Dom exec = new Xpp3Dom("executable");
        if (ExecutionUtils.isWindows()) {
            exec.setValue(session.getCurrentProject().getBasedir() + "/php6.cmd");
        } else {
            // try chmod
            final String[] cmd = {
                "chmod",
                "777",
                new File(session.getCurrentProject().getBasedir(), "php6").getAbsolutePath()};
            final Process p = Runtime.getRuntime().exec(cmd);
            p.waitFor();
            exec.setValue(session.getCurrentProject().getBasedir() + "/php6");
        }
        dom.addChild(exec);

        final IPhpExecutableConfiguration execConfig = factory.lookup(
                IPhpExecutableConfiguration.class,
                new Xpp3Dom[]{dom},
                session);

        assertEquals(PhpVersion.PHP6, execConfig.getPhpExecutable().getVersion());
    }

    /**
     * Tests if the version can be detected.
     *
     * @throws Exception thrown on errors
     */
    public void testGetVersionUnknown() throws Exception {
        // look up the component factory
        final IComponentFactory factory = lookup(IComponentFactory.class);
        // create the execution config
        final MavenSession session = this.createSimpleSession("exec/version");
        final Xpp3Dom dom = new Xpp3Dom("configuration");
        final Xpp3Dom exec = new Xpp3Dom("executable");
        if (ExecutionUtils.isWindows()) {
            exec.setValue(session.getCurrentProject().getBasedir() + "/phpUnknown.cmd");
        } else {
            // try chmod
            final String[] cmd = {
                "chmod",
                "777",
                new File(session.getCurrentProject().getBasedir(), "phpUnknown").getAbsolutePath()};
            final Process p = Runtime.getRuntime().exec(cmd);
            p.waitFor();
            exec.setValue(session.getCurrentProject().getBasedir() + "/phpUnknown");
        }
        dom.addChild(exec);

        final IPhpExecutableConfiguration execConfig = factory.lookup(
                IPhpExecutableConfiguration.class,
                new Xpp3Dom[]{dom},
                session);

        assertEquals(PhpVersion.UNKNOWN, execConfig.getPhpExecutable().getVersion());
    }

    /**
     * Tests if the version can be detected.
     *
     * @throws Exception thrown on errors
     */
    public void testGetVersionIllegal() throws Exception {
        // look up the component factory
        final IComponentFactory factory = lookup(IComponentFactory.class);
        // create the execution config
        final MavenSession session = this.createSimpleSession("exec/version");
        final Xpp3Dom dom = new Xpp3Dom("configuration");
        final Xpp3Dom exec = new Xpp3Dom("executable");
        if (ExecutionUtils.isWindows()) {
            exec.setValue(session.getCurrentProject().getBasedir() + "/phpIllegal.cmd");
        } else {
            // try chmod
            final String[] cmd = {
                "chmod",
                "777",
                new File(session.getCurrentProject().getBasedir(), "phpIllegal").getAbsolutePath()};
            final Process p = Runtime.getRuntime().exec(cmd);
            p.waitFor();
            exec.setValue(session.getCurrentProject().getBasedir() + "/phpIllegal");
        }
        dom.addChild(exec);

        final IPhpExecutableConfiguration execConfig = factory.lookup(
                IPhpExecutableConfiguration.class,
                new Xpp3Dom[]{dom},
                session);

        try {
            execConfig.getPhpExecutable().getVersion();
            fail("Expected exception not thrown");
        // CHECKSTYLE:OFF
        // checkstyle does not like empty catches
        } catch (PhpException ex) {
            // ignore; we expect this exception
        }
        // CHECKSTYLE:ON
    }

    /**
     * Tests if the version can be detected.
     *
     * @throws Exception thrown on errors
     */
    public void testGetVersion4NotCached() throws Exception {
        // look up the component factory
        final IComponentFactory factory = lookup(IComponentFactory.class);
        // create the execution config
        final MavenSession session = this.createSimpleSession("exec/version");
        final Xpp3Dom dom = new Xpp3Dom("configuration");
        final Xpp3Dom exec = new Xpp3Dom("executable");
        if (ExecutionUtils.isWindows()) {
            exec.setValue(session.getCurrentProject().getBasedir() + "/php4.cmd");
        } else {
            // try chmod
            final String[] cmd = {
                "chmod",
                "777",
                new File(session.getCurrentProject().getBasedir(), "php4").getAbsolutePath()};
            final Process p = Runtime.getRuntime().exec(cmd);
            p.waitFor();
            exec.setValue(session.getCurrentProject().getBasedir() + "/php4");
        }
        dom.addChild(exec);

        final IPhpExecutableConfiguration execConfig = factory.lookup(
                IPhpExecutableConfiguration.class,
                new Xpp3Dom[]{dom},
                session);
        execConfig.setUseCache(false);

        assertEquals(PhpVersion.PHP4, execConfig.getPhpExecutable().getVersion());
    }

    /**
     * Tests if the version can be detected.
     *
     * @throws Exception thrown on errors
     */
    public void testGetVersion5NotCached() throws Exception {
        // look up the component factory
        final IComponentFactory factory = lookup(IComponentFactory.class);
        // create the execution config
        final MavenSession session = this.createSimpleSession("exec/version");
        final Xpp3Dom dom = new Xpp3Dom("configuration");
        final Xpp3Dom exec = new Xpp3Dom("executable");
        if (ExecutionUtils.isWindows()) {
            exec.setValue(session.getCurrentProject().getBasedir() + "/php5.cmd");
        } else {
            // try chmod
            final String[] cmd = {
                "chmod",
                "777",
                new File(session.getCurrentProject().getBasedir(), "php5").getAbsolutePath()};
            final Process p = Runtime.getRuntime().exec(cmd);
            p.waitFor();
            exec.setValue(session.getCurrentProject().getBasedir() + "/php5");
        }
        dom.addChild(exec);

        final IPhpExecutableConfiguration execConfig = factory.lookup(
                IPhpExecutableConfiguration.class,
                new Xpp3Dom[]{dom},
                session);
        execConfig.setUseCache(false);

        assertEquals(PhpVersion.PHP5, execConfig.getPhpExecutable().getVersion());
    }

    /**
     * Tests if the version can be detected.
     *
     * @throws Exception thrown on errors
     */
    public void testGetVersion6NotCached() throws Exception {
        // look up the component factory
        final IComponentFactory factory = lookup(IComponentFactory.class);
        // create the execution config
        final MavenSession session = this.createSimpleSession("exec/version");
        final Xpp3Dom dom = new Xpp3Dom("configuration");
        final Xpp3Dom exec = new Xpp3Dom("executable");
        if (ExecutionUtils.isWindows()) {
            exec.setValue(session.getCurrentProject().getBasedir() + "/php6.cmd");
        } else {
            // try chmod
            final String[] cmd = {
                "chmod",
                "777",
                new File(session.getCurrentProject().getBasedir(), "php6").getAbsolutePath()};
            final Process p = Runtime.getRuntime().exec(cmd);
            p.waitFor();
            exec.setValue(session.getCurrentProject().getBasedir() + "/php6");
        }
        dom.addChild(exec);

        final IPhpExecutableConfiguration execConfig = factory.lookup(
                IPhpExecutableConfiguration.class,
                new Xpp3Dom[]{dom},
                session);
        execConfig.setUseCache(false);

        assertEquals(PhpVersion.PHP6, execConfig.getPhpExecutable().getVersion());
    }

    /**
     * Tests if the version can be detected.
     *
     * @throws Exception thrown on errors
     */
    public void testGetVersionUnknownNotCached() throws Exception {
        // look up the component factory
        final IComponentFactory factory = lookup(IComponentFactory.class);
        // create the execution config
        final MavenSession session = this.createSimpleSession("exec/version");
        final Xpp3Dom dom = new Xpp3Dom("configuration");
        final Xpp3Dom exec = new Xpp3Dom("executable");
        if (ExecutionUtils.isWindows()) {
            exec.setValue(session.getCurrentProject().getBasedir() + "/phpUnknown.cmd");
        } else {
            // try chmod
            final String[] cmd = {
                "chmod",
                "777",
                new File(session.getCurrentProject().getBasedir(), "phpUnknown").getAbsolutePath()};
            final Process p = Runtime.getRuntime().exec(cmd);
            p.waitFor();
            exec.setValue(session.getCurrentProject().getBasedir() + "/phpUnknown");
        }
        dom.addChild(exec);

        final IPhpExecutableConfiguration execConfig = factory.lookup(
                IPhpExecutableConfiguration.class,
                new Xpp3Dom[]{dom},
                session);
        execConfig.setUseCache(false);

        assertEquals(PhpVersion.UNKNOWN, execConfig.getPhpExecutable().getVersion());
    }

    /**
     * Tests if the version can be detected.
     *
     * @throws Exception thrown on errors
     */
    public void testGetVersionIllegalNotCached() throws Exception {
        // look up the component factory
        final IComponentFactory factory = lookup(IComponentFactory.class);
        // create the execution config
        final MavenSession session = this.createSimpleSession("exec/version");
        final Xpp3Dom dom = new Xpp3Dom("configuration");
        final Xpp3Dom exec = new Xpp3Dom("executable");
        if (ExecutionUtils.isWindows()) {
            exec.setValue(session.getCurrentProject().getBasedir() + "/phpIllegal.cmd");
        } else {
            // try chmod
            final String[] cmd = {
                "chmod",
                "777",
                new File(session.getCurrentProject().getBasedir(), "phpIllegal").getAbsolutePath()};
            final Process p = Runtime.getRuntime().exec(cmd);
            p.waitFor();
            exec.setValue(session.getCurrentProject().getBasedir() + "/phpIllegal");
        }
        dom.addChild(exec);

        final IPhpExecutableConfiguration execConfig = factory.lookup(
                IPhpExecutableConfiguration.class,
                new Xpp3Dom[]{dom},
                session);
        execConfig.setUseCache(false);

        try {
            execConfig.getPhpExecutable().getVersion();
            fail("Expected exception not thrown");
        // CHECKSTYLE:OFF
        // checkstyle does not like empty catches
        } catch (PhpException ex) {
            // ignore; we expect this exception
        }
        // CHECKSTYLE:ON
    }

}


text:
var workflowDefinition = {
    Name: "testLoader",
    Steps: [
        { Name: "Step0",
            Type: "Init",
            args:
                { currentStepName: "LogActivity", status: "Ordered" },
            nextStep: "LogActivity"
        },
        { Name: "LogActivity",
            Type: "writeConsoleActivity",
            args:
                { text: "Getting a pizza order..." },
            nextStep: "StartOrder"
        },
        { Name: "StartOrder",
            Type: "createChildWorkflow",
            args:
                { workflowDefinition: "PizzaOrdering/pizzaOrderingWorkflow", parameters: {deliveryType: "Delivery"} },
            nextStep: "WaitABit"
        },
        { Name: "WaitABit",
            Type: "waitForTimer",
            args:
                { waitTime: 100 },
            nextStep: "LogActivity"
        }

    ]
}

exports.workflowDefinition = workflowDefinition;


text:
using UnityEngine;
using System.Collections;

public class bsEvent {

	public int length;
	public Touch[] touch = new Touch[5];

}