One more Correct test for TAP5-2582
On Sat, Dec 1, 2018 at 1:56 AM Dimitris Zenios <dimitris.zen...@gmail.com> wrote: > Another one small fix > > On Sat, Dec 1, 2018 at 1:51 AM Dimitris Zenios <dimitris.zen...@gmail.com> > wrote: > >> Sure but lets get 5.5 out the door first. >> >> I have been going over the changes and i have some patches available. >> >> First attached is the already mentioned issue with static interface >> methods >> >> >> >> On Sat, Dec 1, 2018 at 1:26 AM Thiago H. de Paula Figueiredo < >> thiag...@gmail.com> wrote: >> >>> On Fri, Nov 30, 2018 at 7:36 PM Dimitris Zenios < >>> dimitris.zen...@gmail.com> >>> wrote: >>> >>> > I have some ideas on that subject but lest get 5.5 out first and >>> continue >>> > on that afterwards >>> > >>> >>> Nice! Could you please start a new thread with your ideas? I'm curious >>> about them. :) >>> >>> >>> > >>> > On Fri, Nov 30, 2018 at 11:33 PM Thiago H. de Paula Figueiredo < >>> > thiag...@gmail.com> wrote: >>> > >>> > > Yeah, it would break webapps styled with Bootstrap 4 due to the >>> different >>> > > tagging. Maybe we (the Tapestry team or the community) could come up >>> > with a >>> > > separate library to do this. >>> > > >>> > > On Fri, Nov 30, 2018 at 7:30 PM Dimitris Zenios < >>> > dimitris.zen...@gmail.com >>> > > > >>> > > wrote: >>> > > >>> > > > Its not so huge my main concern is the backwards compatibility >>> > > > >>> > > > On Fri, Nov 30, 2018 at 11:27 PM Thiago H. de Paula Figueiredo < >>> > > > thiag...@gmail.com> wrote: >>> > > > >>> > > > > On Fri, Nov 30, 2018 at 6:45 PM Dimitris Zenios < >>> > > > dimitris.zen...@gmail.com >>> > > > > > >>> > > > > wrote: >>> > > > > >>> > > > > > Even though it might be irrelevant i was also thinking of >>> bootstrap >>> > > 4. >>> > > > > > >>> > > > > >>> > > > > Hmm, it would be nice, but I don't think it would be a trivial, >>> quick >>> > > > thing >>> > > > > to do. Any takers? :) >>> > > > > >>> > > > > >>> > > > > > >>> > > > > > On Fri, Nov 30, 2018 at 10:31 PM Dimitris Zenios < >>> > > > > > dimitris.zen...@gmail.com> >>> > > > > > wrote: >>> > > > > > >>> > > > > > > +1 >>> > > > > > > >>> > > > > > > On Fri, 30 Nov 2018, 22:28 Thiago H. de Paula Figueiredo < >>> > > > > > > thi...@arsmachina.com.br wrote: >>> > > > > > > >>> > > > > > >> Hello! >>> > > > > > >> >>> > > > > > >> Since we now have a working build and ASM 7 supporting Java >>> 11, >>> > I >>> > > > was >>> > > > > > >> thinking of release a beta version so people could test it >>> on >>> > > their >>> > > > > > >> own projects. What do you think? >>> > > > > > >> >>> > > > > > >> Cheers! >>> > > > > > >> -- >>> > > > > > >> Thiago H. de Paula Figueiredo >>> > > > > > >> >>> > > > > > >> >>> > > > >>> --------------------------------------------------------------------- >>> > > > > > >> To unsubscribe, e-mail: dev-unsubscr...@tapestry.apache.org >>> > > > > > >> For additional commands, e-mail: >>> dev-h...@tapestry.apache.org >>> > > > > > >> >>> > > > > > >> >>> > > > > > >>> > > > > >>> > > > > >>> > > > > -- >>> > > > > Thiago >>> > > > > >>> > > > >>> > > >>> > > >>> > > -- >>> > > Thiago >>> > > >>> > >>> >>> >>> -- >>> Thiago >>> >>
From 8c56c1a84fdb0b63f2c31895cbc6b44ff051f5bb Mon Sep 17 00:00:00 2001 From: Dimitris Zenios <dimitris.zen...@gmail.com> Date: Sat, 1 Dec 2018 03:38:32 +0200 Subject: [PATCH] Correctly implement test for TAP5-2582 --- .../tapestry5/plastic/MethodProxying.groovy | 29 +++++++++++++ .../samemethodinterface/ResultRunner.java | 5 +++ .../SameMethodsInterface.java | 6 +++ .../samemethodinterface/pkg1/Result.java | 4 ++ .../samemethodinterface/pkg2/Result.java | 4 ++ tapestry-ioc/build.gradle | 2 - .../tapestry5/ioc/internal/AdviceModule.java | 20 --------- .../apache/tapestry5/ioc/internal/Main.java | 38 ----------------- .../src/test/resources/hibernate.cfg.xml | 42 ------------------- 9 files changed, 48 insertions(+), 102 deletions(-) create mode 100644 plastic/src/test/java/testinterfaces/samemethodinterface/ResultRunner.java create mode 100644 plastic/src/test/java/testinterfaces/samemethodinterface/SameMethodsInterface.java create mode 100644 plastic/src/test/java/testinterfaces/samemethodinterface/pkg1/Result.java create mode 100644 plastic/src/test/java/testinterfaces/samemethodinterface/pkg2/Result.java delete mode 100644 tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/Main.java delete mode 100644 tapestry-ioc/src/test/resources/hibernate.cfg.xml diff --git a/plastic/src/test/groovy/org/apache/tapestry5/plastic/MethodProxying.groovy b/plastic/src/test/groovy/org/apache/tapestry5/plastic/MethodProxying.groovy index 22e41b6ff..18856c63e 100644 --- a/plastic/src/test/groovy/org/apache/tapestry5/plastic/MethodProxying.groovy +++ b/plastic/src/test/groovy/org/apache/tapestry5/plastic/MethodProxying.groovy @@ -1,5 +1,8 @@ package org.apache.tapestry5.plastic +import spock.lang.Issue +import testinterfaces.samemethodinterface.ResultRunner +import testinterfaces.samemethodinterface.SameMethodsInterface import testsubjects.Memory import testinterfaces.WithStatic @@ -56,6 +59,32 @@ class MethodProxying extends AbstractPlasticSpecification { 1 * mockRunnable.run() } + @Issue("TAP5-2582") + def "Proxying with multiple methods of the same signature"() { + setup: + + def mockRunner = Mock(SameMethodsInterface.class) { + run() >> new testinterfaces.samemethodinterface.pkg2.Result(); + } + + def o = mgr.createClass(Object, { PlasticClass pc -> + + def field = pc.introduceField(SameMethodsInterface, "delegate").inject(mockRunner) + + pc.proxyInterface(ResultRunner, field) + } as PlasticClassTransformer).newInstance() + + when: + + def result = o.run(); + + then: + + result instanceof testinterfaces.samemethodinterface.pkg1.Result; + + result instanceof testinterfaces.samemethodinterface.pkg2.Result; + } + def "proxy method with arguments and return value"() { setup: diff --git a/plastic/src/test/java/testinterfaces/samemethodinterface/ResultRunner.java b/plastic/src/test/java/testinterfaces/samemethodinterface/ResultRunner.java new file mode 100644 index 000000000..e1048daf0 --- /dev/null +++ b/plastic/src/test/java/testinterfaces/samemethodinterface/ResultRunner.java @@ -0,0 +1,5 @@ +package testinterfaces.samemethodinterface; + +public interface ResultRunner { + testinterfaces.samemethodinterface.pkg1.Result run(); +} diff --git a/plastic/src/test/java/testinterfaces/samemethodinterface/SameMethodsInterface.java b/plastic/src/test/java/testinterfaces/samemethodinterface/SameMethodsInterface.java new file mode 100644 index 000000000..c696bd61f --- /dev/null +++ b/plastic/src/test/java/testinterfaces/samemethodinterface/SameMethodsInterface.java @@ -0,0 +1,6 @@ +package testinterfaces.samemethodinterface; + +public interface SameMethodsInterface extends ResultRunner { + @Override + testinterfaces.samemethodinterface.pkg2.Result run(); +} diff --git a/plastic/src/test/java/testinterfaces/samemethodinterface/pkg1/Result.java b/plastic/src/test/java/testinterfaces/samemethodinterface/pkg1/Result.java new file mode 100644 index 000000000..cddf07c3a --- /dev/null +++ b/plastic/src/test/java/testinterfaces/samemethodinterface/pkg1/Result.java @@ -0,0 +1,4 @@ +package testinterfaces.samemethodinterface.pkg1; + +public class Result { +} diff --git a/plastic/src/test/java/testinterfaces/samemethodinterface/pkg2/Result.java b/plastic/src/test/java/testinterfaces/samemethodinterface/pkg2/Result.java new file mode 100644 index 000000000..f4998321d --- /dev/null +++ b/plastic/src/test/java/testinterfaces/samemethodinterface/pkg2/Result.java @@ -0,0 +1,4 @@ +package testinterfaces.samemethodinterface.pkg2; + +public class Result extends testinterfaces.samemethodinterface.pkg1.Result { +} diff --git a/tapestry-ioc/build.gradle b/tapestry-ioc/build.gradle index 75dca1cbc..7637d5046 100644 --- a/tapestry-ioc/build.gradle +++ b/tapestry-ioc/build.gradle @@ -17,8 +17,6 @@ dependencies { testCompile "commons-lang:commons-lang:2.6" testCompile "org.apache.commons:commons-lang3:3.4" - testCompile "org.hibernate:hibernate-core:5.2.10.Final" - testRuntime "org.hsqldb:hsqldb:2.2.8" provided "org.testng:testng:${versions.testng}", { transitive = false } } diff --git a/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/AdviceModule.java b/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/AdviceModule.java index f94315275..1a90aa3ed 100644 --- a/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/AdviceModule.java +++ b/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/AdviceModule.java @@ -15,13 +15,8 @@ package org.apache.tapestry5.ioc.internal; import org.apache.tapestry5.ioc.MethodAdviceReceiver; -import org.apache.tapestry5.ioc.ObjectLocator; -import org.apache.tapestry5.ioc.Registry; -import org.apache.tapestry5.ioc.RegistryBuilder; import org.apache.tapestry5.ioc.ServiceBinder; import org.apache.tapestry5.ioc.annotations.Advise; -import org.hibernate.Session; -import org.hibernate.cfg.Configuration; public class AdviceModule { @@ -51,19 +46,4 @@ public class AdviceModule final MethodAdviceReceiver methodAdviceReceiver) { methodAdviceReceiver.adviseAllMethods(new TestAdvice()); } - -// public static void main(String[] args) { -// Registry registry = RegistryBuilder.buildAndStartupRegistry(AdviceModule.class); -// Session session = registry.getService(Session.class); -// } - - // TAP5-2582 - public static Session buildHibernateSession( - ObjectLocator objectLocator - ) { - return new Configuration() - .configure("hibernate.cfg.xml") - .buildSessionFactory() - .openSession(); - } } diff --git a/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/Main.java b/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/Main.java deleted file mode 100644 index c42fd56f2..000000000 --- a/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/Main.java +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2013 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.ioc.internal; - - -import java.util.List; - -import org.apache.tapestry5.ioc.MethodAdviceReceiver; -import org.apache.tapestry5.ioc.ObjectLocator; -import org.apache.tapestry5.ioc.Registry; -import org.apache.tapestry5.ioc.RegistryBuilder; -import org.apache.tapestry5.ioc.ServiceBinder; -import org.apache.tapestry5.ioc.annotations.Advise; -import org.hibernate.Session; -import org.hibernate.cfg.Configuration; - -public class Main -{ - - public static void main(String[] args) { - Registry registry = RegistryBuilder.buildAndStartupRegistry(AdviceModule.class); - Session session = registry.getService(Session.class); - final List list = session.createSQLQuery("select 1").list(); - System.out.println(list); - } - -} diff --git a/tapestry-ioc/src/test/resources/hibernate.cfg.xml b/tapestry-ioc/src/test/resources/hibernate.cfg.xml deleted file mode 100644 index d02951b94..000000000 --- a/tapestry-ioc/src/test/resources/hibernate.cfg.xml +++ /dev/null @@ -1,42 +0,0 @@ -<?xml version='1.0' encoding='utf-8'?> -<!-- - Copyright 2007, 2008 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. ---> - -<!DOCTYPE hibernate-configuration PUBLIC - "-//Hibernate/Hibernate Configuration DTD//EN" - "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"> - -<hibernate-configuration> - - <session-factory> - <property name="hibernate.connection.driver_class">org.hsqldb.jdbcDriver</property> - <property name="hibernate.connection.url">jdbc:hsqldb:mem:test</property> - <property name="hibernate.connection.username">sa</property> - <property name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property> - - <property name="show_sql">true</property> - <property name="format_sql">true</property> - <property name="hbm2ddl.auto">update</property> - - <property name="hibernate.c3p0.min_size">5</property> - <property name="hibernate.c3p0.max_size">20</property> - <property name="hibernate.c3p0.timeout">300</property> - <property name="hibernate.c3p0.max_statements">50</property> - <property name="hibernate.c3p0.idle_test_period">3000</property> - </session-factory> - - -</hibernate-configuration> -- 2.19.2
--------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tapestry.apache.org For additional commands, e-mail: dev-h...@tapestry.apache.org