01: /*
02: * Copyright 2005 Joe Walker
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package org.directwebremoting.impl;
17:
18: import org.directwebremoting.Container;
19: import org.directwebremoting.extend.Remoter;
20: import org.directwebremoting.util.SingletonContainer;
21: import org.junit.Test;
22:
23: import static org.junit.Assert.*;
24:
25: /**
26: * @author Joe Walker [joe at getahead dot ltd dot uk]
27: */
28: public class DefaultRemoter2Test {
29: public DefaultRemoter2Test() throws Exception {
30: SingletonContainer singleton = new SingletonContainer(
31: "/org/directwebremoting/impl/dwr.xml");
32: singleton.engageThread();
33: container = singleton.getContainer();
34: remoter = container.getBean(Remoter.class);
35: }
36:
37: @Test
38: public void testGenerateInterfaceScript() {
39: String script = remoter.generateInterfaceScript("JDate",
40: "/path/to/dwr/servlet");
41: assertTrue(script.contains("JDate.getTimezoneOffset"));
42: assertTrue(script
43: .contains("JDate._path = '/path/to/dwr/servlet';"));
44: assertTrue(!script.contains("JDate.notfy"));
45: }
46:
47: private Container container;
48:
49: private Remoter remoter;
50: }
|