To load prod data without running tests: mvn -Pprod dbunit:operation

Mike

On 11/29/07, Rob Hills <[EMAIL PROTECTED]> wrote:
>
> Hi Matt,
>
> On 29 Nov 2007 at 9:41, Matt Raible wrote:
>
> > We're open to suggestions on how to improve this. The reason we use
> > negative ids is because if we don't, Oracle gets its sequences messed
> > up. You could fix things in your project by modifying sample-data.xml
> > to have positive keys and then run "appfuse:full-source" and modify
> > all your tests. Or modify AMP to generate positive ids.
>
> Would you consider it normal practice to run unit tests when deploying to
> a
> production system?  I would have thought that unit testing would be done
> for
> development and test environments, but not for production environments.
>
> My gut feeling is that the solution to the default-data problem would be
> to
> decouple it from tests if possible, so that it can be run independently of
> them.  I think the idea of negative IDs works nicely for development and
> testing, but they probably have no place in a production environment.
>
> > On 11/29/07, Laith Al-Khateeb <[EMAIL PROTECTED]> wrote:
> > > Yes you're right, that's because the ActionTest cases expect negative
> IDs
> > > (-1, -2) to be in the database, which are used in sample-data.xml  but
> that
> > > I didn't specify in default-data.xml (which is used when prod is
> activated).
> > >
> > > Ok, to step back a bit. If I was not going to put any data for my
> tables in
> > > default-data.xml, then the tests will still fail when activating the
> prod
> > > profile and that's because the ActionTests always assume that there
> will be
> > > records with negative IDs in the database.
> > >
> > > This is from action-test.ftl:
> > >
> > > public void testEdit() throws Exception {
> > >         log.debug("testing edit...");
> > >         action.${setIdMethodName}(-1L);
> > >         assertNull(action.get${pojo.shortName} ());
> > >         assertEquals("success", action.edit());
> > >         assertNotNull(action.get${pojo.shortName}());
> > >         assertFalse(action.hasActionErrors());
> > >     }
> > >
> > >
> > > So in effect, the line of "action.${setIdMethodName}(-1L);"
> > > will always fail in prod.
> > >
> > > Now the question is whether this is a bug or whether it is there by
> design
> > > (to prevent people from running tests in prod), in which case loading
> data
> > > from default-data.xml becomes an unusable feature.
>
> Cheers,
> Rob Hills
> Waikiki, Western Australia
> Mobile +61 (412) 904-357
> Fax: +61 (8) 9529-2137
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to