-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
REF: service-map processor with the latest config model (#4734)
* REF: service-map processor with the latest config model Signed-off-by: George Chen <qchea@amazon.com>
- Loading branch information
1 parent
aeac953
commit c4455a7
Showing
5 changed files
with
91 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
...test/java/org/opensearch/dataprepper/plugins/processor/ServiceMapProcessorConfigTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package org.opensearch.dataprepper.plugins.processor; | ||
|
||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
import org.opensearch.dataprepper.test.helper.ReflectivelySetField; | ||
|
||
import java.util.Random; | ||
|
||
import static org.hamcrest.CoreMatchers.equalTo; | ||
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.opensearch.dataprepper.plugins.processor.ServiceMapProcessorConfig.DEFAULT_WINDOW_DURATION; | ||
|
||
class ServiceMapProcessorConfigTest { | ||
private ServiceMapProcessorConfig serviceMapProcessorConfig; | ||
Random random; | ||
|
||
@BeforeEach | ||
void setUp() { | ||
serviceMapProcessorConfig = new ServiceMapProcessorConfig(); | ||
random = new Random(); | ||
} | ||
|
||
@Test | ||
void testDefaultConfig() { | ||
assertThat(serviceMapProcessorConfig.getWindowDuration(), equalTo(DEFAULT_WINDOW_DURATION)); | ||
} | ||
|
||
@Test | ||
void testGetter() throws NoSuchFieldException, IllegalAccessException { | ||
final int windowDuration = 1 + random.nextInt(300); | ||
ReflectivelySetField.setField( | ||
ServiceMapProcessorConfig.class, | ||
serviceMapProcessorConfig, | ||
"windowDuration", | ||
windowDuration); | ||
assertThat(serviceMapProcessorConfig.getWindowDuration(), equalTo(windowDuration)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters