Return-Path: Delivered-To: apmail-db-ojb-dev-archive@www.apache.org Received: (qmail 45519 invoked from network); 7 Feb 2005 02:35:33 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 7 Feb 2005 02:35:33 -0000 Received: (qmail 45286 invoked by uid 500); 7 Feb 2005 02:35:33 -0000 Delivered-To: apmail-db-ojb-dev-archive@db.apache.org Received: (qmail 45092 invoked by uid 500); 7 Feb 2005 02:35:32 -0000 Mailing-List: contact ojb-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "OJB Developers List" Reply-To: "OJB Developers List" Delivered-To: mailing list ojb-dev@db.apache.org Received: (qmail 45079 invoked by uid 99); 7 Feb 2005 02:35:32 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (hermes.apache.org: local policy) Received: from smtp.mel.swiftdsl.com.au (HELO smtp.mel.swiftdsl.com.au) (218.214.17.98) by apache.org (qpsmtpd/0.28) with SMTP; Sun, 06 Feb 2005 18:35:31 -0800 Received: (qmail 32465 invoked from network); 7 Feb 2005 02:35:28 -0000 Received: from unknown (HELO ?192.168.1.78?) (218.214.136.241) by smtp.mel.swiftdsl.com.au with SMTP; 7 Feb 2005 02:35:28 -0000 Message-ID: <4206D42B.70205@baselinesols.com> Date: Mon, 07 Feb 2005 13:36:27 +1100 From: Michael Hart User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: OJB Developers List Subject: Re: cvs commit: db-ojb/src/test/org/apache/ojb/broker HsqldbShutdown.java AllTests.java - Added msg link References: <20050202201026.46443.qmail@minotaur.apache.org> <4206CF0E.2040706@baselinesols.com> In-Reply-To: <4206CF0E.2040706@baselinesols.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Sorry - I forgot to include the link for the msg I sent to ojb-devel on 17/8/2004 regarding HSQLDB 1.7.2: http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-dev@db.apache.org&msgId=1810598 Michael Hart wrote: > Hey Guys, > > I see that this step to shutdown the HSQLDB has been added so that > versions 1.7.2+ can be supported, which is great. I also note that there > was a brief discussion last month about it as well (that I missed - > thread titled "[OJB1.1] test suite and hsql"). > > There's one slight hiccup with this method - although it's arguable > whether it's a problem or not. If the HSQLDB is *not* running in > "In-Process" mode (ie in a Server mode or similar), then it will be > shutdown, possibly (probably) against the user's will. The default for > the OJB JUnit tests is to create an HSQLDB using the "In-Process" mode, > so it won't be a problem in this case - but if someone wants to test on > an HSQLDB server, then it will shut the server down upon completion. > > I haven't got any really nice solution to this - I've queried the HSQL > team about a way to use an SQL statement to conditionally shut the > server down if it's in "In-Process" mode, but this seems to be > impossible (at this stage anyway - see > http://sourceforge.net/mailarchive/message.php?msg_id=9280558 for more > details). > > However, I did outline a possible solution in an e-mail to this list on > 17/8/2004 with the subject "Howto: OJB 1.0.0 + Torque 3.1 + HSQLDB > 1.7.2" - basically by adding a few targets to the build-torque.xml file > that check if the db being created is HSQLDB in "In-Process" mode and > add shutdown statements if so. This means that people can then use this > file to create their own HSQLDB databases as well, outside of the JUnit > tests. It's a fairly ugly patch IMO, but it's arguably "more correct" > than just patching the unit test files and shutting down regardless of > the DB mode. > > HTH, > > Michael > > brj@apache.org wrote: > >> brj 2005/02/02 12:10:26 >> >> Modified: src/test/org/apache/ojb/broker AllTests.java >> Added: src/test/org/apache/ojb/broker HsqldbShutdown.java >> Log: >> shutdown hsql after broker.AllTests >> Revision Changes Path >> 1.60 +1 -1 >> db-ojb/src/test/org/apache/ojb/broker/AllTests.java >> Index: AllTests.java >> =================================================================== >> RCS file: >> /home/cvs/db-ojb/src/test/org/apache/ojb/broker/AllTests.java,v >> retrieving revision 1.59 >> retrieving revision 1.60 >> diff -u -r1.59 -r1.60 >> --- AllTests.java 2 Feb 2005 20:03:15 -0000 1.59 >> +++ AllTests.java 2 Feb 2005 20:10:26 -0000 1.60 >> @@ -128,7 +128,7 @@ >> suite.addTestSuite(NoPkReferenceTest.class); >> // BRJ: ensure shutdown of hsqldb >> - // suite.addTestSuite(HsqldbShutdown.class); >> + suite.addTestSuite(HsqldbShutdown.class); >> return suite; >> } >> } >> 1.1 >> db-ojb/src/test/org/apache/ojb/broker/HsqldbShutdown.java >> Index: HsqldbShutdown.java >> =================================================================== >> package org.apache.ojb.broker; >> /* Copyright 2003-2004 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. >> */ >> import java.sql.Connection; >> import java.sql.SQLException; >> import java.sql.Statement; >> import org.apache.ojb.broker.platforms.Platform; >> import org.apache.ojb.broker.platforms.PlatformHsqldbImpl; >> import org.apache.ojb.junit.PBTestCase; >> /** >> * Performs a shutdown of hsqldb. >> * >> * @author Jakob Braeuchi >> * @version $Id: HsqldbShutdown.java,v 1.1 2005/02/02 20:10:26 brj >> Exp $ >> */ >> public class HsqldbShutdown extends PBTestCase >> { >> public void testHsqldbShutdown() >> { >> Platform platform = >> broker.serviceConnectionManager().getSupportedPlatform(); >> if(platform instanceof PlatformHsqldbImpl) >> { >> Connection con = null; >> Statement stmt = null; >> try >> { >> con = >> broker.serviceConnectionManager().getConnection(); >> stmt = con.createStatement(); >> stmt.execute("shutdown"); >> } >> catch (Exception e) >> { >> e.printStackTrace(); >> } >> finally >> { >> try >> { >> stmt.close(); >> con.close(); >> } >> catch (SQLException e1) >> { >> e1.printStackTrace(); >> } >> } >> } >> } >> } >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org >> For additional commands, e-mail: ojb-dev-help@db.apache.org >> >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org > For additional commands, e-mail: ojb-dev-help@db.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org For additional commands, e-mail: ojb-dev-help@db.apache.org