Changeset 2604 for vlo/branches/vlo-2.13-param/vlo_webapp/src/test/java/eu/clarin/cmdi/vlo/importer/MetadataImporterTest.java
- Timestamp:
- 02/21/13 14:40:39 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vlo/branches/vlo-2.13-param/vlo_webapp/src/test/java/eu/clarin/cmdi/vlo/importer/MetadataImporterTest.java
r1437 r2604 1 1 package eu.clarin.cmdi.vlo.importer; 2 2 3 import static org.junit.Assert.assertEquals; 4 3 import eu.clarin.cmdi.vlo.FacetConstants; 4 import eu.clarin.cmdi.vlo.config.DataRoot; 5 import eu.clarin.cmdi.vlo.config.VloConfig; 5 6 import java.io.File; 6 7 import java.io.IOException; … … 10 11 import java.util.Collections; 11 12 import java.util.List; 12 13 13 import org.apache.solr.client.solrj.SolrServerException; 14 14 import org.apache.solr.common.SolrInputDocument; 15 import static org.junit.Assert.assertEquals; 15 16 import org.junit.Test; 16 17 import eu.clarin.cmdi.vlo.FacetConstants;18 17 19 18 public class MetadataImporterTest extends ImporterTestcase { … … 236 235 private List<SolrInputDocument> importData(File rootFile) throws MalformedURLException { 237 236 final List<SolrInputDocument> result = new ArrayList<SolrInputDocument>(); 238 ImporterConfig config = createConfig(rootFile); 239 MetadataImporter importer = new MetadataImporter(config) { 237 238 String fileName = VloConfig.class.getResource("/VloConfig.xml").getFile(); 239 240 VloConfig testConfig; 241 242 /** 243 * Problem: at the moment the readTestConfig method is not prepared for 244 * a message from the importer. May rename readTestConfig to 245 * readWebAppTestConfig, so that we have space for a 246 * readImporterTestConfig also. 247 * 248 * The best thing would be to have a directory for testing inside the 249 * package. You can always use an external configuration file for more 250 * elaborate testing.test directory inside the package. 251 */ 252 253 testConfig = VloConfig.readTestConfig(fileName); 254 255 // modify the test configuration a bit 256 257 testConfig = modifyConfig(testConfig, rootFile); 258 259 // ... and also the importer itself 260 261 MetadataImporter importer; 262 importer = new MetadataImporter(testConfig) { 240 263 @Override 241 264 protected void initSolrServer() throws MalformedURLException { … … 245 268 @Override 246 269 protected void sendDocs() throws SolrServerException, IOException { 247 270 //overriding here so we can test the docs 248 271 result.addAll(this.docs); 249 272 docs = new ArrayList<SolrInputDocument>(); … … 254 277 } 255 278 256 private ImporterConfig createConfig(File rootFile) { 257 ImporterConfig config = new ImporterConfig(); 279 private VloConfig modifyConfig(VloConfig config, File rootFile) { 258 280 DataRoot dataRoot = new DataRoot(); 259 281 dataRoot.setDeleteFirst(false);//cannot delete not using real solrServer
Note: See TracChangeset
for help on using the changeset viewer.