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.core.resolve;
19:
20: import java.io.File;
21:
22: import junit.framework.TestCase;
23:
24: import org.apache.ivy.Ivy;
25: import org.apache.ivy.core.module.id.ModuleRevisionId;
26: import org.apache.ivy.core.report.ResolveReport;
27: import org.apache.ivy.util.CacheCleaner;
28:
29: public class ResolveEngineTest extends TestCase {
30:
31: private Ivy ivy;
32:
33: private File cache;
34:
35: protected void setUp() throws Exception {
36: cache = new File("build/cache");
37: System.setProperty("ivy.cache.dir", cache.getAbsolutePath());
38: createCache();
39:
40: ivy = Ivy.newInstance();
41: ivy.configure(new File("test/repositories/ivysettings.xml"));
42: }
43:
44: protected void tearDown() throws Exception {
45: CacheCleaner.deleteDir(cache);
46: }
47:
48: public void testInlineResolveWithNonExistingModule()
49: throws Exception {
50: ResolveEngine engine = new ResolveEngine(ivy.getSettings(), ivy
51: .getEventManager(), ivy.getSortEngine());
52:
53: ResolveOptions options = new ResolveOptions();
54: options.setConfs(new String[] { "*" });
55:
56: ModuleRevisionId mRevId = ModuleRevisionId.newInstance(
57: "org1XX", "mod1.0XX", "1.0XX");
58: ResolveReport report = engine.resolve(mRevId, options, true);
59:
60: assertNotNull("The ResolveReport may never be null", report);
61: assertTrue(report.hasError());
62: assertTrue(report.getModuleIds().isEmpty());
63: }
64:
65: private void createCache() {
66: cache.mkdirs();
67: }
68: }
|