Changeset 4517
- Timestamp:
- 02/14/14 09:37:04 (10 years ago)
- Location:
- vlo/branches/vlo-3.0
- Files:
-
- 1 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
vlo/branches/vlo-3.0/vlo-commons/src/main/java/eu/clarin/cmdi/vlo/config/DefaultVloConfigFactory.java
r4510 r4517 17 17 package eu.clarin.cmdi.vlo.config; 18 18 19 import java.io.IOException;20 19 import java.io.InputStream; 21 import javax.xml.bind.JAXBException;22 import javax.xml.transform.stream.StreamSource;23 20 24 21 /** 22 * Creates an instance of the default configuration packed with the VLO commons 25 23 * 26 24 * @author twagoo 27 25 */ 28 public class DefaultVloConfigFactory implementsVloConfigFactory {26 public class DefaultVloConfigFactory extends AbstractXmlVloConfigFactory { 29 27 30 28 public static final String DEFAULT_CONFIG_RESOURCE = "/VloConfig.xml"; 31 private final VloConfigMarshaller marshaller;32 29 33 public DefaultVloConfigFactory() { 34 try { 35 this.marshaller = new VloConfigMarshaller(); 36 } catch (JAXBException ex) { 37 throw new RuntimeException("Could not instantiate configuration marshaller while constructing configuration factory", ex); 38 } 39 } 40 41 public VloConfig newConfig() { 42 try { 43 InputStream configResourceStream = getClass().getResourceAsStream(DEFAULT_CONFIG_RESOURCE); 44 try { 45 return marshaller.unmarshal(new StreamSource(configResourceStream)); 46 } catch (JAXBException ex) { 47 throw new RuntimeException("Could not read default configuration due to deserialization error", ex); 48 } finally { 49 configResourceStream.close(); 50 } 51 } catch (IOException ex) { 52 throw new RuntimeException("Could not close stream to default configuration", ex); 53 } 30 /** 31 * 32 * @return an input stream for the XML file describing the default VLO 33 * configuration 34 */ 35 @Override 36 protected InputStream getXmlConfigurationInputStream() { 37 return getClass().getResourceAsStream(DEFAULT_CONFIG_RESOURCE); 54 38 } 55 39 } -
vlo/branches/vlo-3.0/vlo-commons/src/main/java/eu/clarin/cmdi/vlo/config/VloConfigFactory.java
r4507 r4517 17 17 package eu.clarin.cmdi.vlo.config; 18 18 19 import java.io.IOException; 20 19 21 /** 22 * Interface for objects capable of instantiating a {@link VloConfig} object 20 23 * 21 24 * @author twagoo … … 23 26 public interface VloConfigFactory { 24 27 25 VloConfig newConfig(); 28 /** 29 * 30 * @return a new VLO configuration object 31 * @throws IOException if configuration could be opened, read or closed from 32 * source 33 */ 34 VloConfig newConfig() throws IOException; 26 35 } -
vlo/branches/vlo-3.0/vlo-commons/src/main/java/eu/clarin/cmdi/vlo/config/VloConfigMarshaller.java
r4509 r4517 23 23 import javax.xml.transform.Result; 24 24 import javax.xml.transform.Source; 25 import javax.xml.transform.stream.StreamResult; 25 26 26 27 /** 28 * Serializes and deserializes {@link VloConfig} objects to/from XML files using 29 * the Java Architecture for XML Binding (JAXB) 27 30 * 28 31 * @author twagoo … … 32 35 private final JAXBContext jc; 33 36 34 public VloConfigMarshaller(JAXBContext jc) {35 this.jc = jc;36 }37 38 37 public VloConfigMarshaller() throws JAXBException { 39 38 this.jc = JAXBContext.newInstance(VloConfig.class); 40 39 } 41 40 42 public void marshal(VloConfig config, Result result) throws JAXBException { 41 /** 42 * Marshals (serializes) an existing configuration to some output location 43 * 44 * @param config configuration to marshal 45 * @param result output result for the marshalling, e.g. a 46 * {@link StreamResult} for usage with Files, Streams or Writers 47 * @throws JAXBException 48 */ 49 public final void marshal(VloConfig config, Result result) throws JAXBException { 43 50 final Marshaller marshaller = jc.createMarshaller(); 44 51 marshaller.marshal(config, result); 45 52 } 46 53 47 public VloConfig unmarshal(Source source) throws JAXBException { 54 /** 55 * Unmarshals (deserializes) a configuration file from some source location 56 * 57 * @param source the source representing the VLO configuration to unmarshal 58 * @return the VLO configuration as described by the source 59 * @throws JAXBException if an error occurs while unmarshalling 60 */ 61 public final VloConfig unmarshal(Source source) throws JAXBException { 48 62 Unmarshaller unmarshaller = jc.createUnmarshaller(); 49 63 return (VloConfig) unmarshaller.unmarshal(source); -
vlo/branches/vlo-3.0/vlo-commons/src/main/java/eu/clarin/cmdi/vlo/config/XmlVloConfigFactory.java
r4510 r4517 20 20 import java.io.InputStream; 21 21 import java.net.URL; 22 import javax.xml.bind.JAXBException;23 import javax.xml.transform.stream.StreamSource;24 22 25 23 /** … … 27 25 * @author twagoo 28 26 */ 29 public class XmlVloConfigFactory implements VloConfigFactory {27 public class XmlVloConfigFactory extends AbstractXmlVloConfigFactory implements VloConfigFactory { 30 28 31 private final VloConfigMarshaller marshaller;32 29 private final URL configLocation; 33 30 34 31 public XmlVloConfigFactory(URL configLocation) { 35 32 this.configLocation = configLocation; 36 try {37 this.marshaller = new VloConfigMarshaller();38 } catch (JAXBException ex) {39 throw new RuntimeException("Could not instantiate configuration marshaller while constructing configuration factory", ex);40 }41 33 } 42 34 43 public VloConfig newConfig() { 44 try { 45 final InputStream fileStream = configLocation.openStream(); 46 try { 47 return marshaller.unmarshal(new StreamSource(fileStream)); 48 } catch (JAXBException ex) { 49 throw new RuntimeException("Could not deserialize configuration file", ex); 50 } finally { 51 fileStream.close(); 52 } 53 } catch (IOException ex) { 54 throw new RuntimeException("Could not read configuration file", ex); 55 } 35 protected InputStream getXmlConfigurationInputStream() throws IOException { 36 return configLocation.openStream(); 56 37 } 57 38 } -
vlo/branches/vlo-3.0/vlo-commons/src/test/java/eu/clarin/cmdi/vlo/config/DefaultVloConfigFactoryTest.java
r4509 r4517 1 2 1 package eu.clarin.cmdi.vlo.config; 3 2 … … 16 15 */ 17 16 public class DefaultVloConfigFactoryTest { 18 17 19 18 public DefaultVloConfigFactoryTest() { 20 19 } 21 20 22 21 private VloConfig config; 23 22 24 23 @Before 25 public void setUp() {24 public void setUp() throws Exception { 26 25 config = new DefaultVloConfigFactory().newConfig(); 27 26 } … … 29 28 /** 30 29 * Test the getDataRoots method.<br><br> 31 * 32 * Use the values defined in the packaged {@literal VloConfig.xml} 30 * 31 * Use the values defined in the packaged {@literal VloConfig.xml} 33 32 * configuration file. 34 33 */ 35 34 @Test 36 35 public void testGetDataRoots() { 37 36 38 37 ArrayList<DataRoot> dataRoots; 39 dataRoots = new ArrayList<DataRoot> 40 41 dataRoots.add(new DataRoot("MPI IMDI Archive", 42 43 44 45 dataRoots.add(new DataRoot("CMDI Providers" ,46 47 48 49 dataRoots.add(new DataRoot("OLAC Metadata Providers", 50 51 52 53 38 dataRoots = new ArrayList<DataRoot>(); 39 40 dataRoots.add(new DataRoot("MPI IMDI Archive", 41 new File("/lat/apache/htdocs/oai-harvester/mpi-self-harvest/harvested/results/cmdi/"), 42 "http://catalog.clarin.eu/", 43 "/lat/apache/htdocs/", false)); 44 dataRoots.add(new DataRoot("CMDI Providers", 45 new File("/lat/apache/htdocs/oai-harvester/cmdi-providers/harvested/results/cmdi/"), 46 "http://catalog.clarin.eu/", 47 "/lat/apache/htdocs/", false)); 48 dataRoots.add(new DataRoot("OLAC Metadata Providers", 49 new File("/lat/apache/htdocs/oai-harvester/olac-and-dc-providers/harvested/results/cmdi/"), 50 "http://catalog.clarin.eu/", 51 "/lat/apache/htdocs/", false)); 52 54 53 System.out.println("getDataRoots"); 55 54 56 55 List<DataRoot> rootsReturned = config.getDataRoots(); 57 56 assertArrayEquals(dataRoots.toArray(), rootsReturned.toArray()); … … 63 62 @Test 64 63 public void testSetDataRoots() { 65 66 ArrayList<DataRoot> dataRoots = new ArrayList<DataRoot> 67 68 dataRoots.add(new DataRoot("MPI IMDI Archive", 69 70 71 "/lat/apache/htdocs/", false));72 dataRoots.add(new DataRoot("CMDI Providers" ,73 74 75 76 dataRoots.add(new DataRoot("OLAC Metadata Providers", 77 78 79 80 64 65 ArrayList<DataRoot> dataRoots = new ArrayList<DataRoot>(); 66 67 dataRoots.add(new DataRoot("MPI IMDI Archive", 68 new File("/lat/apache/htdocs/oai-harvester/mpi-self-harvest/harvested/results/cmdi/"), 69 "http://catalog.clarin.eu/", 70 "/lat/apache/htdocs/", false)); 71 dataRoots.add(new DataRoot("CMDI Providers", 72 new File("/lat/apache/htdocs/oai-harvester/cmdi-providers/harvested/results/cmdi/"), 73 "http://catalog.clarin.eu/", 74 "/lat/apache/htdocs/", false)); 75 dataRoots.add(new DataRoot("OLAC Metadata Providers", 76 new File("/lat/apache/htdocs/oai-harvester/olac-and-dc-providers/harvested/results/cmdi/"), 77 "http://catalog.clarin.eu/", 78 "/lat/apache/htdocs/", false)); 79 81 80 System.out.println("setDataRoots"); 82 81 83 82 config.setDataRoots(dataRoots); 84 85 List rootsReturned = config.getDataRoots(); 86 87 assertEquals 83 84 List rootsReturned = config.getDataRoots(); 85 86 assertEquals(dataRoots, rootsReturned); 88 87 } 89 88 … … 93 92 @Test 94 93 public void testGetPagesInApplicationCache() { 95 94 96 95 System.out.println("getPagesInApplicationCache"); 97 96 98 97 int expResult = 40; // as defined in vloconfig.xml 99 98 int result = config.getPagesInApplicationCache(); 100 99 101 100 assertEquals(expResult, result); 102 101 } … … 107 106 @Test 108 107 public void testSetPagesInApplicationCache() { 109 108 110 109 System.out.println("setPagesInApplicationCache"); 111 110 112 111 int param = 999; 113 112 114 113 config.setPagesInApplicationCache(param); 115 114 116 115 int result = config.getPagesInApplicationCache(); 117 118 assertEquals(param, result); 119 } 120 121 116 117 assertEquals(param, result); 118 } 119 122 120 /** 123 121 * Test the getSessionCacheSize method … … 125 123 @Test 126 124 public void testGetSessionCacheSize() { 127 125 128 126 System.out.println("getPagesInApplicationCache"); 129 127 130 128 int expResult = 10000; // as defined in vloconfig.xml 131 129 int result = config.getSessionCacheSize(); 132 130 133 131 assertEquals(expResult, result); 134 132 } … … 139 137 @Test 140 138 public void testSetSessionCacheSize() { 141 139 142 140 System.out.println("setPagesInApplicationCache"); 143 141 144 142 int param = 9999; 145 143 146 144 config.setSessionCacheSize(param); 147 145 148 146 int result = config.getSessionCacheSize(); 149 150 assertEquals(param, result); 151 } 152 147 148 assertEquals(param, result); 149 } 150 153 151 /** 154 152 * Test the getMaxDocsInList method … … 156 154 @Test 157 155 public void testGetMaxDocsInList() { 158 156 159 157 System.out.println("getMaxDocsInList"); 160 158 161 159 int expResult = 128; 162 160 int result = config.getMaxDocsInList(); 163 161 164 162 assertEquals(expResult, result); 165 163 } … … 170 168 @Test 171 169 public void testSetMaxDocsInList() { 172 170 173 171 System.out.println("setMaxDocsInList"); 174 172 175 173 int param = 1000; 176 174 177 175 config.setMaxDocsInList(param); 178 176 179 177 int result = config.getMaxDocsInList(); 180 181 assertEquals(param, result); 182 } 183 178 179 assertEquals(param, result); 180 } 181 184 182 /** 185 183 * Test the getMaxDocsInSolrQueue method … … 187 185 @Test 188 186 public void testGetMaxDocsInSolrQueue() { 189 187 190 188 System.out.println("getMaxDocsInSolrQueue"); 191 189 192 190 int expResult = 128; 193 191 int result = config.getMaxDocsInList(); 194 192 195 193 assertEquals(expResult, result); 196 194 } … … 201 199 @Test 202 200 public void testSetMaxDocsInSolrQueue() { 203 201 204 202 System.out.println("setMaxDocsInSolrQueue"); 205 203 206 204 int param = 1000; 207 205 208 206 config.setMaxDocsInList(param); 209 207 210 208 int result = config.getMaxDocsInList(); 211 212 assertEquals(param, result); 213 } 214 209 210 assertEquals(param, result); 211 } 212 215 213 /** 216 214 * Test the getMaxFileSize method … … 218 216 @Test 219 217 public void testGetMaxFileSize() { 220 218 221 219 System.out.println("getMaxFileSize"); 222 220 223 221 int expResult = 10000000; 224 222 int result = config.getMaxFileSize(); 225 223 226 224 assertEquals(expResult, result); 227 225 } … … 232 230 @Test 233 231 public void testSetMaxFileSize() { 234 232 235 233 System.out.println("setMaxFileSize"); 236 234 237 235 int param = 10000000; 238 236 239 237 config.setMaxFileSize(param); 240 238 241 239 int result = config.getMaxFileSize(); 242 243 assertEquals(param, result); 244 } 245 240 241 assertEquals(param, result); 242 } 243 246 244 /** 247 245 * Test the getHandleResolver method … … 249 247 @Test 250 248 public void testGetUseHandleResolver() { 251 249 252 250 System.out.println("getUseHandleResolver"); 253 251 254 252 boolean expResult = false; 255 253 boolean result = config.getUseHandleResolver(); 256 257 assertEquals(expResult, result); 258 } 259 254 255 assertEquals(expResult, result); 256 } 257 260 258 /** 261 259 * Test the setUseHandleResolver method … … 263 261 @Test 264 262 public void testSetUseHandleResolver() { 265 263 266 264 System.out.println("setUseHandleResolver"); 267 265 268 266 boolean param = true; 269 267 270 268 config.setUseHandleResolver(param); 271 269 272 270 boolean result = config.getUseHandleResolver(); 273 271 274 272 assertEquals(param, result); 275 273 } … … 280 278 @Test 281 279 public void testDeleteAllFirst() { 282 280 283 281 System.out.println("deleteAllFirst"); 284 282 285 283 boolean expResult = true; 286 284 boolean result = config.getDeleteAllFirst(); 287 285 288 286 assertEquals(expResult, result); 289 287 } … … 294 292 @Test 295 293 public void testSetDeleteAllFirst() { 296 294 297 295 System.out.println("setDeleteAllFirst"); 298 296 299 297 boolean param = true; 300 298 301 299 config.setDeleteAllFirst(param); 302 300 303 301 boolean result = config.getDeleteAllFirst(); 304 302 305 303 assertEquals(param, result); 306 304 } … … 311 309 @Test 312 310 public void testPrintMapping() { 313 311 314 312 System.out.println("printMapping"); 315 313 316 314 boolean expResult = false; 317 315 boolean result = config.printMapping(); 318 316 319 317 assertEquals(expResult, result); 320 318 } … … 326 324 public void testSetPrintMapping() { 327 325 System.out.println("setPrintMapping"); 328 326 329 327 boolean param = false; 330 328 331 329 config.setPrintMapping(param); 332 330 333 331 boolean result = config.printMapping(); 334 332 335 333 assertEquals(param, result); 336 334 } … … 341 339 @Test 342 340 public void testGetVloHomeLink() { 343 341 344 342 System.out.println("getVloHomeLink"); 345 343 346 344 String expResult = "http://www.clarin.eu/vlo"; 347 345 String result = config.getHomeUrl(); 348 346 349 347 assertEquals(expResult, result); 350 348 } … … 355 353 @Test 356 354 public void testSetVloHomeLink() { 357 355 358 356 System.out.println("setVloHomeLink"); 359 357 360 358 String param = "http://www.clarin.eu/vlo"; 361 359 362 360 config.setHomeUrl(param); 363 361 364 362 String result = config.getHomeUrl(); 365 363 366 364 assertEquals(param, result); 367 365 } … … 372 370 @Test 373 371 public void testGetHelpUrl() { 374 372 375 373 System.out.println("getHelpUrl"); 376 374 377 375 String expResult = "http://www.clarin.eu/vlo"; 378 376 String result = config.getHelpUrl(); 379 377 380 378 assertEquals(expResult, result); 381 379 } … … 386 384 @Test 387 385 public void testSetHelpUrl() { 388 386 389 387 System.out.println("setHelpUrl"); 390 388 391 389 String param = "http://www.clarin.eu/vlo"; 392 390 393 391 config.setHelpUrl(param); 394 392 395 393 String result = config.getHelpUrl(); 396 394 397 395 assertEquals(param, result); 398 396 } … … 403 401 @Test 404 402 public void testGetSolrUrl() { 405 403 406 404 System.out.println("getSolrUrl"); 407 405 408 406 String expResult = "http://localhost:8080/vlo_solr/"; 409 407 String result = config.getSolrUrl(); 410 408 411 409 assertEquals(expResult, result); 412 410 } … … 417 415 @Test 418 416 public void testSetSolrUrl() { 419 417 420 418 System.out.println("setSolrUrl"); 421 419 422 420 String param = "http://localhost:8084/vlo_solr/"; 423 421 424 422 config.setSolrUrl(param); 425 423 426 424 String result = config.getSolrUrl(); 427 428 assertEquals(param, result); 429 } 430 425 426 assertEquals(param, result); 427 } 428 431 429 /** 432 430 * Test the getGetComponentRegistryProfileSchema method … … 434 432 @Test 435 433 public void testGetComponentRegistryProfileSchema() { 436 434 437 435 System.out.println("getComponentRegistryProfileSchema"); 438 436 439 437 String expResult = "http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/profiles/someId/xsd"; 440 438 String result = config.getComponentRegistryProfileSchema("someId"); 441 442 assertEquals(expResult, result); 443 } 444 439 440 assertEquals(expResult, result); 441 } 442 445 443 /** 446 444 * Test the getComponentRegistryRESTURL method … … 448 446 @Test 449 447 public void testGetComponentRegistryRESTURL() { 450 448 451 449 System.out.println("getComponentRegistryRESTURL"); 452 450 453 451 String expResult = "http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/profiles/"; 454 452 String result = config.getComponentRegistryRESTURL(); 455 453 456 454 assertEquals(expResult, result); 457 455 } … … 462 460 @Test 463 461 public void testComponentRegistryRESTURL() { 464 462 465 463 System.out.println("setComponentRegistryRESTURL"); 466 464 467 465 String param = "http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/profiles/"; 468 466 469 467 config.setComponentRegistryRESTURL(param); 470 468 471 469 String result = config.getComponentRegistryRESTURL(); 472 473 assertEquals(param, result); 474 } 475 470 471 assertEquals(param, result); 472 } 473 476 474 /** 477 475 * Test the getHandleServerUrl method … … 479 477 @Test 480 478 public void testGetHandleServerUrl() { 481 479 482 480 System.out.println("getHandleServerUrl"); 483 481 484 482 String expResult = "http://hdl.handle.net/"; 485 483 String result = config.getHandleServerUrl(); 486 484 487 485 assertEquals(expResult, result); 488 486 } … … 493 491 @Test 494 492 public void testSetHandleServerUrl() { 495 493 496 494 System.out.println("setHandleServerUrl"); 497 495 498 496 String param = "http://hdl.handle.net/"; 499 497 500 498 config.setHandleServerUrl(param); 501 499 502 500 String result = config.getHandleServerUrl(); 503 504 assertEquals(param, result); 505 } 506 501 502 assertEquals(param, result); 503 } 504 507 505 /** 508 506 * Test the getIMDIBrowserUrl method … … 510 508 @Test 511 509 public void testGetIMDIBrowserUrl() { 512 510 513 511 System.out.println("getIMDIBrowserUrl"); 514 512 515 513 String expResult; 516 514 try { … … 529 527 @Test 530 528 public void testSetIMDIBrowserUrl() { 531 529 532 530 System.out.println("setIMDIBrowserUrl"); 533 531 534 532 String param = "http://corpus1.mpi.nl/ds/imdi_browser?openpath="; 535 533 536 534 config.setImdiBrowserUrl(param); 537 535 … … 542 540 expResult = "http://corpus1.mpi.nl/ds/imdi_browser?openpath=" + "handle"; 543 541 } 544 542 545 543 String result = config.getImdiBrowserUrl("handle"); 546 544 547 545 assertEquals(expResult, result); 548 546 } 549 547 550 548 /** 551 549 * Test the getLanguageLinkPrefix method … … 553 551 @Test 554 552 public void testGetLanguageLinkPrefix() { 555 553 556 554 System.out.println("getLanguageLinkPrefix"); 557 555 558 556 String expResult = "http://infra.clarin.eu/service/language/info.php?code="; 559 557 String result = config.getLanguageLinkPrefix(); 560 558 561 559 assertEquals(expResult, result); 562 560 } … … 567 565 @Test 568 566 public void testSetLanguageLinkPrefix() { 569 567 570 568 System.out.println("setLanguageLinkPrefix"); 571 569 572 570 String param = "http://infra.clarin.eu/service/language/info.php?code="; 573 571 574 572 config.setLanguageLinkPrefix(param); 575 573 576 574 String result = config.getLanguageLinkPrefix(); 577 578 assertEquals(param, result); 579 } 580 575 576 assertEquals(param, result); 577 } 578 581 579 /** 582 580 * Test the getFeedbackFromUrl method … … 584 582 @Test 585 583 public void testGetFeedbackFromUrl() { 586 584 587 585 System.out.println("getFeedBackFromUrl"); 588 586 589 587 String expResult = "http://www.clarin.eu/node/3759?url="; 590 588 String result = config.getFeedbackFromUrl(); 591 589 592 590 assertEquals(expResult, result); 593 591 } … … 598 596 @Test 599 597 public void testSetFeedbackFromUrl() { 600 598 601 599 System.out.println("setFeedbackFromUrl"); 602 600 603 601 String param = "http://www.clarin.eu/node/3759?url="; 604 602 605 603 config.setFeedbackFromUrl(param); 606 604 607 605 String result = config.getFeedbackFromUrl(); 608 609 assertEquals(param, result); 610 } 611 606 607 assertEquals(param, result); 608 } 609 612 610 /** 613 611 * Test the getFederatedContentSearchUrl method … … 615 613 @Test 616 614 public void testGetFederatedContentSearchUrl() { 617 615 618 616 System.out.println("getFederatedContentSearchUrl"); 619 617 620 618 String expResult = "http://weblicht.sfs.uni-tuebingen.de/Aggregator/"; 621 619 String result = config.getFederatedContentSearchUrl(); 622 620 623 621 assertEquals(expResult, result); 624 622 } … … 629 627 @Test 630 628 public void testSetFederatedContentSearchUrl() { 631 629 632 630 System.out.println("setFederatedContentSearchUrl"); 633 631 634 632 String param = "http://weblicht.sfs.uni-tuebingen.de/Aggregator/"; 635 633 636 634 config.setFederatedContentSearchUrl(param); 637 635 638 636 String result = config.getFederatedContentSearchUrl(); 639 637 640 638 assertEquals(param, result); 641 639 } … … 646 644 @Test 647 645 public void testGetNationalProjectMapping() { 648 646 649 647 System.out.println("getNationalProjectMapping"); 650 648 651 649 String expResult = "/nationalProjectsMapping.xml"; 652 650 String result = config.getNationalProjectMapping(); 653 651 654 652 assertEquals(expResult, result); 655 653 } … … 660 658 @Test 661 659 public void testSetNationalProjectMapping() { 662 660 663 661 System.out.println("setFNationalProjectMapping"); 664 662 665 663 String param = "nationalProjectsMapping.xml"; 666 664 667 665 config.setNationalProjectMapping(param); 668 666 669 667 String result = config.getNationalProjectMapping(); 670 671 assertEquals(param, result); 672 } 668 669 assertEquals(param, result); 670 } 673 671 674 672 /** … … 677 675 @Test 678 676 public void testGetFacetFields() { 679 677 680 678 System.out.println("getFacetFields"); 681 679 682 680 String[] expResult = { 683 "collection",684 "language",685 "resourceClass",686 "modality",687 "continent",688 "genre",689 "country",690 "subject",691 "organisation",692 "format",693 "dataProvider",694 "nationalProject",695 "keywords"};696 681 "collection", 682 "language", 683 "resourceClass", 684 "modality", 685 "continent", 686 "genre", 687 "country", 688 "subject", 689 "organisation", 690 "format", 691 "dataProvider", 692 "nationalProject", 693 "keywords"}; 694 697 695 String[] result = config.getFacetFields(); 698 696 699 697 assertArrayEquals(expResult, result); 700 698 } … … 705 703 @Test 706 704 public void testSetFacetFields() { 707 705 708 706 System.out.println("setFacetFields"); 709 707 710 708 String[] expResult = { 711 "collection",712 "language",713 "resourceClass",714 "modality",715 "continent",716 "genre",717 "country",718 "subject",719 "organisation",720 "format",721 "dataProvider",722 "nationalProject",723 "keywords"};724 709 "collection", 710 "language", 711 "resourceClass", 712 "modality", 713 "continent", 714 "genre", 715 "country", 716 "subject", 717 "organisation", 718 "format", 719 "dataProvider", 720 "nationalProject", 721 "keywords"}; 722 725 723 config.setFacetFields(expResult); 726 724 727 725 String result[] = config.getFacetFields(); 728 726 729 727 assertArrayEquals(expResult, result); 730 728 } 731 729 732 730 /** 733 731 * Test the getCountryComponentUrl method. … … 735 733 @Test 736 734 public void testCountryComponentUrl() { 737 735 738 736 System.out.println("getCountryComponentUrl"); 739 737 740 738 String expResult = "http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/components/clarin.eu:cr1:c_1271859438104/xml"; 741 739 String result = config.getCountryComponentUrl(); 742 740 743 741 assertEquals(expResult, result); 744 742 } … … 749 747 @Test 750 748 public void testSetCountryComponentUrl() { 751 749 752 750 System.out.println("setCountryComponentUrl"); 753 751 754 752 String param = "http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/components/clarin.eu:cr1:c_1271859438104/xml"; 755 753 756 754 config.setCountryComponentUrl(param); 757 755 758 756 String result = config.getCountryComponentUrl(); 759 760 assertEquals(param, result); 761 } 762 757 758 assertEquals(param, result); 759 } 760 763 761 /** 764 762 * Test the getLanguage2LetterCodeComponentUrl method. … … 766 764 @Test 767 765 public void testGetLanguage2LetterCodeComponentUrl() { 768 766 769 767 System.out.println("getLanguage2LetterCodeComponentUrl"); 770 768 771 769 String expResult = "http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/components/clarin.eu:cr1:c_1271859438109/xml"; 772 770 String result = config.getLanguage2LetterCodeComponentUrl(); 773 771 774 772 assertEquals(expResult, result); 775 773 } … … 780 778 @Test 781 779 public void testSetLanguage2LetterCodeComponentUrl() { 782 780 783 781 System.out.println("setLanguage2LetterCodeComponentUrl"); 784 782 785 783 String param = "http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/components/clarin.eu:cr1:c_1271859438109/xml"; 786 784 787 785 config.setLanguage2LetterCodeComponentUrl(param); 788 786 789 787 String result = config.getLanguage2LetterCodeComponentUrl(); 790 791 assertEquals(param, result); 792 } 793 788 789 assertEquals(param, result); 790 } 791 794 792 /** 795 793 * Test the getLanguage3LetterCodeComponentUrl. … … 797 795 @Test 798 796 public void testGetLanguage3LetterCodeComponentUrl() { 799 797 800 798 System.out.println("getLanguage3LetterCodeComponentUrl"); 801 799 802 800 String expResult = "http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/components/clarin.eu:cr1:c_1271859438110/xml"; 803 801 String result = config.getLanguage3LetterCodeComponentUrl(); 804 802 805 803 assertEquals(expResult, result); 806 804 } … … 811 809 @Test 812 810 public void testSetLanguage3LetterCodeComponentUrl() { 813 811 814 812 System.out.println("setLanguage3LetterCodeComponentUrl"); 815 813 816 814 String param = "http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/components/clarin.eu:cr1:c_1271859438110/xml"; 817 815 818 816 config.setLanguage3LetterCodeComponentUrl(param); 819 817 820 818 String result = config.getLanguage3LetterCodeComponentUrl(); 821 822 assertEquals(param, result); 823 } 824 819 820 assertEquals(param, result); 821 } 822 825 823 /** 826 824 * Test the getSilToISO639CodesUrl method. … … 828 826 @Test 829 827 public void testGetSilToISO639CodesUrl() { 830 828 831 829 System.out.println("getSilToISO639CodesUrl"); 832 830 833 831 String expResult = "http://www.clarin.eu/cmd/xslt/sil_to_iso6393.xml"; 834 832 String result = config.getSilToISO639CodesUrl(); 835 833 836 834 assertEquals(expResult, result); 837 835 } … … 842 840 @Test 843 841 public void testSetSilToISO639CodesUrl() { 844 842 845 843 System.out.println("setSilToISO639CodesUrl"); 846 844 847 845 String param = "http://www.clarin.eu/cmd/xslt/sil_to_iso6393.xml"; 848 846 849 847 config.setSilToISO639CodesUrl(param); 850 848 851 849 String result = config.getSilToISO639CodesUrl(); 852 853 assertEquals(param, result); 854 } 855 850 851 assertEquals(param, result); 852 } 853 856 854 /** 857 855 * Test the getReverseProxyPrefix method … … 859 857 @Test 860 858 public void testReverseProxyPrefix() { 861 859 862 860 System.out.println("getReverseProxyPrefix"); 863 861 864 862 String expResult = ""; 865 863 String result = config.getReverseProxyPrefix(); 866 864 867 865 assertEquals(expResult, result); 868 866 } … … 873 871 @Test 874 872 public void testSetReverseProxyPrefix() { 875 873 876 874 System.out.println("setReverseProxyPrefix"); 877 875 878 876 String param = "vlodev/"; 879 877 880 878 config.setReverseProxyPrefix(param); 881 879 882 880 String result = config.getReverseProxyPrefix(); 883 881 884 882 assertEquals(param, result); 885 883 } … … 890 888 @Test 891 889 public void testGetCqlEndpointFilter() { 892 890 893 891 System.out.println("getCqlEndpointFilter"); 894 892 895 893 String expResult = "http://cqlservlet.mpi.nl/"; 896 894 String result = config.getCqlEndpointFilter(); 897 895 898 896 assertEquals(expResult, result); 899 897 } … … 904 902 @Test 905 903 public void testSetCqlEndpointFilter() { 906 904 907 905 System.out.println("setCqlEndpointFilter"); 908 906 909 907 String param = "http://cqlservlet.mpi.nl/"; 910 908 911 909 config.setCqlEndpointFilter(param); 912 910 913 911 String result = config.getCqlEndpointFilter(); 914 912 915 913 assertEquals(param, result); 916 914 } … … 921 919 @Test 922 920 public void testGetCqlEndpointAlternative() { 923 921 924 922 System.out.println("getCqlEndpointAlternative"); 925 923 926 924 String expResult = "http://cqlservlet.mpi.nl/"; 927 925 String result = config.getCqlEndpointAlternative(); 928 926 929 927 assertEquals(expResult, result); 930 928 } … … 935 933 @Test 936 934 public void testSetCqlEndpointAlternative() { 937 935 938 936 System.out.println("setCqlEndpointAlternative"); 939 937 940 938 String param = "http://cqlservlet.mpi.nl/"; 941 939 942 940 config.setCqlEndpointAlternative(param); 943 941 944 942 String result = config.getCqlEndpointAlternative(); 945 943 946 944 assertEquals(param, result); 947 945 } -
vlo/branches/vlo-3.0/vlo-commons/src/test/java/eu/clarin/cmdi/vlo/config/VloConfigMarshallerTest.java
r4509 r4517 31 31 32 32 /** 33 * 33 * 34 34 * @author twagoo 35 35 */ -
vlo/branches/vlo-3.0/vlo-importer/src/test/java/eu/clarin/cmdi/vlo/importer/CMDIParserVTDXMLTest.java
r4507 r4517 12 12 13 13 @Before 14 public void setUp() { 15 16 // read the configuration from the packaged configuration file 14 public void setUp() throws Exception { 15 // read the configuration from the default configuration file 17 16 new DefaultVloConfigFactory().newConfig(); 18 19 // optionally, modify the configuration here20 21 // apparantly, this does not make the configuration available22 17 } 23 18 -
vlo/branches/vlo-3.0/vlo-importer/src/test/java/eu/clarin/cmdi/vlo/importer/CountryNamePostProcessorTest.java
r4507 r4517 9 9 10 10 @Before 11 public void setUp() {11 public void setUp() throws Exception { 12 12 13 13 // read the configuration from the packaged configuration file -
vlo/branches/vlo-3.0/vlo-importer/src/test/java/eu/clarin/cmdi/vlo/importer/ImporterTestcase.java
r4509 r4517 28 28 29 29 @Before 30 public void setup() {30 public void setup() throws Exception { 31 31 final String baseTempPath = System.getProperty("java.io.tmpdir"); 32 32 testDir = new File(baseTempPath + File.separator + "testRegistry_" + System.currentTimeMillis()); -
vlo/branches/vlo-3.0/vlo-importer/src/test/java/eu/clarin/cmdi/vlo/importer/LanguageCodePostProcessorTest.java
r4507 r4517 9 9 10 10 @Before 11 public void setUp() {12 11 public void setUp() throws Exception { 12 13 13 // read the configuration from the packaged configuration file 14 14 new DefaultVloConfigFactory().newConfig(); -
vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/config/VloSpringConfig.java
r4511 r4517 24 24 import eu.clarin.cmdi.vlo.service.impl.SolrFacetFieldsService; 25 25 import eu.clarin.cmdi.vlo.service.impl.SolrQueryFactoryImpl; 26 import java.io.IOException; 26 27 import org.apache.solr.client.solrj.SolrServer; 27 28 import org.apache.solr.client.solrj.impl.HttpSolrServer; … … 53 54 @Bean 54 55 public VloConfig vloConfig() { 55 return vloConfigFactory().newConfig(); 56 try { 57 return vloConfigFactory().newConfig(); 58 } catch (IOException ex) { 59 throw new RuntimeException("Could not read VLO configuration", ex); 60 } 56 61 } 57 62 58 63 @Bean 59 public VloConfigFactory vloConfigFactory() {64 public VloConfigFactory vloConfigFactory() { 60 65 return new DefaultVloConfigFactory(); 61 66 } … … 75 80 return new SolrQueryFactoryImpl(vloConfig()); 76 81 } 77 82 78 83 @Bean 79 84 public SolrServer solrServer() {
Note: See TracChangeset
for help on using the changeset viewer.