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