diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000000..38efe0219e --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,36 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: Bug +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Context & Motivation** + +How has this issue affected you? What are you trying to accomplish? Providing context helps us come up with a solution that is most useful in the real world. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Your Environment** + - Versions used [e.g 5.0.0] + - Operating System and version [e.g. * Operating System and version:] + - Build tool [e.g. Apache Maven 3.6.0] + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000000..adc97e3e28 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: Feature Request +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.travis.yml b/.travis.yml index 67197a1878..6b1aa64966 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,8 +24,8 @@ jobs: - jdk: openjdk11 script: mvn -q verify - # 1.3 Check java doc - - jdk: openjdk8 + # 1.3 Check javadoc. We need to use this version to properly detect errors. + - jdk: oraclejdk11 env: JAVADOC=true script: - mvn clean verify -DskipTests=true diff --git a/CHANGELOG.md b/CHANGELOG.md index 293c62625e..66f07a38cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,9 @@ Please see [CONTRIBUTING.md](https://github.com/cucumber/cucumber/blob/master/CO ## [5.0.0-SNAPSHOT](https://github.com/cucumber/cucumber-jvm/compare/v4.7.1...master) (In Git) ### Added + * [Core] Upgrade the timeline formatter's jQuery dependency from 3.3.1 to 3.4.1. jQuery 3.3.1 has an [XSS vulnerability](https://www.cvedetails.com/cve/CVE-2019-11358/) + that wouldn't normally affect the timeline formatter. However, it did prevent some organisations from downloading the cucumber-core jar because nexus would block it. + ([#1759](https://github.com/cucumber/cucumber-jvm/issues/1759), [#1769](https://github.com/cucumber/cucumber-jvm/pull/1769) Vincent Pretre, Aslak Hellesøy) * [Core] Add `object-factory` option to CLI and `@CucumberOptions`. ([#1710](https://github.com/cucumber/cucumber-jvm/pull/1710) Ralph Kar) * [Java] Allow parameter types access to the test context ([#851](https://github.com/cucumber/cucumber-jvm/issues/851), [#1458](https://github.com/cucumber/cucumber-jvm/issues/1458) M.P. Korstanje) - Add `@ParameterType` alternative for `TypeRegistry.defineParameterType` @@ -23,11 +26,9 @@ Please see [CONTRIBUTING.md](https://github.com/cucumber/cucumber/blob/master/CO - cucumber.execution.dry-run - cucumber.execution.limit - cucumber.execution.order - - cucumber.execution.parallel.config.fixed.parallelism - cucumber.execution.strict - cucumber.execution.wip - cucumber.feature - - cucumber.rerun-file - cucumber.filter.name - cucumber.filter.tags - cucumber.glue @@ -36,11 +37,12 @@ Please see [CONTRIBUTING.md](https://github.com/cucumber/cucumber/blob/master/CO - cucumber.snippet-type ### Changed - * [All] New package structure ([#1445](https://github.com/cucumber/cucumber-jvm/pull/1445), [#1448](https://github.com/cucumber/cucumber-jvm/issues/1448), [#1449](https://github.com/cucumber/cucumber-jvm/pull/1449) M.P. Korstanje) + * [All] New package structure ([#1445](https://github.com/cucumber/cucumber-jvm/pull/1445), [#1448](https://github.com/cucumber/cucumber-jvm/issues/1448), [#1449](https://github.com/cucumber/cucumber-jvm/pull/1449), [#1760](https://github.com/cucumber/cucumber-jvm/pull/1760) M.P. Korstanje) - Adds `Automatic-Module-Name` to each module - Roots packages in `io.cucumber.` - Use `find . -name '*.java' -exec sed -i 's/import cucumber.api/import io.cucumber/g' {} \; -exec sed -i 's/cucumber.CucumberOptions/cucumber.junit.CucumberOptions/g' {} \;` to adopt 90% of the new package structure - Use @API Guardian annotations to mark the public API ([#1536](https://github.com/cucumber/cucumber-jvm/issues/1536) M.P. Korstanje) + - Limits the transitive use `cucumber-core` for regular users * [All] Compile using source and target level 8 ([#1611](https://github.com/cucumber/cucumber-jvm/issues/1611) M.P. Korstanje) * [Java8] Remove `cucumber-java8` dependency on `cucumber-java` - To use both lambda and annotation based step definitions add a dependency on `cucumber-java` and `cucumber-java8` @@ -72,18 +74,16 @@ Please see [CONTRIBUTING.md](https://github.com/cucumber/cucumber/blob/master/CO - Adds dedicated `io.cucumber.docstring.DocString` object to use in step definitions - Adds `TypeRegistry.defineDocStringType` - Adds `@DocStringType` alternative for `TypeRegistry.defineDocStringType` - -### Deprecated - * [Core] Deprecate `timeout` ([#1506](https://github.com/cucumber/cucumber-jvm/issues/1506), [#1694](https://github.com/cucumber/cucumber-jvm/issues/1694) M.P. Korstanje) - - Prefer using library based solutions - * [JUnit 5 `Assertions.assertTimeout*`](https://junit.org/junit5/docs/5.0.1/api/org/junit/jupiter/api/Assertions.html#assertTimeout-java.time.Duration-org.junit.jupiter.api.function.Executable-) - * [Awaitility](https://github.com/awaitility/awaitility) - * [Guava `TimeLimiter`](https://github.com/google/guava/blob/master/guava/src/com/google/common/util/concurrent/TimeLimiter.java) ### Removed - [Core] Remove deprecated tag syntax. - [Core] Remove `StepDefinitionReporter` ([#1635](https://github.com/cucumber/cucumber-jvm/issues/1635) M.P. Korstanje, Tim te Beek) - Listen `StepDefined` events instead + * [Core] Remove `timeout` ([#1506](https://github.com/cucumber/cucumber-jvm/issues/1506), [#1694](https://github.com/cucumber/cucumber-jvm/issues/1694) M.P. Korstanje) + - Prefer using library based solutions + * [JUnit 5 `Assertions.assertTimeout*`](https://junit.org/junit5/docs/5.0.1/api/org/junit/jupiter/api/Assertions.html#assertTimeout-java.time.Duration-org.junit.jupiter.api.function.Executable-) + * [Awaitility](https://github.com/awaitility/awaitility) + * [Guava `TimeLimiter`](https://github.com/google/guava/blob/master/guava/src/com/google/common/util/concurrent/TimeLimiter.java) ### Fixed - [Java8] Set default before hook order to the same after hook (1000) @@ -171,6 +171,10 @@ Please see [CONTRIBUTING.md](https://github.com/cucumber/cucumber/blob/master/CO - It is recommended to implement your own transaction hooks. - Will allow the dependency on `spring-txn` to be removed. +### Note +Use the snapshot version of the cucumber-eclipse plugin for cucumber 4.5.0 and above that supports the new package structure. To use the latest snapshot version, refer [Follow the latest snapshot](https://github.com/cucumber/cucumber-eclipse#follow-the-latest-snapshot) + + ## [4.4.0](https://github.com/cucumber/cucumber-jvm/compare/v4.3.1...v4.0.0) (2019-06-15) ### Added diff --git a/core/pom.xml b/core/pom.xml index 450adc541a..06637447f4 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -14,7 +14,7 @@ io.cucumber.core 1.12.1 - 1.6 + 2.6.3 0.4.15 0.3.0 0.2 @@ -37,6 +37,10 @@ io.cucumber datatable + + io.cucumber + cucumber-plugin + io.cucumber docstring @@ -47,8 +51,14 @@ - xmlunit - xmlunit + org.xmlunit + xmlunit-core + ${xmlunit.version} + test + + + org.xmlunit + xmlunit-matchers ${xmlunit.version} test diff --git a/core/src/main/java/io/cucumber/core/backend/Backend.java b/core/src/main/java/io/cucumber/core/backend/Backend.java index d00ced1933..484225c4a0 100644 --- a/core/src/main/java/io/cucumber/core/backend/Backend.java +++ b/core/src/main/java/io/cucumber/core/backend/Backend.java @@ -1,6 +1,5 @@ package io.cucumber.core.backend; -import io.cucumber.core.snippets.Snippet; import org.apiguardian.api.API; import java.net.URI; @@ -20,7 +19,7 @@ public interface Backend { * Invoked before a new scenario starts. Implementations should do any necessary * setup of new, isolated state here. Additional scenario scoped step definitions * can be loaded here. These step definitions should implement - * {@link io.cucumber.core.runner.ScenarioScoped} + * {@link ScenarioScoped} */ void buildWorld(); diff --git a/core/src/main/java/io/cucumber/core/backend/BackendProviderService.java b/core/src/main/java/io/cucumber/core/backend/BackendProviderService.java index 4bee6d632b..75cded214f 100644 --- a/core/src/main/java/io/cucumber/core/backend/BackendProviderService.java +++ b/core/src/main/java/io/cucumber/core/backend/BackendProviderService.java @@ -1,11 +1,12 @@ package io.cucumber.core.backend; -import io.cucumber.core.io.ResourceLoader; import org.apiguardian.api.API; +import java.util.function.Supplier; + @API(status = API.Status.STABLE) public interface BackendProviderService { - Backend create(Lookup lookup, Container container, ResourceLoader resourceLoader); + Backend create(Lookup lookup, Container container, Supplier classLoader); } diff --git a/core/src/main/java/io/cucumber/core/backend/CucumberBackendException.java b/core/src/main/java/io/cucumber/core/backend/CucumberBackendException.java new file mode 100644 index 0000000000..b79c40aca5 --- /dev/null +++ b/core/src/main/java/io/cucumber/core/backend/CucumberBackendException.java @@ -0,0 +1,12 @@ +package io.cucumber.core.backend; + +public class CucumberBackendException extends RuntimeException { + + public CucumberBackendException(String message) { + super(message); + } + + public CucumberBackendException(String message, Throwable cause) { + super(message, cause); + } +} diff --git a/core/src/main/java/io/cucumber/core/backend/CucumberInvocationTargetException.java b/core/src/main/java/io/cucumber/core/backend/CucumberInvocationTargetException.java new file mode 100644 index 0000000000..e106fc6da7 --- /dev/null +++ b/core/src/main/java/io/cucumber/core/backend/CucumberInvocationTargetException.java @@ -0,0 +1,22 @@ +package io.cucumber.core.backend; + +import java.lang.reflect.InvocationTargetException; + +public class CucumberInvocationTargetException extends RuntimeException { + + private final Located located; + private final InvocationTargetException invocationTargetException; + + public CucumberInvocationTargetException(Located located, InvocationTargetException invocationTargetException) { + this.located = located; + this.invocationTargetException = invocationTargetException; + } + + public Throwable getInvocationTargetExceptionCause() { + return invocationTargetException.getCause(); + } + + public Located getLocated() { + return located; + } +} diff --git a/core/src/main/java/io/cucumber/core/backend/DataTableTypeDefinition.java b/core/src/main/java/io/cucumber/core/backend/DataTableTypeDefinition.java index 40ff965f08..2cbc299704 100644 --- a/core/src/main/java/io/cucumber/core/backend/DataTableTypeDefinition.java +++ b/core/src/main/java/io/cucumber/core/backend/DataTableTypeDefinition.java @@ -4,16 +4,7 @@ import org.apiguardian.api.API; @API(status = API.Status.STABLE) -public interface DataTableTypeDefinition { +public interface DataTableTypeDefinition extends Located { DataTableType dataTableType(); - - /** - * The source line where the data table type is defined. - * Example: com/example/app/Cucumber.test():42 - * - * @param detail true if extra detailed location information should be included. - * @return The source line of the step definition. - */ - String getLocation(boolean detail); } diff --git a/core/src/main/java/io/cucumber/core/backend/DefaultDataTableCellTransformerDefinition.java b/core/src/main/java/io/cucumber/core/backend/DefaultDataTableCellTransformerDefinition.java index 8c8ad6db91..0a84520fa0 100644 --- a/core/src/main/java/io/cucumber/core/backend/DefaultDataTableCellTransformerDefinition.java +++ b/core/src/main/java/io/cucumber/core/backend/DefaultDataTableCellTransformerDefinition.java @@ -4,17 +4,8 @@ import org.apiguardian.api.API; @API(status = API.Status.STABLE) -public interface DefaultDataTableCellTransformerDefinition { +public interface DefaultDataTableCellTransformerDefinition extends Located { TableCellByTypeTransformer tableCellByTypeTransformer(); - /** - * The source line where the default data table cell is defined. - * Example: com/example/app/Cucumber.test():42 - * - * @param detail true if extra detailed location information should be included. - * @return The source line of the step definition. - */ - String getLocation(boolean detail); - } diff --git a/core/src/main/java/io/cucumber/core/backend/DefaultDataTableEntryTransformerDefinition.java b/core/src/main/java/io/cucumber/core/backend/DefaultDataTableEntryTransformerDefinition.java index f6b9b505dd..6a0f6fb136 100644 --- a/core/src/main/java/io/cucumber/core/backend/DefaultDataTableEntryTransformerDefinition.java +++ b/core/src/main/java/io/cucumber/core/backend/DefaultDataTableEntryTransformerDefinition.java @@ -4,18 +4,10 @@ import org.apiguardian.api.API; @API(status = API.Status.STABLE) -public interface DefaultDataTableEntryTransformerDefinition { +public interface DefaultDataTableEntryTransformerDefinition extends Located { boolean headersToProperties(); TableEntryByTypeTransformer tableEntryByTypeTransformer(); - /** - * The source line where the default table entry transformer is defined. - * Example: com/example/app/Cucumber.test():42 - * - * @param detail true if extra detailed location information should be included. - * @return The source line of the step definition. - */ - String getLocation(boolean detail); } diff --git a/core/src/main/java/io/cucumber/core/backend/DefaultParameterTransformerDefinition.java b/core/src/main/java/io/cucumber/core/backend/DefaultParameterTransformerDefinition.java index 14c0103d29..f8175b9090 100644 --- a/core/src/main/java/io/cucumber/core/backend/DefaultParameterTransformerDefinition.java +++ b/core/src/main/java/io/cucumber/core/backend/DefaultParameterTransformerDefinition.java @@ -4,16 +4,7 @@ import org.apiguardian.api.API; @API(status = API.Status.STABLE) -public interface DefaultParameterTransformerDefinition { +public interface DefaultParameterTransformerDefinition extends Located{ ParameterByTypeTransformer parameterByTypeTransformer(); - - /** - * The source line where the default parameter transformer is defined. - * Example: com/example/app/Cucumber.test():42 - * - * @param detail true if extra detailed location information should be included. - * @return The source line of the step definition. - */ - String getLocation(boolean detail); } diff --git a/core/src/main/java/io/cucumber/core/backend/DocStringTypeDefinition.java b/core/src/main/java/io/cucumber/core/backend/DocStringTypeDefinition.java index 479d098c5f..0cdf36c845 100644 --- a/core/src/main/java/io/cucumber/core/backend/DocStringTypeDefinition.java +++ b/core/src/main/java/io/cucumber/core/backend/DocStringTypeDefinition.java @@ -4,16 +4,8 @@ import org.apiguardian.api.API; @API(status = API.Status.EXPERIMENTAL) -public interface DocStringTypeDefinition { +public interface DocStringTypeDefinition extends Located{ DocStringType docStringType(); - /** - * The source line where the parameter type is defined. - * Example: com/example/app/Cucumber.test():42 - * - * @param detail true if extra detailed location information should be included. - * @return The source line of the step definition. - */ - String getLocation(boolean detail); } diff --git a/core/src/main/java/io/cucumber/core/backend/HookDefinition.java b/core/src/main/java/io/cucumber/core/backend/HookDefinition.java index f61ba37551..cbdef43c80 100644 --- a/core/src/main/java/io/cucumber/core/backend/HookDefinition.java +++ b/core/src/main/java/io/cucumber/core/backend/HookDefinition.java @@ -1,20 +1,11 @@ package io.cucumber.core.backend; -import io.cucumber.core.api.Scenario; import org.apiguardian.api.API; @API(status = API.Status.STABLE) -public interface HookDefinition { - /** - * The source line where the step definition is defined. - * Example: foo/bar/Zap.brainfuck:42 - * - * @param detail true if extra detailed location information should be included. - * @return The source line where the step definition is defined. - */ - String getLocation(boolean detail); +public interface HookDefinition extends Located { - void execute(Scenario scenario) throws Throwable; + void execute(TestCaseState state); String getTagExpression(); diff --git a/core/src/main/java/io/cucumber/core/backend/Located.java b/core/src/main/java/io/cucumber/core/backend/Located.java new file mode 100644 index 0000000000..8b93912716 --- /dev/null +++ b/core/src/main/java/io/cucumber/core/backend/Located.java @@ -0,0 +1,23 @@ +package io.cucumber.core.backend; + +import org.apiguardian.api.API; + +@API(status = API.Status.STABLE) +public interface Located { + + /** + * @param stackTraceElement The location of the step. + * @return Return true if this matches the location. This is used to filter + * stack traces. + */ + boolean isDefinedAt(StackTraceElement stackTraceElement); + + /** + * The source line where the step definition is defined. + * Example: com/example/app/Cucumber.test():42 + * + * @return The source line of the step definition. + */ + String getLocation(); + +} diff --git a/core/src/main/java/io/cucumber/core/backend/ParameterInfo.java b/core/src/main/java/io/cucumber/core/backend/ParameterInfo.java index 99c734edf6..f2908f2005 100644 --- a/core/src/main/java/io/cucumber/core/backend/ParameterInfo.java +++ b/core/src/main/java/io/cucumber/core/backend/ParameterInfo.java @@ -1,12 +1,36 @@ package io.cucumber.core.backend; +import org.apiguardian.api.API; + import java.lang.reflect.Type; +@API(status = API.Status.STABLE) public interface ParameterInfo { + /** + * Returns the type of this parameter. This type is used to provide a hint + * to cucumber expressions to resolve anonymous parameter types. + *

+ * Should always return the same value as {@link TypeResolver#resolve()} + * but may not throw any exceptions. May return {@code Object.class} when no + * information is available. + * + * @return the type of this parameter. + */ Type getType(); + /** + * True if the data table should be transposed. + * + * @return true iff the data table should be transposed. + */ boolean isTransposed(); + /** + * Returns a type resolver. The type provided by this resolver is used + * to convert data table and doc string arguments to a java object. + * + * @return a type resolver + */ TypeResolver getTypeResolver(); } diff --git a/core/src/main/java/io/cucumber/core/backend/ParameterTypeDefinition.java b/core/src/main/java/io/cucumber/core/backend/ParameterTypeDefinition.java index e0956cbcb4..9165aea82b 100644 --- a/core/src/main/java/io/cucumber/core/backend/ParameterTypeDefinition.java +++ b/core/src/main/java/io/cucumber/core/backend/ParameterTypeDefinition.java @@ -4,16 +4,8 @@ import org.apiguardian.api.API; @API(status = API.Status.EXPERIMENTAL) -public interface ParameterTypeDefinition { +public interface ParameterTypeDefinition extends Located { ParameterType parameterType(); - /** - * The source line where the parameter type is defined. - * Example: com/example/app/Cucumber.test():42 - * - * @param detail true if extra detailed location information should be included. - * @return The source line of the step definition. - */ - String getLocation(boolean detail); } diff --git a/core/src/main/java/io/cucumber/core/backend/ScenarioScoped.java b/core/src/main/java/io/cucumber/core/backend/ScenarioScoped.java new file mode 100644 index 0000000000..3d0118d7a5 --- /dev/null +++ b/core/src/main/java/io/cucumber/core/backend/ScenarioScoped.java @@ -0,0 +1,12 @@ +package io.cucumber.core.backend; + +/** + * Marks a glue class as being scenario scoped. + *

+ * Instances of scenario scoped glue can not be used between scenarios and will + * be removed from the glue. This is useful when the glue holds a reference to + * a scenario scoped object (e.g. a method closure). + */ +public interface ScenarioScoped { + +} diff --git a/core/src/main/java/io/cucumber/core/snippets/Snippet.java b/core/src/main/java/io/cucumber/core/backend/Snippet.java similarity index 97% rename from core/src/main/java/io/cucumber/core/snippets/Snippet.java rename to core/src/main/java/io/cucumber/core/backend/Snippet.java index 47a70fb2b8..5223665edc 100644 --- a/core/src/main/java/io/cucumber/core/snippets/Snippet.java +++ b/core/src/main/java/io/cucumber/core/backend/Snippet.java @@ -1,4 +1,4 @@ -package io.cucumber.core.snippets; +package io.cucumber.core.backend; import org.apiguardian.api.API; diff --git a/core/src/main/java/io/cucumber/core/backend/Status.java b/core/src/main/java/io/cucumber/core/backend/Status.java new file mode 100644 index 0000000000..714d28a116 --- /dev/null +++ b/core/src/main/java/io/cucumber/core/backend/Status.java @@ -0,0 +1,14 @@ +package io.cucumber.core.backend; + +import org.apiguardian.api.API; + +@API(status = API.Status.STABLE) +public enum Status { + PASSED, + SKIPPED, + PENDING, + UNDEFINED, + AMBIGUOUS, + FAILED, + UNUSED; +} diff --git a/core/src/main/java/io/cucumber/core/backend/StepDefinition.java b/core/src/main/java/io/cucumber/core/backend/StepDefinition.java index bbeac8cba0..f69164a621 100644 --- a/core/src/main/java/io/cucumber/core/backend/StepDefinition.java +++ b/core/src/main/java/io/cucumber/core/backend/StepDefinition.java @@ -5,26 +5,26 @@ import java.util.List; @API(status = API.Status.STABLE) -public interface StepDefinition extends io.cucumber.core.event.StepDefinition { +public interface StepDefinition extends Located { + /** * Invokes the step definition. The method should raise a Throwable * if the invocation fails, which will cause the step to fail. * * @param args The arguments for the step - * @throws Throwable in case of step failure. + * @throws CucumberBackendException of a failure to invoke the step + * @throws CucumberInvocationTargetException in case of a failure in the step. */ - void execute(Object[] args) throws Throwable; + void execute(Object[] args) throws CucumberBackendException, CucumberInvocationTargetException; /** - * @param stackTraceElement The location of the step. - * @return Return true if this matches the location. This is used to filter - * stack traces. + * @return parameter information or null when the language does not provide parameter information */ - boolean isDefinedAt(StackTraceElement stackTraceElement); + List parameterInfos(); /** - * @return parameter information or null when the language does not provide parameter information + * @return the pattern associated with this instance. Used for error reporting only. */ - List parameterInfos(); + String getPattern(); } diff --git a/core/src/main/java/io/cucumber/core/api/Scenario.java b/core/src/main/java/io/cucumber/core/backend/TestCaseState.java similarity index 85% rename from core/src/main/java/io/cucumber/core/api/Scenario.java rename to core/src/main/java/io/cucumber/core/backend/TestCaseState.java index b14f03ea97..be5337a1be 100644 --- a/core/src/main/java/io/cucumber/core/api/Scenario.java +++ b/core/src/main/java/io/cucumber/core/backend/TestCaseState.java @@ -1,6 +1,5 @@ -package io.cucumber.core.api; +package io.cucumber.core.backend; -import io.cucumber.core.event.Status; import org.apiguardian.api.API; import java.util.Collection; @@ -10,11 +9,11 @@ * It allows writing text and embedding media into reports, as well as inspecting results (in an After block). *

* Note: This class is not intended to be used to create reports. To create custom reports use - * the {@code io.cucumber.core.plugin.Plugin} class. The plugin system provides a much richer access to Cucumbers then + * the {@code io.cucumber.plugin.Plugin} class. The plugin system provides a much richer access to Cucumbers then * hooks after could provide. For an example see {@code io.cucumber.core.plugin.PrettyFormatter}. */ @API(status = API.Status.STABLE) -public interface Scenario { +public interface TestCaseState { /** * @return source_tag_names. */ @@ -44,13 +43,13 @@ public interface Scenario { * * @param data what to embed, for example an image. * @param mimeType what is the data? - * @deprecated use {@link Scenario#embed(byte[], String, String)} instead. + * @deprecated use {@link TestCaseState#embed(byte[], String, String)} instead. */ @Deprecated void embed(byte[] data, String mimeType); /** - * Like {@link Scenario#embed(byte[], String)}, but with name for the embedding. + * Like {@link TestCaseState#embed(byte[], String)}, but with name for the embedding. * * @param data what to embed, for example an image. * @param mimeType what is the data? @@ -86,4 +85,5 @@ public interface Scenario { * the Scenario Outline. */ Integer getLine(); + } diff --git a/core/src/main/java/io/cucumber/core/backend/TypeResolver.java b/core/src/main/java/io/cucumber/core/backend/TypeResolver.java index 5e3199a6eb..f2b7293e11 100644 --- a/core/src/main/java/io/cucumber/core/backend/TypeResolver.java +++ b/core/src/main/java/io/cucumber/core/backend/TypeResolver.java @@ -5,18 +5,25 @@ import java.lang.reflect.Type; /** - * Allows lazy resolution of the type of a data table or doc string. + * Allows lazy resolution and validation of the type of a data table or + * doc string argument. */ @API(status = API.Status.STABLE) public interface TypeResolver { /** - * A type to data convert the table or doc string to. May not return null. + * A type to convert the data table or doc string to. *

- * When the {@link Object} type is returned no transform will be applied. + * May throw an exception when the type could not adequately be determined + * for instance due to a lack of generic information. If a value is return + * it must be the same as {@link ParameterInfo#getType()} + *

+ * When the {@link Object} type is returned no transform will be applied to + * the data table or doc string. * * @return a type + * @throws RuntimeException when the type could not adequately be determined */ - Type resolve(); + Type resolve() throws RuntimeException; } diff --git a/core/src/main/java/io/cucumber/core/cli/Main.java b/core/src/main/java/io/cucumber/core/cli/Main.java index 2311713bee..f4cba915ac 100644 --- a/core/src/main/java/io/cucumber/core/cli/Main.java +++ b/core/src/main/java/io/cucumber/core/cli/Main.java @@ -23,7 +23,7 @@ @API(status = API.Status.STABLE) public class Main { - public static void main(String[] argv) { + public static void main(String... argv) { byte exitStatus = run(argv, Thread.currentThread().getContextClassLoader()); System.exit(exitStatus); } @@ -50,6 +50,8 @@ public static byte run(String[] argv, ClassLoader classLoader) { RuntimeOptions runtimeOptions = new CommandlineOptionsParser() .parse(argv) + .addDefaultFormatterIfNotPresent() + .addDefaultSummaryPrinterIfNotPresent() .build(systemOptions); diff --git a/core/src/main/java/io/cucumber/core/event/StepDefinition.java b/core/src/main/java/io/cucumber/core/event/StepDefinition.java deleted file mode 100644 index 3f6353a619..0000000000 --- a/core/src/main/java/io/cucumber/core/event/StepDefinition.java +++ /dev/null @@ -1,22 +0,0 @@ -package io.cucumber.core.event; - - -import org.apiguardian.api.API; - -@API(status = API.Status.STABLE) -public interface StepDefinition { - - /** - * The source line where the step definition is defined. - * Example: com/example/app/Cucumber.test():42 - * - * @param detail true if extra detailed location information should be included. - * @return The source line of the step definition. - */ - String getLocation(boolean detail); - - /** - * @return the pattern associated with this instance. Used for error reporting only. - */ - String getPattern(); -} diff --git a/core/src/main/java/io/cucumber/core/eventbus/AbstractEventBus.java b/core/src/main/java/io/cucumber/core/eventbus/AbstractEventBus.java index c231ec72a4..50d5c4dd46 100644 --- a/core/src/main/java/io/cucumber/core/eventbus/AbstractEventBus.java +++ b/core/src/main/java/io/cucumber/core/eventbus/AbstractEventBus.java @@ -1,6 +1,6 @@ package io.cucumber.core.eventbus; -import io.cucumber.core.event.Event; +import io.cucumber.plugin.event.Event; public abstract class AbstractEventBus extends AbstractEventPublisher implements EventBus { diff --git a/core/src/main/java/io/cucumber/core/eventbus/AbstractEventPublisher.java b/core/src/main/java/io/cucumber/core/eventbus/AbstractEventPublisher.java index 0b626f0bb5..b280773dcc 100644 --- a/core/src/main/java/io/cucumber/core/eventbus/AbstractEventPublisher.java +++ b/core/src/main/java/io/cucumber/core/eventbus/AbstractEventPublisher.java @@ -1,8 +1,8 @@ package io.cucumber.core.eventbus; -import io.cucumber.core.event.Event; -import io.cucumber.core.event.EventHandler; -import io.cucumber.core.event.EventPublisher; +import io.cucumber.plugin.event.Event; +import io.cucumber.plugin.event.EventHandler; +import io.cucumber.plugin.event.EventPublisher; import java.util.ArrayList; import java.util.HashMap; diff --git a/core/src/main/java/io/cucumber/core/eventbus/EventBus.java b/core/src/main/java/io/cucumber/core/eventbus/EventBus.java index c16bf48169..8b70931fb9 100644 --- a/core/src/main/java/io/cucumber/core/eventbus/EventBus.java +++ b/core/src/main/java/io/cucumber/core/eventbus/EventBus.java @@ -2,8 +2,8 @@ import java.time.Instant; -import io.cucumber.core.event.Event; -import io.cucumber.core.event.EventPublisher; +import io.cucumber.plugin.event.Event; +import io.cucumber.plugin.event.EventPublisher; public interface EventBus extends EventPublisher { diff --git a/core/src/main/java/io/cucumber/core/feature/Argument.java b/core/src/main/java/io/cucumber/core/feature/Argument.java index c5871f5a43..d61c9b864b 100644 --- a/core/src/main/java/io/cucumber/core/feature/Argument.java +++ b/core/src/main/java/io/cucumber/core/feature/Argument.java @@ -1,5 +1,7 @@ package io.cucumber.core.feature; -public interface Argument extends io.cucumber.core.event.StepArgument { +import io.cucumber.plugin.event.StepArgument; + +public interface Argument extends StepArgument { } diff --git a/core/src/main/java/io/cucumber/core/feature/CucumberStep.java b/core/src/main/java/io/cucumber/core/feature/CucumberStep.java index 3fd6426f2a..2ea26c3224 100644 --- a/core/src/main/java/io/cucumber/core/feature/CucumberStep.java +++ b/core/src/main/java/io/cucumber/core/feature/CucumberStep.java @@ -6,7 +6,7 @@ import gherkin.pickles.PickleString; import gherkin.pickles.PickleTable; -public final class CucumberStep implements io.cucumber.core.event.CucumberStep { +public final class CucumberStep implements io.cucumber.plugin.event.CucumberStep { private final PickleStep pickleStep; private final String keyWord; diff --git a/core/src/main/java/io/cucumber/core/feature/DataTableArgument.java b/core/src/main/java/io/cucumber/core/feature/DataTableArgument.java index 9fb0cb6ea3..5584f2aead 100644 --- a/core/src/main/java/io/cucumber/core/feature/DataTableArgument.java +++ b/core/src/main/java/io/cucumber/core/feature/DataTableArgument.java @@ -5,7 +5,7 @@ import java.util.AbstractList; import java.util.List; -public final class DataTableArgument implements Argument, io.cucumber.core.event.DataTableArgument { +public final class DataTableArgument implements Argument, io.cucumber.plugin.event.DataTableArgument { private final CellView cells; private final int line; diff --git a/core/src/main/java/io/cucumber/core/feature/DocStringArgument.java b/core/src/main/java/io/cucumber/core/feature/DocStringArgument.java index 10b2dc9c2f..64e85386ad 100644 --- a/core/src/main/java/io/cucumber/core/feature/DocStringArgument.java +++ b/core/src/main/java/io/cucumber/core/feature/DocStringArgument.java @@ -2,7 +2,7 @@ import gherkin.pickles.PickleString; -public final class DocStringArgument implements Argument, io.cucumber.core.event.DocStringArgument { +public final class DocStringArgument implements Argument, io.cucumber.plugin.event.DocStringArgument { private final PickleString docString; diff --git a/core/src/main/java/io/cucumber/core/options/Constants.java b/core/src/main/java/io/cucumber/core/options/Constants.java index 708dcf823b..845c5d159e 100644 --- a/core/src/main/java/io/cucumber/core/options/Constants.java +++ b/core/src/main/java/io/cucumber/core/options/Constants.java @@ -1,5 +1,7 @@ package io.cucumber.core.options; +import io.cucumber.core.runtime.ObjectFactoryServiceLoader; + public final class Constants { /** @@ -42,14 +44,6 @@ public final class Constants { */ public static final String EXECUTION_ORDER_PROPERTY_NAME = "cucumber.execution.order"; - /** - * Property name used to determine the desired parallelism for the - * {@link Runtime} configuration: {@value} - *

- * No default value; must be an integer. - */ - public static final String EXECUTION_PARALLEL_CONFIG_FIXED_PARALLELISM_PROPERTY_NAME = "cucumber.execution.parallel.config.fixed.parallelism"; - /** * Property name used to enable strict execution: {@value} *

@@ -93,17 +87,6 @@ public final class Constants { */ public static final String FEATURES_PROPERTY_NAME = "cucumber.features"; - /** - * Property name to set a file from which feature locations will be read: {@value} - *

- * Feature paths must be separated by a new line. The feature path is - * a uri or path e.g.: {@code path/to/feature/dir}. - * - * @see io.cucumber.core.feature.FeatureWithLines - * @see #FEATURES_PROPERTY_NAME - */ - public static final String RERUN_FILE_PROPERTY_NAME = "cucumber.rerun-file"; - /** * Property name used to set name filter: {@value} *

@@ -136,7 +119,7 @@ public final class Constants { * Property name used to select a specific object factory implementation: * {@value} * - * @see io.cucumber.core.backend.ObjectFactoryServiceLoader + * @see ObjectFactoryServiceLoader */ public static final String OBJECT_FACTORY_PROPERTY_NAME = "cucumber.object-factory"; diff --git a/core/src/main/java/io/cucumber/core/options/CucumberPropertiesParser.java b/core/src/main/java/io/cucumber/core/options/CucumberPropertiesParser.java index e0299eec33..fcf4f59a6d 100644 --- a/core/src/main/java/io/cucumber/core/options/CucumberPropertiesParser.java +++ b/core/src/main/java/io/cucumber/core/options/CucumberPropertiesParser.java @@ -13,12 +13,12 @@ import java.util.function.Consumer; import java.util.function.Function; import java.util.regex.Pattern; +import java.util.stream.Stream; import static io.cucumber.core.options.Constants.ANSI_COLORS_DISABLED_PROPERTY_NAME; import static io.cucumber.core.options.Constants.EXECUTION_DRY_RUN_PROPERTY_NAME; import static io.cucumber.core.options.Constants.EXECUTION_LIMIT_PROPERTY_NAME; import static io.cucumber.core.options.Constants.EXECUTION_ORDER_PROPERTY_NAME; -import static io.cucumber.core.options.Constants.EXECUTION_PARALLEL_CONFIG_FIXED_PARALLELISM_PROPERTY_NAME; import static io.cucumber.core.options.Constants.EXECUTION_STRICT_PROPERTY_NAME; import static io.cucumber.core.options.Constants.FEATURES_PROPERTY_NAME; import static io.cucumber.core.options.Constants.FILTER_NAME_PROPERTY_NAME; @@ -27,7 +27,6 @@ import static io.cucumber.core.options.Constants.OBJECT_FACTORY_PROPERTY_NAME; import static io.cucumber.core.options.Constants.OPTIONS_PROPERTY_NAME; import static io.cucumber.core.options.Constants.PLUGIN_PROPERTY_NAME; -import static io.cucumber.core.options.Constants.RERUN_FILE_PROPERTY_NAME; import static io.cucumber.core.options.Constants.SNIPPET_TYPE_PROPERTY_NAME; import static io.cucumber.core.options.Constants.WIP_PROPERTY_NAME; import static io.cucumber.core.options.OptionsFileParser.parseFeatureWithLinesFile; @@ -36,7 +35,7 @@ public final class CucumberPropertiesParser { - private static Function> splitAndThen(Function parse) { + private static Function> splitAndMap(Function parse) { return combined -> stream(combined.split(",")) .map(String::trim) .filter(part -> !part.isEmpty()) @@ -44,6 +43,14 @@ private static Function> splitAndThen(Function Function> splitAndThenFlatMap(Function> parse) { + return combined -> stream(combined.split(",")) + .map(String::trim) + .filter(part -> !part.isEmpty()) + .flatMap(parse) + .collect(toList()); + } + public RuntimeOptionsBuilder parse(Map properties) { final RuntimeOptionsBuilder builder; String cucumberOptions = properties.get(OPTIONS_PROPERTY_NAME); @@ -77,12 +84,6 @@ public RuntimeOptionsBuilder parse(Map properties) { builder::setPickleOrder ); - parse(properties, - EXECUTION_PARALLEL_CONFIG_FIXED_PARALLELISM_PROPERTY_NAME, - Integer::parseInt, - builder::setThreads - ); - parse(properties, EXECUTION_STRICT_PROPERTY_NAME, Boolean::parseBoolean, @@ -91,13 +92,7 @@ public RuntimeOptionsBuilder parse(Map properties) { parseAll(properties, FEATURES_PROPERTY_NAME, - splitAndThen(FeatureWithLines::parse), - builder::addFeature - ); - - parseAll(properties, - RERUN_FILE_PROPERTY_NAME, - property -> parseRerunFile(builder, property), + splitAndThenFlatMap(s -> parseFeatureOrRerunFile(builder, s)), builder::addFeature ); @@ -115,7 +110,7 @@ public RuntimeOptionsBuilder parse(Map properties) { parseAll(properties, GLUE_PROPERTY_NAME, - splitAndThen(GluePath::parse), + splitAndMap(GluePath::parse), builder::addGlue ); @@ -127,7 +122,7 @@ public RuntimeOptionsBuilder parse(Map properties) { parseAll(properties, PLUGIN_PROPERTY_NAME, - splitAndThen(Function.identity()), + splitAndMap(Function.identity()), plugin -> builder.addPluginName(plugin, true) ); @@ -145,6 +140,13 @@ public RuntimeOptionsBuilder parse(Map properties) { return builder; } + private Stream parseFeatureOrRerunFile(RuntimeOptionsBuilder builder, String property) { + if(property.startsWith("@")){ + return parseRerunFile(builder, property.substring(1)).stream(); + } + return Stream.of(FeatureWithLines.parse(property)); + } + private Collection parseRerunFile(RuntimeOptionsBuilder builder, String property) { builder.setIsRerun(true); Path rerunFile = Paths.get(property); diff --git a/core/src/main/java/io/cucumber/core/options/PluginOption.java b/core/src/main/java/io/cucumber/core/options/PluginOption.java index 6016f167f8..40742d19cc 100644 --- a/core/src/main/java/io/cucumber/core/options/PluginOption.java +++ b/core/src/main/java/io/cucumber/core/options/PluginOption.java @@ -1,9 +1,9 @@ package io.cucumber.core.options; -import io.cucumber.core.plugin.Plugin; -import io.cucumber.core.plugin.SummaryPrinter; -import io.cucumber.core.plugin.ConcurrentEventListener; -import io.cucumber.core.plugin.EventListener; +import io.cucumber.plugin.Plugin; +import io.cucumber.plugin.SummaryPrinter; +import io.cucumber.plugin.ConcurrentEventListener; +import io.cucumber.plugin.EventListener; import io.cucumber.core.exception.CucumberException; import io.cucumber.core.logging.Logger; import io.cucumber.core.logging.LoggerFactory; diff --git a/core/src/main/java/io/cucumber/core/options/RuntimeOptionsParser.java b/core/src/main/java/io/cucumber/core/options/RuntimeOptionsParser.java index d70446e452..a18e72d60c 100644 --- a/core/src/main/java/io/cucumber/core/options/RuntimeOptionsParser.java +++ b/core/src/main/java/io/cucumber/core/options/RuntimeOptionsParser.java @@ -17,6 +17,7 @@ import java.util.ArrayList; import java.util.List; import java.util.ResourceBundle; +import java.util.function.Function; import java.util.regex.Pattern; import java.util.stream.Collectors; @@ -57,10 +58,22 @@ private static int printI18n(String language) { List languages = dialectProvider.getLanguages(); if (language.equalsIgnoreCase("help")) { - for (String code : languages) { - System.out.println(code); + if (language.equalsIgnoreCase("help")) { + List dialects = new ArrayList<>(); + for (String code : languages) { + GherkinDialect dialect = dialectProvider.getDialect(code, null); + dialects.add(dialect); + } + + int widestLanguage = findWidest(dialects, GherkinDialect::getLanguage); + int widestName = findWidest(dialects, GherkinDialect::getName); + int widestNativeName = findWidest(dialects, GherkinDialect::getNativeName); + + for (GherkinDialect dialect : dialects) { + printDialect(dialect, widestLanguage, widestName, widestNativeName); + } + return 0; } - return 0; } if (languages.contains(language)) { return printKeywordsFor(dialectProvider.getDialect(language, null)); @@ -70,6 +83,14 @@ private static int printI18n(String language) { return 1; } + private static int findWidest(List dialects, Function getNativeName) { + return dialects.stream() + .map(getNativeName) + .mapToInt(String::length) + .max() + .orElse(0); + } + private static int printKeywordsFor(GherkinDialect dialect) { StringBuilder builder = new StringBuilder(); List> table = new ArrayList<>(); @@ -108,6 +129,21 @@ private static void addKeywordRow(List> table, String key, List '"' + o + '"').collect(joining(", ")))); } + private static void printDialect(GherkinDialect dialect, int widestLanguage, int widestName, int widestNativeName) { + String langCode = rightPad(dialect.getLanguage(), widestLanguage); + String name = rightPad(dialect.getName(), widestName); + String nativeName = rightPad(dialect.getNativeName(), widestNativeName); + + System.out.println(langCode + name + nativeName); + } + + private static String rightPad(String text, int maxWidth) { + int padding = 7; + int width = maxWidth + padding; + + return String.format("%" + -width + "s", text); + } + RuntimeOptionsBuilder parse(List args) { args = new ArrayList<>(args); RuntimeOptionsBuilder parsedOptions = new RuntimeOptionsBuilder(); @@ -122,22 +158,22 @@ RuntimeOptionsBuilder parse(List args) { System.out.println(VERSION); System.exit(0); } else if (arg.equals("--i18n")) { - String nextArg = args.remove(0); + String nextArg = removeArgFor(arg, args); System.exit(printI18n(nextArg)); } else if (arg.equals("--threads")) { - int threads = Integer.parseInt(args.remove(0)); + int threads = Integer.parseInt(removeArgFor(arg, args)); if (threads < 1) { throw new CucumberException("--threads must be > 0"); } parsedOptions.setThreads(threads); } else if (arg.equals("--glue") || arg.equals("-g")) { - String gluePath = args.remove(0); + String gluePath = removeArgFor(arg, args); URI parse = GluePath.parse(gluePath); parsedOptions.addGlue(parse); } else if (arg.equals("--tags") || arg.equals("-t")) { - parsedOptions.addTagFilter(args.remove(0)); + parsedOptions.addTagFilter(removeArgFor(arg, args)); } else if (arg.equals("--plugin") || arg.equals("--add-plugin") || arg.equals("-p")) { - parsedOptions.addPluginName(args.remove(0), arg.equals("--add-plugin")); + parsedOptions.addPluginName(removeArgFor(arg, args), arg.equals("--add-plugin")); } else if (arg.equals("--no-dry-run") || arg.equals("--dry-run") || arg.equals("-d")) { parsedOptions.setDryRun(!arg.startsWith("--no-")); } else if (arg.equals("--no-strict") || arg.equals("--strict") || arg.equals("-s")) { @@ -145,24 +181,24 @@ RuntimeOptionsBuilder parse(List args) { } else if (arg.equals("--no-monochrome") || arg.equals("--monochrome") || arg.equals("-m")) { parsedOptions.setMonochrome(!arg.startsWith("--no-")); } else if (arg.equals("--snippets")) { - String nextArg = args.remove(0); + String nextArg = removeArgFor(arg, args); parsedOptions.setSnippetType(SnippetTypeParser.parseSnippetType(nextArg)); } else if (arg.equals("--name") || arg.equals("-n")) { - String nextArg = args.remove(0); + String nextArg = removeArgFor(arg, args); Pattern pattern = Pattern.compile(nextArg); parsedOptions.addNameFilter(pattern); } else if (arg.equals("--wip") || arg.equals("-w")) { parsedOptions.setWip(true); } else if (arg.equals("--order")) { - parsedOptions.setPickleOrder(PickleOrderParser.parse(args.remove(0))); + parsedOptions.setPickleOrder(PickleOrderParser.parse(removeArgFor(arg, args))); } else if (arg.equals("--count")) { - int count = Integer.parseInt(args.remove(0)); + int count = Integer.parseInt(removeArgFor(arg, args)); if (count < 1) { throw new CucumberException("--count must be > 0"); } parsedOptions.setCount(count); } else if (arg.equals("--object-factory")) { - String objectFactoryClassName = args.remove(0); + String objectFactoryClassName = removeArgFor(arg, args); parsedOptions.setObjectFactoryClass(parseObjectFactory(objectFactoryClassName)); } else if (arg.startsWith("-")) { printUsage(); @@ -181,4 +217,12 @@ RuntimeOptionsBuilder parse(List args) { return parsedOptions; } + private String removeArgFor(String arg, List args) { + if (!args.isEmpty()) { + return args.remove(0); + } + printUsage(); + throw new CucumberException("Missing argument for " + arg); + } + } diff --git a/core/src/main/java/io/cucumber/core/plugin/CanonicalEventOrder.java b/core/src/main/java/io/cucumber/core/plugin/CanonicalEventOrder.java index dd78fe5858..d8a49f51cc 100644 --- a/core/src/main/java/io/cucumber/core/plugin/CanonicalEventOrder.java +++ b/core/src/main/java/io/cucumber/core/plugin/CanonicalEventOrder.java @@ -1,12 +1,12 @@ package io.cucumber.core.plugin; -import io.cucumber.core.event.Event; -import io.cucumber.core.event.SnippetsSuggestedEvent; -import io.cucumber.core.event.StepDefinedEvent; -import io.cucumber.core.event.TestCaseEvent; -import io.cucumber.core.event.TestRunFinished; -import io.cucumber.core.event.TestRunStarted; -import io.cucumber.core.event.TestSourceRead; +import io.cucumber.plugin.event.Event; +import io.cucumber.plugin.event.SnippetsSuggestedEvent; +import io.cucumber.plugin.event.StepDefinedEvent; +import io.cucumber.plugin.event.TestCaseEvent; +import io.cucumber.plugin.event.TestRunFinished; +import io.cucumber.plugin.event.TestRunStarted; +import io.cucumber.plugin.event.TestSourceRead; import java.util.Comparator; import java.util.List; diff --git a/core/src/main/java/io/cucumber/core/plugin/CanonicalOrderEventPublisher.java b/core/src/main/java/io/cucumber/core/plugin/CanonicalOrderEventPublisher.java index 8562b027d5..1652043fd1 100644 --- a/core/src/main/java/io/cucumber/core/plugin/CanonicalOrderEventPublisher.java +++ b/core/src/main/java/io/cucumber/core/plugin/CanonicalOrderEventPublisher.java @@ -1,7 +1,7 @@ package io.cucumber.core.plugin; -import io.cucumber.core.event.Event; -import io.cucumber.core.event.TestRunFinished; +import io.cucumber.plugin.event.Event; +import io.cucumber.plugin.event.TestRunFinished; import io.cucumber.core.eventbus.AbstractEventPublisher; import java.util.LinkedList; diff --git a/core/src/main/java/io/cucumber/core/plugin/DefaultSummaryPrinter.java b/core/src/main/java/io/cucumber/core/plugin/DefaultSummaryPrinter.java index 090639bb80..b8183e37d4 100644 --- a/core/src/main/java/io/cucumber/core/plugin/DefaultSummaryPrinter.java +++ b/core/src/main/java/io/cucumber/core/plugin/DefaultSummaryPrinter.java @@ -1,8 +1,12 @@ package io.cucumber.core.plugin; -import io.cucumber.core.event.EventPublisher; -import io.cucumber.core.event.SnippetsSuggestedEvent; -import io.cucumber.core.event.TestRunFinished; +import io.cucumber.plugin.event.EventPublisher; +import io.cucumber.plugin.event.SnippetsSuggestedEvent; +import io.cucumber.plugin.event.TestRunFinished; +import io.cucumber.plugin.ColorAware; +import io.cucumber.plugin.ConcurrentEventListener; +import io.cucumber.plugin.StrictAware; +import io.cucumber.plugin.SummaryPrinter; import java.io.PrintStream; import java.util.ArrayList; diff --git a/core/src/main/java/io/cucumber/core/plugin/HTMLFormatter.java b/core/src/main/java/io/cucumber/core/plugin/HTMLFormatter.java index e276124bfc..9a964e0f2e 100644 --- a/core/src/main/java/io/cucumber/core/plugin/HTMLFormatter.java +++ b/core/src/main/java/io/cucumber/core/plugin/HTMLFormatter.java @@ -14,23 +14,24 @@ import gherkin.ast.Tag; import gherkin.deps.com.google.gson.Gson; import gherkin.deps.com.google.gson.GsonBuilder; -import io.cucumber.core.event.DataTableArgument; -import io.cucumber.core.event.DocStringArgument; -import io.cucumber.core.event.EmbedEvent; -import io.cucumber.core.event.EventPublisher; -import io.cucumber.core.event.HookTestStep; -import io.cucumber.core.event.HookType; -import io.cucumber.core.event.PickleStepTestStep; -import io.cucumber.core.event.Result; -import io.cucumber.core.event.StepArgument; -import io.cucumber.core.event.TestCase; -import io.cucumber.core.event.TestCaseStarted; -import io.cucumber.core.event.TestRunFinished; -import io.cucumber.core.event.TestSourceRead; -import io.cucumber.core.event.TestStepFinished; -import io.cucumber.core.event.TestStepStarted; -import io.cucumber.core.event.WriteEvent; +import io.cucumber.plugin.event.DataTableArgument; +import io.cucumber.plugin.event.DocStringArgument; +import io.cucumber.plugin.event.EmbedEvent; +import io.cucumber.plugin.event.EventPublisher; +import io.cucumber.plugin.event.HookTestStep; +import io.cucumber.plugin.event.HookType; +import io.cucumber.plugin.event.PickleStepTestStep; +import io.cucumber.plugin.event.Result; +import io.cucumber.plugin.event.StepArgument; +import io.cucumber.plugin.event.TestCase; +import io.cucumber.plugin.event.TestCaseStarted; +import io.cucumber.plugin.event.TestRunFinished; +import io.cucumber.plugin.event.TestSourceRead; +import io.cucumber.plugin.event.TestStepFinished; +import io.cucumber.plugin.event.TestStepStarted; +import io.cucumber.plugin.event.WriteEvent; import io.cucumber.core.exception.CucumberException; +import io.cucumber.plugin.EventListener; import java.io.Closeable; import java.io.File; diff --git a/core/src/main/java/io/cucumber/core/plugin/JSONFormatter.java b/core/src/main/java/io/cucumber/core/plugin/JSONFormatter.java index c1de2f46d5..a9da6cd31d 100644 --- a/core/src/main/java/io/cucumber/core/plugin/JSONFormatter.java +++ b/core/src/main/java/io/cucumber/core/plugin/JSONFormatter.java @@ -6,25 +6,26 @@ import gherkin.ast.Step; import gherkin.deps.com.google.gson.Gson; import gherkin.deps.com.google.gson.GsonBuilder; -import gherkin.deps.net.iharder.Base64; -import io.cucumber.core.event.DataTableArgument; -import io.cucumber.core.event.DocStringArgument; -import io.cucumber.core.event.EmbedEvent; -import io.cucumber.core.event.EventPublisher; -import io.cucumber.core.event.HookTestStep; -import io.cucumber.core.event.HookType; -import io.cucumber.core.event.PickleStepTestStep; -import io.cucumber.core.event.Result; -import io.cucumber.core.event.Status; -import io.cucumber.core.event.StepArgument; -import io.cucumber.core.event.TestCase; -import io.cucumber.core.event.TestCaseStarted; -import io.cucumber.core.event.TestRunFinished; -import io.cucumber.core.event.TestSourceRead; -import io.cucumber.core.event.TestStep; -import io.cucumber.core.event.TestStepFinished; -import io.cucumber.core.event.TestStepStarted; -import io.cucumber.core.event.WriteEvent; +import io.cucumber.plugin.event.DataTableArgument; +import io.cucumber.plugin.event.Argument; +import io.cucumber.plugin.event.DocStringArgument; +import io.cucumber.plugin.event.EmbedEvent; +import io.cucumber.plugin.event.EventPublisher; +import io.cucumber.plugin.event.HookTestStep; +import io.cucumber.plugin.event.HookType; +import io.cucumber.plugin.event.PickleStepTestStep; +import io.cucumber.plugin.event.Result; +import io.cucumber.plugin.event.Status; +import io.cucumber.plugin.event.StepArgument; +import io.cucumber.plugin.event.TestCase; +import io.cucumber.plugin.event.TestCaseStarted; +import io.cucumber.plugin.event.TestRunFinished; +import io.cucumber.plugin.event.TestSourceRead; +import io.cucumber.plugin.event.TestStep; +import io.cucumber.plugin.event.TestStepFinished; +import io.cucumber.plugin.event.TestStepStarted; +import io.cucumber.plugin.event.WriteEvent; +import io.cucumber.plugin.EventListener; import java.io.PrintWriter; import java.io.StringWriter; @@ -32,6 +33,7 @@ import java.time.ZoneOffset; import java.time.format.DateTimeFormatter; import java.util.ArrayList; +import java.util.Base64; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -299,7 +301,7 @@ private void addEmbeddingToHookMap(byte[] data, String mimeType, String name) { private Map createEmbeddingMap(byte[] data, String mimeType, String name) { Map embedMap = new HashMap<>(); embedMap.put("mime_type", mimeType); - embedMap.put("data", Base64.encodeBytes(data)); + embedMap.put("data", Base64.getEncoder().encodeToString(data)); if (name != null) { embedMap.put("name", name); } @@ -312,7 +314,7 @@ private Map createMatchMap(TestStep step, Result result) { PickleStepTestStep testStep = (PickleStepTestStep) step; if (!testStep.getDefinitionArgument().isEmpty()) { List> argumentList = new ArrayList<>(); - for (io.cucumber.core.event.Argument argument : testStep.getDefinitionArgument()) { + for (Argument argument : testStep.getDefinitionArgument()) { Map argumentMap = new HashMap<>(); if (argument.getValue() != null) { argumentMap.put("val", argument.getValue()); diff --git a/core/src/main/java/io/cucumber/core/plugin/JUnitFormatter.java b/core/src/main/java/io/cucumber/core/plugin/JUnitFormatter.java index a9242e1bca..fe31e64645 100644 --- a/core/src/main/java/io/cucumber/core/plugin/JUnitFormatter.java +++ b/core/src/main/java/io/cucumber/core/plugin/JUnitFormatter.java @@ -1,20 +1,20 @@ package io.cucumber.core.plugin; -import io.cucumber.core.event.PickleStepTestStep; -import io.cucumber.core.event.EventHandler; -import io.cucumber.core.event.EventPublisher; -import io.cucumber.core.event.Result; -import io.cucumber.core.event.Status; -import io.cucumber.core.event.TestCaseFinished; -import io.cucumber.core.event.TestCaseStarted; -import io.cucumber.core.event.TestRunFinished; -import io.cucumber.core.event.TestSourceRead; -import io.cucumber.core.event.TestStepFinished; import io.cucumber.core.exception.CucumberException; - +import io.cucumber.plugin.EventListener; +import io.cucumber.plugin.StrictAware; +import io.cucumber.plugin.event.EventPublisher; +import io.cucumber.plugin.event.PickleStepTestStep; +import io.cucumber.plugin.event.Result; +import io.cucumber.plugin.event.Status; +import io.cucumber.plugin.event.TestCaseFinished; +import io.cucumber.plugin.event.TestCaseStarted; +import io.cucumber.plugin.event.TestRunFinished; +import io.cucumber.plugin.event.TestRunStarted; +import io.cucumber.plugin.event.TestSourceRead; +import io.cucumber.plugin.event.TestStepFinished; import org.w3c.dom.Document; import org.w3c.dom.Element; -import org.w3c.dom.NodeList; import javax.xml.XMLConstants; import javax.xml.parsers.DocumentBuilderFactory; @@ -25,10 +25,6 @@ import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; - -import static java.util.Locale.ROOT; -import static java.util.concurrent.TimeUnit.SECONDS; - import java.io.Closeable; import java.io.IOException; import java.io.PrintWriter; @@ -37,13 +33,18 @@ import java.net.URL; import java.text.DecimalFormat; import java.text.NumberFormat; +import java.time.Duration; +import java.time.Instant; import java.util.ArrayList; import java.util.List; import java.util.Locale; +import static java.util.Locale.ROOT; +import static java.util.concurrent.TimeUnit.SECONDS; + public final class JUnitFormatter implements EventListener, StrictAware { - private static final long NANOS_PER_SECONDS = SECONDS.toNanos(1L); + private static final long MILLIS_PER_SECOND = SECONDS.toMillis(1L); private final Writer writer; private final Document document; private final Element rootElement; @@ -54,6 +55,7 @@ public final class JUnitFormatter implements EventListener, StrictAware { private String currentFeatureFile = null; private String previousTestCaseName; private int exampleNumber; + private Instant started; @SuppressWarnings("WeakerAccess") // Used by plugin factory public JUnitFormatter(URL writer) throws IOException { @@ -71,13 +73,24 @@ private static String getUniqueTestNameForScenarioExample(String testCaseName, i return testCaseName + (testCaseName.contains(" ") ? " " : "_") + exampleNumber; } + private static String calculateTotalDurationString(Duration result) { + DecimalFormat numberFormat = (DecimalFormat) NumberFormat.getNumberInstance(Locale.US); + double duration = (double) result.toMillis() / MILLIS_PER_SECOND; + return numberFormat.format(duration); + } + @Override public void setEventPublisher(EventPublisher publisher) { + publisher.registerHandlerFor(TestRunStarted.class, this::handleTestRunStarted); publisher.registerHandlerFor(TestSourceRead.class, this::handleTestSourceRead); publisher.registerHandlerFor(TestCaseStarted.class, this::handleTestCaseStarted); publisher.registerHandlerFor(TestCaseFinished.class, this::handleTestCaseFinished); publisher.registerHandlerFor(TestStepFinished.class, this::handleTestStepFinished); - publisher.registerHandlerFor(TestRunFinished.class, event -> finishReport()); + publisher.registerHandlerFor(TestRunFinished.class, this::handleTestRunFinished); + } + + private void handleTestRunStarted(TestRunStarted event) { + this.started = event.getInstant(); } @Override @@ -100,7 +113,7 @@ private void handleTestCaseStarted(TestCaseStarted event) { testCase.writeElement(root); rootElement.appendChild(root); - increaseAttributeValue(rootElement, "tests"); + increaseTestCount(rootElement); } private void handleTestStepFinished(TestStepFinished event) { @@ -118,13 +131,15 @@ private void handleTestCaseFinished(TestCaseFinished event) { } } - private void finishReport() { + private void handleTestRunFinished(TestRunFinished event) { try { + Instant finished = event.getInstant(); // set up a transformer rootElement.setAttribute("name", JUnitFormatter.class.getName()); rootElement.setAttribute("failures", String.valueOf(rootElement.getElementsByTagName("failure").getLength())); rootElement.setAttribute("skipped", String.valueOf(rootElement.getElementsByTagName("skipped").getLength())); - rootElement.setAttribute("time", getTotalDuration(rootElement.getElementsByTagName("testcase"))); + rootElement.setAttribute("errors", "0"); + rootElement.setAttribute("time", calculateTotalDurationString(Duration.between(started, finished))); TransformerFactory factory = TransformerFactory.newInstance(); factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); @@ -147,37 +162,21 @@ private void closeQuietly(Closeable out) { } } - private String getTotalDuration(NodeList testCaseNodes) { - double totalDurationSecondsForAllTimes = 0.0d; - for (int i = 0; i < testCaseNodes.getLength(); i++) { - try { - double testCaseTime = - Double.parseDouble(testCaseNodes.item(i).getAttributes().getNamedItem("time").getNodeValue()); - totalDurationSecondsForAllTimes += testCaseTime; - } catch (NumberFormatException | NullPointerException e) { - throw new CucumberException(e); - } - } - DecimalFormat nfmt = (DecimalFormat) NumberFormat.getNumberInstance(Locale.US); - nfmt.applyPattern("0.######"); - return nfmt.format(totalDurationSecondsForAllTimes); - } - - private void increaseAttributeValue(Element element, String attribute) { + private void increaseTestCount(Element element) { int value = 0; - if (element.hasAttribute(attribute)) { - value = Integer.parseInt(element.getAttribute(attribute)); + if (element.hasAttribute("tests")) { + value = Integer.parseInt(element.getAttribute("tests")); } - element.setAttribute(attribute, String.valueOf(++value)); + element.setAttribute("tests", String.valueOf(++value)); } final class TestCase { private final List steps = new ArrayList<>(); private final List results = new ArrayList<>(); - private final io.cucumber.core.event.TestCase testCase; + private final io.cucumber.plugin.event.TestCase testCase; - TestCase(io.cucumber.core.event.TestCase testCase) { + TestCase(io.cucumber.plugin.event.TestCase testCase) { this.testCase = testCase; } @@ -190,7 +189,7 @@ void writeElement(Element tc) { tc.setAttribute("name", calculateElementName(testCase)); } - private String calculateElementName(io.cucumber.core.event.TestCase testCase) { + private String calculateElementName(io.cucumber.plugin.event.TestCase testCase) { String testCaseName = testCase.getName(); if (testCaseName.equals(previousTestCaseName)) { return getUniqueTestNameForScenarioExample(testCaseName, ++exampleNumber); @@ -202,7 +201,7 @@ private String calculateElementName(io.cucumber.core.event.TestCase testCase) { } void addTestCaseElement(Document doc, Element tc, Result result) { - tc.setAttribute("time", calculateTotalDurationString(result)); + tc.setAttribute("time", calculateTotalDurationString(result.getDuration())); StringBuilder sb = new StringBuilder(); addStepAndResultListing(sb); @@ -210,16 +209,17 @@ void addTestCaseElement(Document doc, Element tc, Result result) { Status status = result.getStatus(); if (status.is(Status.FAILED) || status.is(Status.AMBIGUOUS)) { addStackTrace(sb, result); - child = createElementWithMessage(doc, sb, "failure", printStackTrace(result.getError())); + child = createFailure(doc, sb, result.getError().getMessage(), result.getError().getClass()); } else if (status.is(Status.PENDING) || status.is(Status.UNDEFINED)) { if (strict) { - child = createElementWithMessage(doc, sb, "failure", "The scenario has pending or undefined step(s)"); + Throwable error = result.getError(); + child = createFailure(doc, sb, "The scenario has pending or undefined step(s)", error == null ? Exception.class : error.getClass()); } else { child = createElement(doc, sb, "skipped"); } } else if (status.is(Status.SKIPPED) && result.getError() != null) { addStackTrace(sb, result); - child = createElementWithMessage(doc, sb, "skipped", printStackTrace(result.getError())); + child = createSkipped(doc, sb, printStackTrace(result.getError())); } else { child = createElement(doc, sb, "system-out"); } @@ -228,20 +228,18 @@ void addTestCaseElement(Document doc, Element tc, Result result) { } void handleEmptyTestCase(Document doc, Element tc, Result result) { - tc.setAttribute("time", calculateTotalDurationString(result)); + tc.setAttribute("time", calculateTotalDurationString(result.getDuration())); - String resultType = strict ? "failure" : "skipped"; - Element child = createElementWithMessage(doc, new StringBuilder(), resultType, "The scenario has no steps"); + Element child; + if (strict) { + child = createFailure(doc, new StringBuilder(), "The scenario has no steps", Exception.class); + } else { + child = createSkipped(doc, new StringBuilder(), "The scenario has no steps"); + } tc.appendChild(child); } - private String calculateTotalDurationString(Result result) { - DecimalFormat numberFormat = (DecimalFormat) NumberFormat.getNumberInstance(Locale.US); - numberFormat.applyPattern("0.######"); - return numberFormat.format(((double) result.getDuration().toNanos() / NANOS_PER_SECONDS)); - } - private void addStepAndResultListing(StringBuilder sb) { for (int i = 0; i < steps.size(); i++) { int length = sb.length(); @@ -274,12 +272,19 @@ private String printStackTrace(Throwable error) { return stringWriter.toString(); } - private Element createElementWithMessage(Document doc, StringBuilder sb, String elementType, String message) { - Element child = createElement(doc, sb, elementType); + private Element createSkipped(Document doc, StringBuilder sb, String message) { + Element child = createElement(doc, sb, "skipped"); child.setAttribute("message", message); return child; } + private Element createFailure(Document doc, StringBuilder sb, String message, Class type) { + Element child = createElement(doc, sb, "failure"); + child.setAttribute("message", message); + child.setAttribute("type", type.getName()); + return child; + } + private Element createElement(Document doc, StringBuilder sb, String elementType) { Element child = doc.createElement(elementType); // the createCDATASection method seems to convert "\n" to "\r\n" on Windows, in case @@ -289,6 +294,6 @@ private Element createElement(Document doc, StringBuilder sb, String elementType child.appendChild(doc.createCDATASection(normalizedLineEndings)); return child; } - } + } diff --git a/core/src/main/java/io/cucumber/core/plugin/NullSummaryPrinter.java b/core/src/main/java/io/cucumber/core/plugin/NullSummaryPrinter.java index 3c0bf85d0d..ecac71a477 100644 --- a/core/src/main/java/io/cucumber/core/plugin/NullSummaryPrinter.java +++ b/core/src/main/java/io/cucumber/core/plugin/NullSummaryPrinter.java @@ -1,8 +1,10 @@ package io.cucumber.core.plugin; +import io.cucumber.plugin.SummaryPrinter; + public final class NullSummaryPrinter implements SummaryPrinter { - @SuppressWarnings("WeakerAccess") // Used by PluginFactory + @SuppressWarnings("unused") // Used by PluginFactory public NullSummaryPrinter(){ } diff --git a/core/src/main/java/io/cucumber/core/plugin/Options.java b/core/src/main/java/io/cucumber/core/plugin/Options.java index 583495e7e1..1f29d3bbff 100644 --- a/core/src/main/java/io/cucumber/core/plugin/Options.java +++ b/core/src/main/java/io/cucumber/core/plugin/Options.java @@ -9,7 +9,7 @@ public interface Options { interface Plugin { - Class pluginClass(); + Class pluginClass(); String argument(); diff --git a/core/src/main/java/io/cucumber/core/plugin/PluginFactory.java b/core/src/main/java/io/cucumber/core/plugin/PluginFactory.java index 1690f9fedb..50d4ad0ee0 100644 --- a/core/src/main/java/io/cucumber/core/plugin/PluginFactory.java +++ b/core/src/main/java/io/cucumber/core/plugin/PluginFactory.java @@ -1,6 +1,7 @@ package io.cucumber.core.plugin; import io.cucumber.core.exception.CucumberException; +import io.cucumber.plugin.Plugin; import java.io.File; import java.io.IOException; diff --git a/core/src/main/java/io/cucumber/core/plugin/Plugins.java b/core/src/main/java/io/cucumber/core/plugin/Plugins.java index f0628070cf..89dbb0b55f 100644 --- a/core/src/main/java/io/cucumber/core/plugin/Plugins.java +++ b/core/src/main/java/io/cucumber/core/plugin/Plugins.java @@ -1,8 +1,12 @@ package io.cucumber.core.plugin; -import io.cucumber.core.event.Event; -import io.cucumber.core.event.EventHandler; -import io.cucumber.core.event.EventPublisher; +import io.cucumber.plugin.event.Event; +import io.cucumber.plugin.event.EventPublisher; +import io.cucumber.plugin.ColorAware; +import io.cucumber.plugin.ConcurrentEventListener; +import io.cucumber.plugin.EventListener; +import io.cucumber.plugin.Plugin; +import io.cucumber.plugin.StrictAware; import java.util.ArrayList; import java.util.List; diff --git a/core/src/main/java/io/cucumber/core/plugin/PrettyFormatter.java b/core/src/main/java/io/cucumber/core/plugin/PrettyFormatter.java index 343fc9f165..cc60936d6d 100644 --- a/core/src/main/java/io/cucumber/core/plugin/PrettyFormatter.java +++ b/core/src/main/java/io/cucumber/core/plugin/PrettyFormatter.java @@ -1,18 +1,17 @@ package io.cucumber.core.plugin; -import io.cucumber.core.event.Argument; -import io.cucumber.core.event.PickleStepTestStep; -import io.cucumber.core.event.Result; -import io.cucumber.core.event.TestCase; -import io.cucumber.core.event.TestStep; -import io.cucumber.core.event.EventHandler; -import io.cucumber.core.event.EventPublisher; -import io.cucumber.core.event.TestCaseStarted; -import io.cucumber.core.event.TestRunFinished; -import io.cucumber.core.event.TestSourceRead; -import io.cucumber.core.event.TestStepFinished; -import io.cucumber.core.event.TestStepStarted; -import io.cucumber.core.event.WriteEvent; +import io.cucumber.plugin.event.Argument; +import io.cucumber.plugin.event.PickleStepTestStep; +import io.cucumber.plugin.event.Result; +import io.cucumber.plugin.event.TestCase; +import io.cucumber.plugin.event.TestStep; +import io.cucumber.plugin.event.EventPublisher; +import io.cucumber.plugin.event.TestCaseStarted; +import io.cucumber.plugin.event.TestRunFinished; +import io.cucumber.plugin.event.TestSourceRead; +import io.cucumber.plugin.event.TestStepFinished; +import io.cucumber.plugin.event.TestStepStarted; +import io.cucumber.plugin.event.WriteEvent; import gherkin.ast.Background; import gherkin.ast.Examples; import gherkin.ast.Feature; @@ -20,6 +19,8 @@ import gherkin.ast.ScenarioOutline; import gherkin.ast.Step; import gherkin.ast.Tag; +import io.cucumber.plugin.ColorAware; +import io.cucumber.plugin.EventListener; import java.io.PrintWriter; import java.io.StringWriter; diff --git a/core/src/main/java/io/cucumber/core/plugin/ProgressFormatter.java b/core/src/main/java/io/cucumber/core/plugin/ProgressFormatter.java index 179ccb86b2..ea73195b4f 100644 --- a/core/src/main/java/io/cucumber/core/plugin/ProgressFormatter.java +++ b/core/src/main/java/io/cucumber/core/plugin/ProgressFormatter.java @@ -1,12 +1,13 @@ package io.cucumber.core.plugin; -import io.cucumber.core.event.PickleStepTestStep; -import io.cucumber.core.event.EventHandler; -import io.cucumber.core.event.EventPublisher; -import io.cucumber.core.event.Status; -import io.cucumber.core.event.TestRunFinished; -import io.cucumber.core.event.TestStepFinished; -import io.cucumber.core.event.WriteEvent; +import io.cucumber.plugin.event.PickleStepTestStep; +import io.cucumber.plugin.event.EventPublisher; +import io.cucumber.plugin.event.Status; +import io.cucumber.plugin.event.TestRunFinished; +import io.cucumber.plugin.event.TestStepFinished; +import io.cucumber.plugin.event.WriteEvent; +import io.cucumber.plugin.ColorAware; +import io.cucumber.plugin.ConcurrentEventListener; import java.util.HashMap; import java.util.Map; diff --git a/core/src/main/java/io/cucumber/core/plugin/RerunFormatter.java b/core/src/main/java/io/cucumber/core/plugin/RerunFormatter.java index b03fbb5da1..ae2d30442b 100644 --- a/core/src/main/java/io/cucumber/core/plugin/RerunFormatter.java +++ b/core/src/main/java/io/cucumber/core/plugin/RerunFormatter.java @@ -1,10 +1,12 @@ package io.cucumber.core.plugin; -import io.cucumber.core.event.EventPublisher; -import io.cucumber.core.event.TestCase; -import io.cucumber.core.event.TestCaseFinished; -import io.cucumber.core.event.TestRunFinished; +import io.cucumber.plugin.event.EventPublisher; +import io.cucumber.plugin.event.TestCase; +import io.cucumber.plugin.event.TestCaseFinished; +import io.cucumber.plugin.event.TestRunFinished; import io.cucumber.core.feature.FeatureWithLines; +import io.cucumber.plugin.EventListener; +import io.cucumber.plugin.StrictAware; import java.util.ArrayList; import java.util.Collection; diff --git a/core/src/main/java/io/cucumber/core/plugin/Stats.java b/core/src/main/java/io/cucumber/core/plugin/Stats.java index 800fac0c96..6c9174eb98 100755 --- a/core/src/main/java/io/cucumber/core/plugin/Stats.java +++ b/core/src/main/java/io/cucumber/core/plugin/Stats.java @@ -1,13 +1,16 @@ package io.cucumber.core.plugin; -import io.cucumber.core.event.EventPublisher; -import io.cucumber.core.event.PickleStepTestStep; -import io.cucumber.core.event.Result; -import io.cucumber.core.event.Status; -import io.cucumber.core.event.TestCaseFinished; -import io.cucumber.core.event.TestRunFinished; -import io.cucumber.core.event.TestRunStarted; -import io.cucumber.core.event.TestStepFinished; +import io.cucumber.plugin.event.EventPublisher; +import io.cucumber.plugin.event.PickleStepTestStep; +import io.cucumber.plugin.event.Result; +import io.cucumber.plugin.event.Status; +import io.cucumber.plugin.event.TestCaseFinished; +import io.cucumber.plugin.event.TestRunFinished; +import io.cucumber.plugin.event.TestRunStarted; +import io.cucumber.plugin.event.TestStepFinished; +import io.cucumber.plugin.ColorAware; +import io.cucumber.plugin.ConcurrentEventListener; +import io.cucumber.plugin.StrictAware; import java.io.PrintStream; import java.text.DecimalFormat; diff --git a/core/src/main/java/io/cucumber/core/plugin/TestNGFormatter.java b/core/src/main/java/io/cucumber/core/plugin/TestNGFormatter.java index cea9e060d2..72b69c2abc 100644 --- a/core/src/main/java/io/cucumber/core/plugin/TestNGFormatter.java +++ b/core/src/main/java/io/cucumber/core/plugin/TestNGFormatter.java @@ -1,15 +1,18 @@ package io.cucumber.core.plugin; -import io.cucumber.core.event.PickleStepTestStep; -import io.cucumber.core.event.EventPublisher; -import io.cucumber.core.event.Result; -import io.cucumber.core.event.Status; -import io.cucumber.core.event.TestCaseFinished; -import io.cucumber.core.event.TestCaseStarted; -import io.cucumber.core.event.TestRunFinished; -import io.cucumber.core.event.TestSourceRead; -import io.cucumber.core.event.TestStepFinished; +import io.cucumber.plugin.event.PickleStepTestStep; +import io.cucumber.plugin.event.EventPublisher; +import io.cucumber.plugin.event.Result; +import io.cucumber.plugin.event.Status; +import io.cucumber.plugin.event.TestCaseFinished; +import io.cucumber.plugin.event.TestCaseStarted; +import io.cucumber.plugin.event.TestRunFinished; +import io.cucumber.plugin.event.TestRunStarted; +import io.cucumber.plugin.event.TestSourceRead; +import io.cucumber.plugin.event.TestStepFinished; import io.cucumber.core.exception.CucumberException; +import io.cucumber.plugin.EventListener; +import io.cucumber.plugin.StrictAware; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; @@ -31,13 +34,13 @@ import java.io.StringWriter; import java.io.Writer; import java.net.URL; -import java.text.SimpleDateFormat; import java.time.Duration; +import java.time.Instant; import java.util.ArrayList; -import java.util.Date; import java.util.List; import static java.time.Duration.ZERO; +import static java.time.format.DateTimeFormatter.ISO_INSTANT; import static java.util.Locale.ROOT; public final class TestNGFormatter implements EventListener, StrictAware { @@ -55,6 +58,7 @@ public final class TestNGFormatter implements EventListener, StrictAware { private String currentFeatureFile = null; private String previousTestCaseName; private int exampleNumber; + private Instant started; @SuppressWarnings("WeakerAccess") // Used by plugin factory public TestNGFormatter(URL url) throws IOException { @@ -75,10 +79,15 @@ public TestNGFormatter(URL url) throws IOException { @Override public void setEventPublisher(EventPublisher publisher) { publisher.registerHandlerFor(TestSourceRead.class, this::handleTestSourceRead); + publisher.registerHandlerFor(TestRunStarted.class, this::handleTestRunStarted); publisher.registerHandlerFor(TestCaseStarted.class, this::handleTestCaseStarted); publisher.registerHandlerFor(TestCaseFinished.class, this::handleTestCaseFinished); publisher.registerHandlerFor(TestStepFinished.class, this::handleTestStepFinished); - publisher.registerHandlerFor(TestRunFinished.class, event -> finishReport()); + publisher.registerHandlerFor(TestRunFinished.class, this::handleTestRunFinished); + } + + private void handleTestRunStarted(TestRunStarted event) { + this.started = event.getInstant(); } @Override @@ -102,7 +111,7 @@ private void handleTestCaseStarted(TestCaseStarted event) { root = document.createElement("test-method"); clazz.appendChild(root); testCase = new TestCase(event.getTestCase()); - testCase.start(root); + testCase.start(root, event.getInstant()); } private void handleTestStepFinished(TestStepFinished event) { @@ -115,19 +124,21 @@ private void handleTestStepFinished(TestStepFinished event) { } private void handleTestCaseFinished(TestCaseFinished event) { - testCase.finish(document, root); + testCase.finish(document, root, event.getInstant()); } - private void finishReport() { + private void handleTestRunFinished(TestRunFinished event) { try { + Instant finished = event.getInstant(); + Duration duration = Duration.between(started, finished); results.setAttribute("total", String.valueOf(getElementsCountByAttribute(suite, "status", ".*"))); results.setAttribute("passed", String.valueOf(getElementsCountByAttribute(suite, "status", "PASS"))); results.setAttribute("failed", String.valueOf(getElementsCountByAttribute(suite, "status", "FAIL"))); results.setAttribute("skipped", String.valueOf(getElementsCountByAttribute(suite, "status", "SKIP"))); suite.setAttribute("name", TestNGFormatter.class.getName()); - suite.setAttribute("duration-ms", getTotalDuration(suite.getElementsByTagName("test-method"))); + suite.setAttribute("duration-ms", String.valueOf(duration.toMillis())); test.setAttribute("name", TestNGFormatter.class.getName()); - test.setAttribute("duration-ms", getTotalDuration(suite.getElementsByTagName("test-method"))); + test.setAttribute("duration-ms", String.valueOf(duration.toMillis())); TransformerFactory factory = TransformerFactory.newInstance(); factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); @@ -168,37 +179,23 @@ private int getElementsCountByAttribute(Node node, String attributeName, String return count; } - private String getTotalDuration(NodeList testCaseNodes) { - long totalDuration = 0; - for (int i = 0; i < testCaseNodes.getLength(); i++) { - try { - String duration = testCaseNodes.item(i).getAttributes().getNamedItem("duration-ms").getNodeValue(); - totalDuration += Long.parseLong(duration); - } catch (NumberFormatException | NullPointerException e) { - throw new CucumberException(e); - } - } - return String.valueOf(totalDuration); - } - final class TestCase { private final List steps = new ArrayList<>(); private final List results = new ArrayList<>(); private final List hooks = new ArrayList<>(); - private final io.cucumber.core.event.TestCase testCase; - private final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); + private final io.cucumber.plugin.event.TestCase testCase; - TestCase(io.cucumber.core.event.TestCase testCase) { + TestCase(io.cucumber.plugin.event.TestCase testCase) { this.testCase = testCase; } - private void start(Element element) { + private void start(Element element, Instant instant) { element.setAttribute("name", calculateElementName(testCase)); - element.setAttribute("started-at", dateFormat.format(new Date())); + element.setAttribute("started-at", ISO_INSTANT.format(instant)); } - private String calculateElementName(io.cucumber.core.event.TestCase testCase) { + private String calculateElementName(io.cucumber.plugin.event.TestCase testCase) { String testCaseName = testCase.getName(); if (testCaseName.equals(previousTestCaseName)) { return testCaseName + "_" + ++exampleNumber; @@ -209,9 +206,9 @@ private String calculateElementName(io.cucumber.core.event.TestCase testCase) { } } - void finish(Document doc, Element element) { + void finish(Document doc, Element element, Instant instant) { element.setAttribute("duration-ms", calculateTotalDurationString()); - element.setAttribute("finished-at", dateFormat.format(new Date())); + element.setAttribute("finished-at", ISO_INSTANT.format(instant)); StringBuilder stringBuilder = new StringBuilder(); addStepAndResultListing(stringBuilder); Result skipped = null; diff --git a/core/src/main/java/io/cucumber/core/plugin/TestSourcesModel.java b/core/src/main/java/io/cucumber/core/plugin/TestSourcesModel.java index ff5c6dcb8c..322c65acf6 100644 --- a/core/src/main/java/io/cucumber/core/plugin/TestSourcesModel.java +++ b/core/src/main/java/io/cucumber/core/plugin/TestSourcesModel.java @@ -1,6 +1,6 @@ package io.cucumber.core.plugin; -import io.cucumber.core.event.TestSourceRead; +import io.cucumber.plugin.event.TestSourceRead; import gherkin.AstBuilder; import gherkin.GherkinDialect; import gherkin.GherkinDialectProvider; diff --git a/core/src/main/java/io/cucumber/core/plugin/TimelineFormatter.java b/core/src/main/java/io/cucumber/core/plugin/TimelineFormatter.java index cc4cad1b24..4ac0ad9683 100644 --- a/core/src/main/java/io/cucumber/core/plugin/TimelineFormatter.java +++ b/core/src/main/java/io/cucumber/core/plugin/TimelineFormatter.java @@ -3,14 +3,15 @@ import gherkin.deps.com.google.gson.Gson; import gherkin.deps.com.google.gson.GsonBuilder; import gherkin.deps.com.google.gson.annotations.SerializedName; -import io.cucumber.core.event.EventPublisher; -import io.cucumber.core.event.TestCase; -import io.cucumber.core.event.TestCaseEvent; -import io.cucumber.core.event.TestCaseFinished; -import io.cucumber.core.event.TestCaseStarted; -import io.cucumber.core.event.TestRunFinished; -import io.cucumber.core.event.TestSourceRead; +import io.cucumber.plugin.event.EventPublisher; +import io.cucumber.plugin.event.TestCase; +import io.cucumber.plugin.event.TestCaseEvent; +import io.cucumber.plugin.event.TestCaseFinished; +import io.cucumber.plugin.event.TestCaseStarted; +import io.cucumber.plugin.event.TestRunFinished; +import io.cucumber.plugin.event.TestSourceRead; import io.cucumber.core.exception.CucumberException; +import io.cucumber.plugin.ConcurrentEventListener; import java.io.Closeable; import java.io.File; @@ -20,7 +21,6 @@ import java.io.OutputStream; import java.io.OutputStreamWriter; import java.net.URL; -import java.time.Instant; import java.util.Collection; import java.util.HashMap; import java.util.Map; @@ -35,7 +35,7 @@ public final class TimelineFormatter implements ConcurrentEventListener { "/io/cucumber/core/plugin/timeline/index.html", "/io/cucumber/core/plugin/timeline/formatter.js", "/io/cucumber/core/plugin/timeline/report.css", - "/io/cucumber/core/plugin/timeline/jquery-3.3.1.min.js", + "/io/cucumber/core/plugin/timeline/jquery-3.4.1.min.js", "/io/cucumber/core/plugin/timeline/vis.min.css", "/io/cucumber/core/plugin/timeline/vis.min.js", "/io/cucumber/core/plugin/timeline/vis.override.css", @@ -51,9 +51,9 @@ public final class TimelineFormatter implements ConcurrentEventListener { private final URL reportDir; private final NiceAppendable reportJs; - @SuppressWarnings("WeakerAccess") // Used by PluginFactory + @SuppressWarnings("unused") // Used by PluginFactory public TimelineFormatter(final URL reportDir) { - this(reportDir, createJsonOut(reportDir, "report.js")); + this(reportDir, createOutput(reportDir, "report.js")); } private TimelineFormatter(final URL reportDir, final NiceAppendable reportJs) { @@ -61,7 +61,6 @@ private TimelineFormatter(final URL reportDir, final NiceAppendable reportJs) { this.reportJs = reportJs; } - @Override public void setEventPublisher(final EventPublisher publisher) { publisher.registerHandlerFor(TestSourceRead.class, this::handleTestSourceRead); @@ -101,6 +100,16 @@ private void finishReport(final TestRunFinished event) { reportJs.append("});"); reportJs.close(); copyReportFiles(); + + // TODO: Enable this warning when cucumber-html-formatter is ready to be used +// System.err.println("" + +// "\n" + +// "****************************************\n" + +// "* WARNING: The timeline formatter will *\n" + +// "* be removed in cucumber-jvm 6.0.0 and *\n" + +// "* be replaced by the standalone *\n" + +// "* cucumber-html-formatter. *\n" + +// "****************************************\n"); } private void appendAsJsonToJs(final Gson gson, final NiceAppendable out, final String pushTo, final Collection content) { @@ -125,7 +134,7 @@ private void copyReportFiles() { } } - private static NiceAppendable createJsonOut(final URL dir, final String file) { + private static NiceAppendable createOutput(final URL dir, final String file) { final File outDir = new File(dir.getPath()); if (!outDir.exists() && !outDir.mkdirs()) { throw new CucumberException("Failed to create dir: " + dir.getPath()); @@ -179,9 +188,9 @@ class TestData { @SerializedName("scenario") final String scenario; @SerializedName("start") - final Instant startTime; + final long startTime; @SerializedName("end") - Instant endTime; + long endTime; @SerializedName("group") final long threadId; @SerializedName("content") @@ -197,7 +206,7 @@ class TestData { final String uri = testCase.getUri(); this.feature = TimelineFormatter.this.testSources.getFeatureName(uri); this.scenario = testCase.getName(); - this.startTime = started.getInstant(); + this.startTime = started.getInstant().toEpochMilli(); this.threadId = threadId; this.tags = buildTagsValue(testCase); } @@ -211,7 +220,7 @@ private String buildTagsValue(final TestCase testCase) { } void end(final TestCaseFinished event) { - this.endTime = event.getInstant(); + this.endTime = event.getInstant().toEpochMilli(); this.className = event.getResult().getStatus().name().toLowerCase(ROOT); } } diff --git a/core/src/main/java/io/cucumber/core/plugin/UnusedStepsSummaryPrinter.java b/core/src/main/java/io/cucumber/core/plugin/UnusedStepsSummaryPrinter.java index 4741eb1efe..83ee65dbcd 100644 --- a/core/src/main/java/io/cucumber/core/plugin/UnusedStepsSummaryPrinter.java +++ b/core/src/main/java/io/cucumber/core/plugin/UnusedStepsSummaryPrinter.java @@ -6,7 +6,14 @@ import java.util.TreeMap; import java.util.TreeSet; -import io.cucumber.core.event.*; +import io.cucumber.plugin.event.EventPublisher; +import io.cucumber.plugin.event.Status; +import io.cucumber.plugin.event.StepDefinedEvent; +import io.cucumber.plugin.event.TestRunFinished; +import io.cucumber.plugin.event.TestStepFinished; +import io.cucumber.plugin.ColorAware; +import io.cucumber.plugin.EventListener; +import io.cucumber.plugin.SummaryPrinter; import static java.util.Locale.ROOT; @@ -33,7 +40,7 @@ public void setEventPublisher(EventPublisher publisher) { } private void handleStepDefinedEvent(StepDefinedEvent event) { - registeredSteps.put(event.getStepDefinition().getLocation(false), event.getStepDefinition().getPattern()); + registeredSteps.put(event.getStepDefinition().getLocation(), event.getStepDefinition().getPattern()); } private void handleTestStepFinished(TestStepFinished event) { diff --git a/core/src/main/java/io/cucumber/core/plugin/UsageFormatter.java b/core/src/main/java/io/cucumber/core/plugin/UsageFormatter.java index e4dff59613..81a53ce86d 100644 --- a/core/src/main/java/io/cucumber/core/plugin/UsageFormatter.java +++ b/core/src/main/java/io/cucumber/core/plugin/UsageFormatter.java @@ -4,12 +4,14 @@ import gherkin.deps.com.google.gson.GsonBuilder; import gherkin.deps.com.google.gson.JsonPrimitive; import gherkin.deps.com.google.gson.JsonSerializer; -import io.cucumber.core.event.EventPublisher; -import io.cucumber.core.event.PickleStepTestStep; -import io.cucumber.core.event.Result; -import io.cucumber.core.event.Status; -import io.cucumber.core.event.TestRunFinished; -import io.cucumber.core.event.TestStepFinished; +import io.cucumber.plugin.event.EventPublisher; +import io.cucumber.plugin.event.PickleStepTestStep; +import io.cucumber.plugin.event.Result; +import io.cucumber.plugin.event.Status; +import io.cucumber.plugin.event.TestRunFinished; +import io.cucumber.plugin.event.TestStepFinished; +import io.cucumber.plugin.EventListener; +import io.cucumber.plugin.Plugin; import java.time.Duration; import java.util.ArrayList; diff --git a/core/src/main/java/io/cucumber/core/reflection/Reflections.java b/core/src/main/java/io/cucumber/core/reflection/Reflections.java index 0b39f13d84..bfa62aeeaa 100644 --- a/core/src/main/java/io/cucumber/core/reflection/Reflections.java +++ b/core/src/main/java/io/cucumber/core/reflection/Reflections.java @@ -1,11 +1,11 @@ package io.cucumber.core.reflection; -import io.cucumber.core.io.ClassFinder; import io.cucumber.core.exception.CucumberException; +import io.cucumber.core.io.ClassFinder; import java.lang.reflect.Constructor; -import java.net.URI; import java.lang.reflect.Modifier; +import java.net.URI; import java.util.Arrays; import java.util.Collection; import java.util.HashSet; @@ -18,7 +18,7 @@ public Reflections(ClassFinder classFinder) { this.classFinder = classFinder; } - public static boolean isInstantiable(Class clazz) { + static boolean isInstantiable(Class clazz) { boolean isNonStaticInnerClass = !Modifier.isStatic(clazz.getModifiers()) && clazz.getEnclosingClass() != null; return Modifier.isPublic(clazz.getModifiers()) && !Modifier.isAbstract(clazz.getModifiers()) && !isNonStaticInnerClass; } @@ -28,7 +28,7 @@ public T instantiateExactlyOneSubclass(Class parentType, List packag if (instances.size() == 1) { return instances.iterator().next(); } else if (instances.isEmpty()) { - if(fallback != null) { + if (fallback != null) { return fallback; } throw new NoInstancesException(parentType); diff --git a/core/src/main/java/io/cucumber/core/runner/AmbiguousPickleStepDefinitionsMatch.java b/core/src/main/java/io/cucumber/core/runner/AmbiguousPickleStepDefinitionsMatch.java index d809337535..34a4541642 100644 --- a/core/src/main/java/io/cucumber/core/runner/AmbiguousPickleStepDefinitionsMatch.java +++ b/core/src/main/java/io/cucumber/core/runner/AmbiguousPickleStepDefinitionsMatch.java @@ -1,6 +1,5 @@ package io.cucumber.core.runner; -import io.cucumber.core.api.Scenario; import io.cucumber.core.feature.CucumberStep; import java.util.Collections; @@ -14,13 +13,13 @@ final class AmbiguousPickleStepDefinitionsMatch extends PickleStepDefinitionMatc } @Override - public void runStep(Scenario scenario) { + public void runStep(TestCaseState state) throws AmbiguousStepDefinitionsException { throw exception; } @Override - public void dryRunStep(Scenario scenario) { - runStep(scenario); + public void dryRunStep(TestCaseState state) throws AmbiguousStepDefinitionsException { + runStep(state); } @Override diff --git a/core/src/main/java/io/cucumber/core/runner/AmbiguousStepDefinitionsException.java b/core/src/main/java/io/cucumber/core/runner/AmbiguousStepDefinitionsException.java index 2596edafde..f55c8789d6 100644 --- a/core/src/main/java/io/cucumber/core/runner/AmbiguousStepDefinitionsException.java +++ b/core/src/main/java/io/cucumber/core/runner/AmbiguousStepDefinitionsException.java @@ -1,6 +1,5 @@ package io.cucumber.core.runner; -import io.cucumber.core.exception.CucumberException; import io.cucumber.core.feature.CucumberStep; import java.util.List; @@ -8,7 +7,7 @@ import static java.util.Objects.requireNonNull; import static java.util.stream.Collectors.joining; -final public class AmbiguousStepDefinitionsException extends CucumberException { +final public class AmbiguousStepDefinitionsException extends Exception { private final List matches; diff --git a/core/src/main/java/io/cucumber/core/runner/CachingGlue.java b/core/src/main/java/io/cucumber/core/runner/CachingGlue.java index 382fba9bdc..8fe5b90823 100644 --- a/core/src/main/java/io/cucumber/core/runner/CachingGlue.java +++ b/core/src/main/java/io/cucumber/core/runner/CachingGlue.java @@ -8,15 +8,16 @@ import io.cucumber.core.backend.Glue; import io.cucumber.core.backend.HookDefinition; import io.cucumber.core.backend.ParameterTypeDefinition; +import io.cucumber.core.backend.ScenarioScoped; import io.cucumber.core.backend.StepDefinition; -import io.cucumber.core.event.StepDefinedEvent; import io.cucumber.core.eventbus.EventBus; import io.cucumber.core.feature.CucumberStep; import io.cucumber.core.stepexpression.Argument; -import io.cucumber.core.stepexpression.TypeRegistry; +import io.cucumber.core.stepexpression.StepTypeRegistry; import io.cucumber.cucumberexpressions.ParameterByTypeTransformer; import io.cucumber.datatable.TableCellByTypeTransformer; import io.cucumber.datatable.TableEntryByTypeTransformer; +import io.cucumber.plugin.event.StepDefinedEvent; import java.util.ArrayList; import java.util.Collection; @@ -180,15 +181,15 @@ List getDocStringTypeDefinitions() { return docStringTypeDefinitions; } - void prepareGlue(TypeRegistry typeRegistry) throws DuplicateStepDefinitionException { - parameterTypeDefinitions.forEach(ptd -> typeRegistry.defineParameterType(ptd.parameterType())); - dataTableTypeDefinitions.forEach(dtd -> typeRegistry.defineDataTableType(dtd.dataTableType())); - docStringTypeDefinitions.forEach(dtd -> typeRegistry.defineDocStringType(dtd.docStringType())); + void prepareGlue(StepTypeRegistry stepTypeRegistry) throws DuplicateStepDefinitionException { + parameterTypeDefinitions.forEach(ptd -> stepTypeRegistry.defineParameterType(ptd.parameterType())); + dataTableTypeDefinitions.forEach(dtd -> stepTypeRegistry.defineDataTableType(dtd.dataTableType())); + docStringTypeDefinitions.forEach(dtd -> stepTypeRegistry.defineDocStringType(dtd.docStringType())); if (defaultParameterTransformers.size() == 1) { DefaultParameterTransformerDefinition definition = defaultParameterTransformers.get(0); ParameterByTypeTransformer transformer = definition.parameterByTypeTransformer(); - typeRegistry.setDefaultParameterTransformer(transformer); + stepTypeRegistry.setDefaultParameterTransformer(transformer); } else if (defaultParameterTransformers.size() > 1) { throw new DuplicateDefaultParameterTransformers(defaultParameterTransformers); } @@ -196,7 +197,7 @@ void prepareGlue(TypeRegistry typeRegistry) throws DuplicateStepDefinitionExcept if (defaultDataTableEntryTransformers.size() == 1) { DefaultDataTableEntryTransformerDefinition definition = defaultDataTableEntryTransformers.get(0); TableEntryByTypeTransformer transformer = definition.tableEntryByTypeTransformer(); - typeRegistry.setDefaultDataTableEntryTransformer(transformer); + stepTypeRegistry.setDefaultDataTableEntryTransformer(transformer); } else if (defaultDataTableEntryTransformers.size() > 1) { throw new DuplicateDefaultDataTableEntryTransformers(defaultDataTableEntryTransformers); } @@ -204,23 +205,31 @@ void prepareGlue(TypeRegistry typeRegistry) throws DuplicateStepDefinitionExcept if (defaultDataTableCellTransformers.size() == 1) { DefaultDataTableCellTransformerDefinition definition = defaultDataTableCellTransformers.get(0); TableCellByTypeTransformer transformer = definition.tableCellByTypeTransformer(); - typeRegistry.setDefaultDataTableCellTransformer(transformer); + stepTypeRegistry.setDefaultDataTableCellTransformer(transformer); } else if (defaultDataTableCellTransformers.size() > 1) { throw new DuplicateDefaultDataTableCellTransformers(defaultDataTableCellTransformers); } stepDefinitions.forEach(stepDefinition -> { - CoreStepDefinition coreStepDefinition = new CoreStepDefinition(stepDefinition, typeRegistry); + CoreStepDefinition coreStepDefinition = new CoreStepDefinition(stepDefinition, stepTypeRegistry); CoreStepDefinition previous = stepDefinitionsByPattern.get(stepDefinition.getPattern()); if (previous != null) { throw new DuplicateStepDefinitionException(previous.getStepDefinition(), stepDefinition); } stepDefinitionsByPattern.put(coreStepDefinition.getPattern(), coreStepDefinition); - bus.send(new StepDefinedEvent(bus.getInstant(), stepDefinition)); + bus.send( + new StepDefinedEvent( + bus.getInstant(), + new io.cucumber.plugin.event.StepDefinition( + stepDefinition.getLocation(), + stepDefinition.getPattern() + ) + ) + ); }); } - PickleStepDefinitionMatch stepDefinitionMatch(String uri, CucumberStep step) { + PickleStepDefinitionMatch stepDefinitionMatch(String uri, CucumberStep step) throws AmbiguousStepDefinitionsException{ PickleStepDefinitionMatch cachedMatch = cachedStepDefinitionMatch(uri, step); if (cachedMatch != null) { return cachedMatch; @@ -248,7 +257,7 @@ private PickleStepDefinitionMatch cachedStepDefinitionMatch(String featurePath, return new PickleStepDefinitionMatch(arguments, coreStepDefinition.getStepDefinition(), featurePath, step); } - private PickleStepDefinitionMatch findStepDefinitionMatch(String uri, CucumberStep step) { + private PickleStepDefinitionMatch findStepDefinitionMatch(String uri, CucumberStep step) throws AmbiguousStepDefinitionsException { List matches = stepDefinitionMatches(uri, step); if (matches.isEmpty()) { return null; @@ -295,8 +304,6 @@ private void removeScenarioScopedGlue(Iterable glues) { while (glueIterator.hasNext()) { Object glue = glueIterator.next(); if (glue instanceof ScenarioScoped) { - ScenarioScoped scenarioScopedGlue = (ScenarioScoped) glue; - scenarioScopedGlue.disposeScenarioScope(); glueIterator.remove(); } } diff --git a/core/src/main/java/io/cucumber/core/runner/CoreDefaultDataTableEntryTransformerDefinition.java b/core/src/main/java/io/cucumber/core/runner/CoreDefaultDataTableEntryTransformerDefinition.java index 848a819913..04ad3d6c44 100644 --- a/core/src/main/java/io/cucumber/core/runner/CoreDefaultDataTableEntryTransformerDefinition.java +++ b/core/src/main/java/io/cucumber/core/runner/CoreDefaultDataTableEntryTransformerDefinition.java @@ -1,6 +1,7 @@ package io.cucumber.core.runner; import io.cucumber.core.backend.DefaultDataTableEntryTransformerDefinition; +import io.cucumber.core.backend.ScenarioScoped; import io.cucumber.datatable.TableCellByTypeTransformer; import io.cucumber.datatable.TableEntryByTypeTransformer; @@ -38,22 +39,19 @@ public TableEntryByTypeTransformer tableEntryByTypeTransformer() { } @Override - public String getLocation(boolean detail) { - return delegate.getLocation(detail); + public boolean isDefinedAt(StackTraceElement stackTraceElement) { + return delegate.isDefinedAt(stackTraceElement); } - private static class ScenarioCoreDefaultDataTableEntryTransformerDefinition extends CoreDefaultDataTableEntryTransformerDefinition implements ScenarioScoped { + @Override + public String getLocation() { + return delegate.getLocation(); + } - private final ScenarioScoped delegate; + private static class ScenarioCoreDefaultDataTableEntryTransformerDefinition extends CoreDefaultDataTableEntryTransformerDefinition implements ScenarioScoped { ScenarioCoreDefaultDataTableEntryTransformerDefinition(DefaultDataTableEntryTransformerDefinition delegate) { super(delegate); - this.delegate = (ScenarioScoped) delegate; - } - - @Override - public void disposeScenarioScope() { - delegate.disposeScenarioScope(); } } diff --git a/core/src/main/java/io/cucumber/core/runner/CoreHookDefinition.java b/core/src/main/java/io/cucumber/core/runner/CoreHookDefinition.java index 10cd9258bd..ff0b72cc69 100644 --- a/core/src/main/java/io/cucumber/core/runner/CoreHookDefinition.java +++ b/core/src/main/java/io/cucumber/core/runner/CoreHookDefinition.java @@ -1,7 +1,7 @@ package io.cucumber.core.runner; -import io.cucumber.core.api.Scenario; import io.cucumber.core.backend.HookDefinition; +import io.cucumber.core.backend.ScenarioScoped; import io.cucumber.tagexpressions.Expression; import io.cucumber.tagexpressions.TagExpressionParser; @@ -26,7 +26,7 @@ private CoreHookDefinition(HookDefinition delegate) { this.tagExpression = new TagExpressionParser().parse(delegate.getTagExpression()); } - void execute(Scenario scenario) throws Throwable { + void execute(TestCaseState scenario) { delegate.execute(scenario); } @@ -34,8 +34,8 @@ HookDefinition getDelegate() { return delegate; } - String getLocation(boolean detail) { - return delegate.getLocation(detail); + String getLocation() { + return delegate.getLocation(); } int getOrder() { @@ -47,16 +47,9 @@ boolean matches(List tags) { } static class ScenarioScopedCoreHookDefinition extends CoreHookDefinition implements ScenarioScoped { - private final ScenarioScoped delegate; - private ScenarioScopedCoreHookDefinition(HookDefinition delegate) { super(delegate); - this.delegate = (ScenarioScoped) delegate; } - @Override - public void disposeScenarioScope() { - delegate.disposeScenarioScope(); - } } } diff --git a/core/src/main/java/io/cucumber/core/runner/CoreStepDefinition.java b/core/src/main/java/io/cucumber/core/runner/CoreStepDefinition.java index e65e114915..df9709e692 100644 --- a/core/src/main/java/io/cucumber/core/runner/CoreStepDefinition.java +++ b/core/src/main/java/io/cucumber/core/runner/CoreStepDefinition.java @@ -7,11 +7,11 @@ import io.cucumber.core.stepexpression.ArgumentMatcher; import io.cucumber.core.stepexpression.StepExpression; import io.cucumber.core.stepexpression.StepExpressionFactory; -import io.cucumber.core.stepexpression.TypeRegistry; -import io.cucumber.core.stepexpression.TypeResolver; +import io.cucumber.core.stepexpression.StepTypeRegistry; import java.lang.reflect.Type; import java.util.List; +import java.util.function.Supplier; import static java.util.Objects.requireNonNull; @@ -22,22 +22,22 @@ final class CoreStepDefinition { private final StepDefinition stepDefinition; private final Type[] types; - CoreStepDefinition(StepDefinition stepDefinition, TypeRegistry typeRegistry) { + CoreStepDefinition(StepDefinition stepDefinition, StepTypeRegistry stepTypeRegistry) { this.stepDefinition = requireNonNull(stepDefinition); List parameterInfos = stepDefinition.parameterInfos(); - this.expression = createExpression(parameterInfos, stepDefinition.getPattern(), typeRegistry); + this.expression = createExpression(parameterInfos, stepDefinition.getPattern(), stepTypeRegistry); this.argumentMatcher = new ArgumentMatcher(this.expression); this.types = getTypes(parameterInfos); } - private StepExpression createExpression(List parameterInfos, String expression, TypeRegistry typeRegistry) { + private StepExpression createExpression(List parameterInfos, String expression, StepTypeRegistry stepTypeRegistry) { if (parameterInfos == null || parameterInfos.isEmpty()) { - return new StepExpressionFactory(typeRegistry).createExpression(expression); + return new StepExpressionFactory(stepTypeRegistry).createExpression(expression); } else { ParameterInfo parameterInfo = parameterInfos.get(parameterInfos.size() - 1); - TypeResolver typeResolver = parameterInfo.getTypeResolver()::resolve; + Supplier typeResolver = parameterInfo.getTypeResolver()::resolve; boolean transposed = parameterInfo.isTransposed(); - return new StepExpressionFactory(typeRegistry).createExpression(expression, typeResolver, transposed); + return new StepExpressionFactory(stepTypeRegistry).createExpression(expression, typeResolver, transposed); } } diff --git a/core/src/main/java/io/cucumber/core/runner/DefinitionArgument.java b/core/src/main/java/io/cucumber/core/runner/DefinitionArgument.java index fd8088aa63..4570a365d4 100644 --- a/core/src/main/java/io/cucumber/core/runner/DefinitionArgument.java +++ b/core/src/main/java/io/cucumber/core/runner/DefinitionArgument.java @@ -1,6 +1,6 @@ package io.cucumber.core.runner; -import io.cucumber.core.event.Argument; +import io.cucumber.plugin.event.Argument; import io.cucumber.core.stepexpression.ExpressionArgument; import java.util.ArrayList; diff --git a/core/src/main/java/io/cucumber/core/runner/DuplicateDefaultDataTableCellTransformers.java b/core/src/main/java/io/cucumber/core/runner/DuplicateDefaultDataTableCellTransformers.java index 26446a51e5..848ef0ab34 100644 --- a/core/src/main/java/io/cucumber/core/runner/DuplicateDefaultDataTableCellTransformers.java +++ b/core/src/main/java/io/cucumber/core/runner/DuplicateDefaultDataTableCellTransformers.java @@ -14,7 +14,7 @@ class DuplicateDefaultDataTableCellTransformers extends CucumberException { private static String createMessage(List definitions) { return "There may not be more then one default table cell transformers. Found:" + definitions.stream() - .map(d -> d.getLocation(true)) + .map(d -> d.getLocation()) .collect(joining("\n - ", "\n - ", "\n")); } } diff --git a/core/src/main/java/io/cucumber/core/runner/DuplicateDefaultDataTableEntryTransformers.java b/core/src/main/java/io/cucumber/core/runner/DuplicateDefaultDataTableEntryTransformers.java index 2aa1b7ec90..61c5d5a67e 100644 --- a/core/src/main/java/io/cucumber/core/runner/DuplicateDefaultDataTableEntryTransformers.java +++ b/core/src/main/java/io/cucumber/core/runner/DuplicateDefaultDataTableEntryTransformers.java @@ -13,7 +13,7 @@ class DuplicateDefaultDataTableEntryTransformers extends CucumberException { private static String createMessage(List definitions) { return "There may not be more then one default data table entry. Found:" + definitions.stream() - .map(d -> d.getLocation(true)) + .map(d -> d.getLocation()) .collect(joining("\n - ", "\n - ", "\n")); } } diff --git a/core/src/main/java/io/cucumber/core/runner/DuplicateDefaultParameterTransformers.java b/core/src/main/java/io/cucumber/core/runner/DuplicateDefaultParameterTransformers.java index b52f1313f7..30de1ca013 100644 --- a/core/src/main/java/io/cucumber/core/runner/DuplicateDefaultParameterTransformers.java +++ b/core/src/main/java/io/cucumber/core/runner/DuplicateDefaultParameterTransformers.java @@ -14,7 +14,7 @@ class DuplicateDefaultParameterTransformers extends CucumberException { private static String createMessage(List definitions) { return "There may not be more then one default parameter transformer. Found:" + definitions.stream() - .map(d -> d.getLocation(true)) + .map(d -> d.getLocation()) .collect(joining("\n - ", "\n - ", "\n")); } } diff --git a/core/src/main/java/io/cucumber/core/runner/DuplicateStepDefinitionException.java b/core/src/main/java/io/cucumber/core/runner/DuplicateStepDefinitionException.java index 9a775a9c36..6a16d32995 100644 --- a/core/src/main/java/io/cucumber/core/runner/DuplicateStepDefinitionException.java +++ b/core/src/main/java/io/cucumber/core/runner/DuplicateStepDefinitionException.java @@ -3,8 +3,6 @@ import io.cucumber.core.backend.StepDefinition; import io.cucumber.core.exception.CucumberException; -import java.util.Objects; - import static java.util.Objects.requireNonNull; final class DuplicateStepDefinitionException extends CucumberException { @@ -18,8 +16,8 @@ private static String createMessage(StepDefinition a, StepDefinition b) { requireNonNull(b); return String.format("Duplicate step definitions in %s and %s", - a.getLocation(true), - b.getLocation(true) + a.getLocation(), + b.getLocation() ); } diff --git a/core/src/main/java/io/cucumber/core/runner/FailedPickleStepInstantiationMatch.java b/core/src/main/java/io/cucumber/core/runner/FailedPickleStepInstantiationMatch.java deleted file mode 100644 index a4d782f61a..0000000000 --- a/core/src/main/java/io/cucumber/core/runner/FailedPickleStepInstantiationMatch.java +++ /dev/null @@ -1,24 +0,0 @@ -package io.cucumber.core.runner; - -import io.cucumber.core.api.Scenario; -import io.cucumber.core.feature.CucumberStep; - -import java.util.Collections; - -final class FailedPickleStepInstantiationMatch extends PickleStepDefinitionMatch { - private final Throwable throwable; - - FailedPickleStepInstantiationMatch(String uri, CucumberStep step, Throwable throwable) { - super(Collections.emptyList(), new NoStepDefinition(), uri, step); - this.throwable = removeFrameworkFramesAndAppendStepLocation(throwable, getStepLocation()); - } - - @Override - public void runStep(Scenario scenario) throws Throwable { - throw throwable; - } - public void dryRunStep(Scenario scenario) throws Throwable { - runStep(scenario); - } - -} diff --git a/core/src/main/java/io/cucumber/core/runner/HookDefinitionMatch.java b/core/src/main/java/io/cucumber/core/runner/HookDefinitionMatch.java index 3c51d13561..d1a580bc33 100644 --- a/core/src/main/java/io/cucumber/core/runner/HookDefinitionMatch.java +++ b/core/src/main/java/io/cucumber/core/runner/HookDefinitionMatch.java @@ -1,6 +1,10 @@ package io.cucumber.core.runner; -import io.cucumber.core.api.Scenario; +import io.cucumber.core.backend.CucumberBackendException; +import io.cucumber.core.backend.CucumberInvocationTargetException; +import io.cucumber.core.exception.CucumberException; + +import static io.cucumber.core.runner.StackManipulation.removeFrameworkFrames; final class HookDefinitionMatch implements StepDefinitionMatch { private final CoreHookDefinition hookDefinition; @@ -10,18 +14,33 @@ final class HookDefinitionMatch implements StepDefinitionMatch { } @Override - public void runStep(Scenario scenario) throws Throwable { - hookDefinition.execute(scenario); + public void runStep(TestCaseState state) throws Throwable { + try { + hookDefinition.execute(state); + } catch (CucumberBackendException e) { + throw couldNotInvokeHook(e); + } catch (CucumberInvocationTargetException e) { + throw removeFrameworkFrames(e); + } + } + + private Throwable couldNotInvokeHook(CucumberBackendException e) { + return new CucumberException(String.format("" + + "Could not invoke hook defined at '%s'.\n" + + "It appears there was a problem with the hook definition.\n" + + "The details are in the stacktrace below.", //TODO: Add doc URL + hookDefinition.getLocation() + ), e); } @Override - public void dryRunStep(Scenario scenario) { + public void dryRunStep(TestCaseState state) { // Do nothing } @Override public String getCodeLocation() { - return hookDefinition.getLocation(false); + return hookDefinition.getLocation(); } } diff --git a/core/src/main/java/io/cucumber/core/runner/HookTestStep.java b/core/src/main/java/io/cucumber/core/runner/HookTestStep.java index b5aa510763..77b62ad8e6 100644 --- a/core/src/main/java/io/cucumber/core/runner/HookTestStep.java +++ b/core/src/main/java/io/cucumber/core/runner/HookTestStep.java @@ -1,8 +1,8 @@ package io.cucumber.core.runner; -import io.cucumber.core.event.HookType; +import io.cucumber.plugin.event.HookType; -final class HookTestStep extends TestStep implements io.cucumber.core.event.HookTestStep { +final class HookTestStep extends TestStep implements io.cucumber.plugin.event.HookTestStep { private final HookType hookType; HookTestStep(HookType hookType, HookDefinitionMatch definitionMatch) { diff --git a/core/src/main/java/io/cucumber/core/runner/NoStepDefinition.java b/core/src/main/java/io/cucumber/core/runner/NoStepDefinition.java index f085a076dc..88be1c9ec0 100644 --- a/core/src/main/java/io/cucumber/core/runner/NoStepDefinition.java +++ b/core/src/main/java/io/cucumber/core/runner/NoStepDefinition.java @@ -8,7 +8,7 @@ final class NoStepDefinition implements StepDefinition { @Override - public String getLocation(boolean detail) { + public String getLocation() { return null; } diff --git a/core/src/main/java/io/cucumber/core/runner/PickleStepDefinitionMatch.java b/core/src/main/java/io/cucumber/core/runner/PickleStepDefinitionMatch.java index 0f54050fd6..5f401631ad 100644 --- a/core/src/main/java/io/cucumber/core/runner/PickleStepDefinitionMatch.java +++ b/core/src/main/java/io/cucumber/core/runner/PickleStepDefinitionMatch.java @@ -1,6 +1,7 @@ package io.cucumber.core.runner; -import io.cucumber.core.api.Scenario; +import io.cucumber.core.backend.CucumberBackendException; +import io.cucumber.core.backend.CucumberInvocationTargetException; import io.cucumber.core.backend.ParameterInfo; import io.cucumber.core.backend.StepDefinition; import io.cucumber.core.exception.CucumberException; @@ -12,55 +13,89 @@ import java.util.ArrayList; import java.util.List; +import java.util.stream.Collectors; + +import static io.cucumber.core.runner.StackManipulation.removeFrameworkFrames; +import static io.cucumber.core.runner.StackManipulation.removeFrameworkFramesAndAppendStepLocation; class PickleStepDefinitionMatch extends Match implements StepDefinitionMatch { private final StepDefinition stepDefinition; - private final transient String uri; - // The official JSON gherkin format doesn't have a step attribute, so we're marking this as transient - // to prevent it from ending up in the JSON. - private final transient CucumberStep step; + private final String uri; + private final CucumberStep step; PickleStepDefinitionMatch(List arguments, StepDefinition stepDefinition, String uri, CucumberStep step) { - super(arguments, stepDefinition.getLocation(false)); + super(arguments, stepDefinition.getLocation()); this.stepDefinition = stepDefinition; this.uri = uri; this.step = step; } @Override - public void runStep(Scenario scenario) throws Throwable { - int argumentCount = getArguments().size(); - + public void runStep(TestCaseState state) throws Throwable { + List arguments = getArguments(); List parameterInfos = stepDefinition.parameterInfos(); - if (parameterInfos != null && argumentCount != parameterInfos.size()) { + if (parameterInfos != null && arguments.size() != parameterInfos.size()) { throw arityMismatch(parameterInfos.size()); } List result = new ArrayList<>(); try { - for (Argument argument : getArguments()) { + for (Argument argument : arguments) { result.add(argument.getValue()); } } catch (UndefinedDataTableTypeException e) { throw registerTypeInConfiguration(e); } catch (CucumberExpressionException | CucumberDataTableException e) { throw couldNotConvertArguments(e); + } catch (CucumberBackendException e) { + throw couldNotInvokeArgumentConversion(e); + } catch (CucumberInvocationTargetException e) { + throw removeFrameworkFrames(e); } - try { stepDefinition.execute(result.toArray(new Object[0])); - } catch (CucumberException e) { - throw e; - } catch (Throwable t) { - throw removeFrameworkFramesAndAppendStepLocation(t, getStepLocation()); + } catch (CucumberBackendException e) { + throw couldNotInvokeStep(e, result); + } catch (CucumberInvocationTargetException e) { + throw removeFrameworkFramesAndAppendStepLocation(e, getStepLocation()); } } + private Throwable couldNotInvokeStep(CucumberBackendException e, List result) { + String argumentTypes = createArgumentTypes(result); + return new CucumberException(String.format("" + + "Could not invoke step [%s] defined at '%s'.\n" + + "It appears there was a problem with the step definition.\n" + + "The converted arguments types were (" + argumentTypes + ")\n" + + "\n" + + "The details are in the stacktrace below.", //TODO: Add doc URL + stepDefinition.getPattern(), + stepDefinition.getLocation() + ), e); + } + + private Throwable couldNotInvokeArgumentConversion(CucumberBackendException e) { + return new CucumberException(String.format("" + + "Could not convert arguments for step [%s] defined at '%s'.\n" + + "It appears there was a problem with a hook or transformer definition. " + + "The details are in the stacktrace below.", //TODO: Add doc URL + stepDefinition.getPattern(), + stepDefinition.getLocation() + ), e); + } + + private String createArgumentTypes(List result) { + return result.stream() + .map(Object::getClass) + .map(Class::getName) + .collect(Collectors.joining(", ")); + } + private CucumberException registerTypeInConfiguration(Exception e) { return new CucumberException(String.format("" + "Could not convert arguments for step [%s] defined at '%s'.\n" + "It appears you did not register a data table type. The details are in the stacktrace below.", //TODO: Add doc URL stepDefinition.getPattern(), - stepDefinition.getLocation(true) + stepDefinition.getLocation() ), e); } @@ -70,12 +105,12 @@ private CucumberException couldNotConvertArguments(Exception e) { "Could not convert arguments for step [%s] defined at '%s'.\n" + "The details are in the stacktrace below.", stepDefinition.getPattern(), - stepDefinition.getLocation(true) + stepDefinition.getLocation() ), e); } @Override - public void dryRunStep(Scenario scenario) throws Throwable { + public void dryRunStep(TestCaseState state) throws Throwable { // Do nothing } @@ -86,7 +121,7 @@ private CucumberException arityMismatch(int parameterCount) { "However, the gherkin step has %s arguments%sStep text: %s", stepDefinition.getPattern(), parameterCount, - stepDefinition.getLocation(true), + stepDefinition.getLocation(), arguments.size(), formatArguments(arguments), step.getText() @@ -113,30 +148,11 @@ private List createArgumentsForErrorMessage() { return arguments; } - Throwable removeFrameworkFramesAndAppendStepLocation(Throwable error, StackTraceElement stepLocation) { - StackTraceElement[] stackTraceElements = error.getStackTrace(); - if (stackTraceElements.length == 0 || stepLocation == null) { - return error; - } - - int newStackTraceLength; - for (newStackTraceLength = 1; newStackTraceLength < stackTraceElements.length; ++newStackTraceLength) { - if (stepDefinition.isDefinedAt(stackTraceElements[newStackTraceLength - 1])) { - break; - } - } - StackTraceElement[] newStackTrace = new StackTraceElement[newStackTraceLength + 1]; - System.arraycopy(stackTraceElements, 0, newStackTrace, 0, newStackTraceLength); - newStackTrace[newStackTraceLength] = stepLocation; - error.setStackTrace(newStackTrace); - return error; - } - public String getPattern() { return stepDefinition.getPattern(); } - StackTraceElement getStepLocation() { + private StackTraceElement getStepLocation() { return new StackTraceElement("✽", step.getText(), uri, step.getStepLine()); } @@ -150,7 +166,7 @@ StepDefinition getStepDefinition() { @Override public String getCodeLocation() { - return stepDefinition.getLocation(false); + return stepDefinition.getLocation(); } } diff --git a/core/src/main/java/io/cucumber/core/runner/PickleStepTestStep.java b/core/src/main/java/io/cucumber/core/runner/PickleStepTestStep.java index bd56de676a..83c42346d5 100644 --- a/core/src/main/java/io/cucumber/core/runner/PickleStepTestStep.java +++ b/core/src/main/java/io/cucumber/core/runner/PickleStepTestStep.java @@ -1,15 +1,15 @@ package io.cucumber.core.runner; -import io.cucumber.core.event.Argument; -import io.cucumber.core.event.StepArgument; -import io.cucumber.core.event.TestCase; +import io.cucumber.plugin.event.Argument; +import io.cucumber.plugin.event.StepArgument; +import io.cucumber.plugin.event.TestCase; import io.cucumber.core.eventbus.EventBus; import io.cucumber.core.feature.CucumberStep; import java.util.Collections; import java.util.List; -final class PickleStepTestStep extends TestStep implements io.cucumber.core.event.PickleStepTestStep { +final class PickleStepTestStep extends TestStep implements io.cucumber.plugin.event.PickleStepTestStep { private final String uri; private final CucumberStep step; private final List afterStepHookSteps; @@ -35,17 +35,17 @@ final class PickleStepTestStep extends TestStep implements io.cucumber.core.even } @Override - boolean run(TestCase testCase, EventBus bus, Scenario scenario, boolean skipSteps) { + boolean run(TestCase testCase, EventBus bus, TestCaseState state, boolean skipSteps) { boolean skipNextStep = skipSteps; for (HookTestStep before : beforeStepHookSteps) { - skipNextStep |= before.run(testCase, bus, scenario, skipSteps); + skipNextStep |= before.run(testCase, bus, state, skipSteps); } - skipNextStep |= super.run(testCase, bus, scenario, skipNextStep); + skipNextStep |= super.run(testCase, bus, state, skipNextStep); for (HookTestStep after : afterStepHookSteps) { - skipNextStep |= after.run(testCase, bus, scenario, skipSteps); + skipNextStep |= after.run(testCase, bus, state, skipSteps); } return skipNextStep; diff --git a/core/src/main/java/io/cucumber/core/runner/Runner.java b/core/src/main/java/io/cucumber/core/runner/Runner.java index 843d2f1884..33a0b61fd8 100644 --- a/core/src/main/java/io/cucumber/core/runner/Runner.java +++ b/core/src/main/java/io/cucumber/core/runner/Runner.java @@ -3,15 +3,15 @@ import io.cucumber.core.api.TypeRegistryConfigurer; import io.cucumber.core.backend.Backend; import io.cucumber.core.backend.ObjectFactory; -import io.cucumber.core.event.HookType; -import io.cucumber.core.event.SnippetsSuggestedEvent; import io.cucumber.core.eventbus.EventBus; import io.cucumber.core.feature.CucumberPickle; import io.cucumber.core.feature.CucumberStep; import io.cucumber.core.logging.Logger; import io.cucumber.core.logging.LoggerFactory; import io.cucumber.core.snippets.SnippetGenerator; -import io.cucumber.core.stepexpression.TypeRegistry; +import io.cucumber.core.stepexpression.StepTypeRegistry; +import io.cucumber.plugin.event.HookType; +import io.cucumber.plugin.event.SnippetsSuggestedEvent; import java.net.URI; import java.util.ArrayList; @@ -55,12 +55,12 @@ public EventBus getBus() { public void runPickle(CucumberPickle pickle) { try { - TypeRegistry typeRegistry = createTypeRegistryForPickle(pickle); - snippetGenerators = createSnippetGeneratorsForPickle(typeRegistry); + StepTypeRegistry stepTypeRegistry = createTypeRegistryForPickle(pickle); + snippetGenerators = createSnippetGeneratorsForPickle(stepTypeRegistry); buildBackendWorlds(); // Java8 step definitions will be added to the glue here - glue.prepareGlue(typeRegistry); + glue.prepareGlue(stepTypeRegistry); TestCase testCase = createTestCaseForPickle(pickle); testCase.run(bus); @@ -70,21 +70,21 @@ public void runPickle(CucumberPickle pickle) { } } - private List createSnippetGeneratorsForPickle(TypeRegistry typeRegistry) { + private List createSnippetGeneratorsForPickle(StepTypeRegistry stepTypeRegistry) { return backends.stream() .map(Backend::getSnippet) - .map(s -> new SnippetGenerator(s, typeRegistry.parameterTypeRegistry())) + .map(s -> new SnippetGenerator(s, stepTypeRegistry.parameterTypeRegistry())) .collect(Collectors.toList()); } - private TypeRegistry createTypeRegistryForPickle(CucumberPickle pickle) { + private StepTypeRegistry createTypeRegistryForPickle(CucumberPickle pickle) { Locale locale = typeRegistryConfigurer.locale(); if (locale == null) { locale = new Locale(pickle.getLanguage()); } - TypeRegistry typeRegistry = new TypeRegistry(locale); - typeRegistryConfigurer.configureTypeRegistry(typeRegistry); - return typeRegistry; + StepTypeRegistry stepTypeRegistry = new StepTypeRegistry(locale); + typeRegistryConfigurer.configureTypeRegistry(stepTypeRegistry); + return stepTypeRegistry; } private TestCase createTestCaseForPickle(CucumberPickle pickle) { @@ -102,27 +102,7 @@ private List createTestStepsForPickleSteps(CucumberPickle pi List testSteps = new ArrayList<>(); for (CucumberStep step : pickle.getSteps()) { - PickleStepDefinitionMatch match; - try { - match = glue.stepDefinitionMatch(pickle.getUri(), step); - if (match == null) { - List snippets = new ArrayList<>(); - for (SnippetGenerator snippetGenerator : snippetGenerators) { - List snippet = snippetGenerator.getSnippet(step, runnerOptions.getSnippetType()); - snippets.addAll(snippet); - } - if (!snippets.isEmpty()) { - bus.send(new SnippetsSuggestedEvent(bus.getInstant(), pickle.getUri(), step.getStepLine(), snippets)); - } - match = new UndefinedPickleStepDefinitionMatch(pickle.getUri(), step); - } - } catch (AmbiguousStepDefinitionsException e) { - match = new AmbiguousPickleStepDefinitionsMatch(pickle.getUri(), step, e); - } catch (Throwable t) { - match = new FailedPickleStepInstantiationMatch(pickle.getUri(), step, t); - } - - + PickleStepDefinitionMatch match = matchStepToStepDefinition(pickle, step); List afterStepHookSteps = createAfterStepHooks(pickle.getTags()); List beforeStepHookSteps = createBeforeStepHooks(pickle.getTags()); testSteps.add(new PickleStepTestStep(pickle.getUri(), step, beforeStepHookSteps, afterStepHookSteps, match)); @@ -131,6 +111,31 @@ private List createTestStepsForPickleSteps(CucumberPickle pi return testSteps; } + private PickleStepDefinitionMatch matchStepToStepDefinition(CucumberPickle pickle, CucumberStep step) { + try { + PickleStepDefinitionMatch match = glue.stepDefinitionMatch(pickle.getUri(), step); + if (match != null) { + return match; + } + List snippets = generateSnippetsForStep(step); + if (!snippets.isEmpty()) { + bus.send(new SnippetsSuggestedEvent(bus.getInstant(), pickle.getUri(), step.getStepLine(), snippets)); + } + return new UndefinedPickleStepDefinitionMatch(pickle.getUri(), step); + } catch (AmbiguousStepDefinitionsException e) { + return new AmbiguousPickleStepDefinitionsMatch(pickle.getUri(), step, e); + } + } + + private List generateSnippetsForStep(CucumberStep step) { + List snippets = new ArrayList<>(); + for (SnippetGenerator snippetGenerator : snippetGenerators) { + List snippet = snippetGenerator.getSnippet(step, runnerOptions.getSnippetType()); + snippets.addAll(snippet); + } + return snippets; + } + private List createTestStepsForBeforeHooks(List tags) { return createTestStepsForHooks(tags, glue.getBeforeHooks(), HookType.BEFORE); } diff --git a/core/src/main/java/io/cucumber/core/runner/ScenarioScoped.java b/core/src/main/java/io/cucumber/core/runner/ScenarioScoped.java deleted file mode 100644 index f0c27adcef..0000000000 --- a/core/src/main/java/io/cucumber/core/runner/ScenarioScoped.java +++ /dev/null @@ -1,8 +0,0 @@ -package io.cucumber.core.runner; - -public interface ScenarioScoped { - /** - * Dispose references to Runtime world to allow garbage collection to run. - */ - void disposeScenarioScope(); -} diff --git a/core/src/main/java/io/cucumber/core/runner/StackManipulation.java b/core/src/main/java/io/cucumber/core/runner/StackManipulation.java new file mode 100644 index 0000000000..3ece0559f2 --- /dev/null +++ b/core/src/main/java/io/cucumber/core/runner/StackManipulation.java @@ -0,0 +1,58 @@ +package io.cucumber.core.runner; + +import io.cucumber.core.backend.CucumberInvocationTargetException; +import io.cucumber.core.backend.Located; + +final class StackManipulation { + private StackManipulation(){ + + } + + static Throwable removeFrameworkFrames(CucumberInvocationTargetException invocationException) { + Throwable error = invocationException.getInvocationTargetExceptionCause(); + StackTraceElement[] stackTraceElements = error.getStackTrace(); + Located located = invocationException.getLocated(); + + int newStackTraceLength = findIndexOf(located, stackTraceElements); + if (newStackTraceLength == -1) { + return error; + } + + StackTraceElement[] newStackTrace = new StackTraceElement[newStackTraceLength]; + System.arraycopy(stackTraceElements, 0, newStackTrace, 0, newStackTraceLength); + error.setStackTrace(newStackTrace); + return error; + } + + private static int findIndexOf(Located located, StackTraceElement[] stackTraceElements) { + if (stackTraceElements.length == 0) { + return -1; + } + + int newStackTraceLength; + for (newStackTraceLength = 1; newStackTraceLength < stackTraceElements.length; ++newStackTraceLength) { + if (located.isDefinedAt(stackTraceElements[newStackTraceLength - 1])) { + break; + } + } + return newStackTraceLength; + } + + static Throwable removeFrameworkFramesAndAppendStepLocation(CucumberInvocationTargetException invocationException, StackTraceElement stepLocation) { + Located located = invocationException.getLocated(); + Throwable error = invocationException.getInvocationTargetExceptionCause(); + if (stepLocation == null) { + return error; + } + StackTraceElement[] stackTraceElements = error.getStackTrace(); + int newStackTraceLength = findIndexOf(located, stackTraceElements); + if (newStackTraceLength == -1) { + return error; + } + StackTraceElement[] newStackTrace = new StackTraceElement[newStackTraceLength + 1]; + System.arraycopy(stackTraceElements, 0, newStackTrace, 0, newStackTraceLength); + newStackTrace[newStackTraceLength] = stepLocation; + error.setStackTrace(newStackTrace); + return error; + } +} diff --git a/core/src/main/java/io/cucumber/core/runner/StepDefinitionMatch.java b/core/src/main/java/io/cucumber/core/runner/StepDefinitionMatch.java index a2513c8c52..7cad01a152 100644 --- a/core/src/main/java/io/cucumber/core/runner/StepDefinitionMatch.java +++ b/core/src/main/java/io/cucumber/core/runner/StepDefinitionMatch.java @@ -1,11 +1,9 @@ package io.cucumber.core.runner; -import io.cucumber.core.api.Scenario; - interface StepDefinitionMatch { - void runStep(Scenario scenario) throws Throwable; + void runStep(TestCaseState state) throws Throwable; - void dryRunStep(Scenario scenario) throws Throwable; + void dryRunStep(TestCaseState state) throws Throwable; String getCodeLocation(); diff --git a/core/src/main/java/io/cucumber/core/runner/TestCase.java b/core/src/main/java/io/cucumber/core/runner/TestCase.java index c34a1553af..8dcdf9d6aa 100644 --- a/core/src/main/java/io/cucumber/core/runner/TestCase.java +++ b/core/src/main/java/io/cucumber/core/runner/TestCase.java @@ -1,11 +1,12 @@ package io.cucumber.core.runner; -import io.cucumber.core.event.Result; -import io.cucumber.core.event.TestCaseFinished; -import io.cucumber.core.event.TestCaseStarted; -import io.cucumber.core.event.TestStep; import io.cucumber.core.eventbus.EventBus; import io.cucumber.core.feature.CucumberPickle; +import io.cucumber.plugin.event.Result; +import io.cucumber.plugin.event.Status; +import io.cucumber.plugin.event.TestCaseFinished; +import io.cucumber.plugin.event.TestCaseStarted; +import io.cucumber.plugin.event.TestStep; import java.net.URI; import java.time.Duration; @@ -13,7 +14,7 @@ import java.util.ArrayList; import java.util.List; -final class TestCase implements io.cucumber.core.event.TestCase { +final class TestCase implements io.cucumber.plugin.event.TestCase { private final CucumberPickle pickle; private final List testSteps; private final boolean dryRun; @@ -21,10 +22,10 @@ final class TestCase implements io.cucumber.core.event.TestCase { private final List afterHooks; TestCase(List testSteps, - List beforeHooks, - List afterHooks, + List beforeHooks, + List afterHooks, CucumberPickle pickle, - boolean dryRun) { + boolean dryRun) { this.testSteps = testSteps; this.beforeHooks = beforeHooks; this.afterHooks = afterHooks; @@ -34,24 +35,27 @@ final class TestCase implements io.cucumber.core.event.TestCase { void run(EventBus bus) { boolean skipNextStep = this.dryRun; - Instant startTimeInstant = bus.getInstant(); - bus.send(new TestCaseStarted(startTimeInstant, this)); - Scenario scenario = new Scenario(bus, this); + Instant start = bus.getInstant(); + bus.send(new TestCaseStarted(start, this)); + TestCaseState state = new TestCaseState(bus, this); for (HookTestStep before : beforeHooks) { - skipNextStep |= before.run(this, bus, scenario, dryRun); + skipNextStep |= before.run(this, bus, state, dryRun); } for (PickleStepTestStep step : testSteps) { - skipNextStep |= step.run(this, bus, scenario, skipNextStep); + skipNextStep |= step.run(this, bus, state, skipNextStep); } for (HookTestStep after : afterHooks) { - after.run(this, bus, scenario, dryRun); + after.run(this, bus, state, dryRun); } - Instant stopTimeInstant = bus.getInstant(); - bus.send(new TestCaseFinished(stopTimeInstant, this, new Result(scenario.getStatus(), Duration.between(startTimeInstant, stopTimeInstant), scenario.getError()))); + Instant stop = bus.getInstant(); + Duration duration = Duration.between(start, stop); + Status status = Status.valueOf(state.getStatus().name()); + Result result = new Result(status, duration, state.getError()); + bus.send(new TestCaseFinished(stop, this, result)); } @Override @@ -81,6 +85,7 @@ public String getUri() { return pickle.getUri(); } + @Override public Integer getLine() { return pickle.getLine(); } diff --git a/core/src/main/java/io/cucumber/core/runner/Scenario.java b/core/src/main/java/io/cucumber/core/runner/TestCaseState.java similarity index 79% rename from core/src/main/java/io/cucumber/core/runner/Scenario.java rename to core/src/main/java/io/cucumber/core/runner/TestCaseState.java index 44a5edf2cd..50d937f1cf 100644 --- a/core/src/main/java/io/cucumber/core/runner/Scenario.java +++ b/core/src/main/java/io/cucumber/core/runner/TestCaseState.java @@ -1,8 +1,11 @@ package io.cucumber.core.runner; -import io.cucumber.core.event.TestCase; -import io.cucumber.core.event.*; +import io.cucumber.core.backend.Status; import io.cucumber.core.eventbus.EventBus; +import io.cucumber.plugin.event.EmbedEvent; +import io.cucumber.plugin.event.Result; +import io.cucumber.plugin.event.TestCase; +import io.cucumber.plugin.event.WriteEvent; import java.util.ArrayList; import java.util.Collection; @@ -12,13 +15,13 @@ import static java.util.Comparator.comparing; import static java.util.Objects.requireNonNull; -class Scenario implements io.cucumber.core.api.Scenario { +class TestCaseState implements io.cucumber.core.backend.TestCaseState { private final List stepResults = new ArrayList<>(); private final EventBus bus; private final TestCase testCase; - Scenario(EventBus bus, io.cucumber.core.event.TestCase testCase) { + TestCaseState(EventBus bus, TestCase testCase) { this.bus = requireNonNull(bus); this.testCase = requireNonNull(testCase); } @@ -38,7 +41,8 @@ public Status getStatus() { return Status.UNDEFINED; } - return max(stepResults, comparing(Result::getStatus)).getStatus(); + Result mostSevereResult = max(stepResults, comparing(Result::getStatus)); + return Status.valueOf(mostSevereResult.getStatus().name()); } @Override @@ -46,6 +50,7 @@ public boolean isFailed() { return getStatus() == Status.FAILED; } + @Deprecated @Override public void embed(byte[] data, String mimeType) { bus.send(new EmbedEvent(bus.getInstant(), testCase, data, mimeType)); diff --git a/core/src/main/java/io/cucumber/core/runner/TestStep.java b/core/src/main/java/io/cucumber/core/runner/TestStep.java index 751d5742a3..94d943ca22 100644 --- a/core/src/main/java/io/cucumber/core/runner/TestStep.java +++ b/core/src/main/java/io/cucumber/core/runner/TestStep.java @@ -1,11 +1,11 @@ package io.cucumber.core.runner; import io.cucumber.core.backend.Pending; -import io.cucumber.core.event.Result; -import io.cucumber.core.event.Status; -import io.cucumber.core.event.TestCase; -import io.cucumber.core.event.TestStepFinished; -import io.cucumber.core.event.TestStepStarted; +import io.cucumber.plugin.event.Result; +import io.cucumber.plugin.event.Status; +import io.cucumber.plugin.event.TestCase; +import io.cucumber.plugin.event.TestStepFinished; +import io.cucumber.plugin.event.TestStepStarted; import io.cucumber.core.eventbus.EventBus; import java.time.Duration; @@ -14,7 +14,7 @@ import static java.time.Duration.ZERO; -abstract class TestStep implements io.cucumber.core.event.TestStep { +abstract class TestStep implements io.cucumber.plugin.event.TestStep { private static final String[] ASSUMPTION_VIOLATED_EXCEPTIONS = { "org.junit.AssumptionViolatedException", "org.junit.internal.AssumptionViolatedException", @@ -37,30 +37,30 @@ public String getCodeLocation() { return stepDefinitionMatch.getCodeLocation(); } - boolean run(TestCase testCase, EventBus bus, Scenario scenario, boolean skipSteps) { + boolean run(TestCase testCase, EventBus bus, TestCaseState state, boolean skipSteps) { Instant startTimeMillis = bus.getInstant(); bus.send(new TestStepStarted(startTimeMillis, testCase, this)); Status status; Throwable error = null; try { - status = executeStep(scenario, skipSteps); + status = executeStep(state, skipSteps); } catch (Throwable t) { error = t; status = mapThrowableToStatus(t); } Instant stopTimeNanos = bus.getInstant(); Result result = mapStatusToResult(status, error, Duration.between(startTimeMillis, stopTimeNanos)); - scenario.add(result); + state.add(result); bus.send(new TestStepFinished(stopTimeNanos, testCase, this, result)); return !result.getStatus().is(Status.PASSED); } - private Status executeStep(Scenario scenario, boolean skipSteps) throws Throwable { + private Status executeStep(TestCaseState state, boolean skipSteps) throws Throwable { if (!skipSteps) { - stepDefinitionMatch.runStep(scenario); + stepDefinitionMatch.runStep(state); return Status.PASSED; } else { - stepDefinitionMatch.dryRunStep(scenario); + stepDefinitionMatch.dryRunStep(state); return Status.SKIPPED; } } diff --git a/core/src/main/java/io/cucumber/core/runner/UndefinedPickleStepDefinitionMatch.java b/core/src/main/java/io/cucumber/core/runner/UndefinedPickleStepDefinitionMatch.java index f6e7c479f5..f9506facac 100644 --- a/core/src/main/java/io/cucumber/core/runner/UndefinedPickleStepDefinitionMatch.java +++ b/core/src/main/java/io/cucumber/core/runner/UndefinedPickleStepDefinitionMatch.java @@ -1,6 +1,5 @@ package io.cucumber.core.runner; -import io.cucumber.core.api.Scenario; import io.cucumber.core.feature.CucumberStep; import java.util.Collections; @@ -12,13 +11,13 @@ final class UndefinedPickleStepDefinitionMatch extends PickleStepDefinitionMatch } @Override - public void runStep(Scenario scenario) { + public void runStep(TestCaseState state) { throw new UndefinedStepDefinitionException(); } @Override - public void dryRunStep(Scenario scenario) { - runStep(scenario); + public void dryRunStep(TestCaseState state) { + runStep(state); } } diff --git a/core/src/main/java/io/cucumber/core/runtime/BackendServiceLoader.java b/core/src/main/java/io/cucumber/core/runtime/BackendServiceLoader.java index 9404c4172e..5858c0eb66 100644 --- a/core/src/main/java/io/cucumber/core/runtime/BackendServiceLoader.java +++ b/core/src/main/java/io/cucumber/core/runtime/BackendServiceLoader.java @@ -4,12 +4,12 @@ import io.cucumber.core.backend.BackendProviderService; import io.cucumber.core.backend.ObjectFactory; import io.cucumber.core.exception.CucumberException; -import io.cucumber.core.io.ResourceLoader; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.ServiceLoader; +import java.util.function.Supplier; /** * Supplies instances of {@link Backend} created by using a {@link ServiceLoader} @@ -17,11 +17,11 @@ */ public final class BackendServiceLoader implements BackendSupplier { - private final ResourceLoader resourceLoader; + private final Supplier classLoaderSupplier; private final ObjectFactorySupplier objectFactorySupplier; - public BackendServiceLoader(ResourceLoader resourceLoader, ObjectFactorySupplier objectFactorySupplier) { - this.resourceLoader = resourceLoader; + public BackendServiceLoader(Supplier classLoaderSupplier, ObjectFactorySupplier objectFactorySupplier) { + this.classLoaderSupplier = classLoaderSupplier; this.objectFactorySupplier = objectFactorySupplier; } @@ -42,7 +42,7 @@ private Collection loadBackends(Iterable backends = new ArrayList<>(); for (BackendProviderService backendProviderService : serviceLoader) { ObjectFactory objectFactory = objectFactorySupplier.get(); - backends.add(backendProviderService.create(objectFactory, objectFactory, resourceLoader)); + backends.add(backendProviderService.create(objectFactory, objectFactory, classLoaderSupplier)); } return backends; } diff --git a/core/src/main/java/io/cucumber/core/runtime/Invoker.java b/core/src/main/java/io/cucumber/core/runtime/Invoker.java deleted file mode 100644 index b80f4fe1f6..0000000000 --- a/core/src/main/java/io/cucumber/core/runtime/Invoker.java +++ /dev/null @@ -1,120 +0,0 @@ -package io.cucumber.core.runtime; - -import io.cucumber.core.exception.CucumberException; -import io.cucumber.core.reflection.MethodFormat; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.ScheduledFuture; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; -import java.util.concurrent.atomic.AtomicBoolean; - -public final class Invoker { - - private Invoker() { - - } - - static T timeout(Callback callback, long timeoutMillis) throws Throwable { - if (timeoutMillis == 0) { - return callback.call(); - } - - /* We need to ensure a happens before relation exists between these events; - * a. the timer setting the interrupt flag on the execution thread. - * b. terminating and cleaning up the timer - * To do this we synchronize on monitor. The atomic boolean is merely a convenient container. - */ - final Thread executionThread = Thread.currentThread(); - final Object monitor = new Object(); - final AtomicBoolean done = new AtomicBoolean(); - - ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor(); - ScheduledFuture timer = executorService.schedule(() -> { - synchronized (monitor) { - if (!done.get()) { - executionThread.interrupt(); - } - } - }, timeoutMillis, TimeUnit.MILLISECONDS); - - try { - T result = callback.call(); - // The callback may have been busy waiting. - if (Thread.interrupted()) { - throw new TimeoutException("Timed out after " + timeoutMillis + "ms."); - } - return result; - } catch (InterruptedException timeout) { - throw new TimeoutException("Timed out after " + timeoutMillis + "ms."); - } finally { - synchronized (monitor) { - done.set(true); - timer.cancel(true); - executorService.shutdownNow(); - // Clear the interrupted flag. It may have been set by the timer just before we returned the result. - Thread.interrupted(); - } - } - } - - /** - * @deprecated timeout has been deprecated in favour of library solutions used by the end user. - */ - @Deprecated - public static Object invoke(Object target, Method method, long timeoutMillis, Object... args) throws Throwable { - Method targetMethod = targetMethod(target, method); - return timeout(() -> Invoker.invoke(target, targetMethod, args), timeoutMillis); - } - - public static Object invoke(Object target, Method targetMethod, Object... args) throws Throwable { - boolean accessible = targetMethod.isAccessible(); - try { - targetMethod.setAccessible(true); - return targetMethod.invoke(target, args); - } catch (IllegalArgumentException | IllegalAccessException e) { - throw new CucumberException("Failed to invoke " + MethodFormat.FULL.format(targetMethod) + - ", caused by " + e.getClass().getName() + ": " + e.getMessage(), e); - } catch (InvocationTargetException e) { - throw e.getTargetException(); - } finally { - targetMethod.setAccessible(accessible); - } - } - - private static Method targetMethod(Object target, Method method) throws NoSuchMethodException { - Class targetClass = target.getClass(); - Class declaringClass = method.getDeclaringClass(); - - // Immediately return the provided method if the class loaders are the same. - if (targetClass.getClassLoader().equals(declaringClass.getClassLoader())) { - return method; - } else { - // Check if the method is publicly accessible. Note that methods from interfaces are always public. - if (Modifier.isPublic(method.getModifiers())) { - return targetClass.getMethod(method.getName(), method.getParameterTypes()); - } - - // Loop through all the super classes until the declared method is found. - Class currentClass = targetClass; - while (currentClass != Object.class) { - try { - return currentClass.getDeclaredMethod(method.getName(), method.getParameterTypes()); - } catch (NoSuchMethodException e) { - currentClass = currentClass.getSuperclass(); - } - } - - // The method does not exist in the class hierarchy. - throw new NoSuchMethodException(String.valueOf(method)); - } - } - - interface Callback { - T call() throws Throwable; - } -} diff --git a/core/src/main/java/io/cucumber/core/backend/ObjectFactoryServiceLoader.java b/core/src/main/java/io/cucumber/core/runtime/ObjectFactoryServiceLoader.java similarity index 96% rename from core/src/main/java/io/cucumber/core/backend/ObjectFactoryServiceLoader.java rename to core/src/main/java/io/cucumber/core/runtime/ObjectFactoryServiceLoader.java index aaa8259d75..2a7719c4c8 100644 --- a/core/src/main/java/io/cucumber/core/backend/ObjectFactoryServiceLoader.java +++ b/core/src/main/java/io/cucumber/core/runtime/ObjectFactoryServiceLoader.java @@ -1,5 +1,7 @@ -package io.cucumber.core.backend; +package io.cucumber.core.runtime; +import io.cucumber.core.backend.ObjectFactory; +import io.cucumber.core.backend.Options; import io.cucumber.core.exception.CucumberException; import java.lang.reflect.Constructor; @@ -30,7 +32,7 @@ public ObjectFactoryServiceLoader(Options options) { * * @return an instance of {@link ObjectFactory} */ - public ObjectFactory loadObjectFactory() { + ObjectFactory loadObjectFactory() { Class objectFactoryClass = this.options.getObjectFactoryClass(); final ServiceLoader loader = ServiceLoader.load(ObjectFactory.class); diff --git a/core/src/main/java/io/cucumber/core/runtime/Runtime.java b/core/src/main/java/io/cucumber/core/runtime/Runtime.java index 5cd5b81c9a..5cf61071ce 100644 --- a/core/src/main/java/io/cucumber/core/runtime/Runtime.java +++ b/core/src/main/java/io/cucumber/core/runtime/Runtime.java @@ -1,14 +1,5 @@ package io.cucumber.core.runtime; -import io.cucumber.core.backend.ObjectFactoryServiceLoader; -import io.cucumber.core.event.EventHandler; -import io.cucumber.core.event.EventPublisher; -import io.cucumber.core.event.Result; -import io.cucumber.core.event.Status; -import io.cucumber.core.event.TestCaseFinished; -import io.cucumber.core.event.TestRunFinished; -import io.cucumber.core.event.TestRunStarted; -import io.cucumber.core.event.TestSourceRead; import io.cucumber.core.eventbus.EventBus; import io.cucumber.core.exception.CompositeCucumberException; import io.cucumber.core.exception.CucumberException; @@ -24,10 +15,18 @@ import io.cucumber.core.logging.LoggerFactory; import io.cucumber.core.options.RuntimeOptions; import io.cucumber.core.order.PickleOrder; -import io.cucumber.core.plugin.ConcurrentEventListener; -import io.cucumber.core.plugin.Plugin; import io.cucumber.core.plugin.PluginFactory; import io.cucumber.core.plugin.Plugins; +import io.cucumber.plugin.event.EventHandler; +import io.cucumber.plugin.event.EventPublisher; +import io.cucumber.plugin.event.Result; +import io.cucumber.plugin.event.Status; +import io.cucumber.plugin.event.TestCaseFinished; +import io.cucumber.plugin.event.TestRunFinished; +import io.cucumber.plugin.event.TestRunStarted; +import io.cucumber.plugin.event.TestSourceRead; +import io.cucumber.plugin.ConcurrentEventListener; +import io.cucumber.plugin.Plugin; import java.time.Clock; import java.util.ArrayList; @@ -197,7 +196,7 @@ public Runtime build() { final BackendSupplier backendSupplier = this.backendSupplier != null ? this.backendSupplier - : new BackendServiceLoader(resourceLoader, objectFactorySupplier); + : new BackendServiceLoader(() -> this.classLoader, objectFactorySupplier); final Plugins plugins = new Plugins(new PluginFactory(), runtimeOptions); for (final Plugin plugin : additionalPlugins) { diff --git a/core/src/main/java/io/cucumber/core/runtime/SingletonObjectFactorySupplier.java b/core/src/main/java/io/cucumber/core/runtime/SingletonObjectFactorySupplier.java index f970341e82..2adbd4418c 100644 --- a/core/src/main/java/io/cucumber/core/runtime/SingletonObjectFactorySupplier.java +++ b/core/src/main/java/io/cucumber/core/runtime/SingletonObjectFactorySupplier.java @@ -1,7 +1,6 @@ package io.cucumber.core.runtime; import io.cucumber.core.backend.ObjectFactory; -import io.cucumber.core.backend.ObjectFactoryServiceLoader; public final class SingletonObjectFactorySupplier implements ObjectFactorySupplier { diff --git a/core/src/main/java/io/cucumber/core/runtime/ThreadLocalObjectFactorySupplier.java b/core/src/main/java/io/cucumber/core/runtime/ThreadLocalObjectFactorySupplier.java index 9ae6eff736..3b9c6e8e32 100644 --- a/core/src/main/java/io/cucumber/core/runtime/ThreadLocalObjectFactorySupplier.java +++ b/core/src/main/java/io/cucumber/core/runtime/ThreadLocalObjectFactorySupplier.java @@ -2,7 +2,6 @@ import io.cucumber.core.backend.ObjectFactory; -import io.cucumber.core.backend.ObjectFactoryServiceLoader; import static java.lang.ThreadLocal.withInitial; import static java.util.Objects.requireNonNull; diff --git a/core/src/main/java/io/cucumber/core/runtime/ThreadLocalRunnerSupplier.java b/core/src/main/java/io/cucumber/core/runtime/ThreadLocalRunnerSupplier.java index cc0e6db910..ee6769e24c 100644 --- a/core/src/main/java/io/cucumber/core/runtime/ThreadLocalRunnerSupplier.java +++ b/core/src/main/java/io/cucumber/core/runtime/ThreadLocalRunnerSupplier.java @@ -1,7 +1,7 @@ package io.cucumber.core.runtime; -import io.cucumber.core.event.Event; -import io.cucumber.core.event.EventHandler; +import io.cucumber.plugin.event.Event; +import io.cucumber.plugin.event.EventHandler; import io.cucumber.core.eventbus.AbstractEventBus; import io.cucumber.core.eventbus.EventBus; import io.cucumber.core.runner.Options; diff --git a/core/src/main/java/io/cucumber/core/snippets/SnippetGenerator.java b/core/src/main/java/io/cucumber/core/snippets/SnippetGenerator.java index 0cdad138ab..195fcc3b34 100644 --- a/core/src/main/java/io/cucumber/core/snippets/SnippetGenerator.java +++ b/core/src/main/java/io/cucumber/core/snippets/SnippetGenerator.java @@ -1,6 +1,7 @@ package io.cucumber.core.snippets; -import io.cucumber.core.event.DataTableArgument; +import io.cucumber.plugin.event.DataTableArgument; +import io.cucumber.core.backend.Snippet; import io.cucumber.core.feature.CucumberStep; import io.cucumber.core.feature.DocStringArgument; import io.cucumber.cucumberexpressions.CucumberExpressionGenerator; diff --git a/core/src/main/java/io/cucumber/core/stepexpression/Argument.java b/core/src/main/java/io/cucumber/core/stepexpression/Argument.java index 745df56f01..7c7ae80f88 100644 --- a/core/src/main/java/io/cucumber/core/stepexpression/Argument.java +++ b/core/src/main/java/io/cucumber/core/stepexpression/Argument.java @@ -4,4 +4,6 @@ public interface Argument { Object getValue(); + String toString(); + } diff --git a/core/src/main/java/io/cucumber/core/stepexpression/StepExpressionFactory.java b/core/src/main/java/io/cucumber/core/stepexpression/StepExpressionFactory.java index ce35a91841..c6a5bc49e4 100644 --- a/core/src/main/java/io/cucumber/core/stepexpression/StepExpressionFactory.java +++ b/core/src/main/java/io/cucumber/core/stepexpression/StepExpressionFactory.java @@ -2,6 +2,7 @@ import io.cucumber.core.exception.CucumberException; import io.cucumber.cucumberexpressions.Expression; +import io.cucumber.cucumberexpressions.ExpressionFactory; import io.cucumber.cucumberexpressions.UndefinedParameterTypeException; import io.cucumber.datatable.DataTable; import io.cucumber.datatable.DataTableTypeRegistryTableConverter; @@ -10,15 +11,16 @@ import java.lang.reflect.Type; import java.util.List; +import java.util.function.Supplier; public final class StepExpressionFactory { - private final io.cucumber.cucumberexpressions.ExpressionFactory expressionFactory; + private final ExpressionFactory expressionFactory; private final DataTableTypeRegistryTableConverter tableConverter; private final DocStringTypeRegistryDocStringConverter docStringConverter; - public StepExpressionFactory(TypeRegistry registry) { - this.expressionFactory = new io.cucumber.cucumberexpressions.ExpressionFactory(registry.parameterTypeRegistry()); + public StepExpressionFactory(StepTypeRegistry registry) { + this.expressionFactory = new ExpressionFactory(registry.parameterTypeRegistry()); this.tableConverter = new DataTableTypeRegistryTableConverter(registry.dataTableTypeRegistry()); this.docStringConverter = new DocStringTypeRegistryDocStringConverter(registry.docStringTypeRegistry()); } @@ -33,18 +35,18 @@ public StepExpression createExpression(String expressionString) { } public StepExpression createExpression(String expressionString, Type tableOrDocStringType) { - return createExpression(expressionString, new ResolvedType(tableOrDocStringType), false); + return createExpression(expressionString, () -> tableOrDocStringType, false); } - public StepExpression createExpression(String expressionString, TypeResolver tableOrDocStringType) { + public StepExpression createExpression(String expressionString, Supplier tableOrDocStringType) { return createExpression(expressionString, tableOrDocStringType, false); } - public StepExpression createExpression(String expressionString, final Type tableOrDocStringType, final boolean transpose) { - return createExpression(expressionString, new ResolvedType(tableOrDocStringType), transpose); + public StepExpression createExpression(String expressionString, Type tableOrDocStringType, boolean transpose) { + return createExpression(expressionString, () -> tableOrDocStringType, transpose); } - public StepExpression createExpression(String expressionString, final TypeResolver tableOrDocStringType, final boolean transpose) { + public StepExpression createExpression(String expressionString, Supplier tableOrDocStringType, boolean transpose) { if (expressionString == null) throw new NullPointerException("expressionString can not be null"); if (tableOrDocStringType == null) throw new NullPointerException("tableOrDocStringType can not be null"); @@ -57,13 +59,13 @@ public StepExpression createExpression(String expressionString, final TypeResolv RawTableTransformer tableTransform = (List> raw) -> { DataTable dataTable = DataTable.create(raw, StepExpressionFactory.this.tableConverter); - Type targetType = tableOrDocStringType.resolve(); + Type targetType = tableOrDocStringType.get(); return dataTable.convert(Object.class.equals(targetType) ? DataTable.class : targetType, transpose); }; DocStringTransformer docStringTransform = (text, contentType) -> { DocString docString = DocString.create(text, contentType, docStringConverter); - Type targetType = tableOrDocStringType.resolve(); + Type targetType = tableOrDocStringType.get(); return docString.convert(Object.class.equals(targetType) ? DocString.class : targetType); }; return new StepExpression(expression, docStringTransform, tableTransform); @@ -77,19 +79,4 @@ private CucumberException registerTypeInConfiguration(String expressionString, U expressionString ), e); } - - private static final class ResolvedType implements TypeResolver { - - private final Type type; - - private ResolvedType(Type type) { - this.type = type; - } - - @Override - public Type resolve() { - return type; - } - } - } diff --git a/core/src/main/java/io/cucumber/core/stepexpression/TypeRegistry.java b/core/src/main/java/io/cucumber/core/stepexpression/StepTypeRegistry.java similarity index 95% rename from core/src/main/java/io/cucumber/core/stepexpression/TypeRegistry.java rename to core/src/main/java/io/cucumber/core/stepexpression/StepTypeRegistry.java index dd4d94fe03..29c0fb5ed5 100644 --- a/core/src/main/java/io/cucumber/core/stepexpression/TypeRegistry.java +++ b/core/src/main/java/io/cucumber/core/stepexpression/StepTypeRegistry.java @@ -12,7 +12,7 @@ import java.util.Locale; -public final class TypeRegistry implements io.cucumber.core.api.TypeRegistry { +public final class StepTypeRegistry implements io.cucumber.core.api.TypeRegistry { private final ParameterTypeRegistry parameterTypeRegistry; @@ -21,7 +21,7 @@ public final class TypeRegistry implements io.cucumber.core.api.TypeRegistry { private final DocStringTypeRegistry docStringTypeRegistry; - public TypeRegistry(Locale locale) { + public StepTypeRegistry(Locale locale) { parameterTypeRegistry = new ParameterTypeRegistry(locale); dataTableTypeRegistry = new DataTableTypeRegistry(locale); docStringTypeRegistry = new DocStringTypeRegistry(); diff --git a/core/src/main/java/io/cucumber/core/stepexpression/TypeResolver.java b/core/src/main/java/io/cucumber/core/stepexpression/TypeResolver.java deleted file mode 100644 index 0ae6777cb7..0000000000 --- a/core/src/main/java/io/cucumber/core/stepexpression/TypeResolver.java +++ /dev/null @@ -1,19 +0,0 @@ -package io.cucumber.core.stepexpression; - -import java.lang.reflect.Type; - -/** - * Allows lazy resolution of the type of a data table or doc string. - */ -public interface TypeResolver { - - /** - * A type to data convert the table or doc string to. May not return null. - *

- * When the {@link Object} type is returned no transform will be applied. - * - * @return a type - */ - Type resolve(); - -} diff --git a/core/src/main/resources/io/cucumber/core/plugin/timeline/chosen.jquery.min.js b/core/src/main/resources/io/cucumber/core/plugin/timeline/chosen.jquery.min.js index b6d181f6fb..4ad164751d 100755 --- a/core/src/main/resources/io/cucumber/core/plugin/timeline/chosen.jquery.min.js +++ b/core/src/main/resources/io/cucumber/core/plugin/timeline/chosen.jquery.min.js @@ -1,3 +1,3 @@ -/* Chosen v1.8.5 | (c) 2011-2018 by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */ +/* Chosen v1.8.7 | (c) 2011-2018 by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */ -(function(){var t,e,s,i,n=function(t,e){return function(){return t.apply(e,arguments)}},o=function(t,e){function s(){this.constructor=t}for(var i in e)r.call(e,i)&&(t[i]=e[i]);return s.prototype=e.prototype,t.prototype=new s,t.__super__=e.prototype,t},r={}.hasOwnProperty;(i=function(){function t(){this.options_index=0,this.parsed=[]}return t.prototype.add_node=function(t){return"OPTGROUP"===t.nodeName.toUpperCase()?this.add_group(t):this.add_option(t)},t.prototype.add_group=function(t){var e,s,i,n,o,r;for(e=this.parsed.length,this.parsed.push({array_index:e,group:!0,label:t.label,title:t.title?t.title:void 0,children:0,disabled:t.disabled,classes:t.className}),r=[],s=0,i=(o=t.childNodes).length;s"+t.group_label+""+t.html:t.html},t.prototype.mouse_enter=function(){return this.mouse_on_container=!0},t.prototype.mouse_leave=function(){return this.mouse_on_container=!1},t.prototype.input_focus=function(t){if(this.is_multiple){if(!this.active_field)return setTimeout(function(t){return function(){return t.container_mousedown()}}(this),50)}else if(!this.active_field)return this.activate_field()},t.prototype.input_blur=function(t){if(!this.mouse_on_container)return this.active_field=!1,setTimeout(function(t){return function(){return t.blur_test()}}(this),100)},t.prototype.label_click_handler=function(t){return this.is_multiple?this.container_mousedown(t):this.activate_field()},t.prototype.results_option_build=function(t){var e,s,i,n,o,r,h;for(e="",h=0,n=0,o=(r=this.results_data).length;n=this.max_shown_results));n++);return e},t.prototype.result_add_option=function(t){var e,s;return t.search_match&&this.include_option_in_results(t)?(e=[],t.disabled||t.selected&&this.is_multiple||e.push("active-result"),!t.disabled||t.selected&&this.is_multiple||e.push("disabled-result"),t.selected&&e.push("result-selected"),null!=t.group_array_index&&e.push("group-option"),""!==t.classes&&e.push(t.classes),s=document.createElement("li"),s.className=e.join(" "),t.style&&(s.style.cssText=t.style),s.setAttribute("data-option-array-index",t.array_index),s.innerHTML=t.highlighted_html||t.html,t.title&&(s.title=t.title),this.outerHTML(s)):""},t.prototype.result_add_group=function(t){var e,s;return(t.search_match||t.group_match)&&t.active_options>0?((e=[]).push("group-result"),t.classes&&e.push(t.classes),s=document.createElement("li"),s.className=e.join(" "),s.innerHTML=t.highlighted_html||this.escape_html(t.label),t.title&&(s.title=t.title),this.outerHTML(s)):""},t.prototype.results_update_field=function(){if(this.set_default_text(),this.is_multiple||this.results_reset_cleanup(),this.result_clear_highlight(),this.results_build(),this.results_showing)return this.winnow_results()},t.prototype.reset_single_select_options=function(){var t,e,s,i,n;for(n=[],t=0,e=(s=this.results_data).length;t"+this.escape_html(s)+""+this.escape_html(f)),null!=a&&(a.group_match=!0)):null!=o.group_array_index&&this.results_data[o.group_array_index].search_match&&(o.search_match=!0)));return this.result_clear_highlight(),_<1&&h.length?(this.update_results_content(""),this.no_results(h)):(this.update_results_content(this.results_option_build()),(null!=t?t.skip_highlight:void 0)?void 0:this.winnow_results_set_highlight())},t.prototype.get_search_regex=function(t){var e,s;return s=this.search_contains?t:"(^|\\s|\\b)"+t+"[^\\s]*",this.enable_split_word_search||this.search_contains||(s="^"+s),e=this.case_sensitive_search?"":"i",new RegExp(s,e)},t.prototype.search_string_match=function(t,e){var s;return s=e.exec(t),!this.search_contains&&(null!=s?s[1]:void 0)&&(s.index+=1),s},t.prototype.choices_count=function(){var t,e,s;if(null!=this.selected_option_count)return this.selected_option_count;for(this.selected_option_count=0,t=0,e=(s=this.form_field.options).length;t0?this.keydown_backstroke():this.pending_backstroke||(this.result_clear_highlight(),this.results_search());break;case 13:t.preventDefault(),this.results_showing&&this.result_select(t);break;case 27:this.results_showing&&this.results_hide();break;case 9:case 16:case 17:case 18:case 38:case 40:case 91:break;default:this.results_search()}},t.prototype.clipboard_event_checker=function(t){if(!this.is_disabled)return setTimeout(function(t){return function(){return t.results_search()}}(this),50)},t.prototype.container_width=function(){return null!=this.options.width?this.options.width:this.form_field.offsetWidth+"px"},t.prototype.include_option_in_results=function(t){return!(this.is_multiple&&!this.display_selected_options&&t.selected)&&(!(!this.display_disabled_options&&t.disabled)&&!t.empty)},t.prototype.search_results_touchstart=function(t){return this.touch_started=!0,this.search_results_mouseover(t)},t.prototype.search_results_touchmove=function(t){return this.touch_started=!1,this.search_results_mouseout(t)},t.prototype.search_results_touchend=function(t){if(this.touch_started)return this.search_results_mouseup(t)},t.prototype.outerHTML=function(t){var e;return t.outerHTML?t.outerHTML:((e=document.createElement("div")).appendChild(t),e.innerHTML)},t.prototype.get_single_html=function(){return'\n \n '+this.default_text+'\n

\n\n
\n \n
    \n
    '},t.prototype.get_multi_html=function(){return'
      \n
    • \n \n
    • \n
    \n
    \n
      \n
      '},t.prototype.get_no_results_html=function(t){return'
    • \n '+this.results_none_found+" "+this.escape_html(t)+"\n
    • "},t.browser_is_supported=function(){return"Microsoft Internet Explorer"===window.navigator.appName?document.documentMode>=8:!(/iP(od|hone)/i.test(window.navigator.userAgent)||/IEMobile/i.test(window.navigator.userAgent)||/Windows Phone/i.test(window.navigator.userAgent)||/BlackBerry/i.test(window.navigator.userAgent)||/BB10/i.test(window.navigator.userAgent)||/Android.*Mobile/i.test(window.navigator.userAgent))},t.default_multiple_text="Select Some Options",t.default_single_text="Select an Option",t.default_no_result_text="No results match",t}(),(t=jQuery).fn.extend({chosen:function(i){return e.browser_is_supported()?this.each(function(e){var n,o;o=(n=t(this)).data("chosen"),"destroy"!==i?o instanceof s||n.data("chosen",new s(this,i)):o instanceof s&&o.destroy()}):this}}),s=function(s){function n(){return n.__super__.constructor.apply(this,arguments)}return o(n,e),n.prototype.setup=function(){return this.form_field_jq=t(this.form_field),this.current_selectedIndex=this.form_field.selectedIndex},n.prototype.set_up_html=function(){var e,s;return(e=["chosen-container"]).push("chosen-container-"+(this.is_multiple?"multi":"single")),this.inherit_select_classes&&this.form_field.className&&e.push(this.form_field.className),this.is_rtl&&e.push("chosen-rtl"),s={"class":e.join(" "),title:this.form_field.title},this.form_field.id.length&&(s.id=this.form_field.id.replace(/[^\w]/g,"_")+"_chosen"),this.container=t("
      ",s),this.container.width(this.container_width()),this.is_multiple?this.container.html(this.get_multi_html()):this.container.html(this.get_single_html()),this.form_field_jq.hide().after(this.container),this.dropdown=this.container.find("div.chosen-drop").first(),this.search_field=this.container.find("input.chosen-search-input"),this.focus_field=this.container.find("input.chosen-focus-input"),this.search_results=this.container.find("ul.chosen-results").first(),this.search_field_scale(),this.search_no_results=this.container.find("li.no-results").first(),this.is_multiple?(this.search_choices=this.container.find("ul.chosen-choices").first(),this.search_container=this.container.find("li.search-field").first()):(this.search_container=this.container.find("div.chosen-search").first(),this.selected_item=this.container.find(".chosen-single").first()),this.results_build(),this.set_tab_index(),this.set_label_behavior()},n.prototype.on_ready=function(){return this.form_field_jq.trigger("chosen:ready",{chosen:this})},n.prototype.register_observers=function(){var t;return this.container.on("touchstart.chosen",function(t){return function(e){t.container_mousedown(e)}}(this)),this.container.on("touchend.chosen",function(t){return function(e){t.container_mouseup(e)}}(this)),this.container.on("mousedown.chosen",function(t){return function(e){t.container_mousedown(e)}}(this)),this.container.on("mouseup.chosen",function(t){return function(e){t.container_mouseup(e)}}(this)),this.container.on("mouseenter.chosen",function(t){return function(e){t.mouse_enter(e)}}(this)),this.container.on("mouseleave.chosen",function(t){return function(e){t.mouse_leave(e)}}(this)),this.search_results.on("mouseup.chosen",function(t){return function(e){t.search_results_mouseup(e)}}(this)),this.search_results.on("mouseover.chosen",function(t){return function(e){t.search_results_mouseover(e)}}(this)),this.search_results.on("mouseout.chosen",function(t){return function(e){t.search_results_mouseout(e)}}(this)),this.search_results.on("mousewheel.chosen DOMMouseScroll.chosen",function(t){return function(e){t.search_results_mousewheel(e)}}(this)),this.search_results.on("touchstart.chosen",function(t){return function(e){t.search_results_touchstart(e)}}(this)),this.search_results.on("touchmove.chosen",function(t){return function(e){t.search_results_touchmove(e)}}(this)),this.search_results.on("touchend.chosen",function(t){return function(e){t.search_results_touchend(e)}}(this)),this.form_field_jq.on("chosen:updated.chosen",function(t){return function(e){t.results_update_field(e)}}(this)),this.form_field_jq.on("chosen:activate.chosen",function(t){return function(e){t.activate_field(e)}}(this)),this.form_field_jq.on("chosen:open.chosen",function(t){return function(e){t.container_mousedown(e)}}(this)),this.form_field_jq.on("chosen:close.chosen",function(t){return function(e){t.close_field(e)}}(this)),this.search_field.on("blur.chosen",function(t){return function(e){t.input_blur(e)}}(this)),this.search_field.on("keyup.chosen",function(t){return function(e){t.keyup_checker(e)}}(this)),this.search_field.on("keydown.chosen",function(t){return function(e){t.keydown_checker(e)}}(this)),this.search_field.on("focus.chosen",function(t){return function(e){t.input_focus(e)}}(this)),this.search_field.on("cut.chosen",function(t){return function(e){t.clipboard_event_checker(e)}}(this)),this.search_field.on("paste.chosen",function(t){return function(e){t.clipboard_event_checker(e)}}(this)),this.is_multiple?this.search_choices.on("click.chosen",function(t){return function(e){t.choices_click(e)}}(this)):(this.container.on("click.chosen",function(t){t.preventDefault()}),this.focus_field.on("blur.chosen",function(t){return function(e){t.input_blur(e)}}(this)),this.focus_field.on("focus.chosen",function(t){return function(e){t.input_focus(e)}}(this)),t=function(t){return function(){return t.search_field.val(t.focus_field.val()),t.focus_field.val("")}}(this),this.focus_field.on("keyup.chosen",function(e){return function(s){t(),e.keyup_checker(s)}}(this)),this.focus_field.on("keydown.chosen",function(e){return function(s){t(),e.keydown_checker(s)}}(this)),this.focus_field.on("cut.chosen",function(e){return function(s){setTimeout(t,0),e.clipboard_event_checker(s)}}(this)),this.focus_field.on("paste.chosen",function(e){return function(s){setTimeout(t,0),e.clipboard_event_checker(s)}}(this)))},n.prototype.destroy=function(){return t(this.container[0].ownerDocument).off("click.chosen",this.click_test_action),this.form_field_label.length>0&&this.form_field_label.off("click.chosen"),this.search_field[0].tabIndex&&(this.form_field_jq[0].tabIndex=this.search_field[0].tabIndex),this.container.remove(),this.form_field_jq.removeData("chosen"),this.form_field_jq.show()},n.prototype.search_field_disabled=function(){return this.is_disabled=this.form_field.disabled||this.form_field_jq.parents("fieldset").is(":disabled"),this.container.toggleClass("chosen-disabled",this.is_disabled),this.search_field[0].disabled=this.is_disabled,this.is_multiple||this.selected_item.off("focus.chosen",this.activate_field),this.is_disabled?this.close_field():this.is_multiple?void 0:this.selected_item.on("focus.chosen",this.activate_field)},n.prototype.container_mousedown=function(e){var s;if(!this.is_disabled)return!e||"mousedown"!==(s=e.type)&&"touchstart"!==s||this.results_showing||e.preventDefault(),null!=e&&t(e.target).hasClass("search-choice-close")?void 0:(this.active_field?this.is_multiple||!e||t(e.target)[0]!==this.selected_item[0]&&!t(e.target).parents("a.chosen-single").length||(e.preventDefault(),this.results_toggle()):(this.is_multiple&&this.search_field.val(""),t(this.container[0].ownerDocument).on("click.chosen",this.click_test_action),this.results_show()),this.activate_field())},n.prototype.container_mouseup=function(t){if("ABBR"===t.target.nodeName&&!this.is_disabled)return this.results_reset(t)},n.prototype.search_results_mousewheel=function(t){var e;if(t.originalEvent&&(e=t.originalEvent.deltaY||-t.originalEvent.wheelDelta||t.originalEvent.detail),null!=e)return t.preventDefault(),"DOMMouseScroll"===t.type&&(e*=40),this.search_results.scrollTop(e+this.search_results.scrollTop())},n.prototype.blur_test=function(t){if(!this.active_field&&this.container.hasClass("chosen-container-active"))return this.close_field()},n.prototype.close_field=function(){return t(this.container[0].ownerDocument).off("click.chosen",this.click_test_action),this.active_field=!1,this.results_hide(),this.container.removeClass("chosen-container-active"),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale(),this.search_field.blur()},n.prototype.activate_field=function(){if(!this.is_disabled)return this.container.addClass("chosen-container-active"),this.active_field=!0,this.search_field.focus()},n.prototype.test_active_click=function(e){var s;return(s=t(e.target).closest(".chosen-container")).length&&this.container[0]===s[0]?this.active_field=!0:this.close_field()},n.prototype.results_build=function(){return this.parsing=!0,this.selected_option_count=null,this.results_data=i.select_to_array(this.form_field),this.is_multiple?this.search_choices.find("li.search-choice").remove():(this.single_set_selected_text(),this.disable_search||this.form_field.options.length<=this.disable_search_threshold?(this.search_field[0].readOnly=!0,this.focus_field[0].readOnly=!0,this.container.addClass("chosen-container-single-nosearch")):(this.search_field[0].readOnly=!1,this.focus_field[0].readOnly=!1,this.container.removeClass("chosen-container-single-nosearch"))),this.update_results_content(this.results_option_build({first:!0})),this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.parsing=!1},n.prototype.result_do_highlight=function(t){var e,s,i,n,o;if(t.length){if(this.result_clear_highlight(),this.result_highlight=t,this.result_highlight.addClass("highlighted"),i=parseInt(this.search_results.css("maxHeight"),10),o=this.search_results.scrollTop(),n=i+o,s=this.result_highlight.position().top+this.search_results.scrollTop(),(e=s+this.result_highlight.outerHeight())>=n)return this.search_results.scrollTop(e-i>0?e-i:0);if(s0)return this.form_field_label.on("click.chosen",this.label_click_handler)},n.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices_count()<1&&!this.active_field?(this.search_field.val(this.default_text),this.search_field.addClass("default")):(this.search_field.val(""),this.search_field.removeClass("default"))},n.prototype.search_results_mouseup=function(e){var s;if((s=t(e.target).hasClass("active-result")?t(e.target):t(e.target).parents(".active-result").first()).length)return this.result_highlight=s,this.result_select(e),this.search_field.focus()},n.prototype.search_results_mouseover=function(e){var s;if(s=t(e.target).hasClass("active-result")?t(e.target):t(e.target).parents(".active-result").first())return this.result_do_highlight(s)},n.prototype.search_results_mouseout=function(e){if(t(e.target).hasClass("active-result")||t(e.target).parents(".active-result").first())return this.result_clear_highlight()},n.prototype.choice_build=function(e){var s,i;return s=t("
    • ",{"class":"search-choice"}).html(""+this.choice_label(e)+""),e.disabled?s.addClass("search-choice-disabled"):((i=t("",{"class":"search-choice-close","data-option-array-index":e.array_index})).on("click.chosen",function(t){return function(e){return t.choice_destroy_link_click(e)}}(this)),s.append(i)),this.search_container.before(s)},n.prototype.choice_destroy_link_click=function(e){if(e.preventDefault(),e.stopPropagation(),!this.is_disabled)return this.choice_destroy(t(e.target))},n.prototype.choice_destroy=function(t){if(this.result_deselect(t[0].getAttribute("data-option-array-index")))return this.active_field?this.search_field.focus():this.show_search_field_default(),this.is_multiple&&this.choices_count()>0&&this.get_search_field_value().length<1&&this.results_hide(),t.parents("li").first().remove(),this.search_field_scale()},n.prototype.results_reset=function(){if(this.reset_single_select_options(),this.form_field.options[0].selected=!0,this.single_set_selected_text(),this.show_search_field_default(),this.results_reset_cleanup(),this.trigger_form_field_change(),this.active_field)return this.results_hide()},n.prototype.results_reset_cleanup=function(){return this.current_selectedIndex=this.form_field.selectedIndex,this.selected_item.find("abbr").remove()},n.prototype.result_select=function(t){var e,s;if(this.result_highlight)return e=this.result_highlight,this.result_clear_highlight(),this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.is_multiple?e.removeClass("active-result"):this.reset_single_select_options(),e.addClass("result-selected"),s=this.results_data[e[0].getAttribute("data-option-array-index")],s.selected=!0,this.form_field.options[s.options_index].selected=!0,this.selected_option_count=null,this.is_multiple?this.choice_build(s):this.single_set_selected_text(this.choice_label(s)),this.is_multiple&&(!this.hide_results_on_select||t.metaKey||t.ctrlKey)?t.metaKey||t.ctrlKey?this.winnow_results({skip_highlight:!0}):(this.search_field.val(""),this.winnow_results()):(this.results_hide(),this.show_search_field_default()),(this.is_multiple||this.form_field.selectedIndex!==this.current_selectedIndex)&&this.trigger_form_field_change({selected:this.form_field.options[s.options_index].value}),this.current_selectedIndex=this.form_field.selectedIndex,t.preventDefault(),this.search_field_scale())},n.prototype.single_set_selected_text=function(t){return null==t&&(t=this.default_text),t===this.default_text?this.selected_item.addClass("chosen-default"):(this.single_deselect_control_build(),this.selected_item.removeClass("chosen-default")),this.selected_item.find("span").html(t)},n.prototype.result_deselect=function(t){var e;return e=this.results_data[t],!this.form_field.options[e.options_index].disabled&&(e.selected=!1,this.form_field.options[e.options_index].selected=!1,this.selected_option_count=null,this.result_clear_highlight(),this.results_showing&&this.winnow_results(),this.trigger_form_field_change({deselected:this.form_field.options[e.options_index].value}),this.search_field_scale(),!0)},n.prototype.single_deselect_control_build=function(){if(this.allow_single_deselect)return this.selected_item.find("abbr").length||this.selected_item.find("span").first().after(''),this.selected_item.addClass("chosen-single-with-deselect")},n.prototype.get_search_field_value=function(){return this.search_field.val()},n.prototype.get_search_text=function(){return t.trim(this.get_search_field_value())},n.prototype.escape_html=function(e){return t("
      ").text(e).html()},n.prototype.winnow_results_set_highlight=function(){var t,e;if(e=this.is_multiple?[]:this.search_results.find(".result-selected.active-result"),null!=(t=e.length?e.first():this.search_results.find(".active-result").first()))return this.result_do_highlight(t)},n.prototype.no_results=function(t){var e;return e=this.get_no_results_html(t),this.search_results.append(e),this.form_field_jq.trigger("chosen:no_results",{chosen:this})},n.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()},n.prototype.keydown_arrow=function(){var t;return this.results_showing&&this.result_highlight?(t=this.result_highlight.nextAll("li.active-result").first())?this.result_do_highlight(t):void 0:this.results_show()},n.prototype.keyup_arrow=function(){var t;return this.results_showing||this.is_multiple?this.result_highlight?(t=this.result_highlight.prevAll("li.active-result")).length?this.result_do_highlight(t.first()):(this.choices_count()>0&&this.results_hide(),this.result_clear_highlight()):void 0:this.results_show()},n.prototype.keydown_backstroke=function(){var t;return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.find("a").first()),this.clear_backstroke()):(t=this.search_container.siblings("li.search-choice").last()).length&&!t.hasClass("search-choice-disabled")?(this.pending_backstroke=t,this.single_backstroke_delete?this.keydown_backstroke():this.pending_backstroke.addClass("search-choice-focus")):void 0},n.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClass("search-choice-focus"),this.pending_backstroke=null},n.prototype.search_field_scale=function(){var e,s,i,n,o,r,h;if(this.is_multiple){for(o={position:"absolute",left:"-1000px",top:"-1000px",display:"none",whiteSpace:"pre"},s=0,i=(r=["fontSize","fontStyle","fontWeight","fontFamily","lineHeight","textTransform","letterSpacing"]).length;s").css(o)).text(this.get_search_field_value()),t("body").append(e),h=e.width()+25,e.remove(),this.container.is(":visible")&&(h=Math.min(this.container.outerWidth()-10,h)),this.search_field.width(h)}},n.prototype.trigger_form_field_change=function(t){return this.form_field_jq.trigger("input",t),this.form_field_jq.trigger("change",t)},n}()}).call(this); \ No newline at end of file +(function(){var t,e,s,i,n=function(t,e){return function(){return t.apply(e,arguments)}},r=function(t,e){function s(){this.constructor=t}for(var i in e)o.call(e,i)&&(t[i]=e[i]);return s.prototype=e.prototype,t.prototype=new s,t.__super__=e.prototype,t},o={}.hasOwnProperty;(i=function(){function t(){this.options_index=0,this.parsed=[]}return t.prototype.add_node=function(t){return"OPTGROUP"===t.nodeName.toUpperCase()?this.add_group(t):this.add_option(t)},t.prototype.add_group=function(t){var e,s,i,n,r,o;for(e=this.parsed.length,this.parsed.push({array_index:e,group:!0,label:t.label,title:t.title?t.title:void 0,children:0,disabled:t.disabled,classes:t.className}),o=[],s=0,i=(r=t.childNodes).length;s"+this.escape_html(t.group_label)+""+t.html:t.html},t.prototype.mouse_enter=function(){return this.mouse_on_container=!0},t.prototype.mouse_leave=function(){return this.mouse_on_container=!1},t.prototype.input_focus=function(t){if(this.is_multiple){if(!this.active_field)return setTimeout(function(t){return function(){return t.container_mousedown()}}(this),50)}else if(!this.active_field)return this.activate_field()},t.prototype.input_blur=function(t){if(!this.mouse_on_container)return this.active_field=!1,setTimeout(function(t){return function(){return t.blur_test()}}(this),100)},t.prototype.label_click_handler=function(t){return this.is_multiple?this.container_mousedown(t):this.activate_field()},t.prototype.results_option_build=function(t){var e,s,i,n,r,o,h;for(e="",h=0,n=0,r=(o=this.results_data).length;n=this.max_shown_results));n++);return e},t.prototype.result_add_option=function(t){var e,s;return t.search_match&&this.include_option_in_results(t)?(e=[],t.disabled||t.selected&&this.is_multiple||e.push("active-result"),!t.disabled||t.selected&&this.is_multiple||e.push("disabled-result"),t.selected&&e.push("result-selected"),null!=t.group_array_index&&e.push("group-option"),""!==t.classes&&e.push(t.classes),s=document.createElement("li"),s.className=e.join(" "),t.style&&(s.style.cssText=t.style),s.setAttribute("data-option-array-index",t.array_index),s.innerHTML=t.highlighted_html||t.html,t.title&&(s.title=t.title),this.outerHTML(s)):""},t.prototype.result_add_group=function(t){var e,s;return(t.search_match||t.group_match)&&t.active_options>0?((e=[]).push("group-result"),t.classes&&e.push(t.classes),s=document.createElement("li"),s.className=e.join(" "),s.innerHTML=t.highlighted_html||this.escape_html(t.label),t.title&&(s.title=t.title),this.outerHTML(s)):""},t.prototype.results_update_field=function(){if(this.set_default_text(),this.is_multiple||this.results_reset_cleanup(),this.result_clear_highlight(),this.results_build(),this.results_showing)return this.winnow_results()},t.prototype.reset_single_select_options=function(){var t,e,s,i,n;for(n=[],t=0,e=(s=this.results_data).length;t"+this.escape_html(s)+""+this.escape_html(p)),null!=a&&(a.group_match=!0)):null!=r.group_array_index&&this.results_data[r.group_array_index].search_match&&(r.search_match=!0)));return this.result_clear_highlight(),_<1&&h.length?(this.update_results_content(""),this.no_results(h)):(this.update_results_content(this.results_option_build()),(null!=t?t.skip_highlight:void 0)?void 0:this.winnow_results_set_highlight())},t.prototype.get_search_regex=function(t){var e,s;return s=this.search_contains?t:"(^|\\s|\\b)"+t+"[^\\s]*",this.enable_split_word_search||this.search_contains||(s="^"+s),e=this.case_sensitive_search?"":"i",new RegExp(s,e)},t.prototype.search_string_match=function(t,e){var s;return s=e.exec(t),!this.search_contains&&(null!=s?s[1]:void 0)&&(s.index+=1),s},t.prototype.choices_count=function(){var t,e,s;if(null!=this.selected_option_count)return this.selected_option_count;for(this.selected_option_count=0,t=0,e=(s=this.form_field.options).length;t0?this.keydown_backstroke():this.pending_backstroke||(this.result_clear_highlight(),this.results_search());break;case 13:t.preventDefault(),this.results_showing&&this.result_select(t);break;case 27:this.results_showing&&this.results_hide();break;case 9:case 16:case 17:case 18:case 38:case 40:case 91:break;default:this.results_search()}},t.prototype.clipboard_event_checker=function(t){if(!this.is_disabled)return setTimeout(function(t){return function(){return t.results_search()}}(this),50)},t.prototype.container_width=function(){return null!=this.options.width?this.options.width:this.form_field.offsetWidth+"px"},t.prototype.include_option_in_results=function(t){return!(this.is_multiple&&!this.display_selected_options&&t.selected)&&(!(!this.display_disabled_options&&t.disabled)&&!t.empty)},t.prototype.search_results_touchstart=function(t){return this.touch_started=!0,this.search_results_mouseover(t)},t.prototype.search_results_touchmove=function(t){return this.touch_started=!1,this.search_results_mouseout(t)},t.prototype.search_results_touchend=function(t){if(this.touch_started)return this.search_results_mouseup(t)},t.prototype.outerHTML=function(t){var e;return t.outerHTML?t.outerHTML:((e=document.createElement("div")).appendChild(t),e.innerHTML)},t.prototype.get_single_html=function(){return'\n '+this.default_text+'\n
      \n
      \n
      \n \n
        \n
        '},t.prototype.get_multi_html=function(){return'
          \n
        • \n \n
        • \n
        \n
        \n
          \n
          '},t.prototype.get_no_results_html=function(t){return'
        • \n '+this.results_none_found+" "+this.escape_html(t)+"\n
        • "},t.browser_is_supported=function(){return"Microsoft Internet Explorer"===window.navigator.appName?document.documentMode>=8:!(/iP(od|hone)/i.test(window.navigator.userAgent)||/IEMobile/i.test(window.navigator.userAgent)||/Windows Phone/i.test(window.navigator.userAgent)||/BlackBerry/i.test(window.navigator.userAgent)||/BB10/i.test(window.navigator.userAgent)||/Android.*Mobile/i.test(window.navigator.userAgent))},t.default_multiple_text="Select Some Options",t.default_single_text="Select an Option",t.default_no_result_text="No results match",t}(),(t=jQuery).fn.extend({chosen:function(i){return e.browser_is_supported()?this.each(function(e){var n,r;r=(n=t(this)).data("chosen"),"destroy"!==i?r instanceof s||n.data("chosen",new s(this,i)):r instanceof s&&r.destroy()}):this}}),s=function(s){function n(){return n.__super__.constructor.apply(this,arguments)}return r(n,e),n.prototype.setup=function(){return this.form_field_jq=t(this.form_field),this.current_selectedIndex=this.form_field.selectedIndex},n.prototype.set_up_html=function(){var e,s;return(e=["chosen-container"]).push("chosen-container-"+(this.is_multiple?"multi":"single")),this.inherit_select_classes&&this.form_field.className&&e.push(this.form_field.className),this.is_rtl&&e.push("chosen-rtl"),s={"class":e.join(" "),title:this.form_field.title},this.form_field.id.length&&(s.id=this.form_field.id.replace(/[^\w]/g,"_")+"_chosen"),this.container=t("
          ",s),this.container.width(this.container_width()),this.is_multiple?this.container.html(this.get_multi_html()):this.container.html(this.get_single_html()),this.form_field_jq.hide().after(this.container),this.dropdown=this.container.find("div.chosen-drop").first(),this.search_field=this.container.find("input").first(),this.search_results=this.container.find("ul.chosen-results").first(),this.search_field_scale(),this.search_no_results=this.container.find("li.no-results").first(),this.is_multiple?(this.search_choices=this.container.find("ul.chosen-choices").first(),this.search_container=this.container.find("li.search-field").first()):(this.search_container=this.container.find("div.chosen-search").first(),this.selected_item=this.container.find(".chosen-single").first()),this.results_build(),this.set_tab_index(),this.set_label_behavior()},n.prototype.on_ready=function(){return this.form_field_jq.trigger("chosen:ready",{chosen:this})},n.prototype.register_observers=function(){return this.container.on("touchstart.chosen",function(t){return function(e){t.container_mousedown(e)}}(this)),this.container.on("touchend.chosen",function(t){return function(e){t.container_mouseup(e)}}(this)),this.container.on("mousedown.chosen",function(t){return function(e){t.container_mousedown(e)}}(this)),this.container.on("mouseup.chosen",function(t){return function(e){t.container_mouseup(e)}}(this)),this.container.on("mouseenter.chosen",function(t){return function(e){t.mouse_enter(e)}}(this)),this.container.on("mouseleave.chosen",function(t){return function(e){t.mouse_leave(e)}}(this)),this.search_results.on("mouseup.chosen",function(t){return function(e){t.search_results_mouseup(e)}}(this)),this.search_results.on("mouseover.chosen",function(t){return function(e){t.search_results_mouseover(e)}}(this)),this.search_results.on("mouseout.chosen",function(t){return function(e){t.search_results_mouseout(e)}}(this)),this.search_results.on("mousewheel.chosen DOMMouseScroll.chosen",function(t){return function(e){t.search_results_mousewheel(e)}}(this)),this.search_results.on("touchstart.chosen",function(t){return function(e){t.search_results_touchstart(e)}}(this)),this.search_results.on("touchmove.chosen",function(t){return function(e){t.search_results_touchmove(e)}}(this)),this.search_results.on("touchend.chosen",function(t){return function(e){t.search_results_touchend(e)}}(this)),this.form_field_jq.on("chosen:updated.chosen",function(t){return function(e){t.results_update_field(e)}}(this)),this.form_field_jq.on("chosen:activate.chosen",function(t){return function(e){t.activate_field(e)}}(this)),this.form_field_jq.on("chosen:open.chosen",function(t){return function(e){t.container_mousedown(e)}}(this)),this.form_field_jq.on("chosen:close.chosen",function(t){return function(e){t.close_field(e)}}(this)),this.search_field.on("blur.chosen",function(t){return function(e){t.input_blur(e)}}(this)),this.search_field.on("keyup.chosen",function(t){return function(e){t.keyup_checker(e)}}(this)),this.search_field.on("keydown.chosen",function(t){return function(e){t.keydown_checker(e)}}(this)),this.search_field.on("focus.chosen",function(t){return function(e){t.input_focus(e)}}(this)),this.search_field.on("cut.chosen",function(t){return function(e){t.clipboard_event_checker(e)}}(this)),this.search_field.on("paste.chosen",function(t){return function(e){t.clipboard_event_checker(e)}}(this)),this.is_multiple?this.search_choices.on("click.chosen",function(t){return function(e){t.choices_click(e)}}(this)):this.container.on("click.chosen",function(t){t.preventDefault()})},n.prototype.destroy=function(){return t(this.container[0].ownerDocument).off("click.chosen",this.click_test_action),this.form_field_label.length>0&&this.form_field_label.off("click.chosen"),this.search_field[0].tabIndex&&(this.form_field_jq[0].tabIndex=this.search_field[0].tabIndex),this.container.remove(),this.form_field_jq.removeData("chosen"),this.form_field_jq.show()},n.prototype.search_field_disabled=function(){return this.is_disabled=this.form_field.disabled||this.form_field_jq.parents("fieldset").is(":disabled"),this.container.toggleClass("chosen-disabled",this.is_disabled),this.search_field[0].disabled=this.is_disabled,this.is_multiple||this.selected_item.off("focus.chosen",this.activate_field),this.is_disabled?this.close_field():this.is_multiple?void 0:this.selected_item.on("focus.chosen",this.activate_field)},n.prototype.container_mousedown=function(e){var s;if(!this.is_disabled)return!e||"mousedown"!==(s=e.type)&&"touchstart"!==s||this.results_showing||e.preventDefault(),null!=e&&t(e.target).hasClass("search-choice-close")?void 0:(this.active_field?this.is_multiple||!e||t(e.target)[0]!==this.selected_item[0]&&!t(e.target).parents("a.chosen-single").length||(e.preventDefault(),this.results_toggle()):(this.is_multiple&&this.search_field.val(""),t(this.container[0].ownerDocument).on("click.chosen",this.click_test_action),this.results_show()),this.activate_field())},n.prototype.container_mouseup=function(t){if("ABBR"===t.target.nodeName&&!this.is_disabled)return this.results_reset(t)},n.prototype.search_results_mousewheel=function(t){var e;if(t.originalEvent&&(e=t.originalEvent.deltaY||-t.originalEvent.wheelDelta||t.originalEvent.detail),null!=e)return t.preventDefault(),"DOMMouseScroll"===t.type&&(e*=40),this.search_results.scrollTop(e+this.search_results.scrollTop())},n.prototype.blur_test=function(t){if(!this.active_field&&this.container.hasClass("chosen-container-active"))return this.close_field()},n.prototype.close_field=function(){return t(this.container[0].ownerDocument).off("click.chosen",this.click_test_action),this.active_field=!1,this.results_hide(),this.container.removeClass("chosen-container-active"),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale(),this.search_field.blur()},n.prototype.activate_field=function(){if(!this.is_disabled)return this.container.addClass("chosen-container-active"),this.active_field=!0,this.search_field.val(this.search_field.val()),this.search_field.focus()},n.prototype.test_active_click=function(e){var s;return(s=t(e.target).closest(".chosen-container")).length&&this.container[0]===s[0]?this.active_field=!0:this.close_field()},n.prototype.results_build=function(){return this.parsing=!0,this.selected_option_count=null,this.results_data=i.select_to_array(this.form_field),this.is_multiple?this.search_choices.find("li.search-choice").remove():(this.single_set_selected_text(),this.disable_search||this.form_field.options.length<=this.disable_search_threshold?(this.search_field[0].readOnly=!0,this.container.addClass("chosen-container-single-nosearch")):(this.search_field[0].readOnly=!1,this.container.removeClass("chosen-container-single-nosearch"))),this.update_results_content(this.results_option_build({first:!0})),this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.parsing=!1},n.prototype.result_do_highlight=function(t){var e,s,i,n,r;if(t.length){if(this.result_clear_highlight(),this.result_highlight=t,this.result_highlight.addClass("highlighted"),i=parseInt(this.search_results.css("maxHeight"),10),r=this.search_results.scrollTop(),n=i+r,s=this.result_highlight.position().top+this.search_results.scrollTop(),(e=s+this.result_highlight.outerHeight())>=n)return this.search_results.scrollTop(e-i>0?e-i:0);if(s0)return this.form_field_label.on("click.chosen",this.label_click_handler)},n.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices_count()<1&&!this.active_field?(this.search_field.val(this.default_text),this.search_field.addClass("default")):(this.search_field.val(""),this.search_field.removeClass("default"))},n.prototype.search_results_mouseup=function(e){var s;if((s=t(e.target).hasClass("active-result")?t(e.target):t(e.target).parents(".active-result").first()).length)return this.result_highlight=s,this.result_select(e),this.search_field.focus()},n.prototype.search_results_mouseover=function(e){var s;if(s=t(e.target).hasClass("active-result")?t(e.target):t(e.target).parents(".active-result").first())return this.result_do_highlight(s)},n.prototype.search_results_mouseout=function(e){if(t(e.target).hasClass("active-result")||t(e.target).parents(".active-result").first())return this.result_clear_highlight()},n.prototype.choice_build=function(e){var s,i;return s=t("
        • ",{"class":"search-choice"}).html(""+this.choice_label(e)+""),e.disabled?s.addClass("search-choice-disabled"):((i=t("",{"class":"search-choice-close","data-option-array-index":e.array_index})).on("click.chosen",function(t){return function(e){return t.choice_destroy_link_click(e)}}(this)),s.append(i)),this.search_container.before(s)},n.prototype.choice_destroy_link_click=function(e){if(e.preventDefault(),e.stopPropagation(),!this.is_disabled)return this.choice_destroy(t(e.target))},n.prototype.choice_destroy=function(t){if(this.result_deselect(t[0].getAttribute("data-option-array-index")))return this.active_field?this.search_field.focus():this.show_search_field_default(),this.is_multiple&&this.choices_count()>0&&this.get_search_field_value().length<1&&this.results_hide(),t.parents("li").first().remove(),this.search_field_scale()},n.prototype.results_reset=function(){if(this.reset_single_select_options(),this.form_field.options[0].selected=!0,this.single_set_selected_text(),this.show_search_field_default(),this.results_reset_cleanup(),this.trigger_form_field_change(),this.active_field)return this.results_hide()},n.prototype.results_reset_cleanup=function(){return this.current_selectedIndex=this.form_field.selectedIndex,this.selected_item.find("abbr").remove()},n.prototype.result_select=function(t){var e,s;if(this.result_highlight)return e=this.result_highlight,this.result_clear_highlight(),this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.is_multiple?e.removeClass("active-result"):this.reset_single_select_options(),e.addClass("result-selected"),s=this.results_data[e[0].getAttribute("data-option-array-index")],s.selected=!0,this.form_field.options[s.options_index].selected=!0,this.selected_option_count=null,this.is_multiple?this.choice_build(s):this.single_set_selected_text(this.choice_label(s)),this.is_multiple&&(!this.hide_results_on_select||t.metaKey||t.ctrlKey)?t.metaKey||t.ctrlKey?this.winnow_results({skip_highlight:!0}):(this.search_field.val(""),this.winnow_results()):(this.results_hide(),this.show_search_field_default()),(this.is_multiple||this.form_field.selectedIndex!==this.current_selectedIndex)&&this.trigger_form_field_change({selected:this.form_field.options[s.options_index].value}),this.current_selectedIndex=this.form_field.selectedIndex,t.preventDefault(),this.search_field_scale())},n.prototype.single_set_selected_text=function(t){return null==t&&(t=this.default_text),t===this.default_text?this.selected_item.addClass("chosen-default"):(this.single_deselect_control_build(),this.selected_item.removeClass("chosen-default")),this.selected_item.find("span").html(t)},n.prototype.result_deselect=function(t){var e;return e=this.results_data[t],!this.form_field.options[e.options_index].disabled&&(e.selected=!1,this.form_field.options[e.options_index].selected=!1,this.selected_option_count=null,this.result_clear_highlight(),this.results_showing&&this.winnow_results(),this.trigger_form_field_change({deselected:this.form_field.options[e.options_index].value}),this.search_field_scale(),!0)},n.prototype.single_deselect_control_build=function(){if(this.allow_single_deselect)return this.selected_item.find("abbr").length||this.selected_item.find("span").first().after(''),this.selected_item.addClass("chosen-single-with-deselect")},n.prototype.get_search_field_value=function(){return this.search_field.val()},n.prototype.get_search_text=function(){return t.trim(this.get_search_field_value())},n.prototype.escape_html=function(e){return t("
          ").text(e).html()},n.prototype.winnow_results_set_highlight=function(){var t,e;if(e=this.is_multiple?[]:this.search_results.find(".result-selected.active-result"),null!=(t=e.length?e.first():this.search_results.find(".active-result").first()))return this.result_do_highlight(t)},n.prototype.no_results=function(t){var e;return e=this.get_no_results_html(t),this.search_results.append(e),this.form_field_jq.trigger("chosen:no_results",{chosen:this})},n.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()},n.prototype.keydown_arrow=function(){var t;return this.results_showing&&this.result_highlight?(t=this.result_highlight.nextAll("li.active-result").first())?this.result_do_highlight(t):void 0:this.results_show()},n.prototype.keyup_arrow=function(){var t;return this.results_showing||this.is_multiple?this.result_highlight?(t=this.result_highlight.prevAll("li.active-result")).length?this.result_do_highlight(t.first()):(this.choices_count()>0&&this.results_hide(),this.result_clear_highlight()):void 0:this.results_show()},n.prototype.keydown_backstroke=function(){var t;return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.find("a").first()),this.clear_backstroke()):(t=this.search_container.siblings("li.search-choice").last()).length&&!t.hasClass("search-choice-disabled")?(this.pending_backstroke=t,this.single_backstroke_delete?this.keydown_backstroke():this.pending_backstroke.addClass("search-choice-focus")):void 0},n.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClass("search-choice-focus"),this.pending_backstroke=null},n.prototype.search_field_scale=function(){var e,s,i,n,r,o,h;if(this.is_multiple){for(r={position:"absolute",left:"-1000px",top:"-1000px",display:"none",whiteSpace:"pre"},s=0,i=(o=["fontSize","fontStyle","fontWeight","fontFamily","lineHeight","textTransform","letterSpacing"]).length;s").css(r)).text(this.get_search_field_value()),t("body").append(e),h=e.width()+25,e.remove(),this.container.is(":visible")&&(h=Math.min(this.container.outerWidth()-10,h)),this.search_field.width(h)}},n.prototype.trigger_form_field_change=function(t){return this.form_field_jq.trigger("input",t),this.form_field_jq.trigger("change",t)},n}()}).call(this); \ No newline at end of file diff --git a/core/src/main/resources/io/cucumber/core/plugin/timeline/chosen.min.css b/core/src/main/resources/io/cucumber/core/plugin/timeline/chosen.min.css index 487859c059..1c68ebb1c9 100755 --- a/core/src/main/resources/io/cucumber/core/plugin/timeline/chosen.min.css +++ b/core/src/main/resources/io/cucumber/core/plugin/timeline/chosen.min.css @@ -2,10 +2,10 @@ Chosen, a Select Box Enhancer for jQuery and Prototype by Patrick Filler for Harvest, http://getharvest.com -Version 1.8.5 +Version 1.8.7 Full source at https://github.com/harvesthq/chosen Copyright (c) 2011-2018 Harvest http://getharvest.com MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md This file is generated by `grunt build`, do not edit it by hand. -*/.chosen-container{position:relative;display:inline-block;vertical-align:middle;font-size:13px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.chosen-container *{-webkit-box-sizing:border-box;box-sizing:border-box}.chosen-container .chosen-drop{position:absolute;top:100%;z-index:1010;width:100%;border:1px solid #aaa;border-top:0;background:#fff;-webkit-box-shadow:0 4px 5px rgba(0,0,0,.15);box-shadow:0 4px 5px rgba(0,0,0,.15);display:none}.chosen-container.chosen-with-drop .chosen-drop{display:block}.chosen-container a{cursor:pointer}.chosen-container .chosen-single .group-name,.chosen-container .search-choice .group-name{margin-right:4px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-weight:400;color:#999}.chosen-container .chosen-single .group-name:after,.chosen-container .search-choice .group-name:after{content:":";padding-left:2px;vertical-align:top}.chosen-container-single .chosen-single{position:relative;display:block;overflow:hidden;padding:0 0 0 8px;height:25px;border:1px solid #aaa;border-radius:5px;background-color:#fff;background:-webkit-gradient(linear,left top,left bottom,color-stop(20%,#fff),color-stop(50%,#f6f6f6),color-stop(52%,#eee),to(#f4f4f4));background:linear-gradient(#fff 20%,#f6f6f6 50%,#eee 52%,#f4f4f4 100%);background-clip:padding-box;-webkit-box-shadow:0 0 3px #fff inset,0 1px 1px rgba(0,0,0,.1);box-shadow:0 0 3px #fff inset,0 1px 1px rgba(0,0,0,.1);color:#444;text-decoration:none;white-space:nowrap;line-height:24px}.chosen-container-single .chosen-single input[type=text]{cursor:pointer;opacity:0;position:absolute;width:0}.chosen-container-single .chosen-default{color:#999}.chosen-container-single .chosen-single span{display:block;overflow:hidden;margin-right:26px;text-overflow:ellipsis;white-space:nowrap}.chosen-container-single .chosen-single-with-deselect span{margin-right:38px}.chosen-container-single .chosen-single abbr{position:absolute;top:6px;right:26px;display:block;width:12px;height:12px;background:url(chosen-sprite.png) -42px 1px no-repeat;font-size:1px}.chosen-container-single .chosen-single abbr:hover{background-position:-42px -10px}.chosen-container-single.chosen-disabled .chosen-single abbr:hover{background-position:-42px -10px}.chosen-container-single .chosen-single div{position:absolute;top:0;right:0;display:block;width:18px;height:100%}.chosen-container-single .chosen-single div b{display:block;width:100%;height:100%;background:url(chosen-sprite.png) no-repeat 0 2px}.chosen-container-single .chosen-search{position:relative;z-index:1010;margin:0;padding:3px 4px;white-space:nowrap}.chosen-container-single .chosen-search input[type=text]{margin:1px 0;padding:4px 20px 4px 5px;width:100%;height:auto;outline:0;border:1px solid #aaa;background:url(chosen-sprite.png) no-repeat 100% -20px;font-size:1em;font-family:sans-serif;line-height:normal;border-radius:0}.chosen-container-single .chosen-drop{margin-top:-1px;border-radius:0 0 4px 4px;background-clip:padding-box}.chosen-container-single.chosen-container-single-nosearch .chosen-search{position:absolute;opacity:0;pointer-events:none}.chosen-container .chosen-results{color:#444;position:relative;overflow-x:hidden;overflow-y:auto;margin:0 4px 4px 0;padding:0 0 0 4px;max-height:240px;-webkit-overflow-scrolling:touch}.chosen-container .chosen-results li{display:none;margin:0;padding:5px 6px;list-style:none;line-height:15px;word-wrap:break-word;-webkit-touch-callout:none}.chosen-container .chosen-results li.active-result{display:list-item;cursor:pointer}.chosen-container .chosen-results li.disabled-result{display:list-item;color:#ccc;cursor:default}.chosen-container .chosen-results li.highlighted{background-color:#3875d7;background-image:-webkit-gradient(linear,left top,left bottom,color-stop(20%,#3875d7),color-stop(90%,#2a62bc));background-image:linear-gradient(#3875d7 20%,#2a62bc 90%);color:#fff}.chosen-container .chosen-results li.no-results{color:#777;display:list-item;background:#f4f4f4}.chosen-container .chosen-results li.group-result{display:list-item;font-weight:700;cursor:default}.chosen-container .chosen-results li.group-option{padding-left:15px}.chosen-container .chosen-results li em{font-style:normal;text-decoration:underline}.chosen-container-multi .chosen-choices{position:relative;overflow:hidden;margin:0;padding:0 5px;width:100%;height:auto;border:1px solid #aaa;background-color:#fff;background-image:-webkit-gradient(linear,left top,left bottom,color-stop(1%,#eee),color-stop(15%,#fff));background-image:linear-gradient(#eee 1%,#fff 15%);cursor:text}.chosen-container-multi .chosen-choices li{float:left;list-style:none}.chosen-container-multi .chosen-choices li.search-field{margin:0;padding:0;white-space:nowrap}.chosen-container-multi .chosen-choices li.search-field input[type=text]{margin:1px 0;padding:0;height:25px;outline:0;border:0!important;background:0 0!important;-webkit-box-shadow:none;box-shadow:none;color:#999;font-size:100%;font-family:sans-serif;line-height:normal;border-radius:0;width:25px}.chosen-container-multi .chosen-choices li.search-choice{position:relative;margin:3px 5px 3px 0;padding:3px 20px 3px 5px;border:1px solid #aaa;max-width:100%;border-radius:3px;background-color:#eee;background-image:-webkit-gradient(linear,left top,left bottom,color-stop(20%,#f4f4f4),color-stop(50%,#f0f0f0),color-stop(52%,#e8e8e8),to(#eee));background-image:linear-gradient(#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-size:100% 19px;background-repeat:repeat-x;background-clip:padding-box;-webkit-box-shadow:0 0 2px #fff inset,0 1px 0 rgba(0,0,0,.05);box-shadow:0 0 2px #fff inset,0 1px 0 rgba(0,0,0,.05);color:#333;line-height:13px;cursor:default}.chosen-container-multi .chosen-choices li.search-choice span{word-wrap:break-word}.chosen-container-multi .chosen-choices li.search-choice .search-choice-close{position:absolute;top:4px;right:3px;display:block;width:12px;height:12px;background:url(chosen-sprite.png) -42px 1px no-repeat;font-size:1px}.chosen-container-multi .chosen-choices li.search-choice .search-choice-close:hover{background-position:-42px -10px}.chosen-container-multi .chosen-choices li.search-choice-disabled{padding-right:5px;border:1px solid #ccc;background-color:#e4e4e4;background-image:-webkit-gradient(linear,left top,left bottom,color-stop(20%,#f4f4f4),color-stop(50%,#f0f0f0),color-stop(52%,#e8e8e8),to(#eee));background-image:linear-gradient(#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);color:#666}.chosen-container-multi .chosen-choices li.search-choice-focus{background:#d4d4d4}.chosen-container-multi .chosen-choices li.search-choice-focus .search-choice-close{background-position:-42px -10px}.chosen-container-multi .chosen-results{margin:0;padding:0}.chosen-container-multi .chosen-drop .result-selected{display:list-item;color:#ccc;cursor:default}.chosen-container-active .chosen-single{border:1px solid #5897fb;-webkit-box-shadow:0 0 5px rgba(0,0,0,.3);box-shadow:0 0 5px rgba(0,0,0,.3)}.chosen-container-active.chosen-with-drop .chosen-single{border:1px solid #aaa;border-bottom-right-radius:0;border-bottom-left-radius:0;background-image:-webkit-gradient(linear,left top,left bottom,color-stop(20%,#eee),color-stop(80%,#fff));background-image:linear-gradient(#eee 20%,#fff 80%);-webkit-box-shadow:0 1px 0 #fff inset;box-shadow:0 1px 0 #fff inset}.chosen-container-active.chosen-with-drop .chosen-single div{border-left:none;background:0 0}.chosen-container-active.chosen-with-drop .chosen-single div b{background-position:-18px 2px}.chosen-container-active .chosen-choices{border:1px solid #5897fb;-webkit-box-shadow:0 0 5px rgba(0,0,0,.3);box-shadow:0 0 5px rgba(0,0,0,.3)}.chosen-container-active .chosen-choices li.search-field input[type=text]{color:#222!important}.chosen-disabled{opacity:.5!important;cursor:default}.chosen-disabled .chosen-single{cursor:default}.chosen-disabled .chosen-choices .search-choice .search-choice-close{cursor:default}.chosen-rtl{text-align:right}.chosen-rtl .chosen-single{overflow:visible;padding:0 8px 0 0}.chosen-rtl .chosen-single span{margin-right:0;margin-left:26px;direction:rtl}.chosen-rtl .chosen-single-with-deselect span{margin-left:38px}.chosen-rtl .chosen-single div{right:auto;left:3px}.chosen-rtl .chosen-single abbr{right:auto;left:26px}.chosen-rtl .chosen-choices li{float:right}.chosen-rtl .chosen-choices li.search-field input[type=text]{direction:rtl}.chosen-rtl .chosen-choices li.search-choice{margin:3px 5px 3px 0;padding:3px 5px 3px 19px}.chosen-rtl .chosen-choices li.search-choice .search-choice-close{right:auto;left:4px}.chosen-rtl.chosen-container-single .chosen-results{margin:0 0 4px 4px;padding:0 4px 0 0}.chosen-rtl .chosen-results li.group-option{padding-right:15px;padding-left:0}.chosen-rtl.chosen-container-active.chosen-with-drop .chosen-single div{border-right:none}.chosen-rtl .chosen-search input[type=text]{padding:4px 5px 4px 20px;background:url(chosen-sprite.png) no-repeat -30px -20px;direction:rtl}.chosen-rtl.chosen-container-single .chosen-single div b{background-position:6px 2px}.chosen-rtl.chosen-container-single.chosen-with-drop .chosen-single div b{background-position:-12px 2px}@media only screen and (-webkit-min-device-pixel-ratio:1.5),only screen and (min-resolution:144dpi),only screen and (min-resolution:1.5dppx){.chosen-container .chosen-results-scroll-down span,.chosen-container .chosen-results-scroll-up span,.chosen-container-multi .chosen-choices .search-choice .search-choice-close,.chosen-container-single .chosen-search input[type=text],.chosen-container-single .chosen-single abbr,.chosen-container-single .chosen-single div b,.chosen-rtl .chosen-search input[type=text]{background-image:url(chosen-sprite@2x.png)!important;background-size:52px 37px!important;background-repeat:no-repeat!important}} \ No newline at end of file +*/.chosen-container{position:relative;display:inline-block;vertical-align:middle;font-size:13px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.chosen-container *{-webkit-box-sizing:border-box;box-sizing:border-box}.chosen-container .chosen-drop{position:absolute;top:100%;z-index:1010;width:100%;border:1px solid #aaa;border-top:0;background:#fff;-webkit-box-shadow:0 4px 5px rgba(0,0,0,.15);box-shadow:0 4px 5px rgba(0,0,0,.15);clip:rect(0,0,0,0);-webkit-clip-path:inset(100% 100%);clip-path:inset(100% 100%)}.chosen-container.chosen-with-drop .chosen-drop{clip:auto;-webkit-clip-path:none;clip-path:none}.chosen-container a{cursor:pointer}.chosen-container .chosen-single .group-name,.chosen-container .search-choice .group-name{margin-right:4px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-weight:400;color:#999}.chosen-container .chosen-single .group-name:after,.chosen-container .search-choice .group-name:after{content:":";padding-left:2px;vertical-align:top}.chosen-container-single .chosen-single{position:relative;display:block;overflow:hidden;padding:0 0 0 8px;height:25px;border:1px solid #aaa;border-radius:5px;background-color:#fff;background:-webkit-gradient(linear,left top,left bottom,color-stop(20%,#fff),color-stop(50%,#f6f6f6),color-stop(52%,#eee),to(#f4f4f4));background:linear-gradient(#fff 20%,#f6f6f6 50%,#eee 52%,#f4f4f4 100%);background-clip:padding-box;-webkit-box-shadow:0 0 3px #fff inset,0 1px 1px rgba(0,0,0,.1);box-shadow:0 0 3px #fff inset,0 1px 1px rgba(0,0,0,.1);color:#444;text-decoration:none;white-space:nowrap;line-height:24px}.chosen-container-single .chosen-default{color:#999}.chosen-container-single .chosen-single span{display:block;overflow:hidden;margin-right:26px;text-overflow:ellipsis;white-space:nowrap}.chosen-container-single .chosen-single-with-deselect span{margin-right:38px}.chosen-container-single .chosen-single abbr{position:absolute;top:6px;right:26px;display:block;width:12px;height:12px;background:url(chosen-sprite.png) -42px 1px no-repeat;font-size:1px}.chosen-container-single .chosen-single abbr:hover{background-position:-42px -10px}.chosen-container-single.chosen-disabled .chosen-single abbr:hover{background-position:-42px -10px}.chosen-container-single .chosen-single div{position:absolute;top:0;right:0;display:block;width:18px;height:100%}.chosen-container-single .chosen-single div b{display:block;width:100%;height:100%;background:url(chosen-sprite.png) no-repeat 0 2px}.chosen-container-single .chosen-search{position:relative;z-index:1010;margin:0;padding:3px 4px;white-space:nowrap}.chosen-container-single .chosen-search input[type=text]{margin:1px 0;padding:4px 20px 4px 5px;width:100%;height:auto;outline:0;border:1px solid #aaa;background:url(chosen-sprite.png) no-repeat 100% -20px;font-size:1em;font-family:sans-serif;line-height:normal;border-radius:0}.chosen-container-single .chosen-drop{margin-top:-1px;border-radius:0 0 4px 4px;background-clip:padding-box}.chosen-container-single.chosen-container-single-nosearch .chosen-search{position:absolute;clip:rect(0,0,0,0);-webkit-clip-path:inset(100% 100%);clip-path:inset(100% 100%)}.chosen-container .chosen-results{color:#444;position:relative;overflow-x:hidden;overflow-y:auto;margin:0 4px 4px 0;padding:0 0 0 4px;max-height:240px;-webkit-overflow-scrolling:touch}.chosen-container .chosen-results li{display:none;margin:0;padding:5px 6px;list-style:none;line-height:15px;word-wrap:break-word;-webkit-touch-callout:none}.chosen-container .chosen-results li.active-result{display:list-item;cursor:pointer}.chosen-container .chosen-results li.disabled-result{display:list-item;color:#ccc;cursor:default}.chosen-container .chosen-results li.highlighted{background-color:#3875d7;background-image:-webkit-gradient(linear,left top,left bottom,color-stop(20%,#3875d7),color-stop(90%,#2a62bc));background-image:linear-gradient(#3875d7 20%,#2a62bc 90%);color:#fff}.chosen-container .chosen-results li.no-results{color:#777;display:list-item;background:#f4f4f4}.chosen-container .chosen-results li.group-result{display:list-item;font-weight:700;cursor:default}.chosen-container .chosen-results li.group-option{padding-left:15px}.chosen-container .chosen-results li em{font-style:normal;text-decoration:underline}.chosen-container-multi .chosen-choices{position:relative;overflow:hidden;margin:0;padding:0 5px;width:100%;height:auto;border:1px solid #aaa;background-color:#fff;background-image:-webkit-gradient(linear,left top,left bottom,color-stop(1%,#eee),color-stop(15%,#fff));background-image:linear-gradient(#eee 1%,#fff 15%);cursor:text}.chosen-container-multi .chosen-choices li{float:left;list-style:none}.chosen-container-multi .chosen-choices li.search-field{margin:0;padding:0;white-space:nowrap}.chosen-container-multi .chosen-choices li.search-field input[type=text]{margin:1px 0;padding:0;height:25px;outline:0;border:0!important;background:0 0!important;-webkit-box-shadow:none;box-shadow:none;color:#999;font-size:100%;font-family:sans-serif;line-height:normal;border-radius:0;width:25px}.chosen-container-multi .chosen-choices li.search-choice{position:relative;margin:3px 5px 3px 0;padding:3px 20px 3px 5px;border:1px solid #aaa;max-width:100%;border-radius:3px;background-color:#eee;background-image:-webkit-gradient(linear,left top,left bottom,color-stop(20%,#f4f4f4),color-stop(50%,#f0f0f0),color-stop(52%,#e8e8e8),to(#eee));background-image:linear-gradient(#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-size:100% 19px;background-repeat:repeat-x;background-clip:padding-box;-webkit-box-shadow:0 0 2px #fff inset,0 1px 0 rgba(0,0,0,.05);box-shadow:0 0 2px #fff inset,0 1px 0 rgba(0,0,0,.05);color:#333;line-height:13px;cursor:default}.chosen-container-multi .chosen-choices li.search-choice span{word-wrap:break-word}.chosen-container-multi .chosen-choices li.search-choice .search-choice-close{position:absolute;top:4px;right:3px;display:block;width:12px;height:12px;background:url(chosen-sprite.png) -42px 1px no-repeat;font-size:1px}.chosen-container-multi .chosen-choices li.search-choice .search-choice-close:hover{background-position:-42px -10px}.chosen-container-multi .chosen-choices li.search-choice-disabled{padding-right:5px;border:1px solid #ccc;background-color:#e4e4e4;background-image:-webkit-gradient(linear,left top,left bottom,color-stop(20%,#f4f4f4),color-stop(50%,#f0f0f0),color-stop(52%,#e8e8e8),to(#eee));background-image:linear-gradient(#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);color:#666}.chosen-container-multi .chosen-choices li.search-choice-focus{background:#d4d4d4}.chosen-container-multi .chosen-choices li.search-choice-focus .search-choice-close{background-position:-42px -10px}.chosen-container-multi .chosen-results{margin:0;padding:0}.chosen-container-multi .chosen-drop .result-selected{display:list-item;color:#ccc;cursor:default}.chosen-container-active .chosen-single{border:1px solid #5897fb;-webkit-box-shadow:0 0 5px rgba(0,0,0,.3);box-shadow:0 0 5px rgba(0,0,0,.3)}.chosen-container-active.chosen-with-drop .chosen-single{border:1px solid #aaa;border-bottom-right-radius:0;border-bottom-left-radius:0;background-image:-webkit-gradient(linear,left top,left bottom,color-stop(20%,#eee),color-stop(80%,#fff));background-image:linear-gradient(#eee 20%,#fff 80%);-webkit-box-shadow:0 1px 0 #fff inset;box-shadow:0 1px 0 #fff inset}.chosen-container-active.chosen-with-drop .chosen-single div{border-left:none;background:0 0}.chosen-container-active.chosen-with-drop .chosen-single div b{background-position:-18px 2px}.chosen-container-active .chosen-choices{border:1px solid #5897fb;-webkit-box-shadow:0 0 5px rgba(0,0,0,.3);box-shadow:0 0 5px rgba(0,0,0,.3)}.chosen-container-active .chosen-choices li.search-field input[type=text]{color:#222!important}.chosen-disabled{opacity:.5!important;cursor:default}.chosen-disabled .chosen-single{cursor:default}.chosen-disabled .chosen-choices .search-choice .search-choice-close{cursor:default}.chosen-rtl{text-align:right}.chosen-rtl .chosen-single{overflow:visible;padding:0 8px 0 0}.chosen-rtl .chosen-single span{margin-right:0;margin-left:26px;direction:rtl}.chosen-rtl .chosen-single-with-deselect span{margin-left:38px}.chosen-rtl .chosen-single div{right:auto;left:3px}.chosen-rtl .chosen-single abbr{right:auto;left:26px}.chosen-rtl .chosen-choices li{float:right}.chosen-rtl .chosen-choices li.search-field input[type=text]{direction:rtl}.chosen-rtl .chosen-choices li.search-choice{margin:3px 5px 3px 0;padding:3px 5px 3px 19px}.chosen-rtl .chosen-choices li.search-choice .search-choice-close{right:auto;left:4px}.chosen-rtl.chosen-container-single .chosen-results{margin:0 0 4px 4px;padding:0 4px 0 0}.chosen-rtl .chosen-results li.group-option{padding-right:15px;padding-left:0}.chosen-rtl.chosen-container-active.chosen-with-drop .chosen-single div{border-right:none}.chosen-rtl .chosen-search input[type=text]{padding:4px 5px 4px 20px;background:url(chosen-sprite.png) no-repeat -30px -20px;direction:rtl}.chosen-rtl.chosen-container-single .chosen-single div b{background-position:6px 2px}.chosen-rtl.chosen-container-single.chosen-with-drop .chosen-single div b{background-position:-12px 2px}@media only screen and (-webkit-min-device-pixel-ratio:1.5),only screen and (min-resolution:144dpi),only screen and (min-resolution:1.5dppx){.chosen-container .chosen-results-scroll-down span,.chosen-container .chosen-results-scroll-up span,.chosen-container-multi .chosen-choices .search-choice .search-choice-close,.chosen-container-single .chosen-search input[type=text],.chosen-container-single .chosen-single abbr,.chosen-container-single .chosen-single div b,.chosen-rtl .chosen-search input[type=text]{background-image:url(chosen-sprite@2x.png)!important;background-size:52px 37px!important;background-repeat:no-repeat!important}} \ No newline at end of file diff --git a/core/src/main/resources/io/cucumber/core/plugin/timeline/index.html b/core/src/main/resources/io/cucumber/core/plugin/timeline/index.html index 0beedb7564..9fee5be7eb 100644 --- a/core/src/main/resources/io/cucumber/core/plugin/timeline/index.html +++ b/core/src/main/resources/io/cucumber/core/plugin/timeline/index.html @@ -8,7 +8,7 @@ - + diff --git a/core/src/main/resources/io/cucumber/core/plugin/timeline/jquery-3.3.1.min.js b/core/src/main/resources/io/cucumber/core/plugin/timeline/jquery-3.3.1.min.js deleted file mode 100644 index 4d9b3a2587..0000000000 --- a/core/src/main/resources/io/cucumber/core/plugin/timeline/jquery-3.3.1.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! jQuery v3.3.1 | (c) JS Foundation and other contributors | jquery.org/license */ -!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(e,t){"use strict";var n=[],r=e.document,i=Object.getPrototypeOf,o=n.slice,a=n.concat,s=n.push,u=n.indexOf,l={},c=l.toString,f=l.hasOwnProperty,p=f.toString,d=p.call(Object),h={},g=function e(t){return"function"==typeof t&&"number"!=typeof t.nodeType},y=function e(t){return null!=t&&t===t.window},v={type:!0,src:!0,noModule:!0};function m(e,t,n){var i,o=(t=t||r).createElement("script");if(o.text=e,n)for(i in v)n[i]&&(o[i]=n[i]);t.head.appendChild(o).parentNode.removeChild(o)}function x(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[c.call(e)]||"object":typeof e}var b="3.3.1",w=function(e,t){return new w.fn.init(e,t)},T=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;w.fn=w.prototype={jquery:"3.3.1",constructor:w,length:0,toArray:function(){return o.call(this)},get:function(e){return null==e?o.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=w.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return w.each(this,e)},map:function(e){return this.pushStack(w.map(this,function(t,n){return e.call(t,n,t)}))},slice:function(){return this.pushStack(o.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(n>=0&&n0&&t-1 in e)}var E=function(e){var t,n,r,i,o,a,s,u,l,c,f,p,d,h,g,y,v,m,x,b="sizzle"+1*new Date,w=e.document,T=0,C=0,E=ae(),k=ae(),S=ae(),D=function(e,t){return e===t&&(f=!0),0},N={}.hasOwnProperty,A=[],j=A.pop,q=A.push,L=A.push,H=A.slice,O=function(e,t){for(var n=0,r=e.length;n+~]|"+M+")"+M+"*"),z=new RegExp("="+M+"*([^\\]'\"]*?)"+M+"*\\]","g"),X=new RegExp(W),U=new RegExp("^"+R+"$"),V={ID:new RegExp("^#("+R+")"),CLASS:new RegExp("^\\.("+R+")"),TAG:new RegExp("^("+R+"|[*])"),ATTR:new RegExp("^"+I),PSEUDO:new RegExp("^"+W),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+P+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},G=/^(?:input|select|textarea|button)$/i,Y=/^h\d$/i,Q=/^[^{]+\{\s*\[native \w/,J=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,K=/[+~]/,Z=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),ee=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},te=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ne=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},re=function(){p()},ie=me(function(e){return!0===e.disabled&&("form"in e||"label"in e)},{dir:"parentNode",next:"legend"});try{L.apply(A=H.call(w.childNodes),w.childNodes),A[w.childNodes.length].nodeType}catch(e){L={apply:A.length?function(e,t){q.apply(e,H.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function oe(e,t,r,i){var o,s,l,c,f,h,v,m=t&&t.ownerDocument,T=t?t.nodeType:9;if(r=r||[],"string"!=typeof e||!e||1!==T&&9!==T&&11!==T)return r;if(!i&&((t?t.ownerDocument||t:w)!==d&&p(t),t=t||d,g)){if(11!==T&&(f=J.exec(e)))if(o=f[1]){if(9===T){if(!(l=t.getElementById(o)))return r;if(l.id===o)return r.push(l),r}else if(m&&(l=m.getElementById(o))&&x(t,l)&&l.id===o)return r.push(l),r}else{if(f[2])return L.apply(r,t.getElementsByTagName(e)),r;if((o=f[3])&&n.getElementsByClassName&&t.getElementsByClassName)return L.apply(r,t.getElementsByClassName(o)),r}if(n.qsa&&!S[e+" "]&&(!y||!y.test(e))){if(1!==T)m=t,v=e;else if("object"!==t.nodeName.toLowerCase()){(c=t.getAttribute("id"))?c=c.replace(te,ne):t.setAttribute("id",c=b),s=(h=a(e)).length;while(s--)h[s]="#"+c+" "+ve(h[s]);v=h.join(","),m=K.test(e)&&ge(t.parentNode)||t}if(v)try{return L.apply(r,m.querySelectorAll(v)),r}catch(e){}finally{c===b&&t.removeAttribute("id")}}}return u(e.replace(B,"$1"),t,r,i)}function ae(){var e=[];function t(n,i){return e.push(n+" ")>r.cacheLength&&delete t[e.shift()],t[n+" "]=i}return t}function se(e){return e[b]=!0,e}function ue(e){var t=d.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function le(e,t){var n=e.split("|"),i=n.length;while(i--)r.attrHandle[n[i]]=t}function ce(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function fe(e){return function(t){return"input"===t.nodeName.toLowerCase()&&t.type===e}}function pe(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function de(e){return function(t){return"form"in t?t.parentNode&&!1===t.disabled?"label"in t?"label"in t.parentNode?t.parentNode.disabled===e:t.disabled===e:t.isDisabled===e||t.isDisabled!==!e&&ie(t)===e:t.disabled===e:"label"in t&&t.disabled===e}}function he(e){return se(function(t){return t=+t,se(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}function ge(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}n=oe.support={},o=oe.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return!!t&&"HTML"!==t.nodeName},p=oe.setDocument=function(e){var t,i,a=e?e.ownerDocument||e:w;return a!==d&&9===a.nodeType&&a.documentElement?(d=a,h=d.documentElement,g=!o(d),w!==d&&(i=d.defaultView)&&i.top!==i&&(i.addEventListener?i.addEventListener("unload",re,!1):i.attachEvent&&i.attachEvent("onunload",re)),n.attributes=ue(function(e){return e.className="i",!e.getAttribute("className")}),n.getElementsByTagName=ue(function(e){return e.appendChild(d.createComment("")),!e.getElementsByTagName("*").length}),n.getElementsByClassName=Q.test(d.getElementsByClassName),n.getById=ue(function(e){return h.appendChild(e).id=b,!d.getElementsByName||!d.getElementsByName(b).length}),n.getById?(r.filter.ID=function(e){var t=e.replace(Z,ee);return function(e){return e.getAttribute("id")===t}},r.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&g){var n=t.getElementById(e);return n?[n]:[]}}):(r.filter.ID=function(e){var t=e.replace(Z,ee);return function(e){var n="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}},r.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&g){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),r.find.TAG=n.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):n.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},r.find.CLASS=n.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&g)return t.getElementsByClassName(e)},v=[],y=[],(n.qsa=Q.test(d.querySelectorAll))&&(ue(function(e){h.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&y.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||y.push("\\["+M+"*(?:value|"+P+")"),e.querySelectorAll("[id~="+b+"-]").length||y.push("~="),e.querySelectorAll(":checked").length||y.push(":checked"),e.querySelectorAll("a#"+b+"+*").length||y.push(".#.+[+~]")}),ue(function(e){e.innerHTML="";var t=d.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&y.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&y.push(":enabled",":disabled"),h.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&y.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),y.push(",.*:")})),(n.matchesSelector=Q.test(m=h.matches||h.webkitMatchesSelector||h.mozMatchesSelector||h.oMatchesSelector||h.msMatchesSelector))&&ue(function(e){n.disconnectedMatch=m.call(e,"*"),m.call(e,"[s!='']:x"),v.push("!=",W)}),y=y.length&&new RegExp(y.join("|")),v=v.length&&new RegExp(v.join("|")),t=Q.test(h.compareDocumentPosition),x=t||Q.test(h.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},D=t?function(e,t){if(e===t)return f=!0,0;var r=!e.compareDocumentPosition-!t.compareDocumentPosition;return r||(1&(r=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!n.sortDetached&&t.compareDocumentPosition(e)===r?e===d||e.ownerDocument===w&&x(w,e)?-1:t===d||t.ownerDocument===w&&x(w,t)?1:c?O(c,e)-O(c,t):0:4&r?-1:1)}:function(e,t){if(e===t)return f=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e===d?-1:t===d?1:i?-1:o?1:c?O(c,e)-O(c,t):0;if(i===o)return ce(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?ce(a[r],s[r]):a[r]===w?-1:s[r]===w?1:0},d):d},oe.matches=function(e,t){return oe(e,null,null,t)},oe.matchesSelector=function(e,t){if((e.ownerDocument||e)!==d&&p(e),t=t.replace(z,"='$1']"),n.matchesSelector&&g&&!S[t+" "]&&(!v||!v.test(t))&&(!y||!y.test(t)))try{var r=m.call(e,t);if(r||n.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(e){}return oe(t,d,null,[e]).length>0},oe.contains=function(e,t){return(e.ownerDocument||e)!==d&&p(e),x(e,t)},oe.attr=function(e,t){(e.ownerDocument||e)!==d&&p(e);var i=r.attrHandle[t.toLowerCase()],o=i&&N.call(r.attrHandle,t.toLowerCase())?i(e,t,!g):void 0;return void 0!==o?o:n.attributes||!g?e.getAttribute(t):(o=e.getAttributeNode(t))&&o.specified?o.value:null},oe.escape=function(e){return(e+"").replace(te,ne)},oe.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},oe.uniqueSort=function(e){var t,r=[],i=0,o=0;if(f=!n.detectDuplicates,c=!n.sortStable&&e.slice(0),e.sort(D),f){while(t=e[o++])t===e[o]&&(i=r.push(o));while(i--)e.splice(r[i],1)}return c=null,e},i=oe.getText=function(e){var t,n="",r=0,o=e.nodeType;if(o){if(1===o||9===o||11===o){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=i(e)}else if(3===o||4===o)return e.nodeValue}else while(t=e[r++])n+=i(t);return n},(r=oe.selectors={cacheLength:50,createPseudo:se,match:V,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(Z,ee),e[3]=(e[3]||e[4]||e[5]||"").replace(Z,ee),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||oe.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&oe.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return V.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=a(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(Z,ee).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=E[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&E(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=oe.attr(r,e);return null==i?"!="===t:!t||(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i.replace($," ")+" ").indexOf(n)>-1:"|="===t&&(i===n||i.slice(0,n.length+1)===n+"-"))}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,f,p,d,h,g=o!==a?"nextSibling":"previousSibling",y=t.parentNode,v=s&&t.nodeName.toLowerCase(),m=!u&&!s,x=!1;if(y){if(o){while(g){p=t;while(p=p[g])if(s?p.nodeName.toLowerCase()===v:1===p.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?y.firstChild:y.lastChild],a&&m){x=(d=(l=(c=(f=(p=y)[b]||(p[b]={}))[p.uniqueID]||(f[p.uniqueID]={}))[e]||[])[0]===T&&l[1])&&l[2],p=d&&y.childNodes[d];while(p=++d&&p&&p[g]||(x=d=0)||h.pop())if(1===p.nodeType&&++x&&p===t){c[e]=[T,d,x];break}}else if(m&&(x=d=(l=(c=(f=(p=t)[b]||(p[b]={}))[p.uniqueID]||(f[p.uniqueID]={}))[e]||[])[0]===T&&l[1]),!1===x)while(p=++d&&p&&p[g]||(x=d=0)||h.pop())if((s?p.nodeName.toLowerCase()===v:1===p.nodeType)&&++x&&(m&&((c=(f=p[b]||(p[b]={}))[p.uniqueID]||(f[p.uniqueID]={}))[e]=[T,x]),p===t))break;return(x-=i)===r||x%r==0&&x/r>=0}}},PSEUDO:function(e,t){var n,i=r.pseudos[e]||r.setFilters[e.toLowerCase()]||oe.error("unsupported pseudo: "+e);return i[b]?i(t):i.length>1?(n=[e,e,"",t],r.setFilters.hasOwnProperty(e.toLowerCase())?se(function(e,n){var r,o=i(e,t),a=o.length;while(a--)e[r=O(e,o[a])]=!(n[r]=o[a])}):function(e){return i(e,0,n)}):i}},pseudos:{not:se(function(e){var t=[],n=[],r=s(e.replace(B,"$1"));return r[b]?se(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),t[0]=null,!n.pop()}}),has:se(function(e){return function(t){return oe(e,t).length>0}}),contains:se(function(e){return e=e.replace(Z,ee),function(t){return(t.textContent||t.innerText||i(t)).indexOf(e)>-1}}),lang:se(function(e){return U.test(e||"")||oe.error("unsupported lang: "+e),e=e.replace(Z,ee).toLowerCase(),function(t){var n;do{if(n=g?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return(n=n.toLowerCase())===e||0===n.indexOf(e+"-")}while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===h},focus:function(e){return e===d.activeElement&&(!d.hasFocus||d.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:de(!1),disabled:de(!0),checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!r.pseudos.empty(e)},header:function(e){return Y.test(e.nodeName)},input:function(e){return G.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:he(function(){return[0]}),last:he(function(e,t){return[t-1]}),eq:he(function(e,t,n){return[n<0?n+t:n]}),even:he(function(e,t){for(var n=0;n=0;)e.push(r);return e}),gt:he(function(e,t,n){for(var r=n<0?n+t:n;++r1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function be(e,t,n){for(var r=0,i=t.length;r-1&&(o[l]=!(a[l]=f))}}else v=we(v===a?v.splice(h,v.length):v),i?i(null,a,v,u):L.apply(a,v)})}function Ce(e){for(var t,n,i,o=e.length,a=r.relative[e[0].type],s=a||r.relative[" "],u=a?1:0,c=me(function(e){return e===t},s,!0),f=me(function(e){return O(t,e)>-1},s,!0),p=[function(e,n,r){var i=!a&&(r||n!==l)||((t=n).nodeType?c(e,n,r):f(e,n,r));return t=null,i}];u1&&xe(p),u>1&&ve(e.slice(0,u-1).concat({value:" "===e[u-2].type?"*":""})).replace(B,"$1"),n,u0,i=e.length>0,o=function(o,a,s,u,c){var f,h,y,v=0,m="0",x=o&&[],b=[],w=l,C=o||i&&r.find.TAG("*",c),E=T+=null==w?1:Math.random()||.1,k=C.length;for(c&&(l=a===d||a||c);m!==k&&null!=(f=C[m]);m++){if(i&&f){h=0,a||f.ownerDocument===d||(p(f),s=!g);while(y=e[h++])if(y(f,a||d,s)){u.push(f);break}c&&(T=E)}n&&((f=!y&&f)&&v--,o&&x.push(f))}if(v+=m,n&&m!==v){h=0;while(y=t[h++])y(x,b,a,s);if(o){if(v>0)while(m--)x[m]||b[m]||(b[m]=j.call(u));b=we(b)}L.apply(u,b),c&&!o&&b.length>0&&v+t.length>1&&oe.uniqueSort(u)}return c&&(T=E,l=w),x};return n?se(o):o}return s=oe.compile=function(e,t){var n,r=[],i=[],o=S[e+" "];if(!o){t||(t=a(e)),n=t.length;while(n--)(o=Ce(t[n]))[b]?r.push(o):i.push(o);(o=S(e,Ee(i,r))).selector=e}return o},u=oe.select=function(e,t,n,i){var o,u,l,c,f,p="function"==typeof e&&e,d=!i&&a(e=p.selector||e);if(n=n||[],1===d.length){if((u=d[0]=d[0].slice(0)).length>2&&"ID"===(l=u[0]).type&&9===t.nodeType&&g&&r.relative[u[1].type]){if(!(t=(r.find.ID(l.matches[0].replace(Z,ee),t)||[])[0]))return n;p&&(t=t.parentNode),e=e.slice(u.shift().value.length)}o=V.needsContext.test(e)?0:u.length;while(o--){if(l=u[o],r.relative[c=l.type])break;if((f=r.find[c])&&(i=f(l.matches[0].replace(Z,ee),K.test(u[0].type)&&ge(t.parentNode)||t))){if(u.splice(o,1),!(e=i.length&&ve(u)))return L.apply(n,i),n;break}}}return(p||s(e,d))(i,t,!g,n,!t||K.test(e)&&ge(t.parentNode)||t),n},n.sortStable=b.split("").sort(D).join("")===b,n.detectDuplicates=!!f,p(),n.sortDetached=ue(function(e){return 1&e.compareDocumentPosition(d.createElement("fieldset"))}),ue(function(e){return e.innerHTML="","#"===e.firstChild.getAttribute("href")})||le("type|href|height|width",function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),n.attributes&&ue(function(e){return e.innerHTML="",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||le("value",function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue}),ue(function(e){return null==e.getAttribute("disabled")})||le(P,function(e,t,n){var r;if(!n)return!0===e[t]?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),oe}(e);w.find=E,w.expr=E.selectors,w.expr[":"]=w.expr.pseudos,w.uniqueSort=w.unique=E.uniqueSort,w.text=E.getText,w.isXMLDoc=E.isXML,w.contains=E.contains,w.escapeSelector=E.escape;var k=function(e,t,n){var r=[],i=void 0!==n;while((e=e[t])&&9!==e.nodeType)if(1===e.nodeType){if(i&&w(e).is(n))break;r.push(e)}return r},S=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},D=w.expr.match.needsContext;function N(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}var A=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function j(e,t,n){return g(t)?w.grep(e,function(e,r){return!!t.call(e,r,e)!==n}):t.nodeType?w.grep(e,function(e){return e===t!==n}):"string"!=typeof t?w.grep(e,function(e){return u.call(t,e)>-1!==n}):w.filter(t,e,n)}w.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?w.find.matchesSelector(r,e)?[r]:[]:w.find.matches(e,w.grep(t,function(e){return 1===e.nodeType}))},w.fn.extend({find:function(e){var t,n,r=this.length,i=this;if("string"!=typeof e)return this.pushStack(w(e).filter(function(){for(t=0;t1?w.uniqueSort(n):n},filter:function(e){return this.pushStack(j(this,e||[],!1))},not:function(e){return this.pushStack(j(this,e||[],!0))},is:function(e){return!!j(this,"string"==typeof e&&D.test(e)?w(e):e||[],!1).length}});var q,L=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(w.fn.init=function(e,t,n){var i,o;if(!e)return this;if(n=n||q,"string"==typeof e){if(!(i="<"===e[0]&&">"===e[e.length-1]&&e.length>=3?[null,e,null]:L.exec(e))||!i[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(i[1]){if(t=t instanceof w?t[0]:t,w.merge(this,w.parseHTML(i[1],t&&t.nodeType?t.ownerDocument||t:r,!0)),A.test(i[1])&&w.isPlainObject(t))for(i in t)g(this[i])?this[i](t[i]):this.attr(i,t[i]);return this}return(o=r.getElementById(i[2]))&&(this[0]=o,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):g(e)?void 0!==n.ready?n.ready(e):e(w):w.makeArray(e,this)}).prototype=w.fn,q=w(r);var H=/^(?:parents|prev(?:Until|All))/,O={children:!0,contents:!0,next:!0,prev:!0};w.fn.extend({has:function(e){var t=w(e,this),n=t.length;return this.filter(function(){for(var e=0;e-1:1===n.nodeType&&w.find.matchesSelector(n,e))){o.push(n);break}return this.pushStack(o.length>1?w.uniqueSort(o):o)},index:function(e){return e?"string"==typeof e?u.call(w(e),this[0]):u.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(w.uniqueSort(w.merge(this.get(),w(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}});function P(e,t){while((e=e[t])&&1!==e.nodeType);return e}w.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return k(e,"parentNode")},parentsUntil:function(e,t,n){return k(e,"parentNode",n)},next:function(e){return P(e,"nextSibling")},prev:function(e){return P(e,"previousSibling")},nextAll:function(e){return k(e,"nextSibling")},prevAll:function(e){return k(e,"previousSibling")},nextUntil:function(e,t,n){return k(e,"nextSibling",n)},prevUntil:function(e,t,n){return k(e,"previousSibling",n)},siblings:function(e){return S((e.parentNode||{}).firstChild,e)},children:function(e){return S(e.firstChild)},contents:function(e){return N(e,"iframe")?e.contentDocument:(N(e,"template")&&(e=e.content||e),w.merge([],e.childNodes))}},function(e,t){w.fn[e]=function(n,r){var i=w.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=w.filter(r,i)),this.length>1&&(O[e]||w.uniqueSort(i),H.test(e)&&i.reverse()),this.pushStack(i)}});var M=/[^\x20\t\r\n\f]+/g;function R(e){var t={};return w.each(e.match(M)||[],function(e,n){t[n]=!0}),t}w.Callbacks=function(e){e="string"==typeof e?R(e):w.extend({},e);var t,n,r,i,o=[],a=[],s=-1,u=function(){for(i=i||e.once,r=t=!0;a.length;s=-1){n=a.shift();while(++s-1)o.splice(n,1),n<=s&&s--}),this},has:function(e){return e?w.inArray(e,o)>-1:o.length>0},empty:function(){return o&&(o=[]),this},disable:function(){return i=a=[],o=n="",this},disabled:function(){return!o},lock:function(){return i=a=[],n||t||(o=n=""),this},locked:function(){return!!i},fireWith:function(e,n){return i||(n=[e,(n=n||[]).slice?n.slice():n],a.push(n),t||u()),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!r}};return l};function I(e){return e}function W(e){throw e}function $(e,t,n,r){var i;try{e&&g(i=e.promise)?i.call(e).done(t).fail(n):e&&g(i=e.then)?i.call(e,t,n):t.apply(void 0,[e].slice(r))}catch(e){n.apply(void 0,[e])}}w.extend({Deferred:function(t){var n=[["notify","progress",w.Callbacks("memory"),w.Callbacks("memory"),2],["resolve","done",w.Callbacks("once memory"),w.Callbacks("once memory"),0,"resolved"],["reject","fail",w.Callbacks("once memory"),w.Callbacks("once memory"),1,"rejected"]],r="pending",i={state:function(){return r},always:function(){return o.done(arguments).fail(arguments),this},"catch":function(e){return i.then(null,e)},pipe:function(){var e=arguments;return w.Deferred(function(t){w.each(n,function(n,r){var i=g(e[r[4]])&&e[r[4]];o[r[1]](function(){var e=i&&i.apply(this,arguments);e&&g(e.promise)?e.promise().progress(t.notify).done(t.resolve).fail(t.reject):t[r[0]+"With"](this,i?[e]:arguments)})}),e=null}).promise()},then:function(t,r,i){var o=0;function a(t,n,r,i){return function(){var s=this,u=arguments,l=function(){var e,l;if(!(t=o&&(r!==W&&(s=void 0,u=[e]),n.rejectWith(s,u))}};t?c():(w.Deferred.getStackHook&&(c.stackTrace=w.Deferred.getStackHook()),e.setTimeout(c))}}return w.Deferred(function(e){n[0][3].add(a(0,e,g(i)?i:I,e.notifyWith)),n[1][3].add(a(0,e,g(t)?t:I)),n[2][3].add(a(0,e,g(r)?r:W))}).promise()},promise:function(e){return null!=e?w.extend(e,i):i}},o={};return w.each(n,function(e,t){var a=t[2],s=t[5];i[t[1]]=a.add,s&&a.add(function(){r=s},n[3-e][2].disable,n[3-e][3].disable,n[0][2].lock,n[0][3].lock),a.add(t[3].fire),o[t[0]]=function(){return o[t[0]+"With"](this===o?void 0:this,arguments),this},o[t[0]+"With"]=a.fireWith}),i.promise(o),t&&t.call(o,o),o},when:function(e){var t=arguments.length,n=t,r=Array(n),i=o.call(arguments),a=w.Deferred(),s=function(e){return function(n){r[e]=this,i[e]=arguments.length>1?o.call(arguments):n,--t||a.resolveWith(r,i)}};if(t<=1&&($(e,a.done(s(n)).resolve,a.reject,!t),"pending"===a.state()||g(i[n]&&i[n].then)))return a.then();while(n--)$(i[n],s(n),a.reject);return a.promise()}});var B=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;w.Deferred.exceptionHook=function(t,n){e.console&&e.console.warn&&t&&B.test(t.name)&&e.console.warn("jQuery.Deferred exception: "+t.message,t.stack,n)},w.readyException=function(t){e.setTimeout(function(){throw t})};var F=w.Deferred();w.fn.ready=function(e){return F.then(e)["catch"](function(e){w.readyException(e)}),this},w.extend({isReady:!1,readyWait:1,ready:function(e){(!0===e?--w.readyWait:w.isReady)||(w.isReady=!0,!0!==e&&--w.readyWait>0||F.resolveWith(r,[w]))}}),w.ready.then=F.then;function _(){r.removeEventListener("DOMContentLoaded",_),e.removeEventListener("load",_),w.ready()}"complete"===r.readyState||"loading"!==r.readyState&&!r.documentElement.doScroll?e.setTimeout(w.ready):(r.addEventListener("DOMContentLoaded",_),e.addEventListener("load",_));var z=function(e,t,n,r,i,o,a){var s=0,u=e.length,l=null==n;if("object"===x(n)){i=!0;for(s in n)z(e,t,s,n[s],!0,o,a)}else if(void 0!==r&&(i=!0,g(r)||(a=!0),l&&(a?(t.call(e,r),t=null):(l=t,t=function(e,t,n){return l.call(w(e),n)})),t))for(;s1,null,!0)},removeData:function(e){return this.each(function(){K.remove(this,e)})}}),w.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=J.get(e,t),n&&(!r||Array.isArray(n)?r=J.access(e,t,w.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=w.queue(e,t),r=n.length,i=n.shift(),o=w._queueHooks(e,t),a=function(){w.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return J.get(e,n)||J.access(e,n,{empty:w.Callbacks("once memory").add(function(){J.remove(e,[t+"queue",n])})})}}),w.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),arguments.length\x20\t\r\n\f]+)/i,he=/^$|^module$|\/(?:java|ecma)script/i,ge={option:[1,""],thead:[1,"","
          "],col:[2,"","
          "],tr:[2,"","
          "],td:[3,"","
          "],_default:[0,"",""]};ge.optgroup=ge.option,ge.tbody=ge.tfoot=ge.colgroup=ge.caption=ge.thead,ge.th=ge.td;function ye(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&N(e,t)?w.merge([e],n):n}function ve(e,t){for(var n=0,r=e.length;n-1)i&&i.push(o);else if(l=w.contains(o.ownerDocument,o),a=ye(f.appendChild(o),"script"),l&&ve(a),n){c=0;while(o=a[c++])he.test(o.type||"")&&n.push(o)}return f}!function(){var e=r.createDocumentFragment().appendChild(r.createElement("div")),t=r.createElement("input");t.setAttribute("type","radio"),t.setAttribute("checked","checked"),t.setAttribute("name","t"),e.appendChild(t),h.checkClone=e.cloneNode(!0).cloneNode(!0).lastChild.checked,e.innerHTML="",h.noCloneChecked=!!e.cloneNode(!0).lastChild.defaultValue}();var be=r.documentElement,we=/^key/,Te=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Ce=/^([^.]*)(?:\.(.+)|)/;function Ee(){return!0}function ke(){return!1}function Se(){try{return r.activeElement}catch(e){}}function De(e,t,n,r,i,o){var a,s;if("object"==typeof t){"string"!=typeof n&&(r=r||n,n=void 0);for(s in t)De(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=ke;else if(!i)return e;return 1===o&&(a=i,(i=function(e){return w().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=w.guid++)),e.each(function(){w.event.add(this,t,i,r,n)})}w.event={global:{},add:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,y=J.get(e);if(y){n.handler&&(n=(o=n).handler,i=o.selector),i&&w.find.matchesSelector(be,i),n.guid||(n.guid=w.guid++),(u=y.events)||(u=y.events={}),(a=y.handle)||(a=y.handle=function(t){return"undefined"!=typeof w&&w.event.triggered!==t.type?w.event.dispatch.apply(e,arguments):void 0}),l=(t=(t||"").match(M)||[""]).length;while(l--)d=g=(s=Ce.exec(t[l])||[])[1],h=(s[2]||"").split(".").sort(),d&&(f=w.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=w.event.special[d]||{},c=w.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&w.expr.match.needsContext.test(i),namespace:h.join(".")},o),(p=u[d])||((p=u[d]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(e,r,h,a)||e.addEventListener&&e.addEventListener(d,a)),f.add&&(f.add.call(e,c),c.handler.guid||(c.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),w.event.global[d]=!0)}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,y=J.hasData(e)&&J.get(e);if(y&&(u=y.events)){l=(t=(t||"").match(M)||[""]).length;while(l--)if(s=Ce.exec(t[l])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){f=w.event.special[d]||{},p=u[d=(r?f.delegateType:f.bindType)||d]||[],s=s[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=p.length;while(o--)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));a&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,h,y.handle)||w.removeEvent(e,d,y.handle),delete u[d])}else for(d in u)w.event.remove(e,d+t[l],n,r,!0);w.isEmptyObject(u)&&J.remove(e,"handle events")}},dispatch:function(e){var t=w.event.fix(e),n,r,i,o,a,s,u=new Array(arguments.length),l=(J.get(this,"events")||{})[t.type]||[],c=w.event.special[t.type]||{};for(u[0]=t,n=1;n=1))for(;l!==this;l=l.parentNode||this)if(1===l.nodeType&&("click"!==e.type||!0!==l.disabled)){for(o=[],a={},n=0;n-1:w.find(i,this,null,[l]).length),a[i]&&o.push(r);o.length&&s.push({elem:l,handlers:o})}return l=this,u\x20\t\r\n\f]*)[^>]*)\/>/gi,Ae=/\s*$/g;function Le(e,t){return N(e,"table")&&N(11!==t.nodeType?t:t.firstChild,"tr")?w(e).children("tbody")[0]||e:e}function He(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Oe(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Pe(e,t){var n,r,i,o,a,s,u,l;if(1===t.nodeType){if(J.hasData(e)&&(o=J.access(e),a=J.set(t,o),l=o.events)){delete a.handle,a.events={};for(i in l)for(n=0,r=l[i].length;n1&&"string"==typeof y&&!h.checkClone&&je.test(y))return e.each(function(i){var o=e.eq(i);v&&(t[0]=y.call(this,i,o.html())),Re(o,t,n,r)});if(p&&(i=xe(t,e[0].ownerDocument,!1,e,r),o=i.firstChild,1===i.childNodes.length&&(i=o),o||r)){for(u=(s=w.map(ye(i,"script"),He)).length;f")},clone:function(e,t,n){var r,i,o,a,s=e.cloneNode(!0),u=w.contains(e.ownerDocument,e);if(!(h.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||w.isXMLDoc(e)))for(a=ye(s),r=0,i=(o=ye(e)).length;r0&&ve(a,!u&&ye(e,"script")),s},cleanData:function(e){for(var t,n,r,i=w.event.special,o=0;void 0!==(n=e[o]);o++)if(Y(n)){if(t=n[J.expando]){if(t.events)for(r in t.events)i[r]?w.event.remove(n,r):w.removeEvent(n,r,t.handle);n[J.expando]=void 0}n[K.expando]&&(n[K.expando]=void 0)}}}),w.fn.extend({detach:function(e){return Ie(this,e,!0)},remove:function(e){return Ie(this,e)},text:function(e){return z(this,function(e){return void 0===e?w.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)})},null,e,arguments.length)},append:function(){return Re(this,arguments,function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||Le(this,e).appendChild(e)})},prepend:function(){return Re(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Le(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return Re(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return Re(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(w.cleanData(ye(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return w.clone(this,e,t)})},html:function(e){return z(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!Ae.test(e)&&!ge[(de.exec(e)||["",""])[1].toLowerCase()]){e=w.htmlPrefilter(e);try{for(;n=0&&(u+=Math.max(0,Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-o-u-s-.5))),u}function et(e,t,n){var r=$e(e),i=Fe(e,t,r),o="border-box"===w.css(e,"boxSizing",!1,r),a=o;if(We.test(i)){if(!n)return i;i="auto"}return a=a&&(h.boxSizingReliable()||i===e.style[t]),("auto"===i||!parseFloat(i)&&"inline"===w.css(e,"display",!1,r))&&(i=e["offset"+t[0].toUpperCase()+t.slice(1)],a=!0),(i=parseFloat(i)||0)+Ze(e,t,n||(o?"border":"content"),a,r,i)+"px"}w.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Fe(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,a,s=G(t),u=Xe.test(t),l=e.style;if(u||(t=Je(s)),a=w.cssHooks[t]||w.cssHooks[s],void 0===n)return a&&"get"in a&&void 0!==(i=a.get(e,!1,r))?i:l[t];"string"==(o=typeof n)&&(i=ie.exec(n))&&i[1]&&(n=ue(e,t,i),o="number"),null!=n&&n===n&&("number"===o&&(n+=i&&i[3]||(w.cssNumber[s]?"":"px")),h.clearCloneStyle||""!==n||0!==t.indexOf("background")||(l[t]="inherit"),a&&"set"in a&&void 0===(n=a.set(e,n,r))||(u?l.setProperty(t,n):l[t]=n))}},css:function(e,t,n,r){var i,o,a,s=G(t);return Xe.test(t)||(t=Je(s)),(a=w.cssHooks[t]||w.cssHooks[s])&&"get"in a&&(i=a.get(e,!0,n)),void 0===i&&(i=Fe(e,t,r)),"normal"===i&&t in Ve&&(i=Ve[t]),""===n||n?(o=parseFloat(i),!0===n||isFinite(o)?o||0:i):i}}),w.each(["height","width"],function(e,t){w.cssHooks[t]={get:function(e,n,r){if(n)return!ze.test(w.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?et(e,t,r):se(e,Ue,function(){return et(e,t,r)})},set:function(e,n,r){var i,o=$e(e),a="border-box"===w.css(e,"boxSizing",!1,o),s=r&&Ze(e,t,r,a,o);return a&&h.scrollboxSize()===o.position&&(s-=Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-parseFloat(o[t])-Ze(e,t,"border",!1,o)-.5)),s&&(i=ie.exec(n))&&"px"!==(i[3]||"px")&&(e.style[t]=n,n=w.css(e,t)),Ke(e,n,s)}}}),w.cssHooks.marginLeft=_e(h.reliableMarginLeft,function(e,t){if(t)return(parseFloat(Fe(e,"marginLeft"))||e.getBoundingClientRect().left-se(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}))+"px"}),w.each({margin:"",padding:"",border:"Width"},function(e,t){w.cssHooks[e+t]={expand:function(n){for(var r=0,i={},o="string"==typeof n?n.split(" "):[n];r<4;r++)i[e+oe[r]+t]=o[r]||o[r-2]||o[0];return i}},"margin"!==e&&(w.cssHooks[e+t].set=Ke)}),w.fn.extend({css:function(e,t){return z(this,function(e,t,n){var r,i,o={},a=0;if(Array.isArray(t)){for(r=$e(e),i=t.length;a1)}});function tt(e,t,n,r,i){return new tt.prototype.init(e,t,n,r,i)}w.Tween=tt,tt.prototype={constructor:tt,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||w.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(w.cssNumber[n]?"":"px")},cur:function(){var e=tt.propHooks[this.prop];return e&&e.get?e.get(this):tt.propHooks._default.get(this)},run:function(e){var t,n=tt.propHooks[this.prop];return this.options.duration?this.pos=t=w.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):tt.propHooks._default.set(this),this}},tt.prototype.init.prototype=tt.prototype,tt.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=w.css(e.elem,e.prop,""))&&"auto"!==t?t:0},set:function(e){w.fx.step[e.prop]?w.fx.step[e.prop](e):1!==e.elem.nodeType||null==e.elem.style[w.cssProps[e.prop]]&&!w.cssHooks[e.prop]?e.elem[e.prop]=e.now:w.style(e.elem,e.prop,e.now+e.unit)}}},tt.propHooks.scrollTop=tt.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},w.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},w.fx=tt.prototype.init,w.fx.step={};var nt,rt,it=/^(?:toggle|show|hide)$/,ot=/queueHooks$/;function at(){rt&&(!1===r.hidden&&e.requestAnimationFrame?e.requestAnimationFrame(at):e.setTimeout(at,w.fx.interval),w.fx.tick())}function st(){return e.setTimeout(function(){nt=void 0}),nt=Date.now()}function ut(e,t){var n,r=0,i={height:e};for(t=t?1:0;r<4;r+=2-t)i["margin"+(n=oe[r])]=i["padding"+n]=e;return t&&(i.opacity=i.width=e),i}function lt(e,t,n){for(var r,i=(pt.tweeners[t]||[]).concat(pt.tweeners["*"]),o=0,a=i.length;o1)},removeAttr:function(e){return this.each(function(){w.removeAttr(this,e)})}}),w.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return"undefined"==typeof e.getAttribute?w.prop(e,t,n):(1===o&&w.isXMLDoc(e)||(i=w.attrHooks[t.toLowerCase()]||(w.expr.match.bool.test(t)?dt:void 0)),void 0!==n?null===n?void w.removeAttr(e,t):i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+""),n):i&&"get"in i&&null!==(r=i.get(e,t))?r:null==(r=w.find.attr(e,t))?void 0:r)},attrHooks:{type:{set:function(e,t){if(!h.radioValue&&"radio"===t&&N(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r=0,i=t&&t.match(M);if(i&&1===e.nodeType)while(n=i[r++])e.removeAttribute(n)}}),dt={set:function(e,t,n){return!1===t?w.removeAttr(e,n):e.setAttribute(n,n),n}},w.each(w.expr.match.bool.source.match(/\w+/g),function(e,t){var n=ht[t]||w.find.attr;ht[t]=function(e,t,r){var i,o,a=t.toLowerCase();return r||(o=ht[a],ht[a]=i,i=null!=n(e,t,r)?a:null,ht[a]=o),i}});var gt=/^(?:input|select|textarea|button)$/i,yt=/^(?:a|area)$/i;w.fn.extend({prop:function(e,t){return z(this,w.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[w.propFix[e]||e]})}}),w.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&w.isXMLDoc(e)||(t=w.propFix[t]||t,i=w.propHooks[t]),void 0!==n?i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=w.find.attr(e,"tabindex");return t?parseInt(t,10):gt.test(e.nodeName)||yt.test(e.nodeName)&&e.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),h.optSelected||(w.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),w.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){w.propFix[this.toLowerCase()]=this});function vt(e){return(e.match(M)||[]).join(" ")}function mt(e){return e.getAttribute&&e.getAttribute("class")||""}function xt(e){return Array.isArray(e)?e:"string"==typeof e?e.match(M)||[]:[]}w.fn.extend({addClass:function(e){var t,n,r,i,o,a,s,u=0;if(g(e))return this.each(function(t){w(this).addClass(e.call(this,t,mt(this)))});if((t=xt(e)).length)while(n=this[u++])if(i=mt(n),r=1===n.nodeType&&" "+vt(i)+" "){a=0;while(o=t[a++])r.indexOf(" "+o+" ")<0&&(r+=o+" ");i!==(s=vt(r))&&n.setAttribute("class",s)}return this},removeClass:function(e){var t,n,r,i,o,a,s,u=0;if(g(e))return this.each(function(t){w(this).removeClass(e.call(this,t,mt(this)))});if(!arguments.length)return this.attr("class","");if((t=xt(e)).length)while(n=this[u++])if(i=mt(n),r=1===n.nodeType&&" "+vt(i)+" "){a=0;while(o=t[a++])while(r.indexOf(" "+o+" ")>-1)r=r.replace(" "+o+" "," ");i!==(s=vt(r))&&n.setAttribute("class",s)}return this},toggleClass:function(e,t){var n=typeof e,r="string"===n||Array.isArray(e);return"boolean"==typeof t&&r?t?this.addClass(e):this.removeClass(e):g(e)?this.each(function(n){w(this).toggleClass(e.call(this,n,mt(this),t),t)}):this.each(function(){var t,i,o,a;if(r){i=0,o=w(this),a=xt(e);while(t=a[i++])o.hasClass(t)?o.removeClass(t):o.addClass(t)}else void 0!==e&&"boolean"!==n||((t=mt(this))&&J.set(this,"__className__",t),this.setAttribute&&this.setAttribute("class",t||!1===e?"":J.get(this,"__className__")||""))})},hasClass:function(e){var t,n,r=0;t=" "+e+" ";while(n=this[r++])if(1===n.nodeType&&(" "+vt(mt(n))+" ").indexOf(t)>-1)return!0;return!1}});var bt=/\r/g;w.fn.extend({val:function(e){var t,n,r,i=this[0];{if(arguments.length)return r=g(e),this.each(function(n){var i;1===this.nodeType&&(null==(i=r?e.call(this,n,w(this).val()):e)?i="":"number"==typeof i?i+="":Array.isArray(i)&&(i=w.map(i,function(e){return null==e?"":e+""})),(t=w.valHooks[this.type]||w.valHooks[this.nodeName.toLowerCase()])&&"set"in t&&void 0!==t.set(this,i,"value")||(this.value=i))});if(i)return(t=w.valHooks[i.type]||w.valHooks[i.nodeName.toLowerCase()])&&"get"in t&&void 0!==(n=t.get(i,"value"))?n:"string"==typeof(n=i.value)?n.replace(bt,""):null==n?"":n}}}),w.extend({valHooks:{option:{get:function(e){var t=w.find.attr(e,"value");return null!=t?t:vt(w.text(e))}},select:{get:function(e){var t,n,r,i=e.options,o=e.selectedIndex,a="select-one"===e.type,s=a?null:[],u=a?o+1:i.length;for(r=o<0?u:a?o:0;r-1)&&(n=!0);return n||(e.selectedIndex=-1),o}}}}),w.each(["radio","checkbox"],function(){w.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=w.inArray(w(e).val(),t)>-1}},h.checkOn||(w.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})}),h.focusin="onfocusin"in e;var wt=/^(?:focusinfocus|focusoutblur)$/,Tt=function(e){e.stopPropagation()};w.extend(w.event,{trigger:function(t,n,i,o){var a,s,u,l,c,p,d,h,v=[i||r],m=f.call(t,"type")?t.type:t,x=f.call(t,"namespace")?t.namespace.split("."):[];if(s=h=u=i=i||r,3!==i.nodeType&&8!==i.nodeType&&!wt.test(m+w.event.triggered)&&(m.indexOf(".")>-1&&(m=(x=m.split(".")).shift(),x.sort()),c=m.indexOf(":")<0&&"on"+m,t=t[w.expando]?t:new w.Event(m,"object"==typeof t&&t),t.isTrigger=o?2:3,t.namespace=x.join("."),t.rnamespace=t.namespace?new RegExp("(^|\\.)"+x.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=void 0,t.target||(t.target=i),n=null==n?[t]:w.makeArray(n,[t]),d=w.event.special[m]||{},o||!d.trigger||!1!==d.trigger.apply(i,n))){if(!o&&!d.noBubble&&!y(i)){for(l=d.delegateType||m,wt.test(l+m)||(s=s.parentNode);s;s=s.parentNode)v.push(s),u=s;u===(i.ownerDocument||r)&&v.push(u.defaultView||u.parentWindow||e)}a=0;while((s=v[a++])&&!t.isPropagationStopped())h=s,t.type=a>1?l:d.bindType||m,(p=(J.get(s,"events")||{})[t.type]&&J.get(s,"handle"))&&p.apply(s,n),(p=c&&s[c])&&p.apply&&Y(s)&&(t.result=p.apply(s,n),!1===t.result&&t.preventDefault());return t.type=m,o||t.isDefaultPrevented()||d._default&&!1!==d._default.apply(v.pop(),n)||!Y(i)||c&&g(i[m])&&!y(i)&&((u=i[c])&&(i[c]=null),w.event.triggered=m,t.isPropagationStopped()&&h.addEventListener(m,Tt),i[m](),t.isPropagationStopped()&&h.removeEventListener(m,Tt),w.event.triggered=void 0,u&&(i[c]=u)),t.result}},simulate:function(e,t,n){var r=w.extend(new w.Event,n,{type:e,isSimulated:!0});w.event.trigger(r,null,t)}}),w.fn.extend({trigger:function(e,t){return this.each(function(){w.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];if(n)return w.event.trigger(e,t,n,!0)}}),h.focusin||w.each({focus:"focusin",blur:"focusout"},function(e,t){var n=function(e){w.event.simulate(t,e.target,w.event.fix(e))};w.event.special[t]={setup:function(){var r=this.ownerDocument||this,i=J.access(r,t);i||r.addEventListener(e,n,!0),J.access(r,t,(i||0)+1)},teardown:function(){var r=this.ownerDocument||this,i=J.access(r,t)-1;i?J.access(r,t,i):(r.removeEventListener(e,n,!0),J.remove(r,t))}}});var Ct=e.location,Et=Date.now(),kt=/\?/;w.parseXML=function(t){var n;if(!t||"string"!=typeof t)return null;try{n=(new e.DOMParser).parseFromString(t,"text/xml")}catch(e){n=void 0}return n&&!n.getElementsByTagName("parsererror").length||w.error("Invalid XML: "+t),n};var St=/\[\]$/,Dt=/\r?\n/g,Nt=/^(?:submit|button|image|reset|file)$/i,At=/^(?:input|select|textarea|keygen)/i;function jt(e,t,n,r){var i;if(Array.isArray(t))w.each(t,function(t,i){n||St.test(e)?r(e,i):jt(e+"["+("object"==typeof i&&null!=i?t:"")+"]",i,n,r)});else if(n||"object"!==x(t))r(e,t);else for(i in t)jt(e+"["+i+"]",t[i],n,r)}w.param=function(e,t){var n,r=[],i=function(e,t){var n=g(t)?t():t;r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==n?"":n)};if(Array.isArray(e)||e.jquery&&!w.isPlainObject(e))w.each(e,function(){i(this.name,this.value)});else for(n in e)jt(n,e[n],t,i);return r.join("&")},w.fn.extend({serialize:function(){return w.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=w.prop(this,"elements");return e?w.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!w(this).is(":disabled")&&At.test(this.nodeName)&&!Nt.test(e)&&(this.checked||!pe.test(e))}).map(function(e,t){var n=w(this).val();return null==n?null:Array.isArray(n)?w.map(n,function(e){return{name:t.name,value:e.replace(Dt,"\r\n")}}):{name:t.name,value:n.replace(Dt,"\r\n")}}).get()}});var qt=/%20/g,Lt=/#.*$/,Ht=/([?&])_=[^&]*/,Ot=/^(.*?):[ \t]*([^\r\n]*)$/gm,Pt=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Mt=/^(?:GET|HEAD)$/,Rt=/^\/\//,It={},Wt={},$t="*/".concat("*"),Bt=r.createElement("a");Bt.href=Ct.href;function Ft(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(M)||[];if(g(n))while(r=o[i++])"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function _t(e,t,n,r){var i={},o=e===Wt;function a(s){var u;return i[s]=!0,w.each(e[s]||[],function(e,s){var l=s(t,n,r);return"string"!=typeof l||o||i[l]?o?!(u=l):void 0:(t.dataTypes.unshift(l),a(l),!1)}),u}return a(t.dataTypes[0])||!i["*"]&&a("*")}function zt(e,t){var n,r,i=w.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&w.extend(!0,e,r),e}function Xt(e,t,n){var r,i,o,a,s=e.contents,u=e.dataTypes;while("*"===u[0])u.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(i in s)if(s[i]&&s[i].test(r)){u.unshift(i);break}if(u[0]in n)o=u[0];else{for(i in n){if(!u[0]||e.converters[i+" "+u[0]]){o=i;break}a||(a=i)}o=o||a}if(o)return o!==u[0]&&u.unshift(o),n[o]}function Ut(e,t,n,r){var i,o,a,s,u,l={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)l[a.toLowerCase()]=e.converters[a];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=o,o=c.shift())if("*"===o)o=u;else if("*"!==u&&u!==o){if(!(a=l[u+" "+o]||l["* "+o]))for(i in l)if((s=i.split(" "))[1]===o&&(a=l[u+" "+s[0]]||l["* "+s[0]])){!0===a?a=l[i]:!0!==l[i]&&(o=s[0],c.unshift(s[1]));break}if(!0!==a)if(a&&e["throws"])t=a(t);else try{t=a(t)}catch(e){return{state:"parsererror",error:a?e:"No conversion from "+u+" to "+o}}}return{state:"success",data:t}}w.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Ct.href,type:"GET",isLocal:Pt.test(Ct.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":$t,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":w.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?zt(zt(e,w.ajaxSettings),t):zt(w.ajaxSettings,e)},ajaxPrefilter:Ft(It),ajaxTransport:Ft(Wt),ajax:function(t,n){"object"==typeof t&&(n=t,t=void 0),n=n||{};var i,o,a,s,u,l,c,f,p,d,h=w.ajaxSetup({},n),g=h.context||h,y=h.context&&(g.nodeType||g.jquery)?w(g):w.event,v=w.Deferred(),m=w.Callbacks("once memory"),x=h.statusCode||{},b={},T={},C="canceled",E={readyState:0,getResponseHeader:function(e){var t;if(c){if(!s){s={};while(t=Ot.exec(a))s[t[1].toLowerCase()]=t[2]}t=s[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return c?a:null},setRequestHeader:function(e,t){return null==c&&(e=T[e.toLowerCase()]=T[e.toLowerCase()]||e,b[e]=t),this},overrideMimeType:function(e){return null==c&&(h.mimeType=e),this},statusCode:function(e){var t;if(e)if(c)E.always(e[E.status]);else for(t in e)x[t]=[x[t],e[t]];return this},abort:function(e){var t=e||C;return i&&i.abort(t),k(0,t),this}};if(v.promise(E),h.url=((t||h.url||Ct.href)+"").replace(Rt,Ct.protocol+"//"),h.type=n.method||n.type||h.method||h.type,h.dataTypes=(h.dataType||"*").toLowerCase().match(M)||[""],null==h.crossDomain){l=r.createElement("a");try{l.href=h.url,l.href=l.href,h.crossDomain=Bt.protocol+"//"+Bt.host!=l.protocol+"//"+l.host}catch(e){h.crossDomain=!0}}if(h.data&&h.processData&&"string"!=typeof h.data&&(h.data=w.param(h.data,h.traditional)),_t(It,h,n,E),c)return E;(f=w.event&&h.global)&&0==w.active++&&w.event.trigger("ajaxStart"),h.type=h.type.toUpperCase(),h.hasContent=!Mt.test(h.type),o=h.url.replace(Lt,""),h.hasContent?h.data&&h.processData&&0===(h.contentType||"").indexOf("application/x-www-form-urlencoded")&&(h.data=h.data.replace(qt,"+")):(d=h.url.slice(o.length),h.data&&(h.processData||"string"==typeof h.data)&&(o+=(kt.test(o)?"&":"?")+h.data,delete h.data),!1===h.cache&&(o=o.replace(Ht,"$1"),d=(kt.test(o)?"&":"?")+"_="+Et+++d),h.url=o+d),h.ifModified&&(w.lastModified[o]&&E.setRequestHeader("If-Modified-Since",w.lastModified[o]),w.etag[o]&&E.setRequestHeader("If-None-Match",w.etag[o])),(h.data&&h.hasContent&&!1!==h.contentType||n.contentType)&&E.setRequestHeader("Content-Type",h.contentType),E.setRequestHeader("Accept",h.dataTypes[0]&&h.accepts[h.dataTypes[0]]?h.accepts[h.dataTypes[0]]+("*"!==h.dataTypes[0]?", "+$t+"; q=0.01":""):h.accepts["*"]);for(p in h.headers)E.setRequestHeader(p,h.headers[p]);if(h.beforeSend&&(!1===h.beforeSend.call(g,E,h)||c))return E.abort();if(C="abort",m.add(h.complete),E.done(h.success),E.fail(h.error),i=_t(Wt,h,n,E)){if(E.readyState=1,f&&y.trigger("ajaxSend",[E,h]),c)return E;h.async&&h.timeout>0&&(u=e.setTimeout(function(){E.abort("timeout")},h.timeout));try{c=!1,i.send(b,k)}catch(e){if(c)throw e;k(-1,e)}}else k(-1,"No Transport");function k(t,n,r,s){var l,p,d,b,T,C=n;c||(c=!0,u&&e.clearTimeout(u),i=void 0,a=s||"",E.readyState=t>0?4:0,l=t>=200&&t<300||304===t,r&&(b=Xt(h,E,r)),b=Ut(h,b,E,l),l?(h.ifModified&&((T=E.getResponseHeader("Last-Modified"))&&(w.lastModified[o]=T),(T=E.getResponseHeader("etag"))&&(w.etag[o]=T)),204===t||"HEAD"===h.type?C="nocontent":304===t?C="notmodified":(C=b.state,p=b.data,l=!(d=b.error))):(d=C,!t&&C||(C="error",t<0&&(t=0))),E.status=t,E.statusText=(n||C)+"",l?v.resolveWith(g,[p,C,E]):v.rejectWith(g,[E,C,d]),E.statusCode(x),x=void 0,f&&y.trigger(l?"ajaxSuccess":"ajaxError",[E,h,l?p:d]),m.fireWith(g,[E,C]),f&&(y.trigger("ajaxComplete",[E,h]),--w.active||w.event.trigger("ajaxStop")))}return E},getJSON:function(e,t,n){return w.get(e,t,n,"json")},getScript:function(e,t){return w.get(e,void 0,t,"script")}}),w.each(["get","post"],function(e,t){w[t]=function(e,n,r,i){return g(n)&&(i=i||r,r=n,n=void 0),w.ajax(w.extend({url:e,type:t,dataType:i,data:n,success:r},w.isPlainObject(e)&&e))}}),w._evalUrl=function(e){return w.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},w.fn.extend({wrapAll:function(e){var t;return this[0]&&(g(e)&&(e=e.call(this[0])),t=w(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstElementChild)e=e.firstElementChild;return e}).append(this)),this},wrapInner:function(e){return g(e)?this.each(function(t){w(this).wrapInner(e.call(this,t))}):this.each(function(){var t=w(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=g(e);return this.each(function(n){w(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(e){return this.parent(e).not("body").each(function(){w(this).replaceWith(this.childNodes)}),this}}),w.expr.pseudos.hidden=function(e){return!w.expr.pseudos.visible(e)},w.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},w.ajaxSettings.xhr=function(){try{return new e.XMLHttpRequest}catch(e){}};var Vt={0:200,1223:204},Gt=w.ajaxSettings.xhr();h.cors=!!Gt&&"withCredentials"in Gt,h.ajax=Gt=!!Gt,w.ajaxTransport(function(t){var n,r;if(h.cors||Gt&&!t.crossDomain)return{send:function(i,o){var a,s=t.xhr();if(s.open(t.type,t.url,t.async,t.username,t.password),t.xhrFields)for(a in t.xhrFields)s[a]=t.xhrFields[a];t.mimeType&&s.overrideMimeType&&s.overrideMimeType(t.mimeType),t.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");for(a in i)s.setRequestHeader(a,i[a]);n=function(e){return function(){n&&(n=r=s.onload=s.onerror=s.onabort=s.ontimeout=s.onreadystatechange=null,"abort"===e?s.abort():"error"===e?"number"!=typeof s.status?o(0,"error"):o(s.status,s.statusText):o(Vt[s.status]||s.status,s.statusText,"text"!==(s.responseType||"text")||"string"!=typeof s.responseText?{binary:s.response}:{text:s.responseText},s.getAllResponseHeaders()))}},s.onload=n(),r=s.onerror=s.ontimeout=n("error"),void 0!==s.onabort?s.onabort=r:s.onreadystatechange=function(){4===s.readyState&&e.setTimeout(function(){n&&r()})},n=n("abort");try{s.send(t.hasContent&&t.data||null)}catch(e){if(n)throw e}},abort:function(){n&&n()}}}),w.ajaxPrefilter(function(e){e.crossDomain&&(e.contents.script=!1)}),w.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return w.globalEval(e),e}}}),w.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),w.ajaxTransport("script",function(e){if(e.crossDomain){var t,n;return{send:function(i,o){t=w("