text:
from __future__ import unicode_literals

from django.db import models
from django_extensions.db.models import TimeStampedModel
from django.core import urlresolvers

NO = 0
YES = 1
UNKNOWN = 3
STATUS_CHOICES = (
    (YES, 'Yes'),
    (NO, 'No'),
    (UNKNOWN, 'Unknown'),
)

class DataSource(TimeStampedModel):
    name = models.CharField(max_length=200)
    description = models.TextField()

    def __unicode__(self):
        return self.name

class Response(TimeStampedModel):
    result = models.TextField()

    def __unicode__(self):
        return self.result

class Regime(TimeStampedModel):
    regime = models.TextField()

    def __unicode__(self):
        return self.regime

class Treatment(TimeStampedModel):
    drug = models.TextField()
    dose = models.TextField()

    regime = models.OneToOneField(Regime)
    response = models.OneToOneField(Response)

    def __unicode__(self):
        return self.drug, self.dose

class TumorHistology(TimeStampedModel):
    description = models.TextField()
    image = models.ImageField(upload_to="histology")

    class Meta:
        verbose_name_plural = "Tumor Histology Images"

class Patient(TimeStampedModel):
    external_id = models.CharField(max_length=10, blank=True)
    sex = models.CharField(max_length=10, blank=True, null=True)
    age = models.IntegerField(blank=True, null=True)
    race = models.TextField(blank=True, null=True)
    ethnicity = models.TextField(blank=True, null=True)

    prior_treatment = models.ManyToManyField(Treatment)

    def __unicode__(self):
        return "".join([self.sex, ",", str(self.age)])

class PatientSnapshot(TimeStampedModel):
    patient = models.ForeignKey(Patient)
    age = models.IntegerField(blank=True, null=True)
    stage = models.TextField(blank=True, null=True)

    def __unicode__(self):
        return "PatientSnapshot [Age: %s y.o., Sex: %s]"% (self.age, self.patient.sex)

class Tumor(TimeStampedModel):
    source_tumor_id = models.CharField(max_length=255, blank=True, null=True)
    tumor_type = models.CharField(max_length=255, blank=True, null=True, db_index=True)
    diagnosis = models.CharField(max_length=255, blank=True, null=True, db_index=True)
    tissue_of_origin = models.CharField(max_length=100, blank=True, null=True, db_index=True)
    classification = models.CharField(max_length=100, blank=True, null=True)

    patient_snapshot = models.ForeignKey(PatientSnapshot, blank=True, null=True)
    histology = models.ForeignKey(TumorHistology, blank=True, null=True)

    def __unicode__(self):
        desc = "Tissue: %s (%s, Classification: %s)" % (self.tissue_of_origin, self.tumor_type, self.classification)
        if not self.patient_snapshot:
            desc = "Source specimen: Mouse %s" % "pdx"
        return desc

class ImplantationSite(TimeStampedModel):
    name = models.CharField(max_length=255)

    def __unicode__(self):
        return self.name

class ImplantationType(TimeStampedModel):
    name = models.CharField(max_length=255)

    def __unicode__(self):
        return self.name

class HostStrain(TimeStampedModel):
    name = models.TextField()
    accession = models.TextField()
    humanized = models.TextField()
    humanization_protocol = models.TextField()

    def __unicode__(self):
        return "%s" % (self.name)

class PdxStrain(TimeStampedModel):
    external_id = models.CharField(max_length=100)
    passage_number = models.CharField(max_length=25, blank=True, null=True)
    lag_time = models.CharField(max_length=25, blank=True, null=True)
    doubling_time = models.CharField(max_length=25, blank=True, null=True)
    metastases = models.SmallIntegerField(null=True, blank=True, default=None, choices=STATUS_CHOICES)

    human_tumor = models.OneToOneField(Tumor, related_name='human_tumor')
    mouse_tumor = models.OneToOneField(Tumor, related_name='mouse_tumor')
    host_strain = models.ForeignKey(HostStrain)
    implantation_site = models.ForeignKey(ImplantationSite, blank=True, null=True)
    implantation_type = models.ForeignKey(ImplantationType, blank=True, null=True)
    data_source = models.ForeignKey(DataSource)
    treatment = models.ForeignKey(Treatment, blank=True, null=True)

    def __unicode__(self):
        return "Strain: %s (ID: %s), Implanted [Site:%s, Type: %s]"% (self.host_strain.name, self.external_id, self.implantation_site, self.implantation_type)

    def get_absolute_url(self):
        return urlresolvers.reverse('pdx', args=[self.pk])

class Validation(TimeStampedModel):
    status = models.CharField(max_length=100, blank=True, null=True)
    result = models.TextField()

    pdx_strain = models.ForeignKey(PdxStrain)

    def __unicode__(self):
        return self.result

class Marker(TimeStampedModel):
    gene = models.CharField(max_length=255, db_index=True)
    details = models.TextField(blank=True, null=True)

    tumor = models.ForeignKey(Tumor)

    def __unicode__(self):
        return "%s: %s" % (self.gene, self.details)

    def get_absolute_url(self):

        return urlresolvers.reverse('pdx', args=[self.tumor.mouse_tumor.pk])


text:
<?php

/**
 * Returns the state variable data
 *
 * @phpstub
 *
 * @param resource $introspection
 * @param string $variable_name
 *
 * @return array Return the state variable data or false.
 */
function gupnp_service_introspection_get_state_variable($introspection, $variable_name)
{
}

redpajama_set_name: RedPajamaGithub


text:
require 'test_helper'

class IntegrationStateTest < ActiveSupport::TestCase
  # test "the truth" do
  #   assert true
  # end
end


text:
Tabs make it easy to switch between different views.

### Examples

::: demo
<summary>
  #### Basic
  * Three styles,`boxed` `toggle` and default
  * Setting content by `slot`
</summary>

```html
<div class="columns">
  <div class="column">
    <tabs>
      <tab-item label="Pictures">Pictures Tab</tab-item>
      <tab-item label="Music">Music Tab</tab-item>
      <tab-item label="Videos">Video Tab</tab-item>
      <tab-item label="Documents">Document Tab2</tab-item>
    </tabs>
  </div>

  <div class="column">
    <tabs type="boxed">
      <tab-item label="Pictures">Pictures Tab</tab-item>
      <tab-item label="Music">Music Tab</tab-item>
      <tab-item label="Videos">Video Tab</tab-item>
      <tab-item label="Documents">Document Tab2</tab-item>
    </tabs>
  </div>
</div>

<div class="columns">
  <div class="column">
    <tabs type="toggle">
      <tab-item label="Pictures">Pictures Tab</tab-item>
      <tab-item label="Music">Music Tab</tab-item>
      <tab-item label="Videos">Video Tab</tab-item>
      <tab-item label="Documents">Document Tab2</tab-item>
    </tabs>
  </div>
</div>
```
:::

### Styles and Icon

::: demo
<summary>
  #### styles
  * The tab can be set to take up the whole width
  * There are 3 sizes of tab: `small` `large` and default
  * `alignment`: `right` `left` `centered`
</summary>

```html
<div class="columns">
  <div class="column">
    <tabs type="toggle" :is-full-width="true">
      <tab-item label="Pictures" icon="image">Pictures Tab</tab-item>
      <tab-item label="Music" icon="music">Music Tab</tab-item>
      <tab-item label="Videos" icon="film">Video Tab</tab-item>
      <tab-item label="Documents" icon="file-text-o">Document Tab2</tab-item>
    </tabs>
  </div>
</div>
<hr>
<div class="columns">
  <div class="column">
    <tabs size="small">
      <tab-item label="Pictures">Pictures Tab</tab-item>
      <tab-item label="Music">Music Tab</tab-item>
      <tab-item label="Videos">Video Tab</tab-item>
      <tab-item label="Documents">Document Tab2</tab-item>
    </tabs>
  </div>
  <div class="column">
    <tabs alignment="centered">
      <tab-item label="Pictures">Pictures Tab</tab-item>
      <tab-item label="Music">Music Tab</tab-item>
      <tab-item label="Videos">Video Tab</tab-item>
      <tab-item label="Documents">Document Tab2</tab-item>
    </tabs>
  </div>
</div>

```
:::

### Layout

::: demo
<summary>
  #### layout
  * Position of tabs,accepted value: `left / right / bottom / top`
</summary>

```html
<div class="columns">
  <div class="column">
    <tabs layout="left">
      <tab-item label="Pictures">Pictures Tab</tab-item>
      <tab-item label="Music">Music Tab</tab-item>
      <tab-item label="Videos">Video Tab</tab-item>
      <tab-item label="Documents">Document Tab2</tab-item>
    </tabs>
  </div>

  <div class="column">
    <tabs layout="right">
      <tab-item label="Pictures">Pictures Tab</tab-item>
      <tab-item label="Music">Music Tab</tab-item>
      <tab-item label="Videos">Video Tab</tab-item>
      <tab-item label="Document">Document Tab2</tab-item>
    </tabs>
  </div>
</div>
<hr>
<div class="columns">
  <div class="column">
    <tabs layout="bottom">
      <tab-item label="Pictures">Pictures Tab</tab-item>
      <tab-item label="Music">Music Tab</tab-item>
      <tab-item label="Videos">Video Tab</tab-item>
      <tab-item label="Documents">Document Tab2</tab-item>
    </tabs>
  </div>
</div>

```
:::

### Active,Disabled and Callback

::: demo
<summary>
  #### advanced
  * Sets default actived tabItem's key by `active-index`
  * TabItem can be disabled
  * Sets callback when tab is clicked by `on-tab-click`
</summary>

```html
<div class="columns">
  <div class="column">
    <tabs :active-index="2">
      <tab-item label="Pictures">Pictures Tab</tab-item>
      <tab-item label="Music">Music Tab</tab-item>
      <tab-item label="Videos">Video Tab</tab-item>
      <tab-item label="Documents">Document Tab2</tab-item>
    </tabs>
  </div>

  <div class="column">
    <tabs>
      <tab-item label="Pictures">Pictures Tab</tab-item>
      <tab-item label="Music" disabled>Music Tab</tab-item>
      <tab-item label="Videos">Video Tab</tab-item>
      <tab-item label="Document">Document Tab2</tab-item>
    </tabs>
  </div>
</div>
<hr>
<div class="columns">
  <div class="column">
    <tabs :on-tab-click="tabCallback">
      <tab-item label="Pictures">Pictures Tab</tab-item>
      <tab-item label="Music">Music Tab</tab-item>
      <tab-item label="Videos">Video Tab</tab-item>
      <tab-item label="Documents">Document Tab2</tab-item>
    </tabs>
  </div>
</div>

```
:::

### API

#### Tabs

| Properties        | Description           | Type        | Default       |
|------------|----------------|--------------------|--------------|
| type | different style of tab,accepted value: `boxed / toggle` and default  | String | - |
| is-full-width  | whether the tab takes up the whole width (100%)  | Boolean | false    |
| layout | Position of tabs,accepted value: `left / right / bottom / top`  | String | top |
| size | size of tab,accepted value: `small / large` | String | - |
| alignment | alignment accepted value:`left / right` | String | left   |
| active-index | default actived tabItem's key(count from 0)  | Number | 0   |
| on-tab-click | Callback when tab is switched	  | Function | -   |

#### TabItem

| Properties        | Description           | Type        | Default       |
|------------|----------------|--------------------|--------------|
| icon | icon of tab item  | String | - |
| label  | title of tab item  | String(`required`) | -  |

<script>
export default {
  methods: {
    tabCallback(index) {
      this.$notify.info({
        content: `opening index: ${index + 1} `,
      });
    },
  },
};
</script>


text:
/*jslint node:true, vars:true, bitwise:true, unparam:true */
/*jshint unused:true */

/*
 * Author: Jon Trulson <jtrulson@ics.com>
 * Copyright (c) 2015 Intel Corporation.
 *
 * Permission is hereby granted, free of charge, to any person obtaining
 * a copy of this software and associated documentation files (the
 * "Software"), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish,
 * distribute, sublicense, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject to
 * the following conditions:
 *
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

var barometerObj = require('jsupm_hp20x');

// Instantiate an HP20X on default I2C bus and address
var bar = new barometerObj.HP20X();

// Initialize the device with default values
bar.init();

// Output data every second until interrupted
setInterval(function()
{
    console.log("Temperature: " + bar.getTemperature() + " Celcius");
    console.log("Pressure:    " + bar.getPressure() + " Millibars");
    console.log("Altitude:    " + bar.getAltitude() + " Meters");
    console.log("");
}, 1000);

// exit on ^C
process.on('SIGINT', function()
{
    bar = null;
    barometerObj.cleanUp();
    barometerObj = null;
    console.log("Exiting.");
    process.exit(0);
});


text:
<?php
namespace Notice;

class Controller_Api extends \Controller_Site_Api
{
	protected $check_not_auth_action = array();

	public function before()
	{
		parent::before();
	}

	/**
	 * Get notice list
	 *
	 * @access  public
	 * @return  Response (json)
	 * @throws  Exception in Controller_Base::controller_common_api
	 * @see  Controller_Base::controller_common_api
	 */
	public function get_list()
	{
		$this->controller_common_api(function()
		{
			list($limit, $page) = $this->common_get_pager_list_params(\Config::get('notice.articles.limit'), \Config::get('notice.articles.limit_max'));
			$data = Model_NoticeStatus::get_pager_list4member_id($this->u->id, $limit, $page);
			$list_array = array();
			foreach ($data['list'] as $key => $obj)
			{
				$list_array[] = Site_Model::convert_notice_status_to_array_for_view($obj, $this->u->id);
			}
			// json response
			$data['list'] = $list_array;
			$data['is_detail'] = (bool)\Input::get('is_detail', 0);
			$this->set_response_body_api($data);
		});
	}

	/**
	 * Update watch status
	 *
	 * @access  public
	 * @param   string  $foreign_table  target related table
	 * @param   int     $foreign_id  target related table id
	 * @return  Response (json)
	 * @throws  Exception in Controller_Base::controller_common_api
	 * @see  Controller_Base::controller_common_api
	 */
	public function post_update_watch_status($foreign_table = null, $foreign_id = null)
	{
		$this->controller_common_api(function() use($foreign_table, $foreign_id)
		{
			if (!is_enabled('notice')) throw new \HttpNotFoundException();
			if (\Input::post('foreign_table')) $foreign_table = \Input::post('foreign_table');
			$foreign_id = intval(\Input::post('foreign_id') ?: $foreign_id);
			if (!$foreign_table || !$foreign_id) throw new \HttpNotFoundException();
			if (!in_array($foreign_table, Site_Util::get_accept_foreign_tables())) throw new \HttpNotFoundException();

			$this->response_body['errors']['message_default'] = __('message_change_failed_for', array(
				'label' => t('common.status_of_simple', array('label' => t('form.watch'))),
			));
			$model = \Site_Model::get_model_name($foreign_table);
			$foreign_obj = $model::check_authority($foreign_id);
			$member_id = ($foreign_table == 'album_image') ? $foreign_obj->album->member_id : $foreign_obj->member_id;
			$this->check_browse_authority($foreign_obj->public_flag, $member_id);
			if ($member_id == $this->u->id) throw new \HttpBadRequestException;

			\DB::start_transaction();
			$is_registerd = (bool)Model_MemberWatchContent::change_registered_status4unique_key(array(
				'foreign_table' => $foreign_table,
				'foreign_id' => $foreign_id,
				'member_id' => $this->u->id
			));
			\DB::commit_transaction();

			$data = array(
				'result' => $is_registerd,
				'message' => $is_registerd ? __('notice_add_watch_list') : __('notice_remove_watch_list'),
				'html' => icon_label($is_registerd ? 'form.do_unwatch' : 'form.do_watch', 'both', false),
			);
			$this->set_response_body_api($data);
		});
	}

	/**
	 * Update status already read all
	 *
	 * @access  public
	 * @return  Response (json)
	 * @throws  Exception in Controller_Base::controller_common_api
	 * @see  Controller_Base::controller_common_api
	 */
	public function post_read_all()
	{
		$this->controller_common_api(function()
		{
			if (!is_enabled('notice')) throw new \HttpNotFoundException();

			\DB::start_transaction();
			$updated_count = \Notice\Site_Util::change_all_status2read4member_id($this->u->id);
			\DB::commit_transaction();

			$data = array(
				'result' => (bool)$updated_count,
				'updated_count' => $updated_count,
			);
			$this->set_response_body_api($data);
		});
	}
}


text:
{% load staticfiles %}

     Dashboards

Dashboard v.1

Dashboard v.2

Dashboard v.3

Dashboard v.4

Dashboard v.5 NEW

     Layouts

     Graphs

Flot Charts

Morris.js Charts

Rickshaw Charts

Chart.js

Chartist

Peity Charts

Sparkline Charts

     Mailbox 16/24

Inbox

Email view

Compose email

Email templates

     Metrics

     Widgets

     Forms

Basic form

Advanced Plugins

Wizard

File Upload

Text Editor

     App Views SPECIAL

Contacts

Profile

Profile v.2

Contacts v.2

Projects

Project detail

Teams board

Social feed

Clients

Outlook view

Vote list

File manager

Calendar

Issue tracker

Blog

Article

FAQ

Timeline

Pin board

     Other Pages

Search results

Lockscreen

Invoice

Login

Login v.2

Forget password

Register

404 Page

500 Page

Empty page

     MiscellaneousNEW

Notification

Nestable list

Agile board

Timeline v.2

Diff

Sweet alert

Idle timer

Spinners

Live favicon

Google maps

Code editor

Modal window

Forum view

Validation

Tree view

Chat view

Masonry

     UI Elements

Typography

Icons

Draggable Panels

Buttons

Video

Panels

Tabs

Notifications & Tooltips

Badges, Labels, Progress

     Grid options

     Tables

Static Tables

Data Tables

Foo Tables

jqGrid

     E-commerce

Products grid

Products list

Product edit

Product detail

Orders

Credit Card form

     Gallery

Lightbox Gallery

Slick Carousel

Bootstrap Carousel

     Menu Levels

            Third Level

                    Third Level Item

                    Third Level Item

                    Third Level Item

Second Level Item

            Second Level Item

            Second Level Item

     CSS Animations 62

        Landing Page NEW

     Package


text:
cd /home/www-data/yii2adm
targetDir=`pwd`

if [ ! -d "$targetDir/git-src" ];then
    mkdir "$targetDir/git-src"
fi
if [ ! -d "$targetDir/src" ];then
    mkdir "$targetDir/src"
fi

tar -xzf ./deploy/package.tgz  -C ./git-src

mv ./git-src/open* ./git-src/src

cp -r ./git-src/src/* ./src/

rm -rf ./git-src/src

cd src

php init --env=Production  --overwrite=y

cd ../

if [ ! -f "./composer.json" ];then

    cd src
    #认为是第一次执行部署
    composer global require "fxp/composer-asset-plugin:^1.2.0"
    composer -vvv update
    #执行数据导入操作
    ./yii migrate/up --interactive=0
    cp composer.json ../
    cd ..
else
   echo "diff composer.json  src/composer.json ..."
   rs=`diff composer.json  src/composer.json`
   if [ "$rs" ];then
       #认为composer.json有变动需要 update
       echo "must composer update"
       cd src
       composer -vvv update
       cp composer.json ../
       cd ..
   else
       echo "not need to composer"
   fi
fi

echo "deploy completely!!! "


text:
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">
    <id>zip</id>
    <formats>
        <format>zip</format>
    </formats>
    <includeBaseDirectory>false</includeBaseDirectory>
    <dependencySets>
        <dependencySet>
            <outputDirectory>lib</outputDirectory>
            <useProjectArtifact>true</useProjectArtifact>
            <scope>runtime</scope>
        </dependencySet>
    </dependencySets>

    <fileSets>
        <fileSet>
            <directory>src/main/bin</directory>
            <outputDirectory>bin</outputDirectory>
            <lineEnding>unix</lineEnding>
            <fileMode>0755</fileMode>
        </fileSet>
    </fileSets>
</assembly>


text:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<feed><tipo>Rua</tipo><logradouro>das Crônicas</logradouro><bairro>Canaã</bairro><cidade>Ipatinga</cidade><uf>MG</uf><cep>35164148</cep></feed>


text:
using WebKit::WebRuntimeFeatures;

namespace content {

static base::LazyInstance<base::ThreadLocalPointer<WorkerThread> > lazy_tls =
    LAZY_INSTANCE_INITIALIZER;

WorkerThread::WorkerThread() {
  lazy_tls.Pointer()->Set(this);
  webkit_platform_support_.reset(
      new WorkerWebKitPlatformSupportImpl(thread_safe_sender()));
  WebKit::initialize(webkit_platform_support_.get());
  WebKit::setIDBFactory(
      webkit_platform_support_.get()->idbFactory());

  appcache_dispatcher_.reset(new AppCacheDispatcher(this));

  web_database_observer_impl_.reset(
      new WebDatabaseObserverImpl(sync_message_filter()));
  WebKit::WebDatabase::setObserver(web_database_observer_impl_.get());
  db_message_filter_ = new DBMessageFilter();
  channel()->AddFilter(db_message_filter_.get());

  indexed_db_message_filter_ = new IndexedDBMessageFilter;
  channel()->AddFilter(indexed_db_message_filter_.get());

  const CommandLine& command_line = *CommandLine::ForCurrentProcess();

  webkit_glue::EnableWebCoreLogChannels(
      command_line.GetSwitchValueASCII(switches::kWebCoreLogChannels));

  WebKit::WebRuntimeFeatures::enableDatabase(
      !command_line.HasSwitch(switches::kDisableDatabases));

  WebKit::WebRuntimeFeatures::enableApplicationCache(
      !command_line.HasSwitch(switches::kDisableApplicationCache));

#if defined(OS_WIN)
  // We don't yet support notifications on non-Windows, so hide it from pages.
  WebRuntimeFeatures::enableNotifications(
      !command_line.HasSwitch(switches::kDisableDesktopNotifications));
#endif

  WebRuntimeFeatures::enableFileSystem(
      !command_line.HasSwitch(switches::kDisableFileSystem));

  WebRuntimeFeatures::enableIndexedDatabase(true);
}

WorkerThread::~WorkerThread() {
}

void WorkerThread::Shutdown() {
  // Shutdown in reverse of the initialization order.
  channel()->RemoveFilter(indexed_db_message_filter_.get());
  indexed_db_message_filter_ = NULL;

  channel()->RemoveFilter(db_message_filter_.get());
  db_message_filter_ = NULL;

  WebKit::shutdown();
  lazy_tls.Pointer()->Set(NULL);
}

WorkerThread* WorkerThread::current() {
  return lazy_tls.Pointer()->Get();
}

bool WorkerThread::OnControlMessageReceived(const IPC::Message& msg) {
  // Appcache messages are handled by a delegate.
  if (appcache_dispatcher_->OnMessageReceived(msg))
    return true;

  bool handled = true;
  IPC_BEGIN_MESSAGE_MAP(WorkerThread, msg)
    IPC_MESSAGE_HANDLER(WorkerProcessMsg_CreateWorker, OnCreateWorker)
    IPC_MESSAGE_UNHANDLED(handled = false)
  IPC_END_MESSAGE_MAP()
  return handled;
}

void WorkerThread::OnCreateWorker(
    const WorkerProcessMsg_CreateWorker_Params& params) {
  WorkerAppCacheInitInfo appcache_init_info(
      params.creator_process_id,
      params.shared_worker_appcache_id);

  // WebSharedWorkerStub own themselves.
  new WebSharedWorkerStub(params.name, params.route_id, appcache_init_info);
}

// The browser process is likely dead. Terminate all workers.
void WorkerThread::OnChannelError() {
  set_on_channel_error_called(true);

  for (WorkerStubsList::iterator it = worker_stubs_.begin();
       it != worker_stubs_.end(); ++it) {
    (*it)->OnChannelError();
  }
}

void WorkerThread::RemoveWorkerStub(WebSharedWorkerStub* stub) {
  worker_stubs_.erase(stub);
}

void WorkerThread::AddWorkerStub(WebSharedWorkerStub* stub) {
  worker_stubs_.insert(stub);
}

}  // namespace content


text:
name: Feature
about: Suggest an idea
title: ''
labels: ''
assignees: ''
---

<!--
  ⚠ WARNING

  Half of all issues created do not contain enough information to help or are
  not appropriate for the issue tracker (i.e. one-line questions). If you would
  like to suggest a feature, follow the steps outlined below closely. Any issue
  that does not meet these conditions may be closed unnoticed.

  Why? Because the maintainers of this project are wasting a lot of time
  answering questions that are not directly related to this project.

  Make sure that your request fulfills all of the following requirements
-->

__I checked that...__

- [ ] ... the documentation does not mention anything about my idea
- [ ] ... to my best knowledge, my idea wouldn't break something for other users
- [ ] ... there are no open or closed issues that are related to my idea

## Description

<!-- Please provide a brief description of the feature -->

### Use Cases

<!-- Please describe how your suggestion would benefit you and other users -->

### Screenshots / Mockups

<!-- If applicable, provide some mockups or screenshots -->


text:
package org.apache.camel.test.infra.hashicorp.vault.common;

public final class HashicorpVaultProperties {
    public static final String HASHICORP_VAULT_CONTAINER = "hashicorp.vault.container";
    public static final String HASHICORP_VAULT_ADDRESS = "hashicorp.vault.address";
    public static final String HASHICORP_VAULT_HOST = "hashicorp.vault.host";
    public static final String HASHICORP_VAULT_PORT = "hashicorp.vault.port";
    public static final String HASHICORP_VAULT_TOKEN = "hashicorp.vault.token";
    public static final int DEFAULT_SERVICE_PORT = 8200;

    private HashicorpVaultProperties() {

    }
}


text:
package db

const TimeFormat = ""

// Option allows extra configuration for instantiating Roach. Use the With...
// functions to set options e.g.
//     nameOpt := WithDBName("my_app_db")
type Option func(*Roach)

// WithDSN sets the DSN to be used by Roach.
func WithDSN(dsn string) Option {
	return func(r *Roach) {
		r.dsn = dsn
	}
}

// WithDBName sets the name of the cockroach database to be used by Roach.
func WithDBName(db string) Option {
	return func(r *Roach) {
		r.dbName = db
	}
}


text:
module HaskellRoguelike.Entity
    (
     module HaskellRoguelike.Entity,
     module HaskellRoguelike.EntityType
    ) where

    import Control.Monad.Trans
    import Control.Monad.State

    import HaskellRoguelike.Action
    import HaskellRoguelike.State
    import HaskellRoguelike.Symbol
    import HaskellRoguelike.EntityType
    import HaskellRoguelike.LevelType

    blankEntity :: Entity Level
    blankEntity = Entity 0 (0,0) BlankEntity Small NoAI

    getAction :: AI -> Level -> RoguelikeM (Entity Level) Action
    getAction a l = case a of
                      NoAI -> return None
                      PlayerAI -> getPlayerAction l

    getPlayerAction :: Level -> RoguelikeM (Entity Level) Action
    getPlayerAction _ =
        do s <- lift get
           let a = playerAction s
           lift (put s{playerAction = PlayerAction})
           return a

    makePlayer :: RoguelikeM s (Entity Level)
    makePlayer =
        do
          eid <- getEntityID
          return (Entity eid (0,0) Player Large PlayerAI)


text:
module Zip
  class DOSTime < Time #:nodoc:all
    # MS-DOS File Date and Time format as used in Interrupt 21H Function 57H:

    # Register CX, the Time:
    # Bits 0-4  2 second increments (0-29)
    # Bits 5-10 minutes (0-59)
    # bits 11-15 hours (0-24)

    # Register DX, the Date:
    # Bits 0-4 day (1-31)
    # bits 5-8 month (1-12)
    # bits 9-15 year (four digit year minus 1980)

    def to_binary_dos_time
      (sec / 2) +
        (min << 5) +
        (hour << 11)
    end

    def to_binary_dos_date
      day +
        (month << 5) +
        ((year - 1980) << 9)
    end

    # Dos time is only stored with two seconds accuracy
    def dos_equals(other)
      to_i / 2 == other.to_i / 2
    end

    # Create a DOSTime instance from a vanilla Time instance.
    def self.from_time(time)
      local(time.year, time.month, time.day, time.hour, time.min, time.sec)
    end

    def self.parse_binary_dos_format(binaryDosDate, binaryDosTime)
      second = 2 * (0b11111 & binaryDosTime)
      minute = (0b11111100000 & binaryDosTime) >> 5
      hour   = (0b1111100000000000 & binaryDosTime) >> 11
      day    = (0b11111 & binaryDosDate)
      month  = (0b111100000 & binaryDosDate) >> 5
      year   = ((0b1111111000000000 & binaryDosDate) >> 9) + 1980
      begin
        local(year, month, day, hour, minute, second)
      end
    end
  end
end

# Copyright (C) 2002, 2003 Thomas Sondergaard
# rubyzip is free software; you can redistribute it and/or
# modify it under the terms of the ruby license.


text:
class netlink {
 private:
    int family;
 protected:
    int net;
 public:
    netlink();
    ~netlink();

    int bind(struct addrinfo *hostaddr);
    int socket(int family);
    int connect(int debug, struct addrinfo *hostaddr,
		char *srcroute, int srlen,
		int tos);
    void close(int doshutdown);

    int setdebug(int debug);
    void oobinline();
    void nonblock(int onoff);

    int stilloob();

    int send(const char *buf, int len, int flags);

    int getfd();
};

extern netlink nlink;


text:
<?php

require_once 'Zend/Acl.php';
require_once 'Zend/Acl/Resource.php';
require_once 'Zend/Acl/Role.php';
require_once dirname(__FILE__) . '/_files/MockAssertion.php';

/**
 * @category   Zend
 * @package    Zend_Acl
 * @subpackage UnitTests
 * @group      Zend_Acl
 * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 */
class Zend_Acl_AclTest extends PHPUnit_Framework_TestCase
{
    /**
     * ACL object for each test method
     *
     * @var Zend_Acl
     */
    protected $_acl;

    /**
     * Instantiates a new ACL object and creates internal reference to it for each test method
     *
     * @return void
     */
    public function setUp()
    {
        $this->_acl = new Zend_Acl();
    }

    /**
     * Ensures that basic addition and retrieval of a single Role works
     *
     * @return void
     */
    public function testRoleRegistryAddAndGetOne()
    {
        $roleGuest = new Zend_Acl_Role('guest');

        $role = $this->_acl->addRole($roleGuest)
                          ->getRole($roleGuest->getRoleId());
        $this->assertTrue($roleGuest === $role);
        $role = $this->_acl->getRole($roleGuest);
        $this->assertTrue($roleGuest === $role);
    }

    /**
     * Ensures that basic addition and retrieval of a single Resource works
     */
    public function testRoleAddAndGetOneByString()
    {
        $role = $this->_acl->addRole('area')
                          ->getRole('area');
        $this->assertTrue($role instanceof Zend_Acl_Role);
        $this->assertEquals('area', $role->getRoleId());
    }

    /**
     * Ensures that basic removal of a single Role works
     *
     * @return void
     */
    public function testRoleRegistryRemoveOne()
    {
        $roleGuest = new Zend_Acl_Role('guest');
        $this->_acl->addRole($roleGuest)
                   ->removeRole($roleGuest);
        $this->assertFalse($this->_acl->hasRole($roleGuest));
    }

    /**
     * Ensures that an exception is thrown when a non-existent Role is specified for removal
     *
     * @return void
     */
    public function testRoleRegistryRemoveOneNonExistent()
    {
        try {
            $this->_acl->removeRole('nonexistent');
            $this->fail('Expected Zend_Acl_Role_Registry_Exception not thrown upon removing a non-existent Role');
        } catch (Zend_Acl_Role_Registry_Exception $e) {
            $this->assertContains('not found', $e->getMessage());
        }
    }

    /**
     * Ensures that removal of all Roles works
     *
     * @return void
     */
    public function testRoleRegistryRemoveAll()
    {
        $roleGuest = new Zend_Acl_Role('guest');
        $this->_acl->addRole($roleGuest)
                   ->removeRoleAll();
        $this->assertFalse($this->_acl->hasRole($roleGuest));
    }

    /**
     * Ensures that an exception is thrown when a non-existent Role is specified as a parent upon Role addition
     *
     * @return void
     */
    public function testRoleRegistryAddInheritsNonExistent()
    {
        try {
            $this->_acl->addRole(new Zend_Acl_Role('guest'), 'nonexistent');
            $this->fail('Expected Zend_Acl_Role_Registry_Exception not thrown upon specifying a non-existent parent');
        } catch (Zend_Acl_Role_Registry_Exception $e) {
            $this->assertContains('does not exist', $e->getMessage());
        }
    }

    /**
     * Ensures that an exception is thrown when a non-existent Role is specified to each parameter of inherits()
     *
     * @return void
     */
    public function testRoleRegistryInheritsNonExistent()
    {
        $roleGuest = new Zend_Acl_Role('guest');
        $this->_acl->addRole($roleGuest);
        try {
            $this->_acl->inheritsRole('nonexistent', $roleGuest);
            $this->fail('Expected Zend_Acl_Role_Registry_Exception not thrown upon specifying a non-existent child Role');
        } catch (Zend_Acl_Role_Registry_Exception $e) {
            $this->assertContains('not found', $e->getMessage());
        }
        try {
            $this->_acl->inheritsRole($roleGuest, 'nonexistent');
            $this->fail('Expected Zend_Acl_Role_Registry_Exception not thrown upon specifying a non-existent parent Role');
        } catch (Zend_Acl_Role_Registry_Exception $e) {
            $this->assertContains('not found', $e->getMessage());
        }
    }

    /**
     * Tests basic Role inheritance
     *
     * @return void
     */
    public function testRoleRegistryInherits()
    {
        $roleGuest  = new Zend_Acl_Role('guest');
        $roleMember = new Zend_Acl_Role('member');
        $roleEditor = new Zend_Acl_Role('editor');
        $roleRegistry = new Zend_Acl_Role_Registry();
        $roleRegistry->add($roleGuest)
                    ->add($roleMember, $roleGuest->getRoleId())
                    ->add($roleEditor, $roleMember);
        $this->assertTrue(0 === count($roleRegistry->getParents($roleGuest)));
        $roleMemberParents = $roleRegistry->getParents($roleMember);
        $this->assertTrue(1 === count($roleMemberParents));
        $this->assertTrue(isset($roleMemberParents['guest']));
        $roleEditorParents = $roleRegistry->getParents($roleEditor);
        $this->assertTrue(1 === count($roleEditorParents));
        $this->assertTrue(isset($roleEditorParents['member']));
        $this->assertTrue($roleRegistry->inherits($roleMember, $roleGuest, true));
        $this->assertTrue($roleRegistry->inherits($roleEditor, $roleMember, true));
        $this->assertTrue($roleRegistry->inherits($roleEditor, $roleGuest));
        $this->assertFalse($roleRegistry->inherits($roleGuest, $roleMember));
        $this->assertFalse($roleRegistry->inherits($roleMember, $roleEditor));
        $this->assertFalse($roleRegistry->inherits($roleGuest, $roleEditor));
        $roleRegistry->remove($roleMember);
        $this->assertTrue(0 === count($roleRegistry->getParents($roleEditor)));
        $this->assertFalse($roleRegistry->inherits($roleEditor, $roleGuest));
    }

    /**
     * Tests basic Role multiple inheritance
     *
     * @return void
     */
    public function testRoleRegistryInheritsMultiple()
    {
        $roleParent1 = new Zend_Acl_Role('parent1');
        $roleParent2 = new Zend_Acl_Role('parent2');
        $roleChild   = new Zend_Acl_Role('child');
        $roleRegistry = new Zend_Acl_Role_Registry();
        $roleRegistry->add($roleParent1)
                    ->add($roleParent2)
                    ->add($roleChild, array($roleParent1, $roleParent2));
        $roleChildParents = $roleRegistry->getParents($roleChild);
        $this->assertTrue(2 === count($roleChildParents));
        $i = 1;
        foreach ($roleChildParents as $roleParentId => $roleParent) {
            $this->assertTrue("parent$i" === $roleParentId);
            $i++;
        }
        $this->assertTrue($roleRegistry->inherits($roleChild, $roleParent1));
        $this->assertTrue($roleRegistry->inherits($roleChild, $roleParent2));
        $roleRegistry->remove($roleParent1);
        $roleChildParents = $roleRegistry->getParents($roleChild);
        $this->assertTrue(1 === count($roleChildParents));
        $this->assertTrue(isset($roleChildParents['parent2']));
        $this->assertTrue($roleRegistry->inherits($roleChild, $roleParent2));
    }

    /**
     * Ensures that the same Role cannot be registered more than once to the registry
     *
     * @return void
     */
    public function testRoleRegistryDuplicate()
    {
        $roleGuest = new Zend_Acl_Role('guest');
        $roleRegistry = new Zend_Acl_Role_Registry();
        try {
            $roleRegistry->add($roleGuest)
                        ->add($roleGuest);
            $this->fail('Expected exception not thrown upon adding same Role twice');
        } catch (Zend_Acl_Role_Registry_Exception $e) {
            $this->assertContains('already exists', $e->getMessage());
        }
    }

    /**
     * Ensures that two Roles having the same ID cannot be registered
     *
     * @return void
     */
    public function testRoleRegistryDuplicateId()
    {
        $roleGuest1 = new Zend_Acl_Role('guest');
        $roleGuest2 = new Zend_Acl_Role('guest');
        $roleRegistry = new Zend_Acl_Role_Registry();
        try {
            $roleRegistry->add($roleGuest1)
                        ->add($roleGuest2);
            $this->fail('Expected exception not thrown upon adding two Roles with same ID');
        } catch (Zend_Acl_Role_Registry_Exception $e) {
            $this->assertContains('already exists', $e->getMessage());
        }
    }

    /**
     * Ensures that basic addition and retrieval of a single Resource works
     *
     * @return void
     */
    public function testResourceAddAndGetOne()
    {
        $resourceArea = new Zend_Acl_Resource('area');
        $resource = $this->_acl->add($resourceArea)
                          ->get($resourceArea->getResourceId());
        $this->assertTrue($resourceArea === $resource);
        $resource = $this->_acl->get($resourceArea);
        $this->assertTrue($resourceArea === $resource);
    }

    /**
     * Ensures that basic addition and retrieval of a single Resource works
     */
    public function testResourceAddAndGetOneByString()
    {
        $resource = $this->_acl->addResource('area')
                          ->get('area');
        $this->assertTrue($resource instanceof Zend_Acl_Resource);
        $this->assertEquals('area', $resource->getResourceId());
    }

    /**
     * Ensures that basic addition and retrieval of a single Resource works
     *
     * @group ZF-1167
     */
    public function testResourceAddAndGetOneWithAddResourceMethod()
    {
        $resourceArea = new Zend_Acl_Resource('area');
        $resource = $this->_acl->addResource($resourceArea)
                          ->get($resourceArea->getResourceId());
        $this->assertTrue($resourceArea === $resource);
        $resource = $this->_acl->get($resourceArea);
        $this->assertTrue($resourceArea === $resource);
    }

    /**
     * Ensures that basic removal of a single Resource works
     *
     * @return void
     */
    public function testResourceRemoveOne()
    {
        $resourceArea = new Zend_Acl_Resource('area');
        $this->_acl->add($resourceArea)
                   ->remove($resourceArea);
        $this->assertFalse($this->_acl->has($resourceArea));
    }

    /**
     * Ensures that an exception is thrown when a non-existent Resource is specified for removal
     *
     * @return void
     */
    public function testResourceRemoveOneNonExistent()
    {
        try {
            $this->_acl->remove('nonexistent');
            $this->fail('Expected Zend_Acl_Exception not thrown upon removing a non-existent Resource');
        } catch (Zend_Acl_Exception $e) {
            $this->assertContains('not found', $e->getMessage());
        }
    }

    /**
     * Ensures that removal of all Resources works
     *
     * @return void
     */
    public function testResourceRemoveAll()
    {
        $resourceArea = new Zend_Acl_Resource('area');
        $this->_acl->add($resourceArea)
                   ->removeAll();
        $this->assertFalse($this->_acl->has($resourceArea));
    }

    /**
     * Ensures that an exception is thrown when a non-existent Resource is specified as a parent upon Resource addition
     *
     * @return void
     */
    public function testResourceAddInheritsNonExistent()
    {
        try {
            $this->_acl->add(new Zend_Acl_Resource('area'), 'nonexistent');
            $this->fail('Expected Zend_Acl_Exception not thrown upon specifying a non-existent parent');
        } catch (Zend_Acl_Exception $e) {
            $this->assertContains('does not exist', $e->getMessage());
        }
    }

    /**
     * Ensures that an exception is thrown when a non-existent Resource is specified to each parameter of inherits()
     *
     * @return void
     */
    public function testResourceInheritsNonExistent()
    {
        $resourceArea = new Zend_Acl_Resource('area');
        $this->_acl->add($resourceArea);
        try {
            $this->_acl->inherits('nonexistent', $resourceArea);
            $this->fail('Expected Zend_Acl_Exception not thrown upon specifying a non-existent child Resource');
        } catch (Zend_Acl_Exception $e) {
            $this->assertContains('not found', $e->getMessage());
        }
        try {
            $this->_acl->inherits($resourceArea, 'nonexistent');
            $this->fail('Expected Zend_Acl_Exception not thrown upon specifying a non-existent parent Resource');
        } catch (Zend_Acl_Exception $e) {
            $this->assertContains('not found', $e->getMessage());
        }
    }

    /**
     * Tests basic Resource inheritance
     *
     * @return void
     */
    public function testResourceInherits()
    {
        $resourceCity     = new Zend_Acl_Resource('city');
        $resourceBuilding = new Zend_Acl_Resource('building');
        $resourceRoom     = new Zend_Acl_Resource('room');
        $this->_acl->add($resourceCity)
                   ->add($resourceBuilding, $resourceCity->getResourceId())
                   ->add($resourceRoom, $resourceBuilding);
        $this->assertTrue($this->_acl->inherits($resourceBuilding, $resourceCity, true));
        $this->assertTrue($this->_acl->inherits($resourceRoom, $resourceBuilding, true));
        $this->assertTrue($this->_acl->inherits($resourceRoom, $resourceCity));
        $this->assertFalse($this->_acl->inherits($resourceCity, $resourceBuilding));
        $this->assertFalse($this->_acl->inherits($resourceBuilding, $resourceRoom));
        $this->assertFalse($this->_acl->inherits($resourceCity, $resourceRoom));
        $this->_acl->remove($resourceBuilding);
        $this->assertFalse($this->_acl->has($resourceRoom));
    }

    /**
     * Ensures that the same Resource cannot be added more than once
     *
     * @return void
     */
    public function testResourceDuplicate()
    {
        try {
            $resourceArea = new Zend_Acl_Resource('area');
            $this->_acl->add($resourceArea)
                       ->add($resourceArea);
            $this->fail('Expected exception not thrown upon adding same Resource twice');
        } catch (Zend_Acl_Exception $e) {
            $this->assertContains('already exists', $e->getMessage());
        }
    }

    /**
     * Ensures that two Resources having the same ID cannot be added
     *
     * @return void
     */
    public function testResourceDuplicateId()
    {
        try {
            $resourceArea1 = new Zend_Acl_Resource('area');
            $resourceArea2 = new Zend_Acl_Resource('area');
            $this->_acl->add($resourceArea1)
                       ->add($resourceArea2);
            $this->fail('Expected exception not thrown upon adding two Resources with same ID');
        } catch (Zend_Acl_Exception $e) {
            $this->assertContains('already exists', $e->getMessage());
        }
    }

    /**
     * Ensures that an exception is thrown when a non-existent Role and Resource parameters are specified to isAllowed()
     *
     * @return void
     */
    public function testIsAllowedNonExistent()
    {
        try {
            $this->_acl->isAllowed('nonexistent');
            $this->fail('Expected Zend_Acl_Role_Registry_Exception not thrown upon non-existent Role');
        } catch (Zend_Acl_Role_Registry_Exception $e) {
            $this->assertContains('not found', $e->getMessage());
        }
        try {
            $this->_acl->isAllowed(null, 'nonexistent');
            $this->fail('Expected Zend_Acl_Exception not thrown upon non-existent Resource');
        } catch (Zend_Acl_Exception $e) {
            $this->assertContains('not found', $e->getMessage());
        }
    }

    /**
     * Ensures that by default, Zend_Acl denies access to everything by all
     *
     * @return void
     */
    public function testDefaultDeny()
    {
        $this->assertFalse($this->_acl->isAllowed());
    }

    /**
     * Ensures that the default rule obeys its assertion
     *
     * @return void
     */
    public function testDefaultAssert()
    {
        $this->_acl->deny(null, null, null, new Zend_Acl_MockAssertion(false));
        $this->assertTrue($this->_acl->isAllowed());
        $this->assertTrue($this->_acl->isAllowed(null, null, 'somePrivilege'));
    }

    /**
     * Ensures that ACL-wide rules (all Roles, Resources, and privileges) work properly
     *
     * @return void
     */
    public function testDefaultRuleSet()
    {
        $this->_acl->allow();
        $this->assertTrue($this->_acl->isAllowed());
        $this->_acl->deny();
        $this->assertFalse($this->_acl->isAllowed());
    }

    /**
     * Ensures that by default, Zend_Acl denies access to a privilege on anything by all
     *
     * @return void
     */
    public function testDefaultPrivilegeDeny()
    {
        $this->assertFalse($this->_acl->isAllowed(null, null, 'somePrivilege'));
    }

    /**
     * Ensures that ACL-wide rules apply to privileges
     *
     * @return void
     */
    public function testDefaultRuleSetPrivilege()
    {
        $this->_acl->allow();
        $this->assertTrue($this->_acl->isAllowed(null, null, 'somePrivilege'));
        $this->_acl->deny();
        $this->assertFalse($this->_acl->isAllowed(null, null, 'somePrivilege'));
    }

    /**
     * Ensures that a privilege allowed for all Roles upon all Resources works properly
     *
     * @return void
     */
    public function testPrivilegeAllow()
    {
        $this->_acl->allow(null, null, 'somePrivilege');
        $this->assertTrue($this->_acl->isAllowed(null, null, 'somePrivilege'));
    }

    /**
     * Ensures that a privilege denied for all Roles upon all Resources works properly
     *
     * @return void
     */
    public function testPrivilegeDeny()
    {
        $this->_acl->allow();
        $this->_acl->deny(null, null, 'somePrivilege');
        $this->assertFalse($this->_acl->isAllowed(null, null, 'somePrivilege'));
    }

    /**
     * Ensures that multiple privileges work properly
     *
     * @return void
     */
    public function testPrivileges()
    {
        $this->_acl->allow(null, null, array('p1', 'p2', 'p3'));
        $this->assertTrue($this->_acl->isAllowed(null, null, 'p1'));
        $this->assertTrue($this->_acl->isAllowed(null, null, 'p2'));
        $this->assertTrue($this->_acl->isAllowed(null, null, 'p3'));
        $this->assertFalse($this->_acl->isAllowed(null, null, 'p4'));
        $this->_acl->deny(null, null, 'p1');
        $this->assertFalse($this->_acl->isAllowed(null, null, 'p1'));
        $this->_acl->deny(null, null, array('p2', 'p3'));
        $this->assertFalse($this->_acl->isAllowed(null, null, 'p2'));
        $this->assertFalse($this->_acl->isAllowed(null, null, 'p3'));
    }

    /**
     * Ensures that assertions on privileges work properly
     *
     * @return void
     */
    public function testPrivilegeAssert()
    {
        $this->_acl->allow(null, null, 'somePrivilege', new Zend_Acl_MockAssertion(true));
        $this->assertTrue($this->_acl->isAllowed(null, null, 'somePrivilege'));
        $this->_acl->allow(null, null, 'somePrivilege', new Zend_Acl_MockAssertion(false));
        $this->assertFalse($this->_acl->isAllowed(null, null, 'somePrivilege'));
    }

    /**
     * Ensures that by default, Zend_Acl denies access to everything for a particular Role
     *
     * @return void
     */
    public function testRoleDefaultDeny()
    {
        $roleGuest = new Zend_Acl_Role('guest');
        $this->_acl->addRole($roleGuest);
        $this->assertFalse($this->_acl->isAllowed($roleGuest));
    }

    /**
     * Ensures that ACL-wide rules (all Resources and privileges) work properly for a particular Role
     *
     * @return void
     */
    public function testRoleDefaultRuleSet()
    {
        $roleGuest = new Zend_Acl_Role('guest');
        $this->_acl->addRole($roleGuest)
                   ->allow($roleGuest);
        $this->assertTrue($this->_acl->isAllowed($roleGuest));
        $this->_acl->deny($roleGuest);
        $this->assertFalse($this->_acl->isAllowed($roleGuest));
    }

    /**
     * Ensures that by default, Zend_Acl denies access to a privilege on anything for a particular Role
     *
     * @return void
     */
    public function testRoleDefaultPrivilegeDeny()
    {
        $roleGuest = new Zend_Acl_Role('guest');
        $this->_acl->addRole($roleGuest);
        $this->assertFalse($this->_acl->isAllowed($roleGuest, null, 'somePrivilege'));
    }

    /**
     * Ensures that ACL-wide rules apply to privileges for a particular Role
     *
     * @return void
     */
    public function testRoleDefaultRuleSetPrivilege()
    {
        $roleGuest = new Zend_Acl_Role('guest');
        $this->_acl->addRole($roleGuest)
                   ->allow($roleGuest);
        $this->assertTrue($this->_acl->isAllowed($roleGuest, null, 'somePrivilege'));
        $this->_acl->deny($roleGuest);
        $this->assertFalse($this->_acl->isAllowed($roleGuest, null, 'somePrivilege'));
    }

    /**
     * Ensures that a privilege allowed for a particular Role upon all Resources works properly
     *
     * @return void
     */
    public function testRolePrivilegeAllow()
    {
        $roleGuest = new Zend_Acl_Role('guest');
        $this->_acl->addRole($roleGuest)
                   ->allow($roleGuest, null, 'somePrivilege');
        $this->assertTrue($this->_acl->isAllowed($roleGuest, null, 'somePrivilege'));
    }

    /**
     * Ensures that a privilege denied for a particular Role upon all Resources works properly
     *
     * @return void
     */
    public function testRolePrivilegeDeny()
    {
        $roleGuest = new Zend_Acl_Role('guest');
        $this->_acl->addRole($roleGuest)
                   ->allow($roleGuest)
                   ->deny($roleGuest, null, 'somePrivilege');
        $this->assertFalse($this->_acl->isAllowed($roleGuest, null, 'somePrivilege'));
    }

    /**
     * Ensures that multiple privileges work properly for a particular Role
     *
     * @return void
     */
    public function testRolePrivileges()
    {
        $roleGuest = new Zend_Acl_Role('guest');
        $this->_acl->addRole($roleGuest)
                   ->allow($roleGuest, null, array('p1', 'p2', 'p3'));
        $this->assertTrue($this->_acl->isAllowed($roleGuest, null, 'p1'));
        $this->assertTrue($this->_acl->isAllowed($roleGuest, null, 'p2'));
        $this->assertTrue($this->_acl->isAllowed($roleGuest, null, 'p3'));
        $this->assertFalse($this->_acl->isAllowed($roleGuest, null, 'p4'));
        $this->_acl->deny($roleGuest, null, 'p1');
        $this->assertFalse($this->_acl->isAllowed($roleGuest, null, 'p1'));
        $this->_acl->deny($roleGuest, null, array('p2', 'p3'));
        $this->assertFalse($this->_acl->isAllowed($roleGuest, null, 'p2'));
        $this->assertFalse($this->_acl->isAllowed($roleGuest, null, 'p3'));
    }

    /**
     * Ensures that assertions on privileges work properly for a particular Role
     *
     * @return void
     */
    public function testRolePrivilegeAssert()
    {
        $roleGuest = new Zend_Acl_Role('guest');
        $this->_acl->addRole($roleGuest)
                   ->allow($roleGuest, null, 'somePrivilege', new Zend_Acl_MockAssertion(true));
        $this->assertTrue($this->_acl->isAllowed($roleGuest, null, 'somePrivilege'));
        $this->_acl->allow($roleGuest, null, 'somePrivilege', new Zend_Acl_MockAssertion(false));
        $this->assertFalse($this->_acl->isAllowed($roleGuest, null, 'somePrivilege'));
    }

    /**
     * Ensures that removing the default deny rule results in default deny rule
     *
     * @return void
     */
    public function testRemoveDefaultDeny()
    {
        $this->assertFalse($this->_acl->isAllowed());
        $this->_acl->removeDeny();
        $this->assertFalse($this->_acl->isAllowed());
    }

    /**
     * Ensures that removing the default deny rule results in assertion method being removed
     *
     * @return void
     */
    public function testRemoveDefaultDenyAssert()
    {
        $this->_acl->deny(null, null, null, new Zend_Acl_MockAssertion(false));
        $this->assertTrue($this->_acl->isAllowed());
        $this->_acl->removeDeny();
        $this->assertFalse($this->_acl->isAllowed());
    }

    /**
     * Ensures that removing the default allow rule results in default deny rule being assigned
     *
     * @return void
     */
    public function testRemoveDefaultAllow()
    {
        $this->_acl->allow();
        $this->assertTrue($this->_acl->isAllowed());
        $this->_acl->removeAllow();
        $this->assertFalse($this->_acl->isAllowed());
    }

    /**
     * Ensures that removing non-existent default allow rule does nothing
     *
     * @return void
     */
    public function testRemoveDefaultAllowNonExistent()
    {
        $this->_acl->removeAllow();
        $this->assertFalse($this->_acl->isAllowed());
    }

    /**
     * Ensures that removing non-existent default deny rule does nothing
     *
     * @return void
     */
    public function testRemoveDefaultDenyNonExistent()
    {
        $this->_acl->allow()
                   ->removeDeny();
        $this->assertTrue($this->_acl->isAllowed());
    }

    /**
     * Ensures that for a particular Role, a deny rule on a specific Resource is honored before an allow rule
     * on the entire ACL
     *
     * @return void
     */
    public function testRoleDefaultAllowRuleWithResourceDenyRule()
    {
        $this->_acl->addRole(new Zend_Acl_Role('guest'))
                   ->addRole(new Zend_Acl_Role('staff'), 'guest')
                   ->add(new Zend_Acl_Resource('area1'))
                   ->add(new Zend_Acl_Resource('area2'))
                   ->deny()
                   ->allow('staff')
                   ->deny('staff', array('area1', 'area2'));
        $this->assertFalse($this->_acl->isAllowed('staff', 'area1'));
    }

    /**
     * Ensures that for a particular Role, a deny rule on a specific privilege is honored before an allow
     * rule on the entire ACL
     *
     * @return void
     */
    public function testRoleDefaultAllowRuleWithPrivilegeDenyRule()
    {
        $this->_acl->addRole(new Zend_Acl_Role('guest'))
                   ->addRole(new Zend_Acl_Role('staff'), 'guest')
                   ->deny()
                   ->allow('staff')
                   ->deny('staff', null, array('privilege1', 'privilege2'));
        $this->assertFalse($this->_acl->isAllowed('staff', null, 'privilege1'));
    }

    /**
     * Ensure that basic rule removal works
     *
     * @return void
     */
    public function testRulesRemove()
    {
        $this->_acl->allow(null, null, array('privilege1', 'privilege2'));
        $this->assertFalse($this->_acl->isAllowed());
        $this->assertTrue($this->_acl->isAllowed(null, null, 'privilege1'));
        $this->assertTrue($this->_acl->isAllowed(null, null, 'privilege2'));
        $this->_acl->removeAllow(null, null, 'privilege1');
        $this->assertFalse($this->_acl->isAllowed(null, null, 'privilege1'));
        $this->assertTrue($this->_acl->isAllowed(null, null, 'privilege2'));
    }

    /**
     * Ensures that removal of a Role results in its rules being removed
     *
     * @return void
     */
    public function testRuleRoleRemove()
    {
        $this->_acl->addRole(new Zend_Acl_Role('guest'))
                   ->allow('guest');
        $this->assertTrue($this->_acl->isAllowed('guest'));
        $this->_acl->removeRole('guest');
        try {
            $this->_acl->isAllowed('guest');
            $this->fail('Expected Zend_Acl_Role_Registry_Exception not thrown upon isAllowed() on non-existent Role');
        } catch (Zend_Acl_Role_Registry_Exception $e) {
            $this->assertContains('not found', $e->getMessage());
        }
        $this->_acl->addRole(new Zend_Acl_Role('guest'));
        $this->assertFalse($this->_acl->isAllowed('guest'));
    }

    /**
     * Ensures that removal of all Roles results in Role-specific rules being removed
     *
     * @return void
     */
    public function testRuleRoleRemoveAll()
    {
        $this->_acl->addRole(new Zend_Acl_Role('guest'))
                   ->allow('guest');
        $this->assertTrue($this->_acl->isAllowed('guest'));
        $this->_acl->removeRoleAll();
        try {
            $this->_acl->isAllowed('guest');
            $this->fail('Expected Zend_Acl_Role_Registry_Exception not thrown upon isAllowed() on non-existent Role');
        } catch (Zend_Acl_Role_Registry_Exception $e) {
            $this->assertContains('not found', $e->getMessage());
        }
        $this->_acl->addRole(new Zend_Acl_Role('guest'));
        $this->assertFalse($this->_acl->isAllowed('guest'));
    }

    /**
     * Ensures that removal of a Resource results in its rules being removed
     *
     * @return void
     */
    public function testRulesResourceRemove()
    {
        $this->_acl->add(new Zend_Acl_Resource('area'))
                   ->allow(null, 'area');
        $this->assertTrue($this->_acl->isAllowed(null, 'area'));
        $this->_acl->remove('area');
        try {
            $this->_acl->isAllowed(null, 'area');
            $this->fail('Expected Zend_Acl_Exception not thrown upon isAllowed() on non-existent Resource');
        } catch (Zend_Acl_Exception $e) {
            $this->assertContains('not found', $e->getMessage());
        }
        $this->_acl->add(new Zend_Acl_Resource('area'));
        $this->assertFalse($this->_acl->isAllowed(null, 'area'));
    }

    /**
     * Ensures that removal of all Resources results in Resource-specific rules being removed
     *
     * @return void
     */
    public function testRulesResourceRemoveAll()
    {
        $this->_acl->add(new Zend_Acl_Resource('area'))
                   ->allow(null, 'area');
        $this->assertTrue($this->_acl->isAllowed(null, 'area'));
        $this->_acl->removeAll();
        try {
            $this->_acl->isAllowed(null, 'area');
            $this->fail('Expected Zend_Acl_Exception not thrown upon isAllowed() on non-existent Resource');
        } catch (Zend_Acl_Exception $e) {
            $this->assertContains('not found', $e->getMessage());
        }
        $this->_acl->add(new Zend_Acl_Resource('area'));
        $this->assertFalse($this->_acl->isAllowed(null, 'area'));
    }

    /**
     * Ensures that an example for a content management system is operable
     *
     * @return void
     */
    public function testCMSExample()
    {
        // Add some roles to the Role registry
        $this->_acl->addRole(new Zend_Acl_Role('guest'))
                   ->addRole(new Zend_Acl_Role('staff'), 'guest')  // staff inherits permissions from guest
                   ->addRole(new Zend_Acl_Role('editor'), 'staff') // editor inherits permissions from staff
                   ->addRole(new Zend_Acl_Role('administrator'));

        // Guest may only view content
        $this->_acl->allow('guest', null, 'view');

        // Staff inherits view privilege from guest, but also needs additional privileges
        $this->_acl->allow('staff', null, array('edit', 'submit', 'revise'));

        // Editor inherits view, edit, submit, and revise privileges, but also needs additional privileges
        $this->_acl->allow('editor', null, array('publish', 'archive', 'delete'));

        // Administrator inherits nothing but is allowed all privileges
        $this->_acl->allow('administrator');

        // Access control checks based on above permission sets

        $this->assertTrue($this->_acl->isAllowed('guest', null, 'view'));
        $this->assertFalse($this->_acl->isAllowed('guest', null, 'edit'));
        $this->assertFalse($this->_acl->isAllowed('guest', null, 'submit'));
        $this->assertFalse($this->_acl->isAllowed('guest', null, 'revise'));
        $this->assertFalse($this->_acl->isAllowed('guest', null, 'publish'));
        $this->assertFalse($this->_acl->isAllowed('guest', null, 'archive'));
        $this->assertFalse($this->_acl->isAllowed('guest', null, 'delete'));
        $this->assertFalse($this->_acl->isAllowed('guest', null, 'unknown'));
        $this->assertFalse($this->_acl->isAllowed('guest'));

        $this->assertTrue($this->_acl->isAllowed('staff', null, 'view'));
        $this->assertTrue($this->_acl->isAllowed('staff', null, 'edit'));
        $this->assertTrue($this->_acl->isAllowed('staff', null, 'submit'));
        $this->assertTrue($this->_acl->isAllowed('staff', null, 'revise'));
        $this->assertFalse($this->_acl->isAllowed('staff', null, 'publish'));
        $this->assertFalse($this->_acl->isAllowed('staff', null, 'archive'));
        $this->assertFalse($this->_acl->isAllowed('staff', null, 'delete'));
        $this->assertFalse($this->_acl->isAllowed('staff', null, 'unknown'));
        $this->assertFalse($this->_acl->isAllowed('staff'));

        $this->assertTrue($this->_acl->isAllowed('editor', null, 'view'));
        $this->assertTrue($this->_acl->isAllowed('editor', null, 'edit'));
        $this->assertTrue($this->_acl->isAllowed('editor', null, 'submit'));
        $this->assertTrue($this->_acl->isAllowed('editor', null, 'revise'));
        $this->assertTrue($this->_acl->isAllowed('editor', null, 'publish'));
        $this->assertTrue($this->_acl->isAllowed('editor', null, 'archive'));
        $this->assertTrue($this->_acl->isAllowed('editor', null, 'delete'));
        $this->assertFalse($this->_acl->isAllowed('editor', null, 'unknown'));
        $this->assertFalse($this->_acl->isAllowed('editor'));

        $this->assertTrue($this->_acl->isAllowed('administrator', null, 'view'));
        $this->assertTrue($this->_acl->isAllowed('administrator', null, 'edit'));
        $this->assertTrue($this->_acl->isAllowed('administrator', null, 'submit'));
        $this->assertTrue($this->_acl->isAllowed('administrator', null, 'revise'));
        $this->assertTrue($this->_acl->isAllowed('administrator', null, 'publish'));
        $this->assertTrue($this->_acl->isAllowed('administrator', null, 'archive'));
        $this->assertTrue($this->_acl->isAllowed('administrator', null, 'delete'));
        $this->assertTrue($this->_acl->isAllowed('administrator', null, 'unknown'));
        $this->assertTrue($this->_acl->isAllowed('administrator'));

        // Some checks on specific areas, which inherit access controls from the root ACL node
        $this->_acl->add(new Zend_Acl_Resource('newsletter'))
                   ->add(new Zend_Acl_Resource('pending'), 'newsletter')
                   ->add(new Zend_Acl_Resource('gallery'))
                   ->add(new Zend_Acl_Resource('profiles', 'gallery'))
                   ->add(new Zend_Acl_Resource('config'))
                   ->add(new Zend_Acl_Resource('hosts'), 'config');
        $this->assertTrue($this->_acl->isAllowed('guest', 'pending', 'view'));
        $this->assertTrue($this->_acl->isAllowed('staff', 'profiles', 'revise'));
        $this->assertTrue($this->_acl->isAllowed('staff', 'pending', 'view'));
        $this->assertTrue($this->_acl->isAllowed('staff', 'pending', 'edit'));
        $this->assertFalse($this->_acl->isAllowed('staff', 'pending', 'publish'));
        $this->assertFalse($this->_acl->isAllowed('staff', 'pending'));
        $this->assertFalse($this->_acl->isAllowed('editor', 'hosts', 'unknown'));
        $this->assertTrue($this->_acl->isAllowed('administrator', 'pending'));

        // Add a new group, marketing, which bases its permissions on staff
        $this->_acl->addRole(new Zend_Acl_Role('marketing'), 'staff');

        // Refine the privilege sets for more specific needs

        // Allow marketing to publish and archive newsletters
        $this->_acl->allow('marketing', 'newsletter', array('publish', 'archive'));

        // Allow marketing to publish and archive latest news
        $this->_acl->add(new Zend_Acl_Resource('news'))
                   ->add(new Zend_Acl_Resource('latest'), 'news');
        $this->_acl->allow('marketing', 'latest', array('publish', 'archive'));

        // Deny staff (and marketing, by inheritance) rights to revise latest news
        $this->_acl->deny('staff', 'latest', 'revise');

        // Deny everyone access to archive news announcements
        $this->_acl->add(new Zend_Acl_Resource('announcement'), 'news');
        $this->_acl->deny(null, 'announcement', 'archive');

        // Access control checks for the above refined permission sets

        $this->assertTrue($this->_acl->isAllowed('marketing', null, 'view'));
        $this->assertTrue($this->_acl->isAllowed('marketing', null, 'edit'));
        $this->assertTrue($this->_acl->isAllowed('marketing', null, 'submit'));
        $this->assertTrue($this->_acl->isAllowed('marketing', null, 'revise'));
        $this->assertFalse($this->_acl->isAllowed('marketing', null, 'publish'));
        $this->assertFalse($this->_acl->isAllowed('marketing', null, 'archive'));
        $this->assertFalse($this->_acl->isAllowed('marketing', null, 'delete'));
        $this->assertFalse($this->_acl->isAllowed('marketing', null, 'unknown'));
        $this->assertFalse($this->_acl->isAllowed('marketing'));

        $this->assertTrue($this->_acl->isAllowed('marketing', 'newsletter', 'publish'));
        $this->assertFalse($this->_acl->isAllowed('staff', 'pending', 'publish'));
        $this->assertTrue($this->_acl->isAllowed('marketing', 'pending', 'publish'));
        $this->assertTrue($this->_acl->isAllowed('marketing', 'newsletter', 'archive'));
        $this->assertFalse($this->_acl->isAllowed('marketing', 'newsletter', 'delete'));
        $this->assertFalse($this->_acl->isAllowed('marketing', 'newsletter'));

        $this->assertTrue($this->_acl->isAllowed('marketing', 'latest', 'publish'));
        $this->assertTrue($this->_acl->isAllowed('marketing', 'latest', 'archive'));
        $this->assertFalse($this->_acl->isAllowed('marketing', 'latest', 'delete'));
        $this->assertFalse($this->_acl->isAllowed('marketing', 'latest', 'revise'));
        $this->assertFalse($this->_acl->isAllowed('marketing', 'latest'));

        $this->assertFalse($this->_acl->isAllowed('marketing', 'announcement', 'archive'));
        $this->assertFalse($this->_acl->isAllowed('staff', 'announcement', 'archive'));
        $this->assertFalse($this->_acl->isAllowed('administrator', 'announcement', 'archive'));

        $this->assertFalse($this->_acl->isAllowed('staff', 'latest', 'publish'));
        $this->assertFalse($this->_acl->isAllowed('editor', 'announcement', 'archive'));

        // Remove some previous permission specifications

        // Marketing can no longer publish and archive newsletters
        $this->_acl->removeAllow('marketing', 'newsletter', array('publish', 'archive'));

        // Marketing can no longer archive the latest news
        $this->_acl->removeAllow('marketing', 'latest', 'archive');

        // Now staff (and marketing, by inheritance) may revise latest news
        $this->_acl->removeDeny('staff', 'latest', 'revise');

        // Access control checks for the above refinements

        $this->assertFalse($this->_acl->isAllowed('marketing', 'newsletter', 'publish'));
        $this->assertFalse($this->_acl->isAllowed('marketing', 'newsletter', 'archive'));

        $this->assertFalse($this->_acl->isAllowed('marketing', 'latest', 'archive'));

        $this->assertTrue($this->_acl->isAllowed('staff', 'latest', 'revise'));
        $this->assertTrue($this->_acl->isAllowed('marketing', 'latest', 'revise'));

        // Grant marketing all permissions on the latest news
        $this->_acl->allow('marketing', 'latest');

        // Access control checks for the above refinement
        $this->assertTrue($this->_acl->isAllowed('marketing', 'latest', 'archive'));
        $this->assertTrue($this->_acl->isAllowed('marketing', 'latest', 'publish'));
        $this->assertTrue($this->_acl->isAllowed('marketing', 'latest', 'edit'));
        $this->assertTrue($this->_acl->isAllowed('marketing', 'latest'));

    }

    /**
     * Ensures that the $onlyParents argument to inheritsRole() works
     *
     * @return void
     * @group ZF-2502
     */
    public function testRoleInheritanceSupportsCheckingOnlyParents()
    {
        $this->_acl->addRole(new Zend_Acl_Role('grandparent'))
                   ->addRole(new Zend_Acl_Role('parent'), 'grandparent')
                   ->addRole(new Zend_Acl_Role('child'), 'parent');
        $this->assertFalse($this->_acl->inheritsRole('child', 'grandparent', true));
    }

    /**
     * Ensures that the solution for ZF-2234 works as expected
     *
     * @return void
     * @group ZF-2234
     */
    public function testAclInternalDFSMethodsBehaveProperly()
    {
        require_once dirname(__FILE__) . '/_files/ExtendedAclZF2234.php';
        $acl = new Zend_Acl_ExtendedAclZF2234();

        $someResource = new Zend_Acl_Resource('someResource');
        $someRole     = new Zend_Acl_Role('someRole');

        $acl->add($someResource)
            ->addRole($someRole);

        $nullValue     = null;
        $nullReference =& $nullValue;

        try {
            $acl->roleDFSVisitAllPrivileges($someRole, $someResource, $nullReference);
            $this->fail('Expected Zend_Acl_Exception not thrown');
        } catch (Zend_Acl_Exception $e) {
            $this->assertEquals('$dfs parameter may not be null', $e->getMessage());
        }

        try {
            $acl->roleDFSOnePrivilege($someRole, $someResource, null);
            $this->fail('Expected Zend_Acl_Exception not thrown');
        } catch (Zend_Acl_Exception $e) {
            $this->assertEquals('$privilege parameter may not be null', $e->getMessage());
        }

        try {
            $acl->roleDFSVisitOnePrivilege($someRole, $someResource, null);
            $this->fail('Expected Zend_Acl_Exception not thrown');
        } catch (Zend_Acl_Exception $e) {
            $this->assertEquals('$privilege parameter may not be null', $e->getMessage());
        }

        try {
            $acl->roleDFSVisitOnePrivilege($someRole, $someResource, 'somePrivilege', $nullReference);
            $this->fail('Expected Zend_Acl_Exception not thrown');
        } catch (Zend_Acl_Exception $e) {
            $this->assertEquals('$dfs parameter may not be null', $e->getMessage());
        }
    }

    /**
     * @group ZF-1721
     */
    public function testAclAssertionsGetProperRoleWhenInheritenceIsUsed()
    {
        $acl = $this->_loadUseCase1();

        $user = new Zend_Acl_Role('publisher');
        $blogPost = new Zend_Acl_Resource('blogPost');

        /**
         * @var Zend_Acl_UseCase1_UserIsBlogPostOwnerAssertion
         */
        $assertion = $acl->customAssertion;

        $this->assertTrue($acl->isAllowed($user, $blogPost, 'modify'));

        $this->assertEquals('publisher', $assertion->lastAssertRole->getRoleId());

    }

    /**
     *
     * @group ZF-1722
     */
    public function testAclAssertionsGetOriginalIsAllowedObjects()
    {
        $acl = $this->_loadUseCase1();

        $user = new Zend_Acl_UseCase1_User();
        $blogPost = new Zend_Acl_UseCase1_BlogPost();

        $this->assertTrue($acl->isAllowed($user, $blogPost, 'view'));

        /**
         * @var Zend_Acl_UseCase1_UserIsBlogPostOwnerAssertion
         */
        $assertion = $acl->customAssertion;

        $assertion->assertReturnValue = true;
        $user->role = 'contributor';
        $this->assertTrue($acl->isAllowed($user, $blogPost, 'modify'), 'Assertion should return true');
        $assertion->assertReturnValue = false;
        $this->assertFalse($acl->isAllowed($user, $blogPost, 'modify'), 'Assertion should return false');

        // check to see if the last assertion has the proper objets
        $this->assertTrue($assertion->lastAssertRole instanceof Zend_Acl_UseCase1_User, 'Assertion did not recieve proper role object');
        $this->assertTrue($assertion->lastAssertResource instanceof Zend_Acl_UseCase1_BlogPost, 'Assertion did not recieve proper resource object');

    }

    /**
     *
     * @return Zend_Acl_UseCase1_Acl
     */
    protected function _loadUseCase1()
    {
        if (!class_exists('Zend_Acl_UseCase1_Acl')) {
            require_once dirname(__FILE__) . '/_files/UseCase1/User.php';
            require_once dirname(__FILE__) . '/_files/UseCase1/BlogPost.php';
            require_once dirname(__FILE__) . '/_files/UseCase1/UserIsBlogPostOwnerAssertion.php';
            require_once dirname(__FILE__) . '/_files/UseCase1/Acl.php';
        }
        return new Zend_Acl_UseCase1_Acl();
    }

    /**
     * Returns an array of registered roles
     * @expectedException PHPUnit_Framework_Error
     * @group ZF-5638
     */
    public function testGetRegisteredRoles()
    {
        $acl = $this->_acl;
        $acl->addRole('developer');

        $roles = $acl->getRegisteredRoles();
        $this->assertTrue(is_array($roles));
        $this->assertFalse(empty($roles));
    }

    /**
     * Confirm that deleting a role after allowing access to all roles
     * raise undefined index error
     *
     * @group ZF-5700
     */
    public function testRemovingRoleAfterItWasAllowedAccessToAllResourcesGivesError()
    {
        $acl = new Zend_Acl();
        $acl->addRole(new Zend_Acl_Role('test0'));
        $acl->addRole(new Zend_Acl_Role('test1'));
        $acl->addRole(new Zend_Acl_Role('test2'));
        $acl->addResource(new Zend_Acl_Resource('Test'));

        $acl->allow(null,'Test','xxx');

        // error test
        $acl->removeRole('test0');

        // Check after fix
        $this->assertFalse($acl->hasRole('test0'));
    }

    /**
     * @group ZF-8039
     *
     * Meant to test for the (in)existance of this notice:
     * "Notice: Undefined index: allPrivileges in lib/Zend/Acl.php on line 682"
     */
    public function testMethodRemoveAllowDoesNotThrowNotice() {
        $acl = new Zend_Acl();
        $acl->addRole('admin');
        $acl->addResource('blog');
        $acl->allow('admin', 'blog', 'read');
        $acl->removeAllow(array('admin'), array('blog'), null);
    }

    public function testRoleObjectImplementsToString() {
        $role = new Zend_Acl_Role('_fooBar_');
        $this->assertEquals('_fooBar_',(string)$role);
    }

    public function testResourceObjectImplementsToString() {
        $resource = new Zend_Acl_Resource('_fooBar_');
        $this->assertEquals('_fooBar_',(string)$resource);
    }

    /**
     * @group ZF-7973
     */
    public function testAclPassesPrivilegeToAssertClass() {
        require_once dirname(__FILE__) . '/_files/AssertionZF7973.php';
        $assertion = new Zend_Acl_AclTest_AssertionZF7973();

        $acl = new Zend_Acl();
        $acl->addRole('role');
        $acl->addResource('resource');
        $acl->allow('role',null,null,$assertion);
        $allowed = $acl->isAllowed('role','resource','privilege',$assertion);

        $this->assertTrue($allowed);
    }

    /**
     * @group ZF-8468
     */
    public function testGetRegisteredRolesIsDeprecated() {
        try {
            $this->_acl->getRegisteredRoles();
            $this->fail('getRegisteredRoles() did not throw an exception');
        } catch(PHPUnit_Framework_Error $e) {
            return;
        }

        $this->fail('An expected notice has not been raised');
    }

    /**
     * @group ZF-8468
     */
    public function testgetRoles() {
        $this->assertEquals(array(),$this->_acl->getRoles());

        $roleGuest = new Zend_Acl_Role('guest');
        $this->_acl->addRole($roleGuest);
        $this->_acl->addRole(new Zend_Acl_Role('staff'), $roleGuest);
        $this->_acl->addRole(new Zend_Acl_Role('editor'), 'staff');
        $this->_acl->addRole(new Zend_Acl_Role('administrator'));

        $expected = array('guest', 'staff','editor','administrator');
        $this->assertEquals($expected, $this->_acl->getRoles());
    }

    /**
     * @group ZF-8468
     */
    public function testgetResources() {
        $this->assertEquals(array(),$this->_acl->getResources());

        $this->_acl->add(new Zend_Acl_Resource('someResource'));
        $this->_acl->add(new Zend_Acl_Resource('someOtherResource'));

        $expected = array('someResource', 'someOtherResource');
        $this->assertEquals($expected, $this->_acl->getResources());
    }

    /**
     * @group ZF-9643
     */
    public function testRemoveAllowWithNullResourceAfterResourceSpecificRulesAppliesToAllResources()
    {
        $this->_acl->addRole('guest');
        $this->_acl->addResource('blogpost');
        $this->_acl->addResource('newsletter');
        $this->_acl->allow('guest', 'blogpost', 'read');
        $this->_acl->allow('guest', 'newsletter', 'read');
        $this->assertTrue($this->_acl->isAllowed('guest', 'blogpost', 'read'));
        $this->assertTrue($this->_acl->isAllowed('guest', 'newsletter', 'read'));

        $this->_acl->removeAllow('guest', 'newsletter', 'read');
        $this->assertTrue($this->_acl->isAllowed('guest', 'blogpost', 'read'));
        $this->assertFalse($this->_acl->isAllowed('guest', 'newsletter', 'read'));

        $this->_acl->removeAllow('guest', null, 'read');
        $this->assertFalse($this->_acl->isAllowed('guest', 'blogpost', 'read'));
        $this->assertFalse($this->_acl->isAllowed('guest', 'newsletter', 'read'));

        // ensure allow null/all resoures works
        $this->_acl->allow('guest', null, 'read');
        $this->assertTrue($this->_acl->isAllowed('guest', 'blogpost', 'read'));
        $this->assertTrue($this->_acl->isAllowed('guest', 'newsletter', 'read'));
    }

    /**
     * @group ZF-9643
     */
    public function testRemoveDenyWithNullResourceAfterResourceSpecificRulesAppliesToAllResources()
    {
        $this->_acl->addRole('guest');
        $this->_acl->addResource('blogpost');
        $this->_acl->addResource('newsletter');

        $this->_acl->allow();
        $this->_acl->deny('guest', 'blogpost', 'read');
        $this->_acl->deny('guest', 'newsletter', 'read');
        $this->assertFalse($this->_acl->isAllowed('guest', 'blogpost', 'read'));
        $this->assertFalse($this->_acl->isAllowed('guest', 'newsletter', 'read'));

        $this->_acl->removeDeny('guest', 'newsletter', 'read');
        $this->assertFalse($this->_acl->isAllowed('guest', 'blogpost', 'read'));
        $this->assertTrue($this->_acl->isAllowed('guest', 'newsletter', 'read'));

        $this->_acl->removeDeny('guest', null, 'read');
        $this->assertTrue($this->_acl->isAllowed('guest', 'blogpost', 'read'));
        $this->assertTrue($this->_acl->isAllowed('guest', 'newsletter', 'read'));

        // ensure deny null/all resources works
        $this->_acl->deny('guest', null, 'read');
        $this->assertFalse($this->_acl->isAllowed('guest', 'blogpost', 'read'));
        $this->assertFalse($this->_acl->isAllowed('guest', 'newsletter', 'read'));
    }

    /**
     * @group ZF-10649
     */
    public function testAllowAndDenyWithNullForResourcesWillApplyToAllResources()
    {
        $this->_acl->addRole('guest');
        $this->_acl->addResource('blogpost');

        $this->_acl->allow('guest');
        $this->assertTrue($this->_acl->isAllowed('guest'));
        $this->assertTrue($this->_acl->isAllowed('guest', 'blogpost'));
        $this->assertTrue($this->_acl->isAllowed('guest', 'blogpost', 'read'));

        $this->_acl->deny('guest');
        $this->assertFalse($this->_acl->isAllowed('guest'));
        $this->assertFalse($this->_acl->isAllowed('guest', 'blogpost'));
        $this->assertFalse($this->_acl->isAllowed('guest', 'blogpost', 'read'));
    }
}


text:
using System.Collections.Immutable;
using System.Globalization;
using System.Linq;
using Microsoft.CodeAnalysis.CodeActions;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Editor.Host;
using Microsoft.VisualStudio.Language.Intellisense;
using Microsoft.VisualStudio.Text;
using Roslyn.Utilities;

namespace Microsoft.CodeAnalysis.Editor.Implementation.Suggestions
{
    /// <summary>
    /// Represents light bulb menu item for code fixes.
    /// </summary>
    internal class CodeFixSuggestedAction : SuggestedActionWithFlavors, ITelemetryDiagnosticID<string>
    {
        private readonly CodeFix _fix;
        private readonly SuggestedActionSet _fixAllSuggestedActionSet;

        public CodeFixSuggestedAction(
            Workspace workspace,
            ITextBuffer subjectBuffer,
            ICodeActionEditHandlerService editHandler,
            IWaitIndicator waitIndicator,
            CodeFix fix,
            CodeAction action,
            object provider,
            SuggestedActionSet fixAllSuggestedActionSet)
            : base(workspace, subjectBuffer, editHandler, waitIndicator, action, provider)
        {
            _fix = fix;
            _fixAllSuggestedActionSet = fixAllSuggestedActionSet;
        }

        /// <summary>
        /// If the provided fix all context is non-null and the context's code action Id matches the given code action's Id then,
        /// returns the set of fix all occurrences actions associated with the code action.
        /// </summary>
        internal static SuggestedActionSet GetFixAllSuggestedActionSet(
            CodeAction action,
            int actionCount,
            FixAllCodeActionContext fixAllCodeActionContext,
            Workspace workspace,
            ITextBuffer subjectBuffer,
            ICodeActionEditHandlerService editHandler,
            IWaitIndicator waitIndicator)
        {
            if (fixAllCodeActionContext == null)
            {
                return null;
            }

            if (actionCount > 1 && action.EquivalenceKey == null)
            {
                return null;
            }

            var fixAllSuggestedActions = ImmutableArray.CreateBuilder<FixAllSuggestedAction>();
            foreach (var scope in fixAllCodeActionContext.SupportedScopes)
            {
                var fixAllContext = fixAllCodeActionContext.GetContextForScopeAndActionId(scope, action.EquivalenceKey);
                var fixAllAction = new FixAllCodeAction(fixAllContext, fixAllCodeActionContext.FixAllProvider, showPreviewChangesDialog: true);
                var fixAllSuggestedAction = new FixAllSuggestedAction(workspace, subjectBuffer, editHandler, waitIndicator,
                    fixAllAction, fixAllCodeActionContext.FixAllProvider, fixAllCodeActionContext.OriginalDiagnostics.First());
                fixAllSuggestedActions.Add(fixAllSuggestedAction);
            }

            return new SuggestedActionSet(fixAllSuggestedActions.ToImmutable(), title: EditorFeaturesResources.FixAllOccurrencesIn);
        }

        public string GetDiagnosticID()
        {
            var diagnostic = _fix.PrimaryDiagnostic;

            // we log diagnostic id as it is if it is from us
            if (diagnostic.Descriptor.CustomTags.Any(t => t == WellKnownDiagnosticTags.Telemetry))
            {
                return diagnostic.Id;
            }

            // if it is from third party, we use hashcode
            return diagnostic.GetHashCode().ToString(CultureInfo.InvariantCulture);
        }

        protected override DiagnosticData GetDiagnostic()
        {
            return _fix.GetPrimaryDiagnosticData();
        }

        protected override SuggestedActionSet GetFixAllSuggestedActionSet()
        {
            return _fixAllSuggestedActionSet;
        }
    }
}


text:
/*
 * source http://stackoverflow.com/questions/6049687/jquery-ui-dialog-box-need-to-return-value-when-user-presses-button-but-not-wor
 * http://stackoverflow.com/questions/3560872/returning-value-from-confirmation-dialog-using-jquery-ui-dialog
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

function reloadBusinessModal()
{
    var name=$("#nameBusiness").text();
    RenderBusinessListBySearchModal(name, offsetBusiness, maxrecordsBusiness, true);

}

var offsetBusiness=0; //start at the begining
var maxrecordsBusiness=10;  //record 20 at a time
var langBusiness="en";  //langauge english
var totalrecordsBusiness=0;

RenderBusinessListBySearchModal('%', offsetBusiness, maxrecordsBusiness, true);

function pagedownChooserBusiness()
{
    offsetBusiness = $("#offsetBusiness").text();
    //alert(offset);
    var newoffset = offsetBusiness - maxrecordsBusiness;
    if (newoffset < 0)
        return;
    //alert(newoffset);
    if (newoffset != offsetBusiness)
        RenderBusinessListBySearchModal($("#nameBusiness").text(), newoffset, maxrecordsBusiness, true);
}
function pageupChooserBusiness()
{
    offsetBusiness = $("#offsetBusiness").text();
    //alert(offset);
    var fetch = maxrecordsBusiness;
    if ((parseInt(offsetBusiness) + parseInt(maxrecordsBusiness))  > totalrecordsBusiness)
        //fetch = maxrecords - offset;
        return;
    else
        fetch = (parseInt(offsetBusiness) + parseInt(maxrecordsBusiness));
    //alert(fetch);
    offsetBusiness = fetch;
    RenderBusinessListBySearchModal($("#nameBusiness").text(), fetch, maxrecordsBusiness, true);
}

var selectedItemBusiness=null;

//offset, maxrecords, keyword
function RenderBusinessListBySearchModal(keyword1, offset1, maxrecords1, isForChooser)
{
    var lang = $("#langBusiness").text();
    $("#businesslist").html("<img src=\"img/bigrollergreen.gif\" title=\"Loading\"/>");
    var request=   $.ajax({
        url: 'ajax/businesssearch.jsp?keyword=' + keyword1 + "&offset=" + offset1 + "&maxrecords=" + maxrecords1 + "&lang=" + lang + "&chooser=" + isForChooser,
        type:"GET",
        cache: false
    });

    request.done(function(msg) {
        window.console && console.log('postback done ');
        $("#businesslist").html(msg);

    //refresh();
    });

    request.fail(function(jqXHR, textStatus) {
        window.console && console.log('postback failed ');
        $("#businesslist").html("An error occured! " + jqXHR.responseText + textStatus);
    //refresh();
    });
/*
    $.get('ajax/businesssearch.jsp?keyword=' + keyword1 + "&offset=" + offset1 + "&maxrecords=" + maxrecords1 + "&lang=" + lang, function(data) {
        $("#businesslist").html(data);
        refresh();
    });*/
}

function refreshBusiness()
{
    var displayrecords = $("#displayrecords").text();
    if (displayrecords == totalrecordsBusiness)
    {
        $("#pageupBusiness").addClass("disabled");
        $("#pagedownBusiness").addClass("disabled");
    }
    else if (offsetBusiness + maxrecordsBusiness > totalrecordsBusiness)
    {
        $("#pageupBusiness").addClass("disabled");
    }
    else if (offsetBusiness ==0)
    {
        $("#pagedownBusiness").removeClass("disabled");
    }
    else
    {
        $("#pagedownBusiness").removeClass("disabled");
        $("#pageupBusiness").removeClass("disabled");
    }
}

/**
 *This launches the tModel model div, upon return (and if not abprted), the contents of the div parameter will be replaced with the
 *first selected tModel
 */
function businessModal(div){
    //reset the form in case it was lanucheed more than once per page view
    reloadBusinessModal();

    $.dialogBusiness.confirm({
        callback: function(success, result) {
            if (!success)
            {
              //  alert("aborted!");
            }

            else{
               // alert('Result: ' + result.join());
                $("#" + div).html(result[0]);
            }
       //     return false;
        }
    });
   // return false;
}

function businessCancel()
{
    $(".modalableBusinessChooser").each(function()
    {
        $(this).prop('checked', false);
    });
    $('#businessChooser').modal('hide');

}

/**
 *returns an array of selected tmodel keys
 */
$.dialogBusiness = {
    confirm: function(options) {
        var $modal = $('#businessChooser');
        //$modal.find('.modal-body').text(options.message);

        $modal.off('click.dialog', '.btn, .close')
        .off('hidden')
        .on('click.dialog', '.btn, .close', function() {
            $(this).addClass('modal-result');
        }).on('hidden', function() {
            var result = $(this).find('.modal-result').filter('.btn-primary').length > 0;
            $(this).find('.modal-result').removeClass('modal-result');
            /**
                         * find the result from the model (the selected key)
                         */
            var selectedtmodels =  new Array();
            $(".modalableBusinessChooser").each(function()
            {
                var id=$(this).attr("id");
                if ($(this).is(':checked')) {
                    selectedtmodels.push(
                        id
                        );
                }
            });

            options.callback(result ,selectedtmodels);
        //  $modal.modal('hide');
        });
        //callback = options.callback;

        $modal.modal();
    }
};


text:
package com.validation.manager.core.db;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.TableGenerator;
import javax.validation.constraints.NotNull;

/**
 *
 * @author Javier A. Ortiz Bultron javier.ortiz.78@gmail.com
 */
@Embeddable
public class StepPK implements Serializable {

    @Basic(optional = false)
    @GeneratedValue(strategy = GenerationType.TABLE, generator = "StepGen")
    @TableGenerator(name = "StepGen", table = "vm_id",
            pkColumnName = "table_name",
            valueColumnName = "last_id",
            pkColumnValue = "step",
            allocationSize = 1,
            initialValue = 1_000)
    @NotNull
    @Column(name = "id")
    private int id;
    @Basic(optional = false)
    @NotNull
    @Column(name = "test_case_id")
    private int testCaseId;

    public StepPK() {
    }

    public StepPK(int testCaseId) {
        this.testCaseId = testCaseId;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getTestCaseId() {
        return testCaseId;
    }

    public void setTestCaseId(int testCaseId) {
        this.testCaseId = testCaseId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (int) id;
        hash += (int) testCaseId;
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        if (!(object instanceof StepPK)) {
            return false;
        }
        StepPK other = (StepPK) object;
        if (this.id != other.id) {
            return false;
        }
        return this.testCaseId == other.testCaseId;
    }

    @Override
    public String toString() {
        return "com.validation.manager.core.db.StepPK[ id=" + id
                + ", testCaseId=" + testCaseId + " ]";
    }
}


text:
/*
* Compression Transform
* (C) 2014 Jack Lloyd
*
* Botan is released under the Simplified BSD License (see license.txt)
*/

#ifndef BOTAN_COMPRESSION_TRANSFORM_H_
#define BOTAN_COMPRESSION_TRANSFORM_H_

#include <botan/secmem.h>
#include <botan/exceptn.h>
#include <string>

namespace Botan {

/**
* Interface for a compression algorithm.
*/
class BOTAN_PUBLIC_API(2,0) Compression_Algorithm
   {
   public:
      /**
      * Create an instance based on a name, or return null if the
      * algo combination cannot be found.
      */
      static std::unique_ptr<Compression_Algorithm>
         create(const std::string& algo_spec);

      /**
      * Create an instance based on a name
      * @param algo_spec algorithm name
      * Throws Lookup_Error if not found.
      */
      static std::unique_ptr<Compression_Algorithm>
         create_or_throw(const std::string& algo_spec);

      /**
      * Begin compressing. Most compression algorithms offer a tunable
      * time/compression tradeoff parameter generally represented by
      * an integer in the range of 1 to 9.
      *
      * If 0 or a value out of range is provided, a compression algorithm
      * specific default is used.
      */
      virtual void start(size_t comp_level = 0) = 0;

      /**
      * Process some data.
      * @param buf in/out parameter which will possibly be resized or swapped
      * @param offset an offset into blocks to begin processing
      * @param flush if true the compressor will be told to flush state
      */
      virtual void update(secure_vector<uint8_t>& buf, size_t offset = 0, bool flush = false) = 0;

      /**
      * Finish compressing
      *
      * @param final_block in/out parameter
      * @param offset an offset into final_block to begin processing
      */
      virtual void finish(secure_vector<uint8_t>& final_block, size_t offset = 0) = 0;

      /**
      * @return name of the compression algorithm
      */
      virtual std::string name() const = 0;

      /**
      * Reset the state and abort the current message; start can be
      * called again to process a new message.
      */
      virtual void clear() = 0;

      virtual ~Compression_Algorithm() = default;
   };

/*
* Interface for a decompression algorithm.
*/
class BOTAN_PUBLIC_API(2,0) Decompression_Algorithm
   {
   public:
      /**
      * Create an instance based on a name, or return null if the
      * algo combination cannot be found.
      */
      static std::unique_ptr<Decompression_Algorithm>
         create(const std::string& algo_spec);

      /**
      * Create an instance based on a name
      * @param algo_spec algorithm name
      * Throws Lookup_Error if not found.
      */
      static std::unique_ptr<Decompression_Algorithm>
         create_or_throw(const std::string& algo_spec);

      /**
      * Begin decompressing.
      * Decompression does not support levels, as compression does.
      */
      virtual void start() = 0;

      /**
      * Process some data.
      * @param buf in/out parameter which will possibly be resized or swapped
      * @param offset an offset into blocks to begin processing
      */
      virtual void update(secure_vector<uint8_t>& buf, size_t offset = 0) = 0;

      /**
      * Finish decompressing
      *
      * @param final_block in/out parameter
      * @param offset an offset into final_block to begin processing
      */
      virtual void finish(secure_vector<uint8_t>& final_block, size_t offset = 0) = 0;

      /**
      * @return name of the decompression algorithm
      */
      virtual std::string name() const = 0;

      /**
      * Reset the state and abort the current message; start can be
      * called again to process a new message.
      */
      virtual void clear() = 0;

      virtual ~Decompression_Algorithm() = default;
   };

inline Compression_Algorithm* make_compressor(const std::string& type)
   {
   return Compression_Algorithm::create(type).release();
   }

inline Decompression_Algorithm* make_decompressor(const std::string& type)
   {
   return Decompression_Algorithm::create(type).release();
   }

/**
* An error that occurred during compression (or decompression)
*/
class BOTAN_PUBLIC_API(2,9) Compression_Error : public Exception
   {
   public:

      /**
      * @param func_name the name of the compression API that was called
      * (eg "BZ2_bzCompressInit" or "lzma_code")
      * @param type what library this came from
      * @param rc the error return code from the compression API. The
      * interpretation of this value will depend on the library.
      */
     Compression_Error(const char* func_name, ErrorType type, int rc) :
        Exception("Compression API " + std::string(func_name) +
                  " failed with return code " + std::to_string(rc)),
        m_type(type),
        m_rc(rc)
         {}

      ErrorType error_type() const noexcept override { return m_type; }

      int error_code() const noexcept override { return m_rc; }

   private:
      ErrorType m_type;
      int m_rc;
   };

/**
* Adapts a zlib style API
*/
class Compression_Stream
   {
   public:
      virtual ~Compression_Stream() = default;

      virtual void next_in(uint8_t* b, size_t len) = 0;

      virtual void next_out(uint8_t* b, size_t len) = 0;

      virtual size_t avail_in() const = 0;

      virtual size_t avail_out() const = 0;

      virtual uint32_t run_flag() const = 0;
      virtual uint32_t flush_flag() const = 0;
      virtual uint32_t finish_flag() const = 0;

      virtual bool run(uint32_t flags) = 0;
   };

/**
* Used to implement compression using Compression_Stream
*/
class Stream_Compression : public Compression_Algorithm
   {
   public:
      void update(secure_vector<uint8_t>& buf, size_t offset, bool flush) final override;

      void finish(secure_vector<uint8_t>& buf, size_t offset) final override;

      void clear() final override;

   private:
      void start(size_t level) final override;

      void process(secure_vector<uint8_t>& buf, size_t offset, uint32_t flags);

      virtual std::unique_ptr<Compression_Stream> make_stream(size_t level) const = 0;

      secure_vector<uint8_t> m_buffer;
      std::unique_ptr<Compression_Stream> m_stream;
   };

/**
* FIXME add doc
*/
class Stream_Decompression : public Decompression_Algorithm
   {
   public:
      void update(secure_vector<uint8_t>& buf, size_t offset) final override;

      void finish(secure_vector<uint8_t>& buf, size_t offset) final override;

      void clear() final override;

   private:
      void start() final override;

      void process(secure_vector<uint8_t>& buf, size_t offset, uint32_t flags);

      virtual std::unique_ptr<Compression_Stream> make_stream() const = 0;

      secure_vector<uint8_t> m_buffer;
      std::unique_ptr<Compression_Stream> m_stream;
   };

}

#endif