01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: *
17: */
18: package org.apache.ivy.ant;
19:
20: import java.io.File;
21:
22: import junit.framework.TestCase;
23:
24: import org.apache.tools.ant.Project;
25:
26: public class IvyConvertPomTest extends TestCase {
27: public void testSimple() throws Exception {
28: IvyConvertPom task = new IvyConvertPom();
29: task.setProject(new Project());
30: task.setPomFile(new File(
31: "test/java/org/apache/ivy/ant/test.pom"));
32: File destFile = File.createTempFile("ivy", ".xml");
33: destFile.deleteOnExit();
34: task.setIvyFile(destFile);
35: task.execute();
36:
37: //do not work properly on all platform and depends on the file date
38: //keep the code in comments in case someone manage to fix this and to highlight the fact
39: //that this is not checked
40:
41: // String wrote = FileUtil.readEntirely(new BufferedReader(new FileReader(destFile)));
42: // String expected = readEntirely("test-convertpom.xml").replaceAll("\r\n", "\n").replace(
43: // '\r', '\n');
44: // assertEquals(expected, wrote);
45: }
46:
47: // private String readEntirely(String resource) throws IOException {
48: // return FileUtil.readEntirely(
49: // new BufferedReader(new InputStreamReader(IvyConvertPomTest.class.getResource(resource)
50: // .openStream()))).replaceAll("\r\n", "\n").replace('\r', '\n');
51: // }
52: }
|