QQQ-14 switch from csv to json for the filesystem table

This commit is contained in:
2022-06-21 18:44:11 -05:00
parent ee9f45f8a2
commit 8b3d1ef425
3 changed files with 13 additions and 15 deletions

View File

@ -139,7 +139,7 @@ public class TestUtils
.withField(new QFieldMetaData("email", QFieldType.STRING))
.withBackendDetails(new FilesystemTableBackendDetails()
.withPath("persons")
.withRecordFormat("csv")
.withRecordFormat("json")
.withCardinality("many")
);
}

View File

@ -73,22 +73,20 @@ public class FilesystemActionTest
}
fullPath += File.separatorChar;
String csvHeader = """
"id","createDate","modifyDate","firstName","lastName","birthDate","email"
String jsonData1 = """
[
{"id":1,"createDate":"2021-10-26 14:39:37","modifyDate":"2021-10-26 14:39:37","firstName":"John","lastName":"Doe","birthDate":"1981-01-01","email":"john@kingsrook.com"},
{"id":2,"createDate":"2022-06-17 14:52:59","modifyDate":"2022-06-17 14:52:59","firstName":"Jane","lastName":"Smith","birthDate":"1982-02-02","email":"jane@kingsrook.com"}
]
""";
FileUtils.writeStringToFile(new File(fullPath + "DATA-1.json"), jsonData1);
String csvData1 = csvHeader + """
"1","2021-10-26 14:39:37","2021-10-26 14:39:37","John","Doe","1981-01-01","john@kingsrook.com"
"2","2022-06-17 14:52:59","2022-06-17 14:52:59","Jane","Smith","1982-02-02","jane@kingsrook.com"
String jsonData2 = """
[
{"id":3,"createDate":"2021-11-27 15:40:38","modifyDate":"2021-11-27 15:40:38","firstName":"Homer","lastName":"S","birthDate":"1983-03-03","email":"homer.s@kingsrook.com"}
]
""";
FileUtils.writeStringToFile(new File(fullPath + "DATA-1.csv"), csvData1);
String csvData2 = csvHeader + """
"3","2021-11-27 15:40:38","2021-11-27 15:40:38","Homer","S","1983-03-03","homer.s@kingsrook.com"
"4","2022-07-18 15:53:00","2022-07-18 15:53:00","Marge","S","1984-04-04","marge.s@kingsrook.com"
"5","2022-11-11 12:00:00","2022-11-12 13:00:00","Bart","S","1985-05-05","bart.s@kingsrook.com"
""";
FileUtils.writeStringToFile(new File(fullPath + "DATA-2.csv"), csvData2);
FileUtils.writeStringToFile(new File(fullPath + "DATA-2.json"), jsonData2);
}

View File

@ -69,7 +69,7 @@ public class FilesystemQueryActionTest extends FilesystemActionTest
{
QueryRequest queryRequest = initQueryRequest();
QueryResult queryResult = new FilesystemQueryAction().execute(queryRequest);
Assertions.assertEquals(5, queryResult.getRecords().size(), "Unfiltered query should find all rows");
Assertions.assertEquals(3, queryResult.getRecords().size(), "Unfiltered query should find all rows");
}