use of org.apache.ivy.util.MockMessageLogger in project ant-ivy by apache.
the class IBiblioResolverTest method testErrorReport.
@Test
public void testErrorReport() throws Exception {
IBiblioResolver resolver = new IBiblioResolver();
resolver.setRoot("http://unknown.host.comx/");
resolver.setName("test");
resolver.setM2compatible(true);
resolver.setSettings(settings);
assertEquals("test", resolver.getName());
MockMessageLogger mockMessageImpl = new MockMessageLogger();
IvyContext.getContext().getIvy().getLoggerEngine().setDefaultLogger(mockMessageImpl);
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org.apache", "commons-fileupload", "1.0");
ResolvedModuleRevision rmr = resolver.getDependency(new DefaultDependencyDescriptor(mrid, false), data);
assertNull(rmr);
mockMessageImpl.assertLogContains("tried http://unknown.host.comx/org/apache/commons-fileupload/1.0/commons-fileupload-1.0.pom");
mockMessageImpl.assertLogContains("tried http://unknown.host.comx/org/apache/commons-fileupload/1.0/commons-fileupload-1.0.jar");
}
use of org.apache.ivy.util.MockMessageLogger in project ant-ivy by apache.
the class BintrayResolverTest method testErrorReport.
@Test
public void testErrorReport() throws Exception {
BintrayResolver resolver = new BintrayResolver();
resolver.setSubject("unknown");
resolver.setRepo("unknown");
resolver.setName("test");
resolver.setM2compatible(true);
resolver.setSettings(settings);
assertEquals("test", resolver.getName());
MockMessageLogger mockMessageImpl = new MockMessageLogger();
IvyContext.getContext().getIvy().getLoggerEngine().setDefaultLogger(mockMessageImpl);
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org.apache", "commons-fileupload", "1.0");
ResolvedModuleRevision rmr = resolver.getDependency(new DefaultDependencyDescriptor(mrid, false), data);
assertNull(rmr);
mockMessageImpl.assertLogContains("trying https://dl.bintray.com/unknown/unknown/org/apache/commons-fileupload/1.0/commons-fileupload-1.0.jar");
mockMessageImpl.assertLogContains("tried https://dl.bintray.com/unknown/unknown/org/apache/commons-fileupload/1.0/commons-fileupload-1.0.jar");
}
use of org.apache.ivy.util.MockMessageLogger in project ant-ivy by apache.
the class ChainResolverTest method testDownloadWithDual.
@Test
public void testDownloadWithDual() {
ChainResolver chain = new ChainResolver();
chain.setName("chain");
chain.setSettings(settings);
chain.setDual(true);
// first resolver has only an artifact pattern which don't lead to anything: it won't find
// the module
FileSystemResolver resolver = new FileSystemResolver();
resolver.setName("1");
resolver.setSettings(settings);
resolver.addArtifactPattern(settings.getBaseDir() + "/test/repositories/nowhere/[organisation]/[module]/[type]s/[artifact]-[revision].[type]");
chain.add(resolver);
resolver = new FileSystemResolver();
resolver.setName("2");
resolver.setSettings(settings);
resolver.addIvyPattern(settings.getBaseDir() + "/test/repositories/1/[organisation]/[module]/ivys/ivy-[revision].xml");
resolver.addArtifactPattern(settings.getBaseDir() + "/test/repositories/1/[organisation]/[module]/[type]s/[artifact]-[revision].[type]");
chain.add(resolver);
settings.addResolver(chain);
MockMessageLogger mockLogger = new MockMessageLogger();
IvyContext.getContext().getIvy().getLoggerEngine().setDefaultLogger(mockLogger);
DownloadReport report = chain.download(new Artifact[] { new DefaultArtifact(ModuleRevisionId.parse("org1#mod1.1;1.0"), new Date(), "mod1.1", "jar", "jar") }, new DownloadOptions());
assertNotNull(report);
assertEquals(1, report.getArtifactsReports().length);
assertEquals(DownloadStatus.SUCCESSFUL, report.getArtifactsReports()[0].getDownloadStatus());
mockLogger.assertLogDoesntContain("[FAILED ] org1#mod1.1;1.0!mod1.1.jar");
}
use of org.apache.ivy.util.MockMessageLogger in project ant-ivy by apache.
the class RetrieveTest method testRetrieveSameFileConflict.
@Test
public void testRetrieveSameFileConflict() throws Exception {
// mod1.1 depends on mod1.2
ResolveReport report = ivy.resolve(new File("test/repositories/1/org1/mod1.4/ivys/ivy-1.0.1.xml").toURI().toURL(), getResolveOptions(new String[] { "*" }));
assertNotNull(report);
ModuleDescriptor md = report.getModuleDescriptor();
assertNotNull(md);
String pattern = "build/test/retrieve/[module]/[artifact]-[revision].[ext]";
MockMessageLogger mockLogger = new MockMessageLogger();
Message.setDefaultLogger(mockLogger);
ivy.retrieve(md.getModuleRevisionId(), getRetrieveOptions().setDestArtifactPattern(pattern));
assertTrue(new File(IvyPatternHelper.substitute(pattern, "org1", "mod1.2", "2.2", "mod1.2", "jar", "jar", "default")).exists());
mockLogger.assertLogDoesntContain("conflict on");
}
use of org.apache.ivy.util.MockMessageLogger in project ant-ivy by apache.
the class WarnCircularDependencyStrategyTest method setUp.
@Before
public void setUp() {
// setup a new IvyContext for each test
IvyContext.pushNewContext();
strategy = WarnCircularDependencyStrategy.getInstance();
mockMessageLogger = new MockMessageLogger();
loggerEngine = setupMockLogger(mockMessageLogger);
}
Aggregations