Changeset 2660
- Timestamp:
- 03/07/13 09:54:21 (11 years ago)
- Location:
- vlo/branches/vlo-2.13-param
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
vlo/branches/vlo-2.13-param/vlo_importer/src/main/java/eu/clarin/cmdi/vlo/config/VloConfig.java
r2659 r2660 129 129 * @return the configuration 130 130 */ 131 public static VloConfigreadPackagedConfig() {131 public static void readPackagedConfig() { 132 132 133 133 // set the name of the packaged configuration file 134 134 String fileName = "/VloConfig"; 135 135 136 config =VloConfig.readConfig (fileName);136 VloConfig.readConfig (fileName); 137 137 138 return config;138 // return config; 139 139 } 140 140 … … 149 149 * @return the configuration 150 150 */ 151 public static VloConfigreadConfig(String fileName) {151 public static void readConfig(String fileName) { 152 152 153 153 // may it is safe to first expand the name a litte bit more … … 159 159 160 160 // get the XML file configuration from the file by invoking ... 161 config = (VloConfig) read(fileName, config); 162 163 return config; 161 read(fileName, config); 164 162 } 165 163 166 164 /** 167 165 * Read the configuration from an XML file. 166 * 167 * Move the following remarks to a general remark in the class description, 168 * a remark indicating what you could do if you do not want to use the 169 * packaged configuration. 168 170 * 169 171 * Invoke this method instead of readConfig() if you want to change … … 177 179 * container. 178 180 * 179 * @param fileName the name of the file to read the configuration from 180 * 181 * @return the configuration 182 */ 183 public static VloConfig readTestConfig(String fileName) { 184 185 config = VloConfig.readConfig (fileName); 186 187 // modify the configuration here 188 189 return config; 190 } 181 */ 191 182 192 183 /** -
vlo/branches/vlo-2.13-param/vlo_importer/src/main/java/eu/clarin/cmdi/vlo/config/VloContextConfig.java
r2659 r2660 38 38 * @return the configuration 39 39 */ 40 public static VloConfigswitchToExternalConfig(ServletContext context) {40 public static void switchToExternalConfig(ServletContext context) { 41 41 42 42 if (config == null) { … … 71 71 VloConfig.setSolrUrl(url); 72 72 } 73 74 // return the current configuration, modified or not75 return (VloConfig)config;76 73 } 77 74 } -
vlo/branches/vlo-2.13-param/vlo_importer/src/main/java/eu/clarin/cmdi/vlo/importer/MetadataImporter.java
r2659 r2660 76 76 } 77 77 78 // VLO configuration79 VloConfig config;80 81 78 /** 82 79 * Constructor … … 84 81 * @param 85 82 */ 86 public MetadataImporter (VloConfig config){ 87 this.config = config; 83 public MetadataImporter (){ 88 84 } 89 85 … … 405 401 // optionally, check for file existence here 406 402 407 // read the configuration defined in thefile408 config = VloConfig.readTestConfig(fileName);403 // read the configuration from the externally supplied file 404 VloConfig.readConfig(fileName); 409 405 410 406 // optionally, modify the configuration here 411 407 412 408 // create and start the importer 413 MetadataImporter importer = new MetadataImporter( config);409 MetadataImporter importer = new MetadataImporter(); 414 410 importer.startImport(); 415 411 416 412 // finished importing 417 413 418 if ( config.isPrintMapping()) {414 if (VloConfig.isPrintMapping()) { 419 415 File file = new File("xsdMapping.txt"); 420 416 FacetMappingFactory.printMapping(file); -
vlo/branches/vlo-2.13-param/vlo_importer/src/test/java/eu/clarin/cmdi/vlo/importer/CMDIParserVTDXMLTest.java
r2639 r2660 10 10 11 11 public class CMDIParserVTDXMLTest { 12 13 static VloConfig config;14 // include the full path in the name of the packaged configuration file15 12 16 13 @Before 17 14 public void setUp() { 18 // application configuration19 20 String fileName = VloConfig.class.getResource("/VloConfig.xml").getFile();21 15 22 // optionally, check for file existence here 23 24 // read the configuration defined in the file 25 26 config = VloConfig.readConfig(fileName); 16 // read the configuration from the packaged configuration file 17 VloConfig.readPackagedConfig(); 27 18 28 19 // optionally, modify the configuration here -
vlo/branches/vlo-2.13-param/vlo_importer/src/test/java/eu/clarin/cmdi/vlo/importer/CountryNamePostProcessorTest.java
r2639 r2660 8 8 public class CountryNamePostProcessorTest { 9 9 10 static VloConfig config;11 // include the full path in the name of the packaged configuration file12 13 10 @Before 14 11 public void setUp() { 15 // application configuration16 12 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); 13 // read the configuration from the packaged configuration file 14 VloConfig.readPackagedConfig(); 24 15 25 16 // optionally, modify the configuration here 26 27 // apparantly, this does not make the configuration available28 17 } 29 18 … … 38 27 assertEquals(null, processor.process(null)); 39 28 } 40 41 29 } -
vlo/branches/vlo-2.13-param/vlo_importer/src/test/java/eu/clarin/cmdi/vlo/importer/ImporterTestcase.java
r2659 r2660 23 23 } 24 24 25 // application configuration26 static VloConfig config;27 28 25 @BeforeClass 29 26 public static void setup() { … … 33 30 testDir.deleteOnExit(); 34 31 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); 32 // read the configuration defined in the packaged configuration file 33 VloConfig.readPackagedConfig(); 40 34 41 35 // optionally, modify the configuration here -
vlo/branches/vlo-2.13-param/vlo_importer/src/test/java/eu/clarin/cmdi/vlo/importer/LanguageCodePostProcessorTest.java
r2639 r2660 7 7 8 8 public class LanguageCodePostProcessorTest { 9 10 // application configuration11 static VloConfig config;12 9 13 10 @Before 14 11 public void setUp() { 15 12 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); 13 // read the configuration from the packaged configuration file 14 VloConfig.readPackagedConfig(); 21 15 22 16 // optionally, modify the configuration here -
vlo/branches/vlo-2.13-param/vlo_importer/src/test/java/eu/clarin/cmdi/vlo/importer/MetadataImporterTest.java
r2659 r2660 236 236 final List<SolrInputDocument> result = new ArrayList<SolrInputDocument>(); 237 237 238 String fileName = VloConfig.class.getResource("/VloConfig.xml").getFile();239 240 VloConfig testConfig;241 242 238 /** 243 239 * Problem: at the moment the readTestConfig method is not prepared for … … 251 247 */ 252 248 253 testConfig = VloConfig.readTestConfig(fileName);254 255 // modify the test configuration a bit256 257 testConfig = modifyConfig(testConfig, rootFile);258 259 // ... and also the importer itself249 // testConfig = VloConfig.readTestConfig(fileName); 250 251 VloConfig.readPackagedConfig(); 252 253 // make specific changes to the configuration 254 255 modifyConfig(rootFile); 260 256 261 257 MetadataImporter importer; 262 importer = new MetadataImporter( testConfig) {258 importer = new MetadataImporter() { 263 259 @Override 264 260 protected void initSolrServer() throws MalformedURLException { … … 277 273 } 278 274 279 private VloConfig modifyConfig(VloConfig config,File rootFile) {275 private void modifyConfig(File rootFile) { 280 276 DataRoot dataRoot = new DataRoot(); 281 277 dataRoot.setDeleteFirst(false);//cannot delete not using real solrServer … … 284 280 dataRoot.setTostrip(""); 285 281 dataRoot.setPrefix("http://example.com"); 286 config.setDataRoots(Collections.singletonList(dataRoot)); 287 return config; 282 VloConfig.setDataRoots(Collections.singletonList(dataRoot)); 288 283 } 289 284 -
vlo/branches/vlo-2.13-param/vlo_web_app/src/main/java/eu/clarin/cmdi/vlo/VloWebApplication.java
r2659 r2660 20 20 21 21 private SearchResultsDao searchResults; 22 23 // application configuration24 static VloConfig config;25 22 26 23 // flag indicating whether or not the application object lives in a context … … 47 44 */ 48 45 49 config =VloContextConfig.switchToExternalConfig(servletContext);46 VloContextConfig.switchToExternalConfig(servletContext); 50 47 } 51 48 … … 64 61 65 62 /** 66 * Read the application's configuration.63 * Read the application's packaged configuration. 67 64 * 68 65 * Because on instantiation a web application cannot said to be living … … 72 69 */ 73 70 74 config =VloConfig.readPackagedConfig();71 VloConfig.readPackagedConfig(); 75 72 76 73 // let the {@literal init()} method know that there will be a context … … 97 94 * context associated with this container will be ignored. 98 95 */ 99 public VloWebApplication( VloConfig testConfig) {96 public VloWebApplication(Boolean param) { 100 97 101 98 // remember that the application does not live in a web server context 102 99 103 inContext = false; 104 105 // set the current configuration to the test configuration 106 107 config = testConfig; 100 inContext = param; 108 101 109 102 searchResults = new SearchResultsDao(); -
vlo/branches/vlo-2.13-param/vlo_web_app/src/main/webapp/WEB-INF/web.xml
r2659 r2660 18 18 <init-param> 19 19 <param-name>configuration</param-name> 20 <!-- <param-value>development</param-value>-->20 <!-- <param-value>development</param-value> --> 21 21 <param-value>deployment</param-value> 22 <!-- you can override with -Dwicket.configuration=development -->22 <!-- you can override with -Dwicket.configuration=development --> 23 23 </init-param> 24 24 </filter> … … 29 29 </filter-mapping> 30 30 31 32 31 </web-app> -
vlo/branches/vlo-2.13-param/vlo_web_app/src/test/java/eu/clarin/cmdi/vlo/SearchPageQueryTest.java
r2641 r2660 13 13 public class SearchPageQueryTest { 14 14 15 // application configuration16 static VloConfig config;17 18 15 @Before 19 16 public void setup() { 20 17 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); 18 // read the configuration from the packaged configuration file 19 VloConfig.readPackagedConfig(); 26 20 27 21 // optionally, modify the configuration here -
vlo/branches/vlo-2.13-param/vlo_web_app/src/test/java/eu/clarin/cmdi/vlo/TestFacetedSearchPage.java
r2659 r2660 10 10 */ 11 11 public class TestFacetedSearchPage { 12 13 // application configuration14 static VloConfig config;15 12 16 13 @Before … … 19 16 WicketTester wicketTester; 20 17 21 // include the full path in the name of the packaged configuration file22 String fileName = VloConfig.class.getResource("/VloConfig.xml").getFile();18 // read the packaged configuration 19 VloConfig.readPackagedConfig(); 23 20 24 // read the configuration defined in the file 25 config = VloConfig.readTestConfig(fileName); 21 // optionally, modify the configuration here 26 22 27 // optionally, modify the test configuration here 28 29 wicketTester = new WicketTester(new VloWebApplication(config)); 23 wicketTester = new WicketTester(); 30 24 } 31 25 -
vlo/branches/vlo-2.13-param/vlo_web_app/src/test/java/eu/clarin/cmdi/vlo/pages/FacetBoxPanelTest.java
r2659 r2660 13 13 public class FacetBoxPanelTest { 14 14 15 static VloConfig testConfig;16 17 15 @Before 18 16 public void setUp() { 17 19 18 WicketTester wicketTester; 20 19 21 String fileName = VloConfig.class.getResource("/VloConfig.xml").getFile(); 20 // read the configuration from the package configuration file 21 VloConfig.readPackagedConfig(); 22 22 23 testConfig = VloConfig.readTestConfig(fileName);23 // optionally, modify the configuration here 24 24 25 // optionally, modify the test configuration here 26 27 wicketTester = new WicketTester(new VloWebApplication(testConfig)); 25 // run the web application outside a web server container context 26 wicketTester = new WicketTester(new VloWebApplication(false)); 28 27 } 29 28 -
vlo/branches/vlo-2.13-param/vlo_web_app/src/test/java/eu/clarin/cmdi/vlo/pages/ResourceLinkPanelTest.java
r2659 r2660 11 11 12 12 public class ResourceLinkPanelTest { 13 14 static VloConfig testConfig;15 13 16 14 public static final String _SAME_STRING = "http://blabla"; … … 22 20 WicketTester wicketTester; 23 21 24 String fileName = VloConfig.class.getResource("/VloConfig.xml").getFile(); 22 // read the configuration from the packaged configuration file 23 VloConfig.readPackagedConfig(); 25 24 26 testConfig = VloConfig.readTestConfig(fileName); 27 28 // optionally, modify the test configuration here 29 30 wicketTester = new WicketTester(new VloWebApplication(testConfig)); 25 // optionally, modify the configuration here 26 27 // run the web application outside a web server container context 28 wicketTester = new WicketTester(new VloWebApplication(false)); 31 29 } 32 30
Note: See TracChangeset
for help on using the changeset viewer.