Skip to content

Commit

Permalink
Merge branch 'real-logic:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
pcdv authored Nov 13, 2024
2 parents 71f6596 + 2b78adc commit 86efe84
Show file tree
Hide file tree
Showing 60 changed files with 1,357 additions and 296 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Continuous Integration

on:
workflow_call:
push:
branches:
- master
Expand All @@ -10,7 +11,7 @@ on:
- master

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
Expand All @@ -27,8 +28,8 @@ jobs:
strategy:
fail-fast: false
matrix:
java: [ '8', '11', '17', '21' ]
os: [ 'ubuntu-22.04', 'windows-latest' ]
java: [ '17', '21' ]
os: [ 'ubuntu-24.04', 'windows-latest' ]
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down Expand Up @@ -56,11 +57,11 @@ jobs:
java -Xinternalversion
echo "BUILD_JAVA_HOME=${JAVA_HOME}" >> $GITHUB_ENV
echo "BUILD_JAVA_VERSION=${{ matrix.java }}" >> $GITHUB_ENV
- name: Setup java 8 to run the Gradle script
- name: Setup java 17 to run the Gradle script
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 8
java-version: 17
- name: Build with Gradle
run: ./gradlew
- name: Copy test logs
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: "CodeQL"

on:
workflow_call:
push:
branches:
- master
Expand All @@ -10,7 +11,7 @@ on:
- master

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
group: codeql-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
Expand All @@ -34,15 +35,15 @@ jobs:
ref: ${{ github.sha }}

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
config-file: ./.github/codeql/codeql-config.yml

- name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@v3

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{ matrix.language }}"
60 changes: 60 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Release

on:
workflow_dispatch:
push:
tags:
- '*'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false

env:
GRADLE_OPTS: '-Dorg.gradle.daemon=false -Dorg.gradle.java.installations.auto-detect=false'

jobs:
ci:
uses: ./.github/workflows/ci.yml
permissions:
contents: read

codeql:
uses: ./.github/workflows/codeql.yml
permissions:
actions: read
contents: read
security-events: write

release:
name: Release java artifacts
permissions:
contents: write
packages: write
needs: [ ci, codeql ]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: true
- name: Setup java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
- name: Publish with Gradle to Open Source
run: ./gradlew publishAllPublicationsToOssRepository
env:
ORG_GRADLE_PROJECT_repoUsername: ${{ secrets.SONATYPE_CENTRAL_USERNAME }}
ORG_GRADLE_PROJECT_repoPassword: ${{ secrets.SONATYPE_CENTRAL_PASSWORD }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_RSA_SIGN_KEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_RSA_SIGN_KEYPASS }}
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# the idea of this dockerfile is to allow running artio build in multiple containers in order to increase the chances of a failing test locally
FROM alpine/java:21-jdk as artio-image
ENV GRADLE_OPTS="-Dorg.gradle.daemon=false -Dfix.core.debug=STATE_CLEANUP,FIX_MESSAGE,REPLAY,FIXP_SESSION,FIXP_BUSINESS -Dfix.core.ci=true"
ADD . artio-src
WORKDIR artio-src
ENTRYPOINT ./gradlew clean test
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import uk.co.real_logic.artio.DebugLogger;
import uk.co.real_logic.artio.binary_entrypoint.BinaryEntryPointProtocol;
import uk.co.real_logic.sbe.json.JsonPrinter;
import uk.co.real_logic.sbe.otf.OtfHeaderDecoder;

import java.io.IOException;
import java.net.InetSocketAddress;
Expand Down Expand Up @@ -89,6 +90,8 @@ public final class BinaryEntryPointClient implements AutoCloseable
private long keepAliveIntervalInMs = KEEP_ALIVE_INTERVAL_IN_MS;
private CancelOnDisconnectType cancelOnDisconnectType = DO_NOT_CANCEL_ON_DISCONNECT_OR_TERMINATE;
private long codTimeoutWindow = DeltaInMillisEncoder.timeNullValue();
private static final OtfHeaderDecoder OTF_HEADER_DECODER = new OtfHeaderDecoder(
BinaryEntryPointProtocol.loadSbeIr().headerStructure());

public BinaryEntryPointClient(final int port, final TestSystem testSystem, final long serverAliveIntervalInMs)
throws IOException
Expand Down Expand Up @@ -331,9 +334,15 @@ private void print(final UnsafeBuffer unsafeReadBuffer, final String prefixStrin
{
if (DebugLogger.isEnabled(FIX_TEST))
{
final StringBuilder sb = new StringBuilder();
jsonPrinter.print(sb, unsafeReadBuffer, SOFH_LENGTH);
DebugLogger.log(FIX_TEST, prefixString, sb.toString());
// when templateId == 1000 the call to jsonPrinter.print throws an exception as it does not recognize
// this as a valid templateId
final int templateId = OTF_HEADER_DECODER.getTemplateId(unsafeReadBuffer, SOFH_LENGTH);
if (templateId != OUT_OF_RANGE_TEMPLATE_ID)
{
final StringBuilder sb = new StringBuilder();
jsonPrinter.print(sb, unsafeReadBuffer, SOFH_LENGTH);
DebugLogger.log(FIX_TEST, prefixString, sb.toString());
}
}
}

Expand Down Expand Up @@ -492,6 +501,7 @@ public void writeNewOrderSingle(final int clOrdId)

newOrderSingle
.clOrdID(clOrdId)
.selfTradePreventionInstruction(SelfTradePreventionInstruction.CANCEL_BOTH_ORDERS)
.securityID(SECURITY_ID)
.price().mantissa(3);
newOrderSingle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ private void assertTriggersCancelOnDisconnect(final long logoutTimeInNs)
assertEquals(onlySession.key(), result.context.key());
final long timeoutTakenInNs = result.timeInNs - logoutTimeInNs;
assertThat(timeoutTakenInNs, greaterThanOrEqualTo(codTimeoutInNs));
assertEquals(1, timeoutHandler.invokeCount());
testSystem.await("timeoutHandler.invokeCount() is not 1", () -> 1 == timeoutHandler.invokeCount());
}

class FakeTimeoutHandler implements FixPCancelOnDisconnectTimeoutHandler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -416,21 +416,28 @@ protected String resetGroup(final Entry entry)
" {\n" +
" for (final %2$s %6$s : %5$s.iterator())\n" +
" {\n" +
" %6$s.reset();\n" +
" if (%6$s.next() == null)\n" +
" {\n" +
" %6$s.reset();\n" +
" break;\n" +
" }\n" +
" else\n" +
" {\n" +
" %6$s.reset();\n" +
" }\n" +
" }\n" +
" %3$s = MISSING_INT;\n" +
" has%4$s = false;\n" +
" %7$s = null;\n" +
" }\n\n",
resetMethod,
decoderClassName(name),
formatPropertyName(numberField.name()),
numberField.name(),
iteratorFieldName(group),
formatPropertyName(decoderClassName(name)));
formatPropertyName(decoderClassName(name)),
formatPropertyName(name)
);
}
}

Expand Down Expand Up @@ -484,6 +491,9 @@ private String additionalReset(final boolean isGroup)
{
return
" buffer = null;\n" +
(isGroup ?
" next = null;\n" : ""
) +
" if (" + CODEC_VALIDATION_ENABLED + ")\n" +
" {\n" +
" invalidTagId = Decoder.NO_ERROR;\n" +
Expand Down Expand Up @@ -1925,7 +1935,12 @@ private String decodeGroup(final Entry entry)
" {\n" +
" invalidTagId = tag;\n" +
" rejectReason = %6$s;\n" +
" return position;\n" +
" while (%1$sCurrent != null) \n" +
" {\n" +
" position += %1$sCurrent.decode(buffer, position, end - position);\n" +
" %1$sCurrent = %1$sCurrent.next();\n" +
" }\n" +
" return position - offset;\n" +
" }\n" +
" }\n" +
" }\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<sbe:messageSchema xmlns:sbe="http://fixprotocol.io/2016/sbe"
package="uk.co.real_logic.artio.messages"
id="666"
version="25"
version="26"
semanticVersion="0.2"
description="Internal messaging format used by the FIX Gateway"
byteOrder="littleEndian">
Expand Down Expand Up @@ -499,6 +499,9 @@
description="notifies library instances that they have been timed out, added for monitoring purposes">
<field name="libraryId" id="1" type="LibraryId"/>
<field name="connectCorrelationId" id="2" type="CorrelationId"/>
<group name="sessions" id="3" dimensionType="groupSizeEncoding" sinceVersion="26">
<field name="sessionId" id="4" type="FixSessionId"/>
</group>
</sbe:message>

<sbe:message name="FollowerSessionReply" id="48"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public final class ExampleDictionary
{

public static final String NO_EG_GROUP = "NoEgGroup";
public static final String NO_NESTED_EG_GROUP = "NoNestedGroup";
public static final String NO_SECOND_EG_GROUP = "NoSecondEgGroup";
public static final String NO_ADMIN_EG_GROUP = "NoAdminEgGroup";
public static final String NO_COMPONENT_GROUP = "NoComponentGroup";
Expand Down Expand Up @@ -271,7 +272,7 @@ public final class ExampleDictionary
"8=FIX.4.4\0019=77\00135=0\001115=abc\001116=2\001117=1.1\001127=19700101-00:00:00.001" +
"\001120=2\001121=1\001122=2\001123=1\001123=2\001121=2\001122=2\001123=3\001123=4\00110=063\001";

public static final String MULTI_ENTRY_NESTED_GROUP_MESSAGE_WITHOUT_NESTED_FIELDS =
public static final String MULTI_ENTRY_EG_GROUP_MESSAGE_WITHOUT_NESTED_GROUPS =
"8=FIX.4.4\0019=77\00135=0\001115=abc\001116=2\001117=1.1\001127=19700101-00:00:00.001" +
"\001120=2\001121=1\001121=2\00110=063\001";

Expand Down Expand Up @@ -386,6 +387,10 @@ public final class ExampleDictionary
"8=FIX.4.4\0019=71\00135=0\001115=abc\001116=2\001117=1.1\001127=19700101-00:00:00.001" +
"\001120=2\001121=1\001121=2\00110=053\001";

public static final String REPEATING_GROUP_MESSAGE_WITH_THREE =
"8=FIX.4.4\0019=71\00135=0\001115=abc\001116=2\001117=1.1\001127=19700101-00:00:00.001" +
"\001120=3\001121=1\001121=1\001121=2\00110=053\001";

public static final String SINGLE_REPEATING_GROUP_MESSAGE =
"8=FIX.4.4\0019=65\00135=0\001115=abc\001116=2\001117=1.1\001127=19700101-00:00:00.001" +
"\001120=1\001121=2\00110=052\001";
Expand Down Expand Up @@ -479,6 +484,14 @@ public final class ExampleDictionary
"8=FIX.4.4\0019=71\00135=0\001115=abc\001116=2\001117=1.1\001127=19700101-00:00:00.001" +
"\001120=3\001121=1\001121=2\00110=053\001";

public static final String NESTED_REPEATING_GROUP_MESSAGE_WITH_TOO_LOW_NUMBER_FIELD =
"8=FIX.4.4\0019=77\00135=0\001115=abc\001116=2\001117=1.1\001127=19700101-00:00:00.001" +
"\001120=1\001121=1\001122=1\001123=1\001123=1\00110=063\001";

public static final String NESTED_REPEATING_GROUP_MESSAGE_WITH_TOO_HIGH_NUMBER_FIELD =
"8=FIX.4.4\0019=77\00135=0\001115=abc\001116=2\001117=1.1\001127=19700101-00:00:00.001" +
"\001120=1\001121=1\001122=2\001123=1\00110=063\001";

public static final String NON_EMPTY_OPTIONAL_COMPONENT_OF_REQUIRED_GROUP =
"8=FIX.4.4\0019=81\00135=OCRG\0012001=1\0012002=555-100-1234\00110=246\001";

Expand Down Expand Up @@ -570,7 +583,7 @@ private static Dictionary buildMessageExample()
final Field dayOfMonthField = registerField(messageEgFields, 129, "DayOfMonthField", Type.DAYOFMONTH);

final Group nestedGroup = Group.of(registerField(
messageEgFields, 122, "NoNestedGroup", INT), messageEgFields);
messageEgFields, 122, NO_NESTED_EG_GROUP, INT), messageEgFields);
nestedGroup.optionalEntry(registerField(messageEgFields, 123, "NestedField", INT));

final Group egGroup = Group.of(registerField(messageEgFields, 120, NO_EG_GROUP, INT), messageEgFields);
Expand Down
Loading

0 comments on commit 86efe84

Please sign in to comment.