Source:
<code>public void testJsonDataStructure() throws Exception { String csvFile = "data"+File.separator+"OrderLines.csv"; JobRunner jobRunner = new JobRunner(); String[] roles = { "admin" }; jobRunner.setRoles(roles); JSONDocumentManager jsonMgr = client.newJSONDocumentManager(); try (InputStream csvStream = openStream(csvFile); InputStream jobStream = openStream(JobRunner.jobFileFor(csvFile));) { jobRunner.run(client, csvStream, jobStream); ObjectMapper objectMapper = new ObjectMapper(); ObjectNode jobControlObj = (ObjectNode) objectMapper.readTree(jobStream); ObjectNode jobDef = (ObjectNode) jobControlObj.get("job"); StructuredQueryBuilder queryBldr = new StructuredQueryBuilder(); jsonMgr.setPageLength(1); DocumentPage docPage = jsonMgr.search( queryBldr.andNot(queryBldr.collection(JobRunner.getJobCollection(jobDef.path("id").asText())), queryBldr.document(JobRunner.getBeforeJobDocumentUri(jobDef.path("id").asText()), JobRunner.getAfterJobDocumentUri(jobDef.path("id").asText()))), 1); long docCount = docPage.getTotalSize(); FileReader fr = new FileReader(csvFile); LineNumberReader lnr = new LineNumberReader(fr); int linenumber = 0; while (lnr.readLine() != null) { linenumber++; } lnr.close(); assertEquals(docCount, (linenumber - 1)); JacksonHandle firstDocHandle = docPage.nextContent(new JacksonHandle()); JsonNode firstObject = firstDocHandle.get(); assertNotNull(firstObject.get("metadata")); assertNotNull(firstObject.get("instance")); <START> <END> } catch(Exception ex) { ex.printStackTrace(); } }</code><technical_language>test verify metadata properties? (And instance properties, based header line of CSV file?)</technical_language>

Target:
public void testJsonDataStructure() throws Exception { String csvFile = "data"+File.separator+"OrderLines.csv"; JobRunner jobRunner = new JobRunner(); String[] roles = { "admin" }; jobRunner.setRoles(roles); JSONDocumentManager jsonMgr = client.newJSONDocumentManager(); try (InputStream csvStream = openStream(csvFile); InputStream jobStream = openStream(JobRunner.jobFileFor(csvFile));) { jobRunner.run(client, csvStream, jobStream); ObjectMapper objectMapper = new ObjectMapper(); ObjectNode jobControlObj = (ObjectNode) objectMapper.readTree(jobStream); ObjectNode jobDef = (ObjectNode) jobControlObj.get("job"); StructuredQueryBuilder queryBldr = new StructuredQueryBuilder(); jsonMgr.setPageLength(1); DocumentPage docPage = jsonMgr.search( queryBldr.andNot(queryBldr.collection(JobRunner.getJobCollection(jobDef.path("id").asText())), queryBldr.document(JobRunner.getBeforeJobDocumentUri(jobDef.path("id").asText()), JobRunner.getAfterJobDocumentUri(jobDef.path("id").asText()))), 1); long docCount = docPage.getTotalSize(); FileReader fr = new FileReader(csvFile); LineNumberReader lnr = new LineNumberReader(fr); int linenumber = 0; while (lnr.readLine() != null) { linenumber++; } lnr.close(); assertEquals(docCount, (linenumber - 1)); JacksonHandle firstDocHandle = docPage.nextContent(new JacksonHandle()); JsonNode firstObject = firstDocHandle.get(); JsonNode metadataNode = firstObject.get("metadata"); assertNotNull(metadataNode); assertNotNull(metadataNode.get(0)); JsonNode instanceNode = firstObject.get("instance"); assertNotNull(instanceNode); assertNotNull(instanceNode.get(0)); } catch(Exception ex) { ex.printStackTrace(); } }