Return-Path: Delivered-To: apmail-incubator-beehive-dev-archive@www.apache.org Received: (qmail 58012 invoked from network); 22 Jun 2005 15:47:28 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 22 Jun 2005 15:47:28 -0000 Received: (qmail 81827 invoked by uid 500); 22 Jun 2005 15:47:27 -0000 Delivered-To: apmail-incubator-beehive-dev-archive@incubator.apache.org Received: (qmail 81802 invoked by uid 500); 22 Jun 2005 15:47:27 -0000 Mailing-List: contact beehive-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Beehive Developers" Delivered-To: mailing list beehive-dev@incubator.apache.org Received: (qmail 81789 invoked by uid 99); 22 Jun 2005 15:47:27 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Jun 2005 08:47:27 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [63.96.162.5] (HELO ussjmh01.bea.com) (63.96.162.5) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Jun 2005 08:47:28 -0700 Received: from ussjfe02.amer.bea.com (ussjfe02.bea.com [172.16.120.52]) by ussjmh01.bea.com (Switch-3.0.5/Switch-3.0.0) with ESMTP id j5MFlJ58018582 for ; Wed, 22 Jun 2005 08:47:25 -0700 Received: from USBOEX01.amer.bea.com ([10.36.32.15]) by ussjfe02.amer.bea.com with Microsoft SMTPSVC(5.0.2195.6713); Wed, 22 Jun 2005 08:47:24 -0700 Received: from [10.36.33.147] ([10.36.33.147]) by USBOEX01.amer.bea.com with Microsoft SMTPSVC(5.0.2195.6713); Wed, 22 Jun 2005 09:47:22 -0600 Message-ID: <42B98809.7040604@bea.com> Date: Wed, 22 Jun 2005 09:47:21 -0600 From: Patrick Osborne User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Beehive Developers Subject: Re: junit test container References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 22 Jun 2005 15:47:22.0721 (UTC) FILETIME=[AE166510:01C57741] X-PMX-Version: 4.7.0.111621, Antispam-Engine: 2.0.2.0, Antispam-Data: 2005.6.15.9 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Eddie, Is there support for JDBC controls that use a data source? For example if you the following annotation when declaring a control will it work? @Control @JdbcControl.ConnectionDataSource(jndiName = "java:comp/env/jdbc/perf") private MyJdbcControl jdbcControl; Thanks, Patrick. Eddie ONeil wrote: >All-- > > I've written a small, standalone JUnit test container that can be >used for out-of-container testing of Controls. This is a pretty >simple set of classes that are described below. > > When a test class runs, a new control container context is created >and control fields declared with @Control are instantiated, the test >code executes, and both the context and controls are removed. I think >this should be sufficient to replace the custom control test >containers defined in both the JDBC and web service controls. > > Non-goals of this test container include: > >- facilitate in-container testing as part of EJBs / Servlets / JSPs / >ServletFilters / etc. Frameworks like Cactus are good at this sort of >thing, and Beehive should ensure that the facilities to ensure >controls in a test case work there. >- define a new annotation-based model for writing test classes / test >methods. JUnit 4.0 and TestNG are already defining these annotations >/ semantics. > > The classes involved are: > >- ControlTestCase -- abstract base class used to setup the control >container context and initialize fields marked with @Control. Also >has convenience methods for creating controls programmatically. >- ControlTestUtils -- static helper methods that can be used in a test >environment when a test case needs to extend a different base class. >These would be called in user code from the setUp / tearDown methods. >- ControlTestContainerContext -- simple ControlContainerContext >implementation that allows a test author to wire-up contextual >services, etc > >and a sample test is pasted at the bottom of the mail: > > I'm considering putting this in the tree under: > > trunk/controls/src/junit-testing/... > >and producing a JAR called "beehive-controls-junit-testing.jar" that >can be used from the samples / applications / etc and is included in >the Beehive distribution. > > It's definitely time that we started making this sort of testing easier. :) > > Thoughts / comments? > >Eddie > >::::: sample test >public class ContainmentTest > extends ControlTestCase { > > @Control > private Hello _declarativeHello; > > public void testDeclarativeInstantiation() { > System.out.println(_declarativeHello.hello()); > } > > public void testContainment() { > Hello hello = (Hello)instantiateControl("pkg.containment.HelloBean"); > System.out.println(hello.hello()); > } >} > > >