Comments (4)
I don't know what you are trying to show with the code. You seem to be defining configurations with annotations in the test case class. You need much more explanation of what you are trying to do and why.
I can see that having some configuration in ConfigurationAdmin before running test methods can be useful. But I am not sure I can see what it means to inject a configuration into a field or a method parameter means.
from osgi-test.
Also, I think we would also want a way to provide equivalent support for JUnit 4.
from osgi-test.
I made the Example a bit more descriptive.
The idea is to get having some configuration in ConfigurationAdmin before running test.
I think this should be done by annotating the method.
@Test
@Configuration(pid = PID_NAME, factory = true, properties = {
@ConfigEntry(key = "key1", value = "value") })
public void configMethodInjectService(
@InjectService(filter = "(%s=%s)", filterArguments = { "service.pid",
PID_NAME }) Object service)
{
service.toString();
}
To get access to the org.osgi.service.cm.Configuration::update
and org.osgi.service.cm.Configuration::delete
Method it would help to inject the org.osgi.service.cm.Configuration
Fields and Parameters
/*
*
* Create or Get @Configuration on for the Test and use the Configuration in the Test
*
*/
@Test
public void updateConfigInTest(
@Configuration(pid = "my.pid") org.osgi.service.cm.Configuration configuration)
throws IOException
{
//TODO: some Tests
//change Config
configuration.update(Dictionaries.dictionaryOf("foo", "barbar"));
//TODO: some Tests
}
I this is interesting i will Provide an PR for Junit5 and Junit4
from osgi-test.
Closed via #165
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
- NPE with @WithFactoryConfiguration HOT 15
- [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.