01: /*
02: * Copyright 2006-2007 The Scriptella Project Team.
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 scriptella.driver.xpath;
17:
18: import scriptella.AbstractTestCase;
19: import scriptella.execution.EtlExecutor;
20: import scriptella.execution.EtlExecutorException;
21:
22: import java.io.ByteArrayOutputStream;
23: import java.io.IOException;
24: import java.io.InputStream;
25: import java.io.OutputStream;
26: import java.io.UnsupportedEncodingException;
27: import java.net.URL;
28:
29: /**
30: * Integration test for {@link scriptella.driver.xpath.Driver XPath driver}.
31: */
32: public class XPathDriverITest extends AbstractTestCase {
33: private ByteArrayOutputStream o;
34:
35: protected void setUp() throws Exception {
36:
37: o = new ByteArrayOutputStream();
38: testURLHandler = new TestURLHandler() {
39:
40: public InputStream getInputStream(final URL u)
41: throws IOException {
42: throw new UnsupportedOperationException();
43: }
44:
45: public OutputStream getOutputStream(final URL u) {
46: return o;
47: }
48:
49: public int getContentLength(final URL u) {
50: return -1;
51: }
52: };
53: }
54:
55: public void test() throws EtlExecutorException,
56: UnsupportedEncodingException {
57: EtlExecutor e = newEtlExecutor();
58: e.execute();
59: assertNotNull(o);
60: assertEquals("1;2\n3;4\n5;6\n", new String(o.toByteArray()));
61: }
62:
63: }
|