source: other-projects/trunk/gs3-release-maker/apache-ant-1.6.5/src/testcases/org/apache/tools/ant/util/ResourceUtilsTest.java@ 14627

Last change on this file since 14627 was 14627, checked in by oranfry, 17 years ago

initial import of the gs3-release-maker

File size: 2.1 KB
Line 
1/*
2 * Copyright 2003-2004 The Apache Software Foundation
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 */
17
18package org.apache.tools.ant.util;
19
20import org.apache.tools.ant.Project;
21import org.apache.tools.ant.taskdefs.Echo;
22import org.apache.tools.ant.types.Resource;
23import org.apache.tools.ant.types.ResourceFactory;
24
25import java.io.File;
26
27import junit.framework.TestCase;
28
29/**
30 * Tests for org.apache.tools.ant.util.ResourceUtils.
31 */
32public class ResourceUtilsTest extends TestCase
33 implements ResourceFactory, FileNameMapper {
34
35 private Echo taskINeedForLogging = new Echo();
36
37 public ResourceUtilsTest(String name) {
38 super(name);
39 taskINeedForLogging.setProject(new Project());
40 }
41
42 public void testNoDuplicates() {
43 Resource r = new Resource("samual vimes", true, 1, false);
44 Resource[] toNew =
45 ResourceUtils.selectOutOfDateSources(taskINeedForLogging,
46 new Resource[] {r},
47 this, this);
48 assertEquals(1, toNew.length);
49 }
50
51 /* ============ ResourceFactory interface ====================== */
52 public Resource getResource(String name) {
53 return new Resource(name); // implies lastModified == 0
54 }
55
56 /* ============ FileNameMapper interface ======================= */
57 public void setFrom(String s) {}
58 public void setTo(String s) {}
59 public String[] mapFileName(String s) {
60 return new String[] {"fred colon", "carrot ironfoundersson"};
61 }
62}
Note: See TracBrowser for help on using the repository browser.