Package ubic.gemma.web.util
Class BaseSpringWebTest
- java.lang.Object
-
- org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests
-
- ubic.gemma.core.util.test.BaseSpringContextTest
-
- ubic.gemma.web.util.BaseSpringWebTest
-
- All Implemented Interfaces:
Aware
,InitializingBean
,ApplicationContextAware
- Direct Known Subclasses:
ArrayDesignControllerTest
,AuditControllerTest
,BibRefControllerTest
,CuratableValueObjectTest
,ErrorPagesTest
,ExperimentalDesignControllerIntegrationTest
,ExpressionExperimentControllerTest
,MessageSourceTest
,PubMedQueryControllerTest
,RssFeedControllerTest
,SchedulerSecurityTest
,SecurityControllerTest
,SignupControllerTest
,TaskRunningTest
@ActiveProfiles("web") @WebAppConfiguration @ContextConfiguration(locations="classpath*:WEB-INF/gemma-servlet.xml") public abstract class BaseSpringWebTest extends BaseSpringContextTest
Class to extend for tests of controllers et al. that need a spring context. Provides convenience methods for dealing with mock requests and responses. Also provides a safe port to send email on for testing (for example, using dumbster) This is meant for integration tests, if you want to perform unit tests, consider usingWebAppConfiguration
andContextConfiguration
with a static inner class annotated withConfiguration
. Seeubic.gemma.web.services.rest.SearchWebServiceTest
for a complete example.- Author:
- pavlidis
-
-
Field Summary
Fields Modifier and Type Field Description protected WebApplicationContext
applicationContext
protected MockMvc
mvc
-
Fields inherited from class ubic.gemma.core.util.test.BaseSpringContextTest
externalDatabaseService, jdbcTemplate, log, persisterHelper, rule, taxonService, testHelper
-
Fields inherited from class org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests
logger
-
-
Constructor Summary
Constructors Constructor Description BaseSpringWebTest()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
afterPropertiesSet()
MockHttpServletRequest
newGet(String url)
MockHttpServletRequest
newPost(String url)
Convenience methods to make tests simpler-
Methods inherited from class ubic.gemma.core.util.test.BaseSpringContextTest
addTestAnalyses, countRowsInTable, deleteFromTables, executeSqlScript, getNewTestPersistentCompleteExpressionExperiment, getTaxon, getTestNonPersistentBioSequence, getTestPersistentArrayDesign, getTestPersistentArrayDesign, getTestPersistentArrayDesign, getTestPersistentBasicExpressionExperiment, getTestPersistentBasicExpressionExperiment, getTestPersistentBibliographicReference, getTestPersistentBioAssay, getTestPersistentBioAssay, getTestPersistentBioMaterial, getTestPersistentBioMaterial, getTestPersistentBioSequence, getTestPersistentBioSequence, getTestPersistentBioSequence2GeneProducts, getTestPersistentBlatResult, getTestPersistentBlatResult, getTestPersistentCompleteExpressionExperiment, getTestPersistentCompleteExpressionExperimentWithSequences, getTestPersistentCompleteExpressionExperimentWithSequences, getTestPersistentContact, getTestPersistentDatabaseEntry, getTestPersistentDatabaseEntry, getTestPersistentDatabaseEntry, getTestPersistentDatabaseEntry, getTestPersistentDatabaseEntry, getTestPersistentExpressionExperiment, getTestPersistentExpressionExperiment, getTestPersistentGene, getTestPersistentGene, getTestPersistentGeneProduct, getTestPersistentQuantitationType, randomName, resetTestCollectionSize, runAsAdmin, runAsAgent, runAsAnonymous, runAsUser, runAsUser, setTestCollectionSize, setUpAuthentication, setUpSecurityContextHolderStrategy, tearDownSecurityContext
-
Methods inherited from class org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests
setApplicationContext
-
-
-
-
Field Detail
-
applicationContext
@Autowired protected WebApplicationContext applicationContext
-
mvc
protected MockMvc mvc
-
-
Method Detail
-
afterPropertiesSet
@OverridingMethodsMustInvokeSuper public void afterPropertiesSet()
- Specified by:
afterPropertiesSet
in interfaceInitializingBean
- Overrides:
afterPropertiesSet
in classBaseSpringContextTest
-
newGet
public MockHttpServletRequest newGet(String url)
-
newPost
public MockHttpServletRequest newPost(String url)
Convenience methods to make tests simpler
-
-