Package de.mhus.lib.tests.docker
Class DockerScenario
- java.lang.Object
-
- de.mhus.lib.tests.docker.DockerScenario
-
public class DockerScenario extends Object
-
-
Constructor Summary
Constructors Constructor Description DockerScenario()DockerScenario(String prefix)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DockerScenarioadd(DockerContainer inst)DockerScenarioadd(String name, String image, String... params)LogStreamattach(LogStream stream, String send)LogStreamattach(String name, String send)intcnt()voidcreateNetwork()voiddestroy()Stop end remove the configured containers.voiddestroyNetwork(boolean forced)voiddestroyPrefix()Stop and remove all containers starting with the prefix.LogStreamexec(LogStream stream, String[] cmd, List<String> env, boolean privileges, String user, String dir, String send)LogStreamexec(String name, String cmd)LogStreamexec(String name, String[] cmd, List<String> env, boolean privileges, String user, String dir, String send)LogStreamexec(String name, String cmd, String send)LogStreamexec1(String name, String... cmd)DockerContainerget(String name)com.github.dockerjava.api.DockerClientgetClient()StringgetPrefix()voidinit()booleanisUseExistingNetwork()LogStreamlogs(LogStream stream, boolean follow, int tail)LogStreamlogs(String name, boolean follow, int tail)DockerScenariosetUseExistingNetwork(boolean useExistingNetwork)voidstart()booleanwaitForLog(long timeout, long sleep, LogStream logStream, Function<String,Boolean> check)voidwaitForLogEntry(LogStream logStream, String waitForString)voidwaitForLogEntry(String name, String waitForString, int tail)
-
-
-
Constructor Detail
-
DockerScenario
public DockerScenario()
-
DockerScenario
public DockerScenario(String prefix)
-
-
Method Detail
-
add
public DockerScenario add(String name, String image, String... params)
-
add
public DockerScenario add(DockerContainer inst)
-
get
public DockerContainer get(String name) throws de.mhus.lib.errors.NotFoundException
- Throws:
de.mhus.lib.errors.NotFoundException
-
init
public void init()
-
start
public void start() throws InterruptedException- Throws:
InterruptedException
-
createNetwork
public void createNetwork()
-
destroyNetwork
public void destroyNetwork(boolean forced)
-
destroyPrefix
public void destroyPrefix()
Stop and remove all containers starting with the prefix.
-
destroy
public void destroy()
Stop end remove the configured containers.
-
exec1
public LogStream exec1(String name, String... cmd) throws InterruptedException, de.mhus.lib.errors.NotFoundException
- Throws:
InterruptedExceptionde.mhus.lib.errors.NotFoundException
-
exec
public LogStream exec(String name, String cmd) throws InterruptedException, de.mhus.lib.errors.NotFoundException
- Throws:
InterruptedExceptionde.mhus.lib.errors.NotFoundException
-
exec
public LogStream exec(String name, String cmd, String send) throws InterruptedException, de.mhus.lib.errors.NotFoundException
- Throws:
InterruptedExceptionde.mhus.lib.errors.NotFoundException
-
exec
public LogStream exec(String name, String[] cmd, List<String> env, boolean privileges, String user, String dir, String send) throws InterruptedException, de.mhus.lib.errors.NotFoundException
- Throws:
InterruptedExceptionde.mhus.lib.errors.NotFoundException
-
exec
public LogStream exec(LogStream stream, String[] cmd, List<String> env, boolean privileges, String user, String dir, String send) throws InterruptedException, de.mhus.lib.errors.NotFoundException
- Throws:
InterruptedExceptionde.mhus.lib.errors.NotFoundException
-
attach
public LogStream attach(String name, String send) throws InterruptedException, de.mhus.lib.errors.NotFoundException
- Throws:
InterruptedExceptionde.mhus.lib.errors.NotFoundException
-
attach
public LogStream attach(LogStream stream, String send) throws InterruptedException, de.mhus.lib.errors.NotFoundException
- Throws:
InterruptedExceptionde.mhus.lib.errors.NotFoundException
-
logs
public LogStream logs(String name, boolean follow, int tail) throws de.mhus.lib.errors.NotFoundException
- Throws:
de.mhus.lib.errors.NotFoundException
-
logs
public LogStream logs(LogStream stream, boolean follow, int tail) throws de.mhus.lib.errors.NotFoundException
- Throws:
de.mhus.lib.errors.NotFoundException
-
waitForLogEntry
public void waitForLogEntry(String name, String waitForString, int tail) throws de.mhus.lib.errors.NotFoundException, IOException, InterruptedException
- Throws:
de.mhus.lib.errors.NotFoundExceptionIOExceptionInterruptedException
-
waitForLog
public boolean waitForLog(long timeout, long sleep, LogStream logStream, Function<String,Boolean> check) throws de.mhus.lib.errors.NotFoundException, IOException- Throws:
de.mhus.lib.errors.NotFoundExceptionIOException
-
waitForLogEntry
public void waitForLogEntry(LogStream logStream, String waitForString) throws de.mhus.lib.errors.NotFoundException, IOException
- Throws:
de.mhus.lib.errors.NotFoundExceptionIOException
-
getPrefix
public String getPrefix()
-
getClient
public com.github.dockerjava.api.DockerClient getClient()
-
isUseExistingNetwork
public boolean isUseExistingNetwork()
-
setUseExistingNetwork
public DockerScenario setUseExistingNetwork(boolean useExistingNetwork)
-
cnt
public int cnt()
-
-