AllThesaurus extends Thesaurus { @Override public String getDefaultNamespace() { try { final Iterator<Thesaurus> iterator = thesaurusFinder.getThesauriMap().values().iterator(); Thesaurus thesaurus = null; while (iterator.hasNext()) { thesaurus = iterator.next(); if (!AllThesaurus.ALL_THESAURUS_KEY.equals(thesaurus.getKey())) { break; } else { thesaurus = null; } } if (thesaurus != null) { return URI_CODE_PREFIX + URLEncoder.encode(thesaurus.getDefaultNamespace(), Constants.ENCODING); } else { return null; } } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } } AllThesaurus(ThesaurusFinder thesaurusFinder, IsoLanguagesMapper isoLangMapper, String siteUrl); static String buildKeywordUri(KeywordBean actualWord); @Override String getKey(); @Override String getDname(); @Override String getFname(); @Override Path getFile(); @Override String getType(); @Override String getTitle(); @Override String getDate(); @Override String getDownloadUrl(); @Override String getKeywordUrl(); @Override void retrieveThesaurusTitle(); @Override synchronized LocalRepository getRepository(); @Override synchronized Thesaurus setRepository(LocalRepository repository); @Override synchronized Thesaurus initRepository(); @Override synchronized QueryResultsTable performRequest(final String query); @Override boolean hasConceptScheme(String uri); @Override synchronized URI addElement(KeywordBean keyword); @Override synchronized Thesaurus removeElement(KeywordBean keyword); @Override synchronized Thesaurus removeElement(String namespace, String code); @Override synchronized Thesaurus removeElement(String uri); @Override synchronized URI updateElement(KeywordBean keyword, boolean replace); @Override synchronized boolean isFreeCode(final String namespace, final String code); @Override Thesaurus updateCode(KeywordBean bean, String newcode); @Override synchronized Thesaurus updateCode(String namespace, String oldcode, String newcode); @Override synchronized Thesaurus updateCodeByURI(String olduri, String newuri); @Override void addTitleElement(String thesaurusTitle); @Override IsoLanguagesMapper getIsoLanguageMapper(); @Override synchronized void addRelation(String subject, KeywordRelation related, String relatedSubject); @Override KeywordBean getKeyword(String uri, String... languages); @Override boolean hasKeyword(String uri); @Override List<KeywordBean> getRelated(final String uri, final KeywordRelation request, final String... languages); @Override boolean hasKeywordWithLabel(final String label, final String langCode); @Override KeywordBean getKeywordWithLabel(final String label, final String langCode); @Override synchronized void clear(); @Nonnull @Override FileTime getLastModifiedTime(); @Override String getDefaultNamespace(); static final String FNAME; static final String SEPARATOR; static final String ALL_THESAURUS_KEY; }
@Test public void testGetDefaultNamespace() throws Exception { final String defaultNamespace = this.allThesaurus.getDefaultNamespace(); boolean foundNS = false; for (Thesaurus thes : this.thesaurusFinder.getThesauriMap().values()) { foundNS |= thes.getDefaultNamespace().equals(defaultNamespace); } assertTrue(foundNS); }