All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.playtika.testcontainer.mongodb.MongodbStatusCheck Maven / Gradle / Ivy

There is a newer version: 3.1.9
Show newest version
package com.playtika.testcontainer.mongodb;

import com.playtika.testcontainer.common.checks.AbstractCommandWaitStrategy;
import lombok.RequiredArgsConstructor;

@RequiredArgsConstructor
public class MongodbStatusCheck extends AbstractCommandWaitStrategy {
    private static final String COMMAND = "\"db['system.version'].find()\"";
    private final MongodbProperties properties;

    @Override
    public String[] getCheckCommand() {
        if (properties.getUsername() == null) {
            return new String[]{properties.getShell(), "--eval", COMMAND};
        }

        return new String[]{
                properties.getShell(), "admin",
                "-u", properties.getUsername(),
                "-p", properties.getPassword(),
                "--eval", COMMAND
        };
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy