Package org.apache.ivy.core.module.descriptor

Examples of org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor


        IvyContext context = IvyContext.pushNewCopyContext();
        try {
            context.setDependencyDescriptor(dde);
            context.setResolveData(data);
            DefaultModuleDescriptor moduleDescriptor =
                    (DefaultModuleDescriptor) moduleRegistry.get(dde.getExtraAttribute(ClientModule.CLIENT_MODULE_KEY));
            MetadataArtifactDownloadReport downloadReport = new MetadataArtifactDownloadReport(moduleDescriptor.getMetadataArtifact());
            downloadReport.setDownloadStatus(DownloadStatus.NO);
            downloadReport.setSearched(false);
            return new ResolvedModuleRevision(userResolver, userResolver, moduleDescriptor, downloadReport);
        } finally {
            IvyContext.popContext();
View Full Code Here


        this.artifactsToModuleDescriptorConverter = artifactsToModuleDescriptorConverter;
    }

    public ModuleDescriptor convert(Set<Configuration> configurations, Module module, IvySettings settings) {
        Clock clock = new Clock();
        DefaultModuleDescriptor moduleDescriptor = (DefaultModuleDescriptor) resolveModuleDescriptorConverter.convert(configurations, module, settings);
        moduleDescriptor.addExtraAttributeNamespace(IVY_MAVEN_NAMESPACE_PREFIX, IVY_MAVEN_NAMESPACE);
        artifactsToModuleDescriptorConverter.addArtifacts(moduleDescriptor, configurations);
        logger.debug("Timing: Ivy convert for publish took {}", clock.getTime());
        return moduleDescriptor;
    }
View Full Code Here

/**
* @author Hans Dockter
*/
public class DefaultModuleDescriptorFactory implements ModuleDescriptorFactory {
    public DefaultModuleDescriptor createModuleDescriptor(Module module) {
        return new DefaultModuleDescriptor(IvyUtil.createModuleRevisionId(module),
                module.getStatus(), null);
    }
View Full Code Here

        this.configurationsToModuleDescriptorConverter = configurationsToModuleDescriptorConverter;
        this.dependenciesToModuleDescriptorConverter = dependenciesToModuleDescriptorConverter;
    }

    protected DefaultModuleDescriptor createCommonModuleDescriptor(Module module, Set<Configuration> configurations, IvySettings ivySettings) {
        DefaultModuleDescriptor moduleDescriptor = moduleDescriptorFactory.createModuleDescriptor(module);
        configurationsToModuleDescriptorConverter.addConfigurations(moduleDescriptor, configurations);
        dependenciesToModuleDescriptorConverter.addDependencyDescriptors(moduleDescriptor, configurations, ivySettings);
        return moduleDescriptor;
    }
View Full Code Here

    @Test
    public void testAddConfigurations() {
        Configuration configurationStub1 = createNamesAndExtendedConfigurationStub("conf1");
        Configuration configurationStub2 = createNamesAndExtendedConfigurationStub("conf2", configurationStub1);
        final DefaultModuleDescriptor moduleDescriptor = HelperUtil.createModuleDescriptor(Collections.EMPTY_SET);

        configurationsToModuleDescriptorConverter.addConfigurations(moduleDescriptor, WrapUtil.toSet(configurationStub1, configurationStub2));

        assertIvyConfigurationIsCorrect(moduleDescriptor.getConfiguration(configurationStub1.getName()),
                expectedIvyConfiguration(configurationStub1));
        assertIvyConfigurationIsCorrect(moduleDescriptor.getConfiguration(configurationStub2.getName()),
                expectedIvyConfiguration(configurationStub2));
        assertThat(moduleDescriptor.getConfigurations().length, equalTo(2));
    }
View Full Code Here

    public void convert() {
        final Set<Configuration> configurationsDummy = WrapUtil.toSet(context.mock(Configuration.class, "conf1"),
                context.mock(Configuration.class, "conf2"));
        final Module moduleDummy = context.mock(Module.class);
        final IvySettings ivySettingsDummy = new IvySettings();
        final DefaultModuleDescriptor moduleDescriptorDummy = context.mock(DefaultModuleDescriptor.class);
        final ModuleDescriptorFactory moduleDescriptorFactoryStub = context.mock(ModuleDescriptorFactory.class);
        final ConfigurationsToModuleDescriptorConverter configurationsToModuleDescriptorConverterMock = context.mock(ConfigurationsToModuleDescriptorConverter.class);
        final DependenciesToModuleDescriptorConverter dependenciesToModuleDescriptorConverterMock = context.mock(DependenciesToModuleDescriptorConverter.class);

        ResolveModuleDescriptorConverter resolveModuleDescriptorConverter = new ResolveModuleDescriptorConverter(
                moduleDescriptorFactoryStub,
                configurationsToModuleDescriptorConverterMock,
                dependenciesToModuleDescriptorConverterMock);

        context.checking(new Expectations() {{
            allowing(moduleDescriptorFactoryStub).createModuleDescriptor(moduleDummy);
            will(returnValue(moduleDescriptorDummy));
            one(configurationsToModuleDescriptorConverterMock).addConfigurations(moduleDescriptorDummy, configurationsDummy);
            one(dependenciesToModuleDescriptorConverterMock).addDependencyDescriptors(moduleDescriptorDummy, configurationsDummy, ivySettingsDummy);
        }});

        DefaultModuleDescriptor actualModuleDescriptor = (DefaultModuleDescriptor)
                resolveModuleDescriptorConverter.convert(configurationsDummy, moduleDummy, ivySettingsDummy);

        assertThat(actualModuleDescriptor, equalTo(moduleDescriptorDummy));
    }
View Full Code Here

            one(artifactsExtraAttributesStrategyMock).createExtraAttributes(publishArtifactConf1);
            will(returnValue(extraAttributesArtifact1));
            one(artifactsExtraAttributesStrategyMock).createExtraAttributes(publishArtifactConf2);
            will(returnValue(extraAttributesArtifact2));
        }});
        DefaultModuleDescriptor moduleDescriptor = HelperUtil.createModuleDescriptor(WrapUtil.toSet(configurationStub1.getName(),
                configurationStub2.getName()));

        DefaultArtifactsToModuleDescriptorConverter artifactsToModuleDescriptorConverter =
                new DefaultArtifactsToModuleDescriptorConverter(artifactsExtraAttributesStrategyMock);

        artifactsToModuleDescriptorConverter.addArtifacts(moduleDescriptor, WrapUtil.toSet(configurationStub1, configurationStub2));

        assertArtifactIsAdded(configurationStub1, moduleDescriptor, extraAttributesArtifact1);
        assertArtifactIsAdded(configurationStub2, moduleDescriptor, extraAttributesArtifact2);
        assertThat(moduleDescriptor.getAllArtifacts().length, equalTo(2));
    }
View Full Code Here

    public void convert() {
        final Set<Configuration> configurationsDummy = WrapUtil.toSet(context.mock(Configuration.class, "conf1"),
                context.mock(Configuration.class, "conf2"));
        final Module moduleDummy = context.mock(Module.class);
        final IvySettings ivySettingsDummy = context.mock(IvySettings.class);
        final DefaultModuleDescriptor moduleDescriptorDummy = context.mock(DefaultModuleDescriptor.class);
        final ArtifactsToModuleDescriptorConverter artifactsToModuleDescriptorConverter = context.mock(ArtifactsToModuleDescriptorConverter.class);
        final ModuleDescriptorConverter resolveModuleDescriptorConverter = context.mock(ModuleDescriptorConverter.class);
        PublishModuleDescriptorConverter publishModuleDescriptorConverter = new PublishModuleDescriptorConverter(
                resolveModuleDescriptorConverter,
                artifactsToModuleDescriptorConverter);

        context.checking(new Expectations() {{
            allowing(resolveModuleDescriptorConverter).convert(configurationsDummy, moduleDummy, ivySettingsDummy);
            will(returnValue(moduleDescriptorDummy));
            one(moduleDescriptorDummy).addExtraAttributeNamespace(PublishModuleDescriptorConverter.IVY_MAVEN_NAMESPACE_PREFIX,
                    PublishModuleDescriptorConverter.IVY_MAVEN_NAMESPACE);
            one(artifactsToModuleDescriptorConverter).addArtifacts(moduleDescriptorDummy, configurationsDummy);
        }});

        DefaultModuleDescriptor actualModuleDescriptor = (DefaultModuleDescriptor)
                publishModuleDescriptorConverter.convert(configurationsDummy, moduleDummy, ivySettingsDummy);

        assertThat(actualModuleDescriptor, equalTo(moduleDescriptorDummy));
    }
View Full Code Here

*/
public class DefaultModuleDescriptorFactoryTest {
    @Test
    public void testCreateModuleDescriptor() {
        Module module = new DefaultModule("org", "name", "version", "status");
        DefaultModuleDescriptor moduleDescriptor = new DefaultModuleDescriptorFactory().createModuleDescriptor(module);
        assertThat(moduleDescriptor.getModuleRevisionId().getOrganisation(), equalTo(module.getGroup()));
        assertThat(moduleDescriptor.getModuleRevisionId().getName(), equalTo(module.getName()));
        assertThat(moduleDescriptor.getModuleRevisionId().getRevision(), equalTo(module.getVersion()));
        assertThat(moduleDescriptor.getStatus(), equalTo(module.getStatus()));
        assertThat(moduleDescriptor.getPublicationDate(), equalTo(null));
    }
View Full Code Here

    }

    public ModuleDescriptor convert(Set<Configuration> configurations, Module module, IvySettings settings) {
        assert configurations.size() > 0;
        Clock clock = new Clock();
        DefaultModuleDescriptor moduleDescriptor = createCommonModuleDescriptor(module, configurations, settings);
        logger.debug("Timing: Ivy convert for resolve took {}", clock.getTime());
        return moduleDescriptor;
    }
View Full Code Here

TOP

Related Classes of org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.