Skip to content

Commit 4132e9d

Browse files
authored
Merge pull request #206 from Dokyeongyun/ft-220403-refactoringAlertLogMonitoring
Ft 220403 refactoring alert log monitoring
2 parents c9ebc06 + 4cf74f6 commit 4132e9d

File tree

13 files changed

+387
-181
lines changed

13 files changed

+387
-181
lines changed

pom.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,14 @@
179179
<version>5.7.0</version>
180180
<scope>test</scope>
181181
</dependency>
182+
183+
<!-- mockito -->
184+
<dependency>
185+
<groupId>org.mockito</groupId>
186+
<artifactId>mockito-core</artifactId>
187+
<version>4.3.1</version>
188+
<scope>test</scope>
189+
</dependency>
182190

183191
<!-- logback -->
184192
<dependency>

src/main/java/root/applications/ConsoleApp.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import root.common.server.implement.JschServer;
1616
import root.core.batch.DBCheckBatch;
1717
import root.core.batch.ServerCheckBatch;
18-
import root.core.domain.AlertLogCommandPeriod;
1918
import root.core.domain.JdbcConnectionInfo;
2019
import root.core.domain.JschConnectionInfo;
2120
import root.core.repository.constracts.DBCheckRepository;
@@ -167,9 +166,9 @@ public static void main(String[] args) throws IOException {
167166
ServerCheckUsecase usecase = new ServerCheckUsecaseImpl(repo, ReportFileRepo.getInstance());
168167
ServerCheckBatch serverBatch = new ServerCheckBatch(usecase);
169168

170-
AlertLogCommandPeriod alcp = new AlertLogCommandPeriod(jsch.getAlc(),
171-
DateUtils.addDate(DateUtils.getToday("yyyy-MM-dd"), 0, 0, -1), DateUtils.getToday("yyyy-MM-dd"));
172-
serverBatch.startBatchAlertLogCheckDuringPeriod(alcp);
169+
String startDate = DateUtils.addDate(DateUtils.getToday("yyyy-MM-dd"), 0, 0, -1);
170+
String endDate = DateUtils.getToday("yyyy-MM-dd");
171+
serverBatch.startBatchAlertLogCheckDuringPeriod(jsch.getAlc(), startDate, endDate);
173172
serverBatch.startBatchOSDiskUsageCheck();
174173
System.out.println("■ [ " + jsch.getServerName() + " Monitoring End ]\n\n");
175174
}

src/main/java/root/applications/CsvReportSeparatorApp.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
import java.util.regex.Pattern;
1111

1212
import root.core.repository.constracts.ReportRepository;
13-
import root.core.repository.implement.ReportRepositoryImpl;
13+
import root.core.repository.implement.ReportFileRepo;
1414
import root.utils.DateUtils;
1515

1616
public class CsvReportSeparatorApp {
1717

18-
public static ReportRepository reportRepository = ReportRepositoryImpl.getInstance();
18+
public static ReportRepository reportRepository = ReportFileRepo.getInstance();
1919

2020
public static void main(String[] args) throws IOException {
2121
/*

src/main/java/root/core/batch/ServerCheckBatch.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package root.core.batch;
22

33
import root.core.domain.AlertLogCommand;
4-
import root.core.domain.AlertLogCommandPeriod;
54
import root.core.usecase.constracts.ServerCheckUsecase;
65

76
public class ServerCheckBatch {
@@ -19,9 +18,9 @@ public void startBatchAlertLogCheck(AlertLogCommand alc) {
1918
}
2019
}
2120

22-
public void startBatchAlertLogCheckDuringPeriod(AlertLogCommandPeriod alcp) {
21+
public void startBatchAlertLogCheckDuringPeriod(AlertLogCommand alc, String startDate, String endDate) {
2322
try {
24-
this.serverCheckUsecase.printAlertLogDuringPeriod(alcp);
23+
this.serverCheckUsecase.printAlertLogDuringPeriod(alc, startDate, endDate);
2524
}catch(Exception e) {
2625
e.printStackTrace();
2726
}

src/main/java/root/core/domain/AlertLogCommandPeriod.java

Lines changed: 0 additions & 31 deletions
This file was deleted.

src/main/java/root/core/repository/constracts/ServerCheckRepository.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
import root.core.domain.AlertLog;
88
import root.core.domain.AlertLogCommand;
9-
import root.core.domain.AlertLogCommandPeriod;
109
import root.core.domain.OSDiskUsage;
1110

1211
public interface ServerCheckRepository {
@@ -22,7 +21,7 @@ public interface ServerCheckRepository {
2221

2322
String checkAlertLog(AlertLogCommand alc);
2423

25-
AlertLog checkAlertLogDuringPeriod(AlertLogCommandPeriod alc);
24+
AlertLog checkAlertLogDuringPeriod(AlertLogCommand alc, String startDate, String endDate);
2625

2726
List<OSDiskUsage> checkOSDiskUsage();
2827
}

0 commit comments

Comments
 (0)