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