Skip to content

Commit

Permalink
Merge 75b0eac into 2c365d0
Browse files Browse the repository at this point in the history
  • Loading branch information
ruanjiehui committed Mar 25, 2020
2 parents 2c365d0 + 75b0eac commit c4ef8ba
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 0 deletions.
@@ -0,0 +1,47 @@
/*
* 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.orchestration.center.instance;

import org.junit.Test;

import java.util.Properties;

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

public final class NacosPropertiesTest {

@Test
public void assertGetValue() {
Properties props = new Properties();
props.setProperty(NacosPropertyKey.GROUP.getKey(), "SHARDING_SPHERE_TEST_GROUP");
props.setProperty(NacosPropertyKey.TIMEOUT.getKey(), "6000");
NacosProperties actual = new NacosProperties(props);
assertThat(actual.getValue(NacosPropertyKey.GROUP), is("SHARDING_SPHERE_TEST_GROUP"));
assertThat(actual.getValue(NacosPropertyKey.TIMEOUT), is(6000L));
}

@Test
public void assertGetDefaultValue() {
Properties props = new Properties();
NacosProperties actual = new NacosProperties(props);
assertThat(actual.getValue(NacosPropertyKey.GROUP), is("SHARDING_SPHERE_DEFAULT_GROUP"));
assertThat(actual.getValue(NacosPropertyKey.TIMEOUT), is(3000L));
}

}
@@ -0,0 +1,44 @@
/*
* 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.orchestration.core.facade.properties;

import org.junit.Test;

import java.util.Properties;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

public final class OrchestrationPropertiesTest {

@Test
public void assertGetValue() {
Properties props = new Properties();
props.setProperty(OrchestrationPropertyKey.OVERWRITE.getKey(), "true");
OrchestrationProperties actual = new OrchestrationProperties(props);
assertTrue(actual.getValue(OrchestrationPropertyKey.OVERWRITE));
}

@Test
public void assertGetDefaultValue() {
Properties props = new Properties();
OrchestrationProperties actual = new OrchestrationProperties(props);
assertFalse(actual.getValue(OrchestrationPropertyKey.OVERWRITE));
}

}

0 comments on commit c4ef8ba

Please sign in to comment.