Package org.axonframework.test.server
Class AxonServerContainerUtils
java.lang.Object
org.axonframework.test.server.AxonServerContainerUtils
Utility class for the
AxonServerContainer, used to initialize the cluster.- Since:
- 4.8.0
- Author:
- Milan Savic, Sara Pelligrini
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final booleanConstantbooleanspecifying that a context supports DCB.static final booleanConstantbooleanspecifying that a context does not support DCB. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionRetrieves all the contexts of the Axon Server instance located at the givenhostnameandportcombination.static voidcreateContext(String hostname, int port, String context, boolean dcbContext) Calls the API of Axon Server at the givenhostnameand (http)portto create a context with the givencontextname.static voiddeleteContext(String hostname, int port, String context) Calls the API of Axon Server at the givenhostnameand (http)portto delete the givencontext.static voidinitCluster(String hostname, int port, boolean shouldBeReused, boolean dcbContext) Initialize the cluster of the Axon Server instance located at the givenhostnameandportcombination.internalContexts(String hostname, int port) Retrieves all the internal contexts (registered in the RAFT protocol) of the Axon Server instance located at the givenhostnameandportcombination.static voidpurgeEventsFromAxonServer(String hostname, int port, String context, boolean dcbContext) Calls the API of Axon Server at givenhostnameand (http)portto purge events of the givencontext.
-
Field Details
-
DCB_CONTEXT
public static final boolean DCB_CONTEXTConstantbooleanspecifying that a context supports DCB.- See Also:
-
NO_DCB_CONTEXT
public static final boolean NO_DCB_CONTEXTConstantbooleanspecifying that a context does not support DCB.- See Also:
-
-
Constructor Details
-
AxonServerContainerUtils
public AxonServerContainerUtils()
-
-
Method Details
-
initCluster
public static void initCluster(String hostname, int port, boolean shouldBeReused, boolean dcbContext) throws IOException Initialize the cluster of the Axon Server instance located at the givenhostnameandportcombination.Note that this constructs the contexts
_adminanddefault.- Parameters:
hostname- The hostname of the Axon Server instance to initiate the cluster for.port- The port of the Axon Server instance to initiate the cluster for.shouldBeReused- If set totrue, ensure the cluster is not accidentally initialized twice.dcbContext- Abooleanstating whether a DCB or non-DCB context is being created.- Throws:
IOException- When there are issues with the HTTP connection to the Axon Server instance at the givenhostnameandport.
-
contexts
Retrieves all the contexts of the Axon Server instance located at the givenhostnameandportcombination.- Parameters:
hostname- The hostname of the Axon Server instance to create the givencontextof.port- The port of the Axon Server instance to create the givencontextof.- Returns:
- All the contexts of the Axon Server instances located at the given
hostnameandportcombination. - Throws:
IOException- When there are issues with the HTTP connection to the Axon Server instance at the givenhostnameandport.
-
internalContexts
Retrieves all the internal contexts (registered in the RAFT protocol) of the Axon Server instance located at the givenhostnameandportcombination.- Parameters:
hostname- The hostname of the Axon Server instance to create the givencontextof.port- The port of the Axon Server instance to create the givencontextof.- Returns:
- All the contexts of the Axon Server instances located at the given
hostnameandportcombination. - Throws:
IOException- When there are issues with the HTTP connection to the Axon Server instance at the givenhostnameandport.
-
purgeEventsFromAxonServer
public static void purgeEventsFromAxonServer(String hostname, int port, String context, boolean dcbContext) throws IOException Calls the API of Axon Server at givenhostnameand (http)portto purge events of the givencontext.- Parameters:
hostname- The hostname where AxonServer can be reached.port- The HTTP port AxonServer listens to for API calls.context- The context to purge.dcbContext- Abooleanstating whether a DCB or non-DCB context is being purged.- Throws:
IOException- When an error occurs communicating with Axon Server.- Since:
- 5.0.0
-
deleteContext
Calls the API of Axon Server at the givenhostnameand (http)portto delete the givencontext.- Parameters:
hostname- The hostname where Axon Server can be reached.port- The HTTP port Axon Server listens to for API calls.context- The context to delete.- Throws:
IOException- When an error occurs communicating with Axon Server.
-
createContext
public static void createContext(String hostname, int port, String context, boolean dcbContext) throws IOException Calls the API of Axon Server at the givenhostnameand (http)portto create a context with the givencontextname. ThedcbContextdictates whether the context to be created support DCB, yes or no.- Parameters:
hostname- The hostname where Axon Server can be reached.port- The HTTP port Axon Server listens to for API calls.context- The context to create.dcbContext- Abooleanstating whether a DCB or non-DCB context is being created.- Throws:
IOException- When an error occurs communicating with Axon Server.
-