@Test public void testGetQualifiers() throws Exception { ETLStatistics etlStatistics = new ETLStatistics(); List<String> qualifiers = null; CrsMultiMediaTransformer crsMultiMediaTransformer = new CrsMultiMediaTransformer(etlStatistics); CrsExtractor extractor = new CrsExtractor(multimediaFile, etlStatistics); for (XMLRecordInfo extracted : extractor) { CommonReflectionUtil.setField(AbstractTransformer.class, crsMultiMediaTransformer, "objectID", "RMNH.INS.867435"); CommonReflectionUtil.setField(AbstractTransformer.class, crsMultiMediaTransformer, "input", extracted); Element oaiDcElem = getDescendant(extracted.getRecord(), "oai_dc:dc"); List<Element> ncsrDeterminationElems = getDescendants(oaiDcElem, "ncrsDetermination"); for (Element element : ncsrDeterminationElems) { Object obj = ReflectionUtil.call(crsMultiMediaTransformer, "getQualifiers", new Class[] {Element.class}, new Object[] {element}); qualifiers = (List<String>) obj; } } String expectedQulifierName1 = qualifiers.get(0); String expectedQualifierName2 = qualifiers.get(1); assertNotNull("01", qualifiers); assertEquals("02", expectedQulifierName1, qualifiers.get(0)); assertEquals("03", expectedQualifierName2, qualifiers.get(1)); }
private List<String> getQualifiers(Element e) { String s = val(e, "abcd:IdentificationQualifier1"); if (s == null) return null; ArrayList<String> qualifiers = new ArrayList<>(3); qualifiers.add(s); s = val(e, "abcd:IdentificationQualifier2"); if (s != null) qualifiers.add(s); s = val(e, "abcd:IdentificationQualifier3"); if (s != null) qualifiers.add(s); return qualifiers; }
CrsMultiMediaTransformer extends AbstractXMLTransformer<MultiMediaObject> { private List<String> getQualifiers(Element e) { String s = val(e, "abcd:IdentificationQualifier1"); if (s == null) return null; ArrayList<String> qualifiers = new ArrayList<>(3); qualifiers.add(s); s = val(e, "abcd:IdentificationQualifier2"); if (s != null) qualifiers.add(s); s = val(e, "abcd:IdentificationQualifier3"); if (s != null) qualifiers.add(s); return qualifiers; } }
CrsMultiMediaTransformer extends AbstractXMLTransformer<MultiMediaObject> { private List<String> getQualifiers(Element e) { String s = val(e, "abcd:IdentificationQualifier1"); if (s == null) return null; ArrayList<String> qualifiers = new ArrayList<>(3); qualifiers.add(s); s = val(e, "abcd:IdentificationQualifier2"); if (s != null) qualifiers.add(s); s = val(e, "abcd:IdentificationQualifier3"); if (s != null) qualifiers.add(s); return qualifiers; } CrsMultiMediaTransformer(ETLStatistics stats); }
CrsMultiMediaTransformer extends AbstractXMLTransformer<MultiMediaObject> { private List<String> getQualifiers(Element e) { String s = val(e, "abcd:IdentificationQualifier1"); if (s == null) return null; ArrayList<String> qualifiers = new ArrayList<>(3); qualifiers.add(s); s = val(e, "abcd:IdentificationQualifier2"); if (s != null) qualifiers.add(s); s = val(e, "abcd:IdentificationQualifier3"); if (s != null) qualifiers.add(s); return qualifiers; } CrsMultiMediaTransformer(ETLStatistics stats);  }
CrsMultiMediaTransformer extends AbstractXMLTransformer<MultiMediaObject> { private List<String> getQualifiers(Element e) { String s = val(e, "abcd:IdentificationQualifier1"); if (s == null) return null; ArrayList<String> qualifiers = new ArrayList<>(3); qualifiers.add(s); s = val(e, "abcd:IdentificationQualifier2"); if (s != null) qualifiers.add(s); s = val(e, "abcd:IdentificationQualifier3"); if (s != null) qualifiers.add(s); return qualifiers; } CrsMultiMediaTransformer(ETLStatistics stats);   }