You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by th...@apache.org on 2022/02/05 19:35:54 UTC

[tapestry-5] branch latest-java-tests updated (8e7aa8d -> 0fd01f9)

This is an automated email from the ASF dual-hosted git repository.

thiagohp pushed a change to branch latest-java-tests
in repository https://gitbox.apache.org/repos/asf/tapestry-5.git.


    from 8e7aa8d  TAP5-2702: Upgrade to Groovy 3 and Spock 2 to support Java 17
     new 64f3fb4  TAP5-2700: allowing module classes written in Groovy again
     new 0fd01f9  TAP5-2700: fixing two broken tests

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:
 tapestry-core/build.gradle                         |  5 ++
 .../symbolparam/GridSymbolDemoTests.groovy         |  4 +-
 .../ioc/internal/DefaultModuleDefImpl.java         | 67 +++++++++++++++++-----
 3 files changed, 60 insertions(+), 16 deletions(-)

[tapestry-5] 01/02: TAP5-2700: allowing module classes written in Groovy again

Posted by th...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

thiagohp pushed a commit to branch latest-java-tests
in repository https://gitbox.apache.org/repos/asf/tapestry-5.git

commit 64f3fb46c41a98b6000d1bbe94d9f972e14578cd
Author: Thiago H. de Paula Figueiredo <th...@arsmachina.com.br>
AuthorDate: Sat Feb 5 16:31:55 2022 -0300

    TAP5-2700: allowing module classes written in Groovy again
    
    This fixes GridSymbolDemoTests
---
 .../ioc/internal/DefaultModuleDefImpl.java         | 67 +++++++++++++++++-----
 1 file changed, 52 insertions(+), 15 deletions(-)

diff --git a/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/DefaultModuleDefImpl.java b/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/DefaultModuleDefImpl.java
index adbd8e0..b444a69 100644
--- a/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/DefaultModuleDefImpl.java
+++ b/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/DefaultModuleDefImpl.java
@@ -14,7 +14,22 @@
 
 package org.apache.tapestry5.ioc.internal;
 
-import org.apache.tapestry5.commons.*;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.tapestry5.commons.Configuration;
+import org.apache.tapestry5.commons.MappedConfiguration;
+import org.apache.tapestry5.commons.ObjectCreator;
+import org.apache.tapestry5.commons.OrderedConfiguration;
 import org.apache.tapestry5.commons.internal.util.TapestryException;
 import org.apache.tapestry5.commons.services.PlasticProxyFactory;
 import org.apache.tapestry5.commons.util.CollectionFactory;
@@ -26,23 +41,26 @@ import org.apache.tapestry5.ioc.MethodAdviceReceiver;
 import org.apache.tapestry5.ioc.ScopeConstants;
 import org.apache.tapestry5.ioc.ServiceBinder;
 import org.apache.tapestry5.ioc.ServiceBuilderResources;
-import org.apache.tapestry5.ioc.annotations.*;
-import org.apache.tapestry5.ioc.def.*;
+import org.apache.tapestry5.ioc.annotations.Advise;
+import org.apache.tapestry5.ioc.annotations.Contribute;
+import org.apache.tapestry5.ioc.annotations.Decorate;
+import org.apache.tapestry5.ioc.annotations.EagerLoad;
+import org.apache.tapestry5.ioc.annotations.Marker;
+import org.apache.tapestry5.ioc.annotations.Match;
+import org.apache.tapestry5.ioc.annotations.Optional;
+import org.apache.tapestry5.ioc.annotations.Order;
+import org.apache.tapestry5.ioc.annotations.PreventServiceDecoration;
+import org.apache.tapestry5.ioc.annotations.Scope;
+import org.apache.tapestry5.ioc.annotations.Startup;
+import org.apache.tapestry5.ioc.def.ContributionDef;
+import org.apache.tapestry5.ioc.def.ContributionDef3;
+import org.apache.tapestry5.ioc.def.DecoratorDef;
+import org.apache.tapestry5.ioc.def.ModuleDef2;
+import org.apache.tapestry5.ioc.def.ServiceDef;
+import org.apache.tapestry5.ioc.def.StartupDef;
 import org.apache.tapestry5.ioc.internal.util.InternalUtils;
 import org.slf4j.Logger;
 
-import java.lang.annotation.Annotation;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
 /**
  * Starting from the Class for a module, identifies all the services (service builder methods),
  * decorators (service
@@ -157,6 +175,7 @@ public class DefaultModuleDefImpl implements ModuleDef2, ServiceDefAccumulator
         }
 
         removeSyntheticMethods(methods);
+        removeGroovyObjectMethods(methods);
 
         boolean modulePreventsServiceDecoration = moduleClass.getAnnotation(PreventServiceDecoration.class) != null;
 
@@ -215,6 +234,24 @@ public class DefaultModuleDefImpl implements ModuleDef2, ServiceDefAccumulator
     {
         return serviceDefs.get(serviceId);
     }
+    
+    private void removeGroovyObjectMethods(Set<Method> methods)
+    {
+        Iterator<Method> iterator = methods.iterator();
+
+        while (iterator.hasNext())
+        {
+            Method m = iterator.next();
+            final String name = m.getName();
+
+            if (m.getDeclaringClass().getName().equals("groovy.lang.GroovyObject")
+                    || (name.equals("getMetaClass") && m.getReturnType().getName().equals("groovy.lang.MetaClass"))
+                || (m.getParameterCount() == 1 && m.getParameterTypes()[0].getName().equals("groovy.lang.MetaClass")))
+            {
+                iterator.remove();
+            }
+        }
+    }
 
     private void removeSyntheticMethods(Set<Method> methods)
     {

[tapestry-5] 02/02: TAP5-2700: fixing two broken tests

Posted by th...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

thiagohp pushed a commit to branch latest-java-tests
in repository https://gitbox.apache.org/repos/asf/tapestry-5.git

commit 0fd01f977b64067b4a6c4a3bbba366a56848e20f
Author: Thiago H. de Paula Figueiredo <th...@arsmachina.com.br>
AuthorDate: Sat Feb 5 16:35:37 2022 -0300

    TAP5-2700: fixing two broken tests
    
    GridSymbolDemoTests and XMLTokenStreamTests. testStreamEncoding
---
 tapestry-core/build.gradle                                           | 5 +++++
 .../tapestry5/integration/symbolparam/GridSymbolDemoTests.groovy     | 4 +++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/tapestry-core/build.gradle b/tapestry-core/build.gradle
index 9dcfb45..559dbec 100644
--- a/tapestry-core/build.gradle
+++ b/tapestry-core/build.gradle
@@ -72,6 +72,11 @@ jar {
     }
 }
 
+// Needed to have XMLTokenStreamTests.testStreamEncoding() passing on Java 17
+test {
+    jvmArgs '--add-opens=java.base/java.nio.charset=ALL-UNNAMED'    
+}
+
 task runTestApp1(type:JavaExec) {
   description 'Start app1 integration test app, useful when debugging failing integration tests'
   main = 'org.apache.tapestry5.test.JettyRunner'
diff --git a/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam/GridSymbolDemoTests.groovy b/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam/GridSymbolDemoTests.groovy
index c351e46..600ab6d 100644
--- a/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam/GridSymbolDemoTests.groovy
+++ b/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam/GridSymbolDemoTests.groovy
@@ -1,4 +1,4 @@
-// Copyright 2011-2013 The Apache Software Foundation
+// Copyright 2011-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.
@@ -15,11 +15,13 @@
 package org.apache.tapestry5.integration.symbolparam
 
 import org.apache.tapestry5.integration.TapestryCoreTestCase
+import org.apache.tapestry5.test.TapestryTestConfiguration
 import org.testng.annotations.Test
 
 /**
  * Tests for the Grid's symbol parameter support added in 5.3.
  */
+@TapestryTestConfiguration(webAppFolder = "src/test/symbolparam")
 class GridSymbolDemoTests extends TapestryCoreTestCase
 {
     @Test