Class BaseControllerTestCase<T extends BaseController>
- java.lang.Object
-
- junit.framework.Assert
-
- jetbrains.buildServer.MockSupport
-
- jetbrains.buildServer.AfterTestHook
-
- jetbrains.buildServer.BaseTestCase
-
- jetbrains.buildServer.serverSide.db.BaseDatabaseTestCase
-
- jetbrains.buildServer.serverSide.impl.BaseServerTestCase
-
- jetbrains.buildServer.BaseWebTestCase
-
- jetbrains.buildServer.controllers.BaseControllerTestCase<T>
-
- All Implemented Interfaces:
WaitForAssertions,org.testng.IHookable,org.testng.ITestNGListener
public abstract class BaseControllerTestCase<T extends BaseController> extends BaseWebTestCase
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class jetbrains.buildServer.serverSide.impl.BaseServerTestCase
BaseServerTestCase.TestBuildServerImpl
-
Nested classes/interfaces inherited from class jetbrains.buildServer.serverSide.db.BaseDatabaseTestCase
BaseDatabaseTestCase.SQLWork
-
Nested classes/interfaces inherited from class jetbrains.buildServer.BaseTestCase
BaseTestCase.UnderLockedFile
-
-
Field Summary
Fields Modifier and Type Field Description protected TmyControllerprotected org.springframework.web.servlet.ModelAndViewmyModelAndView-
Fields inherited from class jetbrains.buildServer.BaseWebTestCase
myRequest, myResponse, myWebManager
-
Fields inherited from class jetbrains.buildServer.serverSide.impl.BaseServerTestCase
myAgentManager, myAuditLogFactory, myBuildAgent, myBuildType, myDb, myFixture, myIdSequences, myLoginConfiguration, myProject, myProjectManager, myServer, myWebLinks, NOOP_COUNTER
-
Fields inherited from class jetbrains.buildServer.serverSide.db.BaseDatabaseTestCase
dbType, ourDialect, ourQueryBuilder
-
Fields inherited from class jetbrains.buildServer.BaseTestCase
IS_WINDOWS, myTestLogger, OS_NAME
-
Fields inherited from class jetbrains.buildServer.MockSupport
ANYTHING, NOT_NULL, NULL
-
-
Constructor Summary
Constructors Constructor Description BaseControllerTestCase()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidassertRedirect(String redirectedTo)protected voidassertRedirect2AdminOverview()protected voidassertRedirectMatches(List<org.hamcrest.Matcher<String>> matchers)protected voidassertResponseHas(String what)protected voidassertResponseHasNot(String what)protected voidassertResponseHasStatusNotFound(String statusText)protected voidassertResponseHasWithCount(String what, int count)protected voidassertSimpleView(String expectedMessage)protected voidassertView(String expectedViewName)protected voidcheckResponseHasNoErrors()protected abstract TcreateController()protected org.springframework.web.servlet.ModelAndViewdoGet(Object... params)protected org.springframework.web.servlet.ModelAndViewdoGoodParameterTest(javax.servlet.http.HttpServletRequest request, String expectedViewName, String[] key, Object[] expectedModel)protected org.springframework.web.servlet.ModelAndViewdoGoodParameterTest(javax.servlet.http.HttpServletRequest request, String expectedViewName, String key, Object expectedModel)protected org.springframework.web.servlet.ModelAndViewdoHead(Object... params)protected org.springframework.web.servlet.ModelAndViewdoPost(Object... params)TBDprotected MapgetModel()protected org.springframework.web.servlet.ViewgetView()protected StringgetViewName()protected voidpostHandle(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Object handler, org.springframework.web.servlet.ModelAndView modelAndView)protected booleanpreHandle(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)protected org.springframework.web.servlet.ModelAndViewprocessEmptyRequest()protected org.springframework.web.servlet.ModelAndViewprocessRequest()protected org.springframework.web.servlet.ModelAndViewprocessRequest(javax.servlet.http.HttpServletRequest request)voidrecreateBuildServer()protected voidsetRealUserAgentForRequest()protected voidsetUp()-
Methods inherited from class jetbrains.buildServer.BaseWebTestCase
assertAJAXRedirect, assertErrorInResponse, assertErrorInResponse, assertErrorInResponse, assertMessageNotStored, assertMessageStored, assertNoAJAXRedirect, assertNoErrorInResponse, assertNoErrorInResponse, assertNoErrorsInResponse, assertStateModified, evaluateXpath, getActionMessages, getAddToQueueProcessor, getAjaxController, getAuthorizedUserInterceptor, getPagePlaces, getRolesActionHelper, getSimpleActionController, getWebFixture, getWebLoginModel, logout, makeLoggedIn, tearDown
-
Methods inherited from class jetbrains.buildServer.serverSide.impl.BaseServerTestCase
addDependency, addErrorMessage, addErrorMessage, addRole2LoggedInUser, addToQueue, assertParameterContained, assertRawParameterValue, blockProjectsPersister, build, buildPatchFromDir, checkOS, clearQueue, configurePlugins, containsSimilarArtifactDependency, copyBuildTypeConfig, copyProjectConfig, copyTemplateConfig, copyVcsRootConfig, createAdmin, createAdvancedProfileData, createBuild, createBuild, createBuild, createBuild, createBuild, createBuild, createBuild, createBuild, createBuildInBranch, createBuildInBranch, createBuildInBranch, createBuildInBranch, createBuildProblem, createBuildTypeTemplate, createBuildTypeTemplate, createBuildWithBuildDurationStatistic, createBuildWithBuildProblem, createBuildWithBuildProblems, createBuildWithBuildProblems, createBuildWithBuildProblemsInBranch, createBuildWithChanges, createBuildWithFailedTest, createBuildWithPassedTest, createCloudAgentType, createCustomBuild, createDependencyChain, createDependencyTrigger, createFailedBuild, createFailedBuildWithPassedTest, createInternalErrorBuild, createInternalErrorBuild, createInternalErrorBuildInBranch, createPersonalBuild, createProject, createProject, createPromotionOnModifications, createPromotionOnModifications, createPromotionWithChange, createPromotionWithDesiredBranch, createRespEntry, createRespEntry, createRunningBuild, createRunningBuildInBranch, createSimpleProfile, createSimpleProfile, createSimpleProfileData, createTest, createTriggerDescriptor, createTriggerDescriptor, createUser, createUser, createVcsRoot, createVcsUser, createVirtualProject, deleteLicenses, disableAllAgents, disableRunningBuildsUpdate, doCompilationProblem, dumpBuildState, enableFailOnAnyError, enableRunningBuildsUpdate, findBuildProblem, finishAllBuilds, finishAllQueuedBuilds, finishBuild, finishBuild, finishBuild, finishBuild, flushQueueAndWait, getAgentWorkingDirectoryState, getAllBuildProblems, getEventDispatcher, getFlushedBuildLog, getOrCreateUser, getParameterFactory, getPersonalBuildManager, getProblemId, getProjectAdminRole, getProjectDevRole, getProjectViewerRole, getQueue, getQueue, getRootProject, getRunningBuild, getRunningBuild, getSummaryFactory, getSuperUserRole, getSysAdminRole, getTestId, getTestNameId, getTestNames, getTestRoles, getTestsFromNames, getUserChangesFacade, getUserGroupManager, getUserModelEx, getXpathValue, hexEncodedPublicKey, initServer, logAgentTimezone, makeBuildHanging, makeProjectAccessible, makeProjectAccessible, makeProjectsAccessible, makeProjectsVisible, makeProjectVisible, muteBuildProblemInProject, muteBuildProblemInProject, muteBuildProblemInProject, muteTestsInBt, muteTestsInProject, muteTestsInProject, nTimes, nTimesApply, persist, publishModifications, queueAndWaitForFreeze, queueAndWaitForFreeze, recreateBuildServer, recreateBuildServer, registerAndEnableAgent, registerBuildType, registerBuildType, registerBuildType, registerBuildType, registerBuildType, registerTemplateBasedBuildType, registerTwoTemplatesBasedBuildType, reloadQueue, removeRolesFromLoggedInUser, resolveInProject, runBuildOnModifications, runFailedBuildOnModifications, runningImpl, runningImpl, runSuccessfulBuildOnModifications, runTestsInRunningBuild, runTestsInRunningBuild, runTestsInRunningBuild, setActiveBranchNames, setActiveBranchNames, setBranchSpec, setDefaultLoginModule, setDurationEstimatesFor, setProblemResponsibilty, setReleaseDate, setResponsibilityForBuildType, setResponsibilityForTests, setResponsibilityForTests, setSelectedLoginModule, setUp000, shutdownServer, simulateJavaScriptEncryption, singletonBuildFeature, startBuild, startBuild, startBuild, startBuild, startBuild, startBuild, startBuildInBranch, startBuildInBranch, startBuildInBranch, startBuildWithChanges, switchToEnterpriseMode, switchToProfessionalMode, tearDownFixture, testFailed, testFailed, testNames2Objects, testSuccessful, testSuccessful, tid, unloadFinishedBuildPromotions, unmuteTests, unregisterAgent, unregisterBuildType, updateActiveBuildBranches, vcsSupport, vcsTrigger, waitForBuildToFail, withDisabledResponsibilities
-
Methods inherited from class jetbrains.buildServer.serverSide.db.BaseDatabaseTestCase
assertNoTableRows, cleanupTable, cleanupTables, cleanupTables, countTableRows, createEmptyServerPath, dumpTable, dumpTable, dumpTables, dumpTables, ensureCleanSchema, ensureCleanTable, ensureCleanTable, ensureNoTables, ensureSingleRowTable, executeScript, populateTablesWithSimpleData, provideDatabaseHsql2Only, provideDatabaseMsOnly, provideDatabaseTypeMySQLOnly, provideDatabaseTypeNotHSQL, provideDatabaseTypeNotMySQL, provideDatabaseTypeSupportI18n, provideWithCurrentDatabaseType, runTwoQueries, runTwoThreads, setUpClassStatic, withDBF, withDBF
-
Methods inherited from class jetbrains.buildServer.BaseTestCase
assertArraysEqual, assertArraysEqual, assertContains, assertContains, assertContains, assertContains, assertContains, assertContainsAll, assertContainsAny, assertContainsWithCount, assertEmpty, assertEmpty, assertEquals, assertEquals, assertEquals, assertEquals, assertEqualsIgnoreNonBMP, assertExceptionThrown, assertExceptionThrown, assertExceptionThrown, assertExceptionThrown, assertExceptionThrown, assertGreater, assertGreater, assertGreaterOrEquals, assertHasWithCount, assertInstanceOf, assertListEquals, assertMap, assertMapping, assertMatches, assertMatches, assertMeaningTextEquals, assertNotContains, assertNotContains, assertNotContains, assertNotEmpty, assertNull2, assertSameElements, assertSameElements, assertSameElements, assertSetEquals, assertTime, assertTime, assertTimestampEquals, assertXmlEqual, assertXmlEqual, averageExecutionTime, checkOrderedCollection, checkOrderedCollection, checkUnorderedCollection, checkUnorderedCollection, clearFailure, createMap, createSet, createTempDir, createTempFile, createTempFile, createTempFile, createTestLogger, doUnderLockedDirectory, doUnderLockedFile, doUnderUnreadableLockedFile, dumpCollection, dumpFile, dumpItems, enableAndRecordDebugLog, enableDebug, enableDebug, enableInfo, env, getLoggedFailure, getName, getProjectDir, getTestDataFile, getTestFiles, getTestFilesDataPath, hasCustomInternalProperty, isPropertyDefined, listFilesOrDie, listFilesOrDie, log, performAfterTestVerification, provideWithBooleans, provideWithLinuxMacWindows, provideWithWindowsOnly, registerAsTempFile, removeInternalProperty, resetAllFields, resetFields2Null, runAndReportMemoryAllocations, runAsync, runAsync, runAsyncAndFailOnException, setInternalProperty, setInternalProperty, setInternalProperty, setLogLevel, setName, setUpClass, setupSuite, startThreadsAsync, threadDump, toProvide, trueFalseDataProvider, waitFor, waitFor, waitFor, writeTextToFile
-
Methods inherited from class jetbrains.buildServer.AfterTestHook
finishAfterTestHook, initializeAfterTestHook, run
-
Methods inherited from class jetbrains.buildServer.MockSupport
and, arrayContaining, arrayContaining, arrayContaining, arrayContaining, arrayContaining, arrayContaining, arrayContaining, arrayContaining, arrayContaining, arrayContaining, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, assertThat, atLeastOnce, collectionContaining, collectionContaining, compatibleType, contains, containsInAnyOrder, containsInAnyOrder, containsInOrder, containsInOrder, defaultMockNameForType, doAll, doAll, doAll, doAll, endsWith, eq, eq, eq, eq, eq, eq, eq, eq, eq, eq, exactly, hasProperty, hasProperty, isA, isGreaterThan, isIn, isIn, isLessThan, mapContaining, mapContaining, mapWithKey, mapWithKey, mapWithValue, mapWithValue, mock, mock, never, never, newDummy, newDummy, newDummy, not, not, once, onConsecutiveCalls, onConsecutiveCalls, onConsecutiveCalls, onConsecutiveCalls, or, returnIterator, returnIterator, returnValue, returnValue, returnValue, returnValue, returnValue, returnValue, returnValue, returnValue, returnValue, same, setUpMocks, startsWith, stringContains, tearDownMocks, throwException, toString, verify
-
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame, format
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jetbrains.buildServer.WaitForAssertions
waitFor, waitFor, waitForAssert, waitForAssert, waitForAssert, waitForAssert
-
-
-
-
Field Detail
-
myController
protected T extends BaseController myController
-
myModelAndView
protected org.springframework.web.servlet.ModelAndView myModelAndView
-
-
Method Detail
-
setUp
@BeforeMethod protected void setUp() throws Exception- Overrides:
setUpin classBaseWebTestCase- Throws:
Exception
-
recreateBuildServer
public void recreateBuildServer() throws IOException- Overrides:
recreateBuildServerin classBaseWebTestCase- Throws:
IOException
-
createController
protected abstract T createController() throws IOException
- Throws:
IOException
-
processRequest
protected org.springframework.web.servlet.ModelAndView processRequest(javax.servlet.http.HttpServletRequest request) throws Exception- Throws:
Exception
-
preHandle
protected boolean preHandle(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws Exception- Throws:
Exception
-
postHandle
protected void postHandle(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Object handler, org.springframework.web.servlet.ModelAndView modelAndView) throws Exception- Throws:
Exception
-
processRequest
protected org.springframework.web.servlet.ModelAndView processRequest() throws Exception- Throws:
Exception
-
getModel
protected final Map getModel()
-
getView
protected final org.springframework.web.servlet.View getView()
-
getViewName
protected final String getViewName()
-
processEmptyRequest
protected final org.springframework.web.servlet.ModelAndView processEmptyRequest() throws Exception- Throws:
Exception
-
doGoodParameterTest
protected org.springframework.web.servlet.ModelAndView doGoodParameterTest(javax.servlet.http.HttpServletRequest request, String expectedViewName, String key, Object expectedModel) throws Exception- Throws:
Exception
-
doGoodParameterTest
protected org.springframework.web.servlet.ModelAndView doGoodParameterTest(javax.servlet.http.HttpServletRequest request, String expectedViewName, String[] key, Object[] expectedModel) throws Exception- Throws:
Exception
-
doPost
protected org.springframework.web.servlet.ModelAndView doPost(Object... params) throws Exception
TBD- Parameters:
params- flatten pairs of parameters, the first one is the parameter name and the second one is the parameter value.- Returns:
- Throws:
Exception
-
doGet
protected org.springframework.web.servlet.ModelAndView doGet(Object... params) throws Exception
- Throws:
Exception
-
doHead
protected org.springframework.web.servlet.ModelAndView doHead(Object... params) throws Exception
- Throws:
Exception
-
setRealUserAgentForRequest
protected void setRealUserAgentForRequest()
-
assertRedirect2AdminOverview
protected void assertRedirect2AdminOverview()
-
assertView
protected void assertView(String expectedViewName)
-
assertRedirect
protected void assertRedirect(@Nullable String redirectedTo)
-
assertRedirectMatches
protected void assertRedirectMatches(@NotNull List<org.hamcrest.Matcher<String>> matchers)
-
assertResponseHas
protected void assertResponseHas(String what)
-
assertResponseHasWithCount
protected void assertResponseHasWithCount(String what, int count)
-
assertResponseHasNot
protected void assertResponseHasNot(String what)
-
assertSimpleView
protected void assertSimpleView(String expectedMessage)
-
assertResponseHasStatusNotFound
protected void assertResponseHasStatusNotFound(@Nullable String statusText)
-
checkResponseHasNoErrors
protected void checkResponseHasNoErrors()
-
-