All Projects → wttech → aem-stubs

wttech / aem-stubs

Licence: Apache-2.0 license
Tool for providing sample data for AEM applications in a simple and flexible way. Stubbing server on AEM, no separate needed.

Programming Languages

java
68154 projects - #9 most used programming language
kotlin
9241 projects
shell
77523 projects
groovy
2714 projects
HTML
75241 projects

Projects that are alternatives of or similar to aem-stubs

Hippolyte
HTTP Stubbing in Swift
Stars: ✭ 109 (+172.5%)
Mutual labels:  mock, stub, mocking, stubbing
Ohhttpstubs
Stub your network requests easily! Test your apps with fake network data and custom response time, response code and headers!
Stars: ✭ 4,831 (+11977.5%)
Mutual labels:  mock, stub, mocking, stubbing
Nsubstitute
A friendly substitute for .NET mocking libraries.
Stars: ✭ 1,646 (+4015%)
Mutual labels:  mock, mocking, stubs, mocks
Mockaco
🐵 HTTP mock server, useful to stub services and simulate dynamic API responses, leveraging ASP.NET Core features, built-in fake data generation and pure C# scripting
Stars: ✭ 213 (+432.5%)
Mutual labels:  mock, mocking, mocks
Mockito
Most popular Mocking framework for unit tests written in Java
Stars: ✭ 12,453 (+31032.5%)
Mutual labels:  mock, mocking, mocks
Wiremock
A tool for mocking HTTP services
Stars: ✭ 4,790 (+11875%)
Mutual labels:  mocking, stubbing, wiremock
umock-c
A pure C mocking library
Stars: ✭ 29 (-27.5%)
Mutual labels:  mock, mocking, mocks
Stubmatic
Mock HTTP calls without coding. Designed specially for testing and testers.
Stars: ✭ 118 (+195%)
Mutual labels:  mock, stub, stub-server
stub-server
Stub server for REST APIs
Stars: ✭ 14 (-65%)
Mutual labels:  mock, stub, stub-server
Cuckoo
Boilerplate-free mocking framework for Swift!
Stars: ✭ 1,344 (+3260%)
Mutual labels:  mock, stub, mocking
Wiremockui
Wiremock UI - Tool for creating mock servers, proxies servers and proxies servers with the option to save the data traffic from an existing API or Site.
Stars: ✭ 38 (-5%)
Mutual labels:  mock, stub, mocking
Mockery
A mock code autogenerator for Golang
Stars: ✭ 3,138 (+7745%)
Mutual labels:  mock, mocking, mocks
wiremock
A tool for mocking HTTP services
Stars: ✭ 5,239 (+12997.5%)
Mutual labels:  mocking, stubbing, wiremock
AEM-UP
🚀 AEM Author, Dispatcher and Publisher in one VM managed via Vagrant and provisioned via Ansible
Stars: ✭ 18 (-55%)
Mutual labels:  aem, aem-tools, aem-automation
mockingbird
🐦 Decorator Powered TypeScript Library for Creating Mocks
Stars: ✭ 70 (+75%)
Mutual labels:  mock, mocking, mocks
etoolbox-authoring-kit
Offers a set of tools that create Granite UI authoring interfaces for Adobe Experience Manager components from Java code. This is a comprehensive solution that makes different widgets work in a coordinated manner, provides greater interactivity in AEM dialogs, and introduces additional features (customizable data lists, options selection, etc.)
Stars: ✭ 93 (+132.5%)
Mutual labels:  aem, aem64, aem65
Mockery
Mockery is a simple yet flexible PHP mock object framework for use in unit testing with PHPUnit, PHPSpec or any other testing framework. Its core goal is to offer a test double framework with a succinct API capable of clearly defining all possible object operations and interactions using a human readable Domain Specific Language (DSL).
Stars: ✭ 10,048 (+25020%)
Mutual labels:  mock, stub, mocking
Spy
Clojure/ClojureScript library for stubs, spies and mocks.
Stars: ✭ 131 (+227.5%)
Mutual labels:  mock, stub, mocking
Mocktail
A mock library for Dart inspired by mockito
Stars: ✭ 172 (+330%)
Mutual labels:  mock, mocking
mocka
Mocka - The complete testing framework for LUA and Nginx
Stars: ✭ 26 (-35%)
Mutual labels:  mock, stub

WTT logo

GitHub tag (latest SemVer) GitHub All Releases Check Apache License, Version 2.0, January 2004

AEM Stubs

Tool for providing sample data for AEM applications in a simple and flexible way.

By providing JSON mapping file or implementing a Groovy script using WireMock or Moco framework be able to mock your 3rd party services within minutes without a need to set up separate mock servers (infrastructure).

Simply install ready-to-use CRX package on AEM instance and start stubbing!

Screenshot

AdaptTo 2020 Live Demo - https://adapt.to/2020/en/schedule/lightning-talks/aem-stubs.html

Main concepts of AEM Stubs tool are:

  • Simplicity
    • Creating stubs should be as much simple as it is possible,
    • Reusing widely-known and battle-tested stubbing technology (avoiding reinventing a wheel),
  • Reactivity
    • Trivial tool deployment - installable on AEM via all-in-one CRX package in the time when stubs are actually needed,
    • Trivial stubs deployment - reloading stubs tied to regular AEM application deployment.

Table of contents

Frameworks

At first, it is needed to decide which stubbing framework is more preferred to use.

Both frameworks have their own pros and cons, see comparison:

Topic \ Framework WireMock Moco Comments
Installation All-in-one AEM package All-in-one AEM package Both distributions could be easily deployed via single package installation in CRX Package Manager.
HTTP server AEM built-in (Jetty) Separate running also on AEM at dedicated port (Netty) As of Moco is not using AEM HTTP Server but running its own (faster, asynchronous), it is required to ensure that port
used by Moco is free and not blocked by firewall on some deployment servers.
As of WireMock is running on same server as AEM, all mocked paths need to be prefixed (by default with stubs/).
When using Moco prefixes are not needed as of it is a dedicated HTTP server with mocks only.
Popularity Big - 3.9k stars on GitHub Big - 3.1k stars on GitHub WireMock is a little bit more popular and has probably better documentation and more materials available on the web.
API Rich, old-fashioned Rich, modern Moco API seems to be written with extendability in mind. Has many interfaces, builders etc available. WireMock API has less such extension points and generally does not look so elegant.

After choosing stubbing framework, it is recommended to explore dedicated AEM Stubs framework related documentation:

However, keep in mind using both frameworks on AEM is also supported. It may be useful when some features are missing in one framework, but they are available in another one.

Installation

Simply install ready to use AEM package downloaded from GitHub releases section.

Distribution types:

  • wiremock-all - WireMock framework only with Groovy OSGi bundle included,
  • wiremock-app - WireMock framework only without Groovy OSGi bundle included.
  • moco-all - Moco framework only with Groovy OSGi bundle included,
  • moco-app - Moco framework only without Groovy OSGi bundle included.

Post installation steps

Remember that using AEM Stubs on AEM Publish instances may require an additional configuration.

In case of WireMock, ensure that WireMock Servlet prefix /stubs is not filtered by AEM Dispatcher configuration. Alternatively, by creating OSGi configuration, update that path prefix to path which is already accessible.

When using Moco, ensure that Moco Stubs Server (running by default on port 5555) is not blocked by firewall. Alternatively, by creating OSGi configuration, update that port number to port which is already accessible.

Compatibility

AEM Stubs AEM Java Groovy
1.0.0, 1.0.1 6.4, 6.5 8 2.x
>= 1.0.2 6.3, 6.4, 6.5 8 2.x
2.0.0 6.3, 6.4, 6.5 11 2.x
2.0.1 6.3, 6.4, 6.5 8, 11 2.x
3.0.0 6.3, 6.4, 6.5 8, 11 4.x

Note that AEM Stubs is using Groovy scripts concept. However it is not using AEM Groovy Console. It is done intentionally, because Groovy Console has close dependencies to concrete AEM version. AEM Stubs tool is implemented in a AEM version agnostic way, to make it more universal and more fault-tolerant when AEM version is changing. It is compatible with AEM Groovy Console - simply install one of AEM Stubs distributions without Groovy console OSGi bundle included as it is usually provided by Groovy Console AEM package.

From AEM Stubs 3.x onwards, Groovy has been upgraded to version 4.x. Groovy has stopped providing a groovy-all 'uber' bundle. In this package, only the groovy 'core' bundle is included. It is possible to add extra Groovy modules in your own project. A list of groovy subprojects can be found here at the Groovy GitHub Project

Documentation

Basics

Stubs could be provided by:

  • JSON mapping files (*.stub.json) so called stub mappings e.g file named my-feature.stub.json,
  • Groovy Scripts (*.stub.groovy) so called stub scripts e.g file named my-feature.stub.groovy.

Format of contents of these files depends on chosen framework.

For example, when decided to choose WireMock framework, then these files should be put into AEM under path /conf/stubs/wiremock/* via CRX package with corresponding Vault workspace filter:

<?xml version="1.0" encoding="UTF-8"?>
<workspaceFilter version="1.0">
    <filter root="/apps/example"/>
    <filter root="/conf/stubs/wiremock/example"/>
</workspaceFilter>

Stub mappings or scripts could be organized into folders tree. Any other assets used by scripts like images, extra JSON files could be also freely put close to stub scripts or mappings. Indeed, dedicated extensions *.stub.json and *.stub.groovy are introduced to distinguish these assets from automatically loaded scripts and mappings.

Note that mappings and scripts under path /conf/stubs/wiremock/samples will not be considered as of they are excluded by default configuration of Stub Manager OSGi service. Which means to use samples, it is needed to remove path exclusion, rename a folder or copy sample files to other folder.

OSGi configuration

There are framework specific OSGi configurations (WireMock, Moco) and common listed below:

Stub Manager

Stub script API

Pre-defined variables:

Framework-specific stub script API

See also framework-specific stub script API:

Other tools

There are no other dedicated tools for stubbing data available for AEM and it was main purpose to create AEM Stubs tool.

Authors

Contributing

Issues reported or pull requests created will be very appreciated.

  1. Fork plugin source code using a dedicated GitHub button.
  2. Do code changes on a feature branch created from develop branch.
  3. Create a pull request with a base of develop branch.

Building

Project build is based on Gradle and using Gradle AEM Plugin.

To setup AEM instance, provide details required by running command:

sh gradlew props

Fill opened GUI dialog, then click execute button.

To build CRX package and deploy it on AEM instance, simply run command:

sh gradlew

That's it.

License

AEM Stubs is licensed under the Apache License, Version 2.0 (the "License")

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].