You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Dascalita Dragos <dd...@gmail.com> on 2014/11/03 08:16:17 UTC

Any Sling 7 + Java 7 Integration Tests bundles with Pax ?

Hi,

I'm wondering if there's a bundle that I could use as an example to run
Sling 7 during integration-tests.

I've been trying to use the example from the SlingPaxOptions - [1] wrapper
with Sling 7 bundlelist. While most of the bundles are showing as "active",
a big number of OSGI components don't start. For instance ,
org.apache.sling.settings doesn't start any service at all. I can't
reference JobManager as it doesn't start either. I can register a basic
servlet and that works, so some services work, but not all.

There are about 40 components showing up as unsatisfied. I'm listing them
bellow -  [3]

I've been also looking at the org.apache.sling.event bundle - [2], but most
of the integration tests are failing as well.


Thanks for your help,
Dragos

[1] -
https://github.com/apache/sling/blob/trunk/testing/sling-pax-util/src/main/java/org/apache/sling/paxexam/util/SlingPaxOptions.java

[2] - https://github.com/apache/sling/tree/trunk/bundles/extensions/event

[3] - List with Unsatisfied components in Sling 7 :
------------
org.apache.sling.commons.compiler.impl.EclipseJavaCompiler
org.apache.sling.discovery.impl.DiscoveryServiceImpl
org.apache.sling.discovery.impl.TopologyWebConsolePlugin
org.apache.sling.discovery.impl.cluster.ClusterViewServiceImpl
org.apache.sling.discovery.impl.cluster.voting.VotingHandler
org.apache.sling.discovery.impl.common.heartbeat.HeartbeatHandler
org.apache.sling.discovery.impl.support.StandardPropertyProvider
org.apache.sling.discovery.impl.topology.TopologyChangeHandler
org.apache.sling.discovery.impl.topology.announcement.AnnouncementRegistryImpl
org.apache.sling.discovery.impl.topology.connector.ConnectorRegistryImpl
org.apache.sling.discovery.impl.topology.connector.TopologyConnectorServlet
org.apache.sling.engine.impl.SlingSettingsServiceImpl
org.apache.sling.engine.impl.log.RequestLoggerService
org.apache.sling.engine.parameters
org.apache.sling.event.impl.DistributingEventHandler
org.apache.sling.event.impl.EnvironmentComponent
org.apache.sling.event.impl.dea.DistributedEventReceiver
org.apache.sling.event.impl.dea.DistributedEventSender
org.apache.sling.event.impl.jobs.console.InventoryPlugin
org.apache.sling.event.impl.jobs.console.WebConsolePlugin
org.apache.sling.event.impl.jobs.deprecated.EventAdminBridge
org.apache.sling.event.impl.jobs.deprecated.JobStatusProviderImpl
org.apache.sling.event.impl.jobs.jcr.PersistenceHandler
org.apache.sling.event.impl.jobs.jmx.AllJobStatisticsMBean
org.apache.sling.event.impl.jobs.tasks.HistoryCleanUpTask
org.apache.sling.event.impl.jobs.timed.TimedEventConfiguration
org.apache.sling.event.impl.jobs.timed.TimedEventReceiver
org.apache.sling.event.impl.jobs.timed.TimedEventSender
org.apache.sling.event.jobs.QueueConfiguration
org.apache.sling.fsprovider.internal.FsResourceProvider
org.apache.sling.installer.provider.jcr.impl.JcrInstaller
org.apache.sling.jcr.classloader.internal.DynamicClassLoaderProviderImpl
org.apache.sling.jcr.contentloader.internal.ContentLoaderService
org.apache.sling.jcr.jackrabbit.server.JndiRegistrationSupport
org.apache.sling.jcr.jackrabbit.server.RmiRegistrationSupport
org.apache.sling.scripting.jsp.JspScriptEngineFactory
org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended

---------

Re: Any Sling 7 + Java 7 Integration Tests bundles with Pax ?

Posted by Dascalita Dragos <dd...@gmail.com>.
Hi Carsten, thanks a lot for helping.

I'm running the tests on a MacOSX 10.9.5 with Java 7. I've tried to
investigate what's making the integration-tests fail but I couldn't figure
out the root cause. I can see that Pax URL Aether has issues and the rest
of the tests fail to load the cached bundle, but by looking at the logs I
don't understand what's causing this.

I'm pasting bellow the error that I'm getting in case it helps.

Thanks,
Dragos

----------------------
Forking command line: /bin/sh -c cd
/Projects/sling-git/bundles/extensions/event &&
/Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents/Home/jre/bin/java
-Xmx2048m -XX:MaxPermSize=512m -jar
/Projects/sling-git/bundles/extensions/event/target/surefire/surefirebooter3647465897455320849.jar
/Projects/sling-git/bundles/extensions/event/target/surefire/surefire6539308234963726488tmp
/Projects/sling-git/bundles/extensions/event/target/surefire/surefire_05376957598267243956tmp
Running org.apache.sling.event.it.ChaosTest
21 [main] INFO org.ops4j.pax.exam.spi.DefaultExamSystem - Pax Exam System
(Version: 3.5.0) created.
63 [main] INFO org.ops4j.pax.exam.junit.impl.ProbeRunner - creating PaxExam
runner for class org.apache.sling.event.it.ChaosTest
97 [main] INFO org.ops4j.pax.exam.junit.impl.ProbeRunner - running test
class org.apache.sling.event.it.ChaosTest
155 [main] INFO org.ops4j.exec.DefaultJavaRunner - DefaultJavaRunner
completed successfully

633 [main] INFO org.ops4j.pax.exam.spi.reactors.ReactorManager - suite
finished
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.644 sec
<<< FAILURE! - in org.apache.sling.event.it.ChaosTest
testDoChaos(org.apache.sling.event.it.ChaosTest)  Time elapsed: 0.524 sec
 <<< ERROR!
java.lang.NullPointerException: null
at
org.ops4j.pax.url.mvn.internal.config.MavenConfigurationImpl.getRepositories(MavenConfigurationImpl.java:251)
at
org.ops4j.pax.url.mvn.internal.AetherBasedResolver.selectRepositories(AetherBasedResolver.java:191)
at
org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolveFile(AetherBasedResolver.java:310)
at
org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:296)
at
org.ops4j.pax.url.mvn.internal.Connection.getInputStream(Connection.java:131)
at java.net.URL.openStream(URL.java:1037)
[...]

Running org.apache.sling.event.it.ClassloadingTest
634 [main] INFO org.ops4j.pax.exam.junit.impl.ProbeRunner - creating
PaxExam runner for class org.apache.sling.event.it.ClassloadingTest
636 [main] INFO org.ops4j.pax.exam.junit.impl.ProbeRunner - running test
class org.apache.sling.event.it.ClassloadingTest
643 [main] INFO org.ops4j.exec.DefaultJavaRunner - DefaultJavaRunner
completed successfully

ERROR: Error reloading cached bundle, removing it:
/var/folders/8c/ky5brl215fd08njt72pz9qy00000gq/T/1415035146773-0/bundles
(java.lang.NumberFormatException: For input string: "s")
java.lang.NumberFormatException: For input string: "s"
at
java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Long.parseLong(Long.java:441)
at java.lang.Long.parseLong(Long.java:483)
at
org.apache.felix.framework.cache.BundleArchive.readId(BundleArchive.java:1077)
at
org.apache.felix.framework.cache.BundleArchive.readBundleInfo(BundleArchive.java:972)
at
org.apache.felix.framework.cache.BundleArchive.<init>(BundleArchive.java:182)
at
org.apache.felix.framework.cache.BundleCache.getArchives(BundleCache.java:247)
at org.apache.felix.framework.Felix.init(Felix.java:713)
at org.apache.felix.framework.Felix.start(Felix.java:901)
at
org.ops4j.pax.swissbox.framework.RemoteFrameworkImpl.start(RemoteFrameworkImpl.java:98)
at
org.ops4j.pax.swissbox.framework.RemoteFrameworkImpl.main(RemoteFrameworkImpl.java:434)
973 [main] INFO org.ops4j.exec.DefaultJavaRunner - DefaultJavaRunner
completed successfully
--------------------

Re: Any Sling 7 + Java 7 Integration Tests bundles with Pax ?

Posted by Carsten Ziegeler <cz...@apache.org>.
Hi Dragos,

if the settings service is not started, I guess a lot of other services
won't start as they depend on it - so the settings service seems to be
the root cause.

The sling.event bundle works perfectly for me, apart from some sporadic
problems it run on Jenkins as well. Are you on windows or what errors do
you get when running the ITs?

Regards
Carsten

Am 03.11.14 um 08:16 schrieb Dascalita Dragos:
> Hi,
> 
> I'm wondering if there's a bundle that I could use as an example to run
> Sling 7 during integration-tests.
> 
> I've been trying to use the example from the SlingPaxOptions - [1] wrapper
> with Sling 7 bundlelist. While most of the bundles are showing as "active",
> a big number of OSGI components don't start. For instance ,
> org.apache.sling.settings doesn't start any service at all. I can't
> reference JobManager as it doesn't start either. I can register a basic
> servlet and that works, so some services work, but not all.
> 
> There are about 40 components showing up as unsatisfied. I'm listing them
> bellow -  [3]
> 
> I've been also looking at the org.apache.sling.event bundle - [2], but most
> of the integration tests are failing as well.
> 
> 
> Thanks for your help,
> Dragos
> 
> [1] -
> https://github.com/apache/sling/blob/trunk/testing/sling-pax-util/src/main/java/org/apache/sling/paxexam/util/SlingPaxOptions.java
> 
> [2] - https://github.com/apache/sling/tree/trunk/bundles/extensions/event
> 
> [3] - List with Unsatisfied components in Sling 7 :
> ------------
> org.apache.sling.commons.compiler.impl.EclipseJavaCompiler
> org.apache.sling.discovery.impl.DiscoveryServiceImpl
> org.apache.sling.discovery.impl.TopologyWebConsolePlugin
> org.apache.sling.discovery.impl.cluster.ClusterViewServiceImpl
> org.apache.sling.discovery.impl.cluster.voting.VotingHandler
> org.apache.sling.discovery.impl.common.heartbeat.HeartbeatHandler
> org.apache.sling.discovery.impl.support.StandardPropertyProvider
> org.apache.sling.discovery.impl.topology.TopologyChangeHandler
> org.apache.sling.discovery.impl.topology.announcement.AnnouncementRegistryImpl
> org.apache.sling.discovery.impl.topology.connector.ConnectorRegistryImpl
> org.apache.sling.discovery.impl.topology.connector.TopologyConnectorServlet
> org.apache.sling.engine.impl.SlingSettingsServiceImpl
> org.apache.sling.engine.impl.log.RequestLoggerService
> org.apache.sling.engine.parameters
> org.apache.sling.event.impl.DistributingEventHandler
> org.apache.sling.event.impl.EnvironmentComponent
> org.apache.sling.event.impl.dea.DistributedEventReceiver
> org.apache.sling.event.impl.dea.DistributedEventSender
> org.apache.sling.event.impl.jobs.console.InventoryPlugin
> org.apache.sling.event.impl.jobs.console.WebConsolePlugin
> org.apache.sling.event.impl.jobs.deprecated.EventAdminBridge
> org.apache.sling.event.impl.jobs.deprecated.JobStatusProviderImpl
> org.apache.sling.event.impl.jobs.jcr.PersistenceHandler
> org.apache.sling.event.impl.jobs.jmx.AllJobStatisticsMBean
> org.apache.sling.event.impl.jobs.tasks.HistoryCleanUpTask
> org.apache.sling.event.impl.jobs.timed.TimedEventConfiguration
> org.apache.sling.event.impl.jobs.timed.TimedEventReceiver
> org.apache.sling.event.impl.jobs.timed.TimedEventSender
> org.apache.sling.event.jobs.QueueConfiguration
> org.apache.sling.fsprovider.internal.FsResourceProvider
> org.apache.sling.installer.provider.jcr.impl.JcrInstaller
> org.apache.sling.jcr.classloader.internal.DynamicClassLoaderProviderImpl
> org.apache.sling.jcr.contentloader.internal.ContentLoaderService
> org.apache.sling.jcr.jackrabbit.server.JndiRegistrationSupport
> org.apache.sling.jcr.jackrabbit.server.RmiRegistrationSupport
> org.apache.sling.scripting.jsp.JspScriptEngineFactory
> org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended
> 
> ---------
> 


-- 
Carsten Ziegeler
Adobe Research Switzerland
cziegeler@apache.org

Re: Any Sling 7 + Java 7 Integration Tests bundles with Pax ?

Posted by Bertrand Delacretaz <bd...@apache.org>.
Hi Dragos,

On Mon, Nov 3, 2014 at 7:35 PM, Dascalita Dragos <dd...@gmail.com> wrote:
> ...There are only 4 that don't resolve now, but they don't resolve either when
> I run the launchpad-standalone-[1] on my machine so I can conclude that
> this issue it's not related to the setup of the test...

Yeah, I've seen that as well on my box - I'm busy with other things
right now, if that becomes an issue for your tests please let us know!

BTW the StartupHandler is an instance with other non-launchpad Sling
startups as well, I had the same problem when using the experimental
Crankstart launcher.

-Bertrand

Re: Any Sling 7 + Java 7 Integration Tests bundles with Pax ?

Posted by Dascalita Dragos <dd...@gmail.com>.
Bertrand, thank you very much !

I wouldn't have guessed the StartupHandler issue by myself.

After adding the @Before and @After methods I can now see most of the
components resolving.
There are only 4 that don't resolve now, but they don't resolve either when
I run the launchpad-standalone-[1] on my machine so I can conclude that
this issue it's not related to the setup of the test. These components are:
- org.apache.sling.engine.impl.log.RequestLoggerService
- org.apache.sling.event.jobs.QueueConfiguration
- org.apache.sling.fsprovider.internal.FsResourceProvider
     ["Unsatisfied","Service Name: org.osgi.service.event.EventAdmin"]
- org.apache.sling.jcr.jackrabbit.server.JndiRegistrationSupport
AND org.apache.sling.jcr.jackrabbit.server.RmiRegistrationSupport
   ["Unsatisfied","Service Name: javax.jcr.Repository"]
   ["Unsatisfied","Service Name: org.osgi.service.log.LogService"]

But these don't block my integration tests at the moment.

Thanks a lot for helping me with this issue,
Dragos

[1] -
http://central.maven.org/maven2/org/apache/sling/org.apache.sling.launchpad/7/org.apache.sling.launchpad-7-standalone.jar

On Mon, Nov 3, 2014 at 6:17 AM, Bertrand Delacretaz <bd...@apache.org>
wrote:

> On Mon, Nov 3, 2014 at 12:57 PM, Bertrand Delacretaz
> <bd...@apache.org> wrote:
> > ...Here's a patch that allows SlingSettingsService to start with
> launchpad 7:
> > https://gist.github.com/bdelacretaz/dee49a174147e066b2b4 ...
>
> I have now integrated a workaround for the missing StartupHandler, the
> sling-pax-util tests pass including checking that the
> org.apache.sling.settings.SlingSettingsService is active.
>
> If you write you own tests using SlingPaxOptions you'll need the
> workaround as in SlingSetupTest.setup() [1], for now.
>
> -Bertrand
>
> [1]
> https://svn.apache.org/repos/asf/sling/trunk/testing/sling-pax-util/src/test/java/org/apache/sling/paxexam/util/SlingSetupTest.java
>

Re: Any Sling 7 + Java 7 Integration Tests bundles with Pax ?

Posted by Bertrand Delacretaz <bd...@apache.org>.
On Mon, Nov 3, 2014 at 12:57 PM, Bertrand Delacretaz
<bd...@apache.org> wrote:
> ...Here's a patch that allows SlingSettingsService to start with launchpad 7:
> https://gist.github.com/bdelacretaz/dee49a174147e066b2b4 ...

I have now integrated a workaround for the missing StartupHandler, the
sling-pax-util tests pass including checking that the
org.apache.sling.settings.SlingSettingsService is active.

If you write you own tests using SlingPaxOptions you'll need the
workaround as in SlingSetupTest.setup() [1], for now.

-Bertrand

[1] https://svn.apache.org/repos/asf/sling/trunk/testing/sling-pax-util/src/test/java/org/apache/sling/paxexam/util/SlingSetupTest.java

Re: Any Sling 7 + Java 7 Integration Tests bundles with Pax ?

Posted by Bertrand Delacretaz <bd...@apache.org>.
Hi,

On Mon, Nov 3, 2014 at 12:30 PM, Bertrand Delacretaz
<bd...@apache.org> wrote:
>... I have adapted that module's tests to use the released Launchpad 7,
> and all bundles start, the tests pass on my macosx system, but they
> don't currently check the presence of the SlingSettings service...

Here's a patch that allows SlingSettingsService to start with launchpad 7:
https://gist.github.com/bdelacretaz/dee49a174147e066b2b4

The root cause is a missing
org.apache.sling.launchpad.api.StartupHandler service, which IIRC is
usually provided by the launchpad startup code - the
org.apache.sling.launchpad.karaf bundle added in my patch provides
this, but it's only a temporary solution.

-Bertrand

Re: Any Sling 7 + Java 7 Integration Tests bundles with Pax ?

Posted by Bertrand Delacretaz <bd...@apache.org>.
Hi Dragos,

On Mon, Nov 3, 2014 at 8:16 AM, Dascalita Dragos <dd...@gmail.com> wrote:
> ...I've been trying to use the example from the SlingPaxOptions - [1] wrapper
> with Sling 7 bundlelist. While most of the bundles are showing as "active",
> a big number of OSGI components don't start...

I have adapted that module's tests to use the released Launchpad 7,
and all bundles start, the tests pass on my macosx system, but they
don't currently check the presence of the SlingSettings service. I'll
have a look.

FWIW to examine the state of the instance I set a breakpoint in
SlingSetupTest.testSlingBundles() and look for those lines in the
console output:

Running org.apache.sling.paxexam.util.SlingSetupTest
...
8356 [main] INFO org.apache.sling.paxexam.util.SlingPaxOptions -
osgi.shell.telnet.port=63850
8356 [main] INFO org.apache.sling.paxexam.util.SlingPaxOptions -
org.osgi.service.http.port=63851
...

you can then use those ports to connect to the OSGi console and shell.

-Bertrand