org.testcontainers.dockerclient.LogToStringContainerCallback Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of testcontainers Show documentation
Show all versions of testcontainers Show documentation
Isolated container management for Java code testing
package org.testcontainers.dockerclient;
import com.github.dockerjava.api.async.ResultCallback;
import com.github.dockerjava.api.model.Frame;
/**
*
* @deprecated use {@link ResultCallback.Adapter}
*/
@Deprecated
public class LogToStringContainerCallback extends ResultCallback.Adapter {
private final StringBuffer log = new StringBuffer();
@Override
public void onNext(Frame frame) {
log.append(new String(frame.getPayload()));
}
@Override
public String toString() {
try {
awaitCompletion();
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
return log.toString();
}
}