Support for test-only layers in testsuites.
- Dominant language
- Java
- Stars
- 3.1k
- Forks
- 935
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 17
Description
### Description
Support for including (merging) a layer fragment for testing would be useful.
### Use case/motivation
I needed to write a test that injects something into layers, so that NB implementation sees testing data through FileUtil.getConfigFile and lookup. In simple cases, it is sufficient to provide META-INF/generated-layer.xml, which is picked by the module system automatically from classpath. But in my case, the testsuite uses layer-generating annotations that themselves make such file, effectively overwriting the custom one.
There's some support in Java's `SourceUtilsTestUtil` in `java.source.base` - but I think the support should be promoted, most probably to `openide.filesystems` that contains various filesystem-related or generally to some `platform` cluster module that tests can depend on.
Alternatively, another layer-generating annotation can be created (e.g. in `openide.filesystems`, that would copy over resource content into the generated layer.xml
### Related issues
_No response_
### Are you willing to submit a pull request?
Yes
Contributor guide
Research direction
Start with SourceUtilsTestUtil in java.source.base and inspect the testsuite layer-generating annotations, along with how META-INF/generated-layer.xml is consumed by FileUtil.getConfigFile and lookup. Compare the proposed openide.filesystems or platform-cluster locations and define a test-only layer merge that does not get overwritten by generated layers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- testing-qa, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100