4 Replies Latest reply on Jul 13, 2012 4:34 AM by xmlaura

    Seam with Maven

    walterjwhite

      Hi all,


      I have a few questions regarding Seam and architecture.


      http://seamframework.org/Documentation/SeamTestCoverageWithCobertura


      I have briefly looked at configuring Seam with Maven for test coverage and am not quite sure I understand the examples.  If I want my Seam project to be used as a dependency for other projects, how would I package it without making it a module?  Ideally, I want to test the core Seam functionality independent of my different implementations of the web applications.  In the web application project, I will perform some additional testing there to ensure it integrated with the Seam project, but also test the functionality the web application provided.


      Would it make sense to follow the project structure outlined in the example above and have 2 or more POMS?  One for each parent, or is there a better way to have a core project in which can be independently tested and then used in other projects?



      Thanks,
      Walter





      Thanks,
      Walter

        • 1. Re: Seam with Maven
          kapitanpetko

          If you have 'pure' unit tests, that don't need Seam to be started, you can simply put your tests in your project (src/test/java) and you
          will get Cobertura coverage by running cobertura:cobertura. If you, however, want to use SeamTest (starts Seam, you get bijection, conversations, the whole lot), you will need components.xml, pages.xml, etc, so it's easier to put your SeamTest's in your web project (assuming the structure in the above page). But since the Cobertura Maven plugin instruments only the classes in the current project, so you won't get full coverage (you get coverage only for the classes in the web project). Hence the need to replace dependent-on jars with instrumented ones.


          Not sure what you mean by 'one for each parent' and 'a core project in which can be independently tested'. Do you have one more applications?
          Are those EAR's or WAR's?

          • 2. Re: Seam with Maven
            walterjwhite

            Hi Nikolay,


            Thanks for your reply.


            I would like to run both unit and integration tests.


            What I meant was, I have several projects which make up my web project:
            file operations
            Seam (adds entities, various actions (login, register, forgot password, etc.), and auditing)
            Web Content project (depends on Seam, adds web entities (nodes, wiki pages, comments, etc.))



            Prior to me using Seam, I was using Spring in which case, I could test the application or module at each stage as a unit and integration test.  I want to switch to Seam as the application is a lot smaller yet more robust.  The issue that I am having is, by having separated my projects this way, I cannot test each individual project.


            These sub-projects also are used in another web application for a slightly different purpose.  I am using maven as my project management tool, so my projects look like this:


            web app 1
            fileIo
            seamCore
            webContent
            business
            actual web pages, configuration for web app


            web app 2
            fileIo
            seamCore
            webContent
            actual web pages, configuration for web app


            If I would configure those sub-projects as modules, which also works, I would have to have 2 poms for each module, right?  What is the best way to make those modules or dependencies able to be used in other projects without causing clutter and allowing me to unit/integration test each project?


            I want to minimize duplication of effort, so copying poms doesn't seem like a very robust solution as they are really not 2 separate artifacts, and doing it the way I have now does not follow the example on the seam website.


            Any ideas or comments are helpful.  Please let me know if this is still unclear.


            Thanks,
            Walter

            • 3. Re: Seam with Maven
              kapitanpetko

              Walter White wrote on Feb 20, 2009 23:36:


              These sub-projects also are used in another web application for a slightly different purpose.  I am using maven as my project management tool, so my projects look like this:

              web app 1
              fileIo
              seamCore
              webContent
              business
              actual web pages, configuration for web app
              
              web app 2
              fileIo
              seamCore
              webContent
              actual web pages, configuration for web app
              



              If I would configure those sub-projects as modules, which also works, I would have to have 2 poms for each module, right?  What is the best way to make those modules or dependencies able to be used in other projects without causing clutter and allowing me to unit/integration test each project?



              If your modules (fileIo, seamCore, business) are regular JAR's, I don't see a reason not to have them as modules.
              You can have two webapps, each depending on the modules it needs. You will need a single POM for each module, two POM's for each webapp,
              and possibly a parent POM. Something like:


              my-parent/pom.xml
               |
               +- fileIo/
               |
               +- seamCore/
               |
               +- business/
               |
               +- web-app1/
               |   |
               |   +- src/main/webapp: actual web pages, configuration for web app
               |
               +- web-app2/
                   |
                   +- src/main/webapp: actual web pages, configuration for web app
              



              You can then test fileIo, seamCore and business independently and have any additional/specific tests in web-app1/2.


              I am not a Maven expert, but that seems the natural way to structure your project. Depending on other constraints you may have,
              YMMV, of course.


              • 4. Re: Seam with Maven
                xmlaura

                Hi

                 

                i have similar but little bit different issue, i have repo from two projects, both with submodules, and the

                 

                 

                parent1/pom.xml

                  |

                  +- batchApp -(main+test)

                |

                  +-webApp

                 

                parent2/pom.xml

                  |

                  +- DBUtil (main+test)

                  |

                  +- kid2.2

                 

                So src/tests in batchApp/test of parent1 will run tests cover code inside src/main of DBUtil of parent2, can I follow the same in the http://seamframework.org/Documentation/SeamTestCoverageWithCobertura, the

                (almost) No Ant Solution for

                • In project-ejb and project-common define the following profile: ....
                • In your project-web define the following profile: ...

                 

                Appreciate any comments/help!!!