Repository: tapestry-5 Updated Branches: refs/heads/master 46426d83e -> 820d7d087
TAP5-2588: applying more test patches by Dmitris Zenios Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/820d7d08 Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/820d7d08 Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/820d7d08 Branch: refs/heads/master Commit: 820d7d087c8e8f975f17043c635eae7e246f0966 Parents: 46426d8 Author: Thiago H. de Paula Figueiredo <thi...@arsmachina.com.br> Authored: Wed Dec 5 21:37:07 2018 -0200 Committer: Thiago H. de Paula Figueiredo <thi...@arsmachina.com.br> Committed: Wed Dec 5 21:37:07 2018 -0200 ---------------------------------------------------------------------- .../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 - .../ioc/specs/PropertyAccessImplSpec.groovy | 1 - .../tapestry5/ioc/internal/AdviceModule.java | 20 ---------- .../org/apache/tapestry5/ioc/internal/Main.java | 38 ------------------ .../src/test/resources/hibernate.cfg.xml | 42 -------------------- 10 files changed, 48 insertions(+), 103 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/820d7d08/plastic/src/test/groovy/org/apache/tapestry5/plastic/MethodProxying.groovy ---------------------------------------------------------------------- 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 22e41b6..18856c6 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: http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/820d7d08/plastic/src/test/java/testinterfaces/samemethodinterface/ResultRunner.java ---------------------------------------------------------------------- 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 0000000..e1048da --- /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(); +} http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/820d7d08/plastic/src/test/java/testinterfaces/samemethodinterface/SameMethodsInterface.java ---------------------------------------------------------------------- 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 0000000..c696bd6 --- /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(); +} http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/820d7d08/plastic/src/test/java/testinterfaces/samemethodinterface/pkg1/Result.java ---------------------------------------------------------------------- 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 0000000..cddf07c --- /dev/null +++ b/plastic/src/test/java/testinterfaces/samemethodinterface/pkg1/Result.java @@ -0,0 +1,4 @@ +package testinterfaces.samemethodinterface.pkg1; + +public class Result { +} http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/820d7d08/plastic/src/test/java/testinterfaces/samemethodinterface/pkg2/Result.java ---------------------------------------------------------------------- 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 0000000..f499832 --- /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 { +} http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/820d7d08/tapestry-ioc/build.gradle ---------------------------------------------------------------------- diff --git a/tapestry-ioc/build.gradle b/tapestry-ioc/build.gradle index 75dca1c..7637d50 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 } } http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/820d7d08/tapestry-ioc/src/test/groovy/ioc/specs/PropertyAccessImplSpec.groovy ---------------------------------------------------------------------- diff --git a/tapestry-ioc/src/test/groovy/ioc/specs/PropertyAccessImplSpec.groovy b/tapestry-ioc/src/test/groovy/ioc/specs/PropertyAccessImplSpec.groovy index 8ea3ee9..3c63806 100644 --- a/tapestry-ioc/src/test/groovy/ioc/specs/PropertyAccessImplSpec.groovy +++ b/tapestry-ioc/src/test/groovy/ioc/specs/PropertyAccessImplSpec.groovy @@ -816,7 +816,6 @@ class PropertyAccessImplSpec extends Specification { } public enum ById implements IdentifiableEnum<ById, Byte> { - ; public Byte getId() { return null } http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/820d7d08/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/AdviceModule.java ---------------------------------------------------------------------- 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 f943152..1a90aa3 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(); - } } http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/820d7d08/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/Main.java ---------------------------------------------------------------------- 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 c42fd56..0000000 --- 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); - } - -} http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/820d7d08/tapestry-ioc/src/test/resources/hibernate.cfg.xml ---------------------------------------------------------------------- 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 d02951b..0000000 --- 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>