<commit_before>package org.cloudname.testtools.backend;

import org.cloudname.core.CloudnameBackend;
import org.cloudname.core.CloudnamePath;
import org.cloudname.core.LeaseHandle;
import org.cloudname.core.LeaseListener;
import org.junit.Test;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Random;
import java.util.Set;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;

import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

/**
 * Core backend tests. This ensures the backend implementation works as expected on the most
 * basic level. Override this class in your backend implementation to test it.
 *
 * @author <EMAIL>
 */
public abstract class CoreBackendTest {
    private final CloudnamePath serviceA = new CloudnamePath(
            new String[] { "local", "test", "service-a" });
    private final CloudnamePath serviceB = new CloudnamePath(
            new String[] { "local", "test", "service-b" });

    private final Random random = new Random();

    /**
     * Max data propagation time (in ms) for notifications from the backend. Override if your
     * backend implementation is slow. 5 ms is a lot of time though so do it carefully.
     */
    protected int getBackendPropagationTime() {
        return 5;
    }
    /**
     * Ensure multiple clients can connect and that leases get an unique path for each client.
     */
    @Test
    public void temporaryLeaseCreation() throws Exception {
        try (final CloudnameBackend backend = getBackend()) {
            final String data = Long.toHexString(random.nextLong());<commit_msg>Increase backend propagation time in tests to 100ms<commit_after>package org.cloudname.testtools.backend;

import org.cloudname.core.CloudnameBackend;
import org.cloudname.core.CloudnamePath;
import org.cloudname.core.LeaseHandle;
import org.cloudname.core.LeaseListener;
import org.junit.Test;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Random;
import java.util.Set;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;

import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

/**
 * Core backend tests. This ensures the backend implementation works as expected on the most
 * basic level. Override this class in your backend implementation to test it.
 *
 * @author <EMAIL>
 */
public abstract class CoreBackendTest {
    private final CloudnamePath serviceA = new CloudnamePath(
            new String[] { "local", "test", "service-a" });
    private final CloudnamePath serviceB = new CloudnamePath(
            new String[] { "local", "test", "service-b" });

    private final Random random = new Random();

    /**
     * Max data propagation time (in ms) for notifications from the backend. Override if your
     * backend implementation is slow. 100 ms is a lot of time though so do it carefully.
     */
    protected int getBackendPropagationTime() {
        return 100;
    }
    /**
     * Ensure multiple clients can connect and that leases get an unique path for each client.
     */
    @Test
    public void temporaryLeaseCreation() throws Exception {
        try (final CloudnameBackend backend = getBackend()) {
            final String data = Long.toHexString(random.nextLong());
{'fraction_non_alphanumeric': 0.09064885496183206, 'fraction_numerical': 0.0026240458015267176, 'mean_word_length': 4.0035799522673035, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '3875344', 'n_tokens_mistral': 1161, 'n_tokens_neox': 1153, 'n_words': 368}