icfnext / prosper

A Spock-based integration testing library for prosperous AEM development.
Other
28 stars 19 forks source link

Prosper Tests in AEM6.4 #21

Closed cmrockwell closed 6 years ago

cmrockwell commented 6 years ago

Hello

I am studying an upgrade from AEM 6.3 to AEM 6.4. We have some Prosper specs set up for testing various parts of our project. Previously we used Prosper version 7.0.1 which I have updated to 12.1.0. Unfortunately the tests have errors. I have gone thru our specs and updated the package name, but still getting errors. Could you please look at the error below? Any suggestions would be most appreciated.

-------------------------------------------------------------------------------
Test set: edu.umich.lsa.services.osgi.common.ResourceCategorySpec
-------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 2.924 sec <<< FAILURE!
edu.umich.lsa.services.osgi.common.ResourceCategorySpec  Time elapsed: 2.918 sec  <<< ERROR!
java.lang.RuntimeException: Unable to invoke method 'bindImplementationPicker' for class org.apache.sling.models.impl.ModelAdapterFactory
    at org.apache.sling.testing.mock.osgi.OsgiServiceUtil.invokeMethod(OsgiServiceUtil.java:320)
    at org.apache.sling.testing.mock.osgi.OsgiServiceUtil.invokeBindUnbindMethod(OsgiServiceUtil.java:458)
    at org.apache.sling.testing.mock.osgi.OsgiServiceUtil.invokeBindMethod(OsgiServiceUtil.java:583)
    at org.apache.sling.testing.mock.osgi.MockBundleContext.handleRefsUpdateOnRegister(MockBundleContext.java:153)
    at org.apache.sling.testing.mock.osgi.MockBundleContext.registerService(MockBundleContext.java:123)
    at org.apache.sling.testing.mock.osgi.MockBundleContext.registerService(MockBundleContext.java:108)
    at org.apache.sling.testing.mock.osgi.context.OsgiContextImpl.registerService(OsgiContextImpl.java:117)
    at org.apache.sling.testing.mock.osgi.context.OsgiContextImpl.registerInjectActivateService(OsgiContextImpl.java:155)
    at org.apache.sling.testing.mock.osgi.context.OsgiContextImpl.registerInjectActivateService(OsgiContextImpl.java:141)
    at org.apache.sling.testing.mock.sling.context.SlingContextImpl.registerInjectActivateServiceByClassName(SlingContextImpl.java:175)
    at org.apache.sling.testing.mock.sling.context.SlingContextImpl.registerDefaultServices(SlingContextImpl.java:146)
    at org.apache.sling.testing.mock.sling.context.SlingContextImpl.setUp(SlingContextImpl.java:117)
    at org.apache.sling.testing.mock.sling.junit.SlingContext.access$100(SlingContext.java:40)
    at org.apache.sling.testing.mock.sling.junit.SlingContext$1.before(SlingContext.java:127)
    at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:46)
    at org.spockframework.runtime.extension.builtin.ClassRuleInterceptor.intercept(ClassRuleInterceptor.java:38)
    at org.spockframework.runtime.extension.MethodInvocation.proceed(MethodInvocation.java:87)
    at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:236)
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:134)
    at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:113)
    at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
    at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
    at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
    at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:103)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:74)
Caused by: java.lang.NoSuchMethodError: org.apache.sling.commons.osgi.ServiceUtil.getComparableForServiceRanking(Ljava/util/Map;Lorg/apache/sling/commons/osgi/Order;)Ljava/lang/Comparable;
    at org.apache.sling.commons.osgi.RankedServices.bind(RankedServices.java:126)
    at org.apache.sling.models.impl.ModelAdapterFactory.bindImplementationPicker(ModelAdapterFactory.java:973)
    at org.apache.sling.testing.mock.osgi.OsgiServiceUtil.invokeMethod(OsgiServiceUtil.java:311)
    ... 24 more
markdaugherty commented 6 years ago

This is usually due to conflicting dependency versions in your classpath. I'm guessing the org.apache.sling.commons.osgi dependency has a different version than what's being used to execute the Prosper spec. Due to the nature of transitive dependencies, it's difficult to determine the exact cause without analyzing the entire pom file.

cmrockwell commented 6 years ago

Thanks so much. Your guess was spot on! I had org.apache.sling.commons.osgi v2.2.2 but 6.4 uses 2.4.0

markdaugherty commented 6 years ago

Excellent! Glad to hear there was a quick resolution.