Java

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • Maven/Spring Testing

    13 answers - 476 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    Friends,
    I am using spring in a J2EE project that is being build with maven.
    Somebody here have a good picture on how organizing different spring
    applicationContext.xml s for main and test?
    To be more clear, in a production environment, my ejb will need to get
    one applicationcontext.xml. In test environment it would need to
    obtain another applicationcontext.
    I am sure I am not the first one to have this doubt.
    Thanks in advance.
  • No.1 | | 753 bytes | |

    Hi,

    My approach is using classpath application contexts so the ones in
    src/test/resources override the ones in src/main/resources.

    You can check it out at http://oness.sourceforge.net

    8/18/05, Marcelo Alcantara <maralc (AT) gmail (DOT) comwrote:
    Friends,

    I am using spring in a J2EE project that is being build with maven.

    Somebody here have a good picture on how organizing different spring
    applicationContext.xml s for main and test?

    To be more clear, in a production environment, my ejb will need to get
    one applicationcontext.xml. In test environment it would need to
    obtain another applicationcontext.

    I am sure I am not the first one to have this doubt.

    Thanks in advance.
  • No.2 | | 1128 bytes | |

    Hi Carlos,

    But how do the test ones override the main ones? Having the same
    names? Can you give me more hints about it? This is just what I
    need.

    I will download the oness from home as I cannot go out with maven from
    the company proxy.

    Thanks a lot man.

    Marcelo

    8/18/05, Carlos Sanchez <carlossg (AT) gmail (DOT) comwrote:
    Hi,

    My approach is using classpath application contexts so the ones in
    src/test/resources override the ones in src/main/resources.

    You can check it out at http://oness.sourceforge.net

    8/18/05, Marcelo Alcantara <maralc (AT) gmail (DOT) comwrote:
    Friends,

    I am using spring in a J2EE project that is being build with maven.

    Somebody here have a good picture on how organizing different spring
    applicationContext.xml s for main and test?

    To be more clear, in a production environment, my ejb will need to get
    one applicationcontext.xml. In test environment it would need to
    obtain another applicationcontext.

    I am sure I am not the first one to have this doubt.
    --
    Thanks in advance.
  • No.3 | | 1340 bytes | |

    The test ones need to be in the classpath before the main ones. IIRC
    that's by default or maybe in the project.xml build section

    8/18/05, Marcelo Alcantara <maralc (AT) gmail (DOT) comwrote:
    Hi Carlos,

    But how do the test ones override the main ones? Having the same
    names? Can you give me more hints about it? This is just what I
    need.

    I will download the oness from home as I cannot go out with maven from
    the company proxy.

    Thanks a lot man.

    Marcelo

    8/18/05, Carlos Sanchez <carlossg (AT) gmail (DOT) comwrote:
    Hi,

    My approach is using classpath application contexts so the ones in
    src/test/resources override the ones in src/main/resources.

    You can check it out at http://oness.sourceforge.net

    8/18/05, Marcelo Alcantara <maralc (AT) gmail (DOT) comwrote:
    Friends,

    I am using spring in a J2EE project that is being build with maven.

    Somebody here have a good picture on how organizing different spring
    applicationContext.xml s for main and test?

    To be more clear, in a production environment, my ejb will need to get
    one applicationcontext.xml. In test environment it would need to
    obtain another applicationcontext.

    I am sure I am not the first one to have this doubt.
    --
    Thanks in advance.
  • No.4 | | 2180 bytes | |

    I give them a seperate name. In fact, in a unit test, you do not want to
    load your full "production" context as this may have a big performance
    impact (especially when using Hibernate). The best thing to do is 1) avoid
    loading application contexts where possible by using mock implementations
    for your dependencies 2) When you want to run integration tests, load a
    subset of your "production" context that configures the piece of logic that
    you want to test top-down 3) Have maybe one integration test that loads your
    "production" context as a whole to make sure that there are no errors in
    your configuration. Key message: avoid the use of application context for
    unit testing and default to mock objects.

    Cheers,
    Thomas

    8/18/05, Carlos Sanchez <carlossg (AT) gmail (DOT) comwrote:

    The test ones need to be in the classpath before the main ones. IIRC
    that's by default or maybe in the project.xml build section

    8/18/05, Marcelo Alcantara <maralc (AT) gmail (DOT) comwrote:
    Hi Carlos,

    But how do the test ones override the main ones? Having the same
    names? Can you give me more hints about it? This is just what I
    need.

    I will download the oness from home as I cannot go out with maven from
    the company proxy.

    Thanks a lot man.

    Marcelo

    8/18/05, Carlos Sanchez <carlossg (AT) gmail (DOT) comwrote:
    Hi,

    My approach is using classpath application contexts so the ones in
    src/test/resources override the ones in src/main/resources.

    You can check it out at http://oness.sourceforge.net

    8/18/05, Marcelo Alcantara <maralc (AT) gmail (DOT) comwrote:
    Friends,

    I am using spring in a J2EE project that is being build with maven.

    Somebody here have a good picture on how organizing different spring
    applicationContext.xml s for main and test?

    To be more clear, in a production environment, my ejb will need to
    get
    one applicationcontext.xml. In test environment it would need to
    obtain another applicationcontext.

    I am sure I am not the first one to have this doubt.
    --
    Thanks in advance.
  • No.5 | | 2929 bytes | |

    Hi Carlos/Thomas,

    Thank you for the reply.

    I checked the oness and saw the loading of the applicationContexes.
    And could notice that by default the server loads the test
    applicationContexts before the main ones. My main doubt right now is
    how can I be sure that its gonna be the default behaviour now on. Do
    you know where it is configurable or how maven take that decision?

    Thomas, why do you prefer to avoid loading applicationcontexts in
    testing situation? Too much overhead? And you Carlos, what do you
    think about avoiding the applicationcontexts in testing environment
    and using mocks?

    Cheers,

    Marcelo

    8/19/05, Thomas Van de Velde <thomas.vdvelde (AT) gmail (DOT) comwrote:
    I give them a seperate name. In fact, in a unit test, you do not want to
    load your full "production" context as this may have a big performance
    impact (especially when using Hibernate). The best thing to do is 1) avoid
    loading application contexts where possible by using mock implementations
    for your dependencies 2) When you want to run integration tests, load a
    subset of your "production" context that configures the piece of logic that
    you want to test top-down 3) Have maybe one integration test that loads your
    "production" context as a whole to make sure that there are no errors in
    your configuration. Key message: avoid the use of application context for
    unit testing and default to mock objects.

    Cheers,
    Thomas

    8/18/05, Carlos Sanchez <carlossg (AT) gmail (DOT) comwrote:

    The test ones need to be in the classpath before the main ones. IIRC
    that's by default or maybe in the project.xml build section

    8/18/05, Marcelo Alcantara <maralc (AT) gmail (DOT) comwrote:
    Hi Carlos,

    But how do the test ones override the main ones? Having the same
    names? Can you give me more hints about it? This is just what I
    need.

    I will download the oness from home as I cannot go out with maven from
    the company proxy.

    Thanks a lot man.

    Marcelo

    8/18/05, Carlos Sanchez <carlossg (AT) gmail (DOT) comwrote:
    Hi,

    My approach is using classpath application contexts so the ones in
    src/test/resources override the ones in src/main/resources.

    You can check it out at http://oness.sourceforge.net

    8/18/05, Marcelo Alcantara <maralc (AT) gmail (DOT) comwrote:
    Friends,

    I am using spring in a J2EE project that is being build with maven.

    Somebody here have a good picture on how organizing different spring
    applicationContext.xml s for main and test?

    To be more clear, in a production environment, my ejb will need to
    get
    one applicationcontext.xml. In test environment it would need to
    obtain another applicationcontext.

    I am sure I am not the first one to have this doubt.
    --
    Thanks in advance.
  • No.6 | | 3024 bytes | |

    Where are you guys?

    8/19/05, Marcelo Alcantara <maralc (AT) gmail (DOT) comwrote:
    Hi Carlos/Thomas,

    Thank you for the reply.

    I checked the oness and saw the loading of the applicationContexes.
    And could notice that by default the server loads the test
    applicationContexts before the main ones. My main doubt right now is
    how can I be sure that its gonna be the default behaviour now on. Do
    you know where it is configurable or how maven take that decision?

    Thomas, why do you prefer to avoid loading applicationcontexts in
    testing situation? Too much overhead? And you Carlos, what do you
    think about avoiding the applicationcontexts in testing environment
    and using mocks?

    Cheers,

    Marcelo

    8/19/05, Thomas Van de Velde <thomas.vdvelde (AT) gmail (DOT) comwrote:
    I give them a seperate name. In fact, in a unit test, you do not want to
    load your full "production" context as this may have a big performance
    impact (especially when using Hibernate). The best thing to do is 1) avoid
    loading application contexts where possible by using mock implementations
    for your dependencies 2) When you want to run integration tests, load a
    subset of your "production" context that configures the piece of logic that
    you want to test top-down 3) Have maybe one integration test that loads your
    "production" context as a whole to make sure that there are no errors in
    your configuration. Key message: avoid the use of application context for
    unit testing and default to mock objects.

    Cheers,
    Thomas

    8/18/05, Carlos Sanchez <carlossg (AT) gmail (DOT) comwrote:

    The test ones need to be in the classpath before the main ones. IIRC
    that's by default or maybe in the project.xml build section

    8/18/05, Marcelo Alcantara <maralc (AT) gmail (DOT) comwrote:
    Hi Carlos,

    But how do the test ones override the main ones? Having the same
    names? Can you give me more hints about it? This is just what I
    need.

    I will download the oness from home as I cannot go out with maven from
    the company proxy.

    Thanks a lot man.

    Marcelo

    8/18/05, Carlos Sanchez <carlossg (AT) gmail (DOT) comwrote:
    Hi,

    My approach is using classpath application contexts so the ones in
    src/test/resources override the ones in src/main/resources.

    You can check it out at http://oness.sourceforge.net

    8/18/05, Marcelo Alcantara <maralc (AT) gmail (DOT) comwrote:
    Friends,

    I am using spring in a J2EE project that is being build with maven.

    Somebody here have a good picture on how organizing different spring
    applicationContext.xml s for main and test?

    To be more clear, in a production environment, my ejb will need to
    get
    one applicationcontext.xml. In test environment it would need to
    obtain another applicationcontext.

    I am sure I am not the first one to have this doubt.
    --
    Thanks in advance.
  • No.7 | | 762 bytes | |

    PGP SIGNED MESSAGE
    Hash: SHA1

    Aug 20, 2005, at 08:10, Marcelo Alcantara wrote:

    Where are you guys?

    8/19/05, Marcelo Alcantara <maralc (AT) gmail (DOT) comwrote:

    Being as it's been less than 24 hours since your last question, and
    it's a weekend, I would guess that they have lives outside of providing
    free support for open source software.
    - --
    Craig S. Cottingham
    craig (AT) cottingham (DOT) net
    PGP key available from:

    PGP SIGNATURE
    Version: GnuPG v1.2.4 (Darwin)

    /IvzJhepjUDB/qPascyTo+Q=
    =M87s
    PGP SIGNATURE

    To unsubscribe, e-mail: users-unsubscribe (AT) maven (DOT) apache.org
    For additional commands, e-mail: users-help (AT) maven (DOT) apache.org
  • No.8 | | 1342 bytes | |

    Sorry Craig,

    But I am working on a very big billing project.

    And if you really work with software development, you know what
    happens with us in such situations.

    I help people anytime anywhereI have the "community feelling". And
    let for my contractor pay my salary/my money.

    Your message was really a waste of time. And so do mine (this one).

    I wait for the reply of the community friends.

    Please dont answer this. Dont waste your time.

    Cheers

    Marcelo

    8/20/05, Craig S. Cottingham <craig (AT) cottingham (DOT) netwrote:
    PGP SIGNED MESSAGE
    Hash: SHA1

    Aug 20, 2005, at 08:10, Marcelo Alcantara wrote:

    Where are you guys?

    8/19/05, Marcelo Alcantara <maralc (AT) gmail (DOT) comwrote:

    Being as it's been less than 24 hours since your last question, and
    it's a weekend, I would guess that they have lives outside of providing
    free support for open source software.
    - --
    Craig S. Cottingham
    craig (AT) cottingham (DOT) net
    PGP key available from:

    PGP SIGNATURE
    Version: GnuPG v1.2.4 (Darwin)

    /IvzJhepjUDB/qPascyTo+Q=
    =M87s
    PGP SIGNATURE

    To unsubscribe, e-mail: users-unsubscribe (AT) maven (DOT) apache.org
    For additional commands, e-mail: users-help (AT) maven (DOT) apache.org
  • No.9 | | 887 bytes | |

    Sat, 2005-08-20 at 14:40 -0300, Marcelo Alcantara wrote:
    Sorry Craig,

    But I am working on a very big billing project.

    And if you really work with software development, you know what
    happens with us in such situations.

    Just have to patient. Lots of times questions get answered over weekends
    and holidays we provide what we can whenever we can. If you look at
    the archives you'll see Brett, John, Emmanuel, Trygve and Carlos answer
    almost everything eventually. I think we do a pretty good job clearing
    up most questions

    We understand your situation, we're developing software too.

    I don't know anything about the struts genapp templates so I can't
    really help you. Sorry. The template authors email address is in the
    sources so you might be able to ask that fellow (not posting here to
    prevent spamming).
  • No.10 | | 747 bytes | |

    Hi Jason,

    I knowI have gotten very nice answers here in this list and people
    really seem to be cool. Just saw the Carlos oness that I didnt know
    and it is very nice work too.

    We have a bit of stress today, but talked offline and everything went
    well in the end. :)

    A lot of misunderstanding from everybody.

    The question about genapp templates was already answered.

    What I asked latelly was about how maven decides what to load first
    when running tests. Carlos suggested me to have spring appcontext
    files with the same name, that the test ones would override the main
    ones. But I just wanted to make sure and understand how maven deals
    with it.

    Thanks for the attention.

    Maralc
  • No.11 | | 1209 bytes | |

    Marcelo,

    I haven't answered your follow-up for two reasons:
    1) You ask something I've already answered "as this may have a big
    performance impact"
    2) I do not like your tone. You have posted twice "Where are you guys?" In
    response to that I can tell you that I was on a flight from the US to Europe
    coming back from a very BIG project.

    Thomas

    8/21/05, Marcelo Alcantara <maralc (AT) gmail (DOT) comwrote:

    Hi Jason,

    I knowI have gotten very nice answers here in this list and people
    really seem to be cool. Just saw the Carlos oness that I didnt know
    and it is very nice work too.

    We have a bit of stress today, but talked offline and everything went
    well in the end. :)

    A lot of misunderstanding from everybody.

    The question about genapp templates was already answered.

    What I asked latelly was about how maven decides what to load first
    when running tests. Carlos suggested me to have spring appcontext
    files with the same name, that the test ones would override the main
    ones. But I just wanted to make sure and understand how maven deals
    with it.

    Thanks for the attention.

    Maralc
  • No.12 | | 1581 bytes | |

    Hey Thomas,

    As I said before, I asked that in a good way ("Where are you guys").
    And the confusion between me and Craig was already solved.

    I didnt intend to be aggressive. (But I know I was when answering to Craig).

    Dont get me bad.

    Cheers

    Marcelo

    8/22/05, Thomas Van de Velde <thomas.vdvelde (AT) gmail (DOT) comwrote:
    Marcelo,

    I haven't answered your follow-up for two reasons:
    1) You ask something I've already answered "as this may have a big
    performance impact"
    2) I do not like your tone. You have posted twice "Where are you guys?" In
    response to that I can tell you that I was on a flight from the US to Europe
    coming back from a very BIG project.

    Thomas

    8/21/05, Marcelo Alcantara <maralc (AT) gmail (DOT) comwrote:

    Hi Jason,

    I knowI have gotten very nice answers here in this list and people
    really seem to be cool. Just saw the Carlos oness that I didnt know
    and it is very nice work too.

    We have a bit of stress today, but talked offline and everything went
    well in the end. :)

    A lot of misunderstanding from everybody.

    The question about genapp templates was already answered.

    What I asked latelly was about how maven decides what to load first
    when running tests. Carlos suggested me to have spring appcontext
    files with the same name, that the test ones would override the main
    ones. But I just wanted to make sure and understand how maven deals
    with it.

    Thanks for the attention.

    Maralc
  • No.13 | | 1685 bytes | |

    Case closed ;-)

    8/22/05, Marcelo Alcantara <maralc (AT) gmail (DOT) comwrote:

    Hey Thomas,

    As I said before, I asked that in a good way ("Where are you guys").
    And the confusion between me and Craig was already solved.

    I didnt intend to be aggressive. (But I know I was when answering to
    Craig).

    Dont get me bad.

    Cheers

    Marcelo

    8/22/05, Thomas Van de Velde <thomas.vdvelde (AT) gmail (DOT) comwrote:
    Marcelo,

    I haven't answered your follow-up for two reasons:
    1) You ask something I've already answered "as this may have a big
    performance impact"
    2) I do not like your tone. You have posted twice "Where are you guys?"
    In
    response to that I can tell you that I was on a flight from the US to
    Europe
    coming back from a very BIG project.

    Thomas

    8/21/05, Marcelo Alcantara <maralc (AT) gmail (DOT) comwrote:

    Hi Jason,

    I knowI have gotten very nice answers here in this list and people
    really seem to be cool. Just saw the Carlos oness that I didnt know
    and it is very nice work too.

    We have a bit of stress today, but talked offline and everything went
    well in the end. :)

    A lot of misunderstanding from everybody.

    The question about genapp templates was already answered.

    What I asked latelly was about how maven decides what to load first
    when running tests. Carlos suggested me to have spring appcontext
    files with the same name, that the test ones would override the main
    ones. But I just wanted to make sure and understand how maven deals
    with it.

    Thanks for the attention.

    Maralc

Re: Maven/Spring Testing


max 4000 letters.
Your nickname that display:
In order to stop the spam: 7 + 6 =
QUESTION ON "Java"

EMSDN.COM