Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Hanno Klein committed Oct 26, 2021
2 parents 4820fcd + 43919a6 commit 6fb13fa
Show file tree
Hide file tree
Showing 18 changed files with 3,615 additions and 1,473 deletions.
13 changes: 9 additions & 4 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,20 @@ on:
jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
os: [ ubuntu-latest ]
java-version: [ 11 ]
distro: [ 'zulu', 'temurin' ]
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
- name: Set up JDK ${{ matrix.java-version }} ${{ matrix.distro }}
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
java-version: ${{ matrix.java-version }}
distribution: ${{ matrix.distro }}
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Upload package
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ Data files in this project under `test/resources` are strictly for testing and t
## Build
The project is built with Maven version 3.3 or later.

The project requires Java 11 or later. Some modules use Java Platform Module System (JPMS).
This project requires Java 11 or later. It should run on any platform for which a JVM is supported. Some modules use Java Platform Module System (JPMS).

Several open-source JDK implementations are available, including [Eclipse Temurin](https://adoptium.net/) and [Azul Zulu](https://www.azul.com/downloads/?package=jdk).



2 changes: 1 addition & 1 deletion dsl-antlr/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>parent</artifactId>
<groupId>io.fixprotocol.orchestra</groupId>
<version>1.7.3-SNAPSHOT</version>
<version>1.7.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>dsl-antlr</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion interfaces-util/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.fixprotocol.orchestra</groupId>
<artifactId>parent</artifactId>
<version>1.7.3-SNAPSHOT</version>
<version>1.7.3</version>
</parent>
<artifactId>interfaces-util</artifactId>
<name>${project.groupId}:${project.artifactId}</name>
Expand Down
2 changes: 1 addition & 1 deletion interfaces/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.fixprotocol.orchestra</groupId>
<artifactId>parent</artifactId>
<version>1.7.3-SNAPSHOT</version>
<version>1.7.3</version>
</parent>
<artifactId>interfaces</artifactId>
<name>${project.groupId}:${project.artifactId}</name>
Expand Down
2 changes: 1 addition & 1 deletion message-model/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.fixprotocol.orchestra</groupId>
<artifactId>parent</artifactId>
<version>1.7.3-SNAPSHOT</version>
<version>1.7.3</version>
</parent>
<artifactId>message-model</artifactId>
<name>${project.groupId}:${project.artifactId}</name>
Expand Down
2 changes: 1 addition & 1 deletion orchestra-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.fixprotocol.orchestra</groupId>
<artifactId>parent</artifactId>
<version>1.7.3-SNAPSHOT</version>
<version>1.7.3</version>
</parent>
<artifactId>orchestra-common</artifactId>
<name>${project.groupId}:${project.artifactId}</name>
Expand Down
2 changes: 1 addition & 1 deletion orchestra2doc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.fixprotocol.orchestra</groupId>
<artifactId>parent</artifactId>
<version>1.7.3-SNAPSHOT</version>
<version>1.7.3</version>
</parent>
<artifactId>orchestra2doc</artifactId>
<description>Generates humanly readable documentation</description>
Expand Down
9 changes: 4 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
<modelVersion>4.0.0</modelVersion>
<groupId>io.fixprotocol.orchestra</groupId>
<artifactId>parent</artifactId>
<version>1.7.3-SNAPSHOT</version>
<version>1.7.3</version>
<packaging>pom</packaging>
<name>${project.groupId}:${project.artifactId}</name>
<description>Parent project for FIX Orchestra. Build Java 8 by default, multi-release jar on demand.</description>
<description>Parent project for FIX Orchestra</description>
<url>https://github.com/FIXTradingCommunity/fix-orchestra/wiki</url>
<inceptionYear>2016</inceptionYear>
<prerequisites>
Expand Down Expand Up @@ -67,10 +67,9 @@
<antlr.version>4.9.2</antlr.version>
<base.java.version>11</base.java.version>
<commons-cli.version>1.4</commons-cli.version>
<cucumber.version>1.2.6</cucumber.version>
<junit.version>5.6.1</junit.version>
<junit.version>5.8.0</junit.version>
<log4j.version>2.14.1</log4j.version>
<saxon.version>10.5</saxon.version>
<saxon.version>10.6</saxon.version>
<slf4j.version>1.7.22</slf4j.version>
<stringtemplate.version>4.3.1</stringtemplate.version>
<jackson.version>2.12.3</jackson.version>
Expand Down
4 changes: 2 additions & 2 deletions repository-util/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
<parent>
<groupId>io.fixprotocol.orchestra</groupId>
<artifactId>parent</artifactId>
<version>1.7.3-SNAPSHOT</version>
<version>1.7.3</version>
</parent>
<artifactId>repository-util</artifactId>
<name>${project.groupId}:${project.artifactId}</name>
<description>Repository utilities</description>

<properties>
<md-grammar.version>1.1.2</md-grammar.version>
<md-grammar.version>1.2.0</md-grammar.version>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URL;
import java.util.Iterator;
import java.util.Objects;
Expand All @@ -23,8 +22,6 @@
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
Expand All @@ -36,8 +33,6 @@
import io.fixprotocol.orchestra.dsl.antlr.Evaluator;
import io.fixprotocol.orchestra.dsl.antlr.ScoreException;
import io.fixprotocol.orchestra.event.EventListener;
import io.fixprotocol.orchestra.event.EventListenerFactory;
import io.fixprotocol.orchestra.event.TeeEventListener;

/**
* Validates that an Orchestra repository file conforms to the schema but does not apply
Expand Down Expand Up @@ -103,25 +98,7 @@ public Iterator<String> getPrefixes(String arg0) {
}
};

public static EventListener createLogger(OutputStream jsonOutputStream) {
final Logger logger = LogManager.getLogger(BasicRepositoryValidator.class);
final EventListenerFactory factory = new EventListenerFactory();
TeeEventListener eventListener = null;
try {
eventListener = new TeeEventListener();
final EventListener logEventLogger = factory.getInstance("LOG4J");
logEventLogger.setResource(logger);
eventListener.addEventListener(logEventLogger);
if (jsonOutputStream != null) {
final EventListener jsonEventLogger = factory.getInstance("JSON");
jsonEventLogger.setResource(jsonOutputStream);
eventListener.addEventListener(jsonEventLogger);
}
} catch (Exception e) {
logger.error("Error creating event listener", e);
}
return eventListener;
}


protected Predicate<String> isValidBoolean = t -> true;
protected Predicate<String> isValidChar = t -> t.length() == 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.OutputStream;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import io.fixprotocol.orchestra.event.EventListener;
import io.fixprotocol.orchestra.event.EventListenerFactory;
import io.fixprotocol.orchestra.event.TeeEventListener;

/**
* Validates an Orchestra repository file
Expand Down Expand Up @@ -62,6 +67,7 @@ public Builder style(String style) {
}

public static final String FIX_STYLE = "FIX";
final Logger logger = LogManager.getLogger(RepositoryValidator.class);

public static Builder builder() {
return new Builder();
Expand All @@ -76,10 +82,8 @@ public static Builder builder() {
* Usage: RepositoryValidator [options] &lt;input-file&gt;
* -e &lt;logfile&gt; name of event log
* </pre>
*
* @throws Exception if the file to validate cannot be found, read, or parsed
*/
public static void main(String[] args) throws Exception {
public static void main(String[] args) {
final Builder builder = RepositoryValidator.builder();

for (int i = 0; i < args.length;) {
Expand All @@ -94,7 +98,7 @@ public static void main(String[] args) throws Exception {
i++;
}
final RepositoryValidator validator = builder.build();
validator.validate();
System.exit(validator.validate() ? 0 : 1);
}

private final String eventFile;
Expand All @@ -108,8 +112,7 @@ private RepositoryValidator(Builder builder) {
}

public boolean validate() {
try (EventListener eventLogger = FixRepositoryValidator
.createLogger(eventFile != null ? new FileOutputStream(eventFile) : null)) {
try (EventListener eventLogger = createLogger(eventFile != null ? new FileOutputStream(eventFile) : null)) {
BasicRepositoryValidator impl;
if (FIX_STYLE.equals(this.style)) {
impl = new FixRepositoryValidator(eventLogger);
Expand All @@ -118,9 +121,29 @@ public boolean validate() {
}
return impl.validate(new FileInputStream(inputFile));
} catch (final Exception e) {
System.err.println(e.getMessage());
logger.fatal("RepositoryValidator failed", e);
return false;
}
}

public static EventListener createLogger(OutputStream jsonOutputStream) {
final Logger logger = LogManager.getLogger(RepositoryValidator.class);
final EventListenerFactory factory = new EventListenerFactory();
TeeEventListener eventListener = null;
try {
eventListener = new TeeEventListener();
final EventListener logEventLogger = factory.getInstance("LOG4J");
logEventLogger.setResource(logger);
eventListener.addEventListener(logEventLogger);
if (jsonOutputStream != null) {
final EventListener jsonEventLogger = factory.getInstance("JSON");
jsonEventLogger.setResource(jsonOutputStream);
eventListener.addEventListener(jsonEventLogger);
}
} catch (Exception e) {
logger.error("Error creating event listener", e);
}
return eventListener;
}

}
Loading

0 comments on commit 6fb13fa

Please sign in to comment.