private boolean countMatches(CompositeQuery query, int count) throws Exception { int i = 0; while (query.hasMoreMatches()) { query.nextMatch(); i++; } return count == i; }
@Test public void testByRequestAttributesSequence() throws Exception { Attributes keys = new Attributes(1); Attributes item = new Attributes(4); keys.newSequence(Tag.RequestAttributesSequence, 1).add(item); item.setString(Tag.RequestedProcedureID, VR.SH, "P-9913"); item.setString(Tag.ScheduledProcedureStepID, VR.SH, "9913.1"); item.setNull(Tag.ReferringPhysicianName, VR.PN); item.setString(Tag.AccessionNumber, VR.SH, "A1234"); Attributes issuer = new Attributes(3); item.newSequence(Tag.IssuerOfAccessionNumberSequence, 1).add(issuer); issuer.setString(Tag.LocalNamespaceEntityID, VR.UT, "DCM4CHEE_TESTDATA_ACCNO_ISSUER_1"); issuer.setNull(Tag.UniversalEntityID, VR.UT); issuer.setNull(Tag.UniversalEntityIDType, VR.CS); query.findSeries(pids("REQ_ATTRS_SEQ"), keys, queryParam(false)); assertTrue(countMatches(query, 1)); query.close(); }
@Test public void testByModalitiesInStudyMatchUnknownCT() throws Exception { query.findSeries(pids("MODS_IN_STUDY"), modalitiesInStudy("CT"), queryParam(true)); assertTrue(countMatches(query, 3)); query.close(); }
@Test public void testByModalitiesInStudyPR() throws Exception { query.findSeries(pids("MODS_IN_STUDY"), modalitiesInStudy("PR"), queryParam(false)); assertTrue(countMatches(query, 4)); query.close(); }