mirror of
https://github.com/aaPanel/aaPanel.git
synced 2026-08-22 07:32:26 +02:00
Update to 7.7.0
Since version 7.7.0, we recommend yours update python to 3.12. [+] Using nginx technology to load static files improves access speed [+] Refactor homepage, website, FTP, and database using vue3 [+] Table loading changed to skeleton screen [+] Add Website statistics-v2 professional plug-in [+] Add Home page - top 5 resource occupancy [+] Add protection for Files management (requires Tamper-proof for Enterprise 3.7) [+] Website, FTP, Databases page add program status [+] Add FTP log analysis (only supports Centos) [+] Add password-free login to phpMyAdmin [+] Add Proxy Project in Website (Supported when web service uses Nginx) [+] Add WP Toolkit (Pro version only) [+] Redesigned Docker module [+] Add WP Toolkit Protection [+] Add WP Toolkit Backup and Restore [+] Add WP Toolkit Migrated [+] Add WP Toolkit Clone site (supports new domain and subdomain) [+] Add WP Toolkit Create site from backup of other panel [+] Add WP Toolkit support for Cron automatic backup (only save Local disk) [+] Add WP Toolkit operation log [+] Add Integrity check for WP Toolkit [+] Add WP Toolkit plug-in management and themes management [*] Optimize phpMyAdmin formula access method [*] Optimize Home page PHP display problem [*] Optimize jump to the login interface after the login expires [*] Optimize automatic renewal of SSL at some times [*] Optimize Let's Encrypt to increase application success rate [-] Fix Logs Audit cannot be opened [-] Fix apache URL rewrite issue [-] Fix phpmyadmin installation problem [-] Fix the problem that some servers cannot install software [-] Fix upload file error [-] Fix left menu hiding problem [-] Fix aaPanel Mobile QR code display problem [-] Fix problem that third-party plug-ins are not displayed in the App Store [-] Fix issue where the menu bar is blank when opening new tabs [-] Fixed panel not being accessible in some cases [-] Fix the issue where Curl warning caused the inability to apply for SSL [-] Fix Quota issues for Website, FTP, Databases [-] Fix file interface display problem on mobile terminal
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
import json
|
||||
import os
|
||||
import time
|
||||
import unittest
|
||||
|
||||
import sys
|
||||
if "/www/server/panel" not in sys.path:
|
||||
sys.path.insert(0, "/www/server/panel")
|
||||
|
||||
if "/www/server/panel/class" not in sys.path:
|
||||
sys.path.insert(0, "/www/server/panel/class")
|
||||
|
||||
from mod.project.java.springboot_parser import SpringConfigParser, SpringLogConfigParser
|
||||
|
||||
|
||||
class TestSpringConfigParser(unittest.TestCase):
|
||||
|
||||
# def test_parser_config(self):
|
||||
# file = "/www/java_mall/yami-shop-admin-0.0.1-SNAPSHOT.jar"
|
||||
# # file = "/www/lilishop/lili-shop-error_jar.jar"
|
||||
# # file = "/www/wwwroot/111_java/demo.jar"
|
||||
# # file = "/www/wwwroot/33_java/tduck-api.jar"
|
||||
# # file = "/www/java_mall/yami-shop-api-0.0.1-SNAPSHOT.jar"
|
||||
#
|
||||
# scp = SpringConfigParser(file)
|
||||
# print(scp.get_tip())
|
||||
#
|
||||
# def test_shell_env(self):
|
||||
# SpringConfigParser.get_env_file_data("/www/wwwroot/33_java/test.sh")
|
||||
|
||||
def test_parser_log_config(self):
|
||||
# file = "/www/java_mall/yami-shop-admin-0.0.1-SNAPSHOT.jar"
|
||||
# file = "/www/lilishop/run_api/buyer-api-4.3.jar"
|
||||
# file = "/www/wwwroot/111_java/demo.jar"
|
||||
# file = "/www/wwwroot/33_java/tduck-api.jar"
|
||||
file = "/www/wwwroot/55_MCMS_java/ms-mcms.jar"
|
||||
# file = "/www/java_mall/yami-shop-api-0.0.1-SNAPSHOT.jar"
|
||||
|
||||
if not os.path.exists(file):
|
||||
print("文件不存在")
|
||||
scp = SpringLogConfigParser(file)
|
||||
print(scp.get_all_log_ptah())
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,46 @@
|
||||
import time
|
||||
import unittest
|
||||
|
||||
import sys
|
||||
if "/www/server/panel" not in sys.path:
|
||||
sys.path.insert(0, "/www/server/panel")
|
||||
|
||||
from mod.project.java.projectMod import main as springboot_main
|
||||
from mod.base.web_conf.util import GET_CLASS
|
||||
from mod.project.java import utils
|
||||
|
||||
|
||||
class TestSpringBootConfig(unittest.TestCase):
|
||||
|
||||
def setUp(self) -> None:
|
||||
self.springboot = springboot_main()
|
||||
|
||||
# def test_process_for_create(self):
|
||||
# get = GET_CLASS()
|
||||
# get.is_java_process = ''
|
||||
# get.search = 'ja'
|
||||
# data = self.springboot.process_for_create(get)
|
||||
# print(data)
|
||||
#
|
||||
# def test_process_info_for_create(self):
|
||||
# get = GET_CLASS()
|
||||
# get.pid = "15701"
|
||||
# data = self.springboot.process_info_for_create(get)
|
||||
# print(data)
|
||||
|
||||
# def test_create_port(self):
|
||||
# t = time.time()
|
||||
# print(t)
|
||||
# print(utils.create_a_not_used_port())
|
||||
# print(time.time() - t)
|
||||
|
||||
def test_get_jar_war_config(self):
|
||||
file = "/www/wwwroot/33_java/tduck-api.jar"
|
||||
data = utils.get_jar_war_config(file)
|
||||
if data:
|
||||
data = utils.to_utf8(data)
|
||||
print(data)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,126 @@
|
||||
import unittest
|
||||
import tempfile
|
||||
import os
|
||||
import zipfile
|
||||
import sys
|
||||
from unittest.mock import patch, MagicMock
|
||||
if "/www/server/panel" not in sys.path:
|
||||
sys.path.append("/www/server/panel")
|
||||
|
||||
from mod.project.java.utils import get_jar_war_config, to_utf8, parse_application_yaml, TomCat
|
||||
|
||||
|
||||
class TestJarWarConfig(unittest.TestCase):
|
||||
def setUp(self):
|
||||
# 创建测试用的zip文件
|
||||
self.test_jar = tempfile.NamedTemporaryFile(delete=False)
|
||||
self.test_jar_name = self.test_jar.name
|
||||
self.test_jar.close()
|
||||
|
||||
# 创建一个包含application.yaml的zip文件
|
||||
with zipfile.ZipFile(self.test_jar_name, 'w') as jar:
|
||||
jar.writestr('application.yaml', 'spring:\n datasource:\n url: jdbc:mysql://localhost:3306/testdb')
|
||||
|
||||
# 创建一个不包含application.yaml的zip文件
|
||||
self.test_jar_no_config = tempfile.NamedTemporaryFile(delete=False)
|
||||
self.test_jar_no_config_name = self.test_jar_no_config.name
|
||||
self.test_jar_no_config.close()
|
||||
|
||||
with zipfile.ZipFile(self.test_jar_no_config_name, 'w') as jar:
|
||||
jar.writestr('README.txt', 'This is a test JAR without configuration')
|
||||
|
||||
# 创建一个非zip文件
|
||||
self.test_non_zip = tempfile.NamedTemporaryFile(delete=False)
|
||||
self.test_non_zip_name = self.test_non_zip.name
|
||||
self.test_non_zip.close()
|
||||
|
||||
# 创建一个不存在的文件路径
|
||||
self.test_non_existent = 'non_existent.jar'
|
||||
|
||||
def tearDown(self):
|
||||
# 删除测试文件
|
||||
os.unlink(self.test_jar_name)
|
||||
os.unlink(self.test_jar_no_config_name)
|
||||
os.unlink(self.test_non_zip_name)
|
||||
|
||||
def test_get_jar_war_config_with_valid_jar(self):
|
||||
# 测试有效的JAR文件
|
||||
result = get_jar_war_config(self.test_jar_name)
|
||||
self.assertIsNotNone(result)
|
||||
self.assertEqual(len(result), 1)
|
||||
self.assertIn('application.yaml', result[0][0])
|
||||
|
||||
def test_get_jar_war_config_with_no_config(self):
|
||||
# 测试没有配置文件的JAR
|
||||
result = get_jar_war_config(self.test_jar_no_config_name)
|
||||
self.assertIsNone(result)
|
||||
|
||||
def test_get_jar_war_config_with_non_zip(self):
|
||||
# 测试非ZIP文件
|
||||
result = get_jar_war_config(self.test_non_zip_name)
|
||||
self.assertIsNone(result)
|
||||
|
||||
def test_get_jar_war_config_with_non_existent(self):
|
||||
# 测试不存在的文件
|
||||
result = get_jar_war_config(self.test_non_existent)
|
||||
self.assertIsNone(result)
|
||||
|
||||
def test_to_utf8(self):
|
||||
# 测试转换为UTF-8
|
||||
byte_data = 'test'.encode('utf-8')
|
||||
file_data_list = [('test.txt', byte_data)]
|
||||
result = to_utf8(file_data_list)
|
||||
self.assertIsNotNone(result)
|
||||
self.assertEqual(result, [('test.txt', 'test')])
|
||||
|
||||
def test_parse_application_yaml_valid(self):
|
||||
# 测试有效的YAML配置
|
||||
byte_data = 'spring:\n datasource:\n url: jdbc:mysql://localhost:3306/testdb'
|
||||
file_data_list = [('application.yaml', byte_data.encode('utf-8'))]
|
||||
result = parse_application_yaml(file_data_list)
|
||||
self.assertIsNotNone(result)
|
||||
self.assertEqual(len(result), 1)
|
||||
self.assertIn('application.yaml', result[0][0])
|
||||
self.assertIsInstance(result[0][1], dict)
|
||||
self.assertEqual(result[0][1]['spring']['datasource']['url'], 'jdbc:mysql://localhost:3306/testdb')
|
||||
|
||||
def test_parse_application_yaml_invalid(self):
|
||||
# 测试无效的YAML配置
|
||||
invalid_byte_data = 'not --- a valid yaml'
|
||||
file_data_list = [('application.yaml', invalid_byte_data.encode('utf-8'))]
|
||||
result = parse_application_yaml(file_data_list)
|
||||
self.assertIsNotNone(result)
|
||||
self.assertEqual(len(result), 0)
|
||||
|
||||
|
||||
class TestTomCat(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.tomcat_path = "/usr/local/bttomcat/tomcat10"
|
||||
self.tomcat = TomCat(self.tomcat_path)
|
||||
|
||||
def test_jdk_path(self):
|
||||
self.assertEqual(self.tomcat.jdk_path, "/usr/local/btjdk/jdk8")
|
||||
|
||||
def test_config_xml(self):
|
||||
self.assertIsNotNone(self.tomcat.config_xml)
|
||||
print(self.tomcat.config_xml)
|
||||
|
||||
def test_save_config_xml(self):
|
||||
self.tomcat.add_host("taaaaa", "/tmp/aaaa")
|
||||
self.tomcat.add_host("taaaaa", "/tmp/aaaa")
|
||||
self.tomcat.add_host("tbbb", "/tmp/tbbb")
|
||||
self.assertEqual(self.tomcat.save_config_xml(), True)
|
||||
with open(self.tomcat_path + "/conf/server.xml", "r") as f:
|
||||
print(f.read())
|
||||
|
||||
self.tomcat.remove_host("tbbb")
|
||||
self.assertEqual(self.tomcat.save_config_xml(), True)
|
||||
with open(self.tomcat_path + "/conf/server.xml", "r") as f:
|
||||
print(f.read())
|
||||
|
||||
def test_status(self):
|
||||
print(self.tomcat.status())
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user