Jan Vonka 4c800c25c5 Merged DEV/JASONH to HEAD
12565: JCR - fix ALFCOM-1655 (supercedes part of r12170)
  12644: JCR - fix extra testcase for ALFCOM-1655


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@12650 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
2009-01-09 12:43:46 +00:00

129 lines
3.9 KiB
Java

/*
* Copyright (C) 2005-2008 Alfresco Software Limited.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program 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 General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* As a special exception to the terms and conditions of version 2.0 of
* the GPL, you may redistribute this Program in connection with Free/Libre
* and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have recieved a copy of the text describing
* the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing"
*/
package org.alfresco.jcr.item;
import javax.jcr.Node;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
import javax.jcr.SimpleCredentials;
import org.alfresco.jcr.test.BaseJCRTest;
/**
* One-off item tests - sanity checks for bug fixes
*
* @author janv
*/
public class ItemTest extends BaseJCRTest
{
protected Session session;
@Override
protected void setUp() throws Exception
{
super.setUp();
}
@Override
protected void tearDown() throws Exception
{
super.tearDown();
}
public void test_ALFCOM_1655() throws RepositoryException
{
SimpleCredentials user = new SimpleCredentials("admin", "admin".toCharArray());
session = repository.login(user, getWorkspace());
try
{
Node rootNode = session.getRootNode();
assertNotNull(rootNode);
Node aNode = rootNode.addNode("A1","my:a");
assertNotNull(aNode);
Node bNode = aNode.addNode("B1","my:b");
assertNotNull(bNode);
aNode = rootNode.addNode("A2","cm:folder");
assertNotNull(aNode);
bNode = aNode.addNode("B2","cm:folder");
assertNotNull(bNode);
Node cNode = rootNode.addNode("C1","my:c");
assertNotNull(cNode);
aNode = cNode.addNode("A3","my:a");
assertNotNull(aNode);
bNode = cNode.addNode("B3","my:b");
assertNotNull(bNode);
session.save();
}
finally
{
if (session != null) { session.logout(); }
}
session = repository.login(user, getWorkspace());
try
{
Node rootNode = session.getRootNode();
assertNotNull(rootNode);
Node aNode = rootNode.getNode("A1");
assertNotNull(aNode);
Node bNode = aNode.getNode("B1");
assertNotNull(bNode);
aNode = rootNode.getNode("A2");
assertNotNull(aNode);
bNode = aNode.getNode("B2");
assertNotNull(bNode);
Node cNode = rootNode.getNode("C1");
assertNotNull(cNode);
aNode = cNode.getNode("A3");
assertNotNull(aNode);
bNode = cNode.getNode("B3");
assertNotNull(bNode);
}
finally
{
if (session != null) { session.logout(); }
}
}
}