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 IvyArtifactReportTest extends TestCase {
28: private File cache;
29:
30: private IvyArtifactReport prop;
31:
32: private Project project;
33:
34: protected void setUp() throws Exception {
35: createCache();
36: project = new Project();
37: project.setProperty("ivy.settings.file",
38: "test/repositories/ivysettings.xml");
39:
40: prop = new IvyArtifactReport();
41: prop.setProject(project);
42: System.setProperty("ivy.cache.dir", cache.getAbsolutePath());
43: }
44:
45: private void createCache() {
46: cache = new File("build/cache");
47: cache.mkdirs();
48: }
49:
50: protected void tearDown() throws Exception {
51: cleanCache();
52: }
53:
54: private void cleanCache() {
55: Delete del = new Delete();
56: del.setProject(new Project());
57: del.setDir(cache);
58: del.execute();
59: }
60:
61: public void testSimple() throws Exception {
62: prop.setTofile(new File("build/test-artifact-report.xml"));
63: prop.setFile(new File(
64: "test/java/org/apache/ivy/ant/ivy-simple.xml"));
65: prop.execute();
66:
67: assertTrue(new File("build/test-artifact-report.xml").exists());
68: }
69: }
|