src_fm_fc_ms_ff
stringlengths
43
86.8k
target
stringlengths
20
276k
NavigationHelper implements Serializable { public void setCurrentView(String currentView) { logger.trace("{}: {}", KEY_CURRENT_VIEW, currentView); statusMap.put(KEY_CURRENT_VIEW, currentView); setCurrentPage(currentView); } NavigationHelper(); @PostConstruct void init(); void setBreadcrumbBean(BreadcrumbBean breadcrumb...
@Test public void setCurrentView_shouldSetValueCorrectly() throws Exception { NavigationHelper nh = new NavigationHelper(); nh.setCurrentView(NavigationHelper.KEY_CURRENT_VIEW + "_value"); Assert.assertEquals(NavigationHelper.KEY_CURRENT_VIEW + "_value", nh.statusMap.get(NavigationHelper.KEY_CURRENT_VIEW)); }
NavigationHelper implements Serializable { public void setMenuPage(String page) { logger.debug("Menu Page ist: " + page); statusMap.put(KEY_MENU_PAGE, page); } NavigationHelper(); @PostConstruct void init(); void setBreadcrumbBean(BreadcrumbBean breadcrumbBean); String searchPage(); String homePage(); String browsePage...
@Test public void setMenuPage_shouldSetValueCorrectly() throws Exception { NavigationHelper nh = new NavigationHelper(); nh.setMenuPage(NavigationHelper.KEY_MENU_PAGE + "_value"); Assert.assertEquals(NavigationHelper.KEY_MENU_PAGE + "_value", nh.statusMap.get(NavigationHelper.KEY_MENU_PAGE)); }
NavigationHelper implements Serializable { public void setPreferredView(String preferredView) { statusMap.put(KEY_PREFERRED_VIEW, preferredView); } NavigationHelper(); @PostConstruct void init(); void setBreadcrumbBean(BreadcrumbBean breadcrumbBean); String searchPage(); String homePage(); String browsePage(); String g...
@Test public void setPreferredView_shouldSetValueCorrectly() throws Exception { NavigationHelper nh = new NavigationHelper(); nh.setPreferredView(NavigationHelper.KEY_PREFERRED_VIEW + "_value"); Assert.assertEquals(NavigationHelper.KEY_PREFERRED_VIEW + "_value", nh.statusMap.get(NavigationHelper.KEY_PREFERRED_VIEW)); }
NavigationHelper implements Serializable { public void setSelectedNewsArticle(String art) { statusMap.put(KEY_SELECTED_NEWS_ARTICLE, art); } NavigationHelper(); @PostConstruct void init(); void setBreadcrumbBean(BreadcrumbBean breadcrumbBean); String searchPage(); String homePage(); String browsePage(); String getCurre...
@Test public void setSelectedNewsArticle_shouldSetValueCorrectly() throws Exception { NavigationHelper nh = new NavigationHelper(); nh.setSelectedNewsArticle(NavigationHelper.KEY_SELECTED_NEWS_ARTICLE + "_value"); Assert.assertEquals(NavigationHelper.KEY_SELECTED_NEWS_ARTICLE + "_value", nh.statusMap.get(NavigationHelp...
NavigationHelper implements Serializable { public void setStatusMapValue(String key, String value) { statusMap.put(key, value); } NavigationHelper(); @PostConstruct void init(); void setBreadcrumbBean(BreadcrumbBean breadcrumbBean); String searchPage(); String homePage(); String browsePage(); String getCurrentPage(); b...
@Test public void setStatusMapValue_shouldSetValueCorrectly() throws Exception { NavigationHelper nh = new NavigationHelper(); nh.setStatusMapValue("new_key", "new_value"); Assert.assertEquals("new_value", nh.statusMap.get("new_key")); }
CrowdsourcingBean implements Serializable { public long getCampaignCount(CampaignVisibility visibility) throws DAOException { Map<String, String> filters = visibility != null ? Collections.singletonMap("visibility", visibility.name()) : null; return DataManager.getInstance().getDao().getCampaignCount(filters); } @Post...
@Test public void testGetCampaignCount() throws DAOException { long numPublic = bean.getCampaignCount(CampaignVisibility.PUBLIC); long numPrivate = bean.getCampaignCount(CampaignVisibility.PRIVATE); long numRestricted = bean.getCampaignCount(CampaignVisibility.RESTRICTED); Assert.assertEquals(1, numPublic); Assert.asse...
CrowdsourcingBean implements Serializable { public List<Campaign> getAllCampaigns() throws DAOException { List<Campaign> pages = DataManager.getInstance().getDao().getAllCampaigns(); return pages; } @PostConstruct void init(); long getCampaignCount(CampaignVisibility visibility); String filterCampaignsAction(CampaignV...
@Test public void testGetAllCampaigns() throws DAOException { List<Campaign> campaigns = bean.getAllCampaigns(); Assert.assertEquals(2, campaigns.size()); }
CrowdsourcingBean implements Serializable { public void saveSelectedCampaign() throws DAOException, PresentationException, IndexUnreachableException { logger.trace("saveSelectedCampaign"); try { if (userBean == null || !userBean.getUser().isSuperuser()) { return; } if (selectedCampaign == null) { return; } boolean succ...
@Test public void testSaveSelectedCampaign() throws DAOException, PresentationException, IndexUnreachableException { bean.setSelectedCampaignId("1"); Assert.assertNotNull(bean.getSelectedCampaign()); Date created = new Date(); bean.getSelectedCampaign().setDateCreated(created); Assert.assertEquals("Date created does no...
LocalAuthenticationProvider implements IAuthenticationProvider { @Override public CompletableFuture<LoginResult> login(String email, String password) throws AuthenticationProviderException { HttpServletRequest request = BeanUtils.getRequest(); HttpServletResponse response = BeanUtils.getResponse(); if (StringUtils.isNo...
@Test public void testLogin_valid() throws AuthenticationProviderException, InterruptedException, ExecutionException { CompletableFuture<LoginResult> future = provider.login(userActive_email, userActive_pwHash); Assert.assertTrue(future.get().getUser().isPresent()); Assert.assertTrue(future.get().getUser().get().isActi...
ActiveDocumentBean implements Serializable { public void setPersistentIdentifier(String persistentIdentifier) throws PresentationException, RecordNotFoundException, IndexUnreachableException { synchronized (this) { logger.trace("setPersistentIdentifier: {}", persistentIdentifier); lastReceivedIdentifier = persistentIde...
@Test public void setPersistentIdentifier_shouldDetermineCurrentElementIddocCorrectly() throws Exception { ActiveDocumentBean adb = new ActiveDocumentBean(); adb.setPersistentIdentifier(PI_KLEIUNIV); Assert.assertEquals(iddocKleiuniv, adb.topDocumentIddoc); }
SitelinkBean implements Serializable { public List<String> getAvailableValuesForField(String field, String filterQuery) throws PresentationException, IndexUnreachableException { if (field == null) { throw new IllegalArgumentException("field may not be null"); } if (filterQuery == null) { throw new IllegalArgumentExcept...
@Test public void getAvailableValuesForField_shouldReturnAllExistingValuesForTheGivenField() throws Exception { SitelinkBean sb = new SitelinkBean(); List<String> values = sb.getAvailableValuesForField("MD_YEARPUBLISH", SolrConstants.ISWORK + ":true"); Assert.assertFalse(values.isEmpty()); }
BeanUtils { public static String escapeCriticalUrlChracters(String value) { return escapeCriticalUrlChracters(value, false); } static HttpServletRequest getRequest(); static HttpServletRequest getRequest(FacesContext context); static HttpSession getSession(); static String getServletPathWithHostAsUrlFromJsfContext(); ...
@Test public void escapeCriticalUrlChracters_shouldReplaceCharactersCorrectly() throws Exception { Assert.assertEquals("AU002FU005CU007CU003FZ", BeanUtils.escapeCriticalUrlChracters("A/\\|?Z")); Assert.assertEquals("U007C", BeanUtils.escapeCriticalUrlChracters("%7C")); }
BeanUtils { public static String unescapeCriticalUrlChracters(String value) { if (value == null) { throw new IllegalArgumentException("value may not be null"); } return value.replace(SLASH_REPLACEMENT, "/") .replace(BACKSLASH_REPLACEMENT, "\\") .replace(PIPE_REPLACEMENT, "|") .replace(QUESTION_MARK_REPLACEMENT, "?") .r...
@Test public void unescapeCriticalUrlChracters_shouldReplaceCharactersCorrectly() throws Exception { Assert.assertEquals("A/\\|?Z", BeanUtils.unescapeCriticalUrlChracters("AU002FU005CU007CU003FZ")); }
SearchBean implements SearchInterface, Serializable { public String getSearchUrl() { if (navigationHelper == null) { return null; } switch (activeSearchType) { case SearchHelper.SEARCH_TYPE_ADVANCED: return navigationHelper.getAdvancedSearchUrl(); default: return navigationHelper.getSearchUrl(); } } SearchBean(); @Post...
@Test public void getSearchUrl_shouldReturnNullIfNavigationHelperIsNull() throws Exception { SearchBean sb = new SearchBean(); Assert.assertNull(sb.getSearchUrl()); }
SearchBean implements SearchInterface, Serializable { public List<AdvancedSearchFieldConfiguration> getAdvancedSearchAllowedFields() { return getAdvancedSearchAllowedFields(navigationHelper.getLocaleString()); } SearchBean(); @PostConstruct void init(); void setNavigationHelper(NavigationHelper navigationHelper); void ...
@Test public void getAdvancedSearchAllowedFields_shouldOmitLanguagedFieldsForOtherLanguages() throws Exception { List<AdvancedSearchFieldConfiguration> fields = SearchBean.getAdvancedSearchAllowedFields("en"); boolean en = false; boolean de = false; boolean es = false; for (AdvancedSearchFieldConfiguration field : fiel...
CmsMediaBean implements Serializable { public List<CMSCategory> getAllMediaCategories() throws DAOException { return DataManager.getInstance().getDao().getAllCategories(); } CmsMediaBean(); void resetData(); CMSMediaItem createMediaItem(); List<CMSPage> getMediaOwnerPages(CMSMediaItem item); void deleteMedia(CMSMediaIt...
@Test public void testGetAllMediaCategories() throws DAOException { List<CMSCategory> tags = bean.getAllMediaCategories(); Assert.assertEquals(7, tags.size()); }
CmsMediaBean implements Serializable { public List<CategorizableTranslatedSelectable<CMSMediaItem>> getMediaItems() throws DAOException { return this.dataProvider.getPaginatorList(); } CmsMediaBean(); void resetData(); CMSMediaItem createMediaItem(); List<CMSPage> getMediaOwnerPages(CMSMediaItem item); void deleteMedia...
@Test public void testGetMediaItems() throws DAOException { bean.setFilter(""); Assert.assertEquals(4, bean.getMediaItems().size()); bean.setFilter("tag1"); Assert.assertEquals(3, bean.getMediaItems().size()); bean.setFilter(""); bean.setFilenameFilter(bean.getImageFilter()); Assert.assertEquals(4, bean.getMediaItems()...
CmsMediaBean implements Serializable { public static String getImageFilter() { return "(?i).*\\.(png|jpe?g|gif|tiff?|jp2)"; } CmsMediaBean(); void resetData(); CMSMediaItem createMediaItem(); List<CMSPage> getMediaOwnerPages(CMSMediaItem item); void deleteMedia(CMSMediaItem item); List<CMSMediaItem> getAllMedia(); Tabl...
@Test public void testGetImageFilter() { String file1 = "image.jpg"; String file2 = "image.JPEG"; String file3 = "image.xml"; Assert.assertTrue(file1.matches(bean.getImageFilter())); Assert.assertTrue(file2.matches(bean.getImageFilter())); Assert.assertFalse(file3.matches(bean.getImageFilter())); }
BrowseBean implements Serializable { public List<String> getBrowsingMenuItems(String language) { if (language != null) { language = language.toUpperCase(); } List<String> ret = new ArrayList<>(); for (BrowsingMenuFieldConfig bmfc : DataManager.getInstance().getConfiguration().getBrowsingMenuFields()) { if (bmfc.getFiel...
@Test public void getBrowsingMenuItems_shouldSkipItemsForLanguagespecificFieldsIfNoLanguageWasGiven() throws Exception { BrowseBean bb = new BrowseBean(); List<String> result = bb.getBrowsingMenuItems(null); Assert.assertEquals(2, result.size()); Assert.assertEquals("MD_AUTHOR_UNTOKENIZED", result.get(0)); Assert.asser...
BrowseBean implements Serializable { public String getCollectionHierarchy(String collectionField, String collectionValue) { if (StringUtils.isEmpty(collectionField) || StringUtils.isEmpty(collectionValue)) { return ""; } String separator = DataManager.getInstance().getConfiguration().getCollectionSplittingChar(collecti...
@Test public void getCollectionHierarchy_shouldReturnHierarchyCorrectly() throws Exception { BrowseBean bb = new BrowseBean(); Assert.assertEquals("foo", bb.getCollectionHierarchy("x", "foo")); Assert.assertEquals("foo / foo.bar", bb.getCollectionHierarchy("x", "foo.bar")); }
CmsBean implements Serializable { public static List<String> getLuceneFields() { return getLuceneFields(false, false); } @PostConstruct void init(); List<CMSPage> getMostRecentlyEditedPages(int number); void setNavigationHelper(NavigationHelper navigationHelper); void setSearchBean(SearchBean searchBean); static List<...
@Test public void testGetLuceneFields() { List<String> fields = CmsBean.getLuceneFields(); Assert.assertTrue("Lucene field 'DC' is missing", fields.contains("DC")); Assert.assertTrue("Lucene field 'LABEL' is missing", fields.contains("LABEL")); Assert.assertTrue("Lucene field 'FILENAME' is missing", fields.contains("FI...
CmsBean implements Serializable { public List<CMSStaticPage> getStaticPages() throws DAOException { if (this.staticPages == null) { this.staticPages = createStaticPageList(); } return this.staticPages; } @PostConstruct void init(); List<CMSPage> getMostRecentlyEditedPages(int number); void setNavigationHelper(Navigati...
@Test public void testGetStaticPages() throws DAOException { CmsBean bean = new CmsBean(); List<CMSStaticPage> staticPages = bean.getStaticPages(); Assert.assertFalse(staticPages.isEmpty()); }
CmsBean implements Serializable { public List<CMSPage> getAvailableCmsPages(CMSStaticPage page) throws DAOException { List<CMSPage> allPages = getAllCMSPages().stream() .filter(cmsPage -> isPageValid(cmsPage).equals(PageValidityStatus.VALID)) .filter(cmsPage -> cmsPage.isPublished()) .collect(Collectors.toList()); for ...
@Test public void testGetAvailableCmsPages() throws DAOException { CmsBean bean = new CmsBean(); List<CMSPage> allPages = DataManager.getInstance().getDao().getAllCMSPages(); List<CMSPage> availablePages = bean.getAvailableCmsPages(null); Assert.assertEquals(3, allPages.size() - availablePages.size()); }
CmsBean implements Serializable { public List<Entry<String, List<SearchHit>>> getGroupedQueryResults(List<SearchHit> hits, String groupingField) { Map<String, List<SearchHit>> hitMap = new HashMap<>(); for (SearchHit searchHit : hits) { List<String> groupingValues = getMetadataValues(searchHit, groupingField); if (grou...
@Test public void testGetGroupedQueryResults() throws PresentationException, IndexUnreachableException, DAOException, ViewerConfigurationException { CmsBean bean = new CmsBean(); String groupField = "GROUPING"; String value1 = "VALUE1"; String value2 = "VALUE2"; String value3 = "VALUE3"; List<SearchHit> results = new A...
CmsBean implements Serializable { static List<CMSStaticPage> createStaticPageList() throws DAOException { List<CMSStaticPage> staticPages = DataManager.getInstance().getDao().getAllStaticPages(); List<PageType> pageTypesForCMS = PageType.getTypesHandledByCms(); List<CMSStaticPage> ret = new ArrayList<>(pageTypesForCMS....
@Test public void createStaticPageList_shouldReturnPagesInSpecifiedOrder() throws Exception { List<PageType> pageTypes = PageType.getTypesHandledByCms(); List<CMSStaticPage> pages = CmsBean.createStaticPageList(); Assert.assertEquals(pageTypes.size(), pages.size()); for (int i = 0; i < pageTypes.size(); ++i) { Assert.a...
ConfigurationBean implements Serializable { public boolean isDisplaySearchRssLinks() { return DataManager.getInstance().getConfiguration().isDisplaySearchRssLinks(); } ConfigurationBean(); List<IModule> getModules(); @Deprecated String getContentServletUrl(); String getName(); Double getRelativeImageFooterHeight(); Int...
@Test public void isDisplaySearchRssLinks_shouldReturnCorrectValue() throws Exception { Assert.assertFalse(bean.isDisplaySearchRssLinks()); }
ConfigurationBean implements Serializable { public boolean isSidebarPageLinkVisible() { return DataManager.getInstance().getConfiguration().isSidebarPageViewLinkVisible(); } ConfigurationBean(); List<IModule> getModules(); @Deprecated String getContentServletUrl(); String getName(); Double getRelativeImageFooterHeight(...
@Test public void isSidebarPageLinkVisible_shouldReturnCorrectValue() throws Exception { Assert.assertEquals(false, bean.isSidebarPageLinkVisible()); }
ConfigurationBean implements Serializable { public boolean isSidebarCalendarLinkVisible() { return DataManager.getInstance().getConfiguration().isSidebarCalendarViewLinkVisible(); } ConfigurationBean(); List<IModule> getModules(); @Deprecated String getContentServletUrl(); String getName(); Double getRelativeImageFoote...
@Test public void isSidebarCalendarLinkVisible_shouldReturnCorrectValue() throws Exception { Assert.assertEquals(false, bean.isSidebarCalendarLinkVisible()); }
ConfigurationBean implements Serializable { public boolean isSidebarThumbsLinkVisible() { return DataManager.getInstance().getConfiguration().isSidebarThumbsViewLinkVisible(); } ConfigurationBean(); List<IModule> getModules(); @Deprecated String getContentServletUrl(); String getName(); Double getRelativeImageFooterHei...
@Test public void isSidebarThumbsLinkVisible_shouldReturnCorrectValue() throws Exception { Assert.assertEquals(false, bean.isSidebarThumbsLinkVisible()); }
ConfigurationBean implements Serializable { public boolean isSidebarMetadataLinkVisible() { return DataManager.getInstance().getConfiguration().isSidebarMetadataViewLinkVisible(); } ConfigurationBean(); List<IModule> getModules(); @Deprecated String getContentServletUrl(); String getName(); Double getRelativeImageFoote...
@Test public void isSidebarMetadataLinkVisible_shouldReturnCorrectValue() throws Exception { Assert.assertEquals(false, bean.isSidebarMetadataLinkVisible()); }
ConfigurationBean implements Serializable { public boolean isSidebarFulltextLinkVisible() { return DataManager.getInstance().getConfiguration().isSidebarFulltextLinkVisible(); } ConfigurationBean(); List<IModule> getModules(); @Deprecated String getContentServletUrl(); String getName(); Double getRelativeImageFooterHei...
@Test public void isSidebarFulltextLinkVisible_shouldReturnCorrectValue() throws Exception { Assert.assertEquals(false, bean.isSidebarFulltextLinkVisible()); }
ThumbnailHandler { public String getThumbnailUrl(PhysicalElement page) { return getThumbnailUrl(page, thumbWidth, thumbHeight); } ThumbnailHandler(IIIFUrlHandler iiifUrlHandler, Configuration configuration, String staticImagesPath); URI getThumbnailPath(String filename); String getThumbnailUrl(PhysicalElement page); St...
@Test public void testPage() { PhysicalElement page = new PhysicalElement("PHYS_0001", "00000001.tif", 1, "Seite 1", "urn:234235:3423", "http: String url = handler.getThumbnailUrl(page, 200, 300); Assert.assertEquals("/api/v1/records/1234/files/images/00000001.tif/full/!200,300/0/default.jpg", url); } @Test public void...
ThumbnailHandler { public String getFullImageUrl(PhysicalElement page) { return getFullImageUrl(page, Scale.MAX); } ThumbnailHandler(IIIFUrlHandler iiifUrlHandler, Configuration configuration, String staticImagesPath); URI getThumbnailPath(String filename); String getThumbnailUrl(PhysicalElement page); String getThumbn...
@Test public void testGetFullImageUrl() { String fileUrl = "00000001.tif"; PhysicalElement page = new PhysicalElement("PHYS_0001", fileUrl, 1, "Seite 1", "urn:234235:3423", "http: String urlMax = handler.getFullImageUrl(page, Scale.MAX); Assert.assertEquals("/api/v1/records/1234/files/images/00000001.tif/full/max/0/def...
ImageHandler { public String getImageUrl(PhysicalElement page, PageType pageType) { if (page == null) { throw new IllegalArgumentException("Cannot get image url: PhysicalElement is null"); } if (pageType == null) { throw new IllegalArgumentException("Cannot get image url: PageType is null"); } String pi = page.getPi();...
@Test public void testGetImageUrlLocal() { PhysicalElement page = new PhysicalElement("PHYS_0001", "00000001.tif", 1, "Seite 1", "urn:234235:3423", "http: String url = handler.getImageUrl(page); Assert.assertEquals(ConfigurationTest.APPLICATION_ROOT_URL + "api/v1/image/1234/00000001.tif/info.json", url); } @Test public...
MediaHandler { public String getMediaUrl(String type, String format, String pi, String filename) throws IllegalRequestException { if(urls != null) { if(type.equalsIgnoreCase("audio")) { return urls.path(ApiUrls.RECORDS_FILES, ApiUrls.RECORDS_FILES_AUDIO).params(pi, format, filename).build(); } else if(type.equalsIgnore...
@Test public void testGetMediaUrl() throws IllegalRequestException { String mediaUrl = handler.getMediaUrl("audio","ogg", "1234", "audio.ogg"); Assert.assertEquals(ConfigurationTest.APPLICATION_ROOT_URL + "api/v1/records/1234/files/audio/ogg/audio.ogg", mediaUrl); }
IIIFUrlHandler { public String getIIIFImageUrl(String fileUrl, String docStructIdentifier, String region, String size, String rotation, String quality, String format) { String apiUrl = this.urls == null ? DataManager.getInstance().getConfiguration().getIIIFApiUrl() : this.urls.getApiUrl() + "/"; return getIIIFImageUrl(...
@Test public void testUrlFromFile() { String url = handler.getIIIFImageUrl(fileUrl, pi, region, size, rotation, quality, format); Assert.assertEquals("/api/v1/records/1234/files/images/filename.tif/full/max/0/default.jpg", url); } @Test public void testUrlFromLocalUrl() { fileUrl = "http: String url = handler.getIIIFIm...
AccessConditionUtils { public static boolean checkAccessPermission(Set<String> requiredAccessConditions, String privilegeName, String query, HttpServletRequest request) throws IndexUnreachableException, PresentationException, DAOException { User user = BeanUtils.getUserFromRequest(request); if (user == null) { UserBean...
@Test public void checkAccessPermission_shouldReturnTrueIfRequiredAccessConditionsEmpty() throws Exception { Assert.assertTrue(AccessConditionUtils.checkAccessPermission(new ArrayList<LicenseType>(), new HashSet<String>(), IPrivilegeHolder.PRIV_VIEW_IMAGES, null, null, null)); } @Test public void checkAccessPermission_...
ViewerResourceBundle extends ResourceBundle { public static List<Locale> getAllLocales() { if (allLocales == null) { checkAndLoadResourceBundles(); Set<Locale> locales = new HashSet<>(); locales.addAll(defaultBundles.keySet()); locales.addAll(localBundles.keySet()); allLocales = new ArrayList<>(locales); synchronized (...
@Test public void getAllLocales_shouldReturnEnglishIfNoOtherLocalesFound() throws Exception { List<Locale> locales = ViewerResourceBundle.getAllLocales(); Assert.assertEquals(1, locales.size()); Assert.assertEquals(Locale.ENGLISH, locales.get(0)); }
PdfHandler { public String getPdfUrl(StructElement doc, PhysicalElement page) { return getPdfUrl(doc, new PhysicalElement[] { page }); } PdfHandler(WatermarkHandler watermarkHandler, Configuration configuration); PdfHandler(WatermarkHandler watermarkHandler, AbstractApiUrlManager urls); String getPdfUrl(StructElement ...
@Test public void test() { String pi = "1234"; Optional<String> divId = Optional.ofNullable("LOG_0003"); Optional<String> watermarkId = Optional.ofNullable("footerId"); Optional<String> watermarkText = Optional.ofNullable("watermark text"); Optional<String> label = Optional.ofNullable("output-filename.pdf"); String url...
IIIFPresentationAPIHandler { public String getManifestUrl(String pi) throws URISyntaxException { return builder.getManifestURI(pi).toString(); } IIIFPresentationAPIHandler(AbstractApiUrlManager urls, Configuration configuration); String getManifestUrl(String pi); String getCollectionUrl(); String getCollectionUrl(Strin...
@Test public void testGetManifestUrl() throws URISyntaxException { Assert.assertEquals(ConfigurationTest.APPLICATION_ROOT_URL + "rest/records/PI-SAMPLE/manifest/", handler.getManifestUrl("PI-SAMPLE")); }
IIIFPresentationAPIHandler { public String getCollectionUrl() throws URISyntaxException { return getCollectionUrl(SolrConstants.DC); } IIIFPresentationAPIHandler(AbstractApiUrlManager urls, Configuration configuration); String getManifestUrl(String pi); String getCollectionUrl(); String getCollectionUrl(String field); ...
@Test public void testGetCollectionUrl() throws URISyntaxException { Assert.assertEquals(ConfigurationTest.APPLICATION_ROOT_URL + "rest/collections/DC/", handler.getCollectionUrl()); } @Test public void testGetCollectionUrlString() throws URISyntaxException { Assert.assertEquals(ConfigurationTest.APPLICATION_ROOT_URL +...
IIIFPresentationAPIHandler { public String getLayerUrl(String pi, String annotationType) throws URISyntaxException { AnnotationType type = AnnotationType.valueOf(annotationType.toUpperCase()); if (type == null) { throw new IllegalArgumentException(annotationType + " is not valid annotation type"); } return builder.getL...
@Test public void testGetLayerUrl() throws URISyntaxException { Assert.assertEquals(ConfigurationTest.APPLICATION_ROOT_URL + "rest/records/PI-SAMPLE/layers/FULLTEXT/", handler.getLayerUrl("PI-SAMPLE", "fulltext")); }
IIIFPresentationAPIHandler { public String getAnnotationsUrl(String pi, int pageOrder, String annotationType) throws URISyntaxException { AnnotationType type = AnnotationType.valueOf(annotationType.toUpperCase()); if (type == null) { throw new IllegalArgumentException(annotationType + " is not valid annotation type"); ...
@Test public void testGetAnnotationsUrl() throws URISyntaxException { Assert.assertEquals(ConfigurationTest.APPLICATION_ROOT_URL + "rest/records/PI-SAMPLE/pages/12/annotations/?type=PDF", handler.getAnnotationsUrl("PI-SAMPLE", 12, "pdf")); }
IIIFPresentationAPIHandler { public String getCanvasUrl(String pi, int pageOrder) throws URISyntaxException { return builder.getCanvasURI(pi, pageOrder).toString(); } IIIFPresentationAPIHandler(AbstractApiUrlManager urls, Configuration configuration); String getManifestUrl(String pi); String getCollectionUrl(); String ...
@Test public void testGetCanvasUrl() throws URISyntaxException { Assert.assertEquals(ConfigurationTest.APPLICATION_ROOT_URL + "rest/records/PI-SAMPLE/pages/12/canvas/", handler.getCanvasUrl("PI-SAMPLE", 12)); }
IIIFPresentationAPIHandler { public String getRangeUrl(String pi, String logId) throws URISyntaxException { return builder.getRangeURI(pi, logId).toString(); } IIIFPresentationAPIHandler(AbstractApiUrlManager urls, Configuration configuration); String getManifestUrl(String pi); String getCollectionUrl(); String getColl...
@Test public void testGetRangeUrl() throws URISyntaxException { Assert.assertEquals(ConfigurationTest.APPLICATION_ROOT_URL + "rest/records/PI-SAMPLE/sections/LOG_0007/range/", handler.getRangeUrl("PI-SAMPLE", "LOG_0007")); }
XmlTools { public static Document getDocumentFromString(String string, String encoding) throws JDOMException, IOException { if (encoding == null) { encoding = StringTools.DEFAULT_ENCODING; } byte[] byteArray = null; try { byteArray = string.getBytes(encoding); } catch (UnsupportedEncodingException e) { } ByteArrayInput...
@Test public void getDocumentFromString_shouldBuildDocumentCorrectly() throws Exception { String xml = "<root><child>child1</child><child>child2</child></root>"; Document doc = XmlTools.getDocumentFromString(xml, null); Assert.assertNotNull(doc); Assert.assertNotNull(doc.getRootElement()); Assert.assertEquals("root", d...
XmlTools { public static String getStringFromElement(Object element, String encoding) { if (element == null) { throw new IllegalArgumentException("element may not be null"); } if (encoding == null) { encoding = StringTools.DEFAULT_ENCODING; } Format format = Format.getRawFormat(); XMLOutputter outputter = new XMLOutput...
@Test public void getStringFromElement_shouldReturnXMLStringCorrectlyForDocuments() throws Exception { Document doc = new Document(); doc.setRootElement(new Element("root")); String xml = XmlTools.getStringFromElement(doc, null); Assert.assertNotNull(xml); Assert.assertTrue(xml.contains("<root></root>")); } @Test publi...
XmlTools { public static File writeXmlFile(Document doc, String filePath) throws FileNotFoundException, IOException { return FileTools.getFileFromString(getStringFromElement(doc, StringTools.DEFAULT_ENCODING), filePath, StringTools.DEFAULT_ENCODING, false); } static Document readXmlFile(String filePath); static Docume...
@Test(expected = FileNotFoundException.class) public void writeXmlFile_shouldThrowFileNotFoundExceptionIfFileIsDirectory() throws Exception { Document doc = new Document(); doc.setRootElement(new Element("root")); XmlTools.writeXmlFile(doc, "target"); }
XmlTools { public static Document readXmlFile(String filePath) throws FileNotFoundException, IOException, JDOMException { try (FileInputStream fis = new FileInputStream(new File(filePath))) { return new SAXBuilder().build(fis); } } static Document readXmlFile(String filePath); static Document readXmlFile(URL url); sta...
@Test public void readXmlFile_shouldBuildDocumentFromPathCorrectly() throws Exception { Document doc = XmlTools.readXmlFile(Paths.get("src/test/resources/config_viewer.test.xml")); Assert.assertNotNull(doc); Assert.assertNotNull(doc.getRootElement()); } @Test public void readXmlFile_shouldBuildDocumentFromStringCorrect...
Configuration extends AbstractConfiguration { public int getBreadcrumbsClipping() { return getLocalInt("webGuiDisplay.breadcrumbsClipping", 50); } Configuration(String configFilePath); Set<String> getStopwords(); boolean reloadingRequired(); String getConfigLocalPath(); String getLocalRessourceBundleFile(); int getView...
@Test public void getBreadcrumbsClipping_shouldReturnCorrectValue() throws Exception { Assert.assertEquals(24, DataManager.getInstance().getConfiguration().getBreadcrumbsClipping()); }
Configuration extends AbstractConfiguration { public List<BrowsingMenuFieldConfig> getBrowsingMenuFields() { List<HierarchicalConfiguration> fields = getLocalConfigurationsAt("metadata.browsingMenu.luceneField"); if (fields == null) { return Collections.emptyList(); } List<BrowsingMenuFieldConfig> ret = new ArrayList<>...
@Test public void getBrowsingMenuFields_shouldReturnAllConfiguredElements() throws Exception { Assert.assertEquals(4, DataManager.getInstance().getConfiguration().getBrowsingMenuFields().size()); }
Configuration extends AbstractConfiguration { public int getBrowsingMenuHitsPerPage() { return getLocalInt("metadata.browsingMenu.hitsPerPage", 50); } Configuration(String configFilePath); Set<String> getStopwords(); boolean reloadingRequired(); String getConfigLocalPath(); String getLocalRessourceBundleFile(); int get...
@Test public void getBrowsingMenuHitsPerPage_shouldReturnCorrectValue() throws Exception { Assert.assertEquals(19, DataManager.getInstance().getConfiguration().getBrowsingMenuHitsPerPage()); }
Configuration extends AbstractConfiguration { public String getBrowsingMenuSortingIgnoreLeadingChars() { return getLocalString("metadata.browsingMenu.sorting.ignoreLeadingChars"); } Configuration(String configFilePath); Set<String> getStopwords(); boolean reloadingRequired(); String getConfigLocalPath(); String getLoca...
@Test public void getBrowsingMenuSortingIgnoreLeadingChars_shouldReturnCorrectValue() throws Exception { Assert.assertEquals(".[]", DataManager.getInstance().getConfiguration().getBrowsingMenuSortingIgnoreLeadingChars()); }
Configuration extends AbstractConfiguration { public List<String> getCollectionBlacklist(String field) { HierarchicalConfiguration collection = getCollectionConfiguration(field); if (collection == null) { return null; } return getLocalList(collection, null, "blacklist.collection", Collections.<String> emptyList()); } C...
@Test public void getCollectionBlacklist_shouldReturnAllConfiguredElements() throws Exception { List<String> ret = DataManager.getInstance().getConfiguration().getCollectionBlacklist(SolrConstants.DC); Assert.assertNotNull(ret); Assert.assertEquals(2, ret.size()); }
Configuration extends AbstractConfiguration { public String getCollectionDefaultSortField(String field, String name) { HierarchicalConfiguration collection = getCollectionConfiguration(field); if (collection == null) { return "-"; } List<HierarchicalConfiguration> fields = collection.configurationsAt("defaultSortFields...
@Test public void getCollectionDefaultSortField_shouldReturnCorrectFieldForCollection() throws Exception { Assert.assertEquals("SORT_CREATOR", DataManager.getInstance().getConfiguration().getCollectionDefaultSortField(SolrConstants.DC, "collection1.sub1")); } @Test public void getCollectionDefaultSortField_shouldGivePr...
Configuration extends AbstractConfiguration { public int getCollectionDisplayNumberOfVolumesLevel(String field) { HierarchicalConfiguration collection = getCollectionConfiguration(field); if (collection == null) { return 0; } return collection.getInt("displayNumberOfVolumesLevel", 0); } Configuration(String configFileP...
@Test public void getCollectionDisplayNumberOfVolumesLevel_shouldReturnCorrectValue() throws Exception { Assert.assertEquals(16, DataManager.getInstance().getConfiguration().getCollectionDisplayNumberOfVolumesLevel(SolrConstants.DC)); }
Configuration extends AbstractConfiguration { public List<DcSortingList> getCollectionSorting(String field) { List<DcSortingList> superlist = new ArrayList<>(); HierarchicalConfiguration collection = getCollectionConfiguration(field); if (collection == null) { return superlist; } superlist.add(new DcSortingList(getLoca...
@Test public void getCollectionSorting_shouldReturnAllConfiguredElements() throws Exception { Assert.assertEquals(3, DataManager.getInstance().getConfiguration().getCollectionSorting(SolrConstants.DC).size()); }
Configuration extends AbstractConfiguration { public String getContentServerRealUrl() { return getLocalString("urls.contentServer"); } Configuration(String configFilePath); Set<String> getStopwords(); boolean reloadingRequired(); String getConfigLocalPath(); String getLocalRessourceBundleFile(); int getViewerThumbnails...
@Test public void getContentServerRealUrl_shouldReturnCorrectValue() throws Exception { Assert.assertEquals("contentServer_value", DataManager.getInstance().getConfiguration().getContentServerRealUrl()); }
Configuration extends AbstractConfiguration { public String getContentServerWrapperUrl() { return getLocalString("urls.contentServerWrapper"); } Configuration(String configFilePath); Set<String> getStopwords(); boolean reloadingRequired(); String getConfigLocalPath(); String getLocalRessourceBundleFile(); int getViewer...
@Deprecated @Test public void getContentServerWrapperUrl_shouldReturnCorrectValue() throws Exception { Assert.assertEquals("contentServerWrapper_value", DataManager.getInstance().getConfiguration().getContentServerWrapperUrl()); }
Configuration extends AbstractConfiguration { public String getDownloadUrl() { String urlString = getLocalString("urls.download", "http: if (!urlString.endsWith("/")) { urlString = urlString + "/"; } if (!urlString.endsWith("download/")) { urlString = urlString + "download/"; } return urlString; } Configuration(String ...
@Test public void getDownloadUrl_shouldReturnCorrectValue() throws Exception { Assert.assertEquals("https: }
Configuration extends AbstractConfiguration { String getDataRepositoriesHome() { return getLocalString("dataRepositoriesHome", ""); } Configuration(String configFilePath); Set<String> getStopwords(); boolean reloadingRequired(); String getConfigLocalPath(); String getLocalRessourceBundleFile(); int getViewerThumbnailsP...
@Test @Deprecated public void getDataRepositoriesHome_shouldReturnCorrectValue() throws Exception { Assert.assertEquals("src/test/resources/data/viewer/data/", DataManager.getInstance().getConfiguration().getDataRepositoriesHome()); }
Configuration extends AbstractConfiguration { public String getDcUrl() { return getLocalString("urls.metadata.dc"); } Configuration(String configFilePath); Set<String> getStopwords(); boolean reloadingRequired(); String getConfigLocalPath(); String getLocalRessourceBundleFile(); int getViewerThumbnailsPerPage(); int ge...
@Test public void getDcUrl_shouldReturnCorrectValue() throws Exception { Assert.assertEquals("dc_value", DataManager.getInstance().getConfiguration().getDcUrl()); }
Configuration extends AbstractConfiguration { public String getDefaultCollection() { return getLocalString("content.defaultCollection"); } Configuration(String configFilePath); Set<String> getStopwords(); boolean reloadingRequired(); String getConfigLocalPath(); String getLocalRessourceBundleFile(); int getViewerThumbn...
@Test public void getDefaultCollection_shouldReturnCorrectValue() throws Exception { Assert.assertEquals("defaultCollection_value", DataManager.getInstance().getConfiguration().getDefaultCollection()); }
Configuration extends AbstractConfiguration { public boolean getDisplayBreadcrumbs() { return this.getLocalBoolean("webGuiDisplay.displayBreadcrumbs", true); } Configuration(String configFilePath); Set<String> getStopwords(); boolean reloadingRequired(); String getConfigLocalPath(); String getLocalRessourceBundleFile()...
@Test public void getDisplayBreadcrumbs_shouldReturnCorrectValue() throws Exception { Assert.assertEquals(false, DataManager.getInstance().getConfiguration().getDisplayBreadcrumbs()); }
Configuration extends AbstractConfiguration { public boolean getDisplayMetadataPageLinkBlock() { return this.getLocalBoolean("webGuiDisplay.displayMetadataPageLinkBlock", true); } Configuration(String configFilePath); Set<String> getStopwords(); boolean reloadingRequired(); String getConfigLocalPath(); String getLocalR...
@Test public void getDisplayMetadataPageLinkBlock_shouldReturnCorrectValue() throws Exception { Assert.assertEquals(false, DataManager.getInstance().getConfiguration().getDisplayMetadataPageLinkBlock()); }
Configuration extends AbstractConfiguration { public boolean getDisplayStructType() { return this.getLocalBoolean("metadata.searchHitMetadataList.displayStructType", true); } Configuration(String configFilePath); Set<String> getStopwords(); boolean reloadingRequired(); String getConfigLocalPath(); String getLocalRessou...
@Test public void getDisplayStructType_shouldReturnCorrectValue() throws Exception { Assert.assertEquals(false, DataManager.getInstance().getConfiguration().getDisplayStructType()); }
Configuration extends AbstractConfiguration { public String getEseUrl() { return getLocalString("urls.metadata.ese"); } Configuration(String configFilePath); Set<String> getStopwords(); boolean reloadingRequired(); String getConfigLocalPath(); String getLocalRessourceBundleFile(); int getViewerThumbnailsPerPage(); int ...
@Test public void getEseUrl_shouldReturnCorrectValue() throws Exception { Assert.assertEquals("ese_value", DataManager.getInstance().getConfiguration().getEseUrl()); }
Configuration extends AbstractConfiguration { public String getFeedbackEmailAddress() { return getLocalString("user.feedbackEmailAddress"); } Configuration(String configFilePath); Set<String> getStopwords(); boolean reloadingRequired(); String getConfigLocalPath(); String getLocalRessourceBundleFile(); int getViewerThu...
@Test public void getFeedbackEmailAddress_shouldReturnCorrectValue() throws Exception { Assert.assertEquals("feedbackEmailAddress_value", DataManager.getInstance().getConfiguration().getFeedbackEmailAddress()); }
Configuration extends AbstractConfiguration { public int getSearchHitsPerPageDefaultValue() { List<HierarchicalConfiguration> values = getLocalConfigurationsAt("search.hitsPerPage.value"); if (values.isEmpty()) { return 10; } for (Iterator<HierarchicalConfiguration> it = values.iterator(); it.hasNext();) { Hierarchical...
@Test public void getSearchHitsPerPageDefaultValue_shouldReturnCorrectValue() throws Exception { Assert.assertEquals(15, DataManager.getInstance().getConfiguration().getSearchHitsPerPageDefaultValue()); }
Configuration extends AbstractConfiguration { public List<Integer> getSearchHitsPerPageValues() { List<String> values = getLocalList("search.hitsPerPage.value"); if (values.isEmpty()) { return Collections.emptyList(); } List<Integer> ret = new ArrayList<>(values.size()); for (String value : values) { try { ret.add(Inte...
@Test public void getSearchHitsPerPageValues_shouldReturnAllValues() throws Exception { Assert.assertEquals(4, DataManager.getInstance().getConfiguration().getSearchHitsPerPageValues().size()); }
Configuration extends AbstractConfiguration { public int getFulltextFragmentLength() { return getLocalInt("search.fulltextFragmentLength", 200); } Configuration(String configFilePath); Set<String> getStopwords(); boolean reloadingRequired(); String getConfigLocalPath(); String getLocalRessourceBundleFile(); int getView...
@Test public void getFulltextFragmentLength_shouldReturnCorrectValue() throws Exception { Assert.assertEquals(50, DataManager.getInstance().getConfiguration().getFulltextFragmentLength()); }
Configuration extends AbstractConfiguration { public String getHotfolder() { return getLocalString("hotfolder"); } Configuration(String configFilePath); Set<String> getStopwords(); boolean reloadingRequired(); String getConfigLocalPath(); String getLocalRessourceBundleFile(); int getViewerThumbnailsPerPage(); int getVi...
@Test public void getHotfolder_shouldReturnCorrectValue() throws Exception { Assert.assertEquals("hotfolder", DataManager.getInstance().getConfiguration().getHotfolder()); }
Configuration extends AbstractConfiguration { public String getIndexedLidoFolder() { return getLocalString("indexedLidoFolder", "indexed_lido"); } Configuration(String configFilePath); Set<String> getStopwords(); boolean reloadingRequired(); String getConfigLocalPath(); String getLocalRessourceBundleFile(); int getView...
@Test public void getIndexedLidoFolder_shouldReturnCorrectValue() throws Exception { Assert.assertEquals("indexed_lido", DataManager.getInstance().getConfiguration().getIndexedLidoFolder()); }
Configuration extends AbstractConfiguration { public String getIndexedMetsFolder() { return getLocalString("indexedMetsFolder", "indexed_mets"); } Configuration(String configFilePath); Set<String> getStopwords(); boolean reloadingRequired(); String getConfigLocalPath(); String getLocalRessourceBundleFile(); int getView...
@Test public void getIndexedMetsFolder_shouldReturnCorrectValue() throws Exception { Assert.assertEquals("indexed_mets", DataManager.getInstance().getConfiguration().getIndexedMetsFolder()); }
Configuration extends AbstractConfiguration { public String getIndexedDenkxwebFolder() { return getLocalString("indexedDenkxwebFolder", "indexed_denkxweb"); } Configuration(String configFilePath); Set<String> getStopwords(); boolean reloadingRequired(); String getConfigLocalPath(); String getLocalRessourceBundleFile();...
@Test public void getIndexedDenkxwebFolder_shouldReturnCorrectValue() throws Exception { Assert.assertEquals("indexed_denkxweb", DataManager.getInstance().getConfiguration().getIndexedDenkxwebFolder()); }
Configuration extends AbstractConfiguration { public String getIndexedDublinCoreFolder() { return getLocalString("indexedDublinCoreFolder", "indexed_dublincore"); } Configuration(String configFilePath); Set<String> getStopwords(); boolean reloadingRequired(); String getConfigLocalPath(); String getLocalRessourceBundleF...
@Test public void getIndexedDublinCoreFolder_shouldReturnCorrectValue() throws Exception { Assert.assertEquals("indexed_dublincore", DataManager.getInstance().getConfiguration().getIndexedDublinCoreFolder()); }
Configuration extends AbstractConfiguration { public List<Metadata> getMainMetadataForTemplate(String template) { logger.trace("getMainMetadataForTemplate: {}", template); List<HierarchicalConfiguration> templateList = getLocalConfigurationsAt("metadata.mainMetadataList.template"); if (templateList == null) { return Co...
@Test public void getMainMetadataForTemplate_shouldReturnCorrectTemplateConfiguration() throws Exception { Assert.assertEquals(1, DataManager.getInstance().getConfiguration().getMainMetadataForTemplate("Chapter").size()); } @Test public void getMainMetadataForTemplate_shouldReturnDefaultTemplateConfigurationIfTemplateN...
Configuration extends AbstractConfiguration { public List<Metadata> getTocLabelConfiguration(String template) { List<HierarchicalConfiguration> templateList = getLocalConfigurationsAt("toc.labelConfig.template"); if (templateList == null) { return Collections.emptyList(); } return getMetadataForTemplate(template, templ...
@Test public void getTocLabelConfiguration_shouldReturnCorrectTemplateConfiguration() throws Exception { List<Metadata> metadataList = DataManager.getInstance().getConfiguration().getTocLabelConfiguration("PeriodicalVolume"); Assert.assertNotNull(metadataList); Assert.assertEquals(1, metadataList.size()); Metadata meta...
Configuration extends AbstractConfiguration { public String getMarcUrl() { return getLocalString("urls.metadata.marc"); } Configuration(String configFilePath); Set<String> getStopwords(); boolean reloadingRequired(); String getConfigLocalPath(); String getLocalRessourceBundleFile(); int getViewerThumbnailsPerPage(); in...
@Test public void getMarcUrl_shouldReturnCorrectValue() throws Exception { Assert.assertEquals("marc_value", DataManager.getInstance().getConfiguration().getMarcUrl()); }
Configuration extends AbstractConfiguration { public String getMediaFolder() { return getLocalString("mediaFolder"); } Configuration(String configFilePath); Set<String> getStopwords(); boolean reloadingRequired(); String getConfigLocalPath(); String getLocalRessourceBundleFile(); int getViewerThumbnailsPerPage(); int g...
@Test public void getMediaFolder_shouldReturnCorrectValue() throws Exception { Assert.assertEquals("media", DataManager.getInstance().getConfiguration().getMediaFolder()); }
Configuration extends AbstractConfiguration { public String getPdfFolder() { return getLocalString("pdfFolder", "pdf"); } Configuration(String configFilePath); Set<String> getStopwords(); boolean reloadingRequired(); String getConfigLocalPath(); String getLocalRessourceBundleFile(); int getViewerThumbnailsPerPage(); in...
@Test public void getPdfFolder_shouldReturnCorrectValue() throws Exception { Assert.assertEquals("PDF", DataManager.getInstance().getConfiguration().getPdfFolder()); }
Configuration extends AbstractConfiguration { public String getVocabulariesFolder() { return getLocalString("vocabularies", "vocabularies"); } Configuration(String configFilePath); Set<String> getStopwords(); boolean reloadingRequired(); String getConfigLocalPath(); String getLocalRessourceBundleFile(); int getViewerTh...
@Test public void getVocabulariesFolder_shouldReturnCorrectValue() throws Exception { Assert.assertEquals("vocabularies", DataManager.getInstance().getConfiguration().getVocabulariesFolder()); }
Configuration extends AbstractConfiguration { public String getMetsUrl() { return getLocalString("urls.metadata.mets"); } Configuration(String configFilePath); Set<String> getStopwords(); boolean reloadingRequired(); String getConfigLocalPath(); String getLocalRessourceBundleFile(); int getViewerThumbnailsPerPage(); in...
@Test public void getMetsUrl_shouldReturnCorrectValue() throws Exception { Assert.assertEquals("mets_value", DataManager.getInstance().getConfiguration().getMetsUrl()); }
Configuration extends AbstractConfiguration { public int getMultivolumeThumbnailHeight() { return getLocalInt("toc.multiVolumeThumbnailsHeight", 60); } Configuration(String configFilePath); Set<String> getStopwords(); boolean reloadingRequired(); String getConfigLocalPath(); String getLocalRessourceBundleFile(); int ge...
@Test public void getMultivolumeThumbnailHeight_shouldReturnCorrectValue() throws Exception { Assert.assertEquals(13, DataManager.getInstance().getConfiguration().getMultivolumeThumbnailHeight()); }
Configuration extends AbstractConfiguration { public int getMultivolumeThumbnailWidth() { return getLocalInt("toc.multiVolumeThumbnailsWidth", 50); } Configuration(String configFilePath); Set<String> getStopwords(); boolean reloadingRequired(); String getConfigLocalPath(); String getLocalRessourceBundleFile(); int getV...
@Test public void getMultivolumeThumbnailWidth_shouldReturnCorrectValue() throws Exception { Assert.assertEquals(12, DataManager.getInstance().getConfiguration().getMultivolumeThumbnailWidth()); }
Configuration extends AbstractConfiguration { public boolean isUserRegistrationEnabled() { return getLocalBoolean("user.userRegistrationEnabled", true); } Configuration(String configFilePath); Set<String> getStopwords(); boolean reloadingRequired(); String getConfigLocalPath(); String getLocalRessourceBundleFile(); int...
@Test public void isUserRegistrationEnabled_shouldReturnCorrectValue() throws Exception { Assert.assertFalse(DataManager.getInstance().getConfiguration().isUserRegistrationEnabled()); }
Configuration extends AbstractConfiguration { public List<SecurityQuestion> getSecurityQuestions() { List<HierarchicalConfiguration> nodes = getLocalConfigurationsAt("user.securityQuestions.question"); if (nodes == null || nodes.isEmpty()) { return Collections.emptyList(); } List<SecurityQuestion> ret = new ArrayList<>...
@Test public void getSecurityQuestions_shouldReturnAllConfiguredElements() throws Exception { List<SecurityQuestion> result = DataManager.getInstance().getConfiguration().getSecurityQuestions(); Assert.assertNotNull(result); Assert.assertEquals(2, result.size()); { SecurityQuestion q = result.get(0); Assert.assertEqual...
Configuration extends AbstractConfiguration { public boolean isShowOpenIdConnect() { return getAuthenticationProviders().stream().anyMatch(provider -> OpenIdProvider.TYPE_OPENID.equalsIgnoreCase(provider.getType())); } Configuration(String configFilePath); Set<String> getStopwords(); boolean reloadingRequired(); String...
@Test public void isShowOpenIdConnect_shouldReturnCorrectValue() throws Exception { Assert.assertTrue(DataManager.getInstance().getConfiguration().isShowOpenIdConnect()); }
Configuration extends AbstractConfiguration { public List<IAuthenticationProvider> getAuthenticationProviders() { XMLConfiguration myConfigToUse = config; if (!configLocal.configurationsAt("user.authenticationProviders").isEmpty()) { myConfigToUse = configLocal; } int max = myConfigToUse.getMaxIndex("user.authenticatio...
@Test public void getAuthenticationProviders_shouldLoadUserGroupNamesCorrectly() throws Exception { List<IAuthenticationProvider> providers = DataManager.getInstance().getConfiguration().getAuthenticationProviders(); Assert.assertEquals(5, providers.size()); List<String> groups = providers.get(2).getAddUserToGroups(); ...
Configuration extends AbstractConfiguration { public String getOrigContentFolder() { return getLocalString("origContentFolder"); } Configuration(String configFilePath); Set<String> getStopwords(); boolean reloadingRequired(); String getConfigLocalPath(); String getLocalRessourceBundleFile(); int getViewerThumbnailsPerP...
@Test public void getOrigContentFolder_shouldReturnCorrectValue() throws Exception { Assert.assertEquals("source", DataManager.getInstance().getConfiguration().getOrigContentFolder()); }
Configuration extends AbstractConfiguration { public int getPageLoaderThreshold() { return getLocalInt("performance.pageLoaderThreshold", 1000); } Configuration(String configFilePath); Set<String> getStopwords(); boolean reloadingRequired(); String getConfigLocalPath(); String getLocalRessourceBundleFile(); int getView...
@Test public void getPageLoaderThreshold_shouldReturnCorrectValue() throws Exception { Assert.assertEquals(1000, DataManager.getInstance().getConfiguration().getPageLoaderThreshold()); }
Configuration extends AbstractConfiguration { public String getPageType(PageType type) { return getLocalString("viewer.pageTypes." + type.name()); } Configuration(String configFilePath); Set<String> getStopwords(); boolean reloadingRequired(); String getConfigLocalPath(); String getLocalRessourceBundleFile(); int getVi...
@Test public void getPageType_shouldReturnTheCorrectValueForTheGivenType() throws Exception { Assert.assertEquals("viewImage_value", DataManager.getInstance().getConfiguration().getPageType(PageType.viewImage)); } @Test public void getPageType_shouldReturnNullForNonConfiguredType() throws Exception { Assert.assertNull(...
Configuration extends AbstractConfiguration { public String getRssCopyrightText() { return getLocalString("rss.copyright"); } Configuration(String configFilePath); Set<String> getStopwords(); boolean reloadingRequired(); String getConfigLocalPath(); String getLocalRessourceBundleFile(); int getViewerThumbnailsPerPage()...
@Test public void getRssCopyrightText_shouldReturnCorrectValue() throws Exception { Assert.assertEquals("copyright_value", DataManager.getInstance().getConfiguration().getRssCopyrightText()); }
Configuration extends AbstractConfiguration { public String getRssDescription() { return getLocalString("rss.description", "latest imports"); } Configuration(String configFilePath); Set<String> getStopwords(); boolean reloadingRequired(); String getConfigLocalPath(); String getLocalRessourceBundleFile(); int getViewerT...
@Test public void getRssDescription_shouldReturnCorrectValue() throws Exception { Assert.assertEquals("description_value", DataManager.getInstance().getConfiguration().getRssDescription()); }
Configuration extends AbstractConfiguration { public int getRssFeedItems() { return getLocalInt("rss.numberOfItems", 50); } Configuration(String configFilePath); Set<String> getStopwords(); boolean reloadingRequired(); String getConfigLocalPath(); String getLocalRessourceBundleFile(); int getViewerThumbnailsPerPage(); ...
@Test public void getRssFeedItems_shouldReturnCorrectValue() throws Exception { Assert.assertEquals(25, DataManager.getInstance().getConfiguration().getRssFeedItems()); }
Configuration extends AbstractConfiguration { public String getRssTitle() { return getLocalString("rss.title", "viewer-rss"); } Configuration(String configFilePath); Set<String> getStopwords(); boolean reloadingRequired(); String getConfigLocalPath(); String getLocalRessourceBundleFile(); int getViewerThumbnailsPerPage...
@Test public void getRssTitle_shouldReturnCorrectValue() throws Exception { Assert.assertEquals("title_value", DataManager.getInstance().getConfiguration().getRssTitle()); }
AccessConditionUtils { static Map<String, List<LicenseType>> getRelevantLicenseTypesOnly(List<LicenseType> allLicenseTypes, Set<String> requiredAccessConditions, String query, Map<String, Boolean> accessMap) throws IndexUnreachableException, PresentationException { if (requiredAccessConditions == null || requiredAccess...
@Test public void getRelevantLicenseTypesOnly_shouldRemoveLicenseTypesWhoseNamesDoNotMatchAccessConditions() throws Exception { List<LicenseType> allLicenseTypes = new ArrayList<>(); LicenseType lt = new LicenseType(); allLicenseTypes.add(lt); lt.setName("type1"); lt = new LicenseType(); allLicenseTypes.add(lt); lt.set...
Configuration extends AbstractConfiguration { public String getRulesetFilePath() { return getLocalString("content.ruleset"); } Configuration(String configFilePath); Set<String> getStopwords(); boolean reloadingRequired(); String getConfigLocalPath(); String getLocalRessourceBundleFile(); int getViewerThumbnailsPerPage(...
@Test public void getRulesetFilePath_shouldReturnCorrectValue() throws Exception { Assert.assertEquals("ruleset_value", DataManager.getInstance().getConfiguration().getRulesetFilePath()); }
Configuration extends AbstractConfiguration { public List<Metadata> getSearchHitMetadataForTemplate(String template) { List<HierarchicalConfiguration> templateList = getLocalConfigurationsAt("metadata.searchHitMetadataList.template"); if (templateList == null) { return Collections.emptyList(); } return getMetadataForTe...
@Test public void getSearchHitMetadataForTemplate_shouldReturnCorrectTemplateConfiguration() throws Exception { Assert.assertEquals(1, DataManager.getInstance().getConfiguration().getSearchHitMetadataForTemplate("Chapter").size()); } @Test public void getSearchHitMetadataForTemplate_shouldReturnDefaultTemplateConfigura...
Configuration extends AbstractConfiguration { public int getSearchHitMetadataValueLength() { return getLocalInt("metadata.searchHitMetadataList.valueLength", 0); } Configuration(String configFilePath); Set<String> getStopwords(); boolean reloadingRequired(); String getConfigLocalPath(); String getLocalRessourceBundleFi...
@Test public void getSearchHitMetadataValueLength_shouldReturnCorrectValue() throws Exception { Assert.assertEquals(18, DataManager.getInstance().getConfiguration().getSearchHitMetadataValueLength()); }