Skip to content
This repository was archived by the owner on May 18, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
**/target
*.iml
**/.idea/*
.gradle
dist
build
1 change: 1 addition & 0 deletions .java-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
17
149 changes: 92 additions & 57 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,114 +1,149 @@
allprojects {
apply plugin: 'maven'
apply plugin: 'groovy'
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'signing'

group = 'org.fix4j'
version = '1.6'
version = '1.7'

java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
}

def deployUsername = hasProperty('ossrhUsername') ? ossrhUsername : 'not-given'
def deployPassword = hasProperty('ossrhPassword') ? ossrhPassword : 'not-given'
def deployUsername = providers.gradleProperty('ossrhUsername').orElse('not-given').get()
def deployPassword = providers.gradleProperty('ossrhPassword').orElse('not-given').get()

if (JavaVersion.current().isJava8Compatible()) {
allprojects {
tasks.withType(Javadoc) {
tasks.withType(Javadoc).configureEach {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
}

subprojects {
apply plugin: 'java'
sourceCompatibility = 1.8
targetCompatibility = 1.8

java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

tasks.withType(JavaCompile) {
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
options.release = 17
}

repositories {
mavenLocal()

maven { url "http://repo.maven.apache.org/maven2" }
maven { url "http://repo.marketcetera.org/maven" }
maven { url = uri("https://repo.maven.apache.org/maven2") }
maven { url = uri("https://repo.marketcetera.org/maven") }
}

dependencies {
compile group: 'org.slf4j', name: 'slf4j-log4j12', version: '1.3.0'
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.3.0'
testCompile group: 'junit', name: 'junit', version: '4.11'
testCompile "org.spockframework:spock-core:1.0-groovy-2.4"
// dependencies for using Spock
testCompile "org.hamcrest:hamcrest-core:1.3" // only necessary if Hamcrest matchers are used
testRuntime "cglib:cglib-nodep:3.1" // allows mocking of classes (in addition to interfaces)
testRuntime "org.objenesis:objenesis:2.1" // allows mocking of classes without default constructor (together with CGLIB)

implementation libs.slf4j.api
testImplementation libs.junit4
testImplementation libs.spock.core
testImplementation libs.hamcrest.core
testRuntimeOnly libs.cglib.nodep
testRuntimeOnly libs.objenesis
testRuntimeOnly libs.slf4j.simple
}

task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
testing {
suites {
test {
useJUnitJupiter()
}
}
}

task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
configurations.all {
exclude group: 'org.slf4j', module: 'slf4j-log4j12'
}

artifacts {
archives javadocJar, sourcesJar
tasks.register('javadocJar', Jar) {
archiveClassifier = 'javadoc'
from javadoc
}

signing {
required { gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
tasks.register('sourcesJar', Jar) {
archiveClassifier = 'sources'
from sourceSets.main.allSource
}

uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }

repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: deployUsername, password: deployPassword)
}

snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: deployUsername, password: deployPassword)
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact tasks.named('sourcesJar')
artifact tasks.named('javadocJar')

pom.withXml {
def dependenciesNode = asNode().get('dependencies')?.get(0)
if (dependenciesNode != null) {
dependenciesNode.children().removeAll { dep ->
dep.scope.text() == 'test'
}
}
}

pom.project {
name 'Fix4j Assert'
packaging 'jar'
artifactId project.name
description 'fix4j-assert is a library to assist in testing of applications using FIX protocol'
url 'http://www.fix4j.org'
pom {
name = 'Fix4j Assert'
packaging = 'jar'
artifactId = project.name
description = 'fix4j-assert is a library to assist in testing of applications using FIX protocol'
url = 'http://www.fix4j.org'

scm {
connection 'scm:git:git://github.com/tools4j/groovy-tables.git'
developerConnection 'scm:git:git@github.com:tools4j/fix4j-assert.git'
url 'https://github.com/tools4j/fix4j-assert'
connection = 'scm:git:git://github.com/tools4j/groovy-tables.git'
developerConnection = 'scm:git:git@github.com:tools4j/fix4j-assert.git'
url = 'https://github.com/tools4j/fix4j-assert'
}

licenses {
license {
name 'GNU General Public License (GPL)'
url 'http://www.gnu.org/licenses/gpl.txt'
name = 'GNU General Public License (GPL)'
url = 'http://www.gnu.org/licenses/gpl.txt'
}
}

developers {
developer {
id 'ben'
name 'Ben Warner'
email 'bjwarner@gmail.com'
id = 'ben'
name = 'Ben Warner'
email = 'bjwarner@gmail.com'
}
}
}
}
}

repositories {
maven {
def releasesRepoUrl = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
def snapshotsRepoUrl = uri("https://oss.sonatype.org/content/repositories/snapshots/")
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username = deployUsername
password = deployPassword
}
}
}
}

signing {
required = { gradle.taskGraph.hasTask("publish") }
sign publishing.publications.mavenJava
}

tasks.register('uploadArchives') {
dependsOn publish
group = 'upload'
description = 'Uploads all artifacts to Maven Central (redirects to publish task)'
}
}

31 changes: 28 additions & 3 deletions fix4j-assert-acceptance/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,32 @@
plugins {
id 'groovy'
}

description = ''
dependencies {
compile project(':fix4j-assert-core')
compile project(':fix4j-assert-all')
compile project(':fix4j-assert-testcommon')
implementation project(':fix4j-assert-core')
implementation project(':fix4j-assert-all')
implementation project(':fix4j-assert-testcommon')
implementation project(':fix4j-assert-fixspec-50sp2')
testImplementation libs.groovy.all
}

sourceSets {
test {
groovy {
srcDirs = ['src/test/groovy']
}
}
}

testing {
suites {
test {
useJUnitJupiter()
}
}
}

configurations.all {
exclude group: 'org.slf4j', module: 'slf4j-log4j12'
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,23 +65,21 @@ public class BlockingSessionTest extends Specification {
server.shutdown();
}

@Test
public void testClientSendsServerMessage() throws InterruptedException {
def "client sends server message"() {
when:
client.send(MARKET_DATA_REQUEST);
final FixMessage msg = server.getNextMessage();
client.send(MARKET_DATA_REQUEST)
def msg = server.getNextMessage()

then:
assertEquals(MsgTypes.MarketDataRequest, msg.getTypeOfMessage());
msg.getTypeOfMessage() == MsgTypes.MarketDataRequest
}

@Test
public void testServerSendsClientMessage() throws InterruptedException {
def "server sends client message"() {
when:
server.send(NEW_ORDER_SINGLE);
final FixMessage msg = client.getNextMessage();
server.send(NEW_ORDER_SINGLE)
def msg = client.getNextMessage()

then:
assertEquals(MsgTypes.NewOrderSingle, msg.getTypeOfMessage());
msg.getTypeOfMessage() == MsgTypes.NewOrderSingle
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -160,14 +160,14 @@ class OnFailureReportsTest extends Specification {
public void testRecentInboundMessages(){
when:
final FixMessage clientLogon = client.discardUntil(MsgTypes.Logon);
final FixMessage serverLogon = server.discardUntil(MsgTypes.Logon);
def serverLogon = server.discardUntil(MsgTypes.Logon);

client.send(newOrderSingle1);
client.send(newOrderSingle2);
client.send(marketDataRequest2);

final recievedNewOrderSingle1 = server.discardUntil(MsgTypes.NewOrderSingle);
final recievedNewOrderSingle2 = server.discardUntil(MsgTypes.NewOrderSingle);
def recievedNewOrderSingle1 = server.discardUntil(MsgTypes.NewOrderSingle);
def recievedNewOrderSingle2 = server.discardUntil(MsgTypes.NewOrderSingle);

//Cause a failure by waiting for a MarketDataRequest, but assert it contains a newOrderSingle tag
server.discardUntil(MsgTypes.MarketDataRequest, "[MsgType]35=D[NEWORDERSINGLE]");
Expand Down
28 changes: 18 additions & 10 deletions fix4j-assert-all/build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
plugins {
id 'java'
id 'maven-publish'
}

description = ''
dependencies {
compile project(':fix4j-assert-core')
compile project(':fix4j-assert-fixspec-50sp2')
compile project(':fix4j-assert-quickfix')
testCompile(group: 'junit', name: 'junit', version:'4.12') {
exclude(module: 'hamcrest-core')
}
testCompile group: 'org.hamcrest', name: 'hamcrest-core', version:'1.3'
testCompile group: 'org.hamcrest', name: 'hamcrest-library', version:'1.3'
testCompile(group: 'org.mockito', name: 'mockito-core', version:'2.0.31-beta') {
exclude(module: 'hamcrest-core')
implementation project(':fix4j-assert-core')
implementation project(':fix4j-assert-quickfix')
implementation project(':fix4j-assert-fixspec-50sp2')
testImplementation(libs.junit4) {
exclude(module: 'hamcrest-core')
}
testImplementation libs.hamcrest.core
}

sourceSets {
main {
java {
srcDir 'src/generated/java'
}
}
}
7 changes: 6 additions & 1 deletion fix4j-assert-codegen/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
plugins {
id 'groovy'
}

description = ''
dependencies {
compile group: 'org.codehaus.groovy', name: 'groovy-all', version:'2.3.8'
implementation libs.groovy
implementation libs.groovy.xml
implementation libs.groovy.templates
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ public class FieldTypeCreator {
def it = fields.values().iterator();
while(it.hasNext()){
def field = it.next();
final File parentDir = new File("fieldtype");
if(!parentDir.exists()) parentDir.mkdir();
final File file = new File("fieldtype/" + field.name + ".java");
def packagePath = packageName.replace('.', File.separator)
def outputDir = new File("src/generated/java/${packagePath}/fieldtype")
if(!outputDir.exists()) outputDir.mkdirs()
final File file = new File(outputDir, field.name + ".java")
file.write(createFieldTypeClassContent(packageName, field));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ public class FieldTypesEnumCreator {
def template = engine.createTemplate(reader).make(binding)

final String fieldTypeEnumContent = template.toString();
def fieldClassEnumFile = new File("FieldTypes.java")
def packagePath = packageName.replace('.', File.separator)
def outputDir = new File("src/generated/java/${packagePath}")
if (!outputDir.exists()) outputDir.mkdirs()
def fieldClassEnumFile = new File(outputDir, "FieldTypes.java")
fieldClassEnumFile.write(fieldTypeEnumContent)
println "Written FieldTypes.java to:" + fieldClassEnumFile.absolutePath;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ public class FixSpecificationClassCreator {
def template = engine.createTemplate(reader).make(binding)

final String fileContent = template.toString();
def file = new File("FixSpec.java")
def packagePath = packageName.replace('.', File.separator)
def outputDir = new File("src/generated/java/${packagePath}")
if (!outputDir.exists()) outputDir.mkdirs()
def file = new File(outputDir, "FixSpec.java")
file.write(fileContent)
println "Written FixSpec.java to:" + file.absolutePath;
}
Expand Down
Loading