Project

General

Profile

Download (2.36 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

    
10
package eu.etaxonomy.cdm.io.sdd.in;
11

    
12
import static org.junit.Assert.assertNotNull;
13

    
14
import java.io.FileNotFoundException;
15
import java.net.URISyntaxException;
16
import java.net.URL;
17

    
18

    
19
import org.junit.Assert;
20
import org.junit.Before;
21
import org.junit.Rule;
22
import org.junit.Test;
23
import org.junit.rules.TestRule;
24
import org.unitils.spring.annotation.SpringBeanByType;
25

    
26
import com.carrotsearch.junitbenchmarks.BenchmarkOptions;
27
import com.carrotsearch.junitbenchmarks.BenchmarkRule;
28

    
29
import eu.etaxonomy.cdm.api.service.INameService;
30
import eu.etaxonomy.cdm.test.integration.CdmTransactionalIntegrationTest;
31

    
32
/**
33
 * @author b.clark
34
 * @created 20.01.2009
35
 * @version 1.0
36
 */
37

    
38

    
39
public class SDDImportBenchmark extends CdmTransactionalIntegrationTest {
40

    
41
    @SpringBeanByType
42
    SDDImport sddImport;
43

    
44
    @SpringBeanByType
45
    INameService nameService;
46

    
47
    @Rule 
48
    //was of Type MethodRule before but this was not implemented in junitbenchmarks 0.5.0 anymore 
49
	public TestRule benchmarkRun = new BenchmarkRule();
50

    
51
    private SDDImportConfigurator configurator;
52

    
53
    @Before
54
    public void setUp() throws URISyntaxException {
55
        URL url = this.getClass().getResource("/eu/etaxonomy/cdm/io/sdd/Cichorieae-DA.sdd.xml");
56
        Assert.assertNotNull(url);
57
        configurator = SDDImportConfigurator.NewInstance(url.toURI(), null);
58
    }
59

    
60
    @BenchmarkOptions(benchmarkRounds = 1, warmupRounds = 0)
61
    @Test
62
    public void testInit() {
63
        assertNotNull("sddImport should not be null", sddImport);
64
        assertNotNull("nameService should not be null", nameService);
65
    }
66

    
67
    @BenchmarkOptions(benchmarkRounds = 2, warmupRounds = 0)
68
    @Test
69
    public void testDoInvoke() {
70
        sddImport.doInvoke(new SDDImportState(configurator));
71
        this.setComplete();
72
        this.endTransaction();
73
    }
74

    
75
    /* (non-Javadoc)
76
     * @see eu.etaxonomy.cdm.test.integration.CdmIntegrationTest#createTestData()
77
     */
78
    @Override
79
    public void createTestDataSet() throws FileNotFoundException {
80
        // TODO Auto-generated method stub
81
        
82
    }
83

    
84
}
(3-3/5)