You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@linkis.apache.org by ca...@apache.org on 2022/08/11 06:51:07 UTC

[incubator-linkis] branch dev-1.2.1 updated: [ISSUES-2672]Add DownloadServiceImplTest unit test (#2674)

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

casion pushed a commit to branch dev-1.2.1
in repository https://gitbox.apache.org/repos/asf/incubator-linkis.git


The following commit(s) were added to refs/heads/dev-1.2.1 by this push:
     new f959e70e2 [ISSUES-2672]Add DownloadServiceImplTest unit test (#2674)
f959e70e2 is described below

commit f959e70e21d1f4d45a6ab477339a133dcb4f476f
Author: 成彬彬 <10...@users.noreply.github.com>
AuthorDate: Thu Aug 11 14:51:01 2022 +0800

    [ISSUES-2672]Add DownloadServiceImplTest unit test (#2674)
    
    * Add DownloadServiceImplTest unit test
---
 .../bml/service/DownloadServiceImplTest.java       | 55 ++++++++++++++++++++++
 1 file changed, 55 insertions(+)

diff --git a/linkis-public-enhancements/linkis-bml/linkis-bml-server/src/test/java/org/apache/linkis/bml/service/DownloadServiceImplTest.java b/linkis-public-enhancements/linkis-bml/linkis-bml-server/src/test/java/org/apache/linkis/bml/service/DownloadServiceImplTest.java
new file mode 100644
index 000000000..00dbaa107
--- /dev/null
+++ b/linkis-public-enhancements/linkis-bml/linkis-bml-server/src/test/java/org/apache/linkis/bml/service/DownloadServiceImplTest.java
@@ -0,0 +1,55 @@
+/*
+ * 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.linkis.bml.service;
+
+import org.apache.linkis.bml.dao.DownloadDao;
+import org.apache.linkis.bml.entity.DownloadModel;
+import org.apache.linkis.bml.service.impl.DownloadServiceImpl;
+
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.junit.jupiter.MockitoExtension;
+
+import java.util.Date;
+
+/** DownloadServiceImpl Tester */
+@ExtendWith(MockitoExtension.class)
+public class DownloadServiceImplTest {
+
+    @InjectMocks private DownloadServiceImpl downloadServiceImpl;
+
+    @Mock private DownloadDao downloadDao;
+
+    @Test
+    public void testAddDownloadRecord() throws Exception {
+        DownloadModel downloadModel = new DownloadModel();
+        downloadModel.setDownloader("test");
+        downloadModel.setClientIp("192.143.253");
+        downloadModel.setEndTime(new Date());
+        downloadModel.setId(12);
+        downloadModel.setState(1);
+        downloadModel.setStartTime(new Date());
+        downloadModel.setVersion("1.2");
+        downloadModel.setResourceId("32");
+        Mockito.doNothing().when(downloadDao).insertDownloadModel(downloadModel);
+        downloadServiceImpl.addDownloadRecord(downloadModel);
+    }
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@linkis.apache.org
For additional commands, e-mail: commits-help@linkis.apache.org