From 534995a40559476e6eea8b0cf650ca62c4e8dd99 Mon Sep 17 00:00:00 2001 From: nkorange Date: Thu, 18 Oct 2018 18:59:45 +0800 Subject: [PATCH] Resolve conflicts --- api/pom.xml | 12 ++++- client/pom.xml | 2 +- common/pom.xml | 2 +- .../alibaba/nacos/common/util/IoUtils.java | 39 +++++++++++++++ config/pom.xml | 16 +++++-- console/pom.xml | 2 +- core/pom.xml | 2 +- example/pom.xml | 2 +- naming/pom.xml | 2 +- .../alibaba/nacos/naming/web/ApiCommands.java | 47 +++++-------------- pom.xml | 2 +- test/pom.xml | 2 +- 12 files changed, 80 insertions(+), 50 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index ef8fbdf26fb..d1af63c2657 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -16,7 +16,7 @@ com.alibaba.nacos nacos-all - 0.2.1 + 0.3.0-rc1 4.0.0 @@ -40,6 +40,16 @@ org.apache.commons commons-lang3 + + junit + junit + test + + + org.springframework + spring-test + test + diff --git a/client/pom.xml b/client/pom.xml index d9b0e361ec1..c5a4395a14c 100644 --- a/client/pom.xml +++ b/client/pom.xml @@ -16,7 +16,7 @@ com.alibaba.nacos nacos-all - 0.2.2-SNAPSHOT + 0.3.0-rc1 ../pom.xml diff --git a/common/pom.xml b/common/pom.xml index ed9db89fb0c..e87cd13239c 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -18,7 +18,7 @@ com.alibaba.nacos nacos-all - 0.2.2-SNAPSHOT + 0.3.0-rc1 ../pom.xml 4.0.0 diff --git a/common/src/main/java/com/alibaba/nacos/common/util/IoUtils.java b/common/src/main/java/com/alibaba/nacos/common/util/IoUtils.java index 293d66ca692..207d9136c1d 100644 --- a/common/src/main/java/com/alibaba/nacos/common/util/IoUtils.java +++ b/common/src/main/java/com/alibaba/nacos/common/util/IoUtils.java @@ -16,8 +16,11 @@ package com.alibaba.nacos.common.util; import org.apache.commons.io.IOUtils; +import org.apache.commons.lang3.StringUtils; import java.io.*; +import java.util.ArrayList; +import java.util.List; import java.util.zip.GZIPInputStream; /** @@ -45,5 +48,41 @@ public static byte[] tryDecompress(InputStream raw) throws Exception { return null; } + static private BufferedReader toBufferedReader(Reader reader) { + return reader instanceof BufferedReader ? (BufferedReader) reader : new BufferedReader( + reader); + } + + public static void writeStringToFile(File file, String data, String encoding) + throws IOException { + OutputStream os = null; + try { + os = new FileOutputStream(file); + os.write(data.getBytes(encoding)); + os.flush(); + } finally { + if (null != os) { + os.close(); + } + } + } + + static public List readLines(Reader input) throws IOException { + BufferedReader reader = toBufferedReader(input); + List list = new ArrayList(); + String line = null; + for (; ; ) { + line = reader.readLine(); + if (null != line) { + if (StringUtils.isNotEmpty(line)) { + list.add(line.trim()); + } + } else { + break; + } + } + return list; + } + } diff --git a/config/pom.xml b/config/pom.xml index 377cb334d59..44e725d0ccf 100644 --- a/config/pom.xml +++ b/config/pom.xml @@ -17,7 +17,7 @@ com.alibaba.nacos nacos-all - 0.2.1 + 0.3.0-rc1 4.0.0 @@ -50,10 +50,10 @@ com.google.guava guava - - taglibs - standard - + + + + org.springframework.boot spring-boot-starter-jdbc @@ -65,6 +65,7 @@ commons-lang commons-lang + 2.6 mysql @@ -115,6 +116,11 @@ com.github.spotbugs spotbugs-annotations + + org.mockito + mockito-core + test + diff --git a/console/pom.xml b/console/pom.xml index add82b25d94..13c7633a33c 100644 --- a/console/pom.xml +++ b/console/pom.xml @@ -18,7 +18,7 @@ com.alibaba.nacos nacos-all - 0.2.1 + 0.3.0-rc1 nacos-console diff --git a/core/pom.xml b/core/pom.xml index 46aece4681c..5d3bd364a62 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -18,7 +18,7 @@ com.alibaba.nacos nacos-all - 0.2.2-SNAPSHOT + 0.3.0-rc1 ../pom.xml diff --git a/example/pom.xml b/example/pom.xml index 42295d5c62a..72470dd526a 100644 --- a/example/pom.xml +++ b/example/pom.xml @@ -18,7 +18,7 @@ com.alibaba.nacos nacos-all - 0.2.2-SNAPSHOT + 0.3.0-rc1 ../pom.xml diff --git a/naming/pom.xml b/naming/pom.xml index 2c02cd502ac..91d10bff955 100644 --- a/naming/pom.xml +++ b/naming/pom.xml @@ -18,7 +18,7 @@ com.alibaba.nacos nacos-all - 0.2.2-SNAPSHOT + 0.3.0-rc1 ../pom.xml diff --git a/naming/src/main/java/com/alibaba/nacos/naming/web/ApiCommands.java b/naming/src/main/java/com/alibaba/nacos/naming/web/ApiCommands.java index 68f608789d5..e989fdf8b0c 100644 --- a/naming/src/main/java/com/alibaba/nacos/naming/web/ApiCommands.java +++ b/naming/src/main/java/com/alibaba/nacos/naming/web/ApiCommands.java @@ -23,11 +23,14 @@ import com.alibaba.nacos.api.naming.pojo.Service; import com.alibaba.nacos.common.util.IoUtils; import com.alibaba.nacos.common.util.Md5Utils; -import com.alibaba.nacos.common.util.SystemUtil; +import com.alibaba.nacos.common.util.SystemUtils; import com.alibaba.nacos.naming.boot.RunningConfig; import com.alibaba.nacos.naming.core.*; import com.alibaba.nacos.naming.exception.NacosException; -import com.alibaba.nacos.naming.healthcheck.*; +import com.alibaba.nacos.naming.healthcheck.AbstractHealthCheckProcessor; +import com.alibaba.nacos.naming.healthcheck.HealthCheckTask; +import com.alibaba.nacos.naming.healthcheck.HealthCheckType; +import com.alibaba.nacos.naming.healthcheck.RsInfo; import com.alibaba.nacos.naming.misc.*; import com.alibaba.nacos.naming.push.ClientInfo; import com.alibaba.nacos.naming.push.DataSource; @@ -36,7 +39,6 @@ import com.alibaba.nacos.naming.raft.RaftCore; import com.alibaba.nacos.naming.raft.RaftPeer; import com.alibaba.nacos.naming.raft.RaftProxy; -import com.alibaba.nacos.naming.view.ServiceView; import com.ning.http.client.AsyncCompletionHandler; import com.ning.http.client.Response; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; @@ -78,7 +80,6 @@ public class ApiCommands { @Autowired protected DomainsManager domainsManager; - private DataSource pushDataSource = new DataSource() { @Override @@ -1946,32 +1947,6 @@ public String addCluster4Dom(HttpServletRequest request) throws Exception { return doAddCluster4Dom(request); } - /** - * This API returns dom names only. you should use API: dom to retrieve dom details - */ - @RequestMapping("/domList") - public JSONObject domList(HttpServletRequest request) { - - JSONObject result = new JSONObject(); - - int page = Integer.parseInt(BaseServlet.required(request, "startPg")); - int pageSize = Integer.parseInt(BaseServlet.required(request, "pgSize")); - - List doms = domainsManager.getPagedDom(page, pageSize); - if (CollectionUtils.isEmpty(doms)) { - result.put("domList", Collections.emptyList()); - return result; - } - - JSONArray domArray = new JSONArray(); - for (Domain dom : doms) { - domArray.add(dom.getName()); - } - - result.put("domList", domArray); - - return result; - } @RequestMapping("/distroStatus") public JSONObject distroStatus(HttpServletRequest request) { @@ -2007,9 +1982,9 @@ public JSONObject metrics(HttpServletRequest request) { result.put("ipCount", ipCount); result.put("responsibleDomCount", responsibleDomCount); result.put("responsibleIPCount", responsibleIPCount); - result.put("cpu", SystemUtil.getCPU()); - result.put("load", SystemUtil.getLoad()); - result.put("mem", SystemUtil.getMem()); + result.put("cpu", SystemUtils.getCPU()); + result.put("load", SystemUtils.getLoad()); + result.put("mem", SystemUtils.getMem()); return result; } @@ -2037,7 +2012,7 @@ public JSONObject updateClusterConf(HttpServletRequest request) throws IOExcepti } Loggers.SRV_LOG.info("[UPDATE-CLUSTER] new ips:" + sb.toString()); - IoUtils.writeStringToFile(new File(UtilsAndCommons.getConfFile()), sb.toString(), "utf-8"); + IoUtils.writeStringToFile(UtilsAndCommons.getConfFile(), sb.toString(), "utf-8"); return result; } @@ -2048,7 +2023,7 @@ public JSONObject updateClusterConf(HttpServletRequest request) throws IOExcepti sb.append(ip).append("\r\n"); } Loggers.SRV_LOG.info("[UPDATE-CLUSTER] new ips:" + sb.toString()); - IoUtils.writeStringToFile(new File(UtilsAndCommons.getConfFile()), sb.toString(), "utf-8"); + IoUtils.writeStringToFile(UtilsAndCommons.getConfFile(), sb.toString(), "utf-8"); return result; } @@ -2077,7 +2052,7 @@ public JSONObject updateClusterConf(HttpServletRequest request) throws IOExcepti sb.append(ip).append("\r\n"); } - IoUtils.writeStringToFile(new File(UtilsAndCommons.getConfFile()), sb.toString(), "utf-8"); + IoUtils.writeStringToFile(UtilsAndCommons.getConfFile(), sb.toString(), "utf-8"); return result; } diff --git a/pom.xml b/pom.xml index da576c18d6b..dba29771be9 100644 --- a/pom.xml +++ b/pom.xml @@ -21,7 +21,7 @@ 2018 com.alibaba.nacos nacos-all - 0.2.2-SNAPSHOT + 0.3.0-rc1 pom Alibaba NACOS ${project.version} diff --git a/test/pom.xml b/test/pom.xml index e65e5756915..57f3240d97e 100644 --- a/test/pom.xml +++ b/test/pom.xml @@ -17,7 +17,7 @@ com.alibaba.nacos nacos-all - 0.2.2-SNAPSHOT + 0.3.0-rc1 ../pom.xml 4.0.0