rx

Useful things for RX on the JVM

License

License

GroupId

GroupId

uk.camsw
ArtifactId

ArtifactId

rx
Last Version

Last Version

5.0.1
Release Date

Release Date

Type

Type

pom
Description

Description

rx
Useful things for RX on the JVM
Project URL

Project URL

https://github.com/leonjones1974/rx
Source Code Management

Source Code Management

https://github.com/leonjones1974/rx

Download rx

Filename Size
rx-5.0.1.pom 14 KB
Browse

How to add to project

<!-- https://jarcasting.com/artifacts/uk.camsw/rx/ -->
<dependency>
    <groupId>uk.camsw</groupId>
    <artifactId>rx</artifactId>
    <version>5.0.1</version>
    <type>pom</type>
</dependency>
// https://jarcasting.com/artifacts/uk.camsw/rx/
implementation 'uk.camsw:rx:5.0.1'
// https://jarcasting.com/artifacts/uk.camsw/rx/
implementation ("uk.camsw:rx:5.0.1")
'uk.camsw:rx:pom:5.0.1'
<dependency org="uk.camsw" name="rx" rev="5.0.1">
  <artifact name="rx" type="pom" />
</dependency>
@Grapes(
@Grab(group='uk.camsw', module='rx', version='5.0.1')
)
libraryDependencies += "uk.camsw" % "rx" % "5.0.1"
[uk.camsw/rx "5.0.1"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

  • rxscala-test-dsl
  • rxjava-kafka
  • rxjava-test-dsl
  • rxjava-test-kafka

A Collection of rx related libraries

rxjava-test-dsl

Overview

Rx is great, but testing your awesome sequences can be pain

rx-test aims to provide a simple, extensible DSL to enable easier, more declarative rx testing

A taster (see the tests for more examples)


   DualSourceScenario<String, Integer, String> testScenario = TestScenario.dualSources();

    testScenario
            .given()
                .theStreamUnderTest((s1, s2) -> s1.zipWith(s2, (z, n) -> z + n))
                .renderer(s -> s)
            .when()
                .theSubscriber().subscribes()
                .source1().emits("a")
                .source2().emits(1)
                .source1().emits("b")
                .source2().emits(2)
                .source1().completes()
            .then()
                .theSubscribers()
                    .eventCount().isEqualTo(2)
                    .renderedStream().isEqualTo("[a1]-[b2]-|");
                                                                       
    SingleSourceScenario<String, List<String>> testScenario = TestScenario.singleSource();

    testScenario
            .given()
            .theStreamUnderTest((source, scheduler) -> source.buffer(10, TimeUnit.SECONDS, scheduler))

            .when()
            .subscriber("s1").subscribes()
            .theSource().emits("1a")
            .theSource().emits("1b")
            .theSource().emits("1c")
            .time().advancesBy(Duration.ofSeconds(11))
            .theSource().emits("2a")
            .theSource().emits("2b")
            .theSource().completes()

            .then()
            .subscriber("s1")
            .eventCount().isEqualTo(2)
            .event(0).isEqualTo(asList("1a", "1b", "1c"))
            .event(1).isEqualTo(asList("2a", "2b"));

rxjava-test-kafka

Overview

An extension to rx-test that allows for the incorporation of kafka publisher/ consumers within the tests

A taster (see the tests for more examples)


    String group = UUID.randomUUID().toString();

    new KafkaSourceScenario<String, String, String>()
            .given()
                .aNewTopic()        // Create a randomly named topic on the fly
                .asyncTimeoutOf(Duration.ofSeconds(10))
                .theStreamUnderTest(topic -> KafkaStream.newBuilder(topic.getName(), group).newMergedStream().map(e -> e.getValue()))
            .when()
                .theSubscriber().subscribes()
                .thePublisher().publishes("1", "1")
                .thePublisher().publishes("2", "2")
                .theSubscriber().waitsForEvents(2)
            .then()
                .theSubscribers().renderedStream().isEqualTo("[1]-[2]");

rxjava-capture

Overview

Work in progress - come back later!

Binaries

Binaries and dependency information for Maven, Ivy, Gradle and others can be found at http://search.maven.org.

Example for Maven:

uk.camsw rxjava-test-dsl x.y.z

Versions

Version
5.0.1
5.0.0
4.1.1