Changeset 2639
- Timestamp:
- 02/28/13 09:12:48 (11 years ago)
- Location:
- vlo/branches/vlo-2.13-param/vlo_webapp/src
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
vlo/branches/vlo-2.13-param/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/config/VloConfig.java
r2627 r2639 364 364 */ 365 365 public String getComponentRegistryProfileSchema(String id) { 366 return profileSchemaUrl.replace(" ${PROFILE_ID}", id);366 return profileSchemaUrl.replace("{PROFILE_ID}", id); 367 367 } 368 368 -
vlo/branches/vlo-2.13-param/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/importer/MetadataImporter.java
r2627 r2639 378 378 * @throws IOException 379 379 */ 380 /** 381 * @param args 382 * @throws IOException 383 */ 380 384 public static void main(String[] args) throws MalformedURLException, IOException { 381 385 386 // application configuration 382 387 VloConfig config; 383 388 389 // use the Apache cli framework for getting command line parameters 384 390 Options options = new Options(); 385 391 386 // add t option 387 options.addOption("f", true, "use parameters specified in -f <file>"); 392 /** 393 * Add a "c" option, the option indicating the specification of an XML 394 * configuration file 395 */ 396 options.addOption("c", true, "-c <file> : use parameters specified in <file>"); 388 397 389 398 CommandLineParser parser = new PosixParser(); … … 392 401 // parse the command line arguments 393 402 CommandLine cmd = parser.parse(options, args); 394 if (cmd.hasOption(" f")) {395 // get the value of the f option396 403 if (cmd.hasOption("c")) { 404 405 // the "c" option was specified, now get its value 397 406 String fileName; 398 fileName = cmd.getOptionValue(" f");407 fileName = cmd.getOptionValue("c"); 399 408 400 409 // include the full path in the name 401 402 410 fileName = VloConfig.class.getResource(fileName).getFile(); 403 411 … … 405 413 406 414 // read the configuration defined in the file 407 408 415 config = VloConfig.readConfig(fileName); 409 416 410 417 // optionally, modify the configuration here 411 418 419 // create and start the importer 412 420 MetadataImporter importer = new MetadataImporter(config); 413 421 importer.startImport(); 422 423 // finished importing 424 414 425 if (config.isPrintMapping()) { 415 426 File file = new File("xsdMapping.txt"); … … 420 431 421 432 } catch (org.apache.commons.cli.ParseException ex) { 422 LOG.error("Command line parsing failed."); 423 424 // System.err.println("Command line parsing failed. " + ex.getMessage()); 433 434 // caught an exception caused by command line parsing 435 436 String message = "Command line parsing failed. " + ex.getMessage(); 437 438 LOG.error(message); 439 System.err.println(message); 425 440 } 426 441 } -
vlo/branches/vlo-2.13-param/vlo_webapp/src/main/resources/VloConfig.xml
r2627 r2639 36 36 <vloHomeLink>http://www.clarin.eu/vlo</vloHomeLink> 37 37 38 <profileSchemaUrl>http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/profiles/ </profileSchemaUrl>38 <profileSchemaUrl>http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/profiles/{PROFILE_ID}/xsd</profileSchemaUrl> 39 39 40 40 <componentRegistryRESTURL>http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/profiles/</componentRegistryRESTURL> -
vlo/branches/vlo-2.13-param/vlo_webapp/src/test/java/eu/clarin/cmdi/vlo/SearchPageQueryTest.java
r2627 r2639 1 1 package eu.clarin.cmdi.vlo; 2 2 3 import eu.clarin.cmdi.vlo.config.VloConfig; 3 4 import eu.clarin.cmdi.vlo.pages.SearchPageQuery; 4 5 import org.apache.solr.client.solrj.response.FacetField; … … 12 13 public class SearchPageQueryTest { 13 14 15 // application configuration 16 static VloConfig config; 17 14 18 @Before 15 19 public void setup() { 16 // Configuration.getInstance().setFacetFields(new String[] { "collection", "continent", "organisation", "genre", "country", "language" }); 20 21 // include the full path in the name of the packaged configuration file 22 String fileName = VloConfig.class.getResource("/VloConfig.xml").getFile(); 23 24 // read the configuration defined in the file 25 config = VloConfig.readTestConfig(fileName); 26 27 // optionally, modify the configuration here 17 28 } 18 29 19 30 @Test 20 31 public void testQueryParse() throws Exception { … … 26 37 assertEquals(10, q.getSolrQuery().getFacetFields().length); 27 38 assertEquals("collection", q.getSolrQuery().getFacetFields()[0]); 28 assertEquals("continent", q.getSolrQuery().getFacetFields()[ 1]);39 assertEquals("continent", q.getSolrQuery().getFacetFields()[2]); 29 40 assertNull(q.getSolrQuery().getFilterQueries()); 30 41 … … 36 47 assertEquals("test", q.getSolrQuery().getQuery()); 37 48 assertEquals("name,id,description", q.getSolrQuery().getFields()); 38 assertEquals( 6, q.getSolrQuery().getFacetFields().length);49 assertEquals(10, q.getSolrQuery().getFacetFields().length); 39 50 assertEquals("collection", q.getSolrQuery().getFacetFields()[0]); 40 assertEquals("continent", q.getSolrQuery().getFacetFields()[ 1]);51 assertEquals("continent", q.getSolrQuery().getFacetFields()[2]); 41 52 assertEquals(1, q.getSolrQuery().getFilterQueries().length); 42 53 assertEquals("country:New\\ Zealand", q.getSolrQuery().getFilterQueries()[0]); -
vlo/branches/vlo-2.13-param/vlo_webapp/src/test/java/eu/clarin/cmdi/vlo/TestFacetedSearchPage.java
r2627 r2639 11 11 public class TestFacetedSearchPage { 12 12 13 static VloConfig testConfig; 13 // application configuration 14 static VloConfig config; 14 15 15 16 @Before … … 18 19 WicketTester wicketTester; 19 20 21 // include the full path in the name of the packaged configuration file 20 22 String fileName = VloConfig.class.getResource("/VloConfig.xml").getFile(); 21 23 22 testConfig = VloConfig.readTestConfig(fileName); 24 // read the configuration defined in the file 25 config = VloConfig.readTestConfig(fileName); 23 26 24 27 // optionally, modify the test configuration here 25 28 26 wicketTester = new WicketTester(new VloApplication( testConfig));29 wicketTester = new WicketTester(new VloApplication(config)); 27 30 } 28 31 -
vlo/branches/vlo-2.13-param/vlo_webapp/src/test/java/eu/clarin/cmdi/vlo/importer/CMDIDataProcessorTest.java
r2494 r2639 1 1 package eu.clarin.cmdi.vlo.importer; 2 2 3 import static org.junit.Assert.assertEquals; 4 import static org.junit.Assert.assertNotNull; 5 import static org.junit.Assert.assertTrue; 6 3 import eu.clarin.cmdi.vlo.FacetConstants; 4 import eu.clarin.cmdi.vlo.config.VloConfig; 7 5 import java.io.File; 8 6 import java.util.ArrayList; … … 11 9 import java.util.Iterator; 12 10 import java.util.List; 13 14 11 import org.apache.solr.common.SolrInputDocument; 12 import static org.junit.Assert.assertEquals; 13 import static org.junit.Assert.assertNotNull; 14 import static org.junit.Assert.assertTrue; 15 import org.junit.Before; 15 16 import org.junit.Test; 16 17 import eu.clarin.cmdi.vlo.FacetConstants;18 17 19 18 public class CMDIDataProcessorTest extends ImporterTestcase { … … 22 21 return new CMDIParserVTDXML(MetadataImporter.POST_PROCESSORS); 23 22 } 24 23 25 24 @Test 26 25 public void testCreateCMDIDataFromCorpus() throws Exception { -
vlo/branches/vlo-2.13-param/vlo_webapp/src/test/java/eu/clarin/cmdi/vlo/importer/CMDIParserVTDXMLTest.java
r1314 r2639 1 1 package eu.clarin.cmdi.vlo.importer; 2 3 import static org.junit.Assert.assertEquals;4 import static org.junit.Assert.assertNull;5 6 import org.junit.Test;7 2 8 3 import com.ximpleware.VTDGen; 9 4 import com.ximpleware.VTDNav; 5 import eu.clarin.cmdi.vlo.config.VloConfig; 6 import static org.junit.Assert.assertEquals; 7 import static org.junit.Assert.assertNull; 8 import org.junit.Before; 9 import org.junit.Test; 10 10 11 11 public class CMDIParserVTDXMLTest { 12 13 static VloConfig config; 14 // include the full path in the name of the packaged configuration file 15 16 @Before 17 public void setUp() { 18 // application configuration 19 20 String fileName = VloConfig.class.getResource("/VloConfig.xml").getFile(); 21 22 // optionally, check for file existence here 23 24 // read the configuration defined in the file 25 26 config = VloConfig.readConfig(fileName); 27 28 // optionally, modify the configuration here 29 30 // apparantly, this does not make the configuration available 31 } 12 32 13 33 @Test -
vlo/branches/vlo-2.13-param/vlo_webapp/src/test/java/eu/clarin/cmdi/vlo/importer/CountryNamePostProcessorTest.java
r1043 r2639 1 1 package eu.clarin.cmdi.vlo.importer; 2 2 3 import eu.clarin.cmdi.vlo.config.VloConfig; 3 4 import static org.junit.Assert.assertEquals; 4 5 import org.junit.Before; 5 6 import org.junit.Test; 6 7 8 public class CountryNamePostProcessorTest { 7 9 8 public class CountryNamePostProcessorTest { 10 static VloConfig config; 11 // include the full path in the name of the packaged configuration file 12 13 @Before 14 public void setUp() { 15 // application configuration 16 17 String fileName = VloConfig.class.getResource("/VloConfig.xml").getFile(); 18 19 // optionally, check for file existence here 20 21 // read the configuration defined in the file 22 23 config = VloConfig.readConfig(fileName); 24 25 // optionally, modify the configuration here 26 27 // apparantly, this does not make the configuration available 28 } 9 29 10 30 @Test -
vlo/branches/vlo-2.13-param/vlo_webapp/src/test/java/eu/clarin/cmdi/vlo/importer/ImporterTestcase.java
r2627 r2639 23 23 } 24 24 25 // application configuration 26 static VloConfig config; 27 25 28 @BeforeClass 26 29 public static void setup() { … … 29 32 testDir.mkdir(); 30 33 testDir.deleteOnExit(); 34 35 // include the full path in the name of the packaged configuration file 36 String fileName = VloConfig.class.getResource("/VloConfig.xml").getFile(); 37 38 // read the configuration defined in the file 39 config = VloConfig.readTestConfig(fileName); 40 41 // optionally, modify the configuration here 42 31 43 VloConfig.get().setComponentRegistryRESTURL("http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/profiles/"); 32 44 } -
vlo/branches/vlo-2.13-param/vlo_webapp/src/test/java/eu/clarin/cmdi/vlo/importer/LanguageCodePostProcessorTest.java
r1043 r2639 1 1 package eu.clarin.cmdi.vlo.importer; 2 2 3 import eu.clarin.cmdi.vlo.config.VloConfig; 3 4 import static org.junit.Assert.assertEquals; 4 5 import org.junit.Before; 5 6 import org.junit.Test; 6 7 7 8 public class LanguageCodePostProcessorTest { 9 10 // application configuration 11 static VloConfig config; 12 13 @Before 14 public void setUp() { 15 16 // include the full path in the name of the packaged configuration file 17 String fileName = VloConfig.class.getResource("/VloConfig.xml").getFile(); 18 19 // read the configuration defined in the file 20 config = VloConfig.readTestConfig(fileName); 21 22 // optionally, modify the configuration here 23 } 8 24 9 25 @Test -
vlo/branches/vlo-2.13-param/vlo_webapp/src/test/java/eu/clarin/cmdi/vlo/importer/MetadataImporterTest.java
r2604 r2639 14 14 import org.apache.solr.common.SolrInputDocument; 15 15 import static org.junit.Assert.assertEquals; 16 import org.junit.Before; 16 17 import org.junit.Test; 17 18
Note: See TracChangeset
for help on using the changeset viewer.