VIVIMAN
3 years ago
10 changed files with 186 additions and 137 deletions
@ -0,0 +1,24 @@ |
|||||
|
package com.insigma.func; |
||||
|
|
||||
|
import java.util.function.Consumer; |
||||
|
|
||||
|
/** |
||||
|
* @author Vivim |
||||
|
*/ |
||||
|
public class RunThrowingConsumer { |
||||
|
/*** |
||||
|
* 带有参数和异常处理的的消费接口 |
||||
|
|
||||
|
*/ |
||||
|
public static <T> Consumer<T> throwingConsumerWrapper( |
||||
|
ThrowingConsumer<T, Exception> throwingConsumer) { |
||||
|
|
||||
|
return i -> { |
||||
|
try { |
||||
|
throwingConsumer.accept(i); |
||||
|
} catch (Exception ex) { |
||||
|
throw new RuntimeException(ex); |
||||
|
} |
||||
|
}; |
||||
|
} |
||||
|
} |
@ -0,0 +1,14 @@ |
|||||
|
package com.insigma.func; |
||||
|
|
||||
|
/** |
||||
|
* @author Vivim |
||||
|
*/ |
||||
|
@FunctionalInterface |
||||
|
public interface ThrowingConsumer<T, E extends Exception> { |
||||
|
/*** |
||||
|
* 带有参数和异常处理的的消费接口 |
||||
|
* @param t |
||||
|
* @throws E |
||||
|
*/ |
||||
|
void accept(T t) throws E; |
||||
|
} |
@ -0,0 +1,46 @@ |
|||||
|
package com.insigma.ui; |
||||
|
|
||||
|
import com.insigma.entry.IndexObj; |
||||
|
import com.insigma.entry.TabColObj; |
||||
|
import com.insigma.service.impl.WindowsTomcatMysql; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
|
||||
|
import javax.swing.*; |
||||
|
import java.awt.*; |
||||
|
import java.awt.event.ActionListener; |
||||
|
|
||||
|
/** |
||||
|
* (Test 类) 测试工具类 |
||||
|
* |
||||
|
* @author zhangxianwei |
||||
|
* @since 21:30 2022/4/28 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
public class Test { |
||||
|
|
||||
|
protected static void runTest(JPanel textPanel) { |
||||
|
addButton(textPanel, new JButton("执行shell命令"), e -> new WindowsTomcatMysql().runShell("SERVICES.MSC")); |
||||
|
addButton(textPanel, new JButton("备份"), e -> new WindowsTomcatMysql().runBak()); |
||||
|
// addButton(textPanel, new JButton("还原"), e -> new WindowsTomcatMysql().runRestore(""));
|
||||
|
addButton(textPanel, new JButton("重建索引"), e -> new WindowsTomcatMysql().rebuildIndex(IndexObj.getData())); |
||||
|
addButton(textPanel, new JButton("设置数据库大小"), e -> new WindowsTomcatMysql().setDbSize(512)); |
||||
|
addButton(textPanel, new JButton("清楚垃圾数据"), e -> new WindowsTomcatMysql().cleanDbCache(TabColObj.getSQL(), TabColObj.getData())); |
||||
|
addButton(textPanel, new JButton("注册数据库服务"), e -> new WindowsTomcatMysql().registrationDbService()); |
||||
|
addButton(textPanel, new JButton("清楚应用缓存"), e -> new WindowsTomcatMysql().cleanMwCache()); |
||||
|
addButton(textPanel, new JButton("设置中间件大小"), e -> new WindowsTomcatMysql().setMwSize(128,256,512,512)); |
||||
|
addButton(textPanel, new JButton("注册中间件服务"), e -> new WindowsTomcatMysql().registrationMwService()); |
||||
|
addButton(textPanel, new JButton("启动数据库服务"), e -> new WindowsTomcatMysql().startDbService()); |
||||
|
addButton(textPanel, new JButton("停止数据库服务"), e -> new WindowsTomcatMysql().stopDbService()); |
||||
|
addButton(textPanel, new JButton("启动中间件服务"), e -> new WindowsTomcatMysql().startMwService()); |
||||
|
addButton(textPanel, new JButton("停止中间件服务"), e -> new WindowsTomcatMysql().stopMwService()); |
||||
|
addButton(textPanel, new JButton("打开本地服务"), e -> new WindowsTomcatMysql().openServer()); |
||||
|
} |
||||
|
|
||||
|
private static void addButton(JPanel textPanel, JButton button, ActionListener l) { |
||||
|
button.setFont(new Font("微软雅黑", Font.PLAIN, 15)); |
||||
|
button.setBounds(14, 13, 170, 35); |
||||
|
button.addActionListener(l); |
||||
|
log.info("输出对象:{}", button); |
||||
|
textPanel.add(button); |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue