KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > scriptella > configuration > ContentElTest


1 /*
2  * Copyright 2006-2007 The Scriptella Project Team.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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 scriptella.configuration;
17
18 import scriptella.AbstractTestCase;
19 import scriptella.execution.EtlExecutor;
20
21 import java.util.List JavaDoc;
22
23 /**
24  * Tests for {@link scriptella.configuration.ContentEl}.
25  */

26 public class ContentElTest extends AbstractTestCase {
27     /**
28      * Tests if {@link ContentEl#toString()} returns a location.
29      */

30     public void testToString() {
31         EtlExecutor ex = newEtlExecutor();
32         List JavaDoc<ScriptingElement> elements = ex.getConfiguration().getScriptingElements();
33         ScriptingElement element = elements.get(0);
34         assertEquals("/etl/script[1]", element.getContent().toString());
35         QueryEl q = (QueryEl) elements.get(1);
36         assertEquals("/etl/query[1]", q.getContent().toString());
37         element=q.getChildScriptinglElements().get(0);
38         assertEquals("/etl/query[1]/script[1]", element.getContent().toString());
39     }
40
41     /**
42      * Tests if {@link scriptella.configuration.ContentEl#open()} returns a correct text.
43      */

44     public void testContent() {
45         EtlExecutor ex = newEtlExecutor();
46         List JavaDoc<ScriptingElement> elements = ex.getConfiguration().getScriptingElements();
47         ScriptingElement element = elements.get(0);
48         assertEquals("Script", asString(element.getContent()));
49     }
50
51
52 }
53
Popular Tags