Ah that link is dead. You can get it here now: https://github.com/99soft/miyamoto
On 27/04/18 17:54, Ferry Huberts via osgi-dev wrote: > I use https://code.google.com/p/miyamoto/ in my unit tests. Will work in > other contexts as well. > > > On 27/04/18 14:59, João Assunção via osgi-dev wrote: >> I'm using a custom version of Peter >> Kriens aQute.configurable.Configurable. Initially, I was using it only >> for unit testing but now when I need to run DS components in a plain >> java application (non OSGi). >> >> Regards, >> João Assunção >> >> Email: joao.assun...@exploitsys.com <mailto:joao.assun...@exploitsys.com> >> Mobile: +351 916968984 >> Phone: +351 211933149 >> Web: www.exploitsys.com <http://www.exploitsys.com> >> >> >> >> On Fri, Apr 27, 2018 at 12:11 PM, Tim Ward via osgi-dev >> <osgi-dev@mail.osgi.org <mailto:osgi-dev@mail.osgi.org>> wrote: >> >> Have you tried using the OSGi converter? >> >> You can fill a map with properties and then just: >> >> Converters.standardConverter().convert(map).to(MessagingEndpoint.class) >> >> This will honour the defaults from the annotation - see 707.4.4.4.5 >> of the compendium. The closest link I can give >> is >> https://osgi.org/specification/osgi.cmpn/7.0.0/util.converter.html#util.converter-maps >> >> <https://osgi.org/specification/osgi.cmpn/7.0.0/util.converter.html#util.converter-maps> >> >> >> Tim >> >>> On 27 Apr 2018, at 12:06, Christian Schneider via osgi-dev >>> <osgi-dev@mail.osgi.org <mailto:osgi-dev@mail.osgi.org>> wrote: >>> >>> I am using DS components with type safe configs like below. >>> My innermost tests should run outside of OSGi. So I am using Mockito >>> to inject dependencies into my component. >>> >>> For configs I use >>> >>> @Mock >>> MessagingEndpoint; >>> >>> In the test I then define behaviour like: >>> >>> when(config.endpoint()).thenReturn("http://localhost:8082 >>> <http://localhost:8082/>"); >>> >>> >>> This works but you do not get the default values. So you have to >>> set all config attributes. >>> >>> Is there a better way to simulate such configs? >>> >>> Christian >>> >>> ----- >>> @ObjectClassDefinition(name = "My config") >>> public@interface MessagingEndpoint{ >>> >>> @AttributeDefinition >>> String endpoint() default "http://localhost:8176 >>> <http://localhost:8176/>"; >>> >>> @AttributeDefinition >>> int connectTimeout() default 5000; >>> } >>> >>> -- >>> -- >>> Christian Schneider >>> http://www.liquid-reality.de <http://www.liquid-reality.de/> >>> >>> Computer Scientist >>> http://www.adobe.com <http://www.adobe.com/> >>> >>> _______________________________________________ >>> OSGi Developer Mail List >>> osgi-dev@mail.osgi.org <mailto:osgi-dev@mail.osgi.org> >>> https://mail.osgi.org/mailman/listinfo/osgi-dev >>> <https://mail.osgi.org/mailman/listinfo/osgi-dev> >> >> >> _______________________________________________ >> OSGi Developer Mail List >> osgi-dev@mail.osgi.org <mailto:osgi-dev@mail.osgi.org> >> https://mail.osgi.org/mailman/listinfo/osgi-dev >> <https://mail.osgi.org/mailman/listinfo/osgi-dev> >> >> >> >> >> _______________________________________________ >> OSGi Developer Mail List >> osgi-dev@mail.osgi.org >> https://mail.osgi.org/mailman/listinfo/osgi-dev >> > -- Ferry Huberts _______________________________________________ OSGi Developer Mail List osgi-dev@mail.osgi.org https://mail.osgi.org/mailman/listinfo/osgi-dev