Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[wtp-dev] File locking on web.xml


I am running into a problem while trying to construct a dynamic web project for use in my JUnit testing. The issue appears to be a file lock on the web.xml file. Using code I've found in other JUnit tests, I am attempting to construct my test dynamic web project as follows:

IDataModel dataModel = DataModelFactory.createDataModel(new WebFacetProjectCreationDataModelProvider()); dataModel.setProperty(IFacetProjectCreationDataModelProperties.FACET_PROJECT_NAME, projectName); dataModel.getDefaultOperation().execute(new NullProgressMonitor(), null);

This works fine inasmuch as everything appears to be created correctly and I am able to run tests in this project. However, I am running this code from my setUp() method. When I have multiple tests in the same suite, the project is deleted and recreated on each test. But I get an error on the workspace delete of the project which appears to be caused by the web.xml being locked after the above call. This creates problems in each subsequent test because the web root cannot be correctly reconstructed (unless I change the name of the project or some other workaround).

There appears to possibly be a threading issue here, since if I wait long enough while tracing in the debugger, the lock eventually goes away. Has anyone encountered this or does anyone have ideas as to how to resolve or workaround this problem? Obviously changing the name the project on each iteration is a possible workaround.



Back to the top