flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From labri...@apache.org
Subject svn commit: r1311531 - in /incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections: ./ tests/ tests/vectorCollection/ tests/vectorList/ tests/vectorList/helper/
Date Tue, 10 Apr 2012 00:24:18 GMT
Author: labriola
Date: Tue Apr 10 00:24:17 2012
New Revision: 1311531

URL: http://svn.apache.org/viewvc?rev=1311531&view=rev
Log:
Unit tests for VectorList and VectorCollection

Added:
    incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/ArrayList.as
    incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/tests/
    incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/tests/CollectionTests.as
    incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/tests/vectorCollection/
    incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/tests/vectorCollection/BasicFunctionsTest.as
    incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/tests/vectorList/
    incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/tests/vectorList/AddRemoveItemAtTest.as
    incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/tests/vectorList/AddRemoveItemTest.as
    incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/tests/vectorList/BasicFunctionsTest.as
    incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/tests/vectorList/ConversionTest.as
    incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/tests/vectorList/EventsTest.as
    incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/tests/vectorList/ItemRetrievalTest.as
    incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/tests/vectorList/VectorListSuite.as
    incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/tests/vectorList/helper/
    incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/tests/vectorList/helper/IsEqualToVectorMatcher.as
Modified:
    incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/VectorCollection.as
    incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/VectorList.as

Added: incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/ArrayList.as
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/ArrayList.as?rev=1311531&view=auto
==============================================================================
--- incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/ArrayList.as (added)
+++ incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/ArrayList.as Tue Apr 10 00:24:17 2012
@@ -0,0 +1,784 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package mx.collections 
+{
+    
+import flash.events.EventDispatcher;
+import flash.events.IEventDispatcher;
+import flash.utils.IDataInput;
+import flash.utils.IDataOutput;
+import flash.utils.IExternalizable;
+import flash.utils.getQualifiedClassName;
+
+import mx.core.IPropertyChangeNotifier;
+import mx.events.CollectionEvent;
+import mx.events.CollectionEventKind;
+import mx.events.PropertyChangeEvent;
+import mx.events.PropertyChangeEventKind;
+import mx.resources.IResourceManager;
+import mx.resources.ResourceManager;
+import mx.utils.ArrayUtil;
+import mx.utils.UIDUtil;
+
+//--------------------------------------
+//  Events
+//--------------------------------------
+
+/**
+ *  Dispatched when the IList has been updated in some way.
+ *  
+ *  @eventType mx.events.CollectionEvent.COLLECTION_CHANGE
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Flex 3
+ */
+[Event(name="collectionChange", type="mx.events.CollectionEvent")]
+
+//--------------------------------------
+//  Other metadata
+//--------------------------------------
+
+[RemoteClass(alias="flex.messaging.io.ArrayList")]
+
+[ResourceBundle("collections")]
+
+[DefaultProperty("source")]
+
+/**
+ *  The ArrayList class is a simple implementation of IList 
+ *  that uses a backing Array as the source of the data. 
+ * 
+ *  Items in the backing Array can be accessed and manipulated 
+ *  using the methods and properties of the <code>IList</code>
+ *  interface. Operations on an ArrayList instance modify the 
+ *  data source; for example, if you use the <code>removeItemAt()</code> 
+ *  method on an ArrayList, you remove the item from the underlying 
+ *  Array.
+ * 
+ *  This base class will not throw ItemPendingErrors but it
+ *  is possible that a subclass might.
+ * 
+ *  <pre>
+ *  &lt;mx:ArrayList
+ *  <b>Properties</b>
+ *  source="null"
+ *  /&gt;
+ *  </pre>
+ * 
+ *  @langversion 3.0
+ *  @playerversion Flash 10
+ *  @playerversion AIR 1.5
+ *  @productversion Flex 4
+ */
+public class ArrayList extends EventDispatcher
+       implements IList, IExternalizable, IPropertyChangeNotifier
+{
+    include "../core/Version.as";
+
+    //--------------------------------------------------------------------------
+    //
+    // Constructor
+    // 
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Construct a new ArrayList using the specified array as its source.
+     *  If no source is specified an empty array will be used.
+     * 
+     *  @param source The Array to use as a source for the ArrayList.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function ArrayList(source:Array = null)
+    {
+        super();
+
+        disableEvents();
+        this.source = source;
+        enableEvents();
+        _uid = UIDUtil.createUID();
+    }
+    
+    //--------------------------------------------------------------------------
+    //
+    // Variables
+    // 
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     *  Used for accessing localized Error messages.
+     */
+    private var resourceManager:IResourceManager =
+        ResourceManager.getInstance();
+                                    
+    /**
+     *  @private 
+     *  Indicates if events should be dispatched.
+     *  calls to enableEvents() and disableEvents() effect the value when == 0
+     *  events should be dispatched. 
+     */
+    private var _dispatchEvents:int = 0;
+
+    //--------------------------------------------------------------------------
+    //
+    // Properties
+    // 
+    //--------------------------------------------------------------------------
+    
+    //----------------------------------
+    // length
+    //----------------------------------
+    
+    [Bindable("collectionChange")]
+    
+    /**
+     *  Get the number of items in the list.  An ArrayList should always
+     *  know its length so it shouldn't return -1, though a subclass may 
+     *  override that behavior.
+     *
+     *  @return int representing the length of the source.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function get length():int
+    {
+        if (source)
+            return source.length;
+        else
+            return 0;
+    }
+    
+    //----------------------------------
+    // source
+    //----------------------------------
+    
+    /**
+     *  @private
+     *  Storage for the source Array.
+     */
+    private var _source:Array;
+    
+    /**
+     *  The source array for this ArrayList.  
+     *  Any changes done through the IList interface will be reflected in the 
+     *  source array.  
+     *  If no source array was supplied the ArrayList will create one internally.
+     *  Changes made directly to the underlying Array (e.g., calling 
+     *  <code>theList.source.pop()</code> will not cause <code>CollectionEvents</code> 
+     *  to be dispatched.
+     *
+     *  @return An Array that represents the underlying source.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function get source():Array
+    {
+        return _source;
+    }
+    
+    public function set source(s:Array):void
+    {
+        var i:int;
+        var len:int;
+        if (_source && _source.length)
+        {
+            len = _source.length;
+            for (i = 0; i < len; i++)
+            {
+                stopTrackUpdates(_source[i]);
+            }
+        }
+        _source  = s ? s : [];
+        len = _source.length;
+        for (i = 0; i < len; i++)
+        {
+            startTrackUpdates(_source[i]);
+        }
+        
+        if (_dispatchEvents == 0)
+        {
+           var event:CollectionEvent =
+            new CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
+           event.kind = CollectionEventKind.RESET;
+           dispatchEvent(event);
+        }
+    }
+    
+    //----------------------------------
+    // uid -- mx.core.IPropertyChangeNotifier
+    //----------------------------------
+    
+    /**
+     *  @private
+     *  Storage for the UID String. 
+     */
+    private var _uid:String;
+    
+    /**
+     *  Provides access to the unique id for this list.
+     *  
+     *  @return String representing the internal uid. 
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */  
+    public function get uid():String
+    {
+        return _uid;
+    }
+    
+    public function set uid(value:String):void
+    {
+        _uid = value;
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    // Methods
+    // 
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Get the item at the specified index.
+     * 
+     *  @param  index the index in the list from which to retrieve the item
+     *  @param  prefetch int indicating both the direction and amount of items
+     *          to fetch during the request should the item not be local.
+     *  @return the item at that index, null if there is none
+     *  @throws ItemPendingError if the data for that index needs to be 
+     *                           loaded from a remote location
+     *  @throws RangeError if the index &lt; 0 or index &gt;= length
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function getItemAt(index:int, prefetch:int = 0):Object
+    {
+        if (index < 0 || index >= length)
+        {
+            var message:String = resourceManager.getString(
+                "collections", "outOfBounds", [ index ]);
+            throw new RangeError(message);
+        }
+            
+        return source[index];
+    }
+    
+    /**
+     *  Place the item at the specified index.  
+     *  If an item was already at that index the new item will replace it and it 
+     *  will be returned.
+     *
+     *  @param  item the new value for the index
+     *  @param  index the index at which to place the item
+     *  @return the item that was replaced, null if none
+     *  @throws RangeError if index is less than 0 or greater than or equal to length
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function setItemAt(item:Object, index:int):Object
+    {
+        if (index < 0 || index >= length) 
+        {
+            var message:String = resourceManager.getString(
+                "collections", "outOfBounds", [ index ]);
+            throw new RangeError(message);
+        }
+        
+        var oldItem:Object = source[index];
+        source[index] = item;
+        stopTrackUpdates(oldItem);
+        startTrackUpdates(item);
+        
+        //dispatch the appropriate events 
+        if (_dispatchEvents == 0)
+        {
+            var hasCollectionListener:Boolean = 
+                hasEventListener(CollectionEvent.COLLECTION_CHANGE);
+            var hasPropertyListener:Boolean = 
+                hasEventListener(PropertyChangeEvent.PROPERTY_CHANGE);
+            var updateInfo:PropertyChangeEvent; 
+            
+            if (hasCollectionListener || hasPropertyListener)
+            {
+                updateInfo = new PropertyChangeEvent(PropertyChangeEvent.PROPERTY_CHANGE);
+                updateInfo.kind = PropertyChangeEventKind.UPDATE;
+                updateInfo.oldValue = oldItem;
+                updateInfo.newValue = item;
+                updateInfo.property = index;
+            }
+            
+            if (hasCollectionListener)
+            {
+                var event:CollectionEvent =
+                    new CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
+                event.kind = CollectionEventKind.REPLACE;
+                event.location = index;
+                event.items.push(updateInfo);
+                dispatchEvent(event);
+            }
+            
+            if (hasPropertyListener)
+            {
+                dispatchEvent(updateInfo);
+            }
+        }
+        return oldItem;    
+    }
+    
+    /**
+     *  Add the specified item to the end of the list.
+     *  Equivalent to addItemAt(item, length);
+     * 
+     *  @param item the item to add
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function addItem(item:Object):void
+    {
+        addItemAt(item, length);
+    }
+    
+    /**
+     *  Add the item at the specified index.  
+     *  Any item that was after this index is moved out by one.  
+     * 
+     *  @param item the item to place at the index
+     *  @param index the index at which to place the item
+     *  @throws RangeError if index is less than 0 or greater than the length
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function addItemAt(item:Object, index:int):void
+    {
+        if (index < 0 || index > length) 
+        {
+            var message:String = resourceManager.getString(
+                "collections", "outOfBounds", [ index ]);
+            throw new RangeError(message);
+        }
+            
+        source.splice(index, 0, item);
+
+        startTrackUpdates(item);
+        internalDispatchEvent(CollectionEventKind.ADD, item, index);
+    }
+    
+    /**
+     *  @copy mx.collections.ListCollectionView#addAll()
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function addAll(addList:IList):void
+    {
+        addAllAt(addList, length);
+    }
+    
+    /**
+     *  @copy mx.collections.ListCollectionView#addAllAt()
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function addAllAt(addList:IList, index:int):void
+    {
+        var length:int = addList.length;
+        for (var i:int = 0; i < length; i++)
+        {
+            this.addItemAt(addList.getItemAt(i), i+index);
+        }
+    }
+    
+    /**
+     *  Return the index of the item if it is in the list such that
+     *  getItemAt(index) == item.  
+     *  Note that in this implementation the search is linear and is therefore 
+     *  O(n).
+     * 
+     *  @param item the item to find
+     *  @return the index of the item, -1 if the item is not in the list.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function getItemIndex(item:Object):int
+    {
+        return ArrayUtil.getItemIndex(item, source);
+    }
+    
+    /**
+     *  Removes the specified item from this list, should it exist.
+     *
+     *  @param  item Object reference to the item that should be removed.
+     *  @return Boolean indicating if the item was removed.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function removeItem(item:Object):Boolean
+    {
+        var index:int = getItemIndex(item);
+        var result:Boolean = index >= 0;
+        if (result)
+            removeItemAt(index);
+
+        return result;
+    }
+    
+    /**
+     *  Remove the item at the specified index and return it.  
+     *  Any items that were after this index are now one index earlier.
+     *
+     *  @param index The index from which to remove the item.
+     *  @return The item that was removed.
+     *  @throws RangeError if index &lt; 0 or index &gt;= length.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function removeItemAt(index:int):Object
+    {
+        if (index < 0 || index >= length)
+        {
+            var message:String = resourceManager.getString(
+                "collections", "outOfBounds", [ index ]);
+            throw new RangeError(message);
+        }
+
+        var removed:Object = source.splice(index, 1)[0];
+        stopTrackUpdates(removed);
+        internalDispatchEvent(CollectionEventKind.REMOVE, removed, index);
+        return removed;
+    }
+    
+    /** 
+     *  Remove all items from the list.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function removeAll():void
+    {
+        if (length > 0)
+        {
+            var len:int = length;
+            for (var i:int = 0; i < len; i++)
+            {
+                stopTrackUpdates(source[i]);
+            }
+
+            source.splice(0, length);
+            internalDispatchEvent(CollectionEventKind.RESET);
+        }    
+    }
+    
+    /**
+     *  Notify the view that an item has been updated.  
+     *  This is useful if the contents of the view do not implement 
+     *  <code>IEventDispatcher</code>.  
+     *  If a property is specified the view may be able to optimize its 
+     *  notification mechanism.
+     *  Otherwise it may choose to simply refresh the whole view.
+     *
+     *  @param item The item within the view that was updated.
+     *
+     *  @param property A String, QName, or int
+     *  specifying the property that was updated.
+     *
+     *  @param oldValue The old value of that property.
+     *  (If property was null, this can be the old value of the item.)
+     *
+     *  @param newValue The new value of that property.
+     *  (If property was null, there's no need to specify this
+     *  as the item is assumed to be the new value.)
+     *
+     *  @see mx.events.CollectionEvent
+     *  @see mx.core.IPropertyChangeNotifier
+     *  @see mx.events.PropertyChangeEvent
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+     public function itemUpdated(item:Object, property:Object = null, 
+                                 oldValue:Object = null, 
+                                 newValue:Object = null):void
+    {
+        var event:PropertyChangeEvent =
+            new PropertyChangeEvent(PropertyChangeEvent.PROPERTY_CHANGE);
+        
+        event.kind = PropertyChangeEventKind.UPDATE;
+        event.source = item;
+        event.property = property;
+        event.oldValue = oldValue;
+        event.newValue = newValue;
+        
+        itemUpdateHandler(event);        
+    }    
+    
+    /**
+     *  Return an Array that is populated in the same order as the IList
+     *  implementation.  
+     *
+     *  @return An Array populated in the same order as the IList
+     *  implementation.
+     * 
+     *  @throws ItemPendingError if the data is not yet completely loaded
+     *  from a remote location
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */ 
+    public function toArray():Array
+    {
+        return source.concat();
+    }
+    
+    /**
+     *  Ensures that only the source property is seralized.
+     *  @private
+     */
+    public function readExternal(input:IDataInput):void
+    {
+        source = input.readObject();
+    }
+    
+    /**
+     *  Ensures that only the source property is serialized.
+     *  @private
+     */
+    public function writeExternal(output:IDataOutput):void
+    {
+        output.writeObject(_source);
+    }
+
+    /**
+     *  Pretty prints the contents of this ArrayList to a string and returns it.
+     *
+     *  @return A String containing the contents of the ArrayList.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    override public function toString():String
+    {
+        if (source)
+            return source.toString();
+        else
+            return getQualifiedClassName(this); 
+    }   
+    
+    //--------------------------------------------------------------------------
+    //
+    // Internal Methods
+    // 
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Enables event dispatch for this list.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    private function enableEvents():void
+    {
+        _dispatchEvents++;
+        if (_dispatchEvents > 0)
+            _dispatchEvents = 0;
+    }
+    
+    /**
+     *  Disables event dispatch for this list.
+     *  To re-enable events call enableEvents(), enableEvents() must be called
+     *  a matching number of times as disableEvents().
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    private function disableEvents():void
+    {
+        _dispatchEvents--;
+    }
+    
+    /**
+     *  Dispatches a collection event with the specified information.
+     *
+     *  @param kind String indicates what the kind property of the event should be
+     *  @param item Object reference to the item that was added or removed
+     *  @param location int indicating where in the source the item was added.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    private function internalDispatchEvent(kind:String, item:Object = null, location:int = -1):void
+    {
+        if (_dispatchEvents == 0)
+        {
+            if (hasEventListener(CollectionEvent.COLLECTION_CHANGE))
+            {
+                var event:CollectionEvent =
+                    new CollectionEvent(CollectionEvent.COLLECTION_CHANGE);
+                event.kind = kind;
+                event.items.push(item);
+                event.location = location;
+                dispatchEvent(event);
+            }
+
+            // now dispatch a complementary PropertyChangeEvent
+            if (hasEventListener(PropertyChangeEvent.PROPERTY_CHANGE) && 
+               (kind == CollectionEventKind.ADD || kind == CollectionEventKind.REMOVE))
+            {
+                var objEvent:PropertyChangeEvent =
+                    new PropertyChangeEvent(PropertyChangeEvent.PROPERTY_CHANGE);
+                objEvent.property = location;
+                if (kind == CollectionEventKind.ADD)
+                    objEvent.newValue = item;
+                else
+                    objEvent.oldValue = item;
+                dispatchEvent(objEvent);
+            }
+        }
+    }
+    
+    /**
+     *  Called when any of the contained items in the list dispatch an
+     *  ObjectChange event.  
+     *  Wraps it in a <code>CollectionEventKind.UPDATE</code> object.
+     *
+     *  @param event The event object for the ObjectChange event.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */    
+    protected function itemUpdateHandler(event:PropertyChangeEvent):void
+    {
+        internalDispatchEvent(CollectionEventKind.UPDATE, event);
+        // need to dispatch object event now
+        if (_dispatchEvents == 0 && hasEventListener(PropertyChangeEvent.PROPERTY_CHANGE))
+        {
+            var objEvent:PropertyChangeEvent = PropertyChangeEvent(event.clone());
+			//When itemUpdated is called, there is no event target. This means getItemIndex returns a -1
+			//Since this was originally cast as a uint, this caused many strange results. Changing it to
+			//an int to be consistent throughout other uses of this event
+            var index:int = getItemIndex(event.target);
+            objEvent.property = index.toString() + "." + event.property;
+            dispatchEvent(objEvent);
+        }
+    }
+    
+    /** 
+     *  If the item is an IEventDispatcher, watch it for updates.  
+     *  This method is called by the <code>addItemAt()</code> method, 
+     *  and when the source is initially assigned.
+     *
+     *  @param item The item passed to the <code>addItemAt()</code> method.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    protected function startTrackUpdates(item:Object):void
+    {
+        if (item && (item is IEventDispatcher))
+        {
+            IEventDispatcher(item).addEventListener(
+                                        PropertyChangeEvent.PROPERTY_CHANGE, 
+                                        itemUpdateHandler, false, 0, true);
+        }
+    }
+    
+    /** 
+     *  If the item is an IEventDispatcher, stop watching it for updates.
+     *  This method is called by the <code>removeItemAt()</code> and 
+     *  <code>removeAll()</code> methods, and before a new
+     *  source is assigned.
+     *
+     *  @param item The item passed to the <code>removeItemAt()</code> method.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    protected function stopTrackUpdates(item:Object):void
+    {
+        if (item && item is IEventDispatcher)
+        {
+            IEventDispatcher(item).removeEventListener(
+                                        PropertyChangeEvent.PROPERTY_CHANGE, 
+                                        itemUpdateHandler);    
+        }
+    }
+    
+}
+
+}

Modified: incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/VectorCollection.as
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/VectorCollection.as?rev=1311531&r1=1311530&r2=1311531&view=diff
==============================================================================
--- incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/VectorCollection.as (original)
+++ incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/VectorCollection.as Tue Apr 10 00:24:17 2012
@@ -24,16 +24,13 @@ import flash.utils.IDataInput;
 import flash.utils.IDataOutput;
 import flash.utils.IExternalizable;
 
-import mx.collections.ICollectionView;
-import mx.collections.ListCollectionView;
-import mx.collections.VectorList;
 import mx.core.mx_internal;
 
 use namespace mx_internal;
 
 [DefaultProperty("source")]
 
-public class VectorCollection extends ListCollectionView implements ICollectionView, IExternalizable
+public class VectorCollection extends ListCollectionView implements ICollectionView
 {
 
     //--------------------------------------------------------------------------
@@ -94,37 +91,6 @@ public class VectorCollection extends Li
 		//Provides a default VectorList
 		list = new VectorList( s );
     }
-
-    //--------------------------------------------------------------------------
-    //
-    //  Methods
-    //
-    //--------------------------------------------------------------------------
-
-    /**
-     *  @private
-     *  Ensures that only the source property is serialized.
-     */
-    public function readExternal(input:IDataInput):void
-    {
-        if (list is IExternalizable)
-            IExternalizable(list).readExternal(input);
-        else
-            source = input.readObject();
-    }
-
-    /**
-     *  @private
-     *  Ensures that only the source property is serialized.
-     */
-    public function writeExternal(output:IDataOutput):void
-    {
-        if (list is IExternalizable)
-            IExternalizable(list).writeExternal(output);
-        else
-            output.writeObject(source);
-    }
-
 }
 
 }

Modified: incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/VectorList.as
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/VectorList.as?rev=1311531&r1=1311530&r2=1311531&view=diff
==============================================================================
--- incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/VectorList.as (original)
+++ incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/VectorList.as Tue Apr 10 00:24:17 2012
@@ -62,19 +62,21 @@ import mx.utils.UIDUtil;
  *  is possible that a subclass might.
  */
 public class VectorList extends EventDispatcher
-	   implements IList, IExternalizable, IPropertyChangeNotifier {
+	   implements IList, IPropertyChangeNotifier {
 	   
     //--------------------------------------------------------------------------
     //
     // Static Initializer
     // 
     //--------------------------------------------------------------------------
-    {
+	   /*    {
         //If one attempt to serialize a Vector in any way, the type of the Vector is not retained unless the types are also aliased
         //This should really be handled in the VM in my opinion, however, it is being done here to make it more pay as you go
         //Unfortunately the consequence is that one must either do this manually or in some way reference a VectorList to ensure
         //proper serialization of their Vectors
-        registerClassAlias( "Boolean", Boolean );
+
+	//This is commented out pending the outcome of discussion abotu serialization	
+		registerClassAlias( "Boolean", Boolean );
         registerClassAlias( "int", int );
         registerClassAlias( "Number", Number );
         registerClassAlias( "String", String );
@@ -85,7 +87,7 @@ public class VectorList extends EventDis
 
         registerClassAlias( "Vector", Vector );
     }
-	 
+		*/	 
 	private static const VECTOR_PREFIX:String = "__AS3__.vec::Vector.";
 	private var fixedLengthVector:Boolean = false;
 
@@ -233,11 +235,8 @@ public class VectorList extends EventDis
      *  Get the item at the specified index.
      * 
      *  @param 	index the index in the list from which to retrieve the item
-     *  @param	prefetch int indicating both the direction and amount of items
-     *			to fetch during the request should the item not be local.
+     *  @param	Not used in this implementation at this time
      *  @return the item at that index, null if there is none
-     *  @throws ItemPendingError if the data for that index needs to be 
-     *                           loaded from a remote location
      *  @throws RangeError if the index < 0 or index >= length
      */
     public function getItemAt(index:int, prefetch:int = 0):Object
@@ -486,24 +485,6 @@ public class VectorList extends EventDis
 
         return ar;
     }
-    
-    /**
-     *  Ensures that only the source property is seralized.
-     *  @private
-     */
-    public function readExternal(input:IDataInput):void
-    {
-    	source = input.readObject();
-    }
-    
-    /**
-     *  Ensures that only the source property is serialized.
-     *  @private
-     */
-    public function writeExternal(output:IDataOutput):void
-    {
-    	output.writeObject(_source);
-    }
 
 	/**
      *  Pretty prints the contents of this VectorList to a string and returns it.
@@ -588,7 +569,7 @@ public class VectorList extends EventDis
     	if (_dispatchEvents == 0 && hasEventListener(PropertyChangeEvent.PROPERTY_CHANGE))
     	{
     		var objEvent:PropertyChangeEvent = PropertyChangeEvent(event.clone());
-    		var index:uint = getItemIndex(event.target);
+    		var index:int = getItemIndex(event.target);
     		objEvent.property = index.toString() + "." + event.property;
     		dispatchEvent(objEvent);
     	}

Added: incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/tests/CollectionTests.as
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/tests/CollectionTests.as?rev=1311531&view=auto
==============================================================================
--- incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/tests/CollectionTests.as (added)
+++ incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/tests/CollectionTests.as Tue Apr 10 00:24:17 2012
@@ -0,0 +1,14 @@
+package mx.collections.tests
+{
+	import mx.collections.tests.vectorCollection.BasicFunctionsTest;
+	import mx.collections.tests.vectorList.VectorListSuite;
+	
+	[Suite]
+	[RunWith("org.flexunit.runners.Suite")]
+	public class CollectionTests
+	{
+		public var test1:mx.collections.tests.vectorCollection.BasicFunctionsTest;
+		public var test2:mx.collections.tests.vectorList.VectorListSuite;
+		
+	}
+}
\ No newline at end of file

Added: incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/tests/vectorCollection/BasicFunctionsTest.as
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/tests/vectorCollection/BasicFunctionsTest.as?rev=1311531&view=auto
==============================================================================
--- incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/tests/vectorCollection/BasicFunctionsTest.as (added)
+++ incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/tests/vectorCollection/BasicFunctionsTest.as Tue Apr 10 00:24:17 2012
@@ -0,0 +1,59 @@
+package mx.collections.tests.vectorCollection {
+	import mx.collections.ICollectionView;
+	import mx.collections.IList;
+	import mx.collections.VectorCollection;
+	import mx.collections.VectorList;
+	
+	import org.flexunit.assertThat;
+	import org.flexunit.asserts.assertNull;
+	import org.hamcrest.object.instanceOf;
+	import org.hamcrest.object.sameInstance;
+
+	public class BasicFunctionsTest {
+
+		[Test]
+		public function shouldImplementICollectionView():void {
+			var collection:VectorCollection = new VectorCollection();
+			assertThat( collection, instanceOf( ICollectionView ) );
+		}
+
+		[Test]
+		public function instantiatingWithoutSourceShouldBuildOwnVectorList():void {
+			var collection:VectorCollection = new VectorCollection();
+			
+			assertThat( collection.list, instanceOf( VectorList ) );
+		}
+
+		[Test]
+		public function instantiatingWithVectorShouldYieldListWithVector():void {
+			var vector:Vector.<*> = new Vector.<*>;
+			var collection:VectorCollection = new VectorCollection( vector );
+			
+			assertThat( vector, sameInstance( VectorList( collection.list ).source ) );
+		}
+
+		[Test(expects="TypeError")]
+		public function instantiatingWithTypeOtherThanVectorShouldThrowTypeError():void {
+			var collection:VectorCollection = new VectorCollection( [] );
+		}
+
+		[Test]
+		public function sourceShouldReturnVectorListSourceWhenListViable():void {
+			var vector:Vector.<*> = new Vector.<*>;
+			var collection:VectorCollection = new VectorCollection( vector );
+			
+			assertThat( vector, sameInstance( collection.source ) );
+		}
+
+		[Test]
+		public function sourceShouldReturnNullWhenListIsNull():void {
+			var collection:VectorCollection = new VectorCollection();
+			collection.list = null;
+			
+			assertNull( collection.source );
+		}
+
+		public function BasicFunctionsTest() {
+		}
+	}
+}
\ No newline at end of file

Added: incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/tests/vectorList/AddRemoveItemAtTest.as
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/tests/vectorList/AddRemoveItemAtTest.as?rev=1311531&view=auto
==============================================================================
--- incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/tests/vectorList/AddRemoveItemAtTest.as (added)
+++ incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/tests/vectorList/AddRemoveItemAtTest.as Tue Apr 10 00:24:17 2012
@@ -0,0 +1,133 @@
+package mx.collections.tests.vectorList {
+	import flash.events.EventDispatcher;
+	
+	import mx.collections.VectorList;
+	import mx.events.PropertyChangeEvent;
+	
+	import org.flexunit.assertThat;
+	import org.flexunit.asserts.assertEquals;
+	import org.flexunit.asserts.assertFalse;
+	import org.flexunit.asserts.assertTrue;
+	import org.hamcrest.collection.hasItem;
+	import org.hamcrest.core.not;
+
+	public class AddRemoveItemAtTest {
+		
+		[Test]
+		public function addItemAtShouldInsertElementIntoVector():void {
+			var vector:Vector.<int> = new <int>[ 7, 8, 9 ];
+			var vectorList:VectorList = new VectorList( vector );
+			const value:int = 5;
+			
+			vectorList.addItemAt( value, 2 );
+			assertEquals( 4, vectorList.length );
+			assertEquals( value, vector[ 2 ] );
+		}
+
+		public function addItemAtShouldAddEventListenerForEventDispatchers():void {
+			const value:EventDispatcher = new EventDispatcher();
+			var vector:Vector.<EventDispatcher> = new <EventDispatcher>[value];
+			var vectorList:VectorList = new VectorList( vector );
+			
+			assertFalse( value.hasEventListener( PropertyChangeEvent.PROPERTY_CHANGE ) );
+			vectorList.addItemAt( value, 0 );
+			assertTrue( value.hasEventListener( PropertyChangeEvent.PROPERTY_CHANGE ) );
+		}
+
+		[Test(expects="RangeError")]
+		public function shouldReceiveRangeErrorAttemptingToAddItemAtNegativeIndex():void {
+			var vector:Vector.<int> = new <int>[];
+			var vectorList:VectorList = new VectorList( vector );
+			const value:int = 5;
+			
+			vectorList.addItemAt( value, -1 );
+		}
+		
+		[Test(expects="RangeError")]
+		public function shouldReceiveRangeErrorAttemptingToAddItemAtPastEndOfVector():void {
+			var vector:Vector.<int> = new <int>[];
+			var vectorList:VectorList = new VectorList( vector );
+			const value:int = 5;
+			
+			vectorList.addItemAt( value, 2 );
+		}
+		
+		[Test(expects="RangeError")]
+		public function shouldReceiveErrorAttemptingToAddItemAtToFixedLengthVector():void {
+			var vector:Vector.<int> = new Vector.<int>( 1, true );
+			var vectorList:VectorList = new VectorList( vector );
+			const value:int = 5;
+			
+			vectorList.addItemAt( value, 0 );
+		}
+		
+		[Test]
+		public function removeItemAtShouldRemoveItemFromVector():void {
+			const value:int = 5;
+			var vector:Vector.<int> = new <int>[ value ];
+			var vectorList:VectorList = new VectorList( vector );
+			
+			assertThat( vector, hasItem( value ) );
+			
+			vectorList.removeItemAt( 0 );
+			assertThat( vector, not( hasItem( value ) ) );
+		}
+
+		public function removeItemAtShouldRemoveEventListenerForEventDispatchers():void {
+			const value:EventDispatcher = new EventDispatcher();
+			var vector:Vector.<EventDispatcher> = new <EventDispatcher>[value];
+			var vectorList:VectorList = new VectorList( vector );
+			
+			assertTrue( value.hasEventListener( PropertyChangeEvent.PROPERTY_CHANGE ) );
+			vectorList.removeItemAt( 0 );
+			assertFalse( value.hasEventListener( PropertyChangeEvent.PROPERTY_CHANGE ) );
+		}
+		
+		[Test]
+		public function removeItemAtShouldRemoveReturnRemovedItem():void {
+			const value:int = 5;
+			var vector:Vector.<int> = new <int>[ value ];
+			var vectorList:VectorList = new VectorList( vector );
+			
+			assertEquals( value, vectorList.removeItemAt( 0 ) );
+		}
+
+		[Test]
+		public function removeItemAtShouldRemoveArbitraryNode():void {
+			const value:int = 5;
+			var vector:Vector.<int> = new <int>[ 3, 7, 9, value, 11, 13 ];
+			var vectorList:VectorList = new VectorList( vector );
+			
+			assertThat( vector, hasItem( value ) );
+			
+			vectorList.removeItemAt( 3 );
+
+			assertThat( vector, not( hasItem( value ) ) );
+		}
+
+		[Test]
+		public function removeItemAtShouldRemoveLastNode():void {
+			const value:int = 5;
+			var vector:Vector.<int> = new <int>[ 3, 7, 9, 11, 13, value ];
+			var vectorList:VectorList = new VectorList( vector );
+			
+			assertThat( vector, hasItem( value ) );
+			
+			vectorList.removeItemAt( 5 );
+			
+			assertThat( vector, not( hasItem( value ) ) );
+		}
+
+		[Test(expects="RangeError")]
+		public function removeItemAtShouldThrowRangeErrorIfOutOfRangeIndexSupplied():void {
+			const value:int = 5;
+			var vector:Vector.<int> = new <int>[ value ];
+			var vectorList:VectorList = new VectorList( vector );
+
+			vectorList.removeItemAt( 3 );
+		}
+
+		public function AddRemoveItemAtTest() {
+		}
+	}
+}
\ No newline at end of file

Added: incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/tests/vectorList/AddRemoveItemTest.as
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/tests/vectorList/AddRemoveItemTest.as?rev=1311531&view=auto
==============================================================================
--- incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/tests/vectorList/AddRemoveItemTest.as (added)
+++ incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/tests/vectorList/AddRemoveItemTest.as Tue Apr 10 00:24:17 2012
@@ -0,0 +1,153 @@
+package mx.collections.tests.vectorList {
+	import flash.display.Sprite;
+	import flash.events.EventDispatcher;
+	
+	import mx.collections.VectorList;
+	
+	import org.flexunit.assertThat;
+	import org.flexunit.asserts.assertEquals;
+	import org.flexunit.asserts.assertFalse;
+	import org.flexunit.asserts.assertStrictlyEquals;
+	import org.flexunit.asserts.assertTrue;
+	import org.hamcrest.collection.hasItem;
+	import org.hamcrest.core.not;
+	import org.hamcrest.object.sameInstance;
+
+	public class AddRemoveItemTest {
+		
+		private static const EMPTY:int = 0;
+
+		[Test(expects="TypeError")]
+		public function addItemShouldNotAddItemToMismatchedVectorOfNonConvertibleTypes():void {
+			var vector:Vector.<Sprite> = new <Sprite>[];
+			var vectorList:VectorList = new VectorList( vector );
+			
+			const value:String = "Test";
+			
+			vectorList.addItem( value );
+		}
+		
+		[Test]
+		public function addItemShouldAddFirstItemToEmptyVector():void {
+			var vector:Vector.<int> = new <int>[];
+			var vectorList:VectorList = new VectorList( vector );
+			const value:int = 5;
+			
+			assertThat( vector, not( hasItem( value ) ) );
+			
+			vectorList.addItem( value );
+			assertEquals( 1, vectorList.length );
+			assertThat( vector, hasItem( value ) );
+		}
+		
+		[Test]
+		public function addItemShouldAddItemToMismatchedVectorOfConvertibleTypes():void {
+			//I actually find this an irritating behavior of Vector, but we need to ensure we aren't messing with it.
+			var vector:Vector.<int> = new <int>[];
+			var vectorList:VectorList = new VectorList( vector );
+			
+			const value:String = "5";
+			
+			assertThat( vector, not( hasItem( value ) ) );
+			vectorList.addItem( value );
+			assertThat( vector, hasItem( value ) );
+		}
+		
+		[Test]
+		public function addItemShouldAddLastItemToPopulatedVector():void {
+			var vector:Vector.<int> = new <int>[ 7, 8, 9 ];
+			var vectorList:VectorList = new VectorList( vector );
+			const value:int = 5;
+			
+			assertEquals( 3, vectorList.length );
+			
+			vectorList.addItem( value );
+			assertEquals( 4, vectorList.length );
+			assertEquals( value, vector[ 3 ] );
+		}
+		
+		[Test(expects="RangeError")]
+		public function shouldReceiveErrorAttemptingToAddItemToFixedLengthVector():void {
+			var vector:Vector.<int> = new Vector.<int>( 1, true );
+			var vectorList:VectorList = new VectorList( vector );
+			const value:int = 5;
+			
+			vectorList.addItem( value );
+		}
+
+		[Test]
+		public function removeItemShouldRemoveSimpleItemFromVector():void {
+			var vector:Vector.<int> = new <int>[];
+			var vectorList:VectorList = new VectorList( vector );
+			const value:int = 5;
+
+			vectorList.addItem( value );
+			assertThat( vector, hasItem( value ) );
+
+			vectorList.removeItem( value );
+			assertThat( vector, not( hasItem( value ) ) );
+		}
+
+		[Test]
+		public function removeItemShouldRemoveSingleSimpleItemFromVector():void {
+			var vector:Vector.<int> = new <int>[];
+			var vectorList:VectorList = new VectorList( vector );
+			const value:int = 5;
+			
+			vectorList.addItem( value );
+			vectorList.addItem( value );
+			assertThat( vector, hasItem( value ) );
+			
+			vectorList.removeItem( value );
+			assertThat( vector, hasItem( value ) );
+			assertEquals( 1, vector.length );
+		}
+
+		[Test]
+		public function removeItemShouldRemoveComplexItemFromVector():void {
+			var vector:Vector.<EventDispatcher> = new <EventDispatcher>[];
+			var vectorList:VectorList = new VectorList( vector );
+			const value:EventDispatcher = new EventDispatcher();
+			
+			vectorList.addItem( value );
+			assertThat( vector, hasItem( value ) );
+			
+			vectorList.removeItem( value );
+			assertThat( vector, not( hasItem( value ) ) );
+		}
+
+		[Test]
+		public function removeItemShouldRemoveReturnTrueIfItemFound():void {
+			var vector:Vector.<EventDispatcher> = new <EventDispatcher>[];
+			var vectorList:VectorList = new VectorList( vector );
+			const value:EventDispatcher = new EventDispatcher();
+			
+			vectorList.addItem( value );
+			assertTrue( vectorList.removeItem( value ) );
+		}
+
+		[Test]
+		public function removeItemShouldRemoveReturnFalseIfItemNotFound():void {
+			var vector:Vector.<EventDispatcher> = new <EventDispatcher>[];
+			var vectorList:VectorList = new VectorList( vector );
+			const value:EventDispatcher = new EventDispatcher();
+			
+			assertFalse( vectorList.removeItem( value ) );
+		}
+
+		[Test]
+		public function removeAllShouldEmptyVector():void {
+			var vector:Vector.<int> = new <int>[ 5, 7, 9, 11, 13 ];
+			var vectorList:VectorList = new VectorList( vector );
+			
+			assertEquals( 5, vector.length );
+			
+			vectorList.removeAll();
+
+			assertEquals( EMPTY, vector.length );
+		}
+
+		public function AddRemoveItemTest() {
+		}
+	}
+}
\ No newline at end of file

Added: incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/tests/vectorList/BasicFunctionsTest.as
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/tests/vectorList/BasicFunctionsTest.as?rev=1311531&view=auto
==============================================================================
--- incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/tests/vectorList/BasicFunctionsTest.as (added)
+++ incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/tests/vectorList/BasicFunctionsTest.as Tue Apr 10 00:24:17 2012
@@ -0,0 +1,127 @@
+package mx.collections.tests.vectorList {
+	import mx.collections.IList;
+	import mx.collections.VectorList;
+	import mx.core.IPropertyChangeNotifier;
+	
+	import org.flexunit.assertThat;
+	import org.flexunit.asserts.assertEquals;
+	import org.flexunit.asserts.assertFalse;
+	import org.flexunit.asserts.assertNotNull;
+	import org.flexunit.asserts.assertStrictlyEquals;
+	import org.flexunit.asserts.assertTrue;
+	import org.hamcrest.collection.hasItem;
+	import org.hamcrest.core.not;
+	import org.hamcrest.object.instanceOf;
+
+	public class BasicFunctionsTest {
+
+		private static const EMPTY:int = 0;
+	
+		[Test]
+		public function shouldImplementIList():void {
+			var vectorList:VectorList = new VectorList( null );
+			assertThat( vectorList, instanceOf( IList ) );
+		}
+
+		[Test]
+		public function shouldImplementIPropertyChangeNotifier():void {
+			var vectorList:VectorList = new VectorList( null );
+			assertThat( vectorList, instanceOf( IPropertyChangeNotifier ) );
+		}
+
+		[Test]
+		public function lengthShouldBeEmptyWithNullSource():void {
+			var vectorList:VectorList = new VectorList( null );
+			assertEquals( EMPTY, vectorList.length );
+		}
+
+		[Test(expects="TypeError")]
+		public function shouldReceiveErrorWithNonVectorType():void {
+			var vectorList:VectorList = new VectorList( [] );
+		}
+
+		[Test]
+		public function lengthShouldBeEmptyWhenEmptyVectorProvided():void {
+			var vectorList:VectorList = new VectorList( new Vector.<int>() );
+			assertEquals( EMPTY, vectorList.length );
+		}
+
+		[Test]
+		public function lengthShouldBe1WhenVectorLength1Provided():void {
+			var vectorList:VectorList = new VectorList( new Vector.<int>(1) );
+			assertEquals( 1, vectorList.length );
+		}
+
+		[Test]
+		public function sourcePropertyShouldBeStrictlyEqualToProvidedVector():void {
+			var vector:Vector.<int> = new Vector.<int>();
+			var vectorList:VectorList = new VectorList( vector );
+			assertStrictlyEquals( vector, vectorList.source );
+		}
+
+		[Test]
+		public function shouldSetUIDAtConstruction():void {
+			var vectorList:VectorList = new VectorList( new <int>[] );
+
+			assertNotNull( vectorList.uid );
+			assertTrue( vectorList.uid.length > 0 );
+		}
+
+		[Test]
+		public function multipleVectorListsShouldNotShareAUID():void {
+			var vectorList1:VectorList = new VectorList( new <int>[] );
+			var vectorList2:VectorList = new VectorList( new <int>[] );
+			var vectorList3:VectorList = new VectorList( new <int>[] );
+			
+			assertTrue( vectorList1.uid != vectorList2.uid );
+			assertTrue( vectorList2.uid != vectorList3.uid );
+			assertTrue( vectorList1.uid != vectorList3.uid );
+		}
+
+		[Test]
+		public function shouldBeAbleToSetUID():void {
+			const newUID:String = "3.14159265358";
+			var vectorList:VectorList = new VectorList( new <int>[] );
+			
+			assertFalse( vectorList.uid == newUID );
+			
+			vectorList.uid = newUID;
+			assertTrue( vectorList.uid == newUID );
+		}
+
+		[Test]
+		public function setItemAtShouldUpdateValueAtPosition():void {
+			const value:int = 5;
+			const position:int = 2;
+			var vector:Vector.<int> = new <int>[ 3, 7, 9, 11, 13 ];
+			var vectorList:VectorList = new VectorList( vector );
+			
+			assertThat( vector, not( hasItem( value ) ) );
+			vectorList.setItemAt( value, position );
+			assertThat( vector, hasItem( value ) );
+			assertEquals( value, vector[ position ] );
+		}
+
+		[Test]
+		public function setItemAtShouldReturnOldValueWhenSettingNewValue():void {
+			const newValue:int = 5;
+			const oldValue:int = 9;
+			const position:int = 2;
+			var vector:Vector.<int> = new <int>[ 3, 7, oldValue, 11, 13 ];
+			var vectorList:VectorList = new VectorList( vector );
+			
+			
+			assertEquals( oldValue, vectorList.setItemAt( newValue, position ) );
+		}
+
+		[Test(expects="RangeError")]
+		public function setItemAtShouldThrowRangeErrorForOutOfBoundsIndex():void {
+			const value:int = 100;
+			const position:int = 2;
+			var vector:Vector.<int> = new <int>[ 3 ];
+			var vectorList:VectorList = new VectorList( vector );
+			
+			vectorList.setItemAt( value, position );
+		}
+	}
+}
\ No newline at end of file

Added: incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/tests/vectorList/ConversionTest.as
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/tests/vectorList/ConversionTest.as?rev=1311531&view=auto
==============================================================================
--- incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/tests/vectorList/ConversionTest.as (added)
+++ incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/tests/vectorList/ConversionTest.as Tue Apr 10 00:24:17 2012
@@ -0,0 +1,34 @@
+package mx.collections.tests.vectorList {
+	import mx.collections.tests.vectorList.helper.IsEqualToVectorMatcher;
+	
+	import mx.collections.VectorList;
+	
+	import org.flexunit.assertThat;
+	import org.flexunit.asserts.assertEquals;
+
+	public class ConversionTest {
+
+		[Test]
+		public function toStringMethodShouldBeVectorToStringWhenProvidedVector():void {
+			var vector:Vector.<int> = new <int>[ 5, 4, 3, 1, 2, 5 ];
+			var vectorList:VectorList = new VectorList( vector );
+			assertEquals( vector.toString(), vectorList.toString() );
+		}
+		
+		[Test]
+		public function toStringShouldBeEmptyStringWithNullSource():void {
+			var vectorList:VectorList = new VectorList( null );
+			assertEquals( "", vectorList.toString() );
+		}
+		
+		[Test]
+		public function toArrayShouldReturnArrayWithSameElementsAsVector():void {
+			var vector:Vector.<*> = new <*>[ 5, 4, "3", 1, "Bob", 5 ];
+			var vectorList:VectorList = new VectorList( vector );
+			assertThat( vectorList.toArray(), new IsEqualToVectorMatcher( vector ) );
+		}
+
+		public function ConversionTest() {
+		}
+	}
+}
\ No newline at end of file

Added: incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/tests/vectorList/EventsTest.as
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/tests/vectorList/EventsTest.as?rev=1311531&view=auto
==============================================================================
--- incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/tests/vectorList/EventsTest.as (added)
+++ incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/tests/vectorList/EventsTest.as Tue Apr 10 00:24:17 2012
@@ -0,0 +1,396 @@
+package mx.collections.tests.vectorList {
+	import flash.events.EventDispatcher;
+	
+	import mx.collections.VectorList;
+	import mx.events.CollectionEvent;
+	import mx.events.CollectionEventKind;
+	import mx.events.PropertyChangeEvent;
+	import mx.events.PropertyChangeEventKind;
+	
+	import org.flexunit.events.rule.EventRule;
+	import org.hamcrest.collection.arrayWithSize;
+	import org.hamcrest.collection.hasItem;
+	import org.hamcrest.core.allOf;
+	import org.hamcrest.object.hasPropertyWithValue;
+	import org.hamcrest.object.instanceOf;
+
+	public class EventsTest {
+		
+		[Rule]
+		public var expectEvent:EventRule = new EventRule();
+
+		[Test]
+		public function shouldReceiveCollectionResetWhenSettingSourceToValidValue():void {
+			var vectorList:VectorList = new VectorList();
+
+			expectEvent.from( vectorList ).
+				hasType( CollectionEvent.COLLECTION_CHANGE ).
+				instanceOf( CollectionEvent ).
+				hasPropertyWithValue( "kind", CollectionEventKind.RESET ).
+				once();
+
+			vectorList.source = new <int>[ 1, 2, 3, 4 ];
+		}
+
+		[Test]
+		public function shouldReceiveCollectionResetWhenSettingSourceToNull():void {
+			var vectorList:VectorList = new VectorList();
+			
+			expectEvent.from( vectorList ).
+				hasType( CollectionEvent.COLLECTION_CHANGE ).
+				instanceOf( CollectionEvent ).
+				hasPropertyWithValue( "kind", CollectionEventKind.RESET ).
+				once();
+			
+			vectorList.source = null;
+		}
+
+		[Test]
+		public function shouldReceiveCollectionEventWhenAddingItem():void {
+			const value:int = 5;
+			var vectorList:VectorList = new VectorList( new <int>[ 1, 2, 3, 4 ] );
+			
+			expectEvent.from( vectorList ).
+				hasType( CollectionEvent.COLLECTION_CHANGE ).
+				instanceOf( CollectionEvent ).
+				hasPropertyWithValue( "kind", CollectionEventKind.ADD ).
+				hasPropertyWithValue( "items", allOf( arrayWithSize( 1 ), hasItem( value ) ) ). 
+				once();
+			
+			vectorList.addItem( value );
+		}
+		
+		[Test]
+		public function shouldReceivePropertyChangeEventWhenAddingItem():void {
+			const value:int = 5;
+			var index:int = 0;
+			var vectorList:VectorList = new VectorList( new <int>[ 1, 2, 3, 4 ] );
+			
+			index = vectorList.length;
+			
+			expectEvent.from( vectorList ).
+				hasType( PropertyChangeEvent.PROPERTY_CHANGE ).
+				instanceOf( PropertyChangeEvent ).
+				hasPropertyWithValue( "property", index ).
+				hasPropertyWithValue( "newValue", value ). 
+				once();
+			
+			vectorList.addItem( value );
+		}
+
+		[Test]
+		public function shouldReceiveCollectionEventWhenAddingItemAtIndex():void {
+			const value:int = 5;
+			const index:int = 2;
+			var vectorList:VectorList = new VectorList( new <int>[ 1, 2, 3, 4 ] );
+			
+			expectEvent.from( vectorList ).
+				hasType( CollectionEvent.COLLECTION_CHANGE ).
+				instanceOf( CollectionEvent ).
+				hasPropertyWithValue( "kind", CollectionEventKind.ADD ).
+				hasPropertyWithValue( "items", allOf( arrayWithSize( 1 ), hasItem( value ) ) ). 
+				once();
+			
+			vectorList.addItemAt( value, index );
+		}
+		
+		[Test]
+		public function shouldReceivePropertyChangeEventWhenAddingItemAtIndex():void {
+			const value:int = 5;
+			const index:int = 2;
+			var vectorList:VectorList = new VectorList( new <int>[ 1, 2, 3, 4 ] );
+			
+			expectEvent.from( vectorList ).
+				hasType( PropertyChangeEvent.PROPERTY_CHANGE ).
+				instanceOf( PropertyChangeEvent ).
+				hasPropertyWithValue( "property", index ).
+				hasPropertyWithValue( "newValue", value ). 
+				once();
+			
+			vectorList.addItemAt( value, index );
+		}
+
+		[Test]
+		public function childPropertyChangeEventsShouldPropagateWhenAddedToVectorList():void {
+			const index:uint = 1;
+			const propertyName:String = "dummy";
+			const propertyOldVal:String = "dummyOldVal";
+			const propertyNewVal:String = "dummyNewVal";
+
+			var vector:Vector.<EventDispatcher> = new Vector.<EventDispatcher>();
+			var eventDispatcher:EventDispatcher = new EventDispatcher();
+			var vectorList:VectorList = new VectorList( vector );
+			
+			vectorList.addItem( new EventDispatcher() );
+			vectorList.addItemAt( eventDispatcher, index );
+			
+			expectEvent.from( vectorList ).
+				hasType( PropertyChangeEvent.PROPERTY_CHANGE ).
+				instanceOf( PropertyChangeEvent ).
+				hasPropertyWithValue( "kind", PropertyChangeEventKind.UPDATE ).
+				hasPropertyWithValue( "newValue", propertyNewVal ). 
+				hasPropertyWithValue( "oldValue", propertyOldVal ). 
+				hasPropertyWithValue( "property", index + '.' + propertyName ). 
+				hasPropertyWithValue( "source", eventDispatcher ). 
+				once();
+			
+			eventDispatcher.dispatchEvent( PropertyChangeEvent.createUpdateEvent( eventDispatcher, propertyName , propertyOldVal, propertyNewVal ) );
+		}
+
+		[Test]
+		public function childPropertyChangeEventsShouldStopPropagatingWhenRemovedFromVectorList():void {
+			const index:uint = 1;
+			const propertyName:String = "dummy";
+			const propertyOldVal:String = "dummyOldVal";
+			const propertyNewVal:String = "dummyNewVal";
+			
+			var vector:Vector.<EventDispatcher> = new Vector.<EventDispatcher>();
+			var eventDispatcher:EventDispatcher = new EventDispatcher();
+			var vectorList:VectorList = new VectorList( vector );
+			
+			vectorList.addItem( new EventDispatcher() );
+			vectorList.addItemAt( eventDispatcher, index );
+			vectorList.removeItemAt( index );
+			
+			expectEvent.from( vectorList ).
+				hasType( PropertyChangeEvent.PROPERTY_CHANGE ).
+				never();
+			
+			eventDispatcher.dispatchEvent( PropertyChangeEvent.createUpdateEvent( eventDispatcher, propertyName , propertyOldVal, propertyNewVal ) );
+		}
+
+		[Test(description="This is an example of a test that codifies existing behavior, but it may be WRONG behavior")]
+		public function collectChangeEventsShouldBeReceivedWhenChildPropertyChangeEventOccurs():void {
+			const propertyName:String = "dummy";
+			const propertyOldVal:String = "dummyOldVal";
+			const propertyNewVal:String = "dummyNewVal";
+			
+			var vector:Vector.<EventDispatcher> = new Vector.<EventDispatcher>();
+			var eventDispatcher:EventDispatcher = new EventDispatcher();
+			var vectorList:VectorList = new VectorList( vector );
+			
+			vectorList.addItem( eventDispatcher );
+			
+			expectEvent.from( vectorList ).
+				hasType( CollectionEvent.COLLECTION_CHANGE ).
+				instanceOf( CollectionEvent ).
+				hasPropertyWithValue( "kind", CollectionEventKind.UPDATE ).
+				hasPropertyWithValue( "location", -1 ). 
+				hasPropertyWithValue( "oldLocation", -1 ). 
+				once();
+			
+			eventDispatcher.dispatchEvent( PropertyChangeEvent.createUpdateEvent( eventDispatcher, propertyName , propertyOldVal, propertyNewVal ) );
+		}
+
+		[Test]
+		public function childPropertyChangeEventsShouldPropagateWhenAddedViaSourceToVectorList():void {
+			const index:uint = 1;
+			const propertyName:String = "dummy";
+			const propertyOldVal:String = "dummyOldVal";
+			const propertyNewVal:String = "dummyNewVal";
+			
+			var vector:Vector.<EventDispatcher> = new Vector.<EventDispatcher>();
+			var eventDispatcher:EventDispatcher = new EventDispatcher();
+			vector.push( new EventDispatcher() );
+			vector.push( eventDispatcher );
+
+			var vectorList:VectorList = new VectorList( vector );
+			
+			expectEvent.from( vectorList ).
+				hasType( PropertyChangeEvent.PROPERTY_CHANGE ).
+				instanceOf( PropertyChangeEvent ).
+				hasPropertyWithValue( "kind", PropertyChangeEventKind.UPDATE ).
+				hasPropertyWithValue( "newValue", propertyNewVal ). 
+				hasPropertyWithValue( "oldValue", propertyOldVal ). 
+				hasPropertyWithValue( "property", index + '.' + propertyName ). 
+				hasPropertyWithValue( "source", eventDispatcher ). 
+				once();
+			
+			eventDispatcher.dispatchEvent( PropertyChangeEvent.createUpdateEvent( eventDispatcher, propertyName , propertyOldVal, propertyNewVal ) );
+		}
+		
+		[Test]
+		public function childPropertyChangeEventsShouldStopPropagatingWhenRemovedViaSourceFromVectorList():void {
+			const index:uint = 1;
+			const propertyName:String = "dummy";
+			const propertyOldVal:String = "dummyOldVal";
+			const propertyNewVal:String = "dummyNewVal";
+			
+			var vector:Vector.<EventDispatcher> = new Vector.<EventDispatcher>();
+			var eventDispatcher:EventDispatcher = new EventDispatcher();
+			vector.push( new EventDispatcher() );
+			vector.push( eventDispatcher );
+
+			var vectorList:VectorList = new VectorList( vector );
+			vectorList.source = new Vector.<EventDispatcher>();
+			
+			expectEvent.from( vectorList ).
+				hasType( PropertyChangeEvent.PROPERTY_CHANGE ).
+				never();
+			
+			eventDispatcher.dispatchEvent( PropertyChangeEvent.createUpdateEvent( eventDispatcher, propertyName , propertyOldVal, propertyNewVal ) );
+		}
+		
+		[Test(description="We should really consider if this is the behavior we want here. Right now mimics fixed ArrayList")]
+		public function itemUpdatedShouldDispatchPropertyChangeEvent():void {
+			const propertyName:String = "dummy";
+			const propertyOldVal:String = "dummyOldVal";
+			const propertyNewVal:String = "dummyNewVal";
+			
+			var vector:Vector.<EventDispatcher> = new Vector.<EventDispatcher>();
+			var eventDispatcher:EventDispatcher = new EventDispatcher();
+			var vectorList:VectorList = new VectorList( vector );
+			
+			vectorList.addItem( eventDispatcher );
+			
+			expectEvent.from( vectorList ).
+				hasType( PropertyChangeEvent.PROPERTY_CHANGE ).
+				instanceOf( PropertyChangeEvent ).
+				hasPropertyWithValue( "kind", PropertyChangeEventKind.UPDATE ).
+				hasPropertyWithValue( "newValue", propertyNewVal ). 
+				hasPropertyWithValue( "oldValue", propertyOldVal ). 
+				hasPropertyWithValue( "property", "-1" + '.' + propertyName ). 
+				hasPropertyWithValue( "source", eventDispatcher ). 
+				once();
+
+			vectorList.itemUpdated( eventDispatcher, propertyName, propertyOldVal, propertyNewVal );
+		}
+
+		[Test(description="We should really consider if this is the behavior we want here. Right now mimics ArrayList")]
+		public function itemUpdatedShouldDispatchCollectionChangeEvent():void {
+			const propertyName:String = "dummy";
+			const propertyOldVal:String = "dummyOldVal";
+			const propertyNewVal:String = "dummyNewVal";
+			
+			var vector:Vector.<EventDispatcher> = new Vector.<EventDispatcher>();
+			var eventDispatcher:EventDispatcher = new EventDispatcher();
+			var vectorList:VectorList = new VectorList( vector );
+			
+			vectorList.addItem( eventDispatcher );
+			
+			expectEvent.from( vectorList ).
+				hasType( CollectionEvent.COLLECTION_CHANGE ).
+				instanceOf( CollectionEvent ).
+				hasPropertyWithValue( "kind", CollectionEventKind.UPDATE ).
+				hasPropertyWithValue( "location", -1 ). 
+				hasPropertyWithValue( "oldLocation", -1 ). 
+				once();
+			
+			vectorList.itemUpdated( eventDispatcher, propertyName, propertyOldVal, propertyNewVal );
+		}
+
+		[Test]
+		public function removeAllShouldDispatchResetEvent():void {
+			var vector:Vector.<int> = new <int>[ 5, 7, 9, 11, 13 ];
+			var vectorList:VectorList = new VectorList( vector );
+
+			expectEvent.from( vectorList ).
+				hasType( CollectionEvent.COLLECTION_CHANGE ).
+				instanceOf( CollectionEvent ).
+				hasPropertyWithValue( "kind", CollectionEventKind.RESET ).
+				hasPropertyWithValue( "location", -1 ). 
+				hasPropertyWithValue( "oldLocation", -1 ). 
+				once();
+
+			vectorList.removeAll();
+		}
+
+		[Test]
+		public function removeItemAtShouldDispatchCollectionRemoveEvent():void {
+			const position:int = 3;
+			const value:int = 11;
+			var vector:Vector.<int> = new <int>[ 5, 7, 9, value, 13 ];
+			var vectorList:VectorList = new VectorList( vector );
+			
+			expectEvent.from( vectorList ).
+				hasType( CollectionEvent.COLLECTION_CHANGE ).
+				instanceOf( CollectionEvent ).
+				hasPropertyWithValue( "kind", CollectionEventKind.REMOVE ).
+				hasPropertyWithValue( "location", position ). 
+				hasPropertyWithValue( "items", allOf( arrayWithSize( 1 ), hasItem( value ) ) ). 
+				once();
+			
+			vectorList.removeItemAt( position );
+		}
+
+		[Test]
+		public function removeItemAtShouldDispatchPropertyChangeEvent():void {
+			const position:int = 3;
+			const value:int = 11;
+			var vector:Vector.<int> = new <int>[ 5, 7, 9, value, 13 ];
+			var vectorList:VectorList = new VectorList( vector );
+			
+			expectEvent.from( vectorList ).
+				hasType( PropertyChangeEvent.PROPERTY_CHANGE ).
+				instanceOf( PropertyChangeEvent ).
+				hasPropertyWithValue( "oldValue", value ). 
+				hasPropertyWithValue( "property", position ). 
+				once();
+			
+			vectorList.removeItemAt( position );
+		}
+
+		[Test]
+		public function addItemAtShouldDispatchPropertyChangeEvent():void {
+			const position:int = 3;
+			const value:int = 11;
+			var vector:Vector.<int> = new <int>[ 5, 7, 9, 13 ];
+			var vectorList:VectorList = new VectorList( vector );
+			
+			expectEvent.from( vectorList ).
+				hasType( PropertyChangeEvent.PROPERTY_CHANGE ).
+				instanceOf( PropertyChangeEvent ).
+				hasPropertyWithValue( "newValue", value ). 
+				hasPropertyWithValue( "property", position ). 
+				once();
+			
+			vectorList.addItemAt( value, position );
+		}
+
+		[Test]
+		public function setItemAtShouldDispatchPropertyChangeEvent():void {
+			const position:int = 2;
+			const oldValue:int = 11;
+			const newValue:int = 11;
+			var vector:Vector.<int> = new <int>[ 5, 7, oldValue, 13 ];
+			var vectorList:VectorList = new VectorList( vector );
+			
+			expectEvent.from( vectorList ).
+				hasType( PropertyChangeEvent.PROPERTY_CHANGE ).
+				instanceOf( PropertyChangeEvent ).
+				hasPropertyWithValue( "oldValue", oldValue ). 
+				hasPropertyWithValue( "newValue", newValue ). 
+				hasPropertyWithValue( "property", position ). 
+				once();
+			
+			vectorList.setItemAt( newValue, position );
+		}
+
+		[Test]
+		public function setItemAtShouldDispatchCollectionRemoveEvent():void {
+			const position:int = 2;
+			const oldValue:int = 11;
+			const newValue:int = 11;
+			var vector:Vector.<int> = new <int>[ 5, 7, oldValue, 13 ];
+			var vectorList:VectorList = new VectorList( vector );
+			
+			expectEvent.from( vectorList ).
+				hasType( CollectionEvent.COLLECTION_CHANGE ).
+				instanceOf( CollectionEvent ).
+				hasPropertyWithValue( "kind", CollectionEventKind.REPLACE ).
+				hasPropertyWithValue( "location", position ). 
+				hasPropertyWithValue( "items", allOf( arrayWithSize( 1 ), 
+													  hasItem( allOf( instanceOf( PropertyChangeEvent ),
+																	  hasPropertyWithValue( "oldValue", oldValue ),
+																	  hasPropertyWithValue( "newValue", newValue ),
+																	  hasPropertyWithValue( "property", position ) ) ) ) ). 
+				once();
+			
+			vectorList.setItemAt( newValue, position );
+		}
+
+
+		public function EventsTest() {
+		}
+	}
+}
\ No newline at end of file

Added: incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/tests/vectorList/ItemRetrievalTest.as
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/tests/vectorList/ItemRetrievalTest.as?rev=1311531&view=auto
==============================================================================
--- incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/tests/vectorList/ItemRetrievalTest.as (added)
+++ incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/tests/vectorList/ItemRetrievalTest.as Tue Apr 10 00:24:17 2012
@@ -0,0 +1,103 @@
+package mx.collections.tests.vectorList {
+	import flash.events.EventDispatcher;
+	
+	import mx.collections.VectorList;
+	
+	import org.flexunit.asserts.assertEquals;
+
+	public class ItemRetrievalTest {
+
+		[Test]
+		public function getItemAtShouldReturnValueFirstIndex():void {
+			const position:int = 0;
+			const value:int  = 11;
+			var vector:Vector.<int> = new <int>[ value, 5, 7, 9, 13 ];
+			var vectorList:VectorList = new VectorList( vector );
+			
+			assertEquals( value, vectorList.getItemAt( position ) );
+		}
+
+		[Test]
+		public function getItemAtShouldReturnValueFromArbitraryIndex():void {
+			const position:int = 3;
+			const value:int  = 11;
+			var vector:Vector.<int> = new <int>[ 5, 7, 9, value, 13 ];
+			var vectorList:VectorList = new VectorList( vector );
+			
+			assertEquals( value, vectorList.getItemAt( position ) );
+		}
+
+		[Test]
+		public function getItemAtShouldReturnValueLastIndex():void {
+			const position:int = 3;
+			const value:int  = 11;
+			var vector:Vector.<int> = new <int>[ 5, 7, 9, value ];
+			var vectorList:VectorList = new VectorList( vector );
+			
+			assertEquals( value, vectorList.getItemAt( position ) );
+		}
+
+		[Test(expects="RangeError")]
+		public function shouldThrowRangeErrorForInvalidIndex():void {
+			const position:int = 3;
+			const value:int  = 11;
+			var vector:Vector.<int> = new <int>[ value ];
+			var vectorList:VectorList = new VectorList( vector );
+			
+			vectorList.getItemAt( position );
+		}
+
+		[Test]
+		public function getItemIndexSimpleValueAtFirstPosition():void {
+			const position:int = 0;
+			const value:int  = 11;
+			var vector:Vector.<int> = new <int>[ value, 5, 7, 9, 13 ];
+			var vectorList:VectorList = new VectorList( vector );
+			
+			assertEquals( position, vectorList.getItemIndex( value ) );
+		}
+
+		[Test]
+		public function getItemIndexSimpleValueAtArbitraryPosition():void {
+			const position:int = 3;
+			const value:int  = 11;
+			var vector:Vector.<int> = new <int>[ 5, 7, 9, value, 13 ];
+			var vectorList:VectorList = new VectorList( vector );
+			
+			assertEquals( position, vectorList.getItemIndex( value ) );
+		}
+
+		[Test]
+		public function getItemIndexSimpleValueAtLastPosition():void {
+			const position:int = 3;
+			const value:int  = 11;
+			var vector:Vector.<int> = new <int>[ 5, 7, 9, value ];
+			var vectorList:VectorList = new VectorList( vector );
+			
+			assertEquals( position, vectorList.getItemIndex( value ) );
+		}
+
+		[Test]
+		public function getItemIndexNotFound():void {
+			const position:int = -1;
+			const value:int  = 11;
+			var vector:Vector.<int> = new <int>[ 5, 7, 9 ];
+			var vectorList:VectorList = new VectorList( vector );
+			
+			assertEquals( position, vectorList.getItemIndex( value ) );
+		}
+
+		[Test]
+		public function getItemIndexComplexValue():void {
+			const position:int = 1;
+			const value:EventDispatcher = new EventDispatcher();
+			var vector:Vector.<EventDispatcher> = new <EventDispatcher>[ new EventDispatcher(), value, new EventDispatcher() ];
+			var vectorList:VectorList = new VectorList( vector );
+			
+			assertEquals( position, vectorList.getItemIndex( value ) );
+		}
+		
+		public function ItemRetrievalTest() {
+		}
+	}
+}
\ No newline at end of file

Added: incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/tests/vectorList/VectorListSuite.as
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/tests/vectorList/VectorListSuite.as?rev=1311531&view=auto
==============================================================================
--- incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/tests/vectorList/VectorListSuite.as (added)
+++ incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/tests/vectorList/VectorListSuite.as Tue Apr 10 00:24:17 2012
@@ -0,0 +1,15 @@
+package mx.collections.tests.vectorList
+{
+	
+	[Suite]
+	[RunWith("org.flexunit.runners.Suite")]
+	public class VectorListSuite
+	{
+		public var test1:mx.collections.tests.vectorList.BasicFunctionsTest;
+		public var test2:mx.collections.tests.vectorList.AddRemoveItemTest;
+		public var test3:mx.collections.tests.vectorList.AddRemoveItemAtTest;
+		public var test4:mx.collections.tests.vectorList.ConversionTest;
+		public var test5:mx.collections.tests.vectorList.EventsTest;
+		public var test6:mx.collections.tests.vectorList.ItemRetrievalTest;
+	}
+}
\ No newline at end of file

Added: incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/tests/vectorList/helper/IsEqualToVectorMatcher.as
URL: http://svn.apache.org/viewvc/incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/tests/vectorList/helper/IsEqualToVectorMatcher.as?rev=1311531&view=auto
==============================================================================
--- incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/tests/vectorList/helper/IsEqualToVectorMatcher.as (added)
+++ incubator/flex/whiteboard/labriola/frameworks/projects/framework/src/mx/collections/tests/vectorList/helper/IsEqualToVectorMatcher.as Tue Apr 10 00:24:17 2012
@@ -0,0 +1,52 @@
+package mx.collections.tests.vectorList.helper {
+	import org.hamcrest.BaseMatcher;
+	
+	public class IsEqualToVectorMatcher extends BaseMatcher {
+		private var _value:Object;
+
+		/**
+		 * Constructor
+		 *
+		 * @param value Object the item being matched must be equal to
+		 */
+		public function IsEqualToVectorMatcher( value:Object ) {
+			super();
+
+			_value = value;
+		}
+		
+		/**
+		 * @inheritDoc
+		 */
+		override public function matches(item:Object):Boolean {
+			return areLengthsEqual(_value, item) && areElementsEqual(_value, item);
+		}
+		
+		/**
+		 * Checks if the given objects are of equal length
+		 *
+		 * @private
+		 */
+		private function areLengthsEqual(o1:Object, o2:Object):Boolean
+		{
+			return ( o1.length == o2.length );
+		}
+		
+		/**
+		 * Checks the elements of both objects are the equal
+		 *
+		 * @private
+		 */
+		private function areElementsEqual(o1:*, o2:Object):Boolean
+		{
+			for (var i:int = 0, n:int = o1.length; i < n; i++)
+			{
+				if (!o1[i] == o2[i] )
+				{
+					return false;
+				}
+			}
+			return true;
+		}
+	}
+}
\ No newline at end of file



Mime
View raw message