Class AbstractCosmosDbJunit<T extends AbstractCosmosDbJunit<T>>
- java.lang.Object
-
- net.officefloor.nosql.cosmosdb.test.AbstractCosmosDbJunit<T>
-
- Direct Known Subclasses:
CosmosDbExtension
,CosmosDbRule
public abstract class AbstractCosmosDbJunit<T extends AbstractCosmosDbJunit<T>> extends java.lang.Object
Abstract JUnit CosmosDb functionality.- Author:
- Daniel Sagenschneider
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AbstractCosmosDbJunit.Configuration
Configuration of CosmosDb.
-
Field Summary
Fields Modifier and Type Field Description protected AbstractCosmosDbJunit.Configuration
configuration
protected com.azure.cosmos.CosmosAsyncClient
cosmosAsyncClient
CosmosAsyncClient
.protected com.azure.cosmos.CosmosClient
cosmosClient
CosmosClient
.static int
DEFAULT_LOCAL_COSMOS_PORT
Default local CosmosDb port.protected boolean
isWaitForCosmosDb
Flags to wait for CosmosDb to be available on start.
-
Constructor Summary
Constructors Constructor Description AbstractCosmosDbJunit()
Instantiate with defaultAbstractCosmosDbJunit.Configuration
.AbstractCosmosDbJunit(AbstractCosmosDbJunit.Configuration configuration)
Instantiate.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.azure.cosmos.CosmosAsyncClient
getCosmosAsyncClient()
Obtains theCosmosAsyncClient
.com.azure.cosmos.CosmosClient
getCosmosClient()
Obtains theCosmosClient
.java.lang.String
getEndpointUrl()
Obtains the end point URL.protected void
startCosmosDb()
Start CosmosDb locally.protected void
stopCosmosDb()
Stops locally running CosmosDb.T
waitForCosmosDb()
Sets up to wait on CosmosDB to be available.
-
-
-
Field Detail
-
DEFAULT_LOCAL_COSMOS_PORT
public static final int DEFAULT_LOCAL_COSMOS_PORT
Default local CosmosDb port.- See Also:
- Constant Field Values
-
configuration
protected final AbstractCosmosDbJunit.Configuration configuration
-
cosmosClient
protected com.azure.cosmos.CosmosClient cosmosClient
CosmosClient
.
-
cosmosAsyncClient
protected com.azure.cosmos.CosmosAsyncClient cosmosAsyncClient
CosmosAsyncClient
.
-
isWaitForCosmosDb
protected boolean isWaitForCosmosDb
Flags to wait for CosmosDb to be available on start.
-
-
Constructor Detail
-
AbstractCosmosDbJunit
public AbstractCosmosDbJunit()
Instantiate with defaultAbstractCosmosDbJunit.Configuration
.
-
AbstractCosmosDbJunit
public AbstractCosmosDbJunit(AbstractCosmosDbJunit.Configuration configuration)
Instantiate.- Parameters:
configuration
-AbstractCosmosDbJunit.Configuration
.
-
-
Method Detail
-
waitForCosmosDb
public T waitForCosmosDb()
Sets up to wait on CosmosDB to be available.- Returns:
this
.
-
getEndpointUrl
public java.lang.String getEndpointUrl()
Obtains the end point URL.- Returns:
- End point URL.
-
getCosmosClient
public com.azure.cosmos.CosmosClient getCosmosClient()
Obtains theCosmosClient
.- Returns:
CosmosClient
.
-
getCosmosAsyncClient
public com.azure.cosmos.CosmosAsyncClient getCosmosAsyncClient()
Obtains theCosmosAsyncClient
.- Returns:
CosmosAsyncClient
.
-
startCosmosDb
protected void startCosmosDb() throws java.lang.Exception
Start CosmosDb locally.- Throws:
java.lang.Exception
- If fails to start.
-
stopCosmosDb
protected void stopCosmosDb() throws java.lang.Exception
Stops locally running CosmosDb.- Throws:
java.lang.Exception
- If fails to stop.
-
-