@Test public void testLoadMultiMedia() { String[] names = {"L.1911711@BRAHMS"}; Object actual = ReflectionUtil.callStatic(EnrichmentUtil.class, "loadMultiMedia", new Class[] {String[].class}, new Object[] {names}); QueryResult<MultiMediaObject> result = (QueryResult<MultiMediaObject>) actual; QueryResultItem<MultiMediaObject> actualObj = result.get(0); String expectedId = "L.1911711_2107143681@BRAHMS"; String expectedLicenseType = "Copyright"; String expectedLicense = "CC0"; String expectedCollectionType = "Botany"; String expectedTitle = "RMNH.AVES"; assertEquals("01", expectedId, actualObj.getItem().getId()); assertEquals("02", expectedLicenseType, actualObj.getItem().getLicenseType().toString()); assertEquals("03", expectedLicense, actualObj.getItem().getLicense().toString()); assertEquals("03", expectedCollectionType, actualObj.getItem().getCollectionType()); assertEquals("04", expectedTitle, actualObj.getItem().getTitle()); }
private static QueryResult<MultiMediaObject> loadMultiMedia(String[] specimenIds) { String field = "associatedSpecimenReference"; QueryCondition condition = new QueryCondition(field, "IN", specimenIds); QuerySpec query = new QuerySpec(); query.addCondition(condition); query.setConstantScore(true); query.setSize(50000); MultiMediaObjectDao dao = new MultiMediaObjectDao(); QueryResult<MultiMediaObject> result; try { result = dao.query(query); if (result.getTotalSize() > 50000) { throw new ETLRuntimeException("Too many multimedia"); } } catch (InvalidQueryException e) { throw new ETLRuntimeException(e); } return result; }
EnrichmentUtil { private static QueryResult<MultiMediaObject> loadMultiMedia(String[] specimenIds) { String field = "associatedSpecimenReference"; QueryCondition condition = new QueryCondition(field, "IN", specimenIds); QuerySpec query = new QuerySpec(); query.addCondition(condition); query.setConstantScore(true); query.setSize(50000); MultiMediaObjectDao dao = new MultiMediaObjectDao(); QueryResult<MultiMediaObject> result; try { result = dao.query(query); if (result.getTotalSize() > 50000) { throw new ETLRuntimeException("Too many multimedia"); } } catch (InvalidQueryException e) { throw new ETLRuntimeException(e); } return result; } }
EnrichmentUtil { private static QueryResult<MultiMediaObject> loadMultiMedia(String[] specimenIds) { String field = "associatedSpecimenReference"; QueryCondition condition = new QueryCondition(field, "IN", specimenIds); QuerySpec query = new QuerySpec(); query.addCondition(condition); query.setConstantScore(true); query.setSize(50000); MultiMediaObjectDao dao = new MultiMediaObjectDao(); QueryResult<MultiMediaObject> result; try { result = dao.query(query); if (result.getTotalSize() > 50000) { throw new ETLRuntimeException("Too many multimedia"); } } catch (InvalidQueryException e) { throw new ETLRuntimeException(e); } return result; }  }
EnrichmentUtil { private static QueryResult<MultiMediaObject> loadMultiMedia(String[] specimenIds) { String field = "associatedSpecimenReference"; QueryCondition condition = new QueryCondition(field, "IN", specimenIds); QuerySpec query = new QuerySpec(); query.addCondition(condition); query.setConstantScore(true); query.setSize(50000); MultiMediaObjectDao dao = new MultiMediaObjectDao(); QueryResult<MultiMediaObject> result; try { result = dao.query(query); if (result.getTotalSize() > 50000) { throw new ETLRuntimeException("Too many multimedia"); } } catch (InvalidQueryException e) { throw new ETLRuntimeException(e); } return result; }  static List<TaxonomicEnrichment> createEnrichments(List<Taxon> taxa); }
EnrichmentUtil { private static QueryResult<MultiMediaObject> loadMultiMedia(String[] specimenIds) { String field = "associatedSpecimenReference"; QueryCondition condition = new QueryCondition(field, "IN", specimenIds); QuerySpec query = new QuerySpec(); query.addCondition(condition); query.setConstantScore(true); query.setSize(50000); MultiMediaObjectDao dao = new MultiMediaObjectDao(); QueryResult<MultiMediaObject> result; try { result = dao.query(query); if (result.getTotalSize() > 50000) { throw new ETLRuntimeException("Too many multimedia"); } } catch (InvalidQueryException e) { throw new ETLRuntimeException(e); } return result; }  static List<TaxonomicEnrichment> createEnrichments(List<Taxon> taxa);  }