felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver Lietz <apa...@oliverlietz.de>
Subject Re: Bundles needed to use DS/SCR
Date Wed, 10 Aug 2016 22:31:46 GMT
On Wednesday 10 August 2016 11:29:00 Benson Margulies wrote:
> Configuration-wise, I have the following code. Logging-wise, I have
> pax-exam installing logging, but I will recheck that.
> 
> 
> org.osgi.service.cm.Configuration workerConf =
> configurationAdmin.getConfiguration("com.basistech.ws.worker");
> Dictionary<String, Object> props = new Hashtable<>();
> 
> Path mainWorkerConfigPath =
> Paths.get("../../assemblies/common/configuration/src/main/resources/rosapi/w
> orker-config.yaml"); Path testEndpointPath =
> Paths.get("src/test/config/endpoints.yaml");
> 
> props.put("configurationFilePathname",
> mainWorkerConfigPath.toAbsolutePath().toString());
> props.put("endpointsPathname",
> testEndpointPath.toAbsolutePath().toString());
> 
> workerConf.setBundleLocation(null);
> workerConf.update(props);

There is a much smarter way to provide component configurations in Pax Exam 
(Thanks to Christoph Läubrich): pax-exam-cm

Have a look at SlingOptions [1] in Sling's Testing PaxExam module for 
examples.

Also, adding Felix DS to a Pax Exam test is easily done with 
SlingOptions.scr().

Regards,
O.

[1] 
https://github.com/apache/sling/blob/trunk/testing/org.apache.sling.testing.paxexam/src/main/java/org/apache/sling/testing/paxexam/SlingOptions.java

[...]

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Mime
View raw message