8 Replies Latest reply on Jun 13, 2007 11:55 AM by julien1

    URLNavigator Tests

    mwringe

      I have been updating the urlnavigator testcases and fixing some issues with the file and jar urlnavigators.

      Would it make sense to test situations such as:
      1) invalid jars: jars that have elements added or removed from them
      2) files with symbolic links: possible situation in which a loop could occur

      The jar urlnavigator still has some issues with it, its a bit of a pain the way jars are handled in java.

        • 1. Re: URLNavigator Tests

          for point 1/ : yes it is a must to have

          normally the implementation should deal with it as it simulates missing stuff using a stack

          for point 2/ : what would be the behavior ? follow the link or skip it ?

          • 2. Re: URLNavigator Tests
            mwringe

             

            "julien@jboss.com" wrote:

            for point 2/ : what would be the behavior ? follow the link or skip it ?


            If we follow the links we could get into an infinite loop situation. For example
            /a1/
            /a1/b1 -> /a1/ [b1 links back to a1]

            The other issue is how can this test be integrated into the testsuite? I don't believe Windows has the concept of links (although I could be wrong)

            I also think I need to look a bit more into how java handles symlinks.

            • 3. Re: URLNavigator Tests

              Ok, probably that it is hard to unit test because it depends on the target environment.

              • 4. Re: URLNavigator Tests
                prabhat.jha

                Cant we make this symlink test run only when OS is non-windows? I found this http://shell-shocked.org/article.php?id=284 for symlink in windows but it does not seem cool.

                • 5. Re: URLNavigator Tests
                  mwringe

                  Sorry, I have actually had this done for a while and should have spoke up before now.

                  I made a couple of changes to the code outside of the testcase. I implemented the option to filter on file name (he option was there before but it just didn't do anything).
                  I also added the option to visit the root of a jar now. In order to do this, I had to add a fake jar entry, '/', since this doesn't actually exist in the jar. This causes the current jar entry test to fail. Since this entry doesn't actually exist, is it ok to add it?

                  • 6. Re: URLNavigator Tests

                     

                    "mwringe" wrote:
                    I implemented the option to filter on file name (he option was there before but it just didn't do anything).


                    Good.

                    "mwringe" wrote:
                    I also added the option to visit the root of a jar now. In order to do this, I had to add a fake jar entry, '/', since this doesn't actually exist in the jar. This causes the current jar entry test to fail. Since this entry doesn't actually exist, is it ok to add it?


                    I don't understand, can you explain more precisely ?

                    • 7. Re: URLNavigator Tests
                      mwringe

                      The root of a jar, '/', doesn't actually exist as an entry in the jar. I added a "/" atom object in the jarentryinfo class. So now when you go to navigate the jar using the jarentryinfo class, the root element appears to exist. This allows for visiting a jar starting at the root.

                      The jar entry test would have to be updated since it doesn't expect the root element to be there.

                      • 8. Re: URLNavigator Tests

                        the sequence of generated events that is expected by the tests has to take in account now the presence of "/" entry.

                        it looks normal to me.

                        I think you can go ahead and commit your changes