On 9/10/10 9:30, Clement Escoffier wrote:
Hi,

Try to export org.junit.internal in the junit4osgi bundle.
Right now is just embeds junit.* packages, not org.junit* packages.

To be clear, edit the Export-Package header in its pom.xml to include org.junit.internal, then rebuild it.

-> richard

Regards,

Clement

On 10.09.2010, at 13:36, Anna Karina Nava Soriano wrote:

Good mornign! It's me again!

I tried not to question anything more, I thought your advise would helped me 
but I changed ALL junit dependencies version from 3.8.1 to 4.8.1 in the entire 
ipojo project and all its subprojects (including junit4osgi, handler extender, 
felix-command, swing-gui, and the rest of them)   the only places where I found 
junit version where in all pom.xml files, so that is what I did.

After that there was the same missing packages problem 
"org.osgi.framework.BundleException: Unresolved constraint in bundle 
org.apache.felix.ipojo.junit4osgi [463]: package; (package=org.junit.internal)".  
Weird since as clement said:
"junit4osgi embeds junit. So, you can't use a different version. But you can easily 
modify the junit4osgi bundle to expose the missing package / update the junit 
dependency"
I understood that my junit jar (id 408) is not the one that is providing junit 
packages,  this is junit4osgi's labour.  So I looked inside the manifest of 
junit4osgi and I am not sure why it is not exporting those packages missing 
packages (likeorg.junit.internal) : legible MANIFEST:

                                Manifest-Version:1.0
                                Export-Package:
                                        
org.apache.felix.ipojo.junit4osgi.helpers;uses:=
                                                        
"org.apache.felix.ipojo.junit4osgi,
                                                        
org.apache.felix.ipojo.architecture,
                                                        org.apache.felix.ipojo,
                                                        org.osgi.framework,
                                                        org.osgi.service.cm,
                                                        
org.apache.felix.ipojo.metadata,
                                                        
org.apache.felix.ipojo.parser",
                                        junit.framework;uses:=
                                                        
"org.junit.runner.manipulation,
                                                        org.junit.runner,
                                                        
org.junit.runner.notification,
                                                        org.junit",
                                        org.apache.felix.ipojo.junit4osgi;uses:=
                                                        "junit.framework,
                                                        org.osgi.framework,
                                                        
org.osgi.service.packageadmin",
                                        junit.runner;uses:=
                                                "junit.framework",
                                                
junit.textui;uses:="junit.framework,
                                                junit.runner",
                                        junit.extensions;uses:=
                                                "junit.framework"
                                iPOJO-Components:
                                        component{
                                                
$classname="org.apache.felix.ipojo.junit4osgi.impl.JunitExtender_1"
                                                
org.apache.felix.ipojo.extender:extender{
                                                        $extension="Test-Suite"
                                                        
$onarrival="onBundleArrival"
                                                        
$ondeparture="onBundleDeparture"
                                                }
                                                callback{
                                                        $transition="invalidate"
                                                        $method="stopping"
                                                }
                                                callback{
                                                        $transition="validate"
                                                        $method="starting"
                                                }
                                                provides{}
                                                manipulation{
                                                        
$super="org.apache.felix.ipojo.junit4osgi.impl.JunitExtender"
                                                        field{$name="m_suites" 
$type="java.util.Map"}
                                                        field{$name="m_printer" 
$type="junit.textui.ResultPrinter"}
                                                        
field{$name="m_log"$type="org.osgi.service.log.LogService"}
                                                        method{$name="$init"}
                                                        
method{$arguments="{junit.framework.Test}"$name="doRun"$return="junit.framework.TestResult"}
                                                }
                                                
requires{$field="m_log"$default-implementation="org.apache.felix.ipojo.junit4osgi.impl.LogServiceImpl"$optional="true"}
                                        }
                                        
instance{$component="org.apache.felix.ipojo.junit4osgi.impl.JunitExtender_1"}
                                Private-Package:
                                        org.apache.felix.ipojo.junit4osgi.impl,
                                        org.apache.felix.ipojo.junit4osgi.test
                                Built-By:annakarinanavasoriano
                                Tool:Bnd-0.0.255
                                Bundle-Name:ApacheFelixiPOJOOSGiJunitRunner
                                Created-By:ApacheMavenBundlePlugin&iPOJO1.4.0
                                Bundle-Vendor:TheApacheSoftwareFoundation
                                Build-Jdk:1.6.0_20
                                Bundle-Version:1.1.0.SNAPSHOT
                                Bnd-LastModified:1284058534606
                                
Bundle-ManifestVersion:2Bundle-License:http://www.apache.org/licenses/LICENSE-2.0.txt
                                
Bundle-Description:ApacheFelixisanOSGiimplementation.
                                Import-Package:
                                        
org.apache.felix.ipojo.junit4osgi.helpers,
                                        org.junit.internal,
                                        junit.runner,
                                        org.apache.felix.ipojo;version=1.6,
                                        org.junit.runner.notification,
                                        javax.xml.parsers,
                                        
org.osgi.service.packageadmin;version=1.1,
                                        org.w3c.dom,
                                        junit.textui,
                                        
org.apache.felix.ipojo.parser;version=1.6,
                                        org.junit,
                                        junit.extensions,
                                        org.junit.runner.manipulation,
                                        org.osgi.service.log;version=1.2,
                                        junit.framework,
                                        org.apache.felix.ipojo.junit4osgi,
                                        
org.apache.felix.ipojo.architecture;version=1.6,
                                        org.junit.runner,
                                        org.osgi.framework;version=1.2,
                                        org.osgi.service.cm;version=1.1,
                                        org.apache.felix.ipojo.metadata
                                
Bundle-SymbolicName:org.apache.felix.ipojo.junit4osgi
                                Bundle-DocURL:http://www.apache.org/

Then I decided to include this missing packages to the junit-4.8.1.jar, I did 
that and that  Unresolved constraint problem disappeared.  But isn't this 
opposed to the previous fact that junit4osgi embed junit? do I need to add this 
missing packages to the junit-4.8.1.jar's MANIFEST? or as it is embedded it 
should act the same than previously when it was not necessary to add anything 
to junit.jar since that wasn't the packages provider (it was junit4osgi)?

Well, the thing is that even thinking the previous assumptions.  I included to the 
junit-4.8.1.jar the missing packages.  But the same problem with junit command.  I mean 
junit command is not available in felix ("command not found") even having 
everything installed and activated.  Then I did the same inspect:

[ 408] [Active     ] [    1] 
file:/Applications/NetBeans/sges-v3/glassfish/modules/junit-4.8.1.jar
[ 458] [Active     ] [    1] Apache Felix iPOJO (1.7.0.SNAPSHOT)
[ 459] [Active     ] [    1] Apache Felix iPOJO OSGi Junit Runner - Swing Gui 
(1.1.0.SNAPSHOT)
[ 462] [Active     ] [    1] Apache Felix iPOJO Extender Pattern Handler 
(1.5.0.SNAPSHOT)
[ 463] [Active     ] [    1] Apache Felix iPOJO OSGi Junit Runner 
(1.1.0.SNAPSHOT)
[ 464] [Active     ] [    1] Apache Felix iPOJO OSGi Junit Runner - Felix 
Command (1.1.0.SNAPSHOT)
->  inspect s c 464
Apache Felix iPOJO OSGi Junit Runner - Felix Command (464) provides services:
-----------------------------------------------------------------------------
component.class = org.apache.felix.ipojo.junit4osgi.command.JunitCommand
component.description =<unknown value type>
component.properties =<unknown value type>
component.providedServiceSpecifications = org.apache.felix.shell.Command
factory.name = org.apache.felix.ipojo.junit4osgi.command.JunitCommand
factory.state = 1
objectClass = org.apache.felix.ipojo.Factory, 
org.osgi.service.cm.ManagedServiceFactory
service.id = 44
service.pid = org.apache.felix.ipojo.junit4osgi.command.JunitCommand
->


I am not sure but I think that there is a problem trying to have packages from junit4osgi 
and also from junit.  but the problem is that I don't know how to "force" the 
export of all needed packages from the junit4osgi project.   I mean, the manifest is 
created automatically when compiling the maven project from the pom.xml and the 
metadata.xml files.  Mi junit4osgi MANIFEST is the entire one above.  So Do you know if 
in that resulting manifest file are missing exports? what could cause that problem? and 
how can I add those exports?

Thanks again, I just need this working and do not know what else to do.








On Sep 9, 2010, at 8:01 PM, Clement Escoffier wrote:

On 09.09.2010, at 19:32, Anna Karina Nava Soriano wrote:

I know that about annotations, I already solved it in my tests (it is not a 
problem anymore), but I need some classes of junit 4.8.

I can try your advice, I only need to be sure that if I update the junit 
dependency it wont break anything from junit4osgi.  Let me check if I caught 
the idea... for updating the junit dependency I only need to change  the junit 
version in felix command pom.xml:
               <dependency>
                        <groupId>junit</groupId>
                        <artifactId>junit</artifactId>
                        <version>3.8.1</version>
                </dependency>

I noticed that I already changed that version but in junit4osgi jar.

Then the question is... is there a problem if I change everything to 
junit-4.8.1 or what would be the alternative? adapting to 3.8.1? (this last 
option will be more difficult for me, trying to find workarounds for missing 
classes in junit-3.8.1

Thank you very very much! this is important for me!

You can safely update to 4.8.1. As this version contains the classes from the 
3.8.1.

Regards,

Clement



On Sep 9, 2010, at 7:11 PM, Clement Escoffier wrote:

Hi,

junit4osgi embeds junit. So, you can't use a different version. But you can 
easily modify the junit4osgi bundle to expose the missing package / update the 
junit dependency. However, the launcher does not support annotations, so, you 
must use the junit 3 development model.

Regards,

Clement


On 09.09.2010, at 18:01, Anna Karina Nava Soriano wrote:

thanks Richard!!!!

Now in the junit-4.8.1.jar MANIFEST I included all the missing packages and the 
result is:
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.1
Export-Package: org.junit.runner.notification,org.junit,
org.junit.runner.manipulation,org.junit.runner
Created-By: 1.5.0_20-141 (Apple Inc.)

Now everithing is able to be installed and started:
[ 404] [Active     ] [    1] Apache Felix iPOJO Extender Pattern Handler (1.4.0)
[ 405] [Active     ] [    1] Apache Felix iPOJO OSGi Junit Runner - Felix 
Command (1.0.0)
[ 408] [Active     ] [    1] 
file:/Applications/NetBeans/sges-v3/glassfish/modules/junit-4.8.1.jar
[ 409] [Active     ] [    1] Apache Felix iPOJO OSGi Junit Runner - Swing Gui 
(1.0.0)
[ 410] [Active     ] [    1] Apache Felix iPOJO OSGi Junit Runner 
(1.1.0.SNAPSHOT)
[ 412] [Active     ] [    1] Apache Felix iPOJO (1.6.4)
[ 428] [Active     ] [    1] Broker Project Services TESTS (1.3)

but even having the Felix Command bundle installed and active. I got no junit 
command :( and previously I was.  In fact if I type help
->  help
bundlelevel
cd
find
headers
help
inspect
install
log
ps
refresh
resolve
scr
shutdown
start
startlevel
stop
sysprop
uninstall
update
version

see? no junit command :( I haven't changed that bundle at all. I don't know 
what is happening here.  I tried uninstall everything from 404 and reinstalling 
it but having the same result.  May be it is there is a problem if some part of 
the unit test packages are being exported by junit4osgi and other by the junit 
library?  I don't know how to make junit4osgi treat this packages the same way 
since its manifest is automatically built when I compile the junit4osgi project

Thanks for your supor!





On Sep 9, 2010, at 3:34 PM, Richard S. Hall wrote:

On 9/9/10 6:28, Anna Karina Nava Soriano wrote:
Hello everyone!

Nice tool junit4osgi!

I am working with junit4osgi and needed to extend the JunitExtender class to 
run tests in a particular way (the reason is not important).  MyJunitExtender 
is the new class and it extends JunitExtender and only overrides the run 
method.  I tested it and this was working fine! (obviously I changed 
metadata.xml to tell the new MyJunitExtender class) so far so good.

The thing is that I need now org.junit.internal.JUnitSystem.  So in MyJunitExtender I 
added  "import org.junit.internal.JUnitSystem;" then I compile the project 
again, and the import-Package in my new MANIFEST looks like this:
....
Import-Package: org.apache.felix.ipojo.junit4osgi.helpers, org.junit.i
nternal, junit.runner, org.apache.felix.ipojo;version=1.6, org.junit.
runner.notification, javax.xml.parsers, org.osgi.service.packageadmin
;version=1.1, org.w3c.dom, junit.textui, org.apache.felix.ipojo.parse
r;version=1.6, org.junit, junit.extensions, org.junit.runner.manipula
tion, org.osgi.service.log;version=1.2, junit.framework, org.apache.f
elix.ipojo.junit4osgi, org.apache.felix.ipojo.architecture;version=1.
6, org.junit.runner, org.osgi.framework;version=1.2, org.osgi.service
.cm;version=1.1, org.apache.felix.ipojo.metadata
....

as you can see, the org.junit.internal is there.  I install this new jar in my 
Felix (see the last line)
....
[ 320] [Active     ] [    1] 
file:/Applications/NetBeans/sges-v3/glassfish/modules/junit-4.8.1.jar
[ 326] [Active     ] [    1] Apache Felix iPOJO Extender Pattern Handler (1.4.0)
[ 327] [Installed  ] [    1] Apache Felix iPOJO OSGi Junit Runner - Felix 
Command (1.0.0)
[ 330] [Installed  ] [    1] Apache Felix iPOJO OSGi Junit Runner - Swing Gui 
(1.0.0)
[ 332] [Active     ] [    1] Apache Felix iPOJO (1.6.4)
[ 339] [Installed  ] [    1] Broker Project Services TESTS (1.3)
[ 354] [Installed  ] [    1] Apache Felix iPOJO OSGi Junit Runner 
(1.1.0.SNAPSHOT)

and when I do "start 354"  it keeps saying:
"org.osgi.framework.BundleException: Unresolved constraint in bundle 
org.apache.felix.ipojo.junit4osgi [354]: package; (package=org.junit.internal)"

I know probably there is some stupid thing that I am missing.  My junit file (you can see 
it with the id "320") has this manifest:
"Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.1
Created-By: 1.5.0_20-141 (Apple Inc.)"
If that's all it has, then it is not a bundle. It needs to, at least, export 
its packages.

->  richard

So... does somebody knows what am I doing wrong? I am new in the junit4osgi 
world and I always get kind of lost with all dependencies.

Thank you so much in advance!
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to