maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sisb...@apache.org
Subject svn commit: r678213 [1/2] - in /maven/sandbox/trunk/shared/maven-shared-model/src: main/java/org/apache/maven/shared/model/ main/java/org/apache/maven/shared/model/impl/ test/java/org/apache/maven/shared/model/ test/java/org/apache/maven/shared/model/i...
Date Sat, 19 Jul 2008 20:09:36 GMT
Author: sisbell
Date: Sat Jul 19 13:09:35 2008
New Revision: 678213

URL: http://svn.apache.org/viewvc?rev=678213&view=rev
Log:
Maven code style.

Modified:
    maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/DataSourceException.java
    maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/DomainModel.java
    maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/InputStreamDomainModel.java
    maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/InterpolatorProperty.java
    maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/ModelContainer.java
    maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/ModelContainerAction.java
    maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/ModelContainerFactory.java
    maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/ModelDataSource.java
    maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/ModelMarshaller.java
    maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/ModelProperty.java
    maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/ModelTransformer.java
    maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/ModelTransformerContext.java
    maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/impl/DefaultModelDataSource.java
    maven/sandbox/trunk/shared/maven-shared-model/src/test/java/org/apache/maven/shared/model/ModelMarshallerTest.java
    maven/sandbox/trunk/shared/maven-shared-model/src/test/java/org/apache/maven/shared/model/ModelPropertyTest.java
    maven/sandbox/trunk/shared/maven-shared-model/src/test/java/org/apache/maven/shared/model/ModelTransformerContextTest.java
    maven/sandbox/trunk/shared/maven-shared-model/src/test/java/org/apache/maven/shared/model/impl/DefaultModelDataSourceTest.java

Modified: maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/DataSourceException.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/DataSourceException.java?rev=678213&r1=678212&r2=678213&view=diff
==============================================================================
--- maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/DataSourceException.java (original)
+++ maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/DataSourceException.java Sat Jul 19 13:09:35 2008
@@ -2,15 +2,19 @@
 
 import java.io.IOException;
 
-public class DataSourceException extends IOException {
+public class DataSourceException
+    extends IOException
+{
     static final long serialVersionUID = 8738495672439L;
 
-    public DataSourceException() {
+    public DataSourceException()
+    {
         super();
     }
 
-    public DataSourceException(String message) {
-        super(message);
+    public DataSourceException( String message )
+    {
+        super( message );
     }
 
 }

Modified: maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/DomainModel.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/DomainModel.java?rev=678213&r1=678212&r2=678213&view=diff
==============================================================================
--- maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/DomainModel.java (original)
+++ maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/DomainModel.java Sat Jul 19 13:09:35 2008
@@ -5,9 +5,10 @@
  * used to expose model elements directly. Each respective ModelTransformer implementation should know how to cast to
  * the appropriate domain model type(s).
  */
-public interface DomainModel {
+public interface DomainModel
+{
 
     String getEventHistory();
 
-    void setEventHistory(String history);
+    void setEventHistory( String history );
 }

Modified: maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/InputStreamDomainModel.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/InputStreamDomainModel.java?rev=678213&r1=678212&r2=678213&view=diff
==============================================================================
--- maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/InputStreamDomainModel.java (original)
+++ maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/InputStreamDomainModel.java Sat Jul 19 13:09:35 2008
@@ -5,10 +5,12 @@
 /**
  * Provides service for obtaining input stream of domain model.
  */
-public interface InputStreamDomainModel extends DomainModel {
+public interface InputStreamDomainModel
+    extends DomainModel
+{
 
     /**
-     * Returns input stream of domain model. 
+     * Returns input stream of domain model.
      *
      * @return input stream of domain model
      */

Modified: maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/InterpolatorProperty.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/InterpolatorProperty.java?rev=678213&r1=678212&r2=678213&view=diff
==============================================================================
--- maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/InterpolatorProperty.java (original)
+++ maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/InterpolatorProperty.java Sat Jul 19 13:09:35 2008
@@ -1,43 +1,60 @@
 package org.apache.maven.shared.model;
 
-public final class InterpolatorProperty {
+public final class InterpolatorProperty
+{
 
     private final String key;
 
     private final String value;
 
-    public InterpolatorProperty(String key, String value) {
-        if (key == null) {
-            throw new IllegalArgumentException("key: null");
+    public InterpolatorProperty( String key, String value )
+    {
+        if ( key == null )
+        {
+            throw new IllegalArgumentException( "key: null" );
         }
 
-        if (value == null) {
-            throw new IllegalArgumentException("value: null");
+        if ( value == null )
+        {
+            throw new IllegalArgumentException( "value: null" );
         }
         this.key = key;
         this.value = value;
     }
 
-    public String getKey() {
+    public String getKey()
+    {
         return key;
     }
 
-    public String getValue() {
+    public String getValue()
+    {
         return value;
     }
 
-    public boolean equals(Object o) {
-        if (this == o) return true;
-        if (o == null || getClass() != o.getClass()) return false;
+    public boolean equals( Object o )
+    {
+        if ( this == o )
+        {
+            return true;
+        }
+        if ( o == null || getClass() != o.getClass() )
+        {
+            return false;
+        }
 
         InterpolatorProperty that = (InterpolatorProperty) o;
 
-        if (!key.equals(that.key)) return false;
+        if ( !key.equals( that.key ) )
+        {
+            return false;
+        }
 
         return true;
     }
 
-    public int hashCode() {
+    public int hashCode()
+    {
         return key.hashCode();
     }
 

Modified: maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/ModelContainer.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/ModelContainer.java?rev=678213&r1=678212&r2=678213&view=diff
==============================================================================
--- maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/ModelContainer.java (original)
+++ maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/ModelContainer.java Sat Jul 19 13:09:35 2008
@@ -5,13 +5,14 @@
 /**
  * Provides services for determining actions to take: noop, delete, join. For example, say containers with the same ids
  * are joined, otherwise one must be deleted.
-<pre>
-  ModelContainerA.id = "foo" and
-  ModelContainerB.id = "foobar"
-</pre>
- * then ModelContainerA.containerAction(ModelContainerB) would return delete action for ModelContainerB.  
+ * <pre>
+ * ModelContainerA.id = "foo" and
+ * ModelContainerB.id = "foobar"
+ * </pre>
+ * then ModelContainerA.containerAction(ModelContainerB) would return delete action for ModelContainerB.
  */
-public interface ModelContainer {
+public interface ModelContainer
+{
 
     /**
      * Returns the model properties contained within the model container. This list must be unmodifiable.
@@ -26,7 +27,7 @@
      * @param modelContainer the model container to determine the action of
      * @return model container action (noop, delete, join) for the specified model container
      */
-    ModelContainerAction containerAction(ModelContainer modelContainer);
+    ModelContainerAction containerAction( ModelContainer modelContainer );
 
     /**
      * Creates new instance of model container.
@@ -34,8 +35,8 @@
      * @param modelProperties
      * @return new instance of model container
      */
-    ModelContainer createNewInstance(List<ModelProperty> modelProperties);
+    ModelContainer createNewInstance( List<ModelProperty> modelProperties );
+
+    void sort( List<ModelProperty> modelProperties );
 
-    void sort(List<ModelProperty> modelProperties);
-    
 }

Modified: maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/ModelContainerAction.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/ModelContainerAction.java?rev=678213&r1=678212&r2=678213&view=diff
==============================================================================
--- maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/ModelContainerAction.java (original)
+++ maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/ModelContainerAction.java Sat Jul 19 13:09:35 2008
@@ -3,7 +3,8 @@
 /**
  * Model container actions
  */
-public enum ModelContainerAction {
+public enum ModelContainerAction
+{
     /**
      * Join two containers
      */

Modified: maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/ModelContainerFactory.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/ModelContainerFactory.java?rev=678213&r1=678212&r2=678213&view=diff
==============================================================================
--- maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/ModelContainerFactory.java (original)
+++ maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/ModelContainerFactory.java Sat Jul 19 13:09:35 2008
@@ -7,10 +7,11 @@
  * Factory for returning model container instances. Unlike most factories, implementations of this class are meant to
  * create only one type of model container instance.
  */
-public interface ModelContainerFactory {
+public interface ModelContainerFactory
+{
 
     /**
-     * Returns collection of URIs asscociated with this factory. 
+     * Returns collection of URIs asscociated with this factory.
      *
      * @return collection of URIs asscociated with this factory
      */
@@ -24,5 +25,5 @@
      * @param modelProperties the model properties to be contained within the model container
      * @return the model container
      */
-    ModelContainer create(List<ModelProperty> modelProperties);
+    ModelContainer create( List<ModelProperty> modelProperties );
 }

Modified: maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/ModelDataSource.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/ModelDataSource.java?rev=678213&r1=678212&r2=678213&view=diff
==============================================================================
--- maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/ModelDataSource.java (original)
+++ maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/ModelDataSource.java Sat Jul 19 13:09:35 2008
@@ -6,7 +6,8 @@
 /**
  * Provides services for joining, deleting and querying model containers.
  */
-public interface ModelDataSource {
+public interface ModelDataSource
+{
 
     /**
      * Join model properties of the specified container a with the specified container b. Any elements of model container
@@ -17,14 +18,15 @@
      * @param b model container without precedence
      * @return joined model container
      */
-    ModelContainer join(ModelContainer a, ModelContainer b) throws DataSourceException;
+    ModelContainer join( ModelContainer a, ModelContainer b )
+        throws DataSourceException;
 
     /**
      * Deletes properties of the specified model container from the data source.
      *
      * @param modelContainer the model container that holds the properties to be deleted
      */
-    void delete(ModelContainer modelContainer);
+    void delete( ModelContainer modelContainer );
 
 
     /**
@@ -40,7 +42,8 @@
      * @param uri
      * @return
      */
-    List<ModelContainer> queryFor(String uri) throws DataSourceException;
+    List<ModelContainer> queryFor( String uri )
+        throws DataSourceException;
 
 
     /**
@@ -48,7 +51,7 @@
      *
      * @param modelProperties the model properties that back the data source
      */
-    void init(List<ModelProperty> modelProperties, Collection<ModelContainerFactory> modelContainerFactories);
+    void init( List<ModelProperty> modelProperties, Collection<ModelContainerFactory> modelContainerFactories );
 
     String getEventHistory();
 }

Modified: maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/ModelMarshaller.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/ModelMarshaller.java?rev=678213&r1=678212&r2=678213&view=diff
==============================================================================
--- maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/ModelMarshaller.java (original)
+++ maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/ModelMarshaller.java Sat Jul 19 13:09:35 2008
@@ -12,89 +12,117 @@
 /**
  * Provides methods for marshalling and unmarshalling XML that does not contain attributes.
  */
-public final class ModelMarshaller {
+public final class ModelMarshaller
+{
 
-    private ModelMarshaller() {
+    private ModelMarshaller()
+    {
     }
 
-    public static List<ModelProperty> marshallXmlToModelProperties(InputStream inputStream, String baseUri,
-                                                                   Set<String> collections)
-            throws IOException {
-        if (inputStream == null) {
-            throw new IllegalArgumentException("inputStream: null");
+    public static List<ModelProperty> marshallXmlToModelProperties( InputStream inputStream, String baseUri,
+                                                                    Set<String> collections )
+        throws IOException
+    {
+        if ( inputStream == null )
+        {
+            throw new IllegalArgumentException( "inputStream: null" );
+        }
+
+        if ( baseUri == null )
+        {
+            throw new IllegalArgumentException( "baseUri: null" );
         }
 
-        if (baseUri == null) {
-            throw new IllegalArgumentException("baseUri: null");
-        }
-
-        if (collections == null) {
+        if ( collections == null )
+        {
             collections = Collections.EMPTY_SET;
         }
 
         List<ModelProperty> modelProperties = new ArrayList<ModelProperty>();
         XMLInputFactory xmlInputFactory = XMLInputFactory.newInstance();
-        Uri uri = new Uri(baseUri);
+        Uri uri = new Uri( baseUri );
         String tagName = baseUri;
         String tagValue = null;
 
         int depth = 0;
         XMLStreamReader xmlStreamReader = null;
-        try {
-            xmlStreamReader = xmlInputFactory.createXMLStreamReader(inputStream);
+        try
+        {
+            xmlStreamReader = xmlInputFactory.createXMLStreamReader( inputStream );
             Map<String, String> attributes = new HashMap<String, String>();
-            for (; ; xmlStreamReader.next()) {
+            for ( ; ; xmlStreamReader.next() )
+            {
                 int type = xmlStreamReader.getEventType();
-                switch (type) {
+                switch ( type )
+                {
 
-                    case XMLStreamConstants.CHARACTERS: {
+                    case XMLStreamConstants.CHARACTERS:
+                    {
                         String tmp = xmlStreamReader.getText();
-                        if (tmp != null && tmp.trim().length() != 0) {
+                        if ( tmp != null && tmp.trim().length() != 0 )
+                        {
                             tagValue = tmp;
                         }
                         break;
                     }
 
-                    case XMLStreamConstants.START_ELEMENT: {
+                    case XMLStreamConstants.START_ELEMENT:
+                    {
                         depth++;
-                        if (!tagName.equals(baseUri)) {
-                            modelProperties.add(new ModelProperty(tagName, tagValue));
-                            if (!attributes.isEmpty()) {
-                                for (Map.Entry<String, String> e : attributes.entrySet()) {
-                                    modelProperties.add(new ModelProperty(e.getKey(), e.getValue()));
+                        if ( !tagName.equals( baseUri ) )
+                        {
+                            modelProperties.add( new ModelProperty( tagName, tagValue ) );
+                            if ( !attributes.isEmpty() )
+                            {
+                                for ( Map.Entry<String, String> e : attributes.entrySet() )
+                                {
+                                    modelProperties.add( new ModelProperty( e.getKey(), e.getValue() ) );
                                 }
                                 attributes.clear();
                             }
                         }
 
-                        tagName = uri.getUriFor(xmlStreamReader.getName().getLocalPart(), depth);
-                        if (collections.contains(tagName + "#collection")) {
+                        tagName = uri.getUriFor( xmlStreamReader.getName().getLocalPart(), depth );
+                        if ( collections.contains( tagName + "#collection" ) )
+                        {
                             tagName = tagName + "#collection";
-                            uri.addTag(xmlStreamReader.getName().getLocalPart() + "#collection");
-                        } else {
-                            uri.addTag(xmlStreamReader.getName().getLocalPart());
+                            uri.addTag( xmlStreamReader.getName().getLocalPart() + "#collection" );
+                        }
+                        else
+                        {
+                            uri.addTag( xmlStreamReader.getName().getLocalPart() );
                         }
                         tagValue = null;
 
                     }
-                    case XMLStreamConstants.ATTRIBUTE: {
-                        for (int i = 0; i < xmlStreamReader.getAttributeCount(); i++) {
-
-                            attributes.put(tagName + "#property/" + xmlStreamReader.getAttributeName(i).getLocalPart(),
-                                    xmlStreamReader.getAttributeValue(i));
+                    case XMLStreamConstants.ATTRIBUTE:
+                    {
+                        for ( int i = 0; i < xmlStreamReader.getAttributeCount(); i++ )
+                        {
+
+                            attributes.put(
+                                tagName + "#property/" + xmlStreamReader.getAttributeName( i ).getLocalPart(),
+                                xmlStreamReader.getAttributeValue( i ) );
                         }
                         break;
                     }
-                    case XMLStreamConstants.END_ELEMENT: {
+                    case XMLStreamConstants.END_ELEMENT:
+                    {
                         depth--;
-                        if (tagValue == null) tagValue = "";
+                        if ( tagValue == null )
+                        {
+                            tagValue = "";
+                        }
                         break;
                     }
-                    case XMLStreamConstants.END_DOCUMENT: {
-                        modelProperties.add(new ModelProperty(tagName, tagValue));
-                        if (!attributes.isEmpty()) {
-                            for (Map.Entry<String, String> e : attributes.entrySet()) {
-                                modelProperties.add(new ModelProperty(e.getKey(), e.getValue()));
+                    case XMLStreamConstants.END_DOCUMENT:
+                    {
+                        modelProperties.add( new ModelProperty( tagName, tagValue ) );
+                        if ( !attributes.isEmpty() )
+                        {
+                            for ( Map.Entry<String, String> e : attributes.entrySet() )
+                            {
+                                modelProperties.add( new ModelProperty( e.getKey(), e.getValue() ) );
                             }
                             attributes.clear();
                         }
@@ -102,31 +130,46 @@
                     }
                 }
             }
-        } catch (XMLStreamException e) {
-            throw new IOException(":" + e.toString());
-        } finally {
-            if (xmlStreamReader != null) {
-                try {
+        }
+        catch ( XMLStreamException e )
+        {
+            throw new IOException( ":" + e.toString() );
+        }
+        finally
+        {
+            if ( xmlStreamReader != null )
+            {
+                try
+                {
                     xmlStreamReader.close();
-                } catch (XMLStreamException e) {
+                }
+                catch ( XMLStreamException e )
+                {
                     e.printStackTrace();
                 }
             }
-            try {
+            try
+            {
                 inputStream.close();
-            } catch (IOException e) {
+            }
+            catch ( IOException e )
+            {
 
             }
         }
     }
 
-    public static String unmarshalModelPropertiesToXml(List<ModelProperty> modelProperties, String baseUri) throws IOException {
-        if (modelProperties == null || modelProperties.isEmpty()) {
-            throw new IllegalArgumentException("modelProperties: null or empty");
+    public static String unmarshalModelPropertiesToXml( List<ModelProperty> modelProperties, String baseUri )
+        throws IOException
+    {
+        if ( modelProperties == null || modelProperties.isEmpty() )
+        {
+            throw new IllegalArgumentException( "modelProperties: null or empty" );
         }
 
-        if (baseUri == null || baseUri.trim().length() == 0) {
-            throw new IllegalArgumentException("baseUri: null or empty");
+        if ( baseUri == null || baseUri.trim().length() == 0 )
+        {
+            throw new IllegalArgumentException( "baseUri: null or empty" );
         }
 
         final int basePosition = baseUri.length();
@@ -134,99 +177,123 @@
         StringBuffer sb = new StringBuffer();
         List<String> lastUriTags = new ArrayList<String>();
         int n = 1;
-        for (ModelProperty mp : modelProperties) {
+        for ( ModelProperty mp : modelProperties )
+        {
             String uri = mp.getUri();
-            if(uri.contains("#property")) {
-                continue;    
+            if ( uri.contains( "#property" ) )
+            {
+                continue;
             }
             //String val = (mp.getValue() != null) ? "\"" + mp.getValue() + "\"" : null;
             //   System.out.println("new ModelProperty(\"" + mp.getUri() +"\" , " + val +"),");
-            if (!uri.startsWith(baseUri)) {
-                throw new IllegalArgumentException("Passed in model property that does not match baseUri: Property URI = "
-                        + uri + ", Base URI = " + baseUri);
-            }
-            List<String> tagNames = getTagNamesFromUri(basePosition, uri);
-            if (lastUriTags.size() > tagNames.size()) {
-                for (int i = lastUriTags.size() - 1; i >= tagNames.size(); i--) {
-                    sb.append(toEndTag(lastUriTags.get(i - 1)));
+            if ( !uri.startsWith( baseUri ) )
+            {
+                throw new IllegalArgumentException(
+                    "Passed in model property that does not match baseUri: Property URI = " + uri + ", Base URI = " +
+                        baseUri );
+            }
+            List<String> tagNames = getTagNamesFromUri( basePosition, 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);
+            String tag = tagNames.get( tagNames.size() - 1 );
 
             ModelProperty attribute = null;
-            int peekIndex = modelProperties.indexOf(mp) + 1;
-            if(peekIndex <= modelProperties.size() - 1) {
-                ModelProperty peekProperty = modelProperties.get(peekIndex);
-                if(peekProperty.getUri().contains("#property")) {
+            int peekIndex = modelProperties.indexOf( mp ) + 1;
+            if ( peekIndex <= modelProperties.size() - 1 )
+            {
+                ModelProperty peekProperty = modelProperties.get( peekIndex );
+                if ( peekProperty.getUri().contains( "#property" ) )
+                {
                     attribute = peekProperty;
                 }
             }
 
-            sb.append(toStartTag(tag, attribute));
-            if (mp.getResolvedValue() != null) {
-                sb.append(mp.getResolvedValue());
-                sb.append(toEndTag(tag));
+            sb.append( toStartTag( tag, attribute ) );
+            if ( mp.getResolvedValue() != null )
+            {
+                sb.append( mp.getResolvedValue() );
+                sb.append( toEndTag( tag ) );
                 n = 2;
-            } else {
+            }
+            else
+            {
                 n = 1;
             }
             lastUriTags = tagNames;
         }
-        for (int i = lastUriTags.size() - n; i >= 1; i--) {
-            sb.append(toEndTag(lastUriTags.get(i)));
+        for ( int i = lastUriTags.size() - n; i >= 1; i-- )
+        {
+            sb.append( toEndTag( lastUriTags.get( i ) ) );
         }
         return sb.toString();
     }
 
-    private static List<String> getTagNamesFromUri(int basePosition, String uri) {
-        return Arrays.asList(uri.substring(basePosition).replaceAll("#collection", "").split("/"));
+    private static List<String> getTagNamesFromUri( int basePosition, String uri )
+    {
+        return Arrays.asList( uri.substring( basePosition ).replaceAll( "#collection", "" ).split( "/" ) );
     }
 
-    private static String toStartTag(String value, ModelProperty attribute) {
+    private static String toStartTag( String value, ModelProperty attribute )
+    {
         StringBuffer sb = new StringBuffer();
-        sb.append("\r\n<").append(value);
-        if(attribute != null) {
-            sb.append(" ").append(attribute.getUri().substring(attribute.getUri().indexOf("#property/") + 10)).append("=\"")
-                    .append(attribute.getValue()).append("\" ");
+        sb.append( "\r\n<" ).append( value );
+        if ( attribute != null )
+        {
+            sb.append( " " ).append(
+                attribute.getUri().substring( attribute.getUri().indexOf( "#property/" ) + 10 ) ).append( "=\"" )
+                .append( attribute.getValue() ).append( "\" " );
         }
-        sb.append(">");
+        sb.append( ">" );
         return sb.toString();
     }
 
-    private static String toEndTag(String value) {
-        if (value.trim().length() == 0) {
+    private static String toEndTag( String value )
+    {
+        if ( value.trim().length() == 0 )
+        {
             return "";
         }
         StringBuffer sb = new StringBuffer();
-        sb.append("</").append(value).append(">");
+        sb.append( "</" ).append( value ).append( ">" );
         return sb.toString();
     }
 
-    private static class Uri {
+    private static class Uri
+    {
 
         List<String> uris;
 
-        Uri(String baseUri) {
+        Uri( String baseUri )
+        {
             uris = new LinkedList<String>();
-            uris.add(baseUri);
+            uris.add( baseUri );
         }
 
-        String getUriFor(String tag, int depth) {
-            setUrisToDepth(depth);
+        String getUriFor( String tag, int depth )
+        {
+            setUrisToDepth( depth );
             StringBuffer sb = new StringBuffer();
-            for (String tagName : uris) {
-                sb.append(tagName).append("/");
+            for ( String tagName : uris )
+            {
+                sb.append( tagName ).append( "/" );
             }
-            sb.append(tag);
+            sb.append( tag );
             return sb.toString();
         }
 
-        void addTag(String tag) {
-            uris.add(tag);
+        void addTag( String tag )
+        {
+            uris.add( tag );
         }
 
-        void setUrisToDepth(int depth) {
-            uris = new LinkedList<String>(uris.subList(0, depth));
+        void setUrisToDepth( int depth )
+        {
+            uris = new LinkedList<String>( uris.subList( 0, depth ) );
         }
     }
 }

Modified: maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/ModelProperty.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/ModelProperty.java?rev=678213&r1=678212&r2=678213&view=diff
==============================================================================
--- maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/ModelProperty.java (original)
+++ maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/ModelProperty.java Sat Jul 19 13:09:35 2008
@@ -8,9 +8,10 @@
 /**
  * Maps a URI to a string value, which may be null. This class is immutable.
  */
-public final class ModelProperty {
+public final class ModelProperty
+{
 
-    private static final Pattern EXPRESSION_PATTERN = Pattern.compile("\\$\\{(pom\\.|project\\.|env\\.)?([^}]+)\\}");
+    private static final Pattern EXPRESSION_PATTERN = Pattern.compile( "\\$\\{(pom\\.|project\\.|env\\.)?([^}]+)\\}" );
 
     /**
      * URI of the resource
@@ -34,22 +35,26 @@
      * @param uri   URI of the resource. May not be null
      * @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");
+    public ModelProperty( String uri, String value )
+    {
+        if ( uri == null )
+        {
+            throw new IllegalArgumentException( "uri" );
         }
         this.uri = uri;
         this.value = value;
         resolvedValue = value;
 
         expressions = new ArrayList<String>();
-        if (value != null) {
-            Matcher matcher = EXPRESSION_PATTERN.matcher(value);
-            while (matcher.find()) {
-                expressions.add(matcher.group(0));
+        if ( value != null )
+        {
+            Matcher matcher = EXPRESSION_PATTERN.matcher( value );
+            while ( matcher.find() )
+            {
+                expressions.add( matcher.group( 0 ) );
             }
         }
-        depth = uri.split("/").length;
+        depth = uri.split( "/" ).length;
     }
 
     /**
@@ -57,7 +62,8 @@
      *
      * @return URI key
      */
-    public String getUri() {
+    public String getUri()
+    {
         return uri;
     }
 
@@ -66,34 +72,42 @@
      *
      * @return value for the key. Value may be null.
      */
-    public String getValue() {
+    public String getValue()
+    {
         return value;
     }
 
-    public String getResolvedValue() {
+    public String getResolvedValue()
+    {
         return resolvedValue;
     }
 
-    public boolean isResolved() {
+    public boolean isResolved()
+    {
         return expressions.isEmpty();
     }
 
-    public ModelProperty createCopyOfOriginal() {
-        return new ModelProperty(uri, value);
+    public ModelProperty createCopyOfOriginal()
+    {
+        return new ModelProperty( uri, value );
     }
 
-    public int getDepth() {
+    public int getDepth()
+    {
         return depth;
     }
 
-    public boolean isParentOf(ModelProperty modelProperty) {
-        if( Math.abs(depth - modelProperty.getDepth()) > 1) {
+    public boolean isParentOf( ModelProperty modelProperty )
+    {
+        if ( Math.abs( depth - modelProperty.getDepth() ) > 1 )
+        {
             return false;
         }
-        if (uri.equals(modelProperty.getUri()) || uri.startsWith(modelProperty.getUri())) {
+        if ( uri.equals( modelProperty.getUri() ) || uri.startsWith( modelProperty.getUri() ) )
+        {
             return false;
         }
-        return (modelProperty.getUri().startsWith(uri));
+        return ( modelProperty.getUri().startsWith( uri ) );
     }
     /*
         public boolean isParentOf(ModelProperty modelProperty) {
@@ -102,35 +116,45 @@
     }
      */
 
-    public InterpolatorProperty asInterpolatorProperty(String baseUri) {
-        if (uri.contains("#collection") || value == null) {
+    public InterpolatorProperty asInterpolatorProperty( String baseUri )
+    {
+        if ( uri.contains( "#collection" ) || value == null )
+        {
             return null;
         }
-        String key = "${" + uri.replace(baseUri + "/", "").replace("/", ".") + "}";
-        return new InterpolatorProperty(key, value);
+        String key = "${" + uri.replace( baseUri + "/", "" ).replace( "/", "." ) + "}";
+        return new InterpolatorProperty( key, value );
     }
 
-    public void resolveWith(InterpolatorProperty property) {
-        if (property == null) {
-            throw new IllegalArgumentException("property: null");
+    public void resolveWith( InterpolatorProperty property )
+    {
+        if ( property == null )
+        {
+            throw new IllegalArgumentException( "property: null" );
         }
-        if (isResolved()) {
+        if ( isResolved() )
+        {
             return;
         }
-        for (String expression : expressions) {
-            if (property.getKey().equals(expression)) {
-                resolvedValue = resolvedValue.replace(property.getKey(), property.getValue());
+        for ( String expression : expressions )
+        {
+            if ( property.getKey().equals( expression ) )
+            {
+                resolvedValue = resolvedValue.replace( property.getKey(), property.getValue() );
                 expressions.clear();
-                Matcher matcher = EXPRESSION_PATTERN.matcher(resolvedValue);
-                while (matcher.find()) {
-                    expressions.add(matcher.group(0));
+                Matcher matcher = EXPRESSION_PATTERN.matcher( resolvedValue );
+                while ( matcher.find() )
+                {
+                    expressions.add( matcher.group( 0 ) );
                 }
                 break;
             }
         }
     }
 
-    public String toString() {
-        return "Uri = " + uri + ", Value = " + value + ", Resolved Value = " + resolvedValue + ", Hash = " + this.hashCode();
+    public String toString()
+    {
+        return "Uri = " + uri + ", Value = " + value + ", Resolved Value = " + resolvedValue + ", Hash = " +
+            this.hashCode();
     }
 }

Modified: maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/ModelTransformer.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/ModelTransformer.java?rev=678213&r1=678212&r2=678213&view=diff
==============================================================================
--- maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/ModelTransformer.java (original)
+++ maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/ModelTransformer.java Sat Jul 19 13:09:35 2008
@@ -8,7 +8,8 @@
  * 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 {
+public interface ModelTransformer
+{
 
     String getBaseUri();
 
@@ -19,7 +20,8 @@
      * @param properties list of model properties to transform into domain model. List may not be null.
      * @return domain model
      */
-    DomainModel transformToDomainModel(List<ModelProperty> properties) throws IOException;
+    DomainModel transformToDomainModel( List<ModelProperty> properties )
+        throws IOException;
 
     /**
      * Transforms specified list of domain models to a property list. The list of domain models should be in order of
@@ -28,6 +30,7 @@
      * @param domainModels list of domain models to transform to a list of model properties. List may not be null.
      * @return list of model properties
      */
-    List<ModelProperty> transformToModelProperties(List<DomainModel> domainModels) throws IOException;
+    List<ModelProperty> transformToModelProperties( List<DomainModel> domainModels )
+        throws IOException;
 
 }

Modified: maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/ModelTransformerContext.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/ModelTransformerContext.java?rev=678213&r1=678212&r2=678213&view=diff
==============================================================================
--- maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/ModelTransformerContext.java (original)
+++ maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/ModelTransformerContext.java Sat Jul 19 13:09:35 2008
@@ -10,21 +10,27 @@
 /**
  * Primary context for this package. Provides methods for doing transforms.
  */
-public final class ModelTransformerContext {
+public final class ModelTransformerContext
+{
 
     private final Collection<ModelContainerFactory> factories;
 
-    private final static List<InterpolatorProperty> systemInterpolatorProperties = new ArrayList<InterpolatorProperty>();
+    private final static List<InterpolatorProperty> systemInterpolatorProperties =
+        new ArrayList<InterpolatorProperty>();
 
     private static Logger logger = Logger.getAnonymousLogger();
 
-    static {
-        for (Map.Entry<Object, Object> e : System.getProperties().entrySet()) {
-            systemInterpolatorProperties.add(new InterpolatorProperty("${" + e.getKey() + "}", (String) e.getValue()));
+    static
+    {
+        for ( Map.Entry<Object, Object> e : System.getProperties().entrySet() )
+        {
+            systemInterpolatorProperties.add(
+                new InterpolatorProperty( "${" + e.getKey() + "}", (String) e.getValue() ) );
         }
 
-        for (Map.Entry<String, String> e : System.getenv().entrySet()) {
-            systemInterpolatorProperties.add(new InterpolatorProperty("${env." + e.getKey() + "}", e.getValue()));
+        for ( Map.Entry<String, String> e : System.getenv().entrySet() )
+        {
+            systemInterpolatorProperties.add( new InterpolatorProperty( "${env." + e.getKey() + "}", e.getValue() ) );
         }
     }
 
@@ -33,8 +39,9 @@
      *
      * @param factories model container factories. Value may be null.
      */
-    public ModelTransformerContext(Collection<ModelContainerFactory> factories) {
-        this.factories = (factories == null) ? Collections.EMPTY_LIST : factories;
+    public ModelTransformerContext( Collection<ModelContainerFactory> factories )
+    {
+        this.factories = ( factories == null ) ? Collections.EMPTY_LIST : factories;
     }
 
     /**
@@ -49,48 +56,64 @@
      * @return processed domain model
      * @throws IOException if there was a problem with the transform
      */
-    public DomainModel transform(List<DomainModel> domainModels, ModelTransformer fromModelTransformer,
-                                 ModelTransformer toModelTransformer,
-                                 Collection<InterpolatorProperty> interpolatorProperties) throws IOException {
-        List<InterpolatorProperty> properties = new ArrayList<InterpolatorProperty>(interpolatorProperties);
+    public DomainModel transform( List<DomainModel> domainModels, ModelTransformer fromModelTransformer,
+                                  ModelTransformer toModelTransformer,
+                                  Collection<InterpolatorProperty> interpolatorProperties )
+        throws IOException
+    {
+        List<InterpolatorProperty> properties = new ArrayList<InterpolatorProperty>( interpolatorProperties );
 
         String baseUriForModel = fromModelTransformer.getBaseUri();
-        List<ModelProperty> modelProperties = sort(fromModelTransformer.transformToModelProperties(domainModels),
-                baseUriForModel);
+        List<ModelProperty> modelProperties =
+            sort( fromModelTransformer.transformToModelProperties( domainModels ), baseUriForModel );
         ModelDataSource modelDataSource = new DefaultModelDataSource();
-        modelDataSource.init(modelProperties, factories);
+        modelDataSource.init( modelProperties, factories );
 
-        for (ModelContainerFactory factory : factories) {
-            for (String uri : factory.getUris()) {
+        for ( ModelContainerFactory factory : factories )
+        {
+            for ( String uri : factory.getUris() )
+            {
                 List<ModelContainer> modelContainers;
-                try {
-                    modelContainers = modelDataSource.queryFor(uri);
-                } catch (IllegalArgumentException e) {
-                    System.out.println(modelDataSource.getEventHistory());
-                    throw new IllegalArgumentException(e);
+                try
+                {
+                    modelContainers = modelDataSource.queryFor( uri );
+                }
+                catch ( IllegalArgumentException e )
+                {
+                    System.out.println( modelDataSource.getEventHistory() );
+                    throw new IllegalArgumentException( e );
                 }
                 List<ModelContainer> removedModelContainers = new ArrayList<ModelContainer>();
-                Collections.reverse(modelContainers);
-                for (int i = 0; i < modelContainers.size(); i++) {
-                    ModelContainer mcA = modelContainers.get(i);
-                    if (removedModelContainers.contains(mcA)) {
+                Collections.reverse( modelContainers );
+                for ( int i = 0; i < modelContainers.size(); i++ )
+                {
+                    ModelContainer mcA = modelContainers.get( i );
+                    if ( removedModelContainers.contains( mcA ) )
+                    {
                         continue;
                     }
-                    for (ModelContainer mcB : modelContainers.subList(i + 1, modelContainers.size())) {
-                        ModelContainerAction action = mcA.containerAction(mcB);
-
-                        if (ModelContainerAction.DELETE.equals(action)) {
-                            modelDataSource.delete(mcB);
-                            removedModelContainers.add(mcB);
-                        } else if (ModelContainerAction.JOIN.equals(action)) {
-                            try {
-                                mcA = modelDataSource.join(mcA, mcB);
-                                removedModelContainers.add(mcB);
-                            } catch (DataSourceException e) {
-                                System.out.println(modelDataSource.getEventHistory());
+                    for ( ModelContainer mcB : modelContainers.subList( i + 1, modelContainers.size() ) )
+                    {
+                        ModelContainerAction action = mcA.containerAction( mcB );
+
+                        if ( ModelContainerAction.DELETE.equals( action ) )
+                        {
+                            modelDataSource.delete( mcB );
+                            removedModelContainers.add( mcB );
+                        }
+                        else if ( ModelContainerAction.JOIN.equals( action ) )
+                        {
+                            try
+                            {
+                                mcA = modelDataSource.join( mcA, mcB );
+                                removedModelContainers.add( mcB );
+                            }
+                            catch ( DataSourceException e )
+                            {
+                                System.out.println( modelDataSource.getEventHistory() );
                                 e.printStackTrace();
-                                throw new IOException("Failed to join model containers: URI = " + uri
-                                        + ", Factory = " + factory.getClass().getName());
+                                throw new IOException( "Failed to join model containers: URI = " + uri +
+                                    ", Factory = " + factory.getClass().getName() );
                             }
                         }
                     }
@@ -101,38 +124,47 @@
         //interpolator
         List<ModelProperty> mps = modelDataSource.getModelProperties();
 
-        for (ModelProperty mp : mps) {
-            InterpolatorProperty ip = mp.asInterpolatorProperty(baseUriForModel);
-            if (ip != null) {
-                properties.add(ip);
+        for ( ModelProperty mp : mps )
+        {
+            InterpolatorProperty ip = mp.asInterpolatorProperty( baseUriForModel );
+            if ( ip != null )
+            {
+                properties.add( ip );
             }
         }
 
         List<ModelProperty> unresolvedProperties = new ArrayList<ModelProperty>();
-        for (ModelProperty mp : mps) {
-            if (!mp.isResolved()) {
-                unresolvedProperties.add(mp);
+        for ( ModelProperty mp : mps )
+        {
+            if ( !mp.isResolved() )
+            {
+                unresolvedProperties.add( mp );
             }
         }
 
-        for (InterpolatorProperty ip : properties) {
-            for (ModelProperty mp : unresolvedProperties) {
-              //  mp.resolveWith(ip);
-              //  System.out.println(mp);
-               // System.out.println("-------------------");
+        for ( InterpolatorProperty ip : properties )
+        {
+            for ( ModelProperty mp : unresolvedProperties )
+            {
+                //  mp.resolveWith(ip);
+                //  System.out.println(mp);
+                // System.out.println("-------------------");
             }
         }
 
-        mps = sort(mps, baseUriForModel );
+        mps = sort( mps, baseUriForModel );
 
-        try {
-            DomainModel domainModel = toModelTransformer.transformToDomainModel(mps);
+        try
+        {
+            DomainModel domainModel = toModelTransformer.transformToDomainModel( mps );
             //domainModel.setEventHistory(modelDataSource.getEventHistory());
             return domainModel;
-        } catch (IOException e) {
-            System.out.println(modelDataSource.getEventHistory());
+        }
+        catch ( IOException e )
+        {
+            System.out.println( modelDataSource.getEventHistory() );
             e.printStackTrace();
-            throw new IOException(e.getMessage());
+            throw new IOException( e.getMessage() );
         }
     }
 
@@ -146,10 +178,11 @@
      * @return
      * @throws IOException
      */
-    public DomainModel transform(List<DomainModel> domainModels, ModelTransformer fromModelTransformer,
-                                 ModelTransformer toModelTransformer)
-            throws IOException {
-        return this.transform(domainModels, fromModelTransformer, toModelTransformer, systemInterpolatorProperties);
+    public DomainModel transform( List<DomainModel> domainModels, ModelTransformer fromModelTransformer,
+                                  ModelTransformer toModelTransformer )
+        throws IOException
+    {
+        return this.transform( domainModels, fromModelTransformer, toModelTransformer, systemInterpolatorProperties );
     }
 
     /**
@@ -163,26 +196,32 @@
      * @param baseUri
      * @return sorted list of model properties
      */
-    protected List<ModelProperty> sort(List<ModelProperty> properties, String baseUri) {
-        if (properties == null) {
-            throw new IllegalArgumentException("properties");
+    protected List<ModelProperty> sort( List<ModelProperty> properties, String baseUri )
+    {
+        if ( properties == null )
+        {
+            throw new IllegalArgumentException( "properties" );
         }
         LinkedList<ModelProperty> processedProperties = new LinkedList<ModelProperty>();
         List<String> position = new ArrayList<String>();
         boolean projectIsContained = false;
 
-        for (ModelProperty p : properties) {
+        for ( ModelProperty p : properties )
+        {
             String uri = p.getUri();
-            String parentUri = uri.substring(0, uri.lastIndexOf("/")).replaceAll("#property", "");
-            if (!projectIsContained && uri.equals(baseUri)) {
+            String parentUri = uri.substring( 0, uri.lastIndexOf( "/" ) ).replaceAll( "#property", "" );
+            if ( !projectIsContained && uri.equals( baseUri ) )
+            {
                 projectIsContained = true;
-                processedProperties.add(p);
-                position.add(0, uri);
-            } else if (!position.contains(uri) || parentUri.contains("#collection")) {
-                int pst = position.indexOf(parentUri) + 1;
-                processedProperties.add(pst, p);
-                position.add(pst, uri);
-            } 
+                processedProperties.add( p );
+                position.add( 0, uri );
+            }
+            else if ( !position.contains( uri ) || parentUri.contains( "#collection" ) )
+            {
+                int pst = position.indexOf( parentUri ) + 1;
+                processedProperties.add( pst, p );
+                position.add( pst, uri );
+            }
         }
         return processedProperties;
     }

Modified: maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/impl/DefaultModelDataSource.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/impl/DefaultModelDataSource.java?rev=678213&r1=678212&r2=678213&view=diff
==============================================================================
--- maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/impl/DefaultModelDataSource.java (original)
+++ maven/sandbox/trunk/shared/maven-shared-model/src/main/java/org/apache/maven/shared/model/impl/DefaultModelDataSource.java Sat Jul 19 13:09:35 2008
@@ -8,7 +8,9 @@
 /**
  * Default implementation of the ModelDataSource.
  */
-public final class DefaultModelDataSource implements ModelDataSource {
+public final class DefaultModelDataSource
+    implements ModelDataSource
+{
 
     private List<ModelProperty> modelProperties;
 
@@ -20,92 +22,115 @@
 
     private static Logger logger = Logger.getAnonymousLogger();
 
-    public ModelContainer join(ModelContainer a, ModelContainer b) throws DataSourceException {
-        if (a == null || a.getProperties() == null || a.getProperties().size() == 0) {
-            throw new IllegalArgumentException("a or a.properties: empty");
-        }
-        if (b == null || b.getProperties() == null) {
-            throw new IllegalArgumentException("b: null or b.properties: empty");
+    public ModelContainer join( ModelContainer a, ModelContainer b )
+        throws DataSourceException
+    {
+        if ( a == null || a.getProperties() == null || a.getProperties().size() == 0 )
+        {
+            throw new IllegalArgumentException( "a or a.properties: empty" );
+        }
+        if ( b == null || b.getProperties() == null )
+        {
+            throw new IllegalArgumentException( "b: null or b.properties: empty" );
         }
 
-        if (!modelProperties.containsAll(a.getProperties())) {
+        if ( !modelProperties.containsAll( a.getProperties() ) )
+        {
             List<ModelProperty> unknownProperties = new ArrayList<ModelProperty>();
-            for (ModelProperty mp : a.getProperties()) {
-                if (!modelProperties.contains(mp)) {
-                    unknownProperties.add(mp);
+            for ( ModelProperty mp : a.getProperties() )
+            {
+                if ( !modelProperties.contains( mp ) )
+                {
+                    unknownProperties.add( mp );
                 }
             }
 
             List<DeleteEvent> des = new ArrayList<DeleteEvent>();
-            for (DeleteEvent de : deleteEvents) {
-                if (aContainsAnyOfB(de.getRemovedModelProperties(), unknownProperties)) {
-                    des.add(de);
+            for ( DeleteEvent de : deleteEvents )
+            {
+                if ( aContainsAnyOfB( de.getRemovedModelProperties(), unknownProperties ) )
+                {
+                    des.add( de );
                 }
             }
             //output
             StringBuffer sb = new StringBuffer();
-            sb.append("Found unknown properties in container 'a': Name = ").append(a.getClass().getName()).append("\r\n");
-            for (ModelProperty mp : unknownProperties) {
-                sb.append(mp).append("\r\n");
+            sb.append( "Found unknown properties in container 'a': Name = " ).append( a.getClass().getName() ).append(
+                "\r\n" );
+            for ( ModelProperty mp : unknownProperties )
+            {
+                sb.append( mp ).append( "\r\n" );
             }
 
-            System.out.println(sb);
-            throw new DataSourceException("ModelContainer 'a' contains elements not within datasource");
+            System.out.println( sb );
+            throw new DataSourceException( "ModelContainer 'a' contains elements not within datasource" );
         }
 
-        if (a.equals(b) || b.getProperties().size() == 0) {
+        if ( a.equals( b ) || b.getProperties().size() == 0 )
+        {
             return a;
         }
 
-        int startIndex = modelProperties.indexOf(b.getProperties().get(0));
-        delete(a);
-        delete(b);
+        int startIndex = modelProperties.indexOf( b.getProperties().get( 0 ) );
+        delete( a );
+        delete( b );
 
-        List<ModelProperty> joinedProperties = mergeModelContainers(a, b);
+        List<ModelProperty> joinedProperties = mergeModelContainers( a, b );
 
-        if (modelProperties.size() == 0) {
+        if ( modelProperties.size() == 0 )
+        {
             startIndex = 0;
         }
-        modelProperties.addAll(startIndex, joinedProperties);
+        modelProperties.addAll( startIndex, joinedProperties );
 
         List<ModelProperty> deletedProperties = new ArrayList<ModelProperty>();
-        deletedProperties.addAll(a.getProperties());
-        deletedProperties.addAll(b.getProperties());
-        deletedProperties.removeAll(joinedProperties);
-        if (deletedProperties.size() > 0) {
-            deleteEvents.add(new DeleteEvent(a, b, deletedProperties, "join"));
+        deletedProperties.addAll( a.getProperties() );
+        deletedProperties.addAll( b.getProperties() );
+        deletedProperties.removeAll( joinedProperties );
+        if ( deletedProperties.size() > 0 )
+        {
+            deleteEvents.add( new DeleteEvent( a, b, deletedProperties, "join" ) );
         }
 
-        return a.createNewInstance(joinedProperties);
+        return a.createNewInstance( joinedProperties );
     }
 
-    public void delete(ModelContainer modelContainer) {
-        if (modelContainer == null) {
-            throw new IllegalArgumentException("modelContainer: null");
+    public void delete( ModelContainer modelContainer )
+    {
+        if ( modelContainer == null )
+        {
+            throw new IllegalArgumentException( "modelContainer: null" );
         }
-        if (modelContainer.getProperties() == null) {
-            throw new IllegalArgumentException("modelContainer.properties: null");
+        if ( modelContainer.getProperties() == null )
+        {
+            throw new IllegalArgumentException( "modelContainer.properties: null" );
         }
-        modelProperties.removeAll(modelContainer.getProperties());
-        deleteEvents.add(new DeleteEvent(modelContainer, null, modelContainer.getProperties(), "delete"));
+        modelProperties.removeAll( modelContainer.getProperties() );
+        deleteEvents.add( new DeleteEvent( modelContainer, null, modelContainer.getProperties(), "delete" ) );
     }
 
-    public List<ModelProperty> getModelProperties() {
-        return new ArrayList<ModelProperty>(modelProperties);
+    public List<ModelProperty> getModelProperties()
+    {
+        return new ArrayList<ModelProperty>( modelProperties );
     }
 
-    public List<ModelContainer> queryFor(String uri) throws DataSourceException {
-        if (uri == null) {
-            throw new IllegalArgumentException("uri");
+    public List<ModelContainer> queryFor( String uri )
+        throws DataSourceException
+    {
+        if ( uri == null )
+        {
+            throw new IllegalArgumentException( "uri" );
         }
 
-        if (modelProperties.isEmpty()) {
+        if ( modelProperties.isEmpty() )
+        {
             return Collections.EMPTY_LIST;
         }
 
-        ModelContainerFactory factory = modelContainerFactoryMap.get(uri);
-        if (factory == null) {
-            throw new DataSourceException("Unable to find factory for uri: URI = " + uri);
+        ModelContainerFactory factory = modelContainerFactoryMap.get( uri );
+        if ( factory == null )
+        {
+            throw new DataSourceException( "Unable to find factory for uri: URI = " + uri );
         }
 
         List<ModelContainer> modelContainers = new LinkedList<ModelContainer>();
@@ -118,37 +143,51 @@
 
         List<ModelProperty> tmp = new ArrayList<ModelProperty>();
 
-        for (Iterator<ModelProperty> i = modelProperties.iterator(); i.hasNext();) {
+        for ( Iterator<ModelProperty> i = modelProperties.iterator(); i.hasNext(); )
+        {
             ModelProperty mp = i.next();
-            if (state == START_TAG && (!i.hasNext() || !mp.getUri().startsWith(uri))) {
+            if ( state == START_TAG && ( !i.hasNext() || !mp.getUri().startsWith( uri ) ) )
+            {
                 state = END_TAG;
-            } else if (state == START_TAG && mp.getUri().equals(uri)) {
+            }
+            else if ( state == START_TAG && mp.getUri().equals( uri ) )
+            {
                 state = END_START_TAG;
-            } else if (mp.getUri().startsWith(uri)) {
+            }
+            else if ( mp.getUri().startsWith( uri ) )
+            {
                 state = START_TAG;
-            } else {
+            }
+            else
+            {
                 state = NO_TAG;
             }
-            switch (state) {
-                case START_TAG: {
-                    tmp.add(mp);
-                    if (!i.hasNext()) {
-                        modelContainers.add(factory.create(tmp));
+            switch ( state )
+            {
+                case START_TAG:
+                {
+                    tmp.add( mp );
+                    if ( !i.hasNext() )
+                    {
+                        modelContainers.add( factory.create( tmp ) );
                     }
                     break;
                 }
-                case END_START_TAG: {
-                    modelContainers.add(factory.create(tmp));
+                case END_START_TAG:
+                {
+                    modelContainers.add( factory.create( tmp ) );
                     tmp.clear();
-                    tmp.add(mp);
+                    tmp.add( mp );
                     state = START_TAG;
                     break;
                 }
-                case END_TAG: {
-                    if(!i.hasNext()) {
-                        tmp.add(mp);
+                case END_TAG:
+                {
+                    if ( !i.hasNext() )
+                    {
+                        tmp.add( mp );
                     }
-                    modelContainers.add(factory.create(tmp));
+                    modelContainers.add( factory.create( tmp ) );
                     tmp.clear();
                     state = NO_TAG;
                 }
@@ -156,66 +195,84 @@
         }
 
         //verify data source integrity
-        List<ModelProperty> unknownProperties = findUnknownModelPropertiesFrom(modelContainers);
-        if (!unknownProperties.isEmpty()) {
-            for (ModelProperty mp : unknownProperties) {
-                System.out.println("Missing property from ModelContainer: " + mp);
+        List<ModelProperty> unknownProperties = findUnknownModelPropertiesFrom( modelContainers );
+        if ( !unknownProperties.isEmpty() )
+        {
+            for ( ModelProperty mp : unknownProperties )
+            {
+                System.out.println( "Missing property from ModelContainer: " + mp );
             }
-            throw new DataSourceException("Unable to query datasource. ModelContainer contains elements not within datasource");
+            throw new DataSourceException(
+                "Unable to query datasource. ModelContainer contains elements not within datasource" );
         }
 
         return modelContainers;
     }
 
-    public void init(List<ModelProperty> modelProperties, Collection<ModelContainerFactory> modelContainerFactories) {
-        if (modelProperties == null) {
-            throw new IllegalArgumentException("modelProperties: null");
+    public void init( List<ModelProperty> modelProperties, Collection<ModelContainerFactory> modelContainerFactories )
+    {
+        if ( modelProperties == null )
+        {
+            throw new IllegalArgumentException( "modelProperties: null" );
+        }
+        if ( modelContainerFactories == null )
+        {
+            throw new IllegalArgumentException( "modeContainerFactories: null" );
         }
-        if (modelContainerFactories == null) {
-            throw new IllegalArgumentException("modeContainerFactories: null");
-        }
-        this.modelProperties = new LinkedList<ModelProperty>(modelProperties);
+        this.modelProperties = new LinkedList<ModelProperty>( modelProperties );
         this.modelContainerFactoryMap = new HashMap<String, ModelContainerFactory>();
         this.deleteEvents = new ArrayList<DeleteEvent>();
-        this.originalModelProperties = new ArrayList<ModelProperty>(modelProperties);
+        this.originalModelProperties = new ArrayList<ModelProperty>( modelProperties );
 
-        for (ModelContainerFactory factory : modelContainerFactories) {
+        for ( ModelContainerFactory factory : modelContainerFactories )
+        {
             Collection<String> uris = factory.getUris();
-            if (uris == null) {
-                throw new IllegalArgumentException("factory.uris: null");
+            if ( uris == null )
+            {
+                throw new IllegalArgumentException( "factory.uris: null" );
             }
 
-            for (String uri : uris) {
-                modelContainerFactoryMap.put(uri, factory);
+            for ( String uri : uris )
+            {
+                modelContainerFactoryMap.put( uri, factory );
             }
         }
     }
 
-    public String getEventHistory() {
+    public String getEventHistory()
+    {
         StringBuffer sb = new StringBuffer();
-        sb.append("Original Model Properties\r\n");
-        for (ModelProperty mp : originalModelProperties) {
-            sb.append(mp).append("\r\n");
+        sb.append( "Original Model Properties\r\n" );
+        for ( ModelProperty mp : originalModelProperties )
+        {
+            sb.append( mp ).append( "\r\n" );
         }
 
-        for (DeleteEvent de : deleteEvents) {
-            sb.append(de.toString());
+        for ( DeleteEvent de : deleteEvents )
+        {
+            sb.append( de.toString() );
         }
 
-        sb.append("Processed Model Properties\r\n");
-        for (ModelProperty mp : modelProperties) {
-            sb.append(mp).append("\r\n");
+        sb.append( "Processed Model Properties\r\n" );
+        for ( ModelProperty mp : modelProperties )
+        {
+            sb.append( mp ).append( "\r\n" );
         }
         return sb.toString();
     }
 
-    private List<ModelProperty> findUnknownModelPropertiesFrom(List<ModelContainer> modelContainers) {
+    private List<ModelProperty> findUnknownModelPropertiesFrom( List<ModelContainer> modelContainers )
+    {
         List<ModelProperty> unknownProperties = new ArrayList<ModelProperty>();
-        for (ModelContainer mc : modelContainers) {
-            if (!modelProperties.containsAll(mc.getProperties())) {
-                for (ModelProperty mp : mc.getProperties()) {
-                    if (!modelProperties.contains(mp)) {
-                        unknownProperties.add(mp);
+        for ( ModelContainer mc : modelContainers )
+        {
+            if ( !modelProperties.containsAll( mc.getProperties() ) )
+            {
+                for ( ModelProperty mp : mc.getProperties() )
+                {
+                    if ( !modelProperties.contains( mp ) )
+                    {
+                        unknownProperties.add( mp );
                     }
                 }
             }
@@ -223,16 +280,23 @@
         return unknownProperties;
     }
 
-    private static int findLastIndexOfParent(ModelProperty modelProperty, List<ModelProperty> modelProperties) {
-        for (int i = modelProperties.size() - 1; i >= 0; i--) {
-            if (modelProperties.get(i).getUri().equals(modelProperty.getUri())) {
-                for (int j = i; j < modelProperties.size(); j++) {
-                    if (!modelProperties.get(j).getUri().startsWith(modelProperty.getUri())) {
+    private static int findLastIndexOfParent( ModelProperty modelProperty, List<ModelProperty> modelProperties )
+    {
+        for ( int i = modelProperties.size() - 1; i >= 0; i-- )
+        {
+            if ( modelProperties.get( i ).getUri().equals( modelProperty.getUri() ) )
+            {
+                for ( int j = i; j < modelProperties.size(); j++ )
+                {
+                    if ( !modelProperties.get( j ).getUri().startsWith( modelProperty.getUri() ) )
+                    {
                         return j - 1;
                     }
                 }
                 return modelProperties.size() - 1;
-            } else if (modelProperties.get(i).isParentOf(modelProperty)) {
+            }
+            else if ( modelProperties.get( i ).isParentOf( modelProperty ) )
+            {
                 return i;
             }
         }
@@ -246,50 +310,60 @@
      * @param b container B
      * @return list of merged properties
      */
-    protected static List<ModelProperty> mergeModelContainers(ModelContainer a, ModelContainer b) {
+    protected static List<ModelProperty> mergeModelContainers( ModelContainer a, ModelContainer b )
+    {
         List<ModelProperty> m = new ArrayList<ModelProperty>();
-        m.addAll(a.getProperties());
-        m.addAll(b.getProperties());
+        m.addAll( a.getProperties() );
+        m.addAll( b.getProperties() );
 
         List<String> combineChildrenUris = new ArrayList<String>();
-        for(ModelProperty mp: m) {
+        for ( ModelProperty mp : m )
+        {
             String x = mp.getUri();
-            if(x.endsWith("#property/combine.children") && mp.getValue().equals("append")) {
-                combineChildrenUris.add(x.substring(0, x.length() - 26));    
+            if ( x.endsWith( "#property/combine.children" ) && mp.getValue().equals( "append" ) )
+            {
+                combineChildrenUris.add( x.substring( 0, x.length() - 26 ) );
             }
         }
 
         LinkedList<ModelProperty> processedProperties = new LinkedList<ModelProperty>();
         List<String> uris = new ArrayList<String>();
-        String baseUri = a.getProperties().get(0).getUri();
-        for (ModelProperty p : m) {
+        String baseUri = a.getProperties().get( 0 ).getUri();
+        for ( ModelProperty p : m )
+        {
             int modelPropertyLength = p.getUri().length();
-            if(baseUri.length() > modelPropertyLength ) {
-                throw new IllegalArgumentException("Base URI is longer than model property uri: Base URI = " + baseUri
-                        + ", ModelProperty = " + p);
-            }
-            String subUri = p.getUri().substring(baseUri.length(), modelPropertyLength );
-
-            if (!uris.contains(p.getUri())
-                    || (subUri.contains("#collection") && !subUri.endsWith("#collection"))
-                    && (!combineChildrenUris.contains(p.getUri()) || p.getUri().endsWith("#property/combine.children"))) {
-                processedProperties.add(findLastIndexOfParent(p, processedProperties) + 1, p);
-                uris.add(p.getUri());
-            } 
+            if ( baseUri.length() > modelPropertyLength )
+            {
+                throw new IllegalArgumentException(
+                    "Base URI is longer than model property uri: Base URI = " + baseUri + ", ModelProperty = " + p );
+            }
+            String subUri = p.getUri().substring( baseUri.length(), modelPropertyLength );
+
+            if ( !uris.contains( p.getUri() ) || ( subUri.contains( "#collection" ) &&
+                !subUri.endsWith( "#collection" ) ) &&
+                ( !combineChildrenUris.contains( p.getUri() ) || p.getUri().endsWith( "#property/combine.children" ) ) )
+            {
+                processedProperties.add( findLastIndexOfParent( p, processedProperties ) + 1, p );
+                uris.add( p.getUri() );
+            }
         }
         return processedProperties;
     }
 
-    private static boolean aContainsAnyOfB(List<ModelProperty> a, List<ModelProperty> b) {
-        for (ModelProperty mp : b) {
-            if (a.contains(mp)) {
+    private static boolean aContainsAnyOfB( List<ModelProperty> a, List<ModelProperty> b )
+    {
+        for ( ModelProperty mp : b )
+        {
+            if ( a.contains( mp ) )
+            {
                 return true;
             }
         }
         return false;
     }
 
-    private static class DeleteEvent {
+    private static class DeleteEvent
+    {
 
         private List<ModelProperty> removedModelProperties;
 
@@ -299,46 +373,57 @@
 
         private String methodName;
 
-        DeleteEvent(ModelContainer mcA, ModelContainer mcB, List<ModelProperty> removedModelProperties, String methodName) {
+        DeleteEvent( ModelContainer mcA, ModelContainer mcB, List<ModelProperty> removedModelProperties,
+                     String methodName )
+        {
             this.mcA = mcA;
             this.mcB = mcB;
             this.removedModelProperties = removedModelProperties;
             this.methodName = methodName;
         }
 
-        public ModelContainer getMcA() {
+        public ModelContainer getMcA()
+        {
             return mcA;
         }
 
-        public ModelContainer getMcB() {
+        public ModelContainer getMcB()
+        {
             return mcB;
         }
 
-        public List<ModelProperty> getRemovedModelProperties() {
+        public List<ModelProperty> getRemovedModelProperties()
+        {
             return removedModelProperties;
         }
 
-        public String getMethodName() {
+        public String getMethodName()
+        {
             return methodName;
         }
 
-        public String toString() {
+        public String toString()
+        {
             StringBuffer sb = new StringBuffer();
-            sb.append("Delete Event: ").append(methodName).append("\r\n");
-            sb.append("Model Container A:\r\n");
-            for (ModelProperty mp : mcA.getProperties()) {
-                sb.append(mp).append("\r\n");
-            }
-            if (mcB != null) {
-                sb.append("Model Container B:\r\n");
-                for (ModelProperty mp : mcB.getProperties()) {
-                    sb.append(mp).append("\r\n");
+            sb.append( "Delete Event: " ).append( methodName ).append( "\r\n" );
+            sb.append( "Model Container A:\r\n" );
+            for ( ModelProperty mp : mcA.getProperties() )
+            {
+                sb.append( mp ).append( "\r\n" );
+            }
+            if ( mcB != null )
+            {
+                sb.append( "Model Container B:\r\n" );
+                for ( ModelProperty mp : mcB.getProperties() )
+                {
+                    sb.append( mp ).append( "\r\n" );
                 }
             }
 
-            sb.append("Removed Properties:\r\n");
-            for (ModelProperty mp : removedModelProperties) {
-                sb.append(mp).append("\r\n");
+            sb.append( "Removed Properties:\r\n" );
+            for ( ModelProperty mp : removedModelProperties )
+            {
+                sb.append( mp ).append( "\r\n" );
             }
             return sb.toString();
         }

Modified: maven/sandbox/trunk/shared/maven-shared-model/src/test/java/org/apache/maven/shared/model/ModelMarshallerTest.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/shared/maven-shared-model/src/test/java/org/apache/maven/shared/model/ModelMarshallerTest.java?rev=678213&r1=678212&r2=678213&view=diff
==============================================================================
--- maven/sandbox/trunk/shared/maven-shared-model/src/test/java/org/apache/maven/shared/model/ModelMarshallerTest.java (original)
+++ maven/sandbox/trunk/shared/maven-shared-model/src/test/java/org/apache/maven/shared/model/ModelMarshallerTest.java Sat Jul 19 13:09:35 2008
@@ -7,52 +7,79 @@
 import java.io.ByteArrayInputStream;
 import java.io.FileInputStream;
 import java.io.IOException;
+import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
-public class ModelMarshallerTest {
-
+public class ModelMarshallerTest
+{
+    /*
+     @Test
+     public void aaa() throws IOException {
+         List<ModelProperty> properties =
+                 ModelMarshaller.marshallXmlToModelProperties(
+                         new FileInputStream("/home/shane/checkout/SI_MAVEN_2_1_A/maven-core-it-runner/target/it-working-folder/it0060/subproject/pom.xml"),
+                         "http://apache.org/maven",  null);
+         for(ModelProperty mp : properties) {
+         //    System.out.println(mp);
+         }
+         ModelTransformerContext ctx = new ModelTransformerContext(new ArrayList());
+
+
+                         for(ModelProperty mp : properties) {
+            System.out.println(mp);
+         }
+         System.out.println(ModelMarshaller.unmarshalModelPropertiesToXml(properties, "http://apache.org/maven"));
+     }
+    */
     @Test
-    public void unmarshalWithEmptyCollectionTags() throws IOException {
-        List<ModelProperty> modelProperties = Arrays.asList(
-                new ModelProperty("http://apache.org/maven/project", null),
-                new ModelProperty("http://apache.org/maven/project/dependencies#collection", null)
-        );
-        String xml = ModelMarshaller.unmarshalModelPropertiesToXml(modelProperties, "http://apache.org/maven");
-        System.out.println("COMPLETE:" + xml); //TODO: Verify proper xml
+    public void unmarshalWithEmptyCollectionTags()
+        throws IOException
+    {
+        List<ModelProperty> modelProperties = Arrays.asList(
+            new ModelProperty( "http://apache.org/maven/project", null ),
+            new ModelProperty( "http://apache.org/maven/project/dependencies#collection", null ) );
+        String xml = ModelMarshaller.unmarshalModelPropertiesToXml( modelProperties, "http://apache.org/maven" );
+        System.out.println( "COMPLETE:" + xml ); //TODO: Verify proper xml
     }
 
     @Test
-    public void unmarshalWithSingleProperty() throws IOException {
-        List<ModelProperty> modelProperties = Arrays.asList(
-                new ModelProperty("http://apache.org/maven/project", null),
-                new ModelProperty("http://apache.org/maven/project/modelVersion", "4.0.0")
-        );
-        String xml = ModelMarshaller.unmarshalModelPropertiesToXml(modelProperties, "http://apache.org/maven");
-        System.out.println("COMPLETE:" + xml); //TODO: Verify proper xml
+    public void unmarshalWithSingleProperty()
+        throws IOException
+    {
+        List<ModelProperty> modelProperties = Arrays.asList(
+            new ModelProperty( "http://apache.org/maven/project", null ),
+            new ModelProperty( "http://apache.org/maven/project/modelVersion", "4.0.0" ) );
+        String xml = ModelMarshaller.unmarshalModelPropertiesToXml( modelProperties, "http://apache.org/maven" );
+        System.out.println( "COMPLETE:" + xml ); //TODO: Verify proper xml
     }
 
     @Test
-    public void unmarshalWithEmptyTags111() throws IOException {
-         List<ModelProperty> modelProperties = ModelMarshaller.marshallXmlToModelProperties(
-                new ByteArrayInputStream("<project><S></S><version>1.2</version><developers><developer><organization></organization></developer></developers><modelVersion>4</modelVersion></project>".getBytes()),
-                "http://apache.org/maven", null);
+    public void unmarshalWithEmptyTags111()
+        throws IOException
+    {
+        List<ModelProperty> modelProperties = ModelMarshaller.marshallXmlToModelProperties( new ByteArrayInputStream(
+            "<project><S></S><version>1.2</version><developers><developer><organization></organization></developer></developers><modelVersion>4</modelVersion></project>".getBytes() ),
+                                                                                            "http://apache.org/maven",
+                                                                                            null );
 
-        String xml = ModelMarshaller.unmarshalModelPropertiesToXml(modelProperties, "http://apache.org/maven");
-        System.out.println("COMPLETE:" + xml); //TODO: Verify proper xml
+        String xml = ModelMarshaller.unmarshalModelPropertiesToXml( modelProperties, "http://apache.org/maven" );
+        System.out.println( "COMPLETE:" + xml ); //TODO: Verify proper xml
     }
 
     @Test
-    public void marshal() throws IOException {
+    public void marshal()
+        throws IOException
+    {
         List<ModelProperty> modelProperties = ModelMarshaller.marshallXmlToModelProperties(
-                new ByteArrayInputStream("<project><version>1.1</version></project>".getBytes()),
-                "http://apache.org/maven", null);
+            new ByteArrayInputStream( "<project><version>1.1</version></project>".getBytes() ),
+            "http://apache.org/maven", null );
 
-        assertEquals(2, modelProperties.size());
-        assertEquals("http://apache.org/maven/project", modelProperties.get(0).getUri());
-        assertEquals("http://apache.org/maven/project/version", modelProperties.get(1).getUri());
-        assertEquals("1.1", modelProperties.get(1).getValue());
+        assertEquals( 2, modelProperties.size() );
+        assertEquals( "http://apache.org/maven/project", modelProperties.get( 0 ).getUri() );
+        assertEquals( "http://apache.org/maven/project/version", modelProperties.get( 1 ).getUri() );
+        assertEquals( "1.1", modelProperties.get( 1 ).getValue() );
     }
 
     /*
@@ -67,40 +94,48 @@
     }
      */
     @Test(expected = IllegalArgumentException.class)
-    public void unmarshalWithNullBaseUri() throws IOException {
-        List<ModelProperty> modelProperties = Arrays.asList(
-                new ModelProperty("http://apache.org/maven/project", null)
-        );
+    public void unmarshalWithNullBaseUri()
+        throws IOException
+    {
+        List<ModelProperty> modelProperties =
+            Arrays.asList( new ModelProperty( "http://apache.org/maven/project", null ) );
 
-        ModelMarshaller.unmarshalModelPropertiesToXml(modelProperties, null);
+        ModelMarshaller.unmarshalModelPropertiesToXml( modelProperties, null );
     }
 
     @Test(expected = IllegalArgumentException.class)
-    public void unmarshalWithEmptyBaseUri() throws IOException {
-        List<ModelProperty> modelProperties = Arrays.asList(
-                new ModelProperty("http://apache.org/maven/project", null)
-        );
+    public void unmarshalWithEmptyBaseUri()
+        throws IOException
+    {
+        List<ModelProperty> modelProperties =
+            Arrays.asList( new ModelProperty( "http://apache.org/maven/project", null ) );
 
-        ModelMarshaller.unmarshalModelPropertiesToXml(modelProperties, "");
+        ModelMarshaller.unmarshalModelPropertiesToXml( modelProperties, "" );
     }
 
     @Test(expected = IllegalArgumentException.class)
-    public void unmarshalWithEmptyModelProperties() throws IOException  {
-        ModelMarshaller.unmarshalModelPropertiesToXml(new ArrayList<ModelProperty>(), "http://apache.org/maven/project");
+    public void unmarshalWithEmptyModelProperties()
+        throws IOException
+    {
+        ModelMarshaller.unmarshalModelPropertiesToXml( new ArrayList<ModelProperty>(),
+                                                       "http://apache.org/maven/project" );
     }
 
     @Test(expected = IllegalArgumentException.class)
-    public void unmarshalWithNullModelProperties() throws IOException {
-        ModelMarshaller.unmarshalModelPropertiesToXml(null, "http://apache.org/maven/project");
+    public void unmarshalWithNullModelProperties()
+        throws IOException
+    {
+        ModelMarshaller.unmarshalModelPropertiesToXml( null, "http://apache.org/maven/project" );
     }
 
     @Test(expected = IllegalArgumentException.class)
-    public void unmarshalWithIncorrectModelPropertyUri() throws IOException  {
+    public void unmarshalWithIncorrectModelPropertyUri()
+        throws IOException
+    {
         List<ModelProperty> modelProperties = Arrays.asList(
-                new ModelProperty("http://apache.org/maven/project", null),
-                new ModelProperty("http://bogus.org/maven", "1.1")
-        );
+            new ModelProperty( "http://apache.org/maven/project", null ),
+            new ModelProperty( "http://bogus.org/maven", "1.1" ) );
 
-        ModelMarshaller.unmarshalModelPropertiesToXml(modelProperties, "http://apache.org/maven");
+        ModelMarshaller.unmarshalModelPropertiesToXml( modelProperties, "http://apache.org/maven" );
     }
 }

Modified: maven/sandbox/trunk/shared/maven-shared-model/src/test/java/org/apache/maven/shared/model/ModelPropertyTest.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/shared/maven-shared-model/src/test/java/org/apache/maven/shared/model/ModelPropertyTest.java?rev=678213&r1=678212&r2=678213&view=diff
==============================================================================
--- maven/sandbox/trunk/shared/maven-shared-model/src/test/java/org/apache/maven/shared/model/ModelPropertyTest.java (original)
+++ maven/sandbox/trunk/shared/maven-shared-model/src/test/java/org/apache/maven/shared/model/ModelPropertyTest.java Sat Jul 19 13:09:35 2008
@@ -4,20 +4,25 @@
 import static org.junit.Assert.assertTrue;
 import org.junit.Test;
 
-public class ModelPropertyTest {
+public class ModelPropertyTest
+{
 
     @Test
-    public void isParent() {
-        ModelProperty mp0 = new ModelProperty("http://apache.org/maven/project/profiles#collection/profile/id", "1");
-        ModelProperty mp1 = new ModelProperty("http://apache.org/maven/project/profiles#collection/profile/build/plugins/plugin/groupId", "org");
-        assertFalse(mp0.isParentOf(mp1));
-        assertTrue(mp0.getDepth() < mp1.getDepth());
+    public void isParent()
+    {
+        ModelProperty mp0 = new ModelProperty( "http://apache.org/maven/project/profiles#collection/profile/id", "1" );
+        ModelProperty mp1 = new ModelProperty(
+            "http://apache.org/maven/project/profiles#collection/profile/build/plugins/plugin/groupId", "org" );
+        assertFalse( mp0.isParentOf( mp1 ) );
+        assertTrue( mp0.getDepth() < mp1.getDepth() );
     }
 
     @Test
-    public void isParent1() {
-        ModelProperty mp0 = new ModelProperty("http://apache.org/maven/project/profiles#collection/profile/id", "1");
-        ModelProperty mp1 = new ModelProperty("http://apache.org/maven/project/profiles#collection/profile/id/a/b", "org");
-        assertFalse(mp0.isParentOf(mp1));
+    public void isParent1()
+    {
+        ModelProperty mp0 = new ModelProperty( "http://apache.org/maven/project/profiles#collection/profile/id", "1" );
+        ModelProperty mp1 =
+            new ModelProperty( "http://apache.org/maven/project/profiles#collection/profile/id/a/b", "org" );
+        assertFalse( mp0.isParentOf( mp1 ) );
     }
 }



Mime
View raw message