Oh hell yeah… brother, you just made my day. Thanks Eric!
> On Mar 5, 2021, at 5:13 PM, Eric Norman <[email protected]> wrote: > > Hi Cris, > > I took a quick look and noticed a couple of things: > > 1. It looks like the package that contains your service interfaces needs to > be exported. The problem is that the service interface class that you are > trying to inject is not visible to the osgi bundle that contains the test > class. The paxexam test class is in its own osgi bundle so it can only see > java packages that have been exported from the original bundle. The > simplest way to do that would be to just place a package-info.java file in > that java package whose content looked something like the following to > declare the exported version number: > > @org.osgi.annotation.versioning.Version("1.0.0") > package org.apache.sling.auth.saml2; > > > 2. The line in org.apache.sling.auth.saml2.Activator that changes the > bundle start level seems to be interfering with completing the bundle > startup. Removing that line got the Saml2UserMgtService service in the > bundle to activate for me and the osgi service got injected. > > 3. AuthenticationHandlerSAML2Impl has been defined as requiring > configuration before it is activated, so you will need to supply that > configuration in your paxexam configuration options before that would be > activated and available to be injected with something like this in your > Options: > > // supply the required configuration so the auth handler service > will activate > > newConfiguration("org.apache.sling.auth.saml2.AuthenticationHandlerSAML2") > //TODO: populate any configuration values here > .asOption(), > > > I attempted to fix those issues and applied the changes in the commit at: > https://github.com/apache/sling-whiteboard/commit/b295f4320a03b15da0e713c9abd035b6cf31d8c4 > > <https://github.com/apache/sling-whiteboard/commit/b295f4320a03b15da0e713c9abd035b6cf31d8c4> > > Hope that helps. > > Regards, > -Eric > > > > > > On Fri, Mar 5, 2021 at 12:53 PM Cris Rockwell <[email protected] > <mailto:[email protected]>> wrote: > >> Hi all, >> >> You all have been very helpful as I continuing learning about Pax Exam >> testing. After some time, I patched the oak bundles version to 1.32. My >> test logs the bundles names and states for each; as shown below all bundles >> but one bundle report status:active >> ... >> message=org.apache.sling.auth.form:1.0.14state:active >> message=org.apache.jackrabbit.oak-jackrabbit-api:1.32.0state:active >> message=org.apache.jackrabbit.oak-auth-external:1.32.0state:active >> message=org.ops4j.pax.tipi.junit:4.12.0.1state:active >> message=org.ops4j.pax.tipi.hamcrest.core:1.3.0.1state:active >> message=org.ops4j.pax.exam.invoker.junit:4.13.3state:active >> message=slf4j.api:1.7.26state:active >> … >> >> But my test bundle status reports "resolved" >> message=org.apache.sling.auth.saml2:0.2.0.SNAPSHOTstate:4 >> >> My tests fail because I cannot get references to the services. As I >> mentioned, there are no more obvious wiring dependency errors in the logs. >> The bundle under test Activator logs messages, which look good. >> >> When my IT test tries to @Inject a reference >> @Inject >> Saml2UserMgtService saml2UserMgtService; >> it fails >> [ERROR] org.apache.sling.auth.saml2.impl.SamlHandlerIT.test_setup Time >> elapsed: 0.073 s <<< ERROR! >> java.lang.ClassNotFoundException: >> org.apache.sling.auth.saml2.Saml2UserMgtService not found by >> PAXEXAM-PROBE-dc8debbd-300f-46cf-b125-75a8e3e9ebc9 [198] >> >> >> Here is the IT test >> >> https://github.com/apache/sling-whiteboard/blob/SLING-9397/improve-test-coverage/saml-handler/src/test/java/org/apache/sling/auth/saml2/impl/SamlHandlerIT.java >> < >> https://github.com/apache/sling-whiteboard/blob/SLING-9397/improve-test-coverage/saml-handler/src/test/java/org/apache/sling/auth/saml2/impl/SamlHandlerIT.java >> >> <https://github.com/apache/sling-whiteboard/blob/SLING-9397/improve-test-coverage/saml-handler/src/test/java/org/apache/sling/auth/saml2/impl/SamlHandlerIT.java> >>> >> >> >> Activator looks like this >> >> https://github.com/apache/sling-whiteboard/blob/SLING-9397/improve-test-coverage/saml-handler/src/main/java/org/apache/sling/auth/saml2/Activator.java >> >> <https://github.com/apache/sling-whiteboard/blob/SLING-9397/improve-test-coverage/saml-handler/src/main/java/org/apache/sling/auth/saml2/Activator.java> >> < >> https://github.com/apache/sling-whiteboard/blob/SLING-9397/improve-test-coverage/saml-handler/src/main/java/org/apache/sling/auth/saml2/Activator.java >> >> <https://github.com/apache/sling-whiteboard/blob/SLING-9397/improve-test-coverage/saml-handler/src/main/java/org/apache/sling/auth/saml2/Activator.java> >>> >> >> >> If you looked at any of this, thank so much! >> >> Cris
