Package org.openbravo.test.security
Class ExplicitCrossOrganizationReference
- java.lang.Object
-
- org.openbravo.test.base.MockableBaseTest
-
- org.openbravo.test.base.OBBaseTest
-
- org.openbravo.test.datasource.BaseDataSourceTestDal
-
- org.openbravo.test.security.CrossOrganizationReference
-
- org.openbravo.test.security.ExplicitCrossOrganizationReference
-
public class ExplicitCrossOrganizationReference extends CrossOrganizationReference
Test cases covering special cases for cross organization references, where they are allowed based on ad_column.allowed_cross_org_link setting.- Author:
- alostale
-
-
Field Summary
-
Fields inherited from class org.openbravo.test.security.CrossOrganizationReference
createdObjects, SPAIN_ORG, SPAIN_WAREHOUSE, USA_BP, USA_ORDER, USA_ORG, USA_WAREHOUSE
-
Fields inherited from class org.openbravo.test.datasource.BaseDataSourceTestDal
LOGIN, POST_METHOD, 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 ExplicitCrossOrganizationReference()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
adminAndCrossOrgAdminAreIndependent()
void
byDefaultCrossOrgAdminShouldBeDisabled()
void
childListShouldBeRetrivedEvenIfRoleHasNoAccess()
When fetching children elements (order.getOrderLineList), children's organization is not checked, so even they are cross-org and the role has no access to them, they are present in the bag.void
childListShouldBeRetrivedIfRoleHasAccess()
Fetching children (order.getOrderLineList) should retrieve cross-org elements if role has access to children orgvoid
crossOrgAdminModeShoudBePossibleToEnable()
void
crossOrgAdminShouldWorkAsAnStack()
void
itShouldntBeAllowedToSetCrossOrgIfModNotInDev()
Cross org column value cannot changed if column's module is not in dev.void
orderLineDSShouldHideNonAccessibleChildren()
Creates same order thanorderLineDSShouldShowAllChildren()
.void
orderLineDSShouldShowAllChildren()
Creates an order in org Spain with 2 lines: 1 in Spain another in USA.static void
resetAD()
static void
setUpAllowedCrossOrg()
void
shouldBeAllowedOnChildInsertInOrgAdminMode()
void
shouldBeAllowedOnChildUpdateInOrgAdminMode()
void
shouldBeAllowedOnInsertInCrossOrgAdminMode()
References from org Spain to USA should be allowed on insertion if in cross org admin mode for columns that allow itvoid
shouldBeAllowedOnUpdateInCrossOrgAdminMode()
References from org Spain to USA should not be allowed on update if in cross org admin mode for columns that allow itvoid
shouldBeIllegalOnChildInsert()
void
shouldBeIllegalOnChildUpdate()
void
shouldBeIllegalOnInsert()
References from org Spain to USA should not be allowed on insertion even in a column allowing it if not in admin modevoid
shouldBeIllegalOnInsertAdminModeIfColumnNotSet()
For columns not flagged to allow cross org refs, it should not be possible to do it even in cross org admin modevoid
shouldBeIllegalOnUpdate()
References from org Spain to USA should not be allowed on update even in a column allowing it if not in admin modevoid
shouldBeIllegalOnUpdateAdminModeIfColumnNotSet()
For columns not flagged to allow cross org refs, it should not be possible to do it even in cross org admin modevoid
unbalancedOrgAdminThreadFinalizationShouldLogWarn()
void
unbalancedRestorePreviousCrossOrgAdminShouldLogStackIfEnabled()
void
unbalancedRestorePreviousCrossOrgAdminShouldLogWarn()
-
Methods inherited from class org.openbravo.test.security.CrossOrganizationReference
createOrder, createOrder, createOrder, createOrderLine, createOrderLine, removeCreatedObjects, setRole
-
Methods inherited from class org.openbravo.test.datasource.BaseDataSourceTestDal
authenticate, changeProfile, doRequest, doRequest, doRequest, getLogin, getOpenbravoURL, getPassword, getSessionCsrfToken, logout
-
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
-
-
-
-
Method Detail
-
shouldBeIllegalOnInsert
public void shouldBeIllegalOnInsert()
References from org Spain to USA should not be allowed on insertion even in a column allowing it if not in admin mode
-
shouldBeIllegalOnUpdate
public void shouldBeIllegalOnUpdate()
References from org Spain to USA should not be allowed on update even in a column allowing it if not in admin mode
-
shouldBeAllowedOnInsertInCrossOrgAdminMode
public void shouldBeAllowedOnInsertInCrossOrgAdminMode()
References from org Spain to USA should be allowed on insertion if in cross org admin mode for columns that allow it
-
shouldBeAllowedOnUpdateInCrossOrgAdminMode
public void shouldBeAllowedOnUpdateInCrossOrgAdminMode()
References from org Spain to USA should not be allowed on update if in cross org admin mode for columns that allow it
-
shouldBeIllegalOnInsertAdminModeIfColumnNotSet
public void shouldBeIllegalOnInsertAdminModeIfColumnNotSet()
For columns not flagged to allow cross org refs, it should not be possible to do it even in cross org admin mode
-
shouldBeIllegalOnUpdateAdminModeIfColumnNotSet
public void shouldBeIllegalOnUpdateAdminModeIfColumnNotSet()
For columns not flagged to allow cross org refs, it should not be possible to do it even in cross org admin mode
-
shouldBeIllegalOnChildInsert
public void shouldBeIllegalOnChildInsert()
-
shouldBeIllegalOnChildUpdate
public void shouldBeIllegalOnChildUpdate()
-
shouldBeAllowedOnChildInsertInOrgAdminMode
public void shouldBeAllowedOnChildInsertInOrgAdminMode()
-
shouldBeAllowedOnChildUpdateInOrgAdminMode
public void shouldBeAllowedOnChildUpdateInOrgAdminMode()
-
childListShouldBeRetrivedIfRoleHasAccess
public void childListShouldBeRetrivedIfRoleHasAccess()
Fetching children (order.getOrderLineList) should retrieve cross-org elements if role has access to children org
-
childListShouldBeRetrivedEvenIfRoleHasNoAccess
public void childListShouldBeRetrivedEvenIfRoleHasNoAccess()
When fetching children elements (order.getOrderLineList), children's organization is not checked, so even they are cross-org and the role has no access to them, they are present in the bag.
-
byDefaultCrossOrgAdminShouldBeDisabled
public void byDefaultCrossOrgAdminShouldBeDisabled()
-
crossOrgAdminModeShoudBePossibleToEnable
public void crossOrgAdminModeShoudBePossibleToEnable()
-
crossOrgAdminShouldWorkAsAnStack
public void crossOrgAdminShouldWorkAsAnStack()
-
adminAndCrossOrgAdminAreIndependent
public void adminAndCrossOrgAdminAreIndependent()
-
unbalancedRestorePreviousCrossOrgAdminShouldLogWarn
public void unbalancedRestorePreviousCrossOrgAdminShouldLogWarn()
-
unbalancedRestorePreviousCrossOrgAdminShouldLogStackIfEnabled
public void unbalancedRestorePreviousCrossOrgAdminShouldLogStackIfEnabled()
-
unbalancedOrgAdminThreadFinalizationShouldLogWarn
public void unbalancedOrgAdminThreadFinalizationShouldLogWarn() throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException
-
orderLineDSShouldShowAllChildren
public void orderLineDSShouldShowAllChildren() throws Exception
Creates an order in org Spain with 2 lines: 1 in Spain another in USA. Then fetches OrderLine data source with QA Admin role which has access to both organizations, so both lines should be retrieved- Throws:
Exception
-
orderLineDSShouldHideNonAccessibleChildren
public void orderLineDSShouldHideNonAccessibleChildren() throws Exception
Creates same order thanorderLineDSShouldShowAllChildren()
. Fetch is done with role with access to only Spain, so only 1 line is expected to be retrieved. Note this test will be needed to be changed in case cross org references is also implemented for the UI.- Throws:
Exception
-
itShouldntBeAllowedToSetCrossOrgIfModNotInDev
public void itShouldntBeAllowedToSetCrossOrgIfModNotInDev()
Cross org column value cannot changed if column's module is not in dev. The opposite (value can be changed if mod in dev), is implicitly tested in @BeforeClass method.
-
-