<commit_before>package org.kurento.test.browser;

import static org.kurento.commons.PropertiesManager.getProperty;
import static org.kurento.test.TestConfiguration.DOCKER_HUB_CONTAINER_NAME_DEFAULT;
import static org.kurento.test.TestConfiguration.DOCKER_HUB_CONTAINER_NAME_PROPERTY;
import static org.kurento.test.TestConfiguration.DOCKER_HUB_IMAGE_DEFAULT;
import static org.kurento.test.TestConfiguration.DOCKER_HUB_IMAGE_PROPERTY;
import static org.kurento.test.TestConfiguration.DOCKER_NODE_CHROME_DEBUG_IMAGE_DEFAULT;
import static org.kurento.test.TestConfiguration.DOCKER_NODE_CHROME_DEBUG_IMAGE_PROPERTY;
import static org.kurento.test.TestConfiguration.DOCKER_NODE_CHROME_IMAGE_DEFAULT;
import static org.kurento.test.TestConfiguration.DOCKER_NODE_CHROME_IMAGE_PROPERTY;
import static org.kurento.test.TestConfiguration.DOCKER_NODE_FIREFOX_DEBUG_IMAGE_DEFAULT;
import static org.kurento.test.TestConfiguration.DOCKER_NODE_FIREFOX_DEBUG_IMAGE_PROPERTY;
import static org.kurento.test.TestConfiguration.DOCKER_NODE_FIREFOX_IMAGE_DEFAULT;
import static org.kurento.test.TestConfiguration.DOCKER_NODE_FIREFOX_IMAGE_PROPERTY;
import static org.kurento.test.TestConfiguration.DOCKER_VNCRECORDER_CONTAINER_NAME_DEFAULT;
import static org.kurento.test.TestConfiguration.DOCKER_VNCRECORDER_CONTAINER_NAME_PROPERTY;
import static org.kurento.test.TestConfiguration.DOCKER_VNCRECORDER_IMAGE_DEFAULT;
import static org.kurento.test.TestConfiguration.DOCKER_VNCRECORDER_IMAGE_PROPERTY;
import static org.kurento.test.TestConfiguration.SELENIUM_MAX_DRIVER_ERROR_DEFAULT;
import static org.kurento.test.TestConfiguration.SELENIUM_MAX_DRIVER_ERROR_PROPERTY;
import static org.kurento.test.TestConfiguration.SELENIUM_RECORD_DEFAULT;
import static org.kurento.test.TestConfiguration.SELENIUM_RECORD_PROPERTY;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicInteger;

import org.kurento.commons.exception.KurentoException;
import org.kurento.commons.net.RemoteService;
import org.kurento.test.base.KurentoClientWebPageTest;
import org.kurento.test.docker.Docker;
import org.kurento.test.services.KurentoServicesTestHelper;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.remote.SessionId;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.github.dockerjava.api.command.CreateContainerCmd;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonObject;

public class DockerBrowserManager {

	public static final int REMOTE_WEB_DRIVER_CREATION_MAX_RETRIES = 3;
	private static final int REMOTE_WEB_DRIVER_CREATION_TIMEOUT_S = 10;

	private static final int HUB_CREATION_WAIT_POOL_TIME_MS = 1000;
	private static final int HUB_CREATION_TIMEOUT_MS = 30000;

	private static Logger log = LoggerFactory
			.getLogger(DockerBrowserManager.class);

	private class DockerBrowser {
<commit_msg>[kurento-test] Increase remote webdriver creation timeout to 20 seconds<commit_after>package org.kurento.test.browser;

import static org.kurento.commons.PropertiesManager.getProperty;
import static org.kurento.test.TestConfiguration.DOCKER_HUB_CONTAINER_NAME_DEFAULT;
import static org.kurento.test.TestConfiguration.DOCKER_HUB_CONTAINER_NAME_PROPERTY;
import static org.kurento.test.TestConfiguration.DOCKER_HUB_IMAGE_DEFAULT;
import static org.kurento.test.TestConfiguration.DOCKER_HUB_IMAGE_PROPERTY;
import static org.kurento.test.TestConfiguration.DOCKER_NODE_CHROME_DEBUG_IMAGE_DEFAULT;
import static org.kurento.test.TestConfiguration.DOCKER_NODE_CHROME_DEBUG_IMAGE_PROPERTY;
import static org.kurento.test.TestConfiguration.DOCKER_NODE_CHROME_IMAGE_DEFAULT;
import static org.kurento.test.TestConfiguration.DOCKER_NODE_CHROME_IMAGE_PROPERTY;
import static org.kurento.test.TestConfiguration.DOCKER_NODE_FIREFOX_DEBUG_IMAGE_DEFAULT;
import static org.kurento.test.TestConfiguration.DOCKER_NODE_FIREFOX_DEBUG_IMAGE_PROPERTY;
import static org.kurento.test.TestConfiguration.DOCKER_NODE_FIREFOX_IMAGE_DEFAULT;
import static org.kurento.test.TestConfiguration.DOCKER_NODE_FIREFOX_IMAGE_PROPERTY;
import static org.kurento.test.TestConfiguration.DOCKER_VNCRECORDER_CONTAINER_NAME_DEFAULT;
import static org.kurento.test.TestConfiguration.DOCKER_VNCRECORDER_CONTAINER_NAME_PROPERTY;
import static org.kurento.test.TestConfiguration.DOCKER_VNCRECORDER_IMAGE_DEFAULT;
import static org.kurento.test.TestConfiguration.DOCKER_VNCRECORDER_IMAGE_PROPERTY;
import static org.kurento.test.TestConfiguration.SELENIUM_MAX_DRIVER_ERROR_DEFAULT;
import static org.kurento.test.TestConfiguration.SELENIUM_MAX_DRIVER_ERROR_PROPERTY;
import static org.kurento.test.TestConfiguration.SELENIUM_RECORD_DEFAULT;
import static org.kurento.test.TestConfiguration.SELENIUM_RECORD_PROPERTY;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicInteger;

import org.kurento.commons.exception.KurentoException;
import org.kurento.commons.net.RemoteService;
import org.kurento.test.base.KurentoClientWebPageTest;
import org.kurento.test.docker.Docker;
import org.kurento.test.services.KurentoServicesTestHelper;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.remote.SessionId;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.github.dockerjava.api.command.CreateContainerCmd;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonObject;

public class DockerBrowserManager {

	public static final int REMOTE_WEB_DRIVER_CREATION_MAX_RETRIES = 3;
	private static final int REMOTE_WEB_DRIVER_CREATION_TIMEOUT_S = 20;

	private static final int HUB_CREATION_WAIT_POOL_TIME_MS = 1000;
	private static final int HUB_CREATION_TIMEOUT_MS = 30000;

	private static Logger log = LoggerFactory
			.getLogger(DockerBrowserManager.class);

	private class DockerBrowser {

{'fraction_non_alphanumeric': 0.07424939139843116, 'fraction_numerical': 0.004057343792263998, 'mean_word_length': 8.22069825436409, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6083042', 'n_tokens_mistral': 2441, 'n_tokens_neox': 2404, 'n_words': 354}