java.lang.Object
io.debezium.testing.system.tools.databases.mongodb.sharded.OcpMongoReplicaSet
All Implemented Interfaces:
AutoCloseable, org.testcontainers.lifecycle.Startable

public class OcpMongoReplicaSet extends Object implements org.testcontainers.lifecycle.Startable
Mongo replica set. When started, member number 0 is set as primary, root user is created and optionally internal member auth is enabled
  • Field Details

    • LOGGER

      private static final org.slf4j.Logger LOGGER
    • name

      private final String name
    • configServer

      private final boolean configServer
    • memberCount

      private final int memberCount
    • authRequired

      private boolean authRequired
    • rootUserName

      private final String rootUserName
    • rootPassword

      private final String rootPassword
    • started

      private boolean started
    • ocp

      private final io.fabric8.openshift.client.OpenShiftClient ocp
    • ocpUtil

      private final OpenShiftUtils ocpUtil
    • project

      private final String project
    • useInternalAuth

      private final boolean useInternalAuth
    • shardNum

      private final int shardNum
    • members

      private final List<OcpMongoReplicaSetMember> members
  • Constructor Details

    • OcpMongoReplicaSet

      public OcpMongoReplicaSet(String name, boolean configServer, int memberCount, String rootUserName, String rootPassword, io.fabric8.openshift.client.OpenShiftClient ocp, String project, boolean useInternalAuth, int shardNum)
  • Method Details

    • getReplicaSetFullName

      public String getReplicaSetFullName()
    • start

      public void start()
      Specified by:
      start in interface org.testcontainers.lifecycle.Startable
    • stop

      public void stop()
      Specified by:
      stop in interface org.testcontainers.lifecycle.Startable
    • getName

      public String getName()
    • getShardNum

      public int getShardNum()
    • waitForStopped

      public void waitForStopped()
    • executeMongosh

      public OpenShiftUtils.CommandOutputs executeMongosh(String command, boolean debugLogs)
      execute mongosh command/script on node number 0 (member 0 should always be primary)
      Parameters:
      command -
      debugLogs - print command and outputs to log
      Returns:
      captured outputs from command execution
    • getLocalhostConnectionString

      private String getLocalhostConnectionString()
    • getPort

      private int getPort()
    • getInitRsCommand

      private String getInitRsCommand() throws IOException, freemarker.template.TemplateException
      Throws:
      IOException
      freemarker.template.TemplateException
    • getShardReplicaServiceName

      private String getShardReplicaServiceName(int replicaNum)
    • getConfigServerServiceName

      private String getConfigServerServiceName(int replicaNum)
    • builder