Merged HEAD-QA to HEAD (4.2) (including moving test classes into separate folders)

51903 to 54309 


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@54310 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Samuel Langlois
2013-08-20 17:17:31 +00:00
parent 0a36e2af67
commit ab4ca7177f
1576 changed files with 36419 additions and 8603 deletions

View File

@@ -0,0 +1,68 @@
package org.alfresco.jcr.item;
import javax.jcr.Node;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
import javax.jcr.SimpleCredentials;
import javax.jcr.nodetype.NodeType;
import org.alfresco.jcr.test.BaseJCRTest;
public class Alf1791Test extends BaseJCRTest
{
protected Session superuserSession;
protected Node node;
@Override
protected void setUp() throws Exception
{
super.setUp();
SimpleCredentials superuser = new SimpleCredentials("superuser", "".toCharArray());
superuserSession = repository.login(superuser, getWorkspace());
Node rootNode = superuserSession.getRootNode();
node = rootNode.addNode("alf1791", "cm:content");
}
@Override
protected void tearDown() throws Exception
{
node.remove();
superuserSession.logout();
super.tearDown();
}
public void testAlf1791()
throws Exception
{
final String mixPrefix = node.getSession().getNamespacePrefix("http://www.jcp.org/jcr/mix/1.0");
final String mixReferenceable = mixPrefix + ":referenceable";
final String sysPrefix = node.getSession().getNamespacePrefix("http://www.alfresco.org/model/system/1.0");
final String sysReferenceable = sysPrefix + ":referenceable";
node.addMixin(mixReferenceable);
if (!hasMixin(node, mixReferenceable))
{
throw new RepositoryException("Node just made 'mix:referenceable' isn't! ('sys:referenceable'=" + hasMixin(node, sysReferenceable) + ")");
}
}
public static final boolean hasMixin(final Node node, final String mixinName)
throws RepositoryException
{
final NodeType[] mixinNodeTypes = node.getMixinNodeTypes();
if (mixinNodeTypes == null)
return false;
for (NodeType mixinNodeType : mixinNodeTypes)
{
if (mixinNodeType == null)
continue;
if (mixinName.equals(mixinNodeType.getName()))
return true;
}
return false;
}
}