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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
**/target
*.iml
**/.idea/*
**/build
*/src/generated
Copy link
Member

@terzerm terzerm Feb 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we actually should generate into the build folder, not src

.gradle
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ subprojects {
repositories {
mavenLocal()

maven { url "http://repo.maven.apache.org/maven2" }
maven { url "https://repo.maven.apache.org/maven2" }
maven { url "http://repo.marketcetera.org/maven" }
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.fix4j.test.properties.ApplicationProperties;
import org.fix4j.test.session.AbstractContextFactory;

import java.util.Collections;
import java.util.Map;
import java.util.Properties;

Expand All @@ -17,12 +18,22 @@
*/
public class DefaultContextFactory extends AbstractContextFactory {

private final ApplicationProperties properties;
private final Map<String, String> additionalQuickFixProperties;

public DefaultContextFactory() {
this(ApplicationProperties.Singleton.instance(), Collections.emptyMap());
}

public DefaultContextFactory(final ApplicationProperties properties,
final Map<String, String> additionalQuickFixProperties) {
super(FixSpec.INSTANCE);
this.properties = properties;
this.additionalQuickFixProperties = additionalQuickFixProperties;
}

@Override
protected FixEngineSessionFactory createFixEngineSessionFactory(final FixSpecification fixSpecification) {
return new QuickFixTestSessionFactory(fixSpecification);
return new QuickFixTestSessionFactory(fixSpecification, properties, additionalQuickFixProperties);
}
}
4 changes: 3 additions & 1 deletion fix4j-assert-fixspec-50sp2/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ task genMain( type: JavaExec ) {
classpath = sourceSets.codegen.runtimeClasspath
args = ['/FIX50SP2.xml', 'org.fix4j.spec.fix50sp2']
final File javaWorkingDir = new File("${projectDir}/src/generated/java/org/fix4j/spec/fix50sp2/")
javaWorkingDir.mkdirs()
workingDir = javaWorkingDir.absolutePath
doFirst {
javaWorkingDir.mkdirs()
}
}

clean.doFirst {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ public enum QuickFixProperties implements Keyable<String> {
ALLOW_UNKNOWN_MSG_FIELDS("fix4j.quickfix.allow.unknown.msg.fields"),
VALIDATE_FIELDS_OUT_OF_ORDER("fix4j.quickfix.validate.fields.out.of.order"),
VALIDATE_FIELDS_HAVE_VALUES("fix4j.quickfix.validate.fields.have.values"),
VALIDATE_USER_DEFINED_FIELDS("fix4j.quickfix.validate.user.defined.fields");
VALIDATE_USER_DEFINED_FIELDS("fix4j.quickfix.validate.user.defined.fields"),
RESET_ON_LOGON("fix4j.quickfix.reset.on.logon");

private final String key;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,24 @@
import quickfix.SocketAcceptor;
import quickfix.SocketInitiator;

import java.util.Map;

/**
* User: ben
* Date: 20/08/2014
* Time: 5:44 PM
*/
public class QuickFixTestSessionFactory implements FixEngineSessionFactory {
private final FixSpecification fixSpecification;
private final ApplicationProperties properties;
private final Map additionalQuickFixProperties;

public QuickFixTestSessionFactory(final FixSpecification fixSpecification) {
public QuickFixTestSessionFactory(final FixSpecification fixSpecification,
final ApplicationProperties properties,
final Map additionalQuickFixProperties) {
this.fixSpecification = fixSpecification;
this.properties = properties;
this.additionalQuickFixProperties = additionalQuickFixProperties;
Copy link
Member

@terzerm terzerm Feb 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

null checks here (for all 3 actually)

}

@Override
Expand All @@ -39,7 +47,6 @@ public FixEngineSession createSession(final FixSessionId sessionId, final FixCon

private Connector create(final SessionID quickfixSessionId, final QuickFixApplication app, final FixConnectionMode fixConnectionMode){
try {
final ApplicationProperties properties = ApplicationProperties.Singleton.instance();
final SessionSettings settings = new SessionSettings();
settings.setString("ConnectionType", (fixConnectionMode == FixConnectionMode.INITIATOR ? "initiator": "acceptor"));
settings.setString("SenderCompID", quickfixSessionId.getSenderCompID());
Expand All @@ -55,6 +62,8 @@ private Connector create(final SessionID quickfixSessionId, final QuickFixApplic
settings.setString("ValidateFieldsOutOfOrder", properties.getAsString(QuickFixProperties.VALIDATE_FIELDS_OUT_OF_ORDER, "N"));
settings.setString("ValidateFieldsHaveValues", properties.getAsString(QuickFixProperties.VALIDATE_FIELDS_HAVE_VALUES, "N"));
settings.setString("ValidateUserDefinedFields", properties.getAsString(QuickFixProperties.VALIDATE_USER_DEFINED_FIELDS, "N"));
settings.setString("ResetOnLogon", properties.getAsString(QuickFixProperties.RESET_ON_LOGON, "N"));
settings.set(additionalQuickFixProperties);

if(fixConnectionMode == FixConnectionMode.INITIATOR) {
settings.setString(quickfixSessionId, "SocketConnectPort", properties.getAsString(QuickFixProperties.SOCKET_CONNECT_PORT, "9880"));
Expand Down