001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: *
017: */
018: package org.apache.ivy.plugins.resolver;
019:
020: import java.io.File;
021: import java.util.Arrays;
022: import java.util.Collections;
023: import java.util.Date;
024: import java.util.GregorianCalendar;
025: import java.util.List;
026:
027: import org.apache.ivy.core.IvyContext;
028: import org.apache.ivy.core.event.EventManager;
029: import org.apache.ivy.core.module.descriptor.Artifact;
030: import org.apache.ivy.core.module.descriptor.DefaultArtifact;
031: import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor;
032: import org.apache.ivy.core.module.descriptor.DependencyDescriptor;
033: import org.apache.ivy.core.module.id.ModuleRevisionId;
034: import org.apache.ivy.core.report.DownloadReport;
035: import org.apache.ivy.core.report.DownloadStatus;
036: import org.apache.ivy.core.resolve.DownloadOptions;
037: import org.apache.ivy.core.resolve.ResolveData;
038: import org.apache.ivy.core.resolve.ResolveEngine;
039: import org.apache.ivy.core.resolve.ResolveOptions;
040: import org.apache.ivy.core.resolve.ResolvedModuleRevision;
041: import org.apache.ivy.core.settings.IvySettings;
042: import org.apache.ivy.core.settings.XmlSettingsParser;
043: import org.apache.ivy.core.sort.SortEngine;
044: import org.apache.ivy.plugins.latest.LatestRevisionStrategy;
045: import org.apache.ivy.plugins.latest.LatestTimeStrategy;
046: import org.apache.ivy.util.MockMessageLogger;
047: import org.apache.tools.ant.Project;
048: import org.apache.tools.ant.taskdefs.Delete;
049:
050: /**
051: * Tests ChainResolver
052: */
053: public class ChainResolverTest extends AbstractDependencyResolverTest {
054: private IvySettings settings;
055:
056: private ResolveEngine engine;
057:
058: private ResolveData data;
059:
060: private File cache;
061:
062: protected void setUp() throws Exception {
063: settings = new IvySettings();
064: engine = new ResolveEngine(settings, new EventManager(),
065: new SortEngine(settings));
066: cache = new File("build/cache");
067: data = new ResolveData(engine, new ResolveOptions());
068: cache.mkdirs();
069: settings.setDefaultCache(cache);
070: }
071:
072: protected void tearDown() throws Exception {
073: Delete del = new Delete();
074: del.setProject(new Project());
075: del.setDir(cache);
076: del.execute();
077: }
078:
079: public void testOrderFromConf() throws Exception {
080: new XmlSettingsParser(settings).parse(ChainResolverTest.class
081: .getResource("chainresolverconf.xml"));
082: DependencyResolver resolver = settings.getResolver("chain");
083: assertNotNull(resolver);
084: assertTrue(resolver instanceof ChainResolver);
085: ChainResolver chain = (ChainResolver) resolver;
086: assertResolversSizeAndNames(chain, 3);
087: }
088:
089: private void assertResolversSizeAndNames(ChainResolver chain,
090: int size) {
091: List resolvers = chain.getResolvers();
092: assertEquals(size, resolvers.size());
093: for (int i = 0; i < resolvers.size(); i++) {
094: DependencyResolver r = (DependencyResolver) resolvers
095: .get(i);
096: assertEquals(String.valueOf(i + 1), r.getName());
097: }
098: }
099:
100: public void testName() throws Exception {
101: ChainResolver chain = new ChainResolver();
102: chain.setSettings(settings);
103: chain.setName("chain");
104: assertEquals("chain", chain.getName());
105: }
106:
107: public void testResolveOrder() throws Exception {
108: ChainResolver chain = new ChainResolver();
109: chain.setName("chain");
110: chain.setSettings(settings);
111: MockResolver[] resolvers = new MockResolver[] {
112: MockResolver.buildMockResolver("1", false, null),
113: MockResolver.buildMockResolver("2", true, null),
114: MockResolver.buildMockResolver("3", true, null) };
115: for (int i = 0; i < resolvers.length; i++) {
116: chain.add(resolvers[i]);
117: }
118: assertResolversSizeAndNames(chain, resolvers.length);
119:
120: DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(
121: ModuleRevisionId.newInstance("org", "mod", "rev"),
122: false);
123: ResolvedModuleRevision rmr = chain.getDependency(dd, data);
124: assertNotNull(rmr);
125: assertEquals("2", rmr.getResolver().getName());
126: assertEquals(Arrays.asList(new DependencyDescriptor[] { dd }),
127: resolvers[0].askedDeps);
128: assertEquals(Arrays.asList(new DependencyDescriptor[] { dd }),
129: resolvers[1].askedDeps);
130: assertTrue(resolvers[2].askedDeps.isEmpty());
131: }
132:
133: public void testLatestTimeResolve() throws Exception {
134: ChainResolver chain = new ChainResolver();
135: chain.setName("chain");
136: chain.setSettings(settings);
137: chain.setLatestStrategy(new LatestTimeStrategy());
138: MockResolver[] resolvers = new MockResolver[] {
139: MockResolver.buildMockResolver("1", true,
140: new GregorianCalendar(2005, 1, 20).getTime()),
141: MockResolver.buildMockResolver("2", false, null),
142: MockResolver.buildMockResolver("3", true,
143: new GregorianCalendar(2005, 1, 25).getTime()), // younger -> should the one kept
144: MockResolver.buildMockResolver("4", false, null),
145: MockResolver.buildMockResolver("5", true,
146: new GregorianCalendar(2005, 1, 22).getTime()),
147: MockResolver.buildMockResolver("6", true,
148: new GregorianCalendar(2005, 1, 18).getTime()),
149: MockResolver.buildMockResolver("7", false, null) };
150: for (int i = 0; i < resolvers.length; i++) {
151: chain.add(resolvers[i]);
152: }
153: assertResolversSizeAndNames(chain, resolvers.length);
154:
155: DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(
156: ModuleRevisionId.newInstance("org", "mod",
157: "latest.integration"), false);
158: ResolvedModuleRevision rmr = chain.getDependency(dd, data);
159: assertNotNull(rmr);
160: assertEquals("3", rmr.getResolver().getName());
161: List ddAsList = Arrays
162: .asList(new DependencyDescriptor[] { dd });
163: for (int i = 0; i < resolvers.length; i++) {
164: assertEquals(ddAsList, resolvers[i].askedDeps);
165: }
166: }
167:
168: public void testLatestRevisionResolve() throws Exception {
169: ChainResolver chain = new ChainResolver();
170: chain.setName("chain");
171: chain.setSettings(settings);
172: chain.setLatestStrategy(new LatestRevisionStrategy());
173: MockResolver[] resolvers = new MockResolver[] {
174: MockResolver
175: .buildMockResolver("1", true, ModuleRevisionId
176: .newInstance("org", "mod", "1"),
177: new GregorianCalendar(2005, 1, 20)
178: .getTime()),
179: MockResolver.buildMockResolver("2", false, null),
180: MockResolver
181: .buildMockResolver("3", true, ModuleRevisionId
182: .newInstance("org", "mod", "2"),
183: new GregorianCalendar(2005, 1, 25)
184: .getTime()),
185: MockResolver.buildMockResolver("4", false, null),
186: MockResolver
187: .buildMockResolver("5", true, ModuleRevisionId
188: .newInstance("org", "mod", "4"),
189: new GregorianCalendar(2005, 1, 22)
190: .getTime()), // latest ->
191: // should the
192: // one kept
193: MockResolver
194: .buildMockResolver("6", true, ModuleRevisionId
195: .newInstance("org", "mod", "3"),
196: new GregorianCalendar(2005, 1, 18)
197: .getTime()),
198: MockResolver.buildMockResolver("7", false, null) };
199: for (int i = 0; i < resolvers.length; i++) {
200: chain.add(resolvers[i]);
201: }
202: assertResolversSizeAndNames(chain, resolvers.length);
203:
204: DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(
205: ModuleRevisionId.newInstance("org", "mod",
206: "latest.integration"), false);
207: ResolvedModuleRevision rmr = chain.getDependency(dd, data);
208: assertNotNull(rmr);
209: assertEquals("5", rmr.getResolver().getName());
210: List ddAsList = Arrays
211: .asList(new DependencyDescriptor[] { dd });
212: for (int i = 0; i < resolvers.length; i++) {
213: assertEquals(ddAsList, resolvers[i].askedDeps);
214: }
215: }
216:
217: public void testWithDefault() throws Exception {
218: ChainResolver chain = new ChainResolver();
219: chain.setName("chain");
220: chain.setSettings(settings);
221: chain.setLatestStrategy(new LatestRevisionStrategy());
222: MockResolver[] resolvers = new MockResolver[] {
223: MockResolver.buildMockResolver("1", false, null),
224: MockResolver
225: .buildMockResolver("2", true, ModuleRevisionId
226: .newInstance("org", "mod", "4"),
227: new GregorianCalendar(2005, 1, 22)
228: .getTime(), true), // latest
229: // ->
230: // but
231: // default
232: MockResolver.buildMockResolver("3", false, null),
233: MockResolver.buildMockResolver("4", false, null),
234: MockResolver
235: .buildMockResolver("5", true, ModuleRevisionId
236: .newInstance("org", "mod", "4"),
237: new GregorianCalendar(2005, 1, 22)
238: .getTime()), // latest ->
239: // should the
240: // one kept
241: MockResolver.buildMockResolver("6", false, null),
242: MockResolver.buildMockResolver("7", false, null) };
243: for (int i = 0; i < resolvers.length; i++) {
244: chain.add(resolvers[i]);
245: }
246: assertResolversSizeAndNames(chain, resolvers.length);
247:
248: DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(
249: ModuleRevisionId.newInstance("org", "mod", "4"), false);
250: ResolvedModuleRevision rmr = chain.getDependency(dd, data);
251: assertNotNull(rmr);
252: assertEquals("5", rmr.getResolver().getName());
253: List ddAsList = Arrays
254: .asList(new DependencyDescriptor[] { dd });
255: for (int i = 0; i < 5; i++) {
256: assertEquals(ddAsList, resolvers[i].askedDeps);
257: }
258: for (int i = 5; i < resolvers.length; i++) {
259: assertTrue(resolvers[i].askedDeps.isEmpty());
260: }
261: }
262:
263: public void testLatestWithDefault() throws Exception {
264: ChainResolver chain = new ChainResolver();
265: chain.setName("chain");
266: chain.setSettings(settings);
267: chain.setLatestStrategy(new LatestRevisionStrategy());
268: MockResolver[] resolvers = new MockResolver[] {
269: MockResolver
270: .buildMockResolver("1", true, ModuleRevisionId
271: .newInstance("org", "mod", "1"),
272: new GregorianCalendar(2005, 1, 20)
273: .getTime()),
274: MockResolver
275: .buildMockResolver("2", true, ModuleRevisionId
276: .newInstance("org", "mod", "4"),
277: new GregorianCalendar(2005, 1, 22)
278: .getTime(), true), // latest
279: // ->
280: // but
281: // default
282: MockResolver
283: .buildMockResolver("3", true, ModuleRevisionId
284: .newInstance("org", "mod", "2"),
285: new GregorianCalendar(2005, 1, 25)
286: .getTime()),
287: MockResolver.buildMockResolver("4", false, null),
288: MockResolver
289: .buildMockResolver("5", true, ModuleRevisionId
290: .newInstance("org", "mod", "4"),
291: new GregorianCalendar(2005, 1, 22)
292: .getTime()), // latest ->
293: // should the
294: // one kept
295: MockResolver
296: .buildMockResolver("6", true, ModuleRevisionId
297: .newInstance("org", "mod", "3"),
298: new GregorianCalendar(2005, 1, 18)
299: .getTime()),
300: MockResolver.buildMockResolver("7", false, null) };
301: for (int i = 0; i < resolvers.length; i++) {
302: chain.add(resolvers[i]);
303: }
304: assertResolversSizeAndNames(chain, resolvers.length);
305:
306: DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(
307: ModuleRevisionId.newInstance("org", "mod",
308: "latest.integration"), false);
309: ResolvedModuleRevision rmr = chain.getDependency(dd, data);
310: assertNotNull(rmr);
311: assertEquals("5", rmr.getResolver().getName());
312: List ddAsList = Arrays
313: .asList(new DependencyDescriptor[] { dd });
314: for (int i = 0; i < resolvers.length; i++) {
315: assertEquals(ddAsList, resolvers[i].askedDeps);
316: }
317: }
318:
319: public void testFixedWithDefault() throws Exception {
320: ChainResolver chain = new ChainResolver();
321: chain.setName("chain");
322: chain.setSettings(settings);
323: chain.setLatestStrategy(new LatestRevisionStrategy());
324: MockResolver[] resolvers = new MockResolver[] {
325: MockResolver.buildMockResolver("1", false, null),
326: MockResolver
327: .buildMockResolver("2", true, ModuleRevisionId
328: .newInstance("org", "mod", "4"),
329: new GregorianCalendar(2005, 1, 22)
330: .getTime(), true), // default
331: MockResolver.buildMockResolver("3", false, null),
332: MockResolver
333: .buildMockResolver("4", true, ModuleRevisionId
334: .newInstance("org", "mod", "4"),
335: new GregorianCalendar(2005, 1, 22)
336: .getTime()), // not default
337: // -> should the
338: // one kept
339: MockResolver.buildMockResolver("5", false, null) };
340: for (int i = 0; i < resolvers.length; i++) {
341: chain.add(resolvers[i]);
342: }
343: assertResolversSizeAndNames(chain, resolvers.length);
344:
345: DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(
346: ModuleRevisionId.newInstance("org", "mod", "4"), false);
347: ResolvedModuleRevision rmr = chain.getDependency(dd, data);
348: assertNotNull(rmr);
349: assertEquals("4", rmr.getResolver().getName());
350: List ddAsList = Arrays
351: .asList(new DependencyDescriptor[] { dd });
352: for (int i = 0; i < 4; i++) {
353: assertEquals("invalid asked dependencies for "
354: + resolvers[i], ddAsList, resolvers[i].askedDeps);
355: }
356: for (int i = 4; i < resolvers.length; i++) {
357: assertTrue(
358: "invalid asked dependencies for " + resolvers[i],
359: resolvers[i].askedDeps.isEmpty());
360: }
361: }
362:
363: public void testFixedWithDefaultAndRealResolver() throws Exception {
364: // test case for IVY-206
365: ChainResolver chain = new ChainResolver();
366: chain.setName("chain");
367: chain.setSettings(settings);
368:
369: // no ivy pattern for first resolver: will only find a 'default' module
370: FileSystemResolver resolver = new FileSystemResolver();
371: resolver.setName("1");
372: resolver.setSettings(settings);
373:
374: resolver
375: .addArtifactPattern("test/repositories/1/[organisation]/[module]/[type]s/[artifact]-[revision].[type]");
376: chain.add(resolver);
377:
378: // second resolver has an ivy pattern and will thus find the real module, which should be
379: // kept
380: resolver = new FileSystemResolver();
381: resolver.setName("2");
382: resolver.setSettings(settings);
383:
384: resolver
385: .addIvyPattern("test/repositories/1/[organisation]/[module]/ivys/ivy-[revision].xml");
386: resolver
387: .addArtifactPattern("test/repositories/1/[organisation]/[module]/[type]s/[artifact]-[revision].[type]");
388: chain.add(resolver);
389:
390: settings.addResolver(chain);
391:
392: DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(
393: ModuleRevisionId.newInstance("org1", "mod1.1", "1.0"),
394: false);
395: ResolvedModuleRevision rmr = chain.getDependency(dd, data);
396: assertNotNull(rmr);
397: assertEquals("2", rmr.getResolver().getName());
398: }
399:
400: public void testUseCache() throws Exception {
401: DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(
402: ModuleRevisionId.newInstance("org1", "mod1.1", "1.0"),
403: false);
404: // resolve dependency twice
405: chainToPutDefaultModuleInCache().getDependency(dd, data);
406:
407: ChainResolver chain = new ChainResolver();
408: chain.setName("chain");
409: chain.setSettings(settings);
410: MockResolver[] resolvers = new MockResolver[] { MockResolver
411: .buildMockResolver("1", true, null) };
412: for (int i = 0; i < resolvers.length; i++) {
413: chain.add(resolvers[i]);
414: }
415: chain.getDependency(dd, data);
416: // should not have asked any dependency, should have hit the cache
417: assertEquals(Collections.EMPTY_LIST, resolvers[0].askedDeps);
418: }
419:
420: public void testReturnFirst() throws Exception {
421: ChainResolver chain = new ChainResolver();
422: chain.setName("chain");
423: chain.setSettings(settings);
424: chain.setReturnFirst(true);
425:
426: MockResolver[] resolvers = new MockResolver[] {
427: MockResolver.buildMockResolver("1", true,
428: new GregorianCalendar(2005, 1, 20).getTime()),
429: MockResolver.buildMockResolver("2", false, null),
430: MockResolver.buildMockResolver("3", true,
431: new GregorianCalendar(2005, 1, 25).getTime()), // younger -> should the one kept
432: MockResolver.buildMockResolver("4", false, null),
433: MockResolver.buildMockResolver("5", true,
434: new GregorianCalendar(2005, 1, 22).getTime()),
435: MockResolver.buildMockResolver("6", true,
436: new GregorianCalendar(2005, 1, 18).getTime()),
437: MockResolver.buildMockResolver("7", false, null) };
438: for (int i = 0; i < resolvers.length; i++) {
439: chain.add(resolvers[i]);
440: }
441: assertResolversSizeAndNames(chain, resolvers.length);
442:
443: DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(
444: ModuleRevisionId.newInstance("org", "mod",
445: "latest.integration"), false);
446: ResolvedModuleRevision rmr = chain.getDependency(dd, data);
447: assertNotNull(rmr);
448: assertEquals("1", rmr.getResolver().getName());
449: for (int i = 1; i < resolvers.length; i++) {
450: assertTrue(resolvers[i].askedDeps.isEmpty());
451: }
452: }
453:
454: public void testReturnFirstWithDefaultAndCacheAndRealResolver()
455: throws Exception {
456: // test case for IVY-389
457: DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(
458: ModuleRevisionId.newInstance("org1", "mod1.1", "1.0"),
459: false);
460:
461: // 1 ---- we first do a first resolve which puts a default file in cache
462: chainToPutDefaultModuleInCache().getDependency(dd, data);
463:
464: // 2 ---- now we ask to resolve dependencies with a chain in return first mode with check
465: // modified = false, in which the first resolver is not able to find the module, but the
466: // second is
467: ChainResolver chain = returnFirstChain();
468:
469: ResolvedModuleRevision rmr = chain.getDependency(dd, data);
470: assertNotNull(rmr);
471: // the module returned should be the default one found in cache since check modified is false
472: assertEquals(true, rmr.getDescriptor().isDefault());
473: }
474:
475: public void testReturnFirstWithCheckModifiedAndDefaultAndCacheAndRealResolver()
476: throws Exception {
477: // test case for IVY-207
478:
479: DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(
480: ModuleRevisionId.newInstance("org1", "mod1.1", "1.0"),
481: false);
482:
483: // 1 ---- we first do a first resolve which puts a default file in cache
484: chainToPutDefaultModuleInCache().getDependency(dd, data);
485:
486: // 2 ---- now we ask to resolve dependencies with a chain in return first mode, in which the
487: // first resolver is not able to find the module, but the second is
488: ChainResolver chain = returnFirstChain();
489: chain.setCheckmodified(true);
490:
491: ResolvedModuleRevision rmr = chain.getDependency(dd, data);
492: assertNotNull(rmr);
493: assertEquals(false, rmr.getDescriptor().isDefault());
494: assertEquals("2", rmr.getResolver().getName());
495: }
496:
497: private ChainResolver returnFirstChain() {
498: ChainResolver chain = new ChainResolver();
499: chain.setName("chain");
500: chain.setSettings(settings);
501: chain.setReturnFirst(true);
502:
503: // no pattern for first resolver: will not find the module
504: FileSystemResolver resolver = new FileSystemResolver();
505: resolver.setName("1");
506: resolver.setSettings(settings);
507:
508: chain.add(resolver);
509:
510: // second resolver will find the real module, which should be kept
511: resolver = new FileSystemResolver();
512: resolver.setName("2");
513: resolver.setSettings(settings);
514:
515: resolver
516: .addIvyPattern("test/repositories/1/[organisation]/[module]/ivys/ivy-[revision].xml");
517: resolver
518: .addArtifactPattern("test/repositories/1/[organisation]/[module]/[type]s/[artifact]-[revision].[type]");
519: chain.add(resolver);
520:
521: settings.addResolver(chain);
522: return chain;
523: }
524:
525: private ChainResolver chainToPutDefaultModuleInCache() {
526: ChainResolver chain = new ChainResolver();
527: chain.setName("chain");
528: chain.setSettings(settings);
529:
530: // no ivy pattern for resolver: will only find a 'default' module
531: FileSystemResolver resolver = new FileSystemResolver();
532: resolver.setName("old");
533: resolver.setSettings(settings);
534:
535: resolver
536: .addArtifactPattern("test/repositories/1/[organisation]/[module]/[type]s/[artifact]-[revision].[type]");
537: chain.add(resolver);
538:
539: settings.addResolver(chain);
540: return chain;
541: }
542:
543: public void testDual() throws Exception {
544: ChainResolver chain = new ChainResolver();
545: chain.setName("chain");
546: chain.setSettings(settings);
547: chain.setDual(true);
548: MockResolver[] resolvers = new MockResolver[] {
549: MockResolver.buildMockResolver("1", false, null),
550: MockResolver.buildMockResolver("2", true, null),
551: MockResolver.buildMockResolver("3", true, null) };
552: for (int i = 0; i < resolvers.length; i++) {
553: chain.add(resolvers[i]);
554: }
555: assertResolversSizeAndNames(chain, resolvers.length);
556:
557: DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(
558: ModuleRevisionId.newInstance("org", "mod", "rev"),
559: false);
560: ResolvedModuleRevision rmr = chain.getDependency(dd, data);
561: assertNotNull(rmr);
562: assertEquals("2", rmr.getResolver().getName());
563: assertEquals("chain", rmr.getArtifactResolver().getName());
564: }
565:
566: public void testDownloadWithDual() throws Exception {
567: ChainResolver chain = new ChainResolver();
568: chain.setName("chain");
569: chain.setSettings(settings);
570: chain.setDual(true);
571:
572: // first resolver has only an artifact pattern which don't lead to anything: it won't find the module
573: FileSystemResolver resolver = new FileSystemResolver();
574: resolver.setName("1");
575: resolver.setSettings(settings);
576: resolver
577: .addArtifactPattern("test/repositories/nowhere/[organisation]/[module]/[type]s/[artifact]-[revision].[type]");
578:
579: chain.add(resolver);
580:
581: resolver = new FileSystemResolver();
582: resolver.setName("2");
583: resolver.setSettings(settings);
584:
585: resolver
586: .addIvyPattern("test/repositories/1/[organisation]/[module]/ivys/ivy-[revision].xml");
587: resolver
588: .addArtifactPattern("test/repositories/1/[organisation]/[module]/[type]s/[artifact]-[revision].[type]");
589: chain.add(resolver);
590:
591: settings.addResolver(chain);
592:
593: MockMessageLogger mockLogger = new MockMessageLogger();
594: IvyContext.getContext().getIvy().getLoggerEngine()
595: .setDefaultLogger(mockLogger);
596: DownloadReport report = chain.download(
597: new Artifact[] { new DefaultArtifact(ModuleRevisionId
598: .parse("org1#mod1.1;1.0"), new Date(),
599: "mod1.1", "jar", "jar") },
600: new DownloadOptions());
601: assertNotNull(report);
602: assertEquals(1, report.getArtifactsReports().length);
603: assertEquals(DownloadStatus.SUCCESSFUL, report
604: .getArtifactsReports()[0].getDownloadStatus());
605: mockLogger
606: .assertLogDoesntContain("[FAILED ] org1#mod1.1;1.0!mod1.1.jar");
607: }
608:
609: }
|