Loading ...
Sorry, an error occurred while loading the content.

Re: Simple (??) database initialization

Expand Messages
  • joan
    Thanks everyone - particularly Chris. I d tried every combination i could think of, and every dos command I know (a short list, i m a unix bod). The missing
    Message 1 of 7 , Oct 3, 2005
    • 0 Attachment
      Thanks everyone - particularly Chris.

      I'd tried every combination i could think of, and every dos command I
      know (a short list, i'm a unix bod). The missing clue was "cmd"

      In full:

      |com.objectmentor.fixtures.CommandLineFixture|
      |command|cmd /c scripts\db_reset.bat|

      and my second one (for testing timeout conditions):

      |com.objectmentor.fixtures.CommandLineFixture|
      |command|cmd /c sleep ${sleeptime}|

      Thanks again

      --- In fitnesse@yahoogroups.com, "Helck, Christopher" <chelck@e...> wrote:
      > As someone else mentioned it is probably your arguments.
      > CommandLineFixture uses Runtime.exec() that takes a string. The string
      > needs to be an executable. It is a common mistake to assume that exec()
      > runs a shell for you, it does not. I'm not a window's person, but it
      > should be possible to execute the shell passing it your program to run.
      > Something like:
      > |command|cmd maven.bat ...|
      >
      > The second problem you may encounter is more specific to args. You may
      > need to modify CommandLineFixture to handle multiple arguments. There is
      > a Runtime.exec() that takes an array of Strings -- you need to use this.
      > I have a variant of CommandLineFixture that is based on DoFixture. I
      > would write:
      > |check|command-args|cmd maven.bat, drop-schema, create-schema,
      > load-dummy-data|0|
      >
      > It might save you some grief to wrap up the call to maven into a simple
      > bat file. Then you don't need to worry about the argument caca and when
      > you change your DB you just change the script
      not the tests. Then you
      > do:
      > |command|cmd init-db.bat|
      >
      > Hope this helps.
      > -chris
      >
      > -----Original Message-----
      > From: fitnesse@yahoogroups.com [mailto:fitnesse@yahoogroups.com]
      > On Behalf Of joan
      > Sent: Friday, September 30, 2005 3:23 AM
      > To: fitnesse@yahoogroups.com
      > Subject: [fitnesse] Simple (??) database initialization
      >
      >
      > I want to re-initialize the database everytime I run my test
      > suite. I
      > know this stuff is basic, but I am having problems with it.
      >
      > It's under XP, and what I do by hand is:
      >
      > c:
      > cd bridge\code
      > maven drop-schema create-schema load-dummy-data
      >
      > so i thought the best way to do this would be to use
      > CommandLineFixture, but I can't get it to work.
      >
      > This works fine:
      > |com.objectmentor.fixtures.CommandLineFixture|
      > |command|dir|
      >
      > But any other command I try except DIR just gives my java
      > exceptions:
      > |com.objectmentor.fixtures.CommandLineFixture|
      > |command|c:|
      > |command|cd bridge\code|
      > |command|maven drop-schema create-schema load-dummy-data|
      >
      > java.io.IOException: CreateProcess: MAVEN DROP-SCHEMA
      > CREATE-SCHEMA
      > LOAD-DUMMY-DATA error=2
      >
      > I'd like to stick with using maven if possible, as that will
      > work with
      > whatever db solution we move to (last week it was mySQL, now
      > it's
      > hypersonic, next week it will be SQL server)
      >
      > Any help or hints or other approaches welcome.
      >
      > TIA
      >
      > joan
      >
      >
      >
      >
      > ________________________________
      >
      > YAHOO! GROUPS LINKS
      >
      >
      >
      > * Visit your group "fitnesse
      > <http://groups.yahoo.com/group/fitnesse> " on the web.
      >
      > * To unsubscribe from this group, send an email to:
      > fitnesse-unsubscribe@yahoogroups.com
      > <mailto:fitnesse-unsubscribe@yahoogroups.com?subject=Unsubscribe>
      >
      > * Your use of Yahoo! Groups is subject to the Yahoo!
      > Terms of Service <http://docs.yahoo.com/info/terms/> .
      >
      >
      > ________________________________
      >
      >
      >
      > The information contained in this e-mail is confidential. This
      e-mail is intended only for the stated addressee. If you are not an
      addressee, you must not disclose, copy, circulate or in any other way
      use or rely on the information contained in this e-mail. if you have
      received this e-mail in error, please inform us immediately and delete
      it and all copies from your system.
      >
      > EBS Dealing Resources International Limited. Registered address: 10
      Paternoster Square, London EC4M 7DY, United Kingdom. Registered number
      2669861.
      >
      > EBS Dealing Resources, Inc, registered in Delaware. Address: 535
      Madison Avenue, 24th Floor, New York, NY 10022, USA, and One upper
      Pond road, Building F - Floor 3, Parsippany, NJ 07054, USA.
      >
      > EBS Dealing Resources Japan Limited, a Japanese Corporation.
      Address: Asteer Kayabacho Bldg, 6th Floor, 1-6-1, Shinkawa, Chuo-Ku,
      Tokyo 104-0033, Japan.
    • J. B. Rainsberger
      ... For some reason, this is a little-known DOS command switch. This is safer: cd /d c: bridge code Since cd on its own goes back to wherever you were on c:
      Message 2 of 7 , Oct 3, 2005
      • 0 Attachment
        joan wrote:
        > I want to re-initialize the database everytime I run my test suite. I
        > know this stuff is basic, but I am having problems with it.
        >
        > It's under XP, and what I do by hand is:
        >
        > c:
        > cd bridge\code

        For some reason, this is a little-known DOS command switch. This is safer:

        cd /d c:\bridge\code

        Since "cd" on its own goes back to wherever you were on c: last, it's
        not safe to do that in a script.

        This might not solve your problems, but it'll avoid creating another one.
        --
        J. B. (Joe) Rainsberger
        Diaspar Software Services
        http://www.diasparsoftware.com
        2005 Gordon Pask Award Winner for contribution to Agile practice
        Author, JUnit Recipes: Practical Methods for Programmer Testing
      Your message has been successfully submitted and would be delivered to recipients shortly.