text:
require "spec_helper"

module SocialSnippet

  describe Api::InsertSnippetApi do

    before do
      # prepare snippet.css (global)
      fake_core.storage.write fake_core.config.snippet_css, [
        "snippet {",
        "  margin-top: 0;",
        "  margin-bottom: 0;",
        "}",
      ].join($/)
    end

    describe "#insert_snippet()", :without_fakefs => true do

      class FakeDriver < ::SocialSnippet::Repository::Drivers::DriverBase
        def fetch; end

        def refs
          [
            "master",
            "develop",
            "1.0.0",
            "1.0.1",
            "1.0.2",
          ]
        end

        def snippet_json
          {
            "name" => "example-repo",
            "main" => "src",
          }
        end

        def rev_hash(ref)
          raise "error" unless refs.include?(ref)
          "rev-#{ref}"
        end

        def each_directory(ref, &block)
          [
            ::SocialSnippet::Repository::Drivers::Entry.new("src", ""),
            ::SocialSnippet::Repository::Drivers::Entry.new("src/func", ""),
          ].each &block
        end

        def each_file(ref, &block)
          files = []

          # snippet.json
          files.push ::SocialSnippet::Repository::Drivers::Entry.new "snippet.json", [
            '{',
            '  "name": "example-repo",',
            '  "desc": "This is an example repository.",',
            '  "language": "C++",',
            '  "main": "src"',
            '}',
          ].join($/)

          # src/func.cpp
          files.push ::SocialSnippet::Repository::Drivers::Entry.new "src/func.cpp", [
            '// @snip<func/sub_func_1.cpp>',
            '// @snip<func/sub_func_2.cpp>',
            '// @snip<func/sub_func_3.cpp>',
            'int func() {',
            '  int res = 0;',
            '  res += sub_func_1();',
            '  res += sub_func_2();',
            '  res += sub_func_3();',
            '  res *= 2;',
            '  return res;',
            '}',
          ].join($/)

          # src/func/sub_func_1.cpp
          files.push ::SocialSnippet::Repository::Drivers::Entry.new "src/func/sub_func_1.cpp", [
            'int sub_func_1() {',
            '  return 1;',
            '}',
          ].join($/)

          # src/func/sub_func_2.cpp
          files.push ::SocialSnippet::Repository::Drivers::Entry.new "src/func/sub_func_2.cpp", [
            'int sub_func_2() {',
            '  return 2;',
            '}',
          ].join($/)

          # src/func/sub_func_3.cpp
          files.push ::SocialSnippet::Repository::Drivers::Entry.new "src/func/sub_func_3.cpp", [
            'int sub_func_4() {',
            '  return 3;',
            '}',
          ].join($/)

          files.each &block
        end

        def self.target_url?(url)
          "dummy" === ::URI.parse(url).scheme
        end
      end

      before do
        fake_core.driver_factory.add_driver FakeDriver
      end

      let(:example_repo_info) do
        {
          "name" => "example-repo",
          "desc" => "This is my repository.",
          "url" => "dummy://driver.test/social-snippet/example-repo",
          "dependencies" => {
          },
        }
      end # example_repo_info

      before do
        WebMock
        .stub_request(
          :get,
          "https://api.server/api/v0/repositories/example-repo",
        )
        .to_return(
          :status => 200,
          :body => example_repo_info.to_json,
          :headers => {
            "Content-Type" => "application/json",
          },
        )
      end # GET /repositories/my-repo

      context "$ sspm install example-repo" do

        let(:install_command) { CommandLine::SSpm::SubCommands::InstallCommand.new ["example-repo"] }
        let(:install_command_output) { ::StringIO.new }
        let(:install_command_logger) { ::SocialSnippet::Logger.new install_command_output }

        before do
          allow(fake_core).to receive(:logger).and_return install_command_logger
          install_command.init
          install_command.run
          expect(install_command_output.string).to match /Success/
        end # install example-repo

        context "create instance" do

          let(:string_io) { ::StringIO.new }
          let(:string_logger) { ::SocialSnippet::Logger.new(string_io) }
          before { allow(fake_core).to receive(:logger).and_return string_logger }

          #
          # tests from here
          #

          context "insert a plain text" do

            let(:input) do
              [
                'hello',
                'world',
              ].join($/)
            end

            let(:expected) do
              [
                'hello',
                'world',
              ].join($/) + $/
            end

            before { fake_core.api.insert_snippet input }
            it { expect(string_io.string).to eq expected }

          end # $ ssnip / without snip

          context "$ ssnip / with a snip tag" do

            let(:input) do
              [
                '// @snip <example-repo:func.cpp>'
              ].join($/)
            end

            before { fake_core.api.insert_snippet input }

            it { expect(string_io.string).to match(/@snippet/) }
            it { expect(string_io.string).to match(/example-repo#.*:func\.cpp/) }
            it { expect(string_io.string).to match(/example-repo#.*:func\/sub_func_1\.cpp/) }
            it { expect(string_io.string).to match(/example-repo#.*:func\/sub_func_2\.cpp/) }
            it { expect(string_io.string).to match(/example-repo#.*:func\/sub_func_3\.cpp/) }
            it { expect(string_io.string).to_not match(/ERROR/) }

          end # $ ssnip / with a snip tag

        end # create instance

      end # $ sspm install example-repo

    end # insert_snippet()

  end # Api

end # SocialSnippet::CommandLine


text:
<!DOCTYPE html>

    <meta charset="utf-8"/>
    <title>meSpeak – Voices & Languages</title>

meSpeak – Voices & Languages

A short guide to the set-up of languages and voices for meSpeak.
 Please mind that meSpeak is based on an
   Emscripten-port of eSpeak, so all of the eSpeak grammar applies also to meSpeak.

Standard Language Files

meSpeak's language-files provide eSpeak's language- and voice-files in a single package.
(Since a voice usually
   refers to a language and its dictionary, it seems suitable to bundle them together in a single file.)
The
   language-files are of the following structure (JSON):

<xmp>{ "voice_id": "
    <filename>", "dict_id": "
        <filename>", "dict": "
            <base64-encoded octet
                            stream>", "voice": "
                <base64-encoded octet
                                stream>" }
</xmp>

The values of voice_id and dict_id are actually UNIX-filenames, dict_id relative to
   the path of eSpeak's data-directory "espeak-data/", voice_id relative to "espeak-data/voices/".

If we were to embed the files for the langage "en-en", these would be:

"en/en-en" for the voice and

"en_dict" for the dictionary used by "en-en"

For a standard language-file, you would add a base64-representation as the string value of dict and voice
   of the respective eSpeak-files.

Customizing

There is an alternate layout for meSpeak's language-files, which is espacially usefull for the purpose of customizing
   and testing:

<xmp>{ "voice_id": "
    <filename>", "dict_id": "
        <filename>", "dict": "
            <base64-encoded octet
                            stream>", "voice": "
                <text-string>", "voice_encoding": "text" }
</xmp>

Since eSpeak's voice-files are actually plain-text files, you may use a simple string for these, if you provide an
   additional property "voice_encoding": "text" at the same time.

For dictionaries, which are a binary files with eSpeak, see the note at the end of the page.

Example

For an example we will configure a basic female voice for "en-us", which will be named
   "en-us-f".

Make a copy of a meSpeak-language file (json), which you want to modify (in this case "voices/en/en-us.json).

Rename the file (e.g.: "en-us-f.json") and open it in editor.

Download the source of eSpeak and go to the "espeak-data/"
        directory.

The eSpeak-file "espeak-data/voices/en-us" looks like this:

        <xmp>// moving towards US English name english-us language en-us 2 language en-r language en 3 gender male //
             and more, skipped here
        </xmp>

Rename the "name" parameter to make it unique (e.g.: "name english-us-f").

Change any paramaters as you whish, in this case change "gender male" to "gender
                                                                                female"
        for a female voice.

You should have arrived at something like this (first line removed, since it is just a comment):

        <xmp>name english-us-f language en-us 2 language en-r language en 3 gender female
        </xmp>

Replace any line-breaks by "\n" in order to get a valid JSON-string:

        <xmp>"name english-us-f\nlanguage en-us 2\nlanguage en-r\nlanguage en 3\ngender female"</xmp>

        And use this as a value for the "voice"-property of the JSON-file.

Add the line "voice_encoding": "text" to the JSON to indicate that the voice is
        plain-text.
Your voice file should now look like this:

        <xmp>Content of file: "en-us-f.json":

             { "voice_id": "en-us-f", "dict_id": "en_dict", "dict": "
            <base64-encoded octet
                            stream>", "voice": "name english-us-f\nlanguage en-us 2\nlanguage en-r\nlanguage en
                                   3\ngender female", "voice_encoding": "text" }
        </xmp>

Save it and load it into meSpeak.

Please note that eSpeak is not very graceful with syntax errors in a voice-definition and will just throw an
       error, which will — in the case of meSpeak — show up in the console-log.

For further details on voice-parameters and fine-tuning, please refer to the eSpeak-documentation:
    http://espeak.sourceforge.net/voices.html.

Custom Dictionaries

eSpeak's dictonaries are binary files, which must be compiled with eSpeak first.
 You would have to install
   eSpeak and compile a file following the eSpeak documentation.
Further, you would insert
   a base64-encoded string of the resulting object-file's content as the value of the dict property of a
   meSpeak-language-file.
 Finally, you would set a suiting and unique value for the property dict_id (UNIX
   file path).

There is no shortcut to this. Sorry.

Please see also the section on the extended voice format at the main-page.

Norbert Landsteiner
 Vienna, July 2013

redpajama_set_name: RedPajamaGithub


text:
<button class="ms-Button js-DialogAction--open" data-target=".ms-Dialog--close">

  Open Dialog - Close
  Opens the Sample Dialog
</button>

    <button class="ms-Dialog-button ms-Dialog-button--close js-DialogAction--close">

    </button>

All emails together

Your Inbox has changed. No longer does it include favorites, it is a singular destination for your emails.

          <input id="demo-checkbox-unselected1" class="ms-ChoiceField-input" type="checkbox">
          Option1

          <input id="demo-checkbox-unselected2" class="ms-ChoiceField-input" type="checkbox">
          Option2

          <button class="ms-Dialog-action ms-Button ms-Button--primary">
            Save
          </button>
          <button class="ms-Dialog-action ms-Button">
            Cancel
          </button>


text:
module ConfigDecryptPasswords
  def reload!
    Vmdb::Settings.decrypt_passwords!(super).tap do
      # The following should only be done when loading/reloading the current
      #   process' Settings, as opposed to a remote server's settings.
      Vmdb::Settings.on_reload if equal?(::Settings)
    end
  end

  alias load! reload!
end

Config::Options.prepend(ConfigDecryptPasswords)
Config::Options.include(MoreCoreExtensions::Shared::Nested)


text:
using System;
using NPack;

//
// NEW VERSION FROM NUMERICAL RECIPES http://www.nrbook.com/a/bookcpdf.php
// 7.3 Rejection Method: Gamma, Poisson, Binomial Deviates

namespace URandom
{
	public static class PoissonDistribution
	{

		// return as a floating point number an integer value that is a random deviate drawn
		// from a Possion Distribution of mean xm using randx as a source of uniform deviates
		public static float Normalize( ref NPack.MersenneTwister _rand, float xm)
		{
			// Davide Rambaldi: all moved to double precision
			double sq, alxm, g, oldm; // oldm is a flag for wheter xm has changed or not sincle last call
			sq = alxm = g = oldm = (-1.0);
			double em, t, y;

			if (xm < 12.0f) {      // Use direct method
				if (xm != oldm) {
					oldm = xm;
					g = Math.Exp(-xm); // if x is new, compute the exponential
				}
				em = -1;
				t = 1.0f;
				// Instead of adding exponential deviates it is equivalent to multiply unifomr deviates
				// We never actually take the log, we compare the precomupted exponential
				do {
					++em;
					t *= _rand.NextSingle(true);
				} while (t > g);
			} else {
				// Use REJECTION method
				// xm has changed?
				if ( xm != oldm) {
					oldm = xm;
					sq = Math.Sqrt(2.0 * xm);
					alxm = Math.Log(xm);

					// Gammln is the natural log of a gamma function
					g = xm * alxm - SpecialFunctions.gammln(xm + 1.0f);
				}
				do {
					do {
						// y is the deviate from a Lorentzian comparison function
						y = Math.Tan(Math.PI*_rand.NextSingle(true));
						em=sq*y+xm;
					} while (em < 0.0);
					em = Math.Floor(em);
					t = 0.9 * (1.0+y*y) * Math.Exp(em*alxm-SpecialFunctions.gammln(em+1.0f)-g);
				} while (_rand.NextSingle(true) > t);
			}
			return (float) em;
		}

	}

}


text:
title:  Yedi Mühür
date:  26/01/2019
---

### Konuyla İlgili Metinler
Va. 6:1–17, Lev. 26:21–26, Hez. 4:16, Yas. 32:43, 2Se.. 1:7–10.

>
Hatırlama Metni

> Tomarı almaya, mühürlerini açmaya layıksın! Çünkü boğazlandın ve kanınla her oymaktan, her dilden, her halktan, her ulustan insanları Tanrı'ya satın aldın. Onları Tanrımız'ın hizmetinde bir krallık haline getirdin, kâhinler yaptın. Dünya üzerinde egemenlik sürecekler. (Vahiy 5:9, 10).

Vahiy 6. bölüm, 4. ve 5. bölümlerdeki sahneyi yani, zafer dolu yaşamı ve ölümü sayesinde Adem ile kaybedileni yeniden kazanmış olduğu için mühürlü tomarı açmaya layık olan Mesih'i resmetmeye devam ediyor. O şimdi tomardaki mühürleri açarak kurtuluş planını mutlak olarak gerçekleştirmek için ilerletmeye hazır.

Pentekost, Mesih'in aracılığıyla krallığını genişlettiği müjdenin yayılışının başlangıcı oldu. Yani mühürlerin kırılması Pentekost günü başlayan müjdenin vaaz edilmesine ve onu reddetmenin yaptırımlarına işaret ediyor. Yedinci ve son mührün açılması bizi bu dünyanın tarihinin sonuna götürür.

Vahiy 3:21 ayeti yedi mührün anlamı ile ilgili bize ipucu veriyor: Ben nasıl galip gelerek Babam'la birlikte Babam'ın tahtına oturdumsa, galip gelene de benimle birlikte tahtıma oturma hakkını vereceğim. 4. ve 5. bölümler Mesih'in galip gelişini ve Golgota'daki kurbanlığının sonucunda göksel Başrahibimiz olmaya ve tomarı açmaya lâyık oluşunu bize bildiriyor. 7. bölümün son ayetleri de Mesih'in tahtının önündeki galip gelenleri betimliyor. Yani 6. bölüm Allah'ın halkının İsa'nın tahtını paylaşabilmesi için galip gelmesi süreci hakkında.

_*2 Şubat Sebt Günü'ne hazırlık için bu haftanın konusunu çalışın._


text:
A reverse proxy server that aims to make [Openshift](https://www.openshift.org/) resources work with [Kubernetes](https://kubernetes.io/) tools, namely [Helm](https://helm.sh/).

### Rationale

Kubernetes is complicated.  Helm facilitates usage by providing the ability to install packages, which are configurable services (see [here](https://kubeapps.com/) for examples).  Openshift extends Kubernetes with new features, such as the ability to define a docker build that runs in the cluster.  It also add templates, which are similar to Helm charts (packages), but they use a very limited templating construct.

Unfortunately, Helm cannot be used with Openshift resources because it only knows how to talk to the Kubernetes API.  This project solves that issue without having to fork Helm.

### Getting Started

A Helm chart is provided to make installation easy.  However, since this proxy has not yet been installed, you will need the [Helm template](https://github.com/technosophos/helm-template) plugin to use it.  The chart is published with the [release](https://github.com/megalord/openshift-api-group/releases/latest) so you do not need to clone the whole repo.

I recommend you read the [Access](#access) section document before installing Tiller to make sure the installation is configured to your needs.
```
$ helm template -n kube-system openshift-api-group.tar.gz | oc create -f -
```

This will install the proxy and Helm's Tiller server into `kube-system` namespace of the Openshift cluster.  At this point, the `tiller` service account will not have access to any other namespaces, meaning it cannot be used to install any charts.  Further, only cluster admins or the current namespace's admin can use Helm.  The intent is to be as secure as possible for a default installation.

The `kube-system` namespace always exists in Openshift.  If you do not have access to it, or you do not want to use it, you can pass `-n <other namespace>` to `helm template`.  That namespace must already exist.  When using Helm thereafter, you must `export TILLER_NAMESPACE=<other namespace>` to let Helm know where the Tiller server is.

### Access

#### For Helm

As mentioned above, cluster admins can always use Helm.  If you pass `--set createUsersRole=true` to `helm template`, a cluster role named `helm-users` will be created.  It can be used to grant Helm access to users who are not cluster admins.  This is done via
```
$ oc edit rolebindings/helm-users
```

#### For Tiller

There are two options for giving Tiller the access it needs to install charts.

1) Grant access on a per-namespace basis

After a project has been created via `oc new-project` or the Origin web console, create a role binding between the admin role and the tiller service account.  This can be done on the Service Accounts tab of the Resources > Membership page or via the CLI:
```yaml
apiVersion: v1
kind: RoleBinding
metadata:
  name: tiller-access
subjects:
- kind: ServiceAccount
  name: tiller
  namespace: kube-system
roleRef:
  kind: Role
  name: admin
```
```
$ oc create -f <filename>
```

2) Grant access to the entire cluster

This can be done as part of the install by passing the `--set clusterAdmin=true` flag to `helm template`.  It can also be done to an existing installation via:
```
$ oc adm policy add-cluster-role-to-user cluster-admin system:serviceaccount:kube-system:tiller
```

Warning: this means a Helm user can freely create brand new namespaces and new objects in any existing namespace.

### How It Works

tl;dr:

![architecture](architecture.png)

Tiller parses the content of a chart in order to figure out which endpoint of the Kubernetes API to hit.  For example, creating a resource defined by
```yaml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: myapp
  namespace: helloworld
```
would result in a POST request to `/apis/extensions/v1beta1/namespaces/helloworld/deployments`.

However, to create an Openshift resource such as a BuildConfig, a request needs to be made to `/oapi/v1/namespaces/helloworld/buildconfigs`.  As you can see, Openshift defines it's own api on a separate base path.  Tiller does not know to route a BuildConfig to that route (nor should it).

The Kuberenetes API is designed to be automatically discoverable.  The `/apis` endpoint returns a list of APIGroups that document their own subpaths, and the `/apis/<group>/<version>` endpoint lists the resources that group defines.  Helm uses these along with others to figure out what groups are valid and where to dispatch them.  This design allows for concepts like [Aggregated API Servers](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/aggregated-api-servers.md), which allows anyone to extend the Kubernetes API.  Perhaps in the future, Openshift will be implemented as an API server that registers with the `kube-aggregator`, making this project obsolete.

This service intercepts requests from Tiller to the Kubernetes API and mades a few modifications.

1) Add an APIGroup named openshift.org to the response of `/apis`.

2) Reroute requests matching `/apis/openshift.org/*` to `/oapi/*`.

3) Strip the group name (openshift.org) from the request body for any route matching #2 and add it back into the response body.

With this in place, Tiller can gracefully handle resources such as
```yaml
apiVersion: openshift.org/v1
kind: BuildConfig
metadata:
  name: myapp
```
which means we can develop charts for Openshift, and use Helm to deploy them!

Note that this resource is *NOT* compatible with the `oc create` CLI, because Openshift does not recognize the `openshift.org` api group.  This is an unfortunate side effect, but it can be remedied by building the group transformation into a separate binary.  That is a future goal of this project.

### What About Third Party Resources?

Support for TPRs is what originally motivated Helm to support generic objects in its charts, at least from an outsider's perspective based on [this issue](https://github.com/kubernetes/helm/issues/1468).  However, TPRs are only useful if a separate service is constructed to watch for create, update, or delete operations on those resources.  This makes the workflow asynchronous, introducing additional latency and hampering validation.


text:
def new_list
  grocery_list = Hash.new
end

def add_item(list, item, quantity)
  list[item] = quantity
end

def remove_item(list, item)
  list.delete(item)
end

def update_quant(list, item, quantity)
  list[item] = quantity
end

def list_print(list)
  list.each { |k, v| puts " #{k} #{v}"}
end

grocery_list = new_list

add_item(grocery_list, "Lemonade", 2)
add_item(grocery_list, "Tomatoes", 3)
add_item(grocery_list, "Onions", 1)
add_item(grocery_list, "Ice Cream", 4)
list_print(grocery_list)
puts " "

remove_item(grocery_list, "Lemonade")
list_print(grocery_list)
puts " "

update_quant(grocery_list, "Ice Cream", 1)
list_print(grocery_list)


text:
/* ===========================================================
 * trumbowyg.preformatted.js v1.0
 * Preformatted plugin for Trumbowyg
 * http://alex-d.github.com/Trumbowyg
 * ===========================================================
 * Author : Casella Edoardo (Civile)
 */

(function ($) {
    'use strict';

    $.extend(true, $.trumbowyg, {
        langs: {
            // jshint camelcase:false
            en: {
                preformatted: 'Code sample
'
            },
            da: {
                preformatted: 'Præformateret
'
            },
            fr: {
                preformatted: 'Exemple de code
'
            },
            hu: {
                preformatted: 'Kód minta
'
            },
            it: {
                preformatted: 'Codice
'
            },
            ja: {
                preformatted: 'コードサンプル
'
            },
            ko: {
                preformatted: '코드 예제
'
            },
            pt_br: {
                preformatted: 'Exemple de código
'
            },
            ru: {
                preformatted: 'Пример кода
'
            },
            tr: {
                preformatted: 'Kod örneği
'
            },
            zh_cn: {
                preformatted: '代码示例
'
            },
            zh_tw: {
                preformatted: '代碼範例
'
            },
        },
        // jshint camelcase:true

        plugins: {
            preformatted: {
                init: function (trumbowyg) {
                    var btnDef = {
                        fn: function () {
                            trumbowyg.saveRange();
                            var text = trumbowyg.getRangeText();
                            if (text.replace(/\s/g, '') !== '') {
                                try {
                                    var curtag = getSelectionParentElement().tagName.toLowerCase();
                                    if (curtag === 'code' || curtag === 'pre') {
                                        return unwrapCode();
                                    }
                                    else {
                                        trumbowyg.execCmd('insertHTML', '
' + strip(text) + '
');
                                    }
                                } catch (e) {
                                }
                            }
                        },
                        tag: 'pre'
                    };

                    trumbowyg.addBtnDef('preformatted', btnDef);
                }
            }
        }
    });

    /*
     * GetSelectionParentElement
     */
    function getSelectionParentElement() {
        var parentEl = null,
            selection;

        if (window.getSelection) {
            selection = window.getSelection();
            if (selection.rangeCount) {
                parentEl = selection.getRangeAt(0).commonAncestorContainer;
                if (parentEl.nodeType !== 1) {
                    parentEl = parentEl.parentNode;
                }
            }
        } else if ((selection = document.selection) && selection.type !== 'Control') {
            parentEl = selection.createRange().parentElement();
        }

        return parentEl;
    }

    /*
     * Strip
     * returns a text without HTML tags
     */
    function strip(html) {
        var tmp = document.createElement('DIV');
        tmp.innerHTML = html;
        return tmp.textContent || tmp.innerText || '';
    }

    /*
     * UnwrapCode
     * ADD/FIX: to improve, works but can be better
     * "paranoic" solution
     */
    function unwrapCode() {
        var container = null;

        if (document.selection) { //for IE
            container = document.selection.createRange().parentElement();
        } else {
            var select = window.getSelection();
            if (select.rangeCount > 0) {
                container = select.getRangeAt(0).startContainer.parentNode;
            }
        }

        //'paranoic' unwrap
        var ispre = $(container).contents().closest('pre').length;
        var iscode = $(container).contents().closest('code').length;

        if (ispre && iscode) {
            $(container).contents().unwrap('code').unwrap('pre');
        } else if (ispre) {
            $(container).contents().unwrap('pre');
        } else if (iscode) {
            $(container).contents().unwrap('code');
        }
    }
})(jQuery);


text:
title: "2018 Oregon Chinese Youth Conference"
---

# 第二届俄勒冈华裔青少年年会

## Date

7/8/2018 10:00 am - 4:00 pm

## Place

DoubleTree Hotel by Hilton Portland - Beaverton

15402 NW Cornell Rd. - Beaverton, OR 97006 ([map](https://goo.gl/maps/XNov3hTvDTN2))

## Co-Organizers

[Tech 4 Kids Club](http://www.tech4kidsclub.org/)

[Spark Technology Education](http://www.sparkteched.org/)

## Registration

[Conference registration form](https://docs.google.com/forms/d/e/1FAIpQLSfP5DP8rN05m37MoZ2fE5m5kj-8EXcmz72JbVP5g3L6TqMkrA/viewform?c=0&w=1) for middle & high schools, college students (Parents are also welcome if students are not able to attend themselves).

[Nomination, including self-nomination, form](https://docs.google.com/forms/d/e/1FAIpQLSfQRyJHdDFVPnelnzQpe8xVH2n0A8AsvoNi7VqHrCHFtCS4vg/viewform?c=0&w=1) for the scholarship and awards.

[Registration Form](https://docs.google.com/forms/d/e/1FAIpQLScIhWP3pUAZuqBXZYI3DzgLtV-oWuts6jaLunIfuPR-wFoqUw/viewform?c=0&w=1) for Banner Space.

## Proposed Agenda

Check in starts from 9:00 am

### Morning Session: Motivational Speeches by Distinguished Guests

9:30 am - 9:55 am Guzheng Playing by Cheery Zhang

9:55 am Opening Remark by **Xibei Zhao**, Chairman of the Board of Directors, OCC

10:00 am – 10:30 am	**Knute Buehler**, Oregon State's first Rhodes Scholar, now Republican Candidate for State Governor

10:30 am – 11:00 am	**Jo Ann Hardesty**, Former President, NAACP Portland, now Running for Portland City Council

_11:00 pm - 11:15 pm Taking group photos of participating students and guest speakers_

11:15 am – 11:45 am **Selma Pierce**, 3rd generation of ABC, from a dentist to community advocate to House Representative candidate.

11:45 am – 12:15 am	**Pam Pearce**, a popular and highly sought after prevention educator, President of the [Community Living Above](https://communitylivingabove.org/)

### 12:15 pm – 1:00 pm Lunch Break with Performance by Community Youth

Live demo of robotic by [Spark Tech Edu](http://www.sparkteched.org/), two times World Champions.

Kpop Dance by Ekki, see her [dance portfolio](https://www.instagram.com/yvnnnl/).

### 1:00 pm - 1:50 pm Awards Ceremony

* Victoria Ren Scholarship

To let Victoria's sweetest smile brighten other children in the community who need assistance emotionally and/or financially.

* Voice of Civic Engagement Award

To encourage more youth to take a stand in public hearings or on any community platforms.

* Youth Empowerment Award

To acknowledge those who step out to bring others to grow and excel with them.

* 2018 President's Volunteer Service Award

To recognize those students who have achieved the required number of hours of service over a 12-month time period or cumulative hours over the course of a lifetime.

* 2018 Valedictorians

Congratulations with a speech by Valedictorian from 2018 class.

* 2018 Portland Chinese Rose Princess

To congratulate Daphne Wu on her courageous participation of the first community Rose Princess Contest.

* Motivational Speech by Erik Svilich

One of the founders of Spark Technology Education

### Afternoon Session: Seminars on Youth Physical and Mental Health

2:00 pm - 3:00 Adolescent Mental Health: Reality and Solutions, by **Celeste Jones, PsyD, ABPP** at George Fox University & [OPA](http://www.opa.org/)

3:00 pm - 4:00 Prevention and Treatment for School-Myopia, by **Yue Liu, OD, PhD**, UC Berkeley & Pacific University

### 4:00 pm - 5:00 pm Bonus & Optional Session

An Insider View on College Application, **Prof. Yue Liu**, Scholarship Review Committee, UC Berkeley

## Distinguished Guest Speakers

Ordered alphabetically

### Knute Buehler

Buehler attended Oregon State University graduated from OSU in 1986 with degrees in history and microbiology. Buehler then attended Merton College, Oxford as OSU's first Rhodes Scholar studying philosophy, politics and economics, before graduating from Johns Hopkins Medical School in Baltimore, Maryland. He currently serves in the Oregon House of Representatives. He is currently running for Governor of Oregon in the 2018 election.

### Jo Ann Hardesty

Hardesty served in the United States Navy, was one of the first women to go on board ships. Sher was elected to the Oregon House in 1994, holding office until 2001. She later served as executive director of Oregon Action, and became president of the Portland chapter of the NAACP in January 2015. Hardesty is running for Portland City Council in 2018.

### Pam Pearce

A long-time community activist in Oregon, Pam is currently on the steering committee for West Linn Young Life.  Pam is also a Community Organizer for the Portland Leadership Foundation (PLF). Prior to PLF, Pam served as Executive Director of the Teen Division of the YMCA. Pam got her start as an aide to then U.S. Senator Mark Hatfield in Washington, D.C., shortly after attending the University of Southern California. Pam is in her 21st year of long-term recovery and takes advantage of every opportunity to share her passion for the gifts and hope of recovery.

### Selma Pierce

Selma had been a dentist in Salem area for 20 years. After she retired, Selma's still plying her trade pro bono for a variety of nonprofits and has added fundraising and event planning to her repertoire. Her husband, Bud Pierce, used to be Kate Brown challenger in 2016 election. In February she decided to run for State Representative. "In Order for Democracy to Work, You Have to be Involved."  And she won in May Primary. Selma is a 3rd generation of ABC!

## Seminar Speakers

Ordered alphabetically

### Celeste Jones

Celeste is an assistant professor of clinical psychology at George Fox University, and a board-certified, licensed psychologist who specializes in working with children with Autism Spectrum Disorder and their families. Her research interests are in the broad areas of adversity and resilience in children and families, and in diversity populations. Jones also serves in state leadership, as chair of the Oregon Psychological Association Public Education Committee.

### Maria Liu

Maria is an associate professor at Pacific University College of Optometry and the founder of UC Berkeley Myopia Control Clinic. She received her bachelor degree of clinical medicine from Peking University, her OD from Pacific University, her PhD and MPH from UC Berkeley. She is a world renowned clinical researcher in the field of myopia and her expertise focus on the impact of complex multifocal environment on emmetropization and myopia development, as well as novel optical and pharmaceutical treatments in myopia retardation.

## Conference Sponsors

[China Delight (湘厨)](http://www.pdxchinadelight.net/)

[RevoMax Innovations](http://revomax.com)

[Panda Express](https://www.pandaexpress.com/)

[Five Flavors Cafe](http://www.5flavorcafe.com/)

![]({{ site.url }}/assets/images/divider.jpg)

[Also see 2017 Youth Conference](http://pdxchinese.org/youthconference/youth_conference_2017/)

[2017俄勒冈华裔青少年年会成功举办/Summary and Reflection](http://pdxchinese.org/youth-conference-2017/)

[2018俄勒冈华裔青少年年会成功举办/Summary and Reflection](http://pdxchinese.org/youth-conference-2018/)

[Youth Conference Archive](http://pdxchinese.org/resources/benefits_resources/youthconference/)


text:
<!DOCTYPE html>

<meta content="text/html;charset=utf-8" http-equiv="content-type"/>

<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
<title>pymel.core.system.unloadPlugin — PyMEL 1.0.7 documentation</title>
<link href="../../../_static/nature.css" rel="stylesheet" type="text/css"/>
<link href="../../../_static/pygments.css" rel="stylesheet" type="text/css"/>

<link href="../../../index-2.html" rel="top" title="PyMEL 1.0.7 documentation"/>
<link href="../../pymel.core.system.html" rel="up" title="pymel.core.system"/>
<link href="pymel.core.system.untitledFileName.html" rel="next" title="pymel.core.system.untitledFileName"/>
<link href="pymel.core.system.unknownPlugin.html" rel="prev" title="pymel.core.system.unknownPlugin"/>
<link href="../../../../style/adsk.cpm.css" rel="stylesheet" type="text/css"/><meta content="expert" name="experiencelevel"/><meta content="programmer" name="audience"/><meta content="enable" name="user-comments"/><meta content="ENU" name="language"/><meta content="MAYAUL" name="product"/><meta content="2016" name="release"/><meta content="Customization" name="book"/><meta content="Maya-Tech-Docs" name="component"/><meta content="/view/MAYAUL/2016/ENU/" name="helpsystempath"/><meta content="04/03/2015" name="created"/><meta content="04/03/2015" name="modified"/><meta content="Navigation

 index

 modules |

 next |

 previous |
 PyMEL 1.0.7 documentation »
 pymel.core.system »

 pymel.core.system.unloadPlugin ¶

 unloadPlugin ( *args , **kwargs ) ¶
 Unload plug-ins from Maya. After the successful execution of this command, plug-in services will no longer be available.
 Flags:

 Long Name / Short Name
 Argument Types
 Properties

 addCallback / ac
 script

 Add a procedure to..." name="description"/><meta content="__PyMel_generated_functions_pymel_core_system_pymel_core_system_unloadPlugin_html" name="topicid"/>

Navigation

index

modules |

next |

previous |

PyMEL 1.0.7 documentation »

pymel.core.system »

pymel.core.system.unloadPlugin¶

<tt class="descname">unloadPlugin</tt><big>(</big>*args, **kwargs<big>)</big>¶

Unload plug-ins from Maya. After the successful execution of this command, plug-in services will no longer be available.

Flags:

<colgroup>
<col width="1%"></col>
<col width="61%"></col>
<col width="19%"></col>
<col width="19%"></col>
</colgroup>

Long Name / Short Name
Argument Types
Properties

<tt class="docutils literal">addCallback</tt> / <tt class="docutils literal">ac</tt>
script

Add a procedure to be called just before a plugin is unloaded. The procedure should have one string argument, which will be the plugin's name.

<tt class="docutils literal">force</tt> / <tt class="docutils literal">f</tt>
bool

Unload the plugin even if it is providing services.  This is not recommended.  If you unload a plug-in that implements a node or data type in the scene, those
instances will be converted to unknown nodes or data and the scene will no longer behave properly. Maya may become unstable or even crash. If you use this flag
you are advised to save your scene in MayaAscii format and restart Maya as soon as possible.

<tt class="docutils literal">removeCallback</tt> / <tt class="docutils literal">rc</tt>
script

Remove a procedure which was previously added with -addCallback.                          Flag can have multiple arguments, passed either as a tuple or a list.

Derived from mel command <tt class="xref py py-obj docutils literal">maya.cmds.unloadPlugin</tt>

Example:

import pymel.core as pm

# Unload the plugin that has the internal name "newNode"
#
pm.unloadPlugin( 'newNode.py' )

Previous topic

pymel.core.system.unknownPlugin

Next topic

pymel.core.system.untitledFileName

Core Modules

<tt class="xref">animation</tt>

<tt class="xref">effects</tt>

<tt class="xref">general</tt>

<tt class="xref">language</tt>

<tt class="xref">modeling</tt>

<tt class="xref">rendering</tt>

<tt class="xref">system</tt>

<tt class="xref">windows</tt>

Type Modules

<tt class="xref">datatypes</tt>

<tt class="xref">nodetypes</tt>

<tt class="xref">uitypes</tt>

Other Modules

<tt class="xref">plugins</tt>

<tt class="xref">mayautils</tt>

<tt class="xref">util</tt>

<tt class="xref">versions</tt>

<tt class="xref">tools</tt>

This Page

Show Source

Quick search

<form action="http://help.autodesk.com/cloudhelp/2016/ENU/Maya-Tech-Docs/PyMel/search.html" class="search" method="get"></form>
<input name="q" type="text"/>
<input type="submit" value="Go"/>
<input name="check_keywords" type="hidden" value="yes"/>
<input name="area" type="hidden" value="default"/>

    Enter search terms or a module, class or function name.

Navigation

index

modules |

next |

previous |

PyMEL 1.0.7 documentation »

pymel.core.system »

        © Copyright 2009, Chad Dombrova.
      Created using Sphinx 1.2.3.


text:
package com.stulsoft.pjava.basics.optional;

import java.util.Optional;

/**
 * Playing with map and flatMap of Optional
 *
 * @author Yuriy Stul
 */
public class POptionalWithMapAndFlatMap {
    public static void main(String[] args) {
        System.out.println("==>main");
        test1();
        test2();
        test3();
        test4();
        test5();
        System.out.println("<==main");
    }

    private static void test1() {
        System.out.println("==>test1");
        Person person = new Person();
        person.name = "test1";
        System.out.println("person.getAddress(): " + person.getAddress());
        Optional<Address> address = person.getAddress();
        System.out.println("address.map(Address::getCity): " + address.map(Address::getCity));
        System.out.println("<==test1");
    }

    private static void test2() {
        System.out.println("==>test2");
        Optional<Person> person = Optional.of(new Person());
        person.get().name = "test2";
        Optional<Address> address = person.flatMap(Person::getAddress);
        System.out.println("address: " + address);
        System.out.println("<==test2");
    }

    private static void test3() {
        System.out.println("==>test3");
        Optional<Person> person = Optional.of(new Person());
        person.get().name = "test3";
        person.get().address = new Address();
        person.get().address.city = "the city";
        Optional<String> city = person.flatMap(Person::getAddress).map(Address::getCity);
        System.out.println("city: " + city);
        System.out.println("<==test3");
    }

    private static void test4() {
        System.out.println("==>test4");
        Optional<Person> person = Optional.of(new Person());
        person.get().name = "test4";
        Optional<String> city = person.flatMap(Person::getAddress).map(Address::getCity);
        System.out.println("city: " + city);
        System.out.println("<==test4");
    }

    private static void test5() {
        System.out.println("==>test5");
        Optional<Person> person = Optional.of(new Person());
        person.get().name = "test5";
        Optional<String> city = person.map(Person::getAddress).map(a -> a.map(address -> address.city).orElse(null));
        System.out.println("city: " + city);
        System.out.println("city.isPresent(): " + city.isPresent());
        System.out.println("<==test5");
    }
}

class Person {
    String name;
    Address address;

    Optional<Address> getAddress() {
        return (address == null ? Optional.empty() : Optional.of(address));
    }
}

class Address {
    String city;

    String getCity() {
        return city;
    }
}


text:
<?php

namespace Mpociot\ApiDoc\Generators;

use Faker\Factory;
use ReflectionClass;
use Illuminate\Support\Arr;
use Illuminate\Support\Str;
use Mpociot\Reflection\DocBlock;
use Mpociot\Reflection\DocBlock\Tag;
use Illuminate\Support\Facades\Validator;
use Illuminate\Foundation\Http\FormRequest;
use Mpociot\ApiDoc\Parsers\RuleDescriptionParser as Description;

abstract class AbstractGenerator
{
    /**
     * @param $route
     *
     * @return mixed
     */
    abstract public function getUri($route);

    /**
     * @param $route
     *
     * @return mixed
     */
    abstract public function getMethods($route);

    /**
     * @param  \Illuminate\Routing\Route $route
     * @param array $bindings
     * @param bool $withResponse
     *
     * @return array
     */
    abstract public function processRoute($route, $bindings = [], $withResponse = true);

    /**
     * Prepares / Disables route middlewares.
     *
     * @param  bool $disable
     *
     * @return  void
     */
    abstract public function prepareMiddleware($disable = false);

    /**
     * Get the response from the docblock if available.
     *
     * @param array $tags
     *
     * @return mixed
     */
    protected function getDocblockResponse($tags)
    {
        $responseTags = array_filter($tags, function ($tag) {
            if (! ($tag instanceof Tag)) {
                return false;
            }

            return \strtolower($tag->getName()) == 'response';
        });
        if (empty($responseTags)) {
            return;
        }
        $responseTag = \array_first($responseTags);

        return \response(\json_encode($responseTag->getContent()));
    }

    /**
     * @param array $routeData
     * @param array $routeAction
     * @param array $bindings
     *
     * @return mixed
     */
    protected function getParameters($routeData, $routeAction, $bindings)
    {
        $validator = Validator::make([], $this->getRouteRules($routeAction['uses'], $bindings));
        foreach ($validator->getRules() as $attribute => $rules) {
            $attributeData = [
                'required' => false,
                'type' => null,
                'default' => '',
                'value' => '',
                'description' => [],
            ];
            foreach ($rules as $ruleName => $rule) {
                $this->parseRule($rule, $attribute, $attributeData, $routeData['id']);
            }
            $routeData['parameters'][$attribute] = $attributeData;
        }

        return $routeData;
    }

    /**
     * @param  $route
     * @param  $bindings
     * @param  $headers
     *
     * @return \Illuminate\Http\Response
     */
    protected function getRouteResponse($route, $bindings, $headers = [])
    {
        $uri = $this->addRouteModelBindings($route, $bindings);

        $methods = $this->getMethods($route);

        // Split headers into key - value pairs
        $headers = collect($headers)->map(function ($value) {
            $split = explode(':', $value); // explode to get key + values
            $key = array_shift($split); // extract the key and keep the values in the array
            $value = implode(':', $split); // implode values into string again

            return [trim($key) => trim($value)];
        })->collapse()->toArray();

        //Changes url with parameters like /users/{user} to /users/1
        $uri = preg_replace('/{(.*?)}/', 1, $uri);

        return $this->callRoute(array_shift($methods), $uri, [], [], [], $headers);
    }

    /**
     * @param $route
     * @param array $bindings
     *
     * @return mixed
     */
    protected function addRouteModelBindings($route, $bindings)
    {
        $uri = $this->getUri($route);
        foreach ($bindings as $model => $id) {
            $uri = str_replace('{'.$model.'}', $id, $uri);
        }

        return $uri;
    }

    /**
     * @param  \Illuminate\Routing\Route  $route
     *
     * @return string
     */
    protected function getRouteDescription($route)
    {
        list($class, $method) = explode('@', $route);
        $reflection = new ReflectionClass($class);
        $reflectionMethod = $reflection->getMethod($method);

        $comment = $reflectionMethod->getDocComment();
        $phpdoc = new DocBlock($comment);

        return [
            'short' => $phpdoc->getShortDescription(),
            'long' => $phpdoc->getLongDescription()->getContents(),
            'tags' => $phpdoc->getTags(),
        ];
    }

    /**
     * @param  string  $route
     *
     * @return string
     */
    protected function getRouteGroup($route)
    {
        list($class, $method) = explode('@', $route);
        $reflection = new ReflectionClass($class);
        $comment = $reflection->getDocComment();
        if ($comment) {
            $phpdoc = new DocBlock($comment);
            foreach ($phpdoc->getTags() as $tag) {
                if ($tag->getName() === 'resource') {
                    return $tag->getContent();
                }
            }
        }

        return 'general';
    }

    /**
     * @param  $route
     * @param  array $bindings
     *
     * @return array
     */
    protected function getRouteRules($route, $bindings)
    {
        list($class, $method) = explode('@', $route);
        $reflection = new ReflectionClass($class);
        $reflectionMethod = $reflection->getMethod($method);

        foreach ($reflectionMethod->getParameters() as $parameter) {
            $parameterType = $parameter->getClass();
            if (! is_null($parameterType) && class_exists($parameterType->name)) {
                $className = $parameterType->name;

                if (is_subclass_of($className, FormRequest::class)) {
                    $parameterReflection = new $className;
                    // Add route parameter bindings
                    $parameterReflection->query->add($bindings);
                    $parameterReflection->request->add($bindings);

                    if (method_exists($parameterReflection, 'validator')) {
                        return $parameterReflection->validator()->getRules();
                    } else {
                        return $parameterReflection->rules();
                    }
                }
            }
        }

        return [];
    }

    /**
     * @param  array  $arr
     * @param  string  $first
     * @param  string  $last
     *
     * @return string
     */
    protected function fancyImplode($arr, $first, $last)
    {
        $arr = array_map(function ($value) {
            return '`'.$value.'`';
        }, $arr);
        array_push($arr, implode($last, array_splice($arr, -2)));

        return implode($first, $arr);
    }

    protected function splitValuePairs($parameters, $first = 'is ', $last = 'or ')
    {
        $attribute = '';
        collect($parameters)->map(function ($item, $key) use (&$attribute, $first, $last) {
            $attribute .= '`'.$item.'` ';
            if (($key + 1) % 2 === 0) {
                $attribute .= $last;
            } else {
                $attribute .= $first;
            }
        });
        $attribute = rtrim($attribute, $last);

        return $attribute;
    }

    /**
     * @param  string  $rule
     * @param  string  $ruleName
     * @param  array  $attributeData
     * @param  int  $seed
     *
     * @return void
     */
    protected function parseRule($rule, $ruleName, &$attributeData, $seed)
    {
        $faker = Factory::create();
        $faker->seed(crc32($seed));

        $parsedRule = $this->parseStringRule($rule);
        $parsedRule[0] = $this->normalizeRule($parsedRule[0]);
        list($rule, $parameters) = $parsedRule;

        switch ($rule) {
            case 'required':
                $attributeData['required'] = true;
                break;
            case 'accepted':
                $attributeData['required'] = true;
                $attributeData['type'] = 'boolean';
                $attributeData['value'] = true;
                break;
            case 'after':
                $attributeData['type'] = 'date';
                $attributeData['description'][] = Description::parse($rule)->with(date(DATE_RFC850, strtotime($parameters[0])))->getDescription();
                $attributeData['value'] = date(DATE_RFC850, strtotime('+1 day', strtotime($parameters[0])));
                break;
            case 'alpha':
                $attributeData['description'][] = Description::parse($rule)->getDescription();
                $attributeData['value'] = $faker->word;
                break;
            case 'alpha_dash':
                $attributeData['description'][] = Description::parse($rule)->getDescription();
                break;
            case 'alpha_num':
                $attributeData['description'][] = Description::parse($rule)->getDescription();
                break;
            case 'in':
                $attributeData['description'][] = Description::parse($rule)->with($this->fancyImplode($parameters, ', ', ' or '))->getDescription();
                $attributeData['value'] = $faker->randomElement($parameters);
                break;
            case 'not_in':
                $attributeData['description'][] = Description::parse($rule)->with($this->fancyImplode($parameters, ', ', ' or '))->getDescription();
                $attributeData['value'] = $faker->word;
                break;
            case 'min':
                $attributeData['description'][] = Description::parse($rule)->with($parameters)->getDescription();
                if (Arr::get($attributeData, 'type') === 'numeric' || Arr::get($attributeData, 'type') === 'integer') {
                    $attributeData['value'] = $faker->numberBetween($parameters[0]);
                }
                break;
            case 'max':
                $attributeData['description'][] = Description::parse($rule)->with($parameters)->getDescription();
                if (Arr::get($attributeData, 'type') === 'numeric' || Arr::get($attributeData, 'type') === 'integer') {
                    $attributeData['value'] = $faker->numberBetween(0, $parameters[0]);
                }
                break;
            case 'between':
                if (! isset($attributeData['type'])) {
                    $attributeData['type'] = 'numeric';
                }
                $attributeData['description'][] = Description::parse($rule)->with($parameters)->getDescription();
                $attributeData['value'] = $faker->numberBetween($parameters[0], $parameters[1]);
                break;
            case 'before':
                $attributeData['type'] = 'date';
                $attributeData['description'][] = Description::parse($rule)->with(date(DATE_RFC850, strtotime($parameters[0])))->getDescription();
                $attributeData['value'] = date(DATE_RFC850, strtotime('-1 day', strtotime($parameters[0])));
                break;
            case 'date_format':
                $attributeData['type'] = 'date';
                $attributeData['description'][] = Description::parse($rule)->with($parameters)->getDescription();
                $attributeData['value'] = date($parameters[0]);
                break;
            case 'different':
                $attributeData['description'][] = Description::parse($rule)->with($parameters)->getDescription();
                break;
            case 'digits':
                $attributeData['type'] = 'numeric';
                $attributeData['description'][] = Description::parse($rule)->with($parameters)->getDescription();
                $attributeData['value'] = ($parameters[0] < 9) ? $faker->randomNumber($parameters[0], true) : substr(mt_rand(100000000, mt_getrandmax()), 0, $parameters[0]);
                break;
            case 'digits_between':
                $attributeData['type'] = 'numeric';
                $attributeData['description'][] = Description::parse($rule)->with($parameters)->getDescription();
                break;
            case 'file':
                $attributeData['type'] = 'file';
                $attributeData['description'][] = Description::parse($rule)->getDescription();
                break;
            case 'image':
                $attributeData['type'] = 'image';
                $attributeData['description'][] = Description::parse($rule)->getDescription();
                break;
            case 'json':
                $attributeData['type'] = 'string';
                $attributeData['description'][] = Description::parse($rule)->getDescription();
                $attributeData['value'] = json_encode(['foo', 'bar', 'baz']);
                break;
            case 'mimetypes':
            case 'mimes':
                $attributeData['description'][] = Description::parse($rule)->with($this->fancyImplode($parameters, ', ', ' or '))->getDescription();
                break;
            case 'required_if':
                $attributeData['description'][] = Description::parse($rule)->with($this->splitValuePairs($parameters))->getDescription();
                break;
            case 'required_unless':
                $attributeData['description'][] = Description::parse($rule)->with($this->splitValuePairs($parameters))->getDescription();
                break;
            case 'required_with':
                $attributeData['description'][] = Description::parse($rule)->with($this->fancyImplode($parameters, ', ', ' or '))->getDescription();
                break;
            case 'required_with_all':
                $attributeData['description'][] = Description::parse($rule)->with($this->fancyImplode($parameters, ', ', ' and '))->getDescription();
                break;
            case 'required_without':
                $attributeData['description'][] = Description::parse($rule)->with($this->fancyImplode($parameters, ', ', ' or '))->getDescription();
                break;
            case 'required_without_all':
                $attributeData['description'][] = Description::parse($rule)->with($this->fancyImplode($parameters, ', ', ' and '))->getDescription();
                break;
            case 'same':
                $attributeData['description'][] = Description::parse($rule)->with($parameters)->getDescription();
                break;
            case 'size':
                $attributeData['description'][] = Description::parse($rule)->with($parameters)->getDescription();
                break;
            case 'timezone':
                $attributeData['description'][] = Description::parse($rule)->getDescription();
                $attributeData['value'] = $faker->timezone;
                break;
            case 'exists':
                $fieldName = isset($parameters[1]) ? $parameters[1] : $ruleName;
                $attributeData['description'][] = Description::parse($rule)->with([Str::singular($parameters[0]), $fieldName])->getDescription();
                break;
            case 'active_url':
                $attributeData['type'] = 'url';
                $attributeData['value'] = $faker->url;
                break;
            case 'regex':
                $attributeData['type'] = 'string';
                $attributeData['description'][] = Description::parse($rule)->with($parameters)->getDescription();
                break;
            case 'boolean':
                $attributeData['value'] = true;
                $attributeData['type'] = $rule;
                break;
            case 'array':
                $attributeData['value'] = $faker->word;
                $attributeData['type'] = $rule;
                break;
            case 'date':
                $attributeData['value'] = $faker->date();
                $attributeData['type'] = $rule;
                break;
            case 'email':
                $attributeData['value'] = $faker->safeEmail;
                $attributeData['type'] = $rule;
                break;
            case 'string':
                $attributeData['value'] = $faker->word;
                $attributeData['type'] = $rule;
                break;
            case 'integer':
                $attributeData['value'] = $faker->randomNumber();
                $attributeData['type'] = $rule;
                break;
            case 'numeric':
                $attributeData['value'] = $faker->randomNumber();
                $attributeData['type'] = $rule;
                break;
            case 'url':
                $attributeData['value'] = $faker->url;
                $attributeData['type'] = $rule;
                break;
            case 'ip':
                $attributeData['value'] = $faker->ipv4;
                $attributeData['type'] = $rule;
                break;
        }

        if ($attributeData['value'] === '') {
            $attributeData['value'] = $faker->word;
        }

        if (is_null($attributeData['type'])) {
            $attributeData['type'] = 'string';
        }
    }

    /**
     * Call the given URI and return the Response.
     *
     * @param  string  $method
     * @param  string  $uri
     * @param  array  $parameters
     * @param  array  $cookies
     * @param  array  $files
     * @param  array  $server
     * @param  string  $content
     *
     * @return \Illuminate\Http\Response
     */
    abstract public function callRoute($method, $uri, $parameters = [], $cookies = [], $files = [], $server = [], $content = null);

    /**
     * Transform headers array to array of $_SERVER vars with HTTP_* format.
     *
     * @param  array  $headers
     *
     * @return array
     */
    protected function transformHeadersToServerVars(array $headers)
    {
        $server = [];
        $prefix = 'HTTP_';

        foreach ($headers as $name => $value) {
            $name = strtr(strtoupper($name), '-', '_');

            if (! Str::startsWith($name, $prefix) && $name !== 'CONTENT_TYPE') {
                $name = $prefix.$name;
            }

            $server[$name] = $value;
        }

        return $server;
    }

    /**
     * Parse a string based rule.
     *
     * @param  string  $rules
     *
     * @return array
     */
    protected function parseStringRule($rules)
    {
        $parameters = [];

        // The format for specifying validation rules and parameters follows an
        // easy {rule}:{parameters} formatting convention. For instance the
        // rule "Max:3" states that the value may only be three letters.
        if (strpos($rules, ':') !== false) {
            list($rules, $parameter) = explode(':', $rules, 2);

            $parameters = $this->parseParameters($rules, $parameter);
        }

        return [strtolower(trim($rules)), $parameters];
    }

    /**
     * Parse a parameter list.
     *
     * @param  string  $rule
     * @param  string  $parameter
     *
     * @return array
     */
    protected function parseParameters($rule, $parameter)
    {
        if (strtolower($rule) === 'regex') {
            return [$parameter];
        }

        return str_getcsv($parameter);
    }

    /**
     * Normalizes a rule so that we can accept short types.
     *
     * @param  string $rule
     *
     * @return string
     */
    protected function normalizeRule($rule)
    {
        switch ($rule) {
            case 'int':
                return 'integer';
            case 'bool':
                return 'boolean';
            default:
                return $rule;
        }
    }
}


text:
package de.unioninvestment.eai.portal.portlet.crud.domain.model;

import com.google.common.collect.ImmutableSet;
import com.vaadin.data.Container;
import com.vaadin.data.Container.Ordered;
import com.vaadin.data.Item;
import com.vaadin.data.util.filter.And;
import com.vaadin.data.util.filter.Compare;
import com.vaadin.data.util.filter.Like;
import com.vaadin.data.util.filter.Or;
import de.unioninvestment.eai.portal.portlet.crud.domain.container.EditorSupport;
import de.unioninvestment.eai.portal.portlet.crud.domain.events.*;
import de.unioninvestment.eai.portal.portlet.crud.domain.model.DataContainer.ExportWithExportSettings;
import de.unioninvestment.eai.portal.portlet.crud.domain.model.DataContainer.FilterPolicy;
import de.unioninvestment.eai.portal.portlet.crud.domain.model.filter.*;
import de.unioninvestment.eai.portal.support.vaadin.filter.AdvancedStringFilter;
import de.unioninvestment.eai.portal.support.vaadin.filter.NothingFilter;
import de.unioninvestment.eai.portal.support.vaadin.junit.LiferayContext;
import de.unioninvestment.eai.portal.support.vaadin.mvp.EventBus;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.mockito.*;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;

import java.math.BigDecimal;
import java.sql.SQLTimeoutException;
import java.text.DateFormat;
import java.text.NumberFormat;
import java.util.*;

import static java.util.Arrays.asList;
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyString;
import static org.mockito.Matchers.isA;
import static org.mockito.Mockito.*;

public abstract class AbstractDataContainerTest<C extends AbstractDataContainer, V extends Ordered> {

	@Captor
	private ArgumentCaptor<com.vaadin.data.Container.Filter> filterCaptor;

	@Mock
	protected CreateEventHandler createEventHandlerMock;

	@Mock
	protected BeforeCommitEventHandler beforeCommitEventHandlerMock;

	@Mock
	protected InsertEventHandler insertEventHandlerMock;

	@Mock
	protected UpdateEventHandler updateEventHandlerMock;

	@Mock
	protected DeleteEventHandler deleteEventHandlerMock;

	@Mock
	protected CommitEventHandler commitEventHandlerMock;

	protected List<EditorSupport> editors = new ArrayList<EditorSupport>();

	protected C container;

	protected V vaadinContainerMock;

	@Mock
	protected HashMap<String, String> displayPatternMock;

	protected HashMap<String, String> displayPattern = new HashMap<String, String>();

	@Mock
	protected EditorSupport editorSupportMock;

	@Mock
	private ExportWithExportSettings exportMock;

    @Mock
    private ContainerRowId rowIdMock1, rowIdMock2;
    @Mock
    private Item itemMock1, itemMock2;
    @Mock
    private ContainerRow rowMock1, rowMock2;
    @Mock
    private DataContainer.EachRowCallback eachRowCallbackMock;
    @Mock
    private EventBus eventBusMock;

	@Rule
	public LiferayContext liferayContext = new LiferayContext();

    @Before
	public final void setUp() {
		MockitoAnnotations.initMocks(this);
		editors.add(editorSupportMock);

		vaadinContainerMock = createVaadinContainer();

		container = createDataContainer();

		container.setEditors(editors);

	}

	/**
	 * die zurückgelieferte Implementierung muss sowohl das {@code Container},
	 * als auch das {@code Filterable} Interface implementieren. Wenn es sich um
	 * ein Mock handelt, könnte es wie folgt aussehen:
	 *
	 * <pre>
	 * Mockito.mock(Container.class,
	 * 		Mockito.withSettings().extraInterfaces(Filterable.class))
	 * </pre>
	 *
	 * @return
	 */
	public abstract C createDataContainer();

	public abstract V createVaadinContainer();

	@Test
	public void shouldRegisterOnCreateEvents() {
		container.addCreateEventHandler(createEventHandlerMock);

		assertTrue(container.getOnCreateEventRouter().contains(
				createEventHandlerMock));
	}

	@Test
	public void shouldRegisterBeforeCommitEvents() {
		container.addBeforeCommitEventHandler(beforeCommitEventHandlerMock);

		assertTrue(container.getBeforeCommitEventRouter().contains(
				beforeCommitEventHandlerMock));
	}

	@Test
	public void shouldRegisterOnInsertEvents() {
		container.addInsertEventHandler(insertEventHandlerMock);

		assertTrue(container.getOnInsertEventRouter().contains(
				insertEventHandlerMock));
	}

	@Test
	public void shouldRegisterOnUpdateEvents() {
		container.addUpdateEventHandler(updateEventHandlerMock);

		assertTrue(container.getOnUpdateEventRouter().contains(
				updateEventHandlerMock));
	}

	@Test
	public void shouldRegisterOnDeleteEvents() {
		container.addDeleteEventHandler(deleteEventHandlerMock);

		assertTrue(container.getOnDeleteEventRouter().contains(
				deleteEventHandlerMock));
	}

	@Test
	public void shouldRegisterOnCommitEvents() {
		container.addCommitEventHandler(commitEventHandlerMock);

		assertTrue(container.getOnCommitEventRouter().contains(
				commitEventHandlerMock));
	}

	@Test(expected = IllegalStateException.class)
	public void shouldFailWithoutTransactionOnAddRow() {
		container.addRow();
	}

	@Test
	public void shouldReturnContainerType() {
		container.setVaadinContainer(vaadinContainerMock);
		when(vaadinContainerMock.getType("test")).thenAnswer(
				new Answer<Object>() {
					@Override
					public Object answer(InvocationOnMock invocation)
							throws Throwable {
						return Integer.class;
					}
				});

		Class<?> type = container.getType("test");

		assertTrue(type.isAssignableFrom(Integer.class));
	}

	@Test
	public void shouldNotRemoveDurableFilters() {
		container.setVaadinContainer(vaadinContainerMock);

		Filter equalFilter1 = new Equal("a", "b");
		Filter equalFilter2 = new Equal("c", "d", true);
		Filter equalFilter3 = new Equal("e", "f");

		container.addFilters(asList(equalFilter1, equalFilter2, equalFilter3));

		container.removeAllFilters();

		List<Filter> filterList = container.getFilterList();

		assertThat(filterList.size(), is(1));
		assertThat(filterList.contains(equalFilter2), is(true));

		verify((Filterable) vaadinContainerMock, times(2))
				.replaceContainerFilter(
						any(com.vaadin.data.Container.Filter.class));
	}

	@Test
	public void shouldReplaceFilters() {
		container.setVaadinContainer(vaadinContainerMock);

		List<Filter> newFilters = asList((Filter) new Equal("MYCOL", "MYVALUE"));
		com.vaadin.data.Container.Filter newVaadinFilter = container
				.buildVaadinFilter(new All(newFilters));
		container.replaceFilters(newFilters, true);
		verify((Filterable) vaadinContainerMock).replaceContainerFilter(
				newVaadinFilter);
	}

	@Test
	public void shouldRemoveAllFilters() {
		container.setVaadinContainer(vaadinContainerMock);

		Filter equalFilter1 = new Equal("a", "b");
		Filter equalFilter2 = new Equal("c", "d", true);
		Filter equalFilter3 = new Equal("e", "f");

		container.addFilters(asList(equalFilter1, equalFilter2, equalFilter3));

		container.removeAllFilters(true);

		List<Filter> filterList = container.getFilterList();

		assertThat(filterList.size(), is(0));

		verify((Filterable) vaadinContainerMock).removeAllContainerFilters();
	}

	@Test
	public void shouldAddEqualFilter() {
		shouldAddFilterType(new Equal("ID", 1), Compare.Equal.class);
	}

	@Test
	public void shouldAddGreaterFilter() {
		shouldAddFilterType(new Greater("ID", 1, false), Compare.Greater.class);
	}

	@Test
	public void shouldAddGreaterOrEqualFilter() {
		shouldAddFilterType(new Greater("ID", 1, true),
				Compare.GreaterOrEqual.class);
	}

	@Test
	public void shouldAddLessFilter() {
		shouldAddFilterType(new Less("ID", 1, false), Compare.Less.class);
	}

	@Test
	public void shouldAddLessOrEqualFilter() {
		shouldAddFilterType(new Less("ID", 1, true), Compare.LessOrEqual.class);
	}

	@Test
	public void shouldAddNothingFilter() {
		shouldAddFilterType(new Nothing(), NothingFilter.class);
	}

	@Test
	public void shouldAddIsNullFilter() {
		com.vaadin.data.util.filter.IsNull isNull = shouldAddFilterType(new IsNull("ID"), com.vaadin.data.util.filter.IsNull.class);
		assertThat(isNull.getPropertyId(), is((Object)"ID"));
	}

	@Test
	public void shouldAddWildcardFilter() {
		Like likeFilter = shouldAddFilterType(new Wildcard("ID", "Te*t", false), Like.class);
		assertThat(likeFilter.getValue(), is("Te%t"));
	}

	@Test
	public void shouldAddAnyFilter() {
		shouldAddFilterType(
				new Any(Arrays.asList(new Filter[] {
						new Contains("NAME", "abcdef", false),
						new Equal("ID", 1) })), Or.class);
	}

	@Test
	public void shouldAddNotFilterWithAllSubfilter() {
		container.setVaadinContainer(vaadinContainerMock);
		Not filter = new Not(Arrays.asList(new Filter[] {
				new Contains("NAME", "abcdef", false), new Equal("ID", 1) }));

		container.addFilters(asList((Filter) filter));

		verify((Filterable) vaadinContainerMock).replaceContainerFilter(
				filterCaptor.capture());
		assertThat(container.getFilterList(), hasItems((Filter) filter));
		assertThat(filterCaptor.getValue(),
				instanceOf(com.vaadin.data.util.filter.Not.class));

		And subfilter = (And) ((com.vaadin.data.util.filter.Not) filterCaptor
				.getValue()).getFilter();
		Iterator<com.vaadin.data.Container.Filter> andIterator = subfilter
				.getFilters().iterator();
		assertThat(
				andIterator.next(),
				anyOf(instanceOf(AdvancedStringFilter.class),
						instanceOf(Like.class)));
		assertThat(andIterator.next(),
				instanceOf(com.vaadin.data.util.filter.Compare.Equal.class));
	}

	@Test(expected = IllegalArgumentException.class)
	public void shouldNotAddFilter() {
		container.setVaadinContainer(vaadinContainerMock);
		container.addFilters(asList((Filter) new Filter(false) {
			private static final long serialVersionUID = 1L;
			//
		}));
	}

	@Test
	public void shouldAddNotFilterWithSingleSubfilter() {
		container.setVaadinContainer(vaadinContainerMock);
		Filter filter = new Not(Arrays.asList(new Filter[] { new Contains(
				"NAME", "abc%def", false) }));

		container.addFilters(asList(filter));

		verify((Filterable) vaadinContainerMock).replaceContainerFilter(
				filterCaptor.capture());
		assertThat(container.getFilterList(), hasItems((Filter) filter));
		assertThat(filterCaptor.getValue(),
				instanceOf(com.vaadin.data.util.filter.Not.class));

		assertThat(
				((com.vaadin.data.util.filter.Not) filterCaptor.getValue())
						.getFilter(),
				anyOf(instanceOf(AdvancedStringFilter.class),
						instanceOf(Like.class)));
	}

	@Test
	public void shouldAddAllFilter() {
		container.setVaadinContainer(vaadinContainerMock);
		shouldAddFilterType(
				new All(Arrays.asList(new Filter[] {
						new Contains("NAME", "abc%def", false),
						new Equal("ID", 1) })), And.class);
	}

	@Test
	public void shouldNotAddEmptyAllFilter() {
		shouldNotAddFilterType(new All(new ArrayList<Filter>()));
	}

	@Test
	public void shouldNotAddEmptyAnyFilter() {
		shouldNotAddFilterType(new Any(new ArrayList<Filter>()));
	}

	@Test
	public void shouldNotAddEmptyNotFilter() {
		shouldNotAddFilterType(new Not(null));
	}

	@Test
	public void shouldGetCustomNumberFormat() {
		container.setVaadinContainer(vaadinContainerMock);
		when(vaadinContainerMock.getType(anyString())).thenAnswer(
				new Answer<Class<BigDecimal>>() {
					@Override
					public Class<BigDecimal> answer(InvocationOnMock invocation)
							throws Throwable {
						return BigDecimal.class;
					}
				});
		when(displayPatternMock.get(anyString())).thenReturn("#,##0.00");

		NumberFormat format = (NumberFormat) container.getFormat("testCol");
		assertThat(format.format(123123l), is("123,123.00"));
	}

	@Test
	public void shouldGetCustomDateFormat() {
		container.setVaadinContainer(vaadinContainerMock);
		when(vaadinContainerMock.getType(anyString())).thenAnswer(
				new Answer<Class<Date>>() {
					@Override
					public Class<Date> answer(InvocationOnMock invocation)
							throws Throwable {
						return Date.class;
					}
				});
		when(displayPatternMock.get(anyString()))
				.thenReturn("dd.MM.yyyy HH:mm");

		DateFormat format = (DateFormat) container.getFormat("testCol");
		assertThat(format.format(new GregorianCalendar(2013, 5, 25, 8, 31)
				.getTime()), is("25.06.2013 08:31"));
	}

	@Test
	public void shouldGetNullFormatByWrongType() {
		container.setVaadinContainer(vaadinContainerMock);
		when(vaadinContainerMock.getType(anyString())).thenAnswer(
				new Answer<Class<String>>() {
					@Override
					public Class<String> answer(InvocationOnMock invocation)
							throws Throwable {
						return String.class;
					}
				});
		when(displayPatternMock.get(anyString())).thenReturn("#,##0.00");

		NumberFormat format = (NumberFormat) container.getFormat("testCol");
		assertThat(format, nullValue());
	}

	private void shouldNotAddFilterType(Filter filter) {
		container.setVaadinContainer(vaadinContainerMock);
		container.addFilters(asList(filter));

		verify((Filterable) vaadinContainerMock, never()).addContainerFilter(
				any(com.vaadin.data.Container.Filter.class));
	}

	@SuppressWarnings("unchecked")
	protected <T extends com.vaadin.data.Container.Filter> T shouldAddFilterType(Filter filter,
			Class<T> vaadinClass) {
		container.setVaadinContainer(vaadinContainerMock);
		container.addFilters(asList(filter));

		verify((Filterable) vaadinContainerMock).replaceContainerFilter(
				filterCaptor.capture());
		assertThat(container.getFilterList(), hasItems((Filter) filter));
		com.vaadin.data.Container.Filter vaadinFilter = filterCaptor.getValue();
		assertThat(vaadinFilter, instanceOf(vaadinClass));
		return (T) vaadinFilter;
	}

	public static void returnFollowingColumnType(DataContainer containerMock,
			String columnName, final Class<?> columnType) {
		when(containerMock.getType(columnName)).thenAnswer(
				new Answer<Class<Object>>() {
					@SuppressWarnings("unchecked")
					@Override
					public Class<Object> answer(InvocationOnMock invocation)
							throws Throwable {
						return (Class<Object>) columnType;
					}
				});
	}

	@Test
	public void addFilterShouldApplyNothingFilterIfTheNewFilterlistOnlyContainsDurableFilters() {
		container.setVaadinContainer(vaadinContainerMock);
		container.setFilterPolicy(FilterPolicy.NOTHING_AT_ALL);
		Filter equalFilter1 = new Equal("a", "b", true);

		container.addFilters(asList(equalFilter1));

		verify((Filterable) vaadinContainerMock).replaceContainerFilter(
				isA(NothingFilter.class));
	}

	@Test
	public void replaceFilterShouldApplyNothingFilterIfTheNewFilterlistIsDurable() {
		container.setVaadinContainer(vaadinContainerMock);
		container.setFilterPolicy(FilterPolicy.NOTHING_AT_ALL);
		Filter equalFilter1 = new Equal("a", "b", true);

		container.replaceFilters(asList(equalFilter1), true);

		verify((Filterable) vaadinContainerMock).replaceContainerFilter(
				isA(NothingFilter.class));
	}

	@Test
	public void replaceFilterShouldApplyNothingFilterIfTheNewFilterlistIsEmpty() {
		container.setVaadinContainer(vaadinContainerMock);
		container.setFilterPolicy(FilterPolicy.NOTHING_AT_ALL);
		Filter nonDurableFilter = new Equal("a", "b", false);
		container.addFilters(asList(nonDurableFilter));

		container.replaceFilters(new LinkedList<Filter>(), true);

		verify((Filterable) vaadinContainerMock).replaceContainerFilter(
				isA(Compare.Equal.class));
		verify((Filterable) vaadinContainerMock).replaceContainerFilter(
				isA(NothingFilter.class));
	}

	@Test
	public void replaceFilterShouldApplyNothingFilterOnTimeoutException() {
		container.setVaadinContainer(vaadinContainerMock);
		Filter nonDurableFilter = new Equal("a", "b", false);
		container.addFilters(asList(nonDurableFilter));
		doThrow(new RuntimeException(new SQLTimeoutException("Test"))).when(
				((Filterable) vaadinContainerMock)).removeAllContainerFilters();

		try {
			container.replaceFilters(new LinkedList<Filter>(), true);
			fail("Should throw timeout exception");

		} catch (RuntimeException e) {
			assertThat(container.getFilterList(),
					is(asList((Filter) new Nothing())));
		}
	}

	@Test
	public void addFilterShouldReApplyExistingDurableFiltersIfANonDurableFilterIsAdded() {
		container.setVaadinContainer(vaadinContainerMock);
		container.setFilterPolicy(FilterPolicy.NOTHING_AT_ALL);
		Filter durableFilter = new Equal("a", "b", true);
		Filter nonDurableFilter = new Equal("a", "b", false);
		container.addFilters(asList(durableFilter));

		container.addFilters(asList(nonDurableFilter));

		verify((Filterable) vaadinContainerMock, times(2))
				.replaceContainerFilter(filterCaptor.capture());
		assertThat(filterCaptor.getAllValues().get(0),
				instanceOf(NothingFilter.class));
		com.vaadin.data.Container.Filter allFilter = filterCaptor
				.getAllValues().get(1);
		assertThat(allFilter, instanceOf(And.class));
		Collection<com.vaadin.data.Container.Filter> subFilters = ((And) allFilter)
				.getFilters();
		assertThat(subFilters.size(), is(2));
	}

	@Test
	public void shouldCallExportCallbackWithExportSettings() {
		container.withExportSettings(exportMock);
		verify(exportMock).export();
	}

    @Test
    public void shouldIterateOverImmutableRowsByIds() {
        AbstractDataContainer containerMock = createPartialContainerMock();

        when(rowIdMock1.getInternalId()).thenReturn(1);
        when(rowIdMock2.getInternalId()).thenReturn(2);
        // spy stubbing
        doReturn(rowIdMock1).when(containerMock).convertInternalRowId(1);
        doReturn(rowIdMock2).when(containerMock).convertInternalRowId(2);
        doReturn(rowMock1).when(containerMock).getRow(rowIdMock1, false, true);
        doReturn(rowMock2).when(containerMock).getRow(rowIdMock2, false, true);

        containerMock.eachImmutableRow(ImmutableSet.of(rowIdMock1, rowIdMock2), eachRowCallbackMock);

        verify(eachRowCallbackMock).doWithRow(rowMock1);
        verify(eachRowCallbackMock).doWithRow(rowMock2);
    }

    @Test
    public void shouldIterateOverImmutableRowsByIdsIgnoringMissingRows() {
        AbstractDataContainer containerMock = createPartialContainerMock();

        when(rowIdMock1.getInternalId()).thenReturn(1);
        when(rowIdMock2.getInternalId()).thenReturn(2);
        // spy stubbing
        doReturn(rowIdMock1).when(containerMock).convertInternalRowId(1);
        doReturn(rowIdMock2).when(containerMock).convertInternalRowId(2);
        doReturn(rowMock1).when(containerMock).getRow(rowIdMock1, false, true);
        doReturn(null).when(containerMock).getRow(rowIdMock2, false, true);

        containerMock.eachImmutableRow(ImmutableSet.of(rowIdMock1, rowIdMock2), eachRowCallbackMock);

        verify(eachRowCallbackMock).doWithRow(rowMock1);
        verifyNoMoreInteractions(eachRowCallbackMock);
    }

    @Test
    public void shouldIterateOverRowsByIdsInsideATransaction() {
        AbstractDataContainer containerMock = createPartialContainerMock();

        when(rowIdMock1.getInternalId()).thenReturn(1);
        when(rowIdMock2.getInternalId()).thenReturn(2);
        // spy stubbing
        doReturn(rowIdMock1).when(containerMock).convertInternalRowId(1);
        doReturn(rowIdMock2).when(containerMock).convertInternalRowId(2);
        doReturn(rowMock1).when(containerMock).getRow(rowIdMock1, true, false);
        doReturn(rowMock2).when(containerMock).getRow(rowIdMock2, true, false);

        containerMock.eachRow(ImmutableSet.of(rowIdMock1, rowIdMock2), eachRowCallbackMock);

        InOrder inOrder = inOrder(containerMock, eachRowCallbackMock);

        inOrder.verify(containerMock).commit();
        inOrder.verify(eachRowCallbackMock).doWithRow(rowMock1);
        inOrder.verify(eachRowCallbackMock).doWithRow(rowMock2);
        inOrder.verify(containerMock).commit();
    }

    @Test
    public void shouldIterateOverRowsByIdsIgnoringMissingRows() {
        AbstractDataContainer containerMock = createPartialContainerMock();

        when(rowIdMock1.getInternalId()).thenReturn(1);
        when(rowIdMock2.getInternalId()).thenReturn(2);
        // spy stubbing
        doReturn(rowIdMock1).when(containerMock).convertInternalRowId(1);
        doReturn(rowIdMock2).when(containerMock).convertInternalRowId(2);
        doReturn(rowMock1).when(containerMock).getRow(rowIdMock1, true, false);
        doReturn(null).when(containerMock).getRow(rowIdMock2, true, false);

        containerMock.eachRow(ImmutableSet.of(rowIdMock1, rowIdMock2), eachRowCallbackMock);

        InOrder inOrder = inOrder(containerMock, eachRowCallbackMock);

        inOrder.verify(containerMock).commit();
        inOrder.verify(eachRowCallbackMock).doWithRow(rowMock1);
        inOrder.verify(containerMock).commit();
    }

    private AbstractDataContainer createPartialContainerMock() {
        AbstractDataContainer containerMock = spy(new AbstractDataContainer(eventBusMock, null, null, null) {

            @Override
            protected Container createVaadinContainer() {
                return null;
            }

            @Override
            public boolean isInsertable() {
                return false;
            }

            @Override
            public boolean isUpdateable() {
                return false;
            }

            @Override
            public boolean isDeleteable() {
                return false;
            }

            @Override
            public Class<?> getType(String name) {
                return null;
            }

            @Override
            public void rollback() {

            }

            @Override
            public void commit() {

            }

            @Override
            public List<String> getPrimaryKeyColumns() {
                return null;
            }

            @Override
            public List<String> getColumns() {
                return null;
            }

            @Override
            public ContainerRow convertItemToRow(Item item, boolean transactional, boolean immutable) {
                return null;
            }

            @Override
            public ContainerRowId convertInternalRowId(Object internalId) {
                return null;
            }

            @Override
            public void refresh() {

            }

            @Override
            public ContainerClob getCLob(ContainerRowId rowId, String columnName) {
                return null;
            }

            @Override
            public boolean isCLob(String columnName) {
                return false;
            }

            @Override
            public ContainerBlob getBLob(ContainerRowId rowId, String columnName) {
                return null;
            }

            @Override
            public boolean isBLobEmpty(ContainerRowId rowId, String columnName) {
                return false;
            }

            @Override
            public boolean isBLob(String columnName) {
                return false;
            }
        });
        containerMock.setVaadinContainer(vaadinContainerMock);
        return containerMock;
    }

}


text:
require 'test_helper'
require 'rack/test'

describe Lotus::Container do
  include Rack::Test::Methods

  before do
    Lotus::Container.configure do
      mount Front::Application, at: '/front'
      mount Back::Application,  at: '/back'
    end

    @container = Lotus::Container.new
    Front::Application.load!
    Back::Application.load!
  end

  def app
    @container
  end

  def response
    last_response
  end

  it 'reach to endpoints' do
    get '/back/home'
    response.status.must_equal 200
    response.body.must_equal 'hello Back'

    get '/front/home'
    response.status.must_equal 200
    response.body.must_equal 'hello Front'

    get '/back/users'
    response.status.must_equal 200
    response.body.must_equal 'hello from Back users endpoint'
  end

  it 'print correct routes' do
    matches = [
      'GET, HEAD  /front/home                    Front::Controllers::Home::Show',
      'GET, HEAD  /back/home                     Back::Controllers::Home::Show',
      'GET, HEAD  /back/users                    Back::Controllers::Users::Index'
    ]
    matches.each do |match|
      @container.routes.inspector.to_s.must_match match
    end
  end

  it 'generate correct urls with route helpers' do
    Front::Routes.path(:home).must_equal '/front/home'
    Back::Routes.path(:home).must_equal '/back/home'
  end
end


text:
package aima.core.environment.map;

import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;

import aima.core.agent.Action;
import aima.core.agent.Percept;
import aima.core.agent.impl.DynamicPercept;
import aima.core.search.framework.ActionsFunction;
import aima.core.search.framework.PerceptToStateFunction;
import aima.core.search.framework.ResultFunction;

/**
 * @author Ciaran O'Reilly
 *
 */
public class MapFunctionFactory {
	private static ResultFunction _resultFunction = null;
	private static PerceptToStateFunction _perceptToStateFunction = null;

	public static ActionsFunction getActionsFunction(Map map) {
		return new MapActionsFunction(map);
	}

	public static ResultFunction getResultFunction() {
		if (null == _resultFunction) {
			_resultFunction = new MapResultFunction();
		}
		return _resultFunction;
	}

	private static class MapActionsFunction implements ActionsFunction {
		private Map map = null;

		public MapActionsFunction(Map map) {
			this.map = map;
		}

		public Set<Action> actions(Object state) {
			Set<Action> actions = new LinkedHashSet<Action>();
			String location = state.toString();

			List<String> linkedLocations = map.getLocationsLinkedTo(location);
			for (String linkLoc : linkedLocations) {
				actions.add(new MoveToAction(linkLoc));
			}

			return actions;
		}
	}

	public static PerceptToStateFunction getPerceptToStateFunction() {
		if (null == _perceptToStateFunction) {
			_perceptToStateFunction = new MapPerceptToStateFunction();
		}
		return _perceptToStateFunction;
	}

	private static class MapResultFunction implements ResultFunction {
		public MapResultFunction() {
		}

		public Object result(Object s, Action a) {

			if (a instanceof MoveToAction) {
				MoveToAction mta = (MoveToAction) a;

				return mta.getToLocation();
			}

			// The Action is not understood or is a NoOp
			// the result will be the current state.
			return s;
		}
	}

	private static class MapPerceptToStateFunction implements
			PerceptToStateFunction {
		public Object getState(Percept p) {
			return ((DynamicPercept) p)
					.getAttribute(DynAttributeNames.PERCEPT_IN);
		}
	}
}


text:
using pb = global::Google.Protobuf;
using pbc = global::Google.Protobuf.Collections;
using pbr = global::Google.Protobuf.Reflection;
using scg = global::System.Collections.Generic;
namespace POGOProtos.Networking.Responses {

  /// Holder for reflection information generated from POGOProtos/Networking/Responses/VerifyChallengeResponse.proto
  public static partial class VerifyChallengeResponseReflection {

    #region Descriptor
    /// File descriptor for POGOProtos/Networking/Responses/VerifyChallengeResponse.proto
    public static pbr::FileDescriptor Descriptor {
      get { return descriptor; }
    }
    private static pbr::FileDescriptor descriptor;

    static VerifyChallengeResponseReflection() {
      byte[] descriptorData = global::System.Convert.FromBase64String(
          string.Concat(
            "Cj1QT0dPUHJvdG9zL05ldHdvcmtpbmcvUmVzcG9uc2VzL1ZlcmlmeUNoYWxs",
            "ZW5nZVJlc3BvbnNlLnByb3RvEh9QT0dPUHJvdG9zLk5ldHdvcmtpbmcuUmVz",
            "cG9uc2VzIioKF1ZlcmlmeUNoYWxsZW5nZVJlc3BvbnNlEg8KB3N1Y2Nlc3MY",
            "ASABKAhiBnByb3RvMw=="));
      descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
          new pbr::FileDescriptor[] { },
          new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] {
            new pbr::GeneratedClrTypeInfo(typeof(global::POGOProtos.Networking.Responses.VerifyChallengeResponse), global::POGOProtos.Networking.Responses.VerifyChallengeResponse.Parser, new[]{ "Success" }, null, null, null)
          }));
    }
    #endregion

  }
  #region Messages
  public sealed partial class VerifyChallengeResponse : pb::IMessage<VerifyChallengeResponse> {
    private static readonly pb::MessageParser<VerifyChallengeResponse> _parser = new pb::MessageParser<VerifyChallengeResponse>(() => new VerifyChallengeResponse());
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    public static pb::MessageParser<VerifyChallengeResponse> Parser { get { return _parser; } }

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    public static pbr::MessageDescriptor Descriptor {
      get { return global::POGOProtos.Networking.Responses.VerifyChallengeResponseReflection.Descriptor.MessageTypes[0]; }
    }

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    pbr::MessageDescriptor pb::IMessage.Descriptor {
      get { return Descriptor; }
    }

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    public VerifyChallengeResponse() {
      OnConstruction();
    }

    partial void OnConstruction();

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    public VerifyChallengeResponse(VerifyChallengeResponse other) : this() {
      success_ = other.success_;
    }

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    public VerifyChallengeResponse Clone() {
      return new VerifyChallengeResponse(this);
    }

    /// Field number for the "success" field.
    public const int SuccessFieldNumber = 1;
    private bool success_;
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    public bool Success {
      get { return success_; }
      set {
        success_ = value;
      }
    }

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    public override bool Equals(object other) {
      return Equals(other as VerifyChallengeResponse);
    }

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    public bool Equals(VerifyChallengeResponse other) {
      if (ReferenceEquals(other, null)) {
        return false;
      }
      if (ReferenceEquals(other, this)) {
        return true;
      }
      if (Success != other.Success) return false;
      return true;
    }

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    public override int GetHashCode() {
      int hash = 1;
      if (Success != false) hash ^= Success.GetHashCode();
      return hash;
    }

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    public override string ToString() {
      return pb::JsonFormatter.ToDiagnosticString(this);
    }

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    public void WriteTo(pb::CodedOutputStream output) {
      if (Success != false) {
        output.WriteRawTag(8);
        output.WriteBool(Success);
      }
    }

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    public int CalculateSize() {
      int size = 0;
      if (Success != false) {
        size += 1 + 1;
      }
      return size;
    }

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    public void MergeFrom(VerifyChallengeResponse other) {
      if (other == null) {
        return;
      }
      if (other.Success != false) {
        Success = other.Success;
      }
    }

    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
    public void MergeFrom(pb::CodedInputStream input) {
      uint tag;
      while ((tag = input.ReadTag()) != 0) {
        switch(tag) {
          default:
            input.SkipLastField();
            break;
          case 8: {
            Success = input.ReadBool();
            break;
          }
        }
      }
    }

  }

  #endregion

}

#endregion Designer generated code


text:
```
const theme = require('../theme').default;
theme.renderDocumentation('Unthemed');
```

This component has no theme properties.