text:
package org.innovateuk.ifs.application.forms.sections.yourorganisation.controller;

import org.innovateuk.ifs.application.forms.questions.grantagreement.form.GrantAgreementForm;
import org.innovateuk.ifs.application.forms.sections.yourorganisation.form.YourOrganisationKtpFinancialYearsForm;
import org.innovateuk.ifs.application.forms.sections.yourorganisation.form.YourOrganisationKtpFinancialYearsFormPopulator;
import org.innovateuk.ifs.application.forms.sections.yourorganisation.form.YourOrganisationKtpFinancialYearsFormSaver;
import org.innovateuk.ifs.commons.rest.RestResult;
import org.innovateuk.ifs.competition.resource.CompetitionSetupQuestionResource;
import org.innovateuk.ifs.controller.ValidationHandler;
import org.innovateuk.ifs.finance.resource.OrganisationFinancesKtpYearsResource;
import org.innovateuk.ifs.finance.service.ApplicationYourOrganisationRestService;
import org.innovateuk.ifs.form.service.FormInputRestService;
import org.innovateuk.ifs.user.resource.UserResource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ByteArrayResource;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.function.Supplier;

import static org.innovateuk.ifs.application.forms.ApplicationFormUtil.APPLICATION_BASE_URL;
import static org.innovateuk.ifs.application.forms.ApplicationFormUtil.MODEL_ATTRIBUTE_FORM;
import static org.innovateuk.ifs.controller.FileUploadControllerUtils.getMultipartFileBytes;
import static org.innovateuk.ifs.file.controller.FileDownloadControllerUtils.getFileResponseEntity;

/**
 * The Controller for the "Your organisation" page in the Application Form process when its a ktp competition.
 */
@Controller
@RequestMapping(APPLICATION_BASE_URL + "{applicationId}/form/your-organisation/competition/{competitionId}/organisation/{organisationId}/section/{sectionId}/ktp-financial-years")
public class YourOrganisationKtpFinancialYearsController extends AbstractYourOrganisationFormController<YourOrganisationKtpFinancialYearsForm> {

    @Autowired
    private ApplicationYourOrganisationRestService yourOrganisationRestService;

    @Autowired
    private YourOrganisationKtpFinancialYearsFormPopulator formPopulator;

    @Autowired
    private YourOrganisationKtpFinancialYearsFormSaver saver;

    @Autowired
    private FormInputRestService formInputRestService;

    @Override
    protected YourOrganisationKtpFinancialYearsForm populateForm(long applicationId, long organisationId) {
        OrganisationFinancesKtpYearsResource finances = yourOrganisationRestService.getOrganisationKtpYears(applicationId, organisationId).getSuccess();
        return formPopulator.populate(finances);
    }

    @Override
    protected String formFragment() {
        return "ktp-financial-years";
    }

    @Override
    protected void update(long applicationId, long organisationId, long userId, YourOrganisationKtpFinancialYearsForm form) {
         saver.save(applicationId, organisationId, userId, form, yourOrganisationRestService);
    }

    @Override
    protected String redirectToViewPage(long applicationId, long competitionId, long organisationId, long sectionId) {
        return "redirect:" + APPLICATION_BASE_URL +
                String.format("%d/form/your-organisation/competition/%d/organisation/%d/section/%d/ktp-financial-years",
                        applicationId,
                        competitionId,
                        organisationId,
                        sectionId);
    }

}


text:
ROOTDIR := ../../..
include $(ROOTDIR)/common.mk
CFLAGS += -I$(ROOTDIR)/include
ASMFILES := $(shell ls *.s)
ASMFLAGS += -w-number-overflow

.PHONY: all clean

all: $(ASMFILES) $(OBJFILES)
	for sfile in $(ASMFILES); do \
	    $(ASM) $(ASMFLAGS) $$sfile; \
	done
clean:
	-@rm -f *.o

redpajama_set_name: RedPajamaGithub


text:
from distutils2.core import setup

setup(name='MonthDelta',
      version='1.0b1',
      description='date computations with months',
      long_description=open('README.rst').read(),
      author='Jess Austin',
      author_email='jess.austin@gmail.com',
      url='http://pypi.python.org/pypi/MonthDelta',
      license='MIT',
      py_modules=['monthdelta'],
      provides=['monthdelta'],
      test_suite='test.test_monthdelta',
      classifiers=['Development Status :: 5 - Production/Stable',
                   'License :: OSI Approved :: MIT License',
                   'Operating System :: OS Independent',
                   'Programming Language :: Python :: 2',
                   'Programming Language :: Python :: 3'])


text:
15.0.0 / 2021-11-08
==================
 - [breaking] drop eslint < 7, add eslint 8 (#2495)
 - [breaking] add `exports`
 - [patch] Improve `function-paren-newline` with `multiline-arguments` option (#2471)
 - [patch] update default value for complexity (#2420)
 - [patch] add disabled `no-unsafe-optional-chaining` rule
 - [patch] arthmetic -> arithmetic (#2341)
 - [patch] fix spelling of "than" (#2333)
 - [patch] add `no-nonoctal-decimal-escape` rule
 - [patch] `import/no-extraneous-dependencies`: Add .eslintrc.js to devDeps (#2329)
 - [guide] Spread operator => Spread syntax (#2423)
 - [guide] add references for eslint rules (#2419)
 - [Docs] HTTP => HTTPS (#2489)
 - [readme] some updates
 - [meta] use `prepublishOnly` script for npm 7+
 - [deps] update `eslint-plugin-import`, `eslint-plugin-react`, `object.entries`
 - [dev deps] update `@babel/runtime`, `tape`

14.2.1 / 2020-11-06
==================
 - [base] `no-restricted-globals`: add better messages (#2320)
 - [base] add new core eslint rules, set to off
 - [deps] update `confusing-browser-globals`, `object.assign`
 - [deps] update `eslint-plugin-import`, use valid `import/no-cycle` `maxDepth` option (#2250, #2249)
 - [dev deps] update `@babel/runtime`, `eslint-find-rules`, `eslint-plugin-import`

14.2.0 / 2020-06-10
==================
 - [new] add `eslint` `v7`
 - [minor] Disallow multiple empty lines (#2238)
 - [minor] Fix typo in no-multiple-empty-lines rule (#2168)
 - [patch] Include 'context' exception for `no-param-reassign` (#2230)
 - [patch] Allow triple-slash (///) comments (#2197)
 - [patch] Disable `prefer-object-spread` for `airbnb-base/legacy` (#2198)
 - [deps] update `eslint-plugin-import`, `eslint-plugin-react`, `babel-preset-airbnb`, `eslint-find-rules`, `in-publish`, `tape`, `object.entries`

14.1.0 / 2020-03-12
==================
 - [minor] add new disabled rules, update eslint
 - [minor] enable `import/no-useless-path-segments` for commonjs (#2113)
 - [fix] `whitespace`: only set erroring rules to "warn"
 - Fix indentation with JSX Fragments (#2157)
 - [patch] `import/no-extraneous-dependencies`: Support karma config files (#2121)
 - [readme] normalize multiline word according to merriam-webster (#2138)
 - [deps] update `eslint`, `eslint-plugin-import`, `eslint-plugin-react`, `object.entries`, `confusing-browser-globals`
 - [dev deps] update `@babel/runtime`, `babel-preset-airbnb`, `safe-publish-latest`, `tape`
 - [tests] re-enable eslint rule `prefer-destructuring` internally (#2110)

14.0.0 / 2019-08-09
==================
 - [breaking] `no-self-assign`: enable `props` option
 - [breaking] enable `no-useless-catch`
 - [breaking] enable `max-classes-per-file`
 - [breaking] enable `no-misleading-character-class`
 - [breaking] enable `no-async-promise-executor`
 - [breaking] enable `prefer-object-spread`
 - [breaking] `func-name-matching`: enable `considerPropertyDescriptor` option
 - [breaking] `padded-blocks`: enable `allowSingleLineBlocks` option (#1255)
 - [breaking] `no-multiple-empty-lines`: Restrict empty lines at beginning of file (#2042)
 - [breaking] Set 'strict' to 'never' (#1962)
 - [breaking] legacy: Enable 'strict' (#1962)
 - [breaking] Simplifies `no-mixed-operators` (#1864)
 - [breaking] Require parens for arrow function args (#1863)
 - [breaking] add eslint v6, drop eslint v4
 - [patch] `camelcase`: enable ignoreDestructuring
 - [patch] Add markers to spaced-comment block for Flow types (#1966)
 - [patch] Do not prefer destructuring for object assignment expression (#1583)
 - [deps] update `confusing-browser-globals`, `eslint-plugin-import`, `tape`, `babel-preset-airbnb`
 - [dev deps] update babel-related deps to latest
 - [dev deps] update `eslint-find-rules`, `eslint-plugin-import`
 - [tests] only run tests in non-lint per-package travis job
 - [tests] use `eclint` instead of `editorconfig-tools`

13.2.0 / 2019-07-01
==================
 - [minor] Enforce dangling underscores in method names (#1907)
 - [fix] disable `no-var` in legacy entry point
 - [patch] Ignore property modifications of `staticContext` params (#2029)
 - [patch] `no-extraneous-dependencies`: Add jest.setup.js to devDeps (#1998)
 - [meta] add disabled `prefer-named-capture-group` rule
 - [meta] add disabled `no-useless-catch` config
 - [deps] Switch to confusing-browser-globals (#1961)
 - [deps] update `object.entries`, `eslint-plugin-import`, `eslint-plugin-jsx-a11y`, `eslint-plugin-react`, `tape`
 - [docs] correct JavaScript capitalization (#2046)
 - [readme] Improve eslint config setup instructions for yarn (#2001)
 - [docs] fix docs for whitespace config (#1914, #1871)

13.1.0 / 2018-08-13
==================
 - [new] add eslint v5 support (#1834)
 - [deps] update `eslint-plugin-import`, `eslint`, `babel-preset-airbnb`, `safe-publish-latest`, `eslint-find-rules`
 - [docs] fix typo in readme (#1855)
 - [new] update base ecmaVersion to 2018; remove deprecated experimentalObjectRestSpread option

13.0.0 / 2018-06-21
==================
 - [breaking] order of import statements is ignored for unassigned imports (#1782)
 - [breaking] enable `import/no-cycle`: warn on cyclical dependencies (#1779)
 - [breaking] Change import/no-self-import from "off" to "error" (#1770)
 - [breaking] Update `object-curly-newline` to match eslint 4.18.0 (#1761)
 - [breaking] enable `no-useless-path-segments` (#1743)
 - [breaking] Prevent line breaks before and after `=` (#1710)
 - [breaking] Add .mjs extension support (#1634)
 - [breaking] enable `implicit-arrow-linebreak`
 - [breaking] Enables `nonblock-statement-body-position` rule and adds link to guide (#1618)
 - [breaking] `no-mixed-operators`: only warn on `**` and `%` mixed with arithmetic operators; removes violation against mixing common math operators. (#1611)
 - [breaking] `import/named`: enable
 - [breaking] `lines-between-class-members`: set to "always"
 - [breaking] `no-else-return`: disallow else-if (#1595)
 - [breaking] Enables eslint rule for operator-linebreak
 - [new] Adds config entry point with only whitespace rules enabled (#1749, #1751)
 - [minor] only allow one newline at the end (#1794)
 - [patch] Adjust imports for vue-cli (#1809)
 - [patch] Allow devDependencies for `foo_spec.js` naming style (#1732)
 - [patch] `function-paren-newline`: change to "consistent"
 - [patch] avoid `__mocks__` `no-extraneous-dependencies` check (#1772)
 - [patch] Include 'accumulator' exception for `no-param-reassign` (#1768)
 - [patch] Set import/extensions to ignorePackages (#1652)
 - [patch] properly ignore indentation on jsx
 - [patch] `array-callback-return`: enable `allowImplicit` option (#1668)
 - [deps] update `eslint`, `eslint-plugin-import`
 - [dev deps] update `babel-preset-airbnb`, `tape`, `eslint-find-rules`
 - [meta] add ES2015-2018 in npm package keywords (#1587)
 - [meta] Add licenses to sub packages (#1746)
 - [docs] add `npx` shortcut (#1694)
 - [docs] Use HTTPS for links to ESLint documentation (#1628)
 - [tests] ensure all entry points parse

12.1.0 / 2017-10-16
==================
 - [deps] update `eslint` to `v4.9`

12.0.2 / 2017-10-05
==================
 - [deps] update `eslint`

12.0.1 / 2017-09-27
==================
 - [fix] ensure all JSX elements are ignored by `indent` (#1569)
 - [deps] update `eslint`

12.0.0 / 2017-09-02
==================
 - [deps] [breaking] require `eslint` v4
   - enable `function-paren-newline`, `for-direction`, `getter-return`, `no-compare-neg-zero`, `semi-style`, `object-curly-newline`, `no-buffer-constructor`, `no-restricted-globals`, `switch-colon-spacing`, `template-tag-spacing`, `prefer-promise-reject-errors`, `prefer-destructuring`
   - improve `indent`, `no-multi-spaces`, `no-trailing-spaces`, `no-underscore-dangle`
 - [breaking] move `comma-dangle` to Stylistic Issues (#1514)
 - [breaking] Rules prohibiting global isNaN, isFinite (#1477)
 - [patch] also disallow padding in classes and switches (#1403)
 - [patch] support Protractor config files in import/no-extraneous-dependencies (#1543)

11.3.2 / 2017-08-22
==================
 - [patch] Add jest.config.js to import/no-extraneous-dependencies devDeps (#1522)
 - [patch] Improve Gruntfile glob pattern (#1503)
 - [deps] update `eslint` v4, `tape`
 - [docs] Specify yarn-specific install instructions (#1511)

11.3.1 / 2017-07-24
==================
 - [fix] `legacy`: remove top-level `ecmaFeatures`

11.3.0 / 2017-07-23
==================
 - [deps] allow eslint v3 or v4 (#1447)
 - [deps] update `eslint-plugin-import`
 - [minor] Balanced spacing for inline block comments (#1440)
 - [minor] `no-return-assign`: strengthen linting against returning assignments
 - [patch] Allow jsx extensions for test files (#1427)
 - [patch] `no-restricted-globals`: add confusing globals; leave disabled for now (#1420)
 - [patch] Support Protractor config files in import/no-extraneous-dependencies (#1456)
 - [docs] Remove TODO in prefer-reflect as it's deprecated (#1452)
 - [docs] add yarn instructions (#1463, #1464)

11.2.0 / 2017-05-14
==================
 - [minor] Disallow unused global variables

11.1.3 / 2017-04-03
==================
 - [patch] add error messages to `no-restricted-syntax` (#1353)
 - [deps] update `eslint`

11.1.2 / 2017-03-25
==================
 - [patch] `no-param-reassign`: add ignorePropertyModificationsFor (#1325)
 - [deps] update `eslint`

11.1.1 / 2017-03-03
==================
 - [deps] update `eslint`
 - [patch] enable `ignoreRestSiblings` in `no-unused-vars`

11.1.0 / 2017-01-08
==================
 - [minor] enable `no-multi-assign`
 - [deps] update `eslint`, `babel-preset-airbnb`
 - Update a deprecated option (`eqeqeq`) (#1244)

11.0.1 / 2017-01-08
==================
 - [deps] update `eslint`
 - [docs] add note about `install-peerdeps` (#1234)
 - [docs] Updated instructions to support non-bash users (#1214)

11.0.0 / 2016-12-11
==================
 - [breaking] enable `no-await-in-loop`
 - [patch]  disable `no-duplicate-imports` rule (#1188, #1195, #1054)
 - [patch] `import/no-extraneous-dependencies`: add some comments to ignore patterns
 - [patch] add `import/no-extraneous-dependencies` ignore patterns for test files (#1174)
 - [patch] `import/no-extraneous-dependencies`: added ignore patterns for config files (#1168)
 - [deps] update `eslint`, `eslint-plugin-import`, `tape`

10.0.1 / 2016-11-07
==================
 - [fix] legacy config should not require `**`

10.0.0 / 2016-11-06
==================
 - [breaking] prefer `**` over `Math.pow`
 - [breaking] `comma-dangle`: require trailing commas for functions
 - [breaking] enable `no-useless-return`
 - [breaking] tighten up `indent`
 - [breaking] tighten up `spaced-comment`
 - [breaking] enable `import/no-named-default`
 - [patch] loosen `max-len` with `ignoreRegExpLiterals` option
 - [patch] loosen `no-extraneous-dependencies` for test files (#959, #1089)
 - [deps] update `eslint`, `eslint-plugin-import`
 - [dev deps] update `eslint-find-rules`
 - [Tests] on `node` `v7`

9.0.0 / 2016-10-16
==================
 - [breaking] Add `ForOfStatement` to `no-restricted-syntax` (#1122, #1134)
 - [breaking] enable `import/no-webpack-loader-syntax` (#1123)
 - [breaking] [deps] update `eslint` to `v3.8.0` (#1132)
 - [breaking] [deps] update `eslint-plugin-import` to v2 (#1101)
 - [patch] `new-cap`: add immutable.js exceptions
 - [docs] ensure latest version of config is installed
 - [dev deps] update `babel-preset-airbnb`, `eslint`, `eslint-find-rules`, `tape`, `safe-publish-latest`

8.0.0 / 2016-09-24
==================
 - [breaking] enable rules: `no-restricted-properties`, `prefer-numeric-literals`, `lines-around-directive`, `import/extensions`, `import/no-absolute-path`, `import/no-dynamic-require`

7.2.0 / 2016-09-23
==================
 - [new] set `ecmaVersion` to 2017; enable object rest/spread; update `babel-preset-airbnb`
 - [patch] fix category of `no-restricted-properties`
 - [deps] update `eslint`, `eslint-plugin-import`, `eslint-find-rules`, `safe-publish-latest`

7.1.0 / 2016-09-11
==================
 - [minor] enable `arrow-parens` rule

7.0.1 / 2016-09-10
==================
 - [patch] loosen `max-len` by ignoring strings
 - [deps] update to `eslint` `v3.5.0`

7.0.0 / 2016-09-06
==================
 - [breaking] Add no-plusplus in style.js and added explanation in README (#1012)

6.0.0 / 2016-09-06
==================
 - [breaking] `valid-typeof`: enable `requireStringLiterals` option
 - [breaking] enable `class-methods-use-this`
 - [breaking] enable `symbol-description`
 - [breaking] enable `no-bitwise`
 - [breaking] enable `no-tabs`
 - [breaking] enable `func-call-spacing`
 - [breaking] enable `no-template-curly-in-string`
 - [patch] remove redundant `DebuggerStatement` from `no-restricted-syntax` (#1031)
 - [deps] update `eslint`, `eslint-find-rules`, `eslint-plugin-import`
 - Update `ecmaVersion` to `2016`

5.0.3 / 2016-08-21
==================
 - [fix] correct `import/extensions` list (#1013)
 - [refactor] Changed ESLint rule configs to use 'off', 'warn', and 'error' instead of numbers for better readability (#946)
 - [deps] update `eslint`, `eslint-plugin-react`

5.0.2 / 2016-08-12
==================
 - [deps] update `eslint`, `eslint-find-rules`, `eslint-plugin-import`
 - [tests] add `safe-publish-latest` to `prepublish`

5.0.1 / 2016-07-29
==================
 - [patch] `no-unused-expressions`: flesh out options
 - [deps] update `eslint` to `v3.2`, `eslint-plugin-import` to `v1.12`
 - [tests] improve prepublish script

5.0.0 / 2016-07-24
==================
 - [breaking] enable `import/newline-after-import`
 - [breaking] enable overlooked rules: `linebreak-style`, `new-parens`, `no-continue`, `no-lonely-if`, `operator-assignment`, `space-unary-ops`, `dot-location`, `no-extra-boolean-cast`, `no-this-before-super`, `require-yield`, `no-path-concat`, `no-label-var`, `no-void`, `constructor-super`, `prefer-spread`, `no-new-require`, `no-undef-init`, `no-unexpected-multiline`
 - [deps] update `eslint`, `eslint-find-rules`, `eslint-plugin-import`, `babel-tape-runner`; add `babel-preset-airbnb`
 - [patch] flesh out defaults: `jsx-quotes`
 - [docs] update the peer dep install command to dynamically look up the right version numbers when installing peer deps
 - [tests] fix prepublish scripts

4.0.2 / 2016-07-14
==================
 - [fix] repair accidental comma-dangle change

4.0.1 / 2016-07-14 (unpublished)
==================
 - [fix] Prevent trailing commas in the legacy config (#950)
 - [deps] update `eslint-plugin-import`

4.0.0 / 2016-07-02
==================
 - [breaking] [deps] update `eslint` to v3; drop support for < node 4
 - [breaking] enable `rest-spread-spacing` rule
 - [breaking] enable `no-mixed-operators` rule
 - [breaking] enable `import` rules: `no-named-as-default`, `no-named-as-default-member`, `no-extraneous-dependencies`
 - [breaking] enable `object-property-newline` rule
 - [breaking] enable `no-prototype-builtins` rule
 - [breaking] enable `no-useless-rename` rule
 - [breaking] enable `unicode-bom` rule
 - [breaking] Enforce proper generator star spacing (#887)
 - [breaking] Enable imports/imports-first rule (#882)
 - [breaking] re-order rules; put import rules in separate file (#881)
 - [patch] `newline-per-chained-call`: bump the limit to 4
 - [patch] `object-shorthand`: do not warn when the concise form would have a string literal as a name
 - [patch] Loosen `prefer-const` to not warn when the variable is "read" before being assigned to
 - [refactor] fix quoting of rule properties (#885)
 - [refactor] `quotes`: Use object option form rather than deprecated string form.
 - [deps] update `eslint`, `eslint-plugin-import`, `eslint-find-rules`, `tape`
 - [tests] Only run `eslint-find-rules` on prepublish, not in tests

3.0.1 / 2016-05-08
==================
 - [patch] re-disable `no-extra-parens` (#869, #867)

3.0.0 / 2016-05-07
==================
 - [breaking] enable `import/no-mutable-exports`
 - [breaking] enable `no-class-assign` rule, to pair with `no-func-assign`
 - [breaking] widen `no-extra-parens` to include everything, except `nestedBinaryExpressions`
 - [breaking] Re-enabling `newline-per-chained-call` (#748)
 - [minor] enable `import/no-amd`
 - [patch] enable `import/no-duplicates`
 - [deps] update `eslint`, `eslint-plugin-import`, `eslint-find-rules`

2.0.0 / 2016-04-29
==================
 - [breaking] enable `no-unsafe-finally` rule
 - [semver-minor] enable `no-useless-computed-key` rule
 - [deps] update `eslint`, `eslint-plugin-import`

1.0.4 / 2016-04-26
==================
 - [deps] update `eslint-find-rules`, `eslint-plugin-import`

1.0.3 / 2016-04-21
==================
 - [patch: loosen rules] Allow empty class/object methods

1.0.2 / 2016-04-20
==================
 - [patch: loosen rules] Allow `break` (#840)

1.0.1 / 2016-04-19
==================
 - [patch: loosen rules] Allow `== null` (#542)

1.0.0 / 2016-04-19
==================
 - Initial commmit; moved content over from `eslint-config-airbnb` package.


text:
package org.apache.activemq.artemis.tests.integration.amqp.connect;

import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.Message;
import javax.jms.MessageConsumer;
import javax.jms.MessageProducer;
import javax.jms.Queue;
import javax.jms.Session;
import javax.jms.TextMessage;
import java.io.File;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;

import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.core.config.amqpBrokerConnectivity.AMQPBrokerConnectConfiguration;
import org.apache.activemq.artemis.core.config.amqpBrokerConnectivity.AMQPMirrorBrokerConnectionElement;
import org.apache.activemq.artemis.core.io.IOCallback;
import org.apache.activemq.artemis.core.persistence.impl.journal.JournalRecordIds;
import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.MessageReference;
import org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl;
import org.apache.activemq.artemis.protocol.amqp.broker.ActiveMQProtonRemotingConnection;
import org.apache.activemq.artemis.protocol.amqp.connect.mirror.AMQPMirrorControllerTarget;
import org.apache.activemq.artemis.protocol.amqp.proton.AMQPSessionContext;
import org.apache.activemq.artemis.protocol.amqp.proton.ProtonAbstractReceiver;
import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.apache.activemq.artemis.tests.util.CFUtil;
import org.apache.activemq.artemis.tests.util.Wait;
import org.jboss.logging.Logger;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

public class PagedMirrorTest extends ActiveMQTestBase {

   private static final Logger logger = Logger.getLogger(PagedMirrorTest.class);
   ActiveMQServer server1;

   ActiveMQServer server2;

   @Before
   @Override
   public void setUp() throws Exception {
      super.setUp();

      server1 = createServer(true, createDefaultConfig(0, true), 1024, 10 * 1024);
      server1.getConfiguration().getAcceptorConfigurations().clear();
      server1.getConfiguration().addAcceptorConfiguration("server", "tcp://localhost:61616");
      AMQPBrokerConnectConfiguration brokerConnectConfiguration = new AMQPBrokerConnectConfiguration("other", "tcp://localhost:61617").setReconnectAttempts(-1).setRetryInterval(1000);
      brokerConnectConfiguration.addElement(new AMQPMirrorBrokerConnectionElement());
      server1.getConfiguration().addAMQPConnection(brokerConnectConfiguration);

      server2 = createServer(true, createDefaultConfig(1, true), 1024, 10 * 1024);
      server2.getConfiguration().getAcceptorConfigurations().clear();
      server2.getConfiguration().addAcceptorConfiguration("server", "tcp://localhost:61617");
      brokerConnectConfiguration = new AMQPBrokerConnectConfiguration("other", "tcp://localhost:61616").setReconnectAttempts(-1).setRetryInterval(1000);
      brokerConnectConfiguration.addElement(new AMQPMirrorBrokerConnectionElement());
      server2.getConfiguration().addAMQPConnection(brokerConnectConfiguration);

      server1.start();
      server2.start();
   }

   @Test
   public void testPaged() throws Throwable {
      String sendURI = "tcp://localhost:61616";
      String consumeURI = "tcp://localhost:61616";
      String secondConsumeURI = "tcp://localhost:61617";

      Wait.waitFor(() -> server1.locateQueue("$ACTIVEMQ_ARTEMIS_MIRROR_other") != null);
      Wait.waitFor(() -> server2.locateQueue("$ACTIVEMQ_ARTEMIS_MIRROR_other") != null);

      org.apache.activemq.artemis.core.server.Queue snf1 = server2.locateQueue("$ACTIVEMQ_ARTEMIS_MIRROR_other");
      Assert.assertNotNull(snf1);

      org.apache.activemq.artemis.core.server.Queue snf2 = server1.locateQueue("$ACTIVEMQ_ARTEMIS_MIRROR_other");
      Assert.assertNotNull(snf2);

      File countJournalLocation = server1.getConfiguration().getJournalLocation();
      Assert.assertTrue(countJournalLocation.exists() && countJournalLocation.isDirectory());
      String protocol = "amqp";

      ConnectionFactory sendCF = CFUtil.createConnectionFactory(protocol, sendURI);
      ConnectionFactory consumeCF = CFUtil.createConnectionFactory(protocol, consumeURI);
      ConnectionFactory secondConsumeCF = CFUtil.createConnectionFactory(protocol, secondConsumeURI);

      String bodyBuffer;
      {
         StringBuffer buffer = new StringBuffer();
         for (int i = 0; i < 1024; i++) {
            buffer.append("*");
         }
         bodyBuffer = buffer.toString();
      }

      int NUMBER_OF_MESSAGES = 200;
      int ACK_I = 77;

      try (Connection sendConnecton = sendCF.createConnection()) {
         Session sendSession = sendConnecton.createSession(true, Session.SESSION_TRANSACTED);
         Queue jmsQueue = sendSession.createQueue("someQueue");
         MessageProducer producer = sendSession.createProducer(jmsQueue);

         for (int i = 0; i < NUMBER_OF_MESSAGES; i++) {
            TextMessage message = sendSession.createTextMessage(bodyBuffer);
            message.setIntProperty("i", i);
            producer.send(message);
         }
         sendSession.commit();
      }

      Wait.assertEquals(0, snf1::getMessageCount);
      Wait.assertEquals(0, snf2::getMessageCount);

      try (Connection consumeConnection = consumeCF.createConnection()) {
         Session consumeSession = consumeConnection.createSession(false, 101); // individual ack
         Queue jmsQueue = consumeSession.createQueue("someQueue");
         MessageConsumer consumer = consumeSession.createConsumer(jmsQueue);
         consumeConnection.start();
         for (int i = 0; i < NUMBER_OF_MESSAGES; i++) {
            TextMessage message = (TextMessage) consumer.receive(6000);
            if (message.getIntProperty("i") == ACK_I) {
               message.acknowledge();
            }
         }
         Assert.assertNull(consumer.receiveNoWait());
      }
      Wait.assertEquals(0, snf1::getMessageCount);
      Wait.assertEquals(0, snf2::getMessageCount);
      Wait.assertEquals(1, () -> acksCount(countJournalLocation), 5000, 1000);

      HashSet<Integer> receivedIDs = new HashSet<>();

      try (Connection consumeConnection = secondConsumeCF.createConnection()) {
         Session consumeSession = consumeConnection.createSession(true, Session.SESSION_TRANSACTED);
         Queue jmsQueue = consumeSession.createQueue("someQueue");
         MessageConsumer consumer = consumeSession.createConsumer(jmsQueue);
         consumeConnection.start();

         for (int i = 0; i < NUMBER_OF_MESSAGES - 1; i++) {
            TextMessage message = (TextMessage) consumer.receive(6000);
            Assert.assertNotNull(message);
            Assert.assertNotEquals(ACK_I, message.getIntProperty("i"));
            receivedIDs.add(message.getIntProperty("i"));
         }
         Assert.assertNull(consumer.receiveNoWait());

         Assert.assertEquals(NUMBER_OF_MESSAGES - 1, receivedIDs.size());

         for (int i = 0; i < NUMBER_OF_MESSAGES; i++) {
            if (i != ACK_I) {
               Assert.assertTrue(receivedIDs.contains(i));
            }
         }
      }
   }

   @Test
   public void testAckWithScan() throws Throwable {
      String sendURI = "tcp://localhost:61616";
      String consumeURI = "tcp://localhost:61617";

      Wait.waitFor(() -> server1.locateQueue("$ACTIVEMQ_ARTEMIS_MIRROR_other") != null);
      Wait.waitFor(() -> server2.locateQueue("$ACTIVEMQ_ARTEMIS_MIRROR_other") != null);

      org.apache.activemq.artemis.core.server.Queue snf1 = server2.locateQueue("$ACTIVEMQ_ARTEMIS_MIRROR_other");
      Assert.assertNotNull(snf1);

      org.apache.activemq.artemis.core.server.Queue snf2 = server1.locateQueue("$ACTIVEMQ_ARTEMIS_MIRROR_other");
      Assert.assertNotNull(snf2);

      File countJournalLocation = server1.getConfiguration().getJournalLocation();
      Assert.assertTrue(countJournalLocation.exists() && countJournalLocation.isDirectory());
      String protocol = "amqp";

      ConnectionFactory sendCF = CFUtil.createConnectionFactory(protocol, sendURI);

      String bodyBuffer;
      {
         StringBuffer buffer = new StringBuffer();
         for (int i = 0; i < 1024; i++) {
            buffer.append("*");
         }
         bodyBuffer = buffer.toString();
      }

      int NUMBER_OF_MESSAGES = 200;

      try (Connection sendConnecton = sendCF.createConnection()) {
         Session sendSession = sendConnecton.createSession(true, Session.SESSION_TRANSACTED);
         Queue jmsQueue = sendSession.createQueue("someQueue");
         MessageProducer producer = sendSession.createProducer(jmsQueue);

         for (int i = 0; i < NUMBER_OF_MESSAGES; i++) {
            TextMessage message = sendSession.createTextMessage(bodyBuffer);
            message.setIntProperty("i", i);
            producer.send(message);
         }
         sendSession.commit();
      }

      Wait.assertEquals(0, snf1::getMessageCount);
      Wait.assertEquals(0, snf2::getMessageCount);

      org.apache.activemq.artemis.core.server.Queue serverQueue2 = server2.locateQueue("someQueue");
      Assert.assertNotNull(serverQueue2);
      org.apache.activemq.artemis.core.server.Queue serverQueue1 = server1.locateQueue("someQueue");
      Assert.assertNotNull(serverQueue1);

      Wait.assertEquals(NUMBER_OF_MESSAGES, serverQueue2::getMessageCount);
      Wait.assertEquals(NUMBER_OF_MESSAGES, serverQueue1::getMessageCount);

      ConnectionFactory consumeCF = CFUtil.createConnectionFactory(protocol, consumeURI);
      try (Connection connection = consumeCF.createConnection()) {
         connection.start();
         Session session = connection.createSession(true, Session.SESSION_TRANSACTED);
         Queue jmsQueue = session.createQueue("someQueue");
         MessageConsumer consumer = session.createConsumer(jmsQueue);
         for (int i = 0; i < 10; i++) {
            Message recMessage = consumer.receive(5000);
            Assert.assertNotNull(recMessage);
         }
         session.commit();
      }

      Wait.assertEquals(NUMBER_OF_MESSAGES - 10, serverQueue2::getMessageCount);

      LinkedList<MessageReference> refs = new LinkedList<>();
      serverQueue2.forEach((t) -> refs.add(t));

      AMQPMirrorControllerTarget controllerTarget = locateMirrorTarget(server2);

      CountDownLatch latch = new CountDownLatch(refs.size());

      IOCallback callback = new IOCallback() {
         @Override
         public void done() {
            latch.countDown();
         }

         @Override
         public void onError(int errorCode, String errorMessage) {
         }
      };

      for (MessageReference r : refs) {
         Long messageID = (Long)r.getMessage().getBrokerProperty(SimpleString.toSimpleString("x-opt-amq-mr-id"));
         Object nodeID = r.getMessage().getBrokerProperty(SimpleString.toSimpleString("x-opt-amq-bkr-id"));

         // this will force the retry on the queue after a depage happened
         controllerTarget.performAckOnPage(nodeID.toString(), messageID, serverQueue2, callback);
      }

      Assert.assertTrue(latch.await(10, TimeUnit.SECONDS));

      Wait.assertEquals(NUMBER_OF_MESSAGES - 10 - refs.size(), serverQueue2::getMessageCount);
   }

   protected static AMQPMirrorControllerTarget locateMirrorTarget(ActiveMQServer server) {
      ActiveMQServerImpl theServer = (ActiveMQServerImpl) server;

      for (RemotingConnection connection : theServer.getRemotingService().getConnections()) {
         if (connection instanceof ActiveMQProtonRemotingConnection) {
            ActiveMQProtonRemotingConnection protonRC = (ActiveMQProtonRemotingConnection) connection;
            for (AMQPSessionContext sessionContext : protonRC.getAmqpConnection().getSessions().values()) {
               for (ProtonAbstractReceiver receiver : sessionContext.getReceivers().values()) {
                  if (receiver instanceof AMQPMirrorControllerTarget) {
                     return (AMQPMirrorControllerTarget) receiver;
                  }
               }
            }
         }
      }

      return null;
   }

   private int acksCount(File countJournalLocation) throws Exception {
      HashMap<Integer, AtomicInteger> countJournal = countJournal(countJournalLocation, 10485760, 2, 2);
      AtomicInteger acksCount = countJournal.get((int)JournalRecordIds.ACKNOWLEDGE_CURSOR);
      return acksCount != null ? acksCount.get() : 0;
   }

}


text:
/* Code generated by IfcQuery EXPRESS generator, www.ifcquery.com */
#include <sstream>
#include <limits>

#include "ifcpp/model/AttributeObject.h"
#include "ifcpp/model/BuildingException.h"
#include "ifcpp/model/BuildingGuid.h"
#include "ifcpp/reader/ReaderUtil.h"
#include "ifcpp/writer/WriterUtil.h"
#include "ifcpp/IFC4X3/include/IfcCompoundPlaneAngleMeasure.h"
#include "ifcpp/IFC4X3/include/IfcElementCompositionEnum.h"
#include "ifcpp/IFC4X3/include/IfcGloballyUniqueId.h"
#include "ifcpp/IFC4X3/include/IfcLabel.h"
#include "ifcpp/IFC4X3/include/IfcLengthMeasure.h"
#include "ifcpp/IFC4X3/include/IfcObjectPlacement.h"
#include "ifcpp/IFC4X3/include/IfcOwnerHistory.h"
#include "ifcpp/IFC4X3/include/IfcPostalAddress.h"
#include "ifcpp/IFC4X3/include/IfcProductRepresentation.h"
#include "ifcpp/IFC4X3/include/IfcRelAggregates.h"
#include "ifcpp/IFC4X3/include/IfcRelAssigns.h"
#include "ifcpp/IFC4X3/include/IfcRelAssignsToProduct.h"
#include "ifcpp/IFC4X3/include/IfcRelAssociates.h"
#include "ifcpp/IFC4X3/include/IfcRelContainedInSpatialStructure.h"
#include "ifcpp/IFC4X3/include/IfcRelDeclares.h"
#include "ifcpp/IFC4X3/include/IfcRelDefinesByObject.h"
#include "ifcpp/IFC4X3/include/IfcRelDefinesByProperties.h"
#include "ifcpp/IFC4X3/include/IfcRelDefinesByType.h"
#include "ifcpp/IFC4X3/include/IfcRelInterferesElements.h"
#include "ifcpp/IFC4X3/include/IfcRelNests.h"
#include "ifcpp/IFC4X3/include/IfcRelPositions.h"
#include "ifcpp/IFC4X3/include/IfcRelReferencedInSpatialStructure.h"
#include "ifcpp/IFC4X3/include/IfcRelServicesBuildings.h"
#include "ifcpp/IFC4X3/include/IfcSite.h"
#include "ifcpp/IFC4X3/include/IfcText.h"

// ENTITY IfcSite
IFC4X3::IfcSite::IfcSite( int tag ) { m_tag = tag; }
shared_ptr<BuildingObject> IFC4X3::IfcSite::getDeepCopy( BuildingCopyOptions& options )
{
	shared_ptr<IfcSite> copy_self( new IfcSite() );
	if( m_GlobalId )
	{
		if( options.create_new_IfcGloballyUniqueId ) { copy_self->m_GlobalId = make_shared<IfcGloballyUniqueId>( createBase64Uuid().data() ); }
		else { copy_self->m_GlobalId = dynamic_pointer_cast<IfcGloballyUniqueId>( m_GlobalId->getDeepCopy(options) ); }
	}
	if( m_OwnerHistory )
	{
		if( options.shallow_copy_IfcOwnerHistory ) { copy_self->m_OwnerHistory = m_OwnerHistory; }
		else { copy_self->m_OwnerHistory = dynamic_pointer_cast<IfcOwnerHistory>( m_OwnerHistory->getDeepCopy(options) ); }
	}
	if( m_Name ) { copy_self->m_Name = dynamic_pointer_cast<IfcLabel>( m_Name->getDeepCopy(options) ); }
	if( m_Description ) { copy_self->m_Description = dynamic_pointer_cast<IfcText>( m_Description->getDeepCopy(options) ); }
	if( m_ObjectType ) { copy_self->m_ObjectType = dynamic_pointer_cast<IfcLabel>( m_ObjectType->getDeepCopy(options) ); }
	if( m_ObjectPlacement ) { copy_self->m_ObjectPlacement = dynamic_pointer_cast<IfcObjectPlacement>( m_ObjectPlacement->getDeepCopy(options) ); }
	if( m_Representation ) { copy_self->m_Representation = dynamic_pointer_cast<IfcProductRepresentation>( m_Representation->getDeepCopy(options) ); }
	if( m_LongName ) { copy_self->m_LongName = dynamic_pointer_cast<IfcLabel>( m_LongName->getDeepCopy(options) ); }
	if( m_CompositionType ) { copy_self->m_CompositionType = dynamic_pointer_cast<IfcElementCompositionEnum>( m_CompositionType->getDeepCopy(options) ); }
	if( m_RefLatitude ) { copy_self->m_RefLatitude = dynamic_pointer_cast<IfcCompoundPlaneAngleMeasure>( m_RefLatitude->getDeepCopy(options) ); }
	if( m_RefLongitude ) { copy_self->m_RefLongitude = dynamic_pointer_cast<IfcCompoundPlaneAngleMeasure>( m_RefLongitude->getDeepCopy(options) ); }
	if( m_RefElevation ) { copy_self->m_RefElevation = dynamic_pointer_cast<IfcLengthMeasure>( m_RefElevation->getDeepCopy(options) ); }
	if( m_LandTitleNumber ) { copy_self->m_LandTitleNumber = dynamic_pointer_cast<IfcLabel>( m_LandTitleNumber->getDeepCopy(options) ); }
	if( m_SiteAddress ) { copy_self->m_SiteAddress = dynamic_pointer_cast<IfcPostalAddress>( m_SiteAddress->getDeepCopy(options) ); }
	return copy_self;
}
void IFC4X3::IfcSite::getStepLine( std::stringstream& stream ) const
{
	stream << "#" << m_tag << "= IFCSITE" << "(";
	if( m_GlobalId ) { m_GlobalId->getStepParameter( stream ); } else { stream << "$"; }
	stream << ",";
	if( m_OwnerHistory ) { stream << "#" << m_OwnerHistory->m_tag; } else { stream << "$"; }
	stream << ",";
	if( m_Name ) { m_Name->getStepParameter( stream ); } else { stream << "$"; }
	stream << ",";
	if( m_Description ) { m_Description->getStepParameter( stream ); } else { stream << "$"; }
	stream << ",";
	if( m_ObjectType ) { m_ObjectType->getStepParameter( stream ); } else { stream << "$"; }
	stream << ",";
	if( m_ObjectPlacement ) { stream << "#" << m_ObjectPlacement->m_tag; } else { stream << "$"; }
	stream << ",";
	if( m_Representation ) { stream << "#" << m_Representation->m_tag; } else { stream << "$"; }
	stream << ",";
	if( m_LongName ) { m_LongName->getStepParameter( stream ); } else { stream << "$"; }
	stream << ",";
	if( m_CompositionType ) { m_CompositionType->getStepParameter( stream ); } else { stream << "$"; }
	stream << ",";
	if( m_RefLatitude ) { m_RefLatitude->getStepParameter( stream ); } else { stream << "$"; }
	stream << ",";
	if( m_RefLongitude ) { m_RefLongitude->getStepParameter( stream ); } else { stream << "$"; }
	stream << ",";
	if( m_RefElevation ) { m_RefElevation->getStepParameter( stream ); } else { stream << "$"; }
	stream << ",";
	if( m_LandTitleNumber ) { m_LandTitleNumber->getStepParameter( stream ); } else { stream << "$"; }
	stream << ",";
	if( m_SiteAddress ) { stream << "#" << m_SiteAddress->m_tag; } else { stream << "$"; }
	stream << ");";
}
void IFC4X3::IfcSite::getStepParameter( std::stringstream& stream, bool /*is_select_type*/ ) const { stream << "#" << m_tag; }
void IFC4X3::IfcSite::readStepArguments( const std::vector<std::string>& args, const std::map<int,shared_ptr<BuildingEntity> >& map, std::stringstream& errorStream )
{
	const size_t num_args = args.size();
	if( num_args != 14 ){ std::stringstream err; err << "Wrong parameter count for entity IfcSite, expecting 14, having " << num_args << ". Entity ID: " << m_tag << std::endl; throw BuildingException( err.str().c_str() ); }
	m_GlobalId = IfcGloballyUniqueId::createObjectFromSTEP( args[0], map, errorStream );
	readEntityReference( args[1], m_OwnerHistory, map, errorStream );
	m_Name = IfcLabel::createObjectFromSTEP( args[2], map, errorStream );
	m_Description = IfcText::createObjectFromSTEP( args[3], map, errorStream );
	m_ObjectType = IfcLabel::createObjectFromSTEP( args[4], map, errorStream );
	readEntityReference( args[5], m_ObjectPlacement, map, errorStream );
	readEntityReference( args[6], m_Representation, map, errorStream );
	m_LongName = IfcLabel::createObjectFromSTEP( args[7], map, errorStream );
	m_CompositionType = IfcElementCompositionEnum::createObjectFromSTEP( args[8], map, errorStream );
	m_RefLatitude = IfcCompoundPlaneAngleMeasure::createObjectFromSTEP( args[9], map, errorStream );
	m_RefLongitude = IfcCompoundPlaneAngleMeasure::createObjectFromSTEP( args[10], map, errorStream );
	m_RefElevation = IfcLengthMeasure::createObjectFromSTEP( args[11], map, errorStream );
	m_LandTitleNumber = IfcLabel::createObjectFromSTEP( args[12], map, errorStream );
	readEntityReference( args[13], m_SiteAddress, map, errorStream );
}
void IFC4X3::IfcSite::getAttributes( std::vector<std::pair<std::string, shared_ptr<BuildingObject> > >& vec_attributes ) const
{
	IFC4X3::IfcSpatialStructureElement::getAttributes( vec_attributes );
	vec_attributes.emplace_back( std::make_pair( "RefLatitude", m_RefLatitude ) );
	vec_attributes.emplace_back( std::make_pair( "RefLongitude", m_RefLongitude ) );
	vec_attributes.emplace_back( std::make_pair( "RefElevation", m_RefElevation ) );
	vec_attributes.emplace_back( std::make_pair( "LandTitleNumber", m_LandTitleNumber ) );
	vec_attributes.emplace_back( std::make_pair( "SiteAddress", m_SiteAddress ) );
}
void IFC4X3::IfcSite::getAttributesInverse( std::vector<std::pair<std::string, shared_ptr<BuildingObject> > >& vec_attributes_inverse ) const
{
	IFC4X3::IfcSpatialStructureElement::getAttributesInverse( vec_attributes_inverse );
}
void IFC4X3::IfcSite::setInverseCounterparts( shared_ptr<BuildingEntity> ptr_self_entity )
{
	IfcSpatialStructureElement::setInverseCounterparts( ptr_self_entity );
}
void IFC4X3::IfcSite::unlinkFromInverseCounterparts()
{
	IfcSpatialStructureElement::unlinkFromInverseCounterparts();
}


text:
'''
Created by auto_sdk on 2015.04.21
'''
from aliyun.api.base import RestApi
class Ecs20130110DescribeImagesRequest(RestApi):
	def __init__(self,domain='ecs.aliyuncs.com',port=80):
		RestApi.__init__(self,domain, port)
		self.ImageId = None
		self.ImageOwnerAlias = None
		self.PageNumber = None
		self.PageSize = None
		self.RegionId = None

	def getapiname(self):
		return 'ecs.aliyuncs.com.DescribeImages.2013-01-10'


text:
var path = require('path'),
	rootPath = path.normalize(__dirname + '/..'),
	dotenv = require('dotenv'),
	env = process.env.NODE_ENV || 'development';

if (process.env.NODE_ENV != 'docker') {
	dotenv.load();
}

var config = {
  development: {
		apiUrl: process.env.COMMON_IFLUX_API_URL,
		interval: process.env.PUBLIBIKE_POLL_INTERVAL || 10000,
	  source: process.env.PUBLIBIKE_SOURCE,
	  eventType: process.env.PUBLIBIKE_EVENT_TYPE
  },

  test: {
		apiUrl: process.env.COMMON_IFLUX_API_URL,
		intervall: process.env.PUBLIBIKE_POLL_INTERVAL || 10000,
	  source: process.env.PUBLIBIKE_SOURCE,
	  eventType: process.env.PUBLIBIKE_EVENT_TYPE
	},

  production: {
		apiUrl: process.env.COMMON_IFLUX_API_URL,
		interval: process.env.PUBLIBIKE_POLL_INTERVAL || 600000,
	  source: process.env.PUBLIBIKE_SOURCE,
	  eventType: process.env.PUBLIBIKE_EVENT_TYPE
  },

	docker: {
		apiUrl: process.env.COMMON_IFLUX_API_URL,
		interval: process.env.PUBLIBIKE_POLL_INTERVAL || 60000,
		source: process.env.PUBLIBIKE_SOURCE,
		eventType: process.env.PUBLIBIKE_EVENT_TYPE
	}
};

module.exports = config[env];


text:
module Joyride
  module ApplicationHelper
  end
end


text:
package org.jbpm.workbench.common.client.dataset;

import java.util.function.Consumer;

import com.google.gwtmockito.GwtMockitoTestRunner;
import org.dashbuilder.common.client.error.ClientRuntimeError;
import org.dashbuilder.dataset.DataSet;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.kie.workbench.common.workbench.client.error.DefaultWorkbenchErrorCallback;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Spy;
import org.uberfire.mvp.Command;

import static org.mockito.Mockito.*;

@RunWith(GwtMockitoTestRunner.class)
public class ErrorHandlerBuilderTest {

    @Mock
    DefaultWorkbenchErrorCallback errorCallback;

    @InjectMocks
    @Spy
    ErrorHandlerBuilder dataSetReadyCallback;

    @Before
    public void setup() {
        doNothing().when(dataSetReadyCallback).showErrorMessage(any());
    }

    @Test
    public void testNotFound() {
        final Command command = mock(Command.class);
        dataSetReadyCallback.setEmptyResultsCallback(command);

        dataSetReadyCallback.notFound();

        verify(command).execute();
        verify(dataSetReadyCallback).showErrorMessage(any());
        verify(errorCallback,
               never()).error(any());
    }

    @Test
    public void testOnError() {
        final Command command = mock(Command.class);
        dataSetReadyCallback.setEmptyResultsCallback(command);

        dataSetReadyCallback.onError(mock(ClientRuntimeError.class));

        verify(command).execute();
        verify(errorCallback).error(any());
        verify(dataSetReadyCallback,
               never()).showErrorMessage(any());
    }

    @Test
    public void testCallback() {
        final Consumer<DataSet> consumer = mock(Consumer.class);
        dataSetReadyCallback.setCallback(consumer);

        dataSetReadyCallback.callback(mock(DataSet.class));

        verify(consumer).accept(any());
        verify(errorCallback,
               never()).error(any());
        verify(dataSetReadyCallback,
               never()).showErrorMessage(any());
    }
}


text:
import itertools
import os
import re

from testrunner.local import testsuite
from testrunner.objects import testcase

FLAGS_PATTERN = re.compile(r"//\s+Flags:(.*)")
FILES_PATTERN = re.compile(r"//\s+Files:(.*)")
SELF_SCRIPT_PATTERN = re.compile(r"//\s+Env: TEST_FILE_NAME")

# TODO (machenbach): Share commonalities with mjstest.
class WebkitTestSuite(testsuite.TestSuite):

  def __init__(self, name, root):
    super(WebkitTestSuite, self).__init__(name, root)

  def ListTests(self, context):
    tests = []
    for dirname, dirs, files in os.walk(self.root):
      for dotted in [x for x in dirs if x.startswith('.')]:
        dirs.remove(dotted)
      if 'resources' in dirs:
        dirs.remove('resources')

      dirs.sort()
      files.sort()
      for filename in files:
        if filename.endswith(".js"):
          fullpath = os.path.join(dirname, filename)
          relpath = fullpath[len(self.root) + 1 : -3]
          testname = relpath.replace(os.path.sep, "/")
          test = testcase.TestCase(self, testname)
          tests.append(test)
    return tests

  def GetFlagsForTestCase(self, testcase, context):
    source = self.GetSourceForTest(testcase)
    flags = [] + context.mode_flags
    flags_match = re.findall(FLAGS_PATTERN, source)
    for match in flags_match:
      flags += match.strip().split()

    files_list = []  # List of file names to append to command arguments.
    files_match = FILES_PATTERN.search(source);
    # Accept several lines of 'Files:'.
    while True:
      if files_match:
        files_list += files_match.group(1).strip().split()
        files_match = FILES_PATTERN.search(source, files_match.end())
      else:
        break
    files = [ os.path.normpath(os.path.join(self.root, '..', '..', f))
              for f in files_list ]
    testfilename = os.path.join(self.root, testcase.path + self.suffix())
    if SELF_SCRIPT_PATTERN.search(source):
      env = ["-e", "TEST_FILE_NAME=\"%s\"" % testfilename.replace("\\", "\\\\")]
      files = env + files
    files.append(os.path.join(self.root, "resources/standalone-pre.js"))
    files.append(testfilename)
    files.append(os.path.join(self.root, "resources/standalone-post.js"))

    flags += files
    if context.isolates:
      flags.append("--isolate")
      flags += files

    return testcase.flags + flags

  def GetSourceForTest(self, testcase):
    filename = os.path.join(self.root, testcase.path + self.suffix())
    with open(filename) as f:
      return f.read()

  # TODO(machenbach): Share with test/message/testcfg.py
  def _IgnoreLine(self, string):
    """Ignore empty lines, valgrind output and Android output."""
    if not string: return True
    return (string.startswith("==") or string.startswith("**") or
            string.startswith("ANDROID") or
            # These five patterns appear in normal Native Client output.
            string.startswith("DEBUG MODE ENABLED") or
            string.startswith("tools/nacl-run.py") or
            string.find("BYPASSING ALL ACL CHECKS") > 0 or
            string.find("Native Client module will be loaded") > 0 or
            string.find("NaClHostDescOpen:") > 0 or
            # FIXME(machenbach): The test driver shouldn't try to use slow
            # asserts if they weren't compiled. This fails in optdebug=2.
            string == "Warning: unknown flag --enable-slow-asserts." or
            string == "Try --help for options")

  def IsFailureOutput(self, testcase):
    if super(WebkitTestSuite, self).IsFailureOutput(testcase):
      return True
    file_name = os.path.join(self.root, testcase.path) + "-expected.txt"
    with file(file_name, "r") as expected:
      expected_lines = expected.readlines()

    def ExpIterator():
      for line in expected_lines:
        if line.startswith("#") or not line.strip(): continue
        yield line.strip()

    def ActIterator(lines):
      for line in lines:
        if self._IgnoreLine(line.strip()): continue
        yield line.strip()

    def ActBlockIterator():
      """Iterates over blocks of actual output lines."""
      lines = testcase.output.stdout.splitlines()
      start_index = 0
      found_eqeq = False
      for index, line in enumerate(lines):
        # If a stress test separator is found:
        if line.startswith("=="):
          # Iterate over all lines before a separator except the first.
          if not found_eqeq:
            found_eqeq = True
          else:
            yield ActIterator(lines[start_index:index])
          # The next block of output lines starts after the separator.
          start_index = index + 1
      # Iterate over complete output if no separator was found.
      if not found_eqeq:
        yield ActIterator(lines)

    for act_iterator in ActBlockIterator():
      for (expected, actual) in itertools.izip_longest(
          ExpIterator(), act_iterator, fillvalue=''):
        if expected != actual:
          return True
      return False

def GetSuite(name, root):
  return WebkitTestSuite(name, root)


text:
<?php

// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.

defined('MOODLE_INTERNAL') || die();

$string['correctansweris'] = 'Правилният отговор е: {$a}';
$string['pluginname_help'] = 'Напишете някакъв текст на въпрос, като например: "[[1]] скочи върху [[2]]", след това напишете възможните думи, които трябва да заместят празните места [[1]] и [[2]].';
$string['pluginnamesummary'] = 'Липсващите думи от даден текст се попълва с дърпане и пускане.';


text:
package VMOMI::FaultTolerancePrimaryConfigInfo;
use parent 'VMOMI::FaultToleranceConfigInfo';

use strict;
use warnings;

our @class_ancestors = (
    'FaultToleranceConfigInfo',
    'DynamicData',
);

our @class_members = (
    ['secondaries', 'ManagedObjectReference', 1, ],
);

sub get_class_ancestors {
    return @class_ancestors;
}

sub get_class_members {
    my $class = shift;
    my @super_members = $class->SUPER::get_class_members();
    return (@super_members, @class_members);
}

1;


text:
package cake.internal.util;

import static java.util.Objects.requireNonNull;

import org.cakeframework.bundle.Bundle;
import org.cakeframework.inject.Dependency;
import org.cakeframework.inject.Factory;

import cake.internal.container.ContainerBuilder;
import cake.internal.container.InternalContainerBuilder;
import cake.internal.inject.spi.InjectorBuilder;
import cake.internal.model.InternalBundle;
import cake.internal.util.descriptors.AbstractVariableDescriptor;

/**
 * Various methods to allow access to package private methods in the public API packages.
 */
public final class InternalApis {

    public static void configureExtension(InternalBundle configuration) {
        GeneralHolder.GENERAL.configureExtensionSupport(configuration);
    }

    public static Dependency injectNewDependency(AbstractVariableDescriptor variable) {
        return InjectHolder.INJECT.newDependency(variable);
    }

    public static ContainerBuilder newContainerBuilder(InternalContainerBuilder builder) {
        return GeneralHolder.GENERAL.newContainerBuilderSupport(builder);
    }

    private static class GeneralHolder {
        static final GeneralSupport GENERAL;

        static {
            new ContainerBuilder();
            GENERAL = requireNonNull(GeneralSupport.SUPPORT, "internal error");
        }
    }

    public static abstract class GeneralSupport {
        /** Used for invoking package private InjectorBuilder constructor. */
        private static GeneralSupport SUPPORT;

        /**
         * Configures the extension via {@link Bundle#configure()}.
         *
         * @param configuration
         *            the internal extension configuration
         */
        protected abstract void configureExtensionSupport(InternalBundle configuration);

        protected abstract ContainerBuilder newContainerBuilderSupport(InternalContainerBuilder builder);

        public static void init(GeneralSupport ss) {
            if (SUPPORT != null) {
                throw new Error("Already initialized");
            }
            SUPPORT = requireNonNull(ss);
        }

    }

    static class InjectHolder {
        static final SupportInject INJECT;

        static {
            new InjectorBuilder();
            INJECT = requireNonNull(SupportInject.SUPPORT, "internal error");
        }
    }

    public static abstract class SupportInject {

        /** Used for invoking package private InjectorBuilder constructor. */
        private static SupportInject SUPPORT;

        protected abstract <T> T create(Factory<T> factory, Object[] arguments);

        protected abstract Dependency newDependency(AbstractVariableDescriptor variable);

        // protected abstract InjectorBuilder newBuilderSupport(InternalInjectorBuilder builder);

        public static void init(SupportInject ss) {
            if (SUPPORT != null) {
                throw new Error("Already initialized");
            }
            SUPPORT = requireNonNull(ss);
        }
    }
}


text:
package com.ibm.wsdl.extensions;

import javax.wsdl.*;
import javax.wsdl.extensions.*;
import javax.wsdl.extensions.soap.*;
import javax.wsdl.extensions.soap12.*;
import javax.wsdl.extensions.mime.*;
import com.ibm.wsdl.extensions.soap.*;
import com.ibm.wsdl.extensions.soap12.*;
import com.ibm.wsdl.extensions.http.*;
import com.ibm.wsdl.extensions.mime.*;
import com.ibm.wsdl.extensions.schema.*;

/**
 * This class extends ExtensionRegistry and pre-registers
 * serializers/deserializers for the SOAP, HTTP and MIME
 * extensions. Java extensionTypes are also mapped for all
 * the SOAP, HTTP and MIME extensions.
 *
 * @author Matthew J. Duftler (duftler@us.ibm.com)
 */
public class PopulatedExtensionRegistry extends ExtensionRegistry
{
  public static final long serialVersionUID = 1;

  public PopulatedExtensionRegistry()
  {
    SOAPAddressSerializer soapAddressSer = new SOAPAddressSerializer();

    registerSerializer(Port.class,
                       SOAPConstants.Q_ELEM_SOAP_ADDRESS,
                       soapAddressSer);
    registerDeserializer(Port.class,
                         SOAPConstants.Q_ELEM_SOAP_ADDRESS,
                         soapAddressSer);
    mapExtensionTypes(Port.class,
                      SOAPConstants.Q_ELEM_SOAP_ADDRESS,
                      SOAPAddressImpl.class);

    SOAPBindingSerializer soapBindingSer = new SOAPBindingSerializer();

    registerSerializer(Binding.class,
                       SOAPConstants.Q_ELEM_SOAP_BINDING,
                       soapBindingSer);
    registerDeserializer(Binding.class,
                         SOAPConstants.Q_ELEM_SOAP_BINDING,
                         soapBindingSer);
    mapExtensionTypes(Binding.class,
                      SOAPConstants.Q_ELEM_SOAP_BINDING,
                      SOAPBindingImpl.class);

    SOAPHeaderSerializer soapHeaderSer = new SOAPHeaderSerializer();

    registerSerializer(BindingInput.class,
                       SOAPConstants.Q_ELEM_SOAP_HEADER,
                       soapHeaderSer);
    registerDeserializer(BindingInput.class,
                         SOAPConstants.Q_ELEM_SOAP_HEADER,
                         soapHeaderSer);
    mapExtensionTypes(BindingInput.class,
                      SOAPConstants.Q_ELEM_SOAP_HEADER,
                      SOAPHeaderImpl.class);
    registerSerializer(BindingOutput.class,
                       SOAPConstants.Q_ELEM_SOAP_HEADER,
                       soapHeaderSer);
    registerDeserializer(BindingOutput.class,
                         SOAPConstants.Q_ELEM_SOAP_HEADER,
                         soapHeaderSer);
    mapExtensionTypes(BindingOutput.class,
                      SOAPConstants.Q_ELEM_SOAP_HEADER,
                      SOAPHeaderImpl.class);
    mapExtensionTypes(SOAPHeader.class,
                      SOAPConstants.Q_ELEM_SOAP_HEADER_FAULT,
                      SOAPHeaderFaultImpl.class);
    registerSerializer(MIMEPart.class,
                       SOAPConstants.Q_ELEM_SOAP_HEADER,
                       soapHeaderSer);
    registerDeserializer(MIMEPart.class,
                         SOAPConstants.Q_ELEM_SOAP_HEADER,
                         soapHeaderSer);
    mapExtensionTypes(MIMEPart.class,
                      SOAPConstants.Q_ELEM_SOAP_HEADER,
                      SOAPHeaderImpl.class);

    SOAPBodySerializer soapBodySer = new SOAPBodySerializer();

    registerSerializer(BindingInput.class,
                       SOAPConstants.Q_ELEM_SOAP_BODY,
                       soapBodySer);
    registerDeserializer(BindingInput.class,
                         SOAPConstants.Q_ELEM_SOAP_BODY,
                         soapBodySer);
    mapExtensionTypes(BindingInput.class,
                      SOAPConstants.Q_ELEM_SOAP_BODY,
                      SOAPBodyImpl.class);
    registerSerializer(BindingOutput.class,
                       SOAPConstants.Q_ELEM_SOAP_BODY,
                       soapBodySer);
    registerDeserializer(BindingOutput.class,
                         SOAPConstants.Q_ELEM_SOAP_BODY,
                         soapBodySer);
    mapExtensionTypes(BindingOutput.class,
                      SOAPConstants.Q_ELEM_SOAP_BODY,
                      SOAPBodyImpl.class);
    registerSerializer(MIMEPart.class,
                       SOAPConstants.Q_ELEM_SOAP_BODY,
                       soapBodySer);
    registerDeserializer(MIMEPart.class,
                         SOAPConstants.Q_ELEM_SOAP_BODY,
                         soapBodySer);
    mapExtensionTypes(MIMEPart.class,
                      SOAPConstants.Q_ELEM_SOAP_BODY,
                      SOAPBodyImpl.class);

    SOAPFaultSerializer soapFaultSer = new SOAPFaultSerializer();

    registerSerializer(BindingFault.class,
                       SOAPConstants.Q_ELEM_SOAP_FAULT,
                       soapFaultSer);
    registerDeserializer(BindingFault.class,
                         SOAPConstants.Q_ELEM_SOAP_FAULT,
                         soapFaultSer);
    mapExtensionTypes(BindingFault.class,
                      SOAPConstants.Q_ELEM_SOAP_FAULT,
                      SOAPFaultImpl.class);

    SOAPOperationSerializer soapOperationSer = new SOAPOperationSerializer();

    registerSerializer(BindingOperation.class,
                       SOAPConstants.Q_ELEM_SOAP_OPERATION,
                       soapOperationSer);
    registerDeserializer(BindingOperation.class,
                         SOAPConstants.Q_ELEM_SOAP_OPERATION,
                         soapOperationSer);
    mapExtensionTypes(BindingOperation.class,
                      SOAPConstants.Q_ELEM_SOAP_OPERATION,
                      SOAPOperationImpl.class);

    SOAP12AddressSerializer soap12AddressSer = new SOAP12AddressSerializer();

    registerSerializer(Port.class,
                       SOAP12Constants.Q_ELEM_SOAP_ADDRESS,
                       soap12AddressSer);
    registerDeserializer(Port.class,
                         SOAP12Constants.Q_ELEM_SOAP_ADDRESS,
                         soap12AddressSer);
    mapExtensionTypes(Port.class,
                      SOAP12Constants.Q_ELEM_SOAP_ADDRESS,
                      SOAP12AddressImpl.class);

    SOAP12BindingSerializer soap12BindingSer = new SOAP12BindingSerializer();

    registerSerializer(Binding.class,
                       SOAP12Constants.Q_ELEM_SOAP_BINDING,
                       soap12BindingSer);
    registerDeserializer(Binding.class,
                         SOAP12Constants.Q_ELEM_SOAP_BINDING,
                         soap12BindingSer);
    mapExtensionTypes(Binding.class,
                      SOAP12Constants.Q_ELEM_SOAP_BINDING,
                      SOAP12BindingImpl.class);

    SOAP12HeaderSerializer soap12HeaderSer = new SOAP12HeaderSerializer();

    registerSerializer(BindingInput.class,
                       SOAP12Constants.Q_ELEM_SOAP_HEADER,
                       soap12HeaderSer);
    registerDeserializer(BindingInput.class,
                         SOAP12Constants.Q_ELEM_SOAP_HEADER,
                         soap12HeaderSer);
    mapExtensionTypes(BindingInput.class,
                      SOAP12Constants.Q_ELEM_SOAP_HEADER,
                      SOAP12HeaderImpl.class);
    registerSerializer(BindingOutput.class,
                       SOAP12Constants.Q_ELEM_SOAP_HEADER,
                       soap12HeaderSer);
    registerDeserializer(BindingOutput.class,
                         SOAP12Constants.Q_ELEM_SOAP_HEADER,
                         soap12HeaderSer);
    mapExtensionTypes(BindingOutput.class,
                      SOAP12Constants.Q_ELEM_SOAP_HEADER,
                      SOAP12HeaderImpl.class);
    mapExtensionTypes(SOAP12Header.class,
                      SOAP12Constants.Q_ELEM_SOAP_HEADER_FAULT,
                      SOAP12HeaderFaultImpl.class);
    registerSerializer(MIMEPart.class,
                       SOAP12Constants.Q_ELEM_SOAP_HEADER,
                       soap12HeaderSer);
    registerDeserializer(MIMEPart.class,
                         SOAP12Constants.Q_ELEM_SOAP_HEADER,
                         soap12HeaderSer);
    mapExtensionTypes(MIMEPart.class,
                      SOAP12Constants.Q_ELEM_SOAP_HEADER,
                      SOAP12HeaderImpl.class);

    SOAP12BodySerializer soap12BodySer = new SOAP12BodySerializer();

    registerSerializer(BindingInput.class,
                       SOAP12Constants.Q_ELEM_SOAP_BODY,
                       soap12BodySer);
    registerDeserializer(BindingInput.class,
                         SOAP12Constants.Q_ELEM_SOAP_BODY,
                         soap12BodySer);
    mapExtensionTypes(BindingInput.class,
                      SOAP12Constants.Q_ELEM_SOAP_BODY,
                      SOAP12BodyImpl.class);
    registerSerializer(BindingOutput.class,
                       SOAP12Constants.Q_ELEM_SOAP_BODY,
                       soap12BodySer);
    registerDeserializer(BindingOutput.class,
                         SOAP12Constants.Q_ELEM_SOAP_BODY,
                         soap12BodySer);
    mapExtensionTypes(BindingOutput.class,
                      SOAP12Constants.Q_ELEM_SOAP_BODY,
                      SOAP12BodyImpl.class);
    registerSerializer(MIMEPart.class,
                       SOAP12Constants.Q_ELEM_SOAP_BODY,
                       soap12BodySer);
    registerDeserializer(MIMEPart.class,
                         SOAP12Constants.Q_ELEM_SOAP_BODY,
                         soap12BodySer);
    mapExtensionTypes(MIMEPart.class,
                      SOAP12Constants.Q_ELEM_SOAP_BODY,
                      SOAP12BodyImpl.class);

    SOAP12FaultSerializer soap12FaultSer = new SOAP12FaultSerializer();

    registerSerializer(BindingFault.class,
                       SOAP12Constants.Q_ELEM_SOAP_FAULT,
                       soap12FaultSer);
    registerDeserializer(BindingFault.class,
                         SOAP12Constants.Q_ELEM_SOAP_FAULT,
                         soap12FaultSer);
    mapExtensionTypes(BindingFault.class,
                      SOAP12Constants.Q_ELEM_SOAP_FAULT,
                      SOAP12FaultImpl.class);

    SOAP12OperationSerializer soap12OperationSer = new SOAP12OperationSerializer();

    registerSerializer(BindingOperation.class,
                       SOAP12Constants.Q_ELEM_SOAP_OPERATION,
                       soap12OperationSer);
    registerDeserializer(BindingOperation.class,
                         SOAP12Constants.Q_ELEM_SOAP_OPERATION,
                         soap12OperationSer);
    mapExtensionTypes(BindingOperation.class,
                      SOAP12Constants.Q_ELEM_SOAP_OPERATION,
                      SOAP12OperationImpl.class);

    HTTPAddressSerializer httpAddressSer = new HTTPAddressSerializer();

    registerSerializer(Port.class,
                       HTTPConstants.Q_ELEM_HTTP_ADDRESS,
                       httpAddressSer);
    registerDeserializer(Port.class,
                         HTTPConstants.Q_ELEM_HTTP_ADDRESS,
                         httpAddressSer);
    mapExtensionTypes(Port.class,
                      HTTPConstants.Q_ELEM_HTTP_ADDRESS,
                      HTTPAddressImpl.class);

    HTTPOperationSerializer httpOperationSer = new HTTPOperationSerializer();

    registerSerializer(BindingOperation.class,
                       HTTPConstants.Q_ELEM_HTTP_OPERATION,
                       httpOperationSer);
    registerDeserializer(BindingOperation.class,
                         HTTPConstants.Q_ELEM_HTTP_OPERATION,
                         httpOperationSer);
    mapExtensionTypes(BindingOperation.class,
                      HTTPConstants.Q_ELEM_HTTP_OPERATION,
                      HTTPOperationImpl.class);

    HTTPBindingSerializer httpBindingSer = new HTTPBindingSerializer();

    registerSerializer(Binding.class,
                       HTTPConstants.Q_ELEM_HTTP_BINDING,
                       httpBindingSer);
    registerDeserializer(Binding.class,
                         HTTPConstants.Q_ELEM_HTTP_BINDING,
                         httpBindingSer);
    mapExtensionTypes(Binding.class,
                      HTTPConstants.Q_ELEM_HTTP_BINDING,
                      HTTPBindingImpl.class);

    HTTPUrlEncodedSerializer httpUrlEncodedSer =
      new HTTPUrlEncodedSerializer();

    registerSerializer(BindingInput.class,
                       HTTPConstants.Q_ELEM_HTTP_URL_ENCODED,
                       httpUrlEncodedSer);
    registerDeserializer(BindingInput.class,
                         HTTPConstants.Q_ELEM_HTTP_URL_ENCODED,
                         httpUrlEncodedSer);
    mapExtensionTypes(BindingInput.class,
                      HTTPConstants.Q_ELEM_HTTP_URL_ENCODED,
                      HTTPUrlEncodedImpl.class);

    HTTPUrlReplacementSerializer httpUrlReplacementSer =
      new HTTPUrlReplacementSerializer();

    registerSerializer(BindingInput.class,
                       HTTPConstants.Q_ELEM_HTTP_URL_REPLACEMENT,
                       httpUrlReplacementSer);
    registerDeserializer(BindingInput.class,
                         HTTPConstants.Q_ELEM_HTTP_URL_REPLACEMENT,
                         httpUrlReplacementSer);
    mapExtensionTypes(BindingInput.class,
                      HTTPConstants.Q_ELEM_HTTP_URL_REPLACEMENT,
                      HTTPUrlReplacementImpl.class);

    MIMEContentSerializer mimeContentSer = new MIMEContentSerializer();

    registerSerializer(BindingInput.class,
                       MIMEConstants.Q_ELEM_MIME_CONTENT,
                       mimeContentSer);
    registerDeserializer(BindingInput.class,
                         MIMEConstants.Q_ELEM_MIME_CONTENT,
                         mimeContentSer);
    mapExtensionTypes(BindingInput.class,
                      MIMEConstants.Q_ELEM_MIME_CONTENT,
                      MIMEContentImpl.class);
    registerSerializer(BindingOutput.class,
                       MIMEConstants.Q_ELEM_MIME_CONTENT,
                       mimeContentSer);
    registerDeserializer(BindingOutput.class,
                         MIMEConstants.Q_ELEM_MIME_CONTENT,
                         mimeContentSer);
    mapExtensionTypes(BindingOutput.class,
                      MIMEConstants.Q_ELEM_MIME_CONTENT,
                      MIMEContentImpl.class);
    registerSerializer(MIMEPart.class,
                       MIMEConstants.Q_ELEM_MIME_CONTENT,
                       mimeContentSer);
    registerDeserializer(MIMEPart.class,
                         MIMEConstants.Q_ELEM_MIME_CONTENT,
                         mimeContentSer);
    mapExtensionTypes(MIMEPart.class,
                      MIMEConstants.Q_ELEM_MIME_CONTENT,
                      MIMEContentImpl.class);

    MIMEMultipartRelatedSerializer mimeMultipartRelatedSer =
      new MIMEMultipartRelatedSerializer();

    registerSerializer(BindingInput.class,
                       MIMEConstants.Q_ELEM_MIME_MULTIPART_RELATED,
                       mimeMultipartRelatedSer);
    registerDeserializer(BindingInput.class,
                         MIMEConstants.Q_ELEM_MIME_MULTIPART_RELATED,
                         mimeMultipartRelatedSer);
    mapExtensionTypes(BindingInput.class,
                      MIMEConstants.Q_ELEM_MIME_MULTIPART_RELATED,
                      MIMEMultipartRelatedImpl.class);
    registerSerializer(BindingOutput.class,
                       MIMEConstants.Q_ELEM_MIME_MULTIPART_RELATED,
                       mimeMultipartRelatedSer);
    registerDeserializer(BindingOutput.class,
                         MIMEConstants.Q_ELEM_MIME_MULTIPART_RELATED,
                         mimeMultipartRelatedSer);
    mapExtensionTypes(BindingOutput.class,
                      MIMEConstants.Q_ELEM_MIME_MULTIPART_RELATED,
                      MIMEMultipartRelatedImpl.class);
    registerSerializer(MIMEPart.class,
                       MIMEConstants.Q_ELEM_MIME_MULTIPART_RELATED,
                       mimeMultipartRelatedSer);
    registerDeserializer(MIMEPart.class,
                         MIMEConstants.Q_ELEM_MIME_MULTIPART_RELATED,
                         mimeMultipartRelatedSer);
    mapExtensionTypes(MIMEPart.class,
                      MIMEConstants.Q_ELEM_MIME_MULTIPART_RELATED,
                      MIMEMultipartRelatedImpl.class);
    mapExtensionTypes(MIMEMultipartRelated.class,
                      MIMEConstants.Q_ELEM_MIME_PART,
                      MIMEPartImpl.class);

    MIMEMimeXmlSerializer mimeMimeXmlSer = new MIMEMimeXmlSerializer();

    registerSerializer(BindingInput.class,
                       MIMEConstants.Q_ELEM_MIME_MIME_XML,
                       mimeMimeXmlSer);
    registerDeserializer(BindingInput.class,
                         MIMEConstants.Q_ELEM_MIME_MIME_XML,
                         mimeMimeXmlSer);
    mapExtensionTypes(BindingInput.class,
                      MIMEConstants.Q_ELEM_MIME_MIME_XML,
                      MIMEMimeXmlImpl.class);
    registerSerializer(BindingOutput.class,
                       MIMEConstants.Q_ELEM_MIME_MIME_XML,
                       mimeMimeXmlSer);
    registerDeserializer(BindingOutput.class,
                         MIMEConstants.Q_ELEM_MIME_MIME_XML,
                         mimeMimeXmlSer);
    mapExtensionTypes(BindingOutput.class,
                      MIMEConstants.Q_ELEM_MIME_MIME_XML,
                      MIMEMimeXmlImpl.class);
    registerSerializer(MIMEPart.class,
                       MIMEConstants.Q_ELEM_MIME_MIME_XML,
                       mimeMimeXmlSer);
    registerDeserializer(MIMEPart.class,
                         MIMEConstants.Q_ELEM_MIME_MIME_XML,
                         mimeMimeXmlSer);
    mapExtensionTypes(MIMEPart.class,
                      MIMEConstants.Q_ELEM_MIME_MIME_XML,
                      MIMEMimeXmlImpl.class);

    //Register the schema parser

    mapExtensionTypes(Types.class, SchemaConstants.Q_ELEM_XSD_1999,
        SchemaImpl.class);
    registerDeserializer(Types.class, SchemaConstants.Q_ELEM_XSD_1999,
        new SchemaDeserializer());
    registerSerializer(Types.class, SchemaConstants.Q_ELEM_XSD_1999,
        new SchemaSerializer());

    mapExtensionTypes(Types.class, SchemaConstants.Q_ELEM_XSD_2000,
        SchemaImpl.class);
    registerDeserializer(Types.class, SchemaConstants.Q_ELEM_XSD_2000,
        new SchemaDeserializer());
    registerSerializer(Types.class, SchemaConstants.Q_ELEM_XSD_2000,
        new SchemaSerializer());

    mapExtensionTypes(Types.class, SchemaConstants.Q_ELEM_XSD_2001,
        SchemaImpl.class);
    registerDeserializer(Types.class, SchemaConstants.Q_ELEM_XSD_2001,
        new SchemaDeserializer());
    registerSerializer(Types.class, SchemaConstants.Q_ELEM_XSD_2001,
        new SchemaSerializer());

  }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;

namespace Demo
{
    [TestFixture]
    class D_LocalFunctions
    {
        IEnumerable<double> Iterator_Old(int count)
        {
            if (count < 0) throw new ArgumentException(nameof(count));

            for (int i = 0; i < count; i++)
            {
                yield return Math.Pow(i, 4);
            }
        }

        IEnumerable<double> Iterator_New(int count)
        {
            if (count < 0) throw new ArgumentException(nameof(count));

            IEnumerable<double> doCount()
            {
                for (int i = 1; i <= count; i++)
                {
                    yield return Math.Pow(i,4);
                }
            }

            return doCount();
        }

        [Test]
        public void TestOld()
        {
            var iter = Iterator_Old(-5);

            foreach (var d in iter)
            {
                Assert.Fail();
            }
        }

        [Test]
        public void TesNew()
        {
            var iter = Iterator_New(-5);

            foreach (var d in iter)
            {
                Assert.Fail();
            }
        }

        [Test]
        public void ShouldWork()
        {
            var iter = Iterator_New(5);

            foreach (var d in iter)
            {
                Assert.That(d,Is.GreaterThan(0));
            }
        }

    }
}


text:
package cn.newcapec.framework.core.model.variant;

import java.math.BigDecimal;
import java.sql.SQLException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import cn.newcapec.framework.core.logs.LogEnabled;
import cn.newcapec.framework.core.utils.dataUtils.DateUtil;
import cn.newcapec.framework.core.utils.stringUtils.StringUtil;

/**
 *
 */
public final class VariantUtil implements LogEnabled {
	/**
	 * 短日期formatter
	 */
	private static SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
	/**
	 * 时间formatter
	 */
	private static SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm:ss");
	/**
	 * 长日期formatter
	 */
	private static SimpleDateFormat dateTimeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

	public static final Object toObject(byte value) {
		return new Byte(value);
	}

	public static final Object toObject(short value) {
		return new Short(value);
	}

	public static final Object toObject(int value) {
		return new Integer(value);
	}

	public static final Object toObject(long value) {
		return new Long(value);
	}

	public static final Object toObject(float value) {
		return new Float(value);
	}

	public static final Object toObject(double value) {
		return new Double(value);
	}

	public static final Object toObject(boolean value) {
		return new Boolean(value);
	}

	public static final Object toObject(Date value) {
		return value;
	}

	public static final Object toObject(BigDecimal value) {
		return value;
	}

	public static final Object toObject(String value) {
		return value;
	}

	/**
	 * 转换string
	 *
	 * @param value
	 * @return
	 */
	public static final String parseString(Object value) {
		if (value == null)
			return null;
		if (value instanceof Date)
			return DateUtil.toDateString((Date) value);
		return value.toString();
	}
	/**
	 * 转换byte
	 *
	 * @param value
	 * @return
	 */
	public static final byte parseByte(Object value) {
		String str;
		if (value == null)
			return 0;
		if (value instanceof Number)
			return ((Number) value).byteValue();
		if (value instanceof Boolean)
			return (byte) ((((Boolean) value).booleanValue()) ? 1 : 0);
		if ((str = value.toString()).equals(""))
			return 0;
		return Byte.parseByte(str);
	}
	/**
	 * 转换short
	 *
	 * @param value
	 * @return
	 */
	public static final short parseShort(Object value) {
		String str;
		if (value == null)
			return 0;
		if (value instanceof Number)
			return ((Number) value).shortValue();
		if (value instanceof Boolean)
			return (short) ((((Boolean) value).booleanValue()) ? 1 : 0);
		if ((str = value.toString()).equals(""))
			return 0;
		return Short.parseShort(str);
	}

	/**
	 * 转换int
	 *
	 * @param value
	 * @return
	 */
	public static final int parseInt(Object value) {
		String str;
		if (value == null)
			return 0;
		if (value instanceof Number)
			return ((Number) value).intValue();
		if (value instanceof Boolean) {
			if (((Boolean) value).booleanValue())
				return 1;
			return 0;
		}
		if ((str = value.toString()).equals(""))
			return 0;
		return Integer.parseInt(str);
	}

	/**
	 * 转换long
	 *
	 * @param value
	 * @return
	 */
	public static final long parseLong(Object value) {
		String str;
		if (value == null)
			return 0L;
		if (value instanceof Number)
			return ((Number) value).longValue();
		if (value instanceof Boolean) {
			if (((Boolean) value).booleanValue())
				return 1L;
			return 0L;
		}
		if (value instanceof Date)
			return ((Date) value).getTime();
		if ((str = value.toString()).equals(""))
			return 0L;
		return Long.parseLong(str);
	}
	/**
	 *  转换float
	 * @param value
	 * @return
	 */
	public static final float parseFloat(Object value) {
		String str;
		if (value == null)
			return 0F;
		if (value instanceof Number)
			return ((Number) value).floatValue();
		if (value instanceof Boolean) {
			if (((Boolean) value).booleanValue())
				return 1F;
			return 0F;
		}
		if ((str = value.toString()).equals(""))
			return 0F;
		return Float.parseFloat(str);
	}
	/**
	 * 转换double
	 *
	 * @param value
	 * @return
	 */
	public static final double parseDouble(Object value) {
		String str;
		if (value == null)
			return 0D;
		if (value instanceof Number)
			return ((Number) value).doubleValue();
		if (value instanceof Boolean) {
			if (((Boolean) value).booleanValue())
				return 1D;
			return 0D;
		}
		if ((str = value.toString()).equals(""))
			return 0D;
		return Double.parseDouble(str);
	}

	/**
	 * 转换bigdecimal
	 * @param value
	 * @return
	 */
	public static final BigDecimal parseBigDecimal(Object value) {
		String str;
		if (value == null)
			return BigDecimal.valueOf(0L);
		if (value instanceof BigDecimal)
			return ((BigDecimal) value);
		if (value instanceof Number)
			return BigDecimal.valueOf(((Number) value).longValue());
		if (value instanceof Boolean)
			return BigDecimal.valueOf((((Boolean) value).booleanValue()) ? 1L
					: 0L);
		if ((str = value.toString()).equals(""))
			return BigDecimal.valueOf(0L);
		return new BigDecimal(str);
	}
	/**
	 * 转换逻辑值
	 *
	 * @param value
	 * @return
	 */
	public static final boolean parseBoolean(String value) {
		if (value == null)
			return false;
		return ((value.equalsIgnoreCase("true")) || (value.equals("1")) || (value.equals("-1")));
	}

	/**
	 * 转换布尔值
	 *
	 * @param value
	 * @return
	 */
	public static final boolean parseBoolean(Object value) {
		if (value == null)
			return false;
		if (value instanceof Boolean)
			return ((Boolean) value).booleanValue();
		return parseBoolean(value.toString());
	}
	/**
	 * 判断是否为数值
	 *
	 * @param str
	 * @return
	 */
	private static boolean isNumber(String str) {
		int i = str.length();
		for (int j = 0; j < i; ++j) {
			int k;
			if (((((k = str.charAt(j)) < '0') || (k > 57))) && (k != 46)
					&& (((j != 0) || (k != 45))))
				return false;
		}
		return true;
	}
	/**
	 * 转换日期
	 *
	 * @param value
	 * @return
	 * @throws SQLException
	 */
	public static final Date parseDate(Object value) {
		String str;
		if (value == null)
			return null;
		if (value instanceof Date)
			return ((Date) value);
		if (value instanceof Number)
			return new Date(((Number) value).longValue());
		if (value instanceof oracle.sql.TIMESTAMP)
			try {
				return ((oracle.sql.TIMESTAMP) value).timestampValue();
			} catch (SQLException e) {
				e.printStackTrace();
			}

		if (StringUtil.isValid(str = String.valueOf(value))) {
			if (isNumber(str)) {
				long l = Long.parseLong(str);
				return new Date(l);
			}
			int i = str.length();
			try {
				if (i < 19) {
					if (str.indexOf(":") > 0)
						return timeFormat.parse(str);
					return dateFormat.parse(str);
				}
				log.info("str:"+str);
				return dateTimeFormat.parse(str);
			} catch (ParseException ex) {
				ex.printStackTrace();
				return null;
			}
		}
		return null;
	}

	/**
	 * 将对象转换为对应的数据类型值
	 * @param dataType
	 * @param obj
	 * @return
	 */
	public static final Object translate(int dataType, Object obj) {
		if ((obj == null)
				|| ((obj instanceof String) && (((String) obj)
						.length() == 0))) {
			if (dataType == DataType.STRING)
				return obj;
			return null;
		}
		switch (dataType) {
		case DataType.STRING:
			return parseString(obj);
		case DataType.BOOLEAN:
			return toObject(parseBoolean(obj));
		case DataType.DATE:
		case DataType.TIME:
		case DataType.DATETIME:
			return parseDate(obj);
		case DataType.INT:
			return toObject(parseInt(obj));
		case DataType.DOUBLE:
			return toObject(parseDouble(obj));
		case DataType.LONG:
			return toObject(parseLong(obj));
		case DataType.FLOAT:
			return toObject(parseFloat(obj));
		case DataType.BIGDECIMAL:
			return parseBigDecimal(obj);
		case DataType.BYTE:
			return toObject(parseByte(obj));
		case DataType.SHORT:
			return toObject(parseShort(obj));
		}
		return obj;
	}
}


text:
/**
 *
 */
package com.xinfan.wxshop.business.tag;

import java.io.IOException;
import java.util.List;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.SimpleTagSupport;

import com.xinfan.wxshop.business.service.GoodsService;
import com.xinfan.wxshop.common.base.DataMap;
import com.xinfan.wxshop.common.context.AppContextHolder;

/**
 * @author Administrator
 *
 */
public class TopGoodsListTag extends SimpleTagSupport {

	public void doTag() throws JspException, IOException {

		GoodsService GoodsService = AppContextHolder
				.getBean(GoodsService.class);

		List<DataMap> list = GoodsService.getTopShowGoodsList();

		getJspContext().setAttribute("goods_list", list);
		getJspBody().invoke(null);

	}

}


text:
define([
    './slice'
], function (slice) {
    'use strict';

    /**
     * Curry function
     *
     * Example:
     * curry(function(a, b, c, d)) -> a(b)(c)(d)
     */
    return function curry(func) {
        var count = func.length;
        var args = slice(arguments, 1);
        if (!count) {
            return func;
        }
        if (args.length < count) {
            return function carried() {
                var newArgs = [func];
                newArgs.push.apply(newArgs, args);
                newArgs.push.apply(newArgs, slice(arguments));
                return curry.apply(null, newArgs);
            }
        } else {
            return func.apply(null, args);
        }
    }
});


text:
package org.drools.core.util;

import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.security.InvalidKeyException;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;
import java.security.Signature;
import java.security.SignatureException;
import java.security.UnrecoverableKeyException;
import java.security.cert.Certificate;
import java.security.cert.CertificateException;

import javax.crypto.SecretKey;

import org.drools.core.RuleBaseConfiguration;

import static org.drools.core.util.KeyStoreConstants.KEY_CERTIFICATE_TYPE;
import static org.drools.core.util.KeyStoreConstants.KEY_PASSWORD_TYPE;
import static org.drools.core.util.KeyStoreConstants.PROP_PUB_KS_PWD;
import static org.drools.core.util.KeyStoreConstants.PROP_PUB_KS_URL;
import static org.drools.core.util.KeyStoreConstants.PROP_PVT_ALIAS;
import static org.drools.core.util.KeyStoreConstants.PROP_PVT_KS_PWD;
import static org.drools.core.util.KeyStoreConstants.PROP_PVT_KS_URL;
import static org.drools.core.util.KeyStoreConstants.PROP_PVT_PWD;
import static org.drools.core.util.KeyStoreConstants.PROP_PWD_KS_PWD;
import static org.drools.core.util.KeyStoreConstants.PROP_PWD_KS_URL;

/**
 * A helper class to deal with the key store and signing process during
 * Serialisation
 *

 * This class will read and use the following system properties:
 *

 * drools.serialization.sign = <false|true>
 * drools.serialization.private.keyStoreURL = <URL>
 * drools.serialization.private.keyStorePwd = <password>
 * drools.serialization.private.keyAlias = <key>
 * drools.serialization.private.keyPwd = <password>
 * drools.serialization.public.keyStoreURL = <URL>
 * drools.serialization.public.keyStorePwd = <password>
 */
public class KeyStoreHelper {

    private boolean signed;

    private URL pvtKeyStoreURL;
    private char[] pvtKeyStorePwd;
    private String pvtKeyAlias;
    private char[] pvtKeyPassword;

    private URL pubKeyStoreURL;
    private char[] pubKeyStorePwd;

    private URL pwdKeyStoreURL;
    private char[] pwdKeyStorePwd;

    private KeyStore pvtKeyStore;
    private KeyStore pubKeyStore;
    private KeyStore pwdKeyStore;

    /**
     * Creates a KeyStoreHelper and initialises the KeyStore, by loading its entries.
     * @throws RuntimeException in case any error happens when initialising and loading the keystore.
     */
    public KeyStoreHelper() {
        try {
            this.signed = Boolean.valueOf(System.getProperty(KeyStoreConstants.PROP_SIGN,
                                                             RuleBaseConfiguration.DEFAULT_SIGN_ON_SERIALIZATION)).booleanValue();

            loadPrivateKeyStoreProperties();
            loadPublicKeyStoreProperties();
            loadPasswordKeyStoreProperties();

            initKeyStore();
        } catch (Exception e) {
            throw new RuntimeException("Error initialising KeyStore: " + e.getMessage(), e);
        }
    }

    private void loadPrivateKeyStoreProperties() throws MalformedURLException {
        String url = System.getProperty(PROP_PVT_KS_URL, "");
        if (url.length() > 0) {
            this.pvtKeyStoreURL = new URL(url);
        }
        this.pvtKeyStorePwd = System.getProperty(PROP_PVT_KS_PWD, "").toCharArray();
        this.pvtKeyAlias = System.getProperty(PROP_PVT_ALIAS, "");
        this.pvtKeyPassword = System.getProperty(PROP_PVT_PWD, "").toCharArray();
    }

    private void loadPublicKeyStoreProperties() throws MalformedURLException {
        String url = System.getProperty(PROP_PUB_KS_URL, "");
        if (url.length() > 0) {
            this.pubKeyStoreURL = new URL(url);
        }
        this.pubKeyStorePwd = System.getProperty(PROP_PUB_KS_PWD, "").toCharArray();
    }

    private void loadPasswordKeyStoreProperties() throws MalformedURLException {
        String url = System.getProperty(PROP_PWD_KS_URL, "");
        if (url.length() > 0) {
            pwdKeyStoreURL = new URL(url);
        }
        pwdKeyStorePwd = System.getProperty(PROP_PWD_KS_PWD, "").toCharArray();
    }

    private void initKeyStore() throws NoSuchAlgorithmException, CertificateException, IOException, KeyStoreException {
        if (pvtKeyStoreURL != null) {
            this.pvtKeyStore = loadKeystore(KEY_CERTIFICATE_TYPE, pvtKeyStoreURL, pvtKeyStorePwd);
        }
        if (pubKeyStoreURL != null) {
            this.pubKeyStore = loadKeystore(KEY_CERTIFICATE_TYPE, pubKeyStoreURL, pubKeyStorePwd);
        }
        if (pwdKeyStoreURL != null) {
            this.pwdKeyStore = loadKeystore(KEY_PASSWORD_TYPE, pwdKeyStoreURL, pwdKeyStorePwd);
        }
    }

    private KeyStore loadKeystore(String keyCertificateType, URL url, char[] password) throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException {
        KeyStore keyStore = KeyStore.getInstance(keyCertificateType);
        keyStore.load(url.openStream(), password);

        return keyStore;
    }

    /**
     * Generates the signature for the given byte[] using MD5 with RSA algorithm and the
     * private key with which this helper was initialised.
     *
     * @param data the byte[] of data to be signed
     *
     * @return the signature, encrypted with the private key
     *
     * @throws UnrecoverableKeyException
     * @throws KeyStoreException
     * @throws NoSuchAlgorithmException
     * @throws InvalidKeyException
     * @throws SignatureException
     */
    public byte[] signDataWithPrivateKey(byte[] data) throws UnrecoverableKeyException,
                                                     KeyStoreException,
                                                     NoSuchAlgorithmException,
                                                     InvalidKeyException,
                                                     SignatureException {
        if( pvtKeyStore == null ) {
            throw new RuntimeException( "Key store with private key not configured. Please configure it properly before using signed serialization." );
        }
        PrivateKey pvtkey = (PrivateKey) pvtKeyStore.getKey( pvtKeyAlias,
                                                             pvtKeyPassword );
        Signature sig = Signature.getInstance( "MD5withRSA" );
        sig.initSign( pvtkey );
        sig.update( data );
        return sig.sign();
    }

    /**
     * Checks the given byte[] data against the signature, using the
     * public key with which this helper was initialised and the algorithm
     * MD5 with RSA.
     *
     * @param data the original data that was signed
     * @param signature the provided signature
     *
     * @return true in case the signature matches, false otherwise.
     *
     * @throws KeyStoreException
     * @throws NoSuchAlgorithmException
     * @throws InvalidKeyException
     * @throws SignatureException
     */
    public boolean checkDataWithPublicKey(final String publicKeyAlias,
                                          final byte[] data,
                                          final byte[] signature) throws KeyStoreException,
                                                                 NoSuchAlgorithmException,
                                                                 InvalidKeyException,
                                                                 SignatureException {
        if( pubKeyStore == null ) {
            throw new RuntimeException( "Key store with public key not configured. Please configure it properly before using signed serialization." );
        }
        Certificate cert = pubKeyStore.getCertificate( publicKeyAlias );
        if( cert == null ) {
            throw new RuntimeException( "Public certificate for key '"+publicKeyAlias+"' not found in the configured key store. Impossible to deserialize the object." );
        }
        Signature sig = Signature.getInstance( "MD5withRSA" );
        sig.initVerify( cert.getPublicKey() );
        sig.update( data );
        return sig.verify( signature );
    }

    public String getPasswordKey(String pwdKeyAlias, char[] pwdKeyPassword) {
        SecretKey passwordKey;
        try {
            passwordKey = (SecretKey) pwdKeyStore.getKey(pwdKeyAlias, pwdKeyPassword);
        } catch (Exception e) {
            throw new RuntimeException("Unable to load a key from Key Store. Source " + e.getCause());
        }
        return new String(passwordKey.getEncoded());
    }

    public boolean isSigned() {
        return signed;
    }

    public URL getPvtKeyStoreURL() {
        return pvtKeyStoreURL;
    }

    public char[] getPvtKeyStorePwd() {
        return pvtKeyStorePwd;
    }

    public String getPvtKeyAlias() {
        return pvtKeyAlias;
    }

    public char[] getPvtKeyPassword() {
        return pvtKeyPassword;
    }

    public URL getPubKeyStoreURL() {
        return pubKeyStoreURL;
    }

    public char[] getPubKeyStorePwd() {
        return pubKeyStorePwd;
    }

    public KeyStore getPvtKeyStore() {
        return pvtKeyStore;
    }

    public KeyStore getPubKeyStore() {
        return pubKeyStore;
    }
}


text:
@implementation WeViewVerticalLayoutTests

- (void)setUp
{
    [super setUp];

    // Set-up code here.
}

- (void)tearDown
{
    // Tear-down code here.

    [super tearDown];
}

- (WeViewLayout *)addSubview:(UIView *)subview
                    toWeView:(WeView *)weView
{
    return [weView addSubviewsWithVerticalLayout:@[subview,]];
}

- (WeViewLayout *)addSubviews:(NSArray *)subviews
                     toWeView:(WeView *)weView
{
    return [weView addSubviewsWithVerticalLayout:subviews];
}

- (void)testBasicSizing
{
    [super baseTestBasicSizing];
}

- (void)testBasicMinAndMaxSize
{
    [super baseTestBasicMinAndMaxSize];
}

- (void)testBasicSpacing
{
    [super baseTestBasicSpacing];
}

- (void)testBasicRounding
{
    [super baseTestBasicRounding];
}

- (void)baseTestBasicSizing
{
    WeView *weView = [[WeView alloc] init];
    CGSize subviewSize = CGSizeMake(100, 100);
    WeViewTestView *subview0 = [[WeViewTestView alloc] initWithDesiredSize:subviewSize];
    WeViewTestView *subview1 = [[WeViewTestView alloc] initWithDesiredSize:subviewSize];
    WeViewTestView *subview2 = [[WeViewTestView alloc] initWithDesiredSize:subviewSize];
    WeViewLayout *layout = [self addSubviews:@[subview0, subview1, subview2]
                                    toWeView:weView];

    STAssertTrue(CGSizeEqualToSize([weView sizeThatFits:CGSizeZero], CGSizeMake(100, 300)), @"Unexpected value");

    STAssertTrue(CGSizeEqualToSize([weView sizeThatFits:CGSizeMake(1, 1)], CGSizeMake(100, 300)), @"Unexpected value");

    for (UIView *subview in weView.subviews)
    {
        [subview resetAllLayoutProperties];
    }
    [layout resetAllProperties];
    layout.topMargin = 10;

    STAssertTrue(CGSizeEqualToSize([weView sizeThatFits:CGSizeZero], CGSizeMake(100, 310)), @"Unexpected value");

    for (UIView *subview in weView.subviews)
    {
        [subview resetAllLayoutProperties];
    }
    [layout resetAllProperties];
    layout.vSpacing = 10;

    STAssertTrue(CGSizeEqualToSize([weView sizeThatFits:CGSizeZero], CGSizeMake(100, 320)), @"Unexpected value");

    for (UIView *subview in weView.subviews)
    {
        [subview resetAllLayoutProperties];
    }
    [layout resetAllProperties];
    layout.vSpacing = -10;

    STAssertTrue(CGSizeEqualToSize([weView sizeThatFits:CGSizeZero], CGSizeMake(100, 280)), @"Unexpected value");
}

@end