Skip to content

Commit

Permalink
Add IT for replays
Browse files Browse the repository at this point in the history
  • Loading branch information
skiddykong committed Dec 12, 2017
1 parent 5333db1 commit c936dff
Show file tree
Hide file tree
Showing 16 changed files with 822 additions and 1 deletion.
7 changes: 7 additions & 0 deletions framework-tools-replay/src/test/resources/log4j.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Set root logger level to DEBUG and its only appender to A1.
log4j.rootLogger=INFO, A1
# A1 is set to be a ConsoleAppender.
log4j.appender.A1=org.apache.log4j.ConsoleAppender
# A1 uses PatternLayout.
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
8 changes: 8 additions & 0 deletions framework-tools-replay/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,11 @@ java -jar target/event-buffer-liquibase-0.33.0.jar --url=jdbc:postgresql://local

# Replay event streams
java -jar target/framework-tools-replay-1.0.0-SNAPSHOT-swarm.jar replay -c standalone-ds.xml -l notification-event-listener-1.0.12-SNAPSHOT.war






java -jar /Users/justin/code/framework-tools/framework-tools-test/framework-tools-it/target/test-classes/framework-tools-replay-2.1.0-SNAPSHOT-swarm.jar replay -c /Users/justin/code/framework-tools/framework-tools-test/framework-tools-it/target/test-classes/standalone-ds.xml -l /Users/justin/code/framework-tools/framework-tools-test/framework-tools-it/target/test-classes/framework-tools-test-listener-1.0.0.war
ID:
35 changes: 35 additions & 0 deletions framework-tools-test/framework-event-listener/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?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"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>framework-tools-test</artifactId>
<groupId>uk.gov.justice</groupId>
<version>2.1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<groupId>uk.gov.justice.framework.tools</groupId>
<artifactId>framework-tools-test-listener</artifactId>
<version>1.0.0</version>

<packaging>war</packaging>

<properties>
<cpp.service-component>EVENT_LISTENER</cpp.service-component>
</properties>

<dependencies>
<dependency>
<groupId>uk.gov.justice.services</groupId>
<artifactId>event-listener</artifactId>
<version>${framework.version}</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package uk.gov.justice.framework.tools.listener;

import uk.gov.justice.services.core.annotation.Component;
import uk.gov.justice.services.core.annotation.Handles;
import uk.gov.justice.services.core.annotation.ServiceComponent;
import uk.gov.justice.services.messaging.JsonEnvelope;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@ServiceComponent(value = Component.EVENT_LISTENER)
public class FrameworkToolsTestListener {

private static final Logger logger = LoggerFactory.getLogger(FrameworkToolsTestListener.class);

@Handles("framework.example-test")
public void handle(final JsonEnvelope envelope) {
logger.info("caught a fish!");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#%RAML 0.8
title: API Using media type in the URL
baseUri: message://event/listener/message/cakeshop
version: v1
/example.event:
post:
body:
application/vnd.framework.example-test+json:
schema: !include json/schema/framework.example-test.json
example: !include json/framework.example-test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"test":"test"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"test": {
"type": "string"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<!-- Marker file indicating CDI should be enabled -->

<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xsi:schemaLocation="
http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd" bean-discovery-mode="all">
</beans>
166 changes: 166 additions & 0 deletions framework-tools-test/framework-tools-it/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
<?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"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>framework-tools-test</artifactId>
<groupId>uk.gov.justice</groupId>
<version>2.1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>framework-tools-it</artifactId>

<dependencies>
<!--<dependency>-->
<!--<groupId>org.wildfly.swarm</groupId>-->
<!--<artifactId>h2</artifactId>-->
<!--<version>2016.10.0</version>-->
<!--</dependency>-->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>test</scope>
<version>1.4.187</version>
</dependency>
<dependency>
<groupId>uk.gov.justice.utils</groupId>
<artifactId>test-utils-core</artifactId>
<version>${test.utils.core.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>uk.gov.justice.services</groupId>
<artifactId>framework-api-messaging</artifactId>
<version>${framework.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>uk.gov.justice.services</groupId>
<artifactId>test-utils-core</artifactId>
<version>${framework.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>uk.gov.justice.services</groupId>
<artifactId>event-repository-liquibase</artifactId>
<version>${framework.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>uk.gov.justice.services</groupId>
<artifactId>aggregate-snapshot-repository-liquibase</artifactId>
<version>${framework.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>uk.gov.justice.services</groupId>
<artifactId>event-buffer-liquibase</artifactId>
<version>${framework.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>uk.gov.justice.utils</groupId>
<artifactId>test-utils-logging-simple</artifactId>
<type>pom</type>
<scope>test</scope>
<version>1.5.0</version>
</dependency>

</dependencies>

<build>
<plugins>
<plugin>
<groupId>com.edugility</groupId>
<artifactId>h2-maven-plugin</artifactId>
<configuration>
<port>8092</port>
</configuration>
<executions>
<execution>
<id>Spawn a new H2 TCP server</id>
<phase>pre-integration-test</phase>
<goals>
<goal>spawn</goal>
</goals>
</execution>
<execution>
<id>Stop a spawned H2 TCP server</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.187</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy</id>
<phase>generate-test-sources</phase>
<goals>
<goal>copy</goal>
</goals>
</execution>
</executions>
<configuration>
<artifactItems>
<artifactItem>
<groupId>uk.gov.justice.framework.tools</groupId>
<artifactId>framework-tools-test-listener</artifactId>
<version>1.0.0</version>
<type>war</type>
<overWrite>true</overWrite>
<outputDirectory>${project.basedir}/target/test-classes</outputDirectory>
</artifactItem>
<artifactItem>
<artifactId>framework-tools</artifactId>
<groupId>uk.gov.justice</groupId>
<version>${project.version}</version>
<artifactId>framework-tools-replay</artifactId>
<type>jar</type>
<classifier>swarm</classifier>
<overWrite>true</overWrite>
<outputDirectory>${project.basedir}/target/test-classes</outputDirectory>
</artifactItem>
</artifactItems>
<!--<outputDirectory>${project.build.directory}/wars</outputDirectory>-->
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
</configuration>
</plugin>
</plugins>
</build>
</project>
Loading

0 comments on commit c936dff

Please sign in to comment.