test(frame): 添加 Nifi 日志测试类

- 新增 TestNifiLog 类,用于测试 Nifi 日志查询功能
- 实现了查询指定处理器 ID 和日期的日志信息
- 使用 Spring Boot测试框架,集成 ILoggingEvent20250430Dao
This commit is contained in:
liuy 2025-05-20 16:49:10 +08:00
parent a0900b1cee
commit 675b4a7925
1 changed files with 59 additions and 0 deletions

View File

@ -0,0 +1,59 @@
package com.hzya.frame;
import com.github.pagehelper.PageInfo;
import com.hzya.frame.nifilog.dao.ILoggingEvent20250430Dao;
import com.hzya.frame.nifilog.entity.LoggingEvent20250430Entity;
import com.hzya.frame.page.PageAttribute;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.util.ArrayList;
import java.util.List;
/**
* @Authorliuyang
* @Packagecom.hzya.frame
* @Projectfw-nifi
* @nameTestNifiLog
* @Date2025/5/20 11:53
* @FilenameTestNifiLog
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = {WebappApplication.class})
public class TestNifiLog {
@Autowired
private ILoggingEvent20250430Dao iLoggingEvent20250430Dao;
/**
* 获取nifi token
*/
@Test
public void getAccessToken() {
try {
// PageAttribute<LoggingEvent20250430Entity> loggingEvent20250430EntityPageAttribute = iLoggingEvent20250430Dao.queryPaged();
List<String> arg0List = new ArrayList<>();
arg0List.add("UpdateAttribute[id=ad841aed-30f7-16e2-4fa0-595ab0ab9fdc]");
List<String> logDateList = new ArrayList<>();
logDateList.add("20250519");
logDateList.add("20250520");
LoggingEvent20250430Entity loggingEvent20250430Entity = new LoggingEvent20250430Entity();
loggingEvent20250430Entity.setArg0List(arg0List);
loggingEvent20250430Entity.setLogDateList(logDateList);
loggingEvent20250430Entity.setPageNum(1);
loggingEvent20250430Entity.setPageSize(100);
PageInfo<LoggingEvent20250430Entity> loggingEvent20250430EntityPageInfo = iLoggingEvent20250430Dao.queryLoggingEventByProcessorId(loggingEvent20250430Entity);
List<LoggingEvent20250430Entity> list = loggingEvent20250430EntityPageInfo.getList();
System.out.println(list.size());
} catch (Exception e) {
e.printStackTrace();
}
}
}