Package org.hobbit.core.components.test
Class InMemoryEvaluationStore
java.lang.Object
org.hobbit.core.components.AbstractComponent
org.hobbit.core.components.AbstractCommandReceivingComponent
org.hobbit.core.components.AbstractPlatformConnectorComponent
org.hobbit.core.components.AbstractEvaluationStorage
org.hobbit.core.components.test.InMemoryEvaluationStore
- All Implemented Interfaces:
Closeable,AutoCloseable,CommandReceivingComponent,Component,ExpectedResponseReceivingComponent,PlatformConnector,ResponseReceivingComponent
Simple in-memory implementation of an evaluation storage that can be used for
testing purposes.
- Author:
- Michael Röder (roeder@informatik.uni-leipzig.de)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA simple structure implementing theResultinterfacestatic classA simple structure implementing theResultPairinterface. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Map<String,ResultPair> Map containing a mapping from task Ids to result pairs.Fields inherited from class org.hobbit.core.components.AbstractEvaluationStorage
ackChannel, evalModule2EvalStoreQueue, NEW_ITERATOR_ID, RECEIVE_TIMESTAMP_FOR_SYSTEM_RESULTS_KEY, resultPairIterators, systemResultReceiver, taskResultReceiverFields inherited from class org.hobbit.core.components.AbstractCommandReceivingComponent
cmdChannel, cmdQueueFactory, cmdResponseTimeout, DEFAULT_CMD_RESPONSE_TIMEOUT, defaultContainerType, gson, reportUnhandledExceptionsFields inherited from class org.hobbit.core.components.AbstractComponent
configuration, connectionFactory, incomingDataQueueFactory, NUMBER_OF_RETRIES_TO_CONNECT_TO_RABBIT_MQ, outgoingDataQueuefactory, rabbitMQHostName, START_WAITING_TIME_BEFORE_RETRY -
Constructor Summary
ConstructorsConstructorDescriptionConstructor.InMemoryEvaluationStore(HobbitConfiguration configuration) Constructor to assign configuration object. -
Method Summary
Modifier and TypeMethodDescriptionprotected Iterator<ResultPair>Creates a new iterator that iterates over the response pairs.voidAdds the given result to the map of results.voidreceiveExpectedResponseData(String taskId, long timestamp, byte[] data) This method is called if an expected response is received from a task generator component.voidreceiveResponseData(String taskId, long timestamp, byte[] data) This method is called if a response is received from the system.Methods inherited from class org.hobbit.core.components.AbstractEvaluationStorage
close, init, receiveCommand, runMethods inherited from class org.hobbit.core.components.AbstractPlatformConnectorComponent
addContainerObserver, createContainer, getFactoryForIncomingCmdQueues, getFactoryForIncomingDataQueues, getFactoryForOutgoingCmdQueues, getFactoryForOutgoingDataQueues, stopContainerMethods inherited from class org.hobbit.core.components.AbstractCommandReceivingComponent
addCommandHeaderId, createContainer, createContainer, createContainer, createContainerAsync, createContainerAsync, extendContainerEnvVariables, getCmdResponseTimeout, handleCmd, handleCmd, isReportUnhandledExceptions, reportAndWrap, reportError, reportErrorSavely, reportExceptionSavely, reportUnhandledExceptionSavely, sendToCmdQueue, sendToCmdQueue, sendToCmdQueue, setCmdResponseTimeout, setReportUnhandledExceptionsMethods inherited from class org.hobbit.core.components.AbstractComponent
createConnection, generateSessionQueueName, getConfiguration, getHobbitSessionId, setConfigurationMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.hobbit.core.components.Component
setConfiguration
-
Field Details
-
results
Map containing a mapping from task Ids to result pairs.
-
-
Constructor Details
-
InMemoryEvaluationStore
public InMemoryEvaluationStore()Constructor. -
InMemoryEvaluationStore
Constructor to assign configuration object.
-
-
Method Details
-
receiveResponseData
Description copied from interface:ResponseReceivingComponentThis method is called if a response is received from the system.- Parameters:
taskId- the id of the tasktimestamp- the time at which the response has been received from the systemdata- the data received from a data generator
-
receiveExpectedResponseData
Description copied from interface:ExpectedResponseReceivingComponentThis method is called if an expected response is received from a task generator component.- Parameters:
taskId- the id of the tasktimestamp- the time at which the task has been sent to the systemdata- the data received from a task generator
-
putResult
Adds the given result to the map of results.- Parameters:
isExpectedResult- true if the result has been received from a task generator, i.e., is the expected result for a tasktaskId- id of the tasktimestamp- time stamp for the task resultdata- the result
-
createIterator
Description copied from class:AbstractEvaluationStorageCreates a new iterator that iterates over the response pairs.- Specified by:
createIteratorin classAbstractEvaluationStorage- Returns:
- a new iterator or null if an error occurred
-