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

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
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -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]");
+1 −1
Original line number Diff line number Diff line
@@ -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) {
+38 −0
Original line number Diff line number Diff line
@@ -90,6 +90,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 {
        String filesystemPath = "src/test/resources/DSA-OA2016-vollstaendig.xlsx";
+474 KiB

File added.

No diff preview for this file type.