/*
 * 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.core.yaml.sharding;

import io.shardingsphere.api.config.KeyGeneratorConfiguration;
import org.junit.Before;
import org.junit.Test;

import java.util.Properties;

import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;

public class YamlKeyGeneratorConfigurationTest {
    
    private KeyGeneratorConfiguration keyGeneratorConfiguration;
    
    @Before
    public void setUp() {
        Properties props = new Properties();
        props.setProperty("key1", "value1");
        keyGeneratorConfiguration = new KeyGeneratorConfiguration("order_id", "UUID", null, props);
    }
    
    @Test
    public void createYamlKeyGeneratorConfiguration() {
        YamlKeyGeneratorConfiguration yamlKeyGeneratorConfiguration = new YamlKeyGeneratorConfiguration(keyGeneratorConfiguration);
        assertThat(yamlKeyGeneratorConfiguration.getColumn(), is("order_id"));
        assertThat(yamlKeyGeneratorConfiguration.getType(), is("UUID"));
    }
}

@@ -723,16 +723,86 @@
 ration;%0A
+import io.shardingsphere.core.keygen.generator.SnowflakeKeyGenerator;%0A
 import o
@@ -818,16 +818,16 @@
 Before;%0A
-
 import o
@@ -1010,24 +1010,78 @@
 Test %7B%0A    %0A
+    private Properties props = new Properties();%0A    %0A
     private 
@@ -1180,53 +1180,8 @@
 ) %7B%0A
-        Properties props = new Properties();%0A
     
@@ -1605,24 +1605,24 @@
 rder_id%22));%0A
-
         asse
@@ -1688,10 +1688,438 @@
 ;%0A    %7D%0A
+    %0A    public void getKeyGeneratorConfiguration() %7B%0A        YamlKeyGeneratorConfiguration yamlKeyGeneratorConfiguration = new YamlKeyGeneratorConfiguration();%0A        yamlKeyGeneratorConfiguration.setColumn(%22user_id%22);%0A        yamlKeyGeneratorConfiguration.setClassName(SnowflakeKeyGenerator.class.getName());%0A        yamlKeyGeneratorConfiguration.setType(%22SNOWFLAKE%22);%0A        yamlKeyGeneratorConfiguration.setProps();%0A    %7D%0A
 %7D%0A

add props