Project

General

Profile

Download (2.21 KB) Statistics
| Branch: | Tag: | Revision:
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.common.URI;
29
import eu.etaxonomy.cdm.test.integration.CdmTransactionalIntegrationTest;
30

    
31
/**
32
 * @author b.clark
33
 * @since 20.01.2009
34
 */
35
public class SDDImportBenchmark extends CdmTransactionalIntegrationTest {
36

    
37
    @SpringBeanByType
38
    private SDDImport sddImport;
39

    
40
    @SpringBeanByType
41
    private INameService nameService;
42

    
43
    @Rule
44
    //was of Type MethodRule before but this was not implemented in junitbenchmarks 0.5.0 anymore
45
	public TestRule benchmarkRun = new BenchmarkRule();
46

    
47
    private SDDImportConfigurator configurator;
48

    
49
    @Before
50
    public void setUp() throws URISyntaxException {
51
        URL url = this.getClass().getResource("/eu/etaxonomy/cdm/io/sdd/Cichorieae-DA.sdd.xml");
52
        Assert.assertNotNull(url);
53
        configurator = SDDImportConfigurator.NewInstance(URI.fromUrl(url), null);
54
    }
55

    
56
    @BenchmarkOptions(benchmarkRounds = 1, warmupRounds = 0)
57
    @Test
58
    public void testInit() {
59
        assertNotNull("sddImport should not be null", sddImport);
60
        assertNotNull("nameService should not be null", nameService);
61
    }
62

    
63
    @BenchmarkOptions(benchmarkRounds = 2, warmupRounds = 0)
64
    @Test
65
    public void testDoInvoke() {
66
        sddImport.doInvoke(new SDDImportState(configurator));
67
        this.setComplete();
68
        this.endTransaction();
69
    }
70

    
71
    @Override    public void createTestDataSet() throws FileNotFoundException {}
72
}
(3-3/5)