style(api): The revised code is in compliance with the specification
This commit is contained in:
parent
1b76780cd1
commit
320aca4d90
@ -31,6 +31,7 @@ import java.util.Map;
|
|||||||
public interface MaintainService {
|
public interface MaintainService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* query service
|
||||||
*
|
*
|
||||||
* @param serviceName
|
* @param serviceName
|
||||||
* @return
|
* @return
|
||||||
@ -39,6 +40,7 @@ public interface MaintainService {
|
|||||||
Service selectOneService(String serviceName) throws NacosException;
|
Service selectOneService(String serviceName) throws NacosException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* query service
|
||||||
*
|
*
|
||||||
* @param serviceName
|
* @param serviceName
|
||||||
* @param groupName
|
* @param groupName
|
||||||
|
@ -11,7 +11,9 @@ import com.alibaba.nacos.api.selector.ExpressionSelector;
|
|||||||
import com.alibaba.nacos.api.selector.NoneSelector;
|
import com.alibaba.nacos.api.selector.NoneSelector;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
import org.junit.FixMethodOrder;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
import org.junit.runners.MethodSorters;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -20,6 +22,7 @@ import java.util.Properties;
|
|||||||
import static com.alibaba.nacos.client.utils.LogUtils.NAMING_LOGGER;
|
import static com.alibaba.nacos.client.utils.LogUtils.NAMING_LOGGER;
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||||
public class NacosMaintainServiceTest {
|
public class NacosMaintainServiceTest {
|
||||||
|
|
||||||
private MaintainService maintainService;
|
private MaintainService maintainService;
|
||||||
@ -33,17 +36,7 @@ public class NacosMaintainServiceTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void selectOneService() {
|
public void test1createService() {
|
||||||
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() {
|
|
||||||
Service service = new Service();
|
Service service = new Service();
|
||||||
service.setName("nacos-api");
|
service.setName("nacos-api");
|
||||||
service.setGroupName(Constants.DEFAULT_GROUP);
|
service.setGroupName(Constants.DEFAULT_GROUP);
|
||||||
@ -63,16 +56,7 @@ public class NacosMaintainServiceTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void deleteService() {
|
public void test2updateService() {
|
||||||
try {
|
|
||||||
Assert.assertTrue(maintainService.deleteService("nacos-api"));
|
|
||||||
} catch (NacosException e) {
|
|
||||||
NAMING_LOGGER.error(e.getErrMsg());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void updateService() {
|
|
||||||
Service service = new Service();
|
Service service = new Service();
|
||||||
service.setName("nacos-api");
|
service.setName("nacos-api");
|
||||||
service.setGroupName(Constants.DEFAULT_GROUP);
|
service.setGroupName(Constants.DEFAULT_GROUP);
|
||||||
@ -87,4 +71,24 @@ public class NacosMaintainServiceTest {
|
|||||||
NAMING_LOGGER.error(e.getErrMsg());
|
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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user