Skip to content

Commit

Permalink
Polish alibaba#111 : Replace naming module
Browse files Browse the repository at this point in the history
  • Loading branch information
mercyblitz committed Oct 3, 2018
1 parent e08dca3 commit 741ea7c
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@ public class UtilsAndCommons {

public static final String NACOS_SERVER_CONTEXT = "/nacos";

public static final String NACOS_SERVER_VERSION = "/v1";
public static final String NACOS_SERVER_VERSION = NACOS_SERVER_CONTEXT + "/v1";

public static final String NACOS_NAMING_CONTEXT = NACOS_SERVER_VERSION + "/ns";
public static final String DEFAULT_NACOS_NAMING_CONTEXT = NACOS_SERVER_VERSION + "/ns";

public static final String NACOS_NAMING_CONTEXT = "${nacos.naming.context.path" + ":" + DEFAULT_NACOS_NAMING_CONTEXT + "}";

public static final String NACOS_NAMING_INSTANCE_CONTEXT = "/instance";

Expand Down
Original file line number Diff line number Diff line change
@@ -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 com.alibaba.nacos.naming.misc;

import org.junit.Assert;
import org.junit.Test;
import org.springframework.mock.env.MockEnvironment;

import static com.alibaba.nacos.naming.misc.UtilsAndCommons.DEFAULT_NACOS_NAMING_CONTEXT;
import static com.alibaba.nacos.naming.misc.UtilsAndCommons.NACOS_NAMING_CONTEXT;

/**
* {@link UtilsAndCommons}
*
* @author <a href="mailto:[email protected]">Mercy</a>
* @since 0.2.2
*/
public class UtilsAndCommonsTest {

@Test
public void testControllerPathsDefaultValues() {

MockEnvironment environment = new MockEnvironment();

Assert.assertEquals(DEFAULT_NACOS_NAMING_CONTEXT, environment.resolvePlaceholders(NACOS_NAMING_CONTEXT));


Assert.assertEquals("/nacos/v1/ns", DEFAULT_NACOS_NAMING_CONTEXT);
}
}

0 comments on commit 741ea7c

Please sign in to comment.