Package org.openbravo.test.datasource
Class BaseDataSourceTestDal
- java.lang.Object
-
- org.openbravo.test.base.MockableBaseTest
-
- org.openbravo.test.base.OBBaseTest
-
- org.openbravo.test.datasource.BaseDataSourceTestDal
-
- Direct Known Subclasses:
CrossOrganizationReference
,CSRFAttackTest
,DataSourceSecurity
,DataSourceWhereParameter
,EmptyStringWhereAndFilterClauseParameter
,ETagGeneration
,ExtendedNavigationModelTest
,FetchDSNoActiveEntityObjects
,FICTest
,LinkToParentTreeDataSourceTest
,NonIdForeignKeyFilters
,OpenRecordAfterLogin
,OrganizationSelectorDataSourceTest
,OrganizationWindowRoleFilterTest
,OtherDatasourceRequests
,ResetCookieOnLogin
,SummaryFieldRequestTest
,TestAllowUnpagedDatasourcePreference
,TestComboDatasource
,TestCSVEncoding
,TestNoteDatasource
,TestSelectorDefaultFilterActionHandler
,UserInfoSessionDataTest
public class BaseDataSourceTestDal extends OBBaseTest
Base for tests performing requests to a live Openbravo instance. Allows to work with DAL, in case it is not neededBaseDataSourceTestNoDal
can be used instead. NOTE FOR DEVELOPERS:BaseDataSourceTestNoDal
class should be maintained in parallel to this one- Author:
- alostale
-
-
Field Summary
Fields Modifier and Type Field Description protected static String
LOGIN
protected static String
POST_METHOD
protected static String
PWD
-
Fields inherited from class org.openbravo.test.base.OBBaseTest
DOLLAR, DOLLAR_ID, EURO, EURO_ID, QA_TEST_ADMIN_USER_ID, QA_TEST_CLIENT_ID, QA_TEST_ORG_ID, TEST_BP_CATEGORY_ID, TEST_CLIENT_ID, TEST_INVOICE_ID, TEST_LOCATION_ID, TEST_ORDER_ID, TEST_ORG_ID, TEST_ORG_TREE, TEST_PRODUCT_ID, TEST_ROLE_ID, TEST_US_ORG_ID, TEST_USER_ID, TEST_WAREHOUSE_ID, TEST2_USER_ID, userIds, watchFailures
-
-
Constructor Summary
Constructors Constructor Description BaseDataSourceTestDal()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
authenticate()
Performs a request to authenticate with current settings if already not authenticated.protected void
changeProfile(String roleId, String langId, String orgId, String warehouseId)
Changes current session's profileprotected String
doRequest(String wsPart, String content, int expectedResponse, String method)
protected String
doRequest(String wsPart, String content, int expectedResponse, String method, String contentType)
Performs a request to Openbravo returning its response and asserting the response code matches expectedResponse.protected String
doRequest(String wsPart, Map<String,String> params, int expectedResponse, String method)
protected String
getLogin()
Returns the login used to login for the requests.protected String
getOpenbravoURL()
Obtains URL of Openbravo instance, by default taken from Openbravo.poperties context.url propertyprotected String
getPassword()
Returns the password used to login for the requests.protected String
getSessionCsrfToken()
protected void
logout()
Logs out current session-
Methods inherited from class org.openbravo.test.base.OBBaseTest
addReadWriteAccess, classSetUp, commitTransaction, count, getConnectionProvider, getOneInstance, getRandomUser, getTestLogAppender, initializeDalLayer, initializeDisabledTestCases, initializeTestLogAppender, isErrorOccured, reportException, rollback, setLogStackTraces, setQAAdminContext, setSystemAdministratorContext, setTestAdminContext, setTestLogAppenderLevel, setTestUserContext, setUp, setUserContext, shouldMockServletContext, staticInitializeDalLayer, testDone
-
Methods inherited from class org.openbravo.test.base.MockableBaseTest
mockStatic
-
-
-
-
Field Detail
-
LOGIN
protected static final String LOGIN
- See Also:
- Constant Field Values
-
PWD
protected static final String PWD
- See Also:
- Constant Field Values
-
POST_METHOD
protected static final String POST_METHOD
- See Also:
- Constant Field Values
-
-
Method Detail
-
doRequest
protected String doRequest(String wsPart, String content, int expectedResponse, String method) throws Exception
- Throws:
Exception
- See Also:
doRequest(String, String, int, String, String)
-
doRequest
protected String doRequest(String wsPart, Map<String,String> params, int expectedResponse, String method) throws Exception
- Throws:
Exception
- See Also:
doRequest(String, String, int, String, String)
-
doRequest
protected String doRequest(String wsPart, String content, int expectedResponse, String method, String contentType) throws Exception
Performs a request to Openbravo returning its response and asserting the response code matches expectedResponse. Before performing the requests, this method tries to authenticate with current settings if already not authenticated.- Returns:
- a
String
containing the response for the request - Throws:
Exception
-
authenticate
protected String authenticate() throws Exception
Performs a request to authenticate with current settings if already not authenticated.- Returns:
- a
String
representing the cookie with authenticated session id - Throws:
Exception
-
getSessionCsrfToken
protected String getSessionCsrfToken()
-
getOpenbravoURL
protected String getOpenbravoURL()
Obtains URL of Openbravo instance, by default taken from Openbravo.poperties context.url property- Returns:
- a
String
with the URL of Openbravo instance
-
getLogin
protected String getLogin()
Returns the login used to login for the requests. The default value isLOGIN
- Returns:
- the login name used to login for the requests
-
getPassword
protected String getPassword()
Returns the password used to login for the requests. The default value isPWD
- Returns:
- the password used to login for the requests
-
changeProfile
protected void changeProfile(String roleId, String langId, String orgId, String warehouseId) throws Exception
Changes current session's profile- Throws:
Exception
-
-