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.ObjectAbstract JUnit CosmosDb functionality.- Author:
- Daniel Sagenschneider
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAbstractCosmosDbJunit.ConfigurationConfiguration of CosmosDb.
-
Field Summary
Fields Modifier and Type Field Description protected AbstractCosmosDbJunit.Configurationconfigurationprotected com.azure.cosmos.CosmosAsyncClientcosmosAsyncClientCosmosAsyncClient.protected com.azure.cosmos.CosmosClientcosmosClientCosmosClient.static intDEFAULT_LOCAL_COSMOS_PORTDefault local CosmosDb port.protected booleanisWaitForCosmosDbFlags 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.CosmosAsyncClientgetCosmosAsyncClient()Obtains theCosmosAsyncClient.com.azure.cosmos.CosmosClientgetCosmosClient()Obtains theCosmosClient.java.lang.StringgetEndpointUrl()Obtains the end point URL.protected voidstartCosmosDb()Start CosmosDb locally.protected voidstopCosmosDb()Stops locally running CosmosDb.TwaitForCosmosDb()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.ExceptionStart CosmosDb locally.- Throws:
java.lang.Exception- If fails to start.
-
stopCosmosDb
protected void stopCosmosDb() throws java.lang.ExceptionStops locally running CosmosDb.- Throws:
java.lang.Exception- If fails to stop.
-
-