@@ -4,10 +4,10 @@ import (
44 "fmt"
55 "os"
66 "path"
7+ "strings"
78 "testing"
89 "time"
910
10- "github.com/quickfixgo/quickfix/config"
1111 "github.com/stretchr/testify/require"
1212 "github.com/stretchr/testify/suite"
1313)
@@ -19,11 +19,23 @@ type FileStoreTestSuite struct {
1919}
2020
2121func (suite * FileStoreTestSuite ) SetupTest () {
22- var err error
23- settings := NewSessionSettings ()
2422 suite .fileStoreRootPath = path .Join (os .TempDir (), fmt .Sprintf ("FileStoreTestSuite-%d" , os .Getpid ()))
25- settings .Set (config .FileStorePath , path .Join (suite .fileStoreRootPath , fmt .Sprintf ("%d" , time .Now ().UnixNano ())))
26- suite .msgStore , err = NewFileStoreFactory (settings ).Create (SessionID {BeginString : "FIX.4.4" , SenderCompID : "SENDER" , TargetCompID : "TARGET" })
23+ fileStorePath := path .Join (suite .fileStoreRootPath , fmt .Sprintf ("%d" , time .Now ().UnixNano ()))
24+ sessionID := SessionID {BeginString : "FIX.4.4" , SenderCompID : "SENDER" , TargetCompID : "TARGET" }
25+
26+ // create settings
27+ settings , err := ParseSettings (strings .NewReader (fmt .Sprintf (`
28+ [DEFAULT]
29+ FileStorePath=%s
30+
31+ [SESSION]
32+ BeginString=%s
33+ SenderCompID=%s
34+ TargetCompID=%s` , fileStorePath , sessionID .BeginString , sessionID .SenderCompID , sessionID .TargetCompID )))
35+ require .Nil (suite .T (), err )
36+
37+ // create store
38+ suite .msgStore , err = NewFileStoreFactory (settings ).Create (sessionID )
2739 require .Nil (suite .T (), err )
2840}
2941
0 commit comments