maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sisb...@apache.org
Subject svn commit: r660806 - in /maven/sandbox/trunk/other/maven-project: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/maven/ src/main/java/org/apache/maven/project/ src/main/java/org/apache/maven/proj...
Date Wed, 28 May 2008 04:10:48 GMT
Author: sisbell
Date: Tue May 27 21:10:47 2008
New Revision: 660806

URL: http://svn.apache.org/viewvc?rev=660806&view=rev
Log:
New prototype for maven project.

Added:
    maven/sandbox/trunk/other/maven-project/README.txt
    maven/sandbox/trunk/other/maven-project/src/
    maven/sandbox/trunk/other/maven-project/src/main/
    maven/sandbox/trunk/other/maven-project/src/main/java/
    maven/sandbox/trunk/other/maven-project/src/main/java/org/
    maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/
    maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/
    maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/
    maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/DomainModel.java
    maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/MarshalProperty.java
    maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/ModelMarshaller.java
    maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/ModelProcessor.java
    maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/ModelProperty.java
    maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/ModelPropertySorter.java
    maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/ModelTransformer.java
    maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/ModelTransformerContext.java
    maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/ModelUri.java
    maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/impl/
    maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/impl/DependencyManagementProcessor.java
    maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/impl/PomClassicTransformer.java
    maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/impl/PomDomainModel.java
    maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/impl/ProjectProcessor.java
    maven/sandbox/trunk/other/maven-project/src/main/resources/
    maven/sandbox/trunk/other/maven-project/src/main/resources/pom.xml
    maven/sandbox/trunk/other/maven-project/src/main/resources/text.xml
    maven/sandbox/trunk/other/maven-project/src/test/
    maven/sandbox/trunk/other/maven-project/src/test/java/
    maven/sandbox/trunk/other/maven-project/src/test/java/org/
    maven/sandbox/trunk/other/maven-project/src/test/java/org/apache/
    maven/sandbox/trunk/other/maven-project/src/test/java/org/apache/maven/
    maven/sandbox/trunk/other/maven-project/src/test/java/org/apache/maven/project/
    maven/sandbox/trunk/other/maven-project/src/test/java/org/apache/maven/project/PomBuilder.java
    maven/sandbox/trunk/other/maven-project/src/test/java/org/apache/maven/project/impl/
    maven/sandbox/trunk/other/maven-project/src/test/java/org/apache/maven/project/impl/DependencyManagementProcessorTest.java

Added: maven/sandbox/trunk/other/maven-project/README.txt
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/other/maven-project/README.txt?rev=660806&view=auto
==============================================================================
--- maven/sandbox/trunk/other/maven-project/README.txt (added)
+++ maven/sandbox/trunk/other/maven-project/README.txt Tue May 27 21:10:47 2008
@@ -0,0 +1,25 @@
+Implementation:
+This implementation maps all primitive values to a uri. Model structure is determined by ordering of list and by the
+uri itself, as it is easy to determine children and parents.
+
+Uri = http://apache.org/model/project/dependencyManagement/dependencies#collection, Value = null
+Uri = http://apache.org/model/project/dependencyManagement/dependencies#collection/dependency, Value = null
+Uri = http://apache.org/model/project/dependencyManagement/dependencies#collection/dependency/version, Value = 1.4
+Uri = http://apache.org/model/project/dependencyManagement/dependencies#collection/dependency/artifactId, Value = artifact-dep
+Uri = http://apache.org/model/project/dependencyManagement/dependencies#collection/dependency/groupId, Value = org.apache.maven.dep
+Uri = http://apache.org/model/project/dependencyManagement/dependencies#collection/dependency/scope, Value = compile
+Uri = http://apache.org/model/project/dependencyManagement/dependencies#collection/dependency/version, Value = 1.1
+Uri = http://apache.org/model/project/dependencyManagement/dependencies#collection/dependency/artifactId, Value = artifact-dep
+Uri = http://apache.org/model/project/dependencyManagement/dependencies#collection/dependency/groupId, Value = org.apache.maven.dep
+Uri = http://apache.org/model/project/dependencyManagement/dependencies#collection/dependency, Value = null
+Uri = http://apache.org/model/project/dependencyManagement/dependencies#collection/dependency/version, Value = 1.0
+Uri = http://apache.org/model/project/dependencyManagement/dependencies#collection/dependency/artifactId, Value = bogus-dep
+Uri = http://apache.org/model/project/dependencyManagement/dependencies#collection/dependency/groupId, Value = org.bogus
+Uri = http://apache.org/model/project/dependencyManagement/dependencies#collection/dependency, Value = null
+Uri = http://apache.org/model/project/dependencyManagement/dependencies#collection/dependency/version, Value = 1.1
+Uri = http://apache.org/model/project/dependencyManagement/dependencies#collection/dependency/artifactId, Value = artifact-dep
+Uri = http://apache.org/model/project/dependencyManagement/dependencies#collection/dependency/groupId, Value = org.apache.maven.dep
+Uri = http://apache.org/model/project/dependencies#collection, Value = null
+Uri = http://apache.org/model/project/dependencies#collection/dependency, Value = null
+Uri = http://apache.org/model/project/dependencies#collection/dependency/artifactId, Value = org.apache.maven.dep
+

Added: maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/DomainModel.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/DomainModel.java?rev=660806&view=auto
==============================================================================
--- maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/DomainModel.java (added)
+++ maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/DomainModel.java Tue May 27 21:10:47 2008
@@ -0,0 +1,4 @@
+package org.apache.maven.project;
+
+public interface DomainModel {
+}

Added: maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/MarshalProperty.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/MarshalProperty.java?rev=660806&view=auto
==============================================================================
--- maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/MarshalProperty.java (added)
+++ maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/MarshalProperty.java Tue May 27 21:10:47 2008
@@ -0,0 +1,24 @@
+package org.apache.maven.project;
+
+public class MarshalProperty {
+
+    private String value;
+
+    private String name;
+
+    public String getValue() {
+        return value;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+}

Added: maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/ModelMarshaller.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/ModelMarshaller.java?rev=660806&view=auto
==============================================================================
--- maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/ModelMarshaller.java (added)
+++ maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/ModelMarshaller.java Tue May 27 21:10:47 2008
@@ -0,0 +1,101 @@
+package org.apache.maven.project;
+
+import java.util.*;
+
+public class ModelMarshaller {
+
+    private final static int basePosition = ModelUri.BASE.getUri().length();
+
+    public List<ModelProperty> marshallXmlToModelProperties(String xml, Collection<MarshalProperty> marshalProperties) {
+        int state = 0;
+        List<ModelProperty> modelProperties = new ArrayList<ModelProperty>();
+         /*
+        Stack x = new Stack();
+        x.addAll(Arrays.asList(xml.getBytes()));
+        while(!x.isEmpty()) {
+            if(x.peek().equals("<")) {
+                state = 1;
+                x.pop();
+                while(x.pop()) {
+
+                }
+            } else if {
+
+            }
+        }
+        */
+        return null;
+    }
+
+    private static class Tag {
+        static final int START = 0;
+
+        static final int END = 1;
+
+        private String value;
+
+        private int tagType;
+
+        public int getTagType() {
+            return tagType;
+        }
+
+        public void setTagType(int tagType) {
+            this.tagType = tagType;
+        }
+
+        public String getValue() {
+            return value;
+        }
+
+        public void setValue(String value) {
+            this.value = value;
+        }
+    }
+
+
+    public String unmarshalModelPropertiesToXml(List<ModelProperty> modelProperties) {
+        StringBuffer sb = new StringBuffer();
+        List<String> lastUriTags = new ArrayList<String>();
+        for (ModelProperty mp : modelProperties) {
+            String uri = mp.getUri();
+            List<String> tagNames = getTagNamesFromUri(uri);
+            if (lastUriTags.size() > tagNames.size()) {
+                for (int i = lastUriTags.size() - 1; i >= tagNames.size(); i--) {
+                    sb.append(toEndTag(lastUriTags.get(i - 1)));
+                }
+            }
+            String tag = tagNames.get(tagNames.size() - 1);
+            sb.append(toStartTag(tag));
+            if (mp.getValue() != null) {
+                sb.append(mp.getValue());
+                sb.append(toEndTag(tag));
+            }
+            lastUriTags = tagNames;
+        }
+        for (int i = lastUriTags.size() - 2; i >= 0; i--) {
+            sb.append(toEndTag(lastUriTags.get(i)));
+        }
+        return sb.toString();
+    }
+
+    private static List<String> getTagNamesFromUri(String uri) {
+        List<String> methodNames = new ArrayList<String>();
+        for (String name : uri.substring(basePosition).replace("#collection", "").split("/")) {
+            methodNames.add(name);
+        }
+        return methodNames;
+    }
+
+    static String toStartTag(String value) {
+        StringBuffer sb = new StringBuffer();
+        sb.append("<" + value + ">\r\n");
+        return sb.toString();
+    }
+
+    static String toEndTag(String value) {
+        StringBuffer sb = new StringBuffer();
+        sb.append("\r\n</" + value + ">\r\n");
+        return sb.toString();
+    }
+}

Added: maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/ModelProcessor.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/ModelProcessor.java?rev=660806&view=auto
==============================================================================
--- maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/ModelProcessor.java (added)
+++ maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/ModelProcessor.java Tue May 27 21:10:47 2008
@@ -0,0 +1,12 @@
+package org.apache.maven.project;
+
+import java.util.List;
+
+/**
+ * Process the list of properties in some way: inserting version values (dependency management), removing properties that
+ * have been overriden, copying info from profiles to repsective parts of pom, interpolation etc.
+ */
+public interface ModelProcessor {
+    
+    void process(List<ModelProperty> list);
+}

Added: maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/ModelProperty.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/ModelProperty.java?rev=660806&view=auto
==============================================================================
--- maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/ModelProperty.java (added)
+++ maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/ModelProperty.java Tue May 27 21:10:47 2008
@@ -0,0 +1,59 @@
+package org.apache.maven.project;
+
+import java.util.UUID;
+
+/**
+ * Maps a URI to a string value, which may be null.
+ */
+public class ModelProperty {
+
+    private String uri;
+
+    private String value;
+
+    private UUID id;
+
+    /**
+     *
+     * @param uri URI of the resource
+     * @param value Value associated with specified uri. Value may be null if uri does not map to primitive type.
+     */
+    public ModelProperty(String uri, String value) {
+        if(uri == null) {
+            throw new IllegalArgumentException("uri");
+        }
+        this.uri = uri;
+        this.value = value;
+        //String x = uri;
+   //     if(value != null) {
+   //         x = x + value;
+   //     }
+//        id = UUID.fromString(x);
+    }
+
+    public String toString() {
+        return "Uri = " + uri + ", Value = " + value;
+    }
+
+    public ModelProperty(String uri, String value, UUID id) {
+        if(uri == null) {
+            throw new IllegalArgumentException("uri");
+        }
+
+        if(id  == null) {
+            throw new IllegalArgumentException("id") ;
+        }
+        
+        this.uri = uri;
+        this.value = value;
+        this.id = id;
+    }
+
+    public String getUri() {
+        return uri;
+    }
+
+    public String getValue() {
+        return value;
+    }
+}

Added: maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/ModelPropertySorter.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/ModelPropertySorter.java?rev=660806&view=auto
==============================================================================
--- maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/ModelPropertySorter.java (added)
+++ maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/ModelPropertySorter.java Tue May 27 21:10:47 2008
@@ -0,0 +1,52 @@
+package org.apache.maven.project;
+
+import java.util.LinkedList;
+import java.util.List;
+import java.util.ArrayList;
+
+public class ModelPropertySorter {
+
+    /**
+     * Sorts specified list of model properties. Typically the list contain property information from the entire
+     * hierarchy of models, with most specialized model first in the list.
+     * <p/>
+     * Define Sorting Rules: Sorting also removes duplicate values (same URI) unless the value contains a parent with
+     * a #collection (http://apache.org/model/project/dependencyManagement/dependencies#collection/dependency)
+     *
+     * @param properties list of model properties
+     * @return
+     */
+    public static List<ModelProperty> sort(List<ModelProperty> properties) {
+        LinkedList<ModelProperty> processedProperties = new LinkedList<ModelProperty>();
+        List<String> position = new ArrayList<String>();
+
+        for (ModelProperty p : properties) {
+            if (ModelUri.matches(ModelUri.PROJECT, p.getUri())) {
+                if (!processedProperties.contains(p)) {
+                    processedProperties.add(p);
+                    position.add(0, p.getUri());
+                }
+
+            } else {
+                boolean isContained = position.contains(p.getUri());
+                if (p.getUri().endsWith("#collection") && isContained) {
+                   //  System.out.println("COND1: " + p);
+                    continue;
+                }
+
+                String parentUri = getParentUri(p.getUri());
+                if (!isContained || parentUri.contains("#collection")) {
+                    int pst = position.indexOf(parentUri);
+                    processedProperties.add(pst + 1, p);
+                    position.add(pst + 1, p.getUri());
+                    //  System.out.println("Added: " + p   + ":" + pst + ":" + parentUri);
+                }
+            }
+        }
+        return processedProperties;
+    }
+
+    private static String getParentUri(String uri) {
+        return uri.substring(0, uri.lastIndexOf("/"));
+    }
+}

Added: maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/ModelTransformer.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/ModelTransformer.java?rev=660806&view=auto
==============================================================================
--- maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/ModelTransformer.java (added)
+++ maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/ModelTransformer.java Tue May 27 21:10:47 2008
@@ -0,0 +1,32 @@
+package org.apache.maven.project;
+
+import java.util.List;
+
+/**
+ * Provides services for transforming domain models to property lists and vice versa.
+ * ModelTransformer.transformToDomainModel == ModelTransformer.transformToModelProperties if list of model
+ * properties specified in transformToDomainModel contains only one property with a uri of http://apache.org/model/project.
+ */
+public interface ModelTransformer {
+
+    /**
+     * Transforms specified list of model properties into a single domain model. The list may contain a hierarchy (inheritance) of
+     * model information.
+     *
+     * @param properties list of model properties to transform into domain model.
+     * @return domain model
+     */
+    DomainModel transformToDomainModel(List<ModelProperty> properties);
+
+    /**
+     * Transforms specified list of domain models to a property list. The list of domain models should be in order of
+     * most specialized to least specialized model.
+     *
+     * @param domainModels list of domain models to transform to a list of model properties
+     * @return list of model properties
+     */
+    List<ModelProperty> transformToModelProperties(List<DomainModel> domainModels);
+
+    void init(ModelTransformerContext ctx);
+
+}

Added: maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/ModelTransformerContext.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/ModelTransformerContext.java?rev=660806&view=auto
==============================================================================
--- maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/ModelTransformerContext.java (added)
+++ maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/ModelTransformerContext.java Tue May 27 21:10:47 2008
@@ -0,0 +1,43 @@
+package org.apache.maven.project;
+
+import java.util.*;
+
+
+/**
+ * Primary context for this package. Provides methods for doing transforms.
+ */
+public class ModelTransformerContext {
+
+    private Map<String, ModelTransformer> modelTransformers;
+
+    public ModelTransformerContext() {
+        this.modelTransformers = new HashMap<String, ModelTransformer>();
+    }
+
+    /**
+     * Transforms specified hierarchical list of domain models (inheritence) to target domain model.
+     *
+     * @param domainModels
+     * @param fromModelTransformer
+     * @param toModelTransformer
+     * @return
+     */
+    public DomainModel transform(List<DomainModel> domainModels, ModelTransformer fromModelTransformer, ModelTransformer toModelTransformer) {
+        List<ModelProperty> modelProperties = fromModelTransformer.transformToModelProperties(domainModels);
+        ModelPropertySorter.sort(modelProperties);
+        return toModelTransformer.transformToDomainModel(modelProperties);
+    }
+
+    public DomainModel transformToDomainModel(String transformerName, List<ModelProperty> modelProperties) {
+        ModelTransformer modelTransformer = modelTransformers.get(transformerName);
+        return modelTransformer.transformToDomainModel(ModelPropertySorter.sort(modelProperties));
+    }
+
+    public ModelTransformer getModelTransformerFor(String transformerName) {
+        return modelTransformers.get(transformerName);
+    }
+
+    public void addModelTransformer(String name, ModelTransformer modelTransformer) {
+        modelTransformers.put(name, modelTransformer);
+    }
+}

Added: maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/ModelUri.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/ModelUri.java?rev=660806&view=auto
==============================================================================
--- maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/ModelUri.java (added)
+++ maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/ModelUri.java Tue May 27 21:10:47 2008
@@ -0,0 +1,62 @@
+package org.apache.maven.project;
+
+/**
+ * Defines all the unique ids for canonical data model.
+ */
+public enum ModelUri {
+    BASE("http://apache.org/model/"),
+    PROJECT("http://apache.org/model/project"),
+    PROJECT_MODELVERSION("http://apache.org/model/project/modelVersion"),
+    PROJECT_PREREQUSITIES_MAVEN("http://apache.org/model/project/prerequisites/maven"),
+    PROJECT_ISSUEMANAGEMENT_SYSTEM("http://apache.org/model/project/issueManagement/system"),
+    PROJECT_ISSUEMANAGEMENT_URL("http://apache.org/model/project/issueManagment/url"),
+    PROJECT_ARTIFACTID("http://apache.org/model/project/artifactId"),
+    PROJECT_BUILD("http://apache.org/model/project/build"),
+    PROJECT_BUILD_TESTSOURCEDIRECTORY("http://apache.org/model/project/build/testSourceDirectory"),
+    PROJECT_BUILD_OUTPUTDIRECTORY("http://apache.org/model/project/build/outputDirectory"),
+    PROJECT_BUILD_SCRIPTSOURCEDIRECTORY("http://apache.org/model/project/build/scriptSourceDirectory"),
+    PROJECT_BUILD_SOURCEDIRECTORY("http://apache.org/model/project/build/sourceDirectory"),
+    PROJECT_DESCRIPTION("http://apache.org/model/project/description"),
+    
+    PROJECT_DEPENDENCIES("http://apache.org/model/project/dependencies#collection"),
+    PROJECT_DEPENDENCIES_DEPENDENCY("http://apache.org/model/project/dependencies#collection/dependency"),
+    PROJECT_DEPENDENCIES_DEPENDENCY_VERSION("http://apache.org/model/project/dependencies#collection/dependency/version"),
+    PROJECT_DEPENDENCIES_DEPENDENCY_ARTIFACTID("http://apache.org/model/project/dependencies#collection/dependency/artifactId"),
+
+    PROJECT_DEPENDENCYMANAGEMENT("http://apache.org/model/project/dependencyManagement"),    
+    PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES("http://apache.org/model/project/dependencyManagement/dependencies#collection"),
+    PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY("http://apache.org/model/project/dependencyManagement/dependencies#collection/dependency"),
+    PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_VERSION("http://apache.org/model/project/dependencyManagement/dependencies#collection/dependency/version"),
+    PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_ARTIFACTID("http://apache.org/model/project/dependencyManagement/dependencies#collection/dependency/artifactId"),
+    PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_GROUPID("http://apache.org/model/project/dependencyManagement/dependencies#collection/dependency/groupId"),
+    PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_SCOPE("http://apache.org/model/project/dependencyManagement/dependencies#collection/dependency/scope"),
+
+    PROJECT_GROUPID("http://apache.org/model/project/groupId"),
+    PROJECT_ISSUEMANAGEMENT("http://apache.org/model/project/issueManagement"),
+    PROJECT_NAME("http://apache.org/model/project/name"),
+    PROJECT_MODULES("http://apache.org/model/project/modules#collection"),
+    PROJECT_PACKAGING("http://apache.org/model/packaging"),
+    PROJECT_PROFILES("http://apache.org/model/project/profiles#collection"),
+    PROJECT_PROPERTIES("http://apache.org/model/project/properties#collection"),
+    PROJECT_PREREQUISITES("http://apache.org/model/project/prerequisites"),
+    PROJECT_URL("http://apache.org/model/project/url"),
+    PROJECT_VERSION("http://apache.org/model/project/version");
+
+    private String uri;
+
+    ModelUri(String uri) {
+        this.uri = uri;
+    }
+
+    public String getUri() {
+        return uri;
+    }
+
+    public static boolean matches(ModelUri domainUri, String uri) {
+        return uri.equals(domainUri.getUri());
+    }
+
+    public ModelProperty getModelProperty() {
+        return new ModelProperty(uri, null);
+    }
+}

Added: maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/impl/DependencyManagementProcessor.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/impl/DependencyManagementProcessor.java?rev=660806&view=auto
==============================================================================
--- maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/impl/DependencyManagementProcessor.java (added)
+++ maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/impl/DependencyManagementProcessor.java Tue May 27 21:10:47 2008
@@ -0,0 +1,158 @@
+package org.apache.maven.project.impl;
+
+import org.apache.maven.project.ModelProperty;
+import org.apache.maven.project.ModelUri;
+import org.apache.maven.project.ModelProcessor;
+
+import java.util.*;
+
+/**
+ *
+ */
+public class DependencyManagementProcessor implements ModelProcessor {
+
+    private static boolean matchUriValuesFromMaps(Map<String, ModelProperty> x, Map<String, ModelProperty> y, String uri) {
+        ModelProperty xUri = x.get(uri);
+        ModelProperty yUri = y.get(uri);
+        return !(xUri == null || yUri == null) && xUri.getValue().equals(yUri.getValue());
+    }
+
+    private static void printMap(Map<String, ModelProperty> map) {
+        for (ModelProperty mp : map.values()) {
+            System.out.println(mp);
+        }
+    }
+
+    protected void pushDependenciesFromQueue(LinkedList<ModelProperty> workQueue, Stack<ModelProperty> resultStack) {
+        Map<String, ModelProperty> x = pushDependencyFromQueue(workQueue, resultStack);
+
+        LinkedList<ModelProperty> tmpWorkQueue = new LinkedList<ModelProperty>();
+        //tmpWorkQueue.addAll(workQueue);
+        int deadStop = 0;
+        while (true) {
+            if(workQueue.size() <=0 ) {
+                break;
+            }
+            System.out.println("Iteration: " + deadStop++ +":" + workQueue.size());
+            Map<String, ModelProperty> y = inspectDependencyFromQueue(workQueue);
+
+            int rowCount = y.size();
+
+            System.out.println("*------x------");
+            printMap(x);
+            System.out.println("+-----y-------");
+            printMap(y);
+            System.out.println("=-----------");
+
+            if (matchUriValuesFromMaps(x, y, ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_GROUPID.getUri()) &&
+                    matchUriValuesFromMaps(x, y, ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_ARTIFACTID.getUri())) {
+
+                System.out.println("Matched GROUPID and ARTIFACT ID");
+
+                if (matchUriValuesFromMaps(x, y, ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_VERSION.getUri())) {
+                    System.out.println("MATCHED VERSION");
+                    Set<String> yk = y.keySet();
+                    yk.removeAll(x.keySet());
+                    for (String key : yk) {
+                        System.out.println("KEY = " + key);
+                        resultStack.push(workQueue.get(workQueue.indexOf(y.get(key))));
+                    }
+                }
+                for (int i = 0; i < rowCount; i++) {
+                    System.out.println("Remove dependency from work queue" + workQueue.poll());
+                }
+            } else {//noop
+                for (int i = 0; i < rowCount; i++) {
+                    ModelProperty mp = workQueue.poll();
+                    System.out.println("WQ -> TQ: " + mp);
+                      tmpWorkQueue.push(mp);
+                }
+            }
+        }
+        System.out.println("TQ -> WQ");
+        for (ModelProperty p : tmpWorkQueue) {
+            System.out.println(p);
+        }
+        workQueue.clear();
+        workQueue.addAll(tmpWorkQueue);
+        // workQueue.addAll(tmpWorkQueue);
+    }
+
+    public void process(List<ModelProperty> list) {
+
+        int[] i = getIndexForDependencies(list);
+        if (i[0] == -1) {
+            return;
+        }
+        List<ModelProperty> managementDependencyList = list.subList(i[0], i[1]);
+        System.out.println("Extracted List");
+        for (ModelProperty mp : managementDependencyList) {
+            // System.out.println(mp);
+        }
+        LinkedList<ModelProperty> workQueue = new LinkedList<ModelProperty>(managementDependencyList);
+        Collections.reverse(workQueue);
+
+        Stack<ModelProperty> resultStack = new Stack<ModelProperty>();
+        int j = 0;
+        while (workQueue.size() > 0) {
+            pushDependenciesFromQueue(workQueue, resultStack);
+            System.out.println("Processed Stack step (" + j++ + ") Size = " + workQueue.size() + "\r\n");
+        }
+        managementDependencyList.clear();
+        Collections.reverse(resultStack);
+        list.addAll(i[0], resultStack);
+    }
+
+    private Map<String, ModelProperty> inspectDependencyFromQueue(LinkedList<ModelProperty> workQueue) {
+        Map<String, ModelProperty> tmpMap = new HashMap<String, ModelProperty>();
+        for (ModelProperty mp : workQueue) {
+            tmpMap.put(mp.getUri(), mp);
+            if (ModelUri.matches(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY, mp.getUri())) {
+                break;
+            }
+        }
+        return tmpMap;
+    }
+
+    /**
+     * Pushes the URIs of the first dependency from the specified work queue to the specified result stack.
+     *
+     * @param workQueue
+     * @param resultStack the result stack
+     * @return map of properties of the pushed dependency, where the key is the URI and value is ModelProperty.
+     */
+    private Map<String, ModelProperty> pushDependencyFromQueue(LinkedList<ModelProperty> workQueue, Stack<ModelProperty> resultStack) {
+        Map<String, ModelProperty> tmpMap = new HashMap<String, ModelProperty>();
+        for (Iterator<ModelProperty> i = workQueue.iterator(); i.hasNext();) {
+            ModelProperty mp = i.next();
+            i.remove();
+            System.out.println("WQ-> Result " + mp);
+            resultStack.push(mp);
+            tmpMap.put(mp.getUri(), mp);
+            if (ModelUri.matches(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY, mp.getUri())) {
+                break;
+            }
+        }
+        return tmpMap;
+    }
+
+    private static int[] getIndexForDependencies(List<ModelProperty> modelList) {
+        int startIndex = -1, endIndex = -1;
+        for (int i = 0; i < modelList.size(); i++) {
+            ModelProperty mp = modelList.get(i);
+            if (ModelUri.matches(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY, mp.getUri()) && startIndex < 0) {
+                startIndex = i;
+            } else
+            if (startIndex > -1 && !mp.getUri().startsWith(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY.getUri())) {
+                endIndex = i;
+                break;
+            }
+        }
+        if (endIndex == -1) {
+            endIndex = modelList.size();
+        }
+        return new int[]{startIndex, endIndex};
+        // dependencyManagementList = modelList.subList(startIndex, endIndex);
+        // return startIndex;
+    }
+}

Added: maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/impl/PomClassicTransformer.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/impl/PomClassicTransformer.java?rev=660806&view=auto
==============================================================================
--- maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/impl/PomClassicTransformer.java (added)
+++ maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/impl/PomClassicTransformer.java Tue May 27 21:10:47 2008
@@ -0,0 +1,58 @@
+package org.apache.maven.project.impl;
+
+import org.apache.maven.project.*;
+import org.apache.maven.project.ModelProperty;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
+import org.codehaus.plexus.util.introspection.ReflectionValueExtractor;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+
+import java.util.*;
+import java.io.StringReader;
+import java.io.IOException;
+
+public class PomClassicTransformer implements ModelTransformer {
+
+    private final static int basePosition = ModelUri.BASE.getUri().length();
+
+    private ModelTransformerContext ctx;
+
+    public DomainModel transformToDomainModel(List<ModelProperty> properties) {
+
+        StringReader sReader = new StringReader(new ModelMarshaller().unmarshalModelPropertiesToXml(properties));
+        Model model = null;
+        MavenXpp3Reader modelReader = new MavenXpp3Reader();
+        try {
+            model = modelReader.read(sReader);
+        }
+        catch (IOException e) {
+            e.printStackTrace();
+        }
+        catch (XmlPullParserException e) {
+            e.printStackTrace();
+        }
+        return new PomDomainModel(model);
+    }
+
+    public List<ModelProperty> transformToModelProperties(List<DomainModel> domainModels) {
+        return null;
+    }
+
+    public void init(ModelTransformerContext ctx) {
+        this.ctx = ctx;
+    }
+
+    private static String getDotNotationFromUri(String uri) {
+        return uri.substring(basePosition).replace("#collection", "").replace("/", ".");
+    }
+
+    private static List<String> getMethodNamesFromUri(String uri) {
+        List<String> methodNames = new ArrayList<String>();
+        for (String name : uri.substring(basePosition).replace("#collection", "").split("/")) {
+            methodNames.add(name.substring(0, 1).toUpperCase() + name.substring(1));
+        }
+        return methodNames;
+    }
+
+}
+

Added: maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/impl/PomDomainModel.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/impl/PomDomainModel.java?rev=660806&view=auto
==============================================================================
--- maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/impl/PomDomainModel.java (added)
+++ maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/impl/PomDomainModel.java Tue May 27 21:10:47 2008
@@ -0,0 +1,34 @@
+package org.apache.maven.project.impl;
+
+import org.apache.maven.project.DomainModel;
+import org.apache.maven.model.Model;
+
+public class PomDomainModel implements DomainModel {
+    private Model model;
+
+    public PomDomainModel(Model model) {
+        if(model == null) {
+            throw new IllegalArgumentException("model");
+        }
+        this.model = model;
+    }
+
+    public Model getModel() {
+        return model;
+    }
+
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        PomDomainModel that = (PomDomainModel) o;
+
+        if (!model.equals(that.model)) return false;
+
+        return true;
+    }
+
+    public int hashCode() {
+        return model.hashCode();
+    }
+}

Added: maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/impl/ProjectProcessor.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/impl/ProjectProcessor.java?rev=660806&view=auto
==============================================================================
--- maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/impl/ProjectProcessor.java (added)
+++ maven/sandbox/trunk/other/maven-project/src/main/java/org/apache/maven/project/impl/ProjectProcessor.java Tue May 27 21:10:47 2008
@@ -0,0 +1,16 @@
+package org.apache.maven.project.impl;
+
+import org.apache.maven.project.ModelProcessor;
+import org.apache.maven.project.ModelProperty;
+import org.apache.maven.project.ModelPropertySorter;
+
+import java.util.List;
+
+public class ProjectProcessor implements ModelProcessor {
+
+    public void process(List<ModelProperty> list) {
+        List<ModelProperty> properties = ModelPropertySorter.sort(list);
+        DependencyManagementProcessor processor = new DependencyManagementProcessor();
+        processor.process(properties);
+    }
+}

Added: maven/sandbox/trunk/other/maven-project/src/main/resources/pom.xml
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/other/maven-project/src/main/resources/pom.xml?rev=660806&view=auto
==============================================================================
--- maven/sandbox/trunk/other/maven-project/src/main/resources/pom.xml (added)
+++ maven/sandbox/trunk/other/maven-project/src/main/resources/pom.xml Tue May 27 21:10:47 2008
@@ -0,0 +1,585 @@
+<project>
+    <parent>
+        <artifactId/>
+        <groupId/>
+        <version/>
+        <relativePath/>
+    </parent>
+    <modelVersion/>
+    <groupId/>
+    <artifactId/>
+    <packaging/>
+    <name/>
+    <version/>
+    <description/>
+    <url/>
+    <prerequisites>
+        <maven/>
+    </prerequisites>
+    <issueManagement>
+        <system/>
+        <url/>
+    </issueManagement>
+    <ciManagement>
+        <system/>
+        <url/>
+        <notifiers>
+            <notifier>
+                <type/>
+                <sendOnError/>
+                <sendOnFailure/>
+                <sendOnSuccess/>
+                <sendOnWarning/>
+                <address/>
+                <configuration/>
+            </notifier>
+        </notifiers>
+    </ciManagement>
+    <inceptionYear/>
+    <mailingLists>
+        <mailingList>
+            <name/>
+            <subscribe/>
+            <unsubscribe/>
+            <post/>
+            <archive/>
+            <otherArchives/>
+        </mailingList>
+    </mailingLists>
+    <developers>
+        <developer>
+            <id/>
+            <name/>
+            <email/>
+            <url/>
+            <organization/>
+            <organizationUrl/>
+            <roles/>
+            <timezone/>
+            <properties/>
+        </developer>
+    </developers>
+    <contributors>
+        <contributor>
+            <name/>
+            <email/>
+            <url/>
+            <organization/>
+            <organizationUrl/>
+            <roles/>
+            <timezone/>
+            <properties/>
+        </contributor>
+    </contributors>
+    <licenses>
+        <license>
+            <name/>
+            <url/>
+            <distribution/>
+            <comments/>
+        </license>
+    </licenses>
+    <scm>
+        <connection/>
+        <developerConnection/>
+        <tag/>
+        <url/>
+    </scm>
+    <organization>
+        <name/>
+        <url/>
+    </organization>
+    <build>
+        <sourceDirectory/>
+        <scriptSourceDirectory/>
+        <testSourceDirectory/>
+        <outputDirectory/>
+        <testOutputDirectory/>
+        <extensions>
+            <extension>
+                <groupId/>
+                <artifactId/>
+                <version/>
+            </extension>
+        </extensions>
+        <defaultGoal/>
+        <resources>
+            <resource>
+                <targetPath/>
+                <filtering/>
+                <directory/>
+                <includes/>
+                <excludes/>
+            </resource>
+        </resources>
+        <testResources>
+            <testResource>
+                <targetPath/>
+                <filtering/>
+                <directory/>
+                <includes/>
+                <excludes/>
+            </testResource>
+        </testResources>
+        <directory/>
+        <finalName/>
+        <filters/>
+        <pluginManagement>
+            <plugins>
+                <plugin>
+                    <groupId/>
+                    <artifactId/>
+                    <version/>
+                    <extensions/>
+                    <executions>
+                        <execution>
+                            <id/>
+                            <phase/>
+                            <goals/>
+                            <inherited/>
+                            <configuration/>
+                        </execution>
+                    </executions>
+                    <dependencies>
+                        <dependency>
+                            <groupId/>
+                            <artifactId/>
+                            <version/>
+                            <type/>
+                            <classifier/>
+                            <scope/>
+                            <systemPath/>
+                            <exclusions>
+                                <exclusion>
+                                    <artifactId/>
+                                    <groupId/>
+                                </exclusion>
+                            </exclusions>
+                            <optional/>
+                        </dependency>
+                    </dependencies>
+                    <goals/>
+                    <inherited/>
+                    <configuration/>
+                </plugin>
+            </plugins>
+        </pluginManagement>
+        <plugins>
+            <plugin>
+                <groupId/>
+                <artifactId/>
+                <version/>
+                <extensions/>
+                <executions>
+                    <execution>
+                        <id/>
+                        <phase/>
+                        <goals/>
+                        <inherited/>
+                        <configuration/>
+                    </execution>
+                </executions>
+                <dependencies>
+                    <dependency>
+                        <groupId/>
+                        <artifactId/>
+                        <version/>
+                        <type/>
+                        <classifier/>
+                        <scope/>
+                        <systemPath/>
+                        <exclusions>
+                            <exclusion>
+                                <artifactId/>
+                                <groupId/>
+                            </exclusion>
+                        </exclusions>
+                        <optional/>
+                    </dependency>
+                </dependencies>
+                <goals/>
+                <inherited/>
+                <configuration/>
+            </plugin>
+        </plugins>
+    </build>
+    <profiles>
+        <profile>
+            <id/>
+            <activation>
+                <activeByDefault/>
+                <jdk/>
+                <os>
+                    <name/>
+                    <family/>
+                    <arch/>
+                    <version/>
+                </os>
+                <property>
+                    <name/>
+                    <value/>
+                </property>
+                <file>
+                    <missing/>
+                    <exists/>
+                </file>
+            </activation>
+            <build>
+                <defaultGoal/>
+                <resources>
+                    <resource>
+                        <targetPath/>
+                        <filtering/>
+                        <directory/>
+                        <includes/>
+                        <excludes/>
+                    </resource>
+                </resources>
+                <testResources>
+                    <testResource>
+                        <targetPath/>
+                        <filtering/>
+                        <directory/>
+                        <includes/>
+                        <excludes/>
+                    </testResource>
+                </testResources>
+                <directory/>
+                <finalName/>
+                <filters/>
+                <pluginManagement>
+                    <plugins>
+                        <plugin>
+                            <groupId/>
+                            <artifactId/>
+                            <version/>
+                            <extensions/>
+                            <executions>
+                                <execution>
+                                    <id/>
+                                    <phase/>
+                                    <goals/>
+                                    <inherited/>
+                                    <configuration/>
+                                </execution>
+                            </executions>
+                            <dependencies>
+                                <dependency>
+                                    <groupId/>
+                                    <artifactId/>
+                                    <version/>
+                                    <type/>
+                                    <classifier/>
+                                    <scope/>
+                                    <systemPath/>
+                                    <exclusions>
+                                        <exclusion>
+                                            <artifactId/>
+                                            <groupId/>
+                                        </exclusion>
+                                    </exclusions>
+                                    <optional/>
+                                </dependency>
+                            </dependencies>
+                            <goals/>
+                            <inherited/>
+                            <configuration/>
+                        </plugin>
+                    </plugins>
+                </pluginManagement>
+                <plugins>
+                    <plugin>
+                        <groupId/>
+                        <artifactId/>
+                        <version/>
+                        <extensions/>
+                        <executions>
+                            <execution>
+                                <id/>
+                                <phase/>
+                                <goals/>
+                                <inherited/>
+                                <configuration/>
+                            </execution>
+                        </executions>
+                        <dependencies>
+                            <dependency>
+                                <groupId/>
+                                <artifactId/>
+                                <version/>
+                                <type/>
+                                <classifier/>
+                                <scope/>
+                                <systemPath/>
+                                <exclusions>
+                                    <exclusion>
+                                        <artifactId/>
+                                        <groupId/>
+                                    </exclusion>
+                                </exclusions>
+                                <optional/>
+                            </dependency>
+                        </dependencies>
+                        <goals/>
+                        <inherited/>
+                        <configuration/>
+                    </plugin>
+                </plugins>
+            </build>
+            <modules/>
+            <repositories>
+                <repository>
+                    <releases>
+                        <enabled/>
+                        <updatePolicy/>
+                        <checksumPolicy/>
+                    </releases>
+                    <snapshots>
+                        <enabled/>
+                        <updatePolicy/>
+                        <checksumPolicy/>
+                    </snapshots>
+                    <id/>
+                    <name/>
+                    <url/>
+                    <layout/>
+                </repository>
+            </repositories>
+            <pluginRepositories>
+                <pluginRepository>
+                    <releases>
+                        <enabled/>
+                        <updatePolicy/>
+                        <checksumPolicy/>
+                    </releases>
+                    <snapshots>
+                        <enabled/>
+                        <updatePolicy/>
+                        <checksumPolicy/>
+                    </snapshots>
+                    <id/>
+                    <name/>
+                    <url/>
+                    <layout/>
+                </pluginRepository>
+            </pluginRepositories>
+            <dependencies>
+                <dependency>
+                    <groupId/>
+                    <artifactId/>
+                    <version/>
+                    <type/>
+                    <classifier/>
+                    <scope/>
+                    <systemPath/>
+                    <exclusions>
+                        <exclusion>
+                            <artifactId/>
+                            <groupId/>
+                        </exclusion>
+                    </exclusions>
+                    <optional/>
+                </dependency>
+            </dependencies>
+            <reports/>
+            <reporting>
+                <excludeDefaults/>
+                <outputDirectory/>
+                <plugins>
+                    <plugin>
+                        <groupId/>
+                        <artifactId/>
+                        <version/>
+                        <inherited/>
+                        <configuration/>
+                        <reportSets>
+                            <reportSet>
+                                <id/>
+                                <configuration/>
+                                <inherited/>
+                                <reports/>
+                            </reportSet>
+                        </reportSets>
+                    </plugin>
+                </plugins>
+            </reporting>
+            <dependencyManagement>
+                <dependencies>
+                    <dependency>
+                        <groupId/>
+                        <artifactId/>
+                        <version/>
+                        <type/>
+                        <classifier/>
+                        <scope/>
+                        <systemPath/>
+                        <exclusions>
+                            <exclusion>
+                                <artifactId/>
+                                <groupId/>
+                            </exclusion>
+                        </exclusions>
+                        <optional/>
+                    </dependency>
+                </dependencies>
+            </dependencyManagement>
+            <distributionManagement>
+                <repository>
+                    <uniqueVersion/>
+                    <id/>
+                    <name/>
+                    <url/>
+                    <layout/>
+                </repository>
+                <snapshotRepository>
+                    <uniqueVersion/>
+                    <id/>
+                    <name/>
+                    <url/>
+                    <layout/>
+                </snapshotRepository>
+                <site>
+                    <id/>
+                    <name/>
+                    <url/>
+                </site>
+                <downloadUrl/>
+                <relocation>
+                    <groupId/>
+                    <artifactId/>
+                    <version/>
+                    <message/>
+                </relocation>
+                <status/>
+            </distributionManagement>
+            <properties/>
+        </profile>
+    </profiles>
+    <modules/>
+    <repositories>
+        <repository>
+            <releases>
+                <enabled/>
+                <updatePolicy/>
+                <checksumPolicy/>
+            </releases>
+            <snapshots>
+                <enabled/>
+                <updatePolicy/>
+                <checksumPolicy/>
+            </snapshots>
+            <id/>
+            <name/>
+            <url/>
+            <layout/>
+        </repository>
+    </repositories>
+    <pluginRepositories>
+        <pluginRepository>
+            <releases>
+                <enabled/>
+                <updatePolicy/>
+                <checksumPolicy/>
+            </releases>
+            <snapshots>
+                <enabled/>
+                <updatePolicy/>
+                <checksumPolicy/>
+            </snapshots>
+            <id/>
+            <name/>
+            <url/>
+            <layout/>
+        </pluginRepository>
+    </pluginRepositories>
+    <dependencies>
+        <dependency>
+            <groupId/>
+            <artifactId/>
+            <version/>
+            <type/>
+            <classifier/>
+            <scope/>
+            <systemPath/>
+            <exclusions>
+                <exclusion>
+                    <artifactId/>
+                    <groupId/>
+                </exclusion>
+            </exclusions>
+            <optional/>
+        </dependency>
+    </dependencies>
+    <reports/>
+    <reporting>
+        <excludeDefaults/>
+        <outputDirectory/>
+        <plugins>
+            <plugin>
+                <groupId/>
+                <artifactId/>
+                <version/>
+                <inherited/>
+                <configuration/>
+                <reportSets>
+                    <reportSet>
+                        <id/>
+                        <configuration/>
+                        <inherited/>
+                        <reports/>
+                    </reportSet>
+                </reportSets>
+            </plugin>
+        </plugins>
+    </reporting>
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId/>
+                <artifactId/>
+                <version/>
+                <type/>
+                <classifier/>
+                <scope/>
+                <systemPath/>
+                <exclusions>
+                    <exclusion>
+                        <artifactId/>
+                        <groupId/>
+                    </exclusion>
+                </exclusions>
+                <optional/>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+    <distributionManagement>
+        <repository>
+            <uniqueVersion/>
+            <id/>
+            <name/>
+            <url/>
+            <layout/>
+        </repository>
+        <snapshotRepository>
+            <uniqueVersion/>
+            <id/>
+            <name/>
+            <url/>
+            <layout/>
+        </snapshotRepository>
+        <site>
+            <id/>
+            <name/>
+            <url/>
+        </site>
+        <downloadUrl/>
+        <relocation>
+            <groupId/>
+            <artifactId/>
+            <version/>
+            <message/>
+        </relocation>
+        <status/>
+    </distributionManagement>
+    <properties/>
+</project>
\ No newline at end of file

Added: maven/sandbox/trunk/other/maven-project/src/main/resources/text.xml
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/other/maven-project/src/main/resources/text.xml?rev=660806&view=auto
==============================================================================
--- maven/sandbox/trunk/other/maven-project/src/main/resources/text.xml (added)
+++ maven/sandbox/trunk/other/maven-project/src/main/resources/text.xml Tue May 27 21:10:47 2008
@@ -0,0 +1,68 @@
+<project>
+    <dependencies>
+        <dependency>
+            <version>
+                1.4
+            </version>
+            <artifactId>
+                artifact-dep
+            </artifactId>
+            <groupId>
+                org.apache.maven.dep
+            </groupId>
+
+        </dependency>
+        <dependency>
+            <scope>
+                compile
+            </scope>
+            <version>
+                1.1
+            </version>
+            <artifactId>
+                artifact-dep
+            </artifactId>
+            <groupId>
+                org.apache.maven.dep
+            </groupId>
+
+        </dependency>
+        <dependency>
+            <version>
+                1.0
+            </version>
+            <artifactId>
+                bogus-dep
+            </artifactId>
+            <groupId>
+                org.bogus
+            </groupId>
+
+        </dependency>
+        <dependency>
+            <version>
+                1.1
+            </version>
+            <artifactId>
+                artifact-dep
+            </artifactId>
+            <groupId>
+                org.apache.maven.dep
+            </groupId>
+
+        </dependency>
+
+    </dependencies>
+
+</dependencyManagement>
+<dependencies>
+<dependency>
+    <artifactId>
+        org.apache.maven.dep
+    </artifactId>
+
+</dependency>
+
+</dependencies>
+
+        </project>
\ No newline at end of file

Added: maven/sandbox/trunk/other/maven-project/src/test/java/org/apache/maven/project/PomBuilder.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/other/maven-project/src/test/java/org/apache/maven/project/PomBuilder.java?rev=660806&view=auto
==============================================================================
--- maven/sandbox/trunk/other/maven-project/src/test/java/org/apache/maven/project/PomBuilder.java (added)
+++ maven/sandbox/trunk/other/maven-project/src/test/java/org/apache/maven/project/PomBuilder.java Tue May 27 21:10:47 2008
@@ -0,0 +1,191 @@
+package org.apache.maven.project;
+
+import junit.framework.TestCase;
+import org.apache.maven.project.impl.PomClassicTransformer;
+import org.apache.maven.project.impl.PomDomainModel;
+import org.apache.maven.project.impl.DependencyManagementProcessor;
+import org.apache.maven.project.interpolation.ModelInterpolationException;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
+import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+
+import java.util.LinkedList;
+import java.util.List;
+import java.io.StringWriter;
+import java.io.IOException;
+import java.io.StringReader;
+
+
+public class PomBuilder extends TestCase {
+
+    public void testA() {
+        PomClassicTransformer b = new PomClassicTransformer();
+
+        LinkedList<ModelProperty> mp = new LinkedList<ModelProperty>();
+        mp.add(new ModelProperty(ModelUri.PROJECT.getUri(), null));
+        mp.add(new ModelProperty(ModelUri.PROJECT_ARTIFACTID.getUri(), "org.apache.maven"));
+        mp.add(new ModelProperty(ModelUri.PROJECT.getUri(), null));
+        mp.add(new ModelProperty(ModelUri.PROJECT_ARTIFACTID.getUri(), "org.apache.maven.new"));
+
+        List<ModelProperty> p = ModelPropertySorter.sort(mp);
+        for (ModelProperty prop : p) {
+            System.out.println(prop);
+        }
+    }
+
+    public void testB() {
+        PomClassicTransformer b = new PomClassicTransformer();
+
+        LinkedList<ModelProperty> mp = new LinkedList<ModelProperty>();
+        mp.add(new ModelProperty(ModelUri.PROJECT.getUri(), null));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCIES.getUri(), null));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCIES_DEPENDENCY.getUri(), null));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCIES_DEPENDENCY_ARTIFACTID.getUri(), "org.apache.maven.dep"));
+
+        mp.add(new ModelProperty(ModelUri.PROJECT_ARTIFACTID.getUri(), "org.apache.maven"));
+
+        mp.add(new ModelProperty(ModelUri.PROJECT.getUri(), null));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCIES.getUri(), null));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCIES_DEPENDENCY.getUri(), null));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCIES_DEPENDENCY_ARTIFACTID.getUri(), "org.apache.maven.dep1"));
+
+        List<ModelProperty> p = ModelPropertySorter.sort(mp);
+        for (ModelProperty prop : p) {
+            System.out.println(prop);
+        }
+    }
+
+    public void testC() {
+        PomClassicTransformer b = new PomClassicTransformer();
+
+        LinkedList<ModelProperty> mp = new LinkedList<ModelProperty>();
+        mp.add(new ModelProperty(ModelUri.PROJECT.getUri(), null));
+        mp.add(new ModelProperty(ModelUri.PROJECT_ARTIFACTID.getUri(), "org.apache.maven"));
+        mp.add(new ModelProperty(ModelUri.PROJECT.getUri(), null));
+        mp.add(new ModelProperty(ModelUri.PROJECT_ARTIFACTID.getUri(), "org.apache.maven.new"));
+
+        Model model = ((PomDomainModel) b.transformToDomainModel(mp)).getModel();
+        assertEquals("org.apache.maven", model.getArtifactId());
+    }
+
+    public void testD() {
+        PomClassicTransformer b = new PomClassicTransformer();
+
+        LinkedList<ModelProperty> mp = new LinkedList<ModelProperty>();
+        mp.add(new ModelProperty(ModelUri.PROJECT.getUri(), null));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCIES.getUri(), null));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCIES_DEPENDENCY.getUri(), null));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCIES_DEPENDENCY_ARTIFACTID.getUri(), "org.apache.maven.dep"));
+
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES.getUri(), null));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY.getUri(), null));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_GROUPID.getUri(), "org.apache.maven.dep"));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_ARTIFACTID.getUri(), "artifact-dep"));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_VERSION.getUri(), "1.1"));
+
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY.getUri(), null));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_GROUPID.getUri(), "org.bogus"));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_ARTIFACTID.getUri(), "bogus-dep"));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_VERSION.getUri(), "1.0"));
+
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES.getUri(), null));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY.getUri(), null));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_GROUPID.getUri(), "org.apache.maven.dep"));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_ARTIFACTID.getUri(), "artifact-dep"));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_VERSION.getUri(), "1.1"));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_SCOPE.getUri(), "compile"));
+
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES.getUri(), null));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_GROUPID.getUri(), "org.apache.maven.dep"));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_ARTIFACTID.getUri(), "artifact-dep"));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_VERSION.getUri(), "1.4"));
+
+        List<ModelProperty> p = ModelPropertySorter.sort(mp);
+        for (ModelProperty prop : p) {
+            System.out.println(prop);
+        }
+    }
+
+    public void testE() {
+        PomClassicTransformer b = new PomClassicTransformer();
+
+        LinkedList<ModelProperty> mp = new LinkedList<ModelProperty>();
+        mp.add(new ModelProperty(ModelUri.PROJECT.getUri(), null));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCIES.getUri(), null));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCIES_DEPENDENCY.getUri(), null));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCIES_DEPENDENCY_ARTIFACTID.getUri(), "org.apache.maven.dep"));
+
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT.getUri(), null));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES.getUri(), null));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY.getUri(), null));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_GROUPID.getUri(), "org.apache.maven.dep"));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_ARTIFACTID.getUri(), "artifact-dep"));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_VERSION.getUri(), "1.1"));
+
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY.getUri(), null));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_GROUPID.getUri(), "org.bogus"));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_ARTIFACTID.getUri(), "bogus-dep"));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_VERSION.getUri(), "1.0"));
+
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES.getUri(), null));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY.getUri(), null));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_GROUPID.getUri(), "org.apache.maven.dep"));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_ARTIFACTID.getUri(), "artifact-dep"));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_VERSION.getUri(), "1.1"));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_SCOPE.getUri(), "compile"));
+
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES.getUri(), null));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY.getUri(), null));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_GROUPID.getUri(), "org.apache.maven.dep"));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_ARTIFACTID.getUri(), "artifact-dep"));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_VERSION.getUri(), "1.4"));
+       for (ModelProperty prop : mp) {
+            System.out.println(prop);
+        }
+        System.out.println("-------");
+       List<ModelProperty> p = ModelPropertySorter.sort(mp);
+       for (ModelProperty prop : p) {
+            System.out.println(prop);
+        }
+
+        DependencyManagementProcessor pr = new DependencyManagementProcessor();
+        pr.process(p);
+          System.out.println("Processed List:");
+         for (ModelProperty prop : p) {
+           // System.out.println(prop);
+        }
+
+        String xml = new ModelMarshaller().unmarshalModelPropertiesToXml(p);
+        System.out.println("XML OUTPUT---------------");
+        System.out.println(xml);
+        StringReader sReader = new StringReader(xml);
+        Model model = null;
+        MavenXpp3Reader modelReader = new MavenXpp3Reader();
+        try {
+            model = modelReader.read(sReader);
+        }
+        catch (IOException e) {
+            e.printStackTrace();
+        }
+        catch (XmlPullParserException e) {
+            e.printStackTrace();
+        }
+
+
+        if (model == null) {
+            System.out.println("Model null");
+        }
+        StringWriter sWriter = new StringWriter();
+
+        MavenXpp3Writer writer = new MavenXpp3Writer();
+        try {
+            writer.write(sWriter, model);
+        }
+        catch (IOException e) {
+            e.printStackTrace();
+        }
+        System.out.println(sWriter);
+
+    }
+}

Added: maven/sandbox/trunk/other/maven-project/src/test/java/org/apache/maven/project/impl/DependencyManagementProcessorTest.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/other/maven-project/src/test/java/org/apache/maven/project/impl/DependencyManagementProcessorTest.java?rev=660806&view=auto
==============================================================================
--- maven/sandbox/trunk/other/maven-project/src/test/java/org/apache/maven/project/impl/DependencyManagementProcessorTest.java (added)
+++ maven/sandbox/trunk/other/maven-project/src/test/java/org/apache/maven/project/impl/DependencyManagementProcessorTest.java Tue May 27 21:10:47 2008
@@ -0,0 +1,152 @@
+package org.apache.maven.project.impl;
+
+import junit.framework.TestCase;
+import org.apache.maven.project.ModelProperty;
+import org.apache.maven.project.ModelUri;
+import org.apache.maven.project.ModelPropertySorter;
+
+import java.util.*;
+
+public class DependencyManagementProcessorTest extends TestCase {
+
+    public void testSimpleOveriddenDependency() {
+        LinkedList<ModelProperty> mp = new LinkedList<ModelProperty>();
+
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_GROUPID.getUri(), "org.apache.maven.dep"));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_ARTIFACTID.getUri(), "artifact-dep"));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_VERSION.getUri(), "1.1"));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY.getUri(), null));
+
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_GROUPID.getUri(), "org.apache.maven.dep"));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_ARTIFACTID.getUri(), "artifact-dep"));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_VERSION.getUri(), "1.4"));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY.getUri(), null));
+
+        LinkedList<ModelProperty> workQueue = new LinkedList<ModelProperty>(mp);
+
+        Stack<ModelProperty> result = new Stack<ModelProperty>();
+        DependencyManagementProcessor pr = new DependencyManagementProcessor();
+        pr.pushDependenciesFromQueue(workQueue, result);
+        assertEquals("Incorrect size of result.", 4, result.size());
+        assertTrue("Result does not contain correct version: ",
+                contains(result, ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_VERSION.getUri(), "1.1"));
+        assertEquals("Incorrect size of work queue", 0, workQueue.size());
+    }
+
+    public void testOveriddenDependency() {
+        LinkedList<ModelProperty> mp = new LinkedList<ModelProperty>();
+
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_GROUPID.getUri(), "org.apache.maven.dep"));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_ARTIFACTID.getUri(), "artifact-dep"));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_VERSION.getUri(), "1.1"));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY.getUri(), null));
+
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_GROUPID.getUri(), "org.bogus"));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_ARTIFACTID.getUri(), "bogus-dep"));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_VERSION.getUri(), "1.0"));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY.getUri(), null));
+
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_GROUPID.getUri(), "org.apache.maven.dep"));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_ARTIFACTID.getUri(), "artifact-dep"));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_VERSION.getUri(), "1.4"));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY.getUri(), null));
+
+        LinkedList<ModelProperty> workQueue = new LinkedList<ModelProperty>(mp);
+
+        Stack<ModelProperty> result = new Stack<ModelProperty>();
+        DependencyManagementProcessor pr = new DependencyManagementProcessor();
+        pr.pushDependenciesFromQueue(workQueue, result);
+        for (ModelProperty p : result) {
+            System.out.println("P:" + p);
+        }
+        assertEquals("Incorrect size of result.", 4, result.size());
+        assertTrue("Does not contain correct version: ",
+                contains(result, ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_VERSION.getUri(), "1.1"));
+        //   assertEquals("Incorrect size of work queue", 4, workQueue.size());
+        //   assertTrue("Work queue has incorrect entry" ,
+        //           contains(result, ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_GROUPID.getUri(), "org.bogus"));
+    }
+
+    public void testJoinedDependency() {
+        LinkedList<ModelProperty> mp = new LinkedList<ModelProperty>();
+
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_GROUPID.getUri(), "org.apache.maven.dep"));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_ARTIFACTID.getUri(), "artifact-dep"));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_VERSION.getUri(), "1.1"));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY.getUri(), null));
+
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_GROUPID.getUri(), "org.bogus"));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_ARTIFACTID.getUri(), "bogus-dep"));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_VERSION.getUri(), "1.0"));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY.getUri(), null));
+
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_GROUPID.getUri(), "org.apache.maven.dep"));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_ARTIFACTID.getUri(), "artifact-dep"));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_VERSION.getUri(), "1.1"));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_SCOPE.getUri(), "compile"));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY.getUri(), null));
+
+        LinkedList<ModelProperty> workQueue = new LinkedList<ModelProperty>(mp);
+
+        Stack<ModelProperty> result = new Stack<ModelProperty>();
+        DependencyManagementProcessor pr = new DependencyManagementProcessor();
+        pr.pushDependenciesFromQueue(workQueue, result);
+        for (ModelProperty p : result) {
+            System.out.println("P:" + p);
+        }
+        assertEquals("Incorrect size of result.", 5, result.size());
+        assertTrue("Does not contain correct version: ",
+                contains(result, ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_VERSION.getUri(), "1.1"));
+        assertTrue("Does not contain joined URIs: ",
+                contains(result, ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_SCOPE.getUri(), "compile"));
+    }
+
+    public void testTwoJoinedDependencies() {
+        LinkedList<ModelProperty> mp = new LinkedList<ModelProperty>();
+
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_GROUPID.getUri(), "org.apache.maven.dep"));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_ARTIFACTID.getUri(), "artifact-dep"));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_VERSION.getUri(), "1.1"));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY.getUri(), null));
+
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_GROUPID.getUri(), "org.bogus"));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_ARTIFACTID.getUri(), "bogus-dep"));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_VERSION.getUri(), "1.0"));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY.getUri(), null));
+
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_GROUPID.getUri(), "org.apache.maven.dep"));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_ARTIFACTID.getUri(), "artifact-dep"));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_VERSION.getUri(), "1.1"));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_SCOPE.getUri(), "compile"));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY.getUri(), null));
+
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_GROUPID.getUri(), "org.bogus"));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_ARTIFACTID.getUri(), "bogus-dep"));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_VERSION.getUri(), "1.0"));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_SCOPE.getUri(), "runtime"));
+        mp.add(new ModelProperty(ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY.getUri(), null));
+
+        LinkedList<ModelProperty> workQueue = new LinkedList<ModelProperty>(mp);
+
+        Stack<ModelProperty> result = new Stack<ModelProperty>();
+        DependencyManagementProcessor pr = new DependencyManagementProcessor();
+        pr.pushDependenciesFromQueue(workQueue, result);
+        for (ModelProperty p : result) {
+            System.out.println("P:" + p);
+        }
+        assertEquals("Incorrect size of result.", 5, result.size());
+        assertTrue("Does not contain correct version: ",
+                contains(result, ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_VERSION.getUri(), "1.1"));
+        assertTrue("Does not contain joined URIs: ",
+                contains(result, ModelUri.PROJECT_DEPENDENCYMANAGEMENT_DEPENDENCIES_DEPENDENCY_SCOPE.getUri(), "compile"));
+    }
+
+    private static boolean contains(Collection<ModelProperty> c, String uri, String value) {
+        for (ModelProperty mp : c) {
+            if (mp.getUri().equals(uri) && mp.getValue() != null && mp.getValue().equals(value)) {
+                return true;
+            }
+        }
+        return false;
+    }
+}



Mime
View raw message