You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@linkis.apache.org by pe...@apache.org on 2022/06/06 08:09:48 UTC
[incubator-linkis] branch dev-1.1.3 updated: add test case for [linkis-scheduler] #1914 (#2220)
This is an automated email from the ASF dual-hosted git repository.
peacewong pushed a commit to branch dev-1.1.3
in repository https://gitbox.apache.org/repos/asf/incubator-linkis.git
The following commit(s) were added to refs/heads/dev-1.1.3 by this push:
new 2b4d36631 add test case for [linkis-scheduler] #1914 (#2220)
2b4d36631 is described below
commit 2b4d366311b6f795e77acad59c9a761731b6d606
Author: QuintinTao <72...@users.noreply.github.com>
AuthorDate: Mon Jun 6 16:09:42 2022 +0800
add test case for [linkis-scheduler] #1914 (#2220)
---
.../linkis/scheduler/AbstractSchedulerTest.scala | 42 ++++++++++++++++++++++
.../linkis/scheduler/SchedulerContextTest.scala | 28 +++++++++++++++
2 files changed, 70 insertions(+)
diff --git a/linkis-commons/linkis-scheduler/src/test/scala/org/apache/linkis/scheduler/AbstractSchedulerTest.scala b/linkis-commons/linkis-scheduler/src/test/scala/org/apache/linkis/scheduler/AbstractSchedulerTest.scala
new file mode 100644
index 000000000..128139d06
--- /dev/null
+++ b/linkis-commons/linkis-scheduler/src/test/scala/org/apache/linkis/scheduler/AbstractSchedulerTest.scala
@@ -0,0 +1,42 @@
+/*
+ * 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.scheduler
+
+import org.apache.linkis.scheduler.queue.UserJob
+import org.apache.linkis.scheduler.queue.fifoqueue.{FIFOScheduler, FIFOSchedulerContextImpl}
+import org.junit.jupiter.api.Assertions.{assertEquals, assertNotNull, assertTrue}
+import org.junit.jupiter.api.Test
+
+class AbstractSchedulerTest {
+ @Test
+ def testSubmit: Unit = {
+ val userJob = UserJob()
+ val schedulerContext = new FIFOSchedulerContextImpl(100)
+ val fIFOScheduler = new FIFOScheduler(schedulerContext)
+ fIFOScheduler.submit(userJob)
+ assertNotNull(fIFOScheduler.getSchedulerContext.getOrCreateConsumerManager.getOrCreateConsumer("FIFO-Group"))
+ assertNotNull(fIFOScheduler.get(userJob))
+ }
+
+ @Test
+ def testShutdown: Unit = {
+ val schedulerContext = new FIFOSchedulerContextImpl(100)
+ val fIFOScheduler = new FIFOScheduler(schedulerContext)
+ fIFOScheduler.shutdown
+ assertTrue(fIFOScheduler.getSchedulerContext.getOrCreateConsumerManager.getOrCreateExecutorService.isShutdown)
+ }
+}
diff --git a/linkis-commons/linkis-scheduler/src/test/scala/org/apache/linkis/scheduler/SchedulerContextTest.scala b/linkis-commons/linkis-scheduler/src/test/scala/org/apache/linkis/scheduler/SchedulerContextTest.scala
new file mode 100644
index 000000000..313251b28
--- /dev/null
+++ b/linkis-commons/linkis-scheduler/src/test/scala/org/apache/linkis/scheduler/SchedulerContextTest.scala
@@ -0,0 +1,28 @@
+/*
+ * 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.scheduler
+
+import org.junit.jupiter.api.Assertions.assertNotNull
+import org.junit.jupiter.api.Test
+
+class SchedulerContextTest {
+ @Test
+ def testSchedulerContext: Unit = {
+ val schedulerContext = SchedulerContext
+ assertNotNull(schedulerContext)
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@linkis.apache.org
For additional commands, e-mail: commits-help@linkis.apache.org