From cc16d6a9d6834f038a13c0d2607a7b9a6ef5b52d Mon Sep 17 00:00:00 2001 From: shirly121 Date: Wed, 13 Jan 2021 18:59:36 +0800 Subject: [PATCH] remove useless dependency (#84) --- interactive_engine/src/api/sdk-common/pom.xml | 5 -- .../maxgraph/sdkcommon/util/JSONTest.java | 87 ------------------- interactive_engine/src/common/java/pom.xml | 13 +-- .../maxgraph/common/util/CommonUtil.java | 25 +++--- .../com/alibaba/maxgraph/util/TarUtil.java | 62 ------------- .../src/frontend/frontendservice/pom.xml | 4 - 6 files changed, 14 insertions(+), 182 deletions(-) delete mode 100644 interactive_engine/src/api/sdk-common/src/test/java/com/alibaba/maxgraph/sdkcommon/util/JSONTest.java delete mode 100644 interactive_engine/src/common/java/src/main/java/com/alibaba/maxgraph/util/TarUtil.java diff --git a/interactive_engine/src/api/sdk-common/pom.xml b/interactive_engine/src/api/sdk-common/pom.xml index 248cb08720b9..83dc45dd9828 100644 --- a/interactive_engine/src/api/sdk-common/pom.xml +++ b/interactive_engine/src/api/sdk-common/pom.xml @@ -65,11 +65,6 @@ org.slf4j slf4j-api - - org.projectlombok - lombok - test - org.testng testng diff --git a/interactive_engine/src/api/sdk-common/src/test/java/com/alibaba/maxgraph/sdkcommon/util/JSONTest.java b/interactive_engine/src/api/sdk-common/src/test/java/com/alibaba/maxgraph/sdkcommon/util/JSONTest.java deleted file mode 100644 index 9d9fa729b8d3..000000000000 --- a/interactive_engine/src/api/sdk-common/src/test/java/com/alibaba/maxgraph/sdkcommon/util/JSONTest.java +++ /dev/null @@ -1,87 +0,0 @@ -/** - * Copyright 2020 Alibaba Group Holding Limited. - * - * Licensed 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.maxgraph.sdkcommon.util; - -import com.alibaba.maxgraph.sdkcommon.util.JSON; -import lombok.Getter; -import org.testng.Assert; -import org.testng.annotations.Test; - -/** - * Created by wubincen on 2018/5/4 - */ -public class JSONTest { - - static class TestObject { - @Getter private String stringVal1; - @Getter private int intVal1; - @Getter private double doubleVal1; - - public TestObject() { - } - - public TestObject(String stringVal1, int intVal1, double doubleVal1) { - this.stringVal1 = stringVal1; - this.intVal1 = intVal1; - this.doubleVal1 = doubleVal1; - } - - @Override - public boolean equals(Object obj) { - TestObject other = (TestObject)obj; - return this.stringVal1.equals(other.stringVal1) && - this.doubleVal1 == other.doubleVal1 && - this.intVal1 == other.intVal1; - } - } - - @Test - public void testNormalObject() { - TestObject object = new TestObject("aaaaa", 111, 22.22); - TestObject object1 = JSON.fromJson(JSON.toJson(object), TestObject.class); - Assert.assertEquals(object, object1); - } - - static enum TestEnum { - A, - B, - C; - } - - static class TestEnumObject { - @Getter private TestEnum enumVal; - - public TestEnumObject() { - } - - public TestEnumObject(TestEnum enumVal) { - this.enumVal = enumVal; - } - - @Override - public boolean equals(Object obj) { - TestEnumObject other = (TestEnumObject)obj; - return this.enumVal == other.enumVal; - } - } - - @Test - public void testEnum() { - TestEnumObject object = new TestEnumObject(TestEnum.valueOf("A")); - TestEnumObject object1 = JSON.fromJson(JSON.toJson(object), TestEnumObject.class); - Assert.assertEquals(object, object1); - } -} diff --git a/interactive_engine/src/common/java/pom.xml b/interactive_engine/src/common/java/pom.xml index a31e9b5a4e50..a361df9f0265 100644 --- a/interactive_engine/src/common/java/pom.xml +++ b/interactive_engine/src/common/java/pom.xml @@ -36,10 +36,6 @@ testng - - org.apache.hadoop - hadoop-client - org.apache.hadoop hadoop-common @@ -87,19 +83,12 @@ de.javakaffee kryo-serializers - - org.kamranzafar - jtar - com.alibaba.maxgraph maxgraph-sdk-common - - org.jgrapht - jgrapht-core - + org.mockito mockito-all diff --git a/interactive_engine/src/common/java/src/main/java/com/alibaba/maxgraph/common/util/CommonUtil.java b/interactive_engine/src/common/java/src/main/java/com/alibaba/maxgraph/common/util/CommonUtil.java index 95ee16ac9148..3fecf750d394 100644 --- a/interactive_engine/src/common/java/src/main/java/com/alibaba/maxgraph/common/util/CommonUtil.java +++ b/interactive_engine/src/common/java/src/main/java/com/alibaba/maxgraph/common/util/CommonUtil.java @@ -1,12 +1,12 @@ /** * Copyright 2020 Alibaba Group Holding Limited. - * + *

* Licensed 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 - * + *

+ * 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. @@ -23,11 +23,9 @@ import com.alibaba.maxgraph.sdkcommon.util.JSON; import com.alibaba.maxgraph.sdkcommon.util.PropertyUtil; import com.fasterxml.jackson.core.type.TypeReference; -import com.google.common.base.Preconditions; import com.google.common.collect.Maps; import com.google.common.util.concurrent.ThreadFactoryBuilder; import org.apache.commons.lang3.StringUtils; -import org.apache.hadoop.yarn.api.ApplicationConstants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -36,7 +34,6 @@ import java.io.PrintWriter; import java.io.StringWriter; import java.text.SimpleDateFormat; -import java.util.List; import java.util.Map; import java.util.Properties; import java.util.concurrent.*; @@ -102,13 +99,13 @@ public static Map getConfigFromSystemEnv() { public static InstanceConfig getInstanceConfig(String[] args, int serverId) throws IOException { Map params = getConfigFromSystemEnv(); - if (params!= null && !params.isEmpty()) { - LOG.info("read configs from system env:{}" ,params); + if (params != null && !params.isEmpty()) { + LOG.info("read configs from system env:{}", params); return new InstanceConfig(params); } InstanceConfig config; - if (args!=null && args.length > 0) { + if (args != null && args.length > 0) { Properties properties = PropertyUtil.getProperties(args[0], false); config = new InstanceConfig(properties); } else { @@ -127,7 +124,8 @@ public static String getCurrentDate() { public static String getYarnLogDir() { - String yarnLogDir = System.getenv(ApplicationConstants.Environment.LOG_DIRS.name()); +// String yarnLogDir = System.getenv(ApplicationConstants.Environment.LOG_DIRS.name()); + String yarnLogDir = StringUtils.EMPTY; if (StringUtils.isEmpty(yarnLogDir)) { return "/tmp"; } else { @@ -144,6 +142,7 @@ public static ExecutorService getGrpcExecutor(int threadCount) { threadCount, new ForkJoinPool.ForkJoinWorkerThreadFactory() { final AtomicInteger num = new AtomicInteger(); + @Override public ForkJoinWorkerThread newThread(ForkJoinPool pool) { ForkJoinWorkerThread thread = ForkJoinPool.defaultForkJoinWorkerThreadFactory.newThread(pool); @@ -152,7 +151,9 @@ public ForkJoinWorkerThread newThread(ForkJoinPool pool) { return thread; } }, - (thread, e) -> { LOG.error("Uncaught exception in thread: {}", thread.getName(), e); }, + (thread, e) -> { + LOG.error("Uncaught exception in thread: {}", thread.getName(), e); + }, true); } diff --git a/interactive_engine/src/common/java/src/main/java/com/alibaba/maxgraph/util/TarUtil.java b/interactive_engine/src/common/java/src/main/java/com/alibaba/maxgraph/util/TarUtil.java deleted file mode 100644 index 749e0254b94a..000000000000 --- a/interactive_engine/src/common/java/src/main/java/com/alibaba/maxgraph/util/TarUtil.java +++ /dev/null @@ -1,62 +0,0 @@ -/** - * Copyright 2020 Alibaba Group Holding Limited. - * - * Licensed 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.maxgraph.util; - -import org.kamranzafar.jtar.TarEntry; -import org.kamranzafar.jtar.TarOutputStream; - -import java.io.*; -import java.nio.file.Paths; - -public class TarUtil { - - private static ThreadLocal buf = new ThreadLocal() { - @Override - protected byte[] initialValue() { - return new byte[8<<10]; - } - }; - - public static void tar(String srcPath) throws IOException { - tar(srcPath, srcPath + ".tar"); - } - - public static void tar(String srcPath, String dstPath) throws IOException { - OutputStream outputStream = new FileOutputStream(dstPath); - TarOutputStream out = new TarOutputStream(outputStream); - tar(out, ".", new File(srcPath)); - out.close(); - } - - private static void tar(TarOutputStream out, String prefix, File file) throws IOException { - if (file.isDirectory()) { - String path = Paths.get(prefix, file.getName()).toString(); - for (File f : file.listFiles()) { - tar(out, path, f); - } - } else { - out.putNextEntry(new TarEntry(file, Paths.get(prefix, file.getName()).toString())); - byte[] buf = TarUtil.buf.get(); - int count = 0; - InputStream inputStream = new FileInputStream(file); - while ((count = inputStream.read(buf)) != -1) { - out.write(buf, 0, count); - } - inputStream.close(); - out.flush(); - } - } -} diff --git a/interactive_engine/src/frontend/frontendservice/pom.xml b/interactive_engine/src/frontend/frontendservice/pom.xml index 017eae2d4212..6e2bc284fd93 100644 --- a/interactive_engine/src/frontend/frontendservice/pom.xml +++ b/interactive_engine/src/frontend/frontendservice/pom.xml @@ -35,10 +35,6 @@ com.google.guava guava - - org.apache.kafka - kafka-clients - com.alibaba fastjson