From 320aca4d90b6a937b11986c7aaff814541934b38 Mon Sep 17 00:00:00 2001 From: chuntaojun Date: Tue, 30 Apr 2019 19:27:06 +0800 Subject: [PATCH] style(api): The revised code is in compliance with the specification --- .../nacos/api/naming/MaintainService.java | 2 + .../naming/NacosMaintainServiceTest.java | 46 ++++++++++--------- 2 files changed, 27 insertions(+), 21 deletions(-) diff --git a/api/src/main/java/com/alibaba/nacos/api/naming/MaintainService.java b/api/src/main/java/com/alibaba/nacos/api/naming/MaintainService.java index afa60986e..56bcebcc4 100644 --- a/api/src/main/java/com/alibaba/nacos/api/naming/MaintainService.java +++ b/api/src/main/java/com/alibaba/nacos/api/naming/MaintainService.java @@ -31,6 +31,7 @@ import java.util.Map; public interface MaintainService { /** + * query service * * @param serviceName * @return @@ -39,6 +40,7 @@ public interface MaintainService { Service selectOneService(String serviceName) throws NacosException; /** + * query service * * @param serviceName * @param groupName diff --git a/client/src/test/java/com/alibaba/nacos/client/naming/NacosMaintainServiceTest.java b/client/src/test/java/com/alibaba/nacos/client/naming/NacosMaintainServiceTest.java index 8579c4847..6125c5c53 100644 --- a/client/src/test/java/com/alibaba/nacos/client/naming/NacosMaintainServiceTest.java +++ b/client/src/test/java/com/alibaba/nacos/client/naming/NacosMaintainServiceTest.java @@ -11,7 +11,9 @@ import com.alibaba.nacos.api.selector.ExpressionSelector; import com.alibaba.nacos.api.selector.NoneSelector; import org.junit.Assert; import org.junit.Before; +import org.junit.FixMethodOrder; import org.junit.Test; +import org.junit.runners.MethodSorters; import java.util.HashMap; import java.util.Map; @@ -20,6 +22,7 @@ import java.util.Properties; import static com.alibaba.nacos.client.utils.LogUtils.NAMING_LOGGER; import static org.junit.Assert.*; +@FixMethodOrder(MethodSorters.NAME_ASCENDING) public class NacosMaintainServiceTest { private MaintainService maintainService; @@ -33,17 +36,7 @@ public class NacosMaintainServiceTest { } @Test - public void selectOneService() { - try { - Service service = maintainService.selectOneService("nacos-api"); - NAMING_LOGGER.info("service : {}", service.toString()); - } catch (NacosException e) { - NAMING_LOGGER.error(e.getErrMsg()); - } - } - - @Test - public void createService() { + public void test1createService() { Service service = new Service(); service.setName("nacos-api"); service.setGroupName(Constants.DEFAULT_GROUP); @@ -63,16 +56,7 @@ public class NacosMaintainServiceTest { } @Test - public void deleteService() { - try { - Assert.assertTrue(maintainService.deleteService("nacos-api")); - } catch (NacosException e) { - NAMING_LOGGER.error(e.getErrMsg()); - } - } - - @Test - public void updateService() { + public void test2updateService() { Service service = new Service(); service.setName("nacos-api"); service.setGroupName(Constants.DEFAULT_GROUP); @@ -87,4 +71,24 @@ public class NacosMaintainServiceTest { NAMING_LOGGER.error(e.getErrMsg()); } } + + @Test + public void test3selectOneService() { + try { + Service service = maintainService.selectOneService("nacos-api"); + System.out.println("service : " + service.toString()); + } catch (NacosException e) { + NAMING_LOGGER.error(e.getErrMsg()); + } + } + + @Test + public void test4deleteService() { + try { + Assert.assertTrue(maintainService.deleteService("nacos-api")); + } catch (NacosException e) { + NAMING_LOGGER.error(e.getErrMsg()); + } + } + }