Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

moved config files for junits #298

Merged
merged 2 commits into from
May 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions client/src/test/java/zingg/client/TestArguments.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public void testSubstituteVariablesWithAllEnvVarSet() {
env.put(KEY_MODEL_ID, "400");

byte[] encoded = Files
.readAllBytes(Paths.get(getClass().getResource("../../testConfigTemplate.json.env").getFile()));
.readAllBytes(Paths.get(getClass().getResource("../../testArguments/testConfigTemplate.json.env").getFile()));
String template = new String(encoded, StandardCharsets.UTF_8);
String json = Arguments.substituteVariables(template, env);
Arguments args = Arguments.createArgumentsFromJSONString(json, "");
Expand All @@ -53,7 +53,7 @@ public void testSubstituteVariablesWithMissingEnvVar() {
env.put(KEY_MODEL_ID, "400");

byte[] encoded = Files
.readAllBytes(Paths.get(getClass().getResource("../../testConfigTemplate.json.env").getFile()));
.readAllBytes(Paths.get(getClass().getResource("../../testArguments/testConfigTemplate.json.env").getFile()));

String template = new String(encoded, StandardCharsets.UTF_8);
String json = Arguments.substituteVariables(template, env);
Expand All @@ -73,7 +73,7 @@ public void testSubstituteVariablesWithBlankEnvVar() {
env.put(KEY_MODEL_ID, "400");

byte[] encoded = Files
.readAllBytes(Paths.get(getClass().getResource("../../testConfigTemplate.json.env").getFile()));
.readAllBytes(Paths.get(getClass().getResource("../../testArguments/testConfigTemplate.json.env").getFile()));

String template = new String(encoded, StandardCharsets.UTF_8);
String json = Arguments.substituteVariables(template, env);
Expand All @@ -95,7 +95,7 @@ public void testInvalidEnvVarBooleanType() {
env.put(KEY_MODEL_ID, "400");

byte[] encoded = Files
.readAllBytes(Paths.get(getClass().getResource("../../testConfigTemplate.json.env").getFile()));
.readAllBytes(Paths.get(getClass().getResource("../../testArguments/testConfigTemplate.json.env").getFile()));

String template = new String(encoded, StandardCharsets.UTF_8);
String json = Arguments.substituteVariables(template, env);
Expand All @@ -116,7 +116,7 @@ public void testBooleanType() {
env.put(KEY_MODEL_ID, "400");

byte[] encoded = Files
.readAllBytes(Paths.get(getClass().getResource("../../testConfigTemplate.json.env").getFile()));
.readAllBytes(Paths.get(getClass().getResource("../../testArguments/testConfigTemplate.json.env").getFile()));

String template = new String(encoded, StandardCharsets.UTF_8);
String json = Arguments.substituteVariables(template, env);
Expand All @@ -138,7 +138,7 @@ public void testInvalidEnvVarNumericType() {
env.put(KEY_MODEL_ID, "ONEHUNDRED");

byte[] encoded = Files
.readAllBytes(Paths.get(getClass().getResource("../../testConfigTemplate.json.env").getFile()));
.readAllBytes(Paths.get(getClass().getResource("../../testArguments/testConfigTemplate.json.env").getFile()));

String template = new String(encoded, StandardCharsets.UTF_8);
String json = Arguments.substituteVariables(template, env);
Expand All @@ -160,7 +160,7 @@ public void testNumericWithinQuotes() {
env.put(KEY_MODEL_ID, "500");

byte[] encoded = Files.readAllBytes(
Paths.get(getClass().getResource("../../testNumericWithinQuotesTemplate.json.env").getFile()));
Paths.get(getClass().getResource("../../testArguments/testNumericWithinQuotesTemplate.json.env").getFile()));

String template = new String(encoded, StandardCharsets.UTF_8);
String json = Arguments.substituteVariables(template, env);
Expand All @@ -183,7 +183,7 @@ public void testMalformedVariable() {
env.put(KEY_MODEL_ID, "500");

byte[] encoded = Files.readAllBytes(
Paths.get(getClass().getResource("../../testMalformedConfigTemplate.json.env").getFile()));
Paths.get(getClass().getResource("../../testArguments/testMalformedConfigTemplate.json.env").getFile()));

String template = new String(encoded, StandardCharsets.UTF_8);
String json = Arguments.substituteVariables(template, env);
Expand All @@ -210,7 +210,7 @@ public void testInvalidFilePath() {
public void testMatchTypeMultiple() {
Arguments args;
try {
args = Arguments.createArgumentsFromJSON(getClass().getResource("../../configWithMultipleMatchTypes.json").getFile(), "test");
args = Arguments.createArgumentsFromJSON(getClass().getResource("../../testArguments/configWithMultipleMatchTypes.json").getFile(), "test");
List<MatchType> fNameMatchType = args.getFieldDefinition().get(0).getMatchType();
assertEquals(2, fNameMatchType.size());
assertEquals(MatchType.FUZZY, fNameMatchType.get(0));
Expand All @@ -229,7 +229,7 @@ public void testMatchTypeMultiple() {
public void testMatchTypeWrong() {
Arguments args;
try {
args = Arguments.createArgumentsFromJSON(getClass().getResource("../../configWithMultipleMatchTypesUnsupported.json").getFile(), "test");
args = Arguments.createArgumentsFromJSON(getClass().getResource("../../testArguments/configWithMultipleMatchTypesUnsupported.json").getFile(), "test");
//List<MatchType> fNameMatchType = args.getFieldDefinition().get(0).getMatchType();
fail("config had error, should have flagged");

Expand Down
2 changes: 1 addition & 1 deletion core/src/test/java/zingg/TestDocumenter.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class TestDocumenter extends ZinggSparkTester{
public void setUp(){

try {
args = Arguments.createArgumentsFromJSON(getClass().getResource("/documenter/config.json").getFile());
args = Arguments.createArgumentsFromJSON(getClass().getResource("/testDocumenter/config.json").getFile());
//fail("Exception was expected for missing config file");
} catch (Throwable e) {
e.printStackTrace();
Expand Down
4 changes: 2 additions & 2 deletions core/src/test/java/zingg/preprocess/TestStopWords.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public void testRemoveStopWordsFromDataset() {
RowFactory.create("30", "written java scala", "four", "", "test"),
RowFactory.create("40", "best luck to zingg ", "Five", "thank you", "test")),
schemaOriginal);
String stopWordsFileName = getClass().getResource("../../stopWords.csv").getFile();
String stopWordsFileName = getClass().getResource("../../preProcess/stopWords.csv").getFile();
FieldDefinition fd = new FieldDefinition();
fd.setStopWords(stopWordsFileName);
fd.setFieldName("field1");
Expand Down Expand Up @@ -134,7 +134,7 @@ public void testStopWordColumnMissingFromStopWordFile() {
RowFactory.create("30", "written java scala", "four", "", "test"),
RowFactory.create("40", "best luck to zingg ", "Five", "thank you", "test")),
schemaOriginal);
String stopWordsFileName = getClass().getResource("../../stopWordsWithoutHeader.csv").getFile();
String stopWordsFileName = getClass().getResource("../../preProcess/stopWordsWithoutHeader.csv").getFile();
FieldDefinition fd = new FieldDefinition();
fd.setStopWords(stopWordsFileName);
fd.setFieldName("field1");
Expand Down