icfnext / prosper

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

Facing issue with Build 11.1.0- ExampleSpec » Runtime Unable to initialize JCR_... #16

Closed kalimuthup closed 6 years ago

kalimuthup commented 6 years ago

When i try to write test case by using latest propser 11.1.0 , i am getting ExampleSpec » Runtime Unable to initialize JCR_... exception <<< ERROR! java.lang.RuntimeException: Unable to initialize JCR_OAK resource resolver factory: Unable to invoke method 'activate' for class org.apache.sling.testing.mock.sling.oak.OakMockSlingRepository at org.apache.sling.testing.mock.sling.context.ContextResourceResolverFactory.get(ContextResourceResolverFactory.java:66) at org.apache.sling.testing.mock.sling.context.SlingContextImpl.newResourceResolverFactory(SlingContextImpl.java:125) at org.apache.sling.testing.mock.sling.context.SlingContextImpl.resourceResolverFactory(SlingContextImpl.java:130) at org.apache.sling.testing.mock.sling.context.SlingContextImpl.setUp(SlingContextImpl.java:114) 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).

Below are the pom file inclusion i have done as part of my project.Please shed some light on it . ` cglib

cglib-nodep
       <version>3.1</version>
        <scope>test</scope>
    </dependency>
    <dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.testing.sling-mock-oak</artifactId>
<version>1.0.0</version>
<scope>test</scope>

org.objenesis
        <artifactId>objenesis</artifactId>
        <version>2.1</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.codehaus.groovy</groupId>
        <artifactId>groovy-all</artifactId>
         <version>2.4.1</version>
    </dependency>
    <dependency>
        <groupId>org.spockframework</groupId>
        <artifactId>spock-core</artifactId>
        <version>1.0-groovy-2.4</version>
    </dependency>
    <dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>

org.osgi org.osgi.compendium
    <dependency>
<groupId>com.icfolson.aem.prosper</groupId>
<artifactId>prosper</artifactId>
<version>11.1.0</version>
<scope>test</scope>

`

The Complete Dependency list is given below `

org.osgi
        <artifactId>org.osgi.core</artifactId>
    </dependency>
    <dependency>
        <groupId>org.osgi</groupId>
        <artifactId>org.osgi.compendium</artifactId>
    </dependency>
    <dependency>
        <groupId>org.apache.felix</groupId>
        <artifactId>org.apache.felix.scr.annotations</artifactId>
    </dependency>
    <dependency>
        <groupId>biz.aQute.bnd</groupId>
        <artifactId>annotation</artifactId>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
    </dependency>
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-lang3</artifactId>
    </dependency>
    <!-- https://mvnrepository.com/artifact/commons-collections/commons-collections -->
    <dependency>
        <groupId>commons-collections</groupId>
        <artifactId>commons-collections</artifactId>
    </dependency>               
    <dependency>
        <groupId>commons-lang</groupId>
        <artifactId>commons-lang</artifactId>
    </dependency>
    <dependency>
        <groupId>com.google.code.gson</groupId>
        <artifactId>gson</artifactId>
        <version>2.5</version>
    </dependency>
    <dependency>
        <groupId>commons-codec</groupId>
        <artifactId>commons-codec</artifactId>
    </dependency>
    <dependency>
        <groupId>commons-io</groupId>
        <artifactId>commons-io</artifactId>
    </dependency>
    <dependency>
        <groupId>javax.servlet.jsp</groupId>
        <artifactId>jsp-api</artifactId>
    </dependency>
    <dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>2.4.2</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
<version>2.4.2</version>

javax.jcr jcr
    <!-- test dependencies -->        
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
    </dependency>
    <dependency>
        <groupId>junit-addons</groupId>
        <artifactId>junit-addons</artifactId>
    </dependency>
    <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-all</artifactId>
    </dependency>
    <dependency>
        <groupId>cglib</groupId>
        <artifactId>cglib-nodep</artifactId>
       <version>3.1</version>
        <scope>test</scope>
    </dependency>
    <dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.testing.sling-mock-oak</artifactId>
<version>1.0.0</version>
<scope>test</scope>

org.objenesis objenesis 2.1 test
    <dependency>
        <groupId>org.codehaus.groovy</groupId>
        <artifactId>groovy-all</artifactId>
         <version>2.4.1</version>
    </dependency>
    <dependency>
        <groupId>org.spockframework</groupId>
        <artifactId>spock-core</artifactId>
        <version>1.0-groovy-2.4</version>
    </dependency>
    <dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>

org.osgi org.osgi.compendium
    <dependency>
<groupId>com.icfolson.aem.prosper</groupId>
<artifactId>prosper</artifactId>
<version>11.1.0</version>
<scope>test</scope>

com.adobe.aem uber-jar 6.2.0 obfuscated-apis
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-simple</artifactId>
    </dependency>
    <dependency>
        <groupId>com.google.code.findbugs</groupId>
        <artifactId>jsr305</artifactId>
    </dependency>
    <dependency>
        <groupId>com.adobe.acs</groupId>
        <artifactId>acs-aem-commons-bundle</artifactId>
    </dependency>
    <dependency>
        <groupId>javax.mail</groupId>
        <artifactId>mail</artifactId>
    </dependency>
     <dependency>
        <groupId>com.google.code.gson</groupId>
        <artifactId>gson</artifactId>
        <version>2.5</version>
    </dependency>
    <dependency>
        <groupId>org.json</groupId>
        <artifactId>json</artifactId>
        <version>20160810</version>
    </dependency>
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-email</artifactId>
    </dependency>
    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpcore</artifactId>
        <version>4.3.2</version>
    </dependency>
    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpclient</artifactId>
        <version>4.3.4</version>
    </dependency>
    <dependency>
        <groupId>com.google.http-client</groupId>
        <artifactId>google-http-client</artifactId>
        <version>1.21.0</version>
    </dependency>       
</dependencies>`

Sample Empty Class -- import com.icfolson.aem.prosper.specs.ProsperSpec class ExampleSpec extends ProsperSpec { def setupSpec() { // runs before first feature method, create test content and initialize shared resources here } }

kalimuthup commented 6 years ago

Fixed !!!!.Its issue with the pom.xml.I added few missing dependent jars in pom file and its working as expected.Please check the dependency list below and if it required add to the code base so that others wont have the issue. `

org.apache.sling
<artifactId>org.apache.sling.models.impl</artifactId>
<version>1.4.6</version>

org.apache.sling org.apache.sling.models.api 1.3.6 provided com.icfolson.aem.groovy.extension aem-groovy-extension-bundle 4.0.0 org.slf4j slf4j-nop org.osgi org.osgi.core org.osgi org.osgi.compendium `