3 Replies Latest reply on Feb 16, 2010 11:11 AM by emuckenhuber

    ProfileService Resolving Repository Names with VFS3

    johnbailey

      While running the JBossAS testsuite against the VFS3 branches ran into several failures with profileservices tests.  All the failures were a result of a mismatched repository names for deployments from directories.  The failures occur in the following block of code in 'AbstractDeploymentTest:seUp'

       

       

                     String[] names = jarNames.split(",");
                     for (String name : names)
                     {
                        DeploymentProgress distribute = getDeploymentManager().distribute(name, getManagedURL(name), copyContent);
                        //distribute.addProgressListener(LOG_PROGRESS_LISTENER);
                        distribute.run();
                        checkProgress(distribute);
      
                        deploymentNames.addAll(Arrays.asList(distribute.getDeploymentID().getRepositoryNames()));
                     }
                     
                     // Check the resolution of repository names
                     assertTrue("resolve repsoitory names", 
                           Arrays.asList(getDeploymentManager().getRepositoryNames(names)).containsAll(deploymentNames));
      
      

       

      What seems to be happening with directory deployments is the 'distribute.getDeploymentID().getRepositoryNames()' always returns the VFS path name with the trailing '/' removed and the call to 'getDeploymentManager().getRepositoryNames(names)' is returning the repository names with the trailing slash in the name.

       

      The traling slash is coming from the following piece of code in org.jboss.profileservice.management.upload.remoting.DeployHandler:

         
         protected List<String> getTransientRepositoryNames(String[] names)
         {
            List<String> repositoryNames = new ArrayList<String>();
            for(String name : names)
            {
               if(this.transientDeployments.containsKey(name))
               {
                  repositoryNames.add(name);
                  continue;
               }
               for(VirtualFile vf : this.transientDeployments.values())
               {
                  if(vf.getName().equals(name))
                  {
                     try
                     {
                        String repositoryName = vf.toURI().toString();
                        repositoryNames.add(repositoryName);
                     }
                     catch(Exception ignored) { }
                  }
               }
            }
            return repositoryNames;
         }
      

       

      I tested  a fix by stripping the trailing slash from the repositoryName if it was present.  This fixed all the failing tests, but may be a hack.

       

      I seem to recall something in the profile service had to change for VFS3 with regard to the handling the trailing slash, but can't find the exact details.

       

      Anyway, how should this be handled?

        • 1. Re: ProfileService Resolving Repository Names with VFS3
          emuckenhuber

          Hmm, yeah i started to change the deployment names not to have the trailing '/' in the vfs3 branch. Seems i missed this one, thanks! So just use this "fix" for now - i'll have to change some parts anyway, since this is not really the way it should be handled. There is a spin off project of profileservice, where i still need to update to vfs3 - i guess i'll start doing that once there is a deployers release with vfs3 (which seems to be soon).

           

          With "this fixed all the failing tests" you mean that all the profileservice tests pass in the VFS3 branch, or are there other problems?

          • 2. Re: ProfileService Resolving Repository Names with VFS3
            johnbailey
            There were a few other failures, but I haven't had a chance to track down the cause.  This one was responsible for ~25 failures.  I will take a look at the others and see if it is obvious otherwise I will create some JIRAs to keep track of the others.
            • 3. Re: ProfileService Resolving Repository Names with VFS3
              emuckenhuber

              Hmm do you have a hudson instance for the branch running somewhere, or maybe you want to post the failures here. I might be able to guess where the problem is. Depending on which tests are failing we can also wait until this is integrated into trunk, since it would be easier for me to help.