Return-Path: X-Original-To: apmail-commons-dev-archive@www.apache.org Delivered-To: apmail-commons-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6B280D4AB for ; Fri, 17 May 2013 17:06:07 +0000 (UTC) Received: (qmail 3937 invoked by uid 500); 17 May 2013 17:06:07 -0000 Delivered-To: apmail-commons-dev-archive@commons.apache.org Received: (qmail 3839 invoked by uid 500); 17 May 2013 17:06:07 -0000 Mailing-List: contact dev-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Developers List" Delivered-To: mailing list dev@commons.apache.org Received: (qmail 3830 invoked by uid 99); 17 May 2013 17:06:06 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 May 2013 17:06:06 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of garydgregory@gmail.com designates 209.85.214.53 as permitted sender) Received: from [209.85.214.53] (HELO mail-bk0-f53.google.com) (209.85.214.53) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 May 2013 17:06:01 +0000 Received: by mail-bk0-f53.google.com with SMTP id mx1so129663bkb.40 for ; Fri, 17 May 2013 10:05:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=hCxXEqoHzjmLMm7EAGhwabTk8zPzn1ijhmi6nUyXhJQ=; b=wotPm4wpUKyBtdz/tlXrR/LQ1DnekO0GzJwhnPmevjFWKdK/r0Y0YScqC0BL72w2pR zjdmKIxlyKym7/trygB55ns6QSZFUA3cvU7HdKWTCO3dUbyBsQuChPGwBnYZ/eoUcAHR znMU9aTJyX8GYJaVezUx+4dgse32T2IAEKcdF2wI1Ax6clV/7EzB8v4kbMZHxatRgiZr tJnK5iGKffpIuLkEorGH+Kf073FO6xOE30PwFy7eKokiL63ovdI6s0UE0BQMbr+46bhu T5DX8CtN42PA/lZ/ryQtTjDhiS54vFuWAxi7g3BC8SXYWUEwInCGOvOr1Esi5IQQZiJD rTuA== MIME-Version: 1.0 X-Received: by 10.205.46.131 with SMTP id uo3mr16064218bkb.43.1368810341082; Fri, 17 May 2013 10:05:41 -0700 (PDT) Received: by 10.204.50.139 with HTTP; Fri, 17 May 2013 10:05:40 -0700 (PDT) In-Reply-To: <1368807512.55989.YahooMailClassic@web140706.mail.bf1.yahoo.com> References: <51962AB9.3040801@apache.org> <1368807512.55989.YahooMailClassic@web140706.mail.bf1.yahoo.com> Date: Fri, 17 May 2013 13:05:40 -0400 Message-ID: Subject: Re: [pool] 1.x and TestGenericObjectPoolClassLoaders From: Gary Gregory To: Commons Developers List , Bruno Kinoshita Content-Type: multipart/alternative; boundary=bcaec529977525668f04dcecfe12 X-Virus-Checked: Checked by ClamAV on apache.org --bcaec529977525668f04dcecfe12 Content-Type: text/plain; charset=UTF-8 Yep, it's a resource problem. I found a simple way to fix it. see revision 1483916. Thank you for digging in. Gary On Fri, May 17, 2013 at 12:18 PM, Bruno P. Kinoshita < brunodepaulak@yahoo.com.br> wrote: > Hello, > > TL;DR: > looks like there is an ignored exception that occurs when the test factory > CustomClassLoaderObjectFactory tries to load a not existing resource. > > Test files 'test1' and 'test2' that are not processed by Maven (branch 1.x > has a not-maven-default directory structure). This way, no new objects are > created/added to the pool and the test fails. > > --- > > FWIU, in TestGenericObjectPoolClassLoaders.java the > testContextClassLoader() test method creates custom class loaders > (CustomClassLoader) and custom class loader object factories > (CustomClassLoaderObjectFactory). > > These factories are created with a number and the makeObject() method > returns an URL to a resource "test" + n. > > In the test package, there are two files, test1 and test2 that were > supposed to be used in the test. However, it looks like during test > execution these files are not included by Maven (probably because the 1.x > branch has a custom directory structure). > > Thus, the CustomClassLoaderObjectFactory#makeObject() method returns null. > When the GenericObjectPool tries to create a new object (using that > factory) an exception is raised, but ignored (see GenericObjectPool, line > 1801). And in the end no new objects are added to the pool and the test > fails. > > I think we could fix it by changing the pom.xml to include these two files > or by dropping these files and creating some other dummy URL for tests. > Here's a patch that worked for me [1] (sorry, going to a meeting and > couldn't attach a decent patch right now). > > Just my 0.02 cents, hope that helps. > > Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 > 10:51:28-0300) > Maven home: /opt/java/apache-maven-3.0.5 > Java version: 1.6.0_43, vendor: Sun Microsystems Inc. > Java home: /opt/java/jdk1.6.0_43/jre > Default locale: en_US, platform encoding: UTF-8 > OS name: "linux", version: "3.8.0-21-generic", arch: "amd64", family: > "unix" > > Cheers, Bruno > > [1] https://gist.github.com/kinow/5600147 > > Bruno P. Kinoshita > http://kinoshita.eti.br > http://tupilabs.com > > > --- Em sex, 17/5/13, Mark Thomas escreveu: > > > De: Mark Thomas > > Assunto: Re: [pool] 1.x and TestGenericObjectPoolClassLoaders > > Para: "Commons Developers List" > > Data: Sexta-feira, 17 de Maio de 2013, 10:03 > > On 17/05/2013 13:51, Gary Gregory > > wrote: > > > On Thu, May 16, 2013 at 6:30 PM, Mark Thomas > > wrote: > > > > > >> On 16/05/2013 20:58, Gary Gregory wrote: > > >>> TestGenericObjectPoolClassLoaders (1) > > >>> > > org.apache.commons.pool.impl.TestGenericObjectPoolClassLoaders > > >>> > > >> > > > testContextClassLoader(org.apache.commons.pool.impl.TestGenericObjectPoolClassLoaders) > > >>> junit.framework.AssertionFailedError: Wrong > > number of idle objects in > > >> pool1 > > >>> expected:<1> but was:<0> > > >> > > >> > > >> > > >>> at > > >> > > > org.apache.commons.pool.impl.TestGenericObjectPoolClassLoaders.testContextClassLoader(TestGenericObjectPoolClassLoaders.java:46) > > >> > > >> > > >> > > >> Looking at line 46 of the test, it is possible that > > it could fail > > >> depending on the execution timing. Maybe try > > increasing the Thread.sleep() > > >> ? > > >> > > > > > > I am glad it works on your end. > > > > > > It fails no matter what I change the numbers to, for > > example: > > > > OK. That makes a timing issue unlikely. > > > > > > > > > > pool1.setTimeBetweenEvictionRunsMillis(20); > > > > > Thread.sleep(5000); > > > > > > or: > > > > > > > > pool1.setTimeBetweenEvictionRunsMillis(1000); > > > > > Thread.sleep(5000); > > > > > > arg :( > > > > > > I makes it hard to cut an RC! > > > > Indeed. > > > > I'd suggest it is time to step through that test case with > > the debugger > > in Eclipse and figure out why the object isn't being > > created. > > > > Mark > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org > > For additional commands, e-mail: dev-help@commons.apache.org > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org > For additional commands, e-mail: dev-help@commons.apache.org > > -- E-Mail: garydgregory@gmail.com | ggregory@apache.org Java Persistence with Hibernate, Second Edition JUnit in Action, Second Edition Spring Batch in Action Blog: http://garygregory.wordpress.com Home: http://garygregory.com/ Tweet! http://twitter.com/GaryGregory --bcaec529977525668f04dcecfe12--