Files
alfresco-community-repo/source/test-java/org/alfresco/repo/model/filefolder/HiddenAspectCmisConfigTest.java
Tatyana Valkevych 271ce04935 Merged 5.0.N (5.0.3) to HEAD (5.1)
110822: Merged V4.2-BUG-FIX (4.2.6) to 5.0.N (5.0.3)
      110619: Merged V4.2.5 (4.2.5) to V4.2-BUG-FIX (4.2.6)
         110422: Merged DEV to V4.2.5 (4.2.5)
            110332: MNT-14151 : CMIS Upload/Create in 4.2 adds the sys:hidden and cm:indexControl Aspect to documents starting with a period
               - added system property in order to enable/disable cmis hidden behavior
               


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@110935 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
2015-08-26 13:42:25 +00:00

73 lines
2.4 KiB
Java

/*
* Copyright (C) 2005-2015 Alfresco Software Limited.
*
* This file is part of Alfresco
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
package org.alfresco.repo.model.filefolder;
import javax.transaction.NotSupportedException;
import javax.transaction.SystemException;
import org.junit.After;
import org.junit.Before;
/**
* Associated tests methods for HiddenAspectTest with the non-default value for cmisDisableHide
*
* @author Andreea Dragoi
* @since 4.2.5
*
*/
public class HiddenAspectCmisConfigTest extends HiddenAspectTest
{
private static final String FILENAME_LEADING_DOT_PATTERN = "\\..*";
@Before
public void setup() throws SystemException, NotSupportedException
{
super.setup();
//change cmisHiddenConfing default value
switchCmisHiddenConfig();
}
@After
public void tearDown() throws Exception
{
//revert to cmisHiddenConfing default value
switchCmisHiddenConfig();
super.tearDown();
}
/**
* switch value for cmisDisableHide in order to tests the configuration in both states
*/
private void switchCmisHiddenConfig()
{
for (HiddenFileInfo hiddenFileInfo : hiddenAspect.getPatterns())
{
if (FILENAME_LEADING_DOT_PATTERN.equals(hiddenFileInfo.getFilter()) && hiddenFileInfo instanceof ConfigurableHiddenFileInfo)
{
ConfigurableHiddenFileInfo configurableHiddenFileInfo = (ConfigurableHiddenFileInfo) hiddenFileInfo;
configurableHiddenFileInfo.setCmisDisableHideConfig(!configurableHiddenFileInfo.isCmisDisableHideConfig());
cmisDisableHide = !cmisDisableHide;
break;
}
}
}
}