| Summary: | Files linked in .component are not correctly deployed | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [WebTools] WTP Java EE Tools | Reporter: | Fred Bricon <fbricon> | ||||||||
| Component: | jst.j2ee | Assignee: | Rob Stryker <stryker> | ||||||||
| Status: | RESOLVED FIXED | QA Contact: | Chuck Bridgham <cbridgha> | ||||||||
| Severity: | normal | ||||||||||
| Priority: | P3 | CC: | ccc, gregory.amerson, jasonpet, vvandens | ||||||||
| Version: | 3.2 | Flags: | cbridgha:
review+
|
||||||||
| Target Milestone: | 3.3.2 | ||||||||||
| Hardware: | PC | ||||||||||
| OS: | Windows Vista | ||||||||||
| Whiteboard: | |||||||||||
| Attachments: |
|
||||||||||
|
Description
Fred Bricon
Created attachment 179236 [details]
Test project
- Import the CustomWebXml project,
- deploy it to a server,
- check the deployment descriptor is wrongly deployed.
(In reply to comment #0) > Build Identifier: Helios, WTP 3.1.2 Oops, read WTP 3.2.1 instead. Assigning to Rob for initial investigation. As far as I know, there are no unit tests demonstrating this as a feature. I personally have never seen that usage before and so was not aware it was a feature. This explains why it is not functioning in the deployment model. I am not sure if it ever worked before, but it'd be interesting to see it tested on previous versions to see if the syntax worked then. Anyway, I'd like to see some discussion as to whether this would be a new feature or fixing a regression. It obviously applies. Rob, I never tried that before either, just trying to implement a new feature in m2eclipse-wtp. I'm pretty sure the fact that export is working is an accident -good for me-, I just want to emphasize the behavior discrepancy between export and deployment. I thought that was not supposed to happen anymore. Now I really don't care if this issue is turned into a feature request. I don't see anything blocking here, m2eclipse users will still be able to deploy custom web.xml files, as long as they're named web.xml fred: I'm trying in the 3.2.x codebase and I can't get the file to be included at all in this fashion ;) I notice you're using WTP 3.1.2. In WTP 3.1.2, the flattened virtual component model doesn't exist. I believe this was added in wtp 3.2.0. So unified behaviour should be more observable in wtp 3.2.0. However, as I said, in wtp 3.2.0, I don't see the file deployed at all so far (though it may just be a side-effect of some paths I'm using. I haven't figured it out yet despite spending a while tracing.) Give it a go on wtp 3.2 and let me know what you find. (In reply to comment #6) > I notice you're using WTP 3.1.2. see my 2nd comment (https://bugs.eclipse.org/bugs/show_bug.cgi?id=325733#c2) Eclipse Web Developer Tools Version: 3.2.1.v201007071800-7O7CFbBEMf84nSIGRvUy2Pq4fbXf Build id: 20100615235519 Works for me . Have you tried cleaning the server and publishing again? Sorry, but I somehow mixed up META-INF and WEB-INF. Please read/test with : <wb-resource deploy-path="/WEB-INF/web.xml" source-path="/etc/resources/custom-web.xml"/> One facepalm for Fred. retargeting to 3.3 Forcing to 3.3.1 due to schedule. Sorry. Created attachment 209608 [details]
Patch for this change
The test for this will go in EarProjectCreationOperationTest. The patch looks like this. Avoiding a .patch file right now since multiple new uncommitted tests are in the file.
public void testEAR_HardDeploymentMapping() throws Exception {
IDataModel dm = getEARDataModel("hardEAR", "ourContent", null, null, JavaEEFacetConstants.EAR_5, false);
OperationTestCase.runAndVerify(dm);
IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject("hardEAR");
IFolder f = p.getFolder("test");
f.create(true, true, new NullProgressMonitor());
IFile file = f.getFile("silly.txt");
file.create(new ByteArrayInputStream("Silly String".getBytes()), true, new NullProgressMonitor());
IVirtualComponent earComp = ComponentCore.createComponent(p);
IVirtualFolder rootFolder = earComp.getRootFolder();
IVirtualFile vfile = rootFolder.getFile(new Path("out/notsilly.txt"));
vfile.createLink(new Path("test/silly.txt"), 0, new NullProgressMonitor());
IModule module = ServerUtil.getModule(p);
assertNotNull(module);
ModuleDelegate md = (ModuleDelegate)module.loadAdapter(ModuleDelegate.class, new NullProgressMonitor());
IModuleResource[] resources = md.members();
assertTrue(resources.length == 1);
assertTrue(resources[0].getName().equals("out"));
IModuleFolder mf = (IModuleFolder)resources[0];
IModuleResource[] children = mf.members();
assertTrue(children.length == 1);
assertTrue(children[0].getName().equals("notsilly.txt"));
}
This change looks good go ahead, and add the test please Created attachment 209658 [details]
An additional patch on top of the previous
After running a fuller test suite, I found some other untested test cases failed. The issues were two:
1) Sometimes, the IVirtualResource is null. This should be guarded against
2) Behaviour when the path is "/" (as opposed to an empty path) caused incorrect behaviour and NPEs.
Item 1) is clearly caused by this bug's patch. Item 2 may be a long-standing issue that's been overlooked (?). Either way, I'm committing the test case with this additional fix to guard against these issues.
Committed and released to 3.3.2 and head |