Class OcpMongoShardedController
java.lang.Object
io.debezium.testing.system.tools.databases.AbstractOcpDatabaseController<MongoDatabaseClient>
io.debezium.testing.system.tools.databases.mongodb.OcpMongoShardedController
- All Implemented Interfaces:
DatabaseController<MongoDatabaseClient>,MongoDatabaseController,PortForwardableDatabaseController
public class OcpMongoShardedController
extends AbstractOcpDatabaseController<MongoDatabaseClient>
implements MongoDatabaseController
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringprivate static final org.slf4j.LoggerFields inherited from class io.debezium.testing.system.tools.databases.AbstractOcpDatabaseController
deployment, name, ocp, ocpUtils, portForward, project, services -
Constructor Summary
ConstructorsConstructorDescriptionOcpMongoShardedController(io.fabric8.kubernetes.api.model.apps.Deployment deployment, List<io.fabric8.kubernetes.api.model.Service> services, io.fabric8.openshift.client.OpenShiftClient ocp) -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidexecuteCommandOnComponent(String componentName, String... commands) getDatabaseClient(String username, String password) Creates database client for database using given username and passwordgetDatabaseClient(String username, String password, String authSource) private String[]getShardInitCommand(int shardNum) private StringgetShardReplicaServiceName(int shardNum, int replicaNum) voidDatabase initialisationvoidreload()Reloads the database to initial statevoidremoveShard(int shardNumber, int rangeStart, int rangeEnd) private voiduploadAndExecuteMongoScript(String scriptLocation, String component, int port) Methods inherited from class io.debezium.testing.system.tools.databases.AbstractOcpDatabaseController
closeDatabasePortForwards, executeCommand, executeInitCommand, forwardDatabasePorts, getDatabaseHostname, getDatabasePort, getPublicDatabaseHostname, getPublicDatabasePortMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.debezium.testing.system.tools.databases.DatabaseController
getDatabaseHostname, getDatabasePort, getPublicDatabaseHostname, getPublicDatabasePort
-
Field Details
-
INIT_MONGOS_SCRIPT_LOCATION
- See Also:
-
CREATE_DBZ_USER_SCRIPT_LOCATION
- See Also:
-
LOGGER
private static final org.slf4j.Logger LOGGER
-
-
Constructor Details
-
OcpMongoShardedController
public OcpMongoShardedController(io.fabric8.kubernetes.api.model.apps.Deployment deployment, List<io.fabric8.kubernetes.api.model.Service> services, io.fabric8.openshift.client.OpenShiftClient ocp)
-
-
Method Details
-
getPublicDatabaseUrl
- Specified by:
getPublicDatabaseUrlin interfaceDatabaseController<MongoDatabaseClient>- Returns:
- publicly available connection url of the database
-
getDatabaseClient
Description copied from interface:DatabaseControllerCreates database client for database using given username and password- Specified by:
getDatabaseClientin interfaceDatabaseController<MongoDatabaseClient>- Parameters:
username- usernamepassword- password- Returns:
- database client
-
getDatabaseClient
- Specified by:
getDatabaseClientin interfaceMongoDatabaseController
-
reload
Description copied from interface:DatabaseControllerReloads the database to initial state- Specified by:
reloadin interfaceDatabaseController<MongoDatabaseClient>- Overrides:
reloadin classAbstractOcpDatabaseController<MongoDatabaseClient>- Throws:
InterruptedException- on timing issue
-
executeCommandOnComponent
public void executeCommandOnComponent(String componentName, String... commands) throws InterruptedException - Throws:
InterruptedException
-
initialize
Description copied from interface:DatabaseControllerDatabase initialisation- Specified by:
initializein interfaceDatabaseController<MongoDatabaseClient>- Overrides:
initializein classAbstractOcpDatabaseController<MongoDatabaseClient>- Throws:
InterruptedException- on timing issue
-
addShard
public void addShard(int shardNumber, String zoneName, int rangeStart, int rangeEnd) throws InterruptedException - Throws:
InterruptedException
-
removeShard
- Throws:
InterruptedException
-
uploadAndExecuteMongoScript
private void uploadAndExecuteMongoScript(String scriptLocation, String component, int port) throws InterruptedException - Throws:
InterruptedException
-
getShardInitCommand
-
getShardReplicaServiceName
-