/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You 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.
 */

package org.apache.shardingsphere.shardingjdbc.orchestration.util;

import org.apache.shardingsphere.orchestration.reg.api.RegistryCenter;
import org.apache.shardingsphere.orchestration.reg.api.RegistryCenterConfiguration;
import org.apache.shardingsphere.orchestration.reg.listener.DataChangedEventListener;

import java.util.Collections;
import java.util.List;

public final class TestRegistryCenter implements RegistryCenter {
    
    @Override
    public void init(final RegistryCenterConfiguration config) {
    }
    
    @Override
    public String get(final String key) {
        return "";
    }
    
    @Override
    public String getDirectly(final String key) {
        return "";
    }
    
    @Override
    public boolean isExisted(final String key) {
        return true;
    }
    
    @Override
    public List<String> getChildrenKeys(final String key) {
        return Collections.emptyList();
    }
    
    @Override
    public void persist(final String key, final String value) {
    }
    
    @Override
    public void update(final String key, final String value) {
    }
    
    @Override
    public void persistEphemeral(final String key, final String value) {
    }
    
    @Override
    public void watch(final String key, final DataChangedEventListener dataChangedEventListener) {
    }
    
    @Override
    public void close() {
    }
}

@@ -1155,18 +1155,72 @@
 .util.Li
-st
+nkedHashMap;%0Aimport java.util.List;%0Aimport java.util.Map
 ;%0A%0Apubli
@@ -1281,24 +1281,105 @@
 nter %7B%0A    %0A
+    private final Map%3CString, String%3E registryData = new LinkedHashMap%3C%3E();%0A    %0A
     @Overrid
@@ -1519,34 +1519,53 @@
 %0A        return 
-%22%22
+registryData.get(key)
 ;%0A    %7D%0A    %0A   
@@ -1644,10 +1644,29 @@
 urn 
-%22%22
+registryData.get(key)
 ;%0A  
@@ -1756,12 +1756,37 @@
 urn 
-true
+registryData.containsKey(key)
 ;%0A  
@@ -1989,32 +1989,70 @@
 String value) %7B%0A
+        registryData.put(key, value);%0A
     %7D%0A    %0A    @
@@ -2115,32 +2115,70 @@
 String value) %7B%0A
+        registryData.put(key, value);%0A
     %7D%0A    %0A    @
@@ -2255,24 +2255,62 @@
 ng value) %7B%0A
+        registryData.put(key, value);%0A
     %7D%0A    %0A 
@@ -2438,32 +2438,32 @@
  %0A    @Override%0A
-
     public void 
@@ -2468,20 +2468,50 @@
 d close() %7B%0A
+        registryData.clear();%0A
     %7D%0A%7D%0A

modify TestRegistryCenter