ProfileService Resolving Repository Names with VFS3
johnbailey Feb 15, 2010 6:40 PMWhile 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?