text:
'use strict';

import type {PartialViewConfig} from '../../Renderer/shims/ReactNativeTypes';

const ScrollViewViewConfig = {
  uiViewClassName: 'RCTScrollView',
  bubblingEventTypes: {},
  directEventTypes: {
    topScrollToTop: {
      registrationName: 'onScrollToTop',
    },
  },
  validAttributes: {
    alwaysBounceHorizontal: true,
    alwaysBounceVertical: true,
    automaticallyAdjustContentInsets: true,
    automaticallyAdjustsScrollIndicatorInsets: true,
    bounces: true,
    bouncesZoom: true,
    canCancelContentTouches: true,
    centerContent: true,
    contentInset: {
      diff: require('../../Utilities/differ/pointsDiffer'),
    },
    contentOffset: {
      diff: require('../../Utilities/differ/pointsDiffer'),
    },
    contentInsetAdjustmentBehavior: true,
    decelerationRate: true,
    directionalLockEnabled: true,
    disableIntervalMomentum: true,
    endFillColor: {
      process: require('../../StyleSheet/processColor'),
    },
    fadingEdgeLength: true,
    indicatorStyle: true,
    inverted: true,
    keyboardDismissMode: true,
    maintainVisibleContentPosition: true,
    maximumZoomScale: true,
    minimumZoomScale: true,
    nestedScrollEnabled: true,
    onMomentumScrollBegin: true,
    onMomentumScrollEnd: true,
    onScroll: true,
    onScrollBeginDrag: true,
    onScrollEndDrag: true,
    onScrollToTop: true,
    overScrollMode: true,
    pagingEnabled: true,
    persistentScrollbar: true,
    pinchGestureEnabled: true,
    scrollEnabled: true,
    scrollEventThrottle: true,
    scrollIndicatorInsets: {
      diff: require('../../Utilities/differ/pointsDiffer'),
    },
    scrollPerfTag: true,
    scrollToOverflowEnabled: true,
    scrollsToTop: true,
    sendMomentumEvents: true,
    showsHorizontalScrollIndicator: true,
    showsVerticalScrollIndicator: true,
    snapToAlignment: true,
    snapToEnd: true,
    snapToInterval: true,
    snapToOffsets: true,
    snapToStart: true,
    zoomScale: true,
  },
};

module.exports = (ScrollViewViewConfig: PartialViewConfig);


text:
layout:     post
title: A redis base delay queue
date: 2017-09-10 20:21:35
summary: how to design a reliable delay queue base on redis
categories: golang, queue
---

[Later](http://github.com/btfak/later) is a redis base delay queue

### Usege
golang version: 1.7+
```
go build github.com/btfak/later
$: ./later -h
Usage of ./later:
  -address string
    	serve listen address (default ":8080")
  -redis string
    	redis address (default "redis://127.0.0.1:6379/0")
```

### Feature

- Delay push message to target
- At-lease-once delivery
- Fail and retry
- Reliable
- Performance

## Inside Later

**Later has  four storage part**

* Task Pool: kv pairs hold fully task data
* Delay Bucket: a sorted set store task id and execute time, which waiting to execute by worker
* Unack Bucket: a sorted set store task which has called backend server and waiting response
* Error Bucket: a sorted set store task which call backend server fail

**Three worker fetch tasks with time ticker**

* Delay Worker: get tasks which reach execute time and move tasks from delay bucket to unack bucket, if call backend server success, delete all task data. Otherwise, move tasks from delay bucket to error bucket
* Unack Worker: move tasks from unack bucket to delay bucket
* Error Worker: move tasks from error bucket to delay bucket

**Concurrence problem**

In general, we will deploy multi instance, workers will get same task, but we judge result when move task from delay bucket to unack bucket, if `ZADD` return 1, worker move on, otherwise worker return immediately.

### Frontend API

Response http code: **200** success, **400** request invalid, **404** task not found, **500** internal error

- Create Task

  ```
  Request:
  POST /create
  {
  	"topic":"order",
  	"delay":15, // second
  	"retry":3,  // max retry 3 times, interval 10,20,40... seconds
  	"callback":"http://127.0.0.1:8888/", // http post to target url
  	"content":"hello" // content to post
  }
  Response:
  {
      "id": "35adbde5-77c4-4d65-adac-0082d91f2554"
  }
  ```

- Delete Task

  ```
  Request:
  POST /delete
  {
  	"id":"35adbde5-77c4-4d65-adac-0082d91f2554"
  }
  ```

- Query Task

  ```
  Request:
  POST /query
  {
  	"id":"35adbde5-77c4-4d65-adac-0082d91f2554"
  }
  Response:
  {
      "id": "cb9aefdd-5bd1-4bf3-8c94-1ed5c2ea638e",
      "topic": "order",
      "execute_time": 1504934230,
      "max_retry": 1,
      "has_retry": 0,
      "callback": "http://127.0.0.1:8888/success",
      "content": "hello",
      "creat_time": 1504934220
  }
  ```

## Backend API

- Callback

  ```
  Request:
  POST /?
  {
    "id": "57e177ff-454c-42d6-93ab-65895b950dbf",
    "topic": "order",
    "content": "hello"
  }
  Response:
  {
      "code":100 // 100: success,101: too many request,other: fail
  }
  ```

  At-lease-once delivery, may repeat delivery.  Backend api should idempotent and always return response.

redpajama_set_name: RedPajamaGithub


text:
layout: post
title: Video - PIVX Facts as of May 8 2017
description: Video - PIVX Facts as of May 8 2017
author: Melvin Draupnir
authorurl: /melvin-draupnir/
published: true
---

Some are asking, what's going on with PIVX?" So we put a little slide show together for you!

TRANSCRIPT


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.spacepro</groupId>
    <artifactId>spacepro</artifactId>
    <version>1.2-SNAPSHOT</version>
    <packaging>pom</packaging>

    <name>SpacePro project</name>
    <url>http://www.spacepro.org</url>
    <!--
    Releases the version and prepares snapshot
    mvn - -batch-mode -Dtag=v1.3 release:prepare  -DreleaseVersion=1.3 -DdevelopmentVersion=1.4-SNAPSHOT
    -->

    <properties>

    </properties>

    <modules>
        <module>spacepro-model</module>
        <module>spacepro-service</module>
        <module>spacepro-rest-api</module>
        <module>spacepro-soap-api</module>
        <module>spacepro-gui</module>
    </modules>

    <scm>
        <url>ssh://github.com/sarzwest/spacepro.git</url>
        <connection>scm:git:ssh://github.com/sarzwest/spacepro.git</connection>
        <developerConnection>scm:git:ssh://github.com/sarzwest/spacepro.git</developerConnection>
      <tag>HEAD</tag>
  </scm>
    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.3</version>
                    <configuration>
                        <source>1.7</source>
                        <target>1.7</target>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>2.6</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-release-plugin</artifactId>
                    <version>2.5.3</version>
                    <configuration>
                        <autoVersionSubmodules>true</autoVersionSubmodules>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.spacepro</groupId>
                <artifactId>spacepro-rest-api</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>org.spacepro</groupId>
                <artifactId>spacepro-model</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>org.spacepro</groupId>
                <artifactId>spacepro-service</artifactId>
                <version>${project.version}</version>
            </dependency>

            <dependency>
                <groupId>com.fasterxml.jackson.jaxrs</groupId>
                <artifactId>jackson-jaxrs-json-provider</artifactId>
                <version>2.7.2</version>
            </dependency>
            <dependency>
                <groupId>ma.glasnost.orika</groupId>
                <artifactId>orika-core</artifactId>
                <version>1.4.6</version>
            </dependency>
            <dependency>
                <groupId>commons-codec</groupId>
                <artifactId>commons-codec</artifactId>
                <version>1.10</version>
            </dependency>
            <dependency>
                <groupId>com.google.guava</groupId>
                <artifactId>guava</artifactId>
                <version>19.0</version>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>1.7.12</version>
            </dependency>
            <dependency>
                <groupId>ch.qos.logback</groupId>
                <artifactId>logback-core</artifactId>
                <version>1.1.3</version>
            </dependency>
            <dependency>
                <groupId>ch.qos.logback</groupId>
                <artifactId>logback-classic</artifactId>
                <version>1.1.3</version>
            </dependency>
            <dependency>
                <groupId>org.projectlombok</groupId>
                <artifactId>lombok</artifactId>
                <version>1.16.4</version>
            </dependency>

            <!--<dependency>-->
                <!--<groupId>org.jboss.spec</groupId>-->
                <!--<artifactId>jboss-javaee-6.0</artifactId>-->
                <!--<version>3.0.2.Final-redhat-4</version>-->
                <!--<type>pom</type>-->
                <!--<scope>provided</scope>-->
            <!--</dependency>-->
            <!--<dependency>-->
                <!--<groupId>org.jboss.resteasy</groupId>-->
                <!--<artifactId>resteasy-jaxrs</artifactId>-->
                <!--<version>3.0.16.Final</version>-->
            <!--</dependency>-->
            <!--<dependency>-->
                <!--<groupId>org.jboss.resteasy</groupId>-->
                <!--<artifactId>resteasy-servlet-initializer</artifactId>-->
                <!--<version>3.0.16.Final</version>-->
            <!--</dependency>-->
            <!--<dependency>-->
                <!--<groupId>org.jboss.resteasy</groupId>-->
                <!--<artifactId>resteasy-cdi</artifactId>-->
                <!--<version>3.0.16.Final</version>-->
            <!--</dependency>-->

            <dependency>
                <groupId>org.jboss.resteasy</groupId>
                <artifactId>jaxrs-api</artifactId>
                <version>2.3.6.Final</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>javax.servlet</groupId>
                <artifactId>javax.servlet-api</artifactId>
                <version>3.0.1</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>javax.annotation</groupId>
                <artifactId>javax.annotation-api</artifactId>
                <version>1.2</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>javax.inject</groupId>
                <artifactId>javax.inject</artifactId>
                <version>1</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>org.hibernate.javax.persistence</groupId>
                <artifactId>hibernate-jpa-2.1-api</artifactId>
                <version>1.0.0.Final</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>javax.ejb</groupId>
                <artifactId>ejb-api</artifactId>
                <version>3.0</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>javax.validation</groupId>
                <artifactId>validation-api</artifactId>
                <version>1.1.0.Final</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>org.hibernate</groupId>
                <artifactId>hibernate-entitymanager</artifactId>
                <version>4.3.6.Final</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.hibernate.javax.persistence</groupId>
                        <artifactId>hibernate-jpa-2.1-api</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>

            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>4.12</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <profiles>
        <profile>
            <!-- When built in OpenShift the 'openshift' profile will be used when
                    invoking mvn. -->
            <!-- Use this profile for any OpenShift specific customization your app
                    will need. -->
            <!-- By default that is to put the resulting archive into the 'deployments'
                    folder. -->
            <!-- http://maven.apache.org/guides/mini/guide-building-for-different-environments.html -->
            <id>openshift</id>
            <build>
                <finalName>spacepro</finalName>
                <pluginManagement>
                    <plugins>
                        <plugin>
                            <artifactId>maven-war-plugin</artifactId>
                            <version>2.6</version>
                            <configuration>
                                <outputDirectory>deployments</outputDirectory>
                                <warName>ROOT</warName>
                            </configuration>
                        </plugin>
                    </plugins>
                </pluginManagement>
            </build>
        </profile>
    </profiles>

</project>


text:
/**
 * @fileoverview Tests for no-extend-native rule.
 * @author David Nelson
 */

"use strict";

//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------

const rule = require("../../../lib/rules/no-extend-native"),
    RuleTester = require("../../../lib/testers/rule-tester");

//------------------------------------------------------------------------------
// Tests
//------------------------------------------------------------------------------

const ruleTester = new RuleTester();

ruleTester.run("no-extend-native", rule, {
    valid: [
        "x.prototype.p = 0",
        "x.prototype['p'] = 0",
        "Object.p = 0",
        "Object.toString.bind = 0",
        "Object['toString'].bind = 0",
        "Object.defineProperty(x, 'p', {value: 0})",
        "Object.defineProperties(x, {p: {value: 0}})",
        "global.Object.prototype.toString = 0",
        "this.Object.prototype.toString = 0",
        "with(Object) { prototype.p = 0; }",
        "o = Object; o.prototype.toString = 0",
        "eval('Object.prototype.toString = 0')",
        "parseFloat.prototype.x = 1",
        {
            code: "Object.prototype.g = 0",
            options: [{ exceptions: ["Object"] }]
        },

        // https://github.com/eslint/eslint/issues/4438
        "Object.defineProperty()",
        "Object.defineProperties()",

        // https://github.com/eslint/eslint/issues/8461
        "function foo() { var Object = function() {}; Object.prototype.p = 0 }",
        {
            code: "{ let Object = function() {}; Object.prototype.p = 0 }",
            parserOptions: { ecmaVersion: 6 }
        }
    ],
    invalid: [{
        code: "Object.prototype.p = 0",
        errors: [{
            message: "Object prototype is read only, properties should not be added.",
            type: "AssignmentExpression"
        }]
    }, {
        code: "Function.prototype['p'] = 0",
        errors: [{
            message: "Function prototype is read only, properties should not be added.",
            type: "AssignmentExpression"
        }]
    }, {
        code: "String['prototype'].p = 0",
        errors: [{
            message: "String prototype is read only, properties should not be added.",
            type: "AssignmentExpression"
        }]
    }, {
        code: "Number['prototype']['p'] = 0",
        errors: [{
            message: "Number prototype is read only, properties should not be added.",
            type: "AssignmentExpression"
        }]
    }, {
        code: "Object.defineProperty(Array.prototype, 'p', {value: 0})",
        errors: [{
            message: "Array prototype is read only, properties should not be added.",
            type: "CallExpression"
        }]
    }, {
        code: "Object.defineProperties(Array.prototype, {p: {value: 0}})",
        errors: [{
            message: "Array prototype is read only, properties should not be added.",
            type: "CallExpression"
        }]
    }, {
        code: "Object.defineProperties(Array.prototype, {p: {value: 0}, q: {value: 0}})",
        errors: [{
            message: "Array prototype is read only, properties should not be added.",
            type: "CallExpression"
        }]
    },
    {
        code: "Number['prototype']['p'] = 0",
        options: [{ exceptions: ["Object"] }],
        errors: [{
            message: "Number prototype is read only, properties should not be added.",
            type: "AssignmentExpression"
        }]
    },
    {
        code: "Object.prototype.p = 0; Object.prototype.q = 0",
        errors: [{
            message: "Object prototype is read only, properties should not be added.",
            type: "AssignmentExpression",
            column: 1
        }, {
            message: "Object prototype is read only, properties should not be added.",
            type: "AssignmentExpression",
            column: 25
        }]
    },
    {
        code: "function foo() { Object.prototype.p = 0 }",
        errors: [{
            message: "Object prototype is read only, properties should not be added.",
            type: "AssignmentExpression"
        }]
    }]
});


text:
module Pricecut
  module Elements
    class H5 < Element
      def output!
        p "##### "; yield_children; p " #####"; eol
      end
    end
  end
end


text:
package org.csc.phynixx.spring.mvc.eval.webbinding;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;

@Configuration
@EnableAspectJAutoProxy(proxyTargetClass = true)
public class WebBindingConfig {

   @Bean
   public static InitDataBinderAspect initDataBinderAspect() {
      return new InitDataBinderAspect();
   }

}


text:
module.exports = function () {
  this.World = World;

  this.When(
    /perform a search for "(.*)"/,
    function (searchText, next) {
      this.currentPage.search(searchText)
        .then(this.notifyOk(next), next);
    }
  );

  this.When(
    /clear the search text/,
    function (next) {
      this.currentPage.clearSearchText()
        .then(this.notifyOk(next), next);
    }
  );

};


text:
//replaced by windows version because of permissions issues in windows
//replaced by ipc_posix because that is portable enough on non-windows platforms

//http://www.boost.org/doc/libs/1_39_0/doc/html/interprocess/acknowledgements_notes.html
#include <boost/interprocess/ipc/message_queue.hpp>

#define EXODUS_IPC_EXTERN extern
#include <exodus/mvipc.h>
#include <exodus/mvfunctor.h>

//#define BUFSIZE 1048576
//cant be bigger than process stacksize .. this LIMITS boost messaging
#define BUFSIZE 262144

#ifndef DEBUG
#define TRACING 0
#else
#define TRACING 2
#endif

namespace exodus {

void respondToRequests(boost::interprocess::message_queue& request_queue, boost::interprocess::message_queue& response_queue, ExodusFunctorBase& exodusfunctorbase)
{

	std::size_t request_size;
	unsigned int priority;

	char chRequest[BUFSIZE];
	//char chResponse[BUFSIZE];
	//int nresponsebytes;
	std::string response;

	while (true)
	{

		//get a request
		try
		{
			request_queue.receive(&chRequest, BUFSIZE, request_size, priority);
		}

		//handle failure to get a request
		catch(boost::interprocess::interprocess_exception &ex)
		{
			std::cerr << "mvipc: failed to receive " << ex.what() << std::endl;
			continue;
		}

		//log
		#if TRACING >= 3
			wprintf(L"---------------------------------\nMVipc() read  %d bytes from pipe\n",request_size);
		#endif

		//determine a response
		getResponseToRequest(chRequest,request_size,0,response,exodusfunctorbase);

		//send a response
		try
		{
			response_queue.send(response.data(), response.length(), 0);
		}

		//handle failure to send response
		catch(boost::interprocess::interprocess_exception &ex)
		{
			std::cerr << "mvipc: failed send " << ex.what() << std::endl;
			continue;
		}

		//log
		#if TRACING >= 3
			wprintf(L"MVipc() wrote %d bytes <- \"\"\n",nresponsebytes);
		#endif

	}
}

void closeipcqueues(const std::string& requestqueuename, const std::string& responsequeuename)
{
	//close the request queue
	try
	{
		boost::interprocess::message_queue::remove(requestqueuename.c_str());
	}
	catch(boost::interprocess::interprocess_exception &ex)
	{
		std::cerr << "cannot close " << requestqueuename << " " << ex.what() << std::endl;
	}

	//close the response queue
	try
	{
		boost::interprocess::message_queue::remove(responsequeuename.c_str());
	}
	catch(boost::interprocess::interprocess_exception &ex)
	{
		std::cerr << "cannot close " << responsequeuename << " " << ex.what() << std::endl;
	}

}

//this function is started as a thread by startipc()
int MVipc(const int environmentn, var& pgconnparams)
{

	//TODO prevent or handle SELECT in dictionary functions

	//flag to connect NOT to be recursive and open yet another ipc thread
	tss_ipcstarted.reset(new bool(true));

	//clone the postgres connection because the parent thread is running a select with it
	if (!var().connect(pgconnparams))
	{
		throw var(L"MVipc Cannot connect additional thread to postgres");
		return false;
	}

	//set the threads environment number (same as and provided by the parent thread)
	//AFTER opening the database connection
	setenvironmentn(environmentn);
	var processn=getprocessn();

	//this is a dict library caller
	//TODO check if possible to have no environment;
	//*COPY in mvipc_posix.cpp mvipc_boost.cpp mvipc_win.cpp
	MvEnvironment standalone_mv;
	MvEnvironment* mv=global_environments[environmentn];
	if (not mv)
	{
#if TRACING >= 2
		std::clog<<"MVipc() Using a standalone MvEnvironment"<<std::endl;
#endif
		mv=&standalone_mv;
		mv->init(environmentn);
	}
	ExodusFunctorBase exodusfunctorbase(*mv);

	//"\\\\.\\pipe\\exoduspipexyz"
	//strings of MS tchars
	//typedef basic_string<TCHAR> tstring;
	//wchar_t* exoduspipename="\\\\.\\pipe\\exoduspipexyz";
	var temp="requestexodusservice-"^processn^L"."^environmentn;
	std::string requestqueuename=temp.toString();
	var temp2="responseexodusservice-"^processn^L"."^environmentn;
	std::string responsequeuename=temp2.toString();
	//string requestqueuename="requestexodusqueue";
	//requestqueuename+=environmentn;
	//string responsequeuename="responseexodusqueue";
	//responsequeuename+=environmentn;

	closeipcqueues(requestqueuename, responsequeuename);

	try
	{
		//open request queue
		boost::interprocess::message_queue request_queue
		(
			boost::interprocess::open_or_create	//only create
			,requestqueuename.c_str()	//name
			,100		//max message number
			,BUFSIZ		//max message size
		);

		try
		{
			//open response queue
			boost::interprocess::message_queue response_queue
			(
				boost::interprocess::open_or_create	//only create
				,responsequeuename.c_str()			//name
				,100		//max message number
				,BUFSIZ		//max message size
			);

			//indicate to waiting/paused parent thread that the pipe is open
			//(the pipe is not actually waiting until the next step)
			//scoped so that the scoped_lock is automatically released after the notification
			{
				boost::mutex::scoped_lock lock(global_ipcmutex);
				#if TRACING >= 3
				std::clog<<"MVipc() Notifying that pipe has been opened\n";
				#endif
				//TODO make sure notifies CORRECT parent thread by using an array of ipcmutexes and tss_environmentn
				global_ipccondition.notify_one();
				#if TRACING >= 3
				std::clog<<L"MVipc() Notified that pipe has been opened\n";
				#endif
			}

			respondToRequests(request_queue,response_queue,exodusfunctorbase);

			std::clog << "finished responding to queue " << requestqueuename<<std::endl;

		}
		catch(boost::interprocess::interprocess_exception &ex)
		{
			global_ipccondition.notify_one();
			std::cerr << "cannot open " << responsequeuename << " " << ex.what() << std::endl;
			closeipcqueues(requestqueuename, responsequeuename);
			return 0;
		}

	}
	catch(boost::interprocess::interprocess_exception &ex)
	{
		global_ipccondition.notify_one();
		std::cerr << "cannot open " << requestqueuename << " " << ex.what() << std::endl;
		closeipcqueues(requestqueuename, responsequeuename);
		return 0;
	}

	closeipcqueues(requestqueuename, responsequeuename);
	return 1;
}

}//namespace exodus

#endif //not windows


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

<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>org.apache.hadoop.hbase.security.visibility Class Hierarchy (HBase 0.98.8-hadoop2 API)</title>
<meta name="date" content="2014-11-14">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Hierarchy For Package org.apache.hadoop.hbase.security.visibility

Package Hierarchies:

All Packages

Class Hierarchy

java.lang.Object

org.apache.hadoop.hbase.security.visibility.Authorizations

org.apache.hadoop.hbase.coprocessor.BaseRegionObserver (implements org.apache.hadoop.hbase.coprocessor.RegionObserver)

org.apache.hadoop.hbase.coprocessor.BaseMasterAndRegionObserver (implements org.apache.hadoop.hbase.coprocessor.MasterObserver)

org.apache.hadoop.hbase.security.visibility.VisibilityController (implements org.apache.hadoop.hbase.coprocessor.CoprocessorService, org.apache.hadoop.hbase.protobuf.generated.VisibilityLabelsProtos.VisibilityLabelsService.Interface)

org.apache.hadoop.hbase.security.visibility.CellVisibility

org.apache.hadoop.hbase.security.visibility.DefaultScanLabelGenerator (implements org.apache.hadoop.hbase.security.visibility.ScanLabelGenerator)

org.apache.hadoop.hbase.security.visibility.DefaultVisibilityLabelServiceImpl (implements org.apache.hadoop.hbase.security.visibility.VisibilityLabelService)

org.apache.hadoop.hbase.security.visibility.EnforcingScanLabelGenerator (implements org.apache.hadoop.hbase.security.visibility.ScanLabelGenerator)

org.apache.hadoop.hbase.security.visibility.ExpressionExpander

org.apache.hadoop.hbase.security.visibility.ExpressionParser

org.apache.hadoop.hbase.regionserver.ScanDeleteTracker (implements org.apache.hadoop.hbase.regionserver.DeleteTracker)

org.apache.hadoop.hbase.security.visibility.VisibilityScanDeleteTracker

org.apache.hadoop.hbase.security.visibility.SimpleScanLabelGenerator (implements org.apache.hadoop.hbase.security.visibility.ScanLabelGenerator)

java.lang.Throwable (implements java.io.Serializable)

java.lang.Exception

java.io.IOException

org.apache.hadoop.hbase.HBaseIOException

org.apache.hadoop.hbase.DoNotRetryIOException

org.apache.hadoop.hbase.security.visibility.InvalidLabelException

org.apache.hadoop.hbase.security.visibility.LabelAlreadyExistsException

org.apache.hadoop.hbase.security.visibility.VisibilityControllerNotReadyException

org.apache.hadoop.hbase.security.visibility.ParseException

org.apache.hadoop.hbase.security.visibility.VisibilityClient

org.apache.hadoop.hbase.security.visibility.VisibilityConstants

org.apache.hadoop.hbase.security.visibility.VisibilityLabelsCache (implements org.apache.hadoop.hbase.security.visibility.VisibilityLabelOrdinalProvider)

org.apache.hadoop.hbase.security.visibility.VisibilityLabelServiceManager

org.apache.hadoop.hbase.security.visibility.VisibilityLabelsValidator

org.apache.hadoop.hbase.security.visibility.VisibilityUtils

org.apache.hadoop.hbase.zookeeper.ZooKeeperListener

org.apache.hadoop.hbase.security.visibility.ZKVisibilityLabelWatcher

Interface Hierarchy

org.apache.hadoop.conf.Configurable

org.apache.hadoop.hbase.security.visibility.ScanLabelGenerator

org.apache.hadoop.hbase.security.visibility.VisibilityLabelService

org.apache.hadoop.hbase.security.visibility.VisibilityExpEvaluator

org.apache.hadoop.hbase.security.visibility.VisibilityLabelOrdinalProvider

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Copyright © 2014 The Apache Software Foundation. All rights reserved.


text:
#import "TiViewController.h"
#import "TiApp.h"

@implementation TiViewController

- (id)initWithViewProxy:(TiViewProxy *)window
{
  if (self = [super init]) {
    _proxy = window;
    self.presentationController.delegate = self;
    [self updateOrientations];
    [TiUtils configureController:self withObject:_proxy];
  }
  return self;
}

- (void)dealloc
{
  RELEASE_TO_NIL(_previewActions);
  [super dealloc];
}

- (NSArray<id<UIPreviewActionItem>> *)previewActionItems
{
  if ([self previewActions] == nil) {
    [self setPreviewActions:[NSArray array]];
  }

  return [self previewActions];
}

- (void)updateOrientations
{
  id object = [_proxy valueForUndefinedKey:@"orientationModes"];
  _supportedOrientations = [TiUtils TiOrientationFlagsFromObject:object];
  if (_supportedOrientations == TiOrientationNone) {
    _supportedOrientations = [[[TiApp app] controller] getDefaultOrientations];
  }
}

- (TiViewProxy *)proxy
{
  return _proxy;
}

#ifdef DEVELOPER
- (void)viewWillLayoutSubviews
{
  CGRect bounds = [[self view] bounds];
  NSLog(@"TIVIEWCONTROLLER WILL LAYOUT SUBVIEWS %.1f %.1f", bounds.size.width, bounds.size.height);
  [super viewWillLayoutSubviews];
}
#endif

- (void)viewDidLayoutSubviews
{
#ifdef DEVELOPER
  CGRect bounds = [[self view] bounds];
  NSLog(@"TIVIEWCONTROLLER DID LAYOUT SUBVIEWS %.1f %.1f", bounds.size.width, bounds.size.height);
#endif
  if (!CGRectEqualToRect([_proxy sandboxBounds], [[self view] bounds])) {
    [_proxy parentSizeWillChange];
  }
  [super viewDidLayoutSubviews];
}

//IOS5 support. Begin Section. Drop in 3.2
- (BOOL)automaticallyForwardAppearanceAndRotationMethodsToChildViewControllers
{
  return YES;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
  return TI_ORIENTATION_ALLOWED(_supportedOrientations, toInterfaceOrientation) ? YES : NO;
}
//IOS5 support. End Section

//IOS6 new stuff.
- (BOOL)shouldAutomaticallyForwardRotationMethods
{
  return YES;
}

- (BOOL)shouldAutomaticallyForwardAppearanceMethods
{
  return YES;
}

- (BOOL)shouldAutorotate
{
  return YES;
}

- (UIInterfaceOrientationMask)supportedInterfaceOrientations
{
  /*
     If we are in a navigation controller, let us match so it doesn't get freaked
     out in when pushing/popping. We are going to force orientation anyways.
     */
  if ([self navigationController] != nil) {
    return [[self navigationController] supportedInterfaceOrientations];
  }
  //This would be for modal.
  return (UIInterfaceOrientationMask)_supportedOrientations;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
  return [[[TiApp app] controller] lastValidOrientation:_supportedOrientations];
}

- (void)loadView
{
  if (_proxy == nil) {
    DebugLog(@"NO PROXY ASSOCIATED WITH VIEWCONTROLLER. RETURNING") return;
  }
  [self updateOrientations];
  [self setHidesBottomBarWhenPushed:[TiUtils boolValue:[_proxy valueForUndefinedKey:@"tabBarHidden"] def:NO]];
  //Always wrap proxy view with a wrapperView.
  //This way proxy always has correct sandbox when laying out
  [_proxy parentWillShow];
  UIView *wrapperView = [[UIView alloc] initWithFrame:UIApplication.sharedApplication.keyWindow.frame];
  wrapperView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
  [wrapperView addSubview:[_proxy view]];
  [wrapperView bringSubviewToFront:[_proxy view]];
  self.view = wrapperView;
  [wrapperView release];
}

#pragma mark - Appearance & rotation methods

- (void)viewWillAppear:(BOOL)animated
{
  [_proxy parentWillShow];
  if ([_proxy conformsToProtocol:@protocol(TiWindowProtocol)]) {
    [(id<TiWindowProtocol>)_proxy viewWillAppear:animated];
  }
  [super viewWillAppear:animated];
}
- (void)viewWillDisappear:(BOOL)animated
{
  [_proxy parentWillHide];
  if ([_proxy conformsToProtocol:@protocol(TiWindowProtocol)]) {
    [(id<TiWindowProtocol>)_proxy viewWillDisappear:animated];
  }
  [super viewWillDisappear:animated];
}
- (void)viewDidAppear:(BOOL)animated
{
  if ([_proxy conformsToProtocol:@protocol(TiWindowProtocol)]) {
    [(id<TiWindowProtocol>)_proxy viewDidAppear:animated];
  }
  [super viewDidAppear:animated];
}
- (void)viewDidDisappear:(BOOL)animated
{
  if ([_proxy conformsToProtocol:@protocol(TiWindowProtocol)]) {
    [(id<TiWindowProtocol>)_proxy viewDidDisappear:animated];
  }
  [super viewDidDisappear:animated];
}

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
- (void)presentationControllerWillDismiss:(UIPresentationController *)presentationController
{
  if ([_proxy conformsToProtocol:@protocol(TiWindowProtocol)]) {
    [(id<TiWindowProtocol>)_proxy presentationControllerWillDismiss:presentationController];
  }
}

- (void)presentationControllerDidDismiss:(UIPresentationController *)presentationController
{
  if ([_proxy conformsToProtocol:@protocol(TiWindowProtocol)]) {
    [(id<TiWindowProtocol>)_proxy presentationControllerDidDismiss:presentationController];
  }
}
#endif

- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
{
  if ([_proxy conformsToProtocol:@protocol(TiWindowProtocol)]) {
    [(id<TiWindowProtocol>)_proxy viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
  }
  [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
}

- (void)systemLayoutFittingSizeDidChangeForChildContentContainer:(id<UIContentContainer>)container
{
  if ([_proxy conformsToProtocol:@protocol(TiWindowProtocol)]) {
    [(id<TiWindowProtocol>)_proxy systemLayoutFittingSizeDidChangeForChildContentContainer:container];
  }
  [super systemLayoutFittingSizeDidChangeForChildContentContainer:container];
}

- (void)willTransitionToTraitCollection:(UITraitCollection *)newCollection withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
{
  if ([_proxy conformsToProtocol:@protocol(TiWindowProtocol)]) {
    [(id<TiWindowProtocol>)_proxy willTransitionToTraitCollection:newCollection withTransitionCoordinator:coordinator];
  }
  [super willTransitionToTraitCollection:newCollection withTransitionCoordinator:coordinator];
}

- (void)preferredContentSizeDidChangeForChildContentContainer:(id<UIContentContainer>)container
{
  if ([_proxy conformsToProtocol:@protocol(TiWindowProtocol)]) {
    [(id<TiWindowProtocol>)_proxy preferredContentSizeDidChangeForChildContentContainer:container];
  }
  [super preferredContentSizeDidChangeForChildContentContainer:container];
}

#pragma mark - HomeIndicatorAutoHidden

- (BOOL)prefersHomeIndicatorAutoHidden
{
  if ([_proxy conformsToProtocol:@protocol(TiWindowProtocol)]) {
    return [(id<TiWindowProtocol>)_proxy homeIndicatorAutoHide];
  } else {
    return NO;
  }
}

#pragma mark - Status Bar Appearance

- (BOOL)prefersStatusBarHidden
{
  if ([_proxy conformsToProtocol:@protocol(TiWindowProtocol)]) {
    return [(id<TiWindowProtocol>)_proxy hidesStatusBar];
  } else {
    return NO;
  }
}

- (UIStatusBarStyle)preferredStatusBarStyle
{
  if ([_proxy conformsToProtocol:@protocol(TiWindowProtocol)]) {
    return [(id<TiWindowProtocol>)_proxy preferredStatusBarStyle];
  } else if ([[[TiApp app] controller] topContainerController] != nil) {
    // Prefer the style of the most recent view controller.
    return [[[[TiApp app] controller] topContainerController] preferredStatusBarStyle];
  } else {
    return UIStatusBarStyleDefault;
  }
}

- (BOOL)modalPresentationCapturesStatusBarAppearance
{
  return YES;
}

- (UIStatusBarAnimation)preferredStatusBarUpdateAnimation
{
  return UIStatusBarAnimationNone;
}
- (BOOL)disablesAutomaticKeyboardDismissal
{
  return NO;
}
@end


text:
<?php

class ProxyConfig {

        /**
         * Proxy server IP address or hostname
         */
  public $proxyHost;
        /**
         * Proxy server port
         */
  public $proxyPort;
        /**
         * [Optional] - Proxy user
         */
  public $proxyUser;
        /**
         * [Optional] - Proxy user password
         */
  public $proxyPassword;

}
?>


text:
<?php

namespace Spatie\SchemaOrg;

/**
 * A QAPage is a WebPage focussed on a specific Question and its Answer(s), e.g.
 * in a question answering site or documenting Frequently Asked Questions
 * (FAQs).
 *
 * @see http://schema.org/QAPage
 *
 * @mixin \Spatie\SchemaOrg\WebPage
 */
class QAPage extends BaseType
{
}


text:
from .util import call_class_function

_SETS_INDEX_KEY = "sets"
_RANGE_INDEX_KEY = "range"
_DEFAULT_INDEX_KEY = "default"

class PyomoItemCreator(object):
	''' Helper class for creating various Pyomo items '''
	@staticmethod
	def _create_pyomo_item(pyomo_item_creator, pyomo_item_creator_arg):
		return pyomo_item_creator(pyomo_item_creator_arg)

	@staticmethod
	def _set_abstract_model_property(abstract_model, property_name, value):
		abstract_model.__setattr__(property_name, value)

	@staticmethod
	def _create_and_set_abstract_model_property_item(abstract_model, property_name, pyomo_item_creator, pyomo_item_creator_arg):
		# Create the Pyomo item
		pyomo_item = PyomoItemCreator._create_pyomo_item(pyomo_item_creator, pyomo_item_creator_arg)
		# Set the property to the created item
		PyomoItemCreator._set_abstract_model_property(abstract_model, property_name, pyomo_item)
		return pyomo_item

	@staticmethod
	def _create_and_set_abstract_model_indexed_property_item(abstract_model, property_name_base, property_name_index, pyomo_item_creator, pyomo_item_creator_arg):
		return PyomoItemCreator._create_and_set_abstract_model_indexed_property_item(abstract_model, property_name_base + property_name_index, pyomo_item_creator, pyomo_item_creator_arg)

	@staticmethod
	def create_and_set_abstract_model_indexed_property_item(abstract_model, nameable, property_name_base, property_name_index, pyomo_item_creator, pyomo_item_creator_arg):
		name = nameable.get_name()
		if len(name) > 0:
			return PyomoItemCreator._create_and_set_abstract_model_property_item(abstract_model, name, pyomo_item_creator, pyomo_item_creator_arg)
		else:
			return PyomoItemCreator._create_and_set_abstract_model_indexed_property_item(abstract_model, property_name_base, property_name_index, pyomo_item_creator, pyomo_item_creator_arg)

	@staticmethod
	def _create_pyomo_indexable_item_creator(indexable_type):
		def _create_pyomo_indexable_type_item(indexable_item_dict):
			if len(indexable_item_dict[_SETS_INDEX_KEY]) > 0:
				if indexable_item_dict[_DEFAULT_INDEX_KEY] is None:
					return indexable_type(*indexable_item_dict[_SETS_INDEX_KEY], within=indexable_item_dict[_RANGE_INDEX_KEY])
				else:
					return indexable_type(*indexable_item_dict[_SETS_INDEX_KEY], within=indexable_item_dict[_RANGE_INDEX_KEY], default=indexable_item_dict[_DEFAULT_INDEX_KEY])
			else:
				if indexable_item_dict[_DEFAULT_INDEX_KEY] is None:
					return indexable_type(within=indexable_item_dict[_RANGE_INDEX_KEY])
				else:
					return indexable_type(within=indexable_item_dict[_RANGE_INDEX_KEY], default=indexable_item_dict[_DEFAULT_INDEX_KEY])
		return _create_pyomo_indexable_type_item

	@staticmethod
	def create_pyomo_indexable_items(abstract_model, set_map, indexable_items, property_base_name, indexable_item_type):
		map = dict()
		for i in range(len(indexable_items)):
			indexable_item = indexable_items[i]
			default = call_class_function(indexable_item, "get_default", None)
			indexable_item_arguments = {
											_SETS_INDEX_KEY: [set_map[set] for set in indexable_item.get_sets()],
											_RANGE_INDEX_KEY: set_map[indexable_item.get_range()],
											_DEFAULT_INDEX_KEY: default
										}
			map[indexable_item] = PyomoItemCreator.create_and_set_abstract_model_indexed_property_item(abstract_model,
																										indexable_item,
																										property_base_name,
																										i,
																										PyomoItemCreator._create_pyomo_indexable_item_creator(indexable_item_type),
																										indexable_item_arguments)
		return map


text:
/* Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.flowable.test.spring.boot.eventregistry;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;
import static org.flowable.test.spring.boot.util.DeploymentCleanerUtil.deleteDeployments;
import static org.mockito.Mockito.mock;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import org.assertj.core.api.AbstractCollectionAssert;
import org.assertj.core.api.ObjectAssert;
import org.flowable.app.engine.AppEngine;
import org.flowable.app.engine.AppEngineConfiguration;
import org.flowable.app.spring.SpringAppEngineConfiguration;
import org.flowable.engine.ProcessEngine;
import org.flowable.engine.ProcessEngineConfiguration;
import org.flowable.engine.impl.util.EngineServiceUtil;
import org.flowable.eventregistry.api.ChannelModelProcessor;
import org.flowable.eventregistry.impl.EventRegistryEngine;
import org.flowable.eventregistry.impl.EventRegistryEngineConfiguration;
import org.flowable.eventregistry.impl.management.DefaultEventRegistryChangeDetectionManager;
import org.flowable.eventregistry.impl.pipeline.DelegateExpressionInboundChannelModelProcessor;
import org.flowable.eventregistry.impl.pipeline.DelegateExpressionOutboundChannelModelProcessor;
import org.flowable.eventregistry.impl.pipeline.InboundChannelModelProcessor;
import org.flowable.eventregistry.impl.pipeline.OutboundChannelModelProcessor;
import org.flowable.eventregistry.spring.SpringEventRegistryEngineConfiguration;
import org.flowable.eventregistry.spring.jms.JmsChannelModelProcessor;
import org.flowable.eventregistry.spring.kafka.KafkaChannelDefinitionProcessor;
import org.flowable.eventregistry.spring.management.DefaultSpringEventRegistryChangeDetectionExecutor;
import org.flowable.eventregistry.spring.rabbit.RabbitChannelDefinitionProcessor;
import org.flowable.spring.SpringProcessEngineConfiguration;
import org.flowable.spring.boot.ProcessEngineAutoConfiguration;
import org.flowable.spring.boot.ProcessEngineServicesAutoConfiguration;
import org.flowable.spring.boot.app.AppEngineAutoConfiguration;
import org.flowable.spring.boot.app.AppEngineServicesAutoConfiguration;
import org.flowable.spring.boot.eventregistry.EventRegistryAutoConfiguration;
import org.flowable.spring.boot.eventregistry.EventRegistryServicesAutoConfiguration;
import org.flowable.test.spring.boot.util.CustomUserEngineConfigurerConfiguration;
import org.junit.jupiter.api.Test;
import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration;
import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration;
import org.springframework.boot.autoconfigure.jms.JmsAutoConfiguration;
import org.springframework.boot.autoconfigure.jms.activemq.ActiveMQAutoConfiguration;
import org.springframework.boot.autoconfigure.kafka.KafkaAutoConfiguration;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;

public class EventRegistryAutoConfigurationTest {

    private ApplicationContextRunner contextRunner = new ApplicationContextRunner()
        .withConfiguration(AutoConfigurations.of(
            DataSourceAutoConfiguration.class,
            DataSourceTransactionManagerAutoConfiguration.class,
            EventRegistryServicesAutoConfiguration.class,
            EventRegistryAutoConfiguration.class,
            JacksonAutoConfiguration.class
        ))
        .withUserConfiguration(CustomUserEngineConfigurerConfiguration.class);

    @Test
    public void standaloneEventRegistryWithBasicDataSource() {
        contextRunner.run(context -> {
            assertThat(context)
                .doesNotHaveBean(AppEngine.class)
                .doesNotHaveBean(ProcessEngine.class)
                .doesNotHaveBean(ChannelModelProcessor.class)
                .doesNotHaveBean("eventProcessEngineConfigurationConfigurer")
                .doesNotHaveBean("eventAppEngineConfigurationConfigurer");
            EventRegistryEngine eventRegistryEngine = context.getBean(EventRegistryEngine.class);
            assertThat(eventRegistryEngine).as("Event registry engine").isNotNull();
            assertAllServicesPresent(context, eventRegistryEngine);

            AbstractCollectionAssert<?, Collection<? extends ChannelModelProcessor>, ChannelModelProcessor, ObjectAssert<ChannelModelProcessor>>
                channelModelProcessorAssert = assertThat(eventRegistryEngine.getEventRegistryEngineConfiguration().getChannelModelProcessors());

            channelModelProcessorAssert
                .hasSize(4);

            channelModelProcessorAssert
                .element(0)
                .isInstanceOf(DelegateExpressionInboundChannelModelProcessor.class);

            channelModelProcessorAssert
                .element(1)
                .isInstanceOf(DelegateExpressionOutboundChannelModelProcessor.class);

            channelModelProcessorAssert
                .element(2)
                .isInstanceOf(InboundChannelModelProcessor.class);

            channelModelProcessorAssert
                .element(3)
                .isInstanceOf(OutboundChannelModelProcessor.class);

            assertThat(context).hasSingleBean(CustomUserEngineConfigurerConfiguration.class)
                .getBean(CustomUserEngineConfigurerConfiguration.class)
                .satisfies(configuration -> {
                    assertThat(configuration.getInvokedConfigurations())
                        .containsExactly(
                            SpringEventRegistryEngineConfiguration.class
                        );
                });

        });
    }

    @Test
    public void eventRegistryWithBasicDataSourceAndProcessEngine() {
        contextRunner.withConfiguration(AutoConfigurations.of(
            ProcessEngineServicesAutoConfiguration.class,
            ProcessEngineAutoConfiguration.class
        )).run(context -> {
            assertThat(context)
                .doesNotHaveBean(AppEngine.class)
                .doesNotHaveBean(ChannelModelProcessor.class)
                .hasBean("eventProcessEngineConfigurationConfigurer")
                .doesNotHaveBean("eventAppEngineConfigurationConfigurer");
            ProcessEngine processEngine = context.getBean(ProcessEngine.class);
            assertThat(processEngine).as("Process engine").isNotNull();
            EventRegistryEngineConfiguration eventRegistryEngineConfiguration = eventRegistryEngine(processEngine);

            EventRegistryEngine eventRegistryEngine = context.getBean(EventRegistryEngine.class);
            assertThat(eventRegistryEngine).as("Event registry engine").isNotNull();

            assertThat(eventRegistryEngine.getEventRegistryEngineConfiguration()).as("Event registry Configuration")
                .isEqualTo(eventRegistryEngineConfiguration);
            AbstractCollectionAssert<?, Collection<? extends ChannelModelProcessor>, ChannelModelProcessor, ObjectAssert<ChannelModelProcessor>>
                channelModelProcessorAssert = assertThat(eventRegistryEngine.getEventRegistryEngineConfiguration().getChannelModelProcessors());

            channelModelProcessorAssert
                .hasSize(4);

            channelModelProcessorAssert
                .element(0)
                .isInstanceOf(DelegateExpressionInboundChannelModelProcessor.class);

            channelModelProcessorAssert
                .element(1)
                .isInstanceOf(DelegateExpressionOutboundChannelModelProcessor.class);

            channelModelProcessorAssert
                .element(2)
                .isInstanceOf(InboundChannelModelProcessor.class);

            channelModelProcessorAssert
                .element(3)
                .isInstanceOf(OutboundChannelModelProcessor.class);

            assertAllServicesPresent(context, eventRegistryEngine);

            assertThat(context).hasSingleBean(CustomUserEngineConfigurerConfiguration.class)
                .getBean(CustomUserEngineConfigurerConfiguration.class)
                .satisfies(configuration -> {
                    assertThat(configuration.getInvokedConfigurations())
                        .containsExactly(
                            SpringEventRegistryEngineConfiguration.class,
                            SpringProcessEngineConfiguration.class
                        );
                });

            deleteDeployments(processEngine);
        });

    }

    @Test
    public void idmEngineWithBasicDataSourceAndAppEngine() {
        contextRunner.withConfiguration(AutoConfigurations.of(
            AppEngineServicesAutoConfiguration.class,
            AppEngineAutoConfiguration.class,
            ProcessEngineServicesAutoConfiguration.class,
            ProcessEngineAutoConfiguration.class
        )).run(context -> {
            assertThat(context)
                .doesNotHaveBean(ChannelModelProcessor.class)
                .doesNotHaveBean("eventProcessEngineConfigurationConfigurer")
                .hasBean("eventAppEngineConfigurationConfigurer");
            AppEngine appEngine = context.getBean(AppEngine.class);
            assertThat(appEngine).as("App engine").isNotNull();
            EventRegistryEngineConfiguration eventRegistryEngineConfiguration = eventRegistryEngine(appEngine);

            EventRegistryEngine eventRegistryEngine = context.getBean(EventRegistryEngine.class);
            assertThat(eventRegistryEngine).as("Idm engine").isNotNull();

            assertThat(eventRegistryEngine.getEventRegistryEngineConfiguration()).as("Event registry Configuration")
                .isEqualTo(eventRegistryEngineConfiguration);
            AbstractCollectionAssert<?, Collection<? extends ChannelModelProcessor>, ChannelModelProcessor, ObjectAssert<ChannelModelProcessor>>
                channelModelProcessorAssert = assertThat(eventRegistryEngine.getEventRegistryEngineConfiguration().getChannelModelProcessors());

            channelModelProcessorAssert
                .hasSize(4);

            channelModelProcessorAssert
                .element(0)
                .isInstanceOf(DelegateExpressionInboundChannelModelProcessor.class);

            channelModelProcessorAssert
                .element(1)
                .isInstanceOf(DelegateExpressionOutboundChannelModelProcessor.class);

            channelModelProcessorAssert
                .element(2)
                .isInstanceOf(InboundChannelModelProcessor.class);

            channelModelProcessorAssert
                .element(3)
                .isInstanceOf(OutboundChannelModelProcessor.class);

            assertAllServicesPresent(context, eventRegistryEngine);

            assertThat(context).hasSingleBean(CustomUserEngineConfigurerConfiguration.class)
                .getBean(CustomUserEngineConfigurerConfiguration.class)
                .satisfies(configuration -> {
                    assertThat(configuration.getInvokedConfigurations())
                        .containsExactly(
                            SpringProcessEngineConfiguration.class,
                            SpringEventRegistryEngineConfiguration.class,
                            SpringAppEngineConfiguration.class
                        );
                });

            deleteDeployments(appEngine);
            deleteDeployments(context.getBean(ProcessEngine.class));
        });
    }

    @Test
    public void eventRegistryWithJms() {
        contextRunner
            .withConfiguration(AutoConfigurations.of(
                ActiveMQAutoConfiguration.class,
                JmsAutoConfiguration.class
            ))
            .run(context -> {
                assertThat(context)
                    .hasSingleBean(JmsChannelModelProcessor.class)
                    .hasBean("jmsChannelDefinitionProcessor");
                EventRegistryEngine eventRegistryEngine = context.getBean(EventRegistryEngine.class);
                assertThat(eventRegistryEngine).as("Event registry engine").isNotNull();

                EventRegistryEngineConfiguration eventRegistryEngineConfiguration = eventRegistryEngine.getEventRegistryEngineConfiguration();

                AbstractCollectionAssert<?, Collection<? extends ChannelModelProcessor>, ChannelModelProcessor, ObjectAssert<ChannelModelProcessor>>
                    channelModelProcessorAssert = assertThat(eventRegistryEngineConfiguration.getChannelModelProcessors());

                channelModelProcessorAssert
                    .hasSize(5);

                channelModelProcessorAssert
                    .element(0)
                    .isEqualTo(context.getBean("jmsChannelDefinitionProcessor", ChannelModelProcessor.class));

                channelModelProcessorAssert
                    .element(1)
                    .isInstanceOf(DelegateExpressionInboundChannelModelProcessor.class);

                channelModelProcessorAssert
                    .element(2)
                    .isInstanceOf(DelegateExpressionOutboundChannelModelProcessor.class);

                channelModelProcessorAssert
                    .element(3)
                    .isInstanceOf(InboundChannelModelProcessor.class);

                channelModelProcessorAssert
                    .element(4)
                    .isInstanceOf(OutboundChannelModelProcessor.class);

            });
    }

    @Test
    public void eventRegistryWithRabbit() {
        contextRunner
            .withConfiguration(AutoConfigurations.of(RabbitAutoConfiguration.class))
            .run(context -> {
                assertThat(context)
                    .hasSingleBean(RabbitChannelDefinitionProcessor.class)
                    .hasBean("rabbitChannelDefinitionProcessor");
                EventRegistryEngine eventRegistryEngine = context.getBean(EventRegistryEngine.class);
                assertThat(eventRegistryEngine).as("Event registry engine").isNotNull();

                EventRegistryEngineConfiguration eventRegistryEngineConfiguration = eventRegistryEngine.getEventRegistryEngineConfiguration();
                AbstractCollectionAssert<?, Collection<? extends ChannelModelProcessor>, ChannelModelProcessor, ObjectAssert<ChannelModelProcessor>>
                    channelModelProcessorAssert = assertThat(eventRegistryEngineConfiguration.getChannelModelProcessors())
                    .hasSize(5);

                channelModelProcessorAssert
                    .element(0)
                    .isEqualTo(context.getBean("rabbitChannelDefinitionProcessor", ChannelModelProcessor.class));

                channelModelProcessorAssert
                    .element(1)
                    .isInstanceOf(DelegateExpressionInboundChannelModelProcessor.class);

                channelModelProcessorAssert
                    .element(2)
                    .isInstanceOf(DelegateExpressionOutboundChannelModelProcessor.class);

                channelModelProcessorAssert
                    .element(3)
                    .isInstanceOf(InboundChannelModelProcessor.class);

                channelModelProcessorAssert
                    .element(4)
                    .isInstanceOf(OutboundChannelModelProcessor.class);
            });
    }

    @Test
    public void eventRegistryWithKafka() {
        contextRunner
            .withConfiguration(AutoConfigurations.of(KafkaAutoConfiguration.class))
            .run(context -> {
                assertThat(context)
                    .hasSingleBean(KafkaChannelDefinitionProcessor.class)
                    .hasBean("kafkaChannelDefinitionProcessor");
                EventRegistryEngine eventRegistryEngine = context.getBean(EventRegistryEngine.class);
                assertThat(eventRegistryEngine).as("Event registry engine").isNotNull();

                AbstractCollectionAssert<?, Collection<? extends ChannelModelProcessor>, ChannelModelProcessor, ObjectAssert<ChannelModelProcessor>>
                    channelModelProcessorAssert = assertThat(eventRegistryEngine.getEventRegistryEngineConfiguration().getChannelModelProcessors());

                channelModelProcessorAssert
                    .hasSize(5);

                channelModelProcessorAssert
                    .element(0)
                    .isEqualTo(context.getBean("kafkaChannelDefinitionProcessor", ChannelModelProcessor.class));

                channelModelProcessorAssert
                    .element(1)
                    .isInstanceOf(DelegateExpressionInboundChannelModelProcessor.class);

                channelModelProcessorAssert
                    .element(2)
                    .isInstanceOf(DelegateExpressionOutboundChannelModelProcessor.class);

                channelModelProcessorAssert
                    .element(3)
                    .isInstanceOf(InboundChannelModelProcessor.class);

                channelModelProcessorAssert
                    .element(4)
                    .isInstanceOf(OutboundChannelModelProcessor.class);
            });
    }

    @Test
    public void eventRegistryWithJmsRabbitAndKafka() {
        contextRunner
            .withConfiguration(AutoConfigurations.of(
                ActiveMQAutoConfiguration.class,
                JmsAutoConfiguration.class,
                RabbitAutoConfiguration.class,
                KafkaAutoConfiguration.class
            ))
            .run(context -> {
                assertThat(context)
                    .hasSingleBean(JmsChannelModelProcessor.class)
                    .hasBean("jmsChannelDefinitionProcessor")
                    .hasSingleBean(RabbitChannelDefinitionProcessor.class)
                    .hasBean("rabbitChannelDefinitionProcessor")
                    .hasSingleBean(KafkaChannelDefinitionProcessor.class)
                    .hasBean("kafkaChannelDefinitionProcessor");
                EventRegistryEngine eventRegistryEngine = context.getBean(EventRegistryEngine.class);
                assertThat(eventRegistryEngine).as("Event registry engine").isNotNull();

                EventRegistryEngineConfiguration eventRegistryEngineConfiguration = eventRegistryEngine.getEventRegistryEngineConfiguration();
                AbstractCollectionAssert<?, Collection<? extends ChannelModelProcessor>, ChannelModelProcessor, ObjectAssert<ChannelModelProcessor>>
                    channelModelProcessorAssert = assertThat(eventRegistryEngineConfiguration.getChannelModelProcessors());
                channelModelProcessorAssert
                    .hasSize(7)
                    .contains(
                        context.getBean("jmsChannelDefinitionProcessor", JmsChannelModelProcessor.class),
                        context.getBean("rabbitChannelDefinitionProcessor", RabbitChannelDefinitionProcessor.class),
                        context.getBean("kafkaChannelDefinitionProcessor", KafkaChannelDefinitionProcessor.class)
                    );

                channelModelProcessorAssert
                    .element(3)
                    .isInstanceOf(DelegateExpressionInboundChannelModelProcessor.class);

                channelModelProcessorAssert
                    .element(4)
                    .isInstanceOf(DelegateExpressionOutboundChannelModelProcessor.class);

                channelModelProcessorAssert
                    .element(5)
                    .isInstanceOf(InboundChannelModelProcessor.class);

                channelModelProcessorAssert
                    .element(6)
                    .isInstanceOf(OutboundChannelModelProcessor.class);
            });
    }

    @Test
    public void eventRegistryWithCustomDefinitionProcessors() {
        contextRunner
            .withConfiguration(AutoConfigurations.of(
                ActiveMQAutoConfiguration.class,
                JmsAutoConfiguration.class,
                RabbitAutoConfiguration.class,
                KafkaAutoConfiguration.class
            ))
            .withUserConfiguration(CustomChannelDefinitionProcessorsConfiguration.class)
            .run(context -> {
                assertThat(context)
                    .doesNotHaveBean(JmsChannelModelProcessor.class)
                    .hasBean("jmsChannelDefinitionProcessor")
                    .doesNotHaveBean(RabbitChannelDefinitionProcessor.class)
                    .hasBean("rabbitChannelDefinitionProcessor")
                    .doesNotHaveBean(KafkaChannelDefinitionProcessor.class)
                    .hasBean("kafkaChannelDefinitionProcessor")
                    .hasBean("customChannelDefinitionProcessor");
                EventRegistryEngine eventRegistryEngine = context.getBean(EventRegistryEngine.class);
                assertThat(eventRegistryEngine).as("Event registry engine").isNotNull();

                EventRegistryEngineConfiguration eventRegistryEngineConfiguration = eventRegistryEngine.getEventRegistryEngineConfiguration();
                AbstractCollectionAssert<?, Collection<? extends ChannelModelProcessor>, ChannelModelProcessor, ObjectAssert<ChannelModelProcessor>>
                    channelModelProcessorAssert = assertThat(eventRegistryEngineConfiguration.getChannelModelProcessors());
                channelModelProcessorAssert
                    .hasSize(8);

                channelModelProcessorAssert
                    .element(0)
                    .isEqualTo(context.getBean("customChannelDefinitionProcessor", ChannelModelProcessor.class));

                channelModelProcessorAssert
                    .element(1)
                    .isEqualTo(context.getBean("rabbitChannelDefinitionProcessor", ChannelModelProcessor.class));

                channelModelProcessorAssert
                    .element(2)
                    .isEqualTo(context.getBean("jmsChannelDefinitionProcessor", ChannelModelProcessor.class));

               channelModelProcessorAssert
                    .element(3)
                    .isEqualTo(context.getBean("kafkaChannelDefinitionProcessor", ChannelModelProcessor.class));

                channelModelProcessorAssert
                    .element(4)
                    .isInstanceOf(DelegateExpressionInboundChannelModelProcessor.class);

                channelModelProcessorAssert
                    .element(5)
                    .isInstanceOf(DelegateExpressionOutboundChannelModelProcessor.class);

                channelModelProcessorAssert
                    .element(6)
                    .isInstanceOf(InboundChannelModelProcessor.class);

                channelModelProcessorAssert
                    .element(7)
                    .isInstanceOf(OutboundChannelModelProcessor.class);
            });
    }

    @Test
    public void standaloneEventRegistryWithDefaultTaskScheduler() {
        contextRunner
            .withPropertyValues("flowable.eventregistry.enable-change-detection:true")
            .run(context -> {

                EventRegistryEngine eventRegistryEngine = context.getBean(EventRegistryEngine.class);
                assertThat(eventRegistryEngine).as("Event registry engine").isNotNull();
                assertAllServicesPresent(context, eventRegistryEngine);

                assertThat(eventRegistryEngine.getEventRegistryEngineConfiguration().getEventRegistryChangeDetectionManager())
                    .isInstanceOf(DefaultEventRegistryChangeDetectionManager.class);
                assertThat(eventRegistryEngine.getEventRegistryEngineConfiguration().getEventRegistryChangeDetectionExecutor())
                    .isInstanceOf(DefaultSpringEventRegistryChangeDetectionExecutor.class);

                DefaultSpringEventRegistryChangeDetectionExecutor executor = (DefaultSpringEventRegistryChangeDetectionExecutor)
                    eventRegistryEngine.getEventRegistryEngineConfiguration().getEventRegistryChangeDetectionExecutor();
                assertThat(executor.getTaskScheduler()).isInstanceOf(ThreadPoolTaskScheduler.class);
            });
    }

    @Test
    public void standaloneEventRegistryWithCustomTaskScheduler() {
        contextRunner
            .withBean(ThreadPoolTaskScheduler.class)
            .withPropertyValues("flowable.eventregistry.enable-change-detection:true")
            .run(context -> {

            EventRegistryEngine eventRegistryEngine = context.getBean(EventRegistryEngine.class);
            assertThat(eventRegistryEngine).as("Event registry engine").isNotNull();
            assertAllServicesPresent(context, eventRegistryEngine);

            assertThat(eventRegistryEngine.getEventRegistryEngineConfiguration().getEventRegistryChangeDetectionManager())
                .isInstanceOf(DefaultEventRegistryChangeDetectionManager.class);
                assertThat(eventRegistryEngine.getEventRegistryEngineConfiguration().getEventRegistryChangeDetectionExecutor())
                    .isInstanceOf(DefaultSpringEventRegistryChangeDetectionExecutor.class);

            DefaultSpringEventRegistryChangeDetectionExecutor executor = (DefaultSpringEventRegistryChangeDetectionExecutor)
                eventRegistryEngine.getEventRegistryEngineConfiguration().getEventRegistryChangeDetectionExecutor();
            assertThat(executor.getTaskScheduler()).isEqualTo(context.getBean(TaskScheduler.class));
        });
    }

    private void assertAllServicesPresent(ApplicationContext context, EventRegistryEngine eventRegistryEngine) {
        List<Method> methods = Stream.of(EventRegistryEngine.class.getDeclaredMethods())
            .filter(method -> !(method.getReturnType().equals(void.class)) || "close".equals(method.getName()) || "getName".equals(method.getName()))
            .collect(Collectors.toList());

        assertThat(methods).allSatisfy(method -> {
            try {
                assertThat(context.getBean(method.getReturnType()))
                    .as(method.getReturnType() + " bean")
                    .isEqualTo(method.invoke(eventRegistryEngine));
            } catch (IllegalAccessException | InvocationTargetException e) {
                fail("Failed to invoke method " + method, e);
            }
        });
    }

    private static EventRegistryEngineConfiguration eventRegistryEngine(ProcessEngine processEngine) {
        ProcessEngineConfiguration processEngineConfiguration = processEngine.getProcessEngineConfiguration();
        return EngineServiceUtil.getEventRegistryEngineConfiguration(processEngineConfiguration);
    }

    private static EventRegistryEngineConfiguration eventRegistryEngine(AppEngine appEngine) {
        AppEngineConfiguration appEngineConfiguration = appEngine.getAppEngineConfiguration();
        return EngineServiceUtil.getEventRegistryEngineConfiguration(appEngineConfiguration);
    }

    @Configuration(proxyBeanMethods = false)
    static class CustomChannelDefinitionProcessorsConfiguration {

        @Order(10)
        @Bean({
            "jmsChannelDefinitionProcessor",
            "customJmsChannelDefinitionProcessor"
        })
        public ChannelModelProcessor customJmsChannelDefinitionProcessor() {
            return mock(ChannelModelProcessor.class);
        }

        @Order(0)
        @Bean({
            "rabbitChannelDefinitionProcessor",
            "customRabbitChannelDefinitionProcessor"
        })
        public ChannelModelProcessor customRabbitChannelDefinitionProcessor() {
            return mock(ChannelModelProcessor.class);
        }

        @Order(20)
        @Bean({
            "kafkaChannelDefinitionProcessor",
            "customKafkaChannelDefinitionProcessor"
        })
        public ChannelModelProcessor customKafkaChannelDefinitionProcessor() {
            return mock(ChannelModelProcessor.class);
        }

        @Order(-20)
        @Bean
        public ChannelModelProcessor customChannelDefinitionProcessor() {
            return mock(ChannelModelProcessor.class);
        }
    }
}


text:
<?php

namespace AppBundle\Entity;

use Clastic\NodeBundle\Node\NodeReferenceInterface;
use Clastic\NodeBundle\Node\NodeReferenceTrait;

/**
 * Product
 */
class Product implements NodeReferenceInterface
{
    use NodeReferenceTrait;
    /**
     * @var integer
     */
    private $id;

    /**
     * @var string
     */
    private $icon;

    /**
     * @var string
     */
    private $shortDescription;

    /**
     * @var string
     */
    private $intro1;

    /**
     * @var string
     */
    private $intro2;

    /**
     * @var string
     */
    private $title1;

    /**
     * @var string
     */
    private $title2;

    /**
     * @var string
     */
    private $image;

    /**
     * @var string
     */
    private $color;

    /**
     * @var string
     */
    private $class;

    /**
     * @var string
     */
    private $displayTitle ;

    /**
     * @var array
     */
    private $productInfos;

    /**
     * @return array
     */
    public function getProductInfos()
    {
        return $this->productInfos;
    }

    /**
     * @param array $productInfos
     */
    public function setProductInfos($productInfos)
    {
        $this->productInfos = $productInfos;
    }

    /**
     * @return string
     */
    public function getDisplayTitle()
    {
        return $this->displayTitle ;
    }

    /**
     * @param string $displayTitle
     */
    public function setDisplayTitle($displayTitle)
    {
        $this->displayTitle  = $displayTitle;
    }

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set icon
     *
     * @param string $icon
     *
     * @return Product
     */
    public function setIcon($icon)
    {
        $this->icon = $icon;

        return $this;
    }

    /**
     * Get icon
     *
     * @return string
     */
    public function getIcon()
    {
        return $this->icon;
    }

    /**
     * Set shortDescription
     *
     * @param string $shortDescription
     *
     * @return Product
     */
    public function setShortDescription($shortDescription)
    {
        $this->shortDescription = $shortDescription;

        return $this;
    }

    /**
     * Get shortDescription
     *
     * @return string
     */
    public function getShortDescription()
    {
        return $this->shortDescription;
    }

    /**
     * Set intro1
     *
     * @param string $intro1
     *
     * @return Product
     */
    public function setIntro1($intro1)
    {
        $this->intro1 = $intro1;

        return $this;
    }

    /**
     * Get intro1
     *
     * @return string
     */
    public function getIntro1()
    {
        return $this->intro1;
    }

    /**
     * Set intro2
     *
     * @param string $intro2
     *
     * @return Product
     */
    public function setIntro2($intro2)
    {
        $this->intro2 = $intro2;

        return $this;
    }

    /**
     * Get intro2
     *
     * @return string
     */
    public function getIntro2()
    {
        return $this->intro2;
    }

    /**
     * Set title1
     *
     * @param string $title1
     *
     * @return Product
     */
    public function setTitle1($title1)
    {
        $this->title1 = $title1;

        return $this;
    }

    /**
     * Get title1
     *
     * @return string
     */
    public function getTitle1()
    {
        return $this->title1;
    }

    /**
     * Set title2
     *
     * @param string $title2
     *
     * @return Product
     */
    public function setTitle2($title2)
    {
        $this->title2 = $title2;

        return $this;
    }

    /**
     * Get title2
     *
     * @return string
     */
    public function getTitle2()
    {
        return $this->title2;
    }

    /**
     * Set image
     *
     * @param string $image
     *
     * @return Product
     */
    public function setImage($image)
    {
        $this->image = $image;

        return $this;
    }

    /**
     * Get $image
     *
     * @return string
     */
    public function getImage()
    {
        return $this->image;
    }

    /**
     * Set color
     *
     * @param string $color
     *
     * @return Product
     */
    public function setColor($color)
    {
        $this->color = $color;

        return $this;
    }

    /**
     * Get color
     *
     * @return string
     */
    public function getColor()
    {
        return $this->color;
    }

    /**
     * Set class
     *
     * @param string $class
     *
     * @return Product
     */
    public function setClass($class)
    {
        $this->class = $class;

        return $this;
    }

    /**
     * Get class
     *
     * @return string
     */
    public function getClass()
    {
        return strtolower($this->class);
    }

    /**
     * Get ProductInfo
     *
     * @return string
     */
    public function getProductInfo() {

        return 'tekst';
    }
}


text:
/**
 * Converts a string written in 'Mercup' to a MessageFormat string, i.e. parses our custom markdown
 * @param {string} string - The Mercup string
 * @param {object} options - Option object that is passed to the marked.js parser
 * @param {function} callback - Callback that is passed to the marked.js parser
 * @returns {string} - String containing HTML and MessageFormat elements
 */
function toMessageFormat(string,options,callback){
  // Replacing newlines by br's if they are the third or more newline in sequence. Because markdown
  // will collapse any amount of newlines into a single line break, this allows us to use (n+1) newlines
  // to get n br's in the output. Special care for single newlines before opening MF Syntax
  string = string.replace(/\n{2,}/g,function(ns){ return '\n\n'+Array(ns.length-1).join("
\n"); }).replace(/\n\{/g," {");
  // Escaping MF special characters
  // { => \{, \{ => \\\{, \\ => \\\\, ...
  string = string.replace(/([#\\])/g,'\\$1');
  // Custom marked renderer to suppress enclosing
...

  options = options || {};
  if (!!options.renderer){
    console.log("WARNING: A custom renderer might produce unwanted whitespace or invalid MessageFormat elements");
  }
  else{
    options.renderer = new marked.Renderer();
    options.renderer.paragraph = function(string){
      return string.replace(/\s+/g," ")+'
\n';
    };
  }
  // We don't want Github flavour because we want to ignore line breaks in paragraphs
  if (options.gfm){
    console.log("WARNING: GitHub Flavour will be disabled to deal with newlines correctly")
  }
  options.gfm = false;
  // We also have to remove a potential trailing

  return marked(string,options,callback).split(/
\s*$/)[0];
}

/**
 * Generates combinations such that every variable is bound to every possible case at least once
 * @param {string} locale - The two-letter locale is used to cover all plural cases
 * @param {string} mf - The MessageFormat string for which the combinations should be generated
 * @param {string} comment [''] - The comment containing variable samples of the form 'VARIABLE: [sample]'
 * @param {string} options.method ['smart'] - The method to produce the combinations ('smart' | 'exponential')
 * @param {Object[]} options.defaultRules [...] - Rules used to produce default variable values based on variable names
 * @param {RegExp} options.defaultRules[].regexp - A RegExp that the variable name is tested against
 * @param {function(string) => string} options.defaultRules[].generator - The function used to produce the value
 * @returns {Object[]} - List of combinations that can be used to evaluate this MF-string
 */
function samplesForString(locale, mf, comment, options){
  // Default options
  comment = comment || '';
  options = options || {};
  options.defaultRules = options.defaultRules || [
    {regexp: /URL|LINK/i, generator: function(string){ return '#';}},
    {regexp: /NUM/i,      generator: function(string){ return Math.floor(Math.random()*20);}},
    {regexp: /NAME/i,     generator: function(string){ return 'Mustermann';}},
    {regexp: /GENDER/i,   generator: function(string){ return 'male|female';}}
  ];
  var addCasesToCombinations = (options.method === 'exponential') ? exponentialCombine : smartCombine

  function defaultValueFor(variable){
    for (var rule in options.defaultRules.length){
      if (rule.regexp.test(variable)){
        return rule.generator(variable);
      }
    }
    // If there's no match, the variable's name will be used
    return variable.toUpperCase();
  }

  function smartCombine(variable, cases) {
    cases = cases.shuffled()
    // For all cases or existing combinations, whatever is biggest
    for (var j = 0; j < Math.max(cases.length,combinations.length); j++){
      // (If we've run out of combinations, we duplicate a random one)
      if (j >= combinations.length)
        combinations.push(
          JSON.parse(JSON.stringify(
            combinations[Math.floor(Math.random()*combinations.length)]
          ))
        );
      // ... add one of the cases to the combinations, wrapping around if there are more
      // combinations than cases
      combinations[j][variable] = cases[j % cases.length];
    }
  }
  function exponentialCombine(variable,cases) {
    var n = combinations.map(function(combination){
      return cases.map(function(_case){
        var c = JSON.parse(JSON.stringify(combination))
        c[variable] = _case
        return c;
      });
    });
    return [].concat.apply([], n);
  }

  // Matches and extracts 'VAR_NAME: some comment [EXAMPLE]'s from comment
  var examples = {};
  (comment.match(/^\w+:.*?\[.*?\]/gm) || []).forEach(function addMatchToExamples(match){
    examples[match.match(/\w+/)[0]] = match.match(/\[.*?\]/)[0].slice(1,-1);
  });

  var combinations = [{}];

  var rawVariables = [];

  findVariables((new MessageFormat('de')).parse(mf).program);

  function findVariables(ast){
    switch (ast.type) {
      case 'messageFormatPattern':; case 'messageFormatPatternRight':
        for (var i = 0; i < ast.statements.length; i++)
          findVariables(ast.statements[i]);
        break;
      case 'messageFormatElement':
        // Simple var
        if (ast.output)
          rawVariables.push({
            type: 'simple',
            name: ast.argumentIndex,
            cases: []
          });
        // Plural or select
        else {
          rawVariables.push({
            name:   ast.argumentIndex,
            type:   (ast.elementFormat.key === 'plural') ? "number" : "string",
            cases:  ast.elementFormat.val.pluralForms.map(function findMoreAndReturnKey(e,i){
                      findVariables(e.val);
                      return e.key;
                    })
          });
        }
      break;
    }
  }

  if (rawVariables.length === 0)
    return combinations;

  rawVariables = rawVariables.sort(function lexNameType(v1,v2){
    return (v1.name === v2.name) ? v1.type < v2.type : v1.name < v2.name;
  });

  // Iterating through sorted variables, merging duplicate variables' cases
  var variables = [rawVariables[0]];
  for (var i = 1; i < rawVariables.length; i++){
    var existing = variables[variables.length-1]
    var next = rawVariables[i];
    // Duplicate variable, merge cases
    if (existing.name === next.name){
      // Different types, error
      if (existing.type !== next.type && existing.type !== 'simple' && next.type !== 'simple')
        throw new Error(a.name+" used as both a string and a number");
      existing.cases = existing.cases.append(next.cases)
      if (existing.type === 'simple')
        existing.type = next.type;
    }
    else
      variables.push(next);
  }

  variables.forEach(function(variable){
    if (variable.type === 'number') {
      variable.cases = variable.cases.filter(isNumeric).unique();
      // Add a random number from every predefined case
      // (Everything mod 20, so we can use 20 as 0 as a continuous plural interval)
      var intervals;
      switch (locale) {
        case 'cs':; case 'sk':; case 'pl':
          intervals = [[1,1],[2,4],[5,20]]; break;
        case 'de':; case 'en':; case 'es':; case 'it':; case 'nl':
          intervals = [[1,1],[2,20]]; break;
        case 'fr':
          intervals = [[0,1],[2,19]]; break;
        case 'hu':
          intervals = [[1,20]]; break;
      }
      for (var i = 0; i < intervals.length; i++){
        var reducedInterval = [];
        for (var j = intervals[i][0]; j <= intervals[i][1]; j++){
          // Only add a number to the reduced interval if it's not a case already
          if (!!$.inArray(j % 20,variable.cases))
            reducedInterval.push(j % 20);
        }
        // If the remaining interval is empty it means all its cases are already covered, if not, pick a
        // random number and add it to the list as this interval's representative
        if (reducedInterval.length > 0)
          variable.cases.push(reducedInterval[Math.floor(Math.random()*reducedInterval.length)]);
      }
    }
    else /* type == 'string' || 'simple' */ {
      if (examples[variable.name])
        variable.cases = examples[variable.name].split('|');
      if (variable.cases.length === 0)
        variable.cases = defaultValueFor(variable.name).split('|');
    }
    addCasesToCombinations(variable.name,variable.cases);
  });

  return combinations;
}

// Source: http://stackoverflow.com/questions/2450954/how-to-randomize-shuffle-a-javascript-array
Array.prototype.shuffled = function() {
  var currentIndex = this.length, temporaryValue, randomIndex
  while (0 !== currentIndex) {
    randomIndex = Math.floor(Math.random() * currentIndex);
    currentIndex -= 1;
    temporaryValue = this[currentIndex];
    this[currentIndex] = this[randomIndex];
    this[randomIndex] = temporaryValue;
  }
  return this;
};

// Source: http://stackoverflow.com/questions/1960473/unique-values-in-an-array
Array.prototype.unique = function() {
  return this.filter(function(value, index, self){ return self.indexOf(value) === index; });
};

// Source: http://stackoverflow.com/questions/9716468/is-there-any-function-like-isnumeric-in-javascript-to-validate-numbers
var isNumeric = function(num){
  return Number(parseFloat(num)) == num;
}


text:
package com.heliosapm.script.annotations;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 *
Title: FixtureArg

 *
Description: Annotation to define the arguments expected by a fixture

 *
Company: Helios Development Group LLC

 * @author Whitehead (nwhitehead AT heliosdev DOT org)
 *
com.heliosapm.script.annotations.FixtureArg

 */
@Target({ElementType.ANNOTATION_TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented

public @interface FixtureArg {
	/**
	 * The field name of the argument
	 */
	String name();

	/**
	 * The value of the argument when used to invoke a parameterized fixture
	 */
	String value() default "";

	/**
	 * Indicates if this argument is optional for the fixture to attempt to generate an object for the caller
	 */
	boolean optional() default true;

	/**
	 * The type of the argument
	 */
	Class<?> type() default String.class;
}


text:
@implementation MFFrameController

#pragma mark - Lifecycle

+ (instancetype)sharedMFFrameController
{
    static dispatch_once_t predicate;
    static MFFrameController *instance = nil;
    dispatch_once(&predicate, ^{instance = [[self alloc] init];});
    return instance;
}

- (instancetype)init
{
    self = [super init];
    if (self) {
        NSString *file = [[NSBundle mainBundle] pathForResource:@"Frames-Private" ofType:@"plist"];
        if (![[NSFileManager defaultManager] fileExistsAtPath:file]) {
            file = [[NSBundle mainBundle] pathForResource:@"Frames-Public" ofType:@"plist"];
        }
        _config = [[NSDictionary alloc] initWithContentsOfFile:file];
        [self setup];
    }
    return self;
}

- (void)setup
{
    NSDictionary *frames = _config[@"frames"];
    _frames = [NSMutableDictionary dictionary];
    for (NSDictionary *key in frames) {
        MFFrame *frame = [MFFrame frameWithContentsOfDictionary:[frames objectForKey:key]];
        _frames[frame.title] = frame;
    }
}

@end


text:
import copy_reg
import unittest

from test import test_support
from test.pickletester import ExtensionSaver

class C:
    pass

class WithoutSlots(object):
    pass

class WithWeakref(object):
    __slots__ = ('__weakref__',)

class WithPrivate(object):
    __slots__ = ('__spam',)

class WithSingleString(object):
    __slots__ = 'spam'

class WithInherited(WithSingleString):
    __slots__ = ('eggs',)

class CopyRegTestCase(unittest.TestCase):

    def test_class(self):
        self.assertRaises(TypeError, copy_reg.pickle,
                          C, None, None)

    def test_noncallable_reduce(self):
        self.assertRaises(TypeError, copy_reg.pickle,
                          type(1), "not a callable")

    def test_noncallable_constructor(self):
        self.assertRaises(TypeError, copy_reg.pickle,
                          type(1), int, "not a callable")

    def test_bool(self):
        import copy
        self.assertEquals(True, copy.copy(True))

    def test_extension_registry(self):
        mod, func, code = 'junk1 ', ' junk2', 0xabcd
        e = ExtensionSaver(code)
        try:
            # Shouldn't be in registry now.
            self.assertRaises(ValueError, copy_reg.remove_extension,
                              mod, func, code)
            copy_reg.add_extension(mod, func, code)
            # Should be in the registry.
            self.assert_(copy_reg._extension_registry[mod, func] == code)
            self.assert_(copy_reg._inverted_registry[code] == (mod, func))
            # Shouldn't be in the cache.
            self.assert_(code not in copy_reg._extension_cache)
            # Redundant registration should be OK.
            copy_reg.add_extension(mod, func, code)  # shouldn't blow up
            # Conflicting code.
            self.assertRaises(ValueError, copy_reg.add_extension,
                              mod, func, code + 1)
            self.assertRaises(ValueError, copy_reg.remove_extension,
                              mod, func, code + 1)
            # Conflicting module name.
            self.assertRaises(ValueError, copy_reg.add_extension,
                              mod[1:], func, code )
            self.assertRaises(ValueError, copy_reg.remove_extension,
                              mod[1:], func, code )
            # Conflicting function name.
            self.assertRaises(ValueError, copy_reg.add_extension,
                              mod, func[1:], code)
            self.assertRaises(ValueError, copy_reg.remove_extension,
                              mod, func[1:], code)
            # Can't remove one that isn't registered at all.
            if code + 1 not in copy_reg._inverted_registry:
                self.assertRaises(ValueError, copy_reg.remove_extension,
                                  mod[1:], func[1:], code + 1)

        finally:
            e.restore()

        # Shouldn't be there anymore.
        self.assert_((mod, func) not in copy_reg._extension_registry)
        # The code *may* be in copy_reg._extension_registry, though, if
        # we happened to pick on a registered code.  So don't check for
        # that.

        # Check valid codes at the limits.
        for code in 1, 0x7fffffff:
            e = ExtensionSaver(code)
            try:
                copy_reg.add_extension(mod, func, code)
                copy_reg.remove_extension(mod, func, code)
            finally:
                e.restore()

        # Ensure invalid codes blow up.
        for code in -1, 0, 0x80000000L:
            self.assertRaises(ValueError, copy_reg.add_extension,
                              mod, func, code)

    def test_slotnames(self):
        self.assertEquals(copy_reg._slotnames(WithoutSlots), [])
        self.assertEquals(copy_reg._slotnames(WithWeakref), [])
        expected = ['_WithPrivate__spam']
        self.assertEquals(copy_reg._slotnames(WithPrivate), expected)
        self.assertEquals(copy_reg._slotnames(WithSingleString), ['spam'])
        expected = ['eggs', 'spam']
        expected.sort()
        result = copy_reg._slotnames(WithInherited)
        result.sort()
        self.assertEquals(result, expected)

def test_main():
    test_support.run_unittest(CopyRegTestCase)

if __name__ == "__main__":
    test_main()


text:
namespace boost {
namespace compute {

/// Copies \p points to \p buffer.
///
/// For example, to copy from a \c vtkPoints object to a \c vector<float4_>:
/// \code
/// vtkPoints *points = ...
/// vector<float4_> vector(points->GetNumberOfPoints(), context);
/// vtk_copy_points_to_buffer(points, vector.begin(), queue);
/// \endcode
template<class PointType>
inline void vtk_copy_points_to_buffer(const vtkPoints *points,
                                      buffer_iterator<PointType> buffer,
                                      command_queue &queue = system::default_queue())
{
    vtkPoints *points_ = const_cast<vtkPoints *>(points);

    // copy points to aligned buffer
    std::vector<PointType> tmp(points_->GetNumberOfPoints());
    for(vtkIdType i = 0; i < points_->GetNumberOfPoints(); i++){
        double *p = points_->GetPoint(i);
        tmp[i] = PointType(p[0], p[1], p[2], 1);
    }

    // copy data to device
    copy(tmp.begin(), tmp.end(), buffer, queue);
}

} // end compute namespace
} // end boost namespace

#endif // BOOST_COMPUTE_INTEROP_VTK_POINTS_HPP


text:
Given(/^a document collection "([^"]*)" exists$/) do |title|
  @document_collection = create(:document_collection, :with_group, title: title)
end

Given(/^a published document collection "([^"]*)" exists$/) do |title|
  @document_collection = create(:published_document_collection, :with_group, title: title)
end

Given(/^a published publication called "(.*?)" in the document collection "(.*?)"$/) do |publication_title, collection_title|
  @publication = create(:published_publication, title: publication_title)
  @document_collection = create(:published_document_collection,
    title: collection_title,
    groups: [build(:document_collection_group, documents: [@publication.document])]
  )
  @group = @document_collection.groups.first
end

When(/^I draft a new document collection called "(.*?)"$/) do |title|
  begin_drafting_document_collection(title: title)
  click_on "Save"
  @document_collection = DocumentCollection.find_by!(title: title)
end

When(/^I add the document "(.*?)" to the document collection$/) do |document_title|
  doc_edition = Edition.find_by!(title: document_title)
  refute @document_collection.nil?, "No document collection to act on."

  visit admin_document_collection_path(@document_collection)
  click_on "Edit draft"
  click_on "Collection documents"

  fill_in 'title', with: document_title
  click_on 'Find'
  find('li.ui-menu-item').click
  click_on 'Add'

  within ('section.group') do
    assert page.has_content? doc_edition.title
  end
end

When(/^I move "(.*?)" before "(.*?)" in the document collection$/) do |doc_title_1, doc_title_2|
  refute @document_collection.nil?, "No document collection to act on."

  visit admin_document_collection_path(@document_collection)
  click_on "Edit draft"
  click_on "Collection documents"

  #Simulate drag-droping document.
  page.execute_script %Q{
    (function($) {
      var doc_1_li = $('.document-list li:contains(#{doc_title_1})');
      if(doc_1_li.length == 0) throw("Couldn't find li for document '#{doc_title_1}' in .document-list.");

      var doc_2_li = $('.document-list li:contains(#{doc_title_2})');
      if(doc_2_li.length == 0) throw("Couldn't find li for document '#{doc_title_2}' in .document-list.");

      doc_2_li.before(doc_1_li.remove());

      GOVUK.instances.DocumentGroupOrdering[0].onDrop({}, {item: doc_1_li});
    })(jQuery);
  }
  # Wait for post to complete
  assert page.has_no_css?(".loading-spinner")
end

Then(/^I (?:can )?preview the document collection$/) do
  refute @document_collection.nil?, "No document collection to act on."

  visit preview_document_path(@document_collection)

  assert page.has_selector?("h1", text: @document_collection.title)
  assert page.has_content? @document_collection.summary
  assert page.has_content? @document_collection.body
end

Then(/^I see that the document "(.*?)" is not part of the document collection$/) do |document_title|
  refute_document_is_part_of_document_collection(document_title)
end

Then(/^I should see links back to the collection$/) do
  @document_collection
  assert page.has_css?("a[href='#{public_document_path(@document_collection)}']")
end

When(/^I visit the old document series url "(.*?)"$/) do |url|
  visit url
end

Then(/^I should be redirected to the "(.*?)" document collection$/) do |title|
  dc = DocumentCollection.find_by(title: title)
  assert_path public_document_path(dc)
end

Then(/^I can see in the preview that "(.*?)" is part of the document collection$/) do |document_title|
  visit preview_document_path(@document_collection)
  assert_document_is_part_of_document_collection(document_title)
end

Given(/^a published publication called "(.*?)" in a published document collection$/) do |publication_title|
  @publication = create(:published_publication, title: publication_title)
  @document_collection = create(:published_document_collection,
    groups: [build(:document_collection_group, documents: [@publication.document])]
  )
  @group = @document_collection.groups.first
end

When(/^I redraft the document collection and remove "(.*?)" from it$/) do |document_title|
  refute @document_collection.nil?, "No document collection to act on."

  visit admin_document_collection_path(@document_collection)
  click_on "Create new edition to edit"
  click_on "Collection documents"

  check document_title
  click_on "Remove"
end

Then(/^I can see in the preview that "(.*?)" does not appear$/) do |document_title|
  visit preview_document_path(@document_collection)
  refute_document_is_part_of_document_collection(document_title)
end

Then(/^I see that "(.*?)" is before "(.*?)" in the document collection$/) do |doc_title_1, doc_title_2|
  assert page.has_content? doc_title_1
  assert page.body.index(doc_title_1) < page.body.index(doc_title_2), "Expected #{doc_title_1} to be before #{doc_title_2}"
end


text:
from stellargraph.random import SeededPerBatch
import numpy as np

def test_seeded_per_batch():
    num_batches = 10
    num_iter = 10
    seed = 0

    # different permutations of batch numbers should always give the same seeds
    batch_nums_perms = [np.random.permutation(num_batches) for _ in range(num_iter)]

    def get_batches(batch_nums):
        s = SeededPerBatch(create_with_seed=lambda x: x, seed=seed)
        batches = [0] * num_batches

        for batch_num in batch_nums:
            batches[batch_num] = s[batch_num]

        return tuple(batches)

    assert len({get_batches(batch_nums) for batch_nums in batch_nums_perms}) == 1


text:
declare	module msgfmt {
	function init(language:string, options?: any): void;
	function setLocale(language: string): void;
}