Class AbstractApiActionHandler
- java.lang.Object
-
- org.uitnet.testing.smartfwk.api.core.AbstractApiActionHandler
-
- All Implemented Interfaces:
ApiAuthenticationProvider
public abstract class AbstractApiActionHandler extends Object implements ApiAuthenticationProvider
- Author:
- Madhav Krishna
-
-
Field Summary
Fields Modifier and Type Field Description protected StringactiveProfileNameprotected UserProfileactiveUserProfileprotected ApiTestManagerapiTestManagerprotected StringappNameprotected StringbaseURLprotected longlastRequestAccessTimeInMsprotected booleanlogoutRequestprotected HttpSessionsessionprotected intsessionExpiryDurationInSecondsprotected StringtargetServerName
-
Constructor Summary
Constructors Constructor Description AbstractApiActionHandler(String appName, int sessionExpiryDurationInSeconds, String targetServerName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidauthenticate(String profileName)AbstractApiActionHandlerclone()protected voiddownloadFile(okhttp3.ResponseBody body, String filePath)StringgetActiveProfileName()UserProfilegetActiveUserProfile()longgetLastRequestAccessTimeInMs()intgetSessionExpiryDurationInSeconds()protected voidhandleContentDisposition(HttpResponse httpResponse, okhttp3.Response rawResponse)HttpResponsehttpDelete(String relativeUrl, String responseContentType, Integer connectTimeoutInSeconds, Integer readTimeoutInSeconds)HttpResponsehttpGet(String relativeUrl, String responseContentType, Integer connectTimeoutInSeconds, Integer readTimeoutInSeconds)HttpResponsehttpPost(String relativeUrl, HttpRequest request, Integer connectTimeoutInSeconds, Integer readTimeoutInSeconds)HttpResponsehttpPut(String relativeUrl, HttpRequest request, Integer connectTimeoutInSeconds, Integer readTimeoutInSeconds)HttpResponsehttpUploadFormFiles(String relativeUrl, HttpMultipartRequest request, Integer connectTimeoutInSeconds, Integer readTimeoutInSeconds)protected booleanisSessionExpired()protected HttpResponseprepareResponse(okhttp3.OkHttpClient client, okhttp3.Request.Builder requestBuilder, boolean expectResponseBody, String targetURL)HttpSessionsetActiveProfileName(String profileName)voidsetApiTestManager(ApiTestManager apiTestManager)-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.uitnet.testing.smartfwk.api.core.ApiAuthenticationProvider
login, logout
-
-
-
-
Field Detail
-
appName
protected String appName
-
baseURL
protected String baseURL
-
session
protected HttpSession session
-
activeProfileName
protected String activeProfileName
-
activeUserProfile
protected UserProfile activeUserProfile
-
sessionExpiryDurationInSeconds
protected int sessionExpiryDurationInSeconds
-
lastRequestAccessTimeInMs
protected long lastRequestAccessTimeInMs
-
logoutRequest
protected boolean logoutRequest
-
apiTestManager
protected ApiTestManager apiTestManager
-
targetServerName
protected String targetServerName
-
-
Method Detail
-
setApiTestManager
public void setApiTestManager(ApiTestManager apiTestManager)
-
setActiveProfileName
public HttpSession setActiveProfileName(String profileName)
-
authenticate
protected void authenticate(String profileName)
-
getActiveProfileName
public String getActiveProfileName()
-
httpGet
public HttpResponse httpGet(String relativeUrl, String responseContentType, Integer connectTimeoutInSeconds, Integer readTimeoutInSeconds)
-
httpDelete
public HttpResponse httpDelete(String relativeUrl, String responseContentType, Integer connectTimeoutInSeconds, Integer readTimeoutInSeconds)
-
httpPost
public HttpResponse httpPost(String relativeUrl, HttpRequest request, Integer connectTimeoutInSeconds, Integer readTimeoutInSeconds)
-
httpPut
public HttpResponse httpPut(String relativeUrl, HttpRequest request, Integer connectTimeoutInSeconds, Integer readTimeoutInSeconds)
-
httpUploadFormFiles
public HttpResponse httpUploadFormFiles(String relativeUrl, HttpMultipartRequest request, Integer connectTimeoutInSeconds, Integer readTimeoutInSeconds)
-
prepareResponse
protected HttpResponse prepareResponse(okhttp3.OkHttpClient client, okhttp3.Request.Builder requestBuilder, boolean expectResponseBody, String targetURL)
-
isSessionExpired
protected boolean isSessionExpired()
-
getActiveUserProfile
public UserProfile getActiveUserProfile()
-
getSessionExpiryDurationInSeconds
public int getSessionExpiryDurationInSeconds()
-
getLastRequestAccessTimeInMs
public long getLastRequestAccessTimeInMs()
-
handleContentDisposition
protected void handleContentDisposition(HttpResponse httpResponse, okhttp3.Response rawResponse) throws IOException
- Throws:
IOException
-
downloadFile
protected void downloadFile(okhttp3.ResponseBody body, String filePath) throws IOException- Throws:
IOException
-
clone
public AbstractApiActionHandler clone()
-
-