mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-08 14:51:49 +00:00
125603 rmunteanu: Merged 5.1.1 (5.1.1) to 5.1.N (5.1.2) 125484 slanglois: MNT-16155 Update source headers - remove old Copyrights from Java and JSP dource files git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@125781 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
55 lines
1.5 KiB
Java
55 lines
1.5 KiB
Java
|
|
package org.alfresco.repo.virtual.ref;
|
|
|
|
import java.util.Arrays;
|
|
|
|
import junit.framework.TestCase;
|
|
|
|
import org.junit.Test;
|
|
|
|
public class GetChildByIdMethodTest extends TestCase
|
|
{
|
|
|
|
private String toChildPath(final String parentPath, String childName) throws ProtocolMethodException
|
|
{
|
|
StringParameter path = new StringParameter(parentPath);
|
|
|
|
Reference ref = new Reference(Encodings.PLAIN.encoding,
|
|
Protocols.VIRTUAL.protocol,
|
|
new ClasspathResource("/a/class/path.js"),
|
|
Arrays.asList(path));
|
|
GetChildByIdMethod method = new GetChildByIdMethod(childName);
|
|
|
|
Reference childRef = ref.execute(method);
|
|
|
|
assertEquals(ref.getResource(),
|
|
childRef.getResource());
|
|
assertEquals(ref.getProtocol(),
|
|
childRef.getProtocol());
|
|
|
|
return childRef.execute(new GetTemplatePathMethod());
|
|
}
|
|
|
|
@Test
|
|
public void testExecute() throws Exception
|
|
{
|
|
final String parentPath = "/root";
|
|
final String childName = "aChid";
|
|
String childPath = toChildPath(parentPath,
|
|
childName);
|
|
|
|
assertEquals(parentPath + "/" + childName,
|
|
childPath);
|
|
}
|
|
|
|
@Test
|
|
public void testTrailingPath() throws Exception
|
|
{
|
|
String childPath = toChildPath(" /root/ ",
|
|
"child");
|
|
|
|
assertEquals("/root/child",
|
|
childPath);
|
|
}
|
|
}
|