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:04:27 UTC
[incubator-linkis] branch dev-1.2.1 updated: Add ResourceDaoTest (#2623)
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 ac203efa2 Add ResourceDaoTest (#2623)
ac203efa2 is described below
commit ac203efa2ccb20b64c826c5a4bbe42ab4aced5e9
Author: 成彬彬 <10...@users.noreply.github.com>
AuthorDate: Mon Aug 8 12:04:23 2022 +0800
Add ResourceDaoTest (#2623)
---
.../org/apache/linkis/bml/dao/ResourceDaoTest.java | 101 +++++++++++++++++++++
1 file changed, 101 insertions(+)
diff --git a/linkis-public-enhancements/linkis-bml/linkis-bml-server/src/test/java/org/apache/linkis/bml/dao/ResourceDaoTest.java b/linkis-public-enhancements/linkis-bml/linkis-bml-server/src/test/java/org/apache/linkis/bml/dao/ResourceDaoTest.java
new file mode 100644
index 000000000..4e2308eab
--- /dev/null
+++ b/linkis-public-enhancements/linkis-bml/linkis-bml-server/src/test/java/org/apache/linkis/bml/dao/ResourceDaoTest.java
@@ -0,0 +1,101 @@
+/*
+ * 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.Resource;
+
+import org.springframework.beans.factory.annotation.Autowired;
+
+import org.junit.jupiter.api.Test;
+
+import java.util.*;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+class ResourceDaoTest extends BaseDaoTest {
+
+ @Autowired ResourceDao resourceDao;
+
+ @Test
+ void getResources() {
+ uploadResource();
+ Map<String, Object> map = new HashMap<>();
+ map.put("owner", "testowner");
+ map.put("resource_id", "123");
+ map.put("sys", "testsys");
+ resourceDao.getResources(map);
+ }
+
+ @Test
+ void deleteResource() {
+ uploadResource();
+ resourceDao.deleteResource("123");
+ }
+
+ @Test
+ void batchDeleteResources() {
+ uploadResource();
+ List<String> list = new ArrayList<>();
+ list.add("123");
+ list.add("2");
+ list.add("3");
+ resourceDao.batchDeleteResources(list);
+ }
+
+ @Test
+ void uploadResource() {
+ Resource resource = new Resource();
+ resource.setResourceId("123");
+ resource.setResourceHeader("2");
+ resource.setDownloadedFileName("testFileName");
+ resource.setSystem("testSystem");
+ resource.setCreateTime(new Date());
+ resource.setUser("testUser");
+ resource.setExpireTime("2012.12.02");
+ resource.setMaxVersion(3);
+ resource.setUpdateTime(new Date());
+ resource.setUpdator("testUpdator");
+ resource.setEnableFlag(false);
+ resourceDao.uploadResource(resource);
+ }
+
+ @Test
+ void checkExists() {
+ uploadResource();
+ resourceDao.checkExists("123");
+ }
+
+ @Test
+ void getResource() {
+ uploadResource();
+ resourceDao.getResource("123");
+ }
+
+ @Test
+ void getUserByResourceId() {
+ uploadResource();
+ resourceDao.getUserByResourceId("123");
+ }
+
+ @Test
+ void changeOwner() {
+ String oldOwner = "oldtest";
+ String newOwner = "newtest";
+ resourceDao.changeOwner("123", oldOwner, newOwner);
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@linkis.apache.org
For additional commands, e-mail: commits-help@linkis.apache.org