-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Taylor Gray <[email protected]>
- Loading branch information
1 parent
d64a260
commit 80058c4
Showing
11 changed files
with
145 additions
and
34 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
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
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
54 changes: 54 additions & 0 deletions
54
...t/java/org/opensearch/dataprepper/plugins/processor/decompress/DecompressionTypeTest.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,54 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.dataprepper.plugins.processor.decompress; | ||
|
||
import org.junit.jupiter.api.extension.ExtensionContext; | ||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.Arguments; | ||
import org.junit.jupiter.params.provider.ArgumentsProvider; | ||
import org.junit.jupiter.params.provider.ArgumentsSource; | ||
import org.opensearch.dataprepper.model.codec.DecompressionEngine; | ||
import org.opensearch.dataprepper.plugins.codec.GZipDecompressionEngine; | ||
|
||
import java.util.stream.Stream; | ||
|
||
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.hamcrest.Matchers.equalTo; | ||
import static org.hamcrest.Matchers.instanceOf; | ||
import static org.junit.jupiter.params.provider.Arguments.arguments; | ||
|
||
public class DecompressionTypeTest { | ||
|
||
@ParameterizedTest | ||
@ArgumentsSource(EnumToStringNameArgumentsProvider.class) | ||
void fromOptionValue_returns_expected_DecompressionType(final DecompressionType expectedEnumValue, final String enumName) { | ||
assertThat(DecompressionType.fromOptionValue(enumName), equalTo(expectedEnumValue)); | ||
} | ||
|
||
@ParameterizedTest | ||
@ArgumentsSource(EnumToDecompressionEngineClassArgumentsProvider.class) | ||
void getDecompressionEngine_returns_expected_DecompressionEngine(final DecompressionType enumValue, final Class<DecompressionEngine> decompressionEngineClass) { | ||
assertThat(enumValue.getDecompressionEngine(), instanceOf(decompressionEngineClass)); | ||
} | ||
|
||
private static class EnumToStringNameArgumentsProvider implements ArgumentsProvider { | ||
@Override | ||
public Stream<? extends Arguments> provideArguments(final ExtensionContext context) { | ||
return Stream.of( | ||
arguments(DecompressionType.GZIP, "gzip") | ||
); | ||
} | ||
} | ||
|
||
private static class EnumToDecompressionEngineClassArgumentsProvider implements ArgumentsProvider { | ||
@Override | ||
public Stream<? extends Arguments> provideArguments(final ExtensionContext context) { | ||
return Stream.of( | ||
arguments(DecompressionType.GZIP, GZipDecompressionEngine.class) | ||
); | ||
} | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
...va/org/opensearch/dataprepper/plugins/processor/decompress/encoding/EncodingTypeTest.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,52 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.dataprepper.plugins.processor.decompress.encoding; | ||
|
||
import org.junit.jupiter.api.extension.ExtensionContext; | ||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.Arguments; | ||
import org.junit.jupiter.params.provider.ArgumentsProvider; | ||
import org.junit.jupiter.params.provider.ArgumentsSource; | ||
|
||
import java.util.stream.Stream; | ||
|
||
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.hamcrest.Matchers.equalTo; | ||
import static org.hamcrest.Matchers.instanceOf; | ||
import static org.junit.jupiter.params.provider.Arguments.arguments; | ||
|
||
public class EncodingTypeTest { | ||
|
||
@ParameterizedTest | ||
@ArgumentsSource(EnumToStringNameArgumentsProvider.class) | ||
void fromOptionValue_returns_expected_DecompressionType(final EncodingType expectedEnumValue, final String enumName) { | ||
assertThat(EncodingType.fromOptionValue(enumName), equalTo(expectedEnumValue)); | ||
} | ||
|
||
@ParameterizedTest | ||
@ArgumentsSource(EnumToDecoderEngineClassArgumentsProvider.class) | ||
void getDecompressionEngine_returns_expected_DecompressionEngine(final EncodingType enumValue, final Class<DecoderEngine> decoderEngineClass) { | ||
assertThat(enumValue.getDecoderEngine(), instanceOf(decoderEngineClass)); | ||
} | ||
|
||
private static class EnumToStringNameArgumentsProvider implements ArgumentsProvider { | ||
@Override | ||
public Stream<? extends Arguments> provideArguments(final ExtensionContext context) { | ||
return Stream.of( | ||
arguments(EncodingType.BASE64, "base64") | ||
); | ||
} | ||
} | ||
|
||
private static class EnumToDecoderEngineClassArgumentsProvider implements ArgumentsProvider { | ||
@Override | ||
public Stream<? extends Arguments> provideArguments(final ExtensionContext context) { | ||
return Stream.of( | ||
arguments(EncodingType.BASE64, Base64DecoderEngine.class) | ||
); | ||
} | ||
} | ||
} |