text:
SYNONYM

#### According to
Index Fungorum

#### Published in
null

#### Original name
Phaeoisariopsis tephrosicola P.Rag. Rao

### Remarks
null


text:
@charset "utf-8";
/* CSS Document */

body {
	width:800px;
	height:auto;
	margin-left:auto;
	margin-right:auto;
	background-color:#336633;
	font-family:Verdana, Arial, Helvetica, sans-serif;
	font-size:14px;
	background-image:url(bodyBG2.jpg);
	background-repeat:repeat-y;
	background-position:center;
	}

a{
	color:#6699cc;
	text-decoration:none;
	font-weight:bold;
	}

a:visited{
	color:#6699cc;
	text-decoration:none;
	font-weight:bold;
	}

a:hover{
	color:#ff9900;
	text-decoration:none;
	font-weight:bold;
	}

.main {
	width:800px;
	min-height:400px;
	margin-top:20px;
	float:left;
	}

.banner{
	width:800px;
	height:195px;
	background-image:url(bannerBG2.jpg);
	background-repeat:none;
	}

.stage {
	width:700px;
	height:auto;
	min-height:200px;
	background-color:#ffffff;
	margin-top:20px;
	margin-left:40px;
	padding:10px;
	}

.nav {
	width:800px;
	height:110px;
	background-image:url(navBG2.jpg);
	background-repeat:no-repeat;
	}

.subNav{
	width:760px;
	height:30px;
	margin-bottom:80px;
	margin-left:20px;
	}

.footer {
	width:740px;
	height:35px;
	border-width:10px;
	border-color:#6699cc;
	border-style:solid;
	background-color:#ffffff;
	float:left;
	}

.footer table {
	width:740px;
	height:35px;
	font-family:Verdana, Arial, Helvetica, sans-serif;
	text-align:center;
	font-size:9px;
	}

.contact{
	width:740px;
	height:35px;
	font-family:Verdana, Arial, Helvetica, sans-serif;
	text-align:center;
	}

.dateStamp{
	font-size:12px;
	margin-bottom:-5px;
	text-align:right;
	}

img {
	border:0px;
	}

h1 {
	color:#ff9900;
	font-size:18px;
	font-weight:bold;
	font-variant:small-caps;
	margin-top:-5px;
	}

h2 {
	color:#ff9900;
	font-size:16px;
	margin-top:-5px;
	}

h3 {
	color:#6699cc;
	font-size:16px;
	margin-top:-5px;
	}

/*/ Navigation /*/

#home{
	width:75px;
	height:30px;
	background-image:url(../buttons/home.jpg);
	background-repeat:no-repeat;
	background-position:top;
	float:left;
	}

#options{
	width:85px;
	height:30px;
	background-image:url(../buttons/options.jpg);
	background-repeat:no-repeat;
	background-position:top;
	float:left;
	}

#abortion {
	width:100px;
	height:30px;
	background-image:url(../buttons/abortion.jpg);
	background-repeat:no-repeat;
	background-position:top;
	float:left;
	}

#morningAfter {
	width:100px;
	height:30px;
	background-image:url(../buttons/morningAfter.jpg);
	background-repeat:no-repeat;
	background-position:top;
	float:left;
	}

#symptoms {
	width:110px;
	height:30px;
	background-image:url(../buttons/symptoms.jpg);
	background-repeat:no-repeat;
	background-position:top;
	float:left;
	}

#forMen {
	width:100px;
	height:30px;
	background-image:url(../buttons/forMen.jpg);
	background-repeat:no-repeat;
	background-position:top;
	float:left;
	}

#locations {
	width:105px;
	height:30px;
	background-image:url(../buttons/locations.jpg);
	background-repeat:no-repeat;
	background-position:top;
	float:left;
	}

#videos {
	width:85px;
	height:30px;
	background-image:url(../buttons/videos.jpg);
	background-repeat:no-repeat;
	background-position:top;
	float:left;
	}

#home:hover, #home:active, #options:hover, #options:active, #abortion:hover, #abortion:active, #morningAfter:hover, #morningAfter:active, #symptoms:hover, #symptoms:active, #forMen:hover, #forMen:active, #locations:hover, #locations:active, #videos:hover, #videos:active{
	background-position:bottom;
	}

redpajama_set_name: RedPajamaGithub


text:
	<input type='text' id='nameInput' placeholder='Name'>
  <input type='text' id='messageInput' placeholder='Message'>


text:
<?php

use Aws\CacheInterface;
use Aws\DoctrineCacheAdapter;
use Aws\DynamoDb\DynamoDbClient;
use Aws\DynamoDb\Marshaler;
use Aws\DynamoDb\WriteRequestBatch;
use Aws\Sdk;
use Doctrine\Common\Cache\ApcuCache;
use Zend\ServiceManager\AbstractFactory\ConfigAbstractFactory;
use Zend\ServiceManager\Factory\InvokableFactory;
use ZfrAwsUtils\Container\DynamoDbClientFactory;
use ZfrAwsUtils\Container\SdkFactory;
use ZfrAwsUtils\Container\WriteRequestBatchFactory;
use ZfrAwsUtils\DynamoDb\Pagination\DynamoDbPaginator;

return [
    'dependencies' => [
        'aliases' => [
            CacheInterface::class => DoctrineCacheAdapter::class,
        ],

        'factories' => [
            ApcuCache::class            => InvokableFactory::class,
            DoctrineCacheAdapter::class => ConfigAbstractFactory::class,
            DynamoDbClient::class       => DynamoDbClientFactory::class,
            DynamoDbPaginator::class    => ConfigAbstractFactory::class,
            Marshaler::class            => InvokableFactory::class,
            Sdk::class                  => SdkFactory::class,
            WriteRequestBatch::class    => WriteRequestBatchFactory::class,
        ],
    ],

    ConfigAbstractFactory::class => [
        DoctrineCacheAdapter::class => [ApcuCache::class],
        DynamoDbPaginator::class    => [DynamoDbClient::class, Marshaler::class]
    ],
];


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

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

    <title>statsmodels.genmod.generalized_linear_model.GLM.score_obs — statsmodels 0.6.1 documentation</title>

    <link rel="stylesheet" href="../_static/nature.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />

    <link rel="shortcut icon" href="../_static/statsmodels_hybi_favico.ico"/>
    <link rel="author" title="About these documents" href="../about.html" />
    <link rel="top" title="statsmodels 0.6.1 documentation" href="../index.html" />
    <link rel="up" title="statsmodels.genmod.generalized_linear_model.GLM" href="statsmodels.genmod.generalized_linear_model.GLM.html" />
    <link rel="next" title="statsmodels.genmod.generalized_linear_model.GLM.score_test" href="statsmodels.genmod.generalized_linear_model.GLM.score_test.html" />
    <link rel="prev" title="statsmodels.genmod.generalized_linear_model.GLM.score_factor" href="statsmodels.genmod.generalized_linear_model.GLM.score_factor.html" />
<link rel="stylesheet" href="../../_static/facebox.css" type="text/css" />
<link rel="stylesheet" href="../_static/examples.css" type="text/css" />

Navigation

          index

          next |

          previous |

Install
  |

Support
  |

Bugs
  |

Develop
  |

Examples
  |

FAQ
  |

Generalized Linear Models |

statsmodels.genmod.generalized_linear_model.GLM |

statsmodels.genmod.generalized_linear_model.GLM.score_obs¶

GLM.score_obs(params, scale=None)[source]¶

score first derivative of the loglikelihood for each observation.

<col class="field-name" />
<col class="field-body" />

Parameters:
params : ndarray

parameter at which score is evaluated

scale : None or float

If scale is None, then the default scale will be calculated.
Default scale is defined by self.scaletype and set in fit.
If scale is not None, then it is used as a fixed scale.

Returns:
score_obs : ndarray, 2d

The first derivative of the loglikelihood function evaluated at
params for each observation.

Previous topic

statsmodels.genmod.generalized_linear_model.GLM.score_factor

Next topic

statsmodels.genmod.generalized_linear_model.GLM.score_test

This Page

Show Source

Quick search

    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>

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

        © Copyright 2009-2013, Josef Perktold, Skipper Seabold, Jonathan Taylor, statsmodels-developers.
      Created using Sphinx 1.3.1.


text:
require 'rails_helper'

describe CalculableAttrs::ActiveRecord::Base do
  describe '#calcualble_attr' do
    context 'without defaults' do
      subject { create(:account, tr_count: 5, tr_amount: 10) }

      context 'one attr and block' do
        before do
          Account.calculable_attr(balance: 'SUM(amount)'){ Transaction.joins(:account).all }
        end
        it { is_expected.to respond_to :balance }
        it { expect(subject.balance).to eq 50 }
        it do
          subject #force to execute insertions before
          expect(->{ 10.times { subject.balance } } ).to be_executed_sqls(1)
        end
      end

      context 'one attr and lambda' do
        before do
          Account.calculable_attr balance: 'SUM(amount)', from: ->{ Transaction.joins(:account).all}
        end
        it { is_expected.to respond_to :balance }
        it { expect(subject.balance).to eq 50 }
      end

      context 'many attrs and block' do
        before do
          Account.calculable_attr balance: 'SUM(transactions.amount)', number_of_transactions: 'COUNT(*)' do
            Transaction.joins(:account).all
          end
        end
        it { is_expected.to respond_to :balance }
        it { expect(subject.balance).to eq 50 }
        it { is_expected.to respond_to :number_of_transactions }
        it { expect(subject.number_of_transactions).to eq 5 }
      end

      context 'many attrs and block' do
        before do
          Account.calculable_attr balance:                'SUM(transactions.amount)',
                                  number_of_transactions: 'COUNT(*)',
                                  from:                    ->{ Transaction.joins(:account).all }
        end

        it { is_expected.to respond_to :balance }
        it { expect(subject.balance).to eq 50 }
        it { is_expected.to respond_to :number_of_transactions }
        it { expect(subject.number_of_transactions).to eq 5 }
      end

      it 'will raise exception if no scope provided' do
        no_scope = proc do
          Account.calculable_attr balance: 'SUM(amount)'
        end
        expect(no_scope).to raise_error('CALCULABLE_ATTRS: Relation was missed.')
      end
    end

    context 'with defaults' do
      subject { create(:account) }

      context 'explicit defaults' do
        before do
          Account.calculable_attr(balance: ['SUM(amount)', '-']){ Transaction.joins(:account).all }
        end
        it { expect(subject.balance).to eq '-'}
      end

      context 'implicit default is zero' do
        before do
          Account.calculable_attr(balance: 'SUM(amount)'){ Transaction.joins(:account).all }
        end
        it { expect(subject.balance).to eq 0 }
      end
    end
  end

  describe '#calcualble_attrs_calculators' do
    let(:account) { create(:account, tr_count: 5, tr_amount: 10) }
    before do
      Account.calculable_attr(balance: 'SUM(amount)'){ Transaction.joins(:account).all }
    end
    it { expect(Account).to respond_to(:calculable_attr_calculator) }
    context 'calculator' do
      subject { Account.calculable_attr_calculator(:balance) }
      it { expect(subject).to be_a CalculableAttrs::Calculator }
      it { expect(subject.attrs).to eq [:balance]  }
      it { expect(subject.scoped_relation(account.id).map(&:amount)).to eq [10, 10, 10, 10, 10]  }
    end
  end
end


text:
{% extends 'posts/base.html' %}
{% load core_tags fb_versions %}

{% block page_class %}{{ block.super }} list-page{% endblock %}

{% block breadcrumb_nav %}

Home

News

{% endblock %}

{% block header_content %}
News
{% endblock %}
{% block article_content %}
    {% if post_list %}

        {% for post in post_list %}

{{ post }}

                    {{ post.body|safe }}

Posted {% if post.author %}by {{ post.author.first_name }} {% endif %}on {{ post.publish_date|date }}

                {# TODO: Link to media #}

        {% endfor %}

    {% else %}

No news.

    {% endif %}
{% endblock %}

{% block page_nav %}
    {% pagenav paginator page_obj %}
{% endblock %}


text:
<?xml version="1.0" encoding="utf-8"?>
<resources name="ru" flag="ru" title="Russian">
	<string_add name="_bx_channels_grid_filter_item_title_adm_select_one_filter2"><![CDATA[Любая аудитория]]></string_add>
</resources>


text:
title: Conditional Items Based on Permissions
---

v1.1+

The `add` method and all convenience methods (`link`, `html`, `action`,...) have an equivalent method with an `IfCan` suffix. When used, the item will only be added if the currently logged in user has a certain permission.

```php
Menu::new()
    ->link('/', 'Home')
    ->linkIfCan('view-posts', '/posts', 'Posts');
```

```html
<!-- User isn't logged in or can't view posts -->
<ul>
    <li><a href="/">Home</a></li>
</ul>
```

```html
<!-- User is logged in and can view posts -->
<ul>
    <li><a href="/">Home</a></li>
    <li><a href="/posts">Posts</a></li>
</ul>
```

If your permission check requires parameters, you can provide an array for the permission. The permission's name should be the first element, and parameters should fill up the rest.

```php
Menu::new()
    ->link('PostController@show', 'View post')
    ->linkIfCan(['edit-post', $post], 'PostController@edit', 'Edit post');
```

```html
<!-- User isn't logged in or can't edit the post -->
<ul>
    <li><a href="/posts/1">View post</a></li>
</ul>
```

```html
<!-- User is logged in and can edit the post -->
<ul>
    <li><a href="/posts/1">View post</a></li>
    <li><a href="/posts/1/edit">Edit post</a></li>
</ul>
```


text:
using namespace node;
using namespace v8;

Handle<String> node_sigar_net_address_to_string(sigar_net_address_t *address)
{
	char addr_str[SIGAR_INET6_ADDRSTRLEN];
	sigar_net_address_to_string(NULL, address, addr_str);
    return String::New(addr_str);
}

// TODO: This is completly wrong
int node_sigar_str2net_address(Handle<String> bytes, sigar_net_address_t *address)
{
    //    long len = bytes->Length();
    //    long len = bytes->Utf8Length();
    String::Utf8Value name(bytes->ToString());
    long len = sizeof(name);
    switch (len) {
      case 4:
        address->family = sigar_net_address_t::SIGAR_AF_INET;
        break;
      case 4*4:
        address->family = sigar_net_address_t::SIGAR_AF_INET6;
        break;
      default:
        return EINVAL;
    }
    memcpy(*name, &address->addr.in6, len);
    return SIGAR_OK;
}


text:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <title>ActiveRecord::Inheritance::ClassMethods</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" href="../../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../css/main.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../css/github.css" type="text/css" media="screen" />

            Ruby on Rails 4.1.8

            Module
            ActiveRecord::Inheritance::ClassMethods

/home/kristof/.rvm/gems/ruby-2.2.0/gems/activerecord-4.1.8/lib/active_record/inheritance.rb

Methods

A

                abstract_class?

B

                base_class

C

                compute_type

D

                descends_from_active_record?

N

                new

S

                sti_name,

                symbolized_base_class,

                symbolized_sti_name

Attributes

              [RW]

            abstract_class

Set this to true if this is an abstract class (see
abstract_class?). If you are using inheritance with ActiveRecord and don't want child
classes to utilize the implied STI table name of the parent class, this
will need to be true. For example, given the following:

class SuperClass < ActiveRecord::Base
  self.abstract_class = true
end
class Child < SuperClass
  self.table_name = 'the_table_i_really_want'
end

self.abstract_class = true is required to make
Child<.find,.create, or any Arel method> use
the_table_i_really_want instead of a table called
super_classes

Instance Public methods

              abstract_class?()

            Link

Returns whether this class is an abstract class or not.

                Source:
                show

# File ../.rvm/gems/ruby-2.2.0/gems/activerecord-4.1.8/lib/active_record/inheritance.rb, line 99
def abstract_class?
  defined?(@abstract_class) && @abstract_class == true
end

              base_class()

            Link

Returns the class descending directly from ActiveRecord::Base, or an abstract class, if any,
in the inheritance hierarchy.

If A extends AR::Base, A.base_class will return A. If B descends from A
through some arbitrarily deep hierarchy, B.base_class will return A.

If B < A and C < B and if A is an #abstract_class
then both B.base_class and C.base_class would return B as the answer since
A is an abstract_class.

                Source:
                show

# File ../.rvm/gems/ruby-2.2.0/gems/activerecord-4.1.8/lib/active_record/inheritance.rb, line 69
def base_class
  unless self < Base
    raise ActiveRecordError, "#{name} doesn't belong in a hierarchy descending from ActiveRecord"
  end

  if superclass == Base || superclass.abstract_class?
    self
  else
    superclass.base_class
  end
end

              descends_from_active_record?()

            Link

Returns true if this does not need STI type condition. Returns
false if STI type condition needs to be applied.

                Source:
                show

# File ../.rvm/gems/ruby-2.2.0/gems/activerecord-4.1.8/lib/active_record/inheritance.rb, line 36
def descends_from_active_record?
  if self == Base
    false
  elsif superclass.abstract_class?
    superclass.descends_from_active_record?
  else
    superclass == Base || !columns_hash.include?(inheritance_column)
  end
end

              new(*args, &block)

            Link

Determines if one of the attributes passed in is the inheritance column,
and if the inheritance column is attr accessible, it initializes an
instance of the given subclass instead of the base class.

                Source:
                show

# File ../.rvm/gems/ruby-2.2.0/gems/activerecord-4.1.8/lib/active_record/inheritance.rb, line 17
def new(*args, &block)
  if abstract_class? || self == Base
    raise NotImplementedError, "#{self} is an abstract class and cannot be instantiated."
  end

  attrs = args.first
  if subclass_from_attributes?(attrs)
    subclass = subclass_from_attributes(attrs)
  end

  if subclass
    subclass.new(*args, &block)
  else
    super
  end
end

              sti_name()

            Link

                Source:
                show

# File ../.rvm/gems/ruby-2.2.0/gems/activerecord-4.1.8/lib/active_record/inheritance.rb, line 103
def sti_name
  store_full_sti_class ? name : name.demodulize
end

              symbolized_base_class()

            Link

                Source:
                show

# File ../.rvm/gems/ruby-2.2.0/gems/activerecord-4.1.8/lib/active_record/inheritance.rb, line 51
def symbolized_base_class
  ActiveSupport::Deprecation.warn("ActiveRecord::Base.symbolized_base_class is deprecated and will be removed without replacement.")
  @symbolized_base_class ||= base_class.to_s.to_sym
end

              symbolized_sti_name()

            Link

                Source:
                show

# File ../.rvm/gems/ruby-2.2.0/gems/activerecord-4.1.8/lib/active_record/inheritance.rb, line 56
def symbolized_sti_name
  ActiveSupport::Deprecation.warn("ActiveRecord::Base.symbolized_sti_name is deprecated and will be removed without replacement.")
  @symbolized_sti_name ||= sti_name.present? ? sti_name.to_sym : symbolized_base_class
end

Instance Protected methods

              compute_type(type_name)

            Link

Returns the class type of the record using the current module as a prefix.
So descendants of MyApp::Business::Account would appear as
MyApp::Business::AccountSubclass.

                Source:
                show

# File ../.rvm/gems/ruby-2.2.0/gems/activerecord-4.1.8/lib/active_record/inheritance.rb, line 111
def compute_type(type_name)
  if type_name.match(/^::/)
    # If the type is prefixed with a scope operator then we assume that
    # the type_name is an absolute reference.
    ActiveSupport::Dependencies.constantize(type_name)
  else
    # Build a list of candidates to search for
    candidates = []
    name.scan(/::|$/) { candidates.unshift "#{$`}::#{type_name}" }
    candidates << type_name

    candidates.each do |candidate|
      begin
        constant = ActiveSupport::Dependencies.constantize(candidate)
        return constant if candidate == constant.to_s
      # We don't want to swallow NoMethodError < NameError errors
      rescue NoMethodError
        raise
      rescue NameError
      end
    end

    raise NameError.new("uninitialized constant #{candidates.first}", candidates.first)
  end
end


text:
module Audited
  class Sweeper
    STORED_DATA = {
      current_remote_address: :remote_ip,
      current_request_uuid: :request_uuid,
      current_user: :current_user,
      doc_callback: :doc_callback
    }

    delegate :store, to: ::Audited

    def around(controller)
      self.controller = controller
      STORED_DATA.each { |k,m| store[k] = send(m) }
      yield
    ensure
      self.controller = nil
      STORED_DATA.keys.each { |k| store.delete(k) }
    end

    def current_user
      lambda { controller.send(Audited.current_user_method) if controller.respond_to?(Audited.current_user_method, true) }
    end

    def doc_callback
      lambda { controller.send(Audited.doc_callback_method, store[:audit_doc]) if controller.respond_to?(Audited.doc_callback_method, true) }
    end

    def remote_ip
      controller.try(:request).try(:remote_ip)
    end

    def request_uuid
      controller.try(:request).try(:uuid)
    end

    def controller
      store[:current_controller]
    end

    def controller=(value)
      store[:current_controller] = value
    end
  end
end

ActiveSupport.on_load(:action_controller) do
  if defined?(ActionController::Base)
    ActionController::Base.around_action Audited::Sweeper.new
  end
  if defined?(ActionController::API)
    ActionController::API.around_action Audited::Sweeper.new
  end
end


text:
require_relative '../../spec_helper'
require_lib 'reek/configuration/default_directive'

RSpec.describe Reek::Configuration::DefaultDirective do
  describe '#add' do
    subject { {}.extend(described_class) }

    it 'adds a smell configuration' do
      subject.add :UncommunicativeVariableName, enabled: false
      expect(subject).to eq(Reek::Smells::UncommunicativeVariableName => { enabled: false })
    end
  end
end


text:
<title>
"We have a right to strike"
</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<?php include "../../legacy-includes/Script.htmlf" ?>

<?php include "../../legacy-includes/TopLogo.htmlf" ?>

<?php include "../../legacy-includes/TopAd.htmlf" ?>

<?php include "../../legacy-includes/LeftButtons.htmlf" ?>

<?php include "../../legacy-includes/BodyInsert.htmlf" ?>

ON THE PICKET LINE

Minnesota state workers tell Gov. Jesse Ventura…

"We have a right to strike"

By Nicole Colson | October 12, 2001 | Page 15

MINNEAPOLIS--"Come on Jesse, you chicken!" That was the message one striking worker had for Minnesota Gov. Jesse Ventura as he sneaked into his office through a side entrance on October 4.

Ventura was trying to avoid some of the nearly 28,000 striking Minnesota state employees who walked off the job on October 1.

Strikers--nearly half of all state employees--are represented by AFSCME Council 6 and the Minnesota Association of Professional Employees (MAPE).

"This is the largest labor action ever in the state of Minnesota," AFSCME spokesperson Don Dindorf told Socialist Worker. "I saw a banner at one of the universities that read, 'This strike brought to you by the Ventura Administration.' And that's true."

AFSCME, which represents nearly 18,000 of the striking workers, rejected the state's final offer. The state's last offer included a 3 percent pay raise for each of two years, which doesn't even cover the cost of inflation. And the state is also asking for enormous cuts in health care coverage for AFSCME employees. Under the state's plan, employee co-payments would rise as much as 20 percent.

The 10,500 MAPE workers struck following the state's pathetic offer of a single 4 percent raise for two years--which wouldn't even take effect until 2002. With inflation, that would leave workers' real wages lower than at the end of their last contract.

During his election campaign, Ventura made much of the fact that he is a "union man." But that didn't stop him from stabbing workers in the back. He has authorized more than 1,000 National Guard troops to scab for strikers, and he's expected to hire of thousands of temps.

Ventura cynically used the September 11 tragedy to try to pressure the unions into calling off the strike, suggesting that strikers were unpatriotic. "This strike comes at a most unfortunate time," Ventura said. "Our citizens are still hurting from the devastating attack on September 11, we are coping with the possibility of a long and difficult war, and we are facing the prospect of an economy that is on the brink of recession."

But Minnesota workers have a long history of "sacrificing." "We sacrificed back in 1993, when we took a 0 percent raise," MAPE Communications Director Murray Cody said. "They promised that when times got better, they'd take care of us. But they never came through on that."

"It's insulting. We have union members who are veterans," Dindorf said. "We consider the right to strike and to organize to be fundamental rights."

Workers are taking a stand. Thousands of workers rallied on October 1 outside the state capitol, chanting, "Were we right? Yes we were!"

"We don't have to apologize for being out today at all," said AFSCME Executive Director Peter Benner. "We will win this."

<?php include "../../legacy-includes/BottomNavLinks.htmlf" ?>

<?php include "../../legacy-includes/RightAdFolder.htmlf" ?>


text:
package org.kohsuke.github;

import com.google.common.base.Predicate;
import com.google.common.collect.Iterables;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.SystemUtils;
import org.junit.Assert;
import org.junit.Assume;
import org.junit.Ignore;
import org.junit.Test;
import org.kohsuke.github.GHCommit.File;
import org.kohsuke.github.GHOrganization.Permission;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.Map.Entry;
import java.util.stream.Collectors;

import static org.hamcrest.Matchers.*;

/**
 * Unit test for simple App.
 */
public class AppTest extends AbstractGitHubWireMockTest {
    static final String GITHUB_API_TEST_REPO = "github-api-test";

    @Test
    public void testRepoCRUD() throws Exception {
        String targetName = "github-api-test-rename2";

        cleanupUserRepository("github-api-test-rename");
        cleanupUserRepository(targetName);

        GHRepository r = gitHub.createRepository("github-api-test-rename")
                .description("a test repository")
                .homepage("http://github-api.kohsuke.org/")
                .private_(false)
                .create();

        assertThat(r.hasIssues(), is(true));
        assertThat(r.hasWiki(), is(true));
        assertThat(r.hasDownloads(), is(true));
        assertThat(r.hasProjects(), is(true));

        r.enableIssueTracker(false);
        r.enableDownloads(false);
        r.enableWiki(false);
        r.enableProjects(false);

        r.renameTo(targetName);

        // local instance remains unchanged
        assertThat(r.getName(), equalTo("github-api-test-rename"));
        assertThat(r.hasIssues(), is(true));
        assertThat(r.hasWiki(), is(true));
        assertThat(r.hasDownloads(), is(true));
        assertThat(r.hasProjects(), is(true));

        r = gitHub.getMyself().getRepository(targetName);

        // values are updated
        assertThat(r.hasIssues(), is(false));
        assertThat(r.hasWiki(), is(false));
        assertThat(r.hasDownloads(), is(false));
        assertThat(r.getName(), equalTo(targetName));

        assertThat(r.hasProjects(), is(false));

        r.delete();
    }

    @Test
    public void testRepositoryWithAutoInitializationCRUD() throws Exception {
        String name = "github-api-test-autoinit";
        cleanupUserRepository(name);
        GHRepository r = gitHub.createRepository(name)
                .description("a test repository for auto init")
                .homepage("http://github-api.kohsuke.org/")
                .autoInit(true)
                .create();
        if (mockGitHub.isUseProxy()) {
            Thread.sleep(3000);
        }
        assertThat(r.getReadme(), notNullValue());

        r.delete();
    }

    private void cleanupUserRepository(final String name) throws IOException {
        if (mockGitHub.isUseProxy()) {
            cleanupRepository(getUser(getNonRecordingGitHub()).getLogin() + "/" + name);
        }
    }

    @Test
    public void testCredentialValid() throws IOException {
        assertThat(gitHub.isCredentialValid(), is(true));
        assertThat(gitHub.lastRateLimit().getCore(), not(instanceOf(GHRateLimit.UnknownLimitRecord.class)));
        assertThat(gitHub.lastRateLimit().getCore().getLimit(), equalTo(5000));

        gitHub = getGitHubBuilder().withOAuthToken("bogus", "user")
                .withEndpoint(mockGitHub.apiServer().baseUrl())
                .build();
        assertThat(gitHub.lastRateLimit(), sameInstance(GHRateLimit.DEFAULT));
        assertThat(gitHub.isCredentialValid(), is(false));
        // For invalid credentials, we get a 401 but it includes anonymous rate limit headers
        assertThat(gitHub.lastRateLimit().getCore(), not(instanceOf(GHRateLimit.UnknownLimitRecord.class)));
        assertThat(gitHub.lastRateLimit().getCore().getLimit(), equalTo(60));
    }

    @Test
    public void testCredentialValidEnterprise() throws IOException {
        // Simulated GHE: getRateLimit returns 404
        assertThat(gitHub.lastRateLimit(), sameInstance(GHRateLimit.DEFAULT));
        assertThat(gitHub.lastRateLimit().getCore().isExpired(), is(true));
        assertThat(gitHub.isCredentialValid(), is(true));

        // lastRateLimitUpdates because 404 still includes header rate limit info
        assertThat(gitHub.lastRateLimit(), notNullValue());
        assertThat(gitHub.lastRateLimit(), not(equalTo(GHRateLimit.DEFAULT)));
        assertThat(gitHub.lastRateLimit().getCore().isExpired(), is(false));

        gitHub = getGitHubBuilder().withOAuthToken("bogus", "user")
                .withEndpoint(mockGitHub.apiServer().baseUrl())
                .build();
        assertThat(gitHub.lastRateLimit(), sameInstance(GHRateLimit.DEFAULT));
        assertThat(gitHub.isCredentialValid(), is(false));
        // Simulated GHE: For invalid credentials, we get a 401 that does not include ratelimit info
        assertThat(gitHub.lastRateLimit(), sameInstance(GHRateLimit.DEFAULT));
    }

    @Test
    public void testIssueWithNoComment() throws IOException {
        GHRepository repository = gitHub.getRepository("kohsuke/test");
        GHIssue i = repository.getIssue(4);
        List<GHIssueComment> v = i.getComments();
        // System.out.println(v);
        assertThat(v, is(empty()));
    }

    @Test
    public void testIssueWithComment() throws IOException {
        GHRepository repository = gitHub.getRepository("kohsuke/test");
        GHIssue i = repository.getIssue(3);
        List<GHIssueComment> v = i.getComments();
        // System.out.println(v);
        assertThat(v.size(), equalTo(3));
        assertThat(v.get(0).getHtmlUrl().toString(),
                equalTo("https://github.com/kohsuke/test/issues/3#issuecomment-8547249"));
        assertThat(v.get(0).getUrl().toString(), endsWith("/repos/kohsuke/test/issues/comments/8547249"));
        assertThat(v.get(0).getNodeId(), equalTo("MDEyOklzc3VlQ29tbWVudDg1NDcyNDk="));
        assertThat(v.get(0).getParent().getNumber(), equalTo(3));
        assertThat(v.get(0).getParent().getId(), equalTo(6863845L));
        assertThat(v.get(0).getUser().getLogin(), equalTo("kohsuke"));
        assertThat(v.get(0).listReactions().toList(), is(empty()));

        assertThat(v.get(1).getHtmlUrl().toString(),
                equalTo("https://github.com/kohsuke/test/issues/3#issuecomment-8547251"));
        assertThat(v.get(1).getUrl().toString(), endsWith("/repos/kohsuke/test/issues/comments/8547251"));
        assertThat(v.get(1).getNodeId(), equalTo("MDEyOklzc3VlQ29tbWVudDg1NDcyNTE="));
        assertThat(v.get(1).getParent().getNumber(), equalTo(3));
        assertThat(v.get(1).getUser().getLogin(), equalTo("kohsuke"));
        List<GHReaction> reactions = v.get(1).listReactions().toList();
        assertThat(reactions.size(), equalTo(3));
        assertThat(reactions.stream().map(item -> item.getContent()).collect(Collectors.toList()),
                containsInAnyOrder(ReactionContent.EYES, ReactionContent.HOORAY, ReactionContent.ROCKET));

        // TODO: Add comment CRUD test

        GHReaction reaction = null;
        try {
            reaction = v.get(1).createReaction(ReactionContent.CONFUSED);
            v = i.getComments();
            reactions = v.get(1).listReactions().toList();
            assertThat(reactions.stream().map(item -> item.getContent()).collect(Collectors.toList()),
                    containsInAnyOrder(ReactionContent.CONFUSED,
                            ReactionContent.EYES,
                            ReactionContent.HOORAY,
                            ReactionContent.ROCKET));

            reaction.delete();
            reaction = null;
            v = i.getComments();
            reactions = v.get(1).listReactions().toList();
            assertThat(reactions.stream().map(item -> item.getContent()).collect(Collectors.toList()),
                    containsInAnyOrder(ReactionContent.EYES, ReactionContent.HOORAY, ReactionContent.ROCKET));
        } finally {
            if (reaction != null) {
                reaction.delete();
            }
        }
    }

    @Test
    public void testCreateIssue() throws IOException {
        GHUser u = getUser();
        GHRepository repository = getTestRepository();
        GHMilestone milestone = repository.createMilestone("Test Milestone Title3", "Test Milestone");
        GHIssue o = repository.createIssue("testing")
                .body("this is body")
                .assignee(u)
                .label("bug")
                .label("question")
                .milestone(milestone)
                .create();
        assertThat(o, notNullValue());
        assertThat(o.getBody(), equalTo("this is body"));

        // test locking
        assertThat(o.isLocked(), is(false));
        o.lock();
        o = repository.getIssue(o.getNumber());
        assertThat(o.isLocked(), is(true));
        o.unlock();
        o = repository.getIssue(o.getNumber());
        assertThat(o.isLocked(), is(false));

        o.close();
    }

    @Test
    public void testCreateAndListDeployments() throws IOException {
        GHRepository repository = getTestRepository();
        GHDeployment deployment = repository.createDeployment("main")
                .payload("{\"user\":\"atmos\",\"room_id\":123456}")
                .description("question")
                .environment("unittest")
                .create();
        try {
            assertThat(deployment.getCreator(), notNullValue());
            assertThat(deployment.getId(), notNullValue());
            List<GHDeployment> deployments = repository.listDeployments(null, "main", null, "unittest").toList();
            assertThat(deployments, notNullValue());
            assertThat(deployments, is(not(emptyIterable())));
            GHDeployment unitTestDeployment = deployments.get(0);
            assertThat(unitTestDeployment.getEnvironment(), equalTo("unittest"));
            assertThat(unitTestDeployment.getOriginalEnvironment(), equalTo("unittest"));
            assertThat(unitTestDeployment.isProductionEnvironment(), equalTo(false));
            assertThat(unitTestDeployment.isTransientEnvironment(), equalTo(false));
            assertThat(unitTestDeployment.getRef(), equalTo("main"));
        } finally {
            // deployment.delete();
            assert true;
        }
    }

    @Test
    public void testGetDeploymentStatuses() throws IOException {
        GHRepository repository = getTestRepository();
        GHDeployment deployment = repository.createDeployment("main")
                .description("question")
                .payload("{\"user\":\"atmos\",\"room_id\":123456}")
                .create();
        try {
            GHDeploymentStatus ghDeploymentStatus = deployment.createStatus(GHDeploymentState.QUEUED)
                    .description("success")
                    .targetUrl("http://www.github.com")
                    .logUrl("http://www.github.com/logurl")
                    .environmentUrl("http://www.github.com/envurl")
                    .environment("new-ci-env")
                    .create();
            Iterable<GHDeploymentStatus> deploymentStatuses = deployment.listStatuses();
            assertThat(deploymentStatuses, notNullValue());
            assertThat(Iterables.size(deploymentStatuses), equalTo(1));
            GHDeploymentStatus actualStatus = Iterables.get(deploymentStatuses, 0);
            assertThat(actualStatus.getId(), equalTo(ghDeploymentStatus.getId()));
            assertThat(actualStatus.getState(), equalTo(ghDeploymentStatus.getState()));
            assertThat(actualStatus.getLogUrl(), equalTo(ghDeploymentStatus.getLogUrl()));
            // Target url was deprecated and replaced with log url. The gh api will
            // prefer the log url value and return it in place of target url.
            assertThat(actualStatus.getLogUrl(), equalTo(ghDeploymentStatus.getTargetUrl()));
            assertThat(ghDeploymentStatus.getDeploymentUrl(), equalTo(deployment.getUrl()));
            assertThat(ghDeploymentStatus.getRepositoryUrl(), equalTo(repository.getUrl()));
        } finally {
            // deployment.delete();
            assert true;
        }
    }

    @Test
    public void testGetIssues() throws Exception {
        List<GHIssue> closedIssues = gitHub.getOrganization("hub4j")
                .getRepository("github-api")
                .getIssues(GHIssueState.CLOSED);
        // prior to using PagedIterable GHRepository.getIssues(GHIssueState) would only retrieve 30 issues
        assertThat(closedIssues.size(), greaterThan(150));
        String readRepoString = GitHub.getMappingObjectWriter().writeValueAsString(closedIssues.get(0));
    }

    @Test
    public void testQueryIssues() throws IOException {
        final GHRepository repo = gitHub.getOrganization("hub4j-test-org").getRepository("testQueryIssues");
        List<GHIssue> openBugIssues = repo.queryIssues()
                .milestone("1")
                .creator(gitHub.getMyself().getLogin())
                .state(GHIssueState.OPEN)
                .label("bug")
                .pageSize(10)
                .list()
                .toList();
        GHIssue issueWithMilestone = openBugIssues.get(0);
        assertThat(openBugIssues, is(not(empty())));
        assertThat(openBugIssues, hasSize(1));
        assertThat(issueWithMilestone.getTitle(), is("Issue with milestone"));
        assertThat(issueWithMilestone.getAssignee().getLogin(), is("bloslo"));
        assertThat(issueWithMilestone.getBody(), containsString("@bloslo"));

        List<GHIssue> openIssuesWithAssignee = repo.queryIssues()
                .assignee(gitHub.getMyself().getLogin())
                .state(GHIssueState.OPEN)
                .list()
                .toList();
        GHIssue issueWithAssignee = openIssuesWithAssignee.get(0);
        assertThat(openIssuesWithAssignee, is(not(empty())));
        assertThat(openIssuesWithAssignee, hasSize(1));
        assertThat(issueWithAssignee.getLabels(), hasSize(2));
        assertThat(issueWithAssignee.getMilestone(), is(notNullValue()));

        List<GHIssue> allIssuesSince = repo.queryIssues()
                .mentioned(gitHub.getMyself().getLogin())
                .state(GHIssueState.ALL)
                .since(1632411646L)
                .sort(GHIssueQueryBuilder.Sort.COMMENTS)
                .direction(GHDirection.ASC)
                .list()
                .toList();
        GHIssue issueSince = allIssuesSince.get(3);
        assertThat(allIssuesSince, is(not(empty())));
        assertThat(allIssuesSince, hasSize(4));
        assertThat(issueSince.getBody(), is("Test closed issue @bloslo"));
        assertThat(issueSince.getState(), is(GHIssueState.CLOSED));

        List<GHIssue> allIssuesWithLabels = repo.queryIssues()
                .label("bug")
                .label("test-label")
                .state(GHIssueState.ALL)
                .list()
                .toList();
        GHIssue issueWithLabel = allIssuesWithLabels.get(0);
        assertThat(allIssuesWithLabels, is(not(empty())));
        assertThat(allIssuesWithLabels, hasSize(5));
        assertThat(issueWithLabel.getComments(), hasSize(2));
        assertThat(issueWithLabel.getTitle(), is("Issue with comments"));

        List<GHIssue> issuesWithLabelNull = repo.queryIssues().label(null).list().toList();
        GHIssue issueWithLabelNull = issuesWithLabelNull.get(2);
        assertThat(issuesWithLabelNull, is(not(empty())));
        assertThat(issuesWithLabelNull, hasSize(6));
        assertThat(issueWithLabelNull.getTitle(), is("Closed issue"));
        assertThat(issueWithLabelNull.getBody(), is("Test closed issue @bloslo"));
        assertThat(issueWithLabelNull.getState(), is(GHIssueState.OPEN));

        List<GHIssue> issuesWithLabelEmptyString = repo.queryIssues().label("").state(GHIssueState.ALL).list().toList();
        GHIssue issueWithLabelEmptyString = issuesWithLabelEmptyString.get(0);
        assertThat(issuesWithLabelEmptyString, is(not(empty())));
        assertThat(issuesWithLabelEmptyString, hasSize(8));
        assertThat(issueWithLabelEmptyString.getTitle(), is("Closed issue"));
        assertThat(issueWithLabelEmptyString.getBody(), is("Test closed issue @bloslo"));
    }

    private GHRepository getTestRepository() throws IOException {
        return getTempRepository(GITHUB_API_TEST_REPO);
    }

    @Test
    public void testListIssues() throws IOException {
        Iterable<GHIssue> closedIssues = gitHub.getOrganization("hub4j")
                .getRepository("github-api")
                .listIssues(GHIssueState.CLOSED);

        int x = 0;
        for (GHIssue issue : closedIssues) {
            assertThat(issue, notNullValue());
            x++;
        }

        assertThat(x, greaterThan(150));
    }

    @Test
    public void testRateLimit() throws IOException {
        assertThat(gitHub.getRateLimit(), notNullValue());
    }

    @Test
    public void testMyOrganizations() throws IOException {
        Map<String, GHOrganization> org = gitHub.getMyOrganizations();
        assertThat(org.containsKey(null), is(false));
        // System.out.println(org);
    }

    @Test
    public void testMyOrganizationsContainMyTeams() throws IOException {
        Map<String, Set<GHTeam>> teams = gitHub.getMyTeams();
        Map<String, GHOrganization> myOrganizations = gitHub.getMyOrganizations();
        // GitHub no longer has default 'owners' team, so there may be organization memberships without a team
        // https://help.github.com/articles/about-improved-organization-permissions/
        assertThat(myOrganizations.keySet().containsAll(teams.keySet()), is(true));
    }

    @Test
    public void testMyTeamsShouldIncludeMyself() throws IOException {
        Map<String, Set<GHTeam>> teams = gitHub.getMyTeams();
        for (Entry<String, Set<GHTeam>> teamsPerOrg : teams.entrySet()) {
            String organizationName = teamsPerOrg.getKey();
            for (GHTeam team : teamsPerOrg.getValue()) {
                String teamName = team.getName();
                assertThat("Team " + teamName + " in organization " + organizationName + " does not contain myself",
                        shouldBelongToTeam(organizationName, teamName));
            }
        }
    }

    @Test
    public void testUserPublicOrganizationsWhenThereAreSome() throws IOException {
        // kohsuke had some public org memberships at the time Wiremock recorded the GitHub API responses
        GHUser user = new GHUser();
        user.login = "kohsuke";

        Map<String, GHOrganization> orgs = gitHub.getUserPublicOrganizations(user);
        assertThat(orgs.size(), greaterThan(0));
    }

    @Test
    public void testUserPublicOrganizationsWhenThereAreNone() throws IOException {
        // bitwiseman had no public org memberships at the time Wiremock recorded the GitHub API responses
        GHUser user = new GHUser();
        user.login = "bitwiseman";

        Map<String, GHOrganization> orgs = gitHub.getUserPublicOrganizations(user);
        assertThat(orgs.size(), equalTo(0));
    }

    private boolean shouldBelongToTeam(String organizationName, String teamName) throws IOException {
        GHOrganization org = gitHub.getOrganization(organizationName);
        assertThat(org, notNullValue());
        GHTeam team = org.getTeamByName(teamName);
        assertThat(team, notNullValue());
        return team.hasMember(gitHub.getMyself());
    }

    @Test
    public void testShouldFetchTeam() throws Exception {
        GHOrganization organization = gitHub.getOrganization(GITHUB_API_TEST_ORG);
        GHTeam teamByName = organization.getTeams().get("Core Developers");

        GHTeam teamById = gitHub.getTeam((int) teamByName.getId());
        assertThat(teamById, notNullValue());

        assertThat(teamById.getId(), equalTo(teamByName.getId()));
        assertThat(teamById.getDescription(), equalTo(teamByName.getDescription()));
    }

    @Test
    public void testShouldFetchTeamFromOrganization() throws Exception {
        GHOrganization organization = gitHub.getOrganization(GITHUB_API_TEST_ORG);
        GHTeam teamByName = organization.getTeams().get("Core Developers");

        GHTeam teamById = organization.getTeam(teamByName.getId());
        assertThat(teamById, notNullValue());

        assertThat(teamById.getId(), equalTo(teamByName.getId()));
        assertThat(teamById.getDescription(), equalTo(teamByName.getDescription()));

        GHTeam teamById2 = organization.getTeam(teamByName.getId());
        assertThat(teamById2, notNullValue());

        assertThat(teamById2.getId(), equalTo(teamByName.getId()));
        assertThat(teamById2.getDescription(), equalTo(teamByName.getDescription()));

    }

    @Ignore("Needs mocking check")
    @Test
    public void testFetchPullRequest() throws Exception {
        GHRepository r = gitHub.getOrganization("jenkinsci").getRepository("jenkins");
        assertThat(r.getMasterBranch(), equalTo("main"));
        assertThat(r.getDefaultBranch(), equalTo("main"));
        r.getPullRequest(1);
        r.getPullRequests(GHIssueState.OPEN);
    }

    @Ignore("Needs mocking check")
    @Test
    public void testFetchPullRequestAsList() throws Exception {
        GHRepository r = gitHub.getRepository("hub4j/github-api");
        assertThat(r.getMasterBranch(), equalTo("main"));
        PagedIterable<GHPullRequest> i = r.listPullRequests(GHIssueState.CLOSED);
        List<GHPullRequest> prs = i.toList();
        assertThat(prs, notNullValue());
        assertThat(prs, is(not(empty())));
    }

    @Test
    public void testGetAppInstallations() throws Exception {
        // To generate test data user-to-server OAuth access token was used
        // For more details pls read
        // https://docs.github.com/en/developers/apps/building-github-apps/identifying-and-authorizing-users-for-github-apps#identifying-users-on-your-site
        final PagedIterable<GHAppInstallation> appInstallation = gitHub.getMyself().getAppInstallations();

        assertThat(appInstallation.toList(), is(not(empty())));
        assertThat(appInstallation.toList().size(), is(1));
        final GHAppInstallation ghAppInstallation = appInstallation.toList().get(0);
        assertThat(ghAppInstallation.getAppId(), is(122478L));
        assertThat(ghAppInstallation.getAccount().getLogin(), is("t0m4uk1991"));
    }

    @Ignore("Needs mocking check")
    @Test
    public void testRepoPermissions() throws Exception {
        kohsuke();

        GHRepository r = gitHub.getOrganization(GITHUB_API_TEST_ORG).getRepository("github-api");
        assertThat(r.hasPullAccess(), is(true));

        r = gitHub.getOrganization("github").getRepository("hub");
        assertThat(r.hasAdminAccess(), is(false));
    }

    @Test
    public void testGetMyself() throws Exception {
        GHMyself me = gitHub.getMyself();
        assertThat(me, notNullValue());
        assertThat(me.root(), sameInstance(gitHub));
        assertThat(gitHub.getUser("bitwiseman"), notNullValue());
        PagedIterable<GHRepository> ghRepositories = me.listRepositories();
        assertThat(ghRepositories, is(not(emptyIterable())));
    }

    @Ignore("Needs mocking check")
    @Test
    public void testPublicKeys() throws Exception {
        List<GHKey> keys = gitHub.getMyself().getPublicKeys();
        assertThat(keys, is(not(empty())));
    }

    @Test
    public void testOrgFork() throws Exception {
        cleanupRepository(GITHUB_API_TEST_ORG + "/rubywm");
        gitHub.getRepository("kohsuke/rubywm").forkTo(gitHub.getOrganization(GITHUB_API_TEST_ORG));
    }

    @Test
    public void testGetTeamsForRepo() throws Exception {
        kohsuke();
        // 'Core Developers' and 'Owners'
        assertThat(gitHub.getOrganization(GITHUB_API_TEST_ORG).getRepository("testGetTeamsForRepo").getTeams().size(),
                equalTo(2));
    }

    @Test
    public void testMembership() throws Exception {
        Set<String> members = gitHub.getOrganization(GITHUB_API_TEST_ORG)
                .getRepository("jenkins")
                .getCollaboratorNames();
        // System.out.println(members.contains("kohsuke"));
    }

    @Test
    public void testMemberOrgs() throws Exception {
        HashSet<GHOrganization> o = gitHub.getUser("kohsuke").getOrganizations();
        assertThat(o, hasItem(hasProperty("name", equalTo("CloudBees"))));
    }

    @Test
    public void testOrgTeams() throws Exception {
        kohsuke();
        int sz = 0;
        for (GHTeam t : gitHub.getOrganization(GITHUB_API_TEST_ORG).listTeams()) {
            assertThat(t.getName(), notNullValue());
            sz++;
        }
        assertThat(sz, lessThan(100));
    }

    @Test
    public void testOrgTeamByName() throws Exception {
        kohsuke();
        GHTeam e = gitHub.getOrganization(GITHUB_API_TEST_ORG).getTeamByName("Core Developers");
        assertThat(e, notNullValue());
    }

    @Test
    public void testOrgTeamBySlug() throws Exception {
        kohsuke();
        GHTeam e = gitHub.getOrganization(GITHUB_API_TEST_ORG).getTeamBySlug("core-developers");
        assertThat(e, notNullValue());
    }

    @Test
    public void testCommit() throws Exception {
        GHCommit commit = gitHub.getUser("jenkinsci")
                .getRepository("jenkins")
                .getCommit("08c1c9970af4d609ae754fbe803e06186e3206f7");
        assertThat(commit.getParents().size(), equalTo(1));
        assertThat(commit.getFiles().size(), equalTo(1));
        assertThat(commit.getHtmlUrl().toString(),
                equalTo("https://github.com/jenkinsci/jenkins/commit/08c1c9970af4d609ae754fbe803e06186e3206f7"));
        assertThat(commit.getLinesAdded(), equalTo(40));
        assertThat(commit.getLinesChanged(), equalTo(48));
        assertThat(commit.getLinesDeleted(), equalTo(8));
        assertThat(commit.getParentSHA1s().size(), equalTo(1));
        assertThat(commit.getAuthoredDate(), equalTo(GitHubClient.parseDate("2012-04-24T00:16:52Z")));
        assertThat(commit.getCommitDate(), equalTo(GitHubClient.parseDate("2012-04-24T00:16:52Z")));
        assertThat(commit.getCommitShortInfo().getCommentCount(), equalTo(0));
        assertThat(commit.getCommitShortInfo().getAuthoredDate(), equalTo(commit.getAuthoredDate()));
        assertThat(commit.getCommitShortInfo().getCommitDate(), equalTo(commit.getCommitDate()));
        assertThat(commit.getCommitShortInfo().getMessage(), equalTo("creating an RC branch"));

        File f = commit.getFiles().get(0);
        assertThat(f.getLinesChanged(), equalTo(48));
        assertThat(f.getLinesAdded(), equalTo(40));
        assertThat(f.getLinesDeleted(), equalTo(8));
        assertThat(f.getPreviousFilename(), nullValue());
        assertThat(f.getPatch(), startsWith("@@ -54,6 +54,14 @@\n"));
        assertThat(f.getSha(), equalTo("04d3e54017542ad0ff46355eababacd4850ccba5"));
        assertThat(f.getBlobUrl().toString(),
                equalTo("https://github.com/jenkinsci/jenkins/blob/08c1c9970af4d609ae754fbe803e06186e3206f7/changelog.html"));
        assertThat(f.getRawUrl().toString(),
                equalTo("https://github.com/jenkinsci/jenkins/raw/08c1c9970af4d609ae754fbe803e06186e3206f7/changelog.html"));

        assertThat(f.getStatus(), equalTo("modified"));
        assertThat(f.getFileName(), equalTo("changelog.html"));

        // walk the tree
        GHTree t = commit.getTree();
        assertThat(IOUtils.toString(t.getEntry("todo.txt").readAsBlob()), containsString("executor rendering"));
        assertThat(t.getEntry("war").asTree(), notNullValue());
    }

    @Test
    public void testListCommits() throws Exception {
        List<String> sha1 = new ArrayList<String>();
        for (GHCommit c : gitHub.getUser("kohsuke").getRepository("empty-commit").listCommits()) {
            sha1.add(c.getSHA1());
        }
        assertThat(sha1.get(0), equalTo("fdfad6be4db6f96faea1f153fb447b479a7a9cb7"));
        assertThat(sha1.size(), equalTo(1));
    }

    @Ignore("Needs mocking check")
    @Test
    public void testBranches() throws Exception {
        Map<String, GHBranch> b = gitHub.getUser("jenkinsci").getRepository("jenkins").getBranches();
        // System.out.println(b);
    }

    @Test
    public void testCommitComment() throws Exception {
        GHRepository r = gitHub.getUser("jenkinsci").getRepository("jenkins");
        PagedIterable<GHCommitComment> comments = r.listCommitComments();
        List<GHCommitComment> batch = comments.iterator().nextPage();
        for (GHCommitComment comment : batch) {
            // System.out.println(comment.getBody());
            assertThat(r, sameInstance(comment.getOwner()));
        }
    }

    @Test
    public void testCreateCommitComment() throws Exception {
        GHCommit commit = gitHub.getUser("kohsuke")
                .getRepository("sandbox-ant")
                .getCommit("8ae38db0ea5837313ab5f39d43a6f73de3bd9000");

        assertThat(commit.getCommitShortInfo().getCommentCount(), equalTo(30));
        GHCommitComment c = commit.createComment("[testing](http://kohsuse.org/)");
        try {
            assertThat(c.getPath(), nullValue());
            assertThat(c.getLine(), equalTo(-1));
            assertThat(c.getHtmlUrl().toString(),
                    containsString(
                            "kohsuke/sandbox-ant/commit/8ae38db0ea5837313ab5f39d43a6f73de3bd9000#commitcomment-"));
            assertThat(c.listReactions().toList(), is(empty()));

            c.update("updated text");
            assertThat(c.getBody(), equalTo("updated text"));

            commit = gitHub.getUser("kohsuke")
                    .getRepository("sandbox-ant")
                    .getCommit("8ae38db0ea5837313ab5f39d43a6f73de3bd9000");

            assertThat(commit.getCommitShortInfo().getCommentCount(), equalTo(31));

        } finally {
            c.delete();
        }
    }

    @Test
    public void tryHook() throws Exception {
        final GHOrganization o = gitHub.getOrganization(GITHUB_API_TEST_ORG);
        final GHRepository r = o.getRepository("github-api");
        try {
            GHHook hook = r.createWebHook(new URL("http://www.google.com/"));
            assertThat(hook.getName(), equalTo("web"));
            assertThat(hook.getEvents().size(), equalTo(1));
            assertThat(hook.getEvents(), contains(GHEvent.PUSH));
            assertThat(hook.getConfig().size(), equalTo(3));
            assertThat(hook.isActive(), equalTo(true));

            GHHook hook2 = r.getHook((int) hook.getId());
            assertThat(hook2.getName(), equalTo("web"));
            assertThat(hook2.getEvents().size(), equalTo(1));
            assertThat(hook2.getEvents(), contains(GHEvent.PUSH));
            assertThat(hook2.getConfig().size(), equalTo(3));
            assertThat(hook2.isActive(), equalTo(true));
            hook2.ping();
            hook2.delete();
            final GHHook finalRepoHook = hook;
            GHFileNotFoundException e = Assert.assertThrows(GHFileNotFoundException.class,
                    () -> r.getHook((int) finalRepoHook.getId()));
            assertThat(e.getMessage(),
                    containsString("repos/hub4j-test-org/github-api/hooks/" + finalRepoHook.getId()));
            assertThat(e.getMessage(), containsString("rest/reference/repos#get-a-repository-webhook"));

            hook = r.createWebHook(new URL("http://www.google.com/"));
            r.deleteHook((int) hook.getId());

            hook = o.createWebHook(new URL("http://www.google.com/"));
            assertThat(hook.getName(), equalTo("web"));
            assertThat(hook.getEvents().size(), equalTo(1));
            assertThat(hook.getEvents(), contains(GHEvent.PUSH));
            assertThat(hook.getConfig().size(), equalTo(3));
            assertThat(hook.isActive(), equalTo(true));

            hook2 = o.getHook((int) hook.getId());
            assertThat(hook2.getName(), equalTo("web"));
            assertThat(hook2.getEvents().size(), equalTo(1));
            assertThat(hook2.getEvents(), contains(GHEvent.PUSH));
            assertThat(hook2.getConfig().size(), equalTo(3));
            assertThat(hook2.isActive(), equalTo(true));
            hook2.ping();
            hook2.delete();

            final GHHook finalOrgHook = hook;
            GHFileNotFoundException e2 = Assert.assertThrows(GHFileNotFoundException.class,
                    () -> o.getHook((int) finalOrgHook.getId()));
            assertThat(e2.getMessage(), containsString("orgs/hub4j-test-org/hooks/" + finalOrgHook.getId()));
            assertThat(e2.getMessage(), containsString("rest/reference/orgs#get-an-organization-webhook"));

            hook = o.createWebHook(new URL("http://www.google.com/"));
            o.deleteHook((int) hook.getId());

            // System.out.println(hook);
        } finally {
            if (mockGitHub.isUseProxy()) {
                GHRepository cleanupRepo = getNonRecordingGitHub().getOrganization(GITHUB_API_TEST_ORG)
                        .getRepository("github-api");
                for (GHHook h : cleanupRepo.getHooks()) {
                    h.delete();
                }
            }
        }
    }

    @Test
    public void testEventApi() throws Exception {
        for (GHEventInfo ev : gitHub.getEvents()) {
            if (ev.getType() == GHEvent.PULL_REQUEST) {
                if (ev.getId() == 10680625394L) {
                    assertThat(ev.getActorLogin(), equalTo("pull[bot]"));
                    assertThat(ev.getOrganization(), nullValue());
                    assertThat(ev.getRepository().getFullName(), equalTo("daddyfatstacksBIG/lerna"));
                    assertThat(ev.getCreatedAt(), equalTo(GitHubClient.parseDate("2019-10-21T21:54:52Z")));
                    assertThat(ev.getType(), equalTo(GHEvent.PULL_REQUEST));
                }

                GHEventPayload.PullRequest pr = ev.getPayload(GHEventPayload.PullRequest.class);
                assertThat(pr.getNumber(), is(pr.getPullRequest().getNumber()));
            }
        }
    }

    @Ignore("Needs mocking check")
    @Test
    public void testApp() throws IOException {
        // System.out.println(gitHub.getMyself().getEmails());

        // GHRepository r = gitHub.getOrganization("jenkinsci").createRepository("kktest4", "Kohsuke's test",
        // "http://kohsuke.org/", "Everyone", true);
        // r.fork();

        // tryDisablingIssueTrackers(gitHub);

        // tryDisablingWiki(gitHub);

        // GHPullRequest i = gitHub.getOrganization("jenkinsci").getRepository("sandbox").getPullRequest(1);
        // for (GHIssueComment c : i.getComments())
        // // System.out.println(c);
        // // System.out.println(i);

        // gitHub.getMyself().getRepository("perforce-plugin").setEmailServiceHook("kk@kohsuke.org");

        // tryRenaming(gitHub);
        // tryOrgFork(gitHub);

        // testOrganization(gitHub);
        // testPostCommitHook(gitHub);

        // tryTeamCreation(gitHub);

        // t.add(gitHub.getMyself());
        // // System.out.println(t.getMembers());
        // t.remove(gitHub.getMyself());
        // // System.out.println(t.getMembers());

        // GHRepository r = gitHub.getOrganization("HudsonLabs").createRepository("auto-test", "some description",
        // "http://kohsuke.org/", "Plugin Developers", true);

        // r.
        // GitHub hub = GitHub.connectAnonymously();
        //// hub.createRepository("test","test repository",null,true);
        //// hub.getUserTest("kohsuke").getRepository("test").delete();
        //
        // // System.out.println(hub.getUserTest("kohsuke").getRepository("hudson").getCollaborators());
    }

    private void tryDisablingIssueTrackers(GitHub gitHub) throws IOException {
        for (GHRepository r : gitHub.getOrganization("jenkinsci").getRepositories().values()) {
            if (r.hasIssues()) {
                if (r.getOpenIssueCount() == 0) {
                    // System.out.println("DISABLED " + r.getName());
                    r.enableIssueTracker(false);
                } else {
                    // System.out.println("UNTOUCHED " + r.getName());
                }
            }
        }
    }

    private void tryDisablingWiki(GitHub gitHub) throws IOException {
        for (GHRepository r : gitHub.getOrganization("jenkinsci").getRepositories().values()) {
            if (r.hasWiki()) {
                // System.out.println("DISABLED " + r.getName());
                r.enableWiki(false);
            }
        }
    }

    private void tryUpdatingIssueTracker(GitHub gitHub) throws IOException {
        GHRepository r = gitHub.getOrganization("jenkinsci").getRepository("lib-task-reactor");
        // System.out.println(r.hasIssues());
        // System.out.println(r.getOpenIssueCount());
        r.enableIssueTracker(false);
    }

    private void tryRenaming(GitHub gitHub) throws IOException {
        gitHub.getUser("kohsuke").getRepository("test").renameTo("test2");
    }

    private void tryTeamCreation(GitHub gitHub) throws IOException {
        GHOrganization o = gitHub.getOrganization("HudsonLabs");
        GHTeam t = o.createTeam("auto team", Permission.PUSH);
        t.add(o.getRepository("auto-test"));
    }

    private void testPostCommitHook(GitHub gitHub) throws IOException {
        GHRepository r = gitHub.getMyself().getRepository("foo");
        Set<URL> hooks = r.getPostCommitHooks();
        hooks.add(new URL("http://kohsuke.org/test"));
        // System.out.println(hooks);
        hooks.remove(new URL("http://kohsuke.org/test"));
        // System.out.println(hooks);
    }

    @Test
    public void testOrgRepositories() throws IOException {
        kohsuke();
        GHOrganization j = gitHub.getOrganization("jenkinsci");
        long start = System.currentTimeMillis();
        Map<String, GHRepository> repos = j.getRepositories();
        long end = System.currentTimeMillis();
        // System.out.printf("%d repositories in %dms\n", repos.size(), end - start);
    }

    @Test
    public void testOrganization() throws IOException {
        kohsuke();
        GHOrganization j = gitHub.getOrganization(GITHUB_API_TEST_ORG);
        GHTeam t = j.getTeams().get("Core Developers");

        assertThat(j.getRepository("jenkins"), notNullValue());

        // t.add(labs.getRepository("xyz"));
    }

    @Test
    public void testCommitStatus() throws Exception {
        GHRepository r = gitHub.getRepository("hub4j/github-api");

        GHCommitStatus state;

        // state = r.createCommitStatus("ecbfdd7315ef2cf04b2be7f11a072ce0bd00c396", GHCommitState.FAILURE,
        // "http://kohsuke.org/", "testing!");

        List<GHCommitStatus> lst = r.listCommitStatuses("ecbfdd7315ef2cf04b2be7f11a072ce0bd00c396").toList();
        state = lst.get(0);
        // System.out.println(state);
        assertThat(state.getDescription(), equalTo("testing!"));
        assertThat(state.getTargetUrl(), equalTo("http://kohsuke.org/"));
        assertThat(state.getCreator().getLogin(), equalTo("kohsuke"));
    }

    @Test
    public void testCommitShortInfo() throws Exception {
        GHRepository r = gitHub.getRepository("hub4j/github-api");
        GHCommit commit = r.getCommit("86a2e245aa6d71d54923655066049d9e21a15f23");
        assertThat("Kohsuke Kawaguchi", equalTo(commit.getCommitShortInfo().getAuthor().getName()));
        assertThat("doc", equalTo(commit.getCommitShortInfo().getMessage()));
        assertThat(commit.getCommitShortInfo().getVerification().isVerified(), is(false));
        assertThat(GHVerification.Reason.UNSIGNED, equalTo(commit.getCommitShortInfo().getVerification().getReason()));
        assertThat(commit.getCommitShortInfo().getAuthor().getDate().toInstant().getEpochSecond(),
                equalTo(1271650361L));
        assertThat(commit.getCommitShortInfo().getCommitter().getDate().toInstant().getEpochSecond(),
                equalTo(1271650361L));
    }

    @Ignore("Needs mocking check")
    @Test
    public void testPullRequestPopulate() throws Exception {
        GHRepository r = gitHub.getUser("kohsuke").getRepository("github-api");
        GHPullRequest p = r.getPullRequest(17);
        GHUser u = p.getUser();
        assertThat(u.getName(), notNullValue());
    }

    @Test
    public void testCheckMembership() throws Exception {
        kohsuke();
        GHOrganization j = gitHub.getOrganization("jenkinsci");
        GHUser kohsuke = gitHub.getUser("kohsuke");
        GHUser b = gitHub.getUser("b");

        assertThat(j.hasMember(kohsuke), is(true));
        assertThat(j.hasMember(b), is(false));

        assertThat(j.hasPublicMember(kohsuke), is(true));
        assertThat(j.hasPublicMember(b), is(false));
    }

    @Test
    public void testRef() throws IOException {
        GHRef mainRef = gitHub.getRepository("jenkinsci/jenkins").getRef("heads/main");
        assertThat(mainRef.getUrl().toString(),
                equalTo(mockGitHub.apiServer().baseUrl() + "/repos/jenkinsci/jenkins/git/refs/heads/main"));
    }

    @Test
    public void directoryListing() throws IOException {
        List<GHContent> children = gitHub.getRepository("jenkinsci/jenkins").getDirectoryContent("core");
        for (GHContent c : children) {
            // System.out.println(c.getName());
            if (c.isDirectory()) {
                for (GHContent d : c.listDirectoryContent()) {
                    // System.out.println(" " + d.getName());
                }
            }
        }
    }

    @Ignore("Needs mocking check")
    @Test
    public void testAddDeployKey() throws IOException {
        GHRepository myRepository = getTestRepository();
        final GHDeployKey newDeployKey = myRepository.addDeployKey("test",
                "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDUt0RAycC5cS42JKh6SecfFZBR1RrF+2hYMctz4mk74/arBE+wFb7fnSHGzdGKX2h5CFOWODifRCJVhB7hlVxodxe+QkQQYAEL/x1WVCJnGgTGQGOrhOMj95V3UE5pQKhsKD608C+u5tSofcWXLToP1/wZ7U4/AHjqYi08OLsWToHCax55TZkvdt2jo0hbIoYU+XI9Q8Uv4ONDN1oabiOdgeKi8+crvHAuvNleiBhWVBzFh8KdfzaH5uNdw7ihhFjEd1vzqACsjCINCjdMfzl6jD9ExuWuE92nZJnucls2cEoNC6k2aPmrZDg9hA32FXVpyseY+bDUWFU6LO2LG6PB kohsuke@atlas");
        try {
            assertThat(newDeployKey.getId(), notNullValue());

            GHDeployKey k = Iterables.find(myRepository.getDeployKeys(), new Predicate<GHDeployKey>() {
                public boolean apply(GHDeployKey deployKey) {
                    return newDeployKey.getId() == deployKey.getId();
                }
            });
            assertThat(k, notNullValue());
        } finally {
            newDeployKey.delete();
        }
    }

    @Ignore("Needs mocking check")
    @Test
    public void testCommitStatusContext() throws IOException {
        GHRepository myRepository = getTestRepository();
        GHRef mainRef = myRepository.getRef("heads/main");
        GHCommitStatus commitStatus = myRepository.createCommitStatus(mainRef.getObject()
                .getSha(), GHCommitState.SUCCESS, "http://www.example.com", "test", "test/context");
        assertThat(commitStatus.getContext(), equalTo("test/context"));

    }

    @Ignore("Needs mocking check")
    @Test
    public void testMemberPagenation() throws IOException {
        Set<GHUser> all = new HashSet<GHUser>();
        for (GHUser u : gitHub.getOrganization(GITHUB_API_TEST_ORG).getTeamByName("Core Developers").listMembers()) {
            // System.out.println(u.getLogin());
            all.add(u);
        }
        assertThat(all, is(not(empty())));
    }

    @Test
    public void testCommitSearch() throws IOException {
        PagedSearchIterable<GHCommit> r = gitHub.searchCommits()
                .org("github-api")
                .repo("github-api")
                .author("kohsuke")
                .sort(GHCommitSearchBuilder.Sort.COMMITTER_DATE)
                .list();
        assertThat(r.getTotalCount(), greaterThan(0));

        GHCommit firstCommit = r.iterator().next();
        assertThat(firstCommit.getFiles(), is(not(empty())));
    }

    @Test
    public void testIssueSearch() throws IOException {
        PagedSearchIterable<GHIssue> r = gitHub.searchIssues()
                .mentions("kohsuke")
                .isOpen()
                .sort(GHIssueSearchBuilder.Sort.UPDATED)
                .list();
        assertThat(r.getTotalCount(), greaterThan(0));
        for (GHIssue issue : r) {
            assertThat(issue.getTitle(), notNullValue());
            PagedIterable<GHIssueComment> comments = issue.listComments();
            for (GHIssueComment comment : comments) {
                assertThat(comment, notNullValue());
            }
        }
    }

    @Test // issue #99
    public void testReadme() throws IOException {
        GHContent readme = gitHub.getRepository("hub4j-test-org/test-readme").getReadme();
        assertThat("README.md", equalTo(readme.getName()));
        assertThat("This is a markdown readme.\n", equalTo(readme.getContent()));
    }

    @Ignore("Needs mocking check")
    @Test
    public void testTrees() throws IOException {
        GHTree mainTree = gitHub.getRepository("hub4j/github-api").getTree("main");
        boolean foundReadme = false;
        for (GHTreeEntry e : mainTree.getTree()) {
            if ("readme".equalsIgnoreCase(e.getPath().replaceAll("\\.md", ""))) {
                foundReadme = true;
                break;
            }
        }
        assertThat(foundReadme, is(true));
    }

    @Test
    public void testTreesRecursive() throws IOException {
        GHTree mainTree = gitHub.getRepository("hub4j/github-api").getTreeRecursive("main", 1);
        boolean foundThisFile = false;
        for (GHTreeEntry e : mainTree.getTree()) {
            if (e.getPath().endsWith(AppTest.class.getSimpleName() + ".java")) {
                foundThisFile = true;
                assertThat(e.getPath(), equalTo("src/test/java/org/kohsuke/github/AppTest.java"));
                assertThat(e.getSha(), equalTo("baad7a7c4cf409f610a0e8c7eba17664eb655c44"));
                assertThat(e.getMode(), equalTo("100755"));
                assertThat(e.getSize(), greaterThan(30000L));
                assertThat(e.getUrl().toString(),
                        containsString("/repos/hub4j/github-api/git/blobs/baad7a7c4cf409f610a0e8c7eba17664eb655c44"));
                GHBlob blob = e.asBlob();
                assertThat(e.asBlob().getUrl().toString(),
                        containsString("/repos/hub4j/github-api/git/blobs/baad7a7c4cf409f610a0e8c7eba17664eb655c44"));
                break;
            }

        }
        assertThat(foundThisFile, is(true));
    }

    @Test
    public void testRepoLabel() throws IOException {
        cleanupLabel("test");
        cleanupLabel("test2");

        GHRepository r = gitHub.getRepository("hub4j-test-org/test-labels");
        List<GHLabel> lst = r.listLabels().toList();
        for (GHLabel l : lst) {
            assertThat(l.getUrl(), containsString(l.getName().replace(" ", "%20")));
        }
        assertThat(lst.size(), greaterThan(5));
        GHLabel e = r.getLabel("enhancement");
        assertThat(e.getName(), equalTo("enhancement"));
        assertThat(e.getUrl(), notNullValue());
        assertThat(e.getId(), equalTo(177339106L));
        assertThat(e.getNodeId(), equalTo("MDU6TGFiZWwxNzczMzkxMDY="));
        assertThat(e.isDefault(), is(true));
        assertThat(e.getColor(), matchesPattern("[0-9a-fA-F]{6}"));

        GHLabel t = null;
        GHLabel t2 = null;
        GHLabel t3 = null;
        try {// CRUD
            t = r.createLabel("test", "123456");
            t2 = r.getLabel("test");
            assertThat(t, not(sameInstance(t2)));
            assertThat(t, equalTo(t2));

            assertThat(t2.isDefault(), is(false));

            assertThat(t2.getId(), equalTo(t.getId()));
            assertThat(t2.getNodeId(), equalTo(t.getNodeId()));
            assertThat(t2.getName(), equalTo(t.getName()));
            assertThat("123456", equalTo(t.getColor()));
            assertThat(t2.getColor(), equalTo(t.getColor()));
            assertThat("", equalTo(t.getDescription()));
            assertThat(t2.getDescription(), equalTo(t.getDescription()));
            assertThat(t2.getUrl(), equalTo(t.getUrl()));
            assertThat(t2.isDefault(), equalTo(t.isDefault()));

            // update works on multiple changes in one call
            t3 = t.update().color("000000").description("It is dark!").done();

            // instances behave as immutable by default. Update returns a new updated instance.
            assertThat(t, not(sameInstance(t2)));
            assertThat(t, equalTo(t2));

            assertThat(t, not(sameInstance(t3)));
            assertThat(t, not(equalTo(t3)));

            assertThat("123456", equalTo(t.getColor()));
            assertThat("", equalTo(t.getDescription()));
            assertThat("000000", equalTo(t3.getColor()));
            assertThat("It is dark!", equalTo(t3.getDescription()));

            // Test deprecated methods
            t.setDescription("Deprecated");
            t = r.getLabel("test");

            // By using the old instance t when calling setDescription it also sets color to the old value
            // this is a bad behavior, but it is expected
            assertThat("123456", equalTo(t.getColor()));
            assertThat("Deprecated", equalTo(t.getDescription()));

            t.setColor("000000");
            t = r.getLabel("test");
            assertThat("000000", equalTo(t.getColor()));
            assertThat("Deprecated", equalTo(t.getDescription()));

            // set() makes a single change
            t3 = t.set().description("this is also a test");

            // instances behave as immutable by default. Update returns a new updated instance.
            assertThat(t, not(sameInstance(t3)));
            assertThat(t, not(equalTo(t3)));

            assertThat("000000", equalTo(t3.getColor()));
            assertThat("this is also a test", equalTo(t3.getDescription()));

            t.delete();
            try {
                t = r.getLabel("test");
                fail("Test label should be deleted.");
            } catch (IOException ex) {
                assertThat(ex, instanceOf(FileNotFoundException.class));
            }

            t = r.createLabel("test2", "123457", "this is a different test");
            t2 = r.getLabel("test2");

            assertThat(t2.getName(), equalTo(t.getName()));
            assertThat("123457", equalTo(t.getColor()));
            assertThat(t2.getColor(), equalTo(t.getColor()));
            assertThat("this is a different test", equalTo(t.getDescription()));
            assertThat(t2.getDescription(), equalTo(t.getDescription()));
            assertThat(t2.getUrl(), equalTo(t.getUrl()));
            t.delete();

            // Allow null description
            t = GHLabel.create(r).name("test2").color("123458").done();
            assertThat(t.getName(), equalTo("test2"));
            assertThat(t.getDescription(), is(nullValue()));

        } finally {
            cleanupLabel("test");
            cleanupLabel("test2");
        }
    }

    void cleanupLabel(String name) {
        if (mockGitHub.isUseProxy()) {
            try {
                GHLabel t = getNonRecordingGitHub().getRepository("hub4j-test-org/test-labels").getLabel(name);
                t.delete();
            } catch (IOException e) {

            }
        }
    }

    @Test
    public void testSubscribers() throws IOException {
        boolean bitwiseman = false;
        GHRepository mr = gitHub.getRepository("bitwiseman/github-api");
        for (GHUser u : mr.listSubscribers()) {
            bitwiseman |= u.getLogin().equals("bitwiseman");
        }
        assertThat(bitwiseman, is(true));

        boolean githubApiFound = false;
        for (GHRepository r : gitHub.getUser("bitwiseman").listRepositories()) {
            githubApiFound |= r.equals(mr);
        }
        assertThat(githubApiFound, is(true));
    }

    @Test
    public void notifications() throws Exception {
        boolean found = false;
        for (GHThread t : gitHub.listNotifications().nonBlocking(true).read(true)) {
            if (!found) {
                found = true;
                // both read and unread are included
                assertThat(t.getTitle(), is("Create a Jenkinsfile for Librecores CI in mor1kx"));
                assertThat(t.getLastReadAt(), notNullValue());
                assertThat(t.isRead(), equalTo(true));

                t.markAsRead(); // test this by calling it once on old notfication
            }
            assertThat(t.getReason(), oneOf("subscribed", "mention", "review_requested", "comment"));
            assertThat(t.getTitle(), notNullValue());
            assertThat(t.getLastCommentUrl(), notNullValue());
            assertThat(t.getRepository(), notNullValue());
            assertThat(t.getUpdatedAt(), notNullValue());
            assertThat(t.getType(), oneOf("Issue", "PullRequest"));

            // both thread an unread are included
            // assertThat(t.getLastReadAt(), notNullValue());
            // assertThat(t.isRead(), equalTo(true));

            // Doesn't exist on threads but is part of GHObject. :(
            assertThat(t.getCreatedAt(), nullValue());

        }
        assertThat(found, is(true));
        gitHub.listNotifications().markAsRead();
    }

    @Ignore("Needs mocking check")
    @Test
    public void checkToString() throws Exception {
        // Just basic code coverage to make sure toString() doesn't blow up
        GHUser u = gitHub.getUser("rails");
        // System.out.println(u);
        GHRepository r = u.getRepository("rails");
        // System.out.println(r);
        // System.out.println(r.getIssue(1));
    }

    @Test
    public void reactions() throws Exception {
        GHIssue i = gitHub.getRepository("hub4j/github-api").getIssue(311);

        List<GHReaction> l;
        // retrieval
        l = i.listReactions().toList();
        assertThat(l.size(), equalTo(1));

        assertThat(l.get(0).getUser().getLogin(), is("kohsuke"));
        assertThat(l.get(0).getContent(), is(ReactionContent.HEART));

        // CRUD
        GHReaction a;
        a = i.createReaction(ReactionContent.HOORAY);
        assertThat(a.getUser().getLogin(), is(gitHub.getMyself().getLogin()));
        assertThat(a.getContent(), is(ReactionContent.HOORAY));
        a.delete();

        l = i.listReactions().toList();
        assertThat(l.size(), equalTo(1));

        a = i.createReaction(ReactionContent.PLUS_ONE);
        assertThat(a.getUser().getLogin(), is(gitHub.getMyself().getLogin()));
        assertThat(a.getContent(), is(ReactionContent.PLUS_ONE));

        a = i.createReaction(ReactionContent.CONFUSED);
        assertThat(a.getUser().getLogin(), is(gitHub.getMyself().getLogin()));
        assertThat(a.getContent(), is(ReactionContent.CONFUSED));

        a = i.createReaction(ReactionContent.EYES);
        assertThat(a.getUser().getLogin(), is(gitHub.getMyself().getLogin()));
        assertThat(a.getContent(), is(ReactionContent.EYES));

        a = i.createReaction(ReactionContent.ROCKET);
        assertThat(a.getUser().getLogin(), is(gitHub.getMyself().getLogin()));
        assertThat(a.getContent(), is(ReactionContent.ROCKET));

        l = i.listReactions().toList();
        assertThat(l.size(), equalTo(5));
        assertThat(l.get(0).getUser().getLogin(), is("kohsuke"));
        assertThat(l.get(0).getContent(), is(ReactionContent.HEART));
        assertThat(l.get(1).getUser().getLogin(), is(gitHub.getMyself().getLogin()));
        assertThat(l.get(1).getContent(), is(ReactionContent.PLUS_ONE));
        assertThat(l.get(2).getUser().getLogin(), is(gitHub.getMyself().getLogin()));
        assertThat(l.get(2).getContent(), is(ReactionContent.CONFUSED));
        assertThat(l.get(3).getUser().getLogin(), is(gitHub.getMyself().getLogin()));
        assertThat(l.get(3).getContent(), is(ReactionContent.EYES));
        assertThat(l.get(4).getUser().getLogin(), is(gitHub.getMyself().getLogin()));
        assertThat(l.get(4).getContent(), is(ReactionContent.ROCKET));

        l.get(1).delete();
        l.get(2).delete();
        l.get(3).delete();
        l.get(4).delete();

        l = i.listReactions().toList();
        assertThat(l.size(), equalTo(1));
    }

    @Test
    public void listOrgMemberships() throws Exception {
        GHMyself me = gitHub.getMyself();
        for (GHMembership m : me.listOrgMemberships()) {
            assertThat(m.getUser(), is((GHUser) me));
            assertThat(m.getState(), notNullValue());
            assertThat(m.getRole(), notNullValue());
        }
    }

    @Test
    public void blob() throws Exception {
        Assume.assumeFalse(SystemUtils.IS_OS_WINDOWS);

        GHRepository r = gitHub.getRepository("hub4j/github-api");
        String sha1 = "a12243f2fc5b8c2ba47dd677d0b0c7583539584d";

        verifyBlobContent(r.readBlob(sha1));

        GHBlob blob = r.getBlob(sha1);
        verifyBlobContent(blob.read());
        assertThat(blob.getSha(), is("a12243f2fc5b8c2ba47dd677d0b0c7583539584d"));
        assertThat(blob.getSize(), is(1104L));
    }

    private void verifyBlobContent(InputStream is) throws Exception {
        String content = new String(IOUtils.toByteArray(is), StandardCharsets.UTF_8);
        assertThat(content, containsString("Copyright (c) 2011- Kohsuke Kawaguchi and other contributors"));
        assertThat(content, containsString("FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR"));
        assertThat(content.length(), is(1104));
    }
}


text:
using Nancy;
using Nancy.ErrorHandling;
using Nancy.IO;
using System;
using System.IO;
using System.Reflection;
using System.Text;

namespace MZBlog.Web.ErrorHandling
{
    public class MZBlog404Handler : IStatusCodeHandler
    {
        public bool HandlesStatusCode(HttpStatusCode statusCode, NancyContext context)
        {
            return (int)statusCode == 404;
        }

        public void Handle(HttpStatusCode statusCode, NancyContext context)
        {
            context.Response.ContentType = "text/html";
            context.Response.Contents = s =>
                {
                    using (var writer = new StreamWriter(new UnclosableStreamWrapper(s), Encoding.UTF8))
                    {
                        writer.Write(LoadResource("404.html"));
                    }
                };
        }

        private static string LoadResource(string filename)
        {
            var resourceStream = Assembly.GetCallingAssembly().GetManifestResourceStream(String.Format("MZBlog.Web.ErrorHandling.Resources.{0}", filename));

            if (resourceStream == null)
            {
                return string.Empty;
            }

            using (var reader = new StreamReader(resourceStream))
            {
                return reader.ReadToEnd();
            }
        }
    }
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<title>SoundManager 2 Template</title>

<link rel="stylesheet" href="template.css" />

SoundManager 2 Template Example

This is a basic template for adding SoundManager to your page.

How it works

This page includes the SM2 script, which starts up on its own as appropriate. By default it will try to start as soon as possible.

The minimal code needed to get SoundManager 2 going is below, with configurable parts. You can copy/paste it to get started.

<!-- include SM2 library -->
<script type="text/javascript" src="/path/to/soundmanager2.js"></script>

<!-- configure it for your use -->
<script type="text/javascript">

soundManager.url = '/path/to/sm2-flash-files/'; // directory where SM2 .SWFs live

/*
 * Note that SoundManager will determine and append the appropriate .SWF file to the URL,
 * eg. /path/to/sm2-flash-files/soundmanager2.swf automatically.
 *
 * Bonus: Read up on HTML5 audio support, if you're feeling adventurous.
 * iPad/iPhone and devices without flash installed will always attempt to use it.
 *
 * Also, See the flashblock demo when you want to start getting fancy.
*/

// disable debug mode after development/testing..
// soundManager.debugMode = false;

// The basics: onready() callback

soundManager.onready(function(){

  // SM2 has loaded - now you can create and play sounds!

  var mySound = soundManager.createSound({
    id: 'aSound',
    url: '/path/to/an.mp3'
    // onload: myOnloadHandler,
    // other options here..
  });

  mySound.play();

});

// Optional: ontimeout() callback for handling start-up failure

soundManager.ontimeout(function(){

  // Hrmm, SM2 could not start. Flash blocker involved? Show an error, etc.?

});

</script>

Handling flash blockers

It's good to let users see the flash component of SM2, so those with flash blockers can unblock it and allow SM2 to start. For more info on this, see the Flashblock example.

Making SM2 wait for window.onload()

If you prefer to have the library wait for window.onload() before making onready() / ontimeout() callbacks, you can modify SM2's "waitForWindowLoad" property:

soundManager.waitForWindowLoad = true;

Disabling debug output

SoundManager 2 will write to a debug <div> element or a javascript console if available, by default. To disable it, simply set the relevant property to false:

soundManager.debugMode = false;

To see related configuration code, refer to the source of this page which basically does all of the above "for real."

Troubleshooting

If SM2 is failing to start and throwing errors due to flash security, timeouts or other issues, check out the troubleshooting tool which can help you fix things.

No-debug, compressed version of soundmanager2.js

Once development is finished, you can also use the "minified" (down to 10% of original size with gzip!) version of SM2, which has debug output and comments removed for you: soundmanager2-nodebug-jsmin.js. Serve with gzip compression wherever possible for best bandwidth savings.


text:
#ifndef _MAIN_H_
#define _MAIN_H_

/* Logical cores */
#ifndef APP_MAX_SOCKETS
#define APP_MAX_SOCKETS 2
#endif

#ifndef APP_MAX_LCORES
#define APP_MAX_LCORES       RTE_MAX_LCORE
#endif

#ifndef APP_MAX_NIC_PORTS
#define APP_MAX_NIC_PORTS    RTE_MAX_ETHPORTS
#endif

#ifndef APP_MAX_RX_QUEUES_PER_NIC_PORT
#define APP_MAX_RX_QUEUES_PER_NIC_PORT 128
#endif

#ifndef APP_MAX_TX_QUEUES_PER_NIC_PORT
#define APP_MAX_TX_QUEUES_PER_NIC_PORT 128
#endif

#ifndef APP_MAX_IO_LCORES
#if (APP_MAX_LCORES > 16)
#define APP_MAX_IO_LCORES 16
#else
#define APP_MAX_IO_LCORES APP_MAX_LCORES
#endif
#endif
#if (APP_MAX_IO_LCORES > APP_MAX_LCORES)
#error "APP_MAX_IO_LCORES is too big"
#endif

#ifndef APP_MAX_NIC_RX_QUEUES_PER_IO_LCORE
#define APP_MAX_NIC_RX_QUEUES_PER_IO_LCORE 16
#endif

#ifndef APP_MAX_NIC_TX_PORTS_PER_IO_LCORE
#define APP_MAX_NIC_TX_PORTS_PER_IO_LCORE 16
#endif
#if (APP_MAX_NIC_TX_PORTS_PER_IO_LCORE > APP_MAX_NIC_PORTS)
#error "APP_MAX_NIC_TX_PORTS_PER_IO_LCORE too big"
#endif

#ifndef APP_MAX_WORKER_LCORES
#if (APP_MAX_LCORES > 16)
#define APP_MAX_WORKER_LCORES 16
#else
#define APP_MAX_WORKER_LCORES APP_MAX_LCORES
#endif
#endif
#if (APP_MAX_WORKER_LCORES > APP_MAX_LCORES)
#error "APP_MAX_WORKER_LCORES is too big"
#endif

/* Mempools */
#ifndef APP_DEFAULT_MBUF_DATA_SIZE
#define APP_DEFAULT_MBUF_DATA_SIZE  RTE_MBUF_DEFAULT_BUF_SIZE
#endif

#ifndef APP_DEFAULT_MEMPOOL_BUFFERS
#define APP_DEFAULT_MEMPOOL_BUFFERS   8192 * 4
#endif

#ifndef APP_DEFAULT_MEMPOOL_CACHE_SIZE
#define APP_DEFAULT_MEMPOOL_CACHE_SIZE  256
#endif

/* LPM Tables */
#ifndef APP_MAX_LPM_RULES
#define APP_MAX_LPM_RULES 1024
#endif

/* NIC RX */
#ifndef APP_DEFAULT_NIC_RX_RING_SIZE
#define APP_DEFAULT_NIC_RX_RING_SIZE 1024
#endif

/*
 * RX and TX Prefetch, Host, and Write-back threshold values should be
 * carefully set for optimal performance. Consult the network
 * controller's datasheet and supporting DPDK documentation for guidance
 * on how these parameters should be set.
 */
#ifndef APP_DEFAULT_NIC_RX_PTHRESH
#define APP_DEFAULT_NIC_RX_PTHRESH  8
#endif

#ifndef APP_DEFAULT_NIC_RX_HTHRESH
#define APP_DEFAULT_NIC_RX_HTHRESH  8
#endif

#ifndef APP_DEFAULT_NIC_RX_WTHRESH
#define APP_DEFAULT_NIC_RX_WTHRESH  4
#endif

#ifndef APP_DEFAULT_NIC_RX_FREE_THRESH
#define APP_DEFAULT_NIC_RX_FREE_THRESH  64
#endif

#ifndef APP_DEFAULT_NIC_RX_DROP_EN
#define APP_DEFAULT_NIC_RX_DROP_EN 0
#endif

/* NIC TX */
#ifndef APP_DEFAULT_NIC_TX_RING_SIZE
#define APP_DEFAULT_NIC_TX_RING_SIZE 1024
#endif

/*
 * These default values are optimized for use with the Intel(R) 82599 10 GbE
 * Controller and the DPDK ixgbe PMD. Consider using other values for other
 * network controllers and/or network drivers.
 */
#ifndef APP_DEFAULT_NIC_TX_PTHRESH
#define APP_DEFAULT_NIC_TX_PTHRESH  36
#endif

#ifndef APP_DEFAULT_NIC_TX_HTHRESH
#define APP_DEFAULT_NIC_TX_HTHRESH  0
#endif

#ifndef APP_DEFAULT_NIC_TX_WTHRESH
#define APP_DEFAULT_NIC_TX_WTHRESH  0
#endif

#ifndef APP_DEFAULT_NIC_TX_FREE_THRESH
#define APP_DEFAULT_NIC_TX_FREE_THRESH  0
#endif

#ifndef APP_DEFAULT_NIC_TX_RS_THRESH
#define APP_DEFAULT_NIC_TX_RS_THRESH  0
#endif

/* Software Rings */
#ifndef APP_DEFAULT_RING_RX_SIZE
#define APP_DEFAULT_RING_RX_SIZE 1024
#endif

#ifndef APP_DEFAULT_RING_TX_SIZE
#define APP_DEFAULT_RING_TX_SIZE 1024
#endif

/* Bursts */
#ifndef APP_MBUF_ARRAY_SIZE
#define APP_MBUF_ARRAY_SIZE   512
#endif

#ifndef APP_DEFAULT_BURST_SIZE_IO_RX_READ
#define APP_DEFAULT_BURST_SIZE_IO_RX_READ  144
#endif
#if (APP_DEFAULT_BURST_SIZE_IO_RX_READ > APP_MBUF_ARRAY_SIZE)
#error "APP_DEFAULT_BURST_SIZE_IO_RX_READ is too big"
#endif

#ifndef APP_DEFAULT_BURST_SIZE_IO_RX_WRITE
#define APP_DEFAULT_BURST_SIZE_IO_RX_WRITE  144
#endif
#if (APP_DEFAULT_BURST_SIZE_IO_RX_WRITE > APP_MBUF_ARRAY_SIZE)
#error "APP_DEFAULT_BURST_SIZE_IO_RX_WRITE is too big"
#endif

#ifndef APP_DEFAULT_BURST_SIZE_IO_TX_READ
#define APP_DEFAULT_BURST_SIZE_IO_TX_READ  144
#endif
#if (APP_DEFAULT_BURST_SIZE_IO_TX_READ > APP_MBUF_ARRAY_SIZE)
#error "APP_DEFAULT_BURST_SIZE_IO_TX_READ is too big"
#endif

#ifndef APP_DEFAULT_BURST_SIZE_IO_TX_WRITE
#define APP_DEFAULT_BURST_SIZE_IO_TX_WRITE  144
#endif
#if (APP_DEFAULT_BURST_SIZE_IO_TX_WRITE > APP_MBUF_ARRAY_SIZE)
#error "APP_DEFAULT_BURST_SIZE_IO_TX_WRITE is too big"
#endif

#ifndef APP_DEFAULT_BURST_SIZE_WORKER_READ
#define APP_DEFAULT_BURST_SIZE_WORKER_READ  144
#endif
#if ((2 * APP_DEFAULT_BURST_SIZE_WORKER_READ) > APP_MBUF_ARRAY_SIZE)
#error "APP_DEFAULT_BURST_SIZE_WORKER_READ is too big"
#endif

#ifndef APP_DEFAULT_BURST_SIZE_WORKER_WRITE
#define APP_DEFAULT_BURST_SIZE_WORKER_WRITE  144
#endif
#if (APP_DEFAULT_BURST_SIZE_WORKER_WRITE > APP_MBUF_ARRAY_SIZE)
#error "APP_DEFAULT_BURST_SIZE_WORKER_WRITE is too big"
#endif

/* Load balancing logic */
#ifndef APP_DEFAULT_IO_RX_LB_POS
#define APP_DEFAULT_IO_RX_LB_POS 29
#endif
#if (APP_DEFAULT_IO_RX_LB_POS >= 64)
#error "APP_DEFAULT_IO_RX_LB_POS is too big"
#endif

struct app_mbuf_array {
	struct rte_mbuf *array[APP_MBUF_ARRAY_SIZE];
	uint32_t n_mbufs;
};

enum app_lcore_type {
	e_APP_LCORE_DISABLED = 0,
	e_APP_LCORE_IO,
	e_APP_LCORE_WORKER
};

struct app_lcore_params_io {
	/* I/O RX */
	struct {
		/* NIC */
		struct {
			uint8_t port;
			uint8_t queue;
		} nic_queues[APP_MAX_NIC_RX_QUEUES_PER_IO_LCORE];
		uint32_t n_nic_queues;

		/* Rings */
		struct rte_ring *rings[APP_MAX_WORKER_LCORES];
		uint32_t n_rings;

		/* Internal buffers */
		struct app_mbuf_array mbuf_in;
		struct app_mbuf_array mbuf_out[APP_MAX_WORKER_LCORES];
		uint8_t mbuf_out_flush[APP_MAX_WORKER_LCORES];

		/* Stats */
		uint32_t nic_queues_count[APP_MAX_NIC_RX_QUEUES_PER_IO_LCORE];
		uint32_t nic_queues_iters[APP_MAX_NIC_RX_QUEUES_PER_IO_LCORE];
		uint32_t rings_count[APP_MAX_WORKER_LCORES];
		uint32_t rings_iters[APP_MAX_WORKER_LCORES];
	} rx;

	/* I/O TX */
	struct {
		/* Rings */
		struct rte_ring *rings[APP_MAX_NIC_PORTS][APP_MAX_WORKER_LCORES];

		/* NIC */
		uint8_t nic_ports[APP_MAX_NIC_TX_PORTS_PER_IO_LCORE];
		uint32_t n_nic_ports;

		/* Internal buffers */
		struct app_mbuf_array mbuf_out[APP_MAX_NIC_TX_PORTS_PER_IO_LCORE];
		uint8_t mbuf_out_flush[APP_MAX_NIC_TX_PORTS_PER_IO_LCORE];

		/* Stats */
		uint32_t rings_count[APP_MAX_NIC_PORTS][APP_MAX_WORKER_LCORES];
		uint32_t rings_iters[APP_MAX_NIC_PORTS][APP_MAX_WORKER_LCORES];
		uint32_t nic_ports_count[APP_MAX_NIC_TX_PORTS_PER_IO_LCORE];
		uint32_t nic_ports_iters[APP_MAX_NIC_TX_PORTS_PER_IO_LCORE];
	} tx;
};

struct app_lcore_params_worker {
	/* Rings */
	struct rte_ring *rings_in[APP_MAX_IO_LCORES];
	uint32_t n_rings_in;
	struct rte_ring *rings_out[APP_MAX_NIC_PORTS];

	/* LPM table */
	struct rte_lpm *lpm_table;
	uint32_t worker_id;

	/* Internal buffers */
	struct app_mbuf_array mbuf_in;
	struct app_mbuf_array mbuf_out[APP_MAX_NIC_PORTS];
	uint8_t mbuf_out_flush[APP_MAX_NIC_PORTS];

	/* Stats */
	uint32_t rings_in_count[APP_MAX_IO_LCORES];
	uint32_t rings_in_iters[APP_MAX_IO_LCORES];
	uint32_t rings_out_count[APP_MAX_NIC_PORTS];
	uint32_t rings_out_iters[APP_MAX_NIC_PORTS];
};

struct app_lcore_params {
	union {
		struct app_lcore_params_io io;
		struct app_lcore_params_worker worker;
	};
	enum app_lcore_type type;
	struct rte_mempool *pool;
} __rte_cache_aligned;

struct app_lpm_rule {
	uint32_t ip;
	uint8_t depth;
	uint8_t if_out;
};

struct app_params {
	/* lcore */
	struct app_lcore_params lcore_params[APP_MAX_LCORES];

	/* NIC */
	uint8_t nic_rx_queue_mask[APP_MAX_NIC_PORTS][APP_MAX_RX_QUEUES_PER_NIC_PORT];
	uint8_t nic_tx_port_mask[APP_MAX_NIC_PORTS];

	/* mbuf pools */
	struct rte_mempool *pools[APP_MAX_SOCKETS];

	/* LPM tables */
	struct rte_lpm *lpm_tables[APP_MAX_SOCKETS];
	struct app_lpm_rule lpm_rules[APP_MAX_LPM_RULES];
	uint32_t n_lpm_rules;

	/* rings */
	uint32_t nic_rx_ring_size;
	uint32_t nic_tx_ring_size;
	uint32_t ring_rx_size;
	uint32_t ring_tx_size;

	/* burst size */
	uint32_t burst_size_io_rx_read;
	uint32_t burst_size_io_rx_write;
	uint32_t burst_size_io_tx_read;
	uint32_t burst_size_io_tx_write;
	uint32_t burst_size_worker_read;
	uint32_t burst_size_worker_write;

	/* load balancing */
	uint8_t pos_lb;
} __rte_cache_aligned;

extern struct app_params app;

int app_parse_args(int argc, char **argv);
void app_print_usage(void);
void app_init(void);
int app_lcore_main_loop(void *arg);

int app_get_nic_rx_queues_per_port(uint8_t port);
int app_get_lcore_for_nic_rx(uint8_t port, uint8_t queue, uint32_t *lcore_out);
int app_get_lcore_for_nic_tx(uint8_t port, uint32_t *lcore_out);
int app_is_socket_used(uint32_t socket);
uint32_t app_get_lcores_io_rx(void);
uint32_t app_get_lcores_worker(void);
void app_print_params(void);

#endif /* _MAIN_H_ */


text:
package ${package}.base.infra.persistencia.fabrica;

import javax.persistence.EntityManager;

public class FabricaGenericaRepositoriosJPA implements FabricaRepositorios {
	private EntityManager entityManager;

	public FabricaGenericaRepositoriosJPA(EntityManager entityManager) {
		this.entityManager = entityManager;
	}

	public EntityManager getEntityManager(){
		return entityManager;
	}
}