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/08 04:01:10 UTC

[incubator-linkis] branch dev-1.2.1 updated: Add BmlProjectDaoTest (#2621)

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 4feab70f1 Add  BmlProjectDaoTest (#2621)
4feab70f1 is described below

commit 4feab70f1b1e09b016c6a4ae1a4af4719a7474e3
Author: 成彬彬 <10...@users.noreply.github.com>
AuthorDate: Mon Aug 8 12:01:05 2022 +0800

    Add  BmlProjectDaoTest (#2621)
---
 .../apache/linkis/bml/dao/BmlProjectDaoTest.java   | 104 +++++++++++++++++++++
 1 file changed, 104 insertions(+)

diff --git a/linkis-public-enhancements/linkis-bml/linkis-bml-server/src/test/java/org/apache/linkis/bml/dao/BmlProjectDaoTest.java b/linkis-public-enhancements/linkis-bml/linkis-bml-server/src/test/java/org/apache/linkis/bml/dao/BmlProjectDaoTest.java
new file mode 100644
index 000000000..2f3816e3c
--- /dev/null
+++ b/linkis-public-enhancements/linkis-bml/linkis-bml-server/src/test/java/org/apache/linkis/bml/dao/BmlProjectDaoTest.java
@@ -0,0 +1,104 @@
+/*
+ * 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.dao;
+
+import org.apache.linkis.bml.entity.BmlProject;
+
+import org.springframework.beans.factory.annotation.Autowired;
+
+import org.junit.jupiter.api.Test;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+class BmlProjectDaoTest extends BaseDaoTest {
+
+    @Autowired BmlProjectDao bmlProjectDao;
+
+    @Test
+    void createNewProject() {
+        BmlProject bmlProject = new BmlProject();
+        bmlProject.setName("testName");
+        bmlProject.setSystem("testSy");
+        bmlProject.setSource("test");
+        bmlProject.setDescription("descTest");
+        bmlProject.setCreator("creCreatorUser");
+        bmlProject.setEnabled(1);
+        bmlProject.setCreateTime(new Date());
+        bmlProject.setId(1);
+        bmlProjectDao.createNewProject(bmlProject);
+    }
+
+    @Test
+    void getBmlProject() {
+        createNewProject();
+        bmlProjectDao.getBmlProject("testName");
+    }
+
+    @Test
+    void setProjectPriv() {
+        List<String> usernamesList = new ArrayList<>();
+        usernamesList.add("creCreatorUser");
+        usernamesList.add("creCreatorUser1");
+        int priv = 2;
+        bmlProjectDao.setProjectPriv(1, usernamesList, priv, "creCreatorUser", new Date());
+    }
+
+    @Test
+    void getPrivInProject() {
+        setProjectPriv();
+        createNewProject();
+        bmlProjectDao.getPrivInProject("testName", "creCreatorUser");
+    }
+
+    @Test
+    void addProjectResource() {
+        bmlProjectDao.addProjectResource(1, "123");
+    }
+
+    @Test
+    void getProjectNameByResourceId() {
+        setProjectPriv();
+        bmlProjectDao.getProjectNameByResourceId("123");
+    }
+
+    @Test
+    void getProjectIdByName() {
+        createNewProject();
+        bmlProjectDao.getProjectIdByName("testName");
+    }
+
+    @Test
+    void attachResourceAndProject() {
+        createNewProject();
+        bmlProjectDao.attachResourceAndProject(1, "123");
+    }
+
+    @Test
+    void checkIfExists() {
+        setProjectPriv();
+        bmlProjectDao.checkIfExists(1, "123");
+    }
+
+    @Test
+    void deleteAllPriv() {
+        setProjectPriv();
+        bmlProjectDao.deleteAllPriv(1);
+    }
+}


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