• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java DefaultDependencyDescriptor类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor的典型用法代码示例。如果您正苦于以下问题:Java DefaultDependencyDescriptor类的具体用法?Java DefaultDependencyDescriptor怎么用?Java DefaultDependencyDescriptor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DefaultDependencyDescriptor类属于org.apache.ivy.core.module.descriptor包,在下文中一共展示了DefaultDependencyDescriptor类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:20,代码来源:IvyXmlModuleDescriptorParser.java


示例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;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:17,代码来源:IvyModuleDescriptorConverter.java


示例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;
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:24,代码来源:ReflectiveDependencyDescriptorFactory.java


示例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);
    }
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:21,代码来源:ResolveEngine.java


示例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);
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:18,代码来源:AbstractModuleDescriptorParser.java


示例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]);
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:24,代码来源:UpdateSiteAndIbiblioResolverTest.java


示例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());
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:19,代码来源:DualResolverTest.java


示例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);
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:19,代码来源:DualResolverTest.java


示例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);
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:18,代码来源:DualResolverTest.java


示例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());
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:24,代码来源:ChainResolverTest.java


示例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);
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:20,代码来源:ChainResolverTest.java


示例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());
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:26,代码来源:ChainResolverTest.java


示例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());
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:26,代码来源:ChainResolverTest.java


示例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());
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:23,代码来源:ChainResolverTest.java


示例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());
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:21,代码来源:URLResolverTest.java


示例16: testLatestFileWithOpaqueURL

import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor; //导入依赖的package包/类
@Test
public void testLatestFileWithOpaqueURL() throws Exception {
    URLResolver resolver = new URLResolver();
    resolver.setSettings(settings);
    String rootpath = new File("test/repositories/1").getAbsoluteFile().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());
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:22,代码来源:URLResolverTest.java


示例17: testErrorReport

import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor; //导入依赖的package包/类
@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");
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:25,代码来源:BintrayResolverTest.java


示例18: testFindIvyFileRefWithMultipleIvyPatterns

import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor; //导入依赖的package包/类
/**
 * Test case for IVY-676.
 *
 * @throws Exception if something goes wrong
 * @see <a href="https://issues.apache.org/jira/browse/IVY-676">IVY-676</a>
 */
@Test
public void testFindIvyFileRefWithMultipleIvyPatterns() throws Exception {
    FileSystemResolver resolver = new FileSystemResolver();
    resolver.setName("test");
    resolver.setSettings(settings);
    resolver.addIvyPattern(settings.getBaseDir()
            + "/test/repositories/multi-ivypattern/ivy1/ivy-[revision].xml");
    resolver.addIvyPattern(settings.getBaseDir()
            + "/test/repositories/multi-ivypattern/ivy2/ivy-[revision].xml");

    ModuleRevisionId mrid = ModuleRevisionId.newInstance("org1", "mod1.1", "1.0+");
    ResolvedResource ivyRef = resolver.findIvyFileRef(new DefaultDependencyDescriptor(mrid,
            false), data);

    // check that the found ivy file is the one from the first pattern!
    assertEquals(
        new File("test/repositories/multi-ivypattern/ivy1/ivy-1.0.xml").getCanonicalPath(),
        new File(ivyRef.getResource().getName()).getCanonicalPath());
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:26,代码来源:FileSystemResolverTest.java


示例19: testMaven2

import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor; //导入依赖的package包/类
@Test
public void testMaven2() throws Exception {
    FileSystemResolver resolver = new FileSystemResolver();
    resolver.setName("test");
    resolver.setSettings(settings);
    resolver.setM2compatible(true);
    assertEquals("test", resolver.getName());

    resolver.addIvyPattern(settings.getBaseDir() + "/test/repositories/m2/"
            + "[organisation]/[module]/[revision]/[artifact]-[revision].[ext]");
    resolver.addArtifactPattern(settings.getBaseDir() + "/test/repositories/m2/"
            + "[organisation]/[module]/[revision]/[artifact]-[revision].[ext]");

    ModuleRevisionId mrid = ModuleRevisionId.newInstance("org.apache", "test", "1.0");
    ResolvedModuleRevision rmr = resolver.getDependency(new DefaultDependencyDescriptor(mrid,
            false), data);
    assertNotNull(rmr);

    mrid = ModuleRevisionId.newInstance("org.apache.unknown", "test", "1.0");
    rmr = resolver.getDependency(new DefaultDependencyDescriptor(mrid, false), data);
    assertNull(rmr);
    resolver.reportFailure();
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:24,代码来源:FileSystemResolverTest.java


示例20: testSHA256Checksum

import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor; //导入依赖的package包/类
/**
 * Tests that <code>SHA-256</code> algorithm can be used for checksums on resolvers
 *
 * @throws Exception if something goes wrong
 */
@Test
public void testSHA256Checksum() throws Exception {
    final FileSystemResolver resolver = new FileSystemResolver();
    resolver.setName("sha256-checksum-resolver");
    resolver.setSettings(settings);

    resolver.addIvyPattern(settings.getBaseDir()
            + "/test/repositories/checksums/[module]/[revision]/[artifact]-[revision].[ext]");
    resolver.addArtifactPattern(settings.getBaseDir()
            + "/test/repositories/checksums/[module]/[revision]/[artifact]-[revision].[ext]");

    resolver.setChecksums("SHA-256");
    final ModuleRevisionId mrid = ModuleRevisionId.newInstance("test", "allright", "2.0");
    final ResolvedModuleRevision rmr = resolver.getDependency(new DefaultDependencyDescriptor(mrid, false), data);
    assertNotNull("Resolved module revision was null for " + mrid, rmr);
    final DownloadReport dr = resolver.download(rmr.getDescriptor().getAllArtifacts(), getDownloadOptions());
    final ArtifactDownloadReport[] successfulDownloadReports = dr.getArtifactsReports(DownloadStatus.SUCCESSFUL);
    assertNotNull("No artifacts were downloaded successfully", successfulDownloadReports);
    assertEquals("Unexpected number of successfully downloaded artifacts", 1, successfulDownloadReports.length);
    final ArtifactDownloadReport successfulDownloadReport = successfulDownloadReports[0];
    final Artifact downloadedArtifact = successfulDownloadReport.getArtifact();
    assertEquals("Unexpected organization of downloaded artifact", "test", downloadedArtifact.getModuleRevisionId().getOrganisation());
    assertEquals("Unexpected module of downloaded artifact", "allright", downloadedArtifact.getModuleRevisionId().getModuleId().getName());
    assertEquals("Unexpected revision of downloaded artifact", "2.0", downloadedArtifact.getModuleRevisionId().getRevision());
}
 
开发者ID:apache,项目名称:ant-ivy,代码行数:31,代码来源:FileSystemResolverTest.java



注:本文中的org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java FilePart类代码示例发布时间:2022-05-21
下一篇:
Java DataContentHandler类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap