KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > scriptella > driver > xpath > XPathDriverITest


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.driver.xpath;
17
18 import scriptella.AbstractTestCase;
19 import scriptella.execution.EtlExecutor;
20 import scriptella.execution.EtlExecutorException;
21
22 import java.io.ByteArrayOutputStream JavaDoc;
23 import java.io.IOException JavaDoc;
24 import java.io.InputStream JavaDoc;
25 import java.io.OutputStream JavaDoc;
26 import java.io.UnsupportedEncodingException JavaDoc;
27 import java.net.URL JavaDoc;
28
29 /**
30  * Integration test for {@link scriptella.driver.xpath.Driver XPath driver}.
31  */

32 public class XPathDriverITest extends AbstractTestCase {
33     private ByteArrayOutputStream JavaDoc o;
34
35     protected void setUp() throws Exception JavaDoc {
36
37         o = new ByteArrayOutputStream JavaDoc();
38         testURLHandler = new TestURLHandler() {
39
40             public InputStream JavaDoc getInputStream(final URL JavaDoc u) throws IOException JavaDoc {
41                 throw new UnsupportedOperationException JavaDoc();
42             }
43
44             public OutputStream JavaDoc getOutputStream(final URL JavaDoc u) {
45                 return o;
46             }
47
48             public int getContentLength(final URL JavaDoc u) {
49                 return -1;
50             }
51         };
52     }
53
54
55     public void test() throws EtlExecutorException, UnsupportedEncodingException JavaDoc {
56         EtlExecutor e = newEtlExecutor();
57         e.execute();
58         assertNotNull(o);
59         assertEquals("1;2\n3;4\n5;6\n", new String JavaDoc(o.toByteArray()));
60     }
61
62 }
63
Popular Tags