<commit_before>package com.github.phantomthief.zookeeper;

import static com.github.phantomthief.zookeeper.util.ZkUtils.removeFromZk;
import static org.apache.curator.framework.CuratorFrameworkFactory.newClient;

import java.io.IOException;

import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.retry.RetryForever;
import org.apache.curator.test.TestingServer;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;

/**
 * @author w.vela
 * Created on 2017-08-25.
 */
public class BaseTest {

    protected static TestingServer testingServer;
    protected static CuratorFramework curatorFramework;
    private static String otherConnectionStr;

    @BeforeAll
    public static void init() throws Exception {
        if (otherConnectionStr == null) {
            testingServer = new TestingServer(true);
            curatorFramework = newClient(testingServer.getConnectString(), new RetryForever(1000));
        } else {
            curatorFramework = newClient(otherConnectionStr, new RetryForever(1000));<commit_msg>[test] add zk34mode test switch.<commit_after>package com.github.phantomthief.zookeeper;

import static com.github.phantomthief.zookeeper.util.ZkUtils.removeFromZk;
import static org.apache.curator.framework.CuratorFrameworkFactory.builder;
import static org.apache.curator.framework.CuratorFrameworkFactory.newClient;

import java.io.IOException;

import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.retry.RetryForever;
import org.apache.curator.test.TestingServer;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;

/**
 * @author w.vela
 * Created on 2017-08-25.
 */
public class BaseTest {

    protected static TestingServer testingServer;
    protected static CuratorFramework curatorFramework;
    private static String otherConnectionStr;
    private static boolean enableZk34Mode;

    @BeforeAll
    public static void init() throws Exception {
        if (otherConnectionStr == null) {
            testingServer = new TestingServer(true);
            curatorFramework = newClient(testingServer.getConnectString(), new RetryForever(1000));
        } else {
            if (enableZk34Mode) {
                curatorFramework = builder()
                        .connectString(otherConnectionStr)
                        .zk34CompatibilityMode(true)
                        .dontUseContainerParents()
                        .retryPolicy(new RetryForever(1000))
                        .build();
            } else {
                curatorFramework = newClient(otherConnectionStr, new RetryForever(1000));
            }
{'fraction_non_alphanumeric': 0.08621987951807229, 'fraction_numerical': 0.016566265060240965, 'mean_word_length': 3.3203252032520325, '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': '532758', 'n_tokens_mistral': 757, 'n_tokens_neox': 710, 'n_words': 145}