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: import org.apache.tools.ant.taskdefs.Delete;
26:
27: public class IvyRepositoryReportTest extends TestCase {
28: private File cache;
29:
30: private IvyRepositoryReport report;
31:
32: protected void setUp() throws Exception {
33: createCache();
34: Project project = new Project();
35: project.setProperty("ivy.settings.file",
36: "test/repositories/ivysettings-1.xml");
37:
38: report = new IvyRepositoryReport();
39: report.setProject(project);
40: System.setProperty("ivy.cache.dir", cache.getAbsolutePath());
41: }
42:
43: private void createCache() {
44: cache = new File("build/cache");
45: cache.mkdirs();
46: }
47:
48: protected void tearDown() throws Exception {
49: cleanCache();
50: }
51:
52: private void cleanCache() {
53: Delete del = new Delete();
54: del.setProject(new Project());
55: del.setDir(cache);
56: del.execute();
57: }
58:
59: public void test() {
60: }
61:
62: // no xslt transformation is possible in the junit test on our continuous integration server for
63: // the moment...
64: // public void testGraph() throws Exception {
65: // _report.setOrganisation("org1");
66: // _report.setXml(false);
67: // _report.setGraph(true);
68: // _report.setTodir(_cache);
69: // _report.setOutputname("test-graph");
70: // _report.execute();
71: // File graphml = new File(_cache, "test-graph.graphml");
72: // assertTrue(graphml.exists());
73: // String g = FileUtil.readEntirely(new BufferedReader(new FileReader(graphml)));
74: // assertFalse(g.indexOf("caller") != -1);
75: // assertTrue(g.indexOf("mod1.1") != -1);
76: // }
77: //
78: // public void testDot() throws Exception {
79: // _report.setOrganisation("org1");
80: // _report.setXml(false);
81: // _report.setDot(true);
82: // _report.setTodir(_cache);
83: // _report.setOutputname("test-graph");
84: // _report.execute();
85: // File dot = new File(_cache, "test-graph.dot");
86: // assertTrue(dot.exists());
87: // String g = FileUtil.readEntirely(new BufferedReader(new FileReader(dot)));
88: // assertFalse(g.indexOf("caller") != -1);
89: // assertTrue(g.indexOf("mod1.1") != -1);
90: // }
91: }
|