Commit b7dd5e3e authored by Steinberg, Jan's avatar Steinberg, Jan

new excel test for fdw import, but only on metadata and not on bundle contents…

new excel test for fdw import, but only on metadata and not on bundle contents because thats not yet working out
parent 756268bf
......@@ -26,7 +26,12 @@ public class CatchAllResolvingStrategy implements ContentsUrlsResolvingStrategy
Set<String> contentsUrlStrings = new HashSet<>();
try {
Document doc = Jsoup.connect(seedUrl).userAgent("Mozilla").validateTLSCertificates(false).get();
Document doc = Jsoup.connect(seedUrl)
.userAgent("Mozilla")
.ignoreHttpErrors(true)
.timeout(10000)
.validateTLSCertificates(false)
.get();
// BEGIN check all "meta" elements with an attribute "name"="citation_pdf_url"
Elements citationPdfUrlMetaElements = doc.select("meta[name=citation_pdf_url]");
......
......@@ -310,7 +310,7 @@ public class ContentResolver {
String hasHtmlLikeContentUrl = resolvedUrlString;
ContentsUrlsResolvingStrategy strategy = getStrategy(resolvedUrlString);
contentsUrlStrings = strategy.getContentsUrls(hasHtmlLikeContentUrl);
log.info("ContentType = html?");
log.info("ResolveLink = {} . ContentType = html?", resolvedUrlString);
}
}
catch (IOException e) {
......
......@@ -89,6 +89,44 @@ public class ExcelSpreadsheetBundlesSetSourceTest {
assertEquals("Wrong value for metadatum value dc.description.pubstatus", "1", pubstatusValue);
}
@Test
public void retrieveBundlesFromNewTemplateVersionAndCheckFileUpload() {
InputStream newTemplateExcelIs = getClass().getClassLoader().getResourceAsStream("CSV-Template_2016-11.xls");
ExcelSpreadsheetBundlesSetSource underTest = new ExcelSpreadsheetBundlesSetSource(newTemplateExcelIs);
Set<Bundle> bundles = underTest.getBundlesSet();
bundles.stream().map(Object::toString).forEach(log::info);
Bundle toBeInvestigated = null;
// find the bundle which we want to do some assertions on
for(Bundle bundle : bundles) {
Set<Metadatum> metadata = bundle.getMetadata();
for (Metadatum metadatum : metadata) {
if ( metadatum.getValue().equals("Integration vor Ort: Ein boomendes Aufgabenfeld zwischen zivilgesellschaftlichem Engagement und querschnittsorientierter Kommunalpolitik") ) {
toBeInvestigated = bundle;
break;
}
}
if (toBeInvestigated != null) {
break;
}
}
assertNotNull(toBeInvestigated);
Set<Metadatum> toBeInvestigatedMetadata = toBeInvestigated.getMetadata();
String pubstatusValue = null;
for( Metadatum metadatum : toBeInvestigatedMetadata ) {
if ( metadatum.getKey().equals("dc.description.pubstatus") ) {
pubstatusValue = metadatum.getValue();
}
}
// assertEquals("Wrong value for metadatum value dc.description.pubstatus", "1", pubstatusValue);
// Set<InputStream> fileSet = toBeInvestigated.getContents();
// assertEquals( 1, fileSet.size());
}
@Test
public void getAllMetadataForASpecificBundle() throws FileNotFoundException {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment