You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by "Michael Scheetz (JIRA)" <ji...@apache.org> on 2009/09/09 23:01:58 UTC

[jira] Updated: (IVY-1115) ResolveEngine.getDependencies does not work using extra attributes.

     [ https://issues.apache.org/jira/browse/IVY-1115?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Scheetz updated IVY-1115:
---------------------------------

    Description: 
I wrote these two tests for 'test/java/org/apache/ivy/core/resolve/ResolveEngineTest.java'.  The one using extra attributes to build a dependency list does not return the complete set of dependencies.


    public void testBuildDependencyList_ExtraAtt() throws Exception {
        System.setProperty("ivy.local.default.root", new File("test/repositories/extra-attributes").getAbsolutePath());
        System.setProperty("ivy.settings.file", "test/repositories/extra-attributes/ivysettings.xml");
        String org = "apache";
        String mod = "mymodule";
        String rev = "1749";
        Map extraAttributes = new HashMap();
        extraAttributes.put("eatt", "task2");
        extraAttributes.put("eatt2", "test");
        
        ResolveEngine engine = new ResolveEngine(ivy.getSettings(), 
            ivy.getEventManager(), ivy.getSortEngine());

        ModuleRevisionId mRevId = ModuleRevisionId.newInstance(org, mod, rev, extraAttributes);
        DefaultModuleDescriptor md = DefaultModuleDescriptor.newCallerInstance(mRevId, new String[] {"*"}, true, false);
        String resolveId = ResolveOptions.getDefaultResolveId(md);
        ResolveOptions options = new ResolveOptions();
        options.setConfs(new String[] {"*"});
        options.setResolveId(resolveId);
        ResolveReport report = new ResolveReport(md, options.getResolveId());

        IvyNode[] deps = engine.getDependencies(md, options, report);

        assertEquals(2, deps.length);
        assertTrue(Arrays.toString(deps).contains("apache#mymodule;1749"));
        assertTrue(Arrays.toString(deps).contains("apache#module2;1976"));
    }
    
    public void testBuildDependencyList_MultiDeps() throws Exception {
        System.setProperty("ivy.local.default.root", new File("test/repositories/1").getAbsolutePath());
        System.setProperty("ivy.settings.file", "test/repositories/ivysettings-1.xml");
        String org = "org2";
        String mod = "mod2.3";
        String rev = "0.4";

        ResolveEngine engine = new ResolveEngine(ivy.getSettings(), 
            ivy.getEventManager(), ivy.getSortEngine());

        ModuleRevisionId mRevId = ModuleRevisionId.newInstance(org, mod, rev);
        DefaultModuleDescriptor md = DefaultModuleDescriptor.newCallerInstance(mRevId, new String[] {"*"}, true, false);
        String resolveId = ResolveOptions.getDefaultResolveId(md);
        ResolveOptions options = new ResolveOptions();
        options.setConfs(new String[] {"*"});
        options.setResolveId(resolveId);
        ResolveReport report = new ResolveReport(md, options.getResolveId());

        IvyNode[] deps = engine.getDependencies(md, options, report);

        assertEquals(4, deps.length);
    }


Update:

So far, I have traced the issue down to the VisitNode.loadData(String[], boolean) method.  This method returns false when extra attributes are used, even if there are additional dependencies to follow.

  was:
I wrote these two tests for 'test/java/org/apache/ivy/core/resolve/ResolveEngineTest.java'.  The one using extra attributes to build a dependency list does not return the complete set of dependencies.


    public void testBuildDependencyList_ExtraAtt() throws Exception {
        System.setProperty("ivy.local.default.root", new File("test/repositories/extra-attributes").getAbsolutePath());
        System.setProperty("ivy.settings.file", "test/repositories/extra-attributes/ivysettings.xml");
        String org = "apache";
        String mod = "mymodule";
        String rev = "1749";
        Map extraAttributes = new HashMap();
        extraAttributes.put("eatt", "task2");
        extraAttributes.put("eatt2", "test");
        
        ResolveEngine engine = new ResolveEngine(ivy.getSettings(), 
            ivy.getEventManager(), ivy.getSortEngine());

        ModuleRevisionId mRevId = ModuleRevisionId.newInstance(org, mod, rev, extraAttributes);
        DefaultModuleDescriptor md = DefaultModuleDescriptor.newCallerInstance(mRevId, new String[] {"*"}, true, false);
        String resolveId = ResolveOptions.getDefaultResolveId(md);
        ResolveOptions options = new ResolveOptions();
        options.setConfs(new String[] {"*"});
        options.setResolveId(resolveId);
        ResolveReport report = new ResolveReport(md, options.getResolveId());

        IvyNode[] deps = engine.getDependencies(md, options, report);

        assertEquals(2, deps.length);
        assertTrue(Arrays.toString(deps).contains("apache#mymodule;1749"));
        assertTrue(Arrays.toString(deps).contains("apache#module2;1976"));
    }
    
    public void testBuildDependencyList_MultiDeps() throws Exception {
        System.setProperty("ivy.local.default.root", new File("test/repositories/1").getAbsolutePath());
        System.setProperty("ivy.settings.file", "test/repositories/ivysettings-1.xml");
        String org = "org2";
        String mod = "mod2.3";
        String rev = "0.4";

        ResolveEngine engine = new ResolveEngine(ivy.getSettings(), 
            ivy.getEventManager(), ivy.getSortEngine());

        ModuleRevisionId mRevId = ModuleRevisionId.newInstance(org, mod, rev);
        DefaultModuleDescriptor md = DefaultModuleDescriptor.newCallerInstance(mRevId, new String[] {"*"}, true, false);
        String resolveId = ResolveOptions.getDefaultResolveId(md);
        ResolveOptions options = new ResolveOptions();
        options.setConfs(new String[] {"*"});
        options.setResolveId(resolveId);
        ResolveReport report = new ResolveReport(md, options.getResolveId());

        IvyNode[] deps = engine.getDependencies(md, options, report);

        assertEquals(4, deps.length);
    }


> ResolveEngine.getDependencies does not work using extra attributes.
> -------------------------------------------------------------------
>
>                 Key: IVY-1115
>                 URL: https://issues.apache.org/jira/browse/IVY-1115
>             Project: Ivy
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.1.0-RC2
>         Environment: Ivy SVN version 808087
> Apache Ant version 1.7.0 compiled on December 13 2006
>            Reporter: Michael Scheetz
>             Fix For: 2.1.0-RC2
>
>   Original Estimate: 48h
>  Remaining Estimate: 48h
>
> I wrote these two tests for 'test/java/org/apache/ivy/core/resolve/ResolveEngineTest.java'.  The one using extra attributes to build a dependency list does not return the complete set of dependencies.
>     public void testBuildDependencyList_ExtraAtt() throws Exception {
>         System.setProperty("ivy.local.default.root", new File("test/repositories/extra-attributes").getAbsolutePath());
>         System.setProperty("ivy.settings.file", "test/repositories/extra-attributes/ivysettings.xml");
>         String org = "apache";
>         String mod = "mymodule";
>         String rev = "1749";
>         Map extraAttributes = new HashMap();
>         extraAttributes.put("eatt", "task2");
>         extraAttributes.put("eatt2", "test");
>         
>         ResolveEngine engine = new ResolveEngine(ivy.getSettings(), 
>             ivy.getEventManager(), ivy.getSortEngine());
>         ModuleRevisionId mRevId = ModuleRevisionId.newInstance(org, mod, rev, extraAttributes);
>         DefaultModuleDescriptor md = DefaultModuleDescriptor.newCallerInstance(mRevId, new String[] {"*"}, true, false);
>         String resolveId = ResolveOptions.getDefaultResolveId(md);
>         ResolveOptions options = new ResolveOptions();
>         options.setConfs(new String[] {"*"});
>         options.setResolveId(resolveId);
>         ResolveReport report = new ResolveReport(md, options.getResolveId());
>         IvyNode[] deps = engine.getDependencies(md, options, report);
>         assertEquals(2, deps.length);
>         assertTrue(Arrays.toString(deps).contains("apache#mymodule;1749"));
>         assertTrue(Arrays.toString(deps).contains("apache#module2;1976"));
>     }
>     
>     public void testBuildDependencyList_MultiDeps() throws Exception {
>         System.setProperty("ivy.local.default.root", new File("test/repositories/1").getAbsolutePath());
>         System.setProperty("ivy.settings.file", "test/repositories/ivysettings-1.xml");
>         String org = "org2";
>         String mod = "mod2.3";
>         String rev = "0.4";
>         ResolveEngine engine = new ResolveEngine(ivy.getSettings(), 
>             ivy.getEventManager(), ivy.getSortEngine());
>         ModuleRevisionId mRevId = ModuleRevisionId.newInstance(org, mod, rev);
>         DefaultModuleDescriptor md = DefaultModuleDescriptor.newCallerInstance(mRevId, new String[] {"*"}, true, false);
>         String resolveId = ResolveOptions.getDefaultResolveId(md);
>         ResolveOptions options = new ResolveOptions();
>         options.setConfs(new String[] {"*"});
>         options.setResolveId(resolveId);
>         ResolveReport report = new ResolveReport(md, options.getResolveId());
>         IvyNode[] deps = engine.getDependencies(md, options, report);
>         assertEquals(4, deps.length);
>     }
> Update:
> So far, I have traced the issue down to the VisitNode.loadData(String[], boolean) method.  This method returns false when extra attributes are used, even if there are additional dependencies to follow.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.