Integration-test library for Kotlin and Java

Overview

Maya

Maven Central

Maya (/ˈmɑːjə/, माया), literally "illusion" or "magic". In Vedic texts it connotes a "magic show, an illusion where things appear to be present, but are not what they seem".

This project provides classes for easier integration testing, simulating external environment.

features

  • SQS emulator
    • Standard and FIFO queues support
    • SqsMessageSender for publishing messages from tests.

Installation

Add a dependency to your project.

Gradle:

dependencies {
    testImplementation("com.github.kpavlov.maya:maya:${latestVersion}")
}

Maven:

<dependency>
  <groupId>com.github.kpavlov.maya</groupId>
  <artifactId>maya</artifactId>
  <version>${latestVersion}</version>
</dependency>

Local SQS Simulator

LocalSqs starts local SQS server using ElasticMQ Docker container.

Make sure that docker daemon is running on your machine.

It can be customized by creating configuration file and storing it in the test classpath. Configuration parameters are described here.

// Create and start local SQS Server
val sqs = LocalSqs(configPath="sqs-queues.conf")
sqs.start()

// Create SQS client connected to local SQS server
val sqsClient = SqsAsyncClient.builder()
    .endpointOverride(URI.create(sqs.endpointUrl()))
    .region(Region.US_EAST_1)
    .build()

// Create SqsMessageSender for Standard SQS Queue
val sender = SqsMessageSender<String>(
    sqsClient, 
    queueName = "test-queue",
    messageEncoder = identity()
)

// Send message to Standard queue
val messageId = sender.sendMessageAsync("Hello, World!").await()

// Create SqsMessageSender for Standard SQS Queue
val fifoSender = SqsMessageSender<String>(
    sqsClient,
    queueName = "test-queue.fifo",
    messageEncoder = Function.identity() ,
    messageGroupIdExtractor = { it.substring(0, 5) },
    messageDeduplicationIdExtractor = { it.hashCode().toString() }
)

// Send message to FIFO queue
val messageId = fifoSender.sendMessageAsync("Hello, FIFO World!").await()

// run some tests...

sqs.stop()

It is recommended to start SQS server only once before running all tests. With JUnit5 you should run it in java static initializer, to make sure it is started before all tests in all classes.

You might also like...
Playground for Vault Integration

Vault Lab This is playground for spring-booter to test integrating with Vault the Hashi-Corp product. Secret-Engines that are available now: Transit :

API for a library using Kotlin, Spring-boot and covered by test

Library API This API is to create Books and be able to borrow from them I'm using: Spring Boot version 2.5.6 Kotlin 1.5.31 Java 11 I'm implementing us

Modular Android architecture which showcase Kotlin, MVVM, Navigation, Hilt, Coroutines, Jetpack compose, Retrofit, Unit test and Kotlin Gradle DSL.

SampleCompose Modular Android architecture which showcase Kotlin, MVVM, Navigation, Hilt, Coroutines, Jetpack compose, Retrofit, Unit test and Kotlin

Framework for Mobile test automation (Native app and Browser) on Android and IOS devices
Framework for Mobile test automation (Native app and Browser) on Android and IOS devices

Appium Mobile Automation Framework Framework for Mobile test automation (Native app and Browser) on Android and IOS devices 📱 🚀 Quick Start - Appium

A project that takes advantage of docker and makes the load test easier

Performance Test It's a project that takes advantage of docker and makes the load test easier. Also, it collects metrics from each running container.

Sample demonstrates use of Flow, StateFlow & how we can test Flow

FlowSample This sample demonstrates use of Flow, StateFlow & how we can test Flow. In Kotlin, Coroutine is just the scheduler part of RxJava but now w

A funny project to help you test your BNF syntax

Readme The idea of this project is to implement a BNF expression compiler. We could use BNF to design some syntax like Arithmetic expression. factor

Test task from AppSelect company
Test task from AppSelect company

Test task from AppSelect company

Simple App made for a test to Studio Sol Company

Studio Sol Test - Guess the Number Simple App made for a test to Studio Sol Company. #What you'll see in this project: ViewBinding Navigation Animatio

Owner
Konstantin Pavlov
Software engineer @twilio (kotlin, java, typescript) 🦉 2:5020/316.13
Konstantin Pavlov
An introductory dynamics to Test Driven Development (TDD)An introductory dynamics to Test Driven Development (TDD)

tdd-demo Nesse hands-on teremos uma dinâmica introdutória a Test Driven Development (TDD), ou desenvolvimento orientado por testes. instruções 1 - Clo

Plataforma Impact 1 Jan 15, 2022
Gha-central-test - GitHub Actions Maven Central Test

GitHub Actions Maven Central Test Pushing a tag does a release. Local Maven Depl

James Ward 1 Jan 19, 2022
A project that helps us generate the test project to test the Gradle plugin.

Ktlint Gradle Provides the function to generate a Gradle project for us to test your Gradle plugin Latest plugin version: [1.0.0] Table of content How

Jack Chen 5 Jul 20, 2022
🌱 A test implementation of a Minecraft server using RESTful API taking advantage of the interoperability between Kotlin and Java.

?? Norin A test implementation of a Minecraft server using RESTful API taking advantage of the interoperability between Kotlin and Java. This project

Gabriel 1 Jan 4, 2022
Example of Android project showing integration with Kotlin and Dagger 2

kotlin-dagger-example This project demonstrate how to setup an Android Project with Kotlin and Dagger 2. It's based on Dagger 2 example ##Known issues

Damian Petla 533 Nov 11, 2022
Sample app to demonstrate the integration code and working of Dyte SDK for android, using Kotlin.

Dyte Kotlin Sample App An example app in kotlin using the Dyte Mobile SDK Explore the docs » View Demo · Report Bug · Request Feature Table of Content

Dyte 8 Dec 3, 2021
TODO API Client Kata for Kotlin Developers. The main goal is to practice integration testing using MockWebServer

KataTODOApiClient for Kotlin We are here to practice integration testsing using HTTP stubbing. We are going to use MockWebServer to simulate a HTTP se

Karumi 61 Nov 20, 2022
A basic template ecommerce application with payment integration made using Android Architechture componets

ShopIt ShopIt is a basic template ecommerce application with payment integration(RazorPay), made using Android Architechture componets and Material Co

Apurva Shukla 2 Nov 22, 2021
Torus CustomAuth integration samples for Android applications

CustomAuth Android Samples Examples of using Torus CustomAuth Android SDK. Usage Clone the repository and open with Android Studio Run the app, you'll

Minh-Phuc Tran 1 Dec 3, 2021
Android Open-Source Telematics App with Firebase© integration

Android Open-Source Telematics App with Firebase© integration Description This Telematics App is developed by Damoov and is distributed free of charge

null 0 Jan 14, 2022