You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampark.apache.org by be...@apache.org on 2023/02/22 05:39:24 UTC
[incubator-streampark] branch dev updated: [Fix] Test classes should be under sp package (#2353)
This is an automated email from the ASF dual-hosted git repository.
benjobs pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-streampark.git
The following commit(s) were added to refs/heads/dev by this push:
new 3801ffc19 [Fix] Test classes should be under sp package (#2353)
3801ffc19 is described below
commit 3801ffc196bb23040bb2ae172734d4018e9f9a84
Author: tison <wa...@gmail.com>
AuthorDate: Wed Feb 22 13:39:18 2023 +0800
[Fix] Test classes should be under sp package (#2353)
Signed-off-by: tison <wa...@gmail.com>
---
.../benmanes/caffeine/cache/RefreshCacheTest.java | 47 ----------------------
.../apache/streampark/common/util}/RegexTest.java | 6 +--
.../console/core/bean/SenderEmailTest.java} | 12 +++---
3 files changed, 9 insertions(+), 56 deletions(-)
diff --git a/streampark-console/streampark-console-service/src/test/java/com/github/benmanes/caffeine/cache/RefreshCacheTest.java b/streampark-console/streampark-console-service/src/test/java/com/github/benmanes/caffeine/cache/RefreshCacheTest.java
deleted file mode 100644
index 5917b1711..000000000
--- a/streampark-console/streampark-console-service/src/test/java/com/github/benmanes/caffeine/cache/RefreshCacheTest.java
+++ /dev/null
@@ -1,47 +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 com.github.benmanes.caffeine.cache;
-
-import org.junit.jupiter.api.Test;
-
-import java.util.UUID;
-import java.util.concurrent.TimeUnit;
-
-class RefreshCacheTest {
-
- Cache<String, String> caffeine = null;
-
- @Test
- void cache() throws Exception {
- if (caffeine == null) {
- caffeine =
- Caffeine.newBuilder().refreshAfterWrite(50, TimeUnit.MILLISECONDS).build(this::refresh);
- }
- caffeine.put("config", "hadoop");
- int count = 4;
- while (count > 0) {
- System.out.println(caffeine.getIfPresent("config"));
- Thread.sleep(100L);
- --count;
- }
- }
-
- public String refresh(String value) {
- return UUID.randomUUID() + "@" + value;
- }
-}
diff --git a/streampark-console/streampark-console-service/src/test/java/java/util/regex/RegexTest.java b/streampark-console/streampark-console-service/src/test/java/org/apache/streampark/common/util/RegexTest.java
similarity index 97%
rename from streampark-console/streampark-console-service/src/test/java/java/util/regex/RegexTest.java
rename to streampark-console/streampark-console-service/src/test/java/org/apache/streampark/common/util/RegexTest.java
index c0aa02644..4fe9eaaa4 100644
--- a/streampark-console/streampark-console-service/src/test/java/java/util/regex/RegexTest.java
+++ b/streampark-console/streampark-console-service/src/test/java/org/apache/streampark/common/util/RegexTest.java
@@ -15,9 +15,7 @@
* limitations under the License.
*/
-package java.util.regex;
-
-import org.apache.streampark.common.util.CommandUtils;
+package org.apache.streampark.common.util;
import org.junit.jupiter.api.Test;
@@ -28,6 +26,8 @@ import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import java.util.stream.Collectors;
class RegexTest {
diff --git a/streampark-console/streampark-console-service/src/test/java/org/apache/commons/mail/SendEmailTest.java b/streampark-console/streampark-console-service/src/test/java/org/apache/streampark/console/core/bean/SenderEmailTest.java
similarity index 94%
rename from streampark-console/streampark-console-service/src/test/java/org/apache/commons/mail/SendEmailTest.java
rename to streampark-console/streampark-console-service/src/test/java/org/apache/streampark/console/core/bean/SenderEmailTest.java
index e8a9f619a..0b6da539b 100644
--- a/streampark-console/streampark-console-service/src/test/java/org/apache/commons/mail/SendEmailTest.java
+++ b/streampark-console/streampark-console-service/src/test/java/org/apache/streampark/console/core/bean/SenderEmailTest.java
@@ -15,17 +15,17 @@
* limitations under the License.
*/
-package org.apache.commons.mail;
+package org.apache.streampark.console.core.bean;
import org.apache.streampark.common.util.DateUtils;
import org.apache.streampark.common.util.YarnUtils;
import org.apache.streampark.console.base.util.FreemarkerUtils;
-import org.apache.streampark.console.core.bean.AlertTemplate;
-import org.apache.streampark.console.core.bean.SenderEmail;
import org.apache.streampark.console.core.entity.Application;
import org.apache.streampark.console.core.enums.FlinkAppState;
import freemarker.template.Template;
+import org.apache.commons.mail.EmailException;
+import org.apache.commons.mail.HtmlEmail;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -35,14 +35,14 @@ import java.util.HashMap;
import java.util.Map;
import java.util.TimeZone;
-class SendEmailTest {
+class SenderEmailTest {
private Template template;
private SenderEmail senderEmail;
@BeforeEach
- void initConfig() throws Exception {
+ void initConfig() {
this.template = FreemarkerUtils.loadTemplateFile("alert-email.ftl");
senderEmail = new SenderEmail();
senderEmail.setFrom("****@domain.com");
@@ -77,7 +77,7 @@ class SendEmailTest {
mail.setStatus(appState.name());
StringWriter writer = new StringWriter();
- Map<String, AlertTemplate> out = new HashMap<String, AlertTemplate>();
+ Map<String, AlertTemplate> out = new HashMap<>();
out.put("mail", mail);
template.process(out, writer);