Revision 73baaed9
Added by Cherian Mathew about 9 years ago
src/test/java/eu/etaxonomy/cdm/vaadin/CdmVaadinBaseTest.java | ||
---|---|---|
3 | 3 |
import javax.servlet.ServletContextEvent; |
4 | 4 |
import javax.servlet.ServletContextListener; |
5 | 5 |
import javax.servlet.ServletException; |
6 |
import javax.sql.DataSource; |
|
7 | 6 |
|
8 | 7 |
import org.easymock.EasyMock; |
9 | 8 |
import org.junit.Assert; |
10 | 9 |
import org.junit.BeforeClass; |
11 |
import org.junit.Test;
|
|
10 |
import org.junit.Ignore;
|
|
12 | 11 |
import org.springframework.mock.web.MockServletConfig; |
13 | 12 |
import org.springframework.mock.web.MockServletContext; |
14 | 13 |
import org.springframework.web.context.ContextLoaderListener; |
15 | 14 |
import org.unitils.UnitilsJUnit4; |
16 | 15 |
import org.unitils.database.DatabaseUnitils; |
17 |
import org.unitils.database.annotations.TestDataSource; |
|
18 | 16 |
import org.unitils.database.annotations.Transactional; |
19 | 17 |
import org.unitils.database.util.TransactionMode; |
20 | 18 |
|
... | ... | |
28 | 26 |
|
29 | 27 |
import eu.etaxonomy.cdm.vaadin.util.CdmSQLStringDecorator; |
30 | 28 |
|
29 |
@Ignore |
|
31 | 30 |
@Transactional(TransactionMode.DISABLED) |
32 | 31 |
public class CdmVaadinBaseTest extends UnitilsJUnit4 { |
33 | 32 |
|
... | ... | |
37 | 36 |
private static VaadinSession vaadinSession; |
38 | 37 |
private static boolean isVaadinServletEnvCreated = false; |
39 | 38 |
|
40 |
@TestDataSource |
|
41 |
protected DataSource dataSource; |
|
42 | 39 |
|
43 | 40 |
@BeforeClass |
44 | 41 |
public static void setup() { |
... | ... | |
48 | 45 |
createNewServletEnvironment(); |
49 | 46 |
} |
50 | 47 |
QueryBuilder.setStringDecorator(new CdmSQLStringDecorator()); |
48 |
|
|
49 |
Assert.assertEquals(vaadinServlet, VaadinServlet.getCurrent()); |
|
50 |
Assert.assertEquals(servletContext, VaadinServlet.getCurrent().getServletContext()); |
|
51 |
Assert.assertEquals(vaadinSession, VaadinSession.getCurrent()); |
|
52 |
Assert.assertEquals(vaadinService, VaadinService.getCurrent()); |
|
51 | 53 |
} |
52 | 54 |
|
55 |
|
|
53 | 56 |
public static void createNewServletEnvironment() { |
54 | 57 |
servletContext = new MockServletContext("/webapp"); |
55 | 58 |
|
... | ... | |
81 | 84 |
isVaadinServletEnvCreated = true; |
82 | 85 |
} |
83 | 86 |
|
84 |
public DataSource getDataSource() { |
|
85 |
return dataSource; |
|
86 |
} |
|
87 |
@Test |
|
88 |
public void checkVaadinVariables() { |
|
89 |
Assert.assertEquals(vaadinServlet, VaadinServlet.getCurrent()); |
|
90 |
Assert.assertEquals(servletContext, VaadinServlet.getCurrent().getServletContext()); |
|
91 |
Assert.assertEquals(vaadinSession, VaadinSession.getCurrent()); |
|
92 |
Assert.assertEquals(vaadinService, VaadinService.getCurrent()); |
|
93 |
} |
|
87 |
|
|
94 | 88 |
} |
Also available in: Unified diff
Added tests for NewTaxonBasePresenter
Improved corrected existing tests
CdmTestDataSourceFactory, unitils.properties : added custom test data source factory for unitils