Skip to content

Commit

Permalink
Merge branch 'release/14.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
markdaugherty committed Mar 7, 2019
2 parents c2e2b97 + d4e7025 commit 1690bfd
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 77 deletions.
31 changes: 11 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Prosper

[Olson Digital](http://www.digitalatolson.com/)
[ICF Next](http://www.icfnext.com/)

## Overview

Expand All @@ -12,7 +12,7 @@ Prosper is an integration testing library for Adobe Experience Manager projects
* Write test specifications in [Groovy](http://www.groovy-lang.org/) using [Spock](http://docs.spockframework.org/), a JUnit-based testing framework with an elegant syntax for writing tests quickly and efficiently.
* Sling `ResourceResolver` instance backed by an in-memory Jackrabbit Oak JCR instance supporting the complete set of repository operations.
* Supplies mock OSGi bundle and [Sling](https://sling.apache.org/documentation/development/sling-mock.html) contexts for registering services, adapters, and Sling models.
* Utilizes Groovy builders from the [AEM Groovy Extension](https://github.com/OlsonDigital/aem-groovy-extension) to provide a simple DSL for creating test content.
* Utilizes Groovy builders from the [AEM Groovy Extension](https://github.com/icfnext/aem-groovy-extension) to provide a simple DSL for creating test content.
* Provides additional builders for mock Sling requests and responses to simplify setup of test cases.

## Requirements
Expand All @@ -24,23 +24,14 @@ Prosper is an integration testing library for Adobe Experience Manager projects

Prosper Version(s) | AEM Version
------------ | -------------
14.x.x | 6.3, 6.4, 6.5
13.x.x, 12.x.x | 6.4
11.x.x | 6.3
10.x.x, 9.x.x, 8.x.x | 6.2
7.x.x, 6.x.x, 5.x.x, 4.x.x | 6.1
3.x.x, 2.x.x, 1.x.x | 6.0
<= 0.10.x | 5.6 (CQ)

## Release Notes

### 13.0.0

* Removed custom Sling Mock classes. Mock classes (e.g. `SlingHttpServletRequest`) are now provided by the [Sling Mock](http://sling.apache.org/documentation/development/sling-mock.html) framework to prevent conflicts with other dependencies.
* Removed JSP tag support.
* Upgraded Groovy to version `2.4.15`.
* Upgraded Spock to version `1.2-groovy-2.4`.


## Getting Started

Add Maven dependency to project `pom.xml`.
Expand All @@ -49,7 +40,7 @@ Add Maven dependency to project `pom.xml`.
<dependency>
<groupId>com.icfolson.aem.prosper</groupId>
<artifactId>prosper</artifactId>
<version>13.0.0</version>
<version>14.0.0</version>
<scope>test</scope>
</dependency>
```
Expand Down Expand Up @@ -196,11 +187,11 @@ Field Name | Type | Description
session | [javax.jcr.Session](https://docs.adobe.com/docs/en/spec/javax.jcr/javadocs/jcr-2.0/javax/jcr/Session.html) | Administrative JCR session
resourceResolver | [org.apache.sling.api.resource.ResourceResolver](http://sling.apache.org/apidocs/sling7/org/apache/sling/api/resource/ResourceResolver.html) | Administrative Sling Resource Resolver
pageManager | [com.day.cq.wcm.api.PageManager](https://helpx.adobe.com/experience-manager/6-3/sites/developing/using/reference-materials/javadoc/com/day/cq/wcm/api/PageManager.html) | AEM Page Manager
nodeBuilder | [com.icfolson.aem.groovy.extension.builders.NodeBuilder](http://code.digitalatolson.com/aem-groovy-extension/groovydocs/com/icfolson/aem/groovy/extension/builders/NodeBuilder.html) | JCR [Node Builder](https://github.com/Citytechinc/prosper#content-builders)
pageBuilder | [com.icfolson.aem.groovy.extension.builders.PageBuilder](http://code.digitalatolson.com/aem-groovy-extension/groovydocs/com/icfolson/aem/groovy/extension/builders/PageBuilder.html) | AEM [Page Builder](https://github.com/Citytechinc/prosper#content-builders)
nodeBuilder | [com.icfolson.aem.groovy.extension.builders.NodeBuilder](http://icfnext.github.io/aem-groovy-extension/groovydocs/com/icfolson/aem/groovy/extension/builders/NodeBuilder.html) | JCR [Node Builder](https://github.com/Citytechinc/prosper#content-builders)
pageBuilder | [com.icfolson.aem.groovy.extension.builders.PageBuilder](http://icfnext.github.io/aem-groovy-extension/groovydocs/com/icfolson/aem/groovy/extension/builders/PageBuilder.html) | AEM [Page Builder](https://github.com/Citytechinc/prosper#content-builders)
slingContext | [com.icfolson.aem.prosper.context.SlingContextProvider](https://sling.apache.org/documentation/development/sling-mock.html) | Prosper extension of Sling/OSGi Context

See the `ProsperSpec` [GroovyDoc](http://code.digitalatolson.com/prosper/groovydocs/com/icfolson/aem/prosper/specs/ProsperSpec.html) for details on available methods.
See the `ProsperSpec` [GroovyDoc](http://icfnext.github.io/prosper/groovydocs/com/icfolson/aem/prosper/specs/ProsperSpec.html) for details on available methods.

### Content Builders

Expand Down Expand Up @@ -329,7 +320,7 @@ class MySpec extends ProsperSpec {

### Metaclasses

The [AEM Groovy Extension](https://github.com/OlsonDigital/aem-groovy-extension) decorates the `com.day.cq.wcm.api.Page`, `javax.jcr.Node`, and `javax.jcr.Binary` classes with additional methods to simplify common operations. See the extension library [Groovydocs](http://code.digitalatolson.com/aem-groovy-extension/groovydocs/com/icfolson/aem/groovy/extension/metaclass/GroovyExtensionMetaClassRegistry.html) for details of these additions. The metaclasses are registered automatically and available for use in all test methods.
The [AEM Groovy Extension](https://github.com/icfnext/aem-groovy-extension) decorates the `com.day.cq.wcm.api.Page`, `javax.jcr.Node`, and `javax.jcr.Binary` classes with additional methods to simplify common operations. See the extension library [Groovydocs](http://icfnext.github.io/aem-groovy-extension/groovydocs/com/icfolson/aem/groovy/extension/metaclass/GroovyExtensionMetaClassRegistry.html) for details of these additions. The metaclasses are registered automatically and available for use in all test methods.

### Assertions

Expand Down Expand Up @@ -369,7 +360,7 @@ expect: "page is created and properties match expected values"
assertPageExists("/content/prosper", pageProperties)
```

All available `assert...` methods are detailed in the Prosper [GroovyDocs](http://code.digitalatolson.com/prosper/groovydocs/com/icfolson/aem/prosper/specs/ProsperSpec.html).
All available `assert...` methods are detailed in the Prosper [GroovyDocs](http://icfnext.github.io/prosper/groovydocs/com/icfolson/aem/prosper/specs/ProsperSpec.html).

### Mocking Requests and Responses

Expand Down Expand Up @@ -463,7 +454,7 @@ The mock request and response objects delegate to the [MockSlingHttpServletReque

### Sling Context

See the [Groovydoc](http://code.digitalatolson.com/prosper/groovydocs/com/icfolson/aem/prosper/context/SlingContextProvider.html) for complete details of the available service registration and additional context methods; specific Sling adaptable examples are provided below.
See the [Groovydoc](http://icfnext.github.io/prosper/groovydocs/com/icfolson/aem/prosper/context/SlingContextProvider.html) for complete details of the available service registration and additional context methods; specific Sling adaptable examples are provided below.

#### OSGi Services

Expand Down Expand Up @@ -705,7 +696,7 @@ class MobileRequestTraitSpec extends ProsperSpec implements MobileRequestTrait {

## References

* [Prosper GroovyDocs](http://code.digitalatolson.com/prosper/groovydocs/index.html)
* [Prosper GroovyDocs](http://icfnext.github.io/prosper/groovydocs/index.html)
* [Spock Documentation](http://spockframework.github.io/spock/docs/1.0/index.html)
* [Groovy Documentation](http://www.groovy-lang.org/documentation.html)

Expand Down
83 changes: 40 additions & 43 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

<parent>
<groupId>com.icfolson.aem</groupId>
<artifactId>aem-parent-uber-jar</artifactId>
<version>6.4.1.1</version>
<version>7.0.0</version>
</parent>

<modelVersion>4.0.0</modelVersion>
<groupId>com.icfolson.aem.prosper</groupId>
<artifactId>prosper</artifactId>
<packaging>jar</packaging>
<version>13.0.0</version>
<version>14.0.0</version>
<name>Prosper</name>
<description>A Spock-based integration testing library for Adobe Experience Manager.</description>

<url>https://github.com/OlsonDigital/prosper</url>
<url>https://github.com/icfnext/prosper</url>

<organization>
<name>Olson Digital</name>
<url>http://www.digitalatolson.com</url>
<name>ICF Next</name>
<url>http://www.icfnext.com</url>
</organization>

<licenses>
Expand All @@ -32,9 +33,9 @@
</licenses>

<scm>
<connection>scm:git:git@github.com:OlsonDigital/prosper.git</connection>
<developerConnection>scm:git:git@github.com:OlsonDigital/prosper.git</developerConnection>
<url>https://github.com/OlsonDigital/prosper</url>
<connection>scm:git:git@github.com:icfnext/prosper.git</connection>
<developerConnection>scm:git:git@github.com:icfnext/prosper.git</developerConnection>
<url>https://github.com/icfnext/prosper</url>
</scm>

<build>
Expand Down Expand Up @@ -66,6 +67,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
<configuration>
<trimStackTrace>false</trimStackTrace>
<includes>
<include>**/*Spec*</include>
</includes>
Expand All @@ -83,28 +85,37 @@
</goals>
<configuration>
<target>
<taskdef name="groovydoc" classname="org.codehaus.groovy.ant.Groovydoc"
<taskdef name="groovydoc"
classname="org.codehaus.groovy.ant.Groovydoc"
classpathref="maven.compile.classpath"/>
<groovydoc destdir="${project.reporting.outputDirectory}/groovydocs"
sourcepath="${basedir}/src/main/groovy"
packagenames="com.icfolson.aem.prosper.annotations.*,com.icfolson.aem.prosper.builders.*,com.icfolson.aem.prosper.context.*,com.icfolson.aem.prosper.mocks.*,com.icfolson.aem.prosper.specs.*"
use="true" windowtitle="${project.name}" doctitle="${project.name}">
use="true"
windowtitle="${project.name}"
doctitle="${project.name}">
<link packages="javax.jcr."
href="https://docs.adobe.com/content/docs/en/spec/jsr170/javadocs/jcr-2.0/"/>
<link packages="java." href="https://docs.oracle.com/javase/8/docs/api"/>
<link packages="javax." href="https://docs.oracle.com/javaee/7/api"/>
<link packages="java."
href="https://docs.oracle.com/javase/8/docs/api"/>
<link packages="javax."
href="https://docs.oracle.com/javaee/7/api"/>
<link packages="groovy.,org.codehaus.groovy."
href="http://docs.groovy-lang.org/latest/html/gapi"/>
<link packages="spock."
href="http://spockframework.github.io/spock/javadoc/1.0"/>
<link packages="org.apache.jackrabbit.vault."
href="http://jackrabbit.apache.org/filevault/apidocs"/>
<link packages="org.apache.sling.testing.mock.sling." href="http://static.javadoc.io/org.apache.sling/org.apache.sling.testing.sling-mock/2.2.20/"/>
<link packages="org.apache.sling." href="http://sling.apache.org/apidocs/sling8"/>
<link packages="org.apache.sling.testing.mock.sling."
href="http://static.javadoc.io/org.apache.sling/org.apache.sling.testing.sling-mock/2.2.20/"/>
<link packages="org.apache.sling."
href="http://sling.apache.org/apidocs/sling8"/>
<link packages="com.day.cq.wcm.api."
href="https://helpx.adobe.com/experience-manager/6-4/sites/developing/using/reference-materials/javadoc"/>
<link packages="org.osgi.service.component." href="https://osgi.org/javadoc/r6/cmpn"/>
<link packages="org.osgi.framework." href="https://osgi.org/javadoc/r6/core"/>
<link packages="org.osgi.service.component."
href="https://osgi.org/javadoc/r6/cmpn"/>
<link packages="org.osgi.framework."
href="https://osgi.org/javadoc/r6/core"/>
<link packages="com.icfolson.aem.groovy.extension."
href="http://code.digitalatolson.com/aem-groovy-extension/groovydocs"/>
</groovydoc>
Expand Down Expand Up @@ -255,7 +266,7 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-nop</artifactId>
<version>1.7.6</version>
<version>${slf4j.version}</version>
</dependency>
</dependencies>
</profile>
Expand All @@ -270,12 +281,12 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.6</version>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>com.icfolson.aem.groovy.extension</groupId>
<artifactId>aem-groovy-extension-bundle</artifactId>
<version>6.0.0</version>
<version>7.0.0</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
Expand All @@ -288,24 +299,10 @@
</profiles>

<dependencies>
<!-- inherited -->
<dependency>
<groupId>com.adobe.aem</groupId>
<artifactId>uber-jar</artifactId>
<classifier>apis</classifier>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
</dependency>
<dependency>
<groupId>org.apache.jackrabbit</groupId>
<artifactId>oak-core-spi</artifactId>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>osgi.core</artifactId>
Expand All @@ -324,7 +321,7 @@
<dependency>
<groupId>com.icfolson.aem.groovy.extension</groupId>
<artifactId>aem-groovy-extension-bundle</artifactId>
<version>6.0.0</version>
<version>7.0.0</version>
</dependency>
<dependency>
<groupId>org.spockframework</groupId>
Expand All @@ -336,7 +333,7 @@
<dependency>
<groupId>io.wcm</groupId>
<artifactId>io.wcm.testing.aem-mock.junit4</artifactId>
<version>2.3.2</version>
<version>2.4.0</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
Expand All @@ -348,17 +345,17 @@
</exclusion>
</exclusions>
</dependency>

<!-- sling mock -->
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.testing.sling-mock.junit4</artifactId>
<version>2.3.4</version>
</dependency>
<dependency>
<groupId>com.icfolson.sling</groupId>
<artifactId>org.apache.sling.testing.sling-mock-oak</artifactId>
<version>2.1.0</version>
</dependency>

<!-- uber jar last to allow override of included dependencies -->
<dependency>
<groupId>com.adobe.aem</groupId>
<artifactId>uber-jar</artifactId>
<classifier>apis</classifier>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class ProsperMockSlingHttpServletRequest extends MockSlingHttpServletRequest {
ProsperMockSlingHttpServletRequest(ResourceResolver resourceResolver, BundleContext bundleContext) {
super(resourceResolver, bundleContext)

// default to root resource
resource = resourceResolver.resolve("/")
}

Expand All @@ -22,7 +23,10 @@ class ProsperMockSlingHttpServletRequest extends MockSlingHttpServletRequest {
* @param path JCR resource path
*/
void setPath(String path) {
// resolve to ensure that resource is synthetic even if JCR resource does not exist
resource = resourceResolver.resolve(path)

// set resource path in request path info
(requestPathInfo as MockRequestPathInfo).resourcePath = path
}

Expand Down Expand Up @@ -64,6 +68,6 @@ class ProsperMockSlingHttpServletRequest extends MockSlingHttpServletRequest {
[name, value instanceof Collection ? value as String[] : value]
}

super.setParameterMap(parameterMap)
super.setParameterMap(parameterMap as Map<String, Object>)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ import com.day.cq.commons.jcr.JcrConstants
import com.day.cq.wcm.api.NameConstants
import com.day.cq.wcm.api.Page
import com.day.cq.wcm.api.PageManager
import com.icfolson.aem.groovy.extension.api.MetaClassExtensionProvider
import com.icfolson.aem.groovy.extension.builders.NodeBuilder
import com.icfolson.aem.groovy.extension.builders.PageBuilder
import com.icfolson.aem.groovy.extension.metaclass.GroovyExtensionMetaClassRegistry
import com.icfolson.aem.groovy.extension.services.impl.DefaultExtensionService
import com.icfolson.aem.groovy.extension.services.impl.DefaultMetaClassExtensionProvider
import com.icfolson.aem.prosper.annotations.ModelSpec
import com.icfolson.aem.prosper.annotations.NodeTypes
import com.icfolson.aem.prosper.builders.RequestBuilder
Expand Down Expand Up @@ -64,19 +66,18 @@ abstract class ProsperSpec extends Specification {
* and instantiate a mock resource resolver.
*/
def setupSpec() {
GroovyExtensionMetaClassRegistry.registerMetaClasses()
slingContext.registerService(MetaClassExtensionProvider, new DefaultMetaClassExtensionProvider())
slingContext.registerInjectActivateService(new DefaultExtensionService())

registerNodeTypes()
importVaultContent()
registerSlingModels()
}

/**
* Remove Groovy metaclasses and test content.
* Remove test content.
*/
def cleanupSpec() {
GroovyExtensionMetaClassRegistry.removeMetaClasses()

removeAllNodes()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ public final class AdapterFactoryRegistrationCallback implements SlingContextCal
.build();

@Override
public void execute(SlingContext context) {
public void execute(final SlingContext slingContext) {
// register prosper adapter factory
context.registerService(AdapterFactory.class, new ProsperAdapterFactory(), PROPERTIES);
slingContext.registerService(AdapterFactory.class, new ProsperAdapterFactory(), PROPERTIES);

// register mock adapter factory
context.registerService(AdapterFactory.class, new MockAemAdapterFactory());
slingContext.registerService(AdapterFactory.class, new MockAemAdapterFactory());
}
}
Loading

0 comments on commit 1690bfd

Please sign in to comment.