1 | package eu.clarin.cmdi.vlo.config; |
---|
2 | |
---|
3 | import java.io.File; |
---|
4 | import java.util.Arrays; |
---|
5 | import java.util.List; |
---|
6 | import java.util.Properties; |
---|
7 | import java.util.Set; |
---|
8 | import static org.hamcrest.CoreMatchers.hasItems; |
---|
9 | import static org.junit.Assert.*; |
---|
10 | import org.junit.Before; |
---|
11 | import org.junit.Test; |
---|
12 | |
---|
13 | /** |
---|
14 | * |
---|
15 | * @author keeloo |
---|
16 | */ |
---|
17 | public class DefaultVloConfigFactoryTest { |
---|
18 | |
---|
19 | public DefaultVloConfigFactoryTest() { |
---|
20 | } |
---|
21 | |
---|
22 | private VloConfig config; |
---|
23 | private Properties testProps; |
---|
24 | |
---|
25 | @Before |
---|
26 | public void setUp() throws Exception { |
---|
27 | config = new DefaultVloConfigFactory().newConfig(); |
---|
28 | testProps = new Properties(); |
---|
29 | testProps.load(getClass().getResourceAsStream("/vloconfig.properties")); |
---|
30 | } |
---|
31 | |
---|
32 | /** |
---|
33 | * Test the getDataRoots method.<br><br> |
---|
34 | * |
---|
35 | * Use the values defined in the packaged {@literal VloConfig.xml} |
---|
36 | * configuration file. |
---|
37 | */ |
---|
38 | @Test |
---|
39 | public void testGetDataRoots() { |
---|
40 | final List<DataRoot> rootsReturned = config.getDataRoots(); |
---|
41 | |
---|
42 | assertNotNull(rootsReturned); |
---|
43 | assertTrue("One or more data roots should be defined", rootsReturned.size() > 0); |
---|
44 | assertNotNull(rootsReturned.get(0).getOriginName()); |
---|
45 | assertTrue("Origin name cannot be empty", rootsReturned.get(0).getOriginName().length() > 0); |
---|
46 | assertNotNull(rootsReturned.get(0).getPrefix()); |
---|
47 | assertTrue("Prefix cannot be empty", rootsReturned.get(0).getPrefix().length() > 0); |
---|
48 | assertNotNull(rootsReturned.get(0).getRootFile()); |
---|
49 | assertTrue("Root file cannot be empty", rootsReturned.get(0).getRootFile().getName().length() > 0); |
---|
50 | assertNotNull(rootsReturned.get(0).getToStrip()); |
---|
51 | } |
---|
52 | |
---|
53 | /** |
---|
54 | * Test the set setDataRoots method |
---|
55 | */ |
---|
56 | @Test |
---|
57 | public void testSetDataRoots() { |
---|
58 | |
---|
59 | List<DataRoot> dataRoots = Arrays.asList( |
---|
60 | new DataRoot("MPI IMDI Archive", |
---|
61 | new File("/lat/apache/htdocs/oai-harvester/mpi-self-harvest/harvested/results/cmdi/"), |
---|
62 | "http://catalog.clarin.eu/", |
---|
63 | "/lat/apache/htdocs/", false), |
---|
64 | new DataRoot("CMDI Providers", |
---|
65 | new File("/lat/apache/htdocs/oai-harvester/cmdi-providers/harvested/results/cmdi/"), |
---|
66 | "http://catalog.clarin.eu/", |
---|
67 | "/lat/apache/htdocs/", false), |
---|
68 | new DataRoot("OLAC Metadata Providers", |
---|
69 | new File("/lat/apache/htdocs/oai-harvester/olac-and-dc-providers/harvested/results/cmdi/"), |
---|
70 | "http://catalog.clarin.eu/", |
---|
71 | "/lat/apache/htdocs/", false)); |
---|
72 | |
---|
73 | System.out.println("setDataRoots"); |
---|
74 | |
---|
75 | config.setDataRoots(dataRoots); |
---|
76 | |
---|
77 | List rootsReturned = config.getDataRoots(); |
---|
78 | |
---|
79 | assertEquals(dataRoots, rootsReturned); |
---|
80 | } |
---|
81 | |
---|
82 | /** |
---|
83 | * Test the getPagesInApplicationCache method |
---|
84 | */ |
---|
85 | @Test |
---|
86 | public void testGetPagesInApplicationCache() { |
---|
87 | |
---|
88 | System.out.println("getPagesInApplicationCache"); |
---|
89 | |
---|
90 | int expResult = 40; // as defined in vloconfig.xml |
---|
91 | int result = config.getPagesInApplicationCache(); |
---|
92 | |
---|
93 | assertEquals(expResult, result); |
---|
94 | } |
---|
95 | |
---|
96 | /** |
---|
97 | * Test the setPagesInApplicationCache method |
---|
98 | */ |
---|
99 | @Test |
---|
100 | public void testSetPagesInApplicationCache() { |
---|
101 | |
---|
102 | System.out.println("setPagesInApplicationCache"); |
---|
103 | |
---|
104 | int param = 999; |
---|
105 | |
---|
106 | config.setPagesInApplicationCache(param); |
---|
107 | |
---|
108 | int result = config.getPagesInApplicationCache(); |
---|
109 | |
---|
110 | assertEquals(param, result); |
---|
111 | } |
---|
112 | |
---|
113 | /** |
---|
114 | * Test the getSessionCacheSize method |
---|
115 | */ |
---|
116 | @Test |
---|
117 | public void testGetSessionCacheSize() { |
---|
118 | |
---|
119 | System.out.println("getPagesInApplicationCache"); |
---|
120 | |
---|
121 | int expResult = 10000; // as defined in vloconfig.xml |
---|
122 | int result = config.getSessionCacheSize(); |
---|
123 | |
---|
124 | assertEquals(expResult, result); |
---|
125 | } |
---|
126 | |
---|
127 | /** |
---|
128 | * Test the setSessionCacheSize method |
---|
129 | */ |
---|
130 | @Test |
---|
131 | public void testSetSessionCacheSize() { |
---|
132 | |
---|
133 | System.out.println("setPagesInApplicationCache"); |
---|
134 | |
---|
135 | int param = 9999; |
---|
136 | |
---|
137 | config.setSessionCacheSize(param); |
---|
138 | |
---|
139 | int result = config.getSessionCacheSize(); |
---|
140 | |
---|
141 | assertEquals(param, result); |
---|
142 | } |
---|
143 | |
---|
144 | /** |
---|
145 | * Test the getMaxDocsInList method |
---|
146 | */ |
---|
147 | @Test |
---|
148 | public void testGetMaxDocsInList() { |
---|
149 | |
---|
150 | System.out.println("getMaxDocsInList"); |
---|
151 | |
---|
152 | int expResult = 128; |
---|
153 | int result = config.getMaxDocsInList(); |
---|
154 | |
---|
155 | assertEquals(expResult, result); |
---|
156 | } |
---|
157 | |
---|
158 | /** |
---|
159 | * Test the setMaxDocsInList method |
---|
160 | */ |
---|
161 | @Test |
---|
162 | public void testSetMaxDocsInList() { |
---|
163 | |
---|
164 | System.out.println("setMaxDocsInList"); |
---|
165 | |
---|
166 | int param = 1000; |
---|
167 | |
---|
168 | config.setMaxDocsInList(param); |
---|
169 | |
---|
170 | int result = config.getMaxDocsInList(); |
---|
171 | |
---|
172 | assertEquals(param, result); |
---|
173 | } |
---|
174 | |
---|
175 | /** |
---|
176 | * Test the getMaxDocsInSolrQueue method |
---|
177 | */ |
---|
178 | @Test |
---|
179 | public void testGetMaxDocsInSolrQueue() { |
---|
180 | |
---|
181 | System.out.println("getMaxDocsInSolrQueue"); |
---|
182 | |
---|
183 | int expResult = 128; |
---|
184 | int result = config.getMaxDocsInList(); |
---|
185 | |
---|
186 | assertEquals(expResult, result); |
---|
187 | } |
---|
188 | |
---|
189 | /** |
---|
190 | * Test the setMaxDocsInSolrQueue method |
---|
191 | */ |
---|
192 | @Test |
---|
193 | public void testSetMaxDocsInSolrQueue() { |
---|
194 | |
---|
195 | System.out.println("setMaxDocsInSolrQueue"); |
---|
196 | |
---|
197 | int param = 1000; |
---|
198 | |
---|
199 | config.setMaxDocsInList(param); |
---|
200 | |
---|
201 | int result = config.getMaxDocsInList(); |
---|
202 | |
---|
203 | assertEquals(param, result); |
---|
204 | } |
---|
205 | |
---|
206 | /** |
---|
207 | * Test the getMaxFileSize method |
---|
208 | */ |
---|
209 | @Test |
---|
210 | public void testGetMaxFileSize() { |
---|
211 | |
---|
212 | System.out.println("getMaxFileSize"); |
---|
213 | |
---|
214 | int expResult = 10000000; |
---|
215 | int result = config.getMaxFileSize(); |
---|
216 | |
---|
217 | assertEquals(expResult, result); |
---|
218 | } |
---|
219 | |
---|
220 | /** |
---|
221 | * Test the setMaxFileSize method |
---|
222 | */ |
---|
223 | @Test |
---|
224 | public void testSetMaxFileSize() { |
---|
225 | |
---|
226 | System.out.println("setMaxFileSize"); |
---|
227 | |
---|
228 | int param = 10000000; |
---|
229 | |
---|
230 | config.setMaxFileSize(param); |
---|
231 | |
---|
232 | int result = config.getMaxFileSize(); |
---|
233 | |
---|
234 | assertEquals(param, result); |
---|
235 | } |
---|
236 | |
---|
237 | /** |
---|
238 | * Test the getHandleResolver method |
---|
239 | */ |
---|
240 | @Test |
---|
241 | public void testGetUseHandleResolver() { |
---|
242 | |
---|
243 | System.out.println("getUseHandleResolver"); |
---|
244 | |
---|
245 | boolean expResult = false; |
---|
246 | boolean result = config.getUseHandleResolver(); |
---|
247 | |
---|
248 | assertEquals(expResult, result); |
---|
249 | } |
---|
250 | |
---|
251 | /** |
---|
252 | * Test the setUseHandleResolver method |
---|
253 | */ |
---|
254 | @Test |
---|
255 | public void testSetUseHandleResolver() { |
---|
256 | |
---|
257 | System.out.println("setUseHandleResolver"); |
---|
258 | |
---|
259 | boolean param = true; |
---|
260 | |
---|
261 | config.setUseHandleResolver(param); |
---|
262 | |
---|
263 | boolean result = config.getUseHandleResolver(); |
---|
264 | |
---|
265 | assertEquals(param, result); |
---|
266 | } |
---|
267 | |
---|
268 | /** |
---|
269 | * Test the deleteAllFirst method |
---|
270 | */ |
---|
271 | @Test |
---|
272 | public void testDeleteAllFirst() { |
---|
273 | |
---|
274 | System.out.println("deleteAllFirst"); |
---|
275 | |
---|
276 | boolean expResult = Boolean.valueOf(testProps.getProperty("deleteAllFirst")); |
---|
277 | boolean result = config.getDeleteAllFirst(); |
---|
278 | |
---|
279 | assertEquals(expResult, result); |
---|
280 | } |
---|
281 | |
---|
282 | /** |
---|
283 | * Test the deleteAllFirst method |
---|
284 | */ |
---|
285 | @Test |
---|
286 | public void testSetDeleteAllFirst() { |
---|
287 | |
---|
288 | System.out.println("setDeleteAllFirst"); |
---|
289 | |
---|
290 | boolean param = true; |
---|
291 | |
---|
292 | config.setDeleteAllFirst(param); |
---|
293 | |
---|
294 | boolean result = config.getDeleteAllFirst(); |
---|
295 | |
---|
296 | assertEquals(param, result); |
---|
297 | } |
---|
298 | |
---|
299 | /** |
---|
300 | * Test the printMapping method |
---|
301 | */ |
---|
302 | @Test |
---|
303 | public void testPrintMapping() { |
---|
304 | |
---|
305 | System.out.println("printMapping"); |
---|
306 | |
---|
307 | boolean expResult = false; |
---|
308 | boolean result = config.printMapping(); |
---|
309 | |
---|
310 | assertEquals(expResult, result); |
---|
311 | } |
---|
312 | |
---|
313 | /** |
---|
314 | * Test the setPrintMapping method |
---|
315 | */ |
---|
316 | @Test |
---|
317 | public void testSetPrintMapping() { |
---|
318 | System.out.println("setPrintMapping"); |
---|
319 | |
---|
320 | boolean param = false; |
---|
321 | |
---|
322 | config.setPrintMapping(param); |
---|
323 | |
---|
324 | boolean result = config.printMapping(); |
---|
325 | |
---|
326 | assertEquals(param, result); |
---|
327 | } |
---|
328 | |
---|
329 | /** |
---|
330 | * Test the getHomeUrl method |
---|
331 | */ |
---|
332 | @Test |
---|
333 | public void testGetVloHomeLink() { |
---|
334 | |
---|
335 | System.out.println("getVloHomeLink"); |
---|
336 | |
---|
337 | String expResult = testProps.getProperty("homeUrl"); |
---|
338 | String result = config.getHomeUrl(); |
---|
339 | |
---|
340 | assertEquals(expResult, result); |
---|
341 | } |
---|
342 | |
---|
343 | /** |
---|
344 | * Test the setHomeUrl method |
---|
345 | */ |
---|
346 | @Test |
---|
347 | public void testSetVloHomeLink() { |
---|
348 | |
---|
349 | System.out.println("setVloHomeLink"); |
---|
350 | |
---|
351 | String param = "http://www.clarin.eu/vlo"; |
---|
352 | |
---|
353 | config.setHomeUrl(param); |
---|
354 | |
---|
355 | String result = config.getHomeUrl(); |
---|
356 | |
---|
357 | assertEquals(param, result); |
---|
358 | } |
---|
359 | |
---|
360 | /** |
---|
361 | * Test the getHelpUrl method |
---|
362 | */ |
---|
363 | @Test |
---|
364 | public void testGetHelpUrl() { |
---|
365 | |
---|
366 | System.out.println("getHelpUrl"); |
---|
367 | |
---|
368 | String expResult = testProps.getProperty("helpUrl"); |
---|
369 | String result = config.getHelpUrl(); |
---|
370 | |
---|
371 | assertEquals(expResult, result); |
---|
372 | } |
---|
373 | |
---|
374 | /** |
---|
375 | * Test the setHelpUrl method |
---|
376 | */ |
---|
377 | @Test |
---|
378 | public void testSetHelpUrl() { |
---|
379 | |
---|
380 | System.out.println("setHelpUrl"); |
---|
381 | |
---|
382 | String param = "http://www.clarin.eu/vlo"; |
---|
383 | |
---|
384 | config.setHelpUrl(param); |
---|
385 | |
---|
386 | String result = config.getHelpUrl(); |
---|
387 | |
---|
388 | assertEquals(param, result); |
---|
389 | } |
---|
390 | |
---|
391 | /** |
---|
392 | * Test the getSolrUrl method |
---|
393 | */ |
---|
394 | @Test |
---|
395 | public void testGetSolrUrl() { |
---|
396 | |
---|
397 | System.out.println("getSolrUrl"); |
---|
398 | |
---|
399 | String expResult = testProps.getProperty("solrUrl"); |
---|
400 | String result = config.getSolrUrl(); |
---|
401 | |
---|
402 | assertEquals(expResult, result); |
---|
403 | } |
---|
404 | |
---|
405 | /** |
---|
406 | * Test the setHomeUrl method |
---|
407 | */ |
---|
408 | @Test |
---|
409 | public void testSetSolrUrl() { |
---|
410 | |
---|
411 | System.out.println("setSolrUrl"); |
---|
412 | |
---|
413 | String param = "http://localhost:8084/vlo_solr/"; |
---|
414 | |
---|
415 | config.setSolrUrl(param); |
---|
416 | |
---|
417 | String result = config.getSolrUrl(); |
---|
418 | |
---|
419 | assertEquals(param, result); |
---|
420 | } |
---|
421 | |
---|
422 | /** |
---|
423 | * Test the getGetComponentRegistryProfileSchema method |
---|
424 | */ |
---|
425 | @Test |
---|
426 | public void testGetComponentRegistryProfileSchema() { |
---|
427 | |
---|
428 | System.out.println("getComponentRegistryProfileSchema"); |
---|
429 | |
---|
430 | String expResult = "http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/profiles/someId/xsd"; |
---|
431 | String result = config.getComponentRegistryProfileSchema("someId"); |
---|
432 | |
---|
433 | assertEquals(expResult, result); |
---|
434 | } |
---|
435 | |
---|
436 | /** |
---|
437 | * Test the getComponentRegistryRESTURL method |
---|
438 | */ |
---|
439 | @Test |
---|
440 | public void testGetComponentRegistryRESTURL() { |
---|
441 | |
---|
442 | System.out.println("getComponentRegistryRESTURL"); |
---|
443 | |
---|
444 | String expResult = "http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/profiles/"; |
---|
445 | String result = config.getComponentRegistryRESTURL(); |
---|
446 | |
---|
447 | assertEquals(expResult, result); |
---|
448 | } |
---|
449 | |
---|
450 | /** |
---|
451 | * Test the setComponentRegistryRESTURL method |
---|
452 | */ |
---|
453 | @Test |
---|
454 | public void testComponentRegistryRESTURL() { |
---|
455 | |
---|
456 | System.out.println("setComponentRegistryRESTURL"); |
---|
457 | |
---|
458 | String param = "http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/profiles/"; |
---|
459 | |
---|
460 | config.setComponentRegistryRESTURL(param); |
---|
461 | |
---|
462 | String result = config.getComponentRegistryRESTURL(); |
---|
463 | |
---|
464 | assertEquals(param, result); |
---|
465 | } |
---|
466 | |
---|
467 | /** |
---|
468 | * Test the getHandleServerUrl method |
---|
469 | */ |
---|
470 | @Test |
---|
471 | public void testGetHandleServerUrl() { |
---|
472 | |
---|
473 | System.out.println("getHandleServerUrl"); |
---|
474 | |
---|
475 | String expResult = "http://hdl.handle.net/"; |
---|
476 | String result = config.getHandleServerUrl(); |
---|
477 | |
---|
478 | assertEquals(expResult, result); |
---|
479 | } |
---|
480 | |
---|
481 | /** |
---|
482 | * Test the setHandleServerUrl method |
---|
483 | */ |
---|
484 | @Test |
---|
485 | public void testSetHandleServerUrl() { |
---|
486 | |
---|
487 | System.out.println("setHandleServerUrl"); |
---|
488 | |
---|
489 | String param = "http://hdl.handle.net/"; |
---|
490 | |
---|
491 | config.setHandleServerUrl(param); |
---|
492 | |
---|
493 | String result = config.getHandleServerUrl(); |
---|
494 | |
---|
495 | assertEquals(param, result); |
---|
496 | } |
---|
497 | |
---|
498 | /** |
---|
499 | * Test the getLanguageLinkTemplate method |
---|
500 | */ |
---|
501 | @Test |
---|
502 | public void testGetLanguageLinkPrefix() { |
---|
503 | |
---|
504 | System.out.println("getLanguageLinkPrefix"); |
---|
505 | |
---|
506 | String expResult = "https://infra.clarin.eu/content/language_info/data/{}.html"; |
---|
507 | String result = config.getLanguageLinkTemplate(); |
---|
508 | |
---|
509 | assertEquals(expResult, result); |
---|
510 | } |
---|
511 | |
---|
512 | /** |
---|
513 | * Test the setLanguageLinkPrefix method |
---|
514 | */ |
---|
515 | @Test |
---|
516 | public void testSetLanguageLinkPrefix() { |
---|
517 | |
---|
518 | System.out.println("setLanguageLinkPrefix"); |
---|
519 | |
---|
520 | String param = "https://infra.clarin.eu/content/language_info/data/{}.html"; |
---|
521 | |
---|
522 | config.setLanguageLinkTemplate(param); |
---|
523 | |
---|
524 | String result = config.getLanguageLinkTemplate(); |
---|
525 | |
---|
526 | assertEquals(param, result); |
---|
527 | } |
---|
528 | |
---|
529 | /** |
---|
530 | * Test the getFeedbackFromUrl method |
---|
531 | */ |
---|
532 | @Test |
---|
533 | public void testGetFeedbackFromUrl() { |
---|
534 | |
---|
535 | System.out.println("getFeedBackFromUrl"); |
---|
536 | |
---|
537 | String expResult = "http://www.clarin.eu/node/3759?url="; |
---|
538 | String result = config.getFeedbackFromUrl(); |
---|
539 | |
---|
540 | assertEquals(expResult, result); |
---|
541 | } |
---|
542 | |
---|
543 | /** |
---|
544 | * Test the setFeedbackFromUrl method |
---|
545 | */ |
---|
546 | @Test |
---|
547 | public void testSetFeedbackFromUrl() { |
---|
548 | |
---|
549 | System.out.println("setFeedbackFromUrl"); |
---|
550 | |
---|
551 | String param = "http://www.clarin.eu/node/3759?url="; |
---|
552 | |
---|
553 | config.setFeedbackFromUrl(param); |
---|
554 | |
---|
555 | String result = config.getFeedbackFromUrl(); |
---|
556 | |
---|
557 | assertEquals(param, result); |
---|
558 | } |
---|
559 | |
---|
560 | /** |
---|
561 | * Test the getFederatedContentSearchUrl method |
---|
562 | */ |
---|
563 | @Test |
---|
564 | public void testGetFederatedContentSearchUrl() { |
---|
565 | |
---|
566 | System.out.println("getFederatedContentSearchUrl"); |
---|
567 | |
---|
568 | String expResult = "http://weblicht.sfs.uni-tuebingen.de/Aggregator/"; |
---|
569 | String result = config.getFederatedContentSearchUrl(); |
---|
570 | |
---|
571 | assertEquals(expResult, result); |
---|
572 | } |
---|
573 | |
---|
574 | /** |
---|
575 | * Test the setFederatedContentSearchUrl method |
---|
576 | */ |
---|
577 | @Test |
---|
578 | public void testSetFederatedContentSearchUrl() { |
---|
579 | |
---|
580 | System.out.println("setFederatedContentSearchUrl"); |
---|
581 | |
---|
582 | String param = "http://weblicht.sfs.uni-tuebingen.de/Aggregator/"; |
---|
583 | |
---|
584 | config.setFederatedContentSearchUrl(param); |
---|
585 | |
---|
586 | String result = config.getFederatedContentSearchUrl(); |
---|
587 | |
---|
588 | assertEquals(param, result); |
---|
589 | } |
---|
590 | |
---|
591 | /** |
---|
592 | * Test the getNationalProjectMapping method |
---|
593 | */ |
---|
594 | @Test |
---|
595 | public void testGetNationalProjectMapping() { |
---|
596 | |
---|
597 | System.out.println("getNationalProjectMapping"); |
---|
598 | |
---|
599 | String expResult = "/nationalProjectsMapping.xml"; |
---|
600 | String result = config.getNationalProjectMapping(); |
---|
601 | |
---|
602 | assertEquals(expResult, result); |
---|
603 | } |
---|
604 | |
---|
605 | /** |
---|
606 | * Test the setNationalProjectMapping method |
---|
607 | */ |
---|
608 | @Test |
---|
609 | public void testSetNationalProjectMapping() { |
---|
610 | |
---|
611 | System.out.println("setFNationalProjectMapping"); |
---|
612 | |
---|
613 | String param = "nationalProjectsMapping.xml"; |
---|
614 | |
---|
615 | config.setNationalProjectMapping(param); |
---|
616 | |
---|
617 | String result = config.getNationalProjectMapping(); |
---|
618 | |
---|
619 | assertEquals(param, result); |
---|
620 | } |
---|
621 | |
---|
622 | /** |
---|
623 | * Test of getFacetFields method |
---|
624 | */ |
---|
625 | @Test |
---|
626 | public void testGetFacetFields() { |
---|
627 | |
---|
628 | System.out.println("getFacetFields"); |
---|
629 | |
---|
630 | List<String> expResult = Arrays.asList( |
---|
631 | "languageCode", |
---|
632 | "collection", |
---|
633 | "resourceClass", |
---|
634 | "country", |
---|
635 | "modality", |
---|
636 | "genre", |
---|
637 | "subject", |
---|
638 | "format", |
---|
639 | "organisation", |
---|
640 | "availability", |
---|
641 | "nationalProject", |
---|
642 | "keywords", |
---|
643 | "dataProvider"); |
---|
644 | |
---|
645 | List<String> result = config.getFacetFields(); |
---|
646 | |
---|
647 | assertEquals(expResult, result); |
---|
648 | } |
---|
649 | |
---|
650 | @Test |
---|
651 | public void testGetAllFacetsField() { |
---|
652 | final String[] expItems = new String[]{ |
---|
653 | "languageCode", |
---|
654 | "collection", |
---|
655 | "resourceClass", |
---|
656 | "modality", |
---|
657 | "genre", |
---|
658 | "country", |
---|
659 | "subject", |
---|
660 | "organisation", |
---|
661 | "format", |
---|
662 | "dataProvider", |
---|
663 | "nationalProject", |
---|
664 | "keywords", |
---|
665 | "collection"}; |
---|
666 | List<String> result = config.getAllFacetFields(); |
---|
667 | |
---|
668 | //order is not important in this case |
---|
669 | assertThat(result, hasItems(expItems)); |
---|
670 | } |
---|
671 | |
---|
672 | /** |
---|
673 | * Test of setFacetFields method, of class VloConfig |
---|
674 | */ |
---|
675 | @Test |
---|
676 | public void testSetFacetFields() { |
---|
677 | |
---|
678 | System.out.println("setFacetFields"); |
---|
679 | |
---|
680 | List<String> expResult = Arrays.asList( |
---|
681 | "language", |
---|
682 | "resourceClass", |
---|
683 | "modality", |
---|
684 | "genre", |
---|
685 | "country", |
---|
686 | "dataProvider", |
---|
687 | "nationalProject", |
---|
688 | "keywords"); |
---|
689 | |
---|
690 | config.setFacetFields(expResult); |
---|
691 | |
---|
692 | List<String> result = config.getFacetFields(); |
---|
693 | |
---|
694 | assertEquals(expResult, result); |
---|
695 | } |
---|
696 | |
---|
697 | /** |
---|
698 | * Test the getCountryComponentUrl method. |
---|
699 | */ |
---|
700 | @Test |
---|
701 | public void testCountryComponentUrl() { |
---|
702 | |
---|
703 | System.out.println("getCountryComponentUrl"); |
---|
704 | |
---|
705 | String expResult = "http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/components/clarin.eu:cr1:c_1271859438104/xml"; |
---|
706 | String result = config.getCountryComponentUrl(); |
---|
707 | |
---|
708 | assertEquals(expResult, result); |
---|
709 | } |
---|
710 | |
---|
711 | /** |
---|
712 | * Test the setCountryComponentUrl method. |
---|
713 | */ |
---|
714 | @Test |
---|
715 | public void testSetCountryComponentUrl() { |
---|
716 | |
---|
717 | System.out.println("setCountryComponentUrl"); |
---|
718 | |
---|
719 | String param = "http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/components/clarin.eu:cr1:c_1271859438104/xml"; |
---|
720 | |
---|
721 | config.setCountryComponentUrl(param); |
---|
722 | |
---|
723 | String result = config.getCountryComponentUrl(); |
---|
724 | |
---|
725 | assertEquals(param, result); |
---|
726 | } |
---|
727 | |
---|
728 | /** |
---|
729 | * Test the getLanguage2LetterCodeComponentUrl method. |
---|
730 | */ |
---|
731 | @Test |
---|
732 | public void testGetLanguage2LetterCodeComponentUrl() { |
---|
733 | |
---|
734 | System.out.println("getLanguage2LetterCodeComponentUrl"); |
---|
735 | |
---|
736 | String expResult = "http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/components/clarin.eu:cr1:c_1271859438109/xml"; |
---|
737 | String result = config.getLanguage2LetterCodeComponentUrl(); |
---|
738 | |
---|
739 | assertEquals(expResult, result); |
---|
740 | } |
---|
741 | |
---|
742 | /** |
---|
743 | * Test the setLanguage2LetterCodeComponentUrl method. |
---|
744 | */ |
---|
745 | @Test |
---|
746 | public void testSetLanguage2LetterCodeComponentUrl() { |
---|
747 | |
---|
748 | System.out.println("setLanguage2LetterCodeComponentUrl"); |
---|
749 | |
---|
750 | String param = "http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/components/clarin.eu:cr1:c_1271859438109/xml"; |
---|
751 | |
---|
752 | config.setLanguage2LetterCodeComponentUrl(param); |
---|
753 | |
---|
754 | String result = config.getLanguage2LetterCodeComponentUrl(); |
---|
755 | |
---|
756 | assertEquals(param, result); |
---|
757 | } |
---|
758 | |
---|
759 | /** |
---|
760 | * Test the getLanguage3LetterCodeComponentUrl. |
---|
761 | */ |
---|
762 | @Test |
---|
763 | public void testGetLanguage3LetterCodeComponentUrl() { |
---|
764 | |
---|
765 | System.out.println("getLanguage3LetterCodeComponentUrl"); |
---|
766 | |
---|
767 | String expResult = "http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/components/clarin.eu:cr1:c_1271859438110/xml"; |
---|
768 | String result = config.getLanguage3LetterCodeComponentUrl(); |
---|
769 | |
---|
770 | assertEquals(expResult, result); |
---|
771 | } |
---|
772 | |
---|
773 | /** |
---|
774 | * Test the setLanguage3LetterCodeComponentUrl. |
---|
775 | */ |
---|
776 | @Test |
---|
777 | public void testSetLanguage3LetterCodeComponentUrl() { |
---|
778 | |
---|
779 | System.out.println("setLanguage3LetterCodeComponentUrl"); |
---|
780 | |
---|
781 | String param = "http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/components/clarin.eu:cr1:c_1271859438110/xml"; |
---|
782 | |
---|
783 | config.setLanguage3LetterCodeComponentUrl(param); |
---|
784 | |
---|
785 | String result = config.getLanguage3LetterCodeComponentUrl(); |
---|
786 | |
---|
787 | assertEquals(param, result); |
---|
788 | } |
---|
789 | |
---|
790 | /** |
---|
791 | * Test the getSilToISO639CodesUrl method. |
---|
792 | */ |
---|
793 | @Test |
---|
794 | public void testGetSilToISO639CodesUrl() { |
---|
795 | |
---|
796 | System.out.println("getSilToISO639CodesUrl"); |
---|
797 | |
---|
798 | String expResult = "http://www.clarin.eu/cmd/xslt/sil_to_iso6393.xml"; |
---|
799 | String result = config.getSilToISO639CodesUrl(); |
---|
800 | |
---|
801 | assertEquals(expResult, result); |
---|
802 | } |
---|
803 | |
---|
804 | /** |
---|
805 | * Test the setSilToISO639CodesUrl method. |
---|
806 | */ |
---|
807 | @Test |
---|
808 | public void testSetSilToISO639CodesUrl() { |
---|
809 | |
---|
810 | System.out.println("setSilToISO639CodesUrl"); |
---|
811 | |
---|
812 | String param = "http://www.clarin.eu/cmd/xslt/sil_to_iso6393.xml"; |
---|
813 | |
---|
814 | config.setSilToISO639CodesUrl(param); |
---|
815 | |
---|
816 | String result = config.getSilToISO639CodesUrl(); |
---|
817 | |
---|
818 | assertEquals(param, result); |
---|
819 | } |
---|
820 | |
---|
821 | /** |
---|
822 | * Test the getReverseProxyPrefix method |
---|
823 | */ |
---|
824 | @Test |
---|
825 | public void testReverseProxyPrefix() { |
---|
826 | |
---|
827 | System.out.println("getReverseProxyPrefix"); |
---|
828 | |
---|
829 | String expResult = ""; |
---|
830 | String result = config.getReverseProxyPrefix(); |
---|
831 | |
---|
832 | assertEquals(expResult, result); |
---|
833 | } |
---|
834 | |
---|
835 | /** |
---|
836 | * Test the setReverseProxyPrefix method |
---|
837 | */ |
---|
838 | @Test |
---|
839 | public void testSetReverseProxyPrefix() { |
---|
840 | |
---|
841 | System.out.println("setReverseProxyPrefix"); |
---|
842 | |
---|
843 | String param = "vlodev/"; |
---|
844 | |
---|
845 | config.setReverseProxyPrefix(param); |
---|
846 | |
---|
847 | String result = config.getReverseProxyPrefix(); |
---|
848 | |
---|
849 | assertEquals(param, result); |
---|
850 | } |
---|
851 | |
---|
852 | /** |
---|
853 | * Test the getCqlEndpointFilter method |
---|
854 | */ |
---|
855 | @Test |
---|
856 | public void testGetCqlEndpointFilter() { |
---|
857 | |
---|
858 | System.out.println("getCqlEndpointFilter"); |
---|
859 | |
---|
860 | String expResult = "http://cqlservlet.mpi.nl/"; |
---|
861 | String result = config.getCqlEndpointFilter(); |
---|
862 | |
---|
863 | assertEquals(expResult, result); |
---|
864 | } |
---|
865 | |
---|
866 | /** |
---|
867 | * Test the setCqlEndpointFilter method |
---|
868 | */ |
---|
869 | @Test |
---|
870 | public void testSetCqlEndpointFilter() { |
---|
871 | |
---|
872 | System.out.println("setCqlEndpointFilter"); |
---|
873 | |
---|
874 | String param = "http://cqlservlet.mpi.nl/"; |
---|
875 | |
---|
876 | config.setCqlEndpointFilter(param); |
---|
877 | |
---|
878 | String result = config.getCqlEndpointFilter(); |
---|
879 | |
---|
880 | assertEquals(param, result); |
---|
881 | } |
---|
882 | |
---|
883 | /** |
---|
884 | * Test the getCqlEndpointAlternative method |
---|
885 | */ |
---|
886 | @Test |
---|
887 | public void testGetCqlEndpointAlternative() { |
---|
888 | |
---|
889 | System.out.println("getCqlEndpointAlternative"); |
---|
890 | |
---|
891 | String expResult = "http://cqlservlet.mpi.nl/"; |
---|
892 | String result = config.getCqlEndpointAlternative(); |
---|
893 | |
---|
894 | assertEquals(expResult, result); |
---|
895 | } |
---|
896 | |
---|
897 | /** |
---|
898 | * Test the setCqlEndpointAlternative method |
---|
899 | */ |
---|
900 | @Test |
---|
901 | public void testSetCqlEndpointAlternative() { |
---|
902 | |
---|
903 | System.out.println("setCqlEndpointAlternative"); |
---|
904 | |
---|
905 | String param = "http://cqlservlet.mpi.nl/"; |
---|
906 | |
---|
907 | config.setCqlEndpointAlternative(param); |
---|
908 | |
---|
909 | String result = config.getCqlEndpointAlternative(); |
---|
910 | |
---|
911 | assertEquals(param, result); |
---|
912 | } |
---|
913 | |
---|
914 | @Test |
---|
915 | public void testGetCollectionFacet() { |
---|
916 | final String result = config.getCollectionFacet(); |
---|
917 | assertNull(result); |
---|
918 | } |
---|
919 | |
---|
920 | @Test |
---|
921 | public void testGetIgnoredFields() { |
---|
922 | Set<String> result = config.getIgnoredFields(); |
---|
923 | assertEquals(2, result.size()); |
---|
924 | } |
---|
925 | |
---|
926 | @Test |
---|
927 | public void testGetTechnicalFields() { |
---|
928 | Set<String> result = config.getTechnicalFields(); |
---|
929 | assertEquals(11, result.size()); |
---|
930 | } |
---|
931 | |
---|
932 | @Test |
---|
933 | public void testGetSimpleSearchFacetFields() { |
---|
934 | List<String> result = config.getSimpleSearchFacetFields(); |
---|
935 | assertEquals(5, result.size()); |
---|
936 | } |
---|
937 | } |
---|