mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-18 13:10:44 +00:00
QQQ-14 switch from csv to json for the filesystem table
This commit is contained in:
@ -139,7 +139,7 @@ public class TestUtils
|
|||||||
.withField(new QFieldMetaData("email", QFieldType.STRING))
|
.withField(new QFieldMetaData("email", QFieldType.STRING))
|
||||||
.withBackendDetails(new FilesystemTableBackendDetails()
|
.withBackendDetails(new FilesystemTableBackendDetails()
|
||||||
.withPath("persons")
|
.withPath("persons")
|
||||||
.withRecordFormat("csv")
|
.withRecordFormat("json")
|
||||||
.withCardinality("many")
|
.withCardinality("many")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -73,22 +73,20 @@ public class FilesystemActionTest
|
|||||||
}
|
}
|
||||||
fullPath += File.separatorChar;
|
fullPath += File.separatorChar;
|
||||||
|
|
||||||
String csvHeader = """
|
String jsonData1 = """
|
||||||
"id","createDate","modifyDate","firstName","lastName","birthDate","email"
|
[
|
||||||
|
{"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 + """
|
String jsonData2 = """
|
||||||
"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"
|
{"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);
|
FileUtils.writeStringToFile(new File(fullPath + "DATA-2.json"), jsonData2);
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ public class FilesystemQueryActionTest extends FilesystemActionTest
|
|||||||
{
|
{
|
||||||
QueryRequest queryRequest = initQueryRequest();
|
QueryRequest queryRequest = initQueryRequest();
|
||||||
QueryResult queryResult = new FilesystemQueryAction().execute(queryRequest);
|
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");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user