Package dev.getelements.elements.test
Class JeroMQEmbeddedTestService
java.lang.Object
dev.getelements.elements.test.JeroMQEmbeddedTestService
- All Implemented Interfaces:
EmbeddedTestService
,AutoCloseable
Embeds a test kit which supplies two
Instance
s. One which runs the client, and one which runs a worker.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes the test service.Gets the clientOptional<EmbeddedInstanceContainer>
.Gets the clientOptional<EmbeddedWorkerInstanceContainer>
.onClose
(Consumer<? super EmbeddedTestService> consumer) Subscribes to an even that is fired when the service is closed.start()
Starts theEmbeddedTestService
.Adds a randomly-assignedwithApplicationNode
(ApplicationId applicationId) Begins specialized configuration for an application with the specifiedApplicationId
.withApplicationNode
(String uniqueName) Begins specialized configuration for an application with the specified unique name.Configures a clientInstance
.withClientModule
(com.google.inject.Module module) Installs the suppliedModule
to the clientInstance
.Installs the defaultClient
to the workerInstance
.withNodeModuleFactory
(JeroMQEmbeddedWorkerInstanceContainer.NodeModuleFactory nodeModuleFactory) Specifies anJeroMQEmbeddedWorkerInstanceContainer.NodeModuleFactory
to use when creating newNode
s in the worker instance.withSecurity
(JeroMQSecurity jeroMQSecurity) Specifies an alternative security context.Configures theWorker
to use the UnixFS Storage system.Configures a workerInstance
.withWorkerBindAddress
(String workerBindAddress) Specifies theWorker
bind address.withWorkerModule
(com.google.inject.Module module) Installs the suppliedModule
to the workerInstance
.withZContext
(org.zeromq.ZContext zContext) Specifies an alternative ZContext.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface dev.getelements.elements.test.EmbeddedTestService
getClient, getClientIocResolver, getIocResolver, getWorker
-
Constructor Details
-
JeroMQEmbeddedTestService
public JeroMQEmbeddedTestService()
-
-
Method Details
-
withClient
Configures a clientInstance
.- Returns:
- this instance
-
withWorker
Configures a workerInstance
.- Returns:
- this instance
-
withZContext
Specifies an alternative ZContext.- Parameters:
zContext
- a zContext- Returns:
-
withSecurity
Specifies an alternative security context.- Parameters:
jeroMQSecurity
-- Returns:
-
withWorkerModule
Installs the suppliedModule
to the workerInstance
. If no worker instance was configured, this will implicitly configure a worker instance.- Parameters:
module
- the module- Returns:
- this instance
-
withClientModule
Installs the suppliedModule
to the clientInstance
. If no client instance was configured, this will implicitly configure a client instance.- Parameters:
module
- the module- Returns:
- this instance
-
withDefaultHttpClient
Installs the defaultClient
to the workerInstance
. If no worker instance was configured, this will implicitly configure a worker instance.- Returns:
- this instance
-
withWorkerBindAddress
Specifies theWorker
bind address.- Parameters:
workerBindAddress
- the bind address for the worker- Returns:
- this instance
-
withApplicationNode
public JeroMQEmbeddedWorkerInstanceContainer.ApplicationNodeBuilder<JeroMQEmbeddedTestService> withApplicationNode()Adds a randomly-assigned- Returns:
-
withApplicationNode
public JeroMQEmbeddedWorkerInstanceContainer.ApplicationNodeBuilder<JeroMQEmbeddedTestService> withApplicationNode(String uniqueName) Begins specialized configuration for an application with the specified unique name.- Parameters:
uniqueName
- the application unique name- Returns:
- a new instance of
JeroMQEmbeddedWorkerInstanceContainer.ApplicationNodeBuilder
-
withApplicationNode
public JeroMQEmbeddedWorkerInstanceContainer.ApplicationNodeBuilder<JeroMQEmbeddedTestService> withApplicationNode(ApplicationId applicationId) Begins specialized configuration for an application with the specifiedApplicationId
.- Parameters:
applicationId
- the anApplicationId
- Returns:
- a new instance of
JeroMQEmbeddedWorkerInstanceContainer.ApplicationNodeBuilder
-
withNodeModuleFactory
public JeroMQEmbeddedTestService withNodeModuleFactory(JeroMQEmbeddedWorkerInstanceContainer.NodeModuleFactory nodeModuleFactory) Specifies anJeroMQEmbeddedWorkerInstanceContainer.NodeModuleFactory
to use when creating newNode
s in the worker instance.- Parameters:
nodeModuleFactory
- theJeroMQEmbeddedWorkerInstanceContainer.NodeModuleFactory
- Returns:
- the this instance
-
withUnixFSWorker
Configures theWorker
to use the UnixFS Storage system.- Returns:
- this instance
-
start
Description copied from interface:EmbeddedTestService
Starts theEmbeddedTestService
.- Specified by:
start
in interfaceEmbeddedTestService
- Returns:
-
getClientOptional
Description copied from interface:EmbeddedTestService
Gets the clientOptional<EmbeddedInstanceContainer>
. Is present only if configured.- Specified by:
getClientOptional
in interfaceEmbeddedTestService
- Returns:
- the client
Optional<EmbeddedInstanceContainer>
-
getWorkerOptional
Description copied from interface:EmbeddedTestService
Gets the clientOptional<EmbeddedWorkerInstanceContainer>
. Is present only if configured.- Specified by:
getWorkerOptional
in interfaceEmbeddedTestService
- Returns:
- the client
Optional<EmbeddedWorkerInstanceContainer>
-
onClose
Description copied from interface:EmbeddedTestService
Subscribes to an even that is fired when the service is closed.- Specified by:
onClose
in interfaceEmbeddedTestService
- Parameters:
consumer
-- Returns:
-
close
public void close()Description copied from interface:EmbeddedTestService
Closes the test service.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceEmbeddedTestService
-