Comments (15)
Are you able to provide more of an example? How/where is the annotation being used?
from osgi-test.
public TestClass {
@Test
@WithFactoryConfiguration(factoryPid = "org.eclipse.daanse.ws.server.ServerRuntime", name="testme", properties = {
@Property(key="Hello", value="World")
})
public void testMe() {
}
}
from osgi-test.
Aren't you missing the
@ExtendWith(ConfigurationExtension.class)
public TestClass {
...
}
from osgi-test.
I don't miss it personally and @WithFactoryConfiguration
is annotated with @ExtendWith(ConfigurationExtension.class)
and @Inherited
already.
But even if someone is missing that, it should clearly state that in the error message and not run into a NPE...
from osgi-test.
Also https://junit.org/junit5/docs/current/user-guide/#extensions-keeping-state says:
Usually, an extension is instantiated only once. So the question becomes relevant: How do you keep the state from one invocation of an extension to the next? The ExtensionContext API provides a Store exactly for this purpose.
so using a static singleton seems wrong here anyways.
from osgi-test.
But even if someone is missing that, it should clearly state that in the error message and not run into a NPE...
Absolutely - I just want to be sure that the tests work if you do add the extension directly, or whether there's a more serious issue with the extension. I've found that sometimes the @ExtendWith
is necessary (with other extensions too) as the lifecycle for the location (in this case a method) is discovered too late for some of the processing that is needed.
from osgi-test.
Yes it works when I manually add the annotation, but as far as I understand @Inherited
was meant to not require this. But as this access the method and is supposed to clear the created config after method exit, I also don't see why such a global context would be required and the extension seems to be called. It is just that beforeAll
is not called (obviously because it is method scoped). So blockinghandler might be extracted from the context, so if the parent has already one use that and if not create a local one?
from osgi-test.
Yes it works when I manually add the annotation
That's good, so it's not a total showstopper.
It is just that beforeAll is not called (obviously because it is method scoped). So blockinghandler might be extracted from the context, so if the parent has already one use that and if not create a local one?
That sounds reasonable, but we should check with @stbischof who created this component in case there is a reason.
from osgi-test.
The code is done at a point where functionality of putting an Extention like@ExtendWith(ConfigurationExtension.class)
on a annotation like@WithFactoryConfiguration
was not existing in junit 5. It came some weeks later an so it wans properly implemented from me.
also the documentation, and that we try to reset the configs after each test is not well documented
from osgi-test.
This issue has been automatically marked as stale because it has not had recent activity. Given the limited bandwidth of the team, it will be automatically closed if no further activity occurs. If you feel this is something you could contribute, please have a look at our Contributor Guide. Thank you for your contribution.
from osgi-test.
Still an issue...
from osgi-test.
Can you re-test this now #777 has been merged
from osgi-test.
My tests indicate that this is now solved, but it would be good to get confirmation from @laeubi
from osgi-test.
Can we close this issue?
from osgi-test.
@timothyjward yes if you think it is fixed, I'll probabbly open another one if I still find issues.
from osgi-test.
Related Issues (20)
- Add some descriptive documentation HOT 6
- osgi-test-example-mvn / org.osgi.test.example.player.test.PlayerTest are not executed HOT 4
- Need to obtain code coverage reports and interactive debugging within intellij and gradle plugin HOT 9
- Service instance are kept between different BundleContext's, Tests and test Classes HOT 4
- Provide a Junit5 Extension to start an OSGi-Connect-Framework as part of the test without any need for special setup HOT 4
- @ServiceSource should give a meaningfull error if no services are found HOT 3
- @ServiceSource should support ServiceAware<ServiceType> HOT 4
- readme link to codeql broken HOT 2
- [cm] Support Systemproperties in Property HOT 4
- [cm] either create unbound config, or provide an option for it. HOT 3
- Weird behaviour when using `ConfigurationExtension` and standard config files HOT 10
- Provide a possibillity to inject and empty configuration where update has not been called yet HOT 11
- waitForRemoval and wait for modification Method for ServiceAware HOT 2
- use @With(Factory)Configuration in Annotations of User
- org.osgi.test.junit5.cm.test.ConfigAnnotationTest makes Tests lazy
- Move examples to Java 11? HOT 8
- Replacement in @WithFactoryConfigutation Properties and Factorys name
- Release 1.3.0 HOT 11
- Regression - WithConfiguration is no longer inherited
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from osgi-test.