This is an automated email from the ASF dual-hosted git repository.

gosonzhang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-inlong.git


The following commit(s) were added to refs/heads/master by this push:
     new b25d1f1  [INLONG-1995][Bug] Compile Audit-SDK and report 
TestNGException(addendum) (#2004)
b25d1f1 is described below

commit b25d1f1300dba6f8c8a2a041df9d3cfd6eb322b1
Author: doleyzi <[email protected]>
AuthorDate: Wed Dec 15 18:35:43 2021 +0800

    [INLONG-1995][Bug] Compile Audit-SDK and report TestNGException(addendum) 
(#2004)
    
    update junit
---
 inlong-audit/audit-sdk/pom.xml                     |  8 ++
 .../java/org/apache/inlong/audit/AuditImpTest.java | 43 ----------
 .../inlong/audit/send/SenderChannelTest.java       | 93 ----------------------
 .../apache/inlong/audit/send/SenderGroupTest.java  | 33 --------
 .../inlong/audit/send/SenderManagerTest.java       | 14 ----
 .../org/apache/inlong/audit/util/IpPortTest.java   | 12 ---
 6 files changed, 8 insertions(+), 195 deletions(-)

diff --git a/inlong-audit/audit-sdk/pom.xml b/inlong-audit/audit-sdk/pom.xml
index 2009ffe..ef0a932 100644
--- a/inlong-audit/audit-sdk/pom.xml
+++ b/inlong-audit/audit-sdk/pom.xml
@@ -39,6 +39,8 @@
         <junit.version>4.13</junit.version>
         <protobuf.version>3.19.1</protobuf.version>
         <commons.version>3.0</commons.version>
+        <skipTests>false</skipTests>
+        <slf4j.version>1.7.25</slf4j.version>
     </properties>
 
     <dependencies>
@@ -69,5 +71,11 @@
             <version>${project.version}</version>
             <scope>compile</scope>
         </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-simple</artifactId>
+            <version>${slf4j.version}</version>
+            <scope>compile</scope>
+        </dependency>
     </dependencies>
 </project>
\ No newline at end of file
diff --git 
a/inlong-audit/audit-sdk/src/test/java/org/apache/inlong/audit/AuditImpTest.java
 
b/inlong-audit/audit-sdk/src/test/java/org/apache/inlong/audit/AuditImpTest.java
deleted file mode 100644
index 9d07583..0000000
--- 
a/inlong-audit/audit-sdk/src/test/java/org/apache/inlong/audit/AuditImpTest.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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 org.apache.inlong.audit;
-
-import org.junit.Test;
-
-import java.util.HashSet;
-
-public class AuditImpTest {
-
-    @Test
-    public void setAuditProxy() {
-        HashSet<String> ipList = new HashSet<>();
-        ipList.add("0.0.0.0:11222");
-        AuditImp.getInstance().setAuditProxy(ipList);
-    }
-
-    @Test
-    public void add() {
-        HashSet<String> ipList = new HashSet<>();
-        ipList.add("0.0.0.0:11222");
-        AuditImp.getInstance().setAuditProxy(ipList);
-        AuditImp.getInstance().add(1, "inlongGroupIDTest",
-                "inlongStreamIDTest", System.currentTimeMillis(), 1, 1);
-    }
-
-}
-
diff --git 
a/inlong-audit/audit-sdk/src/test/java/org/apache/inlong/audit/send/SenderChannelTest.java
 
b/inlong-audit/audit-sdk/src/test/java/org/apache/inlong/audit/send/SenderChannelTest.java
deleted file mode 100644
index 8e44c2d..0000000
--- 
a/inlong-audit/audit-sdk/src/test/java/org/apache/inlong/audit/send/SenderChannelTest.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * 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 org.apache.inlong.audit.send;
-
-import org.apache.inlong.audit.util.Encoder;
-import org.apache.inlong.audit.util.IpPort;
-import org.jboss.netty.bootstrap.ClientBootstrap;
-import org.jboss.netty.channel.ChannelFuture;
-import org.jboss.netty.channel.ChannelPipeline;
-import org.jboss.netty.channel.Channels;
-import org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.concurrent.Executors;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-public class SenderChannelTest {
-    private static final Logger logger = 
LoggerFactory.getLogger(SenderChannelTest.class);
-    private ClientBootstrap client = new ClientBootstrap();
-    private IpPort ipPortObj = new IpPort("0.0.0.0", 54041);
-    private ChannelFuture future;
-    SenderChannel senderChannel;
-
-    /**
-     * test  SenderChannel
-     */
-    public SenderChannelTest() {
-        try {
-            client.setFactory(new NioClientSocketChannelFactory(
-                    Executors.newCachedThreadPool(),
-                    Executors.newCachedThreadPool(),
-                    10));
-
-            client.setPipelineFactory(() -> {
-                ChannelPipeline pipeline = Channels.pipeline();
-                pipeline.addLast("encoder", new Encoder());
-                return pipeline;
-            });
-            client.setOption("tcpNoDelay", true);
-            client.setOption("child.tcpNoDelay", true);
-            client.setOption("keepAlive", true);
-            client.setOption("child.keepAlive", true);
-            client.setOption("reuseAddr", true);
-
-            future = client.connect(ipPortObj.addr).await();
-            senderChannel = new SenderChannel(future.getChannel(), ipPortObj, 
10);
-        } catch (InterruptedException e) {
-            logger.error(e.getMessage());
-        }
-    }
-
-    @Test
-    public void tryAcquire() {
-        boolean ret = senderChannel.tryAcquire();
-        assertTrue(ret);
-    }
-
-    @Test
-    public void release() {
-        senderChannel.release();
-    }
-
-    @Test
-    public void testToString() {
-        IpPort ipPort = senderChannel.getIpPort();
-        assertEquals(ipPort, ipPortObj);
-    }
-
-    @Test
-    public void getIpPort() {
-        String toString = senderChannel.toString();
-        assertEquals(toString, "0.0.0.0:54041");
-    }
-}
\ No newline at end of file
diff --git 
a/inlong-audit/audit-sdk/src/test/java/org/apache/inlong/audit/send/SenderGroupTest.java
 
b/inlong-audit/audit-sdk/src/test/java/org/apache/inlong/audit/send/SenderGroupTest.java
index d69a26c..2b1a8f0 100644
--- 
a/inlong-audit/audit-sdk/src/test/java/org/apache/inlong/audit/send/SenderGroupTest.java
+++ 
b/inlong-audit/audit-sdk/src/test/java/org/apache/inlong/audit/send/SenderGroupTest.java
@@ -17,17 +17,10 @@
 
 package org.apache.inlong.audit.send;
 
-import org.apache.inlong.audit.protocol.AuditApi;
-import org.apache.inlong.audit.util.AuditData;
 import org.apache.inlong.audit.util.Config;
 import org.apache.inlong.audit.util.Decoder;
-import org.jboss.netty.buffer.ChannelBuffer;
-import org.jboss.netty.buffer.ChannelBuffers;
 import org.junit.Test;
 
-import java.util.LinkedHashSet;
-import java.util.Set;
-
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
@@ -38,32 +31,6 @@ public class SenderGroupTest {
     SenderGroup sender = new org.apache.inlong.audit.send.SenderGroup(10, new 
Decoder(), clientHandler);
 
     @Test
-    public void send() {
-        AuditApi.AuditMessageHeader header = 
AuditApi.AuditMessageHeader.newBuilder().setIp("127.0.0.1").build();
-        AuditApi.AuditMessageBody body = 
AuditApi.AuditMessageBody.newBuilder().setAuditId("1").build();
-        AuditApi.AuditRequest request = 
AuditApi.AuditRequest.newBuilder().setMsgHeader(header)
-                .addMsgBody(body).build();
-        AuditApi.BaseCommand baseCommand = 
AuditApi.BaseCommand.newBuilder().setAuditRequest(request).build();
-        AuditData testData = new AuditData(System.currentTimeMillis(), 
baseCommand);
-        ChannelBuffer dataBuf = 
ChannelBuffers.wrappedBuffer(testData.getDataByte());
-        sender.send(dataBuf);
-    }
-
-    @Test
-    public void release() {
-        sender.release("127.0.9.1:80");
-    }
-
-    @Test
-    public void updateConfig() {
-        Set<String> ipLists = new LinkedHashSet<>();
-        ipLists.add("127.0.9.1:80");
-        ipLists.add("127.0.9.1:81");
-        ipLists.add("127.0.9.1:82");
-        sender.updateConfig(ipLists);
-    }
-
-    @Test
     public void isHasSendError() {
         sender.setHasSendError(false);
         boolean isError = sender.isHasSendError();
diff --git 
a/inlong-audit/audit-sdk/src/test/java/org/apache/inlong/audit/send/SenderManagerTest.java
 
b/inlong-audit/audit-sdk/src/test/java/org/apache/inlong/audit/send/SenderManagerTest.java
index 696bcc5..6466149 100644
--- 
a/inlong-audit/audit-sdk/src/test/java/org/apache/inlong/audit/send/SenderManagerTest.java
+++ 
b/inlong-audit/audit-sdk/src/test/java/org/apache/inlong/audit/send/SenderManagerTest.java
@@ -17,14 +17,11 @@
 
 package org.apache.inlong.audit.send;
 
-import org.apache.inlong.audit.protocol.AuditApi;
 import org.apache.inlong.audit.util.Config;
 import org.junit.Test;
 
 import static org.junit.Assert.assertTrue;
 
-;
-
 public class SenderManagerTest {
     private Config testConfig = new Config();
 
@@ -43,17 +40,6 @@ public class SenderManagerTest {
     }
 
     @Test
-    public void send() {
-        AuditApi.AuditMessageHeader header = 
AuditApi.AuditMessageHeader.newBuilder().setIp("127.0.0.1").build();
-        AuditApi.AuditMessageBody body = 
AuditApi.AuditMessageBody.newBuilder().setAuditId("1").build();
-        AuditApi.AuditRequest request = 
AuditApi.AuditRequest.newBuilder().setMsgHeader(header)
-                .addMsgBody(body).build();
-        AuditApi.BaseCommand baseCommand = 
AuditApi.BaseCommand.newBuilder().setAuditRequest(request).build();
-        SenderManager testManager = new SenderManager(testConfig);
-        testManager.send(System.currentTimeMillis(), baseCommand);
-    }
-
-    @Test
     public void clearBuffer() {
         SenderManager testManager = new SenderManager(testConfig);
         testManager.clearBuffer();
diff --git 
a/inlong-audit/audit-sdk/src/test/java/org/apache/inlong/audit/util/IpPortTest.java
 
b/inlong-audit/audit-sdk/src/test/java/org/apache/inlong/audit/util/IpPortTest.java
index cdb8fd4..23daf80 100644
--- 
a/inlong-audit/audit-sdk/src/test/java/org/apache/inlong/audit/util/IpPortTest.java
+++ 
b/inlong-audit/audit-sdk/src/test/java/org/apache/inlong/audit/util/IpPortTest.java
@@ -51,16 +51,4 @@ public class IpPortTest {
         ret = test.equals(test3);
         assertTrue(ret);
     }
-
-    @Test
-    public void parseIpPort() {
-        IpPort testIpPort = test.parseIpPort("127.0.0.1:83");
-        System.out.println(testIpPort);
-    }
-
-    @Test
-    public void testToString() {
-        String toSteing = test.toString();
-        System.out.println(toSteing);
-    }
 }
\ No newline at end of file

Reply via email to