use of org.apache.ivy.core.event.EventManager in project ant-ivy by apache.
the class JarResolverTest method setUp.
@Before
public void setUp() {
settings = new IvySettings();
engine = new ResolveEngine(settings, new EventManager(), new SortEngine(settings));
cache = new File("build/cache");
data = new ResolveData(engine, new ResolveOptions());
cache.mkdirs();
settings.setDefaultCache(cache);
cacheManager = (DefaultRepositoryCacheManager) settings.getDefaultRepositoryCacheManager();
}
use of org.apache.ivy.core.event.EventManager in project ant-ivy by apache.
the class Maven2LocalTest method setUp.
@Before
public void setUp() {
settings = new IvySettings();
engine = new ResolveEngine(settings, new EventManager(), new SortEngine(settings));
cache = new File("build/cache");
data = new ResolveData(engine, new ResolveOptions());
cache.mkdirs();
settings.setDefaultCache(cache);
}
use of org.apache.ivy.core.event.EventManager in project ant-ivy by apache.
the class URLResolverTest method setUp.
@Before
public void setUp() {
settings = new IvySettings();
engine = new ResolveEngine(settings, new EventManager(), new SortEngine(settings));
data = new ResolveData(engine, new ResolveOptions());
TestHelper.createCache();
settings.setDefaultCache(TestHelper.cache);
}
use of org.apache.ivy.core.event.EventManager in project ant-ivy by apache.
the class PublishEngineTest method testAtomicity.
@Test
public void testAtomicity() throws Exception {
IvySettings settings = new IvySettings();
final PublishEngine engine = new PublishEngine(settings, new EventManager());
final int[] counter = new int[] { 0 };
final DefaultModuleDescriptor md = DefaultModuleDescriptor.newDefaultInstance(ModuleRevisionId.parse("#A;1.0"));
final FileSystemResolver resolver = new FileSystemResolver() {
public void publish(Artifact artifact, File src, boolean overwrite) throws IOException {
super.publish(artifact, src, overwrite);
synchronized (PublishEngineTest.this) {
counter[0]++;
}
sleepSilently(50);
synchronized (PublishEngineTest.this) {
counter[0]++;
}
}
};
resolver.setName("test");
resolver.setSettings(settings);
String publishRepoDir = new File("build/test/publish/repo").getAbsolutePath();
resolver.addIvyPattern(publishRepoDir + "/[module]/[revision]/[artifact].[ext]");
resolver.addArtifactPattern(publishRepoDir + "/[module]/[revision]/[artifact].[ext]");
FileUtil.copy(new File("test/repositories/1/org1/mod1.1/jars/mod1.1-1.0.jar"), new File("build/test/publish/module/A.jar"), null);
XmlModuleDescriptorWriter.write(md, new File("build/test/publish/module/ivy.xml"));
resolveAndAssertNotFound(settings, resolver, "#A;latest.integration", "before publishing");
// run publish asynchronously
new Thread() {
public void run() {
try {
engine.publish(md, Collections.singletonList("build/test/publish/module/[artifact].[ext]"), resolver, new PublishOptions().setSrcIvyPattern("build/test/publish/module/[artifact].[ext]"));
synchronized (PublishEngineTest.this) {
counter[0]++;
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}.start();
while (true) {
sleepSilently(5);
synchronized (this) {
if (counter[0] == 5) {
break;
} else if (counter[0] < 4) {
resolveAndAssertNotFound(settings, resolver, "#A;latest.integration", "after " + (counter[0] / 2) + " artifacts published");
}
}
}
resolveAndAssertFound(settings, resolver, "#A;1.0");
}
use of org.apache.ivy.core.event.EventManager in project ant-ivy by apache.
the class RepositoryManagementEngineTest method setUp.
@Before
public void setUp() {
fixture = new TestFixture();
IvySettings settings = fixture.getSettings();
repository = new RepositoryManagementEngine(settings, new SearchEngine(settings), new ResolveEngine(settings, new EventManager(), new SortEngine(settings)));
}
Aggregations