Giter Club home page Giter Club logo

Comments (4)

bjhargrave avatar bjhargrave commented on August 18, 2024

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.

bjhargrave avatar bjhargrave commented on August 18, 2024

Also, I think we would also want a way to provide equivalent support for JUnit 4.

from osgi-test.

stbischof avatar stbischof commented on August 18, 2024

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.

kriegfrj avatar kriegfrj commented on August 18, 2024

Closed via #165

from osgi-test.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.