/*
 * Copyright 2016-2018 shardingsphere.io.
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * </p>
 */

package io.shardingsphere.jdbc.orchestration.reg.newzk.client.zookeeper;

import io.shardingsphere.jdbc.orchestration.reg.newzk.client.action.IClient;
import io.shardingsphere.jdbc.orchestration.reg.newzk.client.zookeeper.base.BaseClientTest;
import io.shardingsphere.jdbc.orchestration.reg.newzk.client.zookeeper.base.TestSupport;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.ZooDefs;
import org.junit.Test;

import java.io.IOException;

public class UsualClientTest extends BaseClientTest {
    
    @Override
    protected IClient createClient(final ClientFactory creator) throws IOException, InterruptedException {
        return creator.setClientNamespace(TestSupport.ROOT).authorization(TestSupport.AUTH, TestSupport.AUTH.getBytes(), ZooDefs.Ids.CREATOR_ALL_ACL)
                .newClient(TestSupport.SERVERS, TestSupport.SESSION_TIMEOUT).start();
    }
    
    @Test
    public void assertCreateRoot() throws KeeperException, InterruptedException {
        super.createRoot(getTestClient());
    }
    
    @Test
    public void assertCreateChild() throws KeeperException, InterruptedException {
        super.createChild(getTestClient());
    }
    
    @Test
    public void assertDeleteBranch() throws KeeperException, InterruptedException {
        super.deleteBranch(getTestClient());
    }
    
    @Test
    public void assertExisted() throws KeeperException, InterruptedException {
        super.isExisted(getTestClient());
    }
    
    @Test
    public void assertGet() throws KeeperException, InterruptedException {
        super.get(getTestClient());
    }
    
    @Test
    public void assertAsyncGet() throws KeeperException, InterruptedException {
        super.asyncGet(getTestClient());
    }
    
    @Test
    public void assertGetChildrenKeys() throws KeeperException, InterruptedException {
        super.getChildrenKeys(getTestClient());
    }
    
    @Test
    public void assertPersist() throws KeeperException, InterruptedException {
        super.persist(getTestClient());
    }
    
    @Test
    public void assertPersistEphemeral() throws KeeperException, InterruptedException {
        super.persistEphemeral(getTestClient());
    }
    
    @Test
    public void assertDelAllChildren() throws KeeperException, InterruptedException {
        super.delAllChildren(getTestClient());
    }
    
    @Test
    public void assertWatch() throws KeeperException, InterruptedException {
        super.watch(getTestClient());
    }
    
    @Test
    public void assertWatchRegister() throws KeeperException, InterruptedException {
        super.watchRegister(getTestClient());
    }
    
    @Test
    public void assertClose() {
        super.close(getTestClient());
    }
}

@@ -945,16 +945,611 @@
 upport;%0A
+import io.shardingsphere.jdbc.orchestration.reg.newzk.client.zookeeper.section.StrategyType;%0Aimport io.shardingsphere.jdbc.orchestration.reg.newzk.client.zookeeper.strategy.AsyncRetryStrategy;%0Aimport io.shardingsphere.jdbc.orchestration.reg.newzk.client.zookeeper.strategy.ContentionStrategy;%0Aimport io.shardingsphere.jdbc.orchestration.reg.newzk.client.zookeeper.strategy.SyncRetryStrategy;%0Aimport io.shardingsphere.jdbc.orchestration.reg.newzk.client.zookeeper.strategy.TransactionContendStrategy;%0Aimport io.shardingsphere.jdbc.orchestration.reg.newzk.client.zookeeper.strategy.UsualStrategy;%0A
 import o
@@ -1585,16 +1585,16 @@
 eption;%0A
-
 import o
@@ -1675,16 +1675,104 @@
 ption;%0A%0A
+import static org.hamcrest.CoreMatchers.is;%0Aimport static org.junit.Assert.assertThat;%0A%0A
 public c
@@ -2093,16 +2093,16 @@
 LL_ACL)%0A
-
         
@@ -2192,32 +2192,1120 @@
 %0A    %0A    @Test%0A
+    public void assertUseExecStrategy() %7B%0A        assertThat(getTestClient().getExecStrategy().getClass().getName(), is(UsualStrategy.class.getName()));%0A        getTestClient().useExecStrategy(StrategyType.CONTEND);%0A        assertThat(getTestClient().getExecStrategy().getClass().getName(), is(ContentionStrategy.class.getName()));%0A        getTestClient().useExecStrategy(StrategyType.TRANSACTION_CONTEND);%0A        assertThat(getTestClient().getExecStrategy().getClass().getName(), is(TransactionContendStrategy.class.getName()));%0A        getTestClient().useExecStrategy(StrategyType.SYNC_RETRY);%0A        assertThat(getTestClient().getExecStrategy().getClass().getName(), is(SyncRetryStrategy.class.getName()));%0A        getTestClient().useExecStrategy(StrategyType.ASYNC_RETRY);%0A        assertThat(getTestClient().getExecStrategy().getClass().getName(), is(AsyncRetryStrategy.class.getName()));%0A        getTestClient().useExecStrategy(StrategyType.USUAL);%0A        assertThat(getTestClient().getExecStrategy().getClass().getName(), is(UsualStrategy.class.getName()));%0A    %7D%0A    %0A    @Test%0A
     public void 

add useExecStrategy test