Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
add UT for EventLogFileHandlerTests
Browse files Browse the repository at this point in the history
  • Loading branch information
yu-sun-77 committed Jan 4, 2021
1 parent 4e1dc69 commit 8b8f994
Showing 1 changed file with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
package com.amazon.opendistro.elasticsearch.performanceanalyzer.reader_writer_shared;

import java.io.File;

import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import static org.mockito.Mockito.when;
import static org.mockito.MockitoAnnotations.initMocks;

import com.amazon.opendistro.elasticsearch.performanceanalyzer.collectors.HeapMetricsCollector;
import com.amazon.opendistro.elasticsearch.performanceanalyzer.config.PerformanceAnalyzerController;
import com.amazon.opendistro.elasticsearch.performanceanalyzer.http_action.config.PerformanceAnalyzerConfigAction;
import com.amazon.opendistro.elasticsearch.performanceanalyzer.metrics.MetricsConfiguration;
import com.amazon.opendistro.elasticsearch.performanceanalyzer.metrics.PerformanceAnalyzerMetrics;
import com.amazon.opendistro.elasticsearch.performanceanalyzer.writer.EventLogQueueProcessor;
import static org.mockito.Mockito.when;
import static org.mockito.MockitoAnnotations.initMocks;
import java.io.File;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;

public class EventLogFileHandlerTest {
@Mock
private PerformanceAnalyzerController mockController;
public class EventLogFileHandlerTests {
@Mock private PerformanceAnalyzerController mockController;
@Mock private PerformanceAnalyzerConfigAction configAction;

String pathToTestMetricsDir;

Expand All @@ -27,6 +27,7 @@ public void init() {
deleteDirectory(new File(pathToTestMetricsDir));
boolean newDir = new File(pathToTestMetricsDir).mkdir();
when(mockController.isPerformanceAnalyzerEnabled()).thenReturn(true);
PerformanceAnalyzerConfigAction.setInstance(configAction);
}

private boolean deleteDirectory(File directoryToBeDeleted) {
Expand Down

0 comments on commit 8b8f994

Please sign in to comment.