@@ -117,43 +117,6 @@ public DockerHelper(NlogLogger logger, TestingContext testingContext)
117117
118118 #endregion
119119
120- private async Task LoadEventStoreProjections ( )
121- {
122- //Start our Continous Projections - we might decide to do this at a different stage, but now lets try here
123- String projectionsFolder = "../../../projections/continuous" ;
124- IPAddress [ ] ipAddresses = Dns . GetHostAddresses ( "127.0.0.1" ) ;
125-
126- if ( ! String . IsNullOrWhiteSpace ( projectionsFolder ) )
127- {
128- DirectoryInfo di = new DirectoryInfo ( projectionsFolder ) ;
129-
130- if ( di . Exists )
131- {
132- FileInfo [ ] files = di . GetFiles ( ) ;
133-
134- EventStoreProjectionManagementClient projectionClient = new EventStoreProjectionManagementClient ( ConfigureEventStoreSettings ( this . EventStoreHttpPort ) ) ;
135-
136- foreach ( FileInfo file in files )
137- {
138- String projection = File . ReadAllText ( file . FullName ) ;
139- String projectionName = file . Name . Replace ( ".js" , String . Empty ) ;
140-
141- try
142- {
143- Logger . LogInformation ( $ "Creating projection [{ projectionName } ]") ;
144- await projectionClient . CreateContinuousAsync ( projectionName , projection , trackEmittedStreams : true ) . ConfigureAwait ( false ) ;
145- }
146- catch ( Exception e )
147- {
148- Logger . LogError ( new Exception ( $ "Projection [{ projectionName } ] error", e ) ) ;
149- }
150- }
151- }
152- }
153-
154- Logger . LogInformation ( "Loaded projections" ) ;
155- }
156-
157120 #region Methods
158121
159122 public String FileProcessorContainerName ;
@@ -318,7 +281,7 @@ public override async Task StartContainersForScenarioRun(String scenarioName)
318281 this . EstateReportingClient = new EstateReportingClient ( EstateReportingBaseAddressResolver , httpClient ) ;
319282 this . FileProcessorClient = new FileProcessorClient ( FileProcessorBaseAddressResolver , httpClient ) ;
320283
321- await this . LoadEventStoreProjections ( ) . ConfigureAwait ( false ) ;
284+ await this . LoadEventStoreProjections ( this . EventStoreHttpPort ) . ConfigureAwait ( false ) ;
322285 }
323286
324287 public const Int32 FileProcessorDockerPort = 5009 ;
@@ -380,13 +343,12 @@ private IContainerService SetupFileProcessorContainer(String imageName,
380343
381344 public async Task PopulateSubscriptionServiceConfiguration ( String estateName )
382345 {
383- EventStorePersistentSubscriptionsClient client =
384- new EventStorePersistentSubscriptionsClient ( DockerHelper . ConfigureEventStoreSettings ( this . EventStoreHttpPort ) ) ;
385-
386- PersistentSubscriptionSettings settings = new PersistentSubscriptionSettings ( resolveLinkTos : true , StreamPosition . Start ) ;
387- await client . CreateAsync ( estateName . Replace ( " " , "" ) , "Reporting" , settings ) ;
388- await client . CreateAsync ( $ "EstateManagementSubscriptionStream_{ estateName . Replace ( " " , "" ) } ", "Estate Management" , settings ) ;
389- await client . CreateAsync ( $ "FileProcessorSubscriptionStream_{ ReplaceFirst ( estateName , " " , "" ) } ", "File Processor" , settings ) ;
346+ var name = estateName . Replace ( " " , "" ) ;
347+ List < ( string streamName , string groupName ) > subscriptions = new List < ( String , String ) > ( ) ;
348+ subscriptions . Add ( ( name , "Reporting" ) ) ;
349+ subscriptions . Add ( ( $ "EstateManagementSubscriptionStream_{ name } ", "Estate Management" ) ) ;
350+ subscriptions . Add ( ( $ "FileProcessorSubscriptionStream_{ name } ", "File Processor" ) ) ;
351+ await this . PopulateSubscriptionServiceConfiguration ( this . EventStoreHttpPort , subscriptions ) ;
390352 }
391353
392354 public string ReplaceFirst ( string text , string search , string replace )
@@ -398,32 +360,6 @@ public string ReplaceFirst(string text, string search, string replace)
398360 }
399361 return text . Substring ( 0 , pos ) + replace + text . Substring ( pos + search . Length ) ;
400362 }
401-
402- private static EventStoreClientSettings ConfigureEventStoreSettings ( Int32 eventStoreHttpPort )
403- {
404- String connectionString = $ "http://127.0.0.1:{ eventStoreHttpPort } ";
405-
406- EventStoreClientSettings settings = new EventStoreClientSettings ( ) ;
407- settings . CreateHttpMessageHandler = ( ) => new SocketsHttpHandler
408- {
409- SslOptions =
410- {
411- RemoteCertificateValidationCallback = ( sender ,
412- certificate ,
413- chain ,
414- errors ) => true ,
415- }
416- } ;
417- settings . ConnectionName = "Specflow" ;
418- settings . ConnectivitySettings = new EventStoreClientConnectivitySettings
419- {
420- Insecure = true ,
421- Address = new Uri ( connectionString ) ,
422- } ;
423-
424- settings . DefaultCredentials = new UserCredentials ( "admin" , "changeit" ) ;
425- return settings ;
426- }
427363
428364 private async Task RemoveEstateReadModel ( )
429365 {
0 commit comments