Merged V4.0-BUG-FIX to HEAD

37067: ALF-13294	CIFS: When versionable aspect is active, using the Microsoft Word for Mac 2008 option "always create a backup copy" leads to document versions loss
   37073: ALF-14319 Add a unit test for using the real remote credentials shared container (most use a test one to avoid issues/clashing), and tweak the qname to match other similar ones
   37074: Merged V3.4-BUG-FIX to V4.0-BUG_FIX
      36881: Merged DEV to V3.4-BUG-FIX
         36759: Fix to Checkin failing to distinguish between 'null' and 'unset' properties
         - Some minor ammendments to unit test as well
      36898: Merge HEAD to V3.4-BUG-FIX:
         33668: ALF-12541 / ALF-14254: AMP files need to be able to be pinned to specific "edition(s)" of Alfresco. It is now possible to specify a module.editions property (eg. community) which is checked by the MMT. Also, the version is checked on install. Also, started refactoring some of the code for better reuse.
         33793: ALF-12541 / ALF-14254: Better fix for ALF-12541 - AMP files need to be able to be pinned to specific "edition(s)" of Alfresco Share doesn't have a version.properties file so I need to cater for that scenario. I didn't want to create the LogOutput interface but its a stop-gap until the MMT gets re-worked.
         33695: ALF-12531 / ALF-14255: MMT needs to properly support upgrading of AMP files
         33725: ALF-12532 / ALF-14256: MMT should fail with an error if the target war file doesn't exist
         33735: ALF-12533 / ALF-14257: When run with -directory, MMT should only backup the alfresco.war file once
         33781: ALF-12540 / ALF-14258: AMP - file-mapping.properties: white space at end of line is significant
         33880: ALF-12777 / ALF-14259: MMT should not install AMPs which override pre-existing files in the war file, unless -force is provided. The MMT is moving toward more of a validation phase (checks things, calculate changes) then an execution phase (makes the changes).
         33707: ALF-12541 / ALF-14254: Fix for failing unit tests
      37030: ALF-12511 Allow debugging of the authentication chain at a high level
         - enable with log4j.loggerorg.alfresco.repo.security.authentication.AbstractChainingAuthenticationService=debug
      37066: Merged DEV to V3.4-BUG-FIX (3.4.10)
         37063: ALF-11956: WCM accessibility
            New Tab focus plugin is added for TinyMCE:
            - plugin covers the RTE changes special for 'XForms';
            - configuration for custom appearance has been set in 'web-client-config-wcm.xml'
      37069: ALF-13379: READ_ONLY_LOCK prevents access via deprecated CMIS API
      - Fix by Alex Bykov
   37075: Fix for ALF-14267 SOLR index check - First transaction time used instead of first ACL time - indexCheck, checkInitialState
   37076: Merged V3.4-BUG-FIX to V4.0-BUG-FIX (RECORD ONLY)
      36942: ALF-12081: Cancel Editing button should only be shown for documents that are checked out for offline editing.
      36957: ALF-12081: Reverse-merging r36942 pending UI team review


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@37079 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Dave Ward
2012-05-28 11:33:15 +00:00
parent ff2ae89c08
commit 6155c6ec15
8 changed files with 166 additions and 13 deletions

View File

@@ -144,12 +144,20 @@ public class RemoteCredentialsServiceImpl implements RemoteCredentialsService
credentialsFactories.put(credentialsType, factory);
}
/**
* Provides a read only copy of the credentials factories, useful in unit tests
*/
protected Map<QName,RemoteCredentialsInfoFactory> getCredentialsFactories()
{
return Collections.unmodifiableMap(credentialsFactories);
}
// --------------------------------------------------------
private static QName SYSTEM_FOLDER_QNAME =
QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, "system");
private static QName SHARED_CREDENTIALS_CONTAINER_QNAME =
QName.createQName(RemoteCredentialsModel.REMOTE_CREDENTIALS_MODEL_URL, SHARED_CREDENTIALS_CONTAINER_NAME);
QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, SHARED_CREDENTIALS_CONTAINER_NAME);
/**
* Gets the NodeRef of the holder of shared credentials remote systems.
*

View File

@@ -23,11 +23,13 @@ import static org.junit.Assert.assertNotNull;
import java.util.ArrayList;
import java.util.List;
import java.util.Map.Entry;
import java.util.Set;
import org.alfresco.model.ContentModel;
import org.alfresco.query.PagingRequest;
import org.alfresco.query.PagingResults;
import org.alfresco.repo.model.Repository;
import org.alfresco.repo.policy.BehaviourFilter;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.transaction.RetryingTransactionHelper;
@@ -38,7 +40,6 @@ import org.alfresco.service.cmr.remotecredentials.RemoteCredentialsService;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.security.AuthorityService;
import org.alfresco.service.cmr.security.MutableAuthenticationService;
import org.alfresco.service.cmr.security.PermissionService;
import org.alfresco.service.cmr.security.PersonService;
@@ -60,7 +61,8 @@ import org.springframework.context.ApplicationContext;
/**
* Test cases for {@link RemoteCredentialsServiceImpl} and friends.
*
* Note - this test will zap any existing shared credentials!
* Note - this test will largely use a test shared credentials
* container, but one test puts things into the real credentials folder
*
* @author Nick Burch
* @since Odin
@@ -95,6 +97,8 @@ public class RemoteCredentialsServicesTest
private static DictionaryService DICTIONARY_SERVICE;
private static NodeService NODE_SERVICE;
private static NodeService PUBLIC_NODE_SERVICE;
private static NamespaceService NAMESPACE_SERVICE;
private static Repository REPOSITORY_HELPER;
private static PersonService PERSON_SERVICE;
private static RetryingTransactionHelper TRANSACTION_HELPER;
private static TransactionService TRANSACTION_SERVICE;
@@ -115,6 +119,8 @@ public class RemoteCredentialsServicesTest
AUTHENTICATION_SERVICE = (MutableAuthenticationService)testContext.getBean("authenticationService");
BEHAVIOUR_FILTER = (BehaviourFilter)testContext.getBean("policyBehaviourFilter");
DICTIONARY_SERVICE = (DictionaryService)testContext.getBean("dictionaryService");
NAMESPACE_SERVICE = (NamespaceService)testContext.getBean("namespaceService");
REPOSITORY_HELPER = (Repository)testContext.getBean("repositoryHelper");
NODE_SERVICE = (NodeService)testContext.getBean("nodeService");
PUBLIC_NODE_SERVICE = (NodeService)testContext.getBean("NodeService");
PERSON_SERVICE = (PersonService)testContext.getBean("personService");
@@ -802,6 +808,70 @@ public class RemoteCredentialsServicesTest
assertEquals(1, creds.getPage().size());
}
/**
* Most of the shared credentials container tests work on the test one,
* so that things are in a known and empty state.
* We have this one test that uses the real shared container, just to check
* that it's correctly setup and available
*/
@Test public void testRealSharedCredentialsContainer() throws Exception
{
// Create a new instance, using the real container
RemoteCredentialsServiceImpl realService = new RemoteCredentialsServiceImpl();
realService.setDictionaryService(DICTIONARY_SERVICE);
realService.setNamespaceService(NAMESPACE_SERVICE);
realService.setNodeService(PUBLIC_NODE_SERVICE);
realService.setRepositoryHelper(REPOSITORY_HELPER);
for (Entry<QName,RemoteCredentialsInfoFactory> e : ((RemoteCredentialsServiceImpl)PRIVATE_REMOTE_CREDENTIALS_SERVICE).getCredentialsFactories().entrySet() )
{
realService.registerCredentialsFactory(e.getKey(), e.getValue());
}
// Run as a test user
AuthenticationUtil.setFullyAuthenticatedUser(TEST_USER_ONE);
// Do a create / fetch / delete step
PasswordCredentialsInfoImpl pwCredI = new PasswordCredentialsInfoImpl();
pwCredI.setRemoteUsername(TEST_REMOTE_USERNAME_ONE);
pwCredI.setRemotePassword(TEST_USER_THREE);
BaseCredentialsInfo credentials = null;
try
{
// Create
credentials = realService.createSharedCredentials(TEST_REMOTE_SYSTEM_ONE, pwCredI);
assertEquals(TEST_REMOTE_USERNAME_ONE, credentials.getRemoteUsername());
// Update
((PasswordCredentialsInfoImpl)credentials).setRemoteUsername(TEST_REMOTE_USERNAME_TWO);
((PasswordCredentialsInfoImpl)credentials).setRemotePassword(TEST_USER_ONE);
credentials = realService.updateCredentials(credentials);
assertEquals(TEST_REMOTE_USERNAME_TWO, credentials.getRemoteUsername());
// Delete
realService.deleteCredentials(credentials);
// Tidy, and zap the test parent
PUBLIC_NODE_SERVICE.deleteNode(credentials.getRemoteSystemContainerNodeRef());
credentials = null;
}
finally
{
// Tidy up if needed
if (credentials != null)
{
AuthenticationUtil.setAdminUserAsFullyAuthenticatedUser();
// Zap the credentials themselves
PUBLIC_NODE_SERVICE.deleteNode(credentials.getNodeRef());
// And their test parent
PUBLIC_NODE_SERVICE.deleteNode(credentials.getRemoteSystemContainerNodeRef());
}
}
}
// --------------------------------------------------------------------------------