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
Instances. One which runs the client, and one which runs a worker.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()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 suppliedModuleto the clientInstance.Installs the defaultClientto the workerInstance.withNodeModuleFactory(JeroMQEmbeddedWorkerInstanceContainer.NodeModuleFactory nodeModuleFactory) Specifies anJeroMQEmbeddedWorkerInstanceContainer.NodeModuleFactoryto use when creating newNodes in the worker instance.withSecurity(JeroMQSecurity jeroMQSecurity) Specifies an alternative security context.Configures theWorkerto use the UnixFS Storage system.Configures a workerInstance.withWorkerBindAddress(String workerBindAddress) Specifies theWorkerbind address.withWorkerModule(com.google.inject.Module module) Installs the suppliedModuleto 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, waitMethods 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 suppliedModuleto 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 suppliedModuleto 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 defaultClientto the workerInstance. If no worker instance was configured, this will implicitly configure a worker instance.- Returns:
- this instance
-
withWorkerBindAddress
Specifies theWorkerbind 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.NodeModuleFactoryto use when creating newNodes in the worker instance.- Parameters:
nodeModuleFactory- theJeroMQEmbeddedWorkerInstanceContainer.NodeModuleFactory- Returns:
- the this instance
-
withUnixFSWorker
Configures theWorkerto use the UnixFS Storage system.- Returns:
- this instance
-
start
Description copied from interface:EmbeddedTestServiceStarts theEmbeddedTestService.- Specified by:
startin interfaceEmbeddedTestService- Returns:
-
getClientOptional
Description copied from interface:EmbeddedTestServiceGets the clientOptional<EmbeddedInstanceContainer>. Is present only if configured.- Specified by:
getClientOptionalin interfaceEmbeddedTestService- Returns:
- the client
Optional<EmbeddedInstanceContainer>
-
getWorkerOptional
Description copied from interface:EmbeddedTestServiceGets the clientOptional<EmbeddedWorkerInstanceContainer>. Is present only if configured.- Specified by:
getWorkerOptionalin interfaceEmbeddedTestService- Returns:
- the client
Optional<EmbeddedWorkerInstanceContainer>
-
onClose
Description copied from interface:EmbeddedTestServiceSubscribes to an even that is fired when the service is closed.- Specified by:
onClosein interfaceEmbeddedTestService- Parameters:
consumer-- Returns:
-
close
public void close()Description copied from interface:EmbeddedTestServiceCloses the test service.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceEmbeddedTestService
-