text:
#include "config.h"
#include "core/css/resolver/ElementStyleResources.h"

#include "core/css/CSSGradientValue.h"
#include "core/css/CSSSVGDocumentValue.h"
#include "core/layout/style/StyleGeneratedImage.h"
#include "core/layout/style/StyleImage.h"
#include "core/layout/style/StylePendingImage.h"
#include "platform/graphics/filters/FilterOperation.h"

namespace blink {

ElementStyleResources::ElementStyleResources()
    : m_deviceScaleFactor(1)
{
}

PassRefPtr<StyleImage> ElementStyleResources::styleImage(Document& document, const TextLinkColors& textLinkColors, Color currentColor, CSSPropertyID property, CSSValue* value)
{
    if (value->isImageValue())
        return cachedOrPendingFromValue(document, property, toCSSImageValue(value));

    if (value->isImageGeneratorValue())
        return generatedOrPendingFromValue(property, toCSSImageGeneratorValue(value));

    if (value->isImageSetValue())
        return setOrPendingFromValue(property, toCSSImageSetValue(value));

    if (value->isCursorImageValue())
        return cursorOrPendingFromValue(property, toCSSCursorImageValue(value));

    return nullptr;
}

PassRefPtr<StyleImage> ElementStyleResources::generatedOrPendingFromValue(CSSPropertyID property, CSSImageGeneratorValue* value)
{
    if (value->isPending()) {
        m_pendingImageProperties.set(property, value);
        return StylePendingImage::create(value);
    }
    return StyleGeneratedImage::create(value);
}

PassRefPtr<StyleImage> ElementStyleResources::setOrPendingFromValue(CSSPropertyID property, CSSImageSetValue* value)
{
    RefPtr<StyleImage> image = value->cachedOrPendingImageSet(m_deviceScaleFactor);
    if (image && image->isPendingImage())
        m_pendingImageProperties.set(property, value);
    return image.release();
}

PassRefPtr<StyleImage> ElementStyleResources::cachedOrPendingFromValue(Document& document, CSSPropertyID property, CSSImageValue* value)
{
    RefPtr<StyleImage> image = value->cachedOrPendingImage();
    if (image) {
        if (image->isPendingImage())
            m_pendingImageProperties.set(property, value);
        else
            value->restoreCachedResourceIfNeeded(document);
    }
    return image.release();
}

PassRefPtr<StyleImage> ElementStyleResources::cursorOrPendingFromValue(CSSPropertyID property, CSSCursorImageValue* value)
{
    RefPtr<StyleImage> image = value->cachedOrPendingImage(m_deviceScaleFactor);
    if (image && image->isPendingImage())
        m_pendingImageProperties.set(property, value);
    return image.release();
}

void ElementStyleResources::clearPendingImageProperties()
{
    m_pendingImageProperties.clear();
}

void ElementStyleResources::clearPendingSVGDocuments()
{
    m_pendingSVGDocuments.clear();
}

void ElementStyleResources::addPendingSVGDocument(FilterOperation* filterOperation, CSSSVGDocumentValue* cssSVGDocumentValue)
{
    m_pendingSVGDocuments.set(filterOperation, cssSVGDocumentValue);
}

}


text:
module BrowserStack
  class Worker < ApiRequest
    attr_accessor :os,:os_version,:url,:timeout,:browser,:browser_version
    def initialize(attributes={})
      attributes.each do |name, value|
        begin
          send("#{name}=", value)
        rescue
          puts "invalid attribute #{name} in worker"
        end
      end
    end

    def valid?
       os && os_version && url
    end

    class << self
      def create_worker(params={})
        worker = Worker.new(params)
        if worker.valid?
          worker.commit("/worker","post",params)
        else
        # raise some error
          raise "Not Valid should contain os,os_version,url parameter"
        end
        worker
      end

      def treminate_worker(worker_id)
        worker = Worker.new
        worker.commit("/worker/#{worker_id}","delete")
        worker
      end

      def get_worker_status(worker_id)
        worker = Worker.new
        worker.commit("/worker/#{worker_id}")
        worker
      end

      def get_all_worker_status
        worker = Worker.new
        worker.commit("/workers")
        worker
      end
    end

  end
end

redpajama_set_name: RedPajamaGithub


text:
package com.google.idea.blaze.base.buildmodifier;

import com.google.idea.common.formatter.FormatterInstaller;
import com.intellij.openapi.components.AbstractProjectComponent;
import com.intellij.openapi.project.Project;

/** Integrates buildifier with IntelliJ's formatter. */
public class BuildifierFormatter extends AbstractProjectComponent {

  protected BuildifierFormatter(Project project) {
    super(project);
  }

  @Override
  public void projectOpened() {
    FormatterInstaller.replaceFormatter(myProject, BuildifierDelegatingCodeStyleManager::new);
  }
}


text:
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using COG.Assets;
using COG.Framework;
using COG.Graphics;
using OpenTK;
using OpenTK.Graphics;

namespace COG.Dredger
{
    //reference link http://www.javased.com/?source_dir=TeraSpout/src/main/java/org/terasology/game/modes/StateMainMenu.java
    //https://github.com/RexMorgan/Heliocentricity/tree/master/src/Heliocentricity.Common

    public abstract class GameState
    {
        protected Engine m_engine;

        public virtual void LoadResources() { }
        public virtual void UnloadResources() { }
        public virtual void Exit() { }
        public virtual void Initialize(Engine engine)
        {
            m_engine = engine;
        }

        public abstract void Update(double dt);
        public abstract void Render(double dt);
    }

    public class Engine : Registry
    {
        private static Engine g_engine;
        public static Engine Instance { get { return g_engine; } }

        public Engine()
        {
            g_engine = this;
        }

        private Config m_config;
        private GameWindow m_gameWindow;
        private AssetManager m_assets;
        private ProgramManager m_programs;
        private Stack<GameState> m_states;
        private List<Action> m_pendingStateChanges;

        private bool m_isRunning = false;

        public bool IsRunning { get { return m_isRunning; } }
        public ProgramManager Programs { get { return m_programs; } }
        public AssetManager Assets { get { return m_assets; } }
        public RegistryManager Registry { get { return m_registry; } }
        public GameWindow GameWindow { get { return m_gameWindow; } }
        public GameState CurrentState
        {
            get
            {
                if (m_states.Count == 0)
                    return null;
                return m_states.Peek();
            }
        }

        public void Run(GameState initialState)
        {
            m_isRunning = true;
            Initialize();

            ChangeState(initialState);

            m_gameWindow.Visible = true;

            ProcessStateChanges();

            var sw = Stopwatch.StartNew();
            var lastFrame = 0.0;
            //var skipped = false;
            while (m_isRunning && !m_gameWindow.IsExiting)
            {
                var current = sw.Elapsed.TotalSeconds;
                var dt = current - lastFrame;
                //if( dt < )
                //dt = 1f / 60f;

                Update(dt);

                if (m_gameWindow.IsExiting)
                    break;

                //if (skipped || dt < 0.032)
                //{
                    Render(dt);
                //    skipped = false;
                //}
                //else
                //{
                //    skipped = true;
                //}

                lastFrame = current;
                System.Threading.Thread.Sleep(1);
            }

            m_isRunning = false;

            Cleanup();
        }

        public void Stop(string message)
        {
            m_isRunning = false;
        }

        public void PushState(GameState state)
        {
            m_pendingStateChanges.Add(() =>
            {
                m_states.Push(state);
                state.Initialize(this);
            });
        }

        public void ChangeState(GameState state)
        {
            m_pendingStateChanges.Add(() =>
            {
                PurgeStates();

                m_states.Push(state);
                state.Initialize(this);
                state.LoadResources();
            });
        }

        public void PopState()
        {
            m_pendingStateChanges.Add(() =>
            {
                var state = m_states.Pop();
                state.Exit();
            });
        }

        private void PurgeStates()
        {
            if (m_states.Count > 0)
            {
                var current = m_states.Pop();
                current.UnloadResources();
                current.Exit();

                while (m_states.Count > 0)
                {
                    current = m_states.Pop();
                    //resources we're already unloaded
                    current.Exit();
                }
            }
        }

        private void Update(double dt)
        {
            var state = CurrentState;
            if (state == null)
            {
                m_isRunning = false;
                return;
            }

            state.Update(dt);

            m_gameWindow.ProcessEvents();
        }

        private void Render(double dt)
        {
            var state = CurrentState;
            if (state == null)
            {
                m_isRunning = false;
                return;
            }

            state.Render(dt);

            // Swap buffers
            m_gameWindow.SwapBuffers();

            ProcessStateChanges();
        }

        private void ProcessStateChanges()
        {
            if (m_pendingStateChanges.Count > 0)
            {
                foreach (var stateUpdate in m_pendingStateChanges)
                    stateUpdate();

                m_pendingStateChanges.Clear();
            }
        }

        private void Initialize()
        {
            m_states = new Stack<GameState>();
            m_pendingStateChanges = new List<Action>();

            //setup registry
            var m_registry = new RegistryManager();

            //setup config
            m_config = new Config();
            m_config.Load();
            m_registry.Add(m_config.Module.CreateUri("config"), m_config);

            //add engine to the registry
            m_registry.Add(m_config.Module.CreateUri("engine"), this);

            InitializeManagers();

            InitializeRenderer();
        }

        private void InitializeManagers()
        {
            m_assets = new AssetManager();
            m_assets.InitializeGraphics(m_config.Module.Name);
            m_assets.InitializeFonts();

            m_programs = m_assets.InitializePrograms(m_config.Module.Name);

            m_assets.AddAssetSource(new DirectorySource(m_config.Module.Name, "content"));
        }

        private void InitializeRenderer()
        {
            InitializeOpenTK();
            InitializeDisplay();
        }

        private void InitializeDisplay()
        {
            m_gameWindow = new GameWindow(m_config.WindowWidth, m_config.WindowHeight,
                    GraphicsMode.Default,
                    m_config.Module.Name,
                    GameWindowFlags.Default,
                    DisplayDevice.Default,
                    3, 3,
                    GraphicsContextFlags.Default
                );
            m_gameWindow.VSync = VSyncMode.Off;
        }

        private void InitializeOpenTK()
        {
            OpenTK.Toolkit.Init();
        }

        private void Cleanup()
        {
            PurgeStates();

            m_programs.Dispose();
            m_assets.Dispose();

            m_gameWindow.Dispose();
            m_gameWindow = null;
        }

        protected override void DisposeManaged()
        {
            base.DisposeManaged();

            m_registry.Dispose();
            m_registry = null;

            m_config = null; //registry will dispose object
        }
    }
}


text:
import { ChangeDetectionStrategy, Component } from "@angular/core";
import { Observable } from "rxjs";
import { List } from "immutable";

import { TodoService } from "./todo.service";
import { Todo } from "./todo.model";

@Component({
  selector: "todo-list",
  styleUrls: ["./todo-list.component.scss"],
  templateUrl: "./todo-list.component.html",
  changeDetection: ChangeDetectionStrategy.OnPush
})
export class TodoListComponent {
  todoText: string;
  todos: Observable<List<Todo>>;
  completedTodos: Observable<List<Todo>>;

  constructor(private todoService: TodoService) {
    this.todos = todoService.todos;
    this.completedTodos = todoService.completedTodos;
  }

  add() {
    this.todoService.add(<Todo>{
      text: this.todoText,
      addedTimestamp: Date.now()
    });
    this.todoText = "";
  }

  complete(todo: Todo) {
    this.todoService.complete({
      ...todo,
      done: true,
      completedTimestamp: Date.now()
    });
  }
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
        "http://www.w3.org/TR/html4/strict.dtd">

Bug 14207 :
            REGRESSION: Crash after closing a tab with Google Maps Street View

STEPS TO TEST:
    Open a new tab then close this tab.

TEST PASS:
    Expected : The tab is closed.

TEST FAIL:
    If the test FAILS : The webkit crashes.

    <embed id="target" src="resources/spinbox.swf">


text:
package com.bt.nia.koala.robustness.commands;

import java.util.List;
import java.util.Map;
import java.util.concurrent.Executor;
import java.util.concurrent.atomic.AtomicBoolean;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.bt.nia.koala.robustness.parsers.DescribeImageOutputParser;
import com.ragstorooks.testrr.ScenarioListener;

public class CheckImageStatusScenarioCommand extends PollingStringComparisonScenarioCommand {
	private static final Log log = LogFactory.getLog(CheckImageStatusScenarioCommand.class);
	private String imageIdParameter = "imageId";

	public CheckImageStatusScenarioCommand(String imageIdParameter, ScenarioRunDetails runDetails, String goodValue) {
		this(runDetails.getScenarioId(), runDetails.getScenarioListener(), runDetails.getScenarioCompleted(), runDetails.getExecutor(), runDetails.getParams(), goodValue);
		this.imageIdParameter = imageIdParameter;
	}

	public CheckImageStatusScenarioCommand(ScenarioRunDetails runDetails, String goodValue) {
		this("imageId", runDetails, goodValue);
	}

	public CheckImageStatusScenarioCommand(String scenarioId, ScenarioListener scenarioListener, AtomicBoolean scenarioCompleted, Executor executor, Map<String, Object> params, String goodValue) {
		super(scenarioId, scenarioListener, scenarioCompleted, executor, params, goodValue);
	}

	public CheckImageStatusScenarioCommand(String scenarioId, ScenarioListener scenarioListener, AtomicBoolean scenarioCompleted, Executor executor, Map<String, Object> params, String goodValue,
			String failEarlyValue) {
		super(scenarioId, scenarioListener, scenarioCompleted, executor, params, goodValue, failEarlyValue);
	}

	public CheckImageStatusScenarioCommand(String scenarioId, ScenarioListener scenarioListener, AtomicBoolean scenarioCompleted, Executor executor, Map<String, Object> params, String goodValue,
			String[] failEarlyValues) {
		super(scenarioId, scenarioListener, scenarioCompleted, executor, params, goodValue, failEarlyValues);
	}

	@Override
	protected boolean executePollingCommand(Map<String, Object> params) throws Throwable {
		String imageId = params.get(imageIdParameter).toString();
		try {
			checkStatus(params, imageId);
			return true;
		} catch (UnexpectedOutputException e) {
			log.info(e.getMessage());
			return false;
		}
	}

	@Override
	protected int getMaxNumPolls() {
		return 50;
	}

	@Override
	protected long getPollingIntervalMillis() {
		return 20 * 1000;
	}

	private void checkStatus(Map<String, Object> params, String imageId) throws Throwable {
		try {
			List<String> output = executeEc2Command("ec2dim", new String[] { imageId });

			DescribeImageOutputParser describeImageOutputParser = new DescribeImageOutputParser();
			String currentStatus = describeImageOutputParser.parse(output)[0];
			log.info(String.format("Image %s is %s ", imageId, currentStatus));

			checkString(currentStatus);

		} catch (RuntimeException ex) {
			if (ex.getMessage().contains("Exit status was 1"))
				log.info("Looks like a timeout, ignoring and carrying on");
			else
				throw ex;
		}
	}

}


text:
<?xml version="1.0" encoding="utf-8"?>

Setting Translator Roles

How to enable or disable one or more roles to have Edit Rights to translate all new pages and localized modules for a language using the Languages module. Note: A translator role is automatically created for each language upon creation of localized content. This tutorial explains how to add additional roles if required.

            In DNN Platform, any user (including unauthenticated users) who is granted Edit Module permissions. In Evoq Content and Evoq Content Enterprise, any user  (including unauthenticated users) who is granted <MadCap:annotation MadCap:createDate="2013-06-03T11:23:33.3006233+10:00" MadCap:creator="Lorraine" MadCap:initials="LO" MadCap:comment="Is this correct? I only tested on Community Edition." MadCap:editor="Lorraine" MadCap:editDate="2013-06-03T11:23:45.7663363+10:00">Edit Content </MadCap:annotation>permissions.

Navigate to Admin > Advanced Settings >  <![CDATA[ ]]>Languages - OR - Go to a Languages module.

Select the Languages tab.

In the Edit column of the Culture grid, click the Edit This Language <![CDATA[ ]]> button beside the required language. This opens the Edit Language page.

At Localized Content Translators go to the Selected Role column and <MadCap:snippetText src="../../../../../Resources/Snippets/Check.flsnp" />beside each role that can translate this language. Note: The translator role associated with this role (e.g. Translator (es-ES) ) is already checked by default. - OR - <MadCap:snippetText src="../../../../../Resources/Snippets/Uncheck.flsnp" />beside a role to remove it.

                Click the Update button.


text:
  Wenn aktiviert, müssen Sie sich mit einem Benutzernamen und Passwort anmelden, dem
  die "admin"-Rolle zugewiesen ist, um Konfigurationen zu ändern oder neue Builds
  zu starten. Die Anmeldung erfolgt über den "Anmelden"-Link oben rechts auf der Seite.

  Die Konfiguration von Benutzerkonten ist anhängig vom Webcontainer, den Sie
  einsetzen. Tomcat verwendet beispielsweise standardmäßig die Datei
  <tt>$TOMCAT_HOME/conf/tomcat-users.xml</tt>.

  Wenn Sie Hudson im Intranet (oder in einer vertrauenswürdigen Umgebung) einsetzen,
  bleibt diese Option in der Regel deaktiviert. Dadurch kann jeder Entwickler
  seine Projekte selbst konfigurieren, ohne Sie damit belästigen zu müssen.

  Wenn Sie Hudson hingegen im Internet einsetzen, sollten Sie unbedingt diese
  Option aktivieren. Hudson startet Prozesse auf Ihrem System - ein unsicheres
  Hudson-System ist daher ein sicherer Weg, "gehackt" zu werden.

  Weitere Informationen zum Thema "Sicherheit und Hudson" finden Sie
  hier.


text:
using System.Collections.Generic;

namespace MindTouch.LuceneService {

    public class ActionStack {
        private readonly List<bool> _stack = new List<bool>();

        public bool IsAdd {
            get { return (Head && Tail) || (Tail && !Head); }
        }

        public bool IsDelete {
            get { return (!Head && !Tail) || (Tail && !Head); }
        }

        private bool Head { get { return _stack[0]; } }
        private bool Tail { get { return _stack[_stack.Count - 1]; } }

        public void PushAdd() {
            _stack.Add(true);
        }

        public void PushDelete() {
            _stack.Add(false);
        }
    }
}


text:
namespace ginseng::tefri
{
	template <typename MergedFlow, typename Pipeline>
	class MergedFlowFactory : public interface::Named<MergedFlowFactory<MergedFlow, Pipeline>>
	{
	public:
		MergedFlowFactory(MergedFlow &merged_flow, typename Pipeline::Pointer pipeline)
		: merged_flow(merged_flow), pipeline(pipeline)
		{}

		template <typename Cluster>
		std::enable_if_t
		<
			util::meta::Type<Cluster>::template is_derived_from<abstract::Cluster>(),
			MergedFlowFactory &
		>
		operator,(Cluster &cluster)
		{
			cluster.set_is_multiple_flow(true);
			merged_flow.get_flows().for_each([&](auto flow)
			{
				flow.name(this->name()) >> *pipeline >> cluster;
			});

			return *this;
		}

		template <typename Subscriber>
		std::enable_if_t
		<
			util::meta::Type<Subscriber>::template is_derived_from<abstract::Interactor>(),
			MergedFlowFactory &
		>
		operator,(const Subscriber &subscriber)
		{
			merged_flow.get_flows().for_each([&](auto flow)
			{
				auto factory = flow.name(this->name()) >> *pipeline;
				if(factory.is_can_be_attached(subscriber))
					factory >> subscriber;
			});

			return *this;
		}

		MergedFlowFactory &operator,(typename Root<abstract::ErrorHandler>::Pointer error_handler)
		{
			merged_flow.get_flows().for_each([&](auto flow)
			{
				flow.name(this->name()) >> error_handler;
			});

			return *this;
		}

		MergedFlowFactory &operator,(typename Root<abstract::Completer>::Pointer completer)
		{
			implementation::MultipleFlowCompleterExecutor completer_executor(completer);
			merged_flow.get_flows().for_each([&](auto flow)
			{
				completer_executor.increase_flow_count();
				flow.name(this->name()) >> complete([completer_executor]() mutable { completer_executor(); });
			});

			return *this;
		}

		template <typename Subscriber>
		bool is_can_be_attached(const Subscriber &subscriber, std::enable_if_t<util::meta::Type<Subscriber>::template is_derived_from<abstract::Interactor>()> * = nullptr)
		{
			bool result = true;
			merged_flow.get_flows().for_each([&](auto flow)
			{
				result = result && (flow >> *pipeline).is_can_be_attached(subscriber);
			});

			return result;
		}

	private:
		MergedFlow merged_flow;
		typename Pipeline::Pointer pipeline;
	};

	template <typename MergedFlow>
	class MergedFlowFactory<MergedFlow, EmptyOperatorPipeline> : public interface::Named<MergedFlowFactory<MergedFlow, EmptyOperatorPipeline>>
	{
	public:
		MergedFlowFactory(MergedFlow &merged_flow)
		: merged_flow(merged_flow)
		{}

		template <typename Cluster>
		std::enable_if_t
		<
			util::meta::Type<Cluster>::template is_derived_from<abstract::Cluster>(),
			MergedFlowFactory &
		>
		operator,(Cluster &cluster)
		{
			cluster.set_is_multiple_flow(true);
			merged_flow.get_flows().for_each([&](auto flow)
			{
				flow.name(this->name()) >> cluster;
			});

			return *this;
		}

		template <typename Subscriber>
		std::enable_if_t
		<
			util::meta::Type<Subscriber>::template is_derived_from<abstract::Interactor>(),
			MergedFlowFactory &
		>
		operator,(const Subscriber &subscriber)
		{
			merged_flow.get_flows().for_each([&](auto flow)
			{
				if(flow.is_can_be_attached(subscriber))
					flow.name(this->name()) >> subscriber;
			});

			return *this;
		}

		MergedFlowFactory &operator,(typename Root<abstract::ErrorHandler>::Pointer error_handler)
		{
			merged_flow.get_flows().for_each([&](auto flow)
			{
				flow.name(this->name()) >> error_handler;
			});

			return *this;
		}

		MergedFlowFactory &operator,(typename Root<abstract::Completer>::Pointer completer)
		{
			implementation::MultipleFlowCompleterExecutor completer_executor(completer);
			merged_flow.get_flows().for_each([&](auto flow)
			{
				completer_executor.increase_flow_count();
				flow.name(this->name()) >> complete([completer_executor]() mutable { completer_executor(); });
			});

			return *this;
		}

		template <typename Subscriber>
		bool is_can_be_attached(const Subscriber &subscriber, std::enable_if_t<util::meta::Type<Subscriber>::template is_derived_from<abstract::Interactor>()> * = nullptr)
		{
			bool result = true;
			merged_flow.get_flows().for_each([&](auto flow)
			{
				result = result && flow.is_can_be_attached(subscriber);
			});

			return result;
		}

	private:
		MergedFlow merged_flow;
	};
}

#endif // GINSENGPROJECT_TEFRI_MERGEDFLOWFACTORY_H


text:
<?php
/**
 * Created by PhpStorm.
 * User: barry
 * Date: 09/01/14
 * Time: 20:25
 */

namespace OpenEcoles\UserBundle\Entity;
use Doctrine\ORM\EntityRepository;

/**
 * UserRepository
 *
 * This class was generated by the Doctrine ORM. Add your own custom
 * repository methods below.
 */

class MessageRepository extends EntityRepository {

}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Tuber sphaerosporum Gilkey

### Remarks
null


text:
/**
 * HTML5 Video Extend
 *
 * jQuery plugin (MIT license)
 *
 * @version 1.1.2
 * @author <andchir@gmail.com> Andchir
 */

(function($){

    var videoExtend = function(el, options){
        var base = this;

        // Access to jQuery and DOM versions of element
        base.$el = $(el);
        base.player = el;
        base.timer = null;

        // Add a reverse reference to the DOM object
        base.$el.data('videoExtend', base);

        // Initialize
        base.init = function(){

            var attributes = base.getAttributes();
            base.options = $.extend({}, videoExtend.defaultOptions, options, attributes);
            base.browser = base.getBrowserName();

            var video_src = base.$el.attr('src') || base.$el.children('source').attr('src'),
                poster = base.$el.attr('poster');
            base.isYouTube = /youtube\.com|youtu\.be/.test( video_src );
            base.isFlashVideo = video_src.substr( video_src.length - 4 ) == '.flv';
            if ( base.isYouTube ) {
                base.embedYoutube( video_src );
            }
            else if ( base.isFlashVideo ) {
                base.embedFlashVideo( video_src );
            }
            else {

                base.$el
                    .css({
                        display: 'block',
                        backgroundColor: base.options.backgroundColor
                    })
                    .bind('play pause mouseover mouseout', base.eventsHandler)
                    .bind('canplay',function(){
                        if ( !base.options.initialized ) {
                            base.addMarkers();
                        }
                        base.options.initialized = true;
                    });

            }

            base.makeResponsive();
            base.addLogo();

            if ( base.isFlashVideo && poster ) {
                base.addPoster( poster );
            }

        };

        // Get browser name
        base.getBrowserName = function(){

            var userAgent = navigator.userAgent,
                browser = 'unknown';

            if ( /msie/i.test(userAgent) || "ActiveXObject" in window )
                browser = 'ie';
            else if ( /firefox/i.test(userAgent) )
                browser = 'firefox';
            else if ( /\x20OPR\//.test(userAgent) )
                browser = 'opera';
            else if ( /chrome|chromium/i.test(userAgent) )
                browser = 'chrome';
            else if ( /safari/i.test(userAgent) )
                browser = 'safari';
            else if ( /iphone/i.test(userAgent) ) {
                browser = 'iphone';
            }
            else if ( /ipad/i.test(userAgent) ) {
                browser = 'ipad';
            }

            return browser;

        };

        base.getAttributes = function(){
            var attributes = {};
            $.each( base.$el.get(0).attributes, function( index, attr ) {
                if( attr.name.indexOf('data-') > -1 ) {
                    var value = attr.value;
                    if( /\[(.*)\]/.test( value ) )
                        value = $.parseJSON( value );
                    attributes[ attr.name.substr(5) ] = value;
                }
            });
            return attributes;
        };

        base.eventsHandler = function(e){

            switch( e.type ){
                case 'play':

                    if ( base.options.logoAutoHide ) {
                        clearTimeout( base.timer );
                        base.timer = setTimeout(function(){
                            base.$el.parent().find('.video-extend-logo-container').fadeOut(1000);
                        },1500);
                    }

                    break;
                case 'pause':

                    if ( base.options.logoAutoHide ) {
                        if ( !base.player.seeking ) {
                            clearTimeout( base.timer );
                            base.$el.parent().find('.video-extend-logo-container')
                                .stop().css('opacity',1).show();
                        }
                    }

                    break;
                case 'mouseover':

                    var markers_container = base.$el.parent().find('.video-extend-progress-bar');

                    if ( base.options.markers && markers_container.size() > 0 ) {
                        markers_container.show();
                    }

                    break;
                case 'mouseout':

                    var markers_container = base.$el.parent().find('.video-extend-progress-bar');

                    if ( base.options.markers && markers_container.size() > 0 ) {
                        markers_container.hide();
                    }

                    break;
            }

        };

        base.getControlsSize = function( browser ){

            browser = browser || base.browser;
            var size = { left: 63, right: 232, bottom: 25 };

            switch ( browser ) {
                case 'ie':
                    size.left = 173;
                    size.right = 150;
                    size.bottom = 36;
                    break;
                case 'firefox':
                    size.left = 28;
                    size.right = 128;
                    size.bottom = 19;
                    break;
                case 'opera':
                    size.left = 50;
                    size.right = 150;
                    size.bottom = 20;
                    break;
                case 'safari':
                    size.left = 90;
                    size.right = 100;
                    size.bottom = 30;
                    break;
                case 'chrome':
                    //default
                    break;
            }

            return size;

        };

        // Add logo
        base.addLogo = function(){

            if ( !base.options.logo ) {
                return;
            }

            var logo = $('',{
                    src: base.options.logo
                })
                .css({
                    position: 'absolute',
                    zIndex: 200,
                    width: base.options.logoSize[0],
                    height: base.options.logoSize[1],
                    top: !isNaN( base.options.logoPosition[2] )
                        ? base.$el.outerHeight(true) - base.options.logoSize[1] - base.options.logoPosition[2]
                        : base.options.logoPosition[0],
                    right: base.options.logoPosition[1],
                    bottom: 'auto',
                    left: base.options.logoPosition[3]
                })
                .appendTo('
')
                .parent()
                .addClass('video-extend-logo-container')
                .css({
                    position: 'relative',
                    width: base.options.responsive ? '100%' : base.$el.width()
                });

            if ( base.options.logoLink ) {
                logo.children('img')
                    .css('cursor','pointer')
                    .bind('click',function(){
                        var win = window.open(base.options.logoLink, '_blank');
                        win.focus();
                    });
            }

            base.$el
                .before(logo);

        };

        // Make responsive
        base.makeResponsive = function(){

            if ( !base.options.responsive ) {
                return;
            }

            var maxWidth = base.$el.attr('width') || base.$el.width();

            base.$el
                .wrap('

')
                .css({
                    width: '100%'
                })
                .parent()
                .addClass('video-extend-wrapper')
                .css({
                    width: '100%',
                    maxWidth: maxWidth + 'px'
                });

                if ( base.options.alignCenter ) {
                    base.$el.parent('.video-extend-wrapper')
                        .css('margin', '0 auto');
                }

            $( window )
                .bind('resize',function(){

                    if ( base.$el.parent().find('.video-extend-progress-bar').size() > 0 ) {

                        playerControlsSize = base.getControlsSize();
                        base.$el.parent().find('.video-extend-progress-bar')
                            .css({
                                width: base.$el.width() - playerControlsSize.left - playerControlsSize.right
                            });

                    }

                    base.centerPoster();

                });

        };

        // Add markers
        base.addMarkers = function(){

            if ( !base.options.markers || base.options.markers.length == 0 ) {
                return;
            }

            base.addProgressBarControl();

            setTimeout(function(){

                var duration = base.player.duration,
                    markers_container = base.$el.next('.video-extend-progress-bar'),
                    playerControlsSize = base.getControlsSize();

                if ( !duration ) {
                    return;
                }

                base.options.markers.forEach(function(marker){

                    var percent = parseInt( marker.time / duration * 100 );
                    var marker_el = $('
',{
                            title: marker.text
                        })
                        .css({
                            width           : 2,
                            height          : 10,
                            borderRadius    : 3,
                            backgroundColor : 'rgba(232, 126, 4, 0.95)',
                            'box-shadow'    : '0 0 0 2px rgba(0,0,0,0.5)',
                            cursor          : 'pointer',
                            position        : 'absolute',
                            top             : '-' + playerControlsSize.bottom + 'px',
                            left            : percent + '%',
                            marginLeft      : '-4px'
                        })
                        .appendTo( markers_container );

                    marker_el
                        .bind('click', function(){
                            base.player.currentTime = marker.time;
                        })
                        .bind('mouseover mouseout', function(){
                            markers_container.show();
                        });

                });

            }, 500);

        };

        // Add progress bar control
        base.addProgressBarControl = function(){

            var playerWidth = base.$el.width(),
                playerControlsSize = base.getControlsSize();

            $('
')
                .insertAfter(base.$el)
                .addClass('video-extend-progress-bar')
                .css({
                    position: 'relative',
                    left: playerControlsSize.left,
                    width: playerWidth - playerControlsSize.left - playerControlsSize.right,
                    height: 0
                });

        };

        // Embed YouTube video
        base.embedYoutube = function( video_src ){

            var videoWidth = base.$el.width(),
                videoHeight = base.$el.height(),
                frame_id = 'video' + new Date().getTime(),
                video_id = base.getYoutubeVideoId( video_src );

            var youtubeIframe = $('',{
                    src: 'https://www.youtube-nocookie.com/embed/' + video_id + '?enablejsapi=1&origin=' + window.location.origin,
                    id: frame_id,
                    frameborder: 0,
                    width: videoWidth,
                    height: videoHeight
                })
                .css({
                    width: videoWidth,
                    height: videoHeight
                })
                .insertAfter( base.$el )
                .load(function(){
                    base.loadYTApi( frame_id );
                });

            base.$el.remove();
            base.$el = youtubeIframe;

        };

        // Get YouTube video ID
        // http://stackoverflow.com/questions/3452546/javascript-regex-how-to-get-youtube-video-id-from-url
        base.getYoutubeVideoId = function( url ){
            var regExp = /^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#\&\?]*).*/;
            var match = url.match(regExp);
            if (match && match[7].length==11){
                return match[7];
            }
            return '';
        };

        base.loadYTApi = function( frame_id ){

            if ( $('#yt_iframe_api').size() == 0 ) {

                $('


text:
xtea-d [![Build Status](https://travis-ci.org/Extrawurst/xtea-d.svg)](https://travis-ci.org/Extrawurst/xtea-d) [![Coverage Status](https://coveralls.io/repos/Extrawurst/xtea-d/badge.svg?branch=master)](https://coveralls.io/r/Extrawurst/xtea-d?branch=master) [![version](https://img.shields.io/dub/v/xtea-d.svg)](https://code.dlang.org/packages/xtea-d) [![downloads](https://img.shields.io/dub/dt/xtea-d.svg)](https://code.dlang.org/packages/xtea-d)
======

XTEA cryptography algorithm implementation in D (eXtended Tiny Encryption Algorithm)

usage:
------

This is a dub library (http://code.dlang.org/about). Just add dependancy to your package.json:

```
{
	...
	"dependencies": {
		"xtea-d": "~>0.1.0",
		...
	}
}
```

A simple source code example is in the provided app.d and looks like this:

```
import xtea.XteaCrypto;

void main()
{
	auto crypto = XTEA([1,2,3,4], 64);

	auto data = [0,1,2,3,4,5,6,7];

	writefln("data:\t%s",data);

	crypto.Encrypt(data);

	writefln("encrypted:\t%s",data);
}
```


text:
"use strict";

Object.defineProperty(exports, "__esModule", {
    value: true
});
exports.CopyElevateHelper = exports.AppPackageHelper = exports.NSIS_PATH = exports.nsisTemplatesDir = undefined;

var _bluebirdLst;

function _load_bluebirdLst() {
    return _bluebirdLst = require("bluebird-lst");
}

var _bluebirdLst2;

function _load_bluebirdLst2() {
    return _bluebirdLst2 = _interopRequireDefault(require("bluebird-lst"));
}

var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();

var _builderUtil;

function _load_builderUtil() {
    return _builderUtil = require("builder-util");
}

var _fsExtraP;

function _load_fsExtraP() {
    return _fsExtraP = require("fs-extra-p");
}

var _pathManager;

function _load_pathManager() {
    return _pathManager = require("../../util/pathManager");
}

var _fs;

function _load_fs() {
    return _fs = require("builder-util/out/fs");
}

var _path = _interopRequireWildcard(require("path"));

var _lazyVal;

function _load_lazyVal() {
    return _lazyVal = require("lazy-val");
}

var _binDownload;

function _load_binDownload() {
    return _binDownload = require("builder-util/out/binDownload");
}

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

const nsisTemplatesDir = exports.nsisTemplatesDir = (0, (_pathManager || _load_pathManager()).getTemplatePath)("nsis");
// noinspection SpellCheckingInspection
const NSIS_PATH = exports.NSIS_PATH = new (_lazyVal || _load_lazyVal()).Lazy(() => (0, (_binDownload || _load_binDownload()).getBinFromGithub)("nsis", "3.0.1.13", "2921dd404ce9b69679088a6f1409a56dd360da2077fe1019573c0712c9edf057"));
class AppPackageHelper {
    constructor(elevateHelper) {
        this.elevateHelper = elevateHelper;
        this.archToFileInfo = new Map();
        this.infoToIsDelete = new Map();
        /** @private */
        this.refCount = 0;
    }
    packArch(arch, target) {
        var _this = this;

        return (0, (_bluebirdLst || _load_bluebirdLst()).coroutine)(function* () {
            let infoPromise = _this.archToFileInfo.get(arch);
            if (infoPromise == null) {
                const appOutDir = target.archs.get(arch);
                infoPromise = _this.elevateHelper.copy(appOutDir, target).then(function () {
                    return target.buildAppPackage(appOutDir, arch);
                });
                _this.archToFileInfo.set(arch, infoPromise);
            }
            const info = yield infoPromise;
            if (target.isWebInstaller) {
                _this.infoToIsDelete.set(info, false);
            } else if (!_this.infoToIsDelete.has(info)) {
                _this.infoToIsDelete.set(info, true);
            }
            return info;
        })();
    }
    finishBuild() {
        var _this2 = this;

        return (0, (_bluebirdLst || _load_bluebirdLst()).coroutine)(function* () {
            if (--_this2.refCount > 0) {
                return;
            }
            const filesToDelete = [];
            for (const _ref of _this2.infoToIsDelete.entries()) {
                var _ref2 = _slicedToArray(_ref, 2);

                const info = _ref2[0];
                const isDelete = _ref2[1];

                if (isDelete) {
                    filesToDelete.push(info.file);
                }
            }
            yield (_bluebirdLst2 || _load_bluebirdLst2()).default.map(filesToDelete, function (it) {
                return (0, (_fsExtraP || _load_fsExtraP()).unlink)(it);
            });
        })();
    }
}
exports.AppPackageHelper = AppPackageHelper;
class CopyElevateHelper {
    constructor() {
        this.copied = new Map();
    }
    copy(appOutDir, target) {
        let isPackElevateHelper = target.options.packElevateHelper;
        if (isPackElevateHelper === false && target.options.perMachine === true) {
            isPackElevateHelper = true;
            (0, (_builderUtil || _load_builderUtil()).warn)("`packElevateHelper = false` is ignored, because `perMachine` is set to `true`");
        }
        if (isPackElevateHelper === false) {
            return (_bluebirdLst2 || _load_bluebirdLst2()).default.resolve();
        }
        let promise = this.copied.get(appOutDir);
        if (promise != null) {
            return promise;
        }
        promise = NSIS_PATH.value.then(it => (0, (_fs || _load_fs()).copyFile)(_path.join(it, "elevate.exe"), _path.join(appOutDir, "resources", "elevate.exe"), false));
        this.copied.set(appOutDir, promise);
        return promise;
    }
}
exports.CopyElevateHelper = CopyElevateHelper; //# sourceMappingURL=nsisUtil.js.map


text:
@class PlayerViewModel, VodPlayOperationView;

@interface VodPlayController : PlayController

@property (nonatomic, strong) PlayerViewModel      *playerViewModel;

@property (nonatomic, assign) BOOL fullScreen;

@property (nonatomic, strong) VodPlayOperationView      *playOperationView;

- (void)suspendHandler;

- (void)recoveryHandler;

- (void)stopSuspend;

@end


text:
module CustomStartpage
  VERSION = "0.0.1"
end


text:
var mongoose = require('mongoose')

var UserSchema = new mongoose.Schema({
  team: String,
  _id: String
})

module.exports = mongoose.model('User', UserSchema)


text:
import sh from '../src'

export default function ({ address }) {
  sh.commands.reset({
    address, // @esdoc address: '192.168.1.121',
    timeout: 2000
  })
    .then(response => {
      console.log('response:', response)
      console.log('>>>', JSON.stringify(response.data, null, 2))
      // >>> {
      //   "message": "Smoothie out. Peace. Rebooting in 5 seconds..."
      // }
    })
    .catch(error => {
      console.log(`${error.type}: ${error.message}`, error.response)
    })
}


text: export interface Response {}


text:
namespace chrome {

// This class wraps another file enumerator and filters out non-media files
// from its result, refering given MediaPathFilter.
class FilteringFileEnumerator
    : public fileapi::FileSystemFileUtil::AbstractFileEnumerator {
 public:
  FilteringFileEnumerator(
      scoped_ptr<fileapi::FileSystemFileUtil::AbstractFileEnumerator>
          base_enumerator,
      MediaPathFilter* filter);
  virtual ~FilteringFileEnumerator();

  virtual base::FilePath Next() OVERRIDE;
  virtual int64 Size() OVERRIDE;
  virtual base::Time LastModifiedTime() OVERRIDE;
  virtual bool IsDirectory() OVERRIDE;

 private:
  // The file enumerator to be wrapped.
  scoped_ptr<fileapi::FileSystemFileUtil::AbstractFileEnumerator>
      base_enumerator_;

  // Path filter to filter out non-Media files.
  MediaPathFilter* filter_;
};

}  // namespace chrome

#endif  // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_FILTERING_FILE_ENUMERATOR_H_


text:
class MsgBehavior
{
    public:
        virtual bool msg(const std::string& name, const std::string& id) =0;
    protected:
    private:
};

#endif // MSGBEHAVIOR_H


text:
<!doctype html>

		<title>Zabuun - Learn Arabic for English Speakers</title>
		<meta name="description" content="">
		<?php include $_SERVER['DOCUMENT_ROOT'].'/layout/head.php';?>

		<?php include $_SERVER['DOCUMENT_ROOT'].'/layout/ie8.php';?>
		<?php include $_SERVER['DOCUMENT_ROOT'].'/layout/header.php';?>

			<?php include $_SERVER['DOCUMENT_ROOT'].'/layout/side.php';?>

						Modern Standard Arabic (MSA) | Egyptian Colloquial Arabic (ECA) | Both

Crime

About a Robbery

  A: Did you see the police posters in the neighborhood?
 B: I haven't seen them. What do they say?
 A: They say not to leave anything valuable in your cars at night.
 B: Sometimes I leave my purse in the car.
 A: Well, the posters say that there has been an increase in car break-ins in our  neighborhood.
 B: Do they have any suspects?
 A: The police haven't released any details yet.
 B: I'd better be more careful about what I leave in my car overnight.
 A: Yeah, you should be on the look out for suspicious people.
 B: What makes a person look suspicious?
 A: People looking into cars seems suspicious.
 B: Maybe I'll park my car in the garage from now on.

		<?php include $_SERVER['DOCUMENT_ROOT'].'/layout/footer.php';?>
		<?php include $_SERVER['DOCUMENT_ROOT'].'/layout/scripts.php';?>


text:
package com.wandrell.example.mule.wss.testing.integration.ws.consumer;

import org.apache.commons.io.IOUtils;
import org.custommonkey.xmlunit.XMLAssert;
import org.custommonkey.xmlunit.XMLUnit;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.ClassPathResource;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;

import com.wandrell.example.mule.wss.testing.util.config.context.WebServiceContextPaths;
import com.wandrell.example.mule.wss.testing.util.config.properties.SoapConsumerPropertiesPaths;
import com.wandrell.example.mule.wss.testing.util.config.properties.WebServiceConsumerPropertiesPaths;
import com.wandrell.example.mule.wss.testing.util.test.integration.endpoint.AbstractITEndpoint;

/**
 * Integration tests for an unsecure consumer endpoint flow testing that it
 * handles messages correctly.
 *

 * It adds the following cases:
 *

 *
A SOAP payload is processed and a valid response returned.

 *

 *
 * @author Bernardo Martínez Garrido
 */
@ContextConfiguration(WebServiceContextPaths.CONSUMER)
@TestPropertySource({ WebServiceConsumerPropertiesPaths.UNSECURE,
        SoapConsumerPropertiesPaths.UNSECURE })
public final class ITUnsecureEndpointConsumer extends AbstractITEndpoint {

    /**
     * Name of the flow being tested.
     */
    @Value("${endpoint.flow}")
    private String endpointFlow;

    /**
     * Path to the SOAP payload for the request.
     */
    @Value("${soap.request.payload.path}")
    private String requestPayloadPath;

    /**
     * Path to the SOAP envelope for the response.
     */
    @Value("${soap.response.path}")
    private String responseEnvelopePath;

    /**
     * Default constructor.
     */
    public ITUnsecureEndpointConsumer() {
        super();
    }

    /**
     * Tests that a SOAP payload is processed and a valid response returned.
     *
     * @throws Exception
     *             never, this is a required declaration
     */
    @Test
    public final void testEndpoint_Payload_ReturnsExpected() throws Exception {
        final String result; // Response from the endpoint
        final String encoding; // Files encoding
        final String request; // SOAP request
        final String response; // SOAP response

        // Loads the messages
        encoding = "UTF-8";
        response = IOUtils.toString(
                new ClassPathResource(responseEnvelopePath).getInputStream(),
                encoding);
        request = IOUtils.toString(
                new ClassPathResource(requestPayloadPath).getInputStream(),
                encoding);

        // Sends the request to the flow
        result = runFlow(endpointFlow, request).getMessageAsString();

        // Verifies results
        XMLUnit.setIgnoreWhitespace(true);
        XMLAssert.assertXMLEqual(response, result);
    }

}


text:
/// <reference path='fourslash.ts'/>

////module FindRef4 {
////	module MixedStaticsClassTest {
////		export class Foo {
////			b/*3*/ar: Foo;
////			static b/*4*/ar: Foo;
////
////			public f/*1*/oo(): void {
////			}
////			public static f/*2*/oo(): void {
////			}
////		}
////	}
////
////	function test() {
////		// instance function
////		var x = new MixedStaticsClassTest.Foo();
////		x.foo();
////		x.bar;
////
////		var y = new MixedStaticsClassTest.Foo();
////		y.foo();
////		y.bar;
////
////		// static function
////		MixedStaticsClassTest.Foo.foo();
////		MixedStaticsClassTest.Foo.bar;
////	}
////}

// this line triggers a semantic/syntactic error check, remove line when 788570 is fixed
edit.insert('');

// References to a member method with the same name as a static.
goTo.marker("1");
verify.referencesCountIs(3);

// References to a static method with the same name as a member.
goTo.marker("2");
verify.referencesCountIs(2);

// References to a member property with the same name as a static.
goTo.marker("3");
verify.referencesCountIs(3);

// References to a static property with the same name as a member.
goTo.marker("4");
verify.referencesCountIs(2);


text:
package org.sakuli.integration.services.forwarder.gearman;

import org.apache.commons.io.FileUtils;
import org.joda.time.DateTime;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.mockito.Spy;
import org.sakuli.BaseTest;
import org.sakuli.builder.TestCaseExampleBuilder;
import org.sakuli.builder.TestCaseStepExampleBuilder;
import org.sakuli.datamodel.TestSuite;
import org.sakuli.datamodel.properties.SakuliProperties;
import org.sakuli.datamodel.state.TestCaseState;
import org.sakuli.datamodel.state.TestCaseStepState;
import org.sakuli.datamodel.state.TestSuiteState;
import org.sakuli.exceptions.SakuliCheckedException;
import org.sakuli.integration.IntegrationTest;
import org.sakuli.services.forwarder.ScreenshotDiv;
import org.sakuli.services.forwarder.ScreenshotDivConverter;
import org.sakuli.services.forwarder.gearman.GearmanProperties;
import org.sakuli.services.forwarder.gearman.GearmanTemplateOutputBuilder;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

import java.io.File;
import java.io.IOException;
import java.nio.file.Paths;
import java.util.Arrays;

import static org.mockito.ArgumentMatchers.notNull;
import static org.mockito.Mockito.doReturn;

/**
 * @author Georgi Todorov
 */
@Test(groups = IntegrationTest.GROUP)
public class GearmanTemplateOutputBuilderIntegrationTest extends BaseTest {

    private static final String TESTSUITE_ID = "example_xfce";
    private static final String DEFAULT_SERVICE_TYPE = "passive";
    private static final String DEFAULT_NAGIOS_HOST = "my.nagios.host";
    private static final String DEFAULT_NAGIOS_CHECK_COMMMAND = "check_sakuli";

    @InjectMocks
    @Spy
    private GearmanTemplateOutputBuilder testling;
    @Mock
    private ScreenshotDivConverter screenshotDivConverter;
    @Mock
    private GearmanProperties gearmanProperties;
    private TestSuite testSuite;
    @Mock
    private SakuliProperties sakuliProperties;

    @BeforeMethod
    public void setUp() throws Exception {
        MockitoAnnotations.initMocks(this);
        doReturn(getTemplatePath()).when(sakuliProperties).getForwarderTemplateFolder();
        doReturn(TESTSUITE_ID).when(gearmanProperties).getNagiosServiceDescription();
        doReturn(DEFAULT_SERVICE_TYPE).when(gearmanProperties).getServiceType();
        doReturn(DEFAULT_NAGIOS_HOST).when(gearmanProperties).getNagiosHost();
        doReturn(DEFAULT_NAGIOS_CHECK_COMMMAND).when(gearmanProperties).getNagiosCheckCommand();
        testSuite = new TestSuite();
        testSuite.setId(TESTSUITE_ID);
        testSuite.setTestCases(null);
        doReturn(testSuite).when(testling).getCurrentTestSuite();
        doReturn(null).when(testling).getCurrentTestCase();
    }

    private String getTemplatePath() {
        // If not available execute test via `mvn test-compile` to extract the file dependencies
        return getResource("common/config/templates");
    }

    private String getOutputPath() {
        return getResource("output", this.getClass());
    }

    private String loadExpectedOutput(String testCaseName) throws IOException {
        return FileUtils.readFileToString(Paths.get(getOutputPath() + File.separator + "TestSuite_" + testCaseName + ".txt").toFile());
    }

    @Test
    public void testOK() throws Exception {
        testSuite.setState(TestSuiteState.OK);
        testSuite.setWarningTime(300);
        testSuite.setCriticalTime(400);
        testSuite.setStartDate(new DateTime(1970, 1, 1, 10, 30, 0, 0).toDate());
        testSuite.setStopDate(new DateTime(1970, 1, 1, 10, 30, 44, 990).toDate());
        testSuite.addTestCase(
                new TestCaseExampleBuilder()
                        .withState(TestCaseState.OK)
                        .withWarningTime(20)
                        .withCriticalTime(30)
                        .withStartDate(new DateTime(1970, 1, 1, 10, 30, 0).toDate())
                        .withStopDate(new DateTime(1970, 1, 1, 10, 30, 14, 20).toDate())
                        .withId("case1")
                        .withTestCaseSteps(
                                Arrays.asList(
                                        new TestCaseStepExampleBuilder()
                                                .withState(TestCaseStepState.OK)
                                                .withName("Test_Sahi_landing_page")
                                                .withWarningTime(5)
                                                .withStartDate(new DateTime(1970, 1, 1, 10, 30, 0).toDate())
                                                .withStopDate(new DateTime(1970, 1, 1, 10, 30, 1, 160).toDate())
                                                .buildExample(),
                                        new TestCaseStepExampleBuilder()
                                                .withState(TestCaseStepState.OK)
                                                .withName("Calculation")
                                                .withWarningTime(10)
                                                .withStartDate(new DateTime(1970, 1, 1, 10, 30, 0, 10).toDate())
                                                .withStopDate(new DateTime(1970, 1, 1, 10, 30, 7, 290).toDate())
                                                .buildExample(),
                                        new TestCaseStepExampleBuilder()
                                                .withState(TestCaseStepState.OK)
                                                .withName("Editor")
                                                .withWarningTime(10)
                                                .withStartDate(new DateTime(1970, 1, 1, 10, 30, 0, 20).toDate())
                                                .withStopDate(new DateTime(1970, 1, 1, 10, 30, 1, 500).toDate())
                                                .buildExample()
                                )
                        )
                        .buildExample()
        );
        testSuite.addTestCase(
                new TestCaseExampleBuilder()
                        .withState(TestCaseState.OK)
                        .withWarningTime(20)
                        .withCriticalTime(30)
                        .withStartDate(new DateTime(1970, 1, 1, 10, 30, 10).toDate())
                        .withStopDate(new DateTime(1970, 1, 1, 10, 30, 23, 580).toDate())
                        .withId("case2")
                        .withTestCaseSteps(
                                Arrays.asList(
                                        new TestCaseStepExampleBuilder()
                                                .withState(TestCaseStepState.OK)
                                                .withName("Test_Sahi_landing_page_(case2)")
                                                .withWarningTime(5)
                                                .withStartDate(new DateTime(1970, 1, 1, 10, 30, 0).toDate())
                                                .withStopDate(new DateTime(1970, 1, 1, 10, 30, 1, 30).toDate())
                                                .buildExample(),
                                        new TestCaseStepExampleBuilder()
                                                .withState(TestCaseStepState.OK)
                                                .withName("Calculation_(case2)")
                                                .withWarningTime(10)
                                                .withStartDate(new DateTime(1970, 1, 1, 10, 30, 0, 10).toDate())
                                                .withStopDate(new DateTime(1970, 1, 1, 10, 30, 7, 80).toDate())
                                                .buildExample(),
                                        new TestCaseStepExampleBuilder()
                                                .withName("Editor_(case2)")
                                                .withWarningTime(10)
                                                .withStartDate(new DateTime(1970, 1, 1, 10, 30, 0, 20).toDate())
                                                .withStopDate(new DateTime(1970, 1, 1, 10, 30, 1, 390).toDate())
                                                .buildExample()
                                )
                        )
                        .buildExample()
        );
        String output = testling.createOutput(testSuite);
        Assert.assertEquals(output, loadExpectedOutput(TestCaseState.OK.name()));
    }

    @Test
    public void testWarnInStep() throws Exception {
        testSuite.setState(TestSuiteState.WARNING_IN_STEP);
        testSuite.setWarningTime(300);
        testSuite.setCriticalTime(400);
        testSuite.setStartDate(new DateTime(1970, 1, 1, 10, 31, 0).toDate());
        testSuite.setStopDate(new DateTime(1970, 1, 1, 10, 31, 44, 750).toDate());
        testSuite.addTestCase(
                new TestCaseExampleBuilder()
                        .withState(TestCaseState.OK)
                        .withWarningTime(20)
                        .withCriticalTime(30)
                        .withStartDate(new DateTime(1970, 1, 1, 10, 31, 0).toDate())
                        .withStopDate(new DateTime(1970, 1, 1, 10, 31, 13, 830).toDate())
                        .withId("case1")
                        .withTestCaseSteps(
                                Arrays.asList(
                                        new TestCaseStepExampleBuilder()
                                                .withState(TestCaseStepState.OK)
                                                .withName("Test_Sahi_landing_page")
                                                .withWarningTime(5)
                                                .withStartDate(new DateTime(1970, 1, 1, 10, 31, 0).toDate())
                                                .withStopDate(new DateTime(1970, 1, 1, 10, 31, 1, 80).toDate())
                                                .buildExample(),
                                        new TestCaseStepExampleBuilder()
                                                .withState(TestCaseStepState.OK)
                                                .withName("Calculation")
                                                .withWarningTime(10)
                                                .withStartDate(new DateTime(1970, 1, 1, 10, 31, 0, 10).toDate())
                                                .withStopDate(new DateTime(1970, 1, 1, 10, 31, 7, 140).toDate())
                                                .buildExample(),
                                        new TestCaseStepExampleBuilder()
                                                .withState(TestCaseStepState.OK)
                                                .withName("Editor")
                                                .withWarningTime(10)
                                                .withStartDate(new DateTime(1970, 1, 1, 10, 31, 0, 20).toDate())
                                                .withStopDate(new DateTime(1970, 1, 1, 10, 31, 1, 550).toDate())
                                                .buildExample()
                                )
                        )
                        .buildExample()
        );
        testSuite.addTestCase(new TestCaseExampleBuilder()
                .withState(TestCaseState.WARNING_IN_STEP)
                .withWarningTime(20)
                .withCriticalTime(30)
                .withStartDate(new DateTime(1970, 1, 1, 10, 31, 20).toDate())
                .withStopDate(new DateTime(1970, 1, 1, 10, 31, 33, 430).toDate())
                .withId("case2")
                .withTestCaseSteps(
                        Arrays.asList(
                                new TestCaseStepExampleBuilder()
                                        .withState(TestCaseStepState.OK)
                                        .withName("Test_Sahi_landing_page_(case2)")
                                        .withWarningTime(5)
                                        .withStartDate(new DateTime(1970, 1, 1, 10, 31, 0, 10).toDate())
                                        .withStopDate(new DateTime(1970, 1, 1, 10, 31, 0, 930).toDate())
                                        .buildExample(),
                                new TestCaseStepExampleBuilder()
                                        .withState(TestCaseStepState.WARNING)
                                        .withName("Calculation_(case2)")
                                        .withWarningTime(1)
                                        .withStartDate(new DateTime(1970, 1, 1, 10, 31, 0, 20).toDate())
                                        .withStopDate(new DateTime(1970, 1, 1, 10, 31, 7, 20).toDate())
                                        .buildExample(),
                                new TestCaseStepExampleBuilder()
                                        .withState(TestCaseStepState.OK)
                                        .withName("Editor_(case2)")
                                        .withWarningTime(10)
                                        .withStartDate(new DateTime(1970, 1, 1, 10, 31, 0, 30).toDate())
                                        .withStopDate(new DateTime(1970, 1, 1, 10, 31, 1, 420).toDate())
                                        .buildExample()
                        )
                )
                .buildExample()
        );
        String output = testling.createOutput(testSuite);
        Assert.assertEquals(output, loadExpectedOutput(TestSuiteState.WARNING_IN_STEP.name()));
    }

    @Test
    public void testWarnInCase() throws Exception {
        testSuite.setState(TestSuiteState.WARNING_IN_CASE);
        testSuite.setWarningTime(300);
        testSuite.setCriticalTime(400);
        testSuite.setStartDate(new DateTime(1970, 1, 1, 10, 34, 0).toDate());
        testSuite.setStopDate(new DateTime(1970, 1, 1, 10, 34, 42, 840).toDate());
        testSuite.addTestCase(
                new TestCaseExampleBuilder()
                        .withState(TestCaseState.OK)
                        .withWarningTime(20)
                        .withCriticalTime(30)
                        .withStartDate(new DateTime(1970, 1, 1, 10, 34, 0).toDate())
                        .withStopDate(new DateTime(1970, 1, 1, 10, 34, 14, 30).toDate())
                        .withId("case1")
                        .withTestCaseSteps(
                                Arrays.asList(
                                        new TestCaseStepExampleBuilder()
                                                .withState(TestCaseStepState.OK)
                                                .withName("Test_Sahi_landing_page")
                                                .withWarningTime(5)
                                                .withStartDate(new DateTime(1970, 1, 1, 10, 34, 0, 10).toDate())
                                                .withStopDate(new DateTime(1970, 1, 1, 10, 34, 1, 160).toDate())
                                                .buildExample(),
                                        new TestCaseStepExampleBuilder()
                                                .withState(TestCaseStepState.OK)
                                                .withName("Calculation")
                                                .withWarningTime(10)
                                                .withStartDate(new DateTime(1970, 1, 1, 10, 34, 0, 20).toDate())
                                                .withStopDate(new DateTime(1970, 1, 1, 10, 34, 7, 340).toDate())
                                                .buildExample(),
                                        new TestCaseStepExampleBuilder()
                                                .withState(TestCaseStepState.OK)
                                                .withName("Editor")
                                                .withWarningTime(10)
                                                .withStartDate(new DateTime(1970, 1, 1, 10, 34, 0, 30).toDate())
                                                .withStopDate(new DateTime(1970, 1, 1, 10, 34, 1, 460).toDate())
                                                .buildExample()
                                )
                        )
                        .buildExample()
        );
        testSuite.addTestCase(
                new TestCaseExampleBuilder()
                        .withState(TestCaseState.WARNING)
                        .withWarningTime(2)
                        .withCriticalTime(30)
                        .withStartDate(new DateTime(1970, 1, 1, 10, 34, 20).toDate())
                        .withStopDate(new DateTime(1970, 1, 1, 10, 34, 33, 540).toDate())
                        .withId("case2")
                        .withTestCaseSteps(
                                Arrays.asList(
                                        new TestCaseStepExampleBuilder()
                                                .withState(TestCaseStepState.OK)
                                                .withName("Test_Sahi_landing_page_(case2)")
                                                .withWarningTime(5)
                                                .withStartDate(new DateTime(1970, 1, 1, 10, 34, 0, 10).toDate())
                                                .withStopDate(new DateTime(1970, 1, 1, 10, 34, 0, 940).toDate())
                                                .buildExample(),
                                        new TestCaseStepExampleBuilder()
                                                .withState(TestCaseStepState.OK)
                                                .withName("Calculation_(case2)")
                                                .withWarningTime(10)
                                                .withStartDate(new DateTime(1970, 1, 1, 10, 34, 0, 20).toDate())
                                                .withStopDate(new DateTime(1970, 1, 1, 10, 34, 7, 140).toDate())
                                                .buildExample(),
                                        new TestCaseStepExampleBuilder()
                                                .withState(TestCaseStepState.OK)
                                                .withName("Editor_(case2)")
                                                .withWarningTime(10)
                                                .withStartDate(new DateTime(1970, 1, 1, 10, 34, 0, 30).toDate())
                                                .withStopDate(new DateTime(1970, 1, 1, 10, 34, 1, 390).toDate())
                                                .buildExample()
                                )
                        )
                        .buildExample()
        );
        String output = testling.createOutput(testSuite);
        Assert.assertEquals(output, loadExpectedOutput(TestSuiteState.WARNING_IN_CASE.name()));
    }

    @Test
    public void testCritInCase() throws Exception {
        testSuite.setState(TestSuiteState.CRITICAL_IN_CASE);
        testSuite.setWarningTime(300);
        testSuite.setCriticalTime(400);
        testSuite.setStartDate(new DateTime(1970, 1, 1, 10, 35, 0).toDate());
        testSuite.setStopDate(new DateTime(1970, 1, 1, 10, 35, 46, 960).toDate());
        testSuite.addTestCase(
                new TestCaseExampleBuilder()
                        .withState(TestCaseState.OK)
                        .withWarningTime(20)
                        .withCriticalTime(30)
                        .withStartDate(new DateTime(1970, 1, 1, 10, 35, 0).toDate())
                        .withStopDate(new DateTime(1970, 1, 1, 10, 35, 14, 130).toDate())
                        .withId("case1")
                        .withTestCaseSteps(
                                Arrays.asList(
                                        new TestCaseStepExampleBuilder()
                                                .withState(TestCaseStepState.OK)
                                                .withName("Test_Sahi_landing_page")
                                                .withWarningTime(5)
                                                .withStartDate(new DateTime(1970, 1, 1, 10, 35, 0).toDate())
                                                .withStopDate(new DateTime(1970, 1, 1, 10, 35, 1, 280).toDate())
                                                .buildExample(),
                                        new TestCaseStepExampleBuilder()
                                                .withState(TestCaseStepState.OK)
                                                .withName("Calculation")
                                                .withWarningTime(10)
                                                .withStartDate(new DateTime(1970, 1, 1, 10, 35, 0, 10).toDate())
                                                .withStopDate(new DateTime(1970, 1, 1, 10, 35, 7, 310).toDate())
                                                .buildExample(),
                                        new TestCaseStepExampleBuilder()
                                                .withState(TestCaseStepState.OK)
                                                .withName("Editor")
                                                .withWarningTime(10)
                                                .withStartDate(new DateTime(1970, 1, 1, 10, 35, 0, 20).toDate())
                                                .withStopDate(new DateTime(1970, 1, 1, 10, 35, 1, 470).toDate())
                                                .buildExample()
                                )
                        )
                        .buildExample()
        );
        testSuite.addTestCase(
                new TestCaseExampleBuilder()
                        .withState(TestCaseState.CRITICAL)
                        .withWarningTime(2)
                        .withCriticalTime(3)
                        .withStartDate(new DateTime(1970, 1, 1, 10, 35, 20).toDate())
                        .withStopDate(new DateTime(1970, 1, 1, 10, 35, 33, 700).toDate())
                        .withId("case2")
                        .withTestCaseSteps(
                                Arrays.asList(
                                        new TestCaseStepExampleBuilder()
                                                .withState(TestCaseStepState.OK)
                                                .withName("Test_Sahi_landing_page_(case2)")
                                                .withWarningTime(5)
                                                .withStartDate(new DateTime(1970, 1, 1, 10, 35, 0).toDate())
                                                .withStopDate(new DateTime(1970, 1, 1, 10, 35, 1, 80).toDate())
                                                .buildExample(),
                                        new TestCaseStepExampleBuilder()
                                                .withState(TestCaseStepState.OK)
                                                .withName("Calculation_(case2)")
                                                .withWarningTime(10)
                                                .withStartDate(new DateTime(1970, 1, 1, 10, 35, 0, 10).toDate())
                                                .withStopDate(new DateTime(1970, 1, 1, 10, 35, 7, 120).toDate())
                                                .buildExample(),
                                        new TestCaseStepExampleBuilder()
                                                .withState(TestCaseStepState.OK)
                                                .withName("Editor_(case2)")
                                                .withWarningTime(10)
                                                .withStartDate(new DateTime(1970, 1, 1, 10, 35, 0, 20).toDate())
                                                .withStopDate(new DateTime(1970, 1, 1, 10, 35, 1, 440).toDate())
                                                .buildExample()
                                )
                        )
                        .buildExample()
        );
        String output = testling.createOutput(testSuite);
        String expected = loadExpectedOutput(TestSuiteState.CRITICAL_IN_CASE.name());
        Assert.assertEquals(output, expected);
        Assert.assertEquals(output.getBytes(), expected.getBytes());
    }

    @Test
    public void testWarnInSuite() throws Exception {
        testSuite.setState(TestSuiteState.WARNING_IN_SUITE);
        testSuite.setWarningTime(3);
        testSuite.setCriticalTime(400);
        testSuite.setStartDate(new DateTime(1970, 1, 1, 10, 32, 0).toDate());
        testSuite.setStopDate(new DateTime(1970, 1, 1, 10, 32, 46, 940).toDate());
        testSuite.addTestCase(
                new TestCaseExampleBuilder()
                        .withState(TestCaseState.OK)
                        .withWarningTime(20)
                        .withCriticalTime(30)
                        .withStartDate(new DateTime(1970, 1, 1, 10, 32, 0).toDate())
                        .withStopDate(new DateTime(1970, 1, 1, 10, 32, 14, 130).toDate())
                        .withId("case1")
                        .withTestCaseSteps(
                                Arrays.asList(
                                        new TestCaseStepExampleBuilder()
                                                .withState(TestCaseStepState.OK)
                                                .withName("Test_Sahi_landing_page")
                                                .withWarningTime(5)
                                                .withStartDate(new DateTime(1970, 1, 1, 10, 32, 0).toDate())
                                                .withStopDate(new DateTime(1970, 1, 1, 10, 32, 1, 210).toDate())
                                                .buildExample(),
                                        new TestCaseStepExampleBuilder()
                                                .withState(TestCaseStepState.OK)
                                                .withName("Calculation")
                                                .withWarningTime(10)
                                                .withStartDate(new DateTime(1970, 1, 1, 10, 32, 0, 10).toDate())
                                                .withStopDate(new DateTime(1970, 1, 1, 10, 32, 7, 410).toDate())
                                                .buildExample(),
                                        new TestCaseStepExampleBuilder()
                                                .withState(TestCaseStepState.OK)
                                                .withName("Editor")
                                                .withWarningTime(10)
                                                .withStartDate(new DateTime(1970, 1, 1, 10, 32, 0, 20).toDate())
                                                .withStopDate(new DateTime(1970, 1, 1, 10, 32, 1, 430).toDate())
                                                .buildExample()
                                )
                        )
                        .buildExample()
        );
        testSuite.addTestCase(
                new TestCaseExampleBuilder()
                        .withState(TestCaseState.OK)
                        .withWarningTime(20)
                        .withCriticalTime(30)
                        .withStartDate(new DateTime(1970, 1, 1, 10, 32, 10).toDate())
                        .withStopDate(new DateTime(1970, 1, 1, 10, 32, 23, 580).toDate())
                        .withId("case2")
                        .withTestCaseSteps(
                                Arrays.asList(
                                        new TestCaseStepExampleBuilder()
                                                .withState(TestCaseStepState.OK)
                                                .withName("Test_Sahi_landing_page_(case2)")
                                                .withWarningTime(5)
                                                .withStartDate(new DateTime(1970, 1, 1, 10, 32, 0).toDate())
                                                .withStopDate(new DateTime(1970, 1, 1, 10, 32, 1, 60).toDate())
                                                .buildExample(),
                                        new TestCaseStepExampleBuilder()
                                                .withState(TestCaseStepState.OK)
                                                .withName("Calculation_(case2)")
                                                .withWarningTime(10)
                                                .withStartDate(new DateTime(1970, 1, 1, 10, 32, 0, 10).toDate())
                                                .withStopDate(new DateTime(1970, 1, 1, 10, 32, 7, 80).toDate())
                                                .buildExample(),
                                        new TestCaseStepExampleBuilder()
                                                .withState(TestCaseStepState.OK)
                                                .withName("Editor_(case2)")
                                                .withWarningTime(10)
                                                .withStartDate(new DateTime(1970, 1, 1, 10, 32, 0, 20).toDate())
                                                .withStopDate(new DateTime(1970, 1, 1, 10, 32, 1, 360).toDate())
                                                .buildExample()
                                )
                        )
                        .buildExample()
        );
        String output = testling.createOutput(testSuite);
        Assert.assertEquals(output, loadExpectedOutput(TestSuiteState.WARNING_IN_SUITE.name()));
    }

    @Test
    public void testCritInSuite() throws Exception {
        testSuite.setState(TestSuiteState.CRITICAL_IN_SUITE);
        testSuite.setWarningTime(30);
        testSuite.setCriticalTime(40);
        testSuite.setStartDate(new DateTime(1970, 1, 1, 10, 33, 0).toDate());
        testSuite.setStopDate(new DateTime(1970, 1, 1, 10, 33, 44, 810).toDate());
        testSuite.addTestCase(
                new TestCaseExampleBuilder()
                        .withState(TestCaseState.OK)
                        .withWarningTime(20)
                        .withCriticalTime(30)
                        .withStartDate(new DateTime(1970, 1, 1, 10, 33, 0).toDate())
                        .withStopDate(new DateTime(1970, 1, 1, 10, 33, 13, 910).toDate())
                        .withId("case1")
                        .withTestCaseSteps(
                                Arrays.asList(
                                        new TestCaseStepExampleBuilder()
                                                .withState(TestCaseStepState.OK)
                                                .withName("Test_Sahi_landing_page")
                                                .withWarningTime(5)
                                                .withStartDate(new DateTime(1970, 1, 1, 10, 33, 0).toDate())
                                                .withStopDate(new DateTime(1970, 1, 1, 10, 33, 1, 160).toDate())
                                                .buildExample(),
                                        new TestCaseStepExampleBuilder()
                                                .withState(TestCaseStepState.OK)
                                                .withName("Calculation")
                                                .withWarningTime(10)
                                                .withStartDate(new DateTime(1970, 1, 1, 10, 33, 0, 10).toDate())
                                                .withStopDate(new DateTime(1970, 1, 1, 10, 33, 7, 250).toDate())
                                                .buildExample(),
                                        new TestCaseStepExampleBuilder()
                                                .withState(TestCaseStepState.OK)
                                                .withName("Editor")
                                                .withWarningTime(10)
                                                .withStartDate(new DateTime(1970, 1, 1, 10, 33, 0, 20).toDate())
                                                .withStopDate(new DateTime(1970, 1, 1, 10, 33, 1, 450).toDate())
                                                .buildExample()
                                )
                        )
                        .buildExample()
        );
        testSuite.addTestCase(
                new TestCaseExampleBuilder()
                        .withState(TestCaseState.OK)
                        .withWarningTime(20)
                        .withCriticalTime(30)
                        .withStartDate(new DateTime(1970, 1, 1, 10, 33, 10).toDate())
                        .withStopDate(new DateTime(1970, 1, 1, 10, 33, 23, 550).toDate())
                        .withId("case2")
                        .withTestCaseSteps(
                                Arrays.asList(
                                        new TestCaseStepExampleBuilder()
                                                .withState(TestCaseStepState.OK)
                                                .withName("Test_Sahi_landing_page_(case2)")
                                                .withWarningTime(5)
                                                .withStartDate(new DateTime(1970, 1, 1, 10, 33, 0).toDate())
                                                .withStopDate(new DateTime(1970, 1, 1, 10, 33, 1, 50).toDate())
                                                .buildExample(),
                                        new TestCaseStepExampleBuilder()
                                                .withState(TestCaseStepState.OK)
                                                .withName("Calculation_(case2)")
                                                .withWarningTime(10)
                                                .withStartDate(new DateTime(1970, 1, 1, 10, 33, 10).toDate())
                                                .withStopDate(new DateTime(1970, 1, 1, 10, 33, 17, 30).toDate())
                                                .buildExample(),
                                        new TestCaseStepExampleBuilder()
                                                .withState(TestCaseStepState.OK)
                                                .withName("Editor_(case2)")
                                                .withWarningTime(10)
                                                .withStartDate(new DateTime(1970, 1, 1, 10, 33, 20).toDate())
                                                .withStopDate(new DateTime(1970, 1, 1, 10, 33, 21, 390).toDate())
                                                .buildExample()
                                )
                        )
                        .buildExample()
        );
        String output = testling.createOutput(testSuite);
        Assert.assertEquals(output, loadExpectedOutput(TestSuiteState.CRITICAL_IN_SUITE.name()));
    }

    @Test
    public void testException() throws Exception {
        testSuite.setState(TestSuiteState.ERRORS);
        testSuite.setWarningTime(300);
        testSuite.setCriticalTime(400);
        testSuite.setStartDate(new DateTime(1970, 1, 1, 10, 36, 0).toDate());
        testSuite.setStopDate(new DateTime(1970, 1, 1, 10, 36, 44, 800).toDate());
        testSuite.addTestCase(
                new TestCaseExampleBuilder()
                        .withState(TestCaseState.OK)
                        .withWarningTime(20)
                        .withCriticalTime(30)
                        .withStartDate(new DateTime(1970, 1, 1, 10, 36, 0).toDate())
                        .withStopDate(new DateTime(1970, 1, 1, 10, 36, 14, 200).toDate())
                        .withId("case1")
                        .withTestCaseSteps(
                                Arrays.asList(
                                        new TestCaseStepExampleBuilder()
                                                .withState(TestCaseStepState.OK)
                                                .withName("Test_Sahi_landing_page")
                                                .withWarningTime(5)
                                                .withStartDate(new DateTime(1970, 1, 1, 10, 36, 0).toDate())
                                                .withStopDate(new DateTime(1970, 1, 1, 10, 36, 1, 140).toDate())
                                                .buildExample(),
                                        new TestCaseStepExampleBuilder()
                                                .withState(TestCaseStepState.OK)
                                                .withName("Calculation")
                                                .withWarningTime(10)
                                                .withStartDate(new DateTime(1970, 1, 1, 10, 36, 0, 10).toDate())
                                                .withStopDate(new DateTime(1970, 1, 1, 10, 36, 7, 540).toDate())
                                                .buildExample(),
                                        new TestCaseStepExampleBuilder()
                                                .withState(TestCaseStepState.OK)
                                                .withName("Editor")
                                                .withWarningTime(10)
                                                .withStartDate(new DateTime(1970, 1, 1, 10, 36, 0, 20).toDate())
                                                .withStopDate(new DateTime(1970, 1, 1, 10, 36, 1, 470).toDate())
                                                .buildExample()
                                )
                        )
                        .buildExample()
        );
        testSuite.addTestCase(
                new TestCaseExampleBuilder()
                        .withState(TestCaseState.ERRORS)
                        .withWarningTime(20)
                        .withCriticalTime(30)
                        .withStartDate(new DateTime(1970, 1, 1, 10, 36, 10).toDate())
                        .withStopDate(new DateTime(1970, 1, 1, 10, 36, 23, 550).toDate())
                        .withId("case2")
                        .withTestCaseSteps(
                                Arrays.asList(
                                        new TestCaseStepExampleBuilder()
                                                .withState(TestCaseStepState.ERRORS)
                                                .withName("Test_Sahi_landing_page_(case2)")
                                                .withWarningTime(5)
                                                .withStartDate(new DateTime(1970, 1, 1, 10, 36, 0).toDate())
                                                .withStopDate(new DateTime(1970, 1, 1, 10, 36, 1, 50).toDate())
                                                .withException(new SakuliCheckedException("_highlight(_link(\"xSL Manager\")); TypeError: el is undefined Sahi.prototype._highlight@http://sahi.example.com/_s_/spr/concat.js:1210:9 @http://sahi.example.com/_s_/spr/concat.js line 3607 > eval:1:1 Sahi.prototype.ex@http://sahi.example.com/_s_/spr/concat.js:3607:9 Sahi.prototype.ex@http://sahi.example.com/_s_/spr/sakuli/inject.js:46:12 @http://sahi.example.com/_s_/spr/concat.js:3373:5  <a href='/_s_/dyn/Log_getBrowserScript?href=/root/sakuli/example_test_suites/example_xfce/case2/sakuli_demo.js&n=1210'><b>Click for browser script</b></a>"))
                                                .buildExample(),
                                        new TestCaseStepExampleBuilder()
                                                .withState(TestCaseStepState.OK)
                                                .withName("Calculation_(case2)")
                                                .withWarningTime(10)
                                                .withStartDate(new DateTime(1970, 1, 1, 10, 36, 10).toDate())
                                                .withStopDate(new DateTime(1970, 1, 1, 10, 36, 17, 30).toDate())
                                                .buildExample(),
                                        new TestCaseStepExampleBuilder()
                                                .withState(TestCaseStepState.OK)
                                                .withName("Editor_(case2)")
                                                .withWarningTime(10)
                                                .withStartDate(new DateTime(1970, 1, 1, 10, 36, 20).toDate())
                                                .withStopDate(new DateTime(1970, 1, 1, 10, 36, 21, 390).toDate())
                                                .buildExample()
                                )
                        )
                        .buildExample()
        );
        ScreenshotDiv screenshotDiv = new ScreenshotDiv();
        screenshotDiv.setId("sakuli_screenshot243575009");
        screenshotDiv.setFormat("jpg");
        screenshotDiv.setBase64screenshot("/9j/4AAQSkZJRgABAgAAAQABAAD9k=");
        doReturn(screenshotDiv).when(screenshotDivConverter).convert(notNull(Exception.class));
        String output = testling.createOutput(testSuite);
        Assert.assertEquals(output, loadExpectedOutput(TestSuiteState.ERRORS.name()));
    }
}