Skip to content

Commit

Permalink
chore: commonify settingsarr
Browse files Browse the repository at this point in the history
Signed-off-by: Mohammad Hasnain <[email protected]>
  • Loading branch information
hasnain2808 committed Aug 13, 2024
1 parent 7b2142e commit 6a88bb0
Showing 1 changed file with 3 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ public class CompoundAnalysisTests extends OpenSearchTestCase {

@Before
public void initialize() throws IOException {
this.settingsArr = getSettingsArr();
final Path home = createTempDir();
copyHyphenationPatternsFile(home);
this.settingsArr = new Settings[] { getJsonSettings(home), getYamlSettings(home) };
}

public void testDefaultsCompoundAnalysis() throws Exception {
Expand Down Expand Up @@ -143,10 +145,6 @@ public Map<String, AnalysisProvider<TokenFilterFactory>> getTokenFilters() {
}));
}

private Path createAndGetHomeDirectory() throws IOException {
return createTempDir();
}

private void copyHyphenationPatternsFile(Path home) throws IOException {
InputStream hyphenation_patterns_path = getClass().getResourceAsStream("da_UTF8.xml");
Path config = home.resolve("config");
Expand All @@ -171,10 +169,4 @@ private Settings getYamlSettings(Path home) throws IOException {
.put(Environment.PATH_HOME_SETTING.getKey(), home.toString())
.build();
}

private Settings[] getSettingsArr() throws IOException {
Path home = createAndGetHomeDirectory();
copyHyphenationPatternsFile(home);
return new Settings[] { getJsonSettings(home), getYamlSettings(home) };
}
}

0 comments on commit 6a88bb0

Please sign in to comment.