You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Vincent Zurczak <vi...@linagora.com> on 2016/05/19 16:15:09 UTC

Missing commands when injecting SessionFactory in a PAX-Exam test

Hi,

I am working on a PAX-Exam test for Karaf 4 and I need to install a 
bundle DURING the test (not before).
I followed Achim's sample here [0] and injected a SessionFactory in my 
test. This seems to be working.
When I list the commands available in the session's registry, I find 
many well-known ones. Except there is not "bundle:install", 
"bundle:start", etc. And therefore, I cannot install my bundles.

Any idea about why these commands are missing?
Is this related to the way these commands are made available (Karaf 
commands VS. Gogo commands)?

Regards,

                  Vincent.


[ 0 ] : 
https://github.com/ANierbeck/Karaf-Cassandra/blob/master/Karaf-Cassandra-ITest/src/test/java/de/nierbeck/cassandra/itest/TestBase.java#L140-L170

-- 
Vincent Zurczak
Linagora: www.linagora.com <http://www.linagora.com/>

Twitter <https://twitter.com/VincentZurczak> Vincent Zurczak @ LinkedIn 
<http://fr.linkedin.com/pub/vincent-zurczak/18/b35/6a7> My Skype ID 
<callto://vincent.zurczak> My English blog <http://vzurczak.wordpress.com>

Re: Missing commands when injecting SessionFactory in a PAX-Exam test

Posted by Vincent Zurczak <vi...@linagora.com>.
Hi,

Le 20/05/2016 08:05, Jean-Baptiste Onofr� a �crit :
> Do you have the credential populated for the session ?

No. I have been searching for such an option since yesterday.
I did not find anything in Session or SessionFactory. This morning, I 
dig into SecuredSessionFactory, but this is not that helpful. The only 
thing I found was KarafTestSupport [0] that uses priviledged actions. It 
works when I run my command with the "admin" role [1]. But I am not sure 
this is the right solution.

And I am not sure either why there are two session factories in 
KarafTestSupport.
One if a class field annotated with @Inject. The other is retrieved with 
the getOsgiService() method. Is there a difference between both?

Eventually, most of the KarafTestSupport sub-classes do not set 
principals when they try to execute a command, even those that run 
bundle:install...
So, I have not yet understood everything.

Any help would be appreciated.

Regards,

                 Vincent.


[ 0 ] : 
https://github.com/apache/karaf/blob/master/itests/src/test/java/org/apache/karaf/itests/KarafTestSupport.java
[ 1 ] : http://pastebin.com/A8yMC4SV

-- 
Vincent Zurczak
Linagora: www.linagora.com <http://www.linagora.com/>

Twitter <https://twitter.com/VincentZurczak> Vincent Zurczak @ LinkedIn 
<http://fr.linkedin.com/pub/vincent-zurczak/18/b35/6a7> My Skype ID 
<callto://vincent.zurczak> My English blog <http://vzurczak.wordpress.com>

Re: Missing commands when injecting SessionFactory in a PAX-Exam test

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi,

Do you have the credential populated for the session ?

Regards
JB

On 05/19/2016 06:15 PM, Vincent Zurczak wrote:
> Hi,
>
> I am working on a PAX-Exam test for Karaf 4 and I need to install a
> bundle DURING the test (not before).
> I followed Achim's sample here [0] and injected a SessionFactory in my
> test. This seems to be working.
> When I list the commands available in the session's registry, I find
> many well-known ones. Except there is not "bundle:install",
> "bundle:start", etc. And therefore, I cannot install my bundles.
>
> Any idea about why these commands are missing?
> Is this related to the way these commands are made available (Karaf
> commands VS. Gogo commands)?
>
> Regards,
>
>                   Vincent.
>
>
> [ 0 ] :
> https://github.com/ANierbeck/Karaf-Cassandra/blob/master/Karaf-Cassandra-ITest/src/test/java/de/nierbeck/cassandra/itest/TestBase.java#L140-L170
>
> --
> Vincent Zurczak
> Linagora: www.linagora.com <http://www.linagora.com/>
>
> Twitter <https://twitter.com/VincentZurczak> Vincent Zurczak @ LinkedIn
> <http://fr.linkedin.com/pub/vincent-zurczak/18/b35/6a7> My Skype ID
> <callto://vincent.zurczak> My English blog <http://vzurczak.wordpress.com>

-- 
Jean-Baptiste Onofr�
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com