1
|
/**
|
2
|
* Copyright (C) 2007 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
package eu.etaxonomy.cdm.io.sdd.in;
|
10
|
|
11
|
import static org.junit.Assert.assertNotNull;
|
12
|
|
13
|
import java.io.FileNotFoundException;
|
14
|
import java.net.URISyntaxException;
|
15
|
import java.net.URL;
|
16
|
|
17
|
import org.junit.Assert;
|
18
|
import org.junit.Before;
|
19
|
import org.junit.Rule;
|
20
|
import org.junit.Test;
|
21
|
import org.junit.rules.TestRule;
|
22
|
import org.unitils.spring.annotation.SpringBeanByType;
|
23
|
|
24
|
import com.carrotsearch.junitbenchmarks.BenchmarkOptions;
|
25
|
import com.carrotsearch.junitbenchmarks.BenchmarkRule;
|
26
|
|
27
|
import eu.etaxonomy.cdm.api.service.INameService;
|
28
|
import eu.etaxonomy.cdm.test.integration.CdmTransactionalIntegrationTest;
|
29
|
|
30
|
/**
|
31
|
* @author b.clark
|
32
|
* @since 20.01.2009
|
33
|
*/
|
34
|
public class SDDImportBenchmark extends CdmTransactionalIntegrationTest {
|
35
|
|
36
|
@SpringBeanByType
|
37
|
private SDDImport sddImport;
|
38
|
|
39
|
@SpringBeanByType
|
40
|
private INameService nameService;
|
41
|
|
42
|
@Rule
|
43
|
//was of Type MethodRule before but this was not implemented in junitbenchmarks 0.5.0 anymore
|
44
|
public TestRule benchmarkRun = new BenchmarkRule();
|
45
|
|
46
|
private SDDImportConfigurator configurator;
|
47
|
|
48
|
@Before
|
49
|
public void setUp() throws URISyntaxException {
|
50
|
URL url = this.getClass().getResource("/eu/etaxonomy/cdm/io/sdd/Cichorieae-DA.sdd.xml");
|
51
|
Assert.assertNotNull(url);
|
52
|
configurator = SDDImportConfigurator.NewInstance(url.toURI(), null);
|
53
|
}
|
54
|
|
55
|
@BenchmarkOptions(benchmarkRounds = 1, warmupRounds = 0)
|
56
|
@Test
|
57
|
public void testInit() {
|
58
|
assertNotNull("sddImport should not be null", sddImport);
|
59
|
assertNotNull("nameService should not be null", nameService);
|
60
|
}
|
61
|
|
62
|
@BenchmarkOptions(benchmarkRounds = 2, warmupRounds = 0)
|
63
|
@Test
|
64
|
public void testDoInvoke() {
|
65
|
sddImport.doInvoke(new SDDImportState(configurator));
|
66
|
this.setComplete();
|
67
|
this.endTransaction();
|
68
|
}
|
69
|
|
70
|
@Override public void createTestDataSet() throws FileNotFoundException {}
|
71
|
}
|