本文整理汇总了Java中org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor类的典型用法代码示例。如果您正苦于以下问题:Java DefaultDependencyDescriptor类的具体用法?Java DefaultDependencyDescriptor怎么用?Java DefaultDependencyDescriptor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DefaultDependencyDescriptor类属于org.apache.ivy.core.module.descriptor包,在下文中一共展示了DefaultDependencyDescriptor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addExtendingConfigurations
import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor; //导入依赖的package包/类
private void addExtendingConfigurations(String conf, DefaultDependencyDescriptor dd,
boolean useDefaultMappingToGuessRightOperande) {
Set configsToAdd = new HashSet();
Configuration[] configs = md.getConfigurations();
for (int i = 0; i < configs.length; i++) {
String[] ext = configs[i].getExtends();
for (int j = 0; j < ext.length; j++) {
if (conf.equals(ext[j])) {
String configName = configs[i].getName();
configsToAdd.add(configName);
addExtendingConfigurations(configName, dd,
useDefaultMappingToGuessRightOperande);
}
}
}
String[] confs = (String[]) configsToAdd.toArray(new String[0]);
parseDepsConfs(confs, dd, useDefaultMappingToGuessRightOperande);
}
示例2: readConfigMappings
import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor; //导入依赖的package包/类
private static Map<String, List<String>> readConfigMappings(DependencyDescriptor dependencyDescriptor) {
if (dependencyDescriptor instanceof DefaultDependencyDescriptor) {
try {
return (Map<String, List<String>>) DEPENDENCY_CONFIG_FIELD.get(dependencyDescriptor);
} catch (IllegalAccessException e) {
throw UncheckedException.throwAsUncheckedException(e);
}
}
String[] modConfs = dependencyDescriptor.getModuleConfigurations();
Map<String, List<String>> results = Maps.newLinkedHashMap();
for (String modConf : modConfs) {
results.put(modConf, Arrays.asList(dependencyDescriptor.getDependencyConfigurations(modConfs)));
}
return results;
}
示例3: create
import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor; //导入依赖的package包/类
public DependencyDescriptor create(DependencyDescriptor source, ModuleRevisionId targetId) {
if (!(source instanceof DefaultDependencyDescriptor)) {
throw new IllegalArgumentException("I can only create descriptors out of DefaultDependencyDescriptor");
}
DefaultDependencyDescriptor out = new DefaultDependencyDescriptor(moduleDescriptor(source), targetId, source.getDynamicConstraintDependencyRevisionId(), source.isForce(), source.isChanging(), source.isTransitive());
setProperty(out, "parentId", getProperty(source, "parentId"));
setProperty(out, "namespace", source.getNamespace());
((Map) getProperty(out, "confs")).putAll((Map) getProperty(source, "confs"));
Map sourceExcludeRules = (Map) getProperty(source, "excludeRules");
setProperty(out, "excludeRules", sourceExcludeRules == null? null: new LinkedHashMap(sourceExcludeRules));
Map sourceIncludeRules = (Map) getProperty(source, "includeRules");
setProperty(out, "includeRules", sourceIncludeRules == null ? null : new LinkedHashMap(sourceIncludeRules));
Map dependencyArtifacts = (Map) getProperty(source, "dependencyArtifacts");
setProperty(out, "dependencyArtifacts", dependencyArtifacts == null? null: new LinkedHashMap(dependencyArtifacts));
setProperty(out, "sourceModule", source.getSourceModule());
return out;
}
示例4: findModule
import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor; //导入依赖的package包/类
public ResolvedModuleRevision findModule(ModuleRevisionId id, ResolveOptions options) {
DependencyResolver r = settings.getResolver(id);
if (r == null) {
throw new IllegalStateException("no resolver found for " + id.getModuleId());
}
DefaultModuleDescriptor md = DefaultModuleDescriptor.newCallerInstance(id,
new String[] {"*"}, false, false);
if (options.getResolveId() == null) {
options.setResolveId(ResolveOptions.getDefaultResolveId(md));
}
try {
return r.getDependency(new DefaultDependencyDescriptor(id, true), new ResolveData(this,
options, new ConfigurationResolveReport(this, md, "default", null, options)));
} catch (ParseException e) {
throw new RuntimeException("problem while parsing repository module descriptor for "
+ id + ": " + e, e);
}
}
示例5: addExtendingConfigurations
import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor; //导入依赖的package包/类
private void addExtendingConfigurations(String conf, DefaultDependencyDescriptor dd,
boolean useDefaultMappingToGuessRightOperand) {
Set<String> configsToAdd = new HashSet<>();
for (Configuration config : md.getConfigurations()) {
for (String ext : config.getExtends()) {
if (conf.equals(ext)) {
String configName = config.getName();
configsToAdd.add(configName);
addExtendingConfigurations(configName, dd,
useDefaultMappingToGuessRightOperand);
}
}
}
parseDepsConfs(configsToAdd.toArray(new String[configsToAdd.size()]),
dd, useDefaultMappingToGuessRightOperand);
}
示例6: testArtifactRef
import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor; //导入依赖的package包/类
@Test
public void testArtifactRef() throws ParseException {
// Simple Dependency for ibiblio
ModuleRevisionId mrid1 = ModuleRevisionId.newInstance("log4j", "log4j", "1.2.16");
ResolvedModuleRevision rmr1 = chain.getDependency(new DefaultDependencyDescriptor(mrid1,
false), data);
// Simple Dependency for updatesite
ModuleRevisionId mrid2 = ModuleRevisionId.newInstance(BundleInfo.BUNDLE_TYPE,
"org.apache.ivy", "2.0.0.final_20090108225011");
ResolvedModuleRevision rmr2 = chain.getDependency(new DefaultDependencyDescriptor(mrid2,
false), data);
assertNotNull(rmr1);
assertNotNull(rmr2);
Artifact[] artifacts1 = rmr1.getDescriptor().getArtifacts("default");
Artifact[] artifacts2 = rmr2.getDescriptor().getArtifacts("default");
chain.exists(artifacts2[0]);
chain.exists(artifacts1[0]);
}
示例7: testResolve
import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor; //导入依赖的package包/类
@Test
public void testResolve() throws Exception {
DualResolver dual = new DualResolver();
MockResolver ivyResolver = MockResolver.buildMockResolver(settings, "ivy", true,
new GregorianCalendar(2005, 1, 20).getTime());
MockResolver artifactResolver = MockResolver.buildMockResolver(settings, "artifact",
false, new GregorianCalendar(2005, 1, 20).getTime());
dual.setIvyResolver(ivyResolver);
dual.setArtifactResolver(artifactResolver);
DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(
ModuleRevisionId.newInstance("org", "mod", "rev"), false);
ResolvedModuleRevision rmr = dual.getDependency(dd, data);
assertNotNull(rmr);
assertEquals(dual, rmr.getArtifactResolver());
assertEquals(Collections.<DependencyDescriptor> singletonList(dd), ivyResolver.askedDeps);
assertTrue(artifactResolver.askedDeps.isEmpty());
}
示例8: testResolveFromArtifact
import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor; //导入依赖的package包/类
@Test
public void testResolveFromArtifact() throws Exception {
DualResolver dual = new DualResolver();
MockResolver ivyResolver = MockResolver.buildMockResolver(settings, "ivy", false,
new GregorianCalendar(2005, 1, 20).getTime());
MockResolver artifactResolver = MockResolver.buildMockResolver(settings, "artifact", true,
new GregorianCalendar(2005, 1, 20).getTime());
dual.setIvyResolver(ivyResolver);
dual.setArtifactResolver(artifactResolver);
DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(
ModuleRevisionId.newInstance("org", "mod", "rev"), false);
ResolvedModuleRevision rmr = dual.getDependency(dd, data);
assertNotNull(rmr);
assertEquals(artifactResolver, rmr.getResolver());
assertEquals(Collections.<DependencyDescriptor> singletonList(dd), ivyResolver.askedDeps);
assertEquals(Collections.<DependencyDescriptor> singletonList(dd), artifactResolver.askedDeps);
}
示例9: testResolveFail
import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor; //导入依赖的package包/类
@Test
public void testResolveFail() throws Exception {
DualResolver dual = new DualResolver();
MockResolver ivyResolver = MockResolver.buildMockResolver(settings, "ivy", false,
new GregorianCalendar(2005, 1, 20).getTime());
MockResolver artifactResolver = MockResolver.buildMockResolver(settings, "artifact",
false, new GregorianCalendar(2005, 1, 20).getTime());
dual.setIvyResolver(ivyResolver);
dual.setArtifactResolver(artifactResolver);
DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(
ModuleRevisionId.newInstance("org", "mod", "rev"), false);
ResolvedModuleRevision rmr = dual.getDependency(dd, data);
assertNull(rmr);
assertEquals(Collections.<DependencyDescriptor> singletonList(dd), ivyResolver.askedDeps);
assertEquals(Collections.<DependencyDescriptor> singletonList(dd), artifactResolver.askedDeps);
}
示例10: testResolveOrder
import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor; //导入依赖的package包/类
@Test
public void testResolveOrder() throws Exception {
ChainResolver chain = new ChainResolver();
chain.setName("chain");
chain.setSettings(settings);
MockResolver[] resolvers = new MockResolver[] {
MockResolver.buildMockResolver(settings, "1", false, null),
MockResolver.buildMockResolver(settings, "2", true, null),
MockResolver.buildMockResolver(settings, "3", true, null)};
for (MockResolver resolver : resolvers) {
chain.add(resolver);
}
assertResolversSizeAndNames(chain, resolvers.length);
DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(
ModuleRevisionId.newInstance("org", "mod", "rev"), false);
ResolvedModuleRevision rmr = chain.getDependency(dd, data);
assertNotNull(rmr);
assertEquals("2", rmr.getResolver().getName());
assertEquals(Collections.<DependencyDescriptor> singletonList(dd), resolvers[0].askedDeps);
assertEquals(Collections.<DependencyDescriptor> singletonList(dd), resolvers[1].askedDeps);
assertTrue(resolvers[2].askedDeps.isEmpty());
}
示例11: testUseCache
import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor; //导入依赖的package包/类
@Test
public void testUseCache() throws Exception {
DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(
ModuleRevisionId.newInstance("org1", "mod1.1", "1.0"), false);
// resolve dependency twice
chainToPutDefaultModuleInCache().getDependency(dd, data);
ChainResolver chain = new ChainResolver();
chain.setName("chain");
chain.setSettings(settings);
MockResolver[] resolvers = new MockResolver[] {MockResolver.buildMockResolver(settings,
"1", true, null)};
for (MockResolver resolver : resolvers) {
chain.add(resolver);
}
chain.getDependency(dd, data);
// should not have asked any dependency, should have hit the cache
assertEquals(Collections.emptyList(), resolvers[0].askedDeps);
}
示例12: testReturnFirstWithDefaultAndCacheAndRealResolver
import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor; //导入依赖的package包/类
/**
* Test case for IVY-389.
*
* @throws Exception if something goes wrong
* @see <a href="https://issues.apache.org/jira/browse/IVY-389">IVY-389</a>
*/
@Test
public void testReturnFirstWithDefaultAndCacheAndRealResolver() throws Exception {
DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(
ModuleRevisionId.newInstance("org1", "mod1.1", "1.0"), false);
// 1 ---- we first do a first resolve which puts a default file in cache
chainToPutDefaultModuleInCache().getDependency(dd, data);
// 2 ---- now we ask to resolve dependencies with a chain in return first mode with check
// modified = false, in which the first resolver is not able to find the module, but the
// second is
ChainResolver chain = returnFirstChain();
ResolvedModuleRevision rmr = chain.getDependency(dd, data);
assertNotNull(rmr);
// the module returned should be the default one found in cache since check modified is
// false
assertEquals(true, rmr.getDescriptor().isDefault());
}
示例13: testReturnFirstWithCheckModifiedAndDefaultAndCacheAndRealResolver
import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor; //导入依赖的package包/类
/**
* Test case for IVY-207.
*
* @throws Exception if something goes wrong
* @see <a href="https://issues.apache.org/jira/browse/IVY-207">IVY-207</a>
*/
@Test
public void testReturnFirstWithCheckModifiedAndDefaultAndCacheAndRealResolver()
throws Exception {
DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(
ModuleRevisionId.newInstance("org1", "mod1.1", "1.0"), false);
// 1 ---- we first do a first resolve which puts a default file in cache
chainToPutDefaultModuleInCache().getDependency(dd, data);
// 2 ---- now we ask to resolve dependencies with a chain in return first mode, in which the
// first resolver is not able to find the module, but the second is
ChainResolver chain = returnFirstChain();
chain.setCheckmodified(true);
ResolvedModuleRevision rmr = chain.getDependency(dd, data);
assertNotNull(rmr);
assertEquals(false, rmr.getDescriptor().isDefault());
assertEquals("2", rmr.getResolver().getName());
}
示例14: testDual
import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor; //导入依赖的package包/类
@Test
public void testDual() throws Exception {
ChainResolver chain = new ChainResolver();
chain.setName("chain");
chain.setSettings(settings);
chain.setDual(true);
MockResolver[] resolvers = new MockResolver[] {
MockResolver.buildMockResolver(settings, "1", false, null),
MockResolver.buildMockResolver(settings, "2", true, null),
MockResolver.buildMockResolver(settings, "3", true, null)};
for (MockResolver resolver : resolvers) {
chain.add(resolver);
}
assertResolversSizeAndNames(chain, resolvers.length);
DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(
ModuleRevisionId.newInstance("org", "mod", "rev"), false);
ResolvedModuleRevision rmr = chain.getDependency(dd, data);
assertNotNull(rmr);
assertEquals("2", rmr.getResolver().getName());
assertEquals("chain", rmr.getArtifactResolver().getName());
}
示例15: testLatestFile
import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor; //导入依赖的package包/类
@Test
public void testLatestFile() throws Exception {
URLResolver resolver = new URLResolver();
resolver.setSettings(settings);
String rootpath = new File("test/repositories/1").toURI().toURL().toExternalForm();
resolver.addIvyPattern(rootpath + "[organisation]/[module]/ivys/ivy-[revision].xml");
resolver.addArtifactPattern(rootpath
+ "[organisation]/[module]/[type]s/[artifact]-[revision].[type]");
resolver.setName("test");
assertEquals("test", resolver.getName());
ModuleRevisionId mrid = ModuleRevisionId.newInstance("org1", "mod1.1", "2.0");
ResolvedModuleRevision rmr = resolver.getDependency(new DefaultDependencyDescriptor(
ModuleRevisionId.newInstance("org1", "mod1.1", "latest.integration"), false), data);
assertNotNull(rmr);
assertEquals(mrid, rmr.getId());
Date pubdate = new GregorianCalendar(2005, 1, 15, 11, 0, 0).getTime();
assertEquals(pubdate, rmr.getPublicationDate());
}