[tapestry-5] 02/02: TAP5-2743: add "ifSet" to PerThreadValue
This is an automated email from the ASF dual-hosted git repository. benw pushed a commit to branch TAP5-2743 in repository https://gitbox.apache.org/repos/asf/tapestry-5.git commit 0a644287cdc21b8b271b169f244ff3fbe0032f07 Author: Ben Weidig AuthorDate: Thu Dec 29 09:49:03 2022 +0100 TAP5-2743: add "ifSet" to PerThreadValue --- .../tapestry5/ioc/services/PerThreadValue.java | 19 .../groovy/ioc/specs/PerThreadValueSpec.groovy | 52 +- 2 files changed, 69 insertions(+), 2 deletions(-) diff --git a/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/PerThreadValue.java b/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/PerThreadValue.java index 4c1c3b73c..5b23069a7 100644 --- a/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/PerThreadValue.java +++ b/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/PerThreadValue.java @@ -15,6 +15,7 @@ package org.apache.tapestry5.ioc.services; import java.util.Objects; +import java.util.function.Consumer; import java.util.function.Function; import java.util.function.Supplier; @@ -108,4 +109,22 @@ public interface PerThreadValue return newValue; } + +/** + * If a value is set, performs the given action with it, otherwise it + * does nothing. + * + * @param action performed action if a value is set + * @throws NullPointerException if the action is null + * @since 5.8.3 + */ +default void ifSet(Consumer action) { +Objects.requireNonNull(action); + +if (!exists()) { +return; +} + +action.accept(get()); +} } diff --git a/tapestry-ioc/src/test/groovy/ioc/specs/PerThreadValueSpec.groovy b/tapestry-ioc/src/test/groovy/ioc/specs/PerThreadValueSpec.groovy index 2afbb03e0..9bc15c6fb 100644 --- a/tapestry-ioc/src/test/groovy/ioc/specs/PerThreadValueSpec.groovy +++ b/tapestry-ioc/src/test/groovy/ioc/specs/PerThreadValueSpec.groovy @@ -135,6 +135,54 @@ class PerThreadValueSpec extends Specification { then: thrown NullPointerException -} - + } + + def "ifSet - value is set"() { +given: +PerThreadValue perThreadValue = manager.createValue(); +perThreadValue.set("a value"); +def hasRun = false + +when: +perThreadValue.ifSet { hasRun = true } + +then: +hasRun == true + } + + def "ifSet - no value set"() { +given: +PerThreadValue perThreadValue = manager.createValue(); +def hasRun = false + +when: +perThreadValue.ifSet { hasRun = true } + +then: +hasRun == false + } + + def "ifSet - action is null with no value set"() { +given: +PerThreadValue perThreadValue = manager.createValue(); + +when: +perThreadValue.ifSet(null) + +then: +thrown NullPointerException + } + + def "ifSet - action is null with value set"() { +given: +PerThreadValue perThreadValue = manager.createValue(); +perThreadValue.set("a value") + +when: +perThreadValue.ifSet(null) + +then: +thrown NullPointerException + } + } \ No newline at end of file
[tapestry-5] branch TAP5-2743 updated (c90d9d802 -> 0a644287c)
This is an automated email from the ASF dual-hosted git repository. benw pushed a change to branch TAP5-2743 in repository https://gitbox.apache.org/repos/asf/tapestry-5.git from c90d9d802 TAP-2743: Add "compute" method to PerThreadValue add cac035d2e TAP5-2744: upgrading Selenium and fixing integration tests add d879baba0 TAP5-2744: fixing tapestry-webresources build new 79e610668 Merge branch 'master' into TAP5-2743 new 0a644287c TAP5-2743: add "ifSet" to PerThreadValue The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: build.gradle | 6 ++- tapestry-core/build.gradle | 2 +- .../integration/cluster/ClusterTests.java | 2 +- .../tapestry5/ioc/services/PerThreadValue.java | 19 .../groovy/ioc/specs/PerThreadValueSpec.groovy | 52 +- tapestry-test/build.gradle | 5 ++- .../apache/tapestry5/test/SeleniumTestCase.java| 32 - tapestry-webresources/build.gradle | 13 +++--- 8 files changed, 106 insertions(+), 25 deletions(-)
[jira] [Commented] (TAP5-2743) PerThreadValue should provide more convenience methods
[ https://issues.apache.org/jira/browse/TAP5-2743?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17652776#comment-17652776 ] ASF subversion and git services commented on TAP5-2743: --- Commit 79e610668bfed73fd3fc9324a59529a0b5e387f0 in tapestry-5's branch refs/heads/TAP5-2743 from Ben Weidig [ https://gitbox.apache.org/repos/asf?p=tapestry-5.git;h=79e610668 ] Merge branch 'master' into TAP5-2743 > PerThreadValue should provide more convenience methods > - > > Key: TAP5-2743 > URL: https://issues.apache.org/jira/browse/TAP5-2743 > Project: Tapestry 5 > Issue Type: Improvement > Components: tapestry-ioc >Reporter: Ben Weidig >Assignee: Ben Weidig >Priority: Trivial > > The type org.apache.tapestry5.ioc.services.PerThreadValue should provide > more convenience methods like Map does, e. g.: > * {{T computeIfAbsent(Supplier fn)}} > * {{T }}{{computeIfPresent(Function fn)}} > * {{{}T compute{}}}{{{}(Function fn){}}}{{{}{}}} > I believe these methods would simplify using PerThreadValue and they should > be implementable with default methods directly on the interface. -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (TAP5-2744) Selenium 3.141 can't seem to start FF 102+
[ https://issues.apache.org/jira/browse/TAP5-2744?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17652775#comment-17652775 ] ASF subversion and git services commented on TAP5-2744: --- Commit d879baba01a5e34d78d7f50ce7bb045728431b9e in tapestry-5's branch refs/heads/TAP5-2743 from Thiago H. de Paula Figueiredo [ https://gitbox.apache.org/repos/asf?p=tapestry-5.git;h=d879baba0 ] TAP5-2744: fixing tapestry-webresources build > Selenium 3.141 can't seem to start FF 102+ > -- > > Key: TAP5-2744 > URL: https://issues.apache.org/jira/browse/TAP5-2744 > Project: Tapestry 5 > Issue Type: Dependency upgrade > Components: tapestry-test >Reporter: Ben Weidig >Assignee: Thiago Henrique De Paula Figueiredo >Priority: Major > Fix For: 5.8.3 > > > It seems that Selenium can't start FF 102+ ESR anymore. > Doesn't work both in Travis and locally. > https://github.com/SeleniumHQ/selenium/issues/10840 -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (TAP5-2744) Selenium 3.141 can't seem to start FF 102+
[ https://issues.apache.org/jira/browse/TAP5-2744?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17652774#comment-17652774 ] ASF subversion and git services commented on TAP5-2744: --- Commit cac035d2ebf4c209a3b1c139fab5fb9d9cd83dbf in tapestry-5's branch refs/heads/TAP5-2743 from Thiago H. de Paula Figueiredo [ https://gitbox.apache.org/repos/asf?p=tapestry-5.git;h=cac035d2e ] TAP5-2744: upgrading Selenium and fixing integration tests TAP5-2744: upgrading Selenium TAP5-2744: upgrading Selenium again TAP5-2744: explicitly choosing Firefox for Selenium > Selenium 3.141 can't seem to start FF 102+ > -- > > Key: TAP5-2744 > URL: https://issues.apache.org/jira/browse/TAP5-2744 > Project: Tapestry 5 > Issue Type: Dependency upgrade > Components: tapestry-test >Reporter: Ben Weidig >Assignee: Thiago Henrique De Paula Figueiredo >Priority: Major > Fix For: 5.8.3 > > > It seems that Selenium can't start FF 102+ ESR anymore. > Doesn't work both in Travis and locally. > https://github.com/SeleniumHQ/selenium/issues/10840 -- This message was sent by Atlassian Jira (v8.20.10#820010)
[tapestry-5] 01/02: Merge branch 'master' into TAP5-2743
This is an automated email from the ASF dual-hosted git repository. benw pushed a commit to branch TAP5-2743 in repository https://gitbox.apache.org/repos/asf/tapestry-5.git commit 79e610668bfed73fd3fc9324a59529a0b5e387f0 Merge: c90d9d802 d879baba0 Author: Ben Weidig AuthorDate: Thu Dec 29 09:28:45 2022 +0100 Merge branch 'master' into TAP5-2743 build.gradle | 6 ++-- tapestry-core/build.gradle | 2 +- .../integration/cluster/ClusterTests.java | 2 +- tapestry-test/build.gradle | 5 ++-- .../apache/tapestry5/test/SeleniumTestCase.java| 32 ++ tapestry-webresources/build.gradle | 13 + 6 files changed, 37 insertions(+), 23 deletions(-)
[jira] [Commented] (TAP5-2743) PerThreadValue should provide more convenience methods
[ https://issues.apache.org/jira/browse/TAP5-2743?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17652777#comment-17652777 ] ASF subversion and git services commented on TAP5-2743: --- Commit 0a644287cdc21b8b271b169f244ff3fbe0032f07 in tapestry-5's branch refs/heads/TAP5-2743 from Ben Weidig [ https://gitbox.apache.org/repos/asf?p=tapestry-5.git;h=0a644287c ] TAP5-2743: add "ifSet" to PerThreadValue > PerThreadValue should provide more convenience methods > - > > Key: TAP5-2743 > URL: https://issues.apache.org/jira/browse/TAP5-2743 > Project: Tapestry 5 > Issue Type: Improvement > Components: tapestry-ioc >Reporter: Ben Weidig >Assignee: Ben Weidig >Priority: Trivial > > The type org.apache.tapestry5.ioc.services.PerThreadValue should provide > more convenience methods like Map does, e. g.: > * {{T computeIfAbsent(Supplier fn)}} > * {{T }}{{computeIfPresent(Function fn)}} > * {{{}T compute{}}}{{{}(Function fn){}}}{{{}{}}} > I believe these methods would simplify using PerThreadValue and they should > be implementable with default methods directly on the interface. -- This message was sent by Atlassian Jira (v8.20.10#820010)
[tapestry-5] branch better-page-invalidation updated: TAP5-2742: manual invalidation of cached pages and some error handling
This is an automated email from the ASF dual-hosted git repository. thiagohp pushed a commit to branch better-page-invalidation in repository https://gitbox.apache.org/repos/asf/tapestry-5.git The following commit(s) were added to refs/heads/better-page-invalidation by this push: new 9aa7fb4e4 TAP5-2742: manual invalidation of cached pages and some error handling 9aa7fb4e4 is described below commit 9aa7fb4e4a4ab5ec8d3543b0c118aa23db55674f Author: Thiago H. de Paula Figueiredo AuthorDate: Thu Dec 29 12:00:41 2022 -0300 TAP5-2742: manual invalidation of cached pages and some error handling --- .../util/DifferentClassVersionsException.java | 42 ++ .../tapestry5/corelib/pages/PageCatalog.java | 21 +-- .../internal/services/RequestErrorFilter.java | 38 ++-- .../internal/transform/InjectComponentWorker.java | 37 ++- .../apache/tapestry5/corelib/pages/PageCatalog.tml | 6 ++-- 5 files changed, 130 insertions(+), 14 deletions(-) diff --git a/commons/src/main/java/org/apache/tapestry5/commons/util/DifferentClassVersionsException.java b/commons/src/main/java/org/apache/tapestry5/commons/util/DifferentClassVersionsException.java new file mode 100644 index 0..6bc062b18 --- /dev/null +++ b/commons/src/main/java/org/apache/tapestry5/commons/util/DifferentClassVersionsException.java @@ -0,0 +1,42 @@ +// Copyright 2021 The Apache Software Foundation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.apache.tapestry5.commons.util; + +import org.apache.tapestry5.commons.internal.util.TapestryException; + +/** + * Exception used when trying to assemble a page but different versions of the same class are found. + * + * @since 5.8.3 + */ +public class DifferentClassVersionsException extends TapestryException +{ + +private static final long serialVersionUID = 1L; + +private final String className; + +public DifferentClassVersionsException(String message, String className) +{ +super(message, null); +this.className = className; +} + +public String getClassName() +{ +return className; +} + +} diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/PageCatalog.java b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/PageCatalog.java index 72b79b5cc..0a5925e86 100644 --- a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/PageCatalog.java +++ b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/PageCatalog.java @@ -15,6 +15,7 @@ package org.apache.tapestry5.corelib.pages; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.List; @@ -31,6 +32,7 @@ import org.apache.tapestry5.beaneditor.Validate; import org.apache.tapestry5.beanmodel.BeanModel; import org.apache.tapestry5.beanmodel.services.BeanModelSource; import org.apache.tapestry5.commons.Messages; +import org.apache.tapestry5.commons.services.InvalidationEventHub; import org.apache.tapestry5.commons.util.CollectionFactory; import org.apache.tapestry5.corelib.components.Zone; import org.apache.tapestry5.dom.Element; @@ -48,6 +50,7 @@ import org.apache.tapestry5.internal.services.ReloadHelper; import org.apache.tapestry5.internal.structure.ComponentPageElement; import org.apache.tapestry5.internal.structure.Page; import org.apache.tapestry5.ioc.OperationTracker; +import org.apache.tapestry5.ioc.annotations.ComponentClasses; import org.apache.tapestry5.ioc.annotations.Inject; import org.apache.tapestry5.ioc.annotations.Symbol; import org.apache.tapestry5.ioc.internal.util.InternalUtils; @@ -127,7 +130,11 @@ public class PageCatalog @Inject private Request request; - + +@Inject +@ComponentClasses +private InvalidationEventHub classesInvalidationEventHub; + void pageLoaded() { model = beanModelSource.createDisplayModel(Page.class, messages); @@ -136,6 +143,7 @@ public class PageCatalog model.addExpression("assemblyTime", "stats.assemblyTime"); model.addExpression("componentCount", "stats.componentCount"); model.addExpression("weight", "stats.weight"); +model.add("clear", null); model.reorder("name", "selector", "assemblyTime", "componentCount", "weight"); } @@ -184,7 +192,16 @@ public class PageCatalog { r
[jira] [Commented] (TAP5-2742) Smarter page cache invalidation
[ https://issues.apache.org/jira/browse/TAP5-2742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17652877#comment-17652877 ] ASF subversion and git services commented on TAP5-2742: --- Commit 9aa7fb4e4a4ab5ec8d3543b0c118aa23db55674f in tapestry-5's branch refs/heads/better-page-invalidation from Thiago H. de Paula Figueiredo [ https://gitbox.apache.org/repos/asf?p=tapestry-5.git;h=9aa7fb4e4 ] TAP5-2742: manual invalidation of cached pages and some error handling > Smarter page cache invalidation > --- > > Key: TAP5-2742 > URL: https://issues.apache.org/jira/browse/TAP5-2742 > Project: Tapestry 5 > Issue Type: Improvement > Components: tapestry-core >Reporter: Thiago Henrique De Paula Figueiredo >Assignee: Thiago Henrique De Paula Figueiredo >Priority: Major > > Since Tapestry 5's inception, it throws the whole set of assembled page > instances when anything related is changed, be it the class itself, its > template and maybe also associated messages and assets. In very large > projects with large pages, this can reach a point it slows down the user > (programmer) productivity, forced to wait for unchanged pages to be > reassambled. > Tapestry should provide some way for users to segment page, component, mixin > and base classes to separate regions, one for each classloader, to avoid > clearing out cached page instances that don't have themselves or the classes > they use changed. -- This message was sent by Atlassian Jira (v8.20.10#820010)