01: /*
02: * Copyright (c) 2002-2007 by OpenSymphony
03: * All rights reserved.
04: */
05: package com.opensymphony.webwork.components;
06:
07: import java.net.URISyntaxException;
08:
09: import org.springframework.mock.web.MockServletContext;
10:
11: import junit.framework.TestCase;
12:
13: /**
14: * @author tmjee
15: * @version $Date$ $Id$
16: */
17: public class DefaultRichtexteditorConnectorTest extends TestCase {
18:
19: public void testCalculateActualServerPath() throws Exception {
20: MockServletContext servletContext = new MockServletContext() {
21: public String getRealPath(String path) {
22: return "C:\\eclipse\\workspace\\myProject\\web" + path;
23: }
24: };
25: DefaultRichtexteditorConnector connector = new DefaultRichtexteditorConnector() {
26: private static final long serialVersionUID = -3436164274268111578L;
27:
28: protected boolean makeDirIfNotExists(String path)
29: throws URISyntaxException {
30: return true;
31: }
32: };
33: connector.setServletContext(servletContext);
34: String result = connector
35: .calculateActualServerPath(
36: "\\com\\opensymphony\\webwork\\static\\richtexteditor\\data",
37: "image", "/testing");
38: assertEquals(
39: "file:////C:/eclipse/workspace/myProject/web/WEB-INF/classes/com/opensymphony/webwork/static/richtexteditor/data/image/testing",
40: result);
41: }
42: }
|