diff --git a/.gitignore b/.gitignore
index 90b240f3af0e98af18e659f3adeb7848c45d8dbf..99db0d980384678e213d4d6ef0fe5703368635aa 100644
--- a/.gitignore
+++ b/.gitignore
@@ -22,6 +22,8 @@ atlassian*
 
 /pub/media/*.*
 !/pub/media/.htaccess
+/pub/media/catalog/*
+!/pub/media/catalog/.htaccess
 /pub/media/customer/*
 !/pub/media/customer/.htaccess
 /pub/media/downloadable/*
@@ -29,6 +31,8 @@ atlassian*
 /pub/media/theme/*
 /pub/media/theme_customization/*
 !/pub/media/theme_customization/.htaccess
+/pub/media/tmp/*
+!/pub/media/tmp/.htaccess
 /pub/static/*
 !/pub/static/.htaccess
 
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 868b7a35b288688be70792fb975a9751e5c9084a..4e779e9213961dd03ee1e00070c485afdae4385e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,44 @@
+0.1.0-alpha104
+=============
+* Various improvements:
+    * Merge SQL and Data Upgrades for the Sales and SalesRule modules
+    * Add getDefaultBilling and getDefaultShipping to Customer Interface
+    * Stabilized the Bundle module
+    * Stabilized the CatalogSearch module
+    * Stabilized the Cms module
+    * Stabilized the SalesRule module
+* Performance improvements:
+    * Introduced CatalogRule indexers based on Mview
+    * Significantly decreased the amount of unused objects, mostly in category and product view scenarios:
+		* Got rid of non-shared indexer instances all over the code introducing Magento\Indexer\Model\IndexerRegistry
+		* Magento\Catalog\Pricing\Price\BasePrice being created on demand only, instead of unconditioned creation in constructor
+		* Created proxies for unused objects with big amount of dependencies
+		* Fixed \Magento\Review\Block\Product\Review block which injected backend block context by mistake
+		* A customer model in \Magento\Customer\Model\Layout\DepersonalizePlugin being created on demand only, instead of constructor
+    * Introduced caching for product attribute metadata loading procedure
+    * Improved SavePayment Checkout step to save only payment related data
+    * Speed up all Checkout steps of the One Page Checkout
+    * Updated the benchmark.jmx jmeter script in the performance toolkit
+* Fixed bugs:
+    * Fixed an issue where performance toolkit generator created Products/Categories without URL rewrites due to install area elimination
+    * Fixed an issue where the Custom Options fieldset on Product Information page was collapsible
+    * Fixed an issue where the Base URL was added to target path for Custom UrlRewrite
+    * Fixed an issue where an invalid Cross-sells amount was displayed in the Shopping Cart
+    * Fixed an issue where the Mage_Catalog_Model_Product_Type_AbstractTest::testBeforeSave integration test failed when Mage_Downloadable module was not available
+    * Fixed an issue where the custom URL rewrite redirected to sub-folder when Request Path contained slash
+    * Fixed an issue where it was impossible to place an order if registering during checkout
+    * Fixed an issue where there was no possibility to save default billing and shipping addresses for customer on the store front
+    * Fixed an issue where a widget of Catalog Category Link type was not displayed on the store front
+    * Fixed an issue where the Versions tab was absent on the CMS page with version control
+    * Fixed an issue where it was impossible to insert Widgets and Images to a CMS page
+* Added the following functional tests:
+    * Create widget
+    * Print order from guest on frontend
+* Framework Improvements:
+    * Removed duplicated logic from API Builders and Builder generators. Added support for populating builders from the objects, implementing data interface
+* Processed GitHub requests:
+    * [#674](https://github.com/magento/magento2/issues/674) -- Widgets in content pages
+
 0.1.0-alpha103
 =============
 * Fixed bugs:
diff --git a/README.md b/README.md
index 509292e891431909360fa8607d0ecde5961dc9b4..5a4d56047c98b3956d399d796f54aa1b0dbdfbab 100644
--- a/README.md
+++ b/README.md
@@ -25,7 +25,7 @@ Before you install Magento 2, make sure your system meets or exceeds the followi
 	
 *	<a href="https://getcomposer.org/download/" >Composer</a> (latest stable version)
 *	<a href="http://httpd.apache.org/download.cgi" >Apache 2.2</a> or later
-*	PHP 5.4.11 or 5.5.x (<a href="http://php.net/downloads.php" >installation</a> instructions, <a href="http://phpave.com/upgrade-php-5-3-php-5-5-ubuntu-12-04-lts/" >upgrade</a> instructions)
+*	PHP 5.4.11 or 5.5.x 
 *	Required PHP extensions:
 
 	*	PDO/MySQL
@@ -37,15 +37,13 @@ Before you install Magento 2, make sure your system meets or exceeds the followi
 	*	gd2, ImageMagick 6.3.7 (or later) or both
 	*	soap
 	
-*	<a href="http://dev.mysql.com/doc/refman/5.5/en/installing.html" >MySQL 5.5</a> or later
+*	<a href="http://dev.mysql.com/doc/refman/5.6/en/installing.html" >MySQL 5.6.x</a>
 *	Mail Transfer Agent (MTA) or an SMTP server
 *	Optional but recommended: 
 
 	*	<a href="http://xdebug.org/download.php" >php_xdebug2.2.0</a> or later (development environments only; can have an adverse effect on performance)
-    *	PHPUnit (as a command-line tool) 3.7 or later 
+    *	PHPUnit (as a command-line tool) 4.1 or later 
 	
-
-
 <h2 id="instgde-overview-composer">Composer and Magento</h2>
 
 We now use <a href="https://getcomposer.org/" >Composer</a> to install the Magento 2 software. Composer enables us to manage Magento 2, extensions, and their dependencies.
@@ -87,7 +85,7 @@ Use the following table to verify you have the correct prerequisites to install
 		<td><code>php -v</code></td>
 		<td><a href="#php" >PHP</a></td>
 	</tr>
-	<tr><td>MySQL 5.5 or later</td>
+	<tr><td>MySQL 5.6.x</td>
 	<td><code>mysql -u [root user name] -p</code></td>
 	<td><a href="#mysql" >MySQL</a></td>
 	</tr>
@@ -142,7 +140,7 @@ Before you install Magento, you must do all of the following:
 </li>
 <li>Specify the type of directives that can be used in <code>.htaccess</code>. Magento uses <code>.htaccess</code> for redirects. For guidelines, see:
 <ul><li>Apache 2.2: The <a href="http://httpd.apache.org/docs/2.2/mod/core.html#allowoverride" target="_blank">Apache 2.2 documentation</a>.</li>
-<li>Apache 2.4: The <a href="http://httpd.apache.org/docs/current/mod/mod_rewrite.html" target="_blank">Apache 2.4 documentation</a>.<br>
+<li>Apache 2.4: The <a href="http://httpd.apache.org/docs/current/mod/core.html#allowoverride" target="_blank">Apache 2.4 documentation</a>.<br>
 Note that in Apache 2.4, the server's default site configuration file is <code>/etc/apache2/sites-available/000-default.conf</code><br>
 For example, you can add the following to the bottom of <code>000-default.conf</code>:<br>
 <pre>&lt;Directory "/var/www">
@@ -172,13 +170,27 @@ AllowOverride [value from Apache site]
 
 <h4>Installing MySQL on Ubuntu</h4>
 
-1.	Use the guidelines on the <a href="https://help.ubuntu.com/12.04/serverguide/mysql.html" target="_blank">Ubuntu site</a>. 
+1.	Install MySQL on <a href="https://rtcamp.com/tutorials/mysql/mysql-5-6-ubuntu-12-04/" target="_blank">Ubuntu 12</a> or <a href="http://www.tocker.ca/2014/04/21/installing-mysql-5-6-on-ubuntu-14-04-trusty-tahr.html" target="_blank">Ubuntu 14</a>. 
 2.	Configure the database instance.
 
 <h4>Installing and configuring MySQL on CentOS</h4>
 
-1.	Install and configure MySQL as discussed on the <a href="http://centoshelp.org/servers/database/installing-configuring-mysql-server/" target="_blank">CentOS help site</a>.
-2.	Configure the database instance as discussed in the next section.
+The following procedure is based on <a href="http://sharadchhetri.com/2013/12/26/install-mysql-server-5-6-in-centos-6-x-and-red-hat-6-x-linux/" target="_blank">Install MySQL Server 5.6 in CentOS 6.x and Red Hat 6.x Linux</a>.
+
+1.	Install the MySQL database:
+
+	<pre>cd /tmp
+wget http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm
+rpm -ivh mysql-community-release-el6-5.noarch.rpm
+yum -y install mysql-server</pre>
+	
+2.	Start MySQL.
+
+	`service mysqld start`
+	
+3.	Set a password for the <tt>root</tt> user and set other security-related options. Enter the following command and follow the prompts on your screen to complete the configuration.
+
+	`mysql_secure_installation`
 
 <h4>Configuring the Magento database instance</h4>
 
@@ -194,9 +206,7 @@ To configure a MySQL database instance:
 3.	Enter the MySQL `root` user's password when prompted.
 4.	Enter the following commands in the order shown to create a database instance named `magento` with user name `magento`:
 	<pre>create database magento;
-CREATE USER 'magento'@'localhost' IDENTIFIED BY 'magento';
-GRANT USAGE ON *.* TO magento@localhost IDENTIFIED BY 'magento';
-GRANT ALL ON magento.* TO magento@localhost;</pre>
+GRANT ALL ON magento.* TO magento@localhost IDENTIFIED BY 'magento';</pre>
 
 5.	Enter `exit` to quit the command prompt.
 
@@ -204,11 +214,11 @@ GRANT ALL ON magento.* TO magento@localhost;</pre>
 
 Magento 2 requires PHP 5.4.11 or later or PHP 5.5.x.
 
-**Note**: Magento 2 does not support PHP 5.6.
+**Note**: Magento 2 does *not* support PHP 5.6.
 
-<h3>PHP on Ubuntu</h3>
+<h3>PHP 5.5 or 5.4 on Ubuntu</h3>
 
-<h4>Install PHP 5.5 on Ubuntu 14</h4>
+<h5>Install PHP 5.5 on Ubuntu 14</h5>
 
 To install PHP 5.5 on Ubuntu 14:
 
@@ -223,7 +233,22 @@ To install PHP 5.5 on Ubuntu 14:
 	Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
     with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies</pre>
 	
-<h4>Install PHP 5.4 on Ubuntu 12</h4>
+<h5>Install PHP 5.5 on Ubuntu 12</h5>	
+
+1.	Use the following commands from <a href="http://www.dev-metal.com/how-to-setup-latest-version-of-php-5-5-on-ubuntu-12-04-lts/" target="_blank">dev-metal</a>:
+
+	<pre>add-apt-repository ppa:ondrej/php5
+	apt-get update
+	sudo apt-get install php5</pre>
+	
+2.	Verify the PHP version by entering `php -v`. Messages similar to the following should display:
+
+	<pre>PHP 5.5.18-1+deb.sury.org~precise+1 (cli) (built: Oct 17 2014 15:11:34)
+	Copyright (c) 1997-2014 The PHP Group
+	Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
+    with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies</pre>
+	
+<h5>Install PHP 5.4 on Ubuntu 12</h5>
 
 To install PHP 5.4 on Ubuntu 12:
 
@@ -242,7 +267,7 @@ To install PHP 5.4 on Ubuntu 12:
 
 3.	Restart Apache: `service apache2 restart`
 
-<h4>Upgrade to PHP 5.4 on Ubuntu</h4>
+<h5>Upgrade to PHP 5.4 on Ubuntu</h5>
 
 To upgrade to PHP 5.4 on Ubuntu:
 
@@ -265,7 +290,7 @@ Enter the following command to install required PHP extensions:
 
 There is a <a href="https://bugs.launchpad.net/ubuntu/+source/php-mcrypt/+bug/1240590" target="_blank">known issue</a> in Ubuntu 14 with the `mcrypt` PHP extension. To work around the issue, see <a href="http://askubuntu.com/questions/450825/ubuntu-14-04-phpmyadmin-cant-find-mcrypt-extension" target="_blank">askubuntu</a>.
 
-<h4>Upgrade to PHP 5.4 on CentOS</h4>
+<h4>PHP 5.5 or 5.4 on CentOS</h4>
 
 PHP 5.3 is the default PHP version on CentOS distributions. Upgrade to PHP 5.4 using a repository like <a href="http://blog.famillecollet.com/pages/Config-en" target="_blank">remi</a>. 
 
@@ -275,6 +300,27 @@ The following resources are also available:
 *	<a href="http://stackoverflow.com/questions/21502656/upgrading-php-on-centos-6-5-final" target="_blank">stackoverflow</a>
 *	<a href="http://rpms.famillecollet.com/" target="_blank">remi repository</a>
 
+To verify if PHP is installed already, enter `php -v`. If PHP is *not* installed, install it by entering the following command:
+
+<pre>yum -y install php php-xml</pre>
+
+<h5>PHP 5.5 on CentOS</h5>
+
+To upgrade to PHP 5.5:
+
+There is more than one way to upgrade CentOS 6.5 to PHP 5.5; the following is a suggestion only. Consult a reference for additional options.
+
+Enter the following commands in the order shown.
+
+<pre>cd /tmp
+rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
+yum -y remove php-common-5.3.3-40.el6_6.x86_64
+yum -y install php55w php55w-opcache</pre>
+
+Restart Apache: `service httpd restart`
+
+<h5>PHP 5.4 on CentOS</h5>
+
 To upgrade to PHP 5.4:
 
 1.	Enter the following commands:
diff --git a/app/code/Magento/AdminNotification/composer.json b/app/code/Magento/AdminNotification/composer.json
index 3dffdb3ab9fb53d9af4795391d0631567fbb6eef..0a12e71e6b93f78db7c4cc7be5e4a56e9f426fdb 100644
--- a/app/code/Magento/AdminNotification/composer.json
+++ b/app/code/Magento/AdminNotification/composer.json
@@ -3,15 +3,15 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-core": "0.1.0-alpha103",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-core": "0.1.0-alpha104",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "lib-libxml": "*",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/Authorization/composer.json b/app/code/Magento/Authorization/composer.json
index 5113d36a73598545ebb2d68ac966394c534180d5..2da1ea7e8af43e1ad370aed123019b3df69d534e 100644
--- a/app/code/Magento/Authorization/composer.json
+++ b/app/code/Magento/Authorization/composer.json
@@ -3,12 +3,12 @@
     "description": "Authorization module provides access to Magento ACL functionality.",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/Authorizenet/composer.json b/app/code/Magento/Authorizenet/composer.json
index 37ef6cf7b4d6cf6fb62b3fe9f96da534bf33150c..b70c369f0d14efe3dcd3f2aa643be22d833380ae 100644
--- a/app/code/Magento/Authorizenet/composer.json
+++ b/app/code/Magento/Authorizenet/composer.json
@@ -3,18 +3,18 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-sales": "0.1.0-alpha103",
-        "magento/module-checkout": "0.1.0-alpha103",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/module-core": "0.1.0-alpha103",
-        "magento/module-payment": "0.1.0-alpha103",
-        "magento/module-centinel": "0.1.0-alpha103",
-        "magento/module-catalog": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-sales": "0.1.0-alpha104",
+        "magento/module-checkout": "0.1.0-alpha104",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/module-core": "0.1.0-alpha104",
+        "magento/module-payment": "0.1.0-alpha104",
+        "magento/module-centinel": "0.1.0-alpha104",
+        "magento/module-catalog": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/Authorizenet/etc/module.xml b/app/code/Magento/Authorizenet/etc/module.xml
index 4315ec971432159b1808eeb8e18c8a977b9c301b..dd8f3d7b1bb019b53b951e1942cf897d7f6fa0ae 100644
--- a/app/code/Magento/Authorizenet/etc/module.xml
+++ b/app/code/Magento/Authorizenet/etc/module.xml
@@ -24,7 +24,7 @@
  */
 -->
 <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
-    <module name="Magento_Authorizenet" schema_version="1.5.0.0" active="true">
+    <module name="Magento_Authorizenet" schema_version="2.0.0" active="true">
         <sequence>
             <module name="Magento_Sales"/>
             <module name="Magento_Checkout"/>
diff --git a/app/code/Magento/Backend/composer.json b/app/code/Magento/Backend/composer.json
index d994c01355c1d810966c99bc243198f250b4865a..bdb90397bc7591a2876cc87a178e9b1274133c33 100644
--- a/app/code/Magento/Backend/composer.json
+++ b/app/code/Magento/Backend/composer.json
@@ -3,26 +3,26 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-directory": "0.1.0-alpha103",
-        "magento/module-core": "0.1.0-alpha103",
-        "magento/module-eav": "0.1.0-alpha103",
-        "magento/module-cron": "0.1.0-alpha103",
-        "magento/module-theme": "0.1.0-alpha103",
-        "magento/module-reports": "0.1.0-alpha103",
-        "magento/module-sales": "0.1.0-alpha103",
-        "magento/module-catalog": "0.1.0-alpha103",
-        "magento/module-user": "0.1.0-alpha103",
-        "magento/module-backup": "0.1.0-alpha103",
-        "magento/module-email": "0.1.0-alpha103",
-        "magento/module-customer": "0.1.0-alpha103",
-        "magento/module-translation": "0.1.0-alpha103",
-        "magento/module-require-js": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-directory": "0.1.0-alpha104",
+        "magento/module-core": "0.1.0-alpha104",
+        "magento/module-eav": "0.1.0-alpha104",
+        "magento/module-cron": "0.1.0-alpha104",
+        "magento/module-theme": "0.1.0-alpha104",
+        "magento/module-reports": "0.1.0-alpha104",
+        "magento/module-sales": "0.1.0-alpha104",
+        "magento/module-catalog": "0.1.0-alpha104",
+        "magento/module-user": "0.1.0-alpha104",
+        "magento/module-backup": "0.1.0-alpha104",
+        "magento/module-email": "0.1.0-alpha104",
+        "magento/module-customer": "0.1.0-alpha104",
+        "magento/module-translation": "0.1.0-alpha104",
+        "magento/module-require-js": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/Backup/composer.json b/app/code/Magento/Backup/composer.json
index b6c59756af7ed0a03f431e385fbebde34b3a4e99..5d96e1b15253d1e87cc3a524704e92ccabfa9876 100644
--- a/app/code/Magento/Backup/composer.json
+++ b/app/code/Magento/Backup/composer.json
@@ -3,15 +3,15 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-core": "0.1.0-alpha103",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/module-cron": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-core": "0.1.0-alpha104",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/module-cron": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/Bundle/Model/Resource/Bundle.php b/app/code/Magento/Bundle/Model/Resource/Bundle.php
index 1d1fcb0c8287e8223a0f488b52aaf1daf29ec959..06ba75dd60e60f595d1ccceb5f18ec626b657c12 100644
--- a/app/code/Magento/Bundle/Model/Resource/Bundle.php
+++ b/app/code/Magento/Bundle/Model/Resource/Bundle.php
@@ -103,7 +103,7 @@ class Bundle extends \Magento\Framework\Model\Resource\Db\AbstractDb
     {
         $quoteItemIds = $this->_getReadAdapter()->fetchCol(
             $this->_getReadAdapter()->select()->from(
-                $this->getTable('sales_flat_quote_item'),
+                $this->getTable('sales_quote_item'),
                 array('item_id')
             )->where(
                 'product_id = :product_id'
@@ -113,7 +113,7 @@ class Bundle extends \Magento\Framework\Model\Resource\Db\AbstractDb
 
         if ($quoteItemIds) {
             $this->_getWriteAdapter()->delete(
-                $this->getTable('sales_flat_quote_item'),
+                $this->getTable('sales_quote_item'),
                 array('parent_item_id IN(?)' => $quoteItemIds)
             );
         }
diff --git a/app/code/Magento/Bundle/Pricing/Price/ConfiguredPrice.php b/app/code/Magento/Bundle/Pricing/Price/ConfiguredPrice.php
index fee3a136a41e72bfe747dd9bb686afdd68d1348d..4b91958ff0b5ee962760c3588ee43fe0d2cd55b2 100644
--- a/app/code/Magento/Bundle/Pricing/Price/ConfiguredPrice.php
+++ b/app/code/Magento/Bundle/Pricing/Price/ConfiguredPrice.php
@@ -159,6 +159,6 @@ class ConfiguredPrice extends CatalogPrice\FinalPrice implements ConfiguredPrice
      */
     public function getAmount()
     {
-        return $this->item ? $this->getConfiguredAmount($this->basePrice->getValue()) : parent::getAmount();
+        return $this->item ? $this->getConfiguredAmount($this->getBasePrice()->getValue()) : parent::getAmount();
     }
 }
diff --git a/app/code/Magento/Bundle/Pricing/Price/FinalPrice.php b/app/code/Magento/Bundle/Pricing/Price/FinalPrice.php
index 20b476821d730f4af98b3c189bd7247e6b1eac60..ea0d37e105aa9136d586acfefeea1c5b9568e2b5 100644
--- a/app/code/Magento/Bundle/Pricing/Price/FinalPrice.php
+++ b/app/code/Magento/Bundle/Pricing/Price/FinalPrice.php
@@ -44,7 +44,6 @@ class FinalPrice extends \Magento\Catalog\Pricing\Price\FinalPrice
         CalculatorInterface $calculator
     ) {
         parent::__construct($saleableItem, $quantity, $calculator);
-        $this->basePrice = $this->priceInfo->getPrice(BasePrice::PRICE_CODE);
     }
 
     /**
@@ -65,7 +64,7 @@ class FinalPrice extends \Magento\Catalog\Pricing\Price\FinalPrice
      */
     public function getMaximalPrice()
     {
-        return $this->calculator->getMaxAmount($this->basePrice->getValue(), $this->product);
+        return $this->calculator->getMaxAmount($this->getBasePrice()->getValue(), $this->product);
     }
 
     /**
diff --git a/app/code/Magento/Bundle/composer.json b/app/code/Magento/Bundle/composer.json
index d6d155375dce71156fd8c53da3b244610c0cd4e2..3da664632b69b2191d846b4edc09e31b5d45de9b 100644
--- a/app/code/Magento/Bundle/composer.json
+++ b/app/code/Magento/Bundle/composer.json
@@ -3,24 +3,24 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-catalog": "0.1.0-alpha103",
-        "magento/module-tax": "0.1.0-alpha103",
-        "magento/module-core": "0.1.0-alpha103",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/module-sales": "0.1.0-alpha103",
-        "magento/module-checkout": "0.1.0-alpha103",
-        "magento/module-catalog-inventory": "0.1.0-alpha103",
-        "magento/module-customer": "0.1.0-alpha103",
-        "magento/module-catalog-rule": "0.1.0-alpha103",
-        "magento/module-eav": "0.1.0-alpha103",
-        "magento/module-gift-message": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
-        "magento/module-webapi": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-catalog": "0.1.0-alpha104",
+        "magento/module-tax": "0.1.0-alpha104",
+        "magento/module-core": "0.1.0-alpha104",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/module-sales": "0.1.0-alpha104",
+        "magento/module-checkout": "0.1.0-alpha104",
+        "magento/module-catalog-inventory": "0.1.0-alpha104",
+        "magento/module-customer": "0.1.0-alpha104",
+        "magento/module-catalog-rule": "0.1.0-alpha104",
+        "magento/module-eav": "0.1.0-alpha104",
+        "magento/module-gift-message": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
+        "magento/module-webapi": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/Captcha/composer.json b/app/code/Magento/Captcha/composer.json
index cc309049acfaa2a043c1407adc3e2d4abfb94a81..b49a2e0e8a4d2a1f993395ae8fc6f40181c2623c 100644
--- a/app/code/Magento/Captcha/composer.json
+++ b/app/code/Magento/Captcha/composer.json
@@ -3,16 +3,16 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-customer": "0.1.0-alpha103",
-        "magento/module-checkout": "0.1.0-alpha103",
-        "magento/module-core": "0.1.0-alpha103",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-customer": "0.1.0-alpha104",
+        "magento/module-checkout": "0.1.0-alpha104",
+        "magento/module-core": "0.1.0-alpha104",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/Catalog/Block/Widget/Link.php b/app/code/Magento/Catalog/Block/Widget/Link.php
index 2d94f12ab8c385107cef03a32190cb4854689e7e..0646d46f702830401ce39959aa67e96880ae41dd 100644
--- a/app/code/Magento/Catalog/Block/Widget/Link.php
+++ b/app/code/Magento/Catalog/Block/Widget/Link.php
@@ -65,15 +65,18 @@ class Link extends \Magento\Framework\View\Element\Html\Link implements \Magento
     /**
      * @param \Magento\Framework\View\Element\Template\Context $context
      * @param UrlFinderInterface $urlFinder
+     * @param \Magento\Catalog\Model\Resource\AbstractResource $entityResource
      * @param array $data
      */
     public function __construct(
         \Magento\Framework\View\Element\Template\Context $context,
         UrlFinderInterface $urlFinder,
+        \Magento\Catalog\Model\Resource\AbstractResource $entityResource = null,
         array $data = []
     ) {
         parent::__construct($context, $data);
         $this->urlFinder = $urlFinder;
+        $this->_entityResource = $entityResource;
     }
 
     /**
@@ -141,8 +144,10 @@ class Link extends \Magento\Framework\View\Element\Html\Link implements \Magento
      */
     public function getLabel()
     {
-        if (!$this->_anchorText && $this->_entityResource) {
-            if (!$this->getData('label')) {
+        if (!$this->_anchorText) {
+            if ($this->getData('anchor_text')) {
+                $this->_anchorText = $this->getData('anchor_text');
+            } else if ($this->_entityResource) {
                 $idPath = explode('/', $this->_getData('id_path'));
                 if (isset($idPath[1])) {
                     $id = $idPath[1];
@@ -154,8 +159,6 @@ class Link extends \Magento\Framework\View\Element\Html\Link implements \Magento
                         );
                     }
                 }
-            } else {
-                $this->_anchorText = $this->getData('label');
             }
         }
 
diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute/Save.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute/Save.php
index e058fd04d23f3ea3da5b21799c5a9967a5811e10..356305b338109c8c2ea4d07f52d00fd8be4714c6 100644
--- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute/Save.php
+++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute/Save.php
@@ -170,6 +170,7 @@ class Save extends \Magento\Catalog\Controller\Adminhtml\Product\Action\Attribut
 
                     $stockItemService->saveStockItem(
                         $this->stockItemBuilder->mergeDataObjectWithArray($stockItemDo, $inventoryData)
+                            ->create()
                     );
                 }
                 $this->_stockIndexerProcessor->reindexList($this->attributeHelper->getProductIds());
diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Save.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Save.php
index cafe26ca2e523d6035bc73c66f48a56d6c287230..4aca282ffe176f05550ecad5e3da587d72fe8481 100644
--- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Save.php
+++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Save.php
@@ -111,8 +111,6 @@ class Save extends \Magento\Catalog\Controller\Adminhtml\Product
                     }
                 }
 
-                $this->_objectManager->create('Magento\CatalogRule\Model\Rule')->applyAllRulesToProduct($productId);
-
                 $this->messageManager->addSuccess(__('You saved the product.'));
                 if ($product->getSku() != $originalSku) {
                     $this->messageManager->addNotice(
diff --git a/app/code/Magento/Catalog/Model/Attribute/Backend/Customlayoutupdate.php b/app/code/Magento/Catalog/Model/Attribute/Backend/Customlayoutupdate.php
index 873eb1a50ab88c223549a15ca2418f71bfa5d3cc..74583add4bccd1bef771c0cf97ab79ba298ff53f 100644
--- a/app/code/Magento/Catalog/Model/Attribute/Backend/Customlayoutupdate.php
+++ b/app/code/Magento/Catalog/Model/Attribute/Backend/Customlayoutupdate.php
@@ -43,13 +43,11 @@ class Customlayoutupdate extends \Magento\Eav\Model\Entity\Attribute\Backend\Abs
     /**
      * Construct the custom layout update class
      *
-     * @param \Magento\Framework\Logger $logger
      * @param ValidatorFactory $layoutUpdateValidatorFactory
      */
-    public function __construct(\Magento\Framework\Logger $logger, ValidatorFactory $layoutUpdateValidatorFactory)
+    public function __construct(ValidatorFactory $layoutUpdateValidatorFactory)
     {
         $this->_layoutUpdateValidatorFactory = $layoutUpdateValidatorFactory;
-        parent::__construct($logger);
     }
 
     /**
diff --git a/app/code/Magento/Catalog/Model/Category.php b/app/code/Magento/Catalog/Model/Category.php
index f367d9e74d8507a78054ede819ec2c287ad1df3c..f7f2197b8b5eb44e22833bc8e7519bb316097ec5 100644
--- a/app/code/Magento/Catalog/Model/Category.php
+++ b/app/code/Magento/Catalog/Model/Category.php
@@ -174,22 +174,15 @@ class Category extends \Magento\Catalog\Model\AbstractModel implements \Magento\
      */
     protected $flatState;
 
-    /**
-     * @var \Magento\Indexer\Model\IndexerInterface
-     */
-    protected $flatIndexer;
-
-    /**
-     * @var \Magento\Indexer\Model\IndexerInterface
-     */
-    protected $productIndexer;
-
     /** @var \Magento\CatalogUrlRewrite\Model\CategoryUrlPathGenerator */
     protected $categoryUrlPathGenerator;
 
     /** @var UrlFinderInterface */
     protected $urlFinder;
 
+    /** @var \Magento\Indexer\Model\IndexerRegistry */
+    protected $indexerRegistry;
+
     /**
      * @param \Magento\Framework\Model\Context $context
      * @param \Magento\Framework\Registry $registry
@@ -203,10 +196,9 @@ class Category extends \Magento\Catalog\Model\AbstractModel implements \Magento\
      * @param Config $catalogConfig
      * @param \Magento\Framework\Filter\FilterManager $filter
      * @param Indexer\Category\Flat\State $flatState
-     * @param \Magento\Indexer\Model\IndexerInterface $flatIndexer
-     * @param \Magento\Indexer\Model\IndexerInterface $productIndexer
      * @param \Magento\CatalogUrlRewrite\Model\CategoryUrlPathGenerator $categoryUrlPathGenerator
      * @param UrlFinderInterface $urlFinder
+     * @param \Magento\Indexer\Model\IndexerRegistry $indexerRegistry
      * @param \Magento\Framework\Model\Resource\AbstractResource $resource
      * @param \Magento\Framework\Data\Collection\Db $resourceCollection
      * @param array $data
@@ -224,10 +216,9 @@ class Category extends \Magento\Catalog\Model\AbstractModel implements \Magento\
         \Magento\Catalog\Model\Config $catalogConfig,
         \Magento\Framework\Filter\FilterManager $filter,
         Indexer\Category\Flat\State $flatState,
-        \Magento\Indexer\Model\IndexerInterface $flatIndexer,
-        \Magento\Indexer\Model\IndexerInterface $productIndexer,
         \Magento\CatalogUrlRewrite\Model\CategoryUrlPathGenerator $categoryUrlPathGenerator,
         UrlFinderInterface $urlFinder,
+        \Magento\Indexer\Model\IndexerRegistry $indexerRegistry,
         \Magento\Framework\Model\Resource\AbstractResource $resource = null,
         \Magento\Framework\Data\Collection\Db $resourceCollection = null,
         array $data = array()
@@ -239,12 +230,11 @@ class Category extends \Magento\Catalog\Model\AbstractModel implements \Magento\
         $this->_url = $url;
         $this->_productCollectionFactory = $productCollectionFactory;
         $this->_catalogConfig = $catalogConfig;
-        $this->productIndexer = $productIndexer;
         $this->filter = $filter;
         $this->flatState = $flatState;
-        $this->flatIndexer = $flatIndexer;
         $this->categoryUrlPathGenerator = $categoryUrlPathGenerator;
         $this->urlFinder = $urlFinder;
+        $this->indexerRegistry = $indexerRegistry;
         parent::__construct($context, $registry, $storeManager, $resource, $resourceCollection, $data);
     }
 
@@ -274,32 +264,6 @@ class Category extends \Magento\Catalog\Model\AbstractModel implements \Magento\
         return $this->_useFlatResource;
     }
 
-    /**
-     * Return flat indexer object
-     *
-     * @return \Magento\Indexer\Model\IndexerInterface
-     */
-    protected function getFlatIndexer()
-    {
-        if (!$this->flatIndexer->getId()) {
-            $this->flatIndexer->load(Indexer\Category\Flat\State::INDEXER_ID);
-        }
-        return $this->flatIndexer;
-    }
-
-    /**
-     * Return category product indexer object
-     *
-     * @return \Magento\Indexer\Model\IndexerInterface
-     */
-    protected function getProductIndexer()
-    {
-        if (!$this->productIndexer->getId()) {
-            $this->productIndexer->load(Indexer\Category\Product::INDEXER_ID);
-        }
-        return $this->productIndexer;
-    }
-
     /**
      * Retrieve URL instance
      *
@@ -395,11 +359,15 @@ class Category extends \Magento\Catalog\Model\AbstractModel implements \Magento\
             throw $e;
         }
         $this->_eventManager->dispatch('category_move', $eventParams);
-        if ($this->flatState->isFlatEnabled() && !$this->getFlatIndexer()->isScheduled()) {
-            $this->getFlatIndexer()->reindexList(array($this->getId(), $oldParentId, $parentId));
+        if ($this->flatState->isFlatEnabled()) {
+            $flatIndexer = $this->indexerRegistry->get(Indexer\Category\Flat\State::INDEXER_ID);
+            if (!$flatIndexer->isScheduled()) {
+                $flatIndexer->reindexList(array($this->getId(), $oldParentId, $parentId));
+            }
         }
-        if (!$this->getProductIndexer()->isScheduled()) {
-            $this->getProductIndexer()->reindexList(array_merge($this->getPathIds(), $oldParentIds));
+        $productIndexer = $this->indexerRegistry->get(Indexer\Category\Product::INDEXER_ID);
+        if (!$productIndexer->isScheduled()) {
+            $productIndexer->reindexList(array_merge($this->getPathIds(), $oldParentIds));
         }
         $this->_cacheManager->clean(array(self::CACHE_TAG));
 
@@ -1036,11 +1004,15 @@ class Category extends \Magento\Catalog\Model\AbstractModel implements \Magento\
      */
     public function reindex()
     {
-        if ($this->flatState->isFlatEnabled() && !$this->getFlatIndexer()->isScheduled()) {
-            $this->getFlatIndexer()->reindexRow($this->getId());
+        if ($this->flatState->isFlatEnabled()) {
+            $flatIndexer = $this->indexerRegistry->get(Indexer\Category\Flat\State::INDEXER_ID);
+            if (!$flatIndexer->isScheduled()) {
+                $flatIndexer->reindexRow($this->getId());
+            }
         }
-        if (!$this->getProductIndexer()->isScheduled()) {
-            $this->getProductIndexer()->reindexList($this->getPathIds());
+        $productIndexer = $this->indexerRegistry->get(Indexer\Category\Product::INDEXER_ID);
+        if (!$productIndexer->isScheduled()) {
+            $productIndexer->reindexList($this->getPathIds());
         }
     }
 
diff --git a/app/code/Magento/Catalog/Model/Category/Attribute/Backend/Image.php b/app/code/Magento/Catalog/Model/Category/Attribute/Backend/Image.php
index 313507ef63b1b1d9bdeeb96ec4bb631be2b15d2a..cd796c39b4398b8690016ff06dda0cef9773ca67 100644
--- a/app/code/Magento/Catalog/Model/Category/Attribute/Backend/Image.php
+++ b/app/code/Magento/Catalog/Model/Category/Attribute/Backend/Image.php
@@ -53,6 +53,11 @@ class Image extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend
      */
     protected $_fileUploaderFactory;
 
+    /**
+     * @var \Magento\Framework\Logger
+     */
+    protected $_logger;
+
     /**
      * Construct
      *
@@ -67,7 +72,7 @@ class Image extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend
     ) {
         $this->_filesystem = $filesystem;
         $this->_fileUploaderFactory = $fileUploaderFactory;
-        parent::__construct($logger);
+        $this->_logger = $logger;
     }
 
     /**
diff --git a/app/code/Magento/Catalog/Model/Category/Attribute/Backend/Sortby.php b/app/code/Magento/Catalog/Model/Category/Attribute/Backend/Sortby.php
index 3fda0549932a32d62f0b3d6ae2dd7a89701f658f..59fc4767a02ac777a5e43cf391f5dc49947a3a40 100644
--- a/app/code/Magento/Catalog/Model/Category/Attribute/Backend/Sortby.php
+++ b/app/code/Magento/Catalog/Model/Category/Attribute/Backend/Sortby.php
@@ -40,13 +40,11 @@ class Sortby extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend
     /**
      * Construct
      *
-     * @param \Magento\Framework\Logger $logger
      * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
      */
-    public function __construct(\Magento\Framework\Logger $logger, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig)
+    public function __construct(\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig)
     {
         $this->_scopeConfig = $scopeConfig;
-        parent::__construct($logger);
     }
 
     /**
diff --git a/app/code/Magento/Catalog/Model/Config.php b/app/code/Magento/Catalog/Model/Config.php
index 28ef8cff07af9f116642fa1d80dd2e4147609b71..b2c5107f42d60e2f1db7f05361980fe2dd128c1a 100644
--- a/app/code/Magento/Catalog/Model/Config.php
+++ b/app/code/Magento/Catalog/Model/Config.php
@@ -135,6 +135,7 @@ class Config extends \Magento\Eav\Model\Config
      *
      * @param \Magento\Framework\App\CacheInterface $cache
      * @param \Magento\Eav\Model\Entity\TypeFactory $entityTypeFactory
+     * @param \Magento\Eav\Model\Resource\Entity\Type\CollectionFactory $entityTypeCollectionFactory,
      * @param \Magento\Framework\App\Cache\StateInterface $cacheState
      * @param \Magento\Framework\Validator\UniversalFactory $universalFactory
      * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
@@ -150,6 +151,7 @@ class Config extends \Magento\Eav\Model\Config
     public function __construct(
         \Magento\Framework\App\CacheInterface $cache,
         \Magento\Eav\Model\Entity\TypeFactory $entityTypeFactory,
+        \Magento\Eav\Model\Resource\Entity\Type\CollectionFactory $entityTypeCollectionFactory,
         \Magento\Framework\App\Cache\StateInterface $cacheState,
         \Magento\Framework\Validator\UniversalFactory $universalFactory,
         \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
@@ -168,7 +170,7 @@ class Config extends \Magento\Eav\Model\Config
         $this->_storeManager = $storeManager;
         $this->_eavConfig = $eavConfig;
 
-        parent::__construct($cache, $entityTypeFactory, $cacheState, $universalFactory);
+        parent::__construct($cache, $entityTypeFactory, $entityTypeCollectionFactory, $cacheState, $universalFactory);
     }
 
     /**
diff --git a/app/code/Magento/Catalog/Model/Indexer/AbstractFlatState.php b/app/code/Magento/Catalog/Model/Indexer/AbstractFlatState.php
index 0bd094093c3fc6c557ae4019c595c6bdd876d1a3..20db245a69fe3064822e986700a8a0fc117a6511 100644
--- a/app/code/Magento/Catalog/Model/Indexer/AbstractFlatState.php
+++ b/app/code/Magento/Catalog/Model/Indexer/AbstractFlatState.php
@@ -23,6 +23,8 @@
  */
 namespace Magento\Catalog\Model\Indexer;
 
+use Magento\Store\Model\ScopeInterface;
+
 abstract class AbstractFlatState
 {
     /**
@@ -45,23 +47,21 @@ abstract class AbstractFlatState
      */
     protected $isAvailable;
 
-    /**
-     * @var \Magento\Indexer\Model\IndexerInterface
-     */
-    protected $flatIndexer;
+    /** @var \Magento\Indexer\Model\IndexerRegistry */
+    protected $indexerRegistry;
 
     /**
      * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
-     * @param \Magento\Indexer\Model\IndexerInterface $flatIndexer
+     * @param \Magento\Indexer\Model\IndexerRegistry $indexerRegistry
      * @param bool $isAvailable
      */
     public function __construct(
         \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
-        \Magento\Indexer\Model\IndexerInterface $flatIndexer,
+        \Magento\Indexer\Model\IndexerRegistry $indexerRegistry,
         $isAvailable = false
     ) {
         $this->scopeConfig = $scopeConfig;
-        $this->flatIndexer = $flatIndexer;
+        $this->indexerRegistry = $indexerRegistry;
         $this->isAvailable = $isAvailable;
     }
 
@@ -72,7 +72,7 @@ abstract class AbstractFlatState
      */
     public function isFlatEnabled()
     {
-        return $this->scopeConfig->isSetFlag(static::INDEXER_ENABLED_XML_PATH, \Magento\Store\Model\ScopeInterface::SCOPE_STORE);
+        return $this->scopeConfig->isSetFlag(static::INDEXER_ENABLED_XML_PATH, ScopeInterface::SCOPE_STORE);
     }
 
     /**
@@ -82,19 +82,7 @@ abstract class AbstractFlatState
      */
     public function isAvailable()
     {
-        return $this->isAvailable && $this->isFlatEnabled() && $this->getFlatIndexer()->isValid();
-    }
-
-    /**
-     * Return indexer object
-     *
-     * @return \Magento\Indexer\Model\IndexerInterface
-     */
-    protected function getFlatIndexer()
-    {
-        if (!$this->flatIndexer->getId()) {
-            $this->flatIndexer->load(static::INDEXER_ID);
-        }
-        return $this->flatIndexer;
+        return $this->isAvailable && $this->isFlatEnabled()
+            && $this->indexerRegistry->get(static::INDEXER_ID)->isValid();
     }
 }
diff --git a/app/code/Magento/Catalog/Model/Indexer/Category/Flat.php b/app/code/Magento/Catalog/Model/Indexer/Category/Flat.php
index a7da30396bad26d97b8ea20dfbd86226bff93bec..6475fcefe416d71e3cb81639efbbf5774e7ddb4f 100644
--- a/app/code/Magento/Catalog/Model/Indexer/Category/Flat.php
+++ b/app/code/Magento/Catalog/Model/Indexer/Category/Flat.php
@@ -35,24 +35,22 @@ class Flat implements \Magento\Indexer\Model\ActionInterface, \Magento\Framework
      */
     protected $rowsActionFactory;
 
-    /**
-     * @var \Magento\Indexer\Model\IndexerInterface
-     */
-    protected $indexer;
+    /** @var \Magento\Indexer\Model\IndexerRegistry */
+    protected $indexerRegistry;
 
     /**
      * @param Flat\Action\FullFactory $fullActionFactory
      * @param Flat\Action\RowsFactory $rowsActionFactory
-     * @param \Magento\Indexer\Model\IndexerInterface $indexer
+     * @param \Magento\Indexer\Model\IndexerRegistry $indexerRegistry
      */
     public function __construct(
         Flat\Action\FullFactory $fullActionFactory,
         Flat\Action\RowsFactory $rowsActionFactory,
-        \Magento\Indexer\Model\IndexerInterface $indexer
+        \Magento\Indexer\Model\IndexerRegistry $indexerRegistry
     ) {
         $this->fullActionFactory = $fullActionFactory;
         $this->rowsActionFactory = $rowsActionFactory;
-        $this->indexer = $indexer;
+        $this->indexerRegistry = $indexerRegistry;
     }
 
     /**
@@ -63,14 +61,14 @@ class Flat implements \Magento\Indexer\Model\ActionInterface, \Magento\Framework
      */
     public function execute($ids)
     {
-        $this->indexer->load(Flat\State::INDEXER_ID);
-        if ($this->indexer->isInvalid()) {
+        $indexer = $this->indexerRegistry->get(Flat\State::INDEXER_ID);
+        if ($indexer->isInvalid()) {
             return;
         }
 
         /** @var Flat\Action\Rows $action */
         $action = $this->rowsActionFactory->create();
-        if ($this->indexer->isWorking()) {
+        if ($indexer->isWorking()) {
             $action->reindex($ids, true);
         }
         $action->reindex($ids);
@@ -92,7 +90,7 @@ class Flat implements \Magento\Indexer\Model\ActionInterface, \Magento\Framework
      * @param int[] $ids
      * @return void
      */
-    public function executeList($ids)
+    public function executeList(array $ids)
     {
         $this->execute($ids);
     }
diff --git a/app/code/Magento/Catalog/Model/Indexer/Category/Flat/Plugin/StoreGroup.php b/app/code/Magento/Catalog/Model/Indexer/Category/Flat/Plugin/StoreGroup.php
index 3073d01df6b3479438c89e2f821c33826465c84b..757a2a6e73cfb9b6cbc5ab43835f4d78aa12b0e7 100644
--- a/app/code/Magento/Catalog/Model/Indexer/Category/Flat/Plugin/StoreGroup.php
+++ b/app/code/Magento/Catalog/Model/Indexer/Category/Flat/Plugin/StoreGroup.php
@@ -25,10 +25,8 @@ namespace Magento\Catalog\Model\Indexer\Category\Flat\Plugin;
 
 class StoreGroup
 {
-    /**
-     * @var \Magento\Indexer\Model\IndexerInterface
-     */
-    protected $indexer;
+    /** @var \Magento\Indexer\Model\IndexerRegistry */
+    protected $indexerRegistry;
 
     /**
      * @var \Magento\Catalog\Model\Indexer\Category\Flat\State
@@ -36,30 +34,17 @@ class StoreGroup
     protected $state;
 
     /**
-     * @param \Magento\Indexer\Model\IndexerInterface $indexer
+     * @param \Magento\Indexer\Model\IndexerRegistry $indexerRegistry
      * @param \Magento\Catalog\Model\Indexer\Category\Flat\State $state
      */
     public function __construct(
-        \Magento\Indexer\Model\IndexerInterface $indexer,
+        \Magento\Indexer\Model\IndexerRegistry $indexerRegistry,
         \Magento\Catalog\Model\Indexer\Category\Flat\State $state
     ) {
-        $this->indexer = $indexer;
+        $this->indexerRegistry = $indexerRegistry;
         $this->state = $state;
     }
 
-    /**
-     * Return own indexer object
-     *
-     * @return \Magento\Indexer\Model\IndexerInterface
-     */
-    protected function getIndexer()
-    {
-        if (!$this->indexer->getId()) {
-            $this->indexer->load(\Magento\Catalog\Model\Indexer\Category\Flat\State::INDEXER_ID);
-        }
-        return $this->indexer;
-    }
-
     /**
      * Validate changes for invalidating indexer
      *
@@ -87,7 +72,7 @@ class StoreGroup
         $needInvalidating = $this->validate($group);
         $objectResource = $proceed($group);
         if ($needInvalidating && $this->state->isFlatEnabled()) {
-            $this->getIndexer()->invalidate();
+            $this->indexerRegistry->get(\Magento\Catalog\Model\Indexer\Category\Flat\State::INDEXER_ID)->invalidate();
         }
 
         return $objectResource;
diff --git a/app/code/Magento/Catalog/Model/Indexer/Category/Flat/System/Config/Mode.php b/app/code/Magento/Catalog/Model/Indexer/Category/Flat/System/Config/Mode.php
index e13f2aebe8cb22454861237002fddc6d7b44eefa..42e5c3be7395e81b56225d433509afe81a512a21 100644
--- a/app/code/Magento/Catalog/Model/Indexer/Category/Flat/System/Config/Mode.php
+++ b/app/code/Magento/Catalog/Model/Indexer/Category/Flat/System/Config/Mode.php
@@ -28,21 +28,17 @@ namespace Magento\Catalog\Model\Indexer\Category\Flat\System\Config;
  */
 class Mode extends \Magento\Framework\App\Config\Value
 {
-    /**
-     * @var \Magento\Indexer\Model\IndexerInterface
-     */
-    protected $flatIndexer;
-
-    /**
-     * @var \Magento\Indexer\Model\Indexer\State
-     */
+    /** @var \Magento\Indexer\Model\Indexer\State */
     protected $indexerState;
 
+    /** @var \Magento\Indexer\Model\IndexerRegistry */
+    protected $indexerRegistry;
+
     /**
      * @param \Magento\Framework\Model\Context $context
      * @param \Magento\Framework\Registry $registry
      * @param \Magento\Framework\App\Config\ScopeConfigInterface $config
-     * @param \Magento\Indexer\Model\IndexerInterface $flatIndexer
+     * @param \Magento\Indexer\Model\IndexerRegistry $indexerRegistry
      * @param \Magento\Indexer\Model\Indexer\State $indexerState
      * @param \Magento\Framework\Model\Resource\AbstractResource $resource
      * @param \Magento\Framework\Data\Collection\Db $resourceCollection
@@ -52,15 +48,15 @@ class Mode extends \Magento\Framework\App\Config\Value
         \Magento\Framework\Model\Context $context,
         \Magento\Framework\Registry $registry,
         \Magento\Framework\App\Config\ScopeConfigInterface $config,
-        \Magento\Indexer\Model\IndexerInterface $flatIndexer,
+        \Magento\Indexer\Model\IndexerRegistry $indexerRegistry,
         \Magento\Indexer\Model\Indexer\State $indexerState,
         \Magento\Framework\Model\Resource\AbstractResource $resource = null,
         \Magento\Framework\Data\Collection\Db $resourceCollection = null,
         array $data = array()
     ) {
-        $this->flatIndexer = $flatIndexer;
-        $this->indexerState = $indexerState;
         parent::__construct($context, $registry, $config, $resource, $resourceCollection, $data);
+        $this->indexerRegistry = $indexerRegistry;
+        $this->indexerState = $indexerState;
     }
 
     /**
@@ -87,8 +83,8 @@ class Mode extends \Magento\Framework\App\Config\Value
                 $this->indexerState->setStatus(\Magento\Indexer\Model\Indexer\State::STATUS_INVALID);
                 $this->indexerState->save();
             } else {
-                $this->flatIndexer->load(\Magento\Catalog\Model\Indexer\Category\Flat\State::INDEXER_ID);
-                $this->flatIndexer->setScheduled(false);
+                $this->indexerRegistry->get(\Magento\Catalog\Model\Indexer\Category\Flat\State::INDEXER_ID)
+                    ->setScheduled(false);
             }
         }
     }
diff --git a/app/code/Magento/Catalog/Model/Indexer/Category/Product.php b/app/code/Magento/Catalog/Model/Indexer/Category/Product.php
index 0c5c9be366e772bc41d69aa82edff0fe39bda0c2..d98fa6032f777be4138f382be7e329878db0cd9e 100644
--- a/app/code/Magento/Catalog/Model/Indexer/Category/Product.php
+++ b/app/code/Magento/Catalog/Model/Indexer/Category/Product.php
@@ -40,24 +40,22 @@ class Product implements \Magento\Indexer\Model\ActionInterface, \Magento\Framew
      */
     protected $rowsActionFactory;
 
-    /**
-     * @var \Magento\Indexer\Model\IndexerInterface
-     */
-    protected $indexer;
+    /** @var \Magento\Indexer\Model\IndexerRegistry */
+    protected $indexerRegistry;
 
     /**
      * @param Product\Action\FullFactory $fullActionFactory
      * @param Product\Action\RowsFactory $rowsActionFactory
-     * @param \Magento\Indexer\Model\IndexerInterface $indexer
+     * @param \Magento\Indexer\Model\IndexerRegistry $indexerRegistry
      */
     public function __construct(
         Product\Action\FullFactory $fullActionFactory,
         Product\Action\RowsFactory $rowsActionFactory,
-        \Magento\Indexer\Model\IndexerInterface $indexer
+        \Magento\Indexer\Model\IndexerRegistry $indexerRegistry
     ) {
         $this->fullActionFactory = $fullActionFactory;
         $this->rowsActionFactory = $rowsActionFactory;
-        $this->indexer = $indexer;
+        $this->indexerRegistry = $indexerRegistry;
     }
 
     /**
@@ -87,7 +85,7 @@ class Product implements \Magento\Indexer\Model\ActionInterface, \Magento\Framew
      * @param int[] $ids
      * @return void
      */
-    public function executeList($ids)
+    public function executeList(array $ids)
     {
         $this->executeAction($ids);
     }
@@ -112,11 +110,11 @@ class Product implements \Magento\Indexer\Model\ActionInterface, \Magento\Framew
     protected function executeAction($ids)
     {
         $ids = array_unique($ids);
-        $this->indexer->load(static::INDEXER_ID);
+        $indexer = $this->indexerRegistry->get(static::INDEXER_ID);
 
         /** @var Product\Action\Rows $action */
         $action = $this->rowsActionFactory->create();
-        if ($this->indexer->isWorking()) {
+        if ($indexer->isWorking()) {
             $action->execute($ids, true);
         }
         $action->execute($ids);
diff --git a/app/code/Magento/Catalog/Model/Indexer/Category/Product/Plugin/StoreGroup.php b/app/code/Magento/Catalog/Model/Indexer/Category/Product/Plugin/StoreGroup.php
index 6479a1619eb7cb33c62ea03567d8eb536cc5ac50..424361b6ffca4955c7b3486783b78ef36f8be7aa 100644
--- a/app/code/Magento/Catalog/Model/Indexer/Category/Product/Plugin/StoreGroup.php
+++ b/app/code/Magento/Catalog/Model/Indexer/Category/Product/Plugin/StoreGroup.php
@@ -25,30 +25,15 @@ namespace Magento\Catalog\Model\Indexer\Category\Product\Plugin;
 
 class StoreGroup
 {
-    /**
-     * @var \Magento\Indexer\Model\IndexerInterface
-     */
-    protected $indexer;
+    /** @var \Magento\Indexer\Model\IndexerRegistry */
+    protected $indexerRegistry;
 
     /**
-     * @param \Magento\Indexer\Model\IndexerInterface $indexer
+     * @param \Magento\Indexer\Model\IndexerRegistry $indexerRegistry
      */
-    public function __construct(\Magento\Indexer\Model\IndexerInterface $indexer)
+    public function __construct(\Magento\Indexer\Model\IndexerRegistry $indexerRegistry)
     {
-        $this->indexer = $indexer;
-    }
-
-    /**
-     * Return own indexer object
-     *
-     * @return \Magento\Indexer\Model\IndexerInterface
-     */
-    protected function getIndexer()
-    {
-        if (!$this->indexer->getId()) {
-            $this->indexer->load(\Magento\Catalog\Model\Indexer\Category\Product::INDEXER_ID);
-        }
-        return $this->indexer;
+        $this->indexerRegistry = $indexerRegistry;
     }
 
     /**
@@ -65,7 +50,7 @@ class StoreGroup
         $needInvalidating = $this->validate($group);
         $objectResource = $proceed($group);
         if ($needInvalidating) {
-            $this->getIndexer()->invalidate();
+            $this->indexerRegistry->get(\Magento\Catalog\Model\Indexer\Category\Product::INDEXER_ID)->invalidate();
         }
 
         return $objectResource;
diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Category.php b/app/code/Magento/Catalog/Model/Indexer/Product/Category.php
index b1585e3866bc5b5461013f01d5054e79a7df618f..91c9da8a91c90c1313c9549692a5c6a577d33c1a 100644
--- a/app/code/Magento/Catalog/Model/Indexer/Product/Category.php
+++ b/app/code/Magento/Catalog/Model/Indexer/Product/Category.php
@@ -33,13 +33,13 @@ class Category extends \Magento\Catalog\Model\Indexer\Category\Product
     /**
      * @param \Magento\Catalog\Model\Indexer\Category\Product\Action\FullFactory $fullActionFactory
      * @param Category\Action\RowsFactory $rowsActionFactory
-     * @param \Magento\Indexer\Model\IndexerInterface $indexer
+     * @param \Magento\Indexer\Model\IndexerRegistry $indexerRegistry
      */
     public function __construct(
         \Magento\Catalog\Model\Indexer\Category\Product\Action\FullFactory $fullActionFactory,
         Category\Action\RowsFactory $rowsActionFactory,
-        \Magento\Indexer\Model\IndexerInterface $indexer
+        \Magento\Indexer\Model\IndexerRegistry $indexerRegistry
     ) {
-        parent::__construct($fullActionFactory, $rowsActionFactory, $indexer);
+        parent::__construct($fullActionFactory, $rowsActionFactory, $indexerRegistry);
     }
 }
diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Eav.php b/app/code/Magento/Catalog/Model/Indexer/Product/Eav.php
index b82bc3e5b36048bdafbe950ecc7be84449476a03..48406c60380b3396d12b326c64c0c570d9087ecb 100644
--- a/app/code/Magento/Catalog/Model/Indexer/Product/Eav.php
+++ b/app/code/Magento/Catalog/Model/Indexer/Product/Eav.php
@@ -82,7 +82,7 @@ class Eav implements \Magento\Indexer\Model\ActionInterface, \Magento\Framework\
      * @param int[] $ids
      * @return void
      */
-    public function executeList($ids)
+    public function executeList(array $ids)
     {
         $this->_productEavIndexerRows->execute($ids);
     }
diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat.php
index 82f73f781703fb8672dd605c6be632a5f953e397..52feb5ff1e2c1b978e52f120cfcfe8255803f816 100644
--- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat.php
+++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat.php
@@ -82,7 +82,7 @@ class Flat implements \Magento\Indexer\Model\ActionInterface, \Magento\Framework
      * @param int[] $ids
      * @return void
      */
-    public function executeList($ids)
+    public function executeList(array $ids)
     {
         $this->_productFlatIndexerRows->execute($ids);
     }
diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Processor.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Processor.php
index 0a66b0a8a4505099c5c6b0b9cab74bc29f0b642f..c87a0d028198ae7685d018afb364c45cc024e788 100644
--- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Processor.php
+++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Processor.php
@@ -36,14 +36,14 @@ class Processor extends \Magento\Indexer\Model\Indexer\AbstractProcessor
     protected $_state;
 
     /**
-     * @param \Magento\Indexer\Model\IndexerFactory $indexerFactory
-     * @param \Magento\Catalog\Model\Indexer\Product\Flat\State $state
+     * @param \Magento\Indexer\Model\IndexerRegistry $indexerRegistry
+     * @param State $state
      */
     public function __construct(
-        \Magento\Indexer\Model\IndexerFactory $indexerFactory,
+        \Magento\Indexer\Model\IndexerRegistry $indexerRegistry,
         \Magento\Catalog\Model\Indexer\Product\Flat\State $state
     ) {
-        $this->_indexer = $indexerFactory->create();
+        parent::__construct($indexerRegistry);
         $this->_state = $state;
     }
 
diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/State.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/State.php
index c1c8e0653fd5e6073111644fd4bc21fbe3a0daf3..681d97b63337eb8e91fb4f957559c18bc4fd5682 100644
--- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/State.php
+++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/State.php
@@ -42,21 +42,18 @@ class State extends \Magento\Catalog\Model\Indexer\AbstractFlatState
 
     /**
      * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
-     * @param \Magento\Indexer\Model\IndexerInterface $flatIndexer
+     * @param \Magento\Indexer\Model\IndexerRegistry $indexerRegistry
      * @param \Magento\Catalog\Helper\Product\Flat\Indexer $flatIndexerHelper
      * @param bool $isAvailable
      */
     public function __construct(
         \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
-        \Magento\Indexer\Model\IndexerInterface $flatIndexer,
+        \Magento\Indexer\Model\IndexerRegistry $indexerRegistry,
         \Magento\Catalog\Helper\Product\Flat\Indexer $flatIndexerHelper,
         $isAvailable = false
     ) {
-        $this->scopeConfig = $scopeConfig;
-        $this->flatIndexer = $flatIndexer;
+        parent::__construct($scopeConfig, $indexerRegistry, $isAvailable);
         $this->_productFlatIndexerHelper = $flatIndexerHelper;
-        $this->isAvailable = $isAvailable;
-        parent::__construct($scopeConfig, $flatIndexer, $isAvailable);
     }
 
     /**
diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Price.php b/app/code/Magento/Catalog/Model/Indexer/Product/Price.php
index 89a23c8246c88149351952ba43e67cd31d6f8ac3..b2af851b0e69a5de35aaa7fe85b53504254c8e5f 100644
--- a/app/code/Magento/Catalog/Model/Indexer/Product/Price.php
+++ b/app/code/Magento/Catalog/Model/Indexer/Product/Price.php
@@ -82,7 +82,7 @@ class Price implements \Magento\Indexer\Model\ActionInterface, \Magento\Framewor
      * @param int[] $ids
      * @return void
      */
-    public function executeList($ids)
+    public function executeList(array $ids)
     {
         $this->_productPriceIndexerRows->execute($ids);
     }
diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Price/Plugin/AbstractPlugin.php b/app/code/Magento/Catalog/Model/Indexer/Product/Price/Plugin/AbstractPlugin.php
index d8fda1c8243a5d8773a6821ce742a9297f322022..ddbec8a7a9b52bcbcf20098b1d143851179d253e 100644
--- a/app/code/Magento/Catalog/Model/Indexer/Product/Price/Plugin/AbstractPlugin.php
+++ b/app/code/Magento/Catalog/Model/Indexer/Product/Price/Plugin/AbstractPlugin.php
@@ -25,30 +25,15 @@ namespace Magento\Catalog\Model\Indexer\Product\Price\Plugin;
 
 abstract class AbstractPlugin
 {
-    /**
-     * @var \Magento\Indexer\Model\IndexerInterface
-     */
-    protected $indexer;
-
-    /**
-     * @param \Magento\Indexer\Model\IndexerInterface $indexer
-     */
-    public function __construct(\Magento\Indexer\Model\IndexerInterface $indexer)
-    {
-        $this->indexer = $indexer;
-    }
+    /** @var \Magento\Indexer\Model\IndexerRegistry */
+    protected $indexerRegistry;
 
     /**
-     * Return own indexer object
-     *
-     * @return \Magento\Indexer\Model\IndexerInterface
+     * @param \Magento\Indexer\Model\IndexerRegistry $indexerRegistry
      */
-    protected function getIndexer()
+    public function __construct(\Magento\Indexer\Model\IndexerRegistry $indexerRegistry)
     {
-        if (!$this->indexer->getId()) {
-            $this->indexer->load(\Magento\Catalog\Model\Indexer\Product\Price\Processor::INDEXER_ID);
-        }
-        return $this->indexer;
+        $this->indexerRegistry = $indexerRegistry;
     }
 
     /**
@@ -58,6 +43,6 @@ abstract class AbstractPlugin
      */
     protected function invalidateIndexer()
     {
-        $this->getIndexer()->invalidate();
+        $this->indexerRegistry->get(\Magento\Catalog\Model\Indexer\Product\Price\Processor::INDEXER_ID)->invalidate();
     }
 }
diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Price/System/Config/PriceScope.php b/app/code/Magento/Catalog/Model/Indexer/Product/Price/System/Config/PriceScope.php
index 5c129adf54c97e1ca6682daea403f20b8a618a30..5c0235eb97a579b76a0ec136fdf176d0798c07bb 100644
--- a/app/code/Magento/Catalog/Model/Indexer/Product/Price/System/Config/PriceScope.php
+++ b/app/code/Magento/Catalog/Model/Indexer/Product/Price/System/Config/PriceScope.php
@@ -28,16 +28,14 @@ namespace Magento\Catalog\Model\Indexer\Product\Price\System\Config;
  */
 class PriceScope extends \Magento\Framework\App\Config\Value
 {
-    /**
-     * @var \Magento\Indexer\Model\IndexerInterface
-     */
-    protected $indexer;
+    /** @var \Magento\Indexer\Model\IndexerRegistry */
+    protected $indexerRegistry;
 
     /**
      * @param \Magento\Framework\Model\Context $context
      * @param \Magento\Framework\Registry $registry
      * @param \Magento\Framework\App\Config\ScopeConfigInterface $config
-     * @param \Magento\Indexer\Model\IndexerInterface $indexer
+     * @param \Magento\Indexer\Model\IndexerRegistry $indexerRegistry
      * @param \Magento\Framework\Model\Resource\AbstractResource $resource
      * @param \Magento\Framework\Data\Collection\Db $resourceCollection
      * @param array $data
@@ -46,13 +44,13 @@ class PriceScope extends \Magento\Framework\App\Config\Value
         \Magento\Framework\Model\Context $context,
         \Magento\Framework\Registry $registry,
         \Magento\Framework\App\Config\ScopeConfigInterface $config,
-        \Magento\Indexer\Model\IndexerInterface $indexer,
+        \Magento\Indexer\Model\IndexerRegistry $indexerRegistry,
         \Magento\Framework\Model\Resource\AbstractResource $resource = null,
         \Magento\Framework\Data\Collection\Db $resourceCollection = null,
         array $data = array()
     ) {
-        $this->indexer = $indexer;
         parent::__construct($context, $registry, $config, $resource, $resourceCollection, $data);
+        $this->indexerRegistry = $indexerRegistry;
     }
 
     /**
@@ -74,7 +72,8 @@ class PriceScope extends \Magento\Framework\App\Config\Value
     public function processValue()
     {
         if ($this->isValueChanged()) {
-            $this->indexer->load(\Magento\Catalog\Model\Indexer\Product\Price\Processor::INDEXER_ID)->invalidate();
+            $this->indexerRegistry->get(\Magento\Catalog\Model\Indexer\Product\Price\Processor::INDEXER_ID)
+                ->invalidate();
         }
     }
 }
diff --git a/app/code/Magento/Catalog/Model/Product.php b/app/code/Magento/Catalog/Model/Product.php
index 3474930ad77e7910f7e1df375777574674921225..f201d28fd7d08af37cc5149cd02e080939527c47 100644
--- a/app/code/Magento/Catalog/Model/Product.php
+++ b/app/code/Magento/Catalog/Model/Product.php
@@ -236,10 +236,8 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements IdentityIn
      */
     protected $_filesystem;
 
-    /**
-     * @var \Magento\Indexer\Model\IndexerInterface
-     */
-    protected $categoryIndexer;
+    /** @var \Magento\Indexer\Model\IndexerRegistry */
+    protected $indexerRegistry;
 
     /**
      * @var \Magento\Catalog\Model\Indexer\Product\Flat\Processor
@@ -282,10 +280,10 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements IdentityIn
      * @param Resource\Product\Collection $resourceCollection
      * @param \Magento\Framework\Data\CollectionFactory $collectionFactory
      * @param \Magento\Framework\Filesystem $filesystem
-     * @param \Magento\Indexer\Model\IndexerInterface $categoryIndexer
+     * @param \Magento\Indexer\Model\IndexerRegistry $indexerRegistry
      * @param Indexer\Product\Flat\Processor $productFlatIndexerProcessor
      * @param Indexer\Product\Price\Processor $productPriceIndexerProcessor
-     * @param  \Magento\Catalog\Model\Indexer\Product\Eav\Processor $productEavIndexerProcessor
+     * @param Indexer\Product\Eav\Processor $productEavIndexerProcessor
      * @param array $data
      *
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
@@ -311,7 +309,7 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements IdentityIn
         Resource\Product\Collection $resourceCollection,
         \Magento\Framework\Data\CollectionFactory $collectionFactory,
         \Magento\Framework\Filesystem $filesystem,
-        \Magento\Indexer\Model\IndexerInterface $categoryIndexer,
+        \Magento\Indexer\Model\IndexerRegistry $indexerRegistry,
         \Magento\Catalog\Model\Indexer\Product\Flat\Processor $productFlatIndexerProcessor,
         \Magento\Catalog\Model\Indexer\Product\Price\Processor $productPriceIndexerProcessor,
         \Magento\Catalog\Model\Indexer\Product\Eav\Processor $productEavIndexerProcessor,
@@ -332,7 +330,7 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements IdentityIn
         $this->_urlModel = $url;
         $this->_linkInstance = $productLink;
         $this->_filesystem = $filesystem;
-        $this->categoryIndexer = $categoryIndexer;
+        $this->indexerRegistry = $indexerRegistry;
         $this->_productFlatIndexerProcessor = $productFlatIndexerProcessor;
         $this->_productPriceIndexerProcessor = $productPriceIndexerProcessor;
         $this->_productEavIndexerProcessor = $productEavIndexerProcessor;
@@ -349,19 +347,6 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements IdentityIn
         $this->_init('Magento\Catalog\Model\Resource\Product');
     }
 
-    /**
-     * Return product category indexer object
-     *
-     * @return \Magento\Indexer\Model\IndexerInterface
-     */
-    protected function getCategoryIndexer()
-    {
-        if (!$this->categoryIndexer->getId()) {
-            $this->categoryIndexer->load(Indexer\Product\Category::INDEXER_ID);
-        }
-        return $this->categoryIndexer;
-    }
-
     /**
      * Retrieve Store Id
      *
@@ -804,8 +789,9 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements IdentityIn
     public function reindex()
     {
         $this->_productFlatIndexerProcessor->reindexRow($this->getEntityId());
-        if (!$this->getCategoryIndexer()->isScheduled()) {
-            $this->getCategoryIndexer()->reindexRow($this->getId());
+        $categoryIndexer = $this->indexerRegistry->get(Indexer\Product\Category::INDEXER_ID);
+        if (!$categoryIndexer->isScheduled()) {
+            $categoryIndexer->reindexRow($this->getId());
         }
     }
 
diff --git a/app/code/Magento/Catalog/Model/Product/Action.php b/app/code/Magento/Catalog/Model/Product/Action.php
index 6a77bc1cb884aeb93e0fad9ff75264191f9f66d9..8c63430174b31ee02eb41040e64a495fe776a2a4 100644
--- a/app/code/Magento/Catalog/Model/Product/Action.php
+++ b/app/code/Magento/Catalog/Model/Product/Action.php
@@ -37,10 +37,8 @@ class Action extends \Magento\Framework\Model\AbstractModel
      */
     protected $_productWebsiteFactory;
 
-    /**
-     * @var \Magento\Indexer\Model\IndexerInterface
-     */
-    protected $categoryIndexer;
+    /** @var \Magento\Indexer\Model\IndexerRegistry */
+    protected $indexerRegistry;
 
     /**
      * @var \Magento\Eav\Model\Config
@@ -55,8 +53,8 @@ class Action extends \Magento\Framework\Model\AbstractModel
     /**
      * @param \Magento\Framework\Model\Context $context
      * @param \Magento\Framework\Registry $registry
-     * @param \Magento\Catalog\Model\Product\WebsiteFactory $productWebsiteFactory
-     * @param \Magento\Indexer\Model\IndexerInterface $categoryIndexer
+     * @param WebsiteFactory $productWebsiteFactory
+     * @param \Magento\Indexer\Model\IndexerRegistry $indexerRegistry
      * @param \Magento\Eav\Model\Config $eavConfig
      * @param \Magento\Catalog\Model\Indexer\Product\Eav\Processor $productEavIndexerProcessor
      * @param \Magento\Framework\Model\Resource\AbstractResource $resource
@@ -67,7 +65,7 @@ class Action extends \Magento\Framework\Model\AbstractModel
         \Magento\Framework\Model\Context $context,
         \Magento\Framework\Registry $registry,
         \Magento\Catalog\Model\Product\WebsiteFactory $productWebsiteFactory,
-        \Magento\Indexer\Model\IndexerInterface $categoryIndexer,
+        \Magento\Indexer\Model\IndexerRegistry $indexerRegistry,
         \Magento\Eav\Model\Config $eavConfig,
         \Magento\Catalog\Model\Indexer\Product\Eav\Processor $productEavIndexerProcessor,
         \Magento\Framework\Model\Resource\AbstractResource $resource = null,
@@ -75,7 +73,7 @@ class Action extends \Magento\Framework\Model\AbstractModel
         array $data = array()
     ) {
         $this->_productWebsiteFactory = $productWebsiteFactory;
-        $this->categoryIndexer = $categoryIndexer;
+        $this->indexerRegistry = $indexerRegistry;
         $this->_eavConfig = $eavConfig;
         $this->_productEavIndexerProcessor = $productEavIndexerProcessor;
         parent::__construct($context, $registry, $resource, $resourceCollection, $data);
@@ -91,19 +89,6 @@ class Action extends \Magento\Framework\Model\AbstractModel
         $this->_init('Magento\Catalog\Model\Resource\Product\Action');
     }
 
-    /**
-     * Return product category indexer object
-     *
-     * @return \Magento\Indexer\Model\IndexerInterface
-     */
-    protected function getCategoryIndexer()
-    {
-        if (!$this->categoryIndexer->getId()) {
-            $this->categoryIndexer->load(\Magento\Catalog\Model\Indexer\Product\Category::INDEXER_ID);
-        }
-        return $this->categoryIndexer;
-    }
-
     /**
      * Retrieve resource instance wrapper
      *
@@ -138,8 +123,9 @@ class Action extends \Magento\Framework\Model\AbstractModel
             $this->_productEavIndexerProcessor->reindexList(array_unique($productIds));
         }
 
-        if (!$this->getCategoryIndexer()->isScheduled()) {
-            $this->getCategoryIndexer()->reindexList(array_unique($productIds));
+        $categoryIndexer = $this->indexerRegistry->get(\Magento\Catalog\Model\Indexer\Product\Category::INDEXER_ID);
+        if (!$categoryIndexer->isScheduled()) {
+            $categoryIndexer->reindexList(array_unique($productIds));
         }
         return $this;
     }
@@ -199,8 +185,9 @@ class Action extends \Magento\Framework\Model\AbstractModel
             array('product_ids' => array_unique($productIds), 'website_ids' => $websiteIds, 'action_type' => $type)
         );
 
-        if (!$this->getCategoryIndexer()->isScheduled()) {
-            $this->getCategoryIndexer()->reindexList(array_unique($productIds));
+        $categoryIndexer = $this->indexerRegistry->get(\Magento\Catalog\Model\Indexer\Product\Category::INDEXER_ID);
+        if (!$categoryIndexer->isScheduled()) {
+            $categoryIndexer->reindexList(array_unique($productIds));
         }
     }
 }
diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice.php
index 59e690c995cb8df656421286fc51124a8dc9127f..43ab6908a589d8b65125260bbb1265811bfd3b51 100644
--- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice.php
+++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice.php
@@ -38,7 +38,6 @@ class Groupprice extends \Magento\Catalog\Model\Product\Attribute\Backend\Groupp
     protected $_productAttributeBackendGroupprice;
 
     /**
-     * @param \Magento\Framework\Logger $logger
      * @param \Magento\Directory\Model\CurrencyFactory $currencyFactory
      * @param \Magento\Framework\StoreManagerInterface $storeManager
      * @param \Magento\Catalog\Helper\Data $catalogData
@@ -47,7 +46,6 @@ class Groupprice extends \Magento\Catalog\Model\Product\Attribute\Backend\Groupp
      * @param \Magento\Catalog\Model\Resource\Product\Attribute\Backend\Groupprice $productAttributeBackendGroupprice
      */
     public function __construct(
-        \Magento\Framework\Logger $logger,
         \Magento\Directory\Model\CurrencyFactory $currencyFactory,
         \Magento\Framework\StoreManagerInterface $storeManager,
         \Magento\Catalog\Helper\Data $catalogData,
@@ -56,7 +54,7 @@ class Groupprice extends \Magento\Catalog\Model\Product\Attribute\Backend\Groupp
         \Magento\Catalog\Model\Resource\Product\Attribute\Backend\Groupprice $productAttributeBackendGroupprice
     ) {
         $this->_productAttributeBackendGroupprice = $productAttributeBackendGroupprice;
-        parent::__construct($logger, $currencyFactory, $storeManager, $catalogData, $config, $catalogProductType);
+        parent::__construct($currencyFactory, $storeManager, $catalogData, $config, $catalogProductType);
     }
 
     /**
diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice/AbstractGroupprice.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice/AbstractGroupprice.php
index c519659e4b9cd5db078555a409da380ff7f04fbf..c83318bcf6866eebd69b84b61dc1e0da4ba51bc5 100644
--- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice/AbstractGroupprice.php
+++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice/AbstractGroupprice.php
@@ -54,7 +54,6 @@ abstract class AbstractGroupprice extends Price
     protected $_catalogProductType;
 
     /**
-     * @param \Magento\Framework\Logger $logger
      * @param \Magento\Directory\Model\CurrencyFactory $currencyFactory
      * @param \Magento\Framework\StoreManagerInterface $storeManager
      * @param \Magento\Catalog\Helper\Data $catalogData
@@ -62,7 +61,6 @@ abstract class AbstractGroupprice extends Price
      * @param \Magento\Catalog\Model\Product\Type $catalogProductType
      */
     public function __construct(
-        \Magento\Framework\Logger $logger,
         \Magento\Directory\Model\CurrencyFactory $currencyFactory,
         \Magento\Framework\StoreManagerInterface $storeManager,
         \Magento\Catalog\Helper\Data $catalogData,
@@ -70,7 +68,7 @@ abstract class AbstractGroupprice extends Price
         \Magento\Catalog\Model\Product\Type $catalogProductType
     ) {
         $this->_catalogProductType = $catalogProductType;
-        parent::__construct($logger, $currencyFactory, $storeManager, $catalogData, $config);
+        parent::__construct($currencyFactory, $storeManager, $catalogData, $config);
     }
 
     /**
diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Media.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Media.php
index 183594e8200cbe3cbf9b14f8db409dfd389f30c7..90dac23eae474f369900041c04c309afe85d056f 100644
--- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Media.php
+++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Media.php
@@ -87,7 +87,6 @@ class Media extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend
     /**
      * Construct
      *
-     * @param \Magento\Framework\Logger $logger
      * @param \Magento\Catalog\Model\Resource\ProductFactory $productFactory
      * @param \Magento\Framework\Event\ManagerInterface $eventManager
      * @param \Magento\Core\Helper\File\Storage\Database $fileStorageDb
@@ -97,7 +96,6 @@ class Media extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend
      * @param \Magento\Catalog\Model\Resource\Product\Attribute\Backend\Media $resourceProductAttribute
      */
     public function __construct(
-        \Magento\Framework\Logger $logger,
         \Magento\Catalog\Model\Resource\ProductFactory $productFactory,
         \Magento\Framework\Event\ManagerInterface $eventManager,
         \Magento\Core\Helper\File\Storage\Database $fileStorageDb,
@@ -113,7 +111,6 @@ class Media extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend
         $this->_resourceModel = $resourceProductAttribute;
         $this->_mediaConfig = $mediaConfig;
         $this->_mediaDirectory = $filesystem->getDirectoryWrite(DirectoryList::MEDIA);
-        parent::__construct($logger);
     }
 
     /**
diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Price.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Price.php
index 38db295744433ab15aab6ecc9314d4098b839198..a3944b4bf9e9f3d4634d984bd3ac791c4cb752c4 100644
--- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Price.php
+++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Price.php
@@ -61,14 +61,12 @@ class Price extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend
     /**
      * Construct
      *
-     * @param \Magento\Framework\Logger $logger
      * @param \Magento\Directory\Model\CurrencyFactory $currencyFactory
      * @param \Magento\Framework\StoreManagerInterface $storeManager
      * @param \Magento\Catalog\Helper\Data $catalogData
      * @param \Magento\Framework\App\Config\ScopeConfigInterface $config
      */
     public function __construct(
-        \Magento\Framework\Logger $logger,
         \Magento\Directory\Model\CurrencyFactory $currencyFactory,
         \Magento\Framework\StoreManagerInterface $storeManager,
         \Magento\Catalog\Helper\Data $catalogData,
@@ -78,7 +76,6 @@ class Price extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend
         $this->_storeManager = $storeManager;
         $this->_helper = $catalogData;
         $this->_config = $config;
-        parent::__construct($logger);
     }
 
     /**
diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Sku.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Sku.php
index a97a2a7ca01ea5a38072c99b03553d7adfcfa40d..b8b7c030dc0ebcef9bed3fb8aa10f535e8a83e45 100644
--- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Sku.php
+++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Sku.php
@@ -48,13 +48,11 @@ class Sku extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend
     protected $string;
 
     /**
-     * @param \Magento\Framework\Logger $logger
      * @param \Magento\Framework\Stdlib\String $string
      */
-    public function __construct(\Magento\Framework\Logger $logger, \Magento\Framework\Stdlib\String $string)
+    public function __construct(\Magento\Framework\Stdlib\String $string)
     {
         $this->string = $string;
-        parent::__construct($logger);
     }
 
     /**
diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Startdate.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Startdate.php
index a6aec8f28e8f5de9047939477163520b7a4e2b24..73d2e82248aada5d9da3dea3a2c9c9685ed998c5 100644
--- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Startdate.php
+++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Startdate.php
@@ -41,17 +41,15 @@ class Startdate extends \Magento\Eav\Model\Entity\Attribute\Backend\Datetime
     /**
      * Constructor
      *
-     * @param \Magento\Framework\Logger $logger
      * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate
      * @param \Magento\Framework\Stdlib\DateTime\DateTime $date
      */
     public function __construct(
-        \Magento\Framework\Logger $logger,
         \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate,
         \Magento\Framework\Stdlib\DateTime\DateTime $date
     ) {
         $this->_date = $date;
-        parent::__construct($logger, $localeDate);
+        parent::__construct($localeDate);
     }
 
     /**
diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Stock.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Stock.php
index f83fd3ae758512cb8028d4ac206e109f34de4fad..1b8d4c0cd266dfdf09b3a688070abc622cf9e9ea 100644
--- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Stock.php
+++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Stock.php
@@ -41,15 +41,11 @@ class Stock extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend
     /**
      * Construct
      *
-     * @param \Magento\Framework\Logger $logger
      * @param \Magento\CatalogInventory\Service\V1\StockItemService $stockItemService
      */
-    public function __construct(
-        \Magento\Framework\Logger $logger,
-        \Magento\CatalogInventory\Service\V1\StockItemService $stockItemService
-    ) {
+    public function __construct(\Magento\CatalogInventory\Service\V1\StockItemService $stockItemService)
+    {
         $this->stockItemService = $stockItemService;
-        parent::__construct($logger);
     }
 
     /**
diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Tierprice.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Tierprice.php
index 28fc31e58180f5af5ac56db3711b9712c6f1dcfb..6b1b2cc5974389339a4860fe82169323e967f464 100644
--- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Tierprice.php
+++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Tierprice.php
@@ -40,7 +40,6 @@ class Tierprice extends \Magento\Catalog\Model\Product\Attribute\Backend\Grouppr
     protected $_productAttributeBackendTierprice;
 
     /**
-     * @param \Magento\Framework\Logger $logger
      * @param \Magento\Directory\Model\CurrencyFactory $currencyFactory
      * @param \Magento\Framework\StoreManagerInterface $storeManager
      * @param \Magento\Catalog\Helper\Data $catalogData
@@ -49,7 +48,6 @@ class Tierprice extends \Magento\Catalog\Model\Product\Attribute\Backend\Grouppr
      * @param \Magento\Catalog\Model\Resource\Product\Attribute\Backend\Tierprice $productAttributeTierprice
      */
     public function __construct(
-        \Magento\Framework\Logger $logger,
         \Magento\Directory\Model\CurrencyFactory $currencyFactory,
         \Magento\Framework\StoreManagerInterface $storeManager,
         \Magento\Catalog\Helper\Data $catalogData,
@@ -58,7 +56,7 @@ class Tierprice extends \Magento\Catalog\Model\Product\Attribute\Backend\Grouppr
         \Magento\Catalog\Model\Resource\Product\Attribute\Backend\Tierprice $productAttributeTierprice
     ) {
         $this->_productAttributeBackendTierprice = $productAttributeTierprice;
-        parent::__construct($logger, $currencyFactory, $storeManager, $catalogData, $config, $catalogProductType);
+        parent::__construct($currencyFactory, $storeManager, $catalogData, $config, $catalogProductType);
     }
 
     /**
diff --git a/app/code/Magento/Catalog/Model/Resource/Category.php b/app/code/Magento/Catalog/Model/Resource/Category.php
index 3d002f93e5534130fae296de1bf4cc340689865c..36f0515af5dc8ca208aa6f7b0d722b600ea43171 100644
--- a/app/code/Magento/Catalog/Model/Resource/Category.php
+++ b/app/code/Magento/Catalog/Model/Resource/Category.php
@@ -523,7 +523,7 @@ class Category extends AbstractResource
     public function getChildrenAmount($category, $isActiveFlag = true)
     {
         $storeId = $this->_storeManager->getStore()->getId();
-        $attributeId = $this->_getIsActiveAttributeId();
+        $attributeId = $this->getIsActiveAttributeId();
         $table = $this->getTable(array($this->getEntityTablePrefix(), 'int'));
         $adapter = $this->_getReadAdapter();
         $checkSql = $adapter->getCheckSql('c.value_id > 0', 'c.value', 'd.value');
@@ -559,25 +559,13 @@ class Category extends AbstractResource
      *
      * @return int
      */
-    protected function _getIsActiveAttributeId()
+    public function getIsActiveAttributeId()
     {
         if ($this->_isActiveAttributeId === null) {
-            $bind = array('catalog_category' => \Magento\Catalog\Model\Category::ENTITY, 'is_active' => 'is_active');
-            $select = $this->_getReadAdapter()->select()->from(
-                array('a' => $this->getTable('eav_attribute')),
-                array('attribute_id')
-            )->join(
-                array('t' => $this->getTable('eav_entity_type')),
-                'a.entity_type_id = t.entity_type_id'
-            )->where(
-                'entity_type_code = :catalog_category'
-            )->where(
-                'attribute_code = :is_active'
-            );
-
-            $this->_isActiveAttributeId = $this->_getReadAdapter()->fetchOne($select, $bind);
+            $this->_isActiveAttributeId = (int)$this->_eavConfig
+                ->getAttribute($this->getEntityType(), 'is_active')
+                ->getAttributeId();
         }
-
         return $this->_isActiveAttributeId;
     }
 
@@ -760,7 +748,7 @@ class Category extends AbstractResource
      */
     public function getChildren($category, $recursive = true)
     {
-        $attributeId = (int)$this->_getIsActiveAttributeId();
+        $attributeId = $this->getIsActiveAttributeId();
         $backendTable = $this->getTable(array($this->getEntityTablePrefix(), 'int'));
         $adapter = $this->_getReadAdapter();
         $checkSql = $adapter->getCheckSql('c.value_id > 0', 'c.value', 'd.value');
diff --git a/app/code/Magento/Catalog/Model/Resource/Category/Tree.php b/app/code/Magento/Catalog/Model/Resource/Category/Tree.php
index 79bf34f70024d4dfaf2d6760181828479ba0a903..0ba58e254929712ccba0721c5b87044210b53c82 100644
--- a/app/code/Magento/Catalog/Model/Resource/Category/Tree.php
+++ b/app/code/Magento/Catalog/Model/Resource/Category/Tree.php
@@ -55,13 +55,6 @@ class Tree extends \Magento\Framework\Data\Tree\Dbp
      */
     protected $_collection;
 
-    /**
-     * Id of 'is_active' category attribute
-     *
-     * @var int
-     */
-    protected $_isActiveAttributeId = null;
-
     /**
      * Join URL rewrites data to collection flag
      *
@@ -309,35 +302,6 @@ class Tree extends \Magento\Framework\Data\Tree\Dbp
         return $disabledIds;
     }
 
-    /**
-     * Returns attribute id for attribute "is_active"
-     *
-     * @return int
-     */
-    protected function _getIsActiveAttributeId()
-    {
-        if (is_null($this->_isActiveAttributeId)) {
-            $bind = array(
-                'entity_type_code' => \Magento\Catalog\Model\Category::ENTITY,
-                'attribute_code' => 'is_active'
-            );
-            $select = $this->_conn->select()->from(
-                array('a' => $this->_coreResource->getTableName('eav_attribute')),
-                array('attribute_id')
-            )->join(
-                array('t' => $this->_coreResource->getTableName('eav_entity_type')),
-                'a.entity_type_id = t.entity_type_id'
-            )->where(
-                'entity_type_code = :entity_type_code'
-            )->where(
-                'attribute_code = :attribute_code'
-            );
-
-            $this->_isActiveAttributeId = $this->_conn->fetchOne($select, $bind);
-        }
-        return $this->_isActiveAttributeId;
-    }
-
     /**
      * Retrieve inactive category item ids
      *
@@ -348,7 +312,7 @@ class Tree extends \Magento\Framework\Data\Tree\Dbp
     protected function _getInactiveItemIds($collection, $storeId)
     {
         $filter = $collection->getAllIdsSql();
-        $attributeId = $this->_getIsActiveAttributeId();
+        $attributeId = $this->_catalogCategory->getIsActiveAttributeId();
 
         $conditionSql = $this->_conn->getCheckSql('c.value_id > 0', 'c.value', 'd.value');
         $table = $this->_coreResource->getTableName('catalog_category_entity_int');
diff --git a/app/code/Magento/Catalog/Model/Resource/Config.php b/app/code/Magento/Catalog/Model/Resource/Config.php
index 174fb186153d896e8f018ca04d99055ec308ee1b..c07b975dd6de9c2d67121ce904c081a2ae4fed31 100644
--- a/app/code/Magento/Catalog/Model/Resource/Config.php
+++ b/app/code/Magento/Catalog/Model/Resource/Config.php
@@ -104,7 +104,7 @@ class Config extends \Magento\Framework\Model\Resource\Db\AbstractDb
     public function getStoreId()
     {
         if ($this->_storeId === null) {
-            return $this->_storeManager->getStore()->getId();
+            $this->_storeId = (int)$this->_storeManager->getStore()->getId();
         }
         return $this->_storeId;
     }
@@ -117,7 +117,8 @@ class Config extends \Magento\Framework\Model\Resource\Db\AbstractDb
     public function getEntityTypeId()
     {
         if ($this->_entityTypeId === null) {
-            $this->_entityTypeId = $this->_eavConfig->getEntityType(\Magento\Catalog\Model\Product::ENTITY)->getId();
+            $this->_entityTypeId = (int)$this->_eavConfig->getEntityType(\Magento\Catalog\Model\Product::ENTITY)
+                ->getId();
         }
         return $this->_entityTypeId;
     }
@@ -143,12 +144,11 @@ class Config extends \Magento\Framework\Model\Resource\Db\AbstractDb
             array('store_label' => $storeLabelExpr)
         )->where(
             'main_table.entity_type_id = ?',
-            (int)$this->getEntityTypeId()
+            $this->getEntityTypeId()
         )->where(
             'additional_table.used_in_product_listing = ?',
             1
         );
-
         return $adapter->fetchAll($select);
     }
 
@@ -169,16 +169,15 @@ class Config extends \Magento\Framework\Model\Resource\Db\AbstractDb
             array()
         )->joinLeft(
             array('al' => $this->getTable('eav_attribute_label')),
-            'al.attribute_id = main_table.attribute_id AND al.store_id = ' . (int)$this->getStoreId(),
+            'al.attribute_id = main_table.attribute_id AND al.store_id = ' . $this->getStoreId(),
             array('store_label' => $storeLabelExpr)
         )->where(
             'main_table.entity_type_id = ?',
-            (int)$this->getEntityTypeId()
+            $this->getEntityTypeId()
         )->where(
             'additional_table.used_for_sort_by = ?',
             1
         );
-
         return $adapter->fetchAll($select);
     }
 }
diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/Image.php b/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/Image.php
index 4fc18afeaa1de3a4397635f06d916775a63d0683..5157da8a52e7cac48cd1aaf9cac13e1d12f11141 100644
--- a/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/Image.php
+++ b/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/Image.php
@@ -48,18 +48,15 @@ class Image extends AbstractBackend
     protected $_fileUploaderFactory;
 
     /**
-     * @param \Magento\Framework\Logger $logger
      * @param \Magento\Framework\Filesystem $filesystem
      * @param \Magento\Core\Model\File\UploaderFactory $fileUploaderFactory
      */
     public function __construct(
-        \Magento\Framework\Logger $logger,
         \Magento\Framework\Filesystem $filesystem,
         \Magento\Core\Model\File\UploaderFactory $fileUploaderFactory
     ) {
         $this->_filesystem = $filesystem;
         $this->_fileUploaderFactory = $fileUploaderFactory;
-        parent::__construct($logger);
     }
 
     /**
diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Collection.php b/app/code/Magento/Catalog/Model/Resource/Product/Collection.php
index ecd76ffd110ab441097a1684dafe5612ef3605fa..1c7709593681e7380b6b57faf7dfa026235e6d4b 100644
--- a/app/code/Magento/Catalog/Model/Resource/Product/Collection.php
+++ b/app/code/Magento/Catalog/Model/Resource/Product/Collection.php
@@ -1331,40 +1331,6 @@ class Collection extends \Magento\Catalog\Model\Resource\Collection\AbstractColl
         return $this->addPriceData();
     }
 
-    /**
-     * Join prices from price rules to products collection
-     *
-     * @return $this
-     */
-    protected function _joinPriceRules()
-    {
-        if ($this->isEnabledFlat()) {
-            $customerGroup = $this->_customerSession->getCustomerGroupId();
-            $priceColumn = 'e.display_price_group_' . $customerGroup;
-            $this->getSelect()->columns(array('_rule_price' => $priceColumn));
-
-            return $this;
-        }
-        if (!$this->moduleManager->isEnabled('Magento_CatalogRule')) {
-            return $this;
-        }
-        $wId = $this->_storeManager->getWebsite()->getId();
-        $gId = $this->_customerSession->getCustomerGroupId();
-
-        $storeDate = $this->_localeDate->scopeTimeStamp($this->getStoreId());
-        $conditions = 'price_rule.product_id = e.entity_id AND ';
-        $conditions .= "price_rule.rule_date = '" . $this->dateTime->formatDate($storeDate, false) . "' AND ";
-        $conditions .= $this->getConnection()->quoteInto('price_rule.website_id = ? AND', $wId);
-        $conditions .= $this->getConnection()->quoteInto('price_rule.customer_group_id = ?', $gId);
-
-        $this->getSelect()->joinLeft(
-            array('price_rule' => $this->getTable('catalogrule_product_price')),
-            $conditions,
-            array('rule_price' => 'rule_price')
-        );
-        return $this;
-    }
-
     /**
      * Retrieve all ids
      *
diff --git a/app/code/Magento/Catalog/Plugin/Model/Resource/Config.php b/app/code/Magento/Catalog/Plugin/Model/Resource/Config.php
new file mode 100644
index 0000000000000000000000000000000000000000..033cd7f2bb0cbf44cf19d6faa33e0e53d70a8183
--- /dev/null
+++ b/app/code/Magento/Catalog/Plugin/Model/Resource/Config.php
@@ -0,0 +1,103 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\Catalog\Plugin\Model\Resource;
+
+class Config
+{
+    /**#@+
+     * Product listing attributes cache ids
+     */
+    const PRODUCT_LISTING_ATTRIBUTES_CACHE_ID = 'PRODUCT_LISTING_ATTRIBUTES';
+    const PRODUCT_LISTING_SORT_BY_ATTRIBUTES_CACHE_ID = 'PRODUCT_LISTING_SORT_BY_ATTRIBUTES';
+    /**#@-*/
+
+    /** @var \Magento\Framework\App\CacheInterface */
+    protected $cache;
+
+    /** @var bool|null */
+    protected $isCacheEnabled = null;
+
+    /**
+     * @param \Magento\Framework\App\CacheInterface $cache
+     * @param \Magento\Framework\App\Cache\StateInterface $cacheState
+     */
+    public function __construct(
+        \Magento\Framework\App\CacheInterface $cache,
+        \Magento\Framework\App\Cache\StateInterface $cacheState
+    ) {
+        $this->cache = $cache;
+        $this->isCacheEnabled = $cacheState->isEnabled(\Magento\Eav\Model\Cache\Type::TYPE_IDENTIFIER);
+    }
+
+    /**
+     * @param \Magento\Catalog\Model\Resource\Config $config
+     * @param callable $proceed
+     * @return array
+     */
+    public function aroundGetAttributesUsedInListing(\Magento\Catalog\Model\Resource\Config $config, \Closure $proceed)
+    {
+        $cacheId = self::PRODUCT_LISTING_ATTRIBUTES_CACHE_ID . $config->getEntityTypeId() . '_' . $config->getStoreId();
+        if ($this->isCacheEnabled && ($attributes = $this->cache->load($cacheId))) {
+            return unserialize($attributes);
+        }
+        $attributes = $proceed();
+        if ($this->isCacheEnabled) {
+            $this->cache->save(
+                serialize($attributes),
+                $cacheId,
+                array(
+                    \Magento\Eav\Model\Cache\Type::CACHE_TAG,
+                    \Magento\Eav\Model\Entity\Attribute::CACHE_TAG
+                )
+            );
+        }
+        return $attributes;
+    }
+
+    /**
+     * @param \Magento\Catalog\Model\Resource\Config $config
+     * @param callable $proceed
+     * @return array
+     */
+    public function aroundGetAttributesUsedForSortBy(\Magento\Catalog\Model\Resource\Config $config, \Closure $proceed)
+    {
+        $cacheId = self::PRODUCT_LISTING_SORT_BY_ATTRIBUTES_CACHE_ID . $config->getEntityTypeId() . '_'
+            . $config->getStoreId();
+        if ($this->isCacheEnabled && ($attributes = $this->cache->load($cacheId))) {
+            return unserialize($attributes);
+        }
+        $attributes = $proceed();
+        if ($this->isCacheEnabled) {
+            $this->cache->save(
+                serialize($attributes),
+                $cacheId,
+                array(
+                    \Magento\Eav\Model\Cache\Type::CACHE_TAG,
+                    \Magento\Eav\Model\Entity\Attribute::CACHE_TAG
+                )
+            );
+        }
+        return $attributes;
+    }
+}
diff --git a/app/code/Magento/Catalog/Pricing/Price/FinalPrice.php b/app/code/Magento/Catalog/Pricing/Price/FinalPrice.php
index d5a8454d884c9c5af089c91a50674c53e52624da..10c5472f8a17026a5b79d7cde13313c3dbefc3c1 100644
--- a/app/code/Magento/Catalog/Pricing/Price/FinalPrice.php
+++ b/app/code/Magento/Catalog/Pricing/Price/FinalPrice.php
@@ -41,21 +41,7 @@ class FinalPrice extends AbstractPrice implements FinalPriceInterface
     /**
      * @var BasePrice
      */
-    protected $basePrice;
-
-    /**
-     * @param Product $saleableItem
-     * @param float $quantity
-     * @param CalculatorInterface $calculator
-     */
-    public function __construct(
-        Product $saleableItem,
-        $quantity,
-        CalculatorInterface $calculator
-    ) {
-        parent::__construct($saleableItem, $quantity, $calculator);
-        $this->basePrice = $this->priceInfo->getPrice(BasePrice::PRICE_CODE);
-    }
+    private $basePrice;
 
     /**
      * Get Value
@@ -64,7 +50,7 @@ class FinalPrice extends AbstractPrice implements FinalPriceInterface
      */
     public function getValue()
     {
-        return max(0, $this->basePrice->getValue());
+        return max(0, $this->getBasePrice()->getValue());
     }
 
     /**
@@ -90,4 +76,17 @@ class FinalPrice extends AbstractPrice implements FinalPriceInterface
     {
         return $this->calculator->getAmount($this->getValue(), $this->product);
     }
+
+    /**
+     * Retrieve base price instance lazily
+     *
+     * @return BasePrice|\Magento\Framework\Pricing\Price\PriceInterface
+     */
+    protected function getBasePrice()
+    {
+        if (!$this->basePrice) {
+            $this->basePrice = $this->priceInfo->getPrice(BasePrice::PRICE_CODE);
+        }
+        return $this->basePrice;
+    }
 }
diff --git a/app/code/Magento/Catalog/Service/V1/Data/CategoryBuilder.php b/app/code/Magento/Catalog/Service/V1/Data/CategoryBuilder.php
index c8d7ba60b021cc9441351d71d498d5c311c513f2..6a4995dc7220a17240e98c44f3676a3b5ee4344c 100644
--- a/app/code/Magento/Catalog/Service/V1/Data/CategoryBuilder.php
+++ b/app/code/Magento/Catalog/Service/V1/Data/CategoryBuilder.php
@@ -24,7 +24,7 @@
 namespace Magento\Catalog\Service\V1\Data;
 
 use Magento\Framework\Api\ExtensibleObjectBuilder;
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
 
 /**
  * @codeCoverageIgnore
@@ -33,12 +33,12 @@ class CategoryBuilder extends ExtensibleObjectBuilder
 {
     /**
      * @param \Magento\Framework\Api\ObjectFactory $objectFactory
-     * @param AttributeValueBuilder $valueBuilder
+     * @param AttributeDataBuilder $valueBuilder
      * @param \Magento\Catalog\Service\V1\Category\MetadataServiceInterface $metadataService
      */
     public function __construct(
         \Magento\Framework\Api\ObjectFactory $objectFactory,
-        AttributeValueBuilder $valueBuilder,
+        AttributeDataBuilder $valueBuilder,
         \Magento\Catalog\Service\V1\Category\MetadataServiceInterface $metadataService
     ) {
         parent::__construct($objectFactory, $valueBuilder, $metadataService);
diff --git a/app/code/Magento/Catalog/Service/V1/Data/Eav/AttributeMetadataBuilder.php b/app/code/Magento/Catalog/Service/V1/Data/Eav/AttributeMetadataBuilder.php
index 8f8964e48b3ce99ab15fc8a7ef737db6471d05f9..9f88755fa0946007d222e582f6fd31e350376682 100644
--- a/app/code/Magento/Catalog/Service/V1/Data/Eav/AttributeMetadataBuilder.php
+++ b/app/code/Magento/Catalog/Service/V1/Data/Eav/AttributeMetadataBuilder.php
@@ -25,7 +25,7 @@ namespace Magento\Catalog\Service\V1\Data\Eav;
 
 use Magento\Framework\Api\ExtensibleObjectBuilder;
 use Magento\Framework\Api\AttributeMetadataBuilderInterface;
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
 use Magento\Framework\Api\MetadataServiceInterface;
 
 /**
@@ -56,7 +56,7 @@ class AttributeMetadataBuilder extends ExtensibleObjectBuilder implements Attrib
      * Initializes builder.
      *
      * @param \Magento\Framework\Api\ObjectFactory $objectFactory
-     * @param AttributeValueBuilder $valueBuilder
+     * @param AttributeDataBuilder $valueBuilder
      * @param MetadataServiceInterface $metadataService
      * @param OptionBuilder $optionBuilder
      * @param ValidationRuleBuilder $validationRuleBuilder
@@ -64,7 +64,7 @@ class AttributeMetadataBuilder extends ExtensibleObjectBuilder implements Attrib
      */
     public function __construct(
         \Magento\Framework\Api\ObjectFactory $objectFactory,
-        AttributeValueBuilder $valueBuilder,
+        AttributeDataBuilder $valueBuilder,
         MetadataServiceInterface $metadataService,
         OptionBuilder $optionBuilder,
         ValidationRuleBuilder $validationRuleBuilder,
diff --git a/app/code/Magento/Catalog/Service/V1/Data/Eav/Category/Info/MetadataBuilder.php b/app/code/Magento/Catalog/Service/V1/Data/Eav/Category/Info/MetadataBuilder.php
index 1cee62ac05eaf765a38bc394fa8054baa88718d1..af4d11ef6339411d0fcffb0cabb67f547fecc909 100644
--- a/app/code/Magento/Catalog/Service/V1/Data/Eav/Category/Info/MetadataBuilder.php
+++ b/app/code/Magento/Catalog/Service/V1/Data/Eav/Category/Info/MetadataBuilder.php
@@ -25,7 +25,7 @@
 namespace Magento\Catalog\Service\V1\Data\Eav\Category\Info;
 
 use Magento\Framework\Api\ExtensibleObjectBuilder;
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
 
 /**
  * Class MetadataBuilder
@@ -36,12 +36,12 @@ class MetadataBuilder extends ExtensibleObjectBuilder
 {
     /**
      * @param \Magento\Framework\Api\ObjectFactory $objectFactory
-     * @param AttributeValueBuilder $valueBuilder
+     * @param AttributeDataBuilder $valueBuilder
      * @param \Magento\Catalog\Service\V1\Category\MetadataServiceInterface $metadataService
      */
     public function __construct(
         \Magento\Framework\Api\ObjectFactory $objectFactory,
-        AttributeValueBuilder $valueBuilder,
+        AttributeDataBuilder $valueBuilder,
         \Magento\Catalog\Service\V1\Category\MetadataServiceInterface $metadataService
     ) {
         parent::__construct($objectFactory, $valueBuilder, $metadataService);
diff --git a/app/code/Magento/Catalog/Service/V1/Data/Product/Attribute/SearchResultsBuilder.php b/app/code/Magento/Catalog/Service/V1/Data/Product/Attribute/SearchResultsBuilder.php
index 3d00f39f349e0b14ec8aee66553262482a2a1e54..8bc3ba7c405a8c5d7868cdfb128b220d7e347ee4 100644
--- a/app/code/Magento/Catalog/Service/V1/Data/Product/Attribute/SearchResultsBuilder.php
+++ b/app/code/Magento/Catalog/Service/V1/Data/Product/Attribute/SearchResultsBuilder.php
@@ -25,7 +25,7 @@
 namespace Magento\Catalog\Service\V1\Data\Product\Attribute;
 
 use Magento\Catalog\Service\V1\Data\Eav\AttributeBuilder;
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
 use Magento\Framework\Api\MetadataServiceInterface;
 use Magento\Framework\Api\ObjectFactory;
 use Magento\Framework\Api\SearchCriteriaBuilder;
@@ -42,14 +42,14 @@ class SearchResultsBuilder extends \Magento\Framework\Api\AbstractSearchResultsB
      * Constructor
      *
      * @param ObjectFactory $objectFactory
-     * @param AttributeValueBuilder $valueBuilder
+     * @param AttributeDataBuilder $valueBuilder
      * @param MetadataServiceInterface $metadataService
      * @param SearchCriteriaBuilder $searchCriteriaBuilder
      * @param AttributeBuilder $itemObjectBuilder
      */
     public function __construct(
         ObjectFactory $objectFactory,
-        AttributeValueBuilder $valueBuilder,
+        AttributeDataBuilder $valueBuilder,
         MetadataServiceInterface $metadataService,
         SearchCriteriaBuilder $searchCriteriaBuilder,
         AttributeBuilder $itemObjectBuilder
diff --git a/app/code/Magento/Catalog/Service/V1/Data/Product/SearchResultsBuilder.php b/app/code/Magento/Catalog/Service/V1/Data/Product/SearchResultsBuilder.php
index 67ef9d794759a6da9c1068bcf291b5845c2666eb..538fc109936e1f051f9316a5ca776a1e32baff6e 100644
--- a/app/code/Magento/Catalog/Service/V1/Data/Product/SearchResultsBuilder.php
+++ b/app/code/Magento/Catalog/Service/V1/Data/Product/SearchResultsBuilder.php
@@ -24,7 +24,7 @@
 
 namespace Magento\Catalog\Service\V1\Data\Product;
 
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
 use Magento\Framework\Api\MetadataServiceInterface;
 use Magento\Framework\Api\ObjectFactory;
 use Magento\Framework\Api\SearchCriteriaBuilder;
@@ -43,14 +43,14 @@ class SearchResultsBuilder extends AbstractSearchResultsBuilder
      * Constructor
      *
      * @param ObjectFactory $objectFactory
-     * @param AttributeValueBuilder $valueBuilder
+     * @param AttributeDataBuilder $valueBuilder
      * @param MetadataServiceInterface $metadataService
      * @param SearchCriteriaBuilder $searchCriteriaBuilder
      * @param ProductBuilder $itemObjectBuilder
      */
     public function __construct(
         ObjectFactory $objectFactory,
-        AttributeValueBuilder $valueBuilder,
+        AttributeDataBuilder $valueBuilder,
         MetadataServiceInterface $metadataService,
         SearchCriteriaBuilder $searchCriteriaBuilder,
         ProductBuilder $itemObjectBuilder
diff --git a/app/code/Magento/Catalog/Service/V1/Data/ProductBuilder.php b/app/code/Magento/Catalog/Service/V1/Data/ProductBuilder.php
index f1f7977c173d061a9e6c363effce5dad3dfcfc61..84518611dc27a8070e18b22c96349e6a07ec45d7 100644
--- a/app/code/Magento/Catalog/Service/V1/Data/ProductBuilder.php
+++ b/app/code/Magento/Catalog/Service/V1/Data/ProductBuilder.php
@@ -24,7 +24,7 @@
 
 namespace Magento\Catalog\Service\V1\Data;
 
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
 
 /**
  * @codeCoverageIgnore
@@ -33,12 +33,12 @@ class ProductBuilder extends \Magento\Framework\Api\ExtensibleObjectBuilder
 {
     /**
      * @param \Magento\Framework\Api\ObjectFactory $objectFactory
-     * @param AttributeValueBuilder $valueBuilder
+     * @param AttributeDataBuilder $valueBuilder
      * @param \Magento\Catalog\Service\V1\Product\MetadataServiceInterface $metadataService
      */
     public function __construct(
         \Magento\Framework\Api\ObjectFactory $objectFactory,
-        AttributeValueBuilder $valueBuilder,
+        AttributeDataBuilder $valueBuilder,
         \Magento\Catalog\Service\V1\Product\MetadataServiceInterface $metadataService
     ) {
         parent::__construct($objectFactory, $valueBuilder, $metadataService);
diff --git a/app/code/Magento/Catalog/Service/V1/Product/CustomOptions/Data/Option/MetadataBuilder.php b/app/code/Magento/Catalog/Service/V1/Product/CustomOptions/Data/Option/MetadataBuilder.php
index d11d9083256c9f72e5f0b25d3b697cfa7a3b5cdb..45f25f13ef33079a7fcf4297ee490858cab9aba8 100644
--- a/app/code/Magento/Catalog/Service/V1/Product/CustomOptions/Data/Option/MetadataBuilder.php
+++ b/app/code/Magento/Catalog/Service/V1/Product/CustomOptions/Data/Option/MetadataBuilder.php
@@ -24,7 +24,7 @@
 
 namespace Magento\Catalog\Service\V1\Product\CustomOptions\Data\Option;
 
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
 
 /**
  * @codeCoverageIgnore
@@ -46,13 +46,13 @@ class MetadataBuilder extends \Magento\Framework\Api\ExtensibleObjectBuilder
 
     /**
      * @param \Magento\Framework\Api\ObjectFactory $objectFactory
-     * @param AttributeValueBuilder $valueBuilder
+     * @param AttributeDataBuilder $valueBuilder
      * @param \Magento\Framework\Api\Config\MetadataConfig $metadataService
      * @param array $customAttributeCodes
      */
     public function __construct(
         \Magento\Framework\Api\ObjectFactory $objectFactory,
-        AttributeValueBuilder $valueBuilder,
+        AttributeDataBuilder $valueBuilder,
         \Magento\Framework\Api\Config\MetadataConfig $metadataService,
         array $customAttributeCodes = array()
     ) {
diff --git a/app/code/Magento/Catalog/Service/V1/Product/Link/Data/ProductLinkBuilder.php b/app/code/Magento/Catalog/Service/V1/Product/Link/Data/ProductLinkBuilder.php
index f74eecf46457d4c73b113e3c508578a204c6d995..c0c571ba59033058a35f18ff1554680f7f956ad0 100644
--- a/app/code/Magento/Catalog/Service/V1/Product/Link/Data/ProductLinkBuilder.php
+++ b/app/code/Magento/Catalog/Service/V1/Product/Link/Data/ProductLinkBuilder.php
@@ -24,7 +24,7 @@
 
 namespace Magento\Catalog\Service\V1\Product\Link\Data;
 
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
 
 /**
  * Builder for the ProductLink Service Data Object
@@ -41,13 +41,13 @@ class ProductLinkBuilder extends \Magento\Framework\Api\ExtensibleObjectBuilder
 
     /**
      * @param \Magento\Framework\Api\ObjectFactory $objectFactory
-     * @param AttributeValueBuilder $valueBuilder
+     * @param AttributeDataBuilder $valueBuilder
      * @param \Magento\Framework\Api\Config\MetadataConfig $metadataService
      * @param array $customAttributesCodes
      */
     public function __construct(
         \Magento\Framework\Api\ObjectFactory $objectFactory,
-        AttributeValueBuilder $valueBuilder,
+        AttributeDataBuilder $valueBuilder,
         \Magento\Framework\Api\Config\MetadataConfig $metadataService,
         array $customAttributesCodes = array()
     ) {
diff --git a/app/code/Magento/Catalog/composer.json b/app/code/Magento/Catalog/composer.json
index 079a2c5188483843f7590bfbdf0e3ceb30dc868b..4bd91b1c76fe64c01ed8de76026768ebb60c2455 100644
--- a/app/code/Magento/Catalog/composer.json
+++ b/app/code/Magento/Catalog/composer.json
@@ -3,33 +3,33 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-eav": "0.1.0-alpha103",
-        "magento/module-cms": "0.1.0-alpha103",
-        "magento/module-indexer": "0.1.0-alpha103",
-        "magento/module-customer": "0.1.0-alpha103",
-        "magento/module-core": "0.1.0-alpha103",
-        "magento/module-theme": "0.1.0-alpha103",
-        "magento/module-checkout": "0.1.0-alpha103",
-        "magento/module-log": "0.1.0-alpha103",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/module-widget": "0.1.0-alpha103",
-        "magento/module-wishlist": "0.1.0-alpha103",
-        "magento/module-tax": "0.1.0-alpha103",
-        "magento/module-msrp": "0.1.0-alpha103",
-        "magento/module-catalog-inventory": "0.1.0-alpha103",
-        "magento/module-directory": "0.1.0-alpha103",
-        "magento/module-catalog-rule": "0.1.0-alpha103",
-        "magento/module-sales": "0.1.0-alpha103",
-        "magento/module-product-alert": "0.1.0-alpha103",
-        "magento/module-url-rewrite": "0.1.0-alpha103",
-        "magento/module-catalog-url-rewrite": "0.1.0-alpha103",
-        "magento/module-page-cache": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-eav": "0.1.0-alpha104",
+        "magento/module-cms": "0.1.0-alpha104",
+        "magento/module-indexer": "0.1.0-alpha104",
+        "magento/module-customer": "0.1.0-alpha104",
+        "magento/module-core": "0.1.0-alpha104",
+        "magento/module-theme": "0.1.0-alpha104",
+        "magento/module-checkout": "0.1.0-alpha104",
+        "magento/module-log": "0.1.0-alpha104",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/module-widget": "0.1.0-alpha104",
+        "magento/module-wishlist": "0.1.0-alpha104",
+        "magento/module-tax": "0.1.0-alpha104",
+        "magento/module-msrp": "0.1.0-alpha104",
+        "magento/module-catalog-inventory": "0.1.0-alpha104",
+        "magento/module-directory": "0.1.0-alpha104",
+        "magento/module-catalog-rule": "0.1.0-alpha104",
+        "magento/module-sales": "0.1.0-alpha104",
+        "magento/module-product-alert": "0.1.0-alpha104",
+        "magento/module-url-rewrite": "0.1.0-alpha104",
+        "magento/module-catalog-url-rewrite": "0.1.0-alpha104",
+        "magento/module-page-cache": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/Catalog/etc/di.xml b/app/code/Magento/Catalog/etc/di.xml
index 3ee2a5e3df8b37ecdb2f3d2a490c215c7f21a5eb..fffae3fe39e52935688c9d3d091a6fd8cf6005f8 100644
--- a/app/code/Magento/Catalog/etc/di.xml
+++ b/app/code/Magento/Catalog/etc/di.xml
@@ -113,7 +113,6 @@
     <type name="Magento\Catalog\Model\Product">
         <arguments>
             <argument name="catalogProductStatus" xsi:type="object">Magento\Catalog\Model\Product\Attribute\Source\Status\Proxy</argument>
-            <argument name="categoryIndexer" xsi:type="object" shared="false">Magento\Indexer\Model\IndexerInterface</argument>
         </arguments>
     </type>
     <type name="Magento\Catalog\Model\Resource\Product\Collection">
@@ -180,17 +179,6 @@
             <argument name="storage" xsi:type="object">Magento\Catalog\Model\Session\Storage</argument>
         </arguments>
     </type>
-    <type name="Magento\Catalog\Model\Category">
-        <arguments>
-            <argument name="flatIndexer" xsi:type="object" shared="false">Magento\Indexer\Model\IndexerInterface</argument>
-            <argument name="productIndexer" xsi:type="object" shared="false">Magento\Indexer\Model\IndexerInterface</argument>
-        </arguments>
-    </type>
-    <type name="Magento\Catalog\Model\Indexer\Category\Flat\System\Config\Mode">
-        <arguments>
-            <argument name="flatIndexer" xsi:type="object" shared="false">Magento\Indexer\Model\IndexerInterface</argument>
-        </arguments>
-    </type>
     <type name="Magento\Store\Model\Resource\Website">
         <plugin name="priceIndexerOnWebsiteDelete" type="Magento\Catalog\Model\Indexer\Product\Price\Plugin\Website"/>
     </type>
@@ -208,24 +196,11 @@
     <type name="Magento\Customer\Service\V1\CustomerGroupServiceInterface">
         <plugin name="invalidatePriceIndexerOnCustomerGroup" type="Magento\Catalog\Model\Indexer\Product\Price\Plugin\CustomerGroup"/>
     </type>
-    <type name="Magento\Catalog\Model\Indexer\Product\Price\Plugin\AbstractPlugin">
-        <arguments>
-            <argument name="indexer" xsi:type="object" shared="false">Magento\Indexer\Model\IndexerInterface</argument>
-        </arguments>
-    </type>
-    <type name="Magento\Catalog\Model\Indexer\Product\Price\System\Config\PriceScope">
-        <arguments>
-            <argument name="indexer" xsi:type="object" shared="false">Magento\Indexer\Model\IndexerInterface</argument>
-        </arguments>
-    </type>
     <type name="Magento\Indexer\Model\Config\Data">
         <plugin name="indexerCategoryFlatConfigGet" type="Magento\Catalog\Model\Indexer\Category\Flat\Plugin\IndexerConfigData" />
         <plugin name="indexerProductFlatConfigGet" type="Magento\Catalog\Model\Indexer\Product\Flat\Plugin\IndexerConfigData" />
     </type>
     <type name="Magento\Catalog\Model\Indexer\Category\Flat">
-        <arguments>
-            <argument name="indexer" xsi:type="object" shared="false">Magento\Indexer\Model\IndexerInterface</argument>
-        </arguments>
         <plugin name="page-cache-indexer-reindex-category-flat"
                 type="Magento\Catalog\Model\Indexer\Category\AffectCache" sortOrder="10"/>
     </type>
@@ -234,17 +209,9 @@
             <argument name="defaultPriceIndexer" xsi:type="string">Magento\Catalog\Model\Resource\Product\Indexer\Price\DefaultPrice</argument>
         </arguments>
     </type>
-    <type name="Magento\Catalog\Model\Indexer\Category\Product\Plugin\StoreGroup">
-        <arguments>
-            <argument name="indexer" xsi:type="object" shared="false">Magento\Indexer\Model\IndexerInterface</argument>
-        </arguments>
-    </type>
     <type name="Magento\Eav\Model\Entity\Attribute\Set">
         <plugin name="invalidateEavIndexerOnAttributeSetSave" type="\Magento\Catalog\Model\Indexer\Product\Eav\Plugin\AttributeSet" />
     </type>
-    <type name="Magento\CatalogRule\Model\Rule">
-        <plugin name="reindexPriceOnRuleApply" type="\Magento\Catalog\Model\Indexer\Product\Price\Plugin\CatalogRule" />
-    </type>
     <type name="Magento\Catalog\Helper\Product\Flat\Indexer">
         <arguments>
             <argument name="flatAttributeGroups" xsi:type="array">
@@ -253,16 +220,10 @@
         </arguments>
     </type>
     <type name="Magento\Catalog\Model\Indexer\Category\Product">
-        <arguments>
-            <argument name="indexer" xsi:type="object" shared="false">Magento\Indexer\Model\IndexerInterface</argument>
-        </arguments>
         <plugin name="page-cache-indexer-reindex-category-product"
                 type="Magento\Catalog\Model\Indexer\Product\AffectCache" sortOrder="10"/>
     </type>
     <type name="Magento\Catalog\Model\Indexer\Product\Category">
-        <arguments>
-            <argument name="indexer" xsi:type="object" shared="false">Magento\Indexer\Model\IndexerInterface</argument>
-        </arguments>
         <plugin name="page-cache-indexer-reindex-product-category"
                 type="Magento\Catalog\Model\Indexer\Category\AffectCache" sortOrder="10"/>
     </type>
@@ -290,11 +251,6 @@
             </argument>
         </arguments>
     </type>
-    <type name="Magento\Catalog\Model\Product\Action">
-        <arguments>
-            <argument name="categoryIndexer" xsi:type="object" shared="false">Magento\Indexer\Model\IndexerInterface</argument>
-        </arguments>
-    </type>
     <virtualType name="rowsFlatTableBuilder" type="Magento\Catalog\Model\Indexer\Product\Flat\FlatTableBuilder">
         <arguments>
             <argument name="tableData" xsi:type="object">Magento\Catalog\Model\Indexer\Product\Flat\Action\Rows\TableData</argument>
@@ -335,11 +291,6 @@
             <argument name="layer" xsi:type="object">Magento\Catalog\Model\Layer\Search</argument>
         </arguments>
     </type>
-    <type name="Magento\Catalog\Model\Indexer\Product\Price\Processor">
-        <arguments>
-            <argument name="indexer" xsi:type="object" shared="false">Magento\Indexer\Model\IndexerInterface</argument>
-        </arguments>
-    </type>
     <type name="Magento\Catalog\Model\Indexer\Product\Flat">
         <plugin name="page-cache-indexer-reindex-product-flat"
                 type="Magento\Catalog\Model\Indexer\Product\AffectCache" sortOrder="10"/>
@@ -495,8 +446,16 @@
     <type name="Magento\CatalogInventory\Model\Config\Backend\ShowOutOfStock">
         <plugin name="showOutOfStockValueChanged" type="\Magento\Catalog\Model\Plugin\ShowOutOfStockConfig"/>
     </type>
-    <preference for="Magento\Catalog\Block\Category\Widget\Link" type="Magento\Catalog\Block\Widget\Link" />
-    <preference for="Magento\Catalog\Block\Product\Widget\Link" type="Magento\Catalog\Block\Widget\Link" />
+    <virtualType name="Magento\Catalog\Block\Category\Widget\Link" type="Magento\Catalog\Block\Widget\Link">
+        <arguments>
+            <argument name="entityResource" xsi:type="object">Magento\Catalog\Model\Resource\Category</argument>
+        </arguments>
+    </virtualType>
+    <virtualType name="Magento\Catalog\Block\Product\Widget\Link" type="Magento\Catalog\Block\Widget\Link">
+        <arguments>
+            <argument name="entityResource" xsi:type="object">Magento\Catalog\Model\Resource\Product</argument>
+        </arguments>
+    </virtualType>
     <type name="Magento\Framework\App\Rss\RssManagerInterface">
         <arguments>
             <argument name="dataProviders" xsi:type="array">
@@ -513,4 +472,7 @@
             <argument name="collectionFilter" xsi:type="object">Magento\Catalog\Model\Layer\Search\CollectionFilter</argument>
         </arguments>
     </type>
+    <type name="Magento\Catalog\Model\Resource\Config">
+        <plugin name="productListingAttributesCaching" type="Magento\Catalog\Plugin\Model\Resource\Config" />
+    </type>
 </config>
diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options.phtml
index 4b3ae570ece39850913994e70d63c0a59cb489dd..3657a7b9ab38cffdd26a630a405a988950114948 100644
--- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options.phtml
+++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/options.phtml
@@ -24,13 +24,13 @@
 ?>
 <?php /** @var $this \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Options */ ?>
 
-<div class="fieldset-wrapper collapsable-wrapper opened" id="product-custom-options-wrapper">
+<div class="fieldset-wrapper" id="product-custom-options-wrapper">
     <div class="fieldset-wrapper-title">
-        <strong class="title" data-toggle="collapse" data-target="#product-custom-options-content">
+        <strong class="title">
             <span><?php echo __('Custom Options') ?></span>
         </strong>
     </div>
-    <div class="fieldset-wrapper-content in collapse" id="product-custom-options-content">
+    <div class="fieldset-wrapper-content" id="product-custom-options-content">
         <fieldset class="fieldset">
             <div class="message message-error" id="dynamic-price-warning" style="display: none;">
                 <div class="message-inner">
diff --git a/app/code/Magento/CatalogImportExport/Model/Import/Product.php b/app/code/Magento/CatalogImportExport/Model/Import/Product.php
index 17653dfb665d7ebb765576f627267f37a4e2887a..2d7ba877fcc2778f3610594d4b88b4dac0440db6 100644
--- a/app/code/Magento/CatalogImportExport/Model/Import/Product.php
+++ b/app/code/Magento/CatalogImportExport/Model/Import/Product.php
@@ -480,9 +480,9 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity
     protected $dateTime;
 
     /**
-     * @var \Magento\Indexer\Model\IndexerFactory
+     * @var \Magento\Indexer\Model\IndexerRegistry
      */
-    protected $indexerFactory;
+    protected $indexerRegistry;
 
     /**
      * @var \Magento\Framework\Logger
@@ -506,24 +506,25 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity
      * @param \Magento\CatalogInventory\Service\V1\StockItemService $stockItemService
      * @param \Magento\Catalog\Helper\Data $catalogData
      * @param \Magento\ImportExport\Model\Import\Config $importConfig
-     * @param \Magento\CatalogImportExport\Model\Import\Proxy\Product\ResourceFactory $resourceFactory
-     * @param \Magento\CatalogImportExport\Model\Import\Product\OptionFactory $optionFactory
+     * @param Proxy\Product\ResourceFactory $resourceFactory
+     * @param Product\OptionFactory $optionFactory
      * @param \Magento\Eav\Model\Resource\Entity\Attribute\Set\CollectionFactory $setColFactory
      * @param \Magento\Catalog\Model\Resource\Category\CollectionFactory $categoryColFactory
      * @param \Magento\Customer\Service\V1\CustomerGroupServiceInterface $customerGroupService
      * @param \Magento\Catalog\Model\ProductFactory $productFactory
      * @param \Magento\Framework\StoreManagerInterface $storeManager
-     * @param \Magento\CatalogImportExport\Model\Import\Product\Type\Factory $productTypeFactory
+     * @param Product\Type\Factory $productTypeFactory
      * @param \Magento\Catalog\Model\Resource\Product\LinkFactory $linkFactory
-     * @param \Magento\CatalogImportExport\Model\Import\Proxy\ProductFactory $proxyProdFactory
-     * @param \Magento\CatalogImportExport\Model\Import\UploaderFactory $uploaderFactory
+     * @param Proxy\ProductFactory $proxyProdFactory
+     * @param UploaderFactory $uploaderFactory
      * @param \Magento\Framework\Filesystem $filesystem
      * @param \Magento\CatalogInventory\Model\Resource\Stock\ItemFactory $stockResItemFac
      * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate
      * @param \Magento\Framework\Stdlib\DateTime $dateTime
      * @param \Magento\Framework\Logger $logger
-     * @param \Magento\Indexer\Model\IndexerFactory $indexerFactory
+     * @param \Magento\Indexer\Model\IndexerRegistry $indexerRegistry
      * @param array $data
+     * @throws \Magento\Framework\Model\Exception
      */
     public function __construct(
         \Magento\Core\Helper\Data $coreData,
@@ -553,7 +554,7 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity
         \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate,
         \Magento\Framework\Stdlib\DateTime $dateTime,
         \Magento\Framework\Logger $logger,
-        \Magento\Indexer\Model\IndexerFactory $indexerFactory,
+        \Magento\Indexer\Model\IndexerRegistry $indexerRegistry,
         array $data = array()
     ) {
         $this->_eventManager = $eventManager;
@@ -574,7 +575,7 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity
         $this->_stockResItemFac = $stockResItemFac;
         $this->_localeDate = $localeDate;
         $this->dateTime = $dateTime;
-        $this->indexerFactory = $indexerFactory;
+        $this->indexerRegistry = $indexerRegistry;
         $this->_logger = $logger;
         parent::__construct($coreData, $importExportData, $importData, $config, $resource, $resourceHelper, $string);
         $this->_optionEntity = isset(
@@ -1759,7 +1760,7 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity
      */
     protected function _saveStockItem()
     {
-        $indexer = $this->indexerFactory->create()->load('catalog_product_category');
+        $indexer = $this->indexerRegistry->get('catalog_product_category');
         /** @var $stockResource \Magento\CatalogInventory\Model\Resource\Stock\Item */
         $stockResource = $this->_stockResItemFac->create();
         $entityTable = $stockResource->getMainTable();
diff --git a/app/code/Magento/CatalogImportExport/composer.json b/app/code/Magento/CatalogImportExport/composer.json
index 7d98b3c2e297d06b1371a17eddcd304e55dd1f4e..ce67e7ed7803745c4346c97b4f56d69292084717 100644
--- a/app/code/Magento/CatalogImportExport/composer.json
+++ b/app/code/Magento/CatalogImportExport/composer.json
@@ -3,20 +3,20 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-core": "0.1.0-alpha103",
-        "magento/module-catalog": "0.1.0-alpha103",
-        "magento/module-eav": "0.1.0-alpha103",
-        "magento/module-import-export": "0.1.0-alpha103",
-        "magento/module-indexer": "0.1.0-alpha103",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-catalog-inventory": "0.1.0-alpha103",
-        "magento/module-customer": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-core": "0.1.0-alpha104",
+        "magento/module-catalog": "0.1.0-alpha104",
+        "magento/module-eav": "0.1.0-alpha104",
+        "magento/module-import-export": "0.1.0-alpha104",
+        "magento/module-indexer": "0.1.0-alpha104",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-catalog-inventory": "0.1.0-alpha104",
+        "magento/module-customer": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "ext-ctype": "*",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/CatalogInventory/Model/Indexer/Stock.php b/app/code/Magento/CatalogInventory/Model/Indexer/Stock.php
index 7a3adacfc8aa8304cc85e8318edfc1c2bb6a36f0..68634b33f621e81ba6912fbfedc551abf672998e 100644
--- a/app/code/Magento/CatalogInventory/Model/Indexer/Stock.php
+++ b/app/code/Magento/CatalogInventory/Model/Indexer/Stock.php
@@ -87,7 +87,7 @@ class Stock implements \Magento\Indexer\Model\ActionInterface, \Magento\Framewor
      *
      * @return void
      */
-    public function executeList($ids)
+    public function executeList(array $ids)
     {
         $this->_productStockIndexerRows->execute($ids);
     }
diff --git a/app/code/Magento/CatalogInventory/Model/Observer.php b/app/code/Magento/CatalogInventory/Model/Observer.php
index d063a61a260f1aeab4ff59566a6fa609763432a5..42f82adafc319fce6e8e08daa440b4871873f04b 100644
--- a/app/code/Magento/CatalogInventory/Model/Observer.php
+++ b/app/code/Magento/CatalogInventory/Model/Observer.php
@@ -290,6 +290,7 @@ class Observer
         $stockItemDo = $this->stockItemService->getStockItem($product->getId());
         $this->stockItemService->saveStockItem(
             $this->stockItemBuilder->mergeDataObjectWithArray($stockItemDo, $stockItemData)
+                ->create()
         );
 
         return $this;
diff --git a/app/code/Magento/CatalogInventory/Service/V1/StockItemService.php b/app/code/Magento/CatalogInventory/Service/V1/StockItemService.php
index 33297adae80add1a7544753df6faa6a35e992ab8..33e1d8f1f6af5940e2340e0759106b05da773ef2 100644
--- a/app/code/Magento/CatalogInventory/Service/V1/StockItemService.php
+++ b/app/code/Magento/CatalogInventory/Service/V1/StockItemService.php
@@ -134,7 +134,7 @@ class StockItemService implements StockItemServiceInterface
         $dataToSave = $this->stockItemBuilder->mergeDataObjectWithArray(
             $stockItemDo,
             $stockItemDetailsDo->__toArray()
-        )->__toArray();
+        )->create()->__toArray();
         return $stockItem->setData($dataToSave)->save()->getId();
     }
 
diff --git a/app/code/Magento/CatalogInventory/composer.json b/app/code/Magento/CatalogInventory/composer.json
index 859be9a5e016bdc0f4d736a282890981368b437b..44c2b081b7ceb03fcd26657eb051fef45161ed5f 100644
--- a/app/code/Magento/CatalogInventory/composer.json
+++ b/app/code/Magento/CatalogInventory/composer.json
@@ -3,19 +3,19 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-catalog": "0.1.0-alpha103",
-        "magento/module-core": "0.1.0-alpha103",
-        "magento/module-customer": "0.1.0-alpha103",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/module-indexer": "0.1.0-alpha103",
-        "magento/module-sales": "0.1.0-alpha103",
-        "magento/module-eav": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-catalog": "0.1.0-alpha104",
+        "magento/module-core": "0.1.0-alpha104",
+        "magento/module-customer": "0.1.0-alpha104",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/module-indexer": "0.1.0-alpha104",
+        "magento/module-sales": "0.1.0-alpha104",
+        "magento/module-eav": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/SalesRule/sql/salesrule_setup/upgrade-1.6.0.0-1.6.0.1.php b/app/code/Magento/CatalogRule/CatalogRuleException.php
similarity index 75%
rename from app/code/Magento/SalesRule/sql/salesrule_setup/upgrade-1.6.0.0-1.6.0.1.php
rename to app/code/Magento/CatalogRule/CatalogRuleException.php
index 3e25238187764bac505a8fbd9610d1be0bfef20c..fa78a502e1c57af14563cf35013d72bcb5c921f0 100644
--- a/app/code/Magento/SalesRule/sql/salesrule_setup/upgrade-1.6.0.0-1.6.0.1.php
+++ b/app/code/Magento/CatalogRule/CatalogRuleException.php
@@ -21,13 +21,8 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\CatalogRule;
 
-/** @var $installer \Magento\Setup\Module\SetupModule */
-$installer = $this;
-$connection = $installer->getConnection();
-$connection->createTable(
-    $connection->createTableByDdl(
-        $installer->getTable('coupon_aggregated'),
-        $installer->getTable('coupon_aggregated_updated')
-    )
-);
+class CatalogRuleException extends \Exception
+{
+}
diff --git a/app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Catalog/ApplyRules.php b/app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Catalog/ApplyRules.php
index 84bd532607d09fdf6073909d90601d24ac178ce7..85e47ce124c8f43a04593a286e1302ff670d5326 100644
--- a/app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Catalog/ApplyRules.php
+++ b/app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Catalog/ApplyRules.php
@@ -48,6 +48,7 @@ class ApplyRules extends \Magento\CatalogRule\Controller\Adminhtml\Promo\Catalog
                 $this->messageManager->addError($errorMessage . ' ' . $ruleJob->getError());
             }
         } catch (\Exception $e) {
+            $this->_objectManager->create('Magento\Framework\Logger')->logException($e);
             $this->messageManager->addError($errorMessage);
         }
         $this->_redirect('catalog_rule/*');
diff --git a/app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Catalog/Delete.php b/app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Catalog/Delete.php
index d750748978eefb95b96f54af263c57f8be8cc5e8..c3506013ccfb84fe74cb05c61cf39cf0b4139223 100644
--- a/app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Catalog/Delete.php
+++ b/app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Catalog/Delete.php
@@ -36,6 +36,7 @@ class Delete extends \Magento\CatalogRule\Controller\Adminhtml\Promo\Catalog
         $id = $this->getRequest()->getParam('id');
         if ($id) {
             try {
+                /** @var \Magento\CatalogRule\Model\Rule $model */
                 $model = $this->_objectManager->create('Magento\CatalogRule\Model\Rule');
                 $model->load($id);
                 $model->delete();
diff --git a/app/code/Magento/CatalogRule/Model/Cron.php b/app/code/Magento/CatalogRule/Model/Cron.php
new file mode 100644
index 0000000000000000000000000000000000000000..bb8a302d8ea793fd16d81bfa0c33b8d0f9565697
--- /dev/null
+++ b/app/code/Magento/CatalogRule/Model/Cron.php
@@ -0,0 +1,54 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *   
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\CatalogRule\Model;
+
+class Cron
+{
+    /**
+     * @var Indexer\Rule\RuleProductProcessor
+     */
+    protected $ruleProductProcessor;
+
+    /**
+     * @param Indexer\Rule\RuleProductProcessor $ruleProductProcessor
+     */
+    public function __construct(Indexer\Rule\RuleProductProcessor $ruleProductProcessor)
+    {
+        $this->ruleProductProcessor = $ruleProductProcessor;
+    }
+
+    /**
+     * Daily update catalog price rule by cron
+     * Update include interval 3 days - current day - 1 days before + 1 days after
+     * This method is called from cron process, cron is working in UTC time and
+     * we should generate data for interval -1 day ... +1 day
+     *
+     * @return void
+     */
+    public function dailyCatalogUpdate()
+    {
+        $this->ruleProductProcessor->markIndexerAsInvalid();
+    }
+}
diff --git a/app/code/Magento/CatalogRule/Model/Indexer/AbstractIndexer.php b/app/code/Magento/CatalogRule/Model/Indexer/AbstractIndexer.php
new file mode 100644
index 0000000000000000000000000000000000000000..ff6f88d3ae78d89ec774fa9c24fd8b2b21e59a7f
--- /dev/null
+++ b/app/code/Magento/CatalogRule/Model/Indexer/AbstractIndexer.php
@@ -0,0 +1,112 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\CatalogRule\Model\Indexer;
+
+use Magento\CatalogRule\CatalogRuleException;
+use Magento\Framework\Mview\ActionInterface as MviewActionInterface;
+use Magento\Indexer\Model\ActionInterface as IndexerActionInterface;
+
+abstract class AbstractIndexer implements IndexerActionInterface, MviewActionInterface
+{
+    /**
+     * @var IndexBuilder
+     */
+    protected $indexBuilder;
+
+    /**
+     * @param IndexBuilder $indexBuilder
+     */
+    public function __construct(IndexBuilder $indexBuilder)
+    {
+        $this->indexBuilder = $indexBuilder;
+    }
+
+    /**
+     * Execute materialization on ids entities
+     *
+     * @param int[] $ids
+     * @return void
+     */
+    public function execute($ids)
+    {
+        $this->executeList($ids);
+    }
+
+    /**
+     * Execute full indexation
+     *
+     * @return void
+     */
+    public function executeFull()
+    {
+        $this->indexBuilder->reindexFull();
+    }
+
+    /**
+     * Execute partial indexation by ID list
+     *
+     * @param int[] $ids
+     * @throws CatalogRuleException
+     * @return void
+     */
+    public function executeList(array $ids)
+    {
+        if (!$ids) {
+            throw new CatalogRuleException(__('Could not rebuild index for empty products array'));
+        }
+        $this->doExecuteList($ids);
+    }
+
+    /**
+     * Execute partial indexation by ID list. Template method
+     *
+     * @param int[] $ids
+     * @return void
+     */
+    abstract protected function doExecuteList($ids);
+
+    /**
+     * Execute partial indexation by ID
+     *
+     * @param int $id
+     * @throws CatalogRuleException
+     * @return void
+     */
+    public function executeRow($id)
+    {
+        if (!$id) {
+            throw new CatalogRuleException(__('Could not rebuild index for undefined product'));
+        }
+        $this->doExecuteRow($id);
+    }
+
+    /**
+     * Execute partial indexation by ID. Template method
+     *
+     * @param int $id
+     * @throws \Magento\CatalogRule\CatalogRuleException
+     * @return void
+     */
+    abstract protected function doExecuteRow($id);
+}
diff --git a/app/code/Magento/CatalogRule/Model/Indexer/IndexBuilder.php b/app/code/Magento/CatalogRule/Model/Indexer/IndexBuilder.php
new file mode 100644
index 0000000000000000000000000000000000000000..ed866920526a2fea586c5d5095b1b0b4b7206023
--- /dev/null
+++ b/app/code/Magento/CatalogRule/Model/Indexer/IndexBuilder.php
@@ -0,0 +1,706 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\CatalogRule\Model\Indexer;
+
+use Magento\CatalogRule\CatalogRuleException;
+use Magento\CatalogRule\Model\Rule;
+use Magento\CatalogRule\Model\Resource\Rule\CollectionFactory as RuleCollectionFactory;
+use Magento\Framework\Pricing\PriceCurrencyInterface;
+use Magento\Catalog\Model\Product;
+
+class IndexBuilder
+{
+    const SECONDS_IN_DAY = 86400;
+
+    /**
+     * @var \Magento\Framework\App\Resource
+     */
+    protected $resource;
+
+    /**
+     * @var \Magento\Framework\StoreManagerInterface
+     */
+    protected $storeManager;
+
+    /**
+     * @var RuleCollectionFactory
+     */
+    protected $ruleCollectionFactory;
+
+    /**
+     * @var \Magento\Framework\Logger
+     */
+    protected $logger;
+
+    /**
+     * @var PriceCurrencyInterface
+     */
+    protected $priceCurrency;
+
+    /**
+     * @var \Magento\Eav\Model\Config
+     */
+    protected $eavConfig;
+
+    /**
+     * @var \Magento\Framework\Stdlib\DateTime
+     */
+    protected $dateFormat;
+
+    /**
+     * @var \Magento\Framework\Stdlib\DateTime\DateTime
+     */
+    protected $dateTime;
+
+    /**
+     * @var \Magento\Catalog\Model\ProductFactory
+     */
+    protected $productFactory;
+
+    /**
+     * @var Product[]
+     */
+    protected $loadedProducts;
+
+    /**
+     * @param RuleCollectionFactory $ruleCollectionFactory
+     * @param PriceCurrencyInterface $priceCurrency
+     * @param \Magento\Framework\App\Resource $resource
+     * @param \Magento\Framework\StoreManagerInterface $storeManager
+     * @param \Magento\Framework\Logger $logger
+     * @param \Magento\Eav\Model\Config $eavConfig
+     * @param \Magento\Framework\Stdlib\DateTime $dateFormat
+     * @param \Magento\Framework\Stdlib\DateTime\DateTime $dateTime
+     * @param \Magento\Catalog\Model\ProductFactory $productFactory
+     */
+    public function __construct(
+        RuleCollectionFactory $ruleCollectionFactory,
+        PriceCurrencyInterface $priceCurrency,
+        \Magento\Framework\App\Resource $resource,
+        \Magento\Framework\StoreManagerInterface $storeManager,
+        \Magento\Framework\Logger $logger,
+        \Magento\Eav\Model\Config $eavConfig,
+        \Magento\Framework\Stdlib\DateTime $dateFormat,
+        \Magento\Framework\Stdlib\DateTime\DateTime $dateTime,
+        \Magento\Catalog\Model\ProductFactory $productFactory
+    ) {
+        $this->resource = $resource;
+        $this->storeManager = $storeManager;
+        $this->ruleCollectionFactory = $ruleCollectionFactory;
+        $this->logger = $logger;
+        $this->priceCurrency = $priceCurrency;
+        $this->eavConfig = $eavConfig;
+        $this->dateFormat = $dateFormat;
+        $this->dateTime = $dateTime;
+        $this->productFactory = $productFactory;
+    }
+
+    /**
+     * Reindex by id
+     *
+     * @param int $id
+     * @return void
+     */
+    public function reindexById($id)
+    {
+        $this->reindexByIds([$id]);
+    }
+
+    /**
+     * Reindex by ids
+     *
+     * @param array $ids
+     * @throws \Magento\CatalogRule\CatalogRuleException
+     * @return void
+     */
+    public function reindexByIds(array $ids)
+    {
+        try {
+            $this->doReindexByIds($ids);
+        } catch (\Exception $e) {
+            $this->logException($e);
+            throw new CatalogRuleException($e->getMessage(), $e->getCode(), $e);
+        }
+    }
+
+    /**
+     * Reindex by ids. Template method
+     *
+     * @param array $ids
+     * @return void
+     */
+    protected function doReindexByIds($ids)
+    {
+        $this->cleanByIds($ids);
+
+        foreach ($this->getActiveRules() as $rule) {
+            foreach ($ids as $productId) {
+                $this->applyRule($rule, $this->getProduct($productId));
+            }
+        }
+    }
+
+    /**
+     * Full reindex
+     *
+     * @throws CatalogRuleException
+     * @return void
+     */
+    public function reindexFull()
+    {
+        try {
+            $this->doReindexFull();
+        } catch (\Exception $e) {
+            $this->logException($e);
+            throw new CatalogRuleException($e->getMessage(), $e->getCode(), $e);
+        }
+    }
+
+    /**
+     * Full reindex Template method
+     *
+     * @return void
+     */
+    protected function doReindexFull()
+    {
+        foreach ($this->getAllRules() as $rule) {
+            $this->updateRuleProductData($rule);
+        }
+        $this->applyAllRules();
+    }
+
+    /**
+     * Clean by product ids
+     *
+     * @param array $productIds
+     * @return void
+     */
+    protected function cleanByIds($productIds)
+    {
+        $this->getWriteAdapter()->deleteFromSelect(
+            $this->getWriteAdapter()
+                ->select($this->resource->getTableName('catalogrule_product'), 'product_id')
+                ->distinct()
+                ->where('product_id IN (?)', $productIds),
+            $this->resource->getTableName('catalogrule_product')
+        );
+
+        $this->getWriteAdapter()->deleteFromSelect(
+            $this->getWriteAdapter()->select($this->resource->getTableName('catalogrule_product_price'), 'product_id')
+                ->distinct()
+                ->where('product_id IN (?)', $productIds),
+            $this->resource->getTableName('catalogrule_product_price')
+        );
+    }
+
+    /**
+     * @param Rule $rule
+     * @param Product $product
+     * @return $this
+     * @throws \Exception
+     */
+    protected function applyRule(Rule $rule, $product)
+    {
+        $ruleId = $rule->getId();
+        $productId = $product->getId();
+        $websiteIds = array_intersect($product->getWebsiteIds(), $rule->getWebsiteIds());
+
+        $write = $this->getWriteAdapter();
+
+        $write->delete(
+            $this->resource->getTableName('catalogrule_product'),
+            array($write->quoteInto('rule_id = ?', $ruleId), $write->quoteInto('product_id = ?', $productId))
+        );
+
+        if (!$rule->getConditions()->validate($product)) {
+            $write->delete(
+                $this->resource->getTableName('catalogrule_product_price'),
+                array($write->quoteInto('product_id = ?', $productId))
+            );
+            return $this;
+        }
+
+        $customerGroupIds = $rule->getCustomerGroupIds();
+        $fromTime = strtotime($rule->getFromDate());
+        $toTime = strtotime($rule->getToDate());
+        $toTime = $toTime ? $toTime + self::SECONDS_IN_DAY - 1 : 0;
+        $sortOrder = (int)$rule->getSortOrder();
+        $actionOperator = $rule->getSimpleAction();
+        $actionAmount = $rule->getDiscountAmount();
+        $actionStop = $rule->getStopRulesProcessing();
+        $subActionOperator = $rule->getSubIsEnable() ? $rule->getSubSimpleAction() : '';
+        $subActionAmount = $rule->getSubDiscountAmount();
+
+        $rows = array();
+        try {
+            foreach ($websiteIds as $websiteId) {
+                foreach ($customerGroupIds as $customerGroupId) {
+                    $rows[] = array(
+                        'rule_id' => $ruleId,
+                        'from_time' => $fromTime,
+                        'to_time' => $toTime,
+                        'website_id' => $websiteId,
+                        'customer_group_id' => $customerGroupId,
+                        'product_id' => $productId,
+                        'action_operator' => $actionOperator,
+                        'action_amount' => $actionAmount,
+                        'action_stop' => $actionStop,
+                        'sort_order' => $sortOrder,
+                        'sub_simple_action' => $subActionOperator,
+                        'sub_discount_amount' => $subActionAmount
+                    );
+
+                    if (count($rows) == 1000) {
+                        $write->insertMultiple($this->getTable('catalogrule_product'), $rows);
+                        $rows = array();
+                    }
+                }
+            }
+
+            if (!empty($rows)) {
+                $write->insertMultiple($this->resource->getTableName('catalogrule_product'), $rows);
+            }
+        } catch (\Exception $e) {
+            throw $e;
+        }
+
+        $this->applyAllRules($product);
+
+        return $this;
+    }
+
+    /**
+     * Retrieve connection for read data
+     *
+     * @return \Magento\Framework\DB\Adapter\AdapterInterface
+     */
+    protected function getReadAdapter()
+    {
+        $writeAdapter = $this->getWriteAdapter();
+        if ($writeAdapter && $writeAdapter->getTransactionLevel() > 0) {
+            // if transaction is started we should use write connection for reading
+            return $writeAdapter;
+        }
+        return $this->resource->getConnection('read');
+    }
+
+    /**
+     * Retrieve connection for write data
+     *
+     * @return \Magento\Framework\DB\Adapter\AdapterInterface
+     */
+    protected function getWriteAdapter()
+    {
+        return $this->resource->getConnection('write');
+    }
+
+    /**
+     * @param string $tableName
+     * @return string
+     */
+    protected function getTable($tableName)
+    {
+        return $this->resource->getTableName($tableName);
+    }
+
+    /**
+     * @param Rule $rule
+     * @return $this
+     */
+    protected function updateRuleProductData(Rule $rule)
+    {
+        $ruleId = $rule->getId();
+        $write = $this->getWriteAdapter();
+        if ($rule->getProductsFilter()) {
+            $write->delete(
+                $this->getTable('catalogrule_product'),
+                array('rule_id=?' => $ruleId, 'product_id IN (?)' => $rule->getProductsFilter())
+            );
+        } else {
+            $write->delete($this->getTable('catalogrule_product'), $write->quoteInto('rule_id=?', $ruleId));
+        }
+
+        if (!$rule->getIsActive()) {
+            return $this;
+        }
+
+        $websiteIds = $rule->getWebsiteIds();
+        if (!is_array($websiteIds)) {
+            $websiteIds = explode(',', $websiteIds);
+        }
+        if (empty($websiteIds)) {
+            return $this;
+        }
+
+        \Magento\Framework\Profiler::start('__MATCH_PRODUCTS__');
+        $productIds = $rule->getMatchingProductIds();
+        \Magento\Framework\Profiler::stop('__MATCH_PRODUCTS__');
+
+        $customerGroupIds = $rule->getCustomerGroupIds();
+        $fromTime = strtotime($rule->getFromDate());
+        $toTime = strtotime($rule->getToDate());
+        $toTime = $toTime ? $toTime + self::SECONDS_IN_DAY - 1 : 0;
+        $sortOrder = (int)$rule->getSortOrder();
+        $actionOperator = $rule->getSimpleAction();
+        $actionAmount = $rule->getDiscountAmount();
+        $subActionOperator = $rule->getSubIsEnable() ? $rule->getSubSimpleAction() : '';
+        $subActionAmount = $rule->getSubDiscountAmount();
+        $actionStop = $rule->getStopRulesProcessing();
+
+        $rows = array();
+
+        foreach ($productIds as $productId => $validationByWebsite) {
+            foreach ($websiteIds as $websiteId) {
+                if (empty($validationByWebsite[$websiteId])) {
+                    continue;
+                }
+                foreach ($customerGroupIds as $customerGroupId) {
+                    $rows[] = array(
+                        'rule_id' => $ruleId,
+                        'from_time' => $fromTime,
+                        'to_time' => $toTime,
+                        'website_id' => $websiteId,
+                        'customer_group_id' => $customerGroupId,
+                        'product_id' => $productId,
+                        'action_operator' => $actionOperator,
+                        'action_amount' => $actionAmount,
+                        'action_stop' => $actionStop,
+                        'sort_order' => $sortOrder,
+                        'sub_simple_action' => $subActionOperator,
+                        'sub_discount_amount' => $subActionAmount
+                    );
+
+                    if (count($rows) == 1000) {
+                        $write->insertMultiple($this->getTable('catalogrule_product'), $rows);
+                        $rows = array();
+                    }
+                }
+            }
+        }
+        if (!empty($rows)) {
+            $write->insertMultiple($this->getTable('catalogrule_product'), $rows);
+        }
+
+        return $this;
+    }
+
+    /**
+     * @return $this
+     * @throws \Exception
+     */
+    protected function applyAllRules()
+    {
+        $write = $this->getWriteAdapter();
+
+        $fromDate = mktime(0, 0, 0, date('m'), date('d') - 1);
+        $toDate = mktime(0, 0, 0, date('m'), date('d') + 1);
+
+        $this->deleteOldData();
+
+        $dayPrices = array();
+
+        /**
+         * Update products rules prices per each website separately
+         * because of max join limit in mysql
+         */
+        foreach ($this->storeManager->getWebsites(false) as $website) {
+            $productsStmt = $this->getRuleProductsStmt($website->getId());
+
+            $dayPrices = array();
+            $stopFlags = array();
+            $prevKey = null;
+
+            while ($ruleData = $productsStmt->fetch()) {
+                $ruleProductId = $ruleData['product_id'];
+                $productKey = $ruleProductId .
+                    '_' .
+                    $ruleData['website_id'] .
+                    '_' .
+                    $ruleData['customer_group_id'];
+
+                if ($prevKey && $prevKey != $productKey) {
+                    $stopFlags = array();
+                }
+
+                /**
+                 * Build prices for each day
+                 */
+                for ($time = $fromDate; $time <= $toDate; $time += self::SECONDS_IN_DAY) {
+                    if (($ruleData['from_time'] == 0 ||
+                            $time >= $ruleData['from_time']) && ($ruleData['to_time'] == 0 ||
+                            $time <= $ruleData['to_time'])
+                    ) {
+                        $priceKey = $time . '_' . $productKey;
+
+                        if (isset($stopFlags[$priceKey])) {
+                            continue;
+                        }
+
+                        if (!isset($dayPrices[$priceKey])) {
+                            $dayPrices[$priceKey] = array(
+                                'rule_date' => $time,
+                                'website_id' => $ruleData['website_id'],
+                                'customer_group_id' => $ruleData['customer_group_id'],
+                                'product_id' => $ruleProductId,
+                                'rule_price' => $this->calcRuleProductPrice($ruleData),
+                                'latest_start_date' => $ruleData['from_time'],
+                                'earliest_end_date' => $ruleData['to_time']
+                            );
+                        } else {
+                            $dayPrices[$priceKey]['rule_price'] = $this->calcRuleProductPrice(
+                                $ruleData,
+                                $dayPrices[$priceKey]
+                            );
+                            $dayPrices[$priceKey]['latest_start_date'] = max(
+                                $dayPrices[$priceKey]['latest_start_date'],
+                                $ruleData['from_time']
+                            );
+                            $dayPrices[$priceKey]['earliest_end_date'] = min(
+                                $dayPrices[$priceKey]['earliest_end_date'],
+                                $ruleData['to_time']
+                            );
+                        }
+
+                        if ($ruleData['action_stop']) {
+                            $stopFlags[$priceKey] = true;
+                        }
+                    }
+                }
+
+                $prevKey = $productKey;
+                if (count($dayPrices) > 1000) {
+                    $this->saveRuleProductPrices($dayPrices);
+                    $dayPrices = array();
+                }
+            }
+            $this->saveRuleProductPrices($dayPrices);
+        }
+        $this->saveRuleProductPrices($dayPrices);
+
+        $write->delete($this->getTable('catalogrule_group_website'), array());
+
+        $timestamp = $this->dateTime->gmtTimestamp();
+
+        $select = $write->select()->distinct(
+            true
+        )->from(
+            $this->getTable('catalogrule_product'),
+            array('rule_id', 'customer_group_id', 'website_id')
+        )->where(
+            "{$timestamp} >= from_time AND (({$timestamp} <= to_time AND to_time > 0) OR to_time = 0)"
+        );
+        $query = $select->insertFromSelect($this->getTable('catalogrule_group_website'));
+        $write->query($query);
+
+        return $this;
+    }
+
+    /**
+     * Clean rule price index
+     *
+     * @return $this
+     */
+    protected function deleteOldData()
+    {
+        $this->getWriteAdapter()->delete($this->getTable('catalogrule_product_price'));
+        return $this;
+    }
+
+    /**
+     * @param array $ruleData
+     * @param null $productData
+     * @return float
+     */
+    protected function calcRuleProductPrice($ruleData, $productData = null)
+    {
+        if ($productData !== null && isset($productData['rule_price'])) {
+            $productPrice = $productData['rule_price'];
+        } else {
+            $productPrice = $ruleData['default_price'];
+        }
+
+        switch ($ruleData['action_operator']) {
+            case 'to_fixed':
+                $productPrice = min($ruleData['action_amount'], $productPrice);
+                break;
+            case 'to_percent':
+                $productPrice = $productPrice * $ruleData['action_amount'] / 100;
+                break;
+            case 'by_fixed':
+                $productPrice = max(0, $productPrice - $ruleData['action_amount']);
+                break;
+            case 'by_percent':
+                $productPrice = $productPrice * (1 - $ruleData['action_amount'] / 100);
+                break;
+            default:
+                $productPrice = 0;
+        }
+
+        return $this->priceCurrency->round($productPrice);
+    }
+
+    /**
+     * @param int $websiteId
+     * @return \Zend\Db\Adapter\Driver\StatementInterface|\Zend_Db_Statement_Interface
+     * @throws \Magento\Eav\Exception
+     */
+    protected function getRuleProductsStmt($websiteId)
+    {
+        $read = $this->getReadAdapter();
+        /**
+         * Sort order is important
+         * It used for check stop price rule condition.
+         * website_id   customer_group_id   product_id  sort_order
+         *  1           1                   1           0
+         *  1           1                   1           1
+         *  1           1                   1           2
+         * if row with sort order 1 will have stop flag we should exclude
+         * all next rows for same product id from price calculation
+         */
+        $select = $read->select()->from(
+            array('rp' => $this->getTable('catalogrule_product'))
+        )->order(
+            array('rp.website_id', 'rp.customer_group_id', 'rp.product_id', 'rp.sort_order', 'rp.rule_id')
+        );
+
+        /**
+         * Join default price and websites prices to result
+         */
+        $priceAttr = $this->eavConfig->getAttribute(Product::ENTITY, 'price');
+        $priceTable = $priceAttr->getBackend()->getTable();
+        $attributeId = $priceAttr->getId();
+
+        $joinCondition = '%1$s.entity_id=rp.product_id AND (%1$s.attribute_id='
+            . $attributeId
+            . ') and %1$s.store_id=%2$s';
+
+        $select->join(
+            array('pp_default' => $priceTable),
+            sprintf($joinCondition, 'pp_default', \Magento\Store\Model\Store::DEFAULT_STORE_ID),
+            array()
+        );
+
+        $website = $this->storeManager->getWebsite($websiteId);
+        $defaultGroup = $website->getDefaultGroup();
+        if ($defaultGroup instanceof \Magento\Store\Model\Group) {
+            $storeId = $defaultGroup->getDefaultStoreId();
+        } else {
+            $storeId = \Magento\Store\Model\Store::DEFAULT_STORE_ID;
+        }
+
+        $select->joinInner(
+            array('product_website' => $this->getTable('catalog_product_website')),
+            'product_website.product_id=rp.product_id '
+            . 'AND product_website.website_id = rp.website_id '
+            . 'AND product_website.website_id='
+            . $websiteId,
+            array()
+        );
+
+        $tableAlias = 'pp' . $websiteId;
+        $select->joinLeft(
+            array($tableAlias => $priceTable),
+            sprintf($joinCondition, $tableAlias, $storeId),
+            array()
+        );
+        $select->columns([
+            'default_price' => $this->getReadAdapter()->getIfNullSql($tableAlias . '.value', 'pp_default.value'),
+        ]);
+
+        return $read->query($select);
+    }
+
+    /**
+     * @param array $arrData
+     * @return $this
+     * @throws \Exception
+     */
+    protected function saveRuleProductPrices($arrData)
+    {
+        if (empty($arrData)) {
+            return $this;
+        }
+
+        $adapter = $this->getWriteAdapter();
+        $productIds = array();
+
+        try {
+            foreach ($arrData as $key => $data) {
+                $productIds['product_id'] = $data['product_id'];
+                $arrData[$key]['rule_date'] = $this->dateFormat->formatDate($data['rule_date'], false);
+                $arrData[$key]['latest_start_date'] = $this->dateFormat->formatDate($data['latest_start_date'], false);
+                $arrData[$key]['earliest_end_date'] = $this->dateFormat->formatDate($data['earliest_end_date'], false);
+            }
+            $adapter->insertOnDuplicate($this->getTable('catalogrule_affected_product'), array_unique($productIds));
+            $adapter->insertOnDuplicate($this->getTable('catalogrule_product_price'), $arrData);
+        } catch (\Exception $e) {
+            throw $e;
+        }
+
+        return $this;
+    }
+
+    /**
+     * Get active rules
+     *
+     * @return array
+     */
+    protected function getActiveRules()
+    {
+        return $this->ruleCollectionFactory->create()
+            ->addFieldToFilter('is_active', 1);
+    }
+
+    /**
+     * Get active rules
+     *
+     * @return array
+     */
+    protected function getAllRules()
+    {
+        return $this->ruleCollectionFactory->create();
+    }
+
+    /**
+     * @param int $productId
+     * @return Product
+     */
+    protected function getProduct($productId)
+    {
+        if (!isset($this->loadedProducts[$productId])) {
+            $this->loadedProducts[$productId] = $this->productFactory->create()->load($productId);
+        }
+        return $this->loadedProducts[$productId];
+    }
+
+    /**
+     * @param \Exception $e
+     * @return void
+     */
+    protected function logException($e)
+    {
+        $this->logger->logException($e);
+    }
+}
diff --git a/lib/internal/Magento/Framework/App/View/Deployment/Version/Generator/Timestamp.php b/app/code/Magento/CatalogRule/Model/Indexer/Product/ProductRuleIndexer.php
similarity index 70%
rename from lib/internal/Magento/Framework/App/View/Deployment/Version/Generator/Timestamp.php
rename to app/code/Magento/CatalogRule/Model/Indexer/Product/ProductRuleIndexer.php
index 830a001c74e656ddefca962a73590de935de2fa8..8753fb9eb7ab37f105b5ab5fe189b44028b77e80 100644
--- a/lib/internal/Magento/Framework/App/View/Deployment/Version/Generator/Timestamp.php
+++ b/app/code/Magento/CatalogRule/Model/Indexer/Product/ProductRuleIndexer.php
@@ -21,19 +21,25 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\CatalogRule\Model\Indexer\Product;
 
-namespace Magento\Framework\App\View\Deployment\Version\Generator;
+use Magento\CatalogRule\Model\Indexer\AbstractIndexer;
 
-/**
- * Generation of deployment version of static files using the timestamp
- */
-class Timestamp implements \Magento\Framework\App\View\Deployment\Version\GeneratorInterface
+class ProductRuleIndexer extends AbstractIndexer
 {
     /**
      * {@inheritdoc}
      */
-    public function generate()
+    protected function doExecuteList($ids)
+    {
+        $this->indexBuilder->reindexByIds(array_unique($ids));
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    protected function doExecuteRow($id)
     {
-        return (string)time();
+        $this->indexBuilder->reindexById($id);
     }
 }
diff --git a/app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.2-1.6.0.3.php b/app/code/Magento/CatalogRule/Model/Indexer/Product/ProductRuleProcessor.php
similarity index 74%
rename from app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.2-1.6.0.3.php
rename to app/code/Magento/CatalogRule/Model/Indexer/Product/ProductRuleProcessor.php
index 0f31627236011a835737fa2afad8369920bf20a3..c026b66b2f320bf75c3cc483e99f16b3eee437be 100644
--- a/app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.2-1.6.0.3.php
+++ b/app/code/Magento/CatalogRule/Model/Indexer/Product/ProductRuleProcessor.php
@@ -21,11 +21,14 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\CatalogRule\Model\Indexer\Product;
 
-/* @var $installer \Magento\Setup\Module\SetupModule */
-$installer = $this;
-$installer->getConnection()->addColumn(
-    $installer->getTable('sales_flat_shipment'),
-    'shipping_label',
-    array('type' => \Magento\Framework\DB\Ddl\Table::TYPE_VARBINARY, 'comment' => 'Shipping Label Content', 'length' => '2m')
-);
+use Magento\Indexer\Model\Indexer\AbstractProcessor;
+
+class ProductRuleProcessor extends AbstractProcessor
+{
+    /**
+     * Indexer id
+     */
+    const INDEXER_ID = 'catalogrule_product';
+}
diff --git a/lib/internal/Magento/Framework/Api/AttributeValueBuilder.php b/app/code/Magento/CatalogRule/Model/Indexer/Rule/RuleProductIndexer.php
similarity index 65%
rename from lib/internal/Magento/Framework/Api/AttributeValueBuilder.php
rename to app/code/Magento/CatalogRule/Model/Indexer/Rule/RuleProductIndexer.php
index e4113082c82c2128b71ddc715cafb5b11bc28617..5036adebaf53de7189808f97b63dbd367e6590ba 100644
--- a/lib/internal/Magento/Framework/Api/AttributeValueBuilder.php
+++ b/app/code/Magento/CatalogRule/Model/Indexer/Rule/RuleProductIndexer.php
@@ -21,32 +21,29 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-namespace Magento\Framework\Api;
+namespace Magento\CatalogRule\Model\Indexer\Rule;
 
-/**
- * Custom Attribute Data object builder
- */
-class AttributeValueBuilder extends AbstractSimpleObjectBuilder
+use Magento\CatalogRule\Model\Indexer\AbstractIndexer;
+
+class RuleProductIndexer extends AbstractIndexer
 {
     /**
-     * Set attribute code
+     * {@inheritdoc}
      *
-     * @param string $attributeCode
-     * @return $this
+     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
      */
-    public function setAttributeCode($attributeCode)
+    protected function doExecuteList($ids)
     {
-        return $this->_set(AttributeValue::ATTRIBUTE_CODE, $attributeCode);
+        $this->indexBuilder->reindexFull();
     }
 
     /**
-     * Set attribute value
+     * {@inheritdoc}
      *
-     * @param string $value
-     * @return $this
+     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
      */
-    public function setValue($value)
+    protected function doExecuteRow($id)
     {
-        return $this->_set(AttributeValue::VALUE, $value);
+        $this->indexBuilder->reindexFull();
     }
 }
diff --git a/app/code/Magento/Paypal/sql/paypal_setup/upgrade-1.6.0.1-1.6.0.2.php b/app/code/Magento/CatalogRule/Model/Indexer/Rule/RuleProductProcessor.php
similarity index 73%
rename from app/code/Magento/Paypal/sql/paypal_setup/upgrade-1.6.0.1-1.6.0.2.php
rename to app/code/Magento/CatalogRule/Model/Indexer/Rule/RuleProductProcessor.php
index 96281ede42f6d4a832bd786a917a9b0a691b1f42..87dee29c5ca3801cdae21d80eddbd10b3a723605 100644
--- a/app/code/Magento/Paypal/sql/paypal_setup/upgrade-1.6.0.1-1.6.0.2.php
+++ b/app/code/Magento/CatalogRule/Model/Indexer/Rule/RuleProductProcessor.php
@@ -21,12 +21,14 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\CatalogRule\Model\Indexer\Rule;
 
-/** @var $installer \Magento\Setup\Module\SetupModule */
-$installer = $this;
+use Magento\Indexer\Model\Indexer\AbstractProcessor;
 
-$installer->getConnection()->addColumn(
-    $installer->getTable('paypal_settlement_report_row'),
-    'payment_tracking_id',
-    array('type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'comment' => 'Payment Tracking ID', 'length' => '255')
-);
+class RuleProductProcessor extends AbstractProcessor
+{
+    /**
+     * Indexer id
+     */
+    const INDEXER_ID = 'catalogrule_rule';
+}
diff --git a/app/code/Magento/CatalogRule/Model/Observer.php b/app/code/Magento/CatalogRule/Model/Observer.php
index 57eb2b22bc20115be566b2d1db09f60caf54d52e..fa99c32fb1757fbb7749a8855378ee63b728c06a 100644
--- a/app/code/Magento/CatalogRule/Model/Observer.php
+++ b/app/code/Magento/CatalogRule/Model/Observer.php
@@ -30,9 +30,7 @@ namespace Magento\CatalogRule\Model;
 use Magento\Backend\Model\Session as BackendModelSession;
 use Magento\Catalog\Model\Product;
 use Magento\Catalog\Model\Resource\Product\Collection as ProductCollection;
-use Magento\CatalogRule\Model\Rule\Condition\Combine;
 use Magento\CatalogRule\Model\Rule;
-use Magento\CatalogRule\Model\Resource\Rule\Collection;
 use Magento\CatalogRule\Model\Rule\Product\Price;
 use Magento\Framework\Registry;
 use Magento\Framework\StoreManagerInterface;
@@ -40,8 +38,6 @@ use Magento\Framework\Stdlib\DateTime\TimezoneInterface;
 use Magento\Customer\Service\V1\CustomerGroupServiceInterface as Group;
 use Magento\Customer\Model\Session as CustomerModelSession;
 use Magento\Framework\Event\Observer as EventObserver;
-use Magento\Framework\Message\ManagerInterface;
-use Magento\Rule\Model\Condition\Product\AbstractProduct;
 use Magento\Framework\Stdlib\DateTime;
 
 class Observer
@@ -71,21 +67,6 @@ class Observer
      */
     protected $_productPrice;
 
-    /**
-     * @var BackendModelSession
-     */
-    protected $_backendSession;
-
-    /**
-     * @var \Magento\CatalogRule\Model\RuleFactory
-     */
-    protected $_ruleFactory;
-
-    /**
-     * @var \Magento\CatalogRule\Model\FlagFactory
-     */
-    protected $_flagFactory;
-
     /**
      * @var \Magento\CatalogRule\Model\Resource\Rule\CollectionFactory
      */
@@ -111,25 +92,16 @@ class Observer
      */
     protected $_resourceRule;
 
-    /**
-     * @var \Magento\Framework\Message\ManagerInterface
-     */
-    protected $messageManager;
-
     /**
      * @param Resource\RuleFactory $resourceRuleFactory
      * @param Resource\Rule $resourceRule
      * @param Resource\Rule\CollectionFactory $ruleCollectionFactory
-     * @param Rule\Product\Price $productPrice
-     * @param RuleFactory $ruleFactory
-     * @param FlagFactory $flagFactory
+     * @param Price $productPrice
      * @param StoreManagerInterface $storeManager
      * @param TimezoneInterface $localeDate
      * @param CustomerModelSession $customerSession
-     * @param BackendModelSession $backendSession
      * @param Registry $coreRegistry
      * @param DateTime $dateTime
-     * @param ManagerInterface $messageManager
      *
      * @SuppressWarnings(PHPMD.ExcessiveParameterList)
      */
@@ -138,87 +110,22 @@ class Observer
         Resource\Rule $resourceRule,
         Resource\Rule\CollectionFactory $ruleCollectionFactory,
         Rule\Product\Price $productPrice,
-        RuleFactory $ruleFactory,
-        FlagFactory $flagFactory,
         StoreManagerInterface $storeManager,
         TimezoneInterface $localeDate,
         CustomerModelSession $customerSession,
-        BackendModelSession $backendSession,
         Registry $coreRegistry,
-        DateTime $dateTime,
-        ManagerInterface $messageManager
+        DateTime $dateTime
     ) {
         $this->_resourceRuleFactory = $resourceRuleFactory;
         $this->_resourceRule = $resourceRule;
         $this->_ruleCollectionFactory = $ruleCollectionFactory;
         $this->_productPrice = $productPrice;
-        $this->_ruleFactory = $ruleFactory;
-        $this->_flagFactory = $flagFactory;
         $this->_storeManager = $storeManager;
         $this->_localeDate = $localeDate;
         $this->_customerSession = $customerSession;
-        $this->_backendSession = $backendSession;
         $this->_coreRegistry = $coreRegistry;
         $this->dateTime = $dateTime;
-        $this->messageManager = $messageManager;
-    }
-
-    /**
-     * Apply all catalog price rules for specific product
-     *
-     * @param EventObserver $observer
-     * @return $this|void
-     */
-    public function applyAllRulesOnProduct($observer)
-    {
-        $product = $observer->getEvent()->getProduct();
-        if ($product->getIsMassupdate()) {
-            return;
-        }
-
-        $productWebsiteIds = $product->getWebsiteIds();
-
-        $rules = $this->_ruleCollectionFactory->create()->addFieldToFilter('is_active', 1);
-
-        foreach ($rules as $rule) {
-            $websiteIds = array_intersect($productWebsiteIds, $rule->getWebsiteIds());
-            $rule->applyToProduct($product, $websiteIds);
-        }
-
-        return $this;
     }
-
-    /**
-     * Apply all price rules for current date.
-     * Handle cataolg_product_import_after event
-     *
-     * @param EventObserver $observer
-     * @return $this
-     */
-    public function applyAllRules($observer)
-    {
-        $this->_resourceRule->applyAllRulesForDateRange($this->dateTime->formatDate(mktime(0, 0, 0)));
-        $this->_flagFactory->create()->loadSelf()->setState(0)->save();
-
-        return $this;
-    }
-
-    /**
-     * Apply all catalog price rules
-     *
-     * Fire the same name process as catalog rule model
-     * Event name "apply_catalog_price_rules"
-     *
-     * @param  EventObserver $observer
-     * @return $this
-     */
-    public function processApplyAll(EventObserver $observer)
-    {
-        $this->_ruleFactory->create()->applyAll();
-        $this->_flagFactory->create()->loadSelf()->setState(0)->save();
-        return $this;
-    }
-
     /**
      * Apply catalog price rules to product on frontend
      *
@@ -304,22 +211,6 @@ class Observer
         return $this;
     }
 
-    /**
-     * Daily update catalog price rule by cron
-     * Update include interval 3 days - current day - 1 days before + 1 days after
-     * This method is called from cron process, cron is working in UTC time and
-     * we should generate data for interval -1 day ... +1 day
-     *
-     * @param EventObserver $observer
-     * @return $this
-     */
-    public function dailyCatalogUpdate($observer)
-    {
-        $this->_resourceRule->applyAllRulesForDateRange();
-
-        return $this;
-    }
-
     /**
      * Clean out calculated catalog rule prices for products
      *
@@ -360,98 +251,6 @@ class Observer
         return $this;
     }
 
-    /**
-     * Check rules that contains affected attribute
-     * If rules were found they will be set to inactive and notice will be add to admin session
-     *
-     * @param string $attributeCode
-     * @return $this
-     */
-    protected function _checkCatalogRulesAvailability($attributeCode)
-    {
-        /* @var $collection Collection */
-        $collection = $this->_ruleCollectionFactory->create()->addAttributeInConditionFilter($attributeCode);
-
-        $disabledRulesCount = 0;
-        foreach ($collection as $rule) {
-            /* @var $rule Rule */
-            $rule->setIsActive(0);
-            /* @var $rule->getConditions() Combine */
-            $this->_removeAttributeFromConditions($rule->getConditions(), $attributeCode);
-            $rule->save();
-
-            $disabledRulesCount++;
-        }
-
-        if ($disabledRulesCount) {
-            $this->_ruleFactory->create()->applyAll();
-            $this->messageManager->addWarning(
-                __(
-                    '%1 Catalog Price Rules based on "%2" attribute have been disabled.',
-                    $disabledRulesCount,
-                    $attributeCode
-                )
-            );
-        }
-
-        return $this;
-    }
-
-    /**
-     * Remove catalog attribute condition by attribute code from rule conditions
-     *
-     * @param Combine $combine
-     * @param string $attributeCode
-     * @return void
-     */
-    protected function _removeAttributeFromConditions($combine, $attributeCode)
-    {
-        $conditions = $combine->getConditions();
-        foreach ($conditions as $conditionId => $condition) {
-            if ($condition instanceof Combine) {
-                $this->_removeAttributeFromConditions($condition, $attributeCode);
-            }
-            if ($condition instanceof AbstractProduct) {
-                if ($condition->getAttribute() == $attributeCode) {
-                    unset($conditions[$conditionId]);
-                }
-            }
-        }
-        $combine->setConditions($conditions);
-    }
-
-    /**
-     * After save attribute if it is not used for promo rules already check rules for containing this attribute
-     *
-     * @param EventObserver $observer
-     * @return $this
-     */
-    public function catalogAttributeSaveAfter(EventObserver $observer)
-    {
-        $attribute = $observer->getEvent()->getAttribute();
-        if ($attribute->dataHasChangedFor('is_used_for_promo_rules') && !$attribute->getIsUsedForPromoRules()) {
-            $this->_checkCatalogRulesAvailability($attribute->getAttributeCode());
-        }
-
-        return $this;
-    }
-
-    /**
-     * After delete attribute check rules that contains deleted attribute
-     *
-     * @param EventObserver $observer
-     * @return $this
-     */
-    public function catalogAttributeDeleteAfter(EventObserver $observer)
-    {
-        $attribute = $observer->getEvent()->getAttribute();
-        if ($attribute->getIsUsedForPromoRules()) {
-            $this->_checkCatalogRulesAvailability($attribute->getAttributeCode());
-        }
-
-        return $this;
-    }
-
     /**
      * @param EventObserver $observer
      * @return $this
@@ -501,27 +300,4 @@ class Observer
 
         return $this;
     }
-
-    /**
-     * Create catalog rule relations for imported products
-     *
-     * @param EventObserver $observer
-     * @return void
-     */
-    public function createCatalogRulesRelations(EventObserver $observer)
-    {
-        $adapter = $observer->getEvent()->getAdapter();
-        $affectedEntityIds = $adapter->getAffectedEntityIds();
-
-        if (empty($affectedEntityIds)) {
-            return;
-        }
-
-        $rules = $this->_ruleCollectionFactory->create()->addFieldToFilter('is_active', 1);
-
-        foreach ($rules as $rule) {
-            $rule->setProductsFilter($affectedEntityIds);
-            $this->_resourceRule->updateRuleProductData($rule);
-        }
-    }
 }
diff --git a/app/code/Magento/CatalogRule/Model/Resource/Rule.php b/app/code/Magento/CatalogRule/Model/Resource/Rule.php
index 4640667f039827811edfc857a4268c0368e2913e..73334bc096c5520a867c53dea928f1935dc29a14 100644
--- a/app/code/Magento/CatalogRule/Model/Resource/Rule.php
+++ b/app/code/Magento/CatalogRule/Model/Resource/Rule.php
@@ -199,514 +199,25 @@ class Rule extends \Magento\Rule\Model\Resource\AbstractResource
     }
 
     /**
-     * Update products which are matched for rule
-     *
-     * @param ModelRule $rule
+     * @param \Magento\Framework\Model\AbstractModel $rule
      * @return $this
-     * @throws \Exception
      */
-    public function updateRuleProductData(ModelRule $rule)
+    protected function _afterDelete(\Magento\Framework\Model\AbstractModel $rule)
     {
-        $ruleId = $rule->getId();
         $write = $this->_getWriteAdapter();
-        $write->beginTransaction();
-        if ($rule->getProductsFilter()) {
-            $write->delete(
-                $this->getTable('catalogrule_product'),
-                array('rule_id=?' => $ruleId, 'product_id IN (?)' => $rule->getProductsFilter())
-            );
-        } else {
-            $write->delete($this->getTable('catalogrule_product'), $write->quoteInto('rule_id=?', $ruleId));
-        }
-
-        if (!$rule->getIsActive()) {
-            $write->commit();
-            return $this;
-        }
-
-        $websiteIds = $rule->getWebsiteIds();
-        if (!is_array($websiteIds)) {
-            $websiteIds = explode(',', $websiteIds);
-        }
-        if (empty($websiteIds)) {
-            return $this;
-        }
-
-        \Magento\Framework\Profiler::start('__MATCH_PRODUCTS__');
-        $productIds = $rule->getMatchingProductIds();
-        \Magento\Framework\Profiler::stop('__MATCH_PRODUCTS__');
-
-        $customerGroupIds = $rule->getCustomerGroupIds();
-        $fromTime = strtotime($rule->getFromDate());
-        $toTime = strtotime($rule->getToDate());
-        $toTime = $toTime ? $toTime + self::SECONDS_IN_DAY - 1 : 0;
-        $sortOrder = (int)$rule->getSortOrder();
-        $actionOperator = $rule->getSimpleAction();
-        $actionAmount = $rule->getDiscountAmount();
-        $subActionOperator = $rule->getSubIsEnable() ? $rule->getSubSimpleAction() : '';
-        $subActionAmount = $rule->getSubDiscountAmount();
-        $actionStop = $rule->getStopRulesProcessing();
-
-        $rows = array();
-
-        try {
-            foreach ($productIds as $productId => $validationByWebsite) {
-                foreach ($websiteIds as $websiteId) {
-                    foreach ($customerGroupIds as $customerGroupId) {
-                        if (empty($validationByWebsite[$websiteId])) {
-                            continue;
-                        }
-                        $rows[] = array(
-                            'rule_id' => $ruleId,
-                            'from_time' => $fromTime,
-                            'to_time' => $toTime,
-                            'website_id' => $websiteId,
-                            'customer_group_id' => $customerGroupId,
-                            'product_id' => $productId,
-                            'action_operator' => $actionOperator,
-                            'action_amount' => $actionAmount,
-                            'action_stop' => $actionStop,
-                            'sort_order' => $sortOrder,
-                            'sub_simple_action' => $subActionOperator,
-                            'sub_discount_amount' => $subActionAmount
-                        );
-
-                        if (count($rows) == 1000) {
-                            $write->insertMultiple($this->getTable('catalogrule_product'), $rows);
-                            $rows = array();
-                        }
-                    }
-                }
-            }
-            if (!empty($rows)) {
-                $write->insertMultiple($this->getTable('catalogrule_product'), $rows);
-            }
-
-            $write->commit();
-        } catch (\Exception $e) {
-            $write->rollback();
-            throw $e;
-        }
-
-
-        return $this;
-    }
-
-    /**
-     * Get all product ids matched for rule
-     *
-     * @param int $ruleId
-     * @return array
-     */
-    public function getRuleProductIds($ruleId)
-    {
-        $read = $this->_getReadAdapter();
-        $select = $read->select()->from(
+        $write->delete(
             $this->getTable('catalogrule_product'),
-            'product_id'
-        )->where(
-            'rule_id=?',
-            $ruleId
-        );
-
-        return $read->fetchCol($select);
-    }
-
-    /**
-     * Remove catalog rules product prices for specified date range and product
-     *
-     * @param int|string $fromDate
-     * @param int|string $toDate
-     * @param int|null $productId
-     * @return $this
-     */
-    public function removeCatalogPricesForDateRange($fromDate, $toDate, $productId = null)
-    {
-        $write = $this->_getWriteAdapter();
-        $conds = array();
-        $cond = $write->quoteInto('rule_date between ?', $this->dateTime->formatDate($fromDate));
-        $cond = $write->quoteInto($cond . ' and ?', $this->dateTime->formatDate($toDate));
-        $conds[] = $cond;
-        if (!is_null($productId)) {
-            $conds[] = $write->quoteInto('product_id=?', $productId);
-        }
-
-        /**
-         * Add information about affected products
-         * It can be used in processes which related with product price (like catalog index)
-         */
-        $select = $this->_getWriteAdapter()->select()->from(
-            $this->getTable('catalogrule_product_price'),
-            'product_id'
-        )->where(
-            implode(' AND ', $conds)
-        )->group(
-            'product_id'
-        );
-
-        $replace = $write->insertFromSelect(
-            $select,
-            $this->getTable('catalogrule_affected_product'),
-            array('product_id'),
-            true
-        );
-        $write->query($replace);
-        $write->delete($this->getTable('catalogrule_product_price'), $conds);
-        return $this;
-    }
-
-    /**
-     * Delete old price rules data
-     *
-     * @param string $date
-     * @param int|null $productId
-     * @return $this
-     */
-    public function deleteOldData($date, $productId = null)
-    {
-        $write = $this->_getWriteAdapter();
-        $conds = array();
-        $conds[] = $write->quoteInto('rule_date<?', $this->dateTime->formatDate($date));
-        if (!is_null($productId)) {
-            $conds[] = $write->quoteInto('product_id=?', $productId);
-        }
-        $write->delete($this->getTable('catalogrule_product_price'), $conds);
-        return $this;
-    }
-
-    /**
-     * Get DB resource statement for processing query result
-     *
-     * @param int $fromDate
-     * @param int $toDate
-     * @param int|null $productId
-     * @param int|null $websiteId
-     * @return \Zend_Db_Statement_Interface
-     */
-    protected function _getRuleProductsStmt($fromDate, $toDate, $productId = null, $websiteId = null)
-    {
-        $read = $this->_getReadAdapter();
-        /**
-         * Sort order is important
-         * It used for check stop price rule condition.
-         * website_id   customer_group_id   product_id  sort_order
-         *  1           1                   1           0
-         *  1           1                   1           1
-         *  1           1                   1           2
-         * if row with sort order 1 will have stop flag we should exclude
-         * all next rows for same product id from price calculation
-         */
-        $select = $read->select()->from(
-            array('rp' => $this->getTable('catalogrule_product'))
-        )->where(
-            $read->quoteInto(
-                'rp.from_time = 0 or rp.from_time <= ?',
-                $toDate
-            ) . ' OR ' . $read->quoteInto(
-                'rp.to_time = 0 or rp.to_time >= ?',
-                $fromDate
-            )
-        )->order(
-            array('rp.website_id', 'rp.customer_group_id', 'rp.product_id', 'rp.sort_order', 'rp.rule_id')
-        );
-
-        if (!is_null($productId)) {
-            $select->where('rp.product_id=?', $productId);
-        }
-
-        /**
-         * Join default price and websites prices to result
-         */
-        $priceAttr = $this->_eavConfig->getAttribute(Product::ENTITY, 'price');
-        $priceTable = $priceAttr->getBackend()->getTable();
-        $attributeId = $priceAttr->getId();
-
-        $joinCondition = '%1$s.entity_id=rp.product_id AND (%1$s.attribute_id=' .
-            $attributeId .
-            ') and %1$s.store_id=%2$s';
-
-        $select->join(
-            array('pp_default' => $priceTable),
-            sprintf($joinCondition, 'pp_default', \Magento\Store\Model\Store::DEFAULT_STORE_ID),
-            array('default_price' => 'pp_default.value')
+            array('rule_id=?' => $rule->getId())
         );
-
-        if ($websiteId !== null) {
-            $website = $this->_storeManager->getWebsite($websiteId);
-            $defaultGroup = $website->getDefaultGroup();
-            if ($defaultGroup instanceof \Magento\Store\Model\Group) {
-                $storeId = $defaultGroup->getDefaultStoreId();
-            } else {
-                $storeId = \Magento\Store\Model\Store::DEFAULT_STORE_ID;
-            }
-
-            $select->joinInner(
-                array('product_website' => $this->getTable('catalog_product_website')),
-                'product_website.product_id=rp.product_id ' .
-                'AND rp.website_id=product_website.website_id ' .
-                'AND product_website.website_id=' .
-                $websiteId,
-                array()
-            );
-
-            $tableAlias = 'pp' . $websiteId;
-            $fieldAlias = 'website_' . $websiteId . '_price';
-            $select->joinLeft(
-                array($tableAlias => $priceTable),
-                sprintf($joinCondition, $tableAlias, $storeId),
-                array($fieldAlias => $tableAlias . '.value')
-            );
-        } else {
-            foreach ($this->_storeManager->getWebsites() as $website) {
-                $websiteId = $website->getId();
-                $defaultGroup = $website->getDefaultGroup();
-                if ($defaultGroup instanceof \Magento\Store\Model\Group) {
-                    $storeId = $defaultGroup->getDefaultStoreId();
-                } else {
-                    $storeId = \Magento\Store\Model\Store::DEFAULT_STORE_ID;
-                }
-
-                $tableAlias = 'pp' . $websiteId;
-                $fieldAlias = 'website_' . $websiteId . '_price';
-                $select->joinLeft(
-                    array($tableAlias => $priceTable),
-                    sprintf($joinCondition, $tableAlias, $storeId),
-                    array($fieldAlias => $tableAlias . '.value')
-                );
-            }
-        }
-
-        return $read->query($select);
-    }
-
-    /**
-     * Generate catalog price rules prices for specified date range
-     * If from date is not defined - will be used previous day by UTC
-     * If to date is not defined - will be used next day by UTC
-     *
-     * @param int|string|null $fromDate
-     * @param int|string|null $toDate
-     * @param int $productId
-     * @return $this
-     * @throws \Exception
-     */
-    public function applyAllRulesForDateRange($fromDate = null, $toDate = null, $productId = null)
-    {
-        $write = $this->_getWriteAdapter();
-        $write->beginTransaction();
-
-        $this->_eventManager->dispatch('catalogrule_before_apply', array('resource' => $this));
-
-        $clearOldData = false;
-        if ($fromDate === null) {
-            $fromDate = mktime(0, 0, 0, date('m'), date('d') - 1);
-            /**
-             * If fromDate not specified we can delete all data oldest than 1 day
-             * We have run it for clear table in case when cron was not installed
-             * and old data exist in table
-             */
-            $clearOldData = true;
-        }
-        if (is_string($fromDate)) {
-            $fromDate = strtotime($fromDate);
-        }
-        if ($toDate === null) {
-            $toDate = mktime(0, 0, 0, date('m'), date('d') + 1);
-        }
-        if (is_string($toDate)) {
-            $toDate = strtotime($toDate);
-        }
-
-        $product = null;
-        if ($productId instanceof Product) {
-            $product = $productId;
-            $productId = $productId->getId();
-        }
-
-        $this->removeCatalogPricesForDateRange($fromDate, $toDate, $productId);
-        if ($clearOldData) {
-            $this->deleteOldData($fromDate, $productId);
-        }
-
-        $dayPrices = array();
-
-        try {
-            /**
-             * Update products rules prices per each website separately
-             * because of max join limit in mysql
-             */
-            foreach ($this->_storeManager->getWebsites(false) as $website) {
-                $productsStmt = $this->_getRuleProductsStmt($fromDate, $toDate, $productId, $website->getId());
-
-                $dayPrices = array();
-                $stopFlags = array();
-                $prevKey = null;
-
-                while ($ruleData = $productsStmt->fetch()) {
-                    $ruleProductId = $ruleData['product_id'];
-                    $productKey = $ruleProductId .
-                        '_' .
-                        $ruleData['website_id'] .
-                        '_' .
-                        $ruleData['customer_group_id'];
-
-                    if ($prevKey && $prevKey != $productKey) {
-                        $stopFlags = array();
-                    }
-
-                    /**
-                     * Build prices for each day
-                     */
-                    for ($time = $fromDate; $time <= $toDate; $time += self::SECONDS_IN_DAY) {
-                        if (($ruleData['from_time'] == 0 ||
-                            $time >= $ruleData['from_time']) && ($ruleData['to_time'] == 0 ||
-                            $time <= $ruleData['to_time'])
-                        ) {
-                            $priceKey = $time . '_' . $productKey;
-
-                            if (isset($stopFlags[$priceKey])) {
-                                continue;
-                            }
-
-                            if (!isset($dayPrices[$priceKey])) {
-                                $dayPrices[$priceKey] = array(
-                                    'rule_date' => $time,
-                                    'website_id' => $ruleData['website_id'],
-                                    'customer_group_id' => $ruleData['customer_group_id'],
-                                    'product_id' => $ruleProductId,
-                                    'rule_price' => $this->_calcRuleProductPrice($ruleData),
-                                    'latest_start_date' => $ruleData['from_time'],
-                                    'earliest_end_date' => $ruleData['to_time']
-                                );
-                            } else {
-                                $dayPrices[$priceKey]['rule_price'] = $this->_calcRuleProductPrice(
-                                    $ruleData,
-                                    $dayPrices[$priceKey]
-                                );
-                                $dayPrices[$priceKey]['latest_start_date'] = max(
-                                    $dayPrices[$priceKey]['latest_start_date'],
-                                    $ruleData['from_time']
-                                );
-                                $dayPrices[$priceKey]['earliest_end_date'] = min(
-                                    $dayPrices[$priceKey]['earliest_end_date'],
-                                    $ruleData['to_time']
-                                );
-                            }
-
-                            if ($ruleData['action_stop']) {
-                                $stopFlags[$priceKey] = true;
-                            }
-                        }
-                    }
-
-                    $prevKey = $productKey;
-                    if (count($dayPrices) > 1000) {
-                        $this->_saveRuleProductPrices($dayPrices);
-                        $dayPrices = array();
-                    }
-                }
-                $this->_saveRuleProductPrices($dayPrices);
-            }
-            $this->_saveRuleProductPrices($dayPrices);
-
-            $write->delete($this->getTable('catalogrule_group_website'), array());
-
-            $timestamp = $this->_coreDate->gmtTimestamp();
-
-            $select = $write->select()->distinct(
-                true
-            )->from(
-                $this->getTable('catalogrule_product'),
-                array('rule_id', 'customer_group_id', 'website_id')
-            )->where(
-                "{$timestamp} >= from_time AND (({$timestamp} <= to_time AND to_time > 0) OR to_time = 0)"
-            );
-            $query = $select->insertFromSelect($this->getTable('catalogrule_group_website'));
-            $write->query($query);
-
-            $write->commit();
-        } catch (\Exception $e) {
-            $this->_logger->logException($e);
-            $write->rollback();
-            throw $e;
-        }
-
-        $productCondition = $this->_conditionFactory->create()->setTable(
-            $this->getTable('catalogrule_affected_product')
-        )->setPkFieldName(
-            'product_id'
-        );
-        $this->_eventManager->dispatch(
-            'catalogrule_after_apply',
-            array('product' => $product, 'product_condition' => $productCondition)
+        $write->delete(
+            $this->getTable('catalogrule_customer_group'),
+            array('rule_id=?' => $rule->getId())
         );
-        $write->delete($this->getTable('catalogrule_affected_product'));
-
-        return $this;
-    }
-
-    /**
-     * Calculate product price based on price rule data and previous information
-     *
-     * @param array $ruleData
-     * @param null|array $productData
-     * @return float
-     */
-    protected function _calcRuleProductPrice($ruleData, $productData = null)
-    {
-        if ($productData !== null && isset($productData['rule_price'])) {
-            $productPrice = $productData['rule_price'];
-        } else {
-            $websiteId = $ruleData['website_id'];
-            if (isset($ruleData['website_' . $websiteId . '_price'])) {
-                $productPrice = $ruleData['website_' . $websiteId . '_price'];
-            } else {
-                $productPrice = $ruleData['default_price'];
-            }
-        }
-
-        $productPrice = $this->_catalogRuleData->calcPriceRule(
-            $ruleData['action_operator'],
-            $ruleData['action_amount'],
-            $productPrice
+        $write->delete(
+            $this->getTable('catalogrule_group_website'),
+            array('rule_id=?' => $rule->getId())
         );
-
-        return $this->priceCurrency->round($productPrice);
-    }
-
-    /**
-     * Save rule prices for products to DB
-     *
-     * @param array $arrData
-     * @return $this
-     * @throws \Exception
-     */
-    protected function _saveRuleProductPrices($arrData)
-    {
-        if (empty($arrData)) {
-            return $this;
-        }
-
-        $adapter = $this->_getWriteAdapter();
-        $productIds = array();
-
-        $adapter->beginTransaction();
-        try {
-            foreach ($arrData as $key => $data) {
-                $productIds['product_id'] = $data['product_id'];
-                $arrData[$key]['rule_date'] = $this->dateTime->formatDate($data['rule_date'], false);
-                $arrData[$key]['latest_start_date'] = $this->dateTime->formatDate($data['latest_start_date'], false);
-                $arrData[$key]['earliest_end_date'] = $this->dateTime->formatDate($data['earliest_end_date'], false);
-            }
-            $adapter->insertOnDuplicate($this->getTable('catalogrule_affected_product'), array_unique($productIds));
-            $adapter->insertOnDuplicate($this->getTable('catalogrule_product_price'), $arrData);
-        } catch (\Exception $e) {
-            $adapter->rollback();
-            throw $e;
-        }
-        $adapter->commit();
-
-        return $this;
+        return parent::_afterDelete($rule);
     }
 
     /**
@@ -797,119 +308,4 @@ class Rule extends \Magento\Rule\Model\Resource\AbstractResource
 
         return $adapter->fetchAll($select);
     }
-
-    /**
-     * Retrieve product price data for all customer groups
-     *
-     * @param int|string $date
-     * @param int $wId
-     * @param int $pId
-     * @return array
-     */
-    public function getRulesForProduct($date, $wId, $pId)
-    {
-        $read = $this->_getReadAdapter();
-        $select = $read->select()->from(
-            $this->getTable('catalogrule_product_price'),
-            '*'
-        )->where(
-            'rule_date=?',
-            $this->dateTime->formatDate($date, false)
-        )->where(
-            'website_id=?',
-            $wId
-        )->where(
-            'product_id=?',
-            $pId
-        );
-
-        return $read->fetchAll($select);
-    }
-
-    /**
-     * Apply catalog rule to product
-     *
-     * @param ModelRule $rule
-     * @param Product $product
-     * @param array $websiteIds
-     * @return $this
-     * @throws \Exception
-     */
-    public function applyToProduct($rule, $product, $websiteIds)
-    {
-        if (!$rule->getIsActive()) {
-            return $this;
-        }
-
-        $ruleId = $rule->getId();
-        $productId = $product->getId();
-
-        $write = $this->_getWriteAdapter();
-        $write->beginTransaction();
-
-        $write->delete(
-            $this->getTable('catalogrule_product'),
-            array($write->quoteInto('rule_id=?', $ruleId), $write->quoteInto('product_id=?', $productId))
-        );
-
-        if (!$rule->getConditions()->validate($product)) {
-            $write->delete(
-                $this->getTable('catalogrule_product_price'),
-                array($write->quoteInto('product_id=?', $productId))
-            );
-            $write->commit();
-            return $this;
-        }
-
-        $customerGroupIds = $rule->getCustomerGroupIds();
-        $fromTime = strtotime($rule->getFromDate());
-        $toTime = strtotime($rule->getToDate());
-        $toTime = $toTime ? $toTime + self::SECONDS_IN_DAY - 1 : 0;
-        $sortOrder = (int)$rule->getSortOrder();
-        $actionOperator = $rule->getSimpleAction();
-        $actionAmount = $rule->getDiscountAmount();
-        $actionStop = $rule->getStopRulesProcessing();
-        $subActionOperator = $rule->getSubIsEnable() ? $rule->getSubSimpleAction() : '';
-        $subActionAmount = $rule->getSubDiscountAmount();
-
-        $rows = array();
-        try {
-            foreach ($websiteIds as $websiteId) {
-                foreach ($customerGroupIds as $customerGroupId) {
-                    $rows[] = array(
-                        'rule_id' => $ruleId,
-                        'from_time' => $fromTime,
-                        'to_time' => $toTime,
-                        'website_id' => $websiteId,
-                        'customer_group_id' => $customerGroupId,
-                        'product_id' => $productId,
-                        'action_operator' => $actionOperator,
-                        'action_amount' => $actionAmount,
-                        'action_stop' => $actionStop,
-                        'sort_order' => $sortOrder,
-                        'sub_simple_action' => $subActionOperator,
-                        'sub_discount_amount' => $subActionAmount
-                    );
-
-                    if (count($rows) == 1000) {
-                        $write->insertMultiple($this->getTable('catalogrule_product'), $rows);
-                        $rows = array();
-                    }
-                }
-            }
-
-            if (!empty($rows)) {
-                $write->insertMultiple($this->getTable('catalogrule_product'), $rows);
-            }
-        } catch (\Exception $e) {
-            $write->rollback();
-            throw $e;
-        }
-
-        $this->applyAllRulesForDateRange(null, null, $product);
-
-        $write->commit();
-
-        return $this;
-    }
 }
diff --git a/app/code/Magento/CatalogRule/Model/Rule.php b/app/code/Magento/CatalogRule/Model/Rule.php
index 9de825124395bd20ef3110c10bd35d43986853ee..e3cf9fef46c97bbfaf819d47b421118ade36e406 100644
--- a/app/code/Magento/CatalogRule/Model/Rule.php
+++ b/app/code/Magento/CatalogRule/Model/Rule.php
@@ -353,49 +353,6 @@ class Rule extends \Magento\Rule\Model\AbstractModel
         return $map;
     }
 
-    /**
-     * Apply rule to product
-     *
-     * @param int|Product $product
-     * @param array|null $websiteIds
-     *
-     * @return void
-     */
-    public function applyToProduct($product, $websiteIds = null)
-    {
-        if (is_numeric($product)) {
-            $product = $this->_productFactory->create()->load($product);
-        }
-        if (is_null($websiteIds)) {
-            $websiteIds = $this->getWebsiteIds();
-        }
-        $this->getResource()->applyToProduct($this, $product, $websiteIds);
-    }
-
-    /**
-     * Apply all price rules, invalidate related cache and refresh price index
-     *
-     * @return void
-     */
-    public function applyAll()
-    {
-        $this->getResourceCollection()->walk(array($this->_getResource(), 'updateRuleProductData'));
-        $this->_getResource()->applyAllRulesForDateRange();
-        $this->_invalidateCache();
-    }
-
-    /**
-     * Apply all price rules to product
-     *
-     * @param  int|Product $product
-     * @return void
-     */
-    public function applyAllRulesToProduct($product)
-    {
-        $this->_getResource()->applyAllRulesForDateRange(null, null, $product);
-        $this->_invalidateCache();
-    }
-
     /**
      * Calculate price using catalog price rule of product
      *
diff --git a/app/code/Magento/CatalogRule/Model/Rule/Condition/Combine.php b/app/code/Magento/CatalogRule/Model/Rule/Condition/Combine.php
index 4bbb44aeb16a348b85f48b07fb839083e17bdb4b..a2aba9530c09e1abd6b6eabdab7075c61f5e0bea 100644
--- a/app/code/Magento/CatalogRule/Model/Rule/Condition/Combine.php
+++ b/app/code/Magento/CatalogRule/Model/Rule/Condition/Combine.php
@@ -83,6 +83,7 @@ class Combine extends \Magento\Rule\Model\Condition\Combine
     public function collectValidatedAttributes($productCollection)
     {
         foreach ($this->getConditions() as $condition) {
+            /** @var Product|Combine $condition */
             $condition->collectValidatedAttributes($productCollection);
         }
         return $this;
diff --git a/app/code/Magento/CatalogRule/Model/Rule/Job.php b/app/code/Magento/CatalogRule/Model/Rule/Job.php
index fa1609f4c96ba019e4f7cfb08cef87198748e159..98201f457b9661eb56987c3af5a17e97b1ea1433 100644
--- a/app/code/Magento/CatalogRule/Model/Rule/Job.php
+++ b/app/code/Magento/CatalogRule/Model/Rule/Job.php
@@ -40,23 +40,23 @@
  */
 namespace Magento\CatalogRule\Model\Rule;
 
+use Magento\CatalogRule\Model\Indexer\Rule\RuleProductProcessor;
+
 class Job extends \Magento\Framework\Object
 {
     /**
-     * Instance of event manager model
-     *
-     * @var \Magento\Framework\Event\ManagerInterface
+     * @var RuleProductProcessor
      */
-    protected $_eventManager;
+    protected $ruleProcessor;
 
     /**
      * Basic object initialization
      *
-     * @param \Magento\Framework\Event\ManagerInterface $eventManager
+     * @param RuleProductProcessor $ruleProcessor
      */
-    public function __construct(\Magento\Framework\Event\ManagerInterface $eventManager)
+    public function __construct(RuleProductProcessor $ruleProcessor)
     {
-        $this->_eventManager = $eventManager;
+        $this->ruleProcessor = $ruleProcessor;
     }
 
     /**
@@ -67,8 +67,8 @@ class Job extends \Magento\Framework\Object
     public function applyAll()
     {
         try {
-            $this->_eventManager->dispatch('catalogrule_apply_all');
-            $this->setSuccess(__('The rules have been applied.'));
+            $this->ruleProcessor->markIndexerAsInvalid();
+            $this->setSuccess(__('Updated rules applied.'));
         } catch (\Magento\Framework\Model\Exception $e) {
             $this->setError($e->getMessage());
         }
diff --git a/app/code/Magento/CatalogRule/Plugin/Indexer/Category.php b/app/code/Magento/CatalogRule/Plugin/Indexer/Category.php
new file mode 100644
index 0000000000000000000000000000000000000000..68cd1451cec16590b3af9eb87a982ac90a622400
--- /dev/null
+++ b/app/code/Magento/CatalogRule/Plugin/Indexer/Category.php
@@ -0,0 +1,77 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *   
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\CatalogRule\Plugin\Indexer;
+
+use Magento\CatalogRule\Model\Indexer\Product\ProductRuleProcessor;
+
+class Category
+{
+    /**
+     * @var ProductRuleProcessor
+     */
+    protected $productRuleProcessor;
+
+    /**
+     * @param ProductRuleProcessor $productRuleProcessor
+     */
+    public function __construct(
+        ProductRuleProcessor $productRuleProcessor
+    ) {
+        $this->productRuleProcessor = $productRuleProcessor;
+    }
+
+    /**
+     * @param \Magento\Catalog\Model\Category $subject
+     * @param \Magento\Catalog\Model\Category $result
+     * @return \Magento\Catalog\Model\Category
+     *
+     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+     */
+    public function afterSave(
+        \Magento\Catalog\Model\Category $subject,
+        \Magento\Catalog\Model\Category $result
+    ) {
+        /** @var \Magento\Catalog\Model\Category $result */
+        $productIds = $result->getAffectedProductIds();
+        if ($productIds) {
+            $this->productRuleProcessor->reindexList($productIds);
+        }
+        return $result;
+    }
+
+    /**
+     * @param \Magento\Catalog\Model\Category $subject
+     * @param \Magento\Catalog\Model\Category $result
+     * @return \Magento\Catalog\Model\Category
+     *
+     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+     */
+    public function afterDelete(
+        \Magento\Catalog\Model\Category $subject,
+        \Magento\Catalog\Model\Category $result
+    ) {
+        $this->productRuleProcessor->markIndexerAsInvalid();
+        return $result;
+    }
+}
diff --git a/app/code/Magento/CatalogRule/Plugin/Indexer/CustomerGroup.php b/app/code/Magento/CatalogRule/Plugin/Indexer/CustomerGroup.php
new file mode 100644
index 0000000000000000000000000000000000000000..9d6624cfb0626d5c8a66d2782b5388a44246c88a
--- /dev/null
+++ b/app/code/Magento/CatalogRule/Plugin/Indexer/CustomerGroup.php
@@ -0,0 +1,58 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *   
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\CatalogRule\Plugin\Indexer;
+
+use Magento\CatalogRule\Model\Indexer\Rule\RuleProductProcessor;
+use Magento\Customer\Model\Group;
+
+class CustomerGroup
+{
+    /**
+     * @var RuleProductProcessor
+     */
+    protected $ruleProductProcessor;
+
+    /**
+     * @param RuleProductProcessor $ruleProductProcessor
+     */
+    public function __construct(RuleProductProcessor $ruleProductProcessor)
+    {
+        $this->ruleProductProcessor = $ruleProductProcessor;
+    }
+
+    /**
+     * @param Group $subject
+     * @param Group $result
+     * @return Group
+     *
+     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+     */
+    public function afterDelete(
+        Group $subject,
+        Group $result
+    ) {
+        $this->ruleProductProcessor->markIndexerAsInvalid();
+        return $result;
+    }
+}
diff --git a/app/code/Magento/CatalogRule/Plugin/Indexer/ImportExport.php b/app/code/Magento/CatalogRule/Plugin/Indexer/ImportExport.php
new file mode 100644
index 0000000000000000000000000000000000000000..ee191b2bf555238827547f5191af1b6eab35f908
--- /dev/null
+++ b/app/code/Magento/CatalogRule/Plugin/Indexer/ImportExport.php
@@ -0,0 +1,58 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\CatalogRule\Plugin\Indexer;
+
+use Magento\CatalogRule\Model\Indexer\Rule\RuleProductProcessor;
+use Magento\ImportExport\Model\Import;
+
+class ImportExport
+{
+    /**
+     * @var RuleProductProcessor
+     */
+    protected $ruleProductProcessor;
+
+    /**
+     * @param RuleProductProcessor $ruleProductProcessor
+     */
+    public function __construct(RuleProductProcessor $ruleProductProcessor)
+    {
+        $this->ruleProductProcessor = $ruleProductProcessor;
+    }
+
+    /**
+     * Invalidate catalog price rule indexer
+     *
+     * @param Import $subject
+     * @param bool $result
+     * @return bool
+     *
+     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+     */
+    public function afterImportSource(Import $subject, $result)
+    {
+        $this->ruleProductProcessor->markIndexerAsInvalid();
+        return $result;
+    }
+}
diff --git a/app/code/Magento/CatalogRule/Plugin/Indexer/Product/Attribute.php b/app/code/Magento/CatalogRule/Plugin/Indexer/Product/Attribute.php
new file mode 100644
index 0000000000000000000000000000000000000000..38a192a211299a01a913e5771e869b82eda7614a
--- /dev/null
+++ b/app/code/Magento/CatalogRule/Plugin/Indexer/Product/Attribute.php
@@ -0,0 +1,158 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *   
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\CatalogRule\Plugin\Indexer\Product;
+
+use Magento\CatalogRule\Model\Rule;
+use Magento\CatalogRule\Model\Indexer\Rule\RuleProductProcessor;
+use Magento\CatalogRule\Model\Rule\Condition\Combine;
+use Magento\CatalogRule\Model\Resource\Rule\CollectionFactory as RuleCollectionFactory;
+use Magento\Rule\Model\Condition\Product\AbstractProduct;
+use Magento\Framework\Message\ManagerInterface;
+
+class Attribute
+{
+    /**
+     * @var RuleCollectionFactory
+     */
+    protected $ruleCollectionFactory;
+
+    /**
+     * @var RuleProductProcessor
+     */
+    protected $ruleProductProcessor;
+
+    /**
+     * @var ManagerInterface
+     */
+    protected $messageManager;
+
+    /**
+     * @param RuleCollectionFactory $ruleCollectionFactory
+     * @param RuleProductProcessor $ruleProductProcessor
+     * @param ManagerInterface $messageManager
+     */
+    public function __construct(
+        RuleCollectionFactory $ruleCollectionFactory,
+        RuleProductProcessor $ruleProductProcessor,
+        ManagerInterface $messageManager
+    ) {
+        $this->ruleCollectionFactory = $ruleCollectionFactory;
+        $this->ruleProductProcessor = $ruleProductProcessor;
+        $this->messageManager = $messageManager;
+    }
+
+    /**
+     * @param \Magento\Catalog\Model\Resource\Eav\Attribute $subject
+     * @param \Magento\Catalog\Model\Resource\Eav\Attribute $attribute
+     * @return \Magento\Catalog\Model\Resource\Eav\Attribute
+     *
+     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+     */
+    public function afterSave(
+        \Magento\Catalog\Model\Resource\Eav\Attribute $subject,
+        \Magento\Catalog\Model\Resource\Eav\Attribute $attribute
+    ) {
+        if ($attribute->dataHasChangedFor('is_used_for_promo_rules') && !$attribute->getIsUsedForPromoRules()) {
+            $this->checkCatalogRulesAvailability($attribute->getAttributeCode());
+        }
+        return $attribute;
+    }
+
+    /**
+     * @param \Magento\Catalog\Model\Resource\Eav\Attribute $subject
+     * @param \Magento\Catalog\Model\Resource\Eav\Attribute $attribute
+     * @return \Magento\Catalog\Model\Resource\Eav\Attribute
+     *
+     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+     */
+    public function afterDelete(
+        \Magento\Catalog\Model\Resource\Eav\Attribute $subject,
+        \Magento\Catalog\Model\Resource\Eav\Attribute $attribute
+    ) {
+        if ($attribute->getIsUsedForPromoRules()) {
+            $this->checkCatalogRulesAvailability($attribute->getAttributeCode());
+        }
+        return $attribute;
+    }
+
+    /**
+     * Check rules that contains affected attribute
+     * If rules were found they will be set to inactive and notice will be add to admin session
+     *
+     * @param string $attributeCode
+     * @return $this
+     */
+    protected function checkCatalogRulesAvailability($attributeCode)
+    {
+        /* @var $collection RuleCollectionFactory */
+        $collection = $this->ruleCollectionFactory->create()->addAttributeInConditionFilter($attributeCode);
+
+        $disabledRulesCount = 0;
+        foreach ($collection as $rule) {
+            /* @var $rule Rule */
+            $rule->setIsActive(0);
+            /* @var $rule->getConditions() Combine */
+            $this->removeAttributeFromConditions($rule->getConditions(), $attributeCode);
+            $rule->save();
+
+            $disabledRulesCount++;
+        }
+
+        if ($disabledRulesCount) {
+            $this->ruleProductProcessor->markIndexerAsInvalid();
+            $this->messageManager->addWarning(
+                __(
+                    '%1 Catalog Price Rules based on "%2" attribute have been disabled.',
+                    $disabledRulesCount,
+                    $attributeCode
+                )
+            );
+        }
+
+        return $this;
+    }
+
+    /**
+     * Remove catalog attribute condition by attribute code from rule conditions
+     *
+     * @param Combine $combine
+     * @param string $attributeCode
+     * @return void
+     */
+    protected function removeAttributeFromConditions(Combine $combine, $attributeCode)
+    {
+        $conditions = $combine->getConditions();
+        foreach ($conditions as $conditionId => $condition) {
+            if ($condition instanceof Combine) {
+                $this->removeAttributeFromConditions($condition, $attributeCode);
+            }
+            if ($condition instanceof AbstractProduct) {
+                if ($condition->getAttribute() == $attributeCode) {
+                    unset($conditions[$conditionId]);
+                }
+            }
+        }
+        $combine->setConditions($conditions);
+    }
+}
diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Price/Plugin/CatalogRule.php b/app/code/Magento/CatalogRule/Plugin/Indexer/Product/PriceIndexer.php
similarity index 50%
rename from app/code/Magento/Catalog/Model/Indexer/Product/Price/Plugin/CatalogRule.php
rename to app/code/Magento/CatalogRule/Plugin/Indexer/Product/PriceIndexer.php
index 24ca0a08bcc97f4cc95006c23180cc0cced89039..8c5464a76ce70a7f8c1503e6015740a63b1d0d21 100644
--- a/app/code/Magento/Catalog/Model/Indexer/Product/Price/Plugin/CatalogRule.php
+++ b/app/code/Magento/CatalogRule/Plugin/Indexer/Product/PriceIndexer.php
@@ -17,94 +17,72 @@
  * Do not edit or add to this file if you wish to upgrade Magento to newer
  * versions in the future. If you wish to customize Magento for your
  * needs please refer to http://www.magentocommerce.com for more information.
- *
+ *   
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
-namespace Magento\Catalog\Model\Indexer\Product\Price\Plugin;
 
-class CatalogRule
+namespace Magento\CatalogRule\Plugin\Indexer\Product;
+
+class PriceIndexer
 {
     /**
      * @var \Magento\Catalog\Model\Indexer\Product\Price\Processor
      */
-    protected $_processor;
+    protected $priceProcessor;
 
     /**
-     * @param \Magento\Catalog\Model\Indexer\Product\Price\Processor $processor
+     * @param \Magento\Catalog\Model\Indexer\Product\Price\Processor $priceProcessor
      */
-    public function __construct(
-        \Magento\Catalog\Model\Indexer\Product\Price\Processor $processor
-    ) {
-        $this->_processor = $processor;
+    public function __construct(\Magento\Catalog\Model\Indexer\Product\Price\Processor $priceProcessor)
+    {
+        $this->priceProcessor = $priceProcessor;
     }
 
     /**
      * Invalidate price indexer
      *
-     * @param \Magento\CatalogRule\Model\Rule $subject
-     *
+     * @param \Magento\CatalogRule\Model\Indexer\IndexBuilder $subject
      * @return void
      *
      * @SuppressWarnings(PHPMD.UnusedFormalParameter)
      */
-    public function afterApplyAll(\Magento\CatalogRule\Model\Rule $subject)
+    public function afterReindexFull(\Magento\CatalogRule\Model\Indexer\IndexBuilder $subject)
     {
-        $this->_processor->markIndexerAsInvalid();
+        $this->priceProcessor->markIndexerAsInvalid();
     }
 
     /**
-     * Reindex price for affected product
-     *
-     * @param \Magento\CatalogRule\Model\Rule $subject
+     * @param \Magento\CatalogRule\Model\Indexer\IndexBuilder $subject
      * @param callable $proceed
-     * @param int|\Magento\Catalog\Model\Product $product
-     * @param null|array $websiteIds
-     *
+     * @param array $productIds
      * @return void
      *
      * @SuppressWarnings(PHPMD.UnusedFormalParameter)
      */
-    public function aroundApplyToProduct(
-        \Magento\CatalogRule\Model\Rule $subject,
+    public function aroundReindexByIds(
+        \Magento\CatalogRule\Model\Indexer\IndexBuilder $subject,
         \Closure $proceed,
-        $product,
-        $websiteIds = null
+        array $productIds
     ) {
-        $proceed($product, $websiteIds);
-        $this->_reindexProduct($product);
+        $proceed($productIds);
+        $this->priceProcessor->reindexList($productIds);
     }
 
     /**
-     * Reindex price for affected product
-     *
-     * @param \Magento\CatalogRule\Model\Rule $subject
+     * @param \Magento\CatalogRule\Model\Indexer\IndexBuilder $subject
      * @param callable $proceed
-     * @param int|\Magento\Catalog\Model\Product $product
-     *
+     * @param int $productId
      * @return void
      *
      * @SuppressWarnings(PHPMD.UnusedFormalParameter)
      */
-    public function aroundApplyAllRulesToProduct(
-        \Magento\CatalogRule\Model\Rule $subject,
+    public function aroundReindexById(
+        \Magento\CatalogRule\Model\Indexer\IndexBuilder $subject,
         \Closure $proceed,
-        $product
+        $productId
     ) {
-        $proceed($product);
-        $this->_reindexProduct($product);
-    }
-
-    /**
-     * Reindex product price
-     *
-     * @param int|\Magento\Catalog\Model\Product $product
-     *
-     * @return void
-     */
-    protected function _reindexProduct($product)
-    {
-        $productId = is_numeric($product) ? $product : $product->getId();
-        $this->_processor->reindexRow($productId);
+        $proceed($productId);
+        $this->priceProcessor->reindexRow($productId);
     }
 }
diff --git a/app/code/Magento/CatalogRule/Plugin/Indexer/Product/Save/ApplyRules.php b/app/code/Magento/CatalogRule/Plugin/Indexer/Product/Save/ApplyRules.php
new file mode 100644
index 0000000000000000000000000000000000000000..1cc389f020069493b69d628e5596647e75452100
--- /dev/null
+++ b/app/code/Magento/CatalogRule/Plugin/Indexer/Product/Save/ApplyRules.php
@@ -0,0 +1,62 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\CatalogRule\Plugin\Indexer\Product\Save;
+
+use Magento\Catalog\Model\Product;
+use Magento\CatalogRule\Model\Indexer\Product\ProductRuleProcessor;
+
+class ApplyRules
+{
+    /**
+     * @var ProductRuleProcessor
+     */
+    protected $productRuleProcessor;
+
+    /**
+     * @param ProductRuleProcessor $productRuleProcessor
+     */
+    public function __construct(ProductRuleProcessor $productRuleProcessor)
+    {
+        $this->productRuleProcessor = $productRuleProcessor;
+    }
+
+    /**
+     * Apply catalog rules after product save
+     *
+     * @param Product $subject
+     * @param Product $result
+     * @return Product
+     *
+     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+     */
+    public function afterSave(
+        Product $subject,
+        Product $result
+    ) {
+        if (!$result->getIsMassupdate()) {
+            $this->productRuleProcessor->reindexRow($result->getId());
+        }
+        return $result;
+    }
+}
diff --git a/app/code/Magento/CatalogRule/Plugin/Indexer/Website.php b/app/code/Magento/CatalogRule/Plugin/Indexer/Website.php
new file mode 100644
index 0000000000000000000000000000000000000000..14c2f42bd7a7eda84ac80cdd89d861d0c4de3cc3
--- /dev/null
+++ b/app/code/Magento/CatalogRule/Plugin/Indexer/Website.php
@@ -0,0 +1,59 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *   
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\CatalogRule\Plugin\Indexer;
+
+use Magento\CatalogRule\Model\Indexer\Rule\RuleProductProcessor;
+
+class Website
+{
+    /**
+     * @var RuleProductProcessor
+     */
+    protected $ruleProductProcessor;
+
+    /**
+     * @param RuleProductProcessor $ruleProductProcessor
+     */
+    public function __construct(RuleProductProcessor $ruleProductProcessor)
+    {
+        $this->ruleProductProcessor = $ruleProductProcessor;
+    }
+
+    /**
+     * Invalidate catalog price rule indexer
+     *
+     * @param \Magento\Store\Model\Website $subject
+     * @param \Magento\Store\Model\Website $result
+     * @return \Magento\Store\Model\Website
+     *
+     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+     */
+    public function afterDelete(
+        \Magento\Store\Model\Website $subject,
+        \Magento\Store\Model\Website $result
+    ) {
+        $this->ruleProductProcessor->markIndexerAsInvalid();
+        return $result;
+    }
+}
diff --git a/app/code/Magento/CatalogRule/composer.json b/app/code/Magento/CatalogRule/composer.json
index 653131508c7d3755729fdb7ec9fa37dd57866a4d..b27dd420171c00d5ba00745c27290f6e5eab76ad 100644
--- a/app/code/Magento/CatalogRule/composer.json
+++ b/app/code/Magento/CatalogRule/composer.json
@@ -3,17 +3,19 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-rule": "0.1.0-alpha103",
-        "magento/module-catalog": "0.1.0-alpha103",
-        "magento/module-customer": "0.1.0-alpha103",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/module-eav": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-rule": "0.1.0-alpha104",
+        "magento/module-catalog": "0.1.0-alpha104",
+        "magento/module-customer": "0.1.0-alpha104",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/module-eav": "0.1.0-alpha104",
+        "magento/module-indexer": "0.1.0-alpha104",
+        "magento/module-import-export": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/CatalogRule/etc/adminhtml/di.xml b/app/code/Magento/CatalogRule/etc/adminhtml/di.xml
index 2951c5c618a8456b456266f2ffb3d3960234fd5e..2d4021511709127bceca5f2b1e3fa82ec201238b 100644
--- a/app/code/Magento/CatalogRule/etc/adminhtml/di.xml
+++ b/app/code/Magento/CatalogRule/etc/adminhtml/di.xml
@@ -32,4 +32,22 @@
             </argument>
         </arguments>
     </type>
+    <type name="Magento\Catalog\Model\Product">
+        <plugin name="apply_catalog_rules_after_product_save" type="Magento\CatalogRule\Plugin\Indexer\Product\Save\ApplyRules"/>
+    </type>
+    <type name="Magento\Catalog\Model\Category">
+        <plugin name="apply_after_products_assign" type="Magento\CatalogRule\Plugin\Indexer\Category"/>
+    </type>
+    <type name="Magento\Store\Model\Website">
+        <plugin name="reindex_after_delete_website" type="Magento\CatalogRule\Plugin\Indexer\Website"/>
+    </type>
+    <type name="Magento\Customer\Model\Group">
+        <plugin name="reindex_after_delete_customer_group" type="Magento\CatalogRule\Plugin\Indexer\CustomerGroup"/>
+    </type>
+    <type name="Magento\ImportExport\Model\Import">
+        <plugin name="reindex_after_import" type="Magento\CatalogRule\Plugin\Indexer\ImportExport"/>
+    </type>
+    <type name="Magento\Catalog\Model\Resource\Eav\Attribute">
+        <plugin name="change_product_attribute" type="Magento\CatalogRule\Plugin\Indexer\Product\Attribute"/>
+    </type>
 </config>
diff --git a/app/code/Magento/CatalogRule/etc/adminhtml/events.xml b/app/code/Magento/CatalogRule/etc/adminhtml/events.xml
index 1f8dc132df6c6cc8eeb6c2a4cfcadea321d801cf..dbfa51c8e1c4d7d949b036598821d9efa441af37 100644
--- a/app/code/Magento/CatalogRule/etc/adminhtml/events.xml
+++ b/app/code/Magento/CatalogRule/etc/adminhtml/events.xml
@@ -27,19 +27,4 @@
     <event name="catalog_product_get_final_price">
         <observer name="catalogrule" instance="Magento\CatalogRule\Model\Observer" method="processAdminFinalPrice" />
     </event>
-    <event name="catalog_product_save_after">
-        <observer name="catalogrule" instance="Magento\CatalogRule\Model\Observer" method="applyAllRulesOnProduct" />
-    </event>
-    <event name="catalog_product_import_finish_before">
-        <observer name="catalogrule" instance="Magento\CatalogRule\Model\Observer" method="createCatalogRulesRelations" />
-    </event>
-    <event name="catalog_product_import_after">
-        <observer name="catalogrule" instance="Magento\CatalogRule\Model\Observer" method="applyAllRules" />
-    </event>
-    <event name="catalog_entity_attribute_delete_after">
-        <observer name="catalogrule" instance="Magento\CatalogRule\Model\Observer" method="catalogAttributeDeleteAfter" />
-    </event>
-    <event name="catalog_entity_attribute_save_after">
-        <observer name="catalogrule" instance="Magento\CatalogRule\Model\Observer" method="catalogAttributeSaveAfter" />
-    </event>
 </config>
diff --git a/app/code/Magento/CatalogRule/etc/crontab.xml b/app/code/Magento/CatalogRule/etc/crontab.xml
index c727ac11d8fcaf5f0065e0502251ad58b345e8f0..0210d925dbfa76e4a8a26317d26821d10c6375a7 100644
--- a/app/code/Magento/CatalogRule/etc/crontab.xml
+++ b/app/code/Magento/CatalogRule/etc/crontab.xml
@@ -25,7 +25,7 @@
 -->
 <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Cron/etc/crontab.xsd">
     <group id="default">
-        <job name="catalogrule_apply_all" instance="Magento\CatalogRule\Model\Observer" method="dailyCatalogUpdate">
+        <job name="catalogrule_apply_all" instance="Magento\CatalogRule\Model\Cron" method="dailyCatalogUpdate">
             <schedule>0 1 * * *</schedule>
         </job>
     </group>
diff --git a/app/code/Magento/CatalogRule/etc/di.xml b/app/code/Magento/CatalogRule/etc/di.xml
index 6bab83ce4c4ebc19c1a48ecd56874aff86cf8eca..07960de9e68b1ef824b59d946124f76182780d6c 100644
--- a/app/code/Magento/CatalogRule/etc/di.xml
+++ b/app/code/Magento/CatalogRule/etc/di.xml
@@ -51,7 +51,6 @@
             </argument>
         </arguments>
     </type>
-
     <virtualType name="Magento\Catalog\Pricing\Price\Pool" type="Magento\Framework\Pricing\Price\Pool">
         <arguments>
             <argument name="prices" xsi:type="array">
@@ -59,5 +58,7 @@
             </argument>
         </arguments>
     </virtualType>
-
+    <type name="Magento\CatalogRule\Model\Indexer\IndexBuilder">
+        <plugin name="invalidate_price_indexer" type="Magento\CatalogRule\Plugin\Indexer\Product\PriceIndexer"/>
+    </type>
 </config>
diff --git a/app/code/Magento/CatalogRule/etc/events.xml b/app/code/Magento/CatalogRule/etc/events.xml
index 939092ebfea77cb620a9a6c0894c657e43c859b2..28c5e57be048dd997e89d391259070987d07099c 100644
--- a/app/code/Magento/CatalogRule/etc/events.xml
+++ b/app/code/Magento/CatalogRule/etc/events.xml
@@ -27,7 +27,4 @@
     <event name="prepare_catalog_product_price_index_table">
         <observer name="catalogrule" instance="Magento\CatalogRule\Model\Observer" method="prepareCatalogProductPriceIndexTable" />
     </event>
-    <event name="catalogrule_apply_all">
-        <observer name="catalogrule" instance="Magento\CatalogRule\Model\Observer" method="processApplyAll" />
-    </event>
 </config>
diff --git a/app/code/Magento/CatalogRule/etc/indexer.xml b/app/code/Magento/CatalogRule/etc/indexer.xml
new file mode 100644
index 0000000000000000000000000000000000000000..cc9b494a20f85ce87f0663d3a658e4d49785ae60
--- /dev/null
+++ b/app/code/Magento/CatalogRule/etc/indexer.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<!--
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Academic Free License (AFL 3.0)
+ * that is bundled with this package in the file LICENSE_AFL.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/afl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
+ */
+-->
+<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Indexer/etc/indexer.xsd">
+    <indexer id="catalogrule_rule" view_id="catalogrule_rule" class="Magento\CatalogRule\Model\Indexer\Rule\RuleProductIndexer">
+        <title translate="true">Catalog Rule Product</title>
+        <description translate="true">Indexed rule/product association</description>
+    </indexer>
+    <indexer id="catalogrule_product" view_id="catalogrule_product" class="Magento\CatalogRule\Model\Indexer\Product\ProductRuleIndexer">
+        <title translate="true">Catalog Product Rule</title>
+        <description translate="true">Indexed product/rule association</description>
+    </indexer>
+</config>
diff --git a/app/code/Magento/CatalogRule/etc/module.xml b/app/code/Magento/CatalogRule/etc/module.xml
index 5fda9f6e40ce47f8a3baafd80813fa525e3ae80f..ca42e637d3a24fc460d9ac317ca00328cc075452 100644
--- a/app/code/Magento/CatalogRule/etc/module.xml
+++ b/app/code/Magento/CatalogRule/etc/module.xml
@@ -37,6 +37,8 @@
             <module name="Magento_Customer"/>
             <module name="Magento_Backend"/>
             <module name="Magento_Eav"/>
+            <module name="Magento_Indexer"/>
+            <module name="Magento_ImportExport"/>
         </depends>
     </module>
 </config>
diff --git a/app/code/Magento/CatalogRule/etc/mview.xml b/app/code/Magento/CatalogRule/etc/mview.xml
new file mode 100644
index 0000000000000000000000000000000000000000..db09195083aee751a92ffd2e6a2bc94a7bc26830
--- /dev/null
+++ b/app/code/Magento/CatalogRule/etc/mview.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+<!--
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Academic Free License (AFL 3.0)
+ * that is bundled with this package in the file LICENSE_AFL.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/afl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
+ */
+-->
+<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Mview/etc/mview.xsd">
+    <view id="catalogrule_rule" class="Magento\CatalogRule\Model\Indexer\Rule\RuleProductIndexer" group="indexer">
+        <subscriptions>
+            <table name="catalogrule" entity_column="rule_id" />
+        </subscriptions>
+    </view>
+    <view id="catalogrule_product" class="Magento\CatalogRule\Model\Indexer\Product\ProductRuleIndexer" group="indexer">
+        <subscriptions>
+            <table name="catalog_product_entity" entity_column="entity_id" />
+            <table name="catalog_product_entity_datetime" entity_column="entity_id" />
+            <table name="catalog_product_entity_decimal" entity_column="entity_id" />
+            <table name="catalog_product_entity_gallery" entity_column="entity_id" />
+            <table name="catalog_product_entity_group_price" entity_column="entity_id" />
+            <table name="catalog_product_entity_int" entity_column="entity_id" />
+            <table name="catalog_product_entity_media_gallery" entity_column="entity_id" />
+            <table name="catalog_product_entity_text" entity_column="entity_id" />
+            <table name="catalog_product_entity_tier_price" entity_column="entity_id" />
+            <table name="catalog_product_entity_varchar" entity_column="entity_id" />
+            <table name="catalog_category_product" entity_column="product_id" />
+        </subscriptions>
+    </view>
+</config>
diff --git a/app/code/Magento/CatalogRule/sql/catalogrule_setup/upgrade-1.6.0.3-1.6.0.4.php b/app/code/Magento/CatalogRule/sql/catalogrule_setup/upgrade-1.6.0.3-1.6.0.4.php
new file mode 100644
index 0000000000000000000000000000000000000000..c749227b35ef60238f03568d2cd0325bc31db241
--- /dev/null
+++ b/app/code/Magento/CatalogRule/sql/catalogrule_setup/upgrade-1.6.0.3-1.6.0.4.php
@@ -0,0 +1,57 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+/* @var $installer \Magento\Framework\Module\Setup */
+$installer = $this;
+
+$installer->startSetup();
+
+$table = $installer->getTable('catalogrule_product_price');
+$installer->getConnection()->dropForeignKey(
+    $table,
+    $installer->getFkName('catalogrule_product_price', 'product_id', 'catalog_product_entity', 'entity_id')
+)->dropForeignKey(
+    $table,
+    $installer->getFkName('catalogrule_product_price', 'customer_group_id', 'customer_group', 'customer_group_id')
+)->dropForeignKey(
+    $table,
+    $installer->getFkName('catalogrule_product_price', 'website_id', 'store_website', 'website_id')
+);
+
+$table = $installer->getTable('catalogrule_product');
+$installer->getConnection()->dropForeignKey(
+    $table,
+    $installer->getFkName('catalogrule_product', 'product_id', 'catalog_product_entity', 'entity_id')
+)->dropForeignKey(
+    $table,
+    $installer->getFkName('catalogrule_product', 'customer_group_id', 'customer_group', 'customer_group_id')
+)->dropForeignKey(
+    $table,
+    $installer->getFkName('catalogrule_product', 'website_id', 'store_website', 'website_id')
+)->dropForeignKey(
+    $table,
+    $installer->getFkName('catalogrule_product', 'rule_id', 'catalogrule', 'rule_id')
+);
+
+$installer->endSetup();
diff --git a/app/code/Magento/CatalogSearch/Model/Config/Backend/Search/Type.php b/app/code/Magento/CatalogSearch/Model/Config/Backend/Search/Type.php
index 5764354f7a8fb1949df5f7da28a07c63900064ba..778b32adc3687be27cc409eeeac4207962611839 100644
--- a/app/code/Magento/CatalogSearch/Model/Config/Backend/Search/Type.php
+++ b/app/code/Magento/CatalogSearch/Model/Config/Backend/Search/Type.php
@@ -38,7 +38,7 @@ use Magento\Framework\Model\Context;
 use Magento\Framework\Registry;
 use Magento\Framework\Model\Resource\AbstractResource;
 use Magento\Framework\Data\Collection\Db;
-use Magento\Indexer\Model\IndexerFactory;
+use Magento\Indexer\Model\IndexerRegistry;
 
 class Type extends Value
 {
@@ -49,17 +49,15 @@ class Type extends Value
      */
     protected $_catalogSearchFulltext;
 
-    /**
-     * @var \Magento\Indexer\Model\IndexerFactory
-     */
-    protected $indexerFactory;
+    /** @var IndexerRegistry */
+    protected $indexerRegistry;
 
     /**
      * @param Context $context
      * @param Registry $registry
      * @param ScopeConfigInterface $config
      * @param Fulltext $catalogSearchFulltext
-     * @param IndexerFactory $indexerFactory
+     * @param IndexerRegistry $indexerRegistry
      * @param AbstractResource $resource
      * @param Db $resourceCollection
      * @param array $data
@@ -69,13 +67,13 @@ class Type extends Value
         Registry $registry,
         ScopeConfigInterface $config,
         Fulltext $catalogSearchFulltext,
-        IndexerFactory $indexerFactory,
+        IndexerRegistry $indexerRegistry,
         AbstractResource $resource = null,
         Db $resourceCollection = null,
         array $data = array()
     ) {
         $this->_catalogSearchFulltext = $catalogSearchFulltext;
-        $this->indexerFactory = $indexerFactory;
+        $this->indexerRegistry = $indexerRegistry;
         parent::__construct($context, $registry, $config, $resource, $resourceCollection, $data);
     }
 
@@ -94,12 +92,8 @@ class Type extends Value
         );
         if ($newValue != $oldValue) {
             $this->_catalogSearchFulltext->resetSearchResults();
-
-            $indexer = $this->indexerFactory->create();
-            $indexer->load(FulltextIndexer::INDEXER_ID);
-            $indexer->invalidate();
+            $this->indexerRegistry->get(FulltextIndexer::INDEXER_ID)->invalidate();
         }
-
         return $this;
     }
 }
diff --git a/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext.php b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext.php
index b3e8547a1a0b19e46f75855033ba183e39ce2fc3..57c05e7571153c2531c9ce213f3d69a12ed8940c 100644
--- a/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext.php
+++ b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext.php
@@ -40,24 +40,22 @@ class Fulltext implements \Magento\Indexer\Model\ActionInterface, \Magento\Frame
      */
     protected $rowsActionFactory;
 
-    /**
-     * @var \Magento\Indexer\Model\IndexerInterface
-     */
-    protected $indexer;
+    /** @var \Magento\Indexer\Model\IndexerRegistry */
+    protected $indexerRegistry;
 
     /**
      * @param Fulltext\Action\FullFactory $fullActionFactory
      * @param Fulltext\Action\RowsFactory $rowsActionFactory
-     * @param \Magento\Indexer\Model\IndexerInterface $indexer
+     * @param \Magento\Indexer\Model\IndexerRegistry $indexerRegistry
      */
     public function __construct(
         Fulltext\Action\FullFactory $fullActionFactory,
         Fulltext\Action\RowsFactory $rowsActionFactory,
-        \Magento\Indexer\Model\IndexerInterface $indexer
+        \Magento\Indexer\Model\IndexerRegistry $indexerRegistry
     ) {
         $this->fullActionFactory = $fullActionFactory;
         $this->rowsActionFactory = $rowsActionFactory;
-        $this->indexer = $indexer;
+        $this->indexerRegistry = $indexerRegistry;
     }
 
     /**
@@ -68,7 +66,7 @@ class Fulltext implements \Magento\Indexer\Model\ActionInterface, \Magento\Frame
      */
     public function execute($ids)
     {
-        $this->indexer->load(self::INDEXER_ID);
+        $this->indexerRegistry->get(self::INDEXER_ID);
 
         /** @var Fulltext\Action\Rows $action */
         $action = $this->rowsActionFactory->create();
@@ -91,7 +89,7 @@ class Fulltext implements \Magento\Indexer\Model\ActionInterface, \Magento\Frame
      * @param int[] $ids
      * @return void
      */
-    public function executeList($ids)
+    public function executeList(array $ids)
     {
         $this->execute($ids);
     }
diff --git a/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/AbstractPlugin.php b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/AbstractPlugin.php
index 5f1a512b4ca572f9d38b941fc0bfd574d3926e16..47e19697662a61a443b7702e9bf22ebb2507c5c5 100644
--- a/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/AbstractPlugin.php
+++ b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/AbstractPlugin.php
@@ -27,31 +27,16 @@ use Magento\CatalogSearch\Model\Indexer\Fulltext;
 
 abstract class AbstractPlugin
 {
-    /**
-     * @var \Magento\Indexer\Model\IndexerInterface
-     */
-    protected $indexer;
+    /** @var \Magento\Indexer\Model\IndexerRegistry */
+    protected $indexerRegistry;
 
     /**
-     * @param \Magento\Indexer\Model\IndexerInterface $indexer
+     * @param \Magento\Indexer\Model\IndexerRegistry $indexerRegistry
      */
     public function __construct(
-        \Magento\Indexer\Model\IndexerInterface $indexer
+        \Magento\Indexer\Model\IndexerRegistry $indexerRegistry
     ) {
-        $this->indexer = $indexer;
-    }
-
-    /**
-     * Return own indexer object
-     *
-     * @return \Magento\Indexer\Model\IndexerInterface
-     */
-    protected function getIndexer()
-    {
-        if (!$this->indexer->getId()) {
-            $this->indexer->load(Fulltext::INDEXER_ID);
-        }
-        return $this->indexer;
+        $this->indexerRegistry = $indexerRegistry;
     }
 
     /**
@@ -62,8 +47,9 @@ abstract class AbstractPlugin
      */
     protected function reindexRow($productId)
     {
-        if (!$this->getIndexer()->isScheduled()) {
-            $this->getIndexer()->reindexRow($productId);
+        $indexer = $this->indexerRegistry->get(Fulltext::INDEXER_ID);
+        if (!$indexer->isScheduled()) {
+            $indexer->reindexRow($productId);
         }
     }
 
@@ -75,8 +61,9 @@ abstract class AbstractPlugin
      */
     protected function reindexList(array $productIds)
     {
-        if (!$this->getIndexer()->isScheduled()) {
-            $this->getIndexer()->reindexList($productIds);
+        $indexer = $this->indexerRegistry->get(Fulltext::INDEXER_ID);
+        if (!$indexer->isScheduled()) {
+            $indexer->reindexList($productIds);
         }
     }
 }
diff --git a/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/Attribute.php b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/Attribute.php
index 20200e4e6814dba69fa54f3a7a3b0aab212038e8..3bc0e00bf51417e58ca4d4fb8c5e7763d7d98e9d 100644
--- a/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/Attribute.php
+++ b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/Attribute.php
@@ -23,6 +23,8 @@
  */
 namespace Magento\CatalogSearch\Model\Indexer\Fulltext\Plugin;
 
+use Magento\CatalogSearch\Model\Indexer\Fulltext;
+
 class Attribute extends AbstractPlugin
 {
     /**
@@ -43,7 +45,7 @@ class Attribute extends AbstractPlugin
         $needInvalidation = !$attribute->isObjectNew() && $attribute->dataHasChangedFor('is_searchable');
         $result = $proceed($attribute);
         if ($needInvalidation) {
-            $this->getIndexer()->invalidate();
+            $this->indexerRegistry->get(Fulltext::INDEXER_ID)->invalidate();
         }
 
         return $result;
@@ -67,7 +69,7 @@ class Attribute extends AbstractPlugin
         $needInvalidation = !$attribute->isObjectNew() && $attribute->getIsSearchable();
         $result = $proceed($attribute);
         if ($needInvalidation) {
-            $this->getIndexer()->invalidate();
+            $this->indexerRegistry->get(Fulltext::INDEXER_ID)->invalidate();
         }
 
         return $result;
diff --git a/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/Store/Group.php b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/Store/Group.php
index 7222e6826f515556939cfbb928bdc7b9175dd36e..51cd5afed018677375e08efcc32b5174ef904fdb 100644
--- a/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/Store/Group.php
+++ b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/Store/Group.php
@@ -24,6 +24,7 @@
 namespace Magento\CatalogSearch\Model\Indexer\Fulltext\Plugin\Store;
 
 use Magento\CatalogSearch\Model\Indexer\Fulltext\Plugin\AbstractPlugin;
+use Magento\CatalogSearch\Model\Indexer\Fulltext;
 
 class Group extends AbstractPlugin
 {
@@ -45,7 +46,7 @@ class Group extends AbstractPlugin
         $needInvalidation = !$group->isObjectNew() && $group->dataHasChangedFor('website_id');
         $result = $proceed($group);
         if ($needInvalidation) {
-            $this->getIndexer()->invalidate();
+            $this->indexerRegistry->get(Fulltext::INDEXER_ID)->invalidate();
         }
 
         return $result;
@@ -64,8 +65,7 @@ class Group extends AbstractPlugin
         \Magento\Store\Model\Resource\Group $subject,
         \Magento\Store\Model\Resource\Group $result
     ) {
-        $this->getIndexer()->invalidate();
-
+        $this->indexerRegistry->get(Fulltext::INDEXER_ID)->invalidate();
         return $result;
     }
 }
diff --git a/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/Store/View.php b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/Store/View.php
index 6757ba73a85c68dd65954926a8e808de150d504f..7c7eca701a78f96b9f5663c15dfe11d8b06107b0 100644
--- a/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/Store/View.php
+++ b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/Store/View.php
@@ -24,6 +24,7 @@
 namespace Magento\CatalogSearch\Model\Indexer\Fulltext\Plugin\Store;
 
 use Magento\CatalogSearch\Model\Indexer\Fulltext\Plugin\AbstractPlugin;
+use Magento\CatalogSearch\Model\Indexer\Fulltext;
 
 class View extends AbstractPlugin
 {
@@ -45,9 +46,8 @@ class View extends AbstractPlugin
         $needInvalidation = $store->isObjectNew();
         $result = $proceed($store);
         if ($needInvalidation) {
-            $this->getIndexer()->invalidate();
+            $this->indexerRegistry->get(Fulltext::INDEXER_ID)->invalidate();
         }
-
         return $result;
     }
 
@@ -64,8 +64,7 @@ class View extends AbstractPlugin
         \Magento\Store\Model\Resource\Store $subject,
         \Magento\Store\Model\Resource\Store $result
     ) {
-        $this->getIndexer()->invalidate();
-
+        $this->indexerRegistry->get(Fulltext::INDEXER_ID)->invalidate();
         return $result;
     }
 }
diff --git a/app/code/Magento/CatalogSearch/composer.json b/app/code/Magento/CatalogSearch/composer.json
index f5caacd09782ffdae3960a4f7beeef575f205f25..be48aeb8f502b4ad49e30ac072f3c1374409e654 100644
--- a/app/code/Magento/CatalogSearch/composer.json
+++ b/app/code/Magento/CatalogSearch/composer.json
@@ -3,21 +3,21 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-catalog": "0.1.0-alpha103",
-        "magento/module-search": "0.1.0-alpha103",
-        "magento/module-customer": "0.1.0-alpha103",
-        "magento/module-core": "0.1.0-alpha103",
-        "magento/module-directory": "0.1.0-alpha103",
-        "magento/module-indexer": "0.1.0-alpha103",
-        "magento/module-eav": "0.1.0-alpha103",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/module-theme": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-catalog": "0.1.0-alpha104",
+        "magento/module-search": "0.1.0-alpha104",
+        "magento/module-customer": "0.1.0-alpha104",
+        "magento/module-core": "0.1.0-alpha104",
+        "magento/module-directory": "0.1.0-alpha104",
+        "magento/module-indexer": "0.1.0-alpha104",
+        "magento/module-eav": "0.1.0-alpha104",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/module-theme": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/CatalogSearch/etc/di.xml b/app/code/Magento/CatalogSearch/etc/di.xml
index 52a3239ecf4288eeb8f60b70ab1b30bc1241d2d8..b3710d4628e555f4cc239c0384c2b9dfc7b3269b 100644
--- a/app/code/Magento/CatalogSearch/etc/di.xml
+++ b/app/code/Magento/CatalogSearch/etc/di.xml
@@ -66,11 +66,6 @@
     <type name="Magento\Catalog\Model\Resource\Attribute">
         <plugin name="catalogsearchFulltextIndexerAttribute" type="Magento\CatalogSearch\Model\Indexer\Fulltext\Plugin\Attribute"/>
     </type>
-    <type name="Magento\CatalogSearch\Model\Indexer\Fulltext\Plugin\AbstractPlugin">
-        <arguments>
-            <argument name="indexer" xsi:type="object" shared="false">Magento\Indexer\Model\IndexerInterface</argument>
-        </arguments>
-    </type>
     <type name="Magento\Framework\Search\EntityMetadata" />
     <virtualType name="Magento\Framework\Search\ProductEntityMetadata" type="Magento\Framework\Search\EntityMetadata">
         <arguments>
diff --git a/app/code/Magento/CatalogUrlRewrite/composer.json b/app/code/Magento/CatalogUrlRewrite/composer.json
index 3333a8d3f81b1e1de054729ae1110cdb4a371ecf..1a9acf737b475a9c8c9c2a1e458d83ac5b9a45a1 100644
--- a/app/code/Magento/CatalogUrlRewrite/composer.json
+++ b/app/code/Magento/CatalogUrlRewrite/composer.json
@@ -3,18 +3,18 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/module-catalog": "0.1.0-alpha103",
-        "magento/module-catalog-import-export": "0.1.0-alpha103",
-        "magento/module-eav": "0.1.0-alpha103",
-        "magento/module-import-export": "0.1.0-alpha103",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-url-rewrite": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/module-catalog": "0.1.0-alpha104",
+        "magento/module-catalog-import-export": "0.1.0-alpha104",
+        "magento/module-eav": "0.1.0-alpha104",
+        "magento/module-import-export": "0.1.0-alpha104",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-url-rewrite": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/Centinel/composer.json b/app/code/Magento/Centinel/composer.json
index d5b7d880aa0144163876a0b42ccc884859ed2be8..ed2ea7642a2c3529c5e213cbb3dad32af06e8df3 100644
--- a/app/code/Magento/Centinel/composer.json
+++ b/app/code/Magento/Centinel/composer.json
@@ -3,16 +3,16 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-checkout": "0.1.0-alpha103",
-        "magento/module-core": "0.1.0-alpha103",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/module-sales": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-checkout": "0.1.0-alpha104",
+        "magento/module-core": "0.1.0-alpha104",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/module-sales": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/Centinel/etc/module.xml b/app/code/Magento/Centinel/etc/module.xml
index 6a55692bb702396642e41fce6d244409db799f89..6c4062ae0fc4cfef2d48111f892b9edd45976976 100644
--- a/app/code/Magento/Centinel/etc/module.xml
+++ b/app/code/Magento/Centinel/etc/module.xml
@@ -24,7 +24,7 @@
  */
 -->
 <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
-    <module name="Magento_Centinel" schema_version="1.6.0.0" active="true">
+    <module name="Magento_Centinel" schema_version="2.0.0" active="true">
         <sequence>
             <module name="Magento_Payment"/>
             <module name="Magento_Checkout"/>
diff --git a/app/code/Magento/Checkout/Model/Resource/Cart.php b/app/code/Magento/Checkout/Model/Resource/Cart.php
index 0f7e22bafe4fc6a8145d4984665448a4446f7a17..fc62f303dbf9673c63755c7a22ab1bf7b47279e7 100644
--- a/app/code/Magento/Checkout/Model/Resource/Cart.php
+++ b/app/code/Magento/Checkout/Model/Resource/Cart.php
@@ -37,7 +37,7 @@ class Cart extends \Magento\Framework\Model\Resource\Db\AbstractDb
      */
     protected function _construct()
     {
-        $this->_init('sales_flat_quote', 'entity_id');
+        $this->_init('sales_quote', 'entity_id');
     }
 
     /**
@@ -50,7 +50,7 @@ class Cart extends \Magento\Framework\Model\Resource\Db\AbstractDb
     {
         $read = $this->_getReadAdapter();
         $select = $read->select()->from(
-            array('q' => $this->getTable('sales_flat_quote')),
+            array('q' => $this->getTable('sales_quote')),
             array('items_qty', 'items_count')
         )->where(
             'q.entity_id = :quote_id'
@@ -70,7 +70,7 @@ class Cart extends \Magento\Framework\Model\Resource\Db\AbstractDb
     {
         $read = $this->_getReadAdapter();
         $select = $read->select()->from(
-            array('qi' => $this->getTable('sales_flat_quote_item')),
+            array('qi' => $this->getTable('sales_quote_item')),
             array('id' => 'item_id', 'product_id', 'super_product_id', 'qty', 'created_at')
         )->where(
             'qi.quote_id = :quote_id'
@@ -90,7 +90,7 @@ class Cart extends \Magento\Framework\Model\Resource\Db\AbstractDb
     {
         $adapter = $this->_getReadAdapter();
         $exclusionSelect = $adapter->select()->from(
-            $this->getTable('sales_flat_quote_item'),
+            $this->getTable('sales_quote_item'),
             array('product_id')
         )->where(
             'quote_id = ?',
diff --git a/app/code/Magento/Checkout/Model/Type/Onepage.php b/app/code/Magento/Checkout/Model/Type/Onepage.php
index 8ffe5fbcac0b0c82a2a1021869dc51e94f9e9894..2e0fef9d013090b4c0489cc80ae31554cfc3c67c 100644
--- a/app/code/Magento/Checkout/Model/Type/Onepage.php
+++ b/app/code/Magento/Checkout/Model/Type/Onepage.php
@@ -480,7 +480,7 @@ class Onepage
             }
         }
 
-        $address->save();
+        $this->getQuote()->save();
 
         $this->getCheckout()->setStepData(
             'billing',
@@ -700,11 +700,6 @@ class Onepage
         }
         $quote = $this->getQuote();
 
-        // shipping totals may be affected by payment method
-        if (!$quote->isVirtual() && $quote->getShippingAddress()) {
-            $quote->getShippingAddress()->setCollectShippingRates(true);
-        }
-
         $data['checks'] = array(
             \Magento\Payment\Model\Method\AbstractMethod::CHECK_USE_CHECKOUT,
             \Magento\Payment\Model\Method\AbstractMethod::CHECK_USE_FOR_COUNTRY,
@@ -810,7 +805,8 @@ class Onepage
         $billing->setCustomerAddressData($customerBillingData);
 
         $dataArray = $this->_objectCopyService->getDataFromFieldset('checkout_onepage_quote', 'to_customer', $quote);
-        $customerData = $this->_customerBuilder->mergeDataObjectWithArray($customerData, $dataArray);
+        $customerData = $this->_customerBuilder->mergeDataObjectWithArray($customerData, $dataArray)
+            ->create();
         $quote->setCustomerData($customerData)->setCustomerId(true);
         // TODO : Eventually need to remove this legacy hack
         // Add billing address to quote since customer Data Object does not hold address information
diff --git a/app/code/Magento/Checkout/Service/V1/Data/Cart/AddressBuilder.php b/app/code/Magento/Checkout/Service/V1/Data/Cart/AddressBuilder.php
index 59fe4b3af21fc8378c4d110d1904f127cff960fb..8e1305904c5897f7ed93f9d142db3337b2165fa3 100644
--- a/app/code/Magento/Checkout/Service/V1/Data/Cart/AddressBuilder.php
+++ b/app/code/Magento/Checkout/Service/V1/Data/Cart/AddressBuilder.php
@@ -27,7 +27,7 @@ use Magento\Checkout\Service\V1\Data\Cart\Address\Region;
 use Magento\Checkout\Service\V1\Data\Cart\Address\RegionBuilder;
 use Magento\Customer\Service\V1\CustomerMetadataServiceInterface;
 use Magento\Framework\Api\ExtensibleObjectBuilder;
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
 
 /**
  * Quote address data object builder
@@ -45,13 +45,13 @@ class AddressBuilder extends ExtensibleObjectBuilder
 
     /**
      * @param \Magento\Framework\Api\ObjectFactory $objectFactory
-     * @param AttributeValueBuilder $valueBuilder
+     * @param AttributeDataBuilder $valueBuilder
      * @param CustomerMetadataServiceInterface $metadataService
      * @param RegionBuilder $regionBuilder
      */
     public function __construct(
         \Magento\Framework\Api\ObjectFactory $objectFactory,
-        AttributeValueBuilder $valueBuilder,
+        AttributeDataBuilder $valueBuilder,
         CustomerMetadataServiceInterface $metadataService,
         RegionBuilder $regionBuilder
     ) {
diff --git a/app/code/Magento/Checkout/Service/V1/Data/Cart/Totals/Item.php b/app/code/Magento/Checkout/Service/V1/Data/Cart/Totals/Item.php
index 9f7c98cf7f4e7730e0d463bc65956beba2cf5aab..597442d7a1b3570bdde2dd936eb6867aea5e9769 100644
--- a/app/code/Magento/Checkout/Service/V1/Data/Cart/Totals/Item.php
+++ b/app/code/Magento/Checkout/Service/V1/Data/Cart/Totals/Item.php
@@ -28,7 +28,7 @@ namespace Magento\Checkout\Service\V1\Data\Cart\Totals;
  *
  * @codeCoverageIgnore
  */
-class Item extends \Magento\Framework\Api\AbstractSimpleObject
+class Item extends \Magento\Framework\Api\AbstractExtensibleObject
 {
     /**
      * Price.
diff --git a/app/code/Magento/Checkout/Service/V1/Data/CartSearchResultsBuilder.php b/app/code/Magento/Checkout/Service/V1/Data/CartSearchResultsBuilder.php
index 31005a60fa8fdd3498d78039f22d71c5a6eddd06..60e9f6adb8fc9f829e8be069707a318d02a16064 100644
--- a/app/code/Magento/Checkout/Service/V1/Data/CartSearchResultsBuilder.php
+++ b/app/code/Magento/Checkout/Service/V1/Data/CartSearchResultsBuilder.php
@@ -23,7 +23,7 @@
  */
 namespace Magento\Checkout\Service\V1\Data;
 
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
 use Magento\Framework\Api\MetadataServiceInterface;
 use Magento\Framework\Api\ObjectFactory;
 use Magento\Framework\Api\AbstractSearchResultsBuilder;
@@ -38,14 +38,14 @@ class CartSearchResultsBuilder extends AbstractSearchResultsBuilder
      * Constructor
      *
      * @param ObjectFactory $objectFactory
-     * @param AttributeValueBuilder $valueBuilder
+     * @param AttributeDataBuilder $valueBuilder
      * @param MetadataServiceInterface $metadataService
      * @param SearchCriteriaBuilder $searchCriteriaBuilder
      * @param CartBuilder $itemObjectBuilder
      */
     public function __construct(
         ObjectFactory $objectFactory,
-        AttributeValueBuilder $valueBuilder,
+        AttributeDataBuilder $valueBuilder,
         MetadataServiceInterface $metadataService,
         SearchCriteriaBuilder $searchCriteriaBuilder,
         CartBuilder $itemObjectBuilder
diff --git a/app/code/Magento/Checkout/composer.json b/app/code/Magento/Checkout/composer.json
index 01939494ff4d9c6fc116e3ce067123a81d1a1bee..2473c609a809fb8abc16837231788707412bbe52 100644
--- a/app/code/Magento/Checkout/composer.json
+++ b/app/code/Magento/Checkout/composer.json
@@ -3,27 +3,27 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-sales": "0.1.0-alpha103",
-        "magento/module-authorization": "0.1.0-alpha103",
-        "magento/module-catalog-inventory": "0.1.0-alpha103",
-        "magento/module-core": "0.1.0-alpha103",
-        "magento/module-customer": "0.1.0-alpha103",
-        "magento/module-catalog": "0.1.0-alpha103",
-        "magento/module-payment": "0.1.0-alpha103",
-        "magento/module-tax": "0.1.0-alpha103",
-        "magento/module-directory": "0.1.0-alpha103",
-        "magento/module-eav": "0.1.0-alpha103",
-        "magento/module-gift-message": "0.1.0-alpha103",
-        "magento/module-wishlist": "0.1.0-alpha103",
-        "magento/module-page-cache": "0.1.0-alpha103",
-        "magento/module-theme": "0.1.0-alpha103",
-        "magento/module-msrp": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-sales": "0.1.0-alpha104",
+        "magento/module-authorization": "0.1.0-alpha104",
+        "magento/module-catalog-inventory": "0.1.0-alpha104",
+        "magento/module-core": "0.1.0-alpha104",
+        "magento/module-customer": "0.1.0-alpha104",
+        "magento/module-catalog": "0.1.0-alpha104",
+        "magento/module-payment": "0.1.0-alpha104",
+        "magento/module-tax": "0.1.0-alpha104",
+        "magento/module-directory": "0.1.0-alpha104",
+        "magento/module-eav": "0.1.0-alpha104",
+        "magento/module-gift-message": "0.1.0-alpha104",
+        "magento/module-wishlist": "0.1.0-alpha104",
+        "magento/module-page-cache": "0.1.0-alpha104",
+        "magento/module-theme": "0.1.0-alpha104",
+        "magento/module-msrp": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/CheckoutAgreements/composer.json b/app/code/Magento/CheckoutAgreements/composer.json
index 555ebf8e9056a99a12d29bfa45f1a8eb9e380f1e..ba7889471063374dfe9cacd810b8012b9ad482a1 100644
--- a/app/code/Magento/CheckoutAgreements/composer.json
+++ b/app/code/Magento/CheckoutAgreements/composer.json
@@ -3,14 +3,14 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-checkout": "0.1.0-alpha103",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-checkout": "0.1.0-alpha104",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/Cms/Ui/DataProvider/Page/Row/Actions.php b/app/code/Magento/Cms/Ui/DataProvider/Page/Row/Actions.php
index 36b0da9c589b0a88db3a01c720535ccb6ed327a9..7ea1db863838cfdcb1f1a10f011bc9d9c61c82eb 100644
--- a/app/code/Magento/Cms/Ui/DataProvider/Page/Row/Actions.php
+++ b/app/code/Magento/Cms/Ui/DataProvider/Page/Row/Actions.php
@@ -35,7 +35,7 @@ class Actions implements RowInterface
     /**
      * Url path
      */
-    const URL_PATH = 'cms/page/edit';
+    const URL_PATH = '*/*/edit';
 
     /**
      * @var UrlBuilder
diff --git a/app/code/Magento/Cms/composer.json b/app/code/Magento/Cms/composer.json
index 14df5fea779d6f21024f856a8e4e7eab1b15784d..e6ef44c0fc64711e7ad227739577a06108151e59 100644
--- a/app/code/Magento/Cms/composer.json
+++ b/app/code/Magento/Cms/composer.json
@@ -3,19 +3,19 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-core": "0.1.0-alpha103",
-        "magento/module-theme": "0.1.0-alpha103",
-        "magento/module-widget": "0.1.0-alpha103",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/module-catalog": "0.1.0-alpha103",
-        "magento/module-email": "0.1.0-alpha103",
-        "magento/module-ui": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-core": "0.1.0-alpha104",
+        "magento/module-theme": "0.1.0-alpha104",
+        "magento/module-widget": "0.1.0-alpha104",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/module-catalog": "0.1.0-alpha104",
+        "magento/module-email": "0.1.0-alpha104",
+        "magento/module-ui": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/Cms/view/adminhtml/layout/cms_wysiwyg_images_index.xml b/app/code/Magento/Cms/view/adminhtml/layout/cms_wysiwyg_images_index.xml
index 274227dfd4a7618cfc56ac511959ea6e3cfabde9..b55a731a8723887e06fabe509545857859d30745 100644
--- a/app/code/Magento/Cms/view/adminhtml/layout/cms_wysiwyg_images_index.xml
+++ b/app/code/Magento/Cms/view/adminhtml/layout/cms_wysiwyg_images_index.xml
@@ -23,15 +23,11 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 -->
-<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
-    <body>
-        <remove name="footer"/>
-        <remove name="left"/>
-        <referenceContainer name="content">
-            <block class="Magento\Cms\Block\Adminhtml\Wysiwyg\Images\Content" name="wysiwyg_images.content" template="browser/content.phtml">
-                <block class="Magento\Cms\Block\Adminhtml\Wysiwyg\Images\Tree" name="wysiwyg_images.tree" template="browser/tree.phtml"/>
-                <block class="Magento\Cms\Block\Adminhtml\Wysiwyg\Images\Content\Uploader" name="wysiwyg_images.uploader" template="Magento_Cms::browser/content/uploader.phtml"/>
-            </block>
-        </referenceContainer>
-    </body>
-</page>
+<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_layout.xsd">
+    <container name="root">
+        <block class="Magento\Cms\Block\Adminhtml\Wysiwyg\Images\Content" name="wysiwyg_images.content" template="browser/content.phtml">
+            <block class="Magento\Cms\Block\Adminhtml\Wysiwyg\Images\Tree" name="wysiwyg_images.tree" template="browser/tree.phtml"/>
+            <block class="Magento\Cms\Block\Adminhtml\Wysiwyg\Images\Content\Uploader" name="wysiwyg_images.uploader" template="Magento_Cms::browser/content/uploader.phtml"/>
+        </block>
+    </container>
+</layout>
diff --git a/app/code/Magento/CmsUrlRewrite/composer.json b/app/code/Magento/CmsUrlRewrite/composer.json
index 7e9b6101b4f4fdd82afa25d6de9427fbb4146209..35b70668be015e865c47c2509f6a9df54cb9577a 100644
--- a/app/code/Magento/CmsUrlRewrite/composer.json
+++ b/app/code/Magento/CmsUrlRewrite/composer.json
@@ -3,13 +3,13 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-cms": "0.1.0-alpha103",
-        "magento/module-url-rewrite": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-cms": "0.1.0-alpha104",
+        "magento/module-url-rewrite": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/ConfigurableImportExport/composer.json b/app/code/Magento/ConfigurableImportExport/composer.json
index 40df384e749f5e20a9dd8ee92a673f7f96a3e519..619a8ec5fc779805331f966fa7e2b90ae178fec3 100644
--- a/app/code/Magento/ConfigurableImportExport/composer.json
+++ b/app/code/Magento/ConfigurableImportExport/composer.json
@@ -3,16 +3,16 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-catalog": "0.1.0-alpha103",
-        "magento/module-catalog-import-export": "0.1.0-alpha103",
-        "magento/module-eav": "0.1.0-alpha103",
-        "magento/module-import-export": "0.1.0-alpha103",
-        "magento/module-configurable-product": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-catalog": "0.1.0-alpha104",
+        "magento/module-catalog-import-export": "0.1.0-alpha104",
+        "magento/module-eav": "0.1.0-alpha104",
+        "magento/module-import-export": "0.1.0-alpha104",
+        "magento/module-configurable-product": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/ConfigurableProduct/composer.json b/app/code/Magento/ConfigurableProduct/composer.json
index 1a43a63ebcba8c5dcc8a49e4d847f74c94d6c5a1..8e10f701a525a6d265e7db80055590ed3cde36d0 100644
--- a/app/code/Magento/ConfigurableProduct/composer.json
+++ b/app/code/Magento/ConfigurableProduct/composer.json
@@ -3,23 +3,23 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-catalog": "0.1.0-alpha103",
-        "magento/module-catalog-inventory": "0.1.0-alpha103",
-        "magento/module-sales": "0.1.0-alpha103",
-        "magento/module-core": "0.1.0-alpha103",
-        "magento/module-checkout": "0.1.0-alpha103",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/module-eav": "0.1.0-alpha103",
-        "magento/module-customer": "0.1.0-alpha103",
-        "magento/module-catalog-rule": "0.1.0-alpha103",
-        "magento/module-directory": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
-        "magento/module-webapi": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-catalog": "0.1.0-alpha104",
+        "magento/module-catalog-inventory": "0.1.0-alpha104",
+        "magento/module-sales": "0.1.0-alpha104",
+        "magento/module-core": "0.1.0-alpha104",
+        "magento/module-checkout": "0.1.0-alpha104",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/module-eav": "0.1.0-alpha104",
+        "magento/module-customer": "0.1.0-alpha104",
+        "magento/module-catalog-rule": "0.1.0-alpha104",
+        "magento/module-directory": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
+        "magento/module-webapi": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/Contact/composer.json b/app/code/Magento/Contact/composer.json
index ea0865667585cac9641453206ef131f0023e46c4..44d38f24d3afa2ccc9c89a70c6baae44de6c2765 100644
--- a/app/code/Magento/Contact/composer.json
+++ b/app/code/Magento/Contact/composer.json
@@ -3,15 +3,15 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-customer": "0.1.0-alpha103",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/module-cms": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-customer": "0.1.0-alpha104",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/module-cms": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/Core/composer.json b/app/code/Magento/Core/composer.json
index b32e8bdd5a99a5b96f073546b182ede399dabfef..9ade2b568acb818af3f05d613995d4bf0a44fc42 100644
--- a/app/code/Magento/Core/composer.json
+++ b/app/code/Magento/Core/composer.json
@@ -3,18 +3,18 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/module-cron": "0.1.0-alpha103",
-        "magento/module-theme": "0.1.0-alpha103",
-        "magento/module-eav": "0.1.0-alpha103",
-        "magento/module-page-cache": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/module-cron": "0.1.0-alpha104",
+        "magento/module-theme": "0.1.0-alpha104",
+        "magento/module-eav": "0.1.0-alpha104",
+        "magento/module-page-cache": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "lib-libxml": "*",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/Cron/composer.json b/app/code/Magento/Cron/composer.json
index b5784bd3d380d9f5a637f78a9cdd23570ecab50c..48bc799790395b50e8cf3f1177852316a9d8992c 100644
--- a/app/code/Magento/Cron/composer.json
+++ b/app/code/Magento/Cron/composer.json
@@ -3,13 +3,13 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/CurrencySymbol/composer.json b/app/code/Magento/CurrencySymbol/composer.json
index 3477e2ed64c48dcc4fdee570ddb3b4275e9b0d83..00be91ba472898779b82c2ba8fac3fdd70edd96d 100644
--- a/app/code/Magento/CurrencySymbol/composer.json
+++ b/app/code/Magento/CurrencySymbol/composer.json
@@ -3,16 +3,16 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-page-cache": "0.1.0-alpha103",
-        "magento/module-directory": "0.1.0-alpha103",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/module-core": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-page-cache": "0.1.0-alpha104",
+        "magento/module-directory": "0.1.0-alpha104",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/module-core": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/Customer/Api/AccountManagementInterface.php b/app/code/Magento/Customer/Api/AccountManagementInterface.php
index b32cb52ab15b961990ceba8627cb0f9277171d45..552320ac5b54eedef4bdb845a2469c75b1bd622a 100644
--- a/app/code/Magento/Customer/Api/AccountManagementInterface.php
+++ b/app/code/Magento/Customer/Api/AccountManagementInterface.php
@@ -185,6 +185,27 @@ interface AccountManagementInterface
      * @param int $customerWebsiteId
      * @param int $storeId
      * @return bool
+     * @throws \Magento\Framework\Exception\LocalizedException
      */
     public function isCustomerInStore($customerWebsiteId, $storeId);
+
+    /**
+     * Retrieve default billing address for the given customerId.
+     *
+     * @param int $customerId
+     * @return \Magento\Customer\Api\Data\AddressInterface|null
+     * @throws \Magento\Framework\Exception\NoSuchEntityException If the customer Id is invalid
+     * @throws \Magento\Framework\Exception\LocalizedException
+     */
+    public function getDefaultBillingAddress($customerId);
+
+    /**
+     * Retrieve default shipping address for the given customerId.
+     *
+     * @param int $customerId
+     * @return \Magento\Customer\Api\Data\AddressInterface|null
+     * @throws \Magento\Framework\Exception\NoSuchEntityException If the customer Id is invalid
+     * @throws \Magento\Framework\Exception\LocalizedException
+     */
+    public function getDefaultShippingAddress($customerId);
 }
diff --git a/app/code/Magento/Customer/Api/Data/AddressInterface.php b/app/code/Magento/Customer/Api/Data/AddressInterface.php
index 3e616dd30f44aa207baa63ce0d2f7e1dbefceda4..5452be10a56d7bcdb866a660ec48af9f59d4fe90 100644
--- a/app/code/Magento/Customer/Api/Data/AddressInterface.php
+++ b/app/code/Magento/Customer/Api/Data/AddressInterface.php
@@ -51,6 +51,8 @@ interface AddressInterface extends ExtensibleDataInterface
     const PREFIX = 'prefix';
     const SUFFIX = 'suffix';
     const VAT_ID = 'vat_id';
+    const DEFAULT_BILLING = 'default_billing';
+    const DEFAULT_SHIPPING = 'default_shipping';
     /**#@-*/
 
     /**
@@ -164,4 +166,18 @@ interface AddressInterface extends ExtensibleDataInterface
      * @return string|null
      */
     public function getVatId();
+
+    /**
+     * Get if this address is default shipping address.
+     *
+     * @return bool|null
+     */
+    public function isDefaultShipping();
+
+    /**
+     * Get if this address is default billing address
+     *
+     * @return bool|null
+     */
+    public function isDefaultBilling();
 }
diff --git a/app/code/Magento/Customer/Block/Address/Edit.php b/app/code/Magento/Customer/Block/Address/Edit.php
index ca9b2e6d75f15bc740a356fdd63e7888351c4512..c463113e651ed775f507bb107f1b3d07fdf7aae5 100644
--- a/app/code/Magento/Customer/Block/Address/Edit.php
+++ b/app/code/Magento/Customer/Block/Address/Edit.php
@@ -146,7 +146,8 @@ class Edit extends \Magento\Directory\Block\Data
                     'region' => $postedData['region']
                 );
             }
-            $this->_address = $this->_addressBuilder->mergeDataObjectWithArray($this->_address, $postedData);
+            $this->_address = $this->_addressBuilder->mergeDataObjectWithArray($this->_address, $postedData)
+                ->create();
         }
 
         return $this;
diff --git a/app/code/Magento/Customer/Controller/Account/Edit.php b/app/code/Magento/Customer/Controller/Account/Edit.php
index df78e2f6ddc7f532527e8cf84699002d7d8234d3..efab0d71cfdebf764fe84b5d6f56477d65ddee46 100644
--- a/app/code/Magento/Customer/Controller/Account/Edit.php
+++ b/app/code/Magento/Customer/Controller/Account/Edit.php
@@ -73,7 +73,8 @@ class Edit extends \Magento\Customer\Controller\Account
         $customerId = $this->_getSession()->getCustomerId();
         $customerDataObject = $this->customerAccountService->getCustomer($customerId);
         if (!empty($data)) {
-            $customerDataObject = $this->customerBuilder->mergeDataObjectWithArray($customerDataObject, $data);
+            $customerDataObject = $this->customerBuilder->mergeDataObjectWithArray($customerDataObject, $data)
+                ->create();
         }
         $this->_getSession()->setCustomerData($customerDataObject);
         $this->_getSession()->setChangePassword($this->getRequest()->getParam('changepass') == 1);
diff --git a/app/code/Magento/Customer/Controller/Address/FormPost.php b/app/code/Magento/Customer/Controller/Address/FormPost.php
index 8b68db91148181ba04193934a13b488bf09cf587..73246c711794ead66a7514b2ab224a6b6b2d6d0c 100644
--- a/app/code/Magento/Customer/Controller/Address/FormPost.php
+++ b/app/code/Magento/Customer/Controller/Address/FormPost.php
@@ -74,6 +74,8 @@ class FormPost extends \Magento\Customer\Controller\Address
             ->populateWithArray(array_merge($existingAddressData, $attributeValues))
             ->setCustomerId($this->_getSession()->getCustomerId())
             ->setRegion($region)
+            ->setDefaultBilling($this->getRequest()->getParam('default_billing', false))
+            ->setDefaultShipping($this->getRequest()->getParam('default_shipping', false))
             ->create();
     }
 
diff --git a/app/code/Magento/Customer/Model/AccountManagement.php b/app/code/Magento/Customer/Model/AccountManagement.php
index ea1bbc19ff2a0deed1ed70b7aa25a84342792a4c..b2d54213fa67b125c6bff388bd4ffd325477c795 100644
--- a/app/code/Magento/Customer/Model/AccountManagement.php
+++ b/app/code/Magento/Customer/Model/AccountManagement.php
@@ -32,7 +32,6 @@ use Magento\Customer\Helper\Data as CustomerDataHelper;
 use Magento\Customer\Model\Config\Share as ConfigShare;
 use Magento\Customer\Model\Customer as CustomerModel;
 use Magento\Customer\Model\CustomerFactory;
-use Magento\Customer\Model\CustomerRegistry;
 use Magento\Customer\Model\Metadata\Validator;
 use Magento\Customer\Service\V1\CustomerMetadataServiceInterface;
 use Magento\Framework\App\Config\ScopeConfigInterface;
@@ -54,6 +53,7 @@ use Magento\Framework\Stdlib\String as StringHelper;
 use Magento\Framework\StoreManagerInterface;
 use Magento\Framework\UrlInterface;
 use Magento\Framework\Reflection\DataObjectProcessor;
+use Magento\Customer\Api\Data\AddressInterface;
 
 /**
  * Handle various customer account actions
@@ -542,6 +542,24 @@ class AccountManagement implements AccountManagementInterface
         return $customer;
     }
 
+    /**
+     * {@inheritdoc}
+     */
+    public function getDefaultBillingAddress($customerId)
+    {
+        $customer = $this->customerRepository->getById($customerId);
+        return $this->getAddressById($customer, $customer->getDefaultBilling());
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function getDefaultShippingAddress($customerId)
+    {
+        $customer = $this->customerRepository->getById($customerId);
+        return $this->getAddressById($customer, $customer->getDefaultShipping());
+    }
+
     /**
      * Send either confirmation or welcome email after an account creation
      *
@@ -750,7 +768,6 @@ class AccountManagement implements AccountManagementInterface
         return $customer->getDeleteable();
     }
 
-
     /**
      * Send email with new account related information
      *
@@ -795,10 +812,12 @@ class AccountManagement implements AccountManagementInterface
     }
 
     /**
+     * Send email to customer when his password is reset
+     *
      * @param CustomerInterface $customer
      * @return $this
      */
-    public function sendPasswordResetNotificationEmail($customer)
+    protected function sendPasswordResetNotificationEmail($customer)
     {
         $storeId = $customer->getStoreId();
         if (!$storeId) {
@@ -1084,6 +1103,23 @@ class AccountManagement implements AccountManagementInterface
         return $this;
     }
 
+    /**
+     * Get address by id
+     *
+     * @param CustomerInterface $customer
+     * @param int $addressId
+     * @return AddressInterface|null
+     */
+    protected function getAddressById(CustomerInterface $customer, $addressId)
+    {
+        foreach ($customer->getAddresses() as $address) {
+            if ($address->getId() == $addressId) {
+                return $address;
+            }
+        }
+        return null;
+    }
+
     /**
      * Create an object with data merged from Customer and CustomerSecure
      *
diff --git a/app/code/Magento/Customer/Model/Address.php b/app/code/Magento/Customer/Model/Address.php
index 9545c1ee834697897f72f605fb4066c68f92a90c..0ec83e7eb9e0ccfcdd785cc0f8405c80f814ea17 100644
--- a/app/code/Magento/Customer/Model/Address.php
+++ b/app/code/Magento/Customer/Model/Address.php
@@ -153,6 +153,10 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress
                 $this->setDataUsingMethod($attributeCode, $attributeData);
             }
         }
+        // Need to explicitly set this due to discrepancy in the keys between model and data object
+        $this->setIsDefaultBilling($address->isDefaultBilling());
+        $this->setIsDefaultShipping($address->isDefaultShipping());
+
         // Need to use attribute set or future updates can cause data loss
         if (!$this->getAttributeSetId()) {
             $this->setAttributeSetId(AddressMetadataInterface::ATTRIBUTE_SET_ID_ADDRESS);
diff --git a/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Password.php b/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Password.php
index ca1553922e8c256f45bfb69fc6aed614acafc553..26402bb2a8ba496165e12981df3f614a58f0d0b9 100644
--- a/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Password.php
+++ b/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Password.php
@@ -43,13 +43,11 @@ class Password extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBacke
     protected $string;
 
     /**
-     * @param \Magento\Framework\Logger $logger
      * @param \Magento\Framework\Stdlib\String $string
      */
-    public function __construct(\Magento\Framework\Logger $logger, \Magento\Framework\Stdlib\String $string)
+    public function __construct(\Magento\Framework\Stdlib\String $string)
     {
         $this->string = $string;
-        parent::__construct($logger);
     }
 
     /**
diff --git a/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Store.php b/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Store.php
index da9753ef73e4a4c6c2136a9aa117d9a06426b4ba..83494dac28ce81793b9a32a70d2beecca32c67d0 100644
--- a/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Store.php
+++ b/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Store.php
@@ -36,13 +36,11 @@ class Store extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend
     protected $_storeManager;
 
     /**
-     * @param \Magento\Framework\Logger $logger
      * @param \Magento\Framework\StoreManagerInterface $storeManager
      */
-    public function __construct(\Magento\Framework\Logger $logger, \Magento\Framework\StoreManagerInterface $storeManager)
+    public function __construct(\Magento\Framework\StoreManagerInterface $storeManager)
     {
         $this->_storeManager = $storeManager;
-        parent::__construct($logger);
     }
 
     /**
diff --git a/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Website.php b/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Website.php
index c8c99a5f9582bd5d65c37339e8d503a0005e2e27..5e7f4741ea87474f19c148fc70f0a1ace13b9620 100644
--- a/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Website.php
+++ b/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Website.php
@@ -36,13 +36,11 @@ class Website extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBacken
     protected $_storeManager;
 
     /**
-     * @param \Magento\Framework\Logger $logger
      * @param \Magento\Framework\StoreManagerInterface $storeManager
      */
-    public function __construct(\Magento\Framework\Logger $logger, \Magento\Framework\StoreManagerInterface $storeManager)
+    public function __construct(\Magento\Framework\StoreManagerInterface $storeManager)
     {
         $this->_storeManager = $storeManager;
-        parent::__construct($logger);
     }
 
     /**
diff --git a/app/code/Magento/Customer/Model/Data/Address.php b/app/code/Magento/Customer/Model/Data/Address.php
index e9f5ebbe54ba8d78e3dd36286d66d6f098be3274..5bff296dbc3e1f6461681b023e03bd5057033d24 100644
--- a/app/code/Magento/Customer/Model/Data/Address.php
+++ b/app/code/Magento/Customer/Model/Data/Address.php
@@ -187,4 +187,24 @@ class Address extends \Magento\Framework\Api\AbstractExtensibleObject implements
     {
         return $this->_get(self::CUSTOMER_ID);
     }
+
+    /**
+     * Get if this address is default shipping address.
+     *
+     * @return bool|null
+     */
+    public function isDefaultShipping()
+    {
+        return $this->_get(self::DEFAULT_SHIPPING);
+    }
+
+    /**
+     * Get if this address is default billing address
+     *
+     * @return bool|null
+     */
+    public function isDefaultBilling()
+    {
+        return $this->_get(self::DEFAULT_BILLING);
+    }
 }
diff --git a/app/code/Magento/Customer/Model/Data/CustomerBuilder.php b/app/code/Magento/Customer/Model/Data/CustomerBuilder.php
index 763a05b82881938c709d2da79479c2c62862202e..0b4a91ba1934102a49652dede406e29931d74372 100644
--- a/app/code/Magento/Customer/Model/Data/CustomerBuilder.php
+++ b/app/code/Magento/Customer/Model/Data/CustomerBuilder.php
@@ -26,7 +26,7 @@ namespace Magento\Customer\Model\Data;
 
 use Magento\Framework\Api\AbstractExtensibleObject as ExtensibleObject;
 use Magento\Framework\Api\ExtensibleObjectBuilder;
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
 use Magento\Customer\Service\V1\CustomerMetadataServiceInterface;
 
 /**
@@ -40,12 +40,12 @@ class CustomerBuilder extends ExtensibleObjectBuilder
 {
     /**
      * @param \Magento\Framework\Api\ObjectFactory $objectFactory
-     * @param AttributeValueBuilder $valueBuilder
+     * @param AttributeDataBuilder $valueBuilder
      * @param CustomerMetadataServiceInterface $metadataService
      */
     public function __construct(
         \Magento\Framework\Api\ObjectFactory $objectFactory,
-        AttributeValueBuilder $valueBuilder,
+        AttributeDataBuilder $valueBuilder,
         CustomerMetadataServiceInterface $metadataService
     ) {
         parent::__construct($objectFactory, $valueBuilder, $metadataService);
diff --git a/app/code/Magento/Customer/Model/Layout/DepersonalizePlugin.php b/app/code/Magento/Customer/Model/Layout/DepersonalizePlugin.php
index 799eb75a951ef77c64792982b10437e61b0d18d1..41ee039c924c8efc84bc21444fb78b0eb9aeedb3 100644
--- a/app/code/Magento/Customer/Model/Layout/DepersonalizePlugin.php
+++ b/app/code/Magento/Customer/Model/Layout/DepersonalizePlugin.php
@@ -41,9 +41,9 @@ class DepersonalizePlugin
     protected $customerSession;
 
     /**
-     * @var \Magento\Customer\Model\Customer
+     * @var \Magento\Customer\Model\CustomerFactory
      */
-    protected $customer;
+    protected $customerFactory;
 
     /**
      * @var \Magento\Framework\App\RequestInterface
@@ -95,7 +95,7 @@ class DepersonalizePlugin
     ) {
         $this->session = $session;
         $this->customerSession = $customerSession;
-        $this->customer = $customerFactory->create();
+        $this->customerFactory = $customerFactory;
         $this->request = $request;
         $this->moduleManager = $moduleManager;
         $this->visitor = $visitor;
@@ -140,8 +140,7 @@ class DepersonalizePlugin
             $this->customerSession->clearStorage();
             $this->session->setData(\Magento\Framework\Data\Form\FormKey::FORM_KEY, $this->formKey);
             $this->customerSession->setCustomerGroupId($this->customerGroupId);
-            $this->customer->setGroupId($this->customerGroupId);
-            $this->customerSession->setCustomer($this->customer);
+            $this->customerSession->setCustomer($this->customerFactory->create()->setGroupId($this->customerGroupId));
         }
         return $result;
     }
diff --git a/app/code/Magento/Customer/Model/Resource/Address/Attribute/Backend/Region.php b/app/code/Magento/Customer/Model/Resource/Address/Attribute/Backend/Region.php
index ae46d205a313d10fe26e7891b8a07e744f67e503..51456c5c874895a3953679736c855e720543b985 100644
--- a/app/code/Magento/Customer/Model/Resource/Address/Attribute/Backend/Region.php
+++ b/app/code/Magento/Customer/Model/Resource/Address/Attribute/Backend/Region.php
@@ -36,13 +36,11 @@ class Region extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend
     protected $_regionFactory;
 
     /**
-     * @param \Magento\Framework\Logger $logger
      * @param \Magento\Directory\Model\RegionFactory $regionFactory
      */
-    public function __construct(\Magento\Framework\Logger $logger, \Magento\Directory\Model\RegionFactory $regionFactory)
+    public function __construct(\Magento\Directory\Model\RegionFactory $regionFactory)
     {
         $this->_regionFactory = $regionFactory;
-        parent::__construct($logger);
     }
 
     /**
diff --git a/app/code/Magento/Customer/Model/Resource/AddressRepository.php b/app/code/Magento/Customer/Model/Resource/AddressRepository.php
index 6d3fbec60184dd2a61698096f999d435fceb4aa5..76ba7615d267bcc06fa923842f23d0b928f81e08 100644
--- a/app/code/Magento/Customer/Model/Resource/AddressRepository.php
+++ b/app/code/Magento/Customer/Model/Resource/AddressRepository.php
@@ -126,6 +126,9 @@ class AddressRepository implements \Magento\Customer\Api\AddressRepositoryInterf
             throw $inputException;
         }
         $this->addressResource->save($addressModel);
+        // Clean up the customer registry since the Address save has a
+        // side effect on customer : \Magento\Customer\Model\Resource\Address::_afterSave
+        $this->customerRegistry->remove($address->getCustomerId());
         $this->addressRegistry->push($addressModel);
         $customerModel->getAddressesCollection()->clear();
 
diff --git a/app/code/Magento/Customer/Model/Resource/CustomerRepository.php b/app/code/Magento/Customer/Model/Resource/CustomerRepository.php
index f6af8b15aebe4addae4741960de89b52844f64bc..abace9e1e65dfc7a44ae1f25e5eb85afccbb988a 100644
--- a/app/code/Magento/Customer/Model/Resource/CustomerRepository.php
+++ b/app/code/Magento/Customer/Model/Resource/CustomerRepository.php
@@ -142,7 +142,6 @@ class CustomerRepository implements \Magento\Customer\Api\CustomerRepositoryInte
      */
     public function save(\Magento\Customer\Api\Data\CustomerInterface $customer, $passwordHash = null)
     {
-        $isNewCustomer = $customer->getId() ? false : true;
         $this->validate($customer);
         $customerModel = $this->customerFactory->create(
             [
diff --git a/app/code/Magento/Customer/Service/V1/Data/AddressBuilder.php b/app/code/Magento/Customer/Service/V1/Data/AddressBuilder.php
index 5c47d7ea441e5bdfe8b2fd0bd8fa284ea50a41e0..a245af9aaa7ec55507faf7a99471fbad24c94ace 100644
--- a/app/code/Magento/Customer/Service/V1/Data/AddressBuilder.php
+++ b/app/code/Magento/Customer/Service/V1/Data/AddressBuilder.php
@@ -27,7 +27,7 @@ namespace Magento\Customer\Service\V1\Data;
 use Magento\Customer\Service\V1\AddressMetadataServiceInterface;
 use Magento\Framework\Api\AbstractExtensibleObject as ExtensibleObject;
 use Magento\Framework\Api\ExtensibleObjectBuilder;
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
 
 /**
  * Builder for the Address Service Data Object
@@ -47,13 +47,13 @@ class AddressBuilder extends ExtensibleObjectBuilder
 
     /**
      * @param \Magento\Framework\Api\ObjectFactory $objectFactory
-     * @param AttributeValueBuilder $valueBuilder
+     * @param AttributeDataBuilder $valueBuilder
      * @param AddressMetadataServiceInterface $metadataService
      * @param RegionBuilder $regionBuilder
      */
     public function __construct(
         \Magento\Framework\Api\ObjectFactory $objectFactory,
-        AttributeValueBuilder $valueBuilder,
+        AttributeDataBuilder $valueBuilder,
         AddressMetadataServiceInterface $metadataService,
         RegionBuilder $regionBuilder
     ) {
diff --git a/app/code/Magento/Customer/Service/V1/Data/CustomerBuilder.php b/app/code/Magento/Customer/Service/V1/Data/CustomerBuilder.php
index 9940cee02308458e5ecc1f3b15c77166cf52c491..7b1a36ea61212625d5cfb22710f7c7bf1f2832bc 100644
--- a/app/code/Magento/Customer/Service/V1/Data/CustomerBuilder.php
+++ b/app/code/Magento/Customer/Service/V1/Data/CustomerBuilder.php
@@ -26,26 +26,26 @@ namespace Magento\Customer\Service\V1\Data;
 
 use Magento\Framework\Api\AbstractExtensibleObject as ExtensibleObject;
 use Magento\Framework\Api\ExtensibleObjectBuilder;
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
 use Magento\Customer\Service\V1\CustomerMetadataServiceInterface;
 
 /**
  * Builder for the Customer Service Data Object
  *
  * @method Customer create()
- * @method Customer mergeDataObjectWithArray(ExtensibleObject $dataObject, array $data)
- * @method Customer mergeDataObjects(ExtensibleObject $firstDataObject, ExtensibleObject $secondDataObject)
+ * @method CustomerBuilder mergeDataObjectWithArray(ExtensibleObject $dataObject, array $data)
+ * @method CustomerBuilder mergeDataObjects(ExtensibleObject $firstDataObject, ExtensibleObject $secondDataObject)
  */
 class CustomerBuilder extends ExtensibleObjectBuilder
 {
     /**
      * @param \Magento\Framework\Api\ObjectFactory $objectFactory
-     * @param AttributeValueBuilder $valueBuilder
+     * @param AttributeDataBuilder $valueBuilder
      * @param CustomerMetadataServiceInterface $metadataService
      */
     public function __construct(
         \Magento\Framework\Api\ObjectFactory $objectFactory,
-        AttributeValueBuilder $valueBuilder,
+        AttributeDataBuilder $valueBuilder,
         CustomerMetadataServiceInterface $metadataService
     ) {
         parent::__construct($objectFactory, $valueBuilder, $metadataService);
diff --git a/app/code/Magento/Customer/Service/V1/Data/CustomerDetailsBuilder.php b/app/code/Magento/Customer/Service/V1/Data/CustomerDetailsBuilder.php
index 0db5a29509120075a351accdcb4239c2197d66f9..4944bafcc8b701a8d5a767c07279e70bb0efc962 100644
--- a/app/code/Magento/Customer/Service/V1/Data/CustomerDetailsBuilder.php
+++ b/app/code/Magento/Customer/Service/V1/Data/CustomerDetailsBuilder.php
@@ -26,7 +26,7 @@
 namespace Magento\Customer\Service\V1\Data;
 
 use Magento\Framework\Api\ExtensibleObjectBuilder;
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
 use Magento\Framework\Api\MetadataServiceInterface;
 
 /**
@@ -50,14 +50,14 @@ class CustomerDetailsBuilder extends ExtensibleObjectBuilder
 
     /**
      * @param \Magento\Framework\Api\ObjectFactory $objectFactory
-     * @param AttributeValueBuilder $valueBuilder
+     * @param AttributeDataBuilder $valueBuilder
      * @param MetadataServiceInterface $metadataService
      * @param CustomerBuilder $customerBuilder
      * @param AddressBuilder $addressBuilder
      */
     public function __construct(
         \Magento\Framework\Api\ObjectFactory $objectFactory,
-        AttributeValueBuilder $valueBuilder,
+        AttributeDataBuilder $valueBuilder,
         MetadataServiceInterface $metadataService,
         \Magento\Customer\Service\V1\Data\CustomerBuilder $customerBuilder,
         \Magento\Customer\Service\V1\Data\AddressBuilder $addressBuilder
diff --git a/app/code/Magento/Customer/Service/V1/Data/CustomerGroupSearchResultsBuilder.php b/app/code/Magento/Customer/Service/V1/Data/CustomerGroupSearchResultsBuilder.php
index 7234903af3d14ba83f482e47558a8c02720a5f47..225512bf1c2d10d7e6022ad09a66a30688097f04 100644
--- a/app/code/Magento/Customer/Service/V1/Data/CustomerGroupSearchResultsBuilder.php
+++ b/app/code/Magento/Customer/Service/V1/Data/CustomerGroupSearchResultsBuilder.php
@@ -27,7 +27,7 @@ namespace Magento\Customer\Service\V1\Data;
 use Magento\Framework\Api\ObjectFactory;
 use Magento\Framework\Api\SearchCriteriaBuilder;
 use Magento\Framework\Api\AbstractSearchResultsBuilder;
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
 use Magento\Framework\Api\MetadataServiceInterface;
 
 /**
@@ -41,14 +41,14 @@ class CustomerGroupSearchResultsBuilder extends AbstractSearchResultsBuilder
      * Constructor
      *
      * @param ObjectFactory $objectFactory
-     * @param AttributeValueBuilder $valueBuilder
+     * @param AttributeDataBuilder $valueBuilder
      * @param MetadataServiceInterface $metadataService
      * @param SearchCriteriaBuilder $searchCriteriaBuilder
      * @param CustomerDetailsBuilder $itemObjectBuilder
      */
     public function __construct(
         ObjectFactory $objectFactory,
-        AttributeValueBuilder $valueBuilder,
+        AttributeDataBuilder $valueBuilder,
         MetadataServiceInterface $metadataService,
         SearchCriteriaBuilder $searchCriteriaBuilder,
         CustomerDetailsBuilder $itemObjectBuilder
diff --git a/app/code/Magento/Customer/Service/V1/Data/Eav/AttributeMetadataBuilder.php b/app/code/Magento/Customer/Service/V1/Data/Eav/AttributeMetadataBuilder.php
index afeddb6b0b77e14bc50f44ddebee089c25ef2360..cdfb02dc0cfbeb0c0d6d1d773314ee6579955047 100644
--- a/app/code/Magento/Customer/Service/V1/Data/Eav/AttributeMetadataBuilder.php
+++ b/app/code/Magento/Customer/Service/V1/Data/Eav/AttributeMetadataBuilder.php
@@ -25,7 +25,7 @@ namespace Magento\Customer\Service\V1\Data\Eav;
 
 use Magento\Framework\Api\AttributeMetadataBuilderInterface;
 use Magento\Framework\Api\ExtensibleObjectBuilder;
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
 use Magento\Framework\Api\MetadataServiceInterface;
 
 /**
@@ -49,14 +49,14 @@ class AttributeMetadataBuilder extends ExtensibleObjectBuilder implements Attrib
 
     /**
      * @param \Magento\Framework\Api\ObjectFactory $objectFactory
-     * @param AttributeValueBuilder $valueBuilder
+     * @param AttributeDataBuilder $valueBuilder
      * @param MetadataServiceInterface $metadataService
      * @param OptionBuilder $optionBuilder
      * @param ValidationRuleBuilder $validationRuleBuilder
      */
     public function __construct(
         \Magento\Framework\Api\ObjectFactory $objectFactory,
-        AttributeValueBuilder $valueBuilder,
+        AttributeDataBuilder $valueBuilder,
         MetadataServiceInterface $metadataService,
         \Magento\Customer\Service\V1\Data\Eav\OptionBuilder $optionBuilder,
         \Magento\Customer\Service\V1\Data\Eav\ValidationRuleBuilder $validationRuleBuilder
diff --git a/app/code/Magento/Customer/Service/V1/Data/SearchResultsBuilder.php b/app/code/Magento/Customer/Service/V1/Data/SearchResultsBuilder.php
index e93bd781654d959047cd0e3ae3d8295888f9d403..4f7bb8b9839bd90bc5893becb398d75bd164d511 100644
--- a/app/code/Magento/Customer/Service/V1/Data/SearchResultsBuilder.php
+++ b/app/code/Magento/Customer/Service/V1/Data/SearchResultsBuilder.php
@@ -24,7 +24,7 @@
 
 namespace Magento\Customer\Service\V1\Data;
 
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
 use Magento\Framework\Api\MetadataServiceInterface;
 use Magento\Framework\Api\ObjectFactory;
 use Magento\Framework\Api\SearchCriteriaBuilder;
@@ -42,14 +42,14 @@ class SearchResultsBuilder extends AbstractSearchResultsBuilder
      * Constructor
      *
      * @param ObjectFactory $objectFactory
-     * @param AttributeValueBuilder $valueBuilder
+     * @param AttributeDataBuilder $valueBuilder
      * @param MetadataServiceInterface $metadataService
      * @param SearchCriteriaBuilder $searchCriteriaBuilder
      * @param CustomerDetailsBuilder $itemObjectBuilder
      */
     public function __construct(
         ObjectFactory $objectFactory,
-        AttributeValueBuilder $valueBuilder,
+        AttributeDataBuilder $valueBuilder,
         MetadataServiceInterface $metadataService,
         SearchCriteriaBuilder $searchCriteriaBuilder,
         CustomerDetailsBuilder $itemObjectBuilder
diff --git a/app/code/Magento/Customer/composer.json b/app/code/Magento/Customer/composer.json
index 070aa3601370762fc02f02b3ddd4cae360b2a50f..480763708111d924f27415644d1f9ed2a5a74172 100644
--- a/app/code/Magento/Customer/composer.json
+++ b/app/code/Magento/Customer/composer.json
@@ -3,27 +3,27 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-eav": "0.1.0-alpha103",
-        "magento/module-directory": "0.1.0-alpha103",
-        "magento/module-core": "0.1.0-alpha103",
-        "magento/module-catalog": "0.1.0-alpha103",
-        "magento/module-newsletter": "0.1.0-alpha103",
-        "magento/module-sales": "0.1.0-alpha103",
-        "magento/module-checkout": "0.1.0-alpha103",
-        "magento/module-wishlist": "0.1.0-alpha103",
-        "magento/module-theme": "0.1.0-alpha103",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/module-review": "0.1.0-alpha103",
-        "magento/module-tax": "0.1.0-alpha103",
-        "magento/module-page-cache": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
-        "magento/module-authorization": "0.1.0-alpha103",
-        "magento/module-integration": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-eav": "0.1.0-alpha104",
+        "magento/module-directory": "0.1.0-alpha104",
+        "magento/module-core": "0.1.0-alpha104",
+        "magento/module-catalog": "0.1.0-alpha104",
+        "magento/module-newsletter": "0.1.0-alpha104",
+        "magento/module-sales": "0.1.0-alpha104",
+        "magento/module-checkout": "0.1.0-alpha104",
+        "magento/module-wishlist": "0.1.0-alpha104",
+        "magento/module-theme": "0.1.0-alpha104",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/module-review": "0.1.0-alpha104",
+        "magento/module-tax": "0.1.0-alpha104",
+        "magento/module-page-cache": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
+        "magento/module-authorization": "0.1.0-alpha104",
+        "magento/module-integration": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/Customer/etc/di.xml b/app/code/Magento/Customer/etc/di.xml
index e8e2e10559f48589d80d181622c6fcef7e21f826..c9bcffc7b8967003d033a3161b9307dd6e4b81d8 100644
--- a/app/code/Magento/Customer/etc/di.xml
+++ b/app/code/Magento/Customer/etc/di.xml
@@ -72,6 +72,8 @@
             <argument name="customerData" xsi:type="object">Magento\Customer\Helper\Data\Proxy</argument>
             <argument name="customerResource" xsi:type="object">Magento\Customer\Model\Resource\Customer\Proxy</argument>
             <argument name="storage" xsi:type="object">Magento\Customer\Model\Session\Storage</argument>
+            <argument name="converter" xsi:type="object">Magento\Customer\Model\Converter\Proxy</argument>
+            <argument name="customerAccountService" xsi:type="object">Magento\Customer\Service\V1\CustomerAccountServiceInterface\Proxy</argument>
         </arguments>
     </type>
     <type name="Magento\Framework\Module\Updater\SetupFactory">
@@ -104,9 +106,14 @@
     <type name="Magento\Customer\Model\Customer">
         <arguments>
             <argument name="customerData" xsi:type="object">Magento\Customer\Helper\Data\Proxy</argument>
+            <argument name="groupService" xsi:type="object">Magento\Customer\Service\V1\CustomerGroupServiceInterface\Proxy</argument>
+        </arguments>
+    </type>
+    <type name="Magento\Customer\Helper\Data">
+        <arguments>
+            <argument name="groupService" xsi:type="object">Magento\Customer\Service\V1\CustomerGroupServiceInterface\Proxy</argument>
         </arguments>
     </type>
-    <type name="Magento\Customer\Model\Data\GroupBuilder" shared="false" />
     <type name="Magento\Customer\Service\V1\Data\CustomerGroupBuilder" shared="false" />
     <type name="Magento\Customer\Service\V1\Data\Eav\AttributeMetadataBuilder" shared="false" />
     <type name="Magento\Customer\Api\Data\OptionDataBuilder" shared="false" />
@@ -126,6 +133,7 @@
     <type name="Magento\Customer\Service\V1\CustomerAccountService">
         <arguments>
             <argument name="url" xsi:type="object">Magento\Framework\Url</argument>
+            <argument name="converter" xsi:type="object">Magento\Customer\Model\Converter\Proxy</argument>
         </arguments>
     </type>
     <virtualType name="Magento\Customer\Service\Config\CustomerMetadataConfig" type="Magento\Framework\Api\Config\MetadataConfig">
diff --git a/app/code/Magento/CustomerImportExport/composer.json b/app/code/Magento/CustomerImportExport/composer.json
index dcf167156e55692dd01d55a0b7ada4662ffb3168..b107d8d9b56a9ab27aee00086a2dcd4d10da21d0 100644
--- a/app/code/Magento/CustomerImportExport/composer.json
+++ b/app/code/Magento/CustomerImportExport/composer.json
@@ -3,17 +3,17 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/module-core": "0.1.0-alpha103",
-        "magento/module-customer": "0.1.0-alpha103",
-        "magento/module-eav": "0.1.0-alpha103",
-        "magento/module-import-export": "0.1.0-alpha103",
-        "magento/module-directory": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/module-core": "0.1.0-alpha104",
+        "magento/module-customer": "0.1.0-alpha104",
+        "magento/module-eav": "0.1.0-alpha104",
+        "magento/module-import-export": "0.1.0-alpha104",
+        "magento/module-directory": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/DesignEditor/composer.json b/app/code/Magento/DesignEditor/composer.json
index e08dbfe35a4d60bb8e6b3aa8ddf6cdfd03e6e372..6283b4dc180f91932a10ba17f0381072d6b25533 100644
--- a/app/code/Magento/DesignEditor/composer.json
+++ b/app/code/Magento/DesignEditor/composer.json
@@ -3,16 +3,16 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-theme": "0.1.0-alpha103",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/module-core": "0.1.0-alpha103",
-        "magento/module-eav": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-theme": "0.1.0-alpha104",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/module-core": "0.1.0-alpha104",
+        "magento/module-eav": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/Dhl/composer.json b/app/code/Magento/Dhl/composer.json
index b1c924676704d085dcf5643a03a54eb077985ab8..61bec06052b839b57f8789e3b34d88f1cf24cc38 100644
--- a/app/code/Magento/Dhl/composer.json
+++ b/app/code/Magento/Dhl/composer.json
@@ -3,21 +3,21 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-shipping": "0.1.0-alpha103",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/module-directory": "0.1.0-alpha103",
-        "magento/module-core": "0.1.0-alpha103",
-        "magento/module-sales": "0.1.0-alpha103",
-        "magento/module-checkout": "0.1.0-alpha103",
-        "magento/module-catalog": "0.1.0-alpha103",
-        "magento/module-catalog-inventory": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-shipping": "0.1.0-alpha104",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/module-directory": "0.1.0-alpha104",
+        "magento/module-core": "0.1.0-alpha104",
+        "magento/module-sales": "0.1.0-alpha104",
+        "magento/module-checkout": "0.1.0-alpha104",
+        "magento/module-catalog": "0.1.0-alpha104",
+        "magento/module-catalog-inventory": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "lib-libxml": "*",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/Dhl/data/dhl_setup/data-install-2.0.0.0.php b/app/code/Magento/Dhl/data/dhl_setup/data-install-2.0.0.php
similarity index 100%
rename from app/code/Magento/Dhl/data/dhl_setup/data-install-2.0.0.0.php
rename to app/code/Magento/Dhl/data/dhl_setup/data-install-2.0.0.php
diff --git a/app/code/Magento/Dhl/etc/module.xml b/app/code/Magento/Dhl/etc/module.xml
index a0e44e807650aa11a8aa32759b5b619bb793d130..bbdea658e8958397f81542b3e2d3637f169a3e1c 100644
--- a/app/code/Magento/Dhl/etc/module.xml
+++ b/app/code/Magento/Dhl/etc/module.xml
@@ -24,7 +24,7 @@
  */
 -->
 <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
-    <module name="Magento_Dhl" schema_version="2.0.0.0" active="true">
+    <module name="Magento_Dhl" schema_version="2.0.0" active="true">
         <depends>
             <module name="Magento_Store"/>
             <module name="Magento_Shipping"/>
diff --git a/app/code/Magento/Directory/composer.json b/app/code/Magento/Directory/composer.json
index fc660b3e373ec48155a061a59e6e85aa73d4829f..33cb21f8470e003630e2cc90a0d9f186e9cbac79 100644
--- a/app/code/Magento/Directory/composer.json
+++ b/app/code/Magento/Directory/composer.json
@@ -3,15 +3,15 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-core": "0.1.0-alpha103",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-core": "0.1.0-alpha104",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "lib-libxml": "*",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/Downloadable/Model/Observer.php b/app/code/Magento/Downloadable/Model/Observer.php
index 4de1abcc23d1decb6c8f2942fbec22b31e1845be..9ba58b5808dd2bc76d41b05abf6d1722ed3e07b0 100644
--- a/app/code/Magento/Downloadable/Model/Observer.php
+++ b/app/code/Magento/Downloadable/Model/Observer.php
@@ -23,6 +23,8 @@
  */
 namespace Magento\Downloadable\Model;
 
+use Magento\Store\Model\ScopeInterface;
+
 /**
  * Downloadable Products Observer
  *
@@ -171,7 +173,7 @@ class Observer
                     ->_scopeConfig
                     ->getValue(
                         \Magento\Downloadable\Model\Link::XML_PATH_LINKS_TITLE,
-                        \Magento\Store\Model\ScopeInterface::SCOPE_STORE
+                        ScopeInterface::SCOPE_STORE
                     );
                 $linkPurchased->setLinkSectionTitle($linkSectionTitle)->save();
                 foreach ($linkIds as $linkId) {
@@ -269,7 +271,7 @@ class Observer
         $downloadableItemsStatuses = array();
         $orderItemStatusToEnable = $this->_scopeConfig->getValue(
             \Magento\Downloadable\Model\Link\Purchased\Item::XML_PATH_ORDER_ITEM_STATUS,
-            \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
+            ScopeInterface::SCOPE_STORE,
             $order->getStoreId()
         );
 
@@ -355,31 +357,31 @@ class Observer
      */
     public function isAllowedGuestCheckout(\Magento\Framework\Event\Observer $observer)
     {
-        $quote = $observer->getEvent()->getQuote();
-        /* @var $quote \Magento\Sales\Model\Quote */
         $store = $observer->getEvent()->getStore();
         $result = $observer->getEvent()->getResult();
 
-        $isContain = false;
+        $result->setIsAllowed(true);
+
+        if (!$this->_scopeConfig->isSetFlag(
+            self::XML_PATH_DISABLE_GUEST_CHECKOUT,
+            ScopeInterface::SCOPE_STORE,
+            $store
+        )) {
+            return $this;
+        }
+
+        /* @var $quote \Magento\Sales\Model\Quote */
+        $quote = $observer->getEvent()->getQuote();
 
         foreach ($quote->getAllItems() as $item) {
             if (($product = $item->getProduct())
                 && $product->getTypeId() == \Magento\Downloadable\Model\Product\Type::TYPE_DOWNLOADABLE
             ) {
-                $isContain = true;
+                $result->setIsAllowed(false);
+                break;
             }
         }
 
-        if ($isContain
-            && $this->_scopeConfig->isSetFlag(
-                self::XML_PATH_DISABLE_GUEST_CHECKOUT,
-                \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
-                $store
-            )
-        ) {
-            $result->setIsAllowed(false);
-        }
-
         return $this;
     }
 
diff --git a/app/code/Magento/Downloadable/composer.json b/app/code/Magento/Downloadable/composer.json
index 54b051f3ba5cfc0b113a71ff34c806be50ae278b..6ece1ac9540a43525b62d841eccf8f899c42f017 100644
--- a/app/code/Magento/Downloadable/composer.json
+++ b/app/code/Magento/Downloadable/composer.json
@@ -3,26 +3,26 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-catalog": "0.1.0-alpha103",
-        "magento/module-core": "0.1.0-alpha103",
-        "magento/module-customer": "0.1.0-alpha103",
-        "magento/module-tax": "0.1.0-alpha103",
-        "magento/module-theme": "0.1.0-alpha103",
-        "magento/module-eav": "0.1.0-alpha103",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/module-sales": "0.1.0-alpha103",
-        "magento/module-checkout": "0.1.0-alpha103",
-        "magento/module-directory": "0.1.0-alpha103",
-        "magento/module-wishlist": "0.1.0-alpha103",
-        "magento/module-gift-message": "0.1.0-alpha103",
-        "magento/module-catalog-inventory": "0.1.0-alpha103",
-        "magento/module-msrp": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-catalog": "0.1.0-alpha104",
+        "magento/module-core": "0.1.0-alpha104",
+        "magento/module-customer": "0.1.0-alpha104",
+        "magento/module-tax": "0.1.0-alpha104",
+        "magento/module-theme": "0.1.0-alpha104",
+        "magento/module-eav": "0.1.0-alpha104",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/module-sales": "0.1.0-alpha104",
+        "magento/module-checkout": "0.1.0-alpha104",
+        "magento/module-directory": "0.1.0-alpha104",
+        "magento/module-wishlist": "0.1.0-alpha104",
+        "magento/module-gift-message": "0.1.0-alpha104",
+        "magento/module-catalog-inventory": "0.1.0-alpha104",
+        "magento/module-msrp": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/Downloadable/sql/downloadable_setup/install-1.6.0.0.php b/app/code/Magento/Downloadable/sql/downloadable_setup/install-1.6.0.0.php
index 8f22273500453cc4e81ba8819aa986b24d4c7cc6..f9156743622ff8522c41b71f0aadc2b15fd49b4a 100644
--- a/app/code/Magento/Downloadable/sql/downloadable_setup/install-1.6.0.0.php
+++ b/app/code/Magento/Downloadable/sql/downloadable_setup/install-1.6.0.0.php
@@ -249,9 +249,9 @@ $table = $installer->getConnection()->newTable(
     \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->addForeignKey(
-    $installer->getFkName('downloadable_link_purchased', 'order_id', 'sales_flat_order', 'entity_id'),
+    $installer->getFkName('downloadable_link_purchased', 'order_id', 'sales_order', 'entity_id'),
     'order_id',
-    $installer->getTable('sales_flat_order'),
+    $installer->getTable('sales_order'),
     'entity_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
@@ -383,9 +383,9 @@ $table = $installer->getConnection()->newTable(
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->addForeignKey(
-    $installer->getFkName('downloadable_link_purchased_item', 'order_item_id', 'sales_flat_order_item', 'item_id'),
+    $installer->getFkName('downloadable_link_purchased_item', 'order_item_id', 'sales_order_item', 'item_id'),
     'order_item_id',
-    $installer->getTable('sales_flat_order_item'),
+    $installer->getTable('sales_order_item'),
     'item_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
diff --git a/app/code/Magento/Eav/Model/Config.php b/app/code/Magento/Eav/Model/Config.php
index e1683939f907dca2ff5ab685b63875e8092ea8a1..c76dedfa247ecd76917b4e82cad771eb3166d7c6 100644
--- a/app/code/Magento/Eav/Model/Config.php
+++ b/app/code/Magento/Eav/Model/Config.php
@@ -27,16 +27,20 @@ use Magento\Eav\Model\Entity\Type;
 
 class Config
 {
+    /**#@+
+     * EAV cache ids
+     */
     const ENTITIES_CACHE_ID = 'EAV_ENTITY_TYPES';
-
     const ATTRIBUTES_CACHE_ID = 'EAV_ENTITY_ATTRIBUTES';
+    const ATTRIBUTES_CODES_CACHE_ID = 'EAV_ENTITY_ATTRIBUTES_CODES';
+    /**#@-*/
 
     /**
      * Entity types data
      *
      * @var array
      */
-    protected $_entityData;
+    protected $_entityTypeData;
 
     /**
      * Attributes data
@@ -45,26 +49,12 @@ class Config
      */
     protected $_attributeData;
 
-    /**
-     * Information about preloaded attributes
-     *
-     * @var array
-     */
-    protected $_preloadedAttributes = array();
-
-    /**
-     * Information about entity types with initialized attributes
-     *
-     * @var array
-     */
-    protected $_initializedAttributes = array();
-
     /**
      * Attribute codes cache array
      *
      * @var array
      */
-    protected $_attributeCodes = array();
+    protected $_attributeCodes;
 
     /**
      * Initialized objects
@@ -106,11 +96,19 @@ class Config
      */
     protected $_cache;
 
+    /** @var \Magento\Framework\App\Cache\StateInterface */
+    protected $_cacheState;
+
     /**
      * @var \Magento\Eav\Model\Entity\TypeFactory
      */
     protected $_entityTypeFactory;
 
+    /**
+     * @var \Magento\Eav\Model\Resource\Entity\Type\CollectionFactory
+     */
+    protected $entityTypeCollectionFactory;
+
     /**
      * @var \Magento\Framework\Validator\UniversalFactory
      */
@@ -118,18 +116,21 @@ class Config
 
     /**
      * @param \Magento\Framework\App\CacheInterface $cache
-     * @param Entity\TypeFactory $entityTypeFactory
+     * @param \Magento\Eav\Model\Entity\TypeFactory $entityTypeFactory
+     * @param \Magento\Eav\Model\Resource\Entity\Type\CollectionFactory $entityTypeCollectionFactory
      * @param \Magento\Framework\App\Cache\StateInterface $cacheState
      * @param \Magento\Framework\Validator\UniversalFactory $universalFactory
      */
     public function __construct(
         \Magento\Framework\App\CacheInterface $cache,
         \Magento\Eav\Model\Entity\TypeFactory $entityTypeFactory,
+        \Magento\Eav\Model\Resource\Entity\Type\CollectionFactory $entityTypeCollectionFactory,
         \Magento\Framework\App\Cache\StateInterface $cacheState,
         \Magento\Framework\Validator\UniversalFactory $universalFactory
     ) {
         $this->_cache = $cache;
         $this->_entityTypeFactory = $entityTypeFactory;
+        $this->entityTypeCollectionFactory = $entityTypeCollectionFactory;
         $this->_cacheState = $cacheState;
         $this->_universalFactory = $universalFactory;
     }
@@ -141,13 +142,17 @@ class Config
      */
     public function clear()
     {
-        $this->_entityData = null;
+        $this->_entityTypeData = null;
         $this->_attributeData = null;
         $this->_objects = null;
         $this->_references = null;
-        $this->_preloadedAttributes = array();
-        $this->_initializedAttributes = array();
-        $this->_attributeCodes = array();
+        $this->_attributeCodes = null;
+        $this->_cache->clean(
+            [
+                \Magento\Eav\Model\Cache\Type::CACHE_TAG,
+                \Magento\Eav\Model\Entity\Attribute::CACHE_TAG
+            ]
+        );
         return $this;
     }
 
@@ -271,17 +276,14 @@ class Config
      */
     protected function _initEntityTypes()
     {
-        if (is_array($this->_entityData)) {
+        if (is_array($this->_entityTypeData)) {
             return $this;
         }
         \Magento\Framework\Profiler::start('EAV: ' . __METHOD__, array('group' => 'EAV', 'method' => __METHOD__));
 
-        /**
-         * try load information about entity types from cache
-         */
         if ($this->_isCacheEnabled() && ($cache = $this->_cache->load(self::ENTITIES_CACHE_ID))) {
-            $this->_entityData = unserialize($cache);
-            foreach ($this->_entityData as $typeCode => $data) {
+            $this->_entityTypeData = unserialize($cache);
+            foreach ($this->_entityTypeData as $typeCode => $data) {
                 $typeId = $data['entity_type_id'];
                 $this->_addEntityTypeReference($typeId, $typeCode);
             }
@@ -289,12 +291,7 @@ class Config
             return $this;
         }
 
-        $entityTypesData = $this->_entityTypeFactory->create()->getCollection()->getData();
-        $types = array();
-
-        /**
-         * prepare entity type data
-         */
+        $entityTypesData = $this->entityTypeCollectionFactory->create()->getData();
         foreach ($entityTypesData as $typeData) {
             if (!isset($typeData['attribute_model'])) {
                 $typeData['attribute_model'] = 'Magento\Eav\Model\Entity\Attribute';
@@ -304,14 +301,12 @@ class Config
             $typeId = $typeData['entity_type_id'];
 
             $this->_addEntityTypeReference($typeId, $typeCode);
-            $types[$typeCode] = $typeData;
+            $this->_entityTypeData[$typeCode] = $typeData;
         }
 
-        $this->_entityData = $types;
-
         if ($this->_isCacheEnabled()) {
             $this->_cache->save(
-                serialize($this->_entityData),
+                serialize($this->_entityTypeData),
                 self::ENTITIES_CACHE_ID,
                 array(
                     \Magento\Eav\Model\Cache\Type::CACHE_TAG,
@@ -335,6 +330,7 @@ class Config
         if ($code instanceof Type) {
             return $code;
         }
+        $this->_initEntityTypes();
         \Magento\Framework\Profiler::start('EAV: ' . __METHOD__, array('group' => 'EAV', 'method' => __METHOD__));
 
         if (is_numeric($code)) {
@@ -351,20 +347,11 @@ class Config
             return $entityType;
         }
 
-
-        $entityType = $this->_entityTypeFactory->create();
-        if (isset($this->_entityData[$code])) {
-            $entityType->setData($this->_entityData[$code]);
-        } else {
-            if (is_numeric($code)) {
-                $entityType->load($code);
-            } else {
-                $entityType->loadByCode($code);
-            }
-
-            if (!$entityType->getId()) {
-                throw new \Magento\Framework\Model\Exception(__('Invalid entity_type specified: %1', $code));
-            }
+        $entityType = $this->_entityTypeFactory->create(
+            ['data' => isset($this->_entityTypeData[$code]) ? $this->_entityTypeData[$code] : []]
+        );
+        if (!$entityType->getId()) {
+            throw new \Magento\Framework\Model\Exception(__('Invalid entity_type specified: %1', $code));
         }
         $this->_addEntityTypeReference($entityType->getId(), $entityType->getEntityTypeCode());
         $this->_save($entityType, $entityKey);
@@ -384,25 +371,46 @@ class Config
         $entityType = $this->getEntityType($entityType);
         $entityTypeCode = $entityType->getEntityTypeCode();
 
-        if (isset($this->_initializedAttributes[$entityTypeCode])) {
+        if (isset($this->_attributeData[$entityTypeCode])) {
             return $this;
         }
+        $cacheKey = self::ATTRIBUTES_CACHE_ID . $entityTypeCode;
+        if ($this->_isCacheEnabled() && ($attributes = $this->_cache->load($cacheKey))) {
+            $attributes = unserialize($attributes);
+            if ($attributes) {
+                foreach ($attributes as $attribute) {
+                    $this->_createAttribute($entityType, $attribute);
+                    $this->_attributeData[$entityTypeCode][$attribute['attribute_code']] = $attribute;
+                }
+                return $this;
+            }
+        }
+
         \Magento\Framework\Profiler::start('EAV: ' . __METHOD__, array('group' => 'EAV', 'method' => __METHOD__));
 
-        $attributesInfo = $this->_universalFactory->create(
+        $attributes = $this->_universalFactory->create(
             $entityType->getEntityAttributeCollection()
         )->setEntityTypeFilter(
             $entityType
         )->getData();
 
-        $codes = array();
-        foreach ($attributesInfo as $attribute) {
+        foreach ($attributes as $attribute) {
+            if (empty($attribute['attribute_model'])) {
+                $attribute['attribute_model'] = $entityType->getAttributeModel();
+            }
             $this->_createAttribute($entityType, $attribute);
-            $codes[] = $attribute['attribute_code'];
+            $this->_attributeData[$entityTypeCode][$attribute['attribute_code']] = $attribute;
+        }
+        if ($this->_isCacheEnabled()) {
+            $this->_cache->save(
+                serialize($this->_attributeData[$entityTypeCode]),
+                $cacheKey,
+                array(
+                    \Magento\Eav\Model\Cache\Type::CACHE_TAG,
+                    \Magento\Eav\Model\Entity\Attribute::CACHE_TAG
+                )
+            );
         }
-
-        $entityType->setAttributeCodes($codes);
-        $this->_initializedAttributes[$entityTypeCode] = true;
 
         \Magento\Framework\Profiler::stop('EAV: ' . __METHOD__);
         return $this;
@@ -414,21 +422,16 @@ class Config
      * @param   mixed $entityType
      * @param   mixed $code
      * @return  \Magento\Eav\Model\Entity\Attribute\AbstractAttribute|false
+     * @throws \Magento\Framework\Model\Exception
      */
     public function getAttribute($entityType, $code)
     {
         if ($code instanceof \Magento\Eav\Model\Entity\Attribute\AttributeInterface) {
             return $code;
         }
-
-        \Magento\Framework\Profiler::start('EAV: ' . __METHOD__, array('group' => 'EAV', 'method' => __METHOD__));
+        $this->_initAttributes($entityType);
 
         $entityTypeCode = $this->getEntityType($entityType)->getEntityTypeCode();
-        $entityType = $this->getEntityType($entityType);
-
-        /**
-         * Validate attribute code
-         */
         if (is_numeric($code)) {
             $attributeCode = $this->_getAttributeReference($code, $entityTypeCode);
             if ($attributeCode) {
@@ -437,39 +440,12 @@ class Config
         }
         $attributeKey = $this->_getAttributeKey($entityTypeCode, $code);
 
-        /**
-         * Try use loaded attribute
-         */
         $attribute = $this->_load($attributeKey);
-        if ($attribute) {
-            \Magento\Framework\Profiler::stop('EAV: ' . __METHOD__);
-            return $attribute;
-        }
-
-        if (isset($this->_attributeData[$entityTypeCode][$code])) {
-            $data = $this->_attributeData[$entityTypeCode][$code];
-            unset($this->_attributeData[$entityTypeCode][$code]);
-            $attribute = $this->_universalFactory->create($data['attribute_model'], array('data' => $data));
-        } else {
-            if (is_numeric($code)) {
-                $attribute = $this->_universalFactory->create($entityType->getAttributeModel())->load($code);
-                if ($attribute->getEntityTypeId() != $entityType->getId()) {
-                    return false;
-                }
-                $attributeKey = $this->_getAttributeKey($entityTypeCode, $attribute->getAttributeCode());
-            } else {
-                $attribute = $this->_universalFactory->create(
-                    $entityType->getAttributeModel()
-                )->loadByCode(
-                    $entityType,
-                    $code
-                )->setAttributeCode(
-                    $code
-                );
-            }
-        }
-
-        if ($attribute) {
+        if (!$attribute) {
+            // TODO: refactor wrong method usage in: addAttributeToSelect, joinAttribute
+            $entityType = $this->getEntityType($entityType);
+            $attribute = $this->_universalFactory->create($entityType->getAttributeModel());
+            $attribute->setAttributeCode($code);
             $entity = $entityType->getEntity();
             if ($entity && in_array($attribute->getAttributeCode(), $entity->getDefaultAttributes())) {
                 $attribute->setBackendType(
@@ -478,12 +454,10 @@ class Config
                     1
                 );
             }
-            $attribute->setEntityType($entityType)->setEntityTypeId($entityType->getId());
-            $this->_addAttributeReference($attribute->getId(), $attribute->getAttributeCode(), $entityTypeCode);
+            $this->_addAttributeReference($code, $code, $entityTypeCode);
             $this->_save($attribute, $attributeKey);
         }
         \Magento\Framework\Profiler::stop('EAV: ' . __METHOD__);
-
         return $attribute;
     }
 
@@ -498,18 +472,21 @@ class Config
     {
         $entityType = $this->getEntityType($entityType);
         $attributeSetId = 0;
-        if ($object instanceof \Magento\Framework\Object && $object->getAttributeSetId()) {
-            $attributeSetId = $object->getAttributeSetId();
-        }
         $storeId = 0;
-        if ($object instanceof \Magento\Framework\Object && $object->getStoreId()) {
-            $storeId = $object->getStoreId();
+        if ($object instanceof \Magento\Framework\Object) {
+            $attributeSetId = $object->getAttributeSetId() ?: $attributeSetId;
+            $storeId = $object->getStoreId() ?: $storeId;
         }
-        $cacheKey = sprintf('%d-%d', $entityType->getId(), $attributeSetId);
+        $cacheKey = self::ATTRIBUTES_CODES_CACHE_ID . $entityType->getId() . '-' . $storeId . '-' . $attributeSetId;
         if (isset($this->_attributeCodes[$cacheKey])) {
             return $this->_attributeCodes[$cacheKey];
         }
 
+        if ($this->_isCacheEnabled() && ($attributes = $this->_cache->load($cacheKey))) {
+            $this->_attributeCodes[$cacheKey] = unserialize($attributes);
+            return $this->_attributeCodes[$cacheKey];
+        }
+
         if ($attributeSetId) {
             $attributesInfo = $this->_universalFactory->create(
                 $entityType->getEntityAttributeCollection()
@@ -527,81 +504,22 @@ class Config
             }
         } else {
             $this->_initAttributes($entityType);
-            $attributes = $this->getEntityType($entityType)->getAttributeCodes();
+            $attributes = array_keys($this->_attributeData[$entityType->getEntityTypeCode()]);
         }
 
         $this->_attributeCodes[$cacheKey] = $attributes;
-
-        return $attributes;
-    }
-
-    /**
-     * Preload entity type attributes for performance optimization
-     *
-     * @param   mixed $entityType
-     * @param   mixed $attributes
-     * @return $this
-     */
-    public function preloadAttributes($entityType, $attributes)
-    {
-        if (is_string($attributes)) {
-            $attributes = array($attributes);
-        }
-
-        $entityType = $this->getEntityType($entityType);
-        $entityTypeCode = $entityType->getEntityTypeCode();
-
-        if (!isset($this->_preloadedAttributes[$entityTypeCode])) {
-            $this->_preloadedAttributes[$entityTypeCode] = $attributes;
-        } else {
-            $attributes = array_diff($attributes, $this->_preloadedAttributes[$entityTypeCode]);
-            $this->_preloadedAttributes[$entityTypeCode] = array_merge(
-                $this->_preloadedAttributes[$entityTypeCode],
-                $attributes
+        if ($this->_isCacheEnabled()) {
+            $this->_cache->save(
+                serialize($attributes),
+                $cacheKey,
+                array(
+                    \Magento\Eav\Model\Cache\Type::CACHE_TAG,
+                    \Magento\Eav\Model\Entity\Attribute::CACHE_TAG
+                )
             );
         }
 
-        if (empty($attributes)) {
-            return $this;
-        }
-        \Magento\Framework\Profiler::start(
-            'EAV: ' . __METHOD__ . ':' . $entityTypeCode,
-            array('group' => 'EAV', 'method' => __METHOD__, 'entity_type_code' => $entityTypeCode)
-        );
-
-        $attributesInfo = $this->_universalFactory->create(
-            $entityType->getEntityAttributeCollection()
-        )->setEntityTypeFilter(
-            $entityType
-        )->setCodeFilter(
-            $attributes
-        )->getData();
-
-        if (!$attributesInfo) {
-            \Magento\Framework\Profiler::stop('EAV: ' . __METHOD__ . ':' . $entityTypeCode);
-            return $this;
-        }
-
-        $attributesData = $codes = array();
-
-        foreach ($attributesInfo as $attribute) {
-            if (empty($attribute['attribute_model'])) {
-                $attribute['attribute_model'] = $entityType->getAttributeModel();
-            }
-
-            $attributeCode = $attribute['attribute_code'];
-            $attributeId = $attribute['attribute_id'];
-
-            $this->_addAttributeReference($attributeId, $attributeCode, $entityTypeCode);
-            $attributesData[$attributeCode] = $attribute;
-            $codes[] = $attributeCode;
-        }
-
-        $this->_attributeData[$entityTypeCode] = $attributesData;
-
-        \Magento\Framework\Profiler::stop('EAV: ' . __METHOD__ . ':' . $entityTypeCode);
-
-        return $this;
+        return $attributes;
     }
 
     /**
diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/AbstractBackend.php b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/AbstractBackend.php
index 373add3c0468bf43e35a5be92a5b1228375d0bbb..2da0776686e80e0180e0b0d4e964385cfd4841a5 100644
--- a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/AbstractBackend.php
+++ b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/AbstractBackend.php
@@ -70,19 +70,6 @@ abstract class AbstractBackend implements \Magento\Eav\Model\Entity\Attribute\Ba
      */
     protected $_defaultValue = null;
 
-    /**
-     * @var \Magento\Framework\Logger
-     */
-    protected $_logger;
-
-    /**
-     * @param \Magento\Framework\Logger $logger
-     */
-    public function __construct(\Magento\Framework\Logger $logger)
-    {
-        $this->_logger = $logger;
-    }
-
     /**
      * Set attribute instance
      *
diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Datetime.php b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Datetime.php
index bf9115d096a297511b381311455062461e950f5e..39d8abdca16bf42538fad4be2194f535a9bf3ff1 100644
--- a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Datetime.php
+++ b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Datetime.php
@@ -33,13 +33,11 @@ class Datetime extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBacke
     protected $_localeDate;
 
     /**
-     * @param \Magento\Framework\Logger $logger
      * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate
      */
-    public function __construct(\Magento\Framework\Logger $logger, \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate)
+    public function __construct(\Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate)
     {
         $this->_localeDate = $localeDate;
-        parent::__construct($logger);
     }
 
     /**
diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Store.php b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Store.php
index a51cf76e66b09b12e343e6851e2d329d1d80c9e1..e3438a88897373de8a1c877585cb157044a8d346 100644
--- a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Store.php
+++ b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Store.php
@@ -31,13 +31,11 @@ class Store extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend
     protected $_storeManager;
 
     /**
-     * @param \Magento\Framework\Logger $logger
      * @param \Magento\Framework\StoreManagerInterface $storeManager
      */
-    public function __construct(\Magento\Framework\Logger $logger, \Magento\Framework\StoreManagerInterface $storeManager)
+    public function __construct(\Magento\Framework\StoreManagerInterface $storeManager)
     {
         $this->_storeManager = $storeManager;
-        parent::__construct($logger);
     }
 
     /**
diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Time/Created.php b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Time/Created.php
index 310350b2f88591d31245cfb60cdab18042b04913..dc2af1bd3144b466aa52b3f22dd3a62cbcdf792b 100644
--- a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Time/Created.php
+++ b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Time/Created.php
@@ -34,13 +34,11 @@ class Created extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBacken
     protected $dateTime;
 
     /**
-     * @param \Magento\Framework\Logger $logger
      * @param \Magento\Framework\Stdlib\DateTime $dateTime
      */
-    public function __construct(\Magento\Framework\Logger $logger, \Magento\Framework\Stdlib\DateTime $dateTime)
+    public function __construct(\Magento\Framework\Stdlib\DateTime $dateTime)
     {
         $this->dateTime = $dateTime;
-        parent::__construct($logger);
     }
 
     /**
diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Time/Updated.php b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Time/Updated.php
index 78c10c7d76c969cf054027feef2863c5cd16de81..28227e75c346f1c8ac6368499bd78640b2f0eb19 100644
--- a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Time/Updated.php
+++ b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Time/Updated.php
@@ -34,13 +34,11 @@ class Updated extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBacken
     protected $dateTime;
 
     /**
-     * @param \Magento\Framework\Logger $logger
      * @param \Magento\Framework\Stdlib\DateTime $dateTime
      */
-    public function __construct(\Magento\Framework\Logger $logger, \Magento\Framework\Stdlib\DateTime $dateTime)
+    public function __construct(\Magento\Framework\Stdlib\DateTime $dateTime)
     {
         $this->dateTime = $dateTime;
-        parent::__construct($logger);
     }
 
     /**
diff --git a/app/code/Magento/Eav/Model/Entity/Type.php b/app/code/Magento/Eav/Model/Entity/Type.php
index cd9038f4bd4ef052dfb4ea88e0185842ff3d4b50..9218849a1343a91dc29f2a3cdeaf5aa552c440c9 100644
--- a/app/code/Magento/Eav/Model/Entity/Type.php
+++ b/app/code/Magento/Eav/Model/Entity/Type.php
@@ -357,16 +357,6 @@ class Type extends \Magento\Framework\Model\AbstractModel
         return isset($this->_data['entity_type_code']) ? $this->_data['entity_type_code'] : null;
     }
 
-    /**
-     * Retrieve attribute codes
-     *
-     * @return array|null
-     */
-    public function getAttributeCodes()
-    {
-        return isset($this->_data['attribute_codes']) ? $this->_data['attribute_codes'] : null;
-    }
-
     /**
      * Get attribute model code for entity type
      *
diff --git a/app/code/Magento/Eav/Model/Resource/Entity/Attribute.php b/app/code/Magento/Eav/Model/Resource/Entity/Attribute.php
index e7d4999e4358754481ae131516c3cbdedfefd6cc..d31dc02270d1f18e2eae32dd81a2493744e967a8 100644
--- a/app/code/Magento/Eav/Model/Resource/Entity/Attribute.php
+++ b/app/code/Magento/Eav/Model/Resource/Entity/Attribute.php
@@ -92,28 +92,6 @@ class Attribute extends \Magento\Framework\Model\Resource\Db\AbstractDb
         return $this;
     }
 
-    /**
-     * Load all entity type attributes
-     *
-     * @param int $entityTypeId
-     * @return $this
-     */
-    protected function _loadTypeAttributes($entityTypeId)
-    {
-        if (!isset(self::$_entityAttributes[$entityTypeId])) {
-            $adapter = $this->_getReadAdapter();
-            $bind = array(':entity_type_id' => $entityTypeId);
-            $select = $adapter->select()->from($this->getMainTable())->where('entity_type_id = :entity_type_id');
-
-            $data = $adapter->fetchAll($select, $bind);
-            foreach ($data as $row) {
-                self::$_entityAttributes[$entityTypeId][$row['attribute_code']] = $row;
-            }
-        }
-
-        return $this;
-    }
-
     /**
      * Load attribute data by attribute code
      *
diff --git a/app/code/Magento/Eav/Plugin/Model/Resource/Entity/Attribute.php b/app/code/Magento/Eav/Plugin/Model/Resource/Entity/Attribute.php
new file mode 100644
index 0000000000000000000000000000000000000000..e78c44e67287b96f6b8ac021b42a1715260df625
--- /dev/null
+++ b/app/code/Magento/Eav/Plugin/Model/Resource/Entity/Attribute.php
@@ -0,0 +1,80 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\Eav\Plugin\Model\Resource\Entity;
+
+class Attribute
+{
+    /**
+     * Cache key for store label attribute
+     */
+    const STORE_LABEL_ATTRIBUTE = 'EAV_STORE_LABEL_ATTRIBUTE';
+
+    /** @var \Magento\Framework\App\CacheInterface */
+    protected $cache;
+
+    /** @var bool|null */
+    protected $isCacheEnabled = null;
+
+    /**
+     * @param \Magento\Framework\App\CacheInterface $cache
+     * @param \Magento\Framework\App\Cache\StateInterface $cacheState
+     */
+    public function __construct(
+        \Magento\Framework\App\CacheInterface $cache,
+        \Magento\Framework\App\Cache\StateInterface $cacheState
+    ) {
+        $this->cache = $cache;
+        $this->isCacheEnabled = $cacheState->isEnabled(\Magento\Eav\Model\Cache\Type::TYPE_IDENTIFIER);
+    }
+
+    /**
+     * @param \Magento\Eav\Model\Resource\Entity\Attribute $subject
+     * @param callable $proceed
+     * @param int $attributeId
+     * @return array
+     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+     */
+    public function aroundGetStoreLabelsByAttributeId(
+        \Magento\Eav\Model\Resource\Entity\Attribute $subject,
+        \Closure $proceed,
+        $attributeId
+    ) {
+        $cacheId = self::STORE_LABEL_ATTRIBUTE . $attributeId;
+        if ($this->isCacheEnabled && ($storeLabels = $this->cache->load($cacheId))) {
+            return unserialize($storeLabels);
+        }
+        $storeLabels = $proceed($attributeId);
+        if ($this->isCacheEnabled) {
+            $this->cache->save(
+                serialize($storeLabels),
+                $cacheId,
+                [
+                    \Magento\Eav\Model\Cache\Type::CACHE_TAG,
+                    \Magento\Eav\Model\Entity\Attribute::CACHE_TAG
+                ]
+            );
+        }
+        return $storeLabels;
+    }
+}
diff --git a/app/code/Magento/Eav/composer.json b/app/code/Magento/Eav/composer.json
index 6c6d37ad2dc53f4b518d30d2c1a7b0f5edbd7f66..8d888f993fbf5739027dbab674c245d8713f2a29 100644
--- a/app/code/Magento/Eav/composer.json
+++ b/app/code/Magento/Eav/composer.json
@@ -3,15 +3,15 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-core": "0.1.0-alpha103",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/module-catalog": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-core": "0.1.0-alpha104",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/module-catalog": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/Eav/etc/di.xml b/app/code/Magento/Eav/etc/di.xml
index 6fb75afb1a980cbba20dc72b437c8e1e58a5f605..e62f7dd9b125fdbcd06eb6b17f97d7341cbb7b2f 100644
--- a/app/code/Magento/Eav/etc/di.xml
+++ b/app/code/Magento/Eav/etc/di.xml
@@ -49,4 +49,7 @@
             </argument>
         </arguments>
     </type>
+    <type name="Magento\Eav\Model\Resource\Entity\Attribute">
+        <plugin name="storeLabelCaching" type="Magento\Eav\Plugin\Model\Resource\Entity\Attribute" />
+    </type>
 </config>
diff --git a/app/code/Magento/Email/composer.json b/app/code/Magento/Email/composer.json
index da9af92b589bbea3cc0696617eda999ad6bf1911..bce2ccbaab76451bf09205ebc6830b229e2e5e2e 100644
--- a/app/code/Magento/Email/composer.json
+++ b/app/code/Magento/Email/composer.json
@@ -3,15 +3,15 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-core": "0.1.0-alpha103",
-        "magento/module-cms": "0.1.0-alpha103",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-core": "0.1.0-alpha104",
+        "magento/module-cms": "0.1.0-alpha104",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/Fedex/composer.json b/app/code/Magento/Fedex/composer.json
index 7564c40fe84891083fb09949c64b9cdb9c4b8aff..897ffa1f176a01809899b8b02dc52d7d826f6902 100644
--- a/app/code/Magento/Fedex/composer.json
+++ b/app/code/Magento/Fedex/composer.json
@@ -3,19 +3,19 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-shipping": "0.1.0-alpha103",
-        "magento/module-directory": "0.1.0-alpha103",
-        "magento/module-core": "0.1.0-alpha103",
-        "magento/module-catalog": "0.1.0-alpha103",
-        "magento/module-sales": "0.1.0-alpha103",
-        "magento/module-catalog-inventory": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-shipping": "0.1.0-alpha104",
+        "magento/module-directory": "0.1.0-alpha104",
+        "magento/module-core": "0.1.0-alpha104",
+        "magento/module-catalog": "0.1.0-alpha104",
+        "magento/module-sales": "0.1.0-alpha104",
+        "magento/module-catalog-inventory": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "lib-libxml": "*",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/Fedex/data/fedex_setup/data-install-2.0.0.0.php b/app/code/Magento/Fedex/data/fedex_setup/data-install-2.0.0.php
similarity index 100%
rename from app/code/Magento/Fedex/data/fedex_setup/data-install-2.0.0.0.php
rename to app/code/Magento/Fedex/data/fedex_setup/data-install-2.0.0.php
diff --git a/app/code/Magento/Fedex/etc/module.xml b/app/code/Magento/Fedex/etc/module.xml
index 8f13222ae32a69598908b2b77a36ff40c39b4540..2768394fd10005c59f74855262c9d8bf9e606225 100644
--- a/app/code/Magento/Fedex/etc/module.xml
+++ b/app/code/Magento/Fedex/etc/module.xml
@@ -24,7 +24,7 @@
  */
 -->
 <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
-    <module name="Magento_Fedex" schema_version="2.0.0.0" active="true">
+    <module name="Magento_Fedex" schema_version="2.0.0" active="true">
         <depends>
             <module name="Magento_Store"/>
             <module name="Magento_Shipping"/>
diff --git a/app/code/Magento/GiftMessage/composer.json b/app/code/Magento/GiftMessage/composer.json
index 9c69e019f8e2b5171fa4936b54cd83ebad79cb72..ce43c28f5cce38ffeb6f26e952d9a59751b12439 100644
--- a/app/code/Magento/GiftMessage/composer.json
+++ b/app/code/Magento/GiftMessage/composer.json
@@ -3,20 +3,20 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-catalog": "0.1.0-alpha103",
-        "magento/module-checkout": "0.1.0-alpha103",
-        "magento/module-multishipping": "0.1.0-alpha103",
-        "magento/module-sales": "0.1.0-alpha103",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/module-core": "0.1.0-alpha103",
-        "magento/module-customer": "0.1.0-alpha103",
-        "magento/module-eav": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-catalog": "0.1.0-alpha104",
+        "magento/module-checkout": "0.1.0-alpha104",
+        "magento/module-multishipping": "0.1.0-alpha104",
+        "magento/module-sales": "0.1.0-alpha104",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/module-core": "0.1.0-alpha104",
+        "magento/module-customer": "0.1.0-alpha104",
+        "magento/module-eav": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/GoogleAdwords/composer.json b/app/code/Magento/GoogleAdwords/composer.json
index 113d5f4ce548b9f56907a79e70685b598ba317ce..4d26c26e60fb9b8876b7dbcd9f5fd63a776c4f6e 100644
--- a/app/code/Magento/GoogleAdwords/composer.json
+++ b/app/code/Magento/GoogleAdwords/composer.json
@@ -3,13 +3,13 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-sales": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-sales": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/GoogleAnalytics/composer.json b/app/code/Magento/GoogleAnalytics/composer.json
index 508dbb98670ff01b64f652ff5e5862eafb4b9714..8618b895fcabe05f8df645e729f33e619ada373b 100644
--- a/app/code/Magento/GoogleAnalytics/composer.json
+++ b/app/code/Magento/GoogleAnalytics/composer.json
@@ -3,13 +3,13 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-sales": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-sales": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/GoogleOptimizer/composer.json b/app/code/Magento/GoogleOptimizer/composer.json
index 3ec25dde8dfefd34672d1960751303813377cc18..6ac73e223879540fbd60f5a9465cfff821b142c1 100644
--- a/app/code/Magento/GoogleOptimizer/composer.json
+++ b/app/code/Magento/GoogleOptimizer/composer.json
@@ -3,16 +3,16 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-google-analytics": "0.1.0-alpha103",
-        "magento/module-catalog": "0.1.0-alpha103",
-        "magento/module-cms": "0.1.0-alpha103",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-google-analytics": "0.1.0-alpha104",
+        "magento/module-catalog": "0.1.0-alpha104",
+        "magento/module-cms": "0.1.0-alpha104",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/GoogleShopping/composer.json b/app/code/Magento/GoogleShopping/composer.json
index e79b3cb149f237dd010632885ce18f1ae2e3cb01..8bdd03fa89963707859e2712ef7153469e0a917c 100644
--- a/app/code/Magento/GoogleShopping/composer.json
+++ b/app/code/Magento/GoogleShopping/composer.json
@@ -3,19 +3,19 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-core": "0.1.0-alpha103",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/module-catalog": "0.1.0-alpha103",
-        "magento/module-customer": "0.1.0-alpha103",
-        "magento/module-directory": "0.1.0-alpha103",
-        "magento/module-eav": "0.1.0-alpha103",
-        "magento/module-tax": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-core": "0.1.0-alpha104",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/module-catalog": "0.1.0-alpha104",
+        "magento/module-customer": "0.1.0-alpha104",
+        "magento/module-directory": "0.1.0-alpha104",
+        "magento/module-eav": "0.1.0-alpha104",
+        "magento/module-tax": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/GroupedImportExport/composer.json b/app/code/Magento/GroupedImportExport/composer.json
index 525bf0c37c33aa6bcaf62d5192a13b7039f002c4..29a32c8532142dae524ee206c382c0ff758c77f9 100644
--- a/app/code/Magento/GroupedImportExport/composer.json
+++ b/app/code/Magento/GroupedImportExport/composer.json
@@ -3,16 +3,16 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-catalog": "0.1.0-alpha103",
-        "magento/module-import-export": "0.1.0-alpha103",
-        "magento/module-catalog-import-export": "0.1.0-alpha103",
-        "magento/module-grouped-product": "0.1.0-alpha103",
-        "magento/module-eav": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-catalog": "0.1.0-alpha104",
+        "magento/module-import-export": "0.1.0-alpha104",
+        "magento/module-catalog-import-export": "0.1.0-alpha104",
+        "magento/module-grouped-product": "0.1.0-alpha104",
+        "magento/module-eav": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/GroupedProduct/composer.json b/app/code/Magento/GroupedProduct/composer.json
index a371019206b632bc48f9c0e4863f2b2bc0e02cb8..a4ea85a32ee81fbe75377231d76fdd4d5f258258 100644
--- a/app/code/Magento/GroupedProduct/composer.json
+++ b/app/code/Magento/GroupedProduct/composer.json
@@ -3,21 +3,21 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-catalog": "0.1.0-alpha103",
-        "magento/module-catalog-inventory": "0.1.0-alpha103",
-        "magento/module-sales": "0.1.0-alpha103",
-        "magento/module-core": "0.1.0-alpha103",
-        "magento/module-checkout": "0.1.0-alpha103",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/module-eav": "0.1.0-alpha103",
-        "magento/module-customer": "0.1.0-alpha103",
-        "magento/module-msrp": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-catalog": "0.1.0-alpha104",
+        "magento/module-catalog-inventory": "0.1.0-alpha104",
+        "magento/module-sales": "0.1.0-alpha104",
+        "magento/module-core": "0.1.0-alpha104",
+        "magento/module-checkout": "0.1.0-alpha104",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/module-eav": "0.1.0-alpha104",
+        "magento/module-customer": "0.1.0-alpha104",
+        "magento/module-msrp": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/ImportExport/Model/Import.php b/app/code/Magento/ImportExport/Model/Import.php
index ade0deb91743920bd19bf2d6d8ec105c945fea48..cace1e17b34ff3c976a98ecb9de6ab34b90d3630 100644
--- a/app/code/Magento/ImportExport/Model/Import.php
+++ b/app/code/Magento/ImportExport/Model/Import.php
@@ -114,9 +114,9 @@ class Import extends \Magento\ImportExport\Model\AbstractModel
     protected $_uploaderFactory;
 
     /**
-     * @var \Magento\Indexer\Model\IndexerFactory
+     * @var \Magento\Indexer\Model\IndexerRegistry
      */
-    protected $indexerFactory;
+    protected $indexerRegistry;
 
     /**
      * @var \Magento\ImportExport\Model\Source\Import\Behavior\Factory
@@ -134,14 +134,14 @@ class Import extends \Magento\ImportExport\Model\AbstractModel
      * @param \Magento\Framework\Logger\AdapterFactory $adapterFactory
      * @param \Magento\ImportExport\Helper\Data $importExportData
      * @param \Magento\Framework\App\Config\ScopeConfigInterface $coreConfig
-     * @param \Magento\ImportExport\Model\Import\ConfigInterface $importConfig
-     * @param \Magento\ImportExport\Model\Import\Entity\Factory $entityFactory
-     * @param \Magento\ImportExport\Model\Resource\Import\Data $importData
-     * @param \Magento\ImportExport\Model\Export\Adapter\CsvFactory $csvFactory
-     * @param \Magento\Framework\HTTP\Adapter\FileTransferFactory $httpFactory
+     * @param Import\ConfigInterface $importConfig
+     * @param Import\Entity\Factory $entityFactory
+     * @param Resource\Import\Data $importData
+     * @param Export\Adapter\CsvFactory $csvFactory
+     * @param FileTransferFactory $httpFactory
      * @param \Magento\Core\Model\File\UploaderFactory $uploaderFactory
-     * @param \Magento\ImportExport\Model\Source\Import\Behavior\Factory $behaviorFactory
-     * @param \Magento\Indexer\Model\IndexerFactory $indexerFactory
+     * @param Source\Import\Behavior\Factory $behaviorFactory
+     * @param \Magento\Indexer\Model\IndexerRegistry $indexerRegistry
      * @param array $data
      */
     public function __construct(
@@ -157,7 +157,7 @@ class Import extends \Magento\ImportExport\Model\AbstractModel
         \Magento\Framework\HTTP\Adapter\FileTransferFactory $httpFactory,
         \Magento\Core\Model\File\UploaderFactory $uploaderFactory,
         \Magento\ImportExport\Model\Source\Import\Behavior\Factory $behaviorFactory,
-        \Magento\Indexer\Model\IndexerFactory $indexerFactory,
+        \Magento\Indexer\Model\IndexerRegistry $indexerRegistry,
         array $data = array()
     ) {
         $this->_importExportData = $importExportData;
@@ -168,7 +168,7 @@ class Import extends \Magento\ImportExport\Model\AbstractModel
         $this->_csvFactory = $csvFactory;
         $this->_httpFactory = $httpFactory;
         $this->_uploaderFactory = $uploaderFactory;
-        $this->indexerFactory = $indexerFactory;
+        $this->indexerRegistry = $indexerRegistry;
         $this->_behaviorFactory = $behaviorFactory;
         $this->_filesystem = $filesystem;
         parent::__construct($logger, $filesystem, $adapterFactory, $data);
@@ -573,9 +573,8 @@ class Import extends \Magento\ImportExport\Model\AbstractModel
         }
 
         foreach (array_keys($relatedIndexers) as $indexerId) {
-            $indexer = $this->indexerFactory->create();
             try {
-                $indexer->load($indexerId);
+                $indexer = $this->indexerRegistry->get($indexerId);
                 $indexer->invalidate();
             } catch (\InvalidArgumentException $e) {
             }
diff --git a/app/code/Magento/ImportExport/composer.json b/app/code/Magento/ImportExport/composer.json
index 74afea4be232a660dbe91f734be70d21dd806266..f4c145eb45ba74843ea486378cde40c761459efe 100644
--- a/app/code/Magento/ImportExport/composer.json
+++ b/app/code/Magento/ImportExport/composer.json
@@ -3,17 +3,17 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-core": "0.1.0-alpha103",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/module-eav": "0.1.0-alpha103",
-        "magento/module-indexer": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-core": "0.1.0-alpha104",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/module-eav": "0.1.0-alpha104",
+        "magento/module-indexer": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "ext-ctype": "*",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/Indexer/Controller/Adminhtml/Indexer/MassChangelog.php b/app/code/Magento/Indexer/Controller/Adminhtml/Indexer/MassChangelog.php
index 979f028918f9cf935aace685ede60527cf59aa5b..f4c53bd93ece1be2498e8382c20ad7bbc6e226d0 100644
--- a/app/code/Magento/Indexer/Controller/Adminhtml/Indexer/MassChangelog.php
+++ b/app/code/Magento/Indexer/Controller/Adminhtml/Indexer/MassChangelog.php
@@ -38,13 +38,9 @@ class MassChangelog extends \Magento\Indexer\Controller\Adminhtml\Indexer
             $this->messageManager->addError(__('Please select indexers.'));
         } else {
             try {
-                foreach ($indexerIds as $indexer_id) {
+                foreach ($indexerIds as $indexerId) {
                     /** @var \Magento\Indexer\Model\IndexerInterface $model */
-                    $model = $this->_objectManager->create(
-                        'Magento\Indexer\Model\IndexerInterface'
-                    )->load(
-                        $indexer_id
-                    );
+                    $model = $this->_objectManager->get('Magento\Indexer\Model\IndexerRegistry')->get($indexerId);
                     $model->setScheduled(true);
                 }
                 $this->messageManager->addSuccess(
diff --git a/app/code/Magento/Indexer/Controller/Adminhtml/Indexer/MassOnTheFly.php b/app/code/Magento/Indexer/Controller/Adminhtml/Indexer/MassOnTheFly.php
index f2d6ffd32c0a79c759c82acc1edabf3ca1e53661..48fb3319dba5dd39e55817cf9b9cf7be6da7bbeb 100644
--- a/app/code/Magento/Indexer/Controller/Adminhtml/Indexer/MassOnTheFly.php
+++ b/app/code/Magento/Indexer/Controller/Adminhtml/Indexer/MassOnTheFly.php
@@ -38,13 +38,9 @@ class MassOnTheFly extends \Magento\Indexer\Controller\Adminhtml\Indexer
             $this->messageManager->addError(__('Please select indexers.'));
         } else {
             try {
-                foreach ($indexerIds as $indexer_id) {
+                foreach ($indexerIds as $indexerId) {
                     /** @var \Magento\Indexer\Model\IndexerInterface $model */
-                    $model = $this->_objectManager->create(
-                        'Magento\Indexer\Model\IndexerInterface'
-                    )->load(
-                        $indexer_id
-                    );
+                    $model = $this->_objectManager->get('Magento\Indexer\Model\IndexerRegistry')->get($indexerId);
                     $model->setScheduled(false);
                 }
                 $this->messageManager->addSuccess(
diff --git a/app/code/Magento/Indexer/Model/ActionInterface.php b/app/code/Magento/Indexer/Model/ActionInterface.php
index 5db6a971fc15dbc56a70a4d43ee31f4b170024e1..20d68865b9c6ea5da12dfde42c7b5037c628e02b 100644
--- a/app/code/Magento/Indexer/Model/ActionInterface.php
+++ b/app/code/Magento/Indexer/Model/ActionInterface.php
@@ -38,7 +38,7 @@ interface ActionInterface
      * @param int[] $ids
      * @return void
      */
-    public function executeList($ids);
+    public function executeList(array $ids);
 
     /**
      * Execute partial indexation by ID
diff --git a/app/code/Magento/Indexer/Model/Indexer/AbstractProcessor.php b/app/code/Magento/Indexer/Model/Indexer/AbstractProcessor.php
index b5cccf62e6878a9ac5286ce2b6a3079ca2251312..3c97ac2ba10bbc3da555fb935d840b92d0ef7415 100644
--- a/app/code/Magento/Indexer/Model/Indexer/AbstractProcessor.php
+++ b/app/code/Magento/Indexer/Model/Indexer/AbstractProcessor.php
@@ -33,18 +33,16 @@ abstract class AbstractProcessor
      */
     const INDEXER_ID = '';
 
-    /**
-     * @var \Magento\Indexer\Model\IndexerInterface
-     */
-    protected $_indexer;
+    /** @var \Magento\Indexer\Model\IndexerRegistry */
+    protected $indexerRegistry;
 
     /**
-     * @param \Magento\Indexer\Model\IndexerFactory $indexerFactory
+     * @param \Magento\Indexer\Model\IndexerRegistry $indexerRegistry
      */
     public function __construct(
-        \Magento\Indexer\Model\IndexerFactory $indexerFactory
+        \Magento\Indexer\Model\IndexerRegistry $indexerRegistry
     ) {
-        $this->_indexer = $indexerFactory->create();
+        $this->indexerRegistry = $indexerRegistry;
     }
 
     /**
@@ -54,10 +52,7 @@ abstract class AbstractProcessor
      */
     public function getIndexer()
     {
-        if (!$this->_indexer->getId()) {
-            $this->_indexer->load(static::INDEXER_ID);
-        }
-        return $this->_indexer;
+        return $this->indexerRegistry->get(static::INDEXER_ID);
     }
 
     /**
diff --git a/app/code/Magento/Indexer/Model/IndexerRegistry.php b/app/code/Magento/Indexer/Model/IndexerRegistry.php
new file mode 100644
index 0000000000000000000000000000000000000000..1088c3e9c91e15ec3e3dbe7920e05f7c8578a189
--- /dev/null
+++ b/app/code/Magento/Indexer/Model/IndexerRegistry.php
@@ -0,0 +1,60 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\Indexer\Model;
+
+class IndexerRegistry
+{
+    /**
+     * @var \Magento\Framework\ObjectManager
+     */
+    protected $objectManager;
+
+    /**
+     * @var IndexerInterface[]
+     */
+    protected $indexers = [];
+
+    /**
+     * @param \Magento\Framework\ObjectManager $objectManager
+     */
+    public function __construct(\Magento\Framework\ObjectManager $objectManager)
+    {
+        $this->objectManager = $objectManager;
+    }
+
+    /**
+     * Retrieve indexer instance by id
+     *
+     * @param string $indexerId
+     * @return IndexerInterface
+     */
+    public function get($indexerId)
+    {
+        if (!isset($this->indexers[$indexerId])) {
+            $this->indexers[$indexerId] = $this->objectManager->create('Magento\Indexer\Model\IndexerInterface')
+                ->load($indexerId);
+        }
+        return $this->indexers[$indexerId];
+    }
+}
diff --git a/app/code/Magento/Indexer/composer.json b/app/code/Magento/Indexer/composer.json
index 4d5f4a80fd5b9d1be242f3e4a0d178f93754506f..02434dabfb0aa75e286a5abfbd800f7010d2668b 100644
--- a/app/code/Magento/Indexer/composer.json
+++ b/app/code/Magento/Indexer/composer.json
@@ -3,13 +3,13 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/module-page-cache": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/module-page-cache": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/Integration/composer.json b/app/code/Magento/Integration/composer.json
index 8abd0ede0e4908fced09e70bb85b88dee850cc3e..6d086ae2da008e09640b09b98b66628d9ee2dc24 100644
--- a/app/code/Magento/Integration/composer.json
+++ b/app/code/Magento/Integration/composer.json
@@ -3,17 +3,17 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-core": "0.1.0-alpha103",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/module-customer": "0.1.0-alpha103",
-        "magento/module-user": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
-        "magento/module-authorization": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-core": "0.1.0-alpha104",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/module-customer": "0.1.0-alpha104",
+        "magento/module-user": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
+        "magento/module-authorization": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/LayeredNavigation/composer.json b/app/code/Magento/LayeredNavigation/composer.json
index 194a561b6702d04b6aec5bbe1a5d8a0f8ac4a6b3..b019476a30bcb5d6633cbc49ce158c8bf36be4ec 100644
--- a/app/code/Magento/LayeredNavigation/composer.json
+++ b/app/code/Magento/LayeredNavigation/composer.json
@@ -3,13 +3,13 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-catalog": "0.1.0-alpha103",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-catalog": "0.1.0-alpha104",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/Log/composer.json b/app/code/Magento/Log/composer.json
index e6decb233a938bbed19e33bbde3245e246db8c60..63212cbe67965b21e0e4ee9f05f36eb4f4d1304e 100644
--- a/app/code/Magento/Log/composer.json
+++ b/app/code/Magento/Log/composer.json
@@ -3,16 +3,16 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-core": "0.1.0-alpha103",
-        "magento/module-customer": "0.1.0-alpha103",
-        "magento/module-eav": "0.1.0-alpha103",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-core": "0.1.0-alpha104",
+        "magento/module-customer": "0.1.0-alpha104",
+        "magento/module-eav": "0.1.0-alpha104",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/Msrp/composer.json b/app/code/Magento/Msrp/composer.json
index 2fb27823c7b173a547a5965d7197db923f1a2968..dc8eaec8526f7f0b68901329925df638125f73cb 100644
--- a/app/code/Magento/Msrp/composer.json
+++ b/app/code/Magento/Msrp/composer.json
@@ -3,21 +3,21 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-bundle": "0.1.0-alpha103",
-        "magento/module-catalog": "0.1.0-alpha103",
-        "magento/module-configurable-product": "0.1.0-alpha103",
-        "magento/module-core": "0.1.0-alpha103",
-        "magento/module-downloadable": "0.1.0-alpha103",
-        "magento/module-eav": "0.1.0-alpha103",
-        "magento/module-grouped-product": "0.1.0-alpha103",
-        "magento/module-sales": "0.1.0-alpha103",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-tax": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-bundle": "0.1.0-alpha104",
+        "magento/module-catalog": "0.1.0-alpha104",
+        "magento/module-configurable-product": "0.1.0-alpha104",
+        "magento/module-core": "0.1.0-alpha104",
+        "magento/module-downloadable": "0.1.0-alpha104",
+        "magento/module-eav": "0.1.0-alpha104",
+        "magento/module-grouped-product": "0.1.0-alpha104",
+        "magento/module-sales": "0.1.0-alpha104",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-tax": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/Multishipping/composer.json b/app/code/Magento/Multishipping/composer.json
index e4df9fe320eb0ce1c60eca4ae8dbb2c0558ccce3..0776bfff1a27c59865147bec71a215d2c8cf7462 100644
--- a/app/code/Magento/Multishipping/composer.json
+++ b/app/code/Magento/Multishipping/composer.json
@@ -3,19 +3,19 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-core": "0.1.0-alpha103",
-        "magento/module-checkout": "0.1.0-alpha103",
-        "magento/module-sales": "0.1.0-alpha103",
-        "magento/module-payment": "0.1.0-alpha103",
-        "magento/module-tax": "0.1.0-alpha103",
-        "magento/module-customer": "0.1.0-alpha103",
-        "magento/module-theme": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-core": "0.1.0-alpha104",
+        "magento/module-checkout": "0.1.0-alpha104",
+        "magento/module-sales": "0.1.0-alpha104",
+        "magento/module-payment": "0.1.0-alpha104",
+        "magento/module-tax": "0.1.0-alpha104",
+        "magento/module-customer": "0.1.0-alpha104",
+        "magento/module-theme": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/Newsletter/composer.json b/app/code/Magento/Newsletter/composer.json
index 2095dfd29d1493fea55720f5f40399a75351523f..45695e6b333d01d115423546564384cc4358f58b 100644
--- a/app/code/Magento/Newsletter/composer.json
+++ b/app/code/Magento/Newsletter/composer.json
@@ -3,20 +3,20 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-core": "0.1.0-alpha103",
-        "magento/module-customer": "0.1.0-alpha103",
-        "magento/module-widget": "0.1.0-alpha103",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/module-cms": "0.1.0-alpha103",
-        "magento/module-email": "0.1.0-alpha103",
-        "magento/module-cron": "0.1.0-alpha103",
-        "magento/module-eav": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-core": "0.1.0-alpha104",
+        "magento/module-customer": "0.1.0-alpha104",
+        "magento/module-widget": "0.1.0-alpha104",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/module-cms": "0.1.0-alpha104",
+        "magento/module-email": "0.1.0-alpha104",
+        "magento/module-cron": "0.1.0-alpha104",
+        "magento/module-eav": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/OfflinePayments/composer.json b/app/code/Magento/OfflinePayments/composer.json
index 2b06806aa09575ce958bd9e4e74b119b17d1fe4d..6a2a6b3a91ccf9e1907e9832719a5a0db5913a23 100644
--- a/app/code/Magento/OfflinePayments/composer.json
+++ b/app/code/Magento/OfflinePayments/composer.json
@@ -3,12 +3,12 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-payment": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-payment": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/OfflinePayments/etc/module.xml b/app/code/Magento/OfflinePayments/etc/module.xml
index 24f917885dbea5dedb1731569112aad07d030996..7f24be74c198bc6768221743d0517d2eba4376c6 100644
--- a/app/code/Magento/OfflinePayments/etc/module.xml
+++ b/app/code/Magento/OfflinePayments/etc/module.xml
@@ -24,7 +24,7 @@
  */
 -->
 <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
-    <module name="Magento_OfflinePayments" schema_version="1.6.0.0" active="true">
+    <module name="Magento_OfflinePayments" schema_version="2.0.0" active="true">
         <sequence>
             <module name="Magento_Core"/>
             <module name="Magento_Store"/>
diff --git a/app/code/Magento/OfflineShipping/composer.json b/app/code/Magento/OfflineShipping/composer.json
index 3a7d0d251f57fdde3e3a88beeb06325e0d518935..5d34d020ddec68ed43cf53f9a031a936dc877a37 100644
--- a/app/code/Magento/OfflineShipping/composer.json
+++ b/app/code/Magento/OfflineShipping/composer.json
@@ -3,19 +3,19 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/module-shipping": "0.1.0-alpha103",
-        "magento/module-catalog": "0.1.0-alpha103",
-        "magento/module-sales": "0.1.0-alpha103",
-        "magento/module-sales-rule": "0.1.0-alpha103",
-        "magento/module-directory": "0.1.0-alpha103",
-        "magento/module-checkout": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/module-shipping": "0.1.0-alpha104",
+        "magento/module-catalog": "0.1.0-alpha104",
+        "magento/module-sales": "0.1.0-alpha104",
+        "magento/module-sales-rule": "0.1.0-alpha104",
+        "magento/module-directory": "0.1.0-alpha104",
+        "magento/module-checkout": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/OfflineShipping/etc/module.xml b/app/code/Magento/OfflineShipping/etc/module.xml
index bd98e5a2db56836210eac076f7566a3f42c00907..40fa442036c4d70bd632b292e673eceffac8629c 100644
--- a/app/code/Magento/OfflineShipping/etc/module.xml
+++ b/app/code/Magento/OfflineShipping/etc/module.xml
@@ -24,7 +24,7 @@
  */
 -->
 <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
-    <module name="Magento_OfflineShipping" schema_version="2.0.0.0" active="true">
+    <module name="Magento_OfflineShipping" schema_version="2.0.0" active="true">
         <sequence>
             <module name="Magento_Store"/>
             <module name="Magento_Sales"/>
diff --git a/app/code/Magento/OfflineShipping/sql/offlineshipping_setup/install-2.0.0.0.php b/app/code/Magento/OfflineShipping/sql/offlineshipping_setup/install-2.0.0.php
similarity index 95%
rename from app/code/Magento/OfflineShipping/sql/offlineshipping_setup/install-2.0.0.0.php
rename to app/code/Magento/OfflineShipping/sql/offlineshipping_setup/install-2.0.0.php
index 2432d3e6996154519e1c0eda0405ded497c77865..cf30803cb236398511497913c9f94b3eec5f5fdc 100644
--- a/app/code/Magento/OfflineShipping/sql/offlineshipping_setup/install-2.0.0.0.php
+++ b/app/code/Magento/OfflineShipping/sql/offlineshipping_setup/install-2.0.0.php
@@ -108,7 +108,7 @@ $installer->getConnection()->addColumn(
     'Simple Free Shipping'
 );
 $installer->getConnection()->addColumn(
-    $installer->getTable('sales_flat_order_item'),
+    $installer->getTable('sales_order_item'),
     'free_shipping',
     \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
     null,
@@ -116,7 +116,7 @@ $installer->getConnection()->addColumn(
     'Free Shipping'
 );
 $installer->getConnection()->addColumn(
-    $installer->getTable('sales_flat_quote_address'),
+    $installer->getTable('sales_quote_address'),
     'free_shipping',
     \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
     null,
@@ -124,7 +124,7 @@ $installer->getConnection()->addColumn(
     'Free Shipping'
 );
 $installer->getConnection()->addColumn(
-    $installer->getTable('sales_flat_quote_item'),
+    $installer->getTable('sales_quote_item'),
     'free_shipping',
     \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
     null,
@@ -132,7 +132,7 @@ $installer->getConnection()->addColumn(
     'Free Shipping'
 );
 $installer->getConnection()->addColumn(
-    $installer->getTable('sales_flat_quote_address_item'),
+    $installer->getTable('sales_quote_address_item'),
     'free_shipping',
     \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
     null,
diff --git a/app/code/Magento/Ogone/composer.json b/app/code/Magento/Ogone/composer.json
index dc6ff442783adba16798ae21ecdecc47c149f3b7..300d6a60503cc3f961d4ba47904c9b41d1bd4564 100644
--- a/app/code/Magento/Ogone/composer.json
+++ b/app/code/Magento/Ogone/composer.json
@@ -3,15 +3,15 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-sales": "0.1.0-alpha103",
-        "magento/module-payment": "0.1.0-alpha103",
-        "magento/module-checkout": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-sales": "0.1.0-alpha104",
+        "magento/module-payment": "0.1.0-alpha104",
+        "magento/module-checkout": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/Ogone/data/ogone_setup/data-install-1.6.0.0.php b/app/code/Magento/Ogone/data/ogone_setup/data-install-2.0.0.php
similarity index 100%
rename from app/code/Magento/Ogone/data/ogone_setup/data-install-1.6.0.0.php
rename to app/code/Magento/Ogone/data/ogone_setup/data-install-2.0.0.php
diff --git a/app/code/Magento/Ogone/etc/module.xml b/app/code/Magento/Ogone/etc/module.xml
index d5a600a2aa7dac1fc299d5e2004ed4bff4f554ca..875cd11e011e770e3f34208a8ac3543ac58673d5 100644
--- a/app/code/Magento/Ogone/etc/module.xml
+++ b/app/code/Magento/Ogone/etc/module.xml
@@ -24,7 +24,7 @@
  */
 -->
 <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
-    <module name="Magento_Ogone" schema_version="1.6.0.0" active="true">
+    <module name="Magento_Ogone" schema_version="2.0.0" active="true">
         <sequence>
             <module name="Magento_Sales"/>
             <module name="Magento_Payment"/>
diff --git a/app/code/Magento/PageCache/composer.json b/app/code/Magento/PageCache/composer.json
index b80a9f8d3a52f4050693a3b9f7f8245526d2759f..bc79d590b4e23fba1efb6207c76b50c6796cbc07 100644
--- a/app/code/Magento/PageCache/composer.json
+++ b/app/code/Magento/PageCache/composer.json
@@ -3,13 +3,13 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/PayPalRecurringPayment/composer.json b/app/code/Magento/PayPalRecurringPayment/composer.json
index c7e5ca5291b3f6b7e2d7d41e97bbbf2a5aaf486d..f3695b3101716d5c37cdd2bd04d646faccd47253 100644
--- a/app/code/Magento/PayPalRecurringPayment/composer.json
+++ b/app/code/Magento/PayPalRecurringPayment/composer.json
@@ -3,17 +3,17 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-customer": "0.1.0-alpha103",
-        "magento/module-directory": "0.1.0-alpha103",
-        "magento/module-payment": "0.1.0-alpha103",
-        "magento/module-paypal": "0.1.0-alpha103",
-        "magento/module-recurring-payment": "0.1.0-alpha103",
-        "magento/module-sales": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-customer": "0.1.0-alpha104",
+        "magento/module-directory": "0.1.0-alpha104",
+        "magento/module-payment": "0.1.0-alpha104",
+        "magento/module-paypal": "0.1.0-alpha104",
+        "magento/module-recurring-payment": "0.1.0-alpha104",
+        "magento/module-sales": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/PayPalRecurringPayment/etc/module.xml b/app/code/Magento/PayPalRecurringPayment/etc/module.xml
index c0f24a5bf8276dbeed7516315bc29b20831646f9..42e091d878ef5bdd710fffc24613ed92ba794b4b 100644
--- a/app/code/Magento/PayPalRecurringPayment/etc/module.xml
+++ b/app/code/Magento/PayPalRecurringPayment/etc/module.xml
@@ -24,7 +24,7 @@
  */
 -->
 <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
-    <module name="Magento_PayPalRecurringPayment" schema_version="1.0.0.0" active="true">
+    <module name="Magento_PayPalRecurringPayment" schema_version="2.0.0" active="true">
         <depends>
             <module name="Magento_Customer"/>
             <module name="Magento_Directory"/>
diff --git a/app/code/Magento/Payment/Model/Info.php b/app/code/Magento/Payment/Model/Info.php
index b2989c643e4739b524e753c5fba85dd84457a596..01706937d073042c77a66bb89e97b75ae271fac2 100644
--- a/app/code/Magento/Payment/Model/Info.php
+++ b/app/code/Magento/Payment/Model/Info.php
@@ -217,8 +217,12 @@ class Info extends \Magento\Framework\Model\AbstractModel
      */
     protected function _initAdditionalInformation()
     {
-        if (empty($this->_additionalInformation) && $this->_getData('additional_information')) {
-            $this->_additionalInformation = $this->_getData('additional_information');
+        $additionalInfo = $this->_getData('additional_information');
+        if (empty($this->_additionalInformation) && $additionalInfo) {
+            if (!is_array($additionalInfo)) {
+                $additionalInfo = unserialize($additionalInfo);
+            }
+            $this->_additionalInformation = $additionalInfo;
         }
     }
 }
diff --git a/app/code/Magento/Payment/composer.json b/app/code/Magento/Payment/composer.json
index a10ad27cc9ce58970c39a13eb681d878a4714f5f..8b7ad14ae655066c77d9e77c3c43a9fe3b8bbded 100644
--- a/app/code/Magento/Payment/composer.json
+++ b/app/code/Magento/Payment/composer.json
@@ -3,16 +3,16 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-core": "0.1.0-alpha103",
-        "magento/module-sales": "0.1.0-alpha103",
-        "magento/module-centinel": "0.1.0-alpha103",
-        "magento/module-checkout": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-core": "0.1.0-alpha104",
+        "magento/module-sales": "0.1.0-alpha104",
+        "magento/module-centinel": "0.1.0-alpha104",
+        "magento/module-checkout": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/Payment/etc/module.xml b/app/code/Magento/Payment/etc/module.xml
index 08103caabeffe25b25f844148d3af1a832232bc4..0c2de188ef556983badb76633656496a3bf46233 100644
--- a/app/code/Magento/Payment/etc/module.xml
+++ b/app/code/Magento/Payment/etc/module.xml
@@ -24,7 +24,7 @@
  */
 -->
 <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
-    <module name="Magento_Payment" schema_version="1.6.0.0" active="true">
+    <module name="Magento_Payment" schema_version="2.0.0" active="true">
         <sequence>
             <module name="Magento_Core"/>
             <module name="Magento_Store"/>
diff --git a/app/code/Magento/Paypal/Model/Api/AbstractApi.php b/app/code/Magento/Paypal/Model/Api/AbstractApi.php
index 5f7c6e3f777422612a612136430d6fde7fd80595..15efd4db6adb151d2760a720087ce2a2567c72c9 100644
--- a/app/code/Magento/Paypal/Model/Api/AbstractApi.php
+++ b/app/code/Magento/Paypal/Model/Api/AbstractApi.php
@@ -306,7 +306,7 @@ abstract class AbstractApi extends \Magento\Framework\Object
      * @param array $publicMap
      * @return array|\Magento\Framework\Object
      */
-    public function &import($to, array $publicMap = array())
+    public function import($to, array $publicMap = array())
     {
         return \Magento\Framework\Object\Mapper::accumulateByMap(array($this, 'getDataUsingMethod'), $to, $publicMap);
     }
diff --git a/app/code/Magento/Paypal/composer.json b/app/code/Magento/Paypal/composer.json
index 7cca4e588801dc19e87b41dbe1d482d337a6d8d2..4302f9947945fab9961057f11f86bb2af507759f 100644
--- a/app/code/Magento/Paypal/composer.json
+++ b/app/code/Magento/Paypal/composer.json
@@ -3,25 +3,25 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-checkout": "0.1.0-alpha103",
-        "magento/module-sales": "0.1.0-alpha103",
-        "magento/module-core": "0.1.0-alpha103",
-        "magento/module-customer": "0.1.0-alpha103",
-        "magento/module-payment": "0.1.0-alpha103",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/module-tax": "0.1.0-alpha103",
-        "magento/module-directory": "0.1.0-alpha103",
-        "magento/module-theme": "0.1.0-alpha103",
-        "magento/module-centinel": "0.1.0-alpha103",
-        "magento/module-catalog": "0.1.0-alpha103",
-        "magento/module-eav": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-checkout": "0.1.0-alpha104",
+        "magento/module-sales": "0.1.0-alpha104",
+        "magento/module-core": "0.1.0-alpha104",
+        "magento/module-customer": "0.1.0-alpha104",
+        "magento/module-payment": "0.1.0-alpha104",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/module-tax": "0.1.0-alpha104",
+        "magento/module-directory": "0.1.0-alpha104",
+        "magento/module-theme": "0.1.0-alpha104",
+        "magento/module-centinel": "0.1.0-alpha104",
+        "magento/module-catalog": "0.1.0-alpha104",
+        "magento/module-eav": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "lib-libxml": "*",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/Paypal/data/paypal_setup/data-install-1.6.0.0.php b/app/code/Magento/Paypal/data/paypal_setup/data-install-2.0.0.php
similarity index 91%
rename from app/code/Magento/Paypal/data/paypal_setup/data-install-1.6.0.0.php
rename to app/code/Magento/Paypal/data/paypal_setup/data-install-2.0.0.php
index c1a85daa4350d42b50024fc65e963e33c0ba3912..779aa18f971b59cd2f73317eb0f8f8d069605d48 100644
--- a/app/code/Magento/Paypal/data/paypal_setup/data-install-1.6.0.0.php
+++ b/app/code/Magento/Paypal/data/paypal_setup/data-install-2.0.0.php
@@ -44,7 +44,11 @@ $installer->addAttribute(
 );
 
 $data = array();
-$statuses = array('pending_paypal' => __('Pending PayPal'));
+$statuses = array(
+    'pending_paypal' => __('Pending PayPal'),
+    'paypal_reversed' => __('PayPal Reversed'),
+    'paypal_canceled_reversal'  => __('PayPal Canceled Reversal')
+);
 foreach ($statuses as $code => $info) {
     $data[] = array('status' => $code, 'label' => $info);
 }
diff --git a/app/code/Magento/Paypal/data/paypal_setup/data-upgrade-1.6.0.2-1.6.0.3.php b/app/code/Magento/Paypal/data/paypal_setup/data-upgrade-1.6.0.2-1.6.0.3.php
deleted file mode 100644
index b34584387c7a07dd74e18e208523fd7e7bbd50b4..0000000000000000000000000000000000000000
--- a/app/code/Magento/Paypal/data/paypal_setup/data-upgrade-1.6.0.2-1.6.0.3.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-/** @var $this \Magento\Sales\Model\Resource\Setup */
-$installer = $this;
-$connection = $installer->getConnection();
-$installer->startSetup();
-$data = array(
-    array('paypal_reversed', 'PayPal Reversed'),
-    array('paypal_canceled_reversal', 'PayPal Canceled Reversal')
-);
-$connection = $installer->getConnection()->insertArray(
-    $installer->getTable('sales_order_status'),
-    array('status', 'label'),
-    $data
-);
-$installer->endSetup();
diff --git a/app/code/Magento/Paypal/etc/module.xml b/app/code/Magento/Paypal/etc/module.xml
index 228996c72b5e40fb408ac462a85cdefeb903a19d..ba80a69b3c17512cb2e3450f3fe0f251fce3485a 100644
--- a/app/code/Magento/Paypal/etc/module.xml
+++ b/app/code/Magento/Paypal/etc/module.xml
@@ -24,7 +24,7 @@
  */
 -->
 <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
-    <module name="Magento_Paypal" schema_version="1.6.0.4" active="true">
+    <module name="Magento_Paypal" schema_version="2.0.0" active="true">
         <sequence>
             <module name="Magento_Checkout"/>
             <module name="Magento_Sales"/>
diff --git a/app/code/Magento/Paypal/sql/paypal_setup/install-1.6.0.0.php b/app/code/Magento/Paypal/sql/paypal_setup/install-2.0.0.php
similarity index 88%
rename from app/code/Magento/Paypal/sql/paypal_setup/install-1.6.0.0.php
rename to app/code/Magento/Paypal/sql/paypal_setup/install-2.0.0.php
index b1809bf6af86343c0881cab69917571bf72ffc17..8107bd4b7c75bd044272c3fda0a1703a970f57a2 100644
--- a/app/code/Magento/Paypal/sql/paypal_setup/install-1.6.0.0.php
+++ b/app/code/Magento/Paypal/sql/paypal_setup/install-2.0.0.php
@@ -147,9 +147,9 @@ $table = $installer->getConnection()->newTable(
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->addForeignKey(
-    $installer->getFkName('paypal_billing_agreement_order', 'order_id', 'sales_flat_order', 'entity_id'),
+    $installer->getFkName('paypal_billing_agreement_order', 'order_id', 'sales_order', 'entity_id'),
     'order_id',
-    $installer->getTable('sales_flat_order'),
+    $installer->getTable('sales_order'),
     'entity_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
@@ -313,6 +313,18 @@ $table = $installer->getConnection()->newTable(
     127,
     array(),
     'Consumer Id'
+)->addColumn(
+    'payment_tracking_id',
+    \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
+    255,
+    array(),
+    'Payment Tracking ID'
+)->addColumn(
+    'store_id',
+    \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
+    50,
+    array(),
+    'Store ID'
 )->addIndex(
     $installer->getIdxName('paypal_settlement_report_row', array('report_id')),
     array('report_id')
@@ -370,6 +382,47 @@ $table = $installer->getConnection()->newTable(
 )->setComment(
     'Paypal Certificate Table'
 );
+
+/**
+ * Create table 'paypal_payment_transaction'
+ */
+$table = $installer->getConnection()->newTable(
+    $installer->getTable('paypal_payment_transaction')
+)->addColumn(
+    'transaction_id',
+    \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
+    null,
+    array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true),
+    'Entity Id'
+)->addColumn(
+    'txn_id',
+    \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
+    100,
+    array(),
+    'Txn Id'
+)->addColumn(
+    'additional_information',
+    \Magento\Framework\DB\Ddl\Table::TYPE_BLOB,
+    '64K',
+    array(),
+    'Additional Information'
+)->addColumn(
+    'created_at',
+    \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP,
+    null,
+    array(),
+    'Created At'
+)->addIndex(
+    $installer->getIdxName(
+        'paypal_payment_transaction',
+        array('txn_id'),
+        \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
+    ),
+    array('txn_id'),
+    array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
+)->setComment(
+    'PayPal Payflow Link Payment Transaction'
+);
 $installer->getConnection()->createTable($table);
 /**
  * Prepare database after install
diff --git a/app/code/Magento/Paypal/sql/paypal_setup/upgrade-1.6.0.0-1.6.0.1.php b/app/code/Magento/Paypal/sql/paypal_setup/upgrade-1.6.0.0-1.6.0.1.php
deleted file mode 100644
index 7355597d8f51809043be3ebe127562419a106e33..0000000000000000000000000000000000000000
--- a/app/code/Magento/Paypal/sql/paypal_setup/upgrade-1.6.0.0-1.6.0.1.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-/** @var $installer \Magento\Setup\Module\SetupModule */
-$installer = $this;
-
-/**
- * Create table 'paypal_payment_transaction'
- */
-$table = $installer->getConnection()->newTable(
-    $installer->getTable('paypal_payment_transaction')
-)->addColumn(
-    'transaction_id',
-    \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
-    null,
-    array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true),
-    'Entity Id'
-)->addColumn(
-    'txn_id',
-    \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
-    100,
-    array(),
-    'Txn Id'
-)->addColumn(
-    'additional_information',
-    \Magento\Framework\DB\Ddl\Table::TYPE_BLOB,
-    '64K',
-    array(),
-    'Additional Information'
-)->addColumn(
-    'created_at',
-    \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP,
-    null,
-    array(),
-    'Created At'
-)->addIndex(
-    $installer->getIdxName(
-        'paypal_payment_transaction',
-        array('txn_id'),
-        \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
-    ),
-    array('txn_id'),
-    array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
-)->setComment(
-    'PayPal Payflow Link Payment Transaction'
-);
-$installer->getConnection()->createTable($table);
diff --git a/app/code/Magento/Persistent/composer.json b/app/code/Magento/Persistent/composer.json
index 5c946c684d0a68291116bc5a3a43764d258b117d..ea9bb11020a84f75564d492711176aac1580289d 100644
--- a/app/code/Magento/Persistent/composer.json
+++ b/app/code/Magento/Persistent/composer.json
@@ -3,17 +3,17 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-checkout": "0.1.0-alpha103",
-        "magento/module-core": "0.1.0-alpha103",
-        "magento/module-customer": "0.1.0-alpha103",
-        "magento/module-sales": "0.1.0-alpha103",
-        "magento/module-cron": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-checkout": "0.1.0-alpha104",
+        "magento/module-core": "0.1.0-alpha104",
+        "magento/module-customer": "0.1.0-alpha104",
+        "magento/module-sales": "0.1.0-alpha104",
+        "magento/module-cron": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/Persistent/etc/frontend/di.xml b/app/code/Magento/Persistent/etc/frontend/di.xml
index db997b25019ebfe93d6a8808947a10929dfbc904..4e381ebb770cc76e999b76f22e8492bbc804945e 100644
--- a/app/code/Magento/Persistent/etc/frontend/di.xml
+++ b/app/code/Magento/Persistent/etc/frontend/di.xml
@@ -31,4 +31,9 @@
             </argument>
         </arguments>
     </type>
+    <type name="Magento\Persistent\Model\Observer\EmulateQuote">
+        <arguments>
+            <argument name="customerAccountService" xsi:type="object">Magento\Customer\Service\V1\CustomerAccountServiceInterface\Proxy</argument>
+        </arguments>
+    </type>
 </config>
diff --git a/app/code/Magento/Persistent/sql/persistent_setup/install-1.0.0.0.php b/app/code/Magento/Persistent/sql/persistent_setup/install-1.0.0.0.php
index fb33978aa5d690ca5080aba62b810f48e85913f8..12d2aab293d1a65f47853577eb39ddb1cf9a6a9a 100644
--- a/app/code/Magento/Persistent/sql/persistent_setup/install-1.0.0.0.php
+++ b/app/code/Magento/Persistent/sql/persistent_setup/install-1.0.0.0.php
@@ -97,11 +97,11 @@ $table = $installer->getConnection()->newTable(
 $installer->getConnection()->createTable($table);
 
 /**
- * Alter sales_flat_quote table with is_persistent flag
+ * Alter sales_quote table with is_persistent flag
  *
  */
 $installer->getConnection()->addColumn(
-    $installer->getTable('sales_flat_quote'),
+    $installer->getTable('sales_quote'),
     'is_persistent',
     array(
         'type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
diff --git a/app/code/Magento/ProductAlert/composer.json b/app/code/Magento/ProductAlert/composer.json
index 838a97b3f97567325410c309cf36fac20c01f8a5..6a98e206a3b42fb83f209a31684df7474bc8ed5a 100644
--- a/app/code/Magento/ProductAlert/composer.json
+++ b/app/code/Magento/ProductAlert/composer.json
@@ -3,15 +3,15 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-catalog": "0.1.0-alpha103",
-        "magento/module-customer": "0.1.0-alpha103",
-        "magento/module-core": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-catalog": "0.1.0-alpha104",
+        "magento/module-customer": "0.1.0-alpha104",
+        "magento/module-core": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/RecurringPayment/composer.json b/app/code/Magento/RecurringPayment/composer.json
index b4b05b2f40d1bce9f054d3f8dd91d12966035a12..853e3e05419618cb97776d745aaa50e7aad90a96 100644
--- a/app/code/Magento/RecurringPayment/composer.json
+++ b/app/code/Magento/RecurringPayment/composer.json
@@ -3,22 +3,22 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/module-core": "0.1.0-alpha103",
-        "magento/module-catalog": "0.1.0-alpha103",
-        "magento/module-checkout": "0.1.0-alpha103",
-        "magento/module-customer": "0.1.0-alpha103",
-        "magento/module-eav": "0.1.0-alpha103",
-        "magento/module-payment": "0.1.0-alpha103",
-        "magento/module-sales": "0.1.0-alpha103",
-        "magento/module-theme": "0.1.0-alpha103",
-        "magento/module-catalog-inventory": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/module-core": "0.1.0-alpha104",
+        "magento/module-catalog": "0.1.0-alpha104",
+        "magento/module-checkout": "0.1.0-alpha104",
+        "magento/module-customer": "0.1.0-alpha104",
+        "magento/module-eav": "0.1.0-alpha104",
+        "magento/module-payment": "0.1.0-alpha104",
+        "magento/module-sales": "0.1.0-alpha104",
+        "magento/module-theme": "0.1.0-alpha104",
+        "magento/module-catalog-inventory": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/RecurringPayment/data/recurringpayment_setup/data-install-1.0.0.0.php b/app/code/Magento/RecurringPayment/data/recurringpayment_setup/data-install-2.0.0.php
similarity index 100%
rename from app/code/Magento/RecurringPayment/data/recurringpayment_setup/data-install-1.0.0.0.php
rename to app/code/Magento/RecurringPayment/data/recurringpayment_setup/data-install-2.0.0.php
diff --git a/app/code/Magento/RecurringPayment/etc/frontend/di.xml b/app/code/Magento/RecurringPayment/etc/frontend/di.xml
new file mode 100644
index 0000000000000000000000000000000000000000..886edd277de3f3f24fe2ec5fb04ed0d6eb45eeb3
--- /dev/null
+++ b/app/code/Magento/RecurringPayment/etc/frontend/di.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+<!--
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Academic Free License (AFL 3.0)
+ * that is bundled with this package in the file LICENSE_AFL.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/afl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
+ */
+-->
+<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">
+    <type name="Magento\RecurringPayment\Model\RecurringPayment">
+        <arguments>
+            <argument name="fields" xsi:type="object">Magento\RecurringPayment\Block\Fields\Proxy</argument>
+        </arguments>
+    </type>
+</config>
diff --git a/app/code/Magento/RecurringPayment/etc/module.xml b/app/code/Magento/RecurringPayment/etc/module.xml
index a2f6dbc541cb8b8f673948d17a1ee8650d89caef..75e605cd693ec204e6a377aa7e01ac8c216c9cd5 100644
--- a/app/code/Magento/RecurringPayment/etc/module.xml
+++ b/app/code/Magento/RecurringPayment/etc/module.xml
@@ -24,7 +24,7 @@
  */
 -->
 <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
-    <module name="Magento_RecurringPayment" schema_version="1.0.0.0" active="true">
+    <module name="Magento_RecurringPayment" schema_version="2.0.0" active="true">
         <sequence>
             <module name="Magento_Sales"/>
             <module name="Magento_User"/>
diff --git a/app/code/Magento/RecurringPayment/sql/recurringpayment_setup/install-1.0.0.0.php b/app/code/Magento/RecurringPayment/sql/recurringpayment_setup/install-2.0.0.php
similarity index 99%
rename from app/code/Magento/RecurringPayment/sql/recurringpayment_setup/install-1.0.0.0.php
rename to app/code/Magento/RecurringPayment/sql/recurringpayment_setup/install-2.0.0.php
index 06f5e086605256f45e1ad4d73ab557501464d9e2..d7fae978e7615e49a96e0c21da63a443612ac36d 100644
--- a/app/code/Magento/RecurringPayment/sql/recurringpayment_setup/install-1.0.0.0.php
+++ b/app/code/Magento/RecurringPayment/sql/recurringpayment_setup/install-2.0.0.php
@@ -296,9 +296,9 @@ $table = $this->getConnection()->newTable(
     $this->getIdxName('recurring_payment_order', array('order_id')),
     array('order_id')
 )->addForeignKey(
-    $this->getFkName('recurring_payment_order', 'order_id', 'sales_flat_order', 'entity_id'),
+    $this->getFkName('recurring_payment_order', 'order_id', 'sales_order', 'entity_id'),
     'order_id',
-    $this->getTable('sales_flat_order'),
+    $this->getTable('sales_order'),
     'entity_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
diff --git a/app/code/Magento/Reports/Model/Resource/Customer/Collection.php b/app/code/Magento/Reports/Model/Resource/Customer/Collection.php
index 2889c8e40a3a76ddfb1a1e9480f40a2d2bc5723b..5c0955ec4042550650a9cf59f647d812b4a48725 100644
--- a/app/code/Magento/Reports/Model/Resource/Customer/Collection.php
+++ b/app/code/Magento/Reports/Model/Resource/Customer/Collection.php
@@ -187,7 +187,7 @@ class Collection extends \Magento\Customer\Model\Resource\Customer\Collection
         }
 
         $this->getSelect()->joinLeft(
-            array('orders' => $this->getTable('sales_flat_order')),
+            array('orders' => $this->getTable('sales_order')),
             "orders.customer_id = e.entity_id" . $dateFilter,
             array()
         );
@@ -288,7 +288,7 @@ class Collection extends \Magento\Customer\Model\Resource\Customer\Collection
 
             $select = $this->getConnection()->select();
             $select->from(
-                array('orders' => $this->getTable('sales_flat_order')),
+                array('orders' => $this->getTable('sales_order')),
                 array(
                     'orders_avg_amount' => "AVG({$totalExpr})",
                     'orders_sum_amount' => "SUM({$totalExpr})",
diff --git a/app/code/Magento/Reports/Model/Resource/Order/Collection.php b/app/code/Magento/Reports/Model/Resource/Order/Collection.php
index 23134cd656ed67545a86fbe9e3e1d793f02d0d82..f9bc7d973b50e36e1a24b95028e9cce98e337afc 100644
--- a/app/code/Magento/Reports/Model/Resource/Order/Collection.php
+++ b/app/code/Magento/Reports/Model/Resource/Order/Collection.php
@@ -212,7 +212,7 @@ class Collection extends \Magento\Sales\Model\Resource\Order\Collection
      */
     protected function _prepareSummaryLive($range, $customStart, $customEnd, $isFilter = 0)
     {
-        $this->setMainTable('sales_flat_order');
+        $this->setMainTable('sales_order');
         $adapter = $this->getConnection();
 
         /**
@@ -510,7 +510,7 @@ class Collection extends \Magento\Sales\Model\Resource\Order\Collection
      */
     protected function _calculateTotalsLive($isFilter = 0)
     {
-        $this->setMainTable('sales_flat_order');
+        $this->setMainTable('sales_order');
         $this->removeAllFieldsFromSelect();
 
         $adapter = $this->getConnection();
@@ -623,7 +623,7 @@ class Collection extends \Magento\Sales\Model\Resource\Order\Collection
             }
             $this->getSelect()->where('main_table.order_status NOT IN(?)', $statuses);
         } else {
-            $this->setMainTable('sales_flat_order');
+            $this->setMainTable('sales_order');
             $this->removeAllFieldsFromSelect();
 
             $expr = $this->_getSalesAmountExpression();
diff --git a/app/code/Magento/Reports/Model/Resource/Product/Collection.php b/app/code/Magento/Reports/Model/Resource/Product/Collection.php
index d255990093d12115c137db24af82e8e7bde72577..ee49c760130acad1d2bba399852042ee207c010c 100644
--- a/app/code/Magento/Reports/Model/Resource/Product/Collection.php
+++ b/app/code/Magento/Reports/Model/Resource/Product/Collection.php
@@ -252,10 +252,10 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection
         if ($this->_selectCountSqlType == self::SELECT_COUNT_SQL_TYPE_CART) {
             $countSelect = clone $this->getSelect();
             $countSelect->reset()->from(
-                array('quote_item_table' => $this->getTable('sales_flat_quote_item')),
+                array('quote_item_table' => $this->getTable('sales_quote_item')),
                 array('COUNT(DISTINCT quote_item_table.product_id)')
             )->join(
-                array('quote_table' => $this->getTable('sales_flat_quote')),
+                array('quote_table' => $this->getTable('sales_quote')),
                 'quote_table.entity_id = quote_item_table.quote_id AND quote_table.is_active = 1',
                 array()
             );
@@ -285,10 +285,10 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection
         $countSelect->reset();
 
         $countSelect->from(
-            array('quote_items' => $this->getTable('sales_flat_quote_item')),
+            array('quote_items' => $this->getTable('sales_quote_item')),
             'COUNT(*)'
         )->join(
-            array('quotes' => $this->getTable('sales_flat_quote')),
+            array('quotes' => $this->getTable('sales_quote')),
             'quotes.entity_id = quote_items.quote_id AND quotes.is_active = 1',
             array()
         )->where(
@@ -316,7 +316,7 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection
      */
     public function addOrdersCount($from = '', $to = '')
     {
-        $orderItemTableName = $this->getTable('sales_flat_order_item');
+        $orderItemTableName = $this->getTable('sales_order_item');
         $productFieldName = sprintf('e.%s', $this->getProductEntityId());
 
         $this->getSelect()->joinLeft(
@@ -373,10 +373,10 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection
         }
 
         $this->getSelect()->reset()->from(
-            array('order_items' => $this->getTable('sales_flat_order_item')),
+            array('order_items' => $this->getTable('sales_order_item')),
             array('ordered_qty' => 'SUM(order_items.qty_ordered)', 'order_items_name' => 'order_items.name')
         )->joinInner(
-            array('order' => $this->getTable('sales_flat_order')),
+            array('order' => $this->getTable('sales_order')),
             implode(' AND ', $orderJoinCondition),
             array()
         )->joinLeft(
diff --git a/app/code/Magento/Reports/Model/Resource/Quote/Collection.php b/app/code/Magento/Reports/Model/Resource/Quote/Collection.php
index 984b00dfa77511cf3d1e1eb9bded2a9fe91e2a69..4098da01538dc94341a82b59bbf43e046fccf922 100644
--- a/app/code/Magento/Reports/Model/Resource/Quote/Collection.php
+++ b/app/code/Magento/Reports/Model/Resource/Quote/Collection.php
@@ -147,7 +147,7 @@ class Collection extends \Magento\Sales\Model\Resource\Quote\Collection
 
         $ordersSubSelect = clone $this->getSelect();
         $ordersSubSelect->reset()->from(
-            array('oi' => $this->getTable('sales_flat_order_item')),
+            array('oi' => $this->getTable('sales_order_item')),
             array('orders' => new \Zend_Db_Expr('COUNT(1)'), 'product_id')
         )->group(
             'oi.product_id'
@@ -158,7 +158,7 @@ class Collection extends \Magento\Sales\Model\Resource\Quote\Collection
         )->reset(
             \Zend_Db_Select::COLUMNS
         )->joinInner(
-            array('quote_items' => $this->getTable('sales_flat_quote_item')),
+            array('quote_items' => $this->getTable('sales_quote_item')),
             'quote_items.quote_id = main_table.entity_id',
             null
         )->joinInner(
diff --git a/app/code/Magento/Reports/composer.json b/app/code/Magento/Reports/composer.json
index 2742899c658f87ba921ce9a24dfecb76cdb39194..8b4926bd206d043e67b48aa028a4983d965f96b3 100644
--- a/app/code/Magento/Reports/composer.json
+++ b/app/code/Magento/Reports/composer.json
@@ -3,27 +3,27 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-eav": "0.1.0-alpha103",
-        "magento/module-customer": "0.1.0-alpha103",
-        "magento/module-catalog": "0.1.0-alpha103",
-        "magento/module-sales": "0.1.0-alpha103",
-        "magento/module-cms": "0.1.0-alpha103",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/module-core": "0.1.0-alpha103",
-        "magento/module-widget": "0.1.0-alpha103",
-        "magento/module-log": "0.1.0-alpha103",
-        "magento/module-wishlist": "0.1.0-alpha103",
-        "magento/module-review": "0.1.0-alpha103",
-        "magento/module-catalog-inventory": "0.1.0-alpha103",
-        "magento/module-tax": "0.1.0-alpha103",
-        "magento/module-downloadable": "0.1.0-alpha103",
-        "magento/module-sales-rule": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-eav": "0.1.0-alpha104",
+        "magento/module-customer": "0.1.0-alpha104",
+        "magento/module-catalog": "0.1.0-alpha104",
+        "magento/module-sales": "0.1.0-alpha104",
+        "magento/module-cms": "0.1.0-alpha104",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/module-core": "0.1.0-alpha104",
+        "magento/module-widget": "0.1.0-alpha104",
+        "magento/module-log": "0.1.0-alpha104",
+        "magento/module-wishlist": "0.1.0-alpha104",
+        "magento/module-review": "0.1.0-alpha104",
+        "magento/module-catalog-inventory": "0.1.0-alpha104",
+        "magento/module-tax": "0.1.0-alpha104",
+        "magento/module-downloadable": "0.1.0-alpha104",
+        "magento/module-sales-rule": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/RequireJs/composer.json b/app/code/Magento/RequireJs/composer.json
index d890eb8dd6427e2442fddfe934cb962bff49f074..8641f5e0b9cfada0b2d7d9ad01800d1964622486 100644
--- a/app/code/Magento/RequireJs/composer.json
+++ b/app/code/Magento/RequireJs/composer.json
@@ -3,11 +3,11 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/Review/Block/Product/Review.php b/app/code/Magento/Review/Block/Product/Review.php
index ed15320b73b5f80424b46aa427665d63912df5ca..73714ba9919da4c24ff7d238a5c6008c618fc66f 100644
--- a/app/code/Magento/Review/Block/Product/Review.php
+++ b/app/code/Magento/Review/Block/Product/Review.php
@@ -47,13 +47,13 @@ class Review extends \Magento\Framework\View\Element\Template
     protected $_reviewsColFactory;
 
     /**
-     * @param \Magento\Backend\Block\Template\Context $context
+     * @param \Magento\Framework\View\Element\Template\Context $context
      * @param \Magento\Framework\Registry $registry
      * @param \Magento\Review\Model\Resource\Review\CollectionFactory $collectionFactory
      * @param array $data
      */
     public function __construct(
-        \Magento\Backend\Block\Template\Context $context,
+        \Magento\Framework\View\Element\Template\Context $context,
         \Magento\Framework\Registry $registry,
         \Magento\Review\Model\Resource\Review\CollectionFactory $collectionFactory,
         array $data = array()
diff --git a/app/code/Magento/Review/composer.json b/app/code/Magento/Review/composer.json
index acf1ecf72c66d936cac35769192058dcdedc19c6..47420672b6038eb5b35d052023cfd6c3a22a6e26 100644
--- a/app/code/Magento/Review/composer.json
+++ b/app/code/Magento/Review/composer.json
@@ -3,20 +3,20 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-catalog": "0.1.0-alpha103",
-        "magento/module-core": "0.1.0-alpha103",
-        "magento/module-customer": "0.1.0-alpha103",
-        "magento/module-eav": "0.1.0-alpha103",
-        "magento/module-theme": "0.1.0-alpha103",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/module-tax": "0.1.0-alpha103",
-        "magento/module-newsletter": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-catalog": "0.1.0-alpha104",
+        "magento/module-core": "0.1.0-alpha104",
+        "magento/module-customer": "0.1.0-alpha104",
+        "magento/module-eav": "0.1.0-alpha104",
+        "magento/module-theme": "0.1.0-alpha104",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/module-tax": "0.1.0-alpha104",
+        "magento/module-newsletter": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/Rss/composer.json b/app/code/Magento/Rss/composer.json
index 12d22eadd1ab38a3ee12716ddacb3ab2fe490498..beed028e0ea81b59773d2a7da32fb535733aaf5b 100644
--- a/app/code/Magento/Rss/composer.json
+++ b/app/code/Magento/Rss/composer.json
@@ -3,14 +3,14 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
-        "magento/module-customer": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
+        "magento/module-customer": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/Rule/Model/Condition/Combine.php b/app/code/Magento/Rule/Model/Condition/Combine.php
index e079e2d2c69d4c76026cd7d863c860f818c9f419..87239a38323c69e1552de2bba52db86c5654f13b 100644
--- a/app/code/Magento/Rule/Model/Condition/Combine.php
+++ b/app/code/Magento/Rule/Model/Condition/Combine.php
@@ -25,13 +25,6 @@ namespace Magento\Rule\Model\Condition;
 
 class Combine extends AbstractCondition
 {
-    /**
-     * Store all used condition models
-     *
-     * @var array
-     */
-    protected $_conditionModels = array();
-
     /**
      * @var \Magento\Rule\Model\ConditionFactory
      */
@@ -75,36 +68,6 @@ class Combine extends AbstractCondition
         }
     }
 
-    /**
-     * Retrieve new object for each requested model.
-     * If model is requested first time, store it at static array.
-     *
-     * It's made by performance reasons to avoid initialization of same models each time when rules are being processed.
-     *
-     * @param  string $modelClass
-     * @return AbstractCondition|bool
-     */
-    protected function _getNewConditionModelInstance($modelClass)
-    {
-        if (empty($modelClass)) {
-            return false;
-        }
-
-        if (!array_key_exists($modelClass, $this->_conditionModels)) {
-            $model = $this->_conditionFactory->create($modelClass);
-            $this->_conditionModels[$modelClass] = $model;
-        } else {
-            $model = $this->_conditionModels[$modelClass];
-        }
-
-        if (!$model) {
-            return false;
-        }
-
-        $newModel = clone $model;
-        return $newModel;
-    }
-
     /* start aggregator methods */
     /**
      * @return $this
@@ -266,13 +229,11 @@ class Combine extends AbstractCondition
         );
 
         if (!empty($arr[$key]) && is_array($arr[$key])) {
-            foreach ($arr[$key] as $condArr) {
+            foreach ($arr[$key] as $conditionArr) {
                 try {
-                    $cond = $this->_getNewConditionModelInstance($condArr['type']);
-                    if ($cond) {
-                        $this->addCondition($cond);
-                        $cond->loadArray($condArr, $key);
-                    }
+                    $condition = $this->_conditionFactory->create($conditionArr['type']);
+                    $this->addCondition($condition);
+                    $condition->loadArray($conditionArr, $key);
                 } catch (\Exception $e) {
                     $this->_logger->logException($e);
                 }
diff --git a/app/code/Magento/Rule/Model/Condition/Product/AbstractProduct.php b/app/code/Magento/Rule/Model/Condition/Product/AbstractProduct.php
index fda5e0744cb9fa32aeefeb9a89b0776b575b7f7d..3a706165d7226acd9725d403eb5cf4c4215ae6ad 100644
--- a/app/code/Magento/Rule/Model/Condition/Product/AbstractProduct.php
+++ b/app/code/Magento/Rule/Model/Condition/Product/AbstractProduct.php
@@ -331,11 +331,11 @@ abstract class AbstractProduct extends \Magento\Rule\Model\Condition\AbstractCon
     {
         $attribute = $this->getAttribute();
         if ('category_ids' != $attribute) {
+            $productCollection->addAttributeToSelect($attribute, 'left');
             if ($this->getAttributeObject()->isScopeGlobal()) {
                 $attributes = $this->getRule()->getCollectedAttributes();
                 $attributes[$attribute] = true;
                 $this->getRule()->setCollectedAttributes($attributes);
-                $productCollection->addAttributeToSelect($attribute, 'left');
             } else {
                 $this->_entityAttributeValues = $productCollection->getAllAttributeValues($attribute);
             }
@@ -607,14 +607,20 @@ abstract class AbstractProduct extends \Magento\Rule\Model\Condition\AbstractCon
     }
 
     /**
-     * Get field by attribute
+     * Get mapped sql field
      *
      * @return string
      */
     public function getMappedSqlField()
     {
-
-        return ($this->getAttribute() == 'category_ids') ? 'e.entity_id' : parent::getMappedSqlField();
+        if (!$this->isAttributeSetOrCategory()) {
+            $mappedSqlField = $this->getEavAttributeTableAlias() . '.value';
+        } elseif ($this->getAttribute() == 'category_ids') {
+            $mappedSqlField = 'e.entity_id';
+        } else {
+            $mappedSqlField = parent::getMappedSqlField();
+        }
+        return $mappedSqlField;
     }
 
     /**
@@ -702,4 +708,26 @@ abstract class AbstractProduct extends \Magento\Rule\Model\Condition\AbstractCon
 
         return $operator;
     }
+
+    /**
+     * Check is attribute set or category
+     *
+     * @return bool
+     */
+    protected function isAttributeSetOrCategory()
+    {
+        return in_array($this->getAttribute(), ['attribute_set_id', 'category_ids']);
+    }
+
+    /**
+     * Get eav attribute alias
+     *
+     * @return string
+     */
+    protected function getEavAttributeTableAlias()
+    {
+        $attribute = $this->getAttributeObject();
+
+        return 'at_' . $attribute->getAttributeCode();
+    }
 }
diff --git a/app/code/Magento/Rule/Model/Condition/Sql/Builder.php b/app/code/Magento/Rule/Model/Condition/Sql/Builder.php
index 2f2cedbea3055eb2ec02720cf96b7179f2f6a07d..dac518d9a4f2a98c31aa43e1c4c6b00e9f1ef501 100644
--- a/app/code/Magento/Rule/Model/Condition/Sql/Builder.php
+++ b/app/code/Magento/Rule/Model/Condition/Sql/Builder.php
@@ -119,7 +119,8 @@ class Builder
             /** @var $condition AbstractCondition */
             $collection->getSelect()->joinLeft(
                 [$alias => $collection->getResource()->getTable($joinTable['name'])],
-                $joinTable['condition']
+                $joinTable['condition'],
+                isset($joinTable['columns']) ? $joinTable['columns'] : '*'
             );
         }
         return $this;
diff --git a/app/code/Magento/Rule/Model/ConditionFactory.php b/app/code/Magento/Rule/Model/ConditionFactory.php
index e03c3f0d767f416c632eedd688a9bc26d854dabf..95b18789ba8fd8fc2a1fda6411b3bd0a4b054a66 100644
--- a/app/code/Magento/Rule/Model/ConditionFactory.php
+++ b/app/code/Magento/Rule/Model/ConditionFactory.php
@@ -23,30 +23,48 @@
  */
 namespace Magento\Rule\Model;
 
+use Magento\Framework\ObjectManager;
+
 class ConditionFactory
 {
     /**
-     * @var \Magento\Framework\ObjectManager
+     * @var ObjectManager
+     */
+    private $objectManager;
+
+    /**
+     * Store all used condition models
+     *
+     * @var array
      */
-    protected $_objectManager;
+    private $conditionModels = [];
 
     /**
-     * @param \Magento\Framework\ObjectManager $objectManager
+     * @param ObjectManager $objectManager
      */
-    public function __construct(\Magento\Framework\ObjectManager $objectManager)
+    public function __construct(ObjectManager $objectManager)
     {
-        $this->_objectManager = $objectManager;
+        $this->objectManager = $objectManager;
     }
 
     /**
-     * Create new action object
+     * Create new object for each requested model.
+     * If model is requested first time, store it at array.
+     * It's made by performance reasons to avoid initialization of same models each time when rules are being processed.
      *
      * @param string $type
-     * @param array $data
+     *
      * @return \Magento\Rule\Model\Condition\ConditionInterface
+     *
+     * @throws \LogicException
+     * @throws \BadMethodCallException
      */
-    public function create($type, array $data = array())
+    public function create($type)
     {
-        return $this->_objectManager->create($type, $data);
+        if (!array_key_exists($type, $this->conditionModels)) {
+            $this->conditionModels[$type] = $this->objectManager->create($type);
+        }
+
+        return clone $this->conditionModels[$type];
     }
 }
diff --git a/app/code/Magento/Rule/composer.json b/app/code/Magento/Rule/composer.json
index 02b8dfdb00a8bb4943966603c4585d6b01b54501..01c7fdadc746f53498a185f21ca317fe5aafa8b3 100644
--- a/app/code/Magento/Rule/composer.json
+++ b/app/code/Magento/Rule/composer.json
@@ -3,16 +3,16 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-eav": "0.1.0-alpha103",
-        "magento/module-catalog": "0.1.0-alpha103",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-eav": "0.1.0-alpha104",
+        "magento/module-catalog": "0.1.0-alpha104",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "lib-libxml": "*",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/Sales/Model/AdminOrder/Create.php b/app/code/Magento/Sales/Model/AdminOrder/Create.php
index f3d45333bb3e46c06d46218a0d1ef1340d8f0952..897b51f3370ed28c888cbaaa0b69cbb2b2f54194 100644
--- a/app/code/Magento/Sales/Model/AdminOrder/Create.php
+++ b/app/code/Magento/Sales/Model/AdminOrder/Create.php
@@ -1493,7 +1493,8 @@ class Create extends \Magento\Framework\Object implements \Magento\Checkout\Mode
         $request = $form->prepareRequest($accountData);
         $data = $form->extractData($request);
         $data = $form->restoreData($data);
-        $customer = $this->_customerBuilder->mergeDataObjectWithArray($customer, $data);
+        $customer = $this->_customerBuilder->mergeDataObjectWithArray($customer, $data)
+            ->create();
         $this->getQuote()->updateCustomerData($customer);
         $data = array();
 
@@ -1604,7 +1605,8 @@ class Create extends \Magento\Framework\Object implements \Magento\Checkout\Mode
                 unset($data[$key]);
             }
         }
-        return $this->_customerBuilder->mergeDataObjectWithArray($customerDataObject, $data);
+        return $this->_customerBuilder->mergeDataObjectWithArray($customerDataObject, $data)
+            ->create();
     }
 
     /**
@@ -1702,7 +1704,7 @@ class Create extends \Magento\Framework\Object implements \Magento\Checkout\Mode
             $customerAddressDataObject = $this->_customerAddressBuilder->mergeDataObjects(
                 $existingAddressDataObject,
                 $customerAddressDataObject
-            );
+            )->create();
         } elseif ($addressType == CustomerAddressDataObject::ADDRESS_TYPE_SHIPPING) {
             try {
                 $billingAddressDataObject = $this->_customerAddressService->getDefaultBillingAddress($customerId);
diff --git a/app/code/Magento/Sales/Model/Observer/Frontend/Quote/Address/CollectTotals.php b/app/code/Magento/Sales/Model/Observer/Frontend/Quote/Address/CollectTotals.php
index c88b04b27bd004417a12b6c074f06e5056c021e0..f867d7fdce95a8f3b2113fdd40bbd549e2d42a91 100644
--- a/app/code/Magento/Sales/Model/Observer/Frontend/Quote/Address/CollectTotals.php
+++ b/app/code/Magento/Sales/Model/Observer/Frontend/Quote/Address/CollectTotals.php
@@ -109,7 +109,7 @@ class CollectTotals
             $customerData = $this->customerBuilder->mergeDataObjectWithArray(
                 $customerData,
                 array('group_id' => $groupId)
-            );
+            )->create();
             $quote->setCustomerData($customerData);
         }
     }
diff --git a/app/code/Magento/Sales/Model/Quote.php b/app/code/Magento/Sales/Model/Quote.php
index 72165ecb21c34cf23ec0d6f7a440f6d55362a6cc..aea40921e5fd9852bff3ee42b2286ae421c765a5 100644
--- a/app/code/Magento/Sales/Model/Quote.php
+++ b/app/code/Magento/Sales/Model/Quote.php
@@ -179,6 +179,11 @@ class Quote extends \Magento\Framework\Model\AbstractModel
      */
     protected $_payments;
 
+    /**
+     * @var \Magento\Sales\Model\Quote\Payment
+     */
+    protected $_currentPayment;
+
     /**
      * Different groups of error infos
      *
@@ -533,6 +538,10 @@ class Quote extends \Magento\Framework\Model\AbstractModel
         if (null !== $this->_payments) {
             $this->getPaymentsCollection()->save();
         }
+
+        if (null !== $this->_currentPayment) {
+            $this->getPayment()->save();
+        }
         return $this;
     }
 
@@ -1593,7 +1602,15 @@ class Quote extends \Magento\Framework\Model\AbstractModel
      */
     public function getPayment()
     {
-        foreach ($this->getPaymentsCollection() as $payment) {
+        if (null === $this->_currentPayment || !$this->_currentPayment) {
+            $this->_currentPayment = $this->_quotePaymentCollectionFactory->create()
+                ->setQuoteFilter($this->getId())
+                ->getFirstItem();
+        }
+        if ($payment = $this->_currentPayment) {
+            if ($this->getId()) {
+                $payment->setQuote($this);
+            }
             if (!$payment->isDeleted()) {
                 return $payment;
             }
diff --git a/app/code/Magento/Sales/Model/Quote/Payment.php b/app/code/Magento/Sales/Model/Quote/Payment.php
index b7c50268f63abba0c8d0247cea71fa226c299f62..6801cfccc4e7dc40aa1cab4d51e8bd245d75fb66 100644
--- a/app/code/Magento/Sales/Model/Quote/Payment.php
+++ b/app/code/Magento/Sales/Model/Quote/Payment.php
@@ -159,21 +159,16 @@ class Payment extends \Magento\Payment\Model\Info
 
         $this->setMethod($data->getMethod());
         $method = $this->getMethodInstance();
+        $quote = $this->getQuote();
 
         /**
          * Payment availability related with quote totals.
          * We have to recollect quote totals before checking
          */
-        $this->getQuote()->collectTotals();
-
-        if (!$method->isAvailable(
-            $this->getQuote()
-        ) || !$this->methodSpecificationFactory->create(
-            $data->getChecks()
-        )->isApplicable(
-            $method,
-            $this->getQuote()
-        )
+        $quote->collectTotals();
+
+        if (!$method->isAvailable($quote)
+            || !$this->methodSpecificationFactory->create($data->getChecks())->isApplicable($method, $quote)
         ) {
             throw new \Magento\Framework\Model\Exception(__('The requested Payment Method is not available.'));
         }
diff --git a/app/code/Magento/Sales/Model/Resource/AbstractGrid.php b/app/code/Magento/Sales/Model/Resource/AbstractGrid.php
index 01da9011b074b98e18bc1bbdf9f7e86c9afe9742..62f5126129fcd69203a8cd8147b1fd87ce76cf04 100644
--- a/app/code/Magento/Sales/Model/Resource/AbstractGrid.php
+++ b/app/code/Magento/Sales/Model/Resource/AbstractGrid.php
@@ -45,12 +45,12 @@ abstract class AbstractGrid extends AbstractDb implements GridInterface
     /**
      * @var string
      */
-    protected $orderTableName = 'sales_flat_order';
+    protected $orderTableName = 'sales_order';
 
     /**
      * @var string
      */
-    protected $addressTableName = 'sales_flat_order_address';
+    protected $addressTableName = 'sales_order_address';
 
     /**
      * @param AppResource $resource
diff --git a/app/code/Magento/Sales/Model/Resource/Order.php b/app/code/Magento/Sales/Model/Resource/Order.php
index 0950d18db3270e4b0703de0d221e1754b4fbfcfd..5dcb87177f9ab4edb429f28182bdf69b311d5d97 100644
--- a/app/code/Magento/Sales/Model/Resource/Order.php
+++ b/app/code/Magento/Sales/Model/Resource/Order.php
@@ -70,7 +70,7 @@ class Order extends SalesResource
      */
     protected function _construct()
     {
-        $this->_init('sales_flat_order', 'entity_id');
+        $this->_init('sales_order', 'entity_id');
     }
 
     /**
@@ -108,7 +108,7 @@ class Order extends SalesResource
     {
         $adapter = $this->getReadConnection();
         $select = $adapter->select()->from(
-            array('o' => $this->getTable('sales_flat_order_item')),
+            array('o' => $this->getTable('sales_order_item')),
             array('o.product_type', new \Zend_Db_Expr('COUNT(*)'))
         )->joinInner(
             array('p' => $this->getTable('catalog_product_entity')),
diff --git a/app/code/Magento/Sales/Model/Resource/Order/Address.php b/app/code/Magento/Sales/Model/Resource/Order/Address.php
index 1a72291fc08c6b571bea7a33898e2f35c7c1700d..e3f33bcfde32c18589609135c2ff8abe3a4ff580 100644
--- a/app/code/Magento/Sales/Model/Resource/Order/Address.php
+++ b/app/code/Magento/Sales/Model/Resource/Order/Address.php
@@ -76,7 +76,7 @@ class Address extends \Magento\Sales\Model\Resource\Entity
      */
     protected function _construct()
     {
-        $this->_init('sales_flat_order_address', 'entity_id');
+        $this->_init('sales_order_address', 'entity_id');
     }
 
     /**
diff --git a/app/code/Magento/Sales/Model/Resource/Order/Collection.php b/app/code/Magento/Sales/Model/Resource/Order/Collection.php
index 8cabdec551862626273a9f1ac7c56f6529b9fa7a..3e47161e4363648d9493e4df58c7ba83b1efb1d0 100644
--- a/app/code/Magento/Sales/Model/Resource/Order/Collection.php
+++ b/app/code/Magento/Sales/Model/Resource/Order/Collection.php
@@ -135,7 +135,7 @@ class Collection extends \Magento\Sales\Model\Resource\Collection\AbstractCollec
     }
 
     /**
-     * Join table sales_flat_order_address to select for billing and shipping order addresses.
+     * Join table sales_order_address to select for billing and shipping order addresses.
      * Create correlation map
      *
      * @return $this
@@ -144,7 +144,7 @@ class Collection extends \Magento\Sales\Model\Resource\Collection\AbstractCollec
     {
         $billingAliasName = 'billing_o_a';
         $shippingAliasName = 'shipping_o_a';
-        $joinTable = $this->getTable('sales_flat_order_address');
+        $joinTable = $this->getTable('sales_order_address');
 
         $this->addFilterToMap(
             'billing_firstname',
diff --git a/app/code/Magento/Sales/Model/Resource/Order/Creditmemo.php b/app/code/Magento/Sales/Model/Resource/Order/Creditmemo.php
index 33b3d2cb7b4f991f11e64bab5935187805d295ff..ad3a64403dab35d690814d2f01315da80ca58e15 100644
--- a/app/code/Magento/Sales/Model/Resource/Order/Creditmemo.php
+++ b/app/code/Magento/Sales/Model/Resource/Order/Creditmemo.php
@@ -51,7 +51,7 @@ class Creditmemo extends SalesResource
      */
     protected function _construct()
     {
-        $this->_init('sales_flat_creditmemo', 'entity_id');
+        $this->_init('sales_creditmemo', 'entity_id');
     }
 
     /**
diff --git a/app/code/Magento/Sales/Model/Resource/Order/Creditmemo/Comment.php b/app/code/Magento/Sales/Model/Resource/Order/Creditmemo/Comment.php
index c9db568fedf7477c1745a262978203f202ce5c79..9786250c8bce1ee6c1cf18a4c8c176c46300ae38 100644
--- a/app/code/Magento/Sales/Model/Resource/Order/Creditmemo/Comment.php
+++ b/app/code/Magento/Sales/Model/Resource/Order/Creditmemo/Comment.php
@@ -71,7 +71,7 @@ class Comment extends \Magento\Sales\Model\Resource\Entity
      */
     protected function _construct()
     {
-        $this->_init('sales_flat_creditmemo_comment', 'entity_id');
+        $this->_init('sales_creditmemo_comment', 'entity_id');
     }
 
     /**
diff --git a/app/code/Magento/Sales/Model/Resource/Order/Creditmemo/Grid.php b/app/code/Magento/Sales/Model/Resource/Order/Creditmemo/Grid.php
index 25669e15b31dd6bdede284ae68482775fc63c0b0..914058cc611c0343d587389d86103c277a557a87 100644
--- a/app/code/Magento/Sales/Model/Resource/Order/Creditmemo/Grid.php
+++ b/app/code/Magento/Sales/Model/Resource/Order/Creditmemo/Grid.php
@@ -35,12 +35,12 @@ class Grid extends AbstractGrid
     /**
      * @var string
      */
-    protected $gridTableName = 'sales_flat_creditmemo_grid';
+    protected $gridTableName = 'sales_creditmemo_grid';
 
     /**
      * @var string
      */
-    protected $creditmemoTableName = 'sales_flat_creditmemo';
+    protected $creditmemoTableName = 'sales_creditmemo';
 
     /**
      * Refresh grid row
diff --git a/app/code/Magento/Sales/Model/Resource/Order/Creditmemo/Grid/Collection.php b/app/code/Magento/Sales/Model/Resource/Order/Creditmemo/Grid/Collection.php
index 2384f1c766fb3d7620caef68613fbf6eafc217ba..69ef97b40b357329b4f8cd6e48e865da7dc019e7 100644
--- a/app/code/Magento/Sales/Model/Resource/Order/Creditmemo/Grid/Collection.php
+++ b/app/code/Magento/Sales/Model/Resource/Order/Creditmemo/Grid/Collection.php
@@ -52,6 +52,6 @@ class Collection extends \Magento\Sales\Model\Resource\Order\Creditmemo\Collecti
     protected function _construct()
     {
         parent::_construct();
-        $this->setMainTable('sales_flat_creditmemo_grid');
+        $this->setMainTable('sales_creditmemo_grid');
     }
 }
diff --git a/app/code/Magento/Sales/Model/Resource/Order/Creditmemo/Item.php b/app/code/Magento/Sales/Model/Resource/Order/Creditmemo/Item.php
index 04cc496aa2e58d1c2b9a7dd1df610ad139952109..f1c8a6026238ea490bc5d0a3f69776adfde4ba65 100644
--- a/app/code/Magento/Sales/Model/Resource/Order/Creditmemo/Item.php
+++ b/app/code/Magento/Sales/Model/Resource/Order/Creditmemo/Item.php
@@ -44,6 +44,6 @@ class Item extends \Magento\Sales\Model\Resource\Entity
      */
     protected function _construct()
     {
-        $this->_init('sales_flat_creditmemo_item', 'entity_id');
+        $this->_init('sales_creditmemo_item', 'entity_id');
     }
 }
diff --git a/app/code/Magento/Sales/Model/Resource/Order/Grid.php b/app/code/Magento/Sales/Model/Resource/Order/Grid.php
index 3d266fd5fcd8b177df86b6cfee499c87d46a1825..18a4efbaad2ccd69b6716154ebedf82c4929b7b3 100644
--- a/app/code/Magento/Sales/Model/Resource/Order/Grid.php
+++ b/app/code/Magento/Sales/Model/Resource/Order/Grid.php
@@ -35,7 +35,7 @@ class Grid extends AbstractGrid
     /**
      * @var string
      */
-    protected $gridTableName = 'sales_flat_order_grid';
+    protected $gridTableName = 'sales_order_grid';
 
     /**
      * Refresh grid row
diff --git a/app/code/Magento/Sales/Model/Resource/Order/Grid/Collection.php b/app/code/Magento/Sales/Model/Resource/Order/Grid/Collection.php
index 53d27423805e65a7b006c065cf1c06e0e076abae..7b029049c9370d2dcd5f3eadebdded2d8677d5ea 100644
--- a/app/code/Magento/Sales/Model/Resource/Order/Grid/Collection.php
+++ b/app/code/Magento/Sales/Model/Resource/Order/Grid/Collection.php
@@ -59,7 +59,7 @@ class Collection extends \Magento\Sales\Model\Resource\Order\Collection
     protected function _construct()
     {
         parent::_construct();
-        $this->setMainTable('sales_flat_order_grid');
+        $this->setMainTable('sales_order_grid');
     }
 
     /**
diff --git a/app/code/Magento/Sales/Model/Resource/Order/Invoice.php b/app/code/Magento/Sales/Model/Resource/Order/Invoice.php
index 08e1918d8fb0ec4495ce9eb987cfd85c87dcfddf..3eabd12157f777346958083a690b5fc1569519ff 100644
--- a/app/code/Magento/Sales/Model/Resource/Order/Invoice.php
+++ b/app/code/Magento/Sales/Model/Resource/Order/Invoice.php
@@ -49,7 +49,7 @@ class Invoice extends SalesResource
      */
     protected function _construct()
     {
-        $this->_init('sales_flat_invoice', 'entity_id');
+        $this->_init('sales_invoice', 'entity_id');
     }
 
     /**
diff --git a/app/code/Magento/Sales/Model/Resource/Order/Invoice/Comment.php b/app/code/Magento/Sales/Model/Resource/Order/Invoice/Comment.php
index 6d3ce1e283e1cd971f30f5531efb250a887ec679..41f7326e25dff6bfb73dc94b867c0e3d80b626ff 100644
--- a/app/code/Magento/Sales/Model/Resource/Order/Invoice/Comment.php
+++ b/app/code/Magento/Sales/Model/Resource/Order/Invoice/Comment.php
@@ -74,7 +74,7 @@ class Comment extends \Magento\Sales\Model\Resource\Entity
      */
     protected function _construct()
     {
-        $this->_init('sales_flat_invoice_comment', 'entity_id');
+        $this->_init('sales_invoice_comment', 'entity_id');
     }
 
     /**
diff --git a/app/code/Magento/Sales/Model/Resource/Order/Invoice/Grid.php b/app/code/Magento/Sales/Model/Resource/Order/Invoice/Grid.php
index 1a68f9c05378e5c3d595c92949dce9994b62fc99..161fffa8932a231f31d9d4dd1a4568eb1f7944a4 100644
--- a/app/code/Magento/Sales/Model/Resource/Order/Invoice/Grid.php
+++ b/app/code/Magento/Sales/Model/Resource/Order/Invoice/Grid.php
@@ -35,12 +35,12 @@ class Grid extends AbstractGrid
     /**
      * @var string
      */
-    protected $gridTableName = 'sales_flat_invoice_grid';
+    protected $gridTableName = 'sales_invoice_grid';
 
     /**
      * @var string
      */
-    protected $invoiceTableName = 'sales_flat_invoice';
+    protected $invoiceTableName = 'sales_invoice';
 
     /**
      * Refresh grid row
diff --git a/app/code/Magento/Sales/Model/Resource/Order/Invoice/Grid/Collection.php b/app/code/Magento/Sales/Model/Resource/Order/Invoice/Grid/Collection.php
index 4da498d1052f1eae34a821e69103444c546b2169..828817e347554827d4eb891f61946ec9aa113ae4 100644
--- a/app/code/Magento/Sales/Model/Resource/Order/Invoice/Grid/Collection.php
+++ b/app/code/Magento/Sales/Model/Resource/Order/Invoice/Grid/Collection.php
@@ -52,6 +52,6 @@ class Collection extends \Magento\Sales\Model\Resource\Order\Invoice\Collection
     protected function _construct()
     {
         parent::_construct();
-        $this->setMainTable('sales_flat_invoice_grid');
+        $this->setMainTable('sales_invoice_grid');
     }
 }
diff --git a/app/code/Magento/Sales/Model/Resource/Order/Invoice/Item.php b/app/code/Magento/Sales/Model/Resource/Order/Invoice/Item.php
index 0ec5acbe69acb368a49effa28700110019370308..9e51bc4409481d28c5e77e9ac54653810f245b89 100644
--- a/app/code/Magento/Sales/Model/Resource/Order/Invoice/Item.php
+++ b/app/code/Magento/Sales/Model/Resource/Order/Invoice/Item.php
@@ -44,6 +44,6 @@ class Item extends \Magento\Sales\Model\Resource\Entity
      */
     protected function _construct()
     {
-        $this->_init('sales_flat_invoice_item', 'entity_id');
+        $this->_init('sales_invoice_item', 'entity_id');
     }
 }
diff --git a/app/code/Magento/Sales/Model/Resource/Order/Item.php b/app/code/Magento/Sales/Model/Resource/Order/Item.php
index 34a8ffca5286c25901574071ea83298247b9d5a3..8881bdd83ea1ad238c15bd7e368683918bc5a997 100644
--- a/app/code/Magento/Sales/Model/Resource/Order/Item.php
+++ b/app/code/Magento/Sales/Model/Resource/Order/Item.php
@@ -44,6 +44,6 @@ class Item extends SalesResource
      */
     protected function _construct()
     {
-        $this->_init('sales_flat_order_item', 'item_id');
+        $this->_init('sales_order_item', 'item_id');
     }
 }
diff --git a/app/code/Magento/Sales/Model/Resource/Order/Payment.php b/app/code/Magento/Sales/Model/Resource/Order/Payment.php
index 35a0bc2e401fd08a10703d9d182a3f9a356fa2db..e14c251505425977a1db787a970a49fa376efe59 100644
--- a/app/code/Magento/Sales/Model/Resource/Order/Payment.php
+++ b/app/code/Magento/Sales/Model/Resource/Order/Payment.php
@@ -55,6 +55,6 @@ class Payment extends SalesResource
      */
     protected function _construct()
     {
-        $this->_init('sales_flat_order_payment', 'entity_id');
+        $this->_init('sales_order_payment', 'entity_id');
     }
 }
diff --git a/app/code/Magento/Sales/Model/Resource/Order/Payment/Transaction.php b/app/code/Magento/Sales/Model/Resource/Order/Payment/Transaction.php
index b5555a97b7ebe85724c3ddb8cd00de1487479509..a6129ef934ec4b85e122a0a9d041a2ffb6e984e0 100644
--- a/app/code/Magento/Sales/Model/Resource/Order/Payment/Transaction.php
+++ b/app/code/Magento/Sales/Model/Resource/Order/Payment/Transaction.php
@@ -128,7 +128,7 @@ class Transaction extends \Magento\Sales\Model\Resource\Entity
         $adapter = $this->_getReadAdapter();
         $bind = array(':entity_id' => $orderId);
         $select = $adapter->select()->from(
-            array('so' => $this->getTable('sales_flat_order')),
+            array('so' => $this->getTable('sales_order')),
             'cs.website_id'
         )->joinInner(
             array('cs' => $this->getTable('store')),
diff --git a/app/code/Magento/Sales/Model/Resource/Order/Payment/Transaction/Collection.php b/app/code/Magento/Sales/Model/Resource/Order/Payment/Transaction/Collection.php
index 17699d9712ae0da795d1820b2c02e9d47328a6e0..9b535ce492c3bbd18c9266149e45e4920555a981 100644
--- a/app/code/Magento/Sales/Model/Resource/Order/Payment/Transaction/Collection.php
+++ b/app/code/Magento/Sales/Model/Resource/Order/Payment/Transaction/Collection.php
@@ -215,7 +215,7 @@ class Collection extends \Magento\Sales\Model\Resource\Order\Collection\Abstract
         }
         if ($this->_addPaymentInformation) {
             $this->getSelect()->joinInner(
-                array('sop' => $this->getTable('sales_flat_order_payment')),
+                array('sop' => $this->getTable('sales_order_payment')),
                 'main_table.payment_id = sop.entity_id',
                 $this->_addPaymentInformation
             );
@@ -226,7 +226,7 @@ class Collection extends \Magento\Sales\Model\Resource\Order\Collection\Abstract
         }
         if ($this->_addOrderInformation) {
             $this->getSelect()->joinInner(
-                array('so' => $this->getTable('sales_flat_order')),
+                array('so' => $this->getTable('sales_order')),
                 'main_table.order_id = so.entity_id',
                 $this->_addOrderInformation
             );
diff --git a/app/code/Magento/Sales/Model/Resource/Order/Rss/OrderStatus.php b/app/code/Magento/Sales/Model/Resource/Order/Rss/OrderStatus.php
index 005372e9f9c6c888f32a764e7df907f4ae576d0f..e352563c0c7fb568d8ba0decd00540c748a27255 100644
--- a/app/code/Magento/Sales/Model/Resource/Order/Rss/OrderStatus.php
+++ b/app/code/Magento/Sales/Model/Resource/Order/Rss/OrderStatus.php
@@ -58,8 +58,8 @@ class OrderStatus
         $fields = array('notified' => 'is_customer_notified', 'comment', 'created_at');
         $commentSelects = array();
         foreach (array('invoice', 'shipment', 'creditmemo') as $entityTypeCode) {
-            $mainTable = $resource->getTableName('sales_flat_' . $entityTypeCode);
-            $slaveTable = $resource->getTableName('sales_flat_' . $entityTypeCode . '_comment');
+            $mainTable = $resource->getTableName('sales_' . $entityTypeCode);
+            $slaveTable = $resource->getTableName('sales_' . $entityTypeCode . '_comment');
             $select = $read->select()->from(
                 array('main' => $mainTable),
                 array('entity_id' => 'order_id', 'entity_type_code' => new \Zend_Db_Expr("'{$entityTypeCode}'"))
@@ -74,7 +74,7 @@ class OrderStatus
             $commentSelects[] = '(' . $select . ')';
         }
         $select = $read->select()->from(
-            $resource->getTableName('sales_flat_order_status_history'),
+            $resource->getTableName('sales_order_status_history'),
             array('entity_id' => 'parent_id', 'entity_type_code' => new \Zend_Db_Expr("'order'")) + $fields
         )->where(
             'parent_id = ?',
@@ -87,7 +87,7 @@ class OrderStatus
         $commentSelect = $read->select()->union($commentSelects, \Zend_Db_Select::SQL_UNION_ALL);
 
         $select = $read->select()->from(
-            array('orders' => $resource->getTableName('sales_flat_order')),
+            array('orders' => $resource->getTableName('sales_order')),
             array('increment_id')
         )->join(
             array('t' => $commentSelect),
diff --git a/app/code/Magento/Sales/Model/Resource/Order/Shipment.php b/app/code/Magento/Sales/Model/Resource/Order/Shipment.php
index 1879a8ab1f0124435d4464b27bcdc0633f7104e6..508c2eeaba16e38597bcdf783cefc4fe96867bcc 100644
--- a/app/code/Magento/Sales/Model/Resource/Order/Shipment.php
+++ b/app/code/Magento/Sales/Model/Resource/Order/Shipment.php
@@ -58,7 +58,7 @@ class Shipment extends SalesResource
      */
     protected function _construct()
     {
-        $this->_init('sales_flat_shipment', 'entity_id');
+        $this->_init('sales_shipment', 'entity_id');
     }
 
     /**
diff --git a/app/code/Magento/Sales/Model/Resource/Order/Shipment/Comment.php b/app/code/Magento/Sales/Model/Resource/Order/Shipment/Comment.php
index fa21a5c0e3ebd32f5441961925616820c8a22361..b81e3a5817a1730c35ac9ad2c2180c0494c24d39 100644
--- a/app/code/Magento/Sales/Model/Resource/Order/Shipment/Comment.php
+++ b/app/code/Magento/Sales/Model/Resource/Order/Shipment/Comment.php
@@ -71,7 +71,7 @@ class Comment extends \Magento\Sales\Model\Resource\Entity
      */
     protected function _construct()
     {
-        $this->_init('sales_flat_shipment_comment', 'entity_id');
+        $this->_init('sales_shipment_comment', 'entity_id');
     }
 
     /**
diff --git a/app/code/Magento/Sales/Model/Resource/Order/Shipment/Grid.php b/app/code/Magento/Sales/Model/Resource/Order/Shipment/Grid.php
index 45d951c67572049432dd4ce1ccc7864ae9b79824..3a7acd9f6c976878054bf62ae0964c67285cc599 100644
--- a/app/code/Magento/Sales/Model/Resource/Order/Shipment/Grid.php
+++ b/app/code/Magento/Sales/Model/Resource/Order/Shipment/Grid.php
@@ -35,12 +35,12 @@ class Grid extends AbstractGrid
     /**
      * @var string
      */
-    protected $gridTableName = 'sales_flat_shipment_grid';
+    protected $gridTableName = 'sales_shipment_grid';
 
     /**
      * @var string
      */
-    protected $shipmentTableName = 'sales_flat_shipment';
+    protected $shipmentTableName = 'sales_shipment';
 
     /**
      * Refresh grid row
diff --git a/app/code/Magento/Sales/Model/Resource/Order/Shipment/Grid/Collection.php b/app/code/Magento/Sales/Model/Resource/Order/Shipment/Grid/Collection.php
index 2017ee5a71cbcaaa01b86f7afd5c3700a123c072..1aeb94dde898afdb05d29ef95a49950b471d979d 100644
--- a/app/code/Magento/Sales/Model/Resource/Order/Shipment/Grid/Collection.php
+++ b/app/code/Magento/Sales/Model/Resource/Order/Shipment/Grid/Collection.php
@@ -52,6 +52,6 @@ class Collection extends \Magento\Sales\Model\Resource\Order\Shipment\Collection
     protected function _construct()
     {
         parent::_construct();
-        $this->setMainTable('sales_flat_shipment_grid');
+        $this->setMainTable('sales_shipment_grid');
     }
 }
diff --git a/app/code/Magento/Sales/Model/Resource/Order/Shipment/Item.php b/app/code/Magento/Sales/Model/Resource/Order/Shipment/Item.php
index c0a09763e7ee5db8c6d0530ac131d284e0471916..62b8b1d20a9c16c5364f2672049199bc17e10bb2 100644
--- a/app/code/Magento/Sales/Model/Resource/Order/Shipment/Item.php
+++ b/app/code/Magento/Sales/Model/Resource/Order/Shipment/Item.php
@@ -44,6 +44,6 @@ class Item extends \Magento\Sales\Model\Resource\Entity
      */
     protected function _construct()
     {
-        $this->_init('sales_flat_shipment_item', 'entity_id');
+        $this->_init('sales_shipment_item', 'entity_id');
     }
 }
diff --git a/app/code/Magento/Sales/Model/Resource/Order/Shipment/Track.php b/app/code/Magento/Sales/Model/Resource/Order/Shipment/Track.php
index fecd4bf17309cc0b4bfeb91d81243482d814c6e4..97aefcc1678b0a153b25e15451a952de4a41cbf2 100644
--- a/app/code/Magento/Sales/Model/Resource/Order/Shipment/Track.php
+++ b/app/code/Magento/Sales/Model/Resource/Order/Shipment/Track.php
@@ -71,7 +71,7 @@ class Track extends \Magento\Sales\Model\Resource\Entity
      */
     protected function _construct()
     {
-        $this->_init('sales_flat_shipment_track', 'entity_id');
+        $this->_init('sales_shipment_track', 'entity_id');
     }
 
     /**
diff --git a/app/code/Magento/Sales/Model/Resource/Order/Status.php b/app/code/Magento/Sales/Model/Resource/Order/Status.php
index b0839240f62fe44acd6750e8966b82709a24b375..01cf0228166c7e2cad2fe1eb20420a43cfe938e5 100644
--- a/app/code/Magento/Sales/Model/Resource/Order/Status.php
+++ b/app/code/Magento/Sales/Model/Resource/Order/Status.php
@@ -253,7 +253,7 @@ class Status extends \Magento\Framework\Model\Resource\Db\AbstractDb
     {
         return (bool)$this->_getWriteAdapter()->fetchOne(
             $this->_getWriteAdapter()->select()
-                ->from(['sfo' => $this->getTable('sales_flat_order')], [])
+                ->from(['sfo' => $this->getTable('sales_order')], [])
                 ->where('status = ?', $status)
                 ->limit(1)
                 ->columns([new \Zend_Db_Expr(1)])
diff --git a/app/code/Magento/Sales/Model/Resource/Order/Status/History.php b/app/code/Magento/Sales/Model/Resource/Order/Status/History.php
index 2143955fb86f4aebfeb3b8ada2c158c364fbc26b..368803b73d5fb6e812bfdaa81b949e10817329fe 100644
--- a/app/code/Magento/Sales/Model/Resource/Order/Status/History.php
+++ b/app/code/Magento/Sales/Model/Resource/Order/Status/History.php
@@ -71,7 +71,7 @@ class History extends \Magento\Sales\Model\Resource\Entity
      */
     protected function _construct()
     {
-        $this->_init('sales_flat_order_status_history', 'entity_id');
+        $this->_init('sales_order_status_history', 'entity_id');
     }
 
     /**
diff --git a/app/code/Magento/Sales/Model/Resource/Quote.php b/app/code/Magento/Sales/Model/Resource/Quote.php
index 9942477762fc9d4e473496602a6706384e733721..b02ce7908c2a45d488402f75effbf3e5545ef34e 100644
--- a/app/code/Magento/Sales/Model/Resource/Quote.php
+++ b/app/code/Magento/Sales/Model/Resource/Quote.php
@@ -54,7 +54,7 @@ class Quote extends AbstractResource
      */
     protected function _construct()
     {
-        $this->_init('sales_flat_quote', 'entity_id');
+        $this->_init('sales_quote', 'entity_id');
     }
 
     /**
@@ -184,7 +184,7 @@ class Quote extends AbstractResource
         $adapter = $this->_getReadAdapter();
         $bind = array(':increment_id' => $orderIncrementId);
         $select = $adapter->select();
-        $select->from($this->getTable('sales_flat_order'), 'entity_id')->where('increment_id = :increment_id');
+        $select->from($this->getTable('sales_order'), 'entity_id')->where('increment_id = :increment_id');
         $entity_id = $adapter->fetchOne($select, $bind);
         if ($entity_id > 0) {
             return true;
@@ -200,9 +200,9 @@ class Quote extends AbstractResource
      */
     public function markQuotesRecollectOnCatalogRules()
     {
-        $tableQuote = $this->getTable('sales_flat_quote');
+        $tableQuote = $this->getTable('sales_quote');
         $subSelect = $this->_getReadAdapter()->select()->from(
-            array('t2' => $this->getTable('sales_flat_quote_item')),
+            array('t2' => $this->getTable('sales_quote_item')),
             array('entity_id' => 'quote_id')
         )->from(
             array('t3' => $this->getTable('catalogrule_product_price')),
@@ -250,7 +250,7 @@ class Quote extends AbstractResource
                 'items_count' => new \Zend_Db_Expr($adapter->quoteIdentifier('q.items_count') . ' - 1')
             )
         )->join(
-            array('qi' => $this->getTable('sales_flat_quote_item')),
+            array('qi' => $this->getTable('sales_quote_item')),
             implode(
                 ' AND ',
                 array(
@@ -262,7 +262,7 @@ class Quote extends AbstractResource
             array()
         );
 
-        $updateQuery = $adapter->updateFromSelect($subSelect, array('q' => $this->getTable('sales_flat_quote')));
+        $updateQuery = $adapter->updateFromSelect($subSelect, array('q' => $this->getTable('sales_quote')));
 
         $adapter->query($updateQuery);
 
@@ -277,8 +277,8 @@ class Quote extends AbstractResource
      */
     public function markQuotesRecollect($productIds)
     {
-        $tableQuote = $this->getTable('sales_flat_quote');
-        $tableItem = $this->getTable('sales_flat_quote_item');
+        $tableQuote = $this->getTable('sales_quote');
+        $tableItem = $this->getTable('sales_quote_item');
         $subSelect = $this->_getReadAdapter()->select()->from(
             $tableItem,
             array('entity_id' => 'quote_id')
diff --git a/app/code/Magento/Sales/Model/Resource/Quote/Address.php b/app/code/Magento/Sales/Model/Resource/Quote/Address.php
index 469c1440df9c2105e02d60d11bfb4fefe8b98a57..07b3e2a85b062aa237c3942555e74562071b3d35 100644
--- a/app/code/Magento/Sales/Model/Resource/Quote/Address.php
+++ b/app/code/Magento/Sales/Model/Resource/Quote/Address.php
@@ -37,6 +37,6 @@ class Address extends \Magento\Sales\Model\Resource\AbstractResource
      */
     protected function _construct()
     {
-        $this->_init('sales_flat_quote_address', 'address_id');
+        $this->_init('sales_quote_address', 'address_id');
     }
 }
diff --git a/app/code/Magento/Sales/Model/Resource/Quote/Address/Attribute/Backend/Region.php b/app/code/Magento/Sales/Model/Resource/Quote/Address/Attribute/Backend/Region.php
index 8118c5ae7f9c71ada2317b09aa8117f2aaa3daeb..f076e658d496e3041e33d6f6f59e4ec1ffaa6e28 100644
--- a/app/code/Magento/Sales/Model/Resource/Quote/Address/Attribute/Backend/Region.php
+++ b/app/code/Magento/Sales/Model/Resource/Quote/Address/Attribute/Backend/Region.php
@@ -34,13 +34,11 @@ class Region extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend
     protected $_regionFactory;
 
     /**
-     * @param \Magento\Framework\Logger $logger
      * @param \Magento\Directory\Model\RegionFactory $regionFactory
      */
-    public function __construct(\Magento\Framework\Logger $logger, \Magento\Directory\Model\RegionFactory $regionFactory)
+    public function __construct(\Magento\Directory\Model\RegionFactory $regionFactory)
     {
         $this->_regionFactory = $regionFactory;
-        parent::__construct($logger);
     }
 
     /**
diff --git a/app/code/Magento/Sales/Model/Resource/Quote/Address/Item.php b/app/code/Magento/Sales/Model/Resource/Quote/Address/Item.php
index 10d80366bdaf8240acc2c5e3c4cc991d54e8e561..b719a8e05b60c381ec8a6bf4ded9f5cb61a67b76 100644
--- a/app/code/Magento/Sales/Model/Resource/Quote/Address/Item.php
+++ b/app/code/Magento/Sales/Model/Resource/Quote/Address/Item.php
@@ -37,6 +37,6 @@ class Item extends \Magento\Sales\Model\Resource\AbstractResource
      */
     protected function _construct()
     {
-        $this->_init('sales_flat_quote_address_item', 'address_item_id');
+        $this->_init('sales_quote_address_item', 'address_item_id');
     }
 }
diff --git a/app/code/Magento/Sales/Model/Resource/Quote/Address/Rate.php b/app/code/Magento/Sales/Model/Resource/Quote/Address/Rate.php
index 77d4c6071c6c08ebba41fcce8093e9f0ac0675c1..19b57ed953e491f539140c8aaca80569e6f298c7 100644
--- a/app/code/Magento/Sales/Model/Resource/Quote/Address/Rate.php
+++ b/app/code/Magento/Sales/Model/Resource/Quote/Address/Rate.php
@@ -37,6 +37,6 @@ class Rate extends \Magento\Sales\Model\Resource\AbstractResource
      */
     protected function _construct()
     {
-        $this->_init('sales_flat_quote_shipping_rate', 'rate_id');
+        $this->_init('sales_quote_shipping_rate', 'rate_id');
     }
 }
diff --git a/app/code/Magento/Sales/Model/Resource/Quote/Item.php b/app/code/Magento/Sales/Model/Resource/Quote/Item.php
index 2d3ad7452d1e3d0d2747b0eb3bbed1d162bbf677..b83e78c539285384e06ef0addba6bc0e7a5d4b72 100644
--- a/app/code/Magento/Sales/Model/Resource/Quote/Item.php
+++ b/app/code/Magento/Sales/Model/Resource/Quote/Item.php
@@ -37,6 +37,6 @@ class Item extends \Magento\Sales\Model\Resource\AbstractResource
      */
     protected function _construct()
     {
-        $this->_init('sales_flat_quote_item', 'item_id');
+        $this->_init('sales_quote_item', 'item_id');
     }
 }
diff --git a/app/code/Magento/Sales/Model/Resource/Quote/Item/Option.php b/app/code/Magento/Sales/Model/Resource/Quote/Item/Option.php
index 412ade472fc3559d785c96b55f10e502075ff78b..742f97fe3f219d8d6d9d81dcb88594ab86703b8f 100644
--- a/app/code/Magento/Sales/Model/Resource/Quote/Item/Option.php
+++ b/app/code/Magento/Sales/Model/Resource/Quote/Item/Option.php
@@ -37,6 +37,6 @@ class Option extends \Magento\Framework\Model\Resource\Db\AbstractDb
      */
     protected function _construct()
     {
-        $this->_init('sales_flat_quote_item_option', 'option_id');
+        $this->_init('sales_quote_item_option', 'option_id');
     }
 }
diff --git a/app/code/Magento/Sales/Model/Resource/Quote/Payment.php b/app/code/Magento/Sales/Model/Resource/Quote/Payment.php
index 22b0d7282e224c36e984bc7c34e534f54c372570..f1a2bf2bd5d23b21270f736cf5c9e35340c33fb2 100644
--- a/app/code/Magento/Sales/Model/Resource/Quote/Payment.php
+++ b/app/code/Magento/Sales/Model/Resource/Quote/Payment.php
@@ -53,6 +53,6 @@ class Payment extends \Magento\Sales\Model\Resource\AbstractResource
      */
     protected function _construct()
     {
-        $this->_init('sales_flat_quote_payment', 'payment_id');
+        $this->_init('sales_quote_payment', 'payment_id');
     }
 }
diff --git a/app/code/Magento/Sales/Model/Resource/Report/Bestsellers.php b/app/code/Magento/Sales/Model/Resource/Report/Bestsellers.php
index 041bf7cdd927931d1070e302b9c88a40d340f56d..52e2b866306e97da9f5295d674fa87a79632942b 100644
--- a/app/code/Magento/Sales/Model/Resource/Report/Bestsellers.php
+++ b/app/code/Magento/Sales/Model/Resource/Report/Bestsellers.php
@@ -112,7 +112,7 @@ class Bestsellers extends AbstractReport
         try {
             if ($from !== null || $to !== null) {
                 $subSelect = $this->_getTableDateRangeSelect(
-                    $this->getTable('sales_flat_order'),
+                    $this->getTable('sales_order'),
                     'created_at',
                     'updated_at',
                     $from,
@@ -126,7 +126,7 @@ class Bestsellers extends AbstractReport
             // convert dates from UTC to current admin timezone
             $periodExpr = $adapter->getDatePartSql(
                 $this->getStoreTZOffsetQuery(
-                    array('source_table' => $this->getTable('sales_flat_order')),
+                    array('source_table' => $this->getTable('sales_order')),
                     'source_table.created_at',
                     $from,
                     $to
@@ -164,10 +164,10 @@ class Bestsellers extends AbstractReport
             );
 
             $select->from(
-                array('source_table' => $this->getTable('sales_flat_order')),
+                array('source_table' => $this->getTable('sales_order')),
                 $columns
             )->joinInner(
-                array('order_item' => $this->getTable('sales_flat_order_item')),
+                array('order_item' => $this->getTable('sales_order_item')),
                 'order_item.order_id = source_table.entity_id',
                 array()
             )->where(
diff --git a/app/code/Magento/Sales/Model/Resource/Report/Invoiced.php b/app/code/Magento/Sales/Model/Resource/Report/Invoiced.php
index 6ca9e230b1cd51ff27c207db4667b2bebe2cd7e6..053275809feace3c4ede19587d64cc939e27898e 100644
--- a/app/code/Magento/Sales/Model/Resource/Report/Invoiced.php
+++ b/app/code/Magento/Sales/Model/Resource/Report/Invoiced.php
@@ -72,8 +72,8 @@ class Invoiced extends AbstractReport
     protected function _aggregateByInvoiceCreatedAt($from, $to)
     {
         $table = $this->getTable('sales_invoiced_aggregated');
-        $sourceTable = $this->getTable('sales_flat_invoice');
-        $orderTable = $this->getTable('sales_flat_order');
+        $sourceTable = $this->getTable('sales_invoice');
+        $orderTable = $this->getTable('sales_order');
         $adapter = $this->_getWriteAdapter();
 
         $adapter->beginTransaction();
@@ -195,7 +195,7 @@ class Invoiced extends AbstractReport
     protected function _aggregateByOrderCreatedAt($from, $to)
     {
         $table = $this->getTable('sales_invoiced_aggregated_order');
-        $sourceTable = $this->getTable('sales_flat_order');
+        $sourceTable = $this->getTable('sales_order');
         $adapter = $this->_getWriteAdapter();
 
         if ($from !== null || $to !== null) {
diff --git a/app/code/Magento/Sales/Model/Resource/Report/Order/Createdat.php b/app/code/Magento/Sales/Model/Resource/Report/Order/Createdat.php
index 76d39962ce1a608e6f3c582cd7df5badcad46dcc..062659b23fb11861dab0ee8a1f534e80382c2571 100644
--- a/app/code/Magento/Sales/Model/Resource/Report/Order/Createdat.php
+++ b/app/code/Magento/Sales/Model/Resource/Report/Order/Createdat.php
@@ -75,7 +75,7 @@ class Createdat extends \Magento\Sales\Model\Resource\Report\AbstractReport
 
             if ($from !== null || $to !== null) {
                 $subSelect = $this->_getTableDateRangeSelect(
-                    $this->getTable('sales_flat_order'),
+                    $this->getTable('sales_order'),
                     $aggregationField,
                     $aggregationField,
                     $from,
@@ -88,7 +88,7 @@ class Createdat extends \Magento\Sales\Model\Resource\Report\AbstractReport
 
             $periodExpr = $adapter->getDatePartSql(
                 $this->getStoreTZOffsetQuery(
-                    array('o' => $this->getTable('sales_flat_order')),
+                    array('o' => $this->getTable('sales_order')),
                     'o.' . $aggregationField,
                     $from,
                     $to
@@ -221,7 +221,7 @@ class Createdat extends \Magento\Sales\Model\Resource\Report\AbstractReport
                 'total_qty_invoiced' => new \Zend_Db_Expr('SUM(qty_invoiced)')
             );
             $selectOrderItem->from(
-                $this->getTable('sales_flat_order_item'),
+                $this->getTable('sales_order_item'),
                 $cols
             )->where(
                 'parent_item_id IS NULL'
@@ -230,7 +230,7 @@ class Createdat extends \Magento\Sales\Model\Resource\Report\AbstractReport
             );
 
             $select->from(
-                array('o' => $this->getTable('sales_flat_order')),
+                array('o' => $this->getTable('sales_order')),
                 $columns
             )->join(
                 array('oi' => $selectOrderItem),
diff --git a/app/code/Magento/Sales/Model/Resource/Report/Refunded.php b/app/code/Magento/Sales/Model/Resource/Report/Refunded.php
index fc0042e855027588e4749b46e7baea840869635a..7be06fc137243f642076ae22b572d1db0f3f2b1c 100644
--- a/app/code/Magento/Sales/Model/Resource/Report/Refunded.php
+++ b/app/code/Magento/Sales/Model/Resource/Report/Refunded.php
@@ -72,7 +72,7 @@ class Refunded extends AbstractReport
     protected function _aggregateByOrderCreatedAt($from, $to)
     {
         $table = $this->getTable('sales_refunded_aggregated_order');
-        $sourceTable = $this->getTable('sales_flat_order');
+        $sourceTable = $this->getTable('sales_order');
         $adapter = $this->_getWriteAdapter();
         $adapter->beginTransaction();
 
@@ -159,8 +159,8 @@ class Refunded extends AbstractReport
     protected function _aggregateByRefundCreatedAt($from, $to)
     {
         $table = $this->getTable('sales_refunded_aggregated');
-        $sourceTable = $this->getTable('sales_flat_creditmemo');
-        $orderTable = $this->getTable('sales_flat_order');
+        $sourceTable = $this->getTable('sales_creditmemo');
+        $orderTable = $this->getTable('sales_order');
         $adapter = $this->_getWriteAdapter();
         $adapter->beginTransaction();
 
diff --git a/app/code/Magento/Sales/Model/Resource/Report/Shipping.php b/app/code/Magento/Sales/Model/Resource/Report/Shipping.php
index ec939dec0c7500d015187378acad10f5d055db8c..a8d78fe3b8e743e9185f8508379a23c78f9f86ff 100644
--- a/app/code/Magento/Sales/Model/Resource/Report/Shipping.php
+++ b/app/code/Magento/Sales/Model/Resource/Report/Shipping.php
@@ -71,7 +71,7 @@ class Shipping extends AbstractReport
     protected function _aggregateByOrderCreatedAt($from, $to)
     {
         $table = $this->getTable('sales_shipping_aggregated_order');
-        $sourceTable = $this->getTable('sales_flat_order');
+        $sourceTable = $this->getTable('sales_order');
         $adapter = $this->_getWriteAdapter();
         $adapter->beginTransaction();
 
@@ -163,8 +163,8 @@ class Shipping extends AbstractReport
     protected function _aggregateByShippingCreatedAt($from, $to)
     {
         $table = $this->getTable('sales_shipping_aggregated');
-        $sourceTable = $this->getTable('sales_flat_invoice');
-        $orderTable = $this->getTable('sales_flat_order');
+        $sourceTable = $this->getTable('sales_invoice');
+        $orderTable = $this->getTable('sales_order');
         $adapter = $this->_getWriteAdapter();
         $adapter->beginTransaction();
 
diff --git a/app/code/Magento/Sales/Model/Resource/Setup.php b/app/code/Magento/Sales/Model/Resource/Setup.php
index 81c2c7ba6519a2523965d3dab3ea68fcadde228b..f5bdf6386990a8b967281107a411dd7db59bac18 100644
--- a/app/code/Magento/Sales/Model/Resource/Setup.php
+++ b/app/code/Magento/Sales/Model/Resource/Setup.php
@@ -74,27 +74,27 @@ class Setup extends \Magento\Eav\Model\Entity\Setup
      * @var $_flatEntityTables array
      */
     protected $_flatEntityTables = array(
-        'quote' => 'sales_flat_quote',
-        'quote_item' => 'sales_flat_quote_item',
-        'quote_address' => 'sales_flat_quote_address',
-        'quote_address_item' => 'sales_flat_quote_address_item',
-        'quote_address_rate' => 'sales_flat_quote_shipping_rate',
-        'quote_payment' => 'sales_flat_quote_payment',
-        'order' => 'sales_flat_order',
-        'order_payment' => 'sales_flat_order_payment',
-        'order_item' => 'sales_flat_order_item',
-        'order_address' => 'sales_flat_order_address',
-        'order_status_history' => 'sales_flat_order_status_history',
-        'invoice' => 'sales_flat_invoice',
-        'invoice_item' => 'sales_flat_invoice_item',
-        'invoice_comment' => 'sales_flat_invoice_comment',
-        'creditmemo' => 'sales_flat_creditmemo',
-        'creditmemo_item' => 'sales_flat_creditmemo_item',
-        'creditmemo_comment' => 'sales_flat_creditmemo_comment',
-        'shipment' => 'sales_flat_shipment',
-        'shipment_item' => 'sales_flat_shipment_item',
-        'shipment_track' => 'sales_flat_shipment_track',
-        'shipment_comment' => 'sales_flat_shipment_comment'
+        'quote' => 'sales_quote',
+        'quote_item' => 'sales_quote_item',
+        'quote_address' => 'sales_quote_address',
+        'quote_address_item' => 'sales_quote_address_item',
+        'quote_address_rate' => 'sales_quote_shipping_rate',
+        'quote_payment' => 'sales_quote_payment',
+        'order' => 'sales_order',
+        'order_payment' => 'sales_order_payment',
+        'order_item' => 'sales_order_item',
+        'order_address' => 'sales_order_address',
+        'order_status_history' => 'sales_order_status_history',
+        'invoice' => 'sales_invoice',
+        'invoice_item' => 'sales_invoice_item',
+        'invoice_comment' => 'sales_invoice_comment',
+        'creditmemo' => 'sales_creditmemo',
+        'creditmemo_item' => 'sales_creditmemo_item',
+        'creditmemo_comment' => 'sales_creditmemo_comment',
+        'shipment' => 'sales_shipment',
+        'shipment_item' => 'sales_shipment_item',
+        'shipment_track' => 'sales_shipment_track',
+        'shipment_comment' => 'sales_shipment_comment'
     );
 
     /**
@@ -232,28 +232,28 @@ class Setup extends \Magento\Eav\Model\Entity\Setup
         $entities = array(
             'order' => array(
                 'entity_model' => 'Magento\Sales\Model\Resource\Order',
-                'table' => 'sales_flat_order',
+                'table' => 'sales_order',
                 'increment_model' => 'Magento\Eav\Model\Entity\Increment\Numeric',
                 'increment_per_store' => true,
                 'attributes' => array()
             ),
             'invoice' => array(
                 'entity_model' => 'Magento\Sales\Model\Resource\Order\Invoice',
-                'table' => 'sales_flat_invoice',
+                'table' => 'sales_invoice',
                 'increment_model' => 'Magento\Eav\Model\Entity\Increment\Numeric',
                 'increment_per_store' => true,
                 'attributes' => array()
             ),
             'creditmemo' => array(
                 'entity_model' => 'Magento\Sales\Model\Resource\Order\Creditmemo',
-                'table' => 'sales_flat_creditmemo',
+                'table' => 'sales_creditmemo',
                 'increment_model' => 'Magento\Eav\Model\Entity\Increment\Numeric',
                 'increment_per_store' => true,
                 'attributes' => array()
             ),
             'shipment' => array(
                 'entity_model' => 'Magento\Sales\Model\Resource\Order\Shipment',
-                'table' => 'sales_flat_shipment',
+                'table' => 'sales_shipment',
                 'increment_model' => 'Magento\Eav\Model\Entity\Increment\Numeric',
                 'increment_per_store' => true,
                 'attributes' => array()
diff --git a/app/code/Magento/Sales/composer.json b/app/code/Magento/Sales/composer.json
index 4c296da9b427185731440a30cfddf3d77e85a180..cd8ebd2b68baaecaa543bf1c6c0abbd6a8eb13ce 100644
--- a/app/code/Magento/Sales/composer.json
+++ b/app/code/Magento/Sales/composer.json
@@ -3,31 +3,31 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-catalog": "0.1.0-alpha103",
-        "magento/module-customer": "0.1.0-alpha103",
-        "magento/module-authorization": "0.1.0-alpha103",
-        "magento/module-payment": "0.1.0-alpha103",
-        "magento/module-core": "0.1.0-alpha103",
-        "magento/module-checkout": "0.1.0-alpha103",
-        "magento/module-theme": "0.1.0-alpha103",
-        "magento/module-sales-rule": "0.1.0-alpha103",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/module-widget": "0.1.0-alpha103",
-        "magento/module-directory": "0.1.0-alpha103",
-        "magento/module-eav": "0.1.0-alpha103",
-        "magento/module-tax": "0.1.0-alpha103",
-        "magento/module-gift-message": "0.1.0-alpha103",
-        "magento/module-reports": "0.1.0-alpha103",
-        "magento/module-catalog-inventory": "0.1.0-alpha103",
-        "magento/module-wishlist": "0.1.0-alpha103",
-        "magento/module-email": "0.1.0-alpha103",
-        "magento/module-shipping": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-catalog": "0.1.0-alpha104",
+        "magento/module-customer": "0.1.0-alpha104",
+        "magento/module-authorization": "0.1.0-alpha104",
+        "magento/module-payment": "0.1.0-alpha104",
+        "magento/module-core": "0.1.0-alpha104",
+        "magento/module-checkout": "0.1.0-alpha104",
+        "magento/module-theme": "0.1.0-alpha104",
+        "magento/module-sales-rule": "0.1.0-alpha104",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/module-widget": "0.1.0-alpha104",
+        "magento/module-directory": "0.1.0-alpha104",
+        "magento/module-eav": "0.1.0-alpha104",
+        "magento/module-tax": "0.1.0-alpha104",
+        "magento/module-gift-message": "0.1.0-alpha104",
+        "magento/module-reports": "0.1.0-alpha104",
+        "magento/module-catalog-inventory": "0.1.0-alpha104",
+        "magento/module-wishlist": "0.1.0-alpha104",
+        "magento/module-email": "0.1.0-alpha104",
+        "magento/module-shipping": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/Sales/data/sales_setup/data-install-1.6.0.0.php b/app/code/Magento/Sales/data/sales_setup/data-install-2.0.0.php
similarity index 71%
rename from app/code/Magento/Sales/data/sales_setup/data-install-1.6.0.0.php
rename to app/code/Magento/Sales/data/sales_setup/data-install-2.0.0.php
index f8ca4ef8b2011a23f4988957817247d8342d0247..d3e2be7af5d7b5a65b1b94b6aafc7284f268404c 100644
--- a/app/code/Magento/Sales/data/sales_setup/data-install-1.6.0.0.php
+++ b/app/code/Magento/Sales/data/sales_setup/data-install-2.0.0.php
@@ -22,13 +22,12 @@
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
 
-/** @var $installer \Magento\Sales\Model\Resource\Setup */
-$installer = $this;
+/** @var $this \Magento\Sales\Model\Resource\Setup */
 
 /**
  * Install eav entity types to the eav/entity_type table
  */
-$installer->installEntities();
+$this->installEntities();
 
 /**
  * Install order statuses from config
@@ -48,7 +47,7 @@ $statuses = array(
 foreach ($statuses as $code => $info) {
     $data[] = array('status' => $code, 'label' => $info);
 }
-$installer->getConnection()->insertArray($installer->getTable('sales_order_status'), array('status', 'label'), $data);
+$this->getConnection()->insertArray($this->getTable('sales_order_status'), array('status', 'label'), $data);
 
 /**
  * Install order states from config
@@ -107,8 +106,34 @@ foreach ($states as $code => $info) {
         }
     }
 }
-$installer->getConnection()->insertArray(
-    $installer->getTable('sales_order_status_state'),
+$this->getConnection()->insertArray(
+    $this->getTable('sales_order_status_state'),
     array('status', 'state', 'is_default'),
     $data
 );
+
+$entitiesToAlter = array('quote_address', 'order_address');
+
+$attributes = array(
+    'vat_id' => array('type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT),
+    'vat_is_valid' => array('type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT),
+    'vat_request_id' => array('type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT),
+    'vat_request_date' => array('type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT),
+    'vat_request_success' => array('type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT)
+);
+
+foreach ($entitiesToAlter as $entityName) {
+    foreach ($attributes as $attributeCode => $attributeParams) {
+        $this->addAttribute($entityName, $attributeCode, $attributeParams);
+    }
+}
+
+/** Update visibility for states */
+$states = array('new', 'processing', 'complete', 'closed', 'canceled', 'holded', 'payment_review');
+foreach ($states as $state) {
+    $this->getConnection()->update(
+        $this->getTable('sales_order_status_state'),
+        array('visible_on_front' => 1),
+        array('state = ?' => $state)
+    );
+}
diff --git a/app/code/Magento/Sales/data/sales_setup/data-upgrade-1.6.0.4-1.6.0.5.php b/app/code/Magento/Sales/data/sales_setup/data-upgrade-1.6.0.4-1.6.0.5.php
deleted file mode 100644
index 91eda509ce867974190dd4b05692d50b296f0e08..0000000000000000000000000000000000000000
--- a/app/code/Magento/Sales/data/sales_setup/data-upgrade-1.6.0.4-1.6.0.5.php
+++ /dev/null
@@ -1,71 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-/** @var $installer \Magento\Sales\Model\Resource\Setup */
-$installer = $this;
-
-$subSelect = $installer->getConnection()->select()->from(
-    array('citem' => $installer->getTable('sales_flat_creditmemo_item')),
-    array(
-        'amount_refunded' => 'SUM(citem.row_total)',
-        'base_amount_refunded' => 'SUM(citem.base_row_total)',
-        'base_tax_refunded' => 'SUM(citem.base_tax_amount)',
-        'discount_refunded' => 'SUM(citem.discount_amount)',
-        'base_discount_refunded' => 'SUM(citem.base_discount_amount)'
-    )
-)->joinLeft(
-    array('c' => $installer->getTable('sales_flat_creditmemo')),
-    'c.entity_id = citem.parent_id',
-    array()
-)->joinLeft(
-    array('o' => $installer->getTable('sales_flat_order')),
-    'o.entity_id = c.order_id',
-    array()
-)->joinLeft(
-    array('oitem' => $installer->getTable('sales_flat_order_item')),
-    'oitem.order_id = o.entity_id AND oitem.product_id=citem.product_id',
-    array('item_id')
-)->group(
-    'oitem.item_id'
-);
-
-$select = $installer->getConnection()->select()->from(
-    array('selected' => $subSelect),
-    array(
-        'amount_refunded' => 'amount_refunded',
-        'base_amount_refunded' => 'base_amount_refunded',
-        'base_tax_refunded' => 'base_tax_refunded',
-        'discount_refunded' => 'discount_refunded',
-        'base_discount_refunded' => 'base_discount_refunded'
-    )
-)->where(
-    'main.item_id = selected.item_id'
-);
-
-$updateQuery = $installer->getConnection()->updateFromSelect(
-    $select,
-    array('main' => $installer->getTable('sales_flat_order_item'))
-);
-
-$installer->getConnection()->query($updateQuery);
diff --git a/app/code/Magento/Sales/data/sales_setup/data-upgrade-1.6.0.5-1.6.0.6.php b/app/code/Magento/Sales/data/sales_setup/data-upgrade-1.6.0.5-1.6.0.6.php
deleted file mode 100644
index 65b677a8cb5902f5beef158bcdd9e3075e6dff0e..0000000000000000000000000000000000000000
--- a/app/code/Magento/Sales/data/sales_setup/data-upgrade-1.6.0.5-1.6.0.6.php
+++ /dev/null
@@ -1,42 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-/* @var $installer \Magento\Sales\Model\Resource\Setup */
-$installer = $this;
-
-$entitiesToAlter = array('quote_address', 'order_address');
-
-$attributes = array(
-    'vat_id' => array('type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT),
-    'vat_is_valid' => array('type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT),
-    'vat_request_id' => array('type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT),
-    'vat_request_date' => array('type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT),
-    'vat_request_success' => array('type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT)
-);
-
-foreach ($entitiesToAlter as $entityName) {
-    foreach ($attributes as $attributeCode => $attributeParams) {
-        $installer->addAttribute($entityName, $attributeCode, $attributeParams);
-    }
-}
diff --git a/app/code/Magento/Sales/etc/module.xml b/app/code/Magento/Sales/etc/module.xml
index 685910b9267a9c0212732f6f815951ba9ba5dc05..427b07dd44361be2a6ebad650ca79c0c9ae55052 100644
--- a/app/code/Magento/Sales/etc/module.xml
+++ b/app/code/Magento/Sales/etc/module.xml
@@ -24,7 +24,7 @@
  */
 -->
 <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
-    <module name="Magento_Sales" schema_version="1.6.0.12" active="true">
+    <module name="Magento_Sales" schema_version="2.0.0" active="true">
         <sequence>
             <module name="Magento_Rule"/>
             <module name="Magento_Catalog"/>
diff --git a/app/code/Magento/Sales/sql/sales_setup/install-1.6.0.0.php b/app/code/Magento/Sales/sql/sales_setup/install-2.0.0.php
similarity index 85%
rename from app/code/Magento/Sales/sql/sales_setup/install-1.6.0.0.php
rename to app/code/Magento/Sales/sql/sales_setup/install-2.0.0.php
index 408e985eb95845b90df2ad9adcf2268fe6fc9611..ad5fb72ba01278194375336b5c48e5c9b434b115 100644
--- a/app/code/Magento/Sales/sql/sales_setup/install-1.6.0.0.php
+++ b/app/code/Magento/Sales/sql/sales_setup/install-2.0.0.php
@@ -22,15 +22,14 @@
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
 
-/** @var $installer \Magento\Setup\Module\SetupModule */
-$installer = $this;
-$installer->startSetup();
+/** @var $this \Magento\Sales\Model\Resource\Setup */
+$this->startSetup();
 
 /**
- * Create table 'sales_flat_order'
+ * Create table 'sales_order'
  */
-$table = $installer->getConnection()->newTable(
-    $installer->getTable('sales_flat_order')
+$table = $this->getConnection()->newTable(
+    $this->getTable('sales_order')
 )->addColumn(
     'entity_id',
     \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -835,62 +834,68 @@ $table = $installer->getConnection()->newTable(
     '12,4',
     array(),
     'Base Shipping Incl Tax'
+)->addColumn(
+    'coupon_rule_name',
+    \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
+    255,
+    array('nullable' => true),
+    'Coupon Sales Rule Name'
 )->addIndex(
-    $installer->getIdxName('sales_flat_order', array('status')),
+    $this->getIdxName('sales_order', array('status')),
     array('status')
 )->addIndex(
-    $installer->getIdxName('sales_flat_order', array('state')),
+    $this->getIdxName('sales_order', array('state')),
     array('state')
 )->addIndex(
-    $installer->getIdxName('sales_flat_order', array('store_id')),
+    $this->getIdxName('sales_order', array('store_id')),
     array('store_id')
 )->addIndex(
-    $installer->getIdxName(
-        'sales_flat_order',
+    $this->getIdxName(
+        'sales_order',
         array('increment_id'),
         \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
     ),
     array('increment_id'),
     array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
 )->addIndex(
-    $installer->getIdxName('sales_flat_order', array('created_at')),
+    $this->getIdxName('sales_order', array('created_at')),
     array('created_at')
 )->addIndex(
-    $installer->getIdxName('sales_flat_order', array('customer_id')),
+    $this->getIdxName('sales_order', array('customer_id')),
     array('customer_id')
 )->addIndex(
-    $installer->getIdxName('sales_flat_order', array('ext_order_id')),
+    $this->getIdxName('sales_order', array('ext_order_id')),
     array('ext_order_id')
 )->addIndex(
-    $installer->getIdxName('sales_flat_order', array('quote_id')),
+    $this->getIdxName('sales_order', array('quote_id')),
     array('quote_id')
 )->addIndex(
-    $installer->getIdxName('sales_flat_order', array('updated_at')),
+    $this->getIdxName('sales_order', array('updated_at')),
     array('updated_at')
 )->addForeignKey(
-    $installer->getFkName('sales_flat_order', 'customer_id', 'customer_entity', 'entity_id'),
+    $this->getFkName('sales_order', 'customer_id', 'customer_entity', 'entity_id'),
     'customer_id',
-    $installer->getTable('customer_entity'),
+    $this->getTable('customer_entity'),
     'entity_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->addForeignKey(
-    $installer->getFkName('sales_flat_order', 'store_id', 'store', 'store_id'),
+    $this->getFkName('sales_order', 'store_id', 'store', 'store_id'),
     'store_id',
-    $installer->getTable('store'),
+    $this->getTable('store'),
     'store_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->setComment(
     'Sales Flat Order'
 );
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
 
 /**
- * Create table 'sales_flat_order_grid'
+ * Create table 'sales_order_grid'
  */
-$table = $installer->getConnection()->newTable(
-    $installer->getTable('sales_flat_order_grid')
+$table = $this->getConnection()->newTable(
+    $this->getTable('sales_order_grid')
 )->addColumn(
     'entity_id',
     \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -988,78 +993,78 @@ $table = $installer->getConnection()->newTable(
     array(),
     'Updated At'
 )->addIndex(
-    $installer->getIdxName('sales_flat_order_grid', array('status')),
+    $this->getIdxName('sales_order_grid', array('status')),
     array('status')
 )->addIndex(
-    $installer->getIdxName('sales_flat_order_grid', array('store_id')),
+    $this->getIdxName('sales_order_grid', array('store_id')),
     array('store_id')
 )->addIndex(
-    $installer->getIdxName('sales_flat_order_grid', array('base_grand_total')),
+    $this->getIdxName('sales_order_grid', array('base_grand_total')),
     array('base_grand_total')
 )->addIndex(
-    $installer->getIdxName('sales_flat_order_grid', array('base_total_paid')),
+    $this->getIdxName('sales_order_grid', array('base_total_paid')),
     array('base_total_paid')
 )->addIndex(
-    $installer->getIdxName('sales_flat_order_grid', array('grand_total')),
+    $this->getIdxName('sales_order_grid', array('grand_total')),
     array('grand_total')
 )->addIndex(
-    $installer->getIdxName('sales_flat_order_grid', array('total_paid')),
+    $this->getIdxName('sales_order_grid', array('total_paid')),
     array('total_paid')
 )->addIndex(
-    $installer->getIdxName(
-        'sales_flat_order_grid',
+    $this->getIdxName(
+        'sales_order_grid',
         array('increment_id'),
         \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
     ),
     array('increment_id'),
     array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
 )->addIndex(
-    $installer->getIdxName('sales_flat_order_grid', array('shipping_name')),
+    $this->getIdxName('sales_order_grid', array('shipping_name')),
     array('shipping_name')
 )->addIndex(
-    $installer->getIdxName('sales_flat_order_grid', array('billing_name')),
+    $this->getIdxName('sales_order_grid', array('billing_name')),
     array('billing_name')
 )->addIndex(
-    $installer->getIdxName('sales_flat_order_grid', array('created_at')),
+    $this->getIdxName('sales_order_grid', array('created_at')),
     array('created_at')
 )->addIndex(
-    $installer->getIdxName('sales_flat_order_grid', array('customer_id')),
+    $this->getIdxName('sales_order_grid', array('customer_id')),
     array('customer_id')
 )->addIndex(
-    $installer->getIdxName('sales_flat_order_grid', array('updated_at')),
+    $this->getIdxName('sales_order_grid', array('updated_at')),
     array('updated_at')
 )->addForeignKey(
-    $installer->getFkName('sales_flat_order_grid', 'customer_id', 'customer_entity', 'entity_id'),
+    $this->getFkName('sales_order_grid', 'customer_id', 'customer_entity', 'entity_id'),
     'customer_id',
-    $installer->getTable('customer_entity'),
+    $this->getTable('customer_entity'),
     'entity_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->addForeignKey(
-    $installer->getFkName('sales_flat_order_grid', 'entity_id', 'sales_flat_order', 'entity_id'),
+    $this->getFkName('sales_order_grid', 'entity_id', 'sales_order', 'entity_id'),
     'entity_id',
-    $installer->getTable('sales_flat_order'),
+    $this->getTable('sales_order'),
     'entity_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->addForeignKey(
-    $installer->getFkName('sales_flat_order_grid', 'store_id', 'store', 'store_id'),
+    $this->getFkName('sales_order_grid', 'store_id', 'store', 'store_id'),
     'store_id',
-    $installer->getTable('store'),
+    $this->getTable('store'),
     'store_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->setComment(
     'Sales Flat Order Grid'
 );
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
 
 
 /**
- * Create table 'sales_flat_order_address'
+ * Create table 'sales_order_address'
  */
-$table = $installer->getConnection()->newTable(
-    $installer->getTable('sales_flat_order_address')
+$table = $this->getConnection()->newTable(
+    $this->getTable('sales_order_address')
 )->addColumn(
     'entity_id',
     \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -1187,26 +1192,26 @@ $table = $installer->getConnection()->newTable(
     array(),
     'Company'
 )->addIndex(
-    $installer->getIdxName('sales_flat_order_address', array('parent_id')),
+    $this->getIdxName('sales_order_address', array('parent_id')),
     array('parent_id')
 )->addForeignKey(
-    $installer->getFkName('sales_flat_order_address', 'parent_id', 'sales_flat_order', 'entity_id'),
+    $this->getFkName('sales_order_address', 'parent_id', 'sales_order', 'entity_id'),
     'parent_id',
-    $installer->getTable('sales_flat_order'),
+    $this->getTable('sales_order'),
     'entity_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->setComment(
     'Sales Flat Order Address'
 );
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
 
 
 /**
- * Create table 'sales_flat_order_status_history'
+ * Create table 'sales_order_status_history'
  */
-$table = $installer->getConnection()->newTable(
-    $installer->getTable('sales_flat_order_status_history')
+$table = $this->getConnection()->newTable(
+    $this->getTable('sales_order_status_history')
 )->addColumn(
     'entity_id',
     \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -1249,30 +1254,36 @@ $table = $installer->getConnection()->newTable(
     null,
     array(),
     'Created At'
+)->addColumn(
+    'entity_name',
+    \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
+    32,
+    array('nullable' => true),
+    'Shows what entity history is bind to.'
 )->addIndex(
-    $installer->getIdxName('sales_flat_order_status_history', array('parent_id')),
+    $this->getIdxName('sales_order_status_history', array('parent_id')),
     array('parent_id')
 )->addIndex(
-    $installer->getIdxName('sales_flat_order_status_history', array('created_at')),
+    $this->getIdxName('sales_order_status_history', array('created_at')),
     array('created_at')
 )->addForeignKey(
-    $installer->getFkName('sales_flat_order_status_history', 'parent_id', 'sales_flat_order', 'entity_id'),
+    $this->getFkName('sales_order_status_history', 'parent_id', 'sales_order', 'entity_id'),
     'parent_id',
-    $installer->getTable('sales_flat_order'),
+    $this->getTable('sales_order'),
     'entity_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->setComment(
     'Sales Flat Order Status History'
 );
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
 
 
 /**
- * Create table 'sales_flat_order_item'
+ * Create table 'sales_order_item'
  */
-$table = $installer->getConnection()->newTable(
-    $installer->getTable('sales_flat_order_item')
+$table = $this->getConnection()->newTable(
+    $this->getTable('sales_order_item')
 )->addColumn(
     'item_id',
     \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -1669,37 +1680,54 @@ $table = $installer->getConnection()->newTable(
     '12,4',
     array(),
     'Tax Refunded'
+)->addColumn(
+    'base_tax_refunded',
+    \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL,
+    '12,4',
+    array(),
+    'Base Tax Refunded'
+)->addColumn(
+    'discount_refunded',
+    \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL,
+    '12,4',
+    array(),
+    'Discount Refunded'
+)->addColumn(
+    'base_discount_refunded',
+    \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL,
+    '12,4',
+    array(),
+    'Base Discount Refunded'
 )->addIndex(
-    $installer->getIdxName('sales_flat_order_item', array('order_id')),
+    $this->getIdxName('sales_order_item', array('order_id')),
     array('order_id')
 )->addIndex(
-    $installer->getIdxName('sales_flat_order_item', array('store_id')),
+    $this->getIdxName('sales_order_item', array('store_id')),
     array('store_id')
 )->addForeignKey(
-    $installer->getFkName('sales_flat_order_item', 'order_id', 'sales_flat_order', 'entity_id'),
+    $this->getFkName('sales_order_item', 'order_id', 'sales_order', 'entity_id'),
     'order_id',
-    $installer->getTable('sales_flat_order'),
+    $this->getTable('sales_order'),
     'entity_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->addForeignKey(
-    $installer->getFkName('sales_flat_order_item', 'store_id', 'store', 'store_id'),
+    $this->getFkName('sales_order_item', 'store_id', 'store', 'store_id'),
     'store_id',
-    $installer->getTable('store'),
+    $this->getTable('store'),
     'store_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->setComment(
     'Sales Flat Order Item'
 );
-$installer->getConnection()->createTable($table);
-
+$this->getConnection()->createTable($table);
 
 /**
- * Create table 'sales_flat_order_payment'
+ * Create table 'sales_order_payment'
  */
-$table = $installer->getConnection()->newTable(
-    $installer->getTable('sales_flat_order_payment')
+$table = $this->getConnection()->newTable(
+    $this->getTable('sales_order_payment')
 )->addColumn(
     'entity_id',
     \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -1950,7 +1978,7 @@ $table = $installer->getConnection()->newTable(
     'cc_exp_year',
     \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
     255,
-    array(),
+    array('nullable' => true, 'default' => null),
     'Cc Exp Year'
 )->addColumn(
     'cc_status',
@@ -2025,26 +2053,26 @@ $table = $installer->getConnection()->newTable(
     array(),
     'Additional Information'
 )->addIndex(
-    $installer->getIdxName('sales_flat_order_payment', array('parent_id')),
+    $this->getIdxName('sales_order_payment', array('parent_id')),
     array('parent_id')
 )->addForeignKey(
-    $installer->getFkName('sales_flat_order_payment', 'parent_id', 'sales_flat_order', 'entity_id'),
+    $this->getFkName('sales_order_payment', 'parent_id', 'sales_order', 'entity_id'),
     'parent_id',
-    $installer->getTable('sales_flat_order'),
+    $this->getTable('sales_order'),
     'entity_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->setComment(
     'Sales Flat Order Payment'
 );
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
 
 
 /**
- * Create table 'sales_flat_shipment'
+ * Create table 'sales_shipment'
  */
-$table = $installer->getConnection()->newTable(
-    $installer->getTable('sales_flat_shipment')
+$table = $this->getConnection()->newTable(
+    $this->getTable('sales_shipment')
 )->addColumn(
     'entity_id',
     \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -2123,54 +2151,65 @@ $table = $installer->getConnection()->newTable(
     null,
     array(),
     'Updated At'
+)->addColumn(
+    'packages',
+    \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
+    '20000',
+    array(),
+    'Packed Products in Packages'
+)->addColumn(
+    'shipping_label',
+    \Magento\Framework\DB\Ddl\Table::TYPE_VARBINARY,
+    '2m',
+    array(),
+    'Shipping Label Content'
 )->addIndex(
-    $installer->getIdxName('sales_flat_shipment', array('store_id')),
+    $this->getIdxName('sales_shipment', array('store_id')),
     array('store_id')
 )->addIndex(
-    $installer->getIdxName('sales_flat_shipment', array('total_qty')),
+    $this->getIdxName('sales_shipment', array('total_qty')),
     array('total_qty')
 )->addIndex(
-    $installer->getIdxName(
-        'sales_flat_shipment',
+    $this->getIdxName(
+        'sales_shipment',
         array('increment_id'),
         \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
     ),
     array('increment_id'),
     array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
 )->addIndex(
-    $installer->getIdxName('sales_flat_shipment', array('order_id')),
+    $this->getIdxName('sales_shipment', array('order_id')),
     array('order_id')
 )->addIndex(
-    $installer->getIdxName('sales_flat_shipment', array('created_at')),
+    $this->getIdxName('sales_shipment', array('created_at')),
     array('created_at')
 )->addIndex(
-    $installer->getIdxName('sales_flat_shipment', array('updated_at')),
+    $this->getIdxName('sales_shipment', array('updated_at')),
     array('updated_at')
 )->addForeignKey(
-    $installer->getFkName('sales_flat_shipment', 'order_id', 'sales_flat_order', 'entity_id'),
+    $this->getFkName('sales_shipment', 'order_id', 'sales_order', 'entity_id'),
     'order_id',
-    $installer->getTable('sales_flat_order'),
+    $this->getTable('sales_order'),
     'entity_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->addForeignKey(
-    $installer->getFkName('sales_flat_shipment', 'store_id', 'store', 'store_id'),
+    $this->getFkName('sales_shipment', 'store_id', 'store', 'store_id'),
     'store_id',
-    $installer->getTable('store'),
+    $this->getTable('store'),
     'store_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->setComment(
     'Sales Flat Shipment'
 );
-$installer->getConnection()->createTable($table);
-
+$this->getConnection()->createTable($table);
 
 /**
- * Create table 'sales_flat_shipment_grid'
+ * Create table 'sales_shipment_grid'
  */
-$table = $installer->getConnection()->newTable(
-    $installer->getTable('sales_flat_shipment_grid')
+$table = $this->getConnection()->newTable(
+    $this->getTable('sales_shipment_grid')
 )->addColumn(
     'entity_id',
     \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -2232,62 +2271,62 @@ $table = $installer->getConnection()->newTable(
     array(),
     'Shipping Name'
 )->addIndex(
-    $installer->getIdxName('sales_flat_shipment_grid', array('store_id')),
+    $this->getIdxName('sales_shipment_grid', array('store_id')),
     array('store_id')
 )->addIndex(
-    $installer->getIdxName('sales_flat_shipment_grid', array('total_qty')),
+    $this->getIdxName('sales_shipment_grid', array('total_qty')),
     array('total_qty')
 )->addIndex(
-    $installer->getIdxName('sales_flat_shipment_grid', array('order_id')),
+    $this->getIdxName('sales_shipment_grid', array('order_id')),
     array('order_id')
 )->addIndex(
-    $installer->getIdxName('sales_flat_shipment_grid', array('shipment_status')),
+    $this->getIdxName('sales_shipment_grid', array('shipment_status')),
     array('shipment_status')
 )->addIndex(
-    $installer->getIdxName(
-        'sales_flat_shipment_grid',
+    $this->getIdxName(
+        'sales_shipment_grid',
         array('increment_id'),
         \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
     ),
     array('increment_id'),
     array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
 )->addIndex(
-    $installer->getIdxName('sales_flat_shipment_grid', array('order_increment_id')),
+    $this->getIdxName('sales_shipment_grid', array('order_increment_id')),
     array('order_increment_id')
 )->addIndex(
-    $installer->getIdxName('sales_flat_shipment_grid', array('created_at')),
+    $this->getIdxName('sales_shipment_grid', array('created_at')),
     array('created_at')
 )->addIndex(
-    $installer->getIdxName('sales_flat_shipment_grid', array('order_created_at')),
+    $this->getIdxName('sales_shipment_grid', array('order_created_at')),
     array('order_created_at')
 )->addIndex(
-    $installer->getIdxName('sales_flat_shipment_grid', array('shipping_name')),
+    $this->getIdxName('sales_shipment_grid', array('shipping_name')),
     array('shipping_name')
 )->addForeignKey(
-    $installer->getFkName('sales_flat_shipment_grid', 'entity_id', 'sales_flat_shipment', 'entity_id'),
+    $this->getFkName('sales_shipment_grid', 'entity_id', 'sales_shipment', 'entity_id'),
     'entity_id',
-    $installer->getTable('sales_flat_shipment'),
+    $this->getTable('sales_shipment'),
     'entity_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->addForeignKey(
-    $installer->getFkName('sales_flat_shipment_grid', 'store_id', 'store', 'store_id'),
+    $this->getFkName('sales_shipment_grid', 'store_id', 'store', 'store_id'),
     'store_id',
-    $installer->getTable('store'),
+    $this->getTable('store'),
     'store_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->setComment(
     'Sales Flat Shipment Grid'
 );
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
 
 
 /**
- * Create table 'sales_flat_shipment_item'
+ * Create table 'sales_shipment_item'
  */
-$table = $installer->getConnection()->newTable(
-    $installer->getTable('sales_flat_shipment_item')
+$table = $this->getConnection()->newTable(
+    $this->getTable('sales_shipment_item')
 )->addColumn(
     'entity_id',
     \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -2361,26 +2400,26 @@ $table = $installer->getConnection()->newTable(
     array(),
     'Sku'
 )->addIndex(
-    $installer->getIdxName('sales_flat_shipment_item', array('parent_id')),
+    $this->getIdxName('sales_shipment_item', array('parent_id')),
     array('parent_id')
 )->addForeignKey(
-    $installer->getFkName('sales_flat_shipment_item', 'parent_id', 'sales_flat_shipment', 'entity_id'),
+    $this->getFkName('sales_shipment_item', 'parent_id', 'sales_shipment', 'entity_id'),
     'parent_id',
-    $installer->getTable('sales_flat_shipment'),
+    $this->getTable('sales_shipment'),
     'entity_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->setComment(
     'Sales Flat Shipment Item'
 );
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
 
 
 /**
- * Create table 'sales_flat_shipment_track'
+ * Create table 'sales_shipment_track'
  */
-$table = $installer->getConnection()->newTable(
-    $installer->getTable('sales_flat_shipment_track')
+$table = $this->getConnection()->newTable(
+    $this->getTable('sales_shipment_track')
 )->addColumn(
     'entity_id',
     \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -2448,32 +2487,32 @@ $table = $installer->getConnection()->newTable(
     array(),
     'Updated At'
 )->addIndex(
-    $installer->getIdxName('sales_flat_shipment_track', array('parent_id')),
+    $this->getIdxName('sales_shipment_track', array('parent_id')),
     array('parent_id')
 )->addIndex(
-    $installer->getIdxName('sales_flat_shipment_track', array('order_id')),
+    $this->getIdxName('sales_shipment_track', array('order_id')),
     array('order_id')
 )->addIndex(
-    $installer->getIdxName('sales_flat_shipment_track', array('created_at')),
+    $this->getIdxName('sales_shipment_track', array('created_at')),
     array('created_at')
 )->addForeignKey(
-    $installer->getFkName('sales_flat_shipment_track', 'parent_id', 'sales_flat_shipment', 'entity_id'),
+    $this->getFkName('sales_shipment_track', 'parent_id', 'sales_shipment', 'entity_id'),
     'parent_id',
-    $installer->getTable('sales_flat_shipment'),
+    $this->getTable('sales_shipment'),
     'entity_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->setComment(
     'Sales Flat Shipment Track'
 );
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
 
 
 /**
- * Create table 'sales_flat_shipment_comment'
+ * Create table 'sales_shipment_comment'
  */
-$table = $installer->getConnection()->newTable(
-    $installer->getTable('sales_flat_shipment_comment')
+$table = $this->getConnection()->newTable(
+    $this->getTable('sales_shipment_comment')
 )->addColumn(
     'entity_id',
     \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -2511,29 +2550,29 @@ $table = $installer->getConnection()->newTable(
     array(),
     'Created At'
 )->addIndex(
-    $installer->getIdxName('sales_flat_shipment_comment', array('created_at')),
+    $this->getIdxName('sales_shipment_comment', array('created_at')),
     array('created_at')
 )->addIndex(
-    $installer->getIdxName('sales_flat_shipment_comment', array('parent_id')),
+    $this->getIdxName('sales_shipment_comment', array('parent_id')),
     array('parent_id')
 )->addForeignKey(
-    $installer->getFkName('sales_flat_shipment_comment', 'parent_id', 'sales_flat_shipment', 'entity_id'),
+    $this->getFkName('sales_shipment_comment', 'parent_id', 'sales_shipment', 'entity_id'),
     'parent_id',
-    $installer->getTable('sales_flat_shipment'),
+    $this->getTable('sales_shipment'),
     'entity_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->setComment(
     'Sales Flat Shipment Comment'
 );
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
 
 
 /**
- * Create table 'sales_flat_invoice'
+ * Create table 'sales_invoice'
  */
-$table = $installer->getConnection()->newTable(
-    $installer->getTable('sales_flat_invoice')
+$table = $this->getConnection()->newTable(
+    $this->getTable('sales_invoice')
 )->addColumn(
     'entity_id',
     \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -2792,54 +2831,60 @@ $table = $installer->getConnection()->newTable(
     '12,4',
     array(),
     'Base Total Refunded'
+)->addColumn(
+    'discount_description',
+    \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
+    255,
+    array(),
+    'Discount Description'
 )->addIndex(
-    $installer->getIdxName('sales_flat_invoice', array('store_id')),
+    $this->getIdxName('sales_invoice', array('store_id')),
     array('store_id')
 )->addIndex(
-    $installer->getIdxName('sales_flat_invoice', array('grand_total')),
+    $this->getIdxName('sales_invoice', array('grand_total')),
     array('grand_total')
 )->addIndex(
-    $installer->getIdxName('sales_flat_invoice', array('order_id')),
+    $this->getIdxName('sales_invoice', array('order_id')),
     array('order_id')
 )->addIndex(
-    $installer->getIdxName('sales_flat_invoice', array('state')),
+    $this->getIdxName('sales_invoice', array('state')),
     array('state')
 )->addIndex(
-    $installer->getIdxName(
-        'sales_flat_invoice',
+    $this->getIdxName(
+        'sales_invoice',
         array('increment_id'),
         \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
     ),
     array('increment_id'),
     array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
 )->addIndex(
-    $installer->getIdxName('sales_flat_invoice', array('created_at')),
+    $this->getIdxName('sales_invoice', array('created_at')),
     array('created_at')
 )->addForeignKey(
-    $installer->getFkName('sales_flat_invoice', 'order_id', 'sales_flat_order', 'entity_id'),
+    $this->getFkName('sales_invoice', 'order_id', 'sales_order', 'entity_id'),
     'order_id',
-    $installer->getTable('sales_flat_order'),
+    $this->getTable('sales_order'),
     'entity_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->addForeignKey(
-    $installer->getFkName('sales_flat_invoice', 'store_id', 'store', 'store_id'),
+    $this->getFkName('sales_invoice', 'store_id', 'store', 'store_id'),
     'store_id',
-    $installer->getTable('store'),
+    $this->getTable('store'),
     'store_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->setComment(
     'Sales Flat Invoice'
 );
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
 
 
 /**
- * Create table 'sales_flat_invoice_grid'
+ * Create table 'sales_invoice_grid'
  */
-$table = $installer->getConnection()->newTable(
-    $installer->getTable('sales_flat_invoice_grid')
+$table = $this->getConnection()->newTable(
+    $this->getTable('sales_invoice_grid')
 )->addColumn(
     'entity_id',
     \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -2931,62 +2976,62 @@ $table = $installer->getConnection()->newTable(
     array(),
     'Billing Name'
 )->addIndex(
-    $installer->getIdxName('sales_flat_invoice_grid', array('store_id')),
+    $this->getIdxName('sales_invoice_grid', array('store_id')),
     array('store_id')
 )->addIndex(
-    $installer->getIdxName('sales_flat_invoice_grid', array('grand_total')),
+    $this->getIdxName('sales_invoice_grid', array('grand_total')),
     array('grand_total')
 )->addIndex(
-    $installer->getIdxName('sales_flat_invoice_grid', array('order_id')),
+    $this->getIdxName('sales_invoice_grid', array('order_id')),
     array('order_id')
 )->addIndex(
-    $installer->getIdxName('sales_flat_invoice_grid', array('state')),
+    $this->getIdxName('sales_invoice_grid', array('state')),
     array('state')
 )->addIndex(
-    $installer->getIdxName(
-        'sales_flat_invoice_grid',
+    $this->getIdxName(
+        'sales_invoice_grid',
         array('increment_id'),
         \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
     ),
     array('increment_id'),
     array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
 )->addIndex(
-    $installer->getIdxName('sales_flat_invoice_grid', array('order_increment_id')),
+    $this->getIdxName('sales_invoice_grid', array('order_increment_id')),
     array('order_increment_id')
 )->addIndex(
-    $installer->getIdxName('sales_flat_invoice_grid', array('created_at')),
+    $this->getIdxName('sales_invoice_grid', array('created_at')),
     array('created_at')
 )->addIndex(
-    $installer->getIdxName('sales_flat_invoice_grid', array('order_created_at')),
+    $this->getIdxName('sales_invoice_grid', array('order_created_at')),
     array('order_created_at')
 )->addIndex(
-    $installer->getIdxName('sales_flat_invoice_grid', array('billing_name')),
+    $this->getIdxName('sales_invoice_grid', array('billing_name')),
     array('billing_name')
 )->addForeignKey(
-    $installer->getFkName('sales_flat_invoice_grid', 'entity_id', 'sales_flat_invoice', 'entity_id'),
+    $this->getFkName('sales_invoice_grid', 'entity_id', 'sales_invoice', 'entity_id'),
     'entity_id',
-    $installer->getTable('sales_flat_invoice'),
+    $this->getTable('sales_invoice'),
     'entity_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->addForeignKey(
-    $installer->getFkName('sales_flat_invoice_grid', 'store_id', 'store', 'store_id'),
+    $this->getFkName('sales_invoice_grid', 'store_id', 'store', 'store_id'),
     'store_id',
-    $installer->getTable('store'),
+    $this->getTable('store'),
     'store_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->setComment(
     'Sales Flat Invoice Grid'
 );
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
 
 
 /**
- * Create table 'sales_flat_invoice_item'
+ * Create table 'sales_invoice_item'
  */
-$table = $installer->getConnection()->newTable(
-    $installer->getTable('sales_flat_invoice_item')
+$table = $this->getConnection()->newTable(
+    $this->getTable('sales_invoice_item')
 )->addColumn(
     'entity_id',
     \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -3132,26 +3177,26 @@ $table = $installer->getConnection()->newTable(
     array(),
     'Base Hidden Tax Amount'
 )->addIndex(
-    $installer->getIdxName('sales_flat_invoice_item', array('parent_id')),
+    $this->getIdxName('sales_invoice_item', array('parent_id')),
     array('parent_id')
 )->addForeignKey(
-    $installer->getFkName('sales_flat_invoice_item', 'parent_id', 'sales_flat_invoice', 'entity_id'),
+    $this->getFkName('sales_invoice_item', 'parent_id', 'sales_invoice', 'entity_id'),
     'parent_id',
-    $installer->getTable('sales_flat_invoice'),
+    $this->getTable('sales_invoice'),
     'entity_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->setComment(
     'Sales Flat Invoice Item'
 );
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
 
 
 /**
- * Create table 'sales_flat_invoice_comment'
+ * Create table 'sales_invoice_comment'
  */
-$table = $installer->getConnection()->newTable(
-    $installer->getTable('sales_flat_invoice_comment')
+$table = $this->getConnection()->newTable(
+    $this->getTable('sales_invoice_comment')
 )->addColumn(
     'entity_id',
     \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -3189,29 +3234,29 @@ $table = $installer->getConnection()->newTable(
     array(),
     'Created At'
 )->addIndex(
-    $installer->getIdxName('sales_flat_invoice_comment', array('created_at')),
+    $this->getIdxName('sales_invoice_comment', array('created_at')),
     array('created_at')
 )->addIndex(
-    $installer->getIdxName('sales_flat_invoice_comment', array('parent_id')),
+    $this->getIdxName('sales_invoice_comment', array('parent_id')),
     array('parent_id')
 )->addForeignKey(
-    $installer->getFkName('sales_flat_invoice_comment', 'parent_id', 'sales_flat_invoice', 'entity_id'),
+    $this->getFkName('sales_invoice_comment', 'parent_id', 'sales_invoice', 'entity_id'),
     'parent_id',
-    $installer->getTable('sales_flat_invoice'),
+    $this->getTable('sales_invoice'),
     'entity_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->setComment(
     'Sales Flat Invoice Comment'
 );
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
 
 
 /**
- * Create table 'sales_flat_creditmemo'
+ * Create table 'sales_creditmemo'
  */
-$table = $installer->getConnection()->newTable(
-    $installer->getTable('sales_flat_creditmemo')
+$table = $this->getConnection()->newTable(
+    $this->getTable('sales_creditmemo')
 )->addColumn(
     'entity_id',
     \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -3494,54 +3539,60 @@ $table = $installer->getConnection()->newTable(
     '12,4',
     array(),
     'Base Shipping Incl Tax'
+)->addColumn(
+    'discount_description',
+    \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
+    255,
+    array(),
+    'Discount Description'
 )->addIndex(
-    $installer->getIdxName('sales_flat_creditmemo', array('store_id')),
+    $this->getIdxName('sales_creditmemo', array('store_id')),
     array('store_id')
 )->addIndex(
-    $installer->getIdxName('sales_flat_creditmemo', array('order_id')),
+    $this->getIdxName('sales_creditmemo', array('order_id')),
     array('order_id')
 )->addIndex(
-    $installer->getIdxName('sales_flat_creditmemo', array('creditmemo_status')),
+    $this->getIdxName('sales_creditmemo', array('creditmemo_status')),
     array('creditmemo_status')
 )->addIndex(
-    $installer->getIdxName(
-        'sales_flat_creditmemo',
+    $this->getIdxName(
+        'sales_creditmemo',
         array('increment_id'),
         \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
     ),
     array('increment_id'),
     array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
 )->addIndex(
-    $installer->getIdxName('sales_flat_creditmemo', array('state')),
+    $this->getIdxName('sales_creditmemo', array('state')),
     array('state')
 )->addIndex(
-    $installer->getIdxName('sales_flat_creditmemo', array('created_at')),
+    $this->getIdxName('sales_creditmemo', array('created_at')),
     array('created_at')
 )->addForeignKey(
-    $installer->getFkName('sales_flat_creditmemo', 'order_id', 'sales_flat_order', 'entity_id'),
+    $this->getFkName('sales_creditmemo', 'order_id', 'sales_order', 'entity_id'),
     'order_id',
-    $installer->getTable('sales_flat_order'),
+    $this->getTable('sales_order'),
     'entity_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->addForeignKey(
-    $installer->getFkName('sales_flat_creditmemo', 'store_id', 'store', 'store_id'),
+    $this->getFkName('sales_creditmemo', 'store_id', 'store', 'store_id'),
     'store_id',
-    $installer->getTable('store'),
+    $this->getTable('store'),
     'store_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->setComment(
     'Sales Flat Creditmemo'
 );
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
 
 
 /**
- * Create table 'sales_flat_creditmemo_grid'
+ * Create table 'sales_creditmemo_grid'
  */
-$table = $installer->getConnection()->newTable(
-    $installer->getTable('sales_flat_creditmemo_grid')
+$table = $this->getConnection()->newTable(
+    $this->getTable('sales_creditmemo_grid')
 )->addColumn(
     'entity_id',
     \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -3669,68 +3720,68 @@ $table = $installer->getConnection()->newTable(
     array(),
     'Billing Name'
 )->addIndex(
-    $installer->getIdxName('sales_flat_creditmemo_grid', array('store_id')),
+    $this->getIdxName('sales_creditmemo_grid', array('store_id')),
     array('store_id')
 )->addIndex(
-    $installer->getIdxName('sales_flat_creditmemo_grid', array('grand_total')),
+    $this->getIdxName('sales_creditmemo_grid', array('grand_total')),
     array('grand_total')
 )->addIndex(
-    $installer->getIdxName('sales_flat_creditmemo_grid', array('base_grand_total')),
+    $this->getIdxName('sales_creditmemo_grid', array('base_grand_total')),
     array('base_grand_total')
 )->addIndex(
-    $installer->getIdxName('sales_flat_creditmemo_grid', array('order_id')),
+    $this->getIdxName('sales_creditmemo_grid', array('order_id')),
     array('order_id')
 )->addIndex(
-    $installer->getIdxName('sales_flat_creditmemo_grid', array('creditmemo_status')),
+    $this->getIdxName('sales_creditmemo_grid', array('creditmemo_status')),
     array('creditmemo_status')
 )->addIndex(
-    $installer->getIdxName('sales_flat_creditmemo_grid', array('state')),
+    $this->getIdxName('sales_creditmemo_grid', array('state')),
     array('state')
 )->addIndex(
-    $installer->getIdxName(
-        'sales_flat_creditmemo_grid',
+    $this->getIdxName(
+        'sales_creditmemo_grid',
         array('increment_id'),
         \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
     ),
     array('increment_id'),
     array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
 )->addIndex(
-    $installer->getIdxName('sales_flat_creditmemo_grid', array('order_increment_id')),
+    $this->getIdxName('sales_creditmemo_grid', array('order_increment_id')),
     array('order_increment_id')
 )->addIndex(
-    $installer->getIdxName('sales_flat_creditmemo_grid', array('created_at')),
+    $this->getIdxName('sales_creditmemo_grid', array('created_at')),
     array('created_at')
 )->addIndex(
-    $installer->getIdxName('sales_flat_creditmemo_grid', array('order_created_at')),
+    $this->getIdxName('sales_creditmemo_grid', array('order_created_at')),
     array('order_created_at')
 )->addIndex(
-    $installer->getIdxName('sales_flat_creditmemo_grid', array('billing_name')),
+    $this->getIdxName('sales_creditmemo_grid', array('billing_name')),
     array('billing_name')
 )->addForeignKey(
-    $installer->getFkName('sales_flat_creditmemo_grid', 'entity_id', 'sales_flat_creditmemo', 'entity_id'),
+    $this->getFkName('sales_creditmemo_grid', 'entity_id', 'sales_creditmemo', 'entity_id'),
     'entity_id',
-    $installer->getTable('sales_flat_creditmemo'),
+    $this->getTable('sales_creditmemo'),
     'entity_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->addForeignKey(
-    $installer->getFkName('sales_flat_creditmemo_grid', 'store_id', 'store', 'store_id'),
+    $this->getFkName('sales_creditmemo_grid', 'store_id', 'store', 'store_id'),
     'store_id',
-    $installer->getTable('store'),
+    $this->getTable('store'),
     'store_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->setComment(
     'Sales Flat Creditmemo Grid'
 );
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
 
 
 /**
- * Create table 'sales_flat_creditmemo_item'
+ * Create table 'sales_creditmemo_item'
  */
-$table = $installer->getConnection()->newTable(
-    $installer->getTable('sales_flat_creditmemo_item')
+$table = $this->getConnection()->newTable(
+    $this->getTable('sales_creditmemo_item')
 )->addColumn(
     'entity_id',
     \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -3876,25 +3927,25 @@ $table = $installer->getConnection()->newTable(
     array(),
     'Base Hidden Tax Amount'
 )->addIndex(
-    $installer->getIdxName('sales_flat_creditmemo_item', array('parent_id')),
+    $this->getIdxName('sales_creditmemo_item', array('parent_id')),
     array('parent_id')
 )->addForeignKey(
-    $installer->getFkName('sales_flat_creditmemo_item', 'parent_id', 'sales_flat_creditmemo', 'entity_id'),
+    $this->getFkName('sales_creditmemo_item', 'parent_id', 'sales_creditmemo', 'entity_id'),
     'parent_id',
-    $installer->getTable('sales_flat_creditmemo'),
+    $this->getTable('sales_creditmemo'),
     'entity_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->setComment(
     'Sales Flat Creditmemo Item'
 );
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
 
 /**
- * Create table 'sales_flat_creditmemo_comment'
+ * Create table 'sales_creditmemo_comment'
  */
-$table = $installer->getConnection()->newTable(
-    $installer->getTable('sales_flat_creditmemo_comment')
+$table = $this->getConnection()->newTable(
+    $this->getTable('sales_creditmemo_comment')
 )->addColumn(
     'entity_id',
     \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -3932,29 +3983,29 @@ $table = $installer->getConnection()->newTable(
     array(),
     'Created At'
 )->addIndex(
-    $installer->getIdxName('sales_flat_creditmemo_comment', array('created_at')),
+    $this->getIdxName('sales_creditmemo_comment', array('created_at')),
     array('created_at')
 )->addIndex(
-    $installer->getIdxName('sales_flat_creditmemo_comment', array('parent_id')),
+    $this->getIdxName('sales_creditmemo_comment', array('parent_id')),
     array('parent_id')
 )->addForeignKey(
-    $installer->getFkName('sales_flat_creditmemo_comment', 'parent_id', 'sales_flat_creditmemo', 'entity_id'),
+    $this->getFkName('sales_creditmemo_comment', 'parent_id', 'sales_creditmemo', 'entity_id'),
     'parent_id',
-    $installer->getTable('sales_flat_creditmemo'),
+    $this->getTable('sales_creditmemo'),
     'entity_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->setComment(
     'Sales Flat Creditmemo Comment'
 );
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
 
 
 /**
- * Create table 'sales_flat_quote'
+ * Create table 'sales_quote'
  */
-$table = $installer->getConnection()->newTable(
-    $installer->getTable('sales_flat_quote')
+$table = $this->getConnection()->newTable(
+    $this->getTable('sales_quote')
 )->addColumn(
     'entity_id',
     \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -4250,29 +4301,29 @@ $table = $installer->getConnection()->newTable(
     array(),
     'Ext Shipping Info'
 )->addIndex(
-    $installer->getIdxName('sales_flat_quote', array('customer_id', 'store_id', 'is_active')),
+    $this->getIdxName('sales_quote', array('customer_id', 'store_id', 'is_active')),
     array('customer_id', 'store_id', 'is_active')
 )->addIndex(
-    $installer->getIdxName('sales_flat_quote', array('store_id')),
+    $this->getIdxName('sales_quote', array('store_id')),
     array('store_id')
 )->addForeignKey(
-    $installer->getFkName('sales_flat_quote', 'store_id', 'store', 'store_id'),
+    $this->getFkName('sales_quote', 'store_id', 'store', 'store_id'),
     'store_id',
-    $installer->getTable('store'),
+    $this->getTable('store'),
     'store_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->setComment(
     'Sales Flat Quote'
 );
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
 
 
 /**
- * Create table 'sales_flat_quote_address'
+ * Create table 'sales_quote_address'
  */
-$table = $installer->getConnection()->newTable(
-    $installer->getTable('sales_flat_quote_address')
+$table = $this->getConnection()->newTable(
+    $this->getTable('sales_quote_address')
 )->addColumn(
     'address_id',
     \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -4604,26 +4655,26 @@ $table = $installer->getConnection()->newTable(
     array(),
     'Base Shipping Incl Tax'
 )->addIndex(
-    $installer->getIdxName('sales_flat_quote_address', array('quote_id')),
+    $this->getIdxName('sales_quote_address', array('quote_id')),
     array('quote_id')
 )->addForeignKey(
-    $installer->getFkName('sales_flat_quote_address', 'quote_id', 'sales_flat_quote', 'entity_id'),
+    $this->getFkName('sales_quote_address', 'quote_id', 'sales_quote', 'entity_id'),
     'quote_id',
-    $installer->getTable('sales_flat_quote'),
+    $this->getTable('sales_quote'),
     'entity_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->setComment(
     'Sales Flat Quote Address'
 );
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
 
 
 /**
- * Create table 'sales_flat_quote_item'
+ * Create table 'sales_quote_item'
  */
-$table = $installer->getConnection()->newTable(
-    $installer->getTable('sales_flat_quote_item')
+$table = $this->getConnection()->newTable(
+    $this->getTable('sales_quote_item')
 )->addColumn(
     'item_id',
     \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -4877,55 +4928,55 @@ $table = $installer->getConnection()->newTable(
     array(),
     'Base Hidden Tax Amount'
 )->addIndex(
-    $installer->getIdxName('sales_flat_quote_item', array('parent_item_id')),
+    $this->getIdxName('sales_quote_item', array('parent_item_id')),
     array('parent_item_id')
 )->addIndex(
-    $installer->getIdxName('sales_flat_quote_item', array('product_id')),
+    $this->getIdxName('sales_quote_item', array('product_id')),
     array('product_id')
 )->addIndex(
-    $installer->getIdxName('sales_flat_quote_item', array('quote_id')),
+    $this->getIdxName('sales_quote_item', array('quote_id')),
     array('quote_id')
 )->addIndex(
-    $installer->getIdxName('sales_flat_quote_item', array('store_id')),
+    $this->getIdxName('sales_quote_item', array('store_id')),
     array('store_id')
 )->addForeignKey(
-    $installer->getFkName('sales_flat_quote_item', 'parent_item_id', 'sales_flat_quote_item', 'item_id'),
+    $this->getFkName('sales_quote_item', 'parent_item_id', 'sales_quote_item', 'item_id'),
     'parent_item_id',
-    $installer->getTable('sales_flat_quote_item'),
+    $this->getTable('sales_quote_item'),
     'item_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->addForeignKey(
-    $installer->getFkName('sales_flat_quote_item', 'product_id', 'catalog_product_entity', 'entity_id'),
+    $this->getFkName('sales_quote_item', 'product_id', 'catalog_product_entity', 'entity_id'),
     'product_id',
-    $installer->getTable('catalog_product_entity'),
+    $this->getTable('catalog_product_entity'),
     'entity_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->addForeignKey(
-    $installer->getFkName('sales_flat_quote_item', 'quote_id', 'sales_flat_quote', 'entity_id'),
+    $this->getFkName('sales_quote_item', 'quote_id', 'sales_quote', 'entity_id'),
     'quote_id',
-    $installer->getTable('sales_flat_quote'),
+    $this->getTable('sales_quote'),
     'entity_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->addForeignKey(
-    $installer->getFkName('sales_flat_quote_item', 'store_id', 'store', 'store_id'),
+    $this->getFkName('sales_quote_item', 'store_id', 'store', 'store_id'),
     'store_id',
-    $installer->getTable('store'),
+    $this->getTable('store'),
     'store_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->setComment(
     'Sales Flat Quote Item'
 );
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
 
 /**
- * Create table 'sales_flat_quote_address_item'
+ * Create table 'sales_quote_address_item'
  */
-$table = $installer->getConnection()->newTable(
-    $installer->getTable('sales_flat_quote_address_item')
+$table = $this->getConnection()->newTable(
+    $this->getTable('sales_quote_address_item')
 )->addColumn(
     'address_item_id',
     \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -5155,56 +5206,56 @@ $table = $installer->getConnection()->newTable(
     array(),
     'Base Hidden Tax Amount'
 )->addIndex(
-    $installer->getIdxName('sales_flat_quote_address_item', array('quote_address_id')),
+    $this->getIdxName('sales_quote_address_item', array('quote_address_id')),
     array('quote_address_id')
 )->addIndex(
-    $installer->getIdxName('sales_flat_quote_address_item', array('parent_item_id')),
+    $this->getIdxName('sales_quote_address_item', array('parent_item_id')),
     array('parent_item_id')
 )->addIndex(
-    $installer->getIdxName('sales_flat_quote_address_item', array('quote_item_id')),
+    $this->getIdxName('sales_quote_address_item', array('quote_item_id')),
     array('quote_item_id')
 )->addForeignKey(
-    $installer->getFkName(
-        'sales_flat_quote_address_item',
+    $this->getFkName(
+        'sales_quote_address_item',
         'quote_address_id',
-        'sales_flat_quote_address',
+        'sales_quote_address',
         'address_id'
     ),
     'quote_address_id',
-    $installer->getTable('sales_flat_quote_address'),
+    $this->getTable('sales_quote_address'),
     'address_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->addForeignKey(
-    $installer->getFkName(
-        'sales_flat_quote_address_item',
+    $this->getFkName(
+        'sales_quote_address_item',
         'parent_item_id',
-        'sales_flat_quote_address_item',
+        'sales_quote_address_item',
         'address_item_id'
     ),
     'parent_item_id',
-    $installer->getTable('sales_flat_quote_address_item'),
+    $this->getTable('sales_quote_address_item'),
     'address_item_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->addForeignKey(
-    $installer->getFkName('sales_flat_quote_address_item', 'quote_item_id', 'sales_flat_quote_item', 'item_id'),
+    $this->getFkName('sales_quote_address_item', 'quote_item_id', 'sales_quote_item', 'item_id'),
     'quote_item_id',
-    $installer->getTable('sales_flat_quote_item'),
+    $this->getTable('sales_quote_item'),
     'item_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->setComment(
     'Sales Flat Quote Address Item'
 );
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
 
 
 /**
- * Create table 'sales_flat_quote_item_option'
+ * Create table 'sales_quote_item_option'
  */
-$table = $installer->getConnection()->newTable(
-    $installer->getTable('sales_flat_quote_item_option')
+$table = $this->getConnection()->newTable(
+    $this->getTable('sales_quote_item_option')
 )->addColumn(
     'option_id',
     \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -5236,26 +5287,26 @@ $table = $installer->getConnection()->newTable(
     array(),
     'Value'
 )->addIndex(
-    $installer->getIdxName('sales_flat_quote_item_option', array('item_id')),
+    $this->getIdxName('sales_quote_item_option', array('item_id')),
     array('item_id')
 )->addForeignKey(
-    $installer->getFkName('sales_flat_quote_item_option', 'item_id', 'sales_flat_quote_item', 'item_id'),
+    $this->getFkName('sales_quote_item_option', 'item_id', 'sales_quote_item', 'item_id'),
     'item_id',
-    $installer->getTable('sales_flat_quote_item'),
+    $this->getTable('sales_quote_item'),
     'item_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->setComment(
     'Sales Flat Quote Item Option'
 );
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
 
 
 /**
- * Create table 'sales_flat_quote_payment'
+ * Create table 'sales_quote_payment'
  */
-$table = $installer->getConnection()->newTable(
-    $installer->getTable('sales_flat_quote_payment')
+$table = $this->getConnection()->newTable(
+    $this->getTable('sales_quote_payment')
 )->addColumn(
     'payment_id',
     \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -5318,9 +5369,9 @@ $table = $installer->getConnection()->newTable(
     'Cc Owner'
 )->addColumn(
     'cc_exp_month',
-    \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
-    null,
-    array('unsigned' => true, 'default' => '0'),
+    \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
+    255,
+    array('unsigned' => true, 'default' => null, 'nullable' => true),
     'Cc Exp Month'
 )->addColumn(
     'cc_exp_year',
@@ -5371,26 +5422,26 @@ $table = $installer->getConnection()->newTable(
     array(),
     'Additional Information'
 )->addIndex(
-    $installer->getIdxName('sales_flat_quote_payment', array('quote_id')),
+    $this->getIdxName('sales_quote_payment', array('quote_id')),
     array('quote_id')
 )->addForeignKey(
-    $installer->getFkName('sales_flat_quote_payment', 'quote_id', 'sales_flat_quote', 'entity_id'),
+    $this->getFkName('sales_quote_payment', 'quote_id', 'sales_quote', 'entity_id'),
     'quote_id',
-    $installer->getTable('sales_flat_quote'),
+    $this->getTable('sales_quote'),
     'entity_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->setComment(
     'Sales Flat Quote Payment'
 );
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
 
 
 /**
- * Create table 'sales_flat_quote_shipping_rate'
+ * Create table 'sales_quote_shipping_rate'
  */
-$table = $installer->getConnection()->newTable(
-    $installer->getTable('sales_flat_quote_shipping_rate')
+$table = $this->getConnection()->newTable(
+    $this->getTable('sales_quote_shipping_rate')
 )->addColumn(
     'rate_id',
     \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -5464,26 +5515,26 @@ $table = $installer->getConnection()->newTable(
     array(),
     'Method Title'
 )->addIndex(
-    $installer->getIdxName('sales_flat_quote_shipping_rate', array('address_id')),
+    $this->getIdxName('sales_quote_shipping_rate', array('address_id')),
     array('address_id')
 )->addForeignKey(
-    $installer->getFkName('sales_flat_quote_shipping_rate', 'address_id', 'sales_flat_quote_address', 'address_id'),
+    $this->getFkName('sales_quote_shipping_rate', 'address_id', 'sales_quote_address', 'address_id'),
     'address_id',
-    $installer->getTable('sales_flat_quote_address'),
+    $this->getTable('sales_quote_address'),
     'address_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->setComment(
     'Sales Flat Quote Shipping Rate'
 );
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
 
 
 /**
  * Create table 'sales_invoiced_aggregated'
  */
-$table = $installer->getConnection()->newTable(
-    $installer->getTable('sales_invoiced_aggregated')
+$table = $this->getConnection()->newTable(
+    $this->getTable('sales_invoiced_aggregated')
 )->addColumn(
     'id',
     \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -5539,7 +5590,7 @@ $table = $installer->getConnection()->newTable(
     array(),
     'Invoiced Not Captured'
 )->addIndex(
-    $installer->getIdxName(
+    $this->getIdxName(
         'sales_invoiced_aggregated',
         array('period', 'store_id', 'order_status'),
         \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
@@ -5547,26 +5598,26 @@ $table = $installer->getConnection()->newTable(
     array('period', 'store_id', 'order_status'),
     array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
 )->addIndex(
-    $installer->getIdxName('sales_invoiced_aggregated', array('store_id')),
+    $this->getIdxName('sales_invoiced_aggregated', array('store_id')),
     array('store_id')
 )->addForeignKey(
-    $installer->getFkName('sales_invoiced_aggregated', 'store_id', 'store', 'store_id'),
+    $this->getFkName('sales_invoiced_aggregated', 'store_id', 'store', 'store_id'),
     'store_id',
-    $installer->getTable('store'),
+    $this->getTable('store'),
     'store_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->setComment(
     'Sales Invoiced Aggregated'
 );
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
 
 
 /**
  * Create table 'sales_invoiced_aggregated_order'
  */
-$table = $installer->getConnection()->newTable(
-    $installer->getTable('sales_invoiced_aggregated_order')
+$table = $this->getConnection()->newTable(
+    $this->getTable('sales_invoiced_aggregated_order')
 )->addColumn(
     'id',
     \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -5622,7 +5673,7 @@ $table = $installer->getConnection()->newTable(
     array(),
     'Invoiced Not Captured'
 )->addIndex(
-    $installer->getIdxName(
+    $this->getIdxName(
         'sales_invoiced_aggregated_order',
         array('period', 'store_id', 'order_status'),
         \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
@@ -5630,26 +5681,26 @@ $table = $installer->getConnection()->newTable(
     array('period', 'store_id', 'order_status'),
     array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
 )->addIndex(
-    $installer->getIdxName('sales_invoiced_aggregated_order', array('store_id')),
+    $this->getIdxName('sales_invoiced_aggregated_order', array('store_id')),
     array('store_id')
 )->addForeignKey(
-    $installer->getFkName('sales_invoiced_aggregated_order', 'store_id', 'store', 'store_id'),
+    $this->getFkName('sales_invoiced_aggregated_order', 'store_id', 'store', 'store_id'),
     'store_id',
-    $installer->getTable('store'),
+    $this->getTable('store'),
     'store_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->setComment(
     'Sales Invoiced Aggregated Order'
 );
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
 
 
 /**
  * Create table 'sales_order_aggregated_created'
  */
-$table = $installer->getConnection()->newTable(
-    $installer->getTable('sales_order_aggregated_created')
+$table = $this->getConnection()->newTable(
+    $this->getTable('sales_order_aggregated_created')
 )->addColumn(
     'id',
     \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -5771,7 +5822,7 @@ $table = $installer->getConnection()->newTable(
     array('nullable' => false, 'default' => '0.0000'),
     'Total Discount Amount Actual'
 )->addIndex(
-    $installer->getIdxName(
+    $this->getIdxName(
         'sales_order_aggregated_created',
         array('period', 'store_id', 'order_status'),
         \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
@@ -5779,26 +5830,33 @@ $table = $installer->getConnection()->newTable(
     array('period', 'store_id', 'order_status'),
     array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
 )->addIndex(
-    $installer->getIdxName('sales_order_aggregated_created', array('store_id')),
+    $this->getIdxName('sales_order_aggregated_created', array('store_id')),
     array('store_id')
 )->addForeignKey(
-    $installer->getFkName('sales_order_aggregated_created', 'store_id', 'store', 'store_id'),
+    $this->getFkName('sales_order_aggregated_created', 'store_id', 'store', 'store_id'),
     'store_id',
-    $installer->getTable('store'),
+    $this->getTable('store'),
     'store_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->setComment(
     'Sales Order Aggregated Created'
 );
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
+
+$this->getConnection()->createTable(
+    $this->getConnection()->createTableByDdl(
+        $this->getTable('sales_order_aggregated_created'),
+        $this->getTable('sales_order_aggregated_updated')
+    )
+);
 
 
 /**
  * Create table 'sales_payment_transaction'
  */
-$table = $installer->getConnection()->newTable(
-    $installer->getTable('sales_payment_transaction')
+$table = $this->getConnection()->newTable(
+    $this->getTable('sales_payment_transaction')
 )->addColumn(
     'transaction_id',
     \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -5860,7 +5918,7 @@ $table = $installer->getConnection()->newTable(
     array(),
     'Created At'
 )->addIndex(
-    $installer->getIdxName(
+    $this->getIdxName(
         'sales_payment_transaction',
         array('order_id', 'payment_id', 'txn_id'),
         \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
@@ -5868,43 +5926,43 @@ $table = $installer->getConnection()->newTable(
     array('order_id', 'payment_id', 'txn_id'),
     array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
 )->addIndex(
-    $installer->getIdxName('sales_payment_transaction', array('parent_id')),
+    $this->getIdxName('sales_payment_transaction', array('parent_id')),
     array('parent_id')
 )->addIndex(
-    $installer->getIdxName('sales_payment_transaction', array('payment_id')),
+    $this->getIdxName('sales_payment_transaction', array('payment_id')),
     array('payment_id')
 )->addForeignKey(
-    $installer->getFkName('sales_payment_transaction', 'order_id', 'sales_flat_order', 'entity_id'),
+    $this->getFkName('sales_payment_transaction', 'order_id', 'sales_order', 'entity_id'),
     'order_id',
-    $installer->getTable('sales_flat_order'),
+    $this->getTable('sales_order'),
     'entity_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->addForeignKey(
-    $installer->getFkName('sales_payment_transaction', 'parent_id', 'sales_payment_transaction', 'transaction_id'),
+    $this->getFkName('sales_payment_transaction', 'parent_id', 'sales_payment_transaction', 'transaction_id'),
     'parent_id',
-    $installer->getTable('sales_payment_transaction'),
+    $this->getTable('sales_payment_transaction'),
     'transaction_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->addForeignKey(
-    $installer->getFkName('sales_payment_transaction', 'payment_id', 'sales_flat_order_payment', 'entity_id'),
+    $this->getFkName('sales_payment_transaction', 'payment_id', 'sales_order_payment', 'entity_id'),
     'payment_id',
-    $installer->getTable('sales_flat_order_payment'),
+    $this->getTable('sales_order_payment'),
     'entity_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->setComment(
     'Sales Payment Transaction'
 );
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
 
 
 /**
  * Create table 'sales_refunded_aggregated'
  */
-$table = $installer->getConnection()->newTable(
-    $installer->getTable('sales_refunded_aggregated')
+$table = $this->getConnection()->newTable(
+    $this->getTable('sales_refunded_aggregated')
 )->addColumn(
     'id',
     \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -5954,7 +6012,7 @@ $table = $installer->getConnection()->newTable(
     array(),
     'Offline Refunded'
 )->addIndex(
-    $installer->getIdxName(
+    $this->getIdxName(
         'sales_refunded_aggregated',
         array('period', 'store_id', 'order_status'),
         \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
@@ -5962,26 +6020,26 @@ $table = $installer->getConnection()->newTable(
     array('period', 'store_id', 'order_status'),
     array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
 )->addIndex(
-    $installer->getIdxName('sales_refunded_aggregated', array('store_id')),
+    $this->getIdxName('sales_refunded_aggregated', array('store_id')),
     array('store_id')
 )->addForeignKey(
-    $installer->getFkName('sales_refunded_aggregated', 'store_id', 'store', 'store_id'),
+    $this->getFkName('sales_refunded_aggregated', 'store_id', 'store', 'store_id'),
     'store_id',
-    $installer->getTable('store'),
+    $this->getTable('store'),
     'store_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->setComment(
     'Sales Refunded Aggregated'
 );
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
 
 
 /**
  * Create table 'sales_refunded_aggregated_order'
  */
-$table = $installer->getConnection()->newTable(
-    $installer->getTable('sales_refunded_aggregated_order')
+$table = $this->getConnection()->newTable(
+    $this->getTable('sales_refunded_aggregated_order')
 )->addColumn(
     'id',
     \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -6031,7 +6089,7 @@ $table = $installer->getConnection()->newTable(
     array(),
     'Offline Refunded'
 )->addIndex(
-    $installer->getIdxName(
+    $this->getIdxName(
         'sales_refunded_aggregated_order',
         array('period', 'store_id', 'order_status'),
         \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
@@ -6039,26 +6097,26 @@ $table = $installer->getConnection()->newTable(
     array('period', 'store_id', 'order_status'),
     array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
 )->addIndex(
-    $installer->getIdxName('sales_refunded_aggregated_order', array('store_id')),
+    $this->getIdxName('sales_refunded_aggregated_order', array('store_id')),
     array('store_id')
 )->addForeignKey(
-    $installer->getFkName('sales_refunded_aggregated_order', 'store_id', 'store', 'store_id'),
+    $this->getFkName('sales_refunded_aggregated_order', 'store_id', 'store', 'store_id'),
     'store_id',
-    $installer->getTable('store'),
+    $this->getTable('store'),
     'store_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->setComment(
     'Sales Refunded Aggregated Order'
 );
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
 
 
 /**
  * Create table 'sales_shipping_aggregated'
  */
-$table = $installer->getConnection()->newTable(
-    $installer->getTable('sales_shipping_aggregated')
+$table = $this->getConnection()->newTable(
+    $this->getTable('sales_shipping_aggregated')
 )->addColumn(
     'id',
     \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -6108,7 +6166,7 @@ $table = $installer->getConnection()->newTable(
     array(),
     'Total Shipping Actual'
 )->addIndex(
-    $installer->getIdxName(
+    $this->getIdxName(
         'sales_shipping_aggregated',
         array('period', 'store_id', 'order_status', 'shipping_description'),
         \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
@@ -6116,26 +6174,26 @@ $table = $installer->getConnection()->newTable(
     array('period', 'store_id', 'order_status', 'shipping_description'),
     array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
 )->addIndex(
-    $installer->getIdxName('sales_shipping_aggregated', array('store_id')),
+    $this->getIdxName('sales_shipping_aggregated', array('store_id')),
     array('store_id')
 )->addForeignKey(
-    $installer->getFkName('sales_shipping_aggregated', 'store_id', 'store', 'store_id'),
+    $this->getFkName('sales_shipping_aggregated', 'store_id', 'store', 'store_id'),
     'store_id',
-    $installer->getTable('store'),
+    $this->getTable('store'),
     'store_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->setComment(
     'Sales Shipping Aggregated'
 );
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
 
 
 /**
  * Create table 'sales_shipping_aggregated_order'
  */
-$table = $installer->getConnection()->newTable(
-    $installer->getTable('sales_shipping_aggregated_order')
+$table = $this->getConnection()->newTable(
+    $this->getTable('sales_shipping_aggregated_order')
 )->addColumn(
     'id',
     \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -6185,7 +6243,7 @@ $table = $installer->getConnection()->newTable(
     array(),
     'Total Shipping Actual'
 )->addIndex(
-    $installer->getIdxName(
+    $this->getIdxName(
         'sales_shipping_aggregated_order',
         array('period', 'store_id', 'order_status', 'shipping_description'),
         \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
@@ -6193,26 +6251,26 @@ $table = $installer->getConnection()->newTable(
     array('period', 'store_id', 'order_status', 'shipping_description'),
     array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
 )->addIndex(
-    $installer->getIdxName('sales_shipping_aggregated_order', array('store_id')),
+    $this->getIdxName('sales_shipping_aggregated_order', array('store_id')),
     array('store_id')
 )->addForeignKey(
-    $installer->getFkName('sales_shipping_aggregated_order', 'store_id', 'store', 'store_id'),
+    $this->getFkName('sales_shipping_aggregated_order', 'store_id', 'store', 'store_id'),
     'store_id',
-    $installer->getTable('store'),
+    $this->getTable('store'),
     'store_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->setComment(
     'Sales Shipping Aggregated Order'
 );
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
 
 
 /**
  * Create table 'sales_bestsellers_aggregated_daily'
  */
-$table = $installer->getConnection()->newTable(
-    $installer->getTable('sales_bestsellers_aggregated_daily')
+$table = $this->getConnection()->newTable(
+    $this->getTable('sales_bestsellers_aggregated_daily')
 )->addColumn(
     'id',
     \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -6262,7 +6320,7 @@ $table = $installer->getConnection()->newTable(
     array('unsigned' => true, 'nullable' => false, 'default' => '0'),
     'Rating Pos'
 )->addIndex(
-    $installer->getIdxName(
+    $this->getIdxName(
         'sales_bestsellers_aggregated_daily',
         array('period', 'store_id', 'product_id'),
         \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
@@ -6270,36 +6328,36 @@ $table = $installer->getConnection()->newTable(
     array('period', 'store_id', 'product_id'),
     array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
 )->addIndex(
-    $installer->getIdxName('sales_bestsellers_aggregated_daily', array('store_id')),
+    $this->getIdxName('sales_bestsellers_aggregated_daily', array('store_id')),
     array('store_id')
 )->addIndex(
-    $installer->getIdxName('sales_bestsellers_aggregated_daily', array('product_id')),
+    $this->getIdxName('sales_bestsellers_aggregated_daily', array('product_id')),
     array('product_id')
 )->addForeignKey(
-    $installer->getFkName('sales_bestsellers_aggregated_daily', 'store_id', 'store', 'store_id'),
+    $this->getFkName('sales_bestsellers_aggregated_daily', 'store_id', 'store', 'store_id'),
     'store_id',
-    $installer->getTable('store'),
+    $this->getTable('store'),
     'store_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->addForeignKey(
-    $installer->getFkName('sales_bestsellers_aggregated_daily', 'product_id', 'catalog_product_entity', 'entity_id'),
+    $this->getFkName('sales_bestsellers_aggregated_daily', 'product_id', 'catalog_product_entity', 'entity_id'),
     'product_id',
-    $installer->getTable('catalog_product_entity'),
+    $this->getTable('catalog_product_entity'),
     'entity_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->setComment(
     'Sales Bestsellers Aggregated Daily'
 );
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
 
 
 /**
  * Create table 'sales_bestsellers_aggregated_monthly'
  */
-$table = $installer->getConnection()->newTable(
-    $installer->getTable('sales_bestsellers_aggregated_monthly')
+$table = $this->getConnection()->newTable(
+    $this->getTable('sales_bestsellers_aggregated_monthly')
 )->addColumn(
     'id',
     \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -6349,7 +6407,7 @@ $table = $installer->getConnection()->newTable(
     array('unsigned' => true, 'nullable' => false, 'default' => '0'),
     'Rating Pos'
 )->addIndex(
-    $installer->getIdxName(
+    $this->getIdxName(
         'sales_bestsellers_aggregated_monthly',
         array('period', 'store_id', 'product_id'),
         \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
@@ -6357,35 +6415,35 @@ $table = $installer->getConnection()->newTable(
     array('period', 'store_id', 'product_id'),
     array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
 )->addIndex(
-    $installer->getIdxName('sales_bestsellers_aggregated_monthly', array('store_id')),
+    $this->getIdxName('sales_bestsellers_aggregated_monthly', array('store_id')),
     array('store_id')
 )->addIndex(
-    $installer->getIdxName('sales_bestsellers_aggregated_monthly', array('product_id')),
+    $this->getIdxName('sales_bestsellers_aggregated_monthly', array('product_id')),
     array('product_id')
 )->addForeignKey(
-    $installer->getFkName('sales_bestsellers_aggregated_monthly', 'store_id', 'store', 'store_id'),
+    $this->getFkName('sales_bestsellers_aggregated_monthly', 'store_id', 'store', 'store_id'),
     'store_id',
-    $installer->getTable('store'),
+    $this->getTable('store'),
     'store_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->addForeignKey(
-    $installer->getFkName('sales_bestsellers_aggregated_monthly', 'product_id', 'catalog_product_entity', 'entity_id'),
+    $this->getFkName('sales_bestsellers_aggregated_monthly', 'product_id', 'catalog_product_entity', 'entity_id'),
     'product_id',
-    $installer->getTable('catalog_product_entity'),
+    $this->getTable('catalog_product_entity'),
     'entity_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->setComment(
     'Sales Bestsellers Aggregated Monthly'
 );
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
 
 /**
  * Create table 'sales_bestsellers_aggregated_yearly'
  */
-$table = $installer->getConnection()->newTable(
-    $installer->getTable('sales_bestsellers_aggregated_yearly')
+$table = $this->getConnection()->newTable(
+    $this->getTable('sales_bestsellers_aggregated_yearly')
 )->addColumn(
     'id',
     \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -6435,7 +6493,7 @@ $table = $installer->getConnection()->newTable(
     array('unsigned' => true, 'nullable' => false, 'default' => '0'),
     'Rating Pos'
 )->addIndex(
-    $installer->getIdxName(
+    $this->getIdxName(
         'sales_bestsellers_aggregated_yearly',
         array('period', 'store_id', 'product_id'),
         \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
@@ -6443,35 +6501,35 @@ $table = $installer->getConnection()->newTable(
     array('period', 'store_id', 'product_id'),
     array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
 )->addIndex(
-    $installer->getIdxName('sales_bestsellers_aggregated_yearly', array('store_id')),
+    $this->getIdxName('sales_bestsellers_aggregated_yearly', array('store_id')),
     array('store_id')
 )->addIndex(
-    $installer->getIdxName('sales_bestsellers_aggregated_yearly', array('product_id')),
+    $this->getIdxName('sales_bestsellers_aggregated_yearly', array('product_id')),
     array('product_id')
 )->addForeignKey(
-    $installer->getFkName('sales_bestsellers_aggregated_yearly', 'store_id', 'store', 'store_id'),
+    $this->getFkName('sales_bestsellers_aggregated_yearly', 'store_id', 'store', 'store_id'),
     'store_id',
-    $installer->getTable('store'),
+    $this->getTable('store'),
     'store_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->addForeignKey(
-    $installer->getFkName('sales_bestsellers_aggregated_yearly', 'product_id', 'catalog_product_entity', 'entity_id'),
+    $this->getFkName('sales_bestsellers_aggregated_yearly', 'product_id', 'catalog_product_entity', 'entity_id'),
     'product_id',
-    $installer->getTable('catalog_product_entity'),
+    $this->getTable('catalog_product_entity'),
     'entity_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->setComment(
     'Sales Bestsellers Aggregated Yearly'
 );
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
 
 /**
  * Create table 'sales_order_tax'
  */
-$table = $installer->getConnection()->newTable(
-    $installer->getTable('sales_order_tax')
+$table = $this->getConnection()->newTable(
+    $this->getTable('sales_order_tax')
 )->addColumn(
     'tax_id',
     \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -6545,19 +6603,19 @@ $table = $installer->getConnection()->newTable(
     array('unsigned' => true, 'nullable' => false, 'default' => '0'),
     'Hidden'
 )->addIndex(
-    $installer->getIdxName('sales_order_tax', array('order_id', 'priority', 'position')),
+    $this->getIdxName('sales_order_tax', array('order_id', 'priority', 'position')),
     array('order_id', 'priority', 'position')
 )->setComment(
     'Sales Order Tax Table'
 );
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
 
 
 /**
  * Create table 'sales_order_status'
  */
-$table = $installer->getConnection()->newTable(
-    $installer->getTable('sales_order_status')
+$table = $this->getConnection()->newTable(
+    $this->getTable('sales_order_status')
 )->addColumn(
     'status',
     \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
@@ -6573,14 +6631,14 @@ $table = $installer->getConnection()->newTable(
 )->setComment(
     'Sales Order Status Table'
 );
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
 
 
 /**
  * Create table 'sales_order_status_state'
  */
-$table = $installer->getConnection()->newTable(
-    $installer->getTable('sales_order_status_state')
+$table = $this->getConnection()->newTable(
+    $this->getTable('sales_order_status_state')
 )->addColumn(
     'status',
     \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
@@ -6599,24 +6657,29 @@ $table = $installer->getConnection()->newTable(
     null,
     array('unsigned' => true, 'nullable' => false, 'default' => '0'),
     'Is Default'
+)->addColumn(
+    'visible_on_front',
+    \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
+    1,
+    array('unsigned' => true, 'nullable' => false, 'default' => '0'),
+    'Visible on front'
 )->addForeignKey(
-    $installer->getFkName('sales_order_status_state', 'status', 'sales_order_status', 'status'),
+    $this->getFkName('sales_order_status_state', 'status', 'sales_order_status', 'status'),
     'status',
-    $installer->getTable('sales_order_status'),
+    $this->getTable('sales_order_status'),
     'status',
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->setComment(
     'Sales Order Status Table'
 );
-$installer->getConnection()->createTable($table);
-
+$this->getConnection()->createTable($table);
 
 /**
  * Create table 'sales_order_status_label'
  */
-$table = $installer->getConnection()->newTable(
-    $installer->getTable('sales_order_status_label')
+$table = $this->getConnection()->newTable(
+    $this->getTable('sales_order_status_label')
 )->addColumn(
     'status',
     \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
@@ -6636,25 +6699,25 @@ $table = $installer->getConnection()->newTable(
     array('nullable' => false),
     'Label'
 )->addIndex(
-    $installer->getIdxName('sales_order_status_label', array('store_id')),
+    $this->getIdxName('sales_order_status_label', array('store_id')),
     array('store_id')
 )->addForeignKey(
-    $installer->getFkName('sales_order_status_label', 'status', 'sales_order_status', 'status'),
+    $this->getFkName('sales_order_status_label', 'status', 'sales_order_status', 'status'),
     'status',
-    $installer->getTable('sales_order_status'),
+    $this->getTable('sales_order_status'),
     'status',
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->addForeignKey(
-    $installer->getFkName('sales_order_status_label', 'store_id', 'store', 'store_id'),
+    $this->getFkName('sales_order_status_label', 'store_id', 'store', 'store_id'),
     'store_id',
-    $installer->getTable('store'),
+    $this->getTable('store'),
     'store_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->setComment(
     'Sales Order Status Label Table'
 );
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
 
-$installer->endSetup();
+$this->endSetup();
diff --git a/app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.0-1.6.0.1.php b/app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.0-1.6.0.1.php
deleted file mode 100644
index af18b0bdaa8eefd25e87c51220dca1b64ecc0247..0000000000000000000000000000000000000000
--- a/app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.0-1.6.0.1.php
+++ /dev/null
@@ -1,37 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-/* @var $installer \Magento\Setup\Module\SetupModule */
-$installer = $this;
-
-$installer->getConnection()->addColumn(
-    $installer->getTable('sales_flat_order_status_history'),
-    'entity_name',
-    array(
-        'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
-        'length' => 32,
-        'nullable' => true,
-        'comment' => 'Shows what entity history is bind to.'
-    )
-);
diff --git a/app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.1-1.6.0.2.php b/app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.1-1.6.0.2.php
deleted file mode 100644
index 252edee3a82c26e73b7250d8b97277faaaec7a41..0000000000000000000000000000000000000000
--- a/app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.1-1.6.0.2.php
+++ /dev/null
@@ -1,33 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-/* @var $installer \Magento\Setup\Module\SetupModule */
-$installer = $this;
-$installer->startSetup();
-$installer->getConnection()->addColumn(
-    $installer->getTable('sales_flat_shipment'),
-    'packages',
-    array('type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'comment' => 'Packed Products in Packages', 'length' => '20000')
-);
-$installer->endSetup();
diff --git a/app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.11-1.6.0.12.php b/app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.11-1.6.0.12.php
deleted file mode 100644
index 978444e5eee2722b4229192ad863d6114942867e..0000000000000000000000000000000000000000
--- a/app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.11-1.6.0.12.php
+++ /dev/null
@@ -1,41 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-/* @var $installer \Magento\Setup\Module\SetupModule */
-$installer = $this;
-$installer->startSetup();
-
-$installer->getConnection()->addColumn(
-    $installer->getTable('sales_order_status_state'),
-    'visible_on_front',
-    array(
-        'type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
-        'length' => 1,
-        'nullable' => false,
-        'default' => 0,
-        'comment' => 'visible_on_front'
-    )
-);
-
-$installer->endSetup();
diff --git a/app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.3-1.6.0.4.php b/app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.3-1.6.0.4.php
deleted file mode 100644
index 8d5542163ff7ade2e3f54c6c34d7753c90bec330..0000000000000000000000000000000000000000
--- a/app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.3-1.6.0.4.php
+++ /dev/null
@@ -1,37 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-/**
- * Create aggregation tables for updated_at fields
- */
-
-/** @var $installer \Magento\Setup\Module\SetupModule */
-$installer = $this;
-$connection = $installer->getConnection();
-$connection->createTable(
-    $connection->createTableByDdl(
-        $installer->getTable('sales_order_aggregated_created'),
-        $installer->getTable('sales_order_aggregated_updated')
-    )
-);
diff --git a/app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.4-1.6.0.5.php b/app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.4-1.6.0.5.php
deleted file mode 100644
index a40b49fec9fc0ec62fab5b956401dbb5f778ab90..0000000000000000000000000000000000000000
--- a/app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.4-1.6.0.5.php
+++ /dev/null
@@ -1,56 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-/* @var $installer \Magento\Setup\Module\SetupModule */
-$installer = $this;
-$installer->getConnection()->addColumn(
-    $installer->getTable('sales_flat_order_item'),
-    'base_tax_refunded',
-    array(
-        'type' => \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL,
-        'comment' => 'Base Tax Refunded',
-        'scale' => 4,
-        'precision' => 12
-    )
-);
-$installer->getConnection()->addColumn(
-    $installer->getTable('sales_flat_order_item'),
-    'discount_refunded',
-    array(
-        'type' => \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL,
-        'comment' => 'Discount Refunded',
-        'scale' => 4,
-        'precision' => 12
-    )
-);
-$installer->getConnection()->addColumn(
-    $installer->getTable('sales_flat_order_item'),
-    'base_discount_refunded',
-    array(
-        'type' => \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL,
-        'comment' => 'Base Discount Refunded',
-        'scale' => 4,
-        'precision' => 12
-    )
-);
diff --git a/app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.6-1.6.0.7.php b/app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.6-1.6.0.7.php
deleted file mode 100644
index 14d993e9bc309fc33cbb6e1066395b05dd256ecb..0000000000000000000000000000000000000000
--- a/app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.6-1.6.0.7.php
+++ /dev/null
@@ -1,37 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-/* @var $installer \Magento\Setup\Module\SetupModule */
-$installer = $this;
-
-$installer->getConnection()->addColumn(
-    $installer->getTable('sales_flat_order'),
-    'coupon_rule_name',
-    array(
-        'TYPE' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
-        'LENGTH' => 255,
-        'NULLABLE' => true,
-        'COMMENT' => 'Coupon Sales Rule Name'
-    )
-);
diff --git a/app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.7-1.6.0.8.php b/app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.7-1.6.0.8.php
deleted file mode 100644
index fdcdff51c72ebe856a34d169f7e2cf4bcfed5312..0000000000000000000000000000000000000000
--- a/app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.7-1.6.0.8.php
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-/* @var $installer \Magento\Setup\Module\SetupModule */
-$installer = $this;
-
-$invoiceTable = $installer->getTable('sales_flat_invoice');
-$installer->getConnection()->addColumn(
-    $invoiceTable,
-    'discount_description',
-    array('type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'length' => 255, 'comment' => 'Discount Description')
-);
-
-$creditmemoTable = $installer->getTable('sales_flat_creditmemo');
-$installer->getConnection()->addColumn(
-    $creditmemoTable,
-    'discount_description',
-    array('type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'length' => 255, 'comment' => 'Discount Description')
-);
diff --git a/app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.8-1.6.0.9.php b/app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.8-1.6.0.9.php
deleted file mode 100644
index b4dbc035aee32f59add3b2485ffd53334db364d2..0000000000000000000000000000000000000000
--- a/app/code/Magento/Sales/sql/sales_setup/upgrade-1.6.0.8-1.6.0.9.php
+++ /dev/null
@@ -1,51 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-/* @var $installer \Magento\Setup\Module\SetupModule */
-$installer = $this;
-$installer->startSetup();
-
-$installer->getConnection()->modifyColumn(
-    $installer->getTable('sales_flat_quote_payment'),
-    'cc_exp_year',
-    array(
-        'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
-        'length' => 255,
-        'nullable' => true,
-        'default' => null,
-        'comment' => 'Cc Exp Year'
-    )
-)->modifyColumn(
-    $installer->getTable('sales_flat_quote_payment'),
-    'cc_exp_month',
-    array(
-        'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
-        'length' => 255,
-        'nullable' => true,
-        'default' => null,
-        'comment' => 'Cc Exp Month'
-    )
-);
-
-$installer->endSetup();
diff --git a/app/code/Magento/SalesRule/Model/Resource/Report/Rule/Createdat.php b/app/code/Magento/SalesRule/Model/Resource/Report/Rule/Createdat.php
index 56f6fd5b3b696f8b621a746212fe654ac0cac197..7390a72f02455e0cda784bee4b9e13bad91246b4 100644
--- a/app/code/Magento/SalesRule/Model/Resource/Report/Rule/Createdat.php
+++ b/app/code/Magento/SalesRule/Model/Resource/Report/Rule/Createdat.php
@@ -69,7 +69,7 @@ class Createdat extends \Magento\Reports\Model\Resource\Report\AbstractReport
         $this->_checkDates($from, $to);
 
         $table = $this->getMainTable();
-        $sourceTable = $this->getTable('sales_flat_order');
+        $sourceTable = $this->getTable('sales_order');
         $adapter = $this->_getWriteAdapter();
         $adapter->beginTransaction();
 
diff --git a/app/code/Magento/SalesRule/composer.json b/app/code/Magento/SalesRule/composer.json
index 56b42d7c447e24d4d57984a7144d1d0479ff89a8..cf6eda03156a8a7ca7c53866ca0fdef7b83f3f6d 100644
--- a/app/code/Magento/SalesRule/composer.json
+++ b/app/code/Magento/SalesRule/composer.json
@@ -3,26 +3,26 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-rule": "0.1.0-alpha103",
-        "magento/module-catalog": "0.1.0-alpha103",
-        "magento/module-sales": "0.1.0-alpha103",
-        "magento/module-eav": "0.1.0-alpha103",
-        "magento/module-core": "0.1.0-alpha103",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/module-customer": "0.1.0-alpha103",
-        "magento/module-directory": "0.1.0-alpha103",
-        "magento/module-shipping": "0.1.0-alpha103",
-        "magento/module-payment": "0.1.0-alpha103",
-        "magento/module-reports": "0.1.0-alpha103",
-        "magento/module-catalog-rule": "0.1.0-alpha103",
-        "magento/module-widget": "0.1.0-alpha103",
-        "magento/module-cron": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-rule": "0.1.0-alpha104",
+        "magento/module-catalog": "0.1.0-alpha104",
+        "magento/module-sales": "0.1.0-alpha104",
+        "magento/module-eav": "0.1.0-alpha104",
+        "magento/module-core": "0.1.0-alpha104",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/module-customer": "0.1.0-alpha104",
+        "magento/module-directory": "0.1.0-alpha104",
+        "magento/module-shipping": "0.1.0-alpha104",
+        "magento/module-payment": "0.1.0-alpha104",
+        "magento/module-reports": "0.1.0-alpha104",
+        "magento/module-catalog-rule": "0.1.0-alpha104",
+        "magento/module-widget": "0.1.0-alpha104",
+        "magento/module-cron": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/SalesRule/data/salesrule_setup/data-upgrade-1.6.0.3-1.6.0.4.php b/app/code/Magento/SalesRule/data/salesrule_setup/data-install-2.0.0.php
similarity index 100%
rename from app/code/Magento/SalesRule/data/salesrule_setup/data-upgrade-1.6.0.3-1.6.0.4.php
rename to app/code/Magento/SalesRule/data/salesrule_setup/data-install-2.0.0.php
diff --git a/app/code/Magento/SalesRule/etc/module.xml b/app/code/Magento/SalesRule/etc/module.xml
index 64ccddb8b010d0e0c657c811680edbec08da1e2c..df34f83da4836d4d8899aae2222d27ad6fdbd27b 100644
--- a/app/code/Magento/SalesRule/etc/module.xml
+++ b/app/code/Magento/SalesRule/etc/module.xml
@@ -24,7 +24,7 @@
  */
 -->
 <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
-    <module name="Magento_SalesRule" schema_version="1.6.0.4" active="true">
+    <module name="Magento_SalesRule" schema_version="2.0.0" active="true">
         <sequence>
             <module name="Magento_Rule"/>
             <module name="Magento_Catalog"/>
diff --git a/app/code/Magento/SalesRule/sql/salesrule_setup/install-1.6.0.0.php b/app/code/Magento/SalesRule/sql/salesrule_setup/install-2.0.0.php
similarity index 66%
rename from app/code/Magento/SalesRule/sql/salesrule_setup/install-1.6.0.0.php
rename to app/code/Magento/SalesRule/sql/salesrule_setup/install-2.0.0.php
index 5bdfccba3faef4cf3e59d456cb919c7ef459fbfe..5b837856023752c2bb71cdcab1ee2df341ef822a 100644
--- a/app/code/Magento/SalesRule/sql/salesrule_setup/install-1.6.0.0.php
+++ b/app/code/Magento/SalesRule/sql/salesrule_setup/install-2.0.0.php
@@ -22,15 +22,14 @@
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
 
-/* @var $installer \Magento\Setup\Module\SetupModule */
-$installer = $this;
-$installer->startSetup();
+/* @var $this \Magento\Framework\Module\Setup */
+$this->startSetup();
 
 /**
  * Create table 'salesrule'
  */
-$table = $installer->getConnection()->newTable(
-    $installer->getTable('salesrule')
+$table = $this->getConnection()->newTable(
+    $this->getTable('salesrule')
 )->addColumn(
     'rule_id',
     \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -53,13 +52,13 @@ $table = $installer->getConnection()->newTable(
     'from_date',
     \Magento\Framework\DB\Ddl\Table::TYPE_DATE,
     null,
-    array(),
+    array('nullable' => true, 'default' => null),
     'From Date'
 )->addColumn(
     'to_date',
     \Magento\Framework\DB\Ddl\Table::TYPE_DATE,
     null,
-    array(),
+    array('nullable' => true, 'default' => null),
     'To Date'
 )->addColumn(
     'uses_per_customer',
@@ -157,19 +156,33 @@ $table = $installer->getConnection()->newTable(
     null,
     array('unsigned' => true, 'nullable' => false, 'default' => '1'),
     'Coupon Type'
+)->addColumn(
+    'use_auto_generation',
+    \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
+    null,
+    array('unsigned' => false, 'nullable' => false, 'default' => 0),
+    'Use Auto Generation'
+)->addColumn(
+    'uses_per_coupon',
+    \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
+    null,
+    array('nullable' => false, 'default' => 0),
+    'User Per Coupon'
 )->addIndex(
-    $installer->getIdxName('salesrule', array('is_active', 'sort_order', 'to_date', 'from_date')),
+    $this->getIdxName('salesrule', array('is_active', 'sort_order', 'to_date', 'from_date')),
     array('is_active', 'sort_order', 'to_date', 'from_date')
 )->setComment(
     'Salesrule'
 );
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
+
+
 
 /**
  * Create table 'salesrule_coupon'
  */
-$table = $installer->getConnection()->newTable(
-    $installer->getTable('salesrule_coupon')
+$table = $this->getConnection()->newTable(
+    $this->getTable('salesrule_coupon')
 )->addColumn(
     'coupon_id',
     \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -218,8 +231,20 @@ $table = $installer->getConnection()->newTable(
     null,
     array('unsigned' => true),
     'Is Primary'
+)->addColumn(
+    'created_at',
+    \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP,
+    null,
+    array('nullable' => true),
+    'Coupon Code Creation Date'
+)->addColumn(
+    'type',
+    \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
+    null,
+    array('nullable' => true, 'default' => 0),
+    'Coupon Code Type'
 )->addIndex(
-    $installer->getIdxName(
+    $this->getIdxName(
         'salesrule_coupon',
         array('code'),
         \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
@@ -227,7 +252,7 @@ $table = $installer->getConnection()->newTable(
     array('code'),
     array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
 )->addIndex(
-    $installer->getIdxName(
+    $this->getIdxName(
         'salesrule_coupon',
         array('rule_id', 'is_primary'),
         \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
@@ -235,25 +260,25 @@ $table = $installer->getConnection()->newTable(
     array('rule_id', 'is_primary'),
     array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
 )->addIndex(
-    $installer->getIdxName('salesrule_coupon', array('rule_id')),
+    $this->getIdxName('salesrule_coupon', array('rule_id')),
     array('rule_id')
 )->addForeignKey(
-    $installer->getFkName('salesrule_coupon', 'rule_id', 'salesrule', 'rule_id'),
+    $this->getFkName('salesrule_coupon', 'rule_id', 'salesrule', 'rule_id'),
     'rule_id',
-    $installer->getTable('salesrule'),
+    $this->getTable('salesrule'),
     'rule_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->setComment(
     'Salesrule Coupon'
 );
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
 
 /**
  * Create table 'salesrule_coupon_usage'
  */
-$table = $installer->getConnection()->newTable(
-    $installer->getTable('salesrule_coupon_usage')
+$table = $this->getConnection()->newTable(
+    $this->getTable('salesrule_coupon_usage')
 )->addColumn(
     'coupon_id',
     \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -273,32 +298,32 @@ $table = $installer->getConnection()->newTable(
     array('unsigned' => true, 'nullable' => false, 'default' => '0'),
     'Times Used'
 )->addIndex(
-    $installer->getIdxName('salesrule_coupon_usage', array('customer_id')),
+    $this->getIdxName('salesrule_coupon_usage', array('customer_id')),
     array('customer_id')
 )->addForeignKey(
-    $installer->getFkName('salesrule_coupon_usage', 'coupon_id', 'salesrule_coupon', 'coupon_id'),
+    $this->getFkName('salesrule_coupon_usage', 'coupon_id', 'salesrule_coupon', 'coupon_id'),
     'coupon_id',
-    $installer->getTable('salesrule_coupon'),
+    $this->getTable('salesrule_coupon'),
     'coupon_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->addForeignKey(
-    $installer->getFkName('salesrule_coupon_usage', 'customer_id', 'customer_entity', 'entity_id'),
+    $this->getFkName('salesrule_coupon_usage', 'customer_id', 'customer_entity', 'entity_id'),
     'customer_id',
-    $installer->getTable('customer_entity'),
+    $this->getTable('customer_entity'),
     'entity_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->setComment(
     'Salesrule Coupon Usage'
 );
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
 
 /**
  * Create table 'salesrule_customer'
  */
-$table = $installer->getConnection()->newTable(
-    $installer->getTable('salesrule_customer')
+$table = $this->getConnection()->newTable(
+    $this->getTable('salesrule_customer')
 )->addColumn(
     'rule_customer_id',
     \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -324,35 +349,35 @@ $table = $installer->getConnection()->newTable(
     array('unsigned' => true, 'nullable' => false, 'default' => '0'),
     'Times Used'
 )->addIndex(
-    $installer->getIdxName('salesrule_customer', array('rule_id', 'customer_id')),
+    $this->getIdxName('salesrule_customer', array('rule_id', 'customer_id')),
     array('rule_id', 'customer_id')
 )->addIndex(
-    $installer->getIdxName('salesrule_customer', array('customer_id', 'rule_id')),
+    $this->getIdxName('salesrule_customer', array('customer_id', 'rule_id')),
     array('customer_id', 'rule_id')
 )->addForeignKey(
-    $installer->getFkName('salesrule_customer', 'customer_id', 'customer_entity', 'entity_id'),
+    $this->getFkName('salesrule_customer', 'customer_id', 'customer_entity', 'entity_id'),
     'customer_id',
-    $installer->getTable('customer_entity'),
+    $this->getTable('customer_entity'),
     'entity_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->addForeignKey(
-    $installer->getFkName('salesrule_customer', 'rule_id', 'salesrule', 'rule_id'),
+    $this->getFkName('salesrule_customer', 'rule_id', 'salesrule', 'rule_id'),
     'rule_id',
-    $installer->getTable('salesrule'),
+    $this->getTable('salesrule'),
     'rule_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->setComment(
     'Salesrule Customer'
 );
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
 
 /**
  * Create table 'salesrule_label'
  */
-$table = $installer->getConnection()->newTable(
-    $installer->getTable('salesrule_label')
+$table = $this->getConnection()->newTable(
+    $this->getTable('salesrule_label')
 )->addColumn(
     'label_id',
     \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -378,7 +403,7 @@ $table = $installer->getConnection()->newTable(
     array(),
     'Label'
 )->addIndex(
-    $installer->getIdxName(
+    $this->getIdxName(
         'salesrule_label',
         array('rule_id', 'store_id'),
         \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
@@ -386,32 +411,32 @@ $table = $installer->getConnection()->newTable(
     array('rule_id', 'store_id'),
     array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
 )->addIndex(
-    $installer->getIdxName('salesrule_label', array('store_id')),
+    $this->getIdxName('salesrule_label', array('store_id')),
     array('store_id')
 )->addForeignKey(
-    $installer->getFkName('salesrule_label', 'rule_id', 'salesrule', 'rule_id'),
+    $this->getFkName('salesrule_label', 'rule_id', 'salesrule', 'rule_id'),
     'rule_id',
-    $installer->getTable('salesrule'),
+    $this->getTable('salesrule'),
     'rule_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->addForeignKey(
-    $installer->getFkName('salesrule_label', 'store_id', 'store', 'store_id'),
+    $this->getFkName('salesrule_label', 'store_id', 'store', 'store_id'),
     'store_id',
-    $installer->getTable('store'),
+    $this->getTable('store'),
     'store_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->setComment(
     'Salesrule Label'
 );
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
 
 /**
  * Create table 'salesrule_product_attribute'
  */
-$table = $installer->getConnection()->newTable(
-    $installer->getTable('salesrule_product_attribute')
+$table = $this->getConnection()->newTable(
+    $this->getTable('salesrule_product_attribute')
 )->addColumn(
     'rule_id',
     \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -437,52 +462,52 @@ $table = $installer->getConnection()->newTable(
     array('unsigned' => true, 'nullable' => false, 'primary' => true),
     'Attribute Id'
 )->addIndex(
-    $installer->getIdxName('salesrule_product_attribute', array('website_id')),
+    $this->getIdxName('salesrule_product_attribute', array('website_id')),
     array('website_id')
 )->addIndex(
-    $installer->getIdxName('salesrule_product_attribute', array('customer_group_id')),
+    $this->getIdxName('salesrule_product_attribute', array('customer_group_id')),
     array('customer_group_id')
 )->addIndex(
-    $installer->getIdxName('salesrule_product_attribute', array('attribute_id')),
+    $this->getIdxName('salesrule_product_attribute', array('attribute_id')),
     array('attribute_id')
 )->addForeignKey(
-    $installer->getFkName('salesrule_product_attribute', 'attribute_id', 'eav_attribute', 'attribute_id'),
+    $this->getFkName('salesrule_product_attribute', 'attribute_id', 'eav_attribute', 'attribute_id'),
     'attribute_id',
-    $installer->getTable('eav_attribute'),
+    $this->getTable('eav_attribute'),
     'attribute_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION
 )->addForeignKey(
-    $installer->getFkName('salesrule_product_attribute', 'customer_group_id', 'customer_group', 'customer_group_id'),
+    $this->getFkName('salesrule_product_attribute', 'customer_group_id', 'customer_group', 'customer_group_id'),
     'customer_group_id',
-    $installer->getTable('customer_group'),
+    $this->getTable('customer_group'),
     'customer_group_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION
 )->addForeignKey(
-    $installer->getFkName('salesrule_product_attribute', 'rule_id', 'salesrule', 'rule_id'),
+    $this->getFkName('salesrule_product_attribute', 'rule_id', 'salesrule', 'rule_id'),
     'rule_id',
-    $installer->getTable('salesrule'),
+    $this->getTable('salesrule'),
     'rule_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION
 )->addForeignKey(
-    $installer->getFkName('salesrule_product_attribute', 'website_id', 'store_website', 'website_id'),
+    $this->getFkName('salesrule_product_attribute', 'website_id', 'store_website', 'website_id'),
     'website_id',
-    $installer->getTable('store_website'),
+    $this->getTable('store_website'),
     'website_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_NO_ACTION
 )->setComment(
     'Salesrule Product Attribute'
 );
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
 
 /**
  * Create table 'coupon_aggregated'
  */
-$table = $installer->getConnection()->newTable(
-    $installer->getTable('coupon_aggregated')
+$table = $this->getConnection()->newTable(
+    $this->getTable('coupon_aggregated')
 )->addColumn(
     'id',
     \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -555,8 +580,14 @@ $table = $installer->getConnection()->newTable(
     array(12, 4),
     array('nullable' => false, 'default' => '0.0000'),
     'Total Amount Actual'
+)->addColumn(
+    'rule_name',
+    \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
+    255,
+    array(),
+    'Rule Name'
 )->addIndex(
-    $installer->getIdxName(
+    $this->getIdxName(
         'coupon_aggregated',
         array('period', 'store_id', 'order_status', 'coupon_code'),
         \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
@@ -564,25 +595,35 @@ $table = $installer->getConnection()->newTable(
     array('period', 'store_id', 'order_status', 'coupon_code'),
     array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
 )->addIndex(
-    $installer->getIdxName('coupon_aggregated', array('store_id')),
+    $this->getIdxName('coupon_aggregated', array('store_id')),
     array('store_id')
+)->addIndex(
+    $this->getIdxName('coupon_aggregated', array('rule_name')),
+    array('rule_name')
 )->addForeignKey(
-    $installer->getFkName('coupon_aggregated', 'store_id', 'store', 'store_id'),
+    $this->getFkName('coupon_aggregated', 'store_id', 'store', 'store_id'),
     'store_id',
-    $installer->getTable('store'),
+    $this->getTable('store'),
     'store_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->setComment(
     'Coupon Aggregated'
 );
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
+
+$this->getConnection()->createTable(
+    $this->getConnection()->createTableByDdl(
+        $this->getTable('coupon_aggregated'),
+        $this->getTable('coupon_aggregated_updated')
+    )
+);
 
 /**
  * Create table 'coupon_aggregated_order'
  */
-$table = $installer->getConnection()->newTable(
-    $installer->getTable('coupon_aggregated_order')
+$table = $this->getConnection()->newTable(
+    $this->getTable('coupon_aggregated_order')
 )->addColumn(
     'id',
     \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
@@ -637,8 +678,14 @@ $table = $installer->getConnection()->newTable(
     array(12, 4),
     array('nullable' => false, 'default' => '0.0000'),
     'Total Amount'
+)->addColumn(
+    'rule_name',
+    \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
+    255,
+    array(),
+    'Rule Name'
 )->addIndex(
-    $installer->getIdxName(
+    $this->getIdxName(
         'coupon_aggregated_order',
         array('period', 'store_id', 'order_status', 'coupon_code'),
         \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE
@@ -646,18 +693,109 @@ $table = $installer->getConnection()->newTable(
     array('period', 'store_id', 'order_status', 'coupon_code'),
     array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)
 )->addIndex(
-    $installer->getIdxName('coupon_aggregated_order', array('store_id')),
+    $this->getIdxName('coupon_aggregated_order', array('store_id')),
     array('store_id')
+)->addIndex(
+    $this->getIdxName('coupon_aggregated_order', array('rule_name')),
+    array('rule_name')
 )->addForeignKey(
-    $installer->getFkName('coupon_aggregated_order', 'store_id', 'store', 'store_id'),
+    $this->getFkName('coupon_aggregated_order', 'store_id', 'store', 'store_id'),
     'store_id',
-    $installer->getTable('store'),
+    $this->getTable('store'),
     'store_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->setComment(
     'Coupon Aggregated Order'
 );
-$installer->getConnection()->createTable($table);
+$this->getConnection()->createTable($table);
+
+$websitesTable = $this->getTable('store_website');
+$customerGroupsTable = $this->getTable('customer_group');
+$rulesWebsitesTable = $this->getTable('salesrule_website');
+$rulesCustomerGroupsTable = $this->getTable('salesrule_customer_group');
+
+/**
+ * Create table 'salesrule_website' if not exists. This table will be used instead of
+ * column website_ids of main catalog rules table
+ */
+$table = $this->getConnection()->newTable(
+    $rulesWebsitesTable
+)->addColumn(
+    'rule_id',
+    \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
+    null,
+    array('unsigned' => true, 'nullable' => false, 'primary' => true),
+    'Rule Id'
+)->addColumn(
+    'website_id',
+    \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
+    null,
+    array('unsigned' => true, 'nullable' => false, 'primary' => true),
+    'Website Id'
+)->addIndex(
+    $this->getIdxName('salesrule_website', array('website_id')),
+    array('website_id')
+)->addForeignKey(
+    $this->getFkName('salesrule_website', 'rule_id', 'salesrule', 'rule_id'),
+    'rule_id',
+    $this->getTable('salesrule'),
+    'rule_id',
+    \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
+    \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
+)->addForeignKey(
+    $this->getFkName('salesrule_website', 'website_id', 'core/website', 'website_id'),
+    'website_id',
+    $websitesTable,
+    'website_id',
+    \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
+    \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
+)->setComment(
+    'Sales Rules To Websites Relations'
+);
+
+$this->getConnection()->createTable($table);
+
+
+/**
+ * Create table 'salesrule_customer_group' if not exists. This table will be used instead of
+ * column customer_group_ids of main catalog rules table
+ */
+$table = $this->getConnection()->newTable(
+    $rulesCustomerGroupsTable
+)->addColumn(
+    'rule_id',
+    \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
+    null,
+    array('unsigned' => true, 'nullable' => false, 'primary' => true),
+    'Rule Id'
+)->addColumn(
+    'customer_group_id',
+    \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
+    null,
+    array('unsigned' => true, 'nullable' => false, 'primary' => true),
+    'Customer Group Id'
+)->addIndex(
+    $this->getIdxName('salesrule_customer_group', array('customer_group_id')),
+    array('customer_group_id')
+)->addForeignKey(
+    $this->getFkName('salesrule_customer_group', 'rule_id', 'salesrule', 'rule_id'),
+    'rule_id',
+    $this->getTable('salesrule'),
+    'rule_id',
+    \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
+    \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
+)->addForeignKey(
+    $this->getFkName('salesrule_customer_group', 'customer_group_id', 'customer_group', 'customer_group_id'),
+    'customer_group_id',
+    $customerGroupsTable,
+    'customer_group_id',
+    \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
+    \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
+)->setComment(
+    'Sales Rules To Customer Groups Relations'
+);
+
+$this->getConnection()->createTable($table);
 
-$installer->endSetup();
+$this->endSetup();
diff --git a/app/code/Magento/SalesRule/sql/salesrule_setup/upgrade-1.6.0.1-1.6.0.2.php b/app/code/Magento/SalesRule/sql/salesrule_setup/upgrade-1.6.0.1-1.6.0.2.php
deleted file mode 100644
index 656e8b88ef73420285acfebdf40ca161ae5f8d94..0000000000000000000000000000000000000000
--- a/app/code/Magento/SalesRule/sql/salesrule_setup/upgrade-1.6.0.1-1.6.0.2.php
+++ /dev/null
@@ -1,118 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-/**
- * @var $installer \Magento\Setup\Module\SetupModule
- */
-$installer = $this;
-
-$installer->getConnection()->addColumn(
-    $installer->getTable('salesrule_coupon'),
-    'created_at',
-    array(
-        'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP,
-        'comment' => 'Coupon Code Creation Date',
-        'nullable' => false,
-        'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT
-    )
-);
-
-$installer->getConnection()->addColumn(
-    $installer->getTable('salesrule_coupon'),
-    'type',
-    array('type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, 'comment' => 'Coupon Code Type', 'default' => 0)
-);
-
-$installer->getConnection()->addColumn(
-    $installer->getTable('salesrule'),
-    'use_auto_generation',
-    array(
-        'type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
-        'comment' => 'Use Auto Generation',
-        'nullable' => false,
-        'default' => 0
-    )
-);
-
-$installer->getConnection()->addColumn(
-    $installer->getTable('salesrule'),
-    'uses_per_coupon',
-    array(
-        'type' => \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
-        'comment' => 'Uses Per Coupon',
-        'nullable' => false,
-        'default' => 0
-    )
-);
-
-$installer->getConnection()->addColumn(
-    $installer->getTable('coupon_aggregated'),
-    'rule_name',
-    array('type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'length' => 255, 'comment' => 'Rule Name')
-);
-
-$installer->getConnection()->addColumn(
-    $installer->getTable('coupon_aggregated_order'),
-    'rule_name',
-    array('type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'length' => 255, 'comment' => 'Rule Name')
-);
-
-$installer->getConnection()->addColumn(
-    $installer->getTable('coupon_aggregated_updated'),
-    'rule_name',
-    array('type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, 'length' => 255, 'comment' => 'Rule Name')
-);
-
-$installer->getConnection()->addIndex(
-    $installer->getTable('coupon_aggregated'),
-    $installer->getIdxName(
-        'coupon_aggregated',
-        array('rule_name'),
-        \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_INDEX
-    ),
-    array('rule_name'),
-    \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_INDEX
-);
-
-$installer->getConnection()->addIndex(
-    $installer->getTable('coupon_aggregated_order'),
-    $installer->getIdxName(
-        'coupon_aggregated_order',
-        array('rule_name'),
-        \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_INDEX
-    ),
-    array('rule_name'),
-    \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_INDEX
-);
-
-$installer->getConnection()->addIndex(
-    $installer->getTable('coupon_aggregated_updated'),
-    $installer->getIdxName(
-        'coupon_aggregated_updated',
-        array('rule_name'),
-        \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_INDEX
-    ),
-    array('rule_name'),
-    \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_INDEX
-);
diff --git a/app/code/Magento/SalesRule/sql/salesrule_setup/upgrade-1.6.0.2-1.6.0.3.php b/app/code/Magento/SalesRule/sql/salesrule_setup/upgrade-1.6.0.2-1.6.0.3.php
deleted file mode 100644
index 443d92baa25f7d5e08d4c67eea9b206b9ab95cfe..0000000000000000000000000000000000000000
--- a/app/code/Magento/SalesRule/sql/salesrule_setup/upgrade-1.6.0.2-1.6.0.3.php
+++ /dev/null
@@ -1,135 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-/* @var $installer \Magento\Setup\Module\SetupModule */
-$installer = $this;
-$connection = $installer->getConnection();
-
-$rulesTable = $installer->getTable('salesrule');
-$websitesTable = $installer->getTable('store_website');
-$customerGroupsTable = $installer->getTable('customer_group');
-$rulesWebsitesTable = $installer->getTable('salesrule_website');
-$rulesCustomerGroupsTable = $installer->getTable('salesrule_customer_group');
-
-$installer->startSetup();
-/**
- * Create table 'salesrule_website' if not exists. This table will be used instead of
- * column website_ids of main catalog rules table
- */
-$table = $connection->newTable(
-    $rulesWebsitesTable
-)->addColumn(
-    'rule_id',
-    \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
-    null,
-    array('unsigned' => true, 'nullable' => false, 'primary' => true),
-    'Rule Id'
-)->addColumn(
-    'website_id',
-    \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
-    null,
-    array('unsigned' => true, 'nullable' => false, 'primary' => true),
-    'Website Id'
-)->addIndex(
-    $installer->getIdxName('salesrule_website', array('website_id')),
-    array('website_id')
-)->addForeignKey(
-    $installer->getFkName('salesrule_website', 'rule_id', 'salesrule', 'rule_id'),
-    'rule_id',
-    $rulesTable,
-    'rule_id',
-    \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
-    \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
-)->addForeignKey(
-    $installer->getFkName('salesrule_website', 'website_id', 'core/website', 'website_id'),
-    'website_id',
-    $websitesTable,
-    'website_id',
-    \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
-    \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
-)->setComment(
-    'Sales Rules To Websites Relations'
-);
-
-$connection->createTable($table);
-
-
-/**
- * Create table 'salesrule_customer_group' if not exists. This table will be used instead of
- * column customer_group_ids of main catalog rules table
- */
-$table = $connection->newTable(
-    $rulesCustomerGroupsTable
-)->addColumn(
-    'rule_id',
-    \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
-    null,
-    array('unsigned' => true, 'nullable' => false, 'primary' => true),
-    'Rule Id'
-)->addColumn(
-    'customer_group_id',
-    \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
-    null,
-    array('unsigned' => true, 'nullable' => false, 'primary' => true),
-    'Customer Group Id'
-)->addIndex(
-    $installer->getIdxName('salesrule_customer_group', array('customer_group_id')),
-    array('customer_group_id')
-)->addForeignKey(
-    $installer->getFkName('salesrule_customer_group', 'rule_id', 'salesrule', 'rule_id'),
-    'rule_id',
-    $rulesTable,
-    'rule_id',
-    \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
-    \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
-)->addForeignKey(
-    $installer->getFkName('salesrule_customer_group', 'customer_group_id', 'customer_group', 'customer_group_id'),
-    'customer_group_id',
-    $customerGroupsTable,
-    'customer_group_id',
-    \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
-    \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
-)->setComment(
-    'Sales Rules To Customer Groups Relations'
-);
-
-$connection->createTable($table);
-
-
-/**
- * Change default value to "null" for "from" and "to" dates columns
- */
-$connection->modifyColumn(
-    $rulesTable,
-    'from_date',
-    array('type' => \Magento\Framework\DB\Ddl\Table::TYPE_DATE, 'nullable' => true, 'default' => null)
-);
-
-$connection->modifyColumn(
-    $rulesTable,
-    'to_date',
-    array('type' => \Magento\Framework\DB\Ddl\Table::TYPE_DATE, 'nullable' => true, 'default' => null)
-);
-
-$installer->endSetup();
diff --git a/app/code/Magento/Search/composer.json b/app/code/Magento/Search/composer.json
index 4ceeea36119a931f5901e71ce1791c3943ac6244..78765ded878fb240cfc8ce07ac69a9c5e20d58c2 100644
--- a/app/code/Magento/Search/composer.json
+++ b/app/code/Magento/Search/composer.json
@@ -3,13 +3,13 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/framework": "0.1.0-alpha103",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/module-store": "0.1.0-alpha103",
+        "magento/framework": "0.1.0-alpha104",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/module-store": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/Sendfriend/composer.json b/app/code/Magento/Sendfriend/composer.json
index d1b5e5e445dcc350d5d1037d8d9c028996e4fd07..1cf385c9c84877de5fd4af6902830ee9db81a28c 100644
--- a/app/code/Magento/Sendfriend/composer.json
+++ b/app/code/Magento/Sendfriend/composer.json
@@ -3,16 +3,16 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-catalog": "0.1.0-alpha103",
-        "magento/module-core": "0.1.0-alpha103",
-        "magento/module-customer": "0.1.0-alpha103",
-        "magento/module-theme": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-catalog": "0.1.0-alpha104",
+        "magento/module-core": "0.1.0-alpha104",
+        "magento/module-customer": "0.1.0-alpha104",
+        "magento/module-theme": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/Shipping/composer.json b/app/code/Magento/Shipping/composer.json
index 7b306b9cec0d821f9487e8e18ea7251a0096b3a2..d785061f50313efd584d728f7ee4523239cc027c 100644
--- a/app/code/Magento/Shipping/composer.json
+++ b/app/code/Magento/Shipping/composer.json
@@ -3,23 +3,23 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-core": "0.1.0-alpha103",
-        "magento/module-catalog": "0.1.0-alpha103",
-        "magento/module-sales": "0.1.0-alpha103",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/module-directory": "0.1.0-alpha103",
-        "magento/module-contact": "0.1.0-alpha103",
-        "magento/module-customer": "0.1.0-alpha103",
-        "magento/module-payment": "0.1.0-alpha103",
-        "magento/module-tax": "0.1.0-alpha103",
-        "magento/module-catalog-inventory": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-core": "0.1.0-alpha104",
+        "magento/module-catalog": "0.1.0-alpha104",
+        "magento/module-sales": "0.1.0-alpha104",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/module-directory": "0.1.0-alpha104",
+        "magento/module-contact": "0.1.0-alpha104",
+        "magento/module-customer": "0.1.0-alpha104",
+        "magento/module-payment": "0.1.0-alpha104",
+        "magento/module-tax": "0.1.0-alpha104",
+        "magento/module-catalog-inventory": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "ext-gd": "*",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/Shipping/etc/module.xml b/app/code/Magento/Shipping/etc/module.xml
index 5dec754161d08908a9bf58c229caeaa3ec7deeab..621bcec54e4ba87f18f9398d3f634203e64f9fc1 100644
--- a/app/code/Magento/Shipping/etc/module.xml
+++ b/app/code/Magento/Shipping/etc/module.xml
@@ -24,7 +24,7 @@
  */
 -->
 <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
-    <module name="Magento_Shipping" schema_version="1.6.0.0" active="true">
+    <module name="Magento_Shipping" schema_version="2.0.0" active="true">
         <sequence>
             <module name="Magento_Core"/>
             <module name="Magento_Store"/>
diff --git a/app/code/Magento/Sitemap/composer.json b/app/code/Magento/Sitemap/composer.json
index 2f74fa2dc411dbb583b4a3612f0c609c3a8ffb00..ba2752d55e434d1a56e915773ec5f5b0cae8cf9d 100644
--- a/app/code/Magento/Sitemap/composer.json
+++ b/app/code/Magento/Sitemap/composer.json
@@ -3,18 +3,18 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-catalog": "0.1.0-alpha103",
-        "magento/module-core": "0.1.0-alpha103",
-        "magento/module-eav": "0.1.0-alpha103",
-        "magento/module-cms": "0.1.0-alpha103",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/module-catalog-url-rewrite": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-catalog": "0.1.0-alpha104",
+        "magento/module-core": "0.1.0-alpha104",
+        "magento/module-eav": "0.1.0-alpha104",
+        "magento/module-cms": "0.1.0-alpha104",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/module-catalog-url-rewrite": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/Store/composer.json b/app/code/Magento/Store/composer.json
index a83b62964452f33a904188e0f7f379b527d3981f..7cbd9a016d92e9edfc49f51a30f5c71d24878301 100644
--- a/app/code/Magento/Store/composer.json
+++ b/app/code/Magento/Store/composer.json
@@ -3,14 +3,14 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-core": "0.1.0-alpha103",
-        "magento/module-directory": "0.1.0-alpha103",
-        "magento/module-ui": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-core": "0.1.0-alpha104",
+        "magento/module-directory": "0.1.0-alpha104",
+        "magento/module-ui": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/Tax/Model/Resource/Report/Tax/Createdat.php b/app/code/Magento/Tax/Model/Resource/Report/Tax/Createdat.php
index 86dfe45b63095b27feef8704cac7d3e2593679bf..0ea40e92000c40d056424fa44d5c228ff9cf890c 100644
--- a/app/code/Magento/Tax/Model/Resource/Report/Tax/Createdat.php
+++ b/app/code/Magento/Tax/Model/Resource/Report/Tax/Createdat.php
@@ -76,7 +76,7 @@ class Createdat extends \Magento\Reports\Model\Resource\Report\AbstractReport
         try {
             if ($from !== null || $to !== null) {
                 $subSelect = $this->_getTableDateRangeSelect(
-                    $this->getTable('sales_flat_order'),
+                    $this->getTable('sales_order'),
                     'created_at',
                     'updated_at',
                     $from,
@@ -90,7 +90,7 @@ class Createdat extends \Magento\Reports\Model\Resource\Report\AbstractReport
             // convert dates from UTC to current admin timezone
             $periodExpr = $writeAdapter->getDatePartSql(
                 $this->getStoreTZOffsetQuery(
-                    array('e' => $this->getTable('sales_flat_order')),
+                    array('e' => $this->getTable('sales_order')),
                     'e.' . $aggregationField,
                     $from,
                     $to
@@ -112,7 +112,7 @@ class Createdat extends \Magento\Reports\Model\Resource\Report\AbstractReport
                 array('tax' => $this->getTable('sales_order_tax')),
                 $columns
             )->joinInner(
-                array('e' => $this->getTable('sales_flat_order')),
+                array('e' => $this->getTable('sales_order')),
                 'e.entity_id = tax.order_id',
                 array()
             )->useStraightJoin();
diff --git a/app/code/Magento/Tax/Service/V1/Data/OrderTaxDetails/ItemBuilder.php b/app/code/Magento/Tax/Service/V1/Data/OrderTaxDetails/ItemBuilder.php
index f96ecf5e2c1b8e389bc2f564a5adfc030dc86a55..b7ede890920e6d9d9a292c6b6ddddd18bebc8e8b 100644
--- a/app/code/Magento/Tax/Service/V1/Data/OrderTaxDetails/ItemBuilder.php
+++ b/app/code/Magento/Tax/Service/V1/Data/OrderTaxDetails/ItemBuilder.php
@@ -23,7 +23,7 @@
  */
 namespace Magento\Tax\Service\V1\Data\OrderTaxDetails;
 
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
 use Magento\Framework\Api\MetadataServiceInterface;
 
 /**
@@ -45,13 +45,13 @@ class ItemBuilder extends \Magento\Framework\Api\ExtensibleObjectBuilder
      * Initialize dependencies
      *
      * @param \Magento\Framework\Api\ObjectFactory $objectFactory
-     * @param AttributeValueBuilder $valueBuilder
+     * @param AttributeDataBuilder $valueBuilder
      * @param MetadataServiceInterface $metadataService
      * @param AppliedTaxBuilder $appliedTaxBuilder
      */
     public function __construct(
         \Magento\Framework\Api\ObjectFactory $objectFactory,
-        AttributeValueBuilder $valueBuilder,
+        AttributeDataBuilder $valueBuilder,
         MetadataServiceInterface $metadataService,
         AppliedTaxBuilder $appliedTaxBuilder
     ) {
diff --git a/app/code/Magento/Tax/Service/V1/Data/OrderTaxDetailsBuilder.php b/app/code/Magento/Tax/Service/V1/Data/OrderTaxDetailsBuilder.php
index ad33bc878b23d5d47c158f42eca78404cd762094..facd6bbad985eb0913af3aeef8ae9860dbae62f3 100644
--- a/app/code/Magento/Tax/Service/V1/Data/OrderTaxDetailsBuilder.php
+++ b/app/code/Magento/Tax/Service/V1/Data/OrderTaxDetailsBuilder.php
@@ -26,7 +26,7 @@ namespace Magento\Tax\Service\V1\Data;
 
 use \Magento\Tax\Service\V1\Data\OrderTaxDetails\AppliedTaxBuilder;
 use \Magento\Tax\Service\V1\Data\OrderTaxDetails\ItemBuilder;
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
 use Magento\Framework\Api\MetadataServiceInterface;
 
 /**
@@ -54,14 +54,14 @@ class OrderTaxDetailsBuilder extends \Magento\Framework\Api\ExtensibleObjectBuil
      * Initialize dependencies
      *
      * @param \Magento\Framework\Api\ObjectFactory $objectFactory
-     * @param AttributeValueBuilder $valueBuilder
+     * @param AttributeDataBuilder $valueBuilder
      * @param MetadataServiceInterface $metadataService
      * @param AppliedTaxBuilder $appliedTaxBuilder
      * @param ItemBuilder $itemBuilder
      */
     public function __construct(
         \Magento\Framework\Api\ObjectFactory $objectFactory,
-        AttributeValueBuilder $valueBuilder,
+        AttributeDataBuilder $valueBuilder,
         MetadataServiceInterface $metadataService,
         AppliedTaxBuilder $appliedTaxBuilder,
         ItemBuilder $itemBuilder
diff --git a/app/code/Magento/Tax/Service/V1/Data/QuoteDetails/ItemBuilder.php b/app/code/Magento/Tax/Service/V1/Data/QuoteDetails/ItemBuilder.php
index 4606696a560095fa10dd9bb2c3b4e31328cf787a..63a5db447e998d3be4ca2e1cbb303e2646bdfe1a 100644
--- a/app/code/Magento/Tax/Service/V1/Data/QuoteDetails/ItemBuilder.php
+++ b/app/code/Magento/Tax/Service/V1/Data/QuoteDetails/ItemBuilder.php
@@ -23,7 +23,7 @@
  */
 namespace Magento\Tax\Service\V1\Data\QuoteDetails;
 
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
 use Magento\Framework\Api\MetadataServiceInterface;
 
 /**
@@ -44,13 +44,13 @@ class ItemBuilder extends \Magento\Framework\Api\ExtensibleObjectBuilder
      * Initialize dependencies
      *
      * @param \Magento\Framework\Api\ObjectFactory $objectFactory
-     * @param AttributeValueBuilder $valueBuilder
+     * @param AttributeDataBuilder $valueBuilder
      * @param MetadataServiceInterface $metadataService
      * @param \Magento\Tax\Service\V1\Data\TaxClassKeyBuilder $taxClassKeyBuilder
      */
     public function __construct(
         \Magento\Framework\Api\ObjectFactory $objectFactory,
-        AttributeValueBuilder $valueBuilder,
+        AttributeDataBuilder $valueBuilder,
         MetadataServiceInterface $metadataService,
         \Magento\Tax\Service\V1\Data\TaxClassKeyBuilder $taxClassKeyBuilder
     ) {
diff --git a/app/code/Magento/Tax/Service/V1/Data/QuoteDetailsBuilder.php b/app/code/Magento/Tax/Service/V1/Data/QuoteDetailsBuilder.php
index 3ca8f0b566507d21568dc787fe4557385af1d8ac..09abb8d738bea3d93fbda77febd4383a5e3e4f63 100644
--- a/app/code/Magento/Tax/Service/V1/Data/QuoteDetailsBuilder.php
+++ b/app/code/Magento/Tax/Service/V1/Data/QuoteDetailsBuilder.php
@@ -23,7 +23,7 @@
  */
 namespace Magento\Tax\Service\V1\Data;
 
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
 use Magento\Framework\Api\MetadataServiceInterface;
 
 /**
@@ -58,7 +58,7 @@ class QuoteDetailsBuilder extends \Magento\Framework\Api\ExtensibleObjectBuilder
      * Initialize dependencies.
      *
      * @param \Magento\Framework\Api\ObjectFactory $objectFactory
-     * @param AttributeValueBuilder $valueBuilder
+     * @param AttributeDataBuilder $valueBuilder
      * @param MetadataServiceInterface $metadataService
      * @param \Magento\Tax\Service\V1\Data\QuoteDetails\ItemBuilder $itemBuilder
      * @param \Magento\Tax\Service\V1\Data\TaxClassKeyBuilder $taxClassKeyBuilder
@@ -66,7 +66,7 @@ class QuoteDetailsBuilder extends \Magento\Framework\Api\ExtensibleObjectBuilder
      */
     public function __construct(
         \Magento\Framework\Api\ObjectFactory $objectFactory,
-        AttributeValueBuilder $valueBuilder,
+        AttributeDataBuilder $valueBuilder,
         MetadataServiceInterface $metadataService,
         \Magento\Tax\Service\V1\Data\QuoteDetails\ItemBuilder $itemBuilder,
         \Magento\Tax\Service\V1\Data\TaxClassKeyBuilder $taxClassKeyBuilder,
diff --git a/app/code/Magento/Tax/Service/V1/Data/TaxClassSearchResultsBuilder.php b/app/code/Magento/Tax/Service/V1/Data/TaxClassSearchResultsBuilder.php
index d1a5b4d6b140ff914463278f79b67c57d6c9bb59..aaaa826b6c754531764fbb30edb16620080d075c 100644
--- a/app/code/Magento/Tax/Service/V1/Data/TaxClassSearchResultsBuilder.php
+++ b/app/code/Magento/Tax/Service/V1/Data/TaxClassSearchResultsBuilder.php
@@ -24,7 +24,7 @@
 
 namespace Magento\Tax\Service\V1\Data;
 
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
 use Magento\Framework\Api\MetadataServiceInterface;
 use Magento\Framework\Api\ObjectFactory;
 use Magento\Framework\Api\SearchCriteriaBuilder;
@@ -41,14 +41,14 @@ class TaxClassSearchResultsBuilder extends AbstractSearchResultsBuilder
      * Constructor
      *
      * @param ObjectFactory $objectFactory
-     * @param AttributeValueBuilder $valueBuilder
+     * @param AttributeDataBuilder $valueBuilder
      * @param MetadataServiceInterface $metadataService
      * @param SearchCriteriaBuilder $searchCriteriaBuilder
      * @param TaxClassBuilder $itemObjectBuilder
      */
     public function __construct(
         ObjectFactory $objectFactory,
-        AttributeValueBuilder $valueBuilder,
+        AttributeDataBuilder $valueBuilder,
         MetadataServiceInterface $metadataService,
         SearchCriteriaBuilder $searchCriteriaBuilder,
         TaxClassBuilder $itemObjectBuilder
diff --git a/app/code/Magento/Tax/Service/V1/Data/TaxDetails/AppliedTaxBuilder.php b/app/code/Magento/Tax/Service/V1/Data/TaxDetails/AppliedTaxBuilder.php
index 63155d19996a4f52c38b41243db5e7091db5d16b..de943fb0c4851bfba9149283733c57c21f89f003 100644
--- a/app/code/Magento/Tax/Service/V1/Data/TaxDetails/AppliedTaxBuilder.php
+++ b/app/code/Magento/Tax/Service/V1/Data/TaxDetails/AppliedTaxBuilder.php
@@ -23,7 +23,7 @@
  */
 namespace Magento\Tax\Service\V1\Data\TaxDetails;
 
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
 use Magento\Framework\Api\MetadataServiceInterface;
 
 /**
@@ -44,13 +44,13 @@ class AppliedTaxBuilder extends \Magento\Framework\Api\ExtensibleObjectBuilder
      * Initialize dependencies.
      *
      * @param \Magento\Framework\Api\ObjectFactory $objectFactory
-     * @param AttributeValueBuilder $valueBuilder
+     * @param AttributeDataBuilder $valueBuilder
      * @param MetadataServiceInterface $metadataService
      * @param AppliedTaxRateBuilder $appliedTaxRateBuilder
      */
     public function __construct(
         \Magento\Framework\Api\ObjectFactory $objectFactory,
-        AttributeValueBuilder $valueBuilder,
+        AttributeDataBuilder $valueBuilder,
         MetadataServiceInterface $metadataService,
         AppliedTaxRateBuilder $appliedTaxRateBuilder
     ) {
diff --git a/app/code/Magento/Tax/Service/V1/Data/TaxDetails/ItemBuilder.php b/app/code/Magento/Tax/Service/V1/Data/TaxDetails/ItemBuilder.php
index d61795ea390c432aff11ecc770555d937169a851..373ef4f2bc9c2c677919951daa27a8244a57dba5 100644
--- a/app/code/Magento/Tax/Service/V1/Data/TaxDetails/ItemBuilder.php
+++ b/app/code/Magento/Tax/Service/V1/Data/TaxDetails/ItemBuilder.php
@@ -23,7 +23,7 @@
  */
 namespace Magento\Tax\Service\V1\Data\TaxDetails;
 
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
 use Magento\Framework\Api\MetadataServiceInterface;
 use Magento\Tax\Service\V1\Data\TaxDetails;
 
@@ -46,13 +46,13 @@ class ItemBuilder extends \Magento\Framework\Api\ExtensibleObjectBuilder
      * Initialize dependencies
      *
      * @param \Magento\Framework\Api\ObjectFactory $objectFactory
-     * @param AttributeValueBuilder $valueBuilder
+     * @param AttributeDataBuilder $valueBuilder
      * @param MetadataServiceInterface $metadataService
      * @param AppliedTaxBuilder $appliedTaxBuilder
      */
     public function __construct(
         \Magento\Framework\Api\ObjectFactory $objectFactory,
-        AttributeValueBuilder $valueBuilder,
+        AttributeDataBuilder $valueBuilder,
         MetadataServiceInterface $metadataService,
         \Magento\Tax\Service\V1\Data\TaxDetails\AppliedTaxBuilder $appliedTaxBuilder
     ) {
diff --git a/app/code/Magento/Tax/Service/V1/Data/TaxDetailsBuilder.php b/app/code/Magento/Tax/Service/V1/Data/TaxDetailsBuilder.php
index 3d52a7ab547e87cf5b94501e90902df81b460763..e3cb24abf12ef79a55cc484edd5002f54bcc275d 100644
--- a/app/code/Magento/Tax/Service/V1/Data/TaxDetailsBuilder.php
+++ b/app/code/Magento/Tax/Service/V1/Data/TaxDetailsBuilder.php
@@ -24,7 +24,7 @@
 
 namespace Magento\Tax\Service\V1\Data;
 
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
 use Magento\Framework\Api\MetadataServiceInterface;
 
 /**
@@ -52,14 +52,14 @@ class TaxDetailsBuilder extends \Magento\Framework\Api\ExtensibleObjectBuilder
      * Initialize dependencies
      *
      * @param \Magento\Framework\Api\ObjectFactory $objectFactory
-     * @param AttributeValueBuilder $valueBuilder
+     * @param AttributeDataBuilder $valueBuilder
      * @param MetadataServiceInterface $metadataService
      * @param TaxDetails\AppliedTaxBuilder $appliedTaxBuilder
      * @param TaxDetails\ItemBuilder $taxDetailsItemBuilder
      */
     public function __construct(
         \Magento\Framework\Api\ObjectFactory $objectFactory,
-        AttributeValueBuilder $valueBuilder,
+        AttributeDataBuilder $valueBuilder,
         MetadataServiceInterface $metadataService,
         \Magento\Tax\Service\V1\Data\TaxDetails\AppliedTaxBuilder $appliedTaxBuilder,
         \Magento\Tax\Service\V1\Data\TaxDetails\ItemBuilder $taxDetailsItemBuilder
diff --git a/app/code/Magento/Tax/Service/V1/Data/TaxRateBuilder.php b/app/code/Magento/Tax/Service/V1/Data/TaxRateBuilder.php
index 0a541e6d09e0b2f2a5c97d13953aedda983b5b68..74cae8f7cfa74514c1d058307086d2864c094914 100644
--- a/app/code/Magento/Tax/Service/V1/Data/TaxRateBuilder.php
+++ b/app/code/Magento/Tax/Service/V1/Data/TaxRateBuilder.php
@@ -23,7 +23,7 @@
  */
 namespace Magento\Tax\Service\V1\Data;
 
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
 use Magento\Framework\Api\MetadataServiceInterface;
 use Magento\Framework\Api\ObjectFactory;
 
@@ -52,14 +52,14 @@ class TaxRateBuilder extends \Magento\Framework\Api\ExtensibleObjectBuilder
      * Initialize dependencies.
      *
      * @param ObjectFactory $objectFactory
-     * @param AttributeValueBuilder $valueBuilder
+     * @param AttributeDataBuilder $valueBuilder
      * @param MetadataServiceInterface $metadataService
      * @param ZipRangeBuilder $zipRangeBuilder
      * @param TaxRateTitleBuilder $taxRateTitleBuilder
      */
     public function __construct(
         ObjectFactory $objectFactory,
-        AttributeValueBuilder $valueBuilder,
+        AttributeDataBuilder $valueBuilder,
         MetadataServiceInterface $metadataService,
         ZipRangeBuilder $zipRangeBuilder,
         TaxRateTitleBuilder $taxRateTitleBuilder
diff --git a/app/code/Magento/Tax/Service/V1/Data/TaxRateSearchResultsBuilder.php b/app/code/Magento/Tax/Service/V1/Data/TaxRateSearchResultsBuilder.php
index 47aac3fbd86bceae6c6f50416635c58db27642a9..4f3c71ff40649ad58e19c9e963d79e84e3dfcfe6 100644
--- a/app/code/Magento/Tax/Service/V1/Data/TaxRateSearchResultsBuilder.php
+++ b/app/code/Magento/Tax/Service/V1/Data/TaxRateSearchResultsBuilder.php
@@ -24,7 +24,7 @@
 
 namespace Magento\Tax\Service\V1\Data;
 
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
 use Magento\Framework\Api\MetadataServiceInterface;
 use Magento\Framework\Api\ObjectFactory;
 use Magento\Framework\Api\AbstractSearchResultsBuilder;
@@ -41,14 +41,14 @@ class TaxRateSearchResultsBuilder extends AbstractSearchResultsBuilder
      * Constructor
      *
      * @param ObjectFactory $objectFactory
-     * @param AttributeValueBuilder $valueBuilder
+     * @param AttributeDataBuilder $valueBuilder
      * @param MetadataServiceInterface $metadataService
      * @param SearchCriteriaBuilder $searchCriteriaBuilder
      * @param TaxRateBuilder $itemObjectBuilder
      */
     public function __construct(
         ObjectFactory $objectFactory,
-        AttributeValueBuilder $valueBuilder,
+        AttributeDataBuilder $valueBuilder,
         MetadataServiceInterface $metadataService,
         SearchCriteriaBuilder $searchCriteriaBuilder,
         TaxRateBuilder $itemObjectBuilder
diff --git a/app/code/Magento/Tax/Service/V1/Data/TaxRuleBuilder.php b/app/code/Magento/Tax/Service/V1/Data/TaxRuleBuilder.php
index 6499999341de49a8054e824f4eb8fb575f4c24ff..586ed35f07d648765c673916da17fe62082bd5a5 100644
--- a/app/code/Magento/Tax/Service/V1/Data/TaxRuleBuilder.php
+++ b/app/code/Magento/Tax/Service/V1/Data/TaxRuleBuilder.php
@@ -24,7 +24,7 @@
 namespace Magento\Tax\Service\V1\Data;
 
 use Magento\Framework\Api\ExtensibleObjectBuilder;
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
 use Magento\Framework\Api\MetadataServiceInterface;
 use Magento\Framework\Api\ObjectFactory;
 
@@ -46,13 +46,13 @@ class TaxRuleBuilder extends ExtensibleObjectBuilder
      * Initialize dependencies.
      *
      * @param ObjectFactory $objectFactory
-     * @param AttributeValueBuilder $valueBuilder
+     * @param AttributeDataBuilder $valueBuilder
      * @param MetadataServiceInterface $metadataService
      * @param TaxRateBuilder $taxRateBuilder
      */
     public function __construct(
         ObjectFactory $objectFactory,
-        AttributeValueBuilder $valueBuilder,
+        AttributeDataBuilder $valueBuilder,
         MetadataServiceInterface $metadataService,
         TaxRateBuilder $taxRateBuilder
     ) {
diff --git a/app/code/Magento/Tax/Service/V1/Data/TaxRuleSearchResultsBuilder.php b/app/code/Magento/Tax/Service/V1/Data/TaxRuleSearchResultsBuilder.php
index 41c16cbd6fd288d5d09aa1fe19c9402fc6cbf249..a221af83cf4fa60f97c1529b00a471ffc7ff5651 100644
--- a/app/code/Magento/Tax/Service/V1/Data/TaxRuleSearchResultsBuilder.php
+++ b/app/code/Magento/Tax/Service/V1/Data/TaxRuleSearchResultsBuilder.php
@@ -24,7 +24,7 @@
 
 namespace Magento\Tax\Service\V1\Data;
 
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
 use Magento\Framework\Api\MetadataServiceInterface;
 use Magento\Framework\Api\ObjectFactory;
 use Magento\Framework\Api\SearchCriteriaBuilder;
@@ -41,14 +41,14 @@ class TaxRuleSearchResultsBuilder extends AbstractSearchResultsBuilder
      * Constructor
      *
      * @param ObjectFactory $objectFactory
-     * @param AttributeValueBuilder $valueBuilder
+     * @param AttributeDataBuilder $valueBuilder
      * @param MetadataServiceInterface $metadataService
      * @param SearchCriteriaBuilder $searchCriteriaBuilder
      * @param TaxRuleBuilder $itemObjectBuilder
      */
     public function __construct(
         ObjectFactory $objectFactory,
-        AttributeValueBuilder $valueBuilder,
+        AttributeDataBuilder $valueBuilder,
         MetadataServiceInterface $metadataService,
         SearchCriteriaBuilder $searchCriteriaBuilder,
         TaxRuleBuilder $itemObjectBuilder
diff --git a/app/code/Magento/Tax/composer.json b/app/code/Magento/Tax/composer.json
index 817f2a38a57f14ad2a2c7c9c84a55ad2bd5bf3e9..4bd259aaac0c1f8e0fcf82a42cd7d3955ad682b0 100644
--- a/app/code/Magento/Tax/composer.json
+++ b/app/code/Magento/Tax/composer.json
@@ -3,23 +3,23 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-catalog": "0.1.0-alpha103",
-        "magento/module-customer": "0.1.0-alpha103",
-        "magento/module-core": "0.1.0-alpha103",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/module-directory": "0.1.0-alpha103",
-        "magento/module-checkout": "0.1.0-alpha103",
-        "magento/module-shipping": "0.1.0-alpha103",
-        "magento/module-eav": "0.1.0-alpha103",
-        "magento/module-sales": "0.1.0-alpha103",
-        "magento/module-reports": "0.1.0-alpha103",
-        "magento/module-configurable-product": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-catalog": "0.1.0-alpha104",
+        "magento/module-customer": "0.1.0-alpha104",
+        "magento/module-core": "0.1.0-alpha104",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/module-directory": "0.1.0-alpha104",
+        "magento/module-checkout": "0.1.0-alpha104",
+        "magento/module-shipping": "0.1.0-alpha104",
+        "magento/module-eav": "0.1.0-alpha104",
+        "magento/module-sales": "0.1.0-alpha104",
+        "magento/module-reports": "0.1.0-alpha104",
+        "magento/module-configurable-product": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/Tax/etc/frontend/di.xml b/app/code/Magento/Tax/etc/frontend/di.xml
new file mode 100644
index 0000000000000000000000000000000000000000..d62eaad35321c93464c21e6cd6a5add9faa6481a
--- /dev/null
+++ b/app/code/Magento/Tax/etc/frontend/di.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+<!--
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Academic Free License (AFL 3.0)
+ * that is bundled with this package in the file LICENSE_AFL.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/afl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
+ */
+-->
+<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">
+    <type name="Magento\Tax\Model\Calculation">
+        <arguments>
+            <argument name="addressService" xsi:type="object">Magento\Customer\Service\V1\CustomerAddressServiceInterface\Proxy</argument>
+            <argument name="groupService" xsi:type="object">Magento\Customer\Service\V1\CustomerGroupServiceInterface\Proxy</argument>
+            <argument name="customerAccount" xsi:type="object">Magento\Customer\Service\V1\CustomerAccountServiceInterface\Proxy</argument>
+        </arguments>
+    </type>
+</config>
diff --git a/app/code/Magento/Tax/sql/tax_setup/upgrade-1.6.0.1-1.6.0.2.php b/app/code/Magento/Tax/sql/tax_setup/upgrade-1.6.0.1-1.6.0.2.php
index 18ef18d6db66c283a882f00c12eb557618bee230..dc85e2b647afcf29bf6b2233ccf01de38c9f5aa4 100644
--- a/app/code/Magento/Tax/sql/tax_setup/upgrade-1.6.0.1-1.6.0.2.php
+++ b/app/code/Magento/Tax/sql/tax_setup/upgrade-1.6.0.1-1.6.0.2.php
@@ -67,9 +67,9 @@ $table = $installer->getConnection()->newTable(
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
 )->addForeignKey(
-    $installer->getFkName('sales_order_tax_item', 'item_id', 'sales_flat_order_item', 'item_id'),
+    $installer->getFkName('sales_order_tax_item', 'item_id', 'sales_order_item', 'item_id'),
     'item_id',
-    $installer->getTable('sales_flat_order_item'),
+    $installer->getTable('sales_order_item'),
     'item_id',
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE,
     \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE
diff --git a/app/code/Magento/Tax/sql/tax_setup/upgrade-1.6.0.6-1.6.0.7.php b/app/code/Magento/Tax/sql/tax_setup/upgrade-1.6.0.6-1.6.0.7.php
index 557166c02d862d52016529d213a04f82fe41de95..7f65a36603a466060ee89fc958f7d4bab0b7bfb5 100644
--- a/app/code/Magento/Tax/sql/tax_setup/upgrade-1.6.0.6-1.6.0.7.php
+++ b/app/code/Magento/Tax/sql/tax_setup/upgrade-1.6.0.6-1.6.0.7.php
@@ -105,9 +105,9 @@ $connection->changeColumn(
     ]
 );
 $connection->addForeignKey(
-    $installer->getFkName('sales_order_tax_item', 'associated_item_id', 'sales_flat_order_item', 'item_id'),
+    $installer->getFkName('sales_order_tax_item', 'associated_item_id', 'sales_order_item', 'item_id'),
     $installer->getTable('sales_order_tax_item'),
     'associated_item_id',
-    $installer->getTable('sales_flat_order_item'),
+    $installer->getTable('sales_order_item'),
     'item_id'
 );
diff --git a/app/code/Magento/TaxImportExport/composer.json b/app/code/Magento/TaxImportExport/composer.json
index c84e9abf1d8b303da05799b3d5e1b23b19318006..5d463084c6bdb62ec64d88ee85fc42961033f3eb 100644
--- a/app/code/Magento/TaxImportExport/composer.json
+++ b/app/code/Magento/TaxImportExport/composer.json
@@ -3,15 +3,15 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-tax": "0.1.0-alpha103",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/module-directory": "0.1.0-alpha103",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-tax": "0.1.0-alpha104",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/module-directory": "0.1.0-alpha104",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/Theme/composer.json b/app/code/Magento/Theme/composer.json
index 6d93b9068ee4dde0b12c1baad3c92a01e3c3d1d5..2e3dd1a6e2ca16a9b4f7fcdf651fbabc742e69dd 100644
--- a/app/code/Magento/Theme/composer.json
+++ b/app/code/Magento/Theme/composer.json
@@ -3,17 +3,17 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-core": "0.1.0-alpha103",
-        "magento/module-customer": "0.1.0-alpha103",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/module-cms": "0.1.0-alpha103",
-        "magento/module-translation": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-core": "0.1.0-alpha104",
+        "magento/module-customer": "0.1.0-alpha104",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/module-cms": "0.1.0-alpha104",
+        "magento/module-translation": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/Theme/etc/di.xml b/app/code/Magento/Theme/etc/di.xml
index 93644313573000821d1bd2473ef6f09852980498..789c64087023ce693478d6355aa03ea97b7ce2f2 100644
--- a/app/code/Magento/Theme/etc/di.xml
+++ b/app/code/Magento/Theme/etc/di.xml
@@ -62,7 +62,6 @@
         </arguments>
     </type>
     <preference for="Magento\Framework\App\View\Deployment\Version\StorageInterface" type="Magento\Framework\App\View\Deployment\Version\Storage\File"/>
-    <preference for="Magento\Framework\App\View\Deployment\Version\GeneratorInterface" type="Magento\Framework\App\View\Deployment\Version\Generator\Timestamp"/>
     <type name="Magento\Framework\App\View\Deployment\Version\Storage\File">
         <arguments>
             <argument name="directoryCode" xsi:type="const">Magento\Framework\App\Filesystem\DirectoryList::STATIC_VIEW</argument>
diff --git a/app/code/Magento/Theme/etc/module.xml b/app/code/Magento/Theme/etc/module.xml
index 2653ba3715326390c7e9af4cc8a65620d2137b60..0859582a9d7bbb24a49f042acb08d972a7830a17 100644
--- a/app/code/Magento/Theme/etc/module.xml
+++ b/app/code/Magento/Theme/etc/module.xml
@@ -24,7 +24,7 @@
  */
 -->
 <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
-    <module name="Magento_Theme" schema_version="1.6.0.0" active="true">
+    <module name="Magento_Theme" schema_version="2.0.0" active="true">
         <sequence>
             <module name="Magento_Core"/>
             <module name="Magento_Store"/>
diff --git a/app/code/Magento/Translation/composer.json b/app/code/Magento/Translation/composer.json
index 1ab6d63afbdefb1b536951849ef8117288880718..ba56c47708d0213157bb36934652efe647fe22be 100644
--- a/app/code/Magento/Translation/composer.json
+++ b/app/code/Magento/Translation/composer.json
@@ -3,14 +3,14 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-core": "0.1.0-alpha103",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-core": "0.1.0-alpha104",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/Ui/composer.json b/app/code/Magento/Ui/composer.json
index 313b30b38c45db80de767f581154b0da624330c3..6e3c827631f0524742bc607432bcfb1906bc659e 100644
--- a/app/code/Magento/Ui/composer.json
+++ b/app/code/Magento/Ui/composer.json
@@ -3,13 +3,13 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/Ui/etc/module.xml b/app/code/Magento/Ui/etc/module.xml
index d859f136d0a3c4644cbb2d7df7b3fd2419414737..3e1302245a0f09658ac237fcef908e9b4abb5eb3 100644
--- a/app/code/Magento/Ui/etc/module.xml
+++ b/app/code/Magento/Ui/etc/module.xml
@@ -24,14 +24,14 @@
  */
 -->
 <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
-    <module name="Magento_Ui" schema_version="1.6.0.0" active="true">
+    <module name="Magento_Ui" schema_version="2.0.0" active="true">
         <sequence>
             <module name="Magento_Backend"/>
-        	<module name="Magento_Directory"/>
+            <module name="Magento_Directory"/>
         </sequence>
         <depends>
             <module name="Magento_Backend"/>
             <module name="Magento_Store"/>
         </depends>
     </module>
-</config>
\ No newline at end of file
+</config>
diff --git a/app/code/Magento/Ups/composer.json b/app/code/Magento/Ups/composer.json
index 81119a2bf504218847b02c3e0ba4840ade7ebf2d..d6a7c4e76180ec988fa941aa3c475226f2d19bb7 100644
--- a/app/code/Magento/Ups/composer.json
+++ b/app/code/Magento/Ups/composer.json
@@ -3,18 +3,18 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-core": "0.1.0-alpha103",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/module-sales": "0.1.0-alpha103",
-        "magento/module-shipping": "0.1.0-alpha103",
-        "magento/module-directory": "0.1.0-alpha103",
-        "magento/module-catalog-inventory": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-core": "0.1.0-alpha104",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/module-sales": "0.1.0-alpha104",
+        "magento/module-shipping": "0.1.0-alpha104",
+        "magento/module-directory": "0.1.0-alpha104",
+        "magento/module-catalog-inventory": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/Ups/etc/module.xml b/app/code/Magento/Ups/etc/module.xml
index ae8aab01ae5f0cd3993eca55493ea7be6d07abaa..22c05c57ca705b99d22e1a6e1588c41b2b12ddd3 100644
--- a/app/code/Magento/Ups/etc/module.xml
+++ b/app/code/Magento/Ups/etc/module.xml
@@ -24,7 +24,7 @@
  */
 -->
 <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
-    <module name="Magento_Ups" schema_version="2.0.0.0" active="true">
+    <module name="Magento_Ups" schema_version="2.0.0" active="true">
         <depends>
             <module name="Magento_Store"/>
             <module name="Magento_Core"/>
diff --git a/app/code/Magento/UrlRewrite/Controller/Adminhtml/Url/Rewrite/Save.php b/app/code/Magento/UrlRewrite/Controller/Adminhtml/Url/Rewrite/Save.php
index e6f5bd53a667a35e4044a866646ef9b21cd67905..906ba7f49f324270e7f77ea156f79478c6d5d092 100644
--- a/app/code/Magento/UrlRewrite/Controller/Adminhtml/Url/Rewrite/Save.php
+++ b/app/code/Magento/UrlRewrite/Controller/Adminhtml/Url/Rewrite/Save.php
@@ -166,7 +166,7 @@ class Save extends \Magento\UrlRewrite\Controller\Adminhtml\Url\Rewrite
                 $requestPath = $this->getRequest()->getParam('request_path');
                 $this->_objectManager->get('Magento\UrlRewrite\Helper\UrlRewrite')->validateRequestPath($requestPath);
 
-                $model->setEntityType($this->getRequest()->getParam('entity_type', self::ENTITY_TYPE_CUSTOM))
+                $model->setEntityType($this->getRequest()->getParam('entity_type') ?: self::ENTITY_TYPE_CUSTOM)
                     ->setRequestPath($requestPath)
                     ->setTargetPath($this->getRequest()->getParam('target_path', $model->getTargetPath()))
                     ->setRedirectType($this->getRequest()->getParam('redirect_type'))
diff --git a/app/code/Magento/UrlRewrite/Controller/Router.php b/app/code/Magento/UrlRewrite/Controller/Router.php
index 255904c15c1f7c7e19380c5863d95d5902c17043..28f97eef23c4fb84ca753bf45ee22c3685701c54 100644
--- a/app/code/Magento/UrlRewrite/Controller/Router.php
+++ b/app/code/Magento/UrlRewrite/Controller/Router.php
@@ -26,6 +26,7 @@ namespace Magento\UrlRewrite\Controller;
 use Magento\UrlRewrite\Service\V1\Data\UrlRewrite;
 use Magento\UrlRewrite\Model\UrlFinderInterface;
 use Magento\UrlRewrite\Model\OptionProvider;
+use Magento\UrlRewrite\Controller\Adminhtml\Url\Rewrite;
 
 /**
  * UrlRewrite Controller Router
@@ -98,15 +99,30 @@ class Router implements \Magento\Framework\App\RouterInterface
             return null;
         }
 
-        $redirectType = $rewrite->getRedirectType();
-        if ($redirectType) {
-            return $this->redirect($request, $rewrite->getTargetPath(), $redirectType);
+        if ($rewrite->getRedirectType()) {
+            return $this->processRedirect($request, $rewrite);
         }
 
         $request->setPathInfo('/' . $rewrite->getTargetPath());
         return $this->actionFactory->create('Magento\Framework\App\Action\Forward', array('request' => $request));
     }
 
+    /**
+     * @param \Magento\Framework\App\RequestInterface $request
+     * @param UrlRewrite $rewrite
+     * @return \Magento\Framework\App\ActionInterface|null
+     */
+    protected function processRedirect($request, $rewrite)
+    {
+        $target = $rewrite->getTargetPath();
+        if ($rewrite->getEntityType() !== Rewrite::ENTITY_TYPE_CUSTOM
+            || ($prefix = substr($target, 0, 6)) !== 'http:/' && $prefix !== 'https:'
+        ) {
+            $target = $this->url->getUrl('', array('_direct' => $target));
+        }
+        return $this->redirect($request, $target, $rewrite->getRedirectType());
+    }
+
     /**
      * @param \Magento\Framework\App\RequestInterface $request
      * @param string $url
@@ -115,7 +131,7 @@ class Router implements \Magento\Framework\App\RouterInterface
      */
     protected function redirect($request, $url, $code)
     {
-        $this->response->setRedirect($this->url->getUrl('', array('_direct' => $url)), $code);
+        $this->response->setRedirect($url, $code);
         $request->setDispatched(true);
         return $this->actionFactory->create('Magento\Framework\App\Action\Redirect', array('request' => $request));
     }
@@ -127,11 +143,9 @@ class Router implements \Magento\Framework\App\RouterInterface
      */
     protected function getRewrite($requestPath, $storeId)
     {
-        return $this->urlFinder->findOneByData(
-            [
-                UrlRewrite::REQUEST_PATH => trim($requestPath, '/'),
-                UrlRewrite::STORE_ID => $storeId,
-            ]
-        );
+        return $this->urlFinder->findOneByData([
+            UrlRewrite::REQUEST_PATH => trim($requestPath, '/'),
+            UrlRewrite::STORE_ID => $storeId,
+        ]);
     }
 }
diff --git a/app/code/Magento/UrlRewrite/composer.json b/app/code/Magento/UrlRewrite/composer.json
index 7d14b5527fd55813d652296eba5a62012128a860..e1b7463e28d16e6928b46407c641e69e666f9fe1 100644
--- a/app/code/Magento/UrlRewrite/composer.json
+++ b/app/code/Magento/UrlRewrite/composer.json
@@ -3,18 +3,18 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-catalog": "0.1.0-alpha103",
-        "magento/module-core": "0.1.0-alpha103",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/module-catalog-url-rewrite": "0.1.0-alpha103",
-        "magento/module-cms": "0.1.0-alpha103",
-        "magento/module-cms-url-rewrite": "0.1.0-alpha103",
+        "magento/module-catalog": "0.1.0-alpha104",
+        "magento/module-core": "0.1.0-alpha104",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/module-catalog-url-rewrite": "0.1.0-alpha104",
+        "magento/module-cms": "0.1.0-alpha104",
+        "magento/module-cms-url-rewrite": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/User/composer.json b/app/code/Magento/User/composer.json
index 34af5709eb0619508a6736df023c86a03b8c363a..543ae1e6ff17bb08e8e120f5d04ea891133e7393 100644
--- a/app/code/Magento/User/composer.json
+++ b/app/code/Magento/User/composer.json
@@ -3,16 +3,16 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-authorization": "0.1.0-alpha103",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/module-core": "0.1.0-alpha103",
-        "magento/module-integration": "0.1.0-alpha103",
-        "magento/module-theme": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-authorization": "0.1.0-alpha104",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/module-core": "0.1.0-alpha104",
+        "magento/module-integration": "0.1.0-alpha104",
+        "magento/module-theme": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/Usps/composer.json b/app/code/Magento/Usps/composer.json
index 414c0721039c05ce907c689514826915a8e0e80c..bff4187f43b38f426994d4756e779231f8cc2065 100644
--- a/app/code/Magento/Usps/composer.json
+++ b/app/code/Magento/Usps/composer.json
@@ -3,19 +3,19 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-shipping": "0.1.0-alpha103",
-        "magento/module-directory": "0.1.0-alpha103",
-        "magento/module-core": "0.1.0-alpha103",
-        "magento/module-catalog": "0.1.0-alpha103",
-        "magento/module-sales": "0.1.0-alpha103",
-        "magento/module-catalog-inventory": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-shipping": "0.1.0-alpha104",
+        "magento/module-directory": "0.1.0-alpha104",
+        "magento/module-core": "0.1.0-alpha104",
+        "magento/module-catalog": "0.1.0-alpha104",
+        "magento/module-sales": "0.1.0-alpha104",
+        "magento/module-catalog-inventory": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "lib-libxml": "*",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/Usps/data/usps_setup/data-install-2.0.0.0.php b/app/code/Magento/Usps/data/usps_setup/data-install-2.0.0.php
similarity index 100%
rename from app/code/Magento/Usps/data/usps_setup/data-install-2.0.0.0.php
rename to app/code/Magento/Usps/data/usps_setup/data-install-2.0.0.php
diff --git a/app/code/Magento/Usps/etc/module.xml b/app/code/Magento/Usps/etc/module.xml
index 8ef5554d20703e8a7c464f5dfe864f003413bba9..da87d123165400f614e581cfd8da2a9f6e281655 100644
--- a/app/code/Magento/Usps/etc/module.xml
+++ b/app/code/Magento/Usps/etc/module.xml
@@ -24,7 +24,7 @@
  */
 -->
 <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
-    <module name="Magento_Usps" schema_version="2.0.0.0" active="true">
+    <module name="Magento_Usps" schema_version="2.0.0" active="true">
         <depends>
             <module name="Magento_Store"/>
             <module name="Magento_Shipping"/>
diff --git a/app/code/Magento/Webapi/Controller/ServiceArgsSerializer.php b/app/code/Magento/Webapi/Controller/ServiceArgsSerializer.php
index 7af9aec600d5140a2c621e86248396194327ae83..a582647d7ddbb835efa3994e61700379a32a7291 100644
--- a/app/code/Magento/Webapi/Controller/ServiceArgsSerializer.php
+++ b/app/code/Magento/Webapi/Controller/ServiceArgsSerializer.php
@@ -29,7 +29,7 @@ use Magento\Framework\ObjectManager;
 use Magento\Framework\ObjectManager\Config as ObjectManagerConfig;
 use Magento\Framework\Api\Config\Reader as ServiceConfigReader;
 use Magento\Framework\Api\AttributeValue;
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
 use Magento\Framework\Reflection\TypeProcessor;
 use Zend\Code\Reflection\ClassReflection;
 use Zend\Code\Reflection\MethodReflection;
@@ -55,7 +55,7 @@ class ServiceArgsSerializer
     /** @var ServiceConfigReader */
     protected $serviceConfigReader;
 
-    /** @var AttributeValueBuilder */
+    /** @var AttributeDataBuilder */
     protected $attributeValueBuilder;
 
     /**
@@ -64,13 +64,13 @@ class ServiceArgsSerializer
      * @param TypeProcessor $typeProcessor
      * @param DataBuilderFactory $builderFactory
      * @param ServiceConfigReader $serviceConfigReader
-     * @param AttributeValueBuilder $attributeValueBuilder
+     * @param AttributeDataBuilder $attributeValueBuilder
      */
     public function __construct(
         TypeProcessor $typeProcessor,
         DataBuilderFactory $builderFactory,
         ServiceConfigReader $serviceConfigReader,
-        AttributeValueBuilder $attributeValueBuilder
+        AttributeDataBuilder $attributeValueBuilder
     ) {
         $this->typeProcessor = $typeProcessor;
         $this->builderFactory = $builderFactory;
diff --git a/app/code/Magento/Webapi/composer.json b/app/code/Magento/Webapi/composer.json
index 25cede30adf7d70aa8f4f652faf91bec8739348b..34a208debd1e67fa50163e2c5ece21f950d51feb 100644
--- a/app/code/Magento/Webapi/composer.json
+++ b/app/code/Magento/Webapi/composer.json
@@ -3,17 +3,17 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-authorization": "0.1.0-alpha103",
-        "magento/module-core": "0.1.0-alpha103",
-        "magento/module-integration": "0.1.0-alpha103",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/module-user": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-authorization": "0.1.0-alpha104",
+        "magento/module-core": "0.1.0-alpha104",
+        "magento/module-integration": "0.1.0-alpha104",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/module-user": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/Weee/Model/Attribute/Backend/Weee/Tax.php b/app/code/Magento/Weee/Model/Attribute/Backend/Weee/Tax.php
index fe7afcf1f815e06cab0820827aa28fa09865afe1..3a339a0a94b1095932b3918eb76cd03e99744fb3 100644
--- a/app/code/Magento/Weee/Model/Attribute/Backend/Weee/Tax.php
+++ b/app/code/Magento/Weee/Model/Attribute/Backend/Weee/Tax.php
@@ -43,7 +43,6 @@ class Tax extends \Magento\Catalog\Model\Product\Attribute\Backend\Price
     protected $_directoryHelper;
 
     /**
-     * @param \Magento\Framework\Logger $logger
      * @param \Magento\Directory\Model\CurrencyFactory $currencyFactory
      * @param \Magento\Framework\StoreManagerInterface $storeManager
      * @param \Magento\Catalog\Helper\Data $catalogData
@@ -52,7 +51,6 @@ class Tax extends \Magento\Catalog\Model\Product\Attribute\Backend\Price
      * @param \Magento\Weee\Model\Resource\Attribute\Backend\Weee\Tax $attributeTax
      */
     public function __construct(
-        \Magento\Framework\Logger $logger,
         \Magento\Directory\Model\CurrencyFactory $currencyFactory,
         \Magento\Framework\StoreManagerInterface $storeManager,
         \Magento\Catalog\Helper\Data $catalogData,
@@ -63,7 +61,7 @@ class Tax extends \Magento\Catalog\Model\Product\Attribute\Backend\Price
         $this->_directoryHelper = $directoryHelper;
         $this->_storeManager = $storeManager;
         $this->_attributeTax = $attributeTax;
-        parent::__construct($logger, $currencyFactory, $storeManager, $catalogData, $config);
+        parent::__construct($currencyFactory, $storeManager, $catalogData, $config);
     }
 
     /**
diff --git a/app/code/Magento/Weee/composer.json b/app/code/Magento/Weee/composer.json
index d455549da8f503cd1a945dfe7253bb58b6bce597..aa73fea5c9fc60713708cceb4978934fd929f560 100644
--- a/app/code/Magento/Weee/composer.json
+++ b/app/code/Magento/Weee/composer.json
@@ -3,21 +3,21 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-catalog": "0.1.0-alpha103",
-        "magento/module-tax": "0.1.0-alpha103",
-        "magento/module-sales": "0.1.0-alpha103",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/module-directory": "0.1.0-alpha103",
-        "magento/module-core": "0.1.0-alpha103",
-        "magento/module-eav": "0.1.0-alpha103",
-        "magento/module-customer": "0.1.0-alpha103",
-        "magento/module-bundle": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-catalog": "0.1.0-alpha104",
+        "magento/module-tax": "0.1.0-alpha104",
+        "magento/module-sales": "0.1.0-alpha104",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/module-directory": "0.1.0-alpha104",
+        "magento/module-core": "0.1.0-alpha104",
+        "magento/module-eav": "0.1.0-alpha104",
+        "magento/module-customer": "0.1.0-alpha104",
+        "magento/module-bundle": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/Widget/composer.json b/app/code/Magento/Widget/composer.json
index 7e6a5e30b44a434d4c34346f74778e32274baf3a..4758d09cccf2d49d1a5e8d72aaf6a0fee0b5b8f6 100644
--- a/app/code/Magento/Widget/composer.json
+++ b/app/code/Magento/Widget/composer.json
@@ -3,16 +3,16 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-cms": "0.1.0-alpha103",
-        "magento/module-core": "0.1.0-alpha103",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/module-catalog": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-cms": "0.1.0-alpha104",
+        "magento/module-core": "0.1.0-alpha104",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/module-catalog": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/code/Magento/Wishlist/composer.json b/app/code/Magento/Wishlist/composer.json
index cd936a1bca3f9dfe93859e53703abde2715c5ef1..187737e677f4c0f8742088fdeabab7aa8dd6362e 100644
--- a/app/code/Magento/Wishlist/composer.json
+++ b/app/code/Magento/Wishlist/composer.json
@@ -3,25 +3,25 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/module-store": "0.1.0-alpha103",
-        "magento/module-customer": "0.1.0-alpha103",
-        "magento/module-catalog": "0.1.0-alpha103",
-        "magento/module-core": "0.1.0-alpha103",
-        "magento/module-checkout": "0.1.0-alpha103",
-        "magento/module-theme": "0.1.0-alpha103",
-        "magento/module-catalog-inventory": "0.1.0-alpha103",
-        "magento/module-rss": "0.1.0-alpha103",
-        "magento/module-backend": "0.1.0-alpha103",
-        "magento/module-bundle": "0.1.0-alpha103",
-        "magento/module-sales": "0.1.0-alpha103",
-        "magento/module-grouped-product": "0.1.0-alpha103",
-        "magento/module-configurable-product": "0.1.0-alpha103",
-        "magento/module-downloadable": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/module-store": "0.1.0-alpha104",
+        "magento/module-customer": "0.1.0-alpha104",
+        "magento/module-catalog": "0.1.0-alpha104",
+        "magento/module-core": "0.1.0-alpha104",
+        "magento/module-checkout": "0.1.0-alpha104",
+        "magento/module-theme": "0.1.0-alpha104",
+        "magento/module-catalog-inventory": "0.1.0-alpha104",
+        "magento/module-rss": "0.1.0-alpha104",
+        "magento/module-backend": "0.1.0-alpha104",
+        "magento/module-bundle": "0.1.0-alpha104",
+        "magento/module-sales": "0.1.0-alpha104",
+        "magento/module-grouped-product": "0.1.0-alpha104",
+        "magento/module-configurable-product": "0.1.0-alpha104",
+        "magento/module-downloadable": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-module",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/design/adminhtml/Magento/backend/composer.json b/app/design/adminhtml/Magento/backend/composer.json
index ef648d9f8788d250d68289e322e2069e2ebe6eb1..c54a869c01b17f617fbdc962512d5721f60236b4 100644
--- a/app/design/adminhtml/Magento/backend/composer.json
+++ b/app/design/adminhtml/Magento/backend/composer.json
@@ -3,11 +3,11 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-theme",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/design/adminhtml/Magento/backend/theme.xml b/app/design/adminhtml/Magento/backend/theme.xml
index 480251aaa9d559c716459dd16ee95a1aed305b30..d5d8a9cc4caa413e9f4df7ba4ff97dae606ac73a 100644
--- a/app/design/adminhtml/Magento/backend/theme.xml
+++ b/app/design/adminhtml/Magento/backend/theme.xml
@@ -24,5 +24,5 @@
 -->
 <theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Config/etc/theme.xsd">
     <title>Magento 2 backend</title>
-    <version>0.1.0-alpha103</version>
+    <version>0.1.0-alpha104</version>
 </theme>
diff --git a/app/design/frontend/Magento/blank/composer.json b/app/design/frontend/Magento/blank/composer.json
index 08082d03c50e0fae001ef8aae20b961917fd7db6..70060e31e297aa1473b5e123a01dc9948ddc5a42 100644
--- a/app/design/frontend/Magento/blank/composer.json
+++ b/app/design/frontend/Magento/blank/composer.json
@@ -3,11 +3,11 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-theme",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/design/frontend/Magento/blank/theme.xml b/app/design/frontend/Magento/blank/theme.xml
index 777b5718e97b5c0a55bd06dc82bcc2cb28a681f7..cef3f21f044549f5beb94c4987d27dacacbcab35 100644
--- a/app/design/frontend/Magento/blank/theme.xml
+++ b/app/design/frontend/Magento/blank/theme.xml
@@ -24,7 +24,7 @@
 -->
 <theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Config/etc/theme.xsd">
     <title>Magento Blank</title>
-    <version>0.1.0-alpha103</version>
+    <version>0.1.0-alpha104</version>
     <media>
         <preview_image>media/preview.jpg</preview_image>
     </media>
diff --git a/app/design/frontend/Magento/plushe/composer.json b/app/design/frontend/Magento/plushe/composer.json
index c261261089081e97384294959d3cdebd80abeee5..0d2af0efb65bceb686a8c3667e3b50cc3e5874bd 100644
--- a/app/design/frontend/Magento/plushe/composer.json
+++ b/app/design/frontend/Magento/plushe/composer.json
@@ -3,12 +3,12 @@
     "description": "N/A",
     "require": {
         "php": "~5.4.11|~5.5.0",
-        "magento/theme-frontend-blank": "0.1.0-alpha103",
-        "magento/framework": "0.1.0-alpha103",
+        "magento/theme-frontend-blank": "0.1.0-alpha104",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-theme",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "extra": {
         "map": [
             [
diff --git a/app/design/frontend/Magento/plushe/theme.xml b/app/design/frontend/Magento/plushe/theme.xml
index 2bafb85bb0e546bddc67c9317cea8fad1ad5f1f4..812501a26b5b99fcef4ce367a368ce7fc158c67d 100644
--- a/app/design/frontend/Magento/plushe/theme.xml
+++ b/app/design/frontend/Magento/plushe/theme.xml
@@ -24,7 +24,7 @@
 -->
 <theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Config/etc/theme.xsd">
     <title>Magento Plushe</title>
-    <version>0.1.0-alpha103</version>
+    <version>0.1.0-alpha104</version>
     <parent>Magento/blank</parent>
     <media>
         <preview_image>media/preview.jpg</preview_image>
diff --git a/app/etc/di.xml b/app/etc/di.xml
index e8440ff4a4b9c8363ff00772b20d302e00c6a1f7..c586ec91283b3f33b6b83c052c683e62b9842c06 100644
--- a/app/etc/di.xml
+++ b/app/etc/di.xml
@@ -102,7 +102,6 @@
     </type>
     <type name="Magento\Framework\Api\FilterBuilder" shared="false" />
     <type name="Magento\Framework\Api\SearchCriteriaBuilder" shared="false" />
-    <type name="Magento\Framework\Api\AttributeValueBuilder" shared="false" />
     <type name="Magento\Framework\View\Layout\Builder" shared="false" />
     <type name="Magento\Framework\View\Page\Builder" shared="false" />
     <type name="Magento\Framework\Message\Manager">
diff --git a/app/i18n/magento/de_de/composer.json b/app/i18n/magento/de_de/composer.json
index 04c5fa37ffb566ddaaa6e9a1559d7ff2c209e5e0..2f79ba8b3de7ce8247f70212bfb200a89804b4e2 100644
--- a/app/i18n/magento/de_de/composer.json
+++ b/app/i18n/magento/de_de/composer.json
@@ -1,9 +1,9 @@
 {
     "name": "magento/language-de_de",
     "description": "German (Germany) language",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "require": {
-        "magento/framework": "0.1.0-alpha103",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-language",
diff --git a/app/i18n/magento/en_us/composer.json b/app/i18n/magento/en_us/composer.json
index 2da87721ec06108df3d978fbf26e72e0a436614e..0bae8cff86b43d015943b1eb60bb9bdbb2b0f9ab 100644
--- a/app/i18n/magento/en_us/composer.json
+++ b/app/i18n/magento/en_us/composer.json
@@ -1,9 +1,9 @@
 {
     "name": "magento/language-en_us",
     "description": "English (United States) language",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "require": {
-        "magento/framework": "0.1.0-alpha103",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-language",
diff --git a/app/i18n/magento/es_es/composer.json b/app/i18n/magento/es_es/composer.json
index 2d4801b4d25cff6f444f931464f75255bbaa7b62..e8a1d9c61d9b144bd812c064f5346fbf5e910fc2 100644
--- a/app/i18n/magento/es_es/composer.json
+++ b/app/i18n/magento/es_es/composer.json
@@ -1,9 +1,9 @@
 {
     "name": "magento/language-es_es",
     "description": "Spanish (Spain) language",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "require": {
-        "magento/framework": "0.1.0-alpha103",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-language",
diff --git a/app/i18n/magento/fr_fr/composer.json b/app/i18n/magento/fr_fr/composer.json
index dbbea826ea6d3376d7edafb40f0ec57bf0d22757..023ce244a204001e2897e9c84a15b263b5da02a8 100644
--- a/app/i18n/magento/fr_fr/composer.json
+++ b/app/i18n/magento/fr_fr/composer.json
@@ -1,9 +1,9 @@
 {
     "name": "magento/language-fr_fr",
     "description": "French (France) language",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "require": {
-        "magento/framework": "0.1.0-alpha103",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-language",
diff --git a/app/i18n/magento/nl_nl/composer.json b/app/i18n/magento/nl_nl/composer.json
index 7e8220b3a6dfaba2c2e902fe5acddfd8ea13050f..2c56e12d9099194aad2afe1cf5167876e91d794d 100644
--- a/app/i18n/magento/nl_nl/composer.json
+++ b/app/i18n/magento/nl_nl/composer.json
@@ -1,9 +1,9 @@
 {
     "name": "magento/language-nl_nl",
     "description": "Dutch (Netherlands) language",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "require": {
-        "magento/framework": "0.1.0-alpha103",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-language",
diff --git a/app/i18n/magento/pt_br/composer.json b/app/i18n/magento/pt_br/composer.json
index ea16345b323a69cbea0b06c69addeec82e84ef08..2aec74a84a6decff20ed1c08a547935526882c7e 100644
--- a/app/i18n/magento/pt_br/composer.json
+++ b/app/i18n/magento/pt_br/composer.json
@@ -1,9 +1,9 @@
 {
     "name": "magento/language-pt_br",
     "description": "Portuguese (Brazil) language",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "require": {
-        "magento/framework": "0.1.0-alpha103",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-language",
diff --git a/app/i18n/magento/zh_cn/composer.json b/app/i18n/magento/zh_cn/composer.json
index 38e1cdcc023900114db8301b0fb933d9a160d50f..49e9b73e80c339dd50cdc4caa882c021b779dfd0 100644
--- a/app/i18n/magento/zh_cn/composer.json
+++ b/app/i18n/magento/zh_cn/composer.json
@@ -1,9 +1,9 @@
 {
     "name": "magento/language-zh_cn",
     "description": "Chinese (China) language",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "require": {
-        "magento/framework": "0.1.0-alpha103",
+        "magento/framework": "0.1.0-alpha104",
         "magento/magento-composer-installer": "*"
     },
     "type": "magento2-language",
diff --git a/composer.json b/composer.json
index 6e91b7b16ccb4e8bae3c011aac79418bdda43eab..5429b05db8f921ab78b6970cd41804ce677805e2 100644
--- a/composer.json
+++ b/composer.json
@@ -2,7 +2,7 @@
     "name": "magento/project-community-edition",
     "description": "Magento project (Community Edition)",
     "type": "project",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "require": {
         "php": "~5.4.11|~5.5.0",
         "zendframework/zend-stdlib": "2.0.3"
diff --git a/dev/tests/functional/lib/Mtf/Client/Driver/Selenium/Element/ConditionsElement.php b/dev/tests/functional/lib/Mtf/Client/Driver/Selenium/Element/ConditionsElement.php
index ad185157e020ddb5dd6d5c7f7d0eb686dc1f1f01..5175c113edc7f874ad3e8e77d263801289b81c9a 100644
--- a/dev/tests/functional/lib/Mtf/Client/Driver/Selenium/Element/ConditionsElement.php
+++ b/dev/tests/functional/lib/Mtf/Client/Driver/Selenium/Element/ConditionsElement.php
@@ -52,6 +52,8 @@ use Mtf\ObjectManager;
  *     [Subtotal|is|100]
  *     {Product attribute combination|NOT FOUND|ANY:[[Attribute Set|is|Default][Attribute Set|is|Default]]}
  * ]}
+ *
+ * @SuppressWarnings(PHPMD.TooManyFields)
  */
 class ConditionsElement extends AbstractElement
 {
@@ -178,6 +180,13 @@ class ConditionsElement extends AbstractElement
      */
     protected $chooserGridLocator = 'div[id*=chooser]';
 
+    /**
+     * Rule param input selector.
+     *
+     * @var string
+     */
+    protected $ruleParamInput = '.element [name^="rule[conditions]"]';
+
     /**
      * Set value to conditions
      *
@@ -247,6 +256,13 @@ class ConditionsElement extends AbstractElement
 
         $newCondition = $context->find($this->newCondition, Locator::SELECTOR_XPATH);
         $newCondition->find($this->addNew, Locator::SELECTOR_XPATH)->click();
+        $typeNew = $this->typeNew;
+        $newCondition->waitUntil(
+            function () use ($newCondition, $typeNew) {
+                $element = $newCondition->find($typeNew, Locator::SELECTOR_XPATH, 'select');
+                return $element->isVisible() ? true : null;
+            }
+        );
         $newCondition->find($this->typeNew, Locator::SELECTOR_XPATH, 'select')->setValue($condition['type']);
         $this->ruleParamWait();
 
@@ -282,7 +298,13 @@ class ConditionsElement extends AbstractElement
                 $grid->searchAndSelect([$chooserConfig[1] => $rule]);
                 continue;
             }
-
+            $input = $this->ruleParamInput;
+            $param->waitUntil(
+                function () use ($param, $input) {
+                    $element = $param->find($input);
+                    return $element->isVisible() ? true : null;
+                }
+            );
             $value = $param->find('select', Locator::SELECTOR_CSS, 'select');
             if ($value->isVisible()) {
                 $value->setValue($rule);
diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/Block/Catalog/Product/View.php b/dev/tests/functional/tests/app/Magento/Bundle/Test/Block/Catalog/Product/View.php
index 2b95d3fe47086cbb53fc58305b861d85184ef9e2..7a6dd546e3b08e2e918651962a58390e06c49901 100644
--- a/dev/tests/functional/tests/app/Magento/Bundle/Test/Block/Catalog/Product/View.php
+++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/Block/Catalog/Product/View.php
@@ -41,7 +41,7 @@ class View extends \Magento\Catalog\Test\Block\Product\View
      *
      * @var string
      */
-    protected $customizeButton = '.action.primary.customize';
+    protected $customizeButton = '.action.primary.customize span';
 
     /**
      * Bundle options block
diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertTierPriceOnBundleProductPage.php b/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertTierPriceOnBundleProductPage.php
index 1da8099492b0e23a445faf2c0e7be3e532d198c8..2e8991f6228cb406deed170a0649d3538e3fd4ee 100644
--- a/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertTierPriceOnBundleProductPage.php
+++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertTierPriceOnBundleProductPage.php
@@ -67,10 +67,10 @@ class AssertTierPriceOnBundleProductPage extends AssertProductTierPriceOnProduct
     {
         //Open product view page
         $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
-        $viewBlock = $catalogProductView->getViewBlock();
+        $viewBlock = $catalogProductView->getBundleViewBlock();
         $viewBlock->clickCustomize();
 
         //Process assertions
-        $this->assertPrice($product, $catalogProductView);
+        $this->assertPrice($product, $viewBlock);
     }
 }
diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/Page/Product/CatalogProductView.xml b/dev/tests/functional/tests/app/Magento/Bundle/Test/Page/Product/CatalogProductView.xml
index 470c1a0e668edc6fb79481fb7ee7ac8951bcc79c..5db58f896ee232cc359909b15a96ceca8de51ab2 100644
--- a/dev/tests/functional/tests/app/Magento/Bundle/Test/Page/Product/CatalogProductView.xml
+++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/Page/Product/CatalogProductView.xml
@@ -32,5 +32,10 @@
                 </bundle>
             </renders>
         </viewBlock>
+        <bundleViewBlock>
+            <class>Magento\Bundle\Test\Block\Catalog\Product\View</class>
+            <locator>#maincontent</locator>
+            <strategy>css selector</strategy>
+        </bundleViewBlock>
     </blocks>
 </page>
diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/BundleDynamicTest.php b/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/BundleDynamicTest.php
index 57103046af3697d87dc22217233bfc886171186f..eb34fb40c5bb45d005bff31675da246d05218033 100755
--- a/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/BundleDynamicTest.php
+++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/BundleDynamicTest.php
@@ -110,7 +110,7 @@ class BundleDynamicTest extends Functional
         $productListBlock = $categoryPage->getListProductBlock();
         $this->assertTrue(
             $productListBlock->isProductVisible($product->getName()),
-            'Product "' .  $product->getName() . '" is absent on category page'
+            'Product "' . $product->getName() . '" is absent on category page'
         );
         $productListBlock->openProductViewPage($product->getName());
         //Verification on product detail page
@@ -123,9 +123,8 @@ class BundleDynamicTest extends Functional
                 'price_to' => $productViewBlock->getPriceBlock()->getPriceTo()
             ]
         );
-
-        $actualOptions = $productPage->getViewBlock()->getOptions($product)['bundle_options'];
         $expectedOptions = $product->getBundleOptions();
+        $actualOptions = $productViewBlock->getOptions($product)['bundle_options'];
         foreach ($actualOptions as $key => $actualOption) {
             $this->assertContains($expectedOptions[$key]['title'], $actualOption);
         }
diff --git a/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/BundleFixedTest.php b/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/BundleFixedTest.php
index 26025de223c91d60e1843beb668d946339b96e12..c73f0f00befa761cca0e11a0decaa6e171c5b767 100755
--- a/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/BundleFixedTest.php
+++ b/dev/tests/functional/tests/app/Magento/Bundle/Test/TestCase/BundleFixedTest.php
@@ -120,9 +120,8 @@ class BundleFixedTest extends Functional
                 'price_to' => $productViewBlock->getPriceBlock()->getPriceTo()
             ]
         );
-
-        $actualOptions = $productPage->getViewBlock()->getOptions($product)['bundle_options'];
         $expectedOptions = $product->getBundleOptions();
+        $actualOptions = $productViewBlock->getOptions($product)['bundle_options'];
         foreach ($actualOptions as $key => $actualOption) {
             $this->assertContains($expectedOptions[$key]['title'], $actualOption);
         }
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Tab/ProductDetails/CategoryIds.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Tab/ProductDetails/CategoryIds.php
index 822ecf09c9445d979d29cf3746bb7b2612786b25..28c58e94127781ea92b303db47b4a8b8d730228c 100644
--- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Tab/ProductDetails/CategoryIds.php
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Tab/ProductDetails/CategoryIds.php
@@ -52,7 +52,7 @@ class CategoryIds extends MultisuggestElement
      *
      * @var string
      */
-    protected $top = './ancestor::body//form[@data-form="edit-product"]';
+    protected $top = './ancestor::body//*[@class="page-main-actions"]';
 
     /**
      * Set value
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Tab/ProductDetails/ProductOnlineSwitcher.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Tab/ProductDetails/ProductOnlineSwitcher.php
index c61f192582b14b3b013e72e19e2d884386cec5a7..dd80ac49d838f74a51c4814e18ac9cd6a4e41fa0 100644
--- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Tab/ProductDetails/ProductOnlineSwitcher.php
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Tab/ProductDetails/ProductOnlineSwitcher.php
@@ -25,6 +25,7 @@
 namespace Magento\Catalog\Test\Block\Adminhtml\Product\Edit\Tab\ProductDetails;
 
 use Mtf\Client\Driver\Selenium\Element;
+use Mtf\Client\Element\Locator;
 
 /**
  * Class ProductOnlineSwitcher
@@ -39,6 +40,13 @@ class ProductOnlineSwitcher extends Element
      */
     protected $onlineSwitcher = '#product-online-switcher%s + [for="product-online-switcher"]';
 
+    /**
+     * Selector for top page click.
+     *
+     * @var string
+     */
+    protected $topPage = './ancestor::body//*[@class="page-main-actions"]';
+
     /**
      * Set value
      *
@@ -56,6 +64,7 @@ class ProductOnlineSwitcher extends Element
                 && $this->find(sprintf($this->onlineSwitcher, ':not(:checked)'))->isVisible()
             )
         ) {
+            $this->find($this->topPage, Locator::SELECTOR_XPATH)->click();
             $this->find(sprintf($this->onlineSwitcher, ''))->click();
         }
     }
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Category/View.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Category/View.php
index b056a546fb3ca27d7c18243844391d7f8ac4c70d..976a8e13c968a498fdd655bd952baf85cc3075fd 100755
--- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Category/View.php
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Category/View.php
@@ -25,6 +25,8 @@
 namespace Magento\Catalog\Test\Block\Category;
 
 use Mtf\Block\Block;
+use Mtf\Client\Element\Locator;
+use Magento\Widget\Test\Fixture\Widget;
 
 /**
  * Class View
@@ -32,6 +34,13 @@ use Mtf\Block\Block;
  */
 class View extends Block
 {
+    /**
+     * Recently Viewed Products selectors
+     *
+     * @var string
+     */
+    protected $recentlyViewedProducts = './/*[contains(@class,"widget")]//strong[@class="product-item-name"]';
+
     /**
      * Description CSS selector
      *
@@ -39,6 +48,13 @@ class View extends Block
      */
     protected $description = '.category-description';
 
+    /**
+     * Locator for category content
+     *
+     * @var string
+     */
+    protected $content = '.category-cms';
+
     /**
      * Get description
      *
@@ -56,6 +72,23 @@ class View extends Block
      */
     public function getContent()
     {
-        return $this->_rootElement->getText();
+        return $this->_rootElement->find($this->content)->getText();
+    }
+
+    /**
+     * Get products from Recently Viewed block
+     *
+     * @return array
+     */
+    public function getProductsFromRecentlyViewedBlock()
+    {
+        $products = [];
+        $this->waitForElementVisible($this->recentlyViewedProducts, Locator::SELECTOR_XPATH);
+        $productNames = $this->_rootElement->find($this->recentlyViewedProducts, Locator::SELECTOR_XPATH)
+            ->getElements();
+        foreach ($productNames as $productName) {
+            $products[] = $productName->getText();
+        }
+        return $products;
     }
 }
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Category/CatalogCategoryView.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Category/CatalogCategoryView.xml
index bc2fd6057cd6a4a523fcdf821359a3df10b9fbaa..f98b1418d44f0c5348b82c077be2c560ce76ae86 100644
--- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Category/CatalogCategoryView.xml
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Category/CatalogCategoryView.xml
@@ -60,5 +60,10 @@
             <locator>#maincontent</locator>
             <strategy>css selector</strategy>
         </viewBlock>
+        <widgetView>
+            <class>Magento\Widget\Test\Block\WidgetView</class>
+            <locator>.widget</locator>
+            <strategy>css selector</strategy>
+        </widgetView>
     </blocks>
 </page>
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Product/CatalogProductCompare.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Product/CatalogProductCompare.xml
index 84b218a68816f1c6eb0ce323f2ac4876198e9ed8..89772195b7d9e69d9e2db9781e8d6ead0f40e1a2 100644
--- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Product/CatalogProductCompare.xml
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Product/CatalogProductCompare.xml
@@ -35,5 +35,10 @@
             <locator>.page.messages .messages</locator>
             <strategy>css selector</strategy>
         </messagesBlock>
+        <widgetView>
+            <class>Magento\Widget\Test\Block\WidgetView</class>
+            <locator>.column.main .widget</locator>
+            <strategy>css selector</strategy>
+        </widgetView>
     </blocks>
 </page>
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Product/CatalogProductView.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Product/CatalogProductView.xml
index 53b581d68cb2e369071e474c8ab23ae5f6ca01ef..3c4c81657aed0fe39aba7e35c1ba8ba306ed3913 100755
--- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Product/CatalogProductView.xml
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Page/Product/CatalogProductView.xml
@@ -85,5 +85,10 @@
             <locator>.page-title h1.title .base</locator>
             <strategy>css selector</strategy>
         </titleBlock>
+        <widgetView>
+            <class>Magento\Widget\Test\Block\WidgetView</class>
+            <locator>.column.main .widget</locator>
+            <strategy>css selector</strategy>
+        </widgetView>
     </blocks>
 </page>
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple.php
index 701b6b754862d1992bc9bb45adda670eb6a773a5..e46a8edc14b20c7506b8fafefbade29cef0a4a94 100755
--- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple.php
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple.php
@@ -27,8 +27,7 @@ namespace Magento\Catalog\Test\Repository;
 use Mtf\Repository\AbstractRepository;
 
 /**
- * Class CatalogProductSimple
- * Data for creation Catalog Product Simple
+ * Data for creation Catalog Product Simple.
  */
 class CatalogProductSimple extends AbstractRepository
 {
@@ -220,7 +219,7 @@ class CatalogProductSimple extends AbstractRepository
         ];
 
         $this->_data['adc_123_simple_for_advancedsearch'] = [
-            'name' => 'adc_123',
+            'name' => 'adc_123_%isolation%',
             'sku' => 'adc_123',
             'price' => ['value' => 100.00, 'preset' => '-'],
             'tax_class_id' => ['dataSet' => 'None'],
@@ -268,7 +267,7 @@ class CatalogProductSimple extends AbstractRepository
         ];
 
         $this->_data['abc_dfj_simple_for_advancedsearch'] = [
-            'name' => 'abc_dfj',
+            'name' => 'abc_dfj_%isolation%',
             'sku' => 'abc_dfj',
             'price' => ['value' => 50.00, 'preset' => '-'],
             'tax_class_id' => ['dataSet' => 'Taxable Goods'],
diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Handler/CatalogSearchQuery/Curl.php b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Handler/CatalogSearchQuery/Curl.php
index 94b3ec11621c0fb58f0a09c13d9f34fb50ecd0a3..8b76fd0bc481c7f3d108dc40f86a9e9d51caecc8 100644
--- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Handler/CatalogSearchQuery/Curl.php
+++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Handler/CatalogSearchQuery/Curl.php
@@ -32,8 +32,7 @@ use Mtf\Util\Protocol\CurlTransport\BackendDecorator;
 use Mtf\Handler\Curl as AbstractCurl;
 
 /**
- * Class Curl
- * Create new search term via curl
+ * Create new search term via curl.
  */
 class Curl extends AbstractCurl implements CatalogSearchQueryInterface
 {
@@ -51,6 +50,13 @@ class Curl extends AbstractCurl implements CatalogSearchQueryInterface
         ]
     ];
 
+    /**
+     * Search term url.
+     *
+     * @var string
+     */
+    protected $url = 'search/term/';
+
     /**
      * Post request for creating search term
      *
@@ -67,13 +73,13 @@ class Curl extends AbstractCurl implements CatalogSearchQueryInterface
     }
 
     /**
-     * Add new search term
+     * Add new search term.
      *
      * @param array $data
      */
     protected function addNewSearchTerm(array $data)
     {
-        $url = $_ENV['app_backend_url'] . 'catalog/search/save';
+        $url = $_ENV['app_backend_url'] . $this->url . 'save';
         $curl = new BackendDecorator(new CurlTransport(), new Config);
         $curl->write(CurlInterface::POST, $url, '1.0', [], $data);
         $curl->read();
@@ -81,7 +87,7 @@ class Curl extends AbstractCurl implements CatalogSearchQueryInterface
     }
 
     /**
-     * Getting search term id
+     * Getting search term id.
      *
      * @param string $queryText
      * @return int
@@ -90,13 +96,13 @@ class Curl extends AbstractCurl implements CatalogSearchQueryInterface
     protected function getNewSearchTermId($queryText)
     {
         $filter = base64_encode('search_query=' . $queryText);
-        $url = $_ENV['app_backend_url'] . 'catalog/search/index/filter/' . $filter;
+        $url = $_ENV['app_backend_url'] . $this->url . 'index/filter/' . $filter;
         $curl = new BackendDecorator(new CurlTransport(), new Config);
         $curl->write(CurlInterface::GET, $url, '1.0');
         $response = $curl->read();
         $curl->close();
 
-        if (!preg_match('#search/edit/id/(\d+)/"#', $response, $matches)) {
+        if (!preg_match('#' . $this->url . 'edit/id/(\d+)/"#', $response, $matches)) {
             throw new \Exception('Search term not found in grid!');
         }
 
diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/Adminhtml/CatalogSearchEdit.xml b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/Adminhtml/CatalogSearchEdit.xml
index 321aea4d757b3c53d40f209872aee410742ae592..16e72e509a3acb9685bf137ca246012d9a5bb268 100644
--- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/Adminhtml/CatalogSearchEdit.xml
+++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/Adminhtml/CatalogSearchEdit.xml
@@ -23,7 +23,7 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 -->
-<page mca="catalog/search/edit" module="Magento_CatalogSearch">
+<page mca="search/term/edit" module="Magento_CatalogSearch">
     <blocks>
         <form>
             <class>Magento\CatalogSearch\Test\Block\Adminhtml\Edit\SearchTermForm</class>
diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/Adminhtml/CatalogSearchIndex.xml b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/Adminhtml/CatalogSearchIndex.xml
index 7821a3be4eee3a78afe60c93a5eb6e0bf49f9330..9fb7a875ab2e07dd1a49aa8b58e321eaeb733923 100644
--- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/Adminhtml/CatalogSearchIndex.xml
+++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/Adminhtml/CatalogSearchIndex.xml
@@ -23,11 +23,11 @@
  * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
  */
 -->
-<page mca="catalog/search/index" module="Magento_CatalogSearch">
+<page mca="search/term" module="Magento_CatalogSearch">
     <blocks>
         <grid>
             <class>Magento\CatalogSearch\Test\Block\Adminhtml\Grid</class>
-            <locator>#catalog_search_grid</locator>
+            <locator>#search_term_grid</locator>
             <strategy>css selector</strategy>
         </grid>
         <gridPageActions>
diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/AdvancedSearch.xml b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/AdvancedSearch.xml
index 11b296b264bdb2e7af98360fca815894a480a2e3..548e9aaec7c28822104b5381951a92f4762c1358 100644
--- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/AdvancedSearch.xml
+++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/Page/AdvancedSearch.xml
@@ -30,5 +30,10 @@
             <locator>.form.search.advanced</locator>
             <strategy>css selector</strategy>
         </form>
+        <widgetView>
+            <class>Magento\Widget\Test\Block\WidgetView</class>
+            <locator>.widget</locator>
+            <strategy>css selector</strategy>
+        </widgetView>
     </blocks>
 </page>
diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/AdvancedSearchEntityTest.php b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/AdvancedSearchEntityTest.php
index 5e2861cf2fce68f73291390dc986d53f896eb162..887e6b67b1fc6caefd3c0543ce5f0795517feb1a 100644
--- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/AdvancedSearchEntityTest.php
+++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/AdvancedSearchEntityTest.php
@@ -31,8 +31,6 @@ use Magento\CatalogSearch\Test\Page\AdvancedSearch;
 use Magento\Catalog\Test\Fixture\CatalogProductSimple;
 
 /**
- * Test Creation for AdvancedSearchEntity
- *
  * Test Flow:
  * Preconditions:
  * 1. Two specific simple product is created(unique sku,name,short/full description, tax class)
@@ -90,7 +88,7 @@ class AdvancedSearchEntityTest extends Injectable
      *
      * @SuppressWarnings(PHPMD.UnusedFormalParameter)
      */
-    public function testSearch(
+    public function test(
         array $products,
         CatalogProductSimple $productSearch,
         CmsIndex $cmsIndex,
diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/AdvancedSearchEntityTest/testSearch.csv b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/AdvancedSearchEntityTest/test.csv
similarity index 77%
rename from dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/AdvancedSearchEntityTest/testSearch.csv
rename to dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/AdvancedSearchEntityTest/test.csv
index c48e64424e4d622de0f0bd6df6074cb5b341d719..25bbad9bcc99f8a781a523abd6de1b1c54688999 100644
--- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/AdvancedSearchEntityTest/testSearch.csv
+++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/AdvancedSearchEntityTest/test.csv
@@ -1,13 +1,13 @@
-"products/simple_1";"products/simple_2";"productSearch/data/name";"productSearch/data/sku";"productSearch/data/description";"productSearch/data/short_description";"productSearch/data/price/value/price_from";"productSearch/data/price/value/price_to";"constraint"
-"Yes";"-";"abc_dfj";"abc_dfj";"adc_Full";"abc_short";49;500;"assertAdvancedSearchProductsResult"
-"Yes";"-";"abc";"-";"-";"-";"-";"-";"assertAdvancedSearchProductsResult"
-"-";"Yes";"adc_123";"-";"-";"-";"-";"-";"assertAdvancedSearchProductsResult"
-"Yes";"-";"-";"abc";"-";"-";"-";"-";"assertAdvancedSearchProductsResult"
-"Yes";"-";"-";"abc_dfj";"-";"-";"-";"-";"assertAdvancedSearchProductsResult"
-"Yes";"-";"-";"abc";"full";"-";"-";"-";"assertAdvancedSearchProductsResult"
-"-";"Yes";"-";"-";"dfj_full";"-";"-";"-";"assertAdvancedSearchProductsResult"
-"Yes";"-";"-";"-";"-";"short";"-";"-";"assertAdvancedSearchProductsResult"
-"-";"-";"-";"-";"-";"dfj_short";"-";"-";"assertAdvancedSearchProductsResult"
-"Yes";"-";"-";"-";"-";"-";50;50;"assertAdvancedSearchProductsResult"
-"Yes";"Yes";"-";"-";"-";"-";"-";100;"assertAdvancedSearchProductsResult"
-"Yes";"-";"abc_dfj";"abc_dfj";"adc_Full";"abc_short";49;50;"assertAdvancedSearchProductsResult"
+"products/simple_1";"products/simple_2";"productSearch/data/name";"productSearch/data/sku";"productSearch/data/description";"productSearch/data/short_description";"productSearch/data/price/value/price_from";"productSearch/data/price/value/price_to";"constraint";"issue"
+"Yes";"-";"abc_dfj";"abc_dfj";"adc_Full";"abc_short";49;500;"assertAdvancedSearchProductsResult";""
+"Yes";"-";"abc";"-";"-";"-";"-";"-";"assertAdvancedSearchProductsResult";"MAGETWO-30318"
+"-";"Yes";"adc_123";"-";"-";"-";"-";"-";"assertAdvancedSearchProductsResult";""
+"Yes";"-";"-";"abc";"-";"-";"-";"-";"assertAdvancedSearchProductsResult";""
+"Yes";"-";"-";"abc_dfj";"-";"-";"-";"-";"assertAdvancedSearchProductsResult";""
+"Yes";"-";"-";"abc";"full";"-";"-";"-";"assertAdvancedSearchProductsResult";"MAGETWO-30318"
+"-";"Yes";"-";"-";"dfj_full";"-";"-";"-";"assertAdvancedSearchProductsResult";""
+"Yes";"-";"-";"-";"-";"short";"-";"-";"assertAdvancedSearchProductsResult";"MAGETWO-30318"
+"-";"-";"-";"-";"-";"dfj_short";"-";"-";"assertAdvancedSearchProductsResult";""
+"Yes";"-";"-";"-";"-";"-";50;50;"assertAdvancedSearchProductsResult";"MAGETWO-30318"
+"Yes";"Yes";"-";"-";"-";"-";"-";100;"assertAdvancedSearchProductsResult";"MAGETWO-30318"
+"Yes";"-";"abc_dfj";"abc_dfj";"adc_Full";"abc_short";49;50;"assertAdvancedSearchProductsResult";"MAGETWO-30318"
diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/EditSearchTermEntityTest/test.csv b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/EditSearchTermEntityTest/test.csv
index 28764fb922a2796f412131a71be1b6ff47881f7b..c7e90bce0d3bef7bda24cd75e88468fc6ccb7789 100644
--- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/EditSearchTermEntityTest/test.csv
+++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/TestCase/EditSearchTermEntityTest/test.csv
@@ -1,2 +1,2 @@
 "searchTerm/data/query_text/value";"searchTerm/data/store_id";"searchTerm/data/num_results";"searchTerm/data/popularity";"searchTerm/data/synonym_for";"searchTerm/data/redirect";"searchTerm/data/display_in_terms";"constraint"
-"catalogProductSimple::getSku";"Main Website/Main Website Store/Default Store View";1;20;"simple";"http://example.com/";"No";"assertSearchTermSuccessSaveMessage, assertSearchTermForm, assertSearchTermInGrid, assertSearchTermOnFrontend"
+"catalogProductSimple::getSku";"Main Website/Main Website Store/Default Store View";1;20;"simple%isolation%";"http://example.com/";"No";"assertSearchTermSuccessSaveMessage, assertSearchTermForm, assertSearchTermInGrid, assertSearchTermOnFrontend"
diff --git a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/etc/page.xml b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/etc/page.xml
index f29d5cfa1127342903ec23730b9bd442c81b7c72..15e18c204aec30e5f578c7d67936da1bbc6fec2a 100644
--- a/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/etc/page.xml
+++ b/dev/tests/functional/tests/app/Magento/CatalogSearch/Test/etc/page.xml
@@ -30,12 +30,12 @@
     </catalogsearchResult>
     <catalogSearchIndex>
         <area>adminhtml</area>
-        <mca>catalog/search/index</mca>
+        <mca>search/term</mca>
         <class>Magento\CatalogSearch\Test\Page\Adminhtml\CatalogSearchIndex</class>
     </catalogSearchIndex>
     <catalogSearchEdit>
         <area>adminhtml</area>
-        <mca>catalog/search/edit</mca>
+        <mca>search/term/edit</mca>
         <class>Magento\CatalogSearch\Test\Page\Adminhtml\CatalogSearchEdit</class>
     </catalogSearchEdit>
 </page>
diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/etc/fixture.xml b/dev/tests/functional/tests/app/Magento/Checkout/Test/etc/fixture.xml
index a1a7c4ff0e0e2d983ff08927fc10d68c7d94829e..7ea1e3ed913043e2d4aa013a279892274257f531 100644
--- a/dev/tests/functional/tests/app/Magento/Checkout/Test/etc/fixture.xml
+++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/etc/fixture.xml
@@ -26,7 +26,7 @@
 <fixture>
     <cart module="Magento_Checkout">
         <type>flat</type>
-        <entity_type>sales_flat_quote</entity_type>
+        <entity_type>sales_quote</entity_type>
         <collection>Magento\Checkout\Model\Resource\Cart</collection>
     </cart>
 </fixture>
diff --git a/dev/tests/functional/tests/app/Magento/Cms/Test/Page/CmsIndex.xml b/dev/tests/functional/tests/app/Magento/Cms/Test/Page/CmsIndex.xml
index 9fa7731d6c2072322352095df3d950cd04f237aa..cbdec15ecfa42b72d36e5e0f7ebdf24f88c0c148 100644
--- a/dev/tests/functional/tests/app/Magento/Cms/Test/Page/CmsIndex.xml
+++ b/dev/tests/functional/tests/app/Magento/Cms/Test/Page/CmsIndex.xml
@@ -75,5 +75,10 @@
             <locator>.page.main</locator>
             <strategy>css selector</strategy>
         </cmsPageBlock>
+        <widgetView>
+            <class>Magento\Widget\Test\Block\WidgetView</class>
+            <locator>.widget</locator>
+            <strategy>css selector</strategy>
+        </widgetView>
     </blocks>
 </page>
diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertConfigurableAttributesAbsentOnProductPage.php b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertConfigurableAttributesAbsentOnProductPage.php
index 6f80540e34cc6d696140724d228b4fb7d78ef9be..66d3da9432b418216d882567b63e96ca826485c5 100644
--- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertConfigurableAttributesAbsentOnProductPage.php
+++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertConfigurableAttributesAbsentOnProductPage.php
@@ -31,7 +31,7 @@ use Mtf\Constraint\AbstractConstraint;
 use Mtf\Client\Browser;
 
 /**
- * Assert that deleted products attributes are absent on product page on frontend.
+ * Assert that deleted configurable attributes are absent on product page on frontend.
  */
 class AssertConfigurableAttributesAbsentOnProductPage extends AbstractConstraint
 {
@@ -43,7 +43,7 @@ class AssertConfigurableAttributesAbsentOnProductPage extends AbstractConstraint
     protected $severeness = 'low';
 
     /**
-     * Assert that deleted products attributes are absent on product page on frontend.
+     * Assert that deleted configurable attributes are absent on product page on frontend.
      *
      * @param CatalogProductAttribute[] $deletedProductAttributes
      * @param Browser $browser
@@ -64,7 +64,7 @@ class AssertConfigurableAttributesAbsentOnProductPage extends AbstractConstraint
             $attributeLabel = $attribute->getFrontendLabel();
             \PHPUnit_Framework_Assert::assertFalse(
                 isset($pageOptions[$attributeLabel]),
-                "Product attribute '$attributeLabel' found on product page on frontend."
+                "Configurable attribute '$attributeLabel' found on product page on frontend."
             );
         }
     }
@@ -76,6 +76,6 @@ class AssertConfigurableAttributesAbsentOnProductPage extends AbstractConstraint
      */
     public function toString()
     {
-        return "Product attributes are absent on product page on frontend.";
+        return "Configurable attributes are absent on product page on frontend.";
     }
 }
diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertConfigurableAttributesBlockIsAbsentOnProductPage.php b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertConfigurableAttributesBlockIsAbsentOnProductPage.php
index 5b89b2d82e7834ee141c2e197a01096e7727469f..65194e6d4aad8552012d5a665d1cf9f5dc2189dc 100644
--- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertConfigurableAttributesBlockIsAbsentOnProductPage.php
+++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertConfigurableAttributesBlockIsAbsentOnProductPage.php
@@ -42,7 +42,7 @@ class AssertConfigurableAttributesBlockIsAbsentOnProductPage extends AbstractCon
     protected $severeness = 'low';
 
     /**
-     * Assert that all products attributes is absent on product page on frontend.
+     * Assert that all configurable attributes is absent on product page on frontend.
      *
      * @param Browser $browser
      * @param CatalogProductView $catalogProductView
@@ -57,7 +57,7 @@ class AssertConfigurableAttributesBlockIsAbsentOnProductPage extends AbstractCon
         $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
         \PHPUnit_Framework_Assert::assertFalse(
             $catalogProductView->getConfigurableAttributesBlock()->isVisible(),
-            "Product attributes are present on product page on frontend."
+            "Configurable attributes are present on product page on frontend."
         );
     }
 
@@ -68,6 +68,6 @@ class AssertConfigurableAttributesBlockIsAbsentOnProductPage extends AbstractCon
      */
     public function toString()
     {
-        return "All product attributes are absent on product page on frontend.";
+        return "All configurable attributes are absent on product page on frontend.";
     }
 }
diff --git a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertConfigurableProductForm.php b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertConfigurableProductForm.php
index cd507b550ae6fcaebab6ae1e4144845dbdeca50d..d5ac176b9e7ddbece7c216fa8db7999a06b741fa 100755
--- a/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertConfigurableProductForm.php
+++ b/dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Constraint/AssertConfigurableProductForm.php
@@ -66,6 +66,11 @@ class AssertConfigurableProductForm extends AssertProductForm
         'is_default',
     ];
 
+    /**
+     * Skipped variation matrix field.
+     *
+     * @var array
+     */
     protected $skippedVariationMatrixFields = [
         'configurable_attribute'
     ];
diff --git a/dev/tests/functional/tests/app/Magento/Core/Test/TestStep/SetupConfigurationStep.php b/dev/tests/functional/tests/app/Magento/Core/Test/TestStep/SetupConfigurationStep.php
index 1986caa81afa66766f5e5691ece89e3171de235a..20a3f387be4169a81330dad62187744930fe3c7c 100644
--- a/dev/tests/functional/tests/app/Magento/Core/Test/TestStep/SetupConfigurationStep.php
+++ b/dev/tests/functional/tests/app/Magento/Core/Test/TestStep/SetupConfigurationStep.php
@@ -86,9 +86,10 @@ class SetupConfigurationStep implements TestStepInterface
 
         foreach ($configData as $configDataSet) {
             $config = $this->fixtureFactory->createByCode('configData', ['dataSet' => $configDataSet . $prefix]);
-            $config->persist();
-
-            $result[] = $config;
+            if ($config->hasData('section')) {
+                $config->persist();
+                $result[] = $config;
+            }
         }
 
         return ['config' => $result];
diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Address/Renderer.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Address/Renderer.php
index b379af48b64756ace50c40adef8267d4151eb982..b454ded90eb1f7f05d5c6ade87d8359a590457cf 100644
--- a/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Address/Renderer.php
+++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Address/Renderer.php
@@ -27,26 +27,26 @@ namespace Magento\Customer\Test\Block\Address;
 use Magento\Customer\Test\Fixture\AddressInjectable;
 
 /**
- * Class Renderer
- * Render output from AddressInjectable fixture according to data format type
+ * Render output from AddressInjectable fixture according to data format type.
  */
 class Renderer
 {
     /**
-     * Address format type
+     * Address format type.
      *
      * @var string
      */
     protected $type;
 
     /**
-     * AddressInjectable fixture
+     * AddressInjectable fixture.
      *
      * @var AddressInjectable
      */
     protected $address;
 
     /**
+     * @constructor
      * @param AddressInjectable $address
      * @param string $type
      */
@@ -57,7 +57,7 @@ class Renderer
     }
 
     /**
-     * Returns pattern according to address type
+     * Returns pattern according to address type.
      *
      * @return string
      */
@@ -65,6 +65,12 @@ class Renderer
     {
         $region = $this->resolveRegion();
         switch ($this->type) {
+            case "html":
+                $outputPattern = "{{depend}}{{prefix}} {{/depend}}{{firstname}} {{depend}}{{middlename}} {{/depend}}"
+                    . "{{lastname}}{{depend}} {{suffix}}{{/depend}}\n{{depend}}{{company}}\n{{/depend}}{{street}}\n"
+                    . "{{city}}, {{{$region}}}, {{postcode}}\n{{country_id}}\n{{depend}}T: {{telephone}}{{/depend}}"
+                    . "{{depend}}\nF: {{fax}}{{/depend}}{{depend}}\nVAT: {{vat_id}}{{/depend}}";
+                break;
             case "oneline":
             default:
                 $outputPattern = "{{depend}}{{prefix}} {{/depend}}{{firstname}} {{depend}}{{middlename}} {{/depend}}"
@@ -76,7 +82,7 @@ class Renderer
     }
 
     /**
-     * Render address according to format type
+     * Render address according to format type.
      *
      * @return string
      */
@@ -85,18 +91,18 @@ class Renderer
         $outputPattern = $this->getPattern();
         $fields = $this->getFieldsArray($outputPattern);
         $output = $this->preparePattern();
+        $output = str_replace(['{{depend}}', '{{/depend}}', '{', '}'], '', $output);
 
         foreach ($fields as $field) {
             $data = $this->address->getData($field);
             $output = str_replace($field, $data, $output);
         }
 
-        $output = str_replace(['{', '}'], '', $output);
         return $output;
     }
 
     /**
-     * Get an array of necessary fields from pattern
+     * Get an array of necessary fields from pattern.
      *
      * @param string $outputPattern
      * @return mixed
@@ -114,14 +120,14 @@ class Renderer
     }
 
     /**
-     * Purge fields from pattern which are not present in fixture
+     * Purge fields from pattern which are not present in fixture.
      *
      * @return string
      */
     protected function preparePattern()
     {
         $outputPattern = $this->getPattern();
-        preg_match_all('@\{\{depend\}\}(.*?)\{\{.depend\}\}@', $outputPattern, $matches);
+        preg_match_all('@\{\{depend\}\}(.*?)\{\{.depend\}\}@siu', $outputPattern, $matches);
         foreach ($matches[1] as $key => $dependPart) {
             preg_match_all('@\{\{(\w+)\}\}@', $dependPart, $depends);
             foreach ($depends[1] as $depend) {
@@ -134,7 +140,7 @@ class Renderer
     }
 
     /**
-     * Check necessary field to retrieve according to address country
+     * Check necessary field to retrieve according to address country.
      *
      * @return string
      */
diff --git a/dev/tests/functional/tests/app/Magento/Downloadable/Test/Fixture/DownloadableProductInjectable/CheckoutData.php b/dev/tests/functional/tests/app/Magento/Downloadable/Test/Fixture/DownloadableProductInjectable/CheckoutData.php
index f9b743f4eed2187f2b903b0662c500e95476a8e4..4852b1a13ca225e46bfdee7562684def4e3bfb11 100644
--- a/dev/tests/functional/tests/app/Magento/Downloadable/Test/Fixture/DownloadableProductInjectable/CheckoutData.php
+++ b/dev/tests/functional/tests/app/Magento/Downloadable/Test/Fixture/DownloadableProductInjectable/CheckoutData.php
@@ -70,6 +70,16 @@ class CheckoutData extends \Magento\Catalog\Test\Fixture\CatalogProductSimple\Ch
                     'subtotal' => 22.43
                 ]
             ],
+            'default' => [
+                'options' => [
+                    'links' => [
+                        [
+                            'label' => 'link_1',
+                            'value' => 'Yes'
+                        ]
+                    ],
+                ]
+            ],
         ];
         return isset($presets[$name]) ? $presets[$name] : [];
     }
diff --git a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Constraint/AssertGroupedProductInItemsOrderedGrid.php b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Constraint/AssertGroupedProductInItemsOrderedGrid.php
index 5b940aef244af6c6c56ea703ed8c591968e3b868..729d0c845765f4cbe13fb26b4370588fe48b8f07 100644
--- a/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Constraint/AssertGroupedProductInItemsOrderedGrid.php
+++ b/dev/tests/functional/tests/app/Magento/GroupedProduct/Test/Constraint/AssertGroupedProductInItemsOrderedGrid.php
@@ -59,16 +59,16 @@ class AssertGroupedProductInItemsOrderedGrid extends AbstractConstraint
      * Assert product was added to Items Ordered grid in customer account on Order creation page backend
      *
      * @param OrderCreateIndex $orderCreateIndex
-     * @param array $entityData
+     * @param array $products
      * @throws \Exception
      * @return void
      */
-    public function processAssert(OrderCreateIndex $orderCreateIndex, array $entityData)
+    public function processAssert(OrderCreateIndex $orderCreateIndex, array $products)
     {
-        if (!isset($entityData['products'])) {
+        if (empty($products)) {
             throw new \Exception("No products");
         }
-        $data = $this->prepareData($entityData, $orderCreateIndex->getCreateBlock()->getItemsBlock());
+        $data = $this->prepareData($products, $orderCreateIndex->getCreateBlock()->getItemsBlock());
 
         \PHPUnit_Framework_Assert::assertEquals(
             $data['fixtureData'],
@@ -87,7 +87,7 @@ class AssertGroupedProductInItemsOrderedGrid extends AbstractConstraint
     protected function prepareData(array $data, Items $itemsBlock)
     {
         $fixtureData = [];
-        foreach ($data['products'] as $product) {
+        foreach ($data as $product) {
             $products = $product->getAssociated()['products'];
             foreach ($products as $key => $value) {
                 $fixtureData[$key]['name'] = $value->getName();
diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/Block/Customer/Wishlist/Items/Product.php b/dev/tests/functional/tests/app/Magento/Wishlist/Test/Block/Customer/Wishlist/Items/Product.php
index 7e148cb713012fc0f1739bc038c29828304b50b2..a998c4bbfb6c63f6235053a34ea81e05ca04779d 100644
--- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/Block/Customer/Wishlist/Items/Product.php
+++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/Block/Customer/Wishlist/Items/Product.php
@@ -25,6 +25,7 @@
 namespace Magento\Wishlist\Test\Block\Customer\Wishlist\Items;
 
 use Mtf\Block\Form;
+use Mtf\Client\Element\Locator;
 
 /**
  * Class Product
@@ -53,6 +54,13 @@ class Product extends Form
      */
     protected $viewDetails = '.details.tooltip';
 
+    /**
+     * Selector for 'Details block' element
+     *
+     * @var string
+     */
+    protected $detailsBlock = '.product-item-tooltip';
+
     /**
      * Edit button css selector
      *
@@ -74,6 +82,13 @@ class Product extends Form
      */
     protected $optionValue = '.tooltip.content .values';
 
+    /**
+     * Selector for click on footer block
+     *
+     * @var string
+     */
+    protected $footer = './ancestor::body//footer';
+
     /**
      * Fill item product details
      *
@@ -115,11 +130,15 @@ class Product extends Form
     {
         $viewDetails = $this->_rootElement->find($this->viewDetails);
         if ($viewDetails->isVisible()) {
+            $this->_rootElement->find($this->footer, Locator::SELECTOR_XPATH)->click();
             $viewDetails->click();
             $labels = $this->_rootElement->find($this->optionLabel)->getElements();
             $values = $this->_rootElement->find($this->optionValue)->getElements();
             $data = [];
             foreach ($labels as $key => $label) {
+                if (!$label->isVisible()) {
+                    $viewDetails->click();
+                }
                 $data[] = [
                     'title' => $label->getText(),
                     'value' => str_replace('$', '', $values[$key]->getText())
diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/Constraint/AssertProductDetailsInWishlist.php b/dev/tests/functional/tests/app/Magento/Wishlist/Test/Constraint/AssertProductDetailsInWishlist.php
index 2180f8cceb363a537b6b9858b54c3e785f4d388d..9098a4268304296145c0db7bf6dfec15376a4da4 100644
--- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/Constraint/AssertProductDetailsInWishlist.php
+++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/Constraint/AssertProductDetailsInWishlist.php
@@ -24,7 +24,7 @@
 
 namespace Magento\Wishlist\Test\Constraint;
 
-use Mtf\Constraint\AbstractConstraint;
+use Mtf\Constraint\AbstractAssertForm;
 use Magento\Cms\Test\Page\CmsIndex;
 use Magento\Wishlist\Test\Page\WishlistIndex;
 use Mtf\Fixture\FixtureFactory;
@@ -34,7 +34,7 @@ use Mtf\Fixture\InjectableFixture;
  * Class AssertBundleProductDetailsInWishlist
  * Assert that the correct option details are displayed on the "View Details" tool tip
  */
-class AssertProductDetailsInWishlist extends AbstractConstraint
+class AssertProductDetailsInWishlist extends AbstractAssertForm
 {
     /**
      * Constraint severeness
@@ -63,11 +63,8 @@ class AssertProductDetailsInWishlist extends AbstractConstraint
         $cartFixture = $fixtureFactory->createByCode('cart', ['data' => ['items' => ['products' => [$product]]]]);
         $expectedOptions = $cartFixture->getItems()[0]->getData()['options'];
 
-        \PHPUnit_Framework_Assert::assertEquals(
-            $expectedOptions,
-            $actualOptions,
-            "Expected product options are not equal to actual."
-        );
+        $errors = $this->verifyData($expectedOptions, $actualOptions);
+        \PHPUnit_Framework_Assert::assertEmpty($errors, $errors);
     }
 
     /**
diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/AddProductsToCartFromCustomerWishlistOnFrontendTest.php b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/AddProductsToCartFromCustomerWishlistOnFrontendTest.php
index e41e009f83395c696450b6aa86d0d50660a58209..fee9db347116ca7e7f64c43f07f944cce4fcbf0d 100644
--- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/AddProductsToCartFromCustomerWishlistOnFrontendTest.php
+++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/AddProductsToCartFromCustomerWishlistOnFrontendTest.php
@@ -68,6 +68,7 @@ class AddProductsToCartFromCustomerWishlistOnFrontendTest extends AbstractWishli
      */
     public function test(CustomerInjectable $customer, $products, $qty, Browser $browser)
     {
+        $this->markTestIncomplete("Bug: MAGETWO-30097");
         // Preconditions
         $this->browser = $browser;
         $customer->persist();
diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ConfigureProductInCustomerWishlistOnFrontendTest.php b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ConfigureProductInCustomerWishlistOnFrontendTest.php
index e57e3a27546e922908ccefb087d2c7f402af1846..8827034ea7856459f1b30c66c4b968e7e8b40c3f 100644
--- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ConfigureProductInCustomerWishlistOnFrontendTest.php
+++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ConfigureProductInCustomerWishlistOnFrontendTest.php
@@ -71,6 +71,7 @@ class ConfigureProductInCustomerWishlistOnFrontendTest extends AbstractWishlistT
      */
     public function test(CustomerInjectable $customer, $product)
     {
+        $this->markTestIncomplete("Bug: MAGETWO-30097");
         // Preconditions
         $product = $this->createProducts($product)[0];
         $this->loginCustomer($customer);
diff --git a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ShareWishlistEntityTest.php b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ShareWishlistEntityTest.php
index 5fd6ded0abec6f421814236c021337eb9eef19b0..7f74f70127c367a3280b7b46ecb28672e0ad5a9a 100644
--- a/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ShareWishlistEntityTest.php
+++ b/dev/tests/functional/tests/app/Magento/Wishlist/Test/TestCase/ShareWishlistEntityTest.php
@@ -174,6 +174,7 @@ class ShareWishlistEntityTest extends Injectable
         CatalogProductSimple $product,
         array $sharingInfo
     ) {
+        $this->markTestIncomplete("Bug: MAGETWO-30105");
         //Steps
         $this->loginCustomer($customer);
         $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/AbstractTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/AbstractTest.php
index d123affbf99ec1f319d204b542d1b8d2ef470f56..25366065d1a07381147bec2716382de5c1aa6e4f 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/AbstractTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/AbstractTest.php
@@ -36,7 +36,6 @@ class AbstractTest extends \PHPUnit_Framework_TestCase
         $catalogProductOption = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
             'Magento\Catalog\Model\Product\Option'
         );
-        $eavConfig = $this->getMock('Magento\Eav\Model\Config', array(), array(), '', false);
         $catalogProductType = $this->getMock('Magento\Catalog\Model\Product\Type', array(), array(), '', false);
         $eventManager = $this->getMock(
             'Magento\Framework\Event\ManagerInterface',
@@ -55,7 +54,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase
             array(
                 $productFactory,
                 $catalogProductOption,
-                $eavConfig,
+                \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Eav\Model\Config'),
                 $catalogProductType,
                 $eventManager,
                 $coreData,
@@ -304,22 +303,22 @@ class AbstractTest extends \PHPUnit_Framework_TestCase
     }
 
     /**
+     * @magentoDbIsolation enabled
      * @magentoDataFixture Magento/Catalog/_files/product_simple.php
+     * @magentoDataFixture Magento/Catalog/_files/product_attribute_with_invalid_apply_to.php
      */
     public function testBeforeSave()
     {
-        $this->markTestIncomplete('MAGETWO-9199');
         /** @var $product \Magento\Catalog\Model\Product */
         $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
             'Magento\Catalog\Model\Product'
         );
         $product->load(1);
         // fixture
-        $product->setData('links_purchased_separately', 'value');
-        // this attribute is applicable only for downloadable
+        $product->setData('attribute_with_invalid_applyto', 'value');
         $this->_model->beforeSave($product);
         $this->assertTrue($product->canAffectOptions());
-        $this->assertFalse($product->hasData('links_purchased_separately'));
+        $this->assertFalse($product->hasData('attribute_with_invalid_applyto'));
     }
 
     /**
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_attribute_with_invalid_apply_to.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_attribute_with_invalid_apply_to.php
new file mode 100644
index 0000000000000000000000000000000000000000..6b74da686c06a9755f7fdc5d62335f13d59a5745
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_attribute_with_invalid_apply_to.php
@@ -0,0 +1,49 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+/** @var \Magento\Catalog\Model\Resource\Setup $installer */
+$installer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
+    'Magento\Catalog\Model\Resource\Setup',
+    ['resourceName' => 'catalog_setup']
+);
+
+/** @var $attribute \Magento\Catalog\Model\Resource\Eav\Attribute */
+$attribute = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
+    'Magento\Catalog\Model\Resource\Eav\Attribute'
+);
+$attribute->setData(
+    [
+        'attribute_code' => 'attribute_with_invalid_applyto',
+        'entity_type_id' => $installer->getEntityTypeId('catalog_product'),
+        'apply_to' => 'invalid-type',
+    ]
+);
+$attribute->save();
+
+/* Assign attribute to attribute set */
+$installer->addAttributeToGroup('catalog_product', 'Default', 'General', $attribute->getId());
+
+/** @var \Magento\Eav\Model\Config $eavConfig */
+$eavConfig = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Eav\Model\Config');
+$eavConfig->clear();
diff --git a/dev/tests/integration/testsuite/Magento/CatalogRule/Model/Indexer/IndexerBuilderTest.php b/dev/tests/integration/testsuite/Magento/CatalogRule/Model/Indexer/IndexerBuilderTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..9d659af73d304d78eff3de5e548d532b71940a2b
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/CatalogRule/Model/Indexer/IndexerBuilderTest.php
@@ -0,0 +1,126 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\CatalogRule\Model\Indexer;
+
+use Magento\TestFramework\Helper\Bootstrap;
+
+class IndexerBuilderTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var \Magento\CatalogRule\Model\Indexer\IndexBuilder
+     */
+    protected $indexerBuilder;
+
+    /**
+     * @var \Magento\CatalogRule\Model\Resource\Rule
+     */
+    protected $resourceRule;
+
+    /**
+     * @var \Magento\Catalog\Model\Product
+     */
+    protected $product;
+
+    /**
+     * @var \Magento\Catalog\Model\Product
+     */
+    protected $productSecond;
+
+    /**
+     * @var \Magento\Catalog\Model\Product
+     */
+    protected $productThird;
+
+    protected function setUp()
+    {
+        $this->indexerBuilder = Bootstrap::getObjectManager()->get('Magento\CatalogRule\Model\Indexer\IndexBuilder');
+        $this->resourceRule = Bootstrap::getObjectManager()->get('Magento\CatalogRule\Model\Resource\Rule');
+        $this->product = Bootstrap::getObjectManager()->get('Magento\Catalog\Model\Product');
+    }
+
+    /**
+     * @magentoDbIsolation enabled
+     * @magentoAppIsolation enabled
+     * @magentoDataFixture Magento/CatalogRule/_files/attribute.php
+     * @magentoDataFixture Magento/CatalogRule/_files/rule_by_attribute.php
+     * @magentoDataFixture Magento/Catalog/_files/product_simple.php
+     */
+    public function testReindexById()
+    {
+        $this->product->load(1)->setData('test_attribute', 'test_attribute_value')->save();
+
+        $this->indexerBuilder->reindexById(1);
+
+        $this->assertEquals(9.8, $this->resourceRule->getRulePrice(true, 1, 1, 1));
+    }
+
+    /**
+     * @magentoDbIsolation enabled
+     * @magentoAppIsolation enabled
+     * @magentoDataFixture Magento/CatalogRule/_files/attribute.php
+     * @magentoDataFixture Magento/CatalogRule/_files/rule_by_attribute.php
+     * @magentoDataFixture Magento/Catalog/_files/product_simple.php
+     */
+    public function testReindexByIds()
+    {
+        $this->prepareProducts();
+
+        $this->indexerBuilder->reindexByIds([
+            $this->product->getId(),
+            $this->productSecond->getId(),
+            $this->productThird->getId()
+        ]);
+
+        $this->assertEquals(9.8, $this->resourceRule->getRulePrice(true, 1, 1, 1));
+        $this->assertEquals(9.8, $this->resourceRule->getRulePrice(true, 1, 1, $this->productSecond->getId()));
+        $this->assertFalse($this->resourceRule->getRulePrice(true, 1, 1, $this->productThird->getId()));
+    }
+
+    /**
+     * @magentoDbIsolation enabled
+     * @magentoAppIsolation enabled
+     * @magentoDataFixture Magento/CatalogRule/_files/attribute.php
+     * @magentoDataFixture Magento/CatalogRule/_files/rule_by_attribute.php
+     * @magentoDataFixture Magento/Catalog/_files/product_simple.php
+     */
+    public function testReindexFull()
+    {
+        $this->prepareProducts();
+
+        $this->indexerBuilder->reindexFull();
+
+        $this->assertEquals(9.8, $this->resourceRule->getRulePrice(true, 1, 1, 1));
+        $this->assertEquals(9.8, $this->resourceRule->getRulePrice(true, 1, 1, $this->productSecond->getId()));
+        $this->assertFalse($this->resourceRule->getRulePrice(true, 1, 1, $this->productThird->getId()));
+    }
+
+    protected function prepareProducts()
+    {
+        $this->product->load(1)->setData('test_attribute', 'test_attribute_value')->save();
+        $this->productSecond = clone $this->product;
+        $this->productSecond->setId(null)->save();
+        $this->productThird = clone $this->product;
+        $this->productThird->setId(null)->setData('test_attribute', 'NO_test_attribute_value')->save();
+    }
+}
diff --git a/dev/tests/integration/testsuite/Magento/CatalogRule/Model/Indexer/ProductRuleTest.php b/dev/tests/integration/testsuite/Magento/CatalogRule/Model/Indexer/ProductRuleTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..ebab141b58e8b5f25dc1b8b6723596c0c19e1dfc
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/CatalogRule/Model/Indexer/ProductRuleTest.php
@@ -0,0 +1,65 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\CatalogRule\Model\Indexer;
+
+use Magento\TestFramework\Helper\Bootstrap;
+
+/**
+ * @magentoDbIsolation enabled
+ * @magentoAppIsolation enabled
+ */
+class ProductRuleTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var \Magento\CatalogRule\Model\Resource\Rule
+     */
+    protected $resourceRule;
+
+    /**
+     * @var \Magento\Catalog\Model\Product
+     */
+    protected $product;
+
+    protected function setUp()
+    {
+        $this->resourceRule = Bootstrap::getObjectManager()->get('Magento\CatalogRule\Model\Resource\Rule');
+        $this->product = Bootstrap::getObjectManager()->get('Magento\Catalog\Model\Product');
+
+        Bootstrap::getObjectManager()->get('Magento\CatalogRule\Model\Indexer\Product\ProductRuleProcessor')
+            ->getIndexer()->isScheduled(false);
+    }
+
+    /**
+     * @magentoDataFixture Magento/CatalogRule/_files/attribute.php
+     * @magentoDataFixture Magento/CatalogRule/_files/rule_by_attribute.php
+     * @magentoDataFixture Magento/Catalog/_files/product_simple.php
+     * @magentoAppArea adminhtml
+     */
+    public function testReindexAfterSuitableProductSaving()
+    {
+        $this->product->load(1)->setData('test_attribute', 'test_attribute_value')->save();
+
+        $this->assertEquals(9.8, $this->resourceRule->getRulePrice(true, 1, 1, 1));
+    }
+}
diff --git a/dev/tests/integration/testsuite/Magento/CatalogRule/Model/Indexer/RuleProductTest.php b/dev/tests/integration/testsuite/Magento/CatalogRule/Model/Indexer/RuleProductTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..799fccbb78a5bbcdedc31c7d569c06ee0bee7120
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/CatalogRule/Model/Indexer/RuleProductTest.php
@@ -0,0 +1,76 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\CatalogRule\Model\Indexer;
+
+use Magento\TestFramework\Helper\Bootstrap;
+
+/**
+ * @magentoDbIsolation enabled
+ * @magentoAppIsolation enabled
+ */
+class RuleProductTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var \Magento\CatalogRule\Model\Indexer\IndexBuilder
+     */
+    protected $indexBuilder;
+
+    /**
+     * @var \Magento\CatalogRule\Model\Resource\Rule
+     */
+    protected $resourceRule;
+
+    /**
+     * @var \Magento\Catalog\Model\Product
+     */
+    protected $product;
+
+    protected function setUp()
+    {
+        $this->indexBuilder = Bootstrap::getObjectManager()->get('Magento\CatalogRule\Model\Indexer\IndexBuilder');
+        $this->resourceRule = Bootstrap::getObjectManager()->get('Magento\CatalogRule\Model\Resource\Rule');
+        $this->product = Bootstrap::getObjectManager()->create('Magento\Catalog\Model\Product');
+    }
+
+    /**
+     * @magentoDataFixture Magento/CatalogRule/_files/attribute.php
+     * @magentoDataFixture Magento/Catalog/_files/product_simple.php
+     */
+    public function testReindexAfterRuleCreation()
+    {
+        $this->product->load(1)->setData('test_attribute', 'test_attribute_value')->save();
+        $this->assertFalse($this->resourceRule->getRulePrice(true, 1, 1, 1));
+
+        $this->saveRule();
+        // apply all rules
+        $this->indexBuilder->reindexFull();
+
+        $this->assertEquals(9.8, $this->resourceRule->getRulePrice(true, 1, 1, 1));
+    }
+
+    protected function saveRule()
+    {
+        require 'Magento/CatalogRule/_files/rule_by_attribute.php';
+    }
+}
diff --git a/dev/tests/integration/testsuite/Magento/CatalogRule/_files/attribute.php b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/attribute.php
new file mode 100644
index 0000000000000000000000000000000000000000..5b556d27b0a0d2de6b5601cbcc3556b550be0aad
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/attribute.php
@@ -0,0 +1,53 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+/** @var \Magento\Catalog\Model\Resource\Setup $installer */
+$installer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
+    'Magento\Catalog\Model\Resource\Setup',
+    array('resourceName' => 'catalog_setup')
+);
+
+/** @var $attribute \Magento\Catalog\Model\Resource\Eav\Attribute */
+$attribute = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
+    'Magento\Catalog\Model\Resource\Eav\Attribute'
+);
+$attribute->setData(
+    [
+        'attribute_code' => 'test_attribute',
+        'entity_type_id' => $installer->getEntityTypeId('catalog_product'),
+        'is_global' => 1,
+        'is_user_defined' => 1,
+        'frontend_input' => 'text',
+        'is_used_for_promo_rules' => 1,
+        'backend_type' => 'text',
+    ]
+);
+$attribute->save();
+
+/* Assign attribute to attribute set */
+$installer->addAttributeToGroup('catalog_product', 'Default', 'General', $attribute->getId());
+
+/** @var \Magento\Eav\Model\Config $eavConfig */
+$eavConfig = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Eav\Model\Config');
+$eavConfig->clear();
diff --git a/dev/tests/integration/testsuite/Magento/CatalogRule/_files/catalog_rule_10_off_not_logged.php b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/catalog_rule_10_off_not_logged.php
index 15605cd20c4259b07a28cc9b914528921a20619c..9487109503c87768d6ba5c604300dfdf712132df 100644
--- a/dev/tests/integration/testsuite/Magento/CatalogRule/_files/catalog_rule_10_off_not_logged.php
+++ b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/catalog_rule_10_off_not_logged.php
@@ -39,4 +39,7 @@ $catalogRule
     ->setSimpleAction('by_percent')
     ->save();
 
-$catalogRule->applyAll();
+/** @var \Magento\CatalogRule\Model\Indexer\IndexBuilder $indexBuilder */
+$indexBuilder = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
+    ->get('Magento\CatalogRule\Model\Indexer\IndexBuilder');
+$indexBuilder->reindexFull();
diff --git a/app/code/Magento/Paypal/sql/paypal_setup/upgrade-1.6.0.3-1.6.0.4.php b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/rule_by_attribute.php
similarity index 50%
rename from app/code/Magento/Paypal/sql/paypal_setup/upgrade-1.6.0.3-1.6.0.4.php
rename to dev/tests/integration/testsuite/Magento/CatalogRule/_files/rule_by_attribute.php
index 03fdc17f2ead9205c6ab0d7d30539508f90cbaf1..ec66b7c44adf0d40ad4d29686c96edd40de91a73 100644
--- a/app/code/Magento/Paypal/sql/paypal_setup/upgrade-1.6.0.3-1.6.0.4.php
+++ b/dev/tests/integration/testsuite/Magento/CatalogRule/_files/rule_by_attribute.php
@@ -22,16 +22,32 @@
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
 
-/** @var $installer \Magento\Setup\Module\SetupModule */
-$installer = $this;
+use Magento\TestFramework\Helper\Bootstrap;
 
-$installer->getConnection()
-    ->addColumn(
-        $installer->getTable('paypal_settlement_report_row'),
-        'store_id',
-        array(
-            'type'    => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
-            'comment' => 'Store ID',
-            'length'  => '50'
-        )
-    );
+/** @var \Magento\CatalogRule\Model\Rule $rule */
+$rule = Bootstrap::getObjectManager()->get('Magento\CatalogRule\Model\RuleFactory')->create();
+$rule->loadPost([
+    'name' => 'test_rule',
+    'is_active' => '1',
+    'website_ids' => [1],
+    'customer_group_ids' => [0, 1],
+    'discount_amount' => 2,
+    'simple_action' => 'by_percent',
+    'from_date' => '',
+    'to_date' => '',
+    'conditions' => [
+        '1' => [
+            'type' => 'Magento\CatalogRule\Model\Rule\Condition\Combine',
+            'aggregator' => 'all',
+            'value' => '1',
+            'new_child' => '',
+        ],
+        '1--1' => [
+            'type' => 'Magento\CatalogRule\Model\Rule\Condition\Product',
+            'attribute' => 'test_attribute',
+            'operator' => '==',
+            'value' => 'test_attribute_value',
+        ],
+    ],
+]);
+$rule->save();
diff --git a/app/code/Magento/Sales/data/sales_setup/data-upgrade-1.6.0.11-1.6.0.12.php b/dev/tests/integration/testsuite/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/IndexTest.php
similarity index 64%
rename from app/code/Magento/Sales/data/sales_setup/data-upgrade-1.6.0.11-1.6.0.12.php
rename to dev/tests/integration/testsuite/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/IndexTest.php
index d63f241effcc66134cd10a80bfe4729061730399..823151c6920e621d53cfaba42555dff55c0f5038 100644
--- a/app/code/Magento/Sales/data/sales_setup/data-upgrade-1.6.0.11-1.6.0.12.php
+++ b/dev/tests/integration/testsuite/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/IndexTest.php
@@ -22,17 +22,16 @@
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
 
-/** @var $installer \Magento\Sales\Model\Resource\Setup */
-$installer = $this;
-$installer->startSetup();
+namespace Magento\Cms\Controller\Adminhtml\Wysiwyg\Images;
 
-/** Update visibility for states */
-$states = array('new', 'processing', 'complete', 'closed', 'canceled', 'holded', 'payment_review');
-foreach ($states as $state) {
-    $installer->getConnection()->update(
-        $installer->getTable('sales_order_status_state'),
-        array('visible_on_front' => 1),
-        array('state = ?' => $state)
-    );
+class IndexTest extends \Magento\Backend\Utility\Controller
+{
+    public function testViewAction()
+    {
+        $this->dispatch('backend/cms/wysiwyg_images/index/target_element_id/page_content/store/undefined/type/image/');
+        $content = $this->getResponse()->getBody();
+        $this->assertNotContains('<html', $content);
+        $this->assertNotContains('<head', $content);
+        $this->assertNotContains('<body', $content);
+    }
 }
-$installer->endSetup();
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Block/Widget/TaxvatTest.php b/dev/tests/integration/testsuite/Magento/Customer/Block/Widget/TaxvatTest.php
index ae1c4fec817d65d2e69ffa43bb41d423a0e902a5..64b2c874e4da76de24559add3cbcd1cd3d816e4e 100644
--- a/dev/tests/integration/testsuite/Magento/Customer/Block/Widget/TaxvatTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Block/Widget/TaxvatTest.php
@@ -65,4 +65,11 @@ class TaxvatTest extends \PHPUnit_Framework_TestCase
         $this->assertContains('title="Tax/VAT number"', $block->toHtml());
         $this->assertContains('required', $block->toHtml());
     }
+
+    protected function tearDown()
+    {
+        /** @var \Magento\Eav\Model\Config $eavConfig */
+        $eavConfig = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Eav\Model\Config');
+        $eavConfig->clear();
+    }
 }
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Controller/AddressTest.php b/dev/tests/integration/testsuite/Magento/Customer/Controller/AddressTest.php
index 13d9a87450e0ae542fc2c4cd15262ff67e4adf89..49faea05afa7509d13c5cda7f79191ed91b5c0e9 100644
--- a/dev/tests/integration/testsuite/Magento/Customer/Controller/AddressTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Controller/AddressTest.php
@@ -94,7 +94,9 @@ class AddressTest extends \Magento\TestFramework\TestCase\AbstractController
                 'postcode' => '55555',
                 'country_id' => 'UA',
                 'success_url' => '',
-                'error_url' => ''
+                'error_url' => '',
+                'default_billing' => true,
+                'default_shipping' => true
             )
         );
         // we are overwriting the address coming from the fixture
@@ -112,6 +114,8 @@ class AddressTest extends \Magento\TestFramework\TestCase\AbstractController
         $this->assertEquals('UA', $address->getCountryId());
         $this->assertEquals('Kyiv', $address->getCity());
         $this->assertEquals('Kiev', $address->getRegion()->getRegion());
+        $this->assertTrue($address->isDefaultBilling());
+        $this->assertTrue($address->isDefaultShipping());
     }
 
     /**
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/AccountManagementTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/AccountManagementTest.php
index 46ca6c183565f7fb7af944dde22ea4e3a0378007..d8203c9d0a59f25cbd3595a4bfdff13a7695280d 100755
--- a/dev/tests/integration/testsuite/Magento/Customer/Model/AccountManagementTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Model/AccountManagementTest.php
@@ -25,11 +25,14 @@
 namespace Magento\Customer\Model;
 
 use Magento\Customer\Api\AccountManagementInterface;
+use Magento\Customer\Api\AddressRepositoryInterface;
 use Magento\Customer\Api\CustomerRepositoryInterface;
+use Magento\Customer\Api\Data\AddressInterface;
 use Magento\Customer\Service\V1;
 use Magento\Framework\Exception\InputException;
 use Magento\Framework\Exception\NoSuchEntityException;
 use Magento\Framework\Exception\State\ExpiredException;
+use Magento\Framework\Reflection\DataObjectProcessor;
 use Magento\TestFramework\Helper\Bootstrap;
 
 /**
@@ -48,8 +51,8 @@ class AccountManagementTest extends \PHPUnit_Framework_TestCase
     /** @var CustomerRepositoryInterface */
     private $customerRepository;
 
-    /** @var CustomerAddressServiceInterface needed to setup tests */
-    private $_customerAddressService;
+    /** @var AddressRepositoryInterface needed to setup tests */
+    private $addressRepository;
 
     /** @var \Magento\Framework\ObjectManager */
     private $objectManager;
@@ -63,6 +66,9 @@ class AccountManagementTest extends \PHPUnit_Framework_TestCase
     /** @var \Magento\Customer\Api\Data\CustomerDataBuilder */
     private $customerBuilder;
 
+    /** @var DataObjectProcessor */
+    private $dataProcessor;
+
     protected function setUp()
     {
         $this->objectManager = Bootstrap::getObjectManager();
@@ -70,20 +76,21 @@ class AccountManagementTest extends \PHPUnit_Framework_TestCase
             ->create('Magento\Customer\Api\AccountManagementInterface');
         $this->customerRepository = $this->objectManager
             ->create('Magento\Customer\Api\CustomerRepositoryInterface');
-        $this->_customerAddressService =
-            $this->objectManager->create('Magento\Customer\Service\V1\CustomerAddressServiceInterface');
+        $this->addressRepository =
+            $this->objectManager->create('Magento\Customer\Api\AddressRepositoryInterface');
 
         $this->addressBuilder = $this->objectManager->create('Magento\Customer\Api\Data\AddressDataBuilder');
         $this->customerBuilder = $this->objectManager->create('Magento\Customer\Api\Data\CustomerDataBuilder');
 
         $regionBuilder = $this->objectManager->create('Magento\Customer\Api\Data\RegionDataBuilder');
-        $this->addressBuilder->setId(1)
+        $this->addressBuilder->setId('1')
             ->setCountryId('US')
-            ->setCustomerId(1)
+            ->setCustomerId('1')
             ->setPostcode('75477')
             ->setRegion(
                 $regionBuilder->setRegionCode('AL')->setRegion('Alabama')->setRegionId(1)->create()
             )
+            ->setCompany('CompanyName')
             ->setStreet(['Green str, 67'])
             ->setTelephone('3468676')
             ->setCity('CityM')
@@ -91,13 +98,14 @@ class AccountManagementTest extends \PHPUnit_Framework_TestCase
             ->setLastname('Smith');
         $address = $this->addressBuilder->create();
 
-        $this->addressBuilder->setId(2)
+        $this->addressBuilder->setId('2')
             ->setCountryId('US')
-            ->setCustomerId(1)
+            ->setCustomerId('1')
             ->setPostcode('47676')
             ->setRegion(
                 $regionBuilder->setRegionCode('AL')->setRegion('Alabama')->setRegionId(1)->create()
             )
+            ->setCompany('Company')
             ->setStreet(['Black str, 48'])
             ->setCity('CityX')
             ->setTelephone('3234676')
@@ -106,6 +114,9 @@ class AccountManagementTest extends \PHPUnit_Framework_TestCase
         $address2 = $this->addressBuilder->create();
 
         $this->_expectedAddresses = [$address, $address2];
+
+        $this->dataProcessor = $this->objectManager
+            ->create('Magento\Framework\Reflection\DataObjectProcessor');
     }
 
     /**
@@ -827,6 +838,108 @@ class AccountManagementTest extends \PHPUnit_Framework_TestCase
         $this->assertTrue($this->accountManagement->isEmailAvailable('nonexistent@example.com', 1));
     }
 
+    /**
+     * @magentoDataFixture  Magento/Customer/_files/customer.php
+     * @magentoDataFixture  Magento/Customer/_files/customer_address.php
+     * @magentoDataFixture  Magento/Customer/_files/customer_two_addresses.php
+     */
+    public function testGetDefaultBillingAddress()
+    {
+        $customerId = 1;
+        $address = $this->accountManagement->getDefaultBillingAddress($customerId);
+
+        $expected = $this->dataProcessor->buildOutputDataArray(
+            $this->_expectedAddresses[0],
+            'Magento\Customer\Api\Data\AddressInterface'
+        );
+        $result = $this->dataProcessor->buildOutputDataArray($address, 'Magento\Customer\Api\Data\AddressInterface');
+        /*
+         * TODO : Data builder / populateWithArray currently does not detect
+         * array type and returns street as string instead of array. Need to fix this.
+         */
+        unset($expected[AddressInterface::STREET]);
+        unset($result[AddressInterface::STREET]);
+        $this->assertEquals($expected, $result);
+    }
+
+    /**
+     * @magentoDataFixture  Magento/Customer/_files/customer.php
+     */
+    public function testSaveNewAddressDefaults()
+    {
+        $customerId = 1;
+
+        /** @var $addressShippingBuilder \Magento\Customer\Api\Data\AddressDataBuilder */
+        $addressShippingBuilder = $this->addressBuilder->populate($this->_expectedAddresses[0])->setId(null);
+        $addressShippingBuilder->setDefaultShipping(true)->setDefaultBilling(false)->setCustomerId($customerId);
+        //TODO : Will be fixed as part of fixing populate. For now Region is set as Data Object instead of array
+        $addressShippingBuilder->setRegion($this->_expectedAddresses[0]->getRegion());
+        $addressShipping = $addressShippingBuilder->create();
+
+        /** @var $addressBillingBuilder \Magento\Customer\Api\Data\AddressDataBuilder */
+        $addressBillingBuilder = $this->addressBuilder->populate($this->_expectedAddresses[1])->setId(null);
+        $addressBillingBuilder->setDefaultBilling(true)->setDefaultShipping(false)->setCustomerId($customerId);
+        //TODO : Will be fixed as part of fixing populate
+        $addressBillingBuilder->setRegion($this->_expectedAddresses[1]->getRegion());
+        $addressBilling = $addressBillingBuilder->create();
+
+        $addressShippingExpected = $this->addressRepository->save($addressShipping);
+        $addressBillingExpected = $this->addressRepository->save($addressBilling);
+
+        // Call api under test
+        $shippingResponse = $this->accountManagement->getDefaultShippingAddress($customerId);
+        $billingResponse = $this->accountManagement->getDefaultBillingAddress($customerId);
+
+
+        // Verify if the new Shipping address created is same as returned by the api under test :
+        // \Magento\Customer\Api\AccountManagementInterface::getDefaultShippingAddress
+        $addressShippingExpected = $this->dataProcessor->buildOutputDataArray(
+            $addressShippingExpected,
+            'Magento\Customer\Api\Data\AddressInterface'
+        );
+        $shippingResponse = $this->dataProcessor->buildOutputDataArray(
+            $shippingResponse,
+            'Magento\Customer\Api\Data\AddressInterface'
+        );
+        /*
+         * TODO : Data builder / populateWithArray currently does not detect
+         * array type and returns street as string instead of array. Need to fix this.
+         */
+        unset($addressShippingExpected[AddressInterface::STREET]);
+        unset($shippingResponse[AddressInterface::STREET]);
+
+        $this->assertEquals($addressShippingExpected, $shippingResponse);
+
+        // Verify if the new Billing address created is same as returned by the api under test :
+        // \Magento\Customer\Api\AccountManagementInterface::getDefaultShippingAddress
+        $addressBillingExpected = $this->dataProcessor->buildOutputDataArray(
+            $addressBillingExpected,
+            'Magento\Customer\Api\Data\AddressInterface'
+        );
+        $billingResponse = $this->dataProcessor->buildOutputDataArray(
+            $billingResponse,
+            'Magento\Customer\Api\Data\AddressInterface'
+        );
+        /*
+         * TODO : Data builder / populateWithArray currently does not detect
+         * array type and returns street as string instead of array. Need to fix this.
+         */
+        unset($addressBillingExpected[AddressInterface::STREET]);
+        unset($billingResponse[AddressInterface::STREET]);
+
+        $this->assertEquals($addressBillingExpected, $billingResponse);
+    }
+
+    /**
+     * @magentoDataFixture  Magento/Customer/_files/customer.php
+     */
+    public function testGetDefaultAddressesForNonExistentAddress()
+    {
+        $customerId = 1;
+        $this->assertNull($this->accountManagement->getDefaultBillingAddress($customerId));
+        $this->assertNull($this->accountManagement->getDefaultShippingAddress($customerId));
+    }
+
     /**
      * Set Rp data to Customer in fixture
      *
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Service/V1/Data/CustomerDetailsBuilderTest.php b/dev/tests/integration/testsuite/Magento/Customer/Service/V1/Data/CustomerDetailsBuilderTest.php
index 4a984761e94bdf320f2d5891c69dcff81ffdf416..40cd098a1dbb9fa5f46298733b226bafeb11d8a9 100644
--- a/dev/tests/integration/testsuite/Magento/Customer/Service/V1/Data/CustomerDetailsBuilderTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Service/V1/Data/CustomerDetailsBuilderTest.php
@@ -319,7 +319,8 @@ class CustomerDetailsBuilderTest extends \PHPUnit_Framework_TestCase
         $customerDetailsA = $this->_builder->populateWithArray(
             array('customer' => $customer, 'addresses' => array($address2))
         )->create();
-        $customerDetailsB = $this->_builder->mergeDataObjects($customerDetailsC, $customerDetailsA);
+        $customerDetailsB = $this->_builder->mergeDataObjects($customerDetailsC, $customerDetailsA)
+            ->create();
         $this->assertEquals($customerDetails->__toArray(), $customerDetailsB->__toArray());
     }
 
@@ -386,7 +387,7 @@ class CustomerDetailsBuilderTest extends \PHPUnit_Framework_TestCase
         $customerDetailsB = $this->_builder->mergeDataObjectWithArray(
             $customerDetailsC,
             array('addresses' => array($address2))
-        );
+        )->create();
         $this->assertEquals($customerDetails->__toArray(), $customerDetailsB->__toArray());
     }
 }
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Service/V1/Data/Eav/AttributeMetadataBuilderTest.php b/dev/tests/integration/testsuite/Magento/Customer/Service/V1/Data/Eav/AttributeMetadataBuilderTest.php
index a1f2bc2c4ad82e3c18974e9613511611583d0782..a528858ac62e9be096a16a42da629fedbc6de58e 100644
--- a/dev/tests/integration/testsuite/Magento/Customer/Service/V1/Data/Eav/AttributeMetadataBuilderTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Service/V1/Data/Eav/AttributeMetadataBuilderTest.php
@@ -149,7 +149,8 @@ class AttributeMetadataBuilderTest extends \PHPUnit_Framework_TestCase
 
         $attributeMetadata = $this->_builder->populateWithArray($dataNoOptions)->create();
         $attributeMetadataA = $this->_builder->populateWithArray($dataWithOptions)->create();
-        $merged = $this->_builder->mergeDataObjects($attributeMetadata, $attributeMetadataA);
+        $merged = $this->_builder->mergeDataObjects($attributeMetadata, $attributeMetadataA)
+            ->create();
         $this->assertEquals($attributeMetadataA, $merged);
     }
 
@@ -180,7 +181,8 @@ class AttributeMetadataBuilderTest extends \PHPUnit_Framework_TestCase
 
         $attributeMetadata = $this->_builder->populateWithArray($dataNoOptions)->create();
         $attributeMetadataA = $this->_builder->populateWithArray($dataWithOptions)->create();
-        $merged = $this->_builder->mergeDataObjectWithArray($attributeMetadata, $dataWithOptions);
+        $merged = $this->_builder->mergeDataObjectWithArray($attributeMetadata, $dataWithOptions)
+            ->create();
         $this->assertEquals($attributeMetadataA, $merged);
     }
 }
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Api/Code/Generator/DataBuilderTest.php b/dev/tests/integration/testsuite/Magento/Framework/Api/Code/Generator/DataBuilderTest.php
index c9a63d381949233ca3ee17d64a3f4315dc1247b6..7580bd0cd6600b86e62527953f4d54696a62a1d2 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Api/Code/Generator/DataBuilderTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Api/Code/Generator/DataBuilderTest.php
@@ -25,6 +25,10 @@ namespace Magento\Framework\Api\Code\Generator;
 
 use Magento\Wonderland\Api\Data\FakeAddressInterface;
 use Magento\Wonderland\Api\Data\FakeRegionInterface;
+use Magento\Wonderland\Model\Data\FakeAddress;
+use Magento\Wonderland\Model\Data\FakeRegion;
+use Magento\Framework\Api\ExtensibleDataInterface;
+use Magento\Framework\Api\AttributeInterface;
 
 class DataBuilderTest extends \PHPUnit_Framework_TestCase
 {
@@ -47,12 +51,100 @@ class DataBuilderTest extends \PHPUnit_Framework_TestCase
         );
     }
 
-    public function testPopulateWithArray()
+    /**
+     * @dataProvider getBuildersToTest
+     */
+    public function testBuilders($builderType)
     {
+        $builder = $this->_objectManager->create($builderType);
+        $this->assertInstanceOf($builderType, $builder);
+    }
+
+    public function getBuildersToTest()
+    {
+        return [
+            ['Magento\Checkout\Service\V1\Data\Cart\TotalsBuilder'],
+        ];
+    }
+
+    public function testDataObjectBuilder()
+    {
+        $regionBuilder = $this->_objectManager->create('Magento\Wonderland\Model\Data\FakeRegionBuilder');
+        $this->assertInstanceOf('\Magento\Wonderland\Model\Data\FakeRegionBuilder', $regionBuilder);
+        $region = $regionBuilder->setRegion('test')
+            ->setRegionCode('test_code')
+            ->setRegionId('test_id')
+            ->create();
+        $this->assertInstanceOf('\Magento\Wonderland\Model\Data\FakeRegion', $region);
+        $this->assertEquals('test', $region->getRegion());
+    }
+
+
+    public function testDataObjectPopulateWithArray()
+    {
+        $data = $this->getAddressArray();
+
+        /** @var \Magento\Wonderland\Model\Data\FakeAddressBuilder $addressBuilder */
+        $addressBuilder = $this->_objectManager->create('Magento\Wonderland\Model\Data\FakeAddressBuilder');
+        /** @var \Magento\Wonderland\Api\Data\FakeAddressInterface $address */
+        $address = $addressBuilder->populateWithArray($data)
+            ->create();
+        $this->assertInstanceOf('\Magento\Wonderland\Model\Data\FakeAddress', $address);
+        $this->assertEquals('Johnes', $address->getLastname());
+        $this->assertNull($address->getCustomAttribute('test'));
+        $this->assertEmpty($address->getCustomAttributes());
+        $this->assertInstanceOf('\Magento\Wonderland\Model\Data\FakeRegion', $address->getRegion());
+        $this->assertInstanceOf('\Magento\Wonderland\Model\Data\FakeRegion', $address->getRegions()[0]);
+        $this->assertInstanceOf('\Magento\Wonderland\Model\Data\FakeRegion', $address->getRegions()[1]);
+    }
+
+
+    public function testDataObjectPopulate()
+    {
+        $data = $this->getAddressArray();
+
+        /** @var \Magento\Wonderland\Model\Data\FakeAddressBuilder $addressBuilder */
+        $addressBuilder = $this->_objectManager->create('Magento\Wonderland\Model\Data\FakeAddressBuilder');
+        /** @var \Magento\Wonderland\Api\Data\FakeAddressInterface $address */
+        $address = $addressBuilder->populateWithArray($data)
+            ->create();
+
+        $addressUpdated = $addressBuilder->populate($address)
+            ->setCompany('RocketScience')
+            ->create();
+
+        $this->assertInstanceOf('\Magento\Wonderland\Model\Data\FakeAddress', $addressUpdated);
+        $this->assertEquals('RocketScience', $addressUpdated->getCompany());
+
+        $this->assertEmpty($address->getCustomAttributes());
+        $this->assertInstanceOf('\Magento\Wonderland\Model\Data\FakeRegion', $address->getRegion());
+        $this->assertInstanceOf('\Magento\Wonderland\Model\Data\FakeRegion', $address->getRegions()[0]);
+        $this->assertInstanceOf('\Magento\Wonderland\Model\Data\FakeRegion', $address->getRegions()[1]);
+    }
+
+
+    public function testModelPopulateWithArray()
+    {
+        $data = $this->getAddressArray();
+
         /** @var \Magento\Wonderland\Api\Data\FakeAddressDataBuilder $addressBuilder */
         $addressBuilder = $this->_objectManager->create('Magento\Wonderland\Api\Data\FakeAddressDataBuilder');
+        /** @var \Magento\Wonderland\Api\Data\FakeAddressInterface $address */
+        $address = $addressBuilder->populateWithArray($data)
+            ->create();
+        $this->assertInstanceOf('\Magento\Wonderland\Api\Data\FakeAddressInterface', $address);
+        $this->assertEquals('Johnes', $address->getLastname());
+        $this->assertEquals(true, $address->isDefaultShipping());
+        $this->assertEquals(false, $address->isDefaultBilling());
+        $this->assertNull($address->getCustomAttribute('test'));
+        $this->assertInstanceOf('\Magento\Wonderland\Api\Data\FakeRegionInterface', $address->getRegion());
+        $this->assertInstanceOf('\Magento\Wonderland\Api\Data\FakeRegionInterface', $address->getRegions()[0]);
+        $this->assertInstanceOf('\Magento\Wonderland\Api\Data\FakeRegionInterface', $address->getRegions()[1]);
+    }
 
-        $data = [
+    public function getAddressArray()
+    {
+        return [
             FakeAddressInterface::ID => 1,
             FakeAddressInterface::CITY => 'Kiev',
             FakeAddressInterface::REGION => [
@@ -84,18 +176,9 @@ class DataBuilderTest extends \PHPUnit_Framework_TestCase
             FakeAddressInterface::STREET => 'Oak rd.',
             FakeAddressInterface::TELEPHONE => '1234567',
             FakeAddressInterface::VAT_ID => '1',
-            'test' => 'xxx'
+            'test' => 'xxx',
+            FakeAddressInterface::DEFAULT_BILLING => false,
+            FakeAddressInterface::DEFAULT_SHIPPING => true,
         ];
-
-        /** @var \Magento\Wonderland\Api\Data\FakeAddressInterface $address */
-        $address = $addressBuilder->populateWithArray($data)
-            ->create();
-        $this->assertInstanceOf('\Magento\Wonderland\Api\Data\FakeAddressInterface', $address);
-        $this->assertEquals('Johnes', $address->getLastname());
-        $this->assertNull($address->getCustomAttribute('test'));
-        $this->assertInstanceOf('\Magento\Wonderland\Api\Data\FakeRegionInterface', $address->getRegion());
-        $this->assertInstanceOf('\Magento\Wonderland\Api\Data\FakeRegionInterface', $address->getRegions()[0]);
-        $this->assertInstanceOf('\Magento\Wonderland\Api\Data\FakeRegionInterface', $address->getRegions()[1]);
     }
-
-}
\ No newline at end of file
+}
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Api/Data/FakeAddressInterface.php b/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Api/Data/FakeAddressInterface.php
index a717126d57208c15bf617eb23ca07bc649812279..dbb7899946d1fa8f76768b2666d177e9df111b95 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Api/Data/FakeAddressInterface.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Api/Data/FakeAddressInterface.php
@@ -52,6 +52,8 @@ interface FakeAddressInterface extends ExtensibleDataInterface
     const PREFIX = 'prefix';
     const SUFFIX = 'suffix';
     const VAT_ID = 'vat_id';
+    const DEFAULT_BILLING = 'default_billing';
+    const DEFAULT_SHIPPING = 'default_shipping';
     /**#@-*/
 
     /**
@@ -172,4 +174,18 @@ interface FakeAddressInterface extends ExtensibleDataInterface
      * @return string|null
      */
     public function getVatId();
+
+    /**
+     * Get if this address is default shipping address.
+     *
+     * @return bool|null
+     */
+    public function isDefaultShipping();
+
+    /**
+     * Get if this address is default billing address
+     *
+     * @return bool|null
+     */
+    public function isDefaultBilling();
 }
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Model/Data/FakeAddress.php b/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Model/Data/FakeAddress.php
new file mode 100644
index 0000000000000000000000000000000000000000..1f9ad5e79eb37753956e5b71cdf5179a18450833
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Model/Data/FakeAddress.php
@@ -0,0 +1,222 @@
+<?php
+/**
+ *
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\Wonderland\Model\Data;
+
+use Magento\Framework\Api\AbstractExtensibleObject;
+
+class FakeAddress extends AbstractExtensibleObject
+{
+    /**#@+
+     * Constants for keys of data array
+     */
+    const ID = 'id';
+    const CUSTOMER_ID = 'customer_id';
+    const REGION = 'region';
+    const REGIONS = 'regions';
+    const COUNTRY_ID = 'country_id';
+    const STREET = 'street';
+    const COMPANY = 'company';
+    const TELEPHONE = 'telephone';
+    const FAX = 'fax';
+    const POSTCODE = 'postcode';
+    const CITY = 'city';
+    const FIRSTNAME = 'firstname';
+    const LASTNAME = 'lastname';
+    const MIDDLENAME = 'middlename';
+    const PREFIX = 'prefix';
+    const SUFFIX = 'suffix';
+    const VAT_ID = 'vat_id';
+    /**#@-*/
+
+    /**
+     * Get ID
+     *
+     * @return int|null
+     */
+    public function getId()
+    {
+        return $this->_get(self::ID);
+    }
+
+    /**
+     * Get customer ID
+     *
+     * @return int|null
+     */
+    public function getCustomerId()
+    {
+        return $this->_get(self::CUSTOMER_ID);
+    }
+
+    /**
+     * Get region
+     *
+     * @return \Magento\Wonderland\Model\Data\FakeRegion|null
+     */
+    public function getRegion()
+    {
+        return $this->_get(self::REGION);
+    }
+
+    /**
+     * Get region
+     *
+     * @return \Magento\Wonderland\Model\Data\FakeRegion[]|null
+     */
+    public function getRegions()
+    {
+        return $this->_get(self::REGIONS);
+    }
+
+    /**
+     * Two-letter country code in ISO_3166-2 format
+     *
+     * @return string|null
+     */
+    public function getCountryId()
+    {
+        return $this->_get(self::COUNTRY_ID);
+    }
+
+    /**
+     * Get street
+     *
+     * @return string[]|null
+     */
+    public function getStreet()
+    {
+        return $this->_get(self::STREET);
+    }
+
+    /**
+     * Get company
+     *
+     * @return string|null
+     */
+    public function getCompany()
+    {
+        return $this->_get(self::COMPANY);
+    }
+
+    /**
+     * Get telephone number
+     *
+     * @return string|null
+     */
+    public function getTelephone()
+    {
+        return $this->_get(self::TELEPHONE);
+    }
+
+    /**
+     * Get fax number
+     *
+     * @return string|null
+     */
+    public function getFax()
+    {
+        return $this->_get(self::FAX);
+    }
+
+    /**
+     * Get postcode
+     *
+     * @return string|null
+     */
+    public function getPostcode()
+    {
+        return $this->_get(self::POSTCODE);
+    }
+
+    /**
+     * Get city name
+     *
+     * @return string|null
+     */
+    public function getCity()
+    {
+        return $this->_get(self::CITY);
+    }
+
+    /**
+     * Get first name
+     *
+     * @return string|null
+     */
+    public function getFirstname()
+    {
+        return $this->_get(self::FIRSTNAME);
+    }
+
+    /**
+     * Get last name
+     *
+     * @return string|null
+     */
+    public function getLastname()
+    {
+        return $this->_get(self::LASTNAME);
+    }
+
+    /**
+     * Get middle name
+     *
+     * @return string|null
+     */
+    public function getMiddlename()
+    {
+        return $this->_get(self::MIDDLENAME);
+    }
+
+    /**
+     * Get prefix
+     *
+     * @return string|null
+     */
+    public function getPrefix()
+    {
+        return $this->_get(self::PREFIX);
+    }
+
+    /**
+     * Get suffix
+     *
+     * @return string|null
+     */
+    public function getSuffix()
+    {
+        return $this->_get(self::SUFFIX);
+    }
+
+    /**
+     * Get Vat id
+     *
+     * @return string|null
+     */
+    public function getVatId()
+    {
+        return $this->_get(self::VAT_ID);
+    }
+}
\ No newline at end of file
diff --git a/dev/tests/unit/testsuite/Magento/Framework/App/View/Deployment/Version/Generator/TimestampTest.php b/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Model/Data/FakeRegion.php
similarity index 56%
rename from dev/tests/unit/testsuite/Magento/Framework/App/View/Deployment/Version/Generator/TimestampTest.php
rename to dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Model/Data/FakeRegion.php
index 5f981048d3ed8e2672cc76000b9418de6c9173f4..6338ff41e36e8b56011a404d7f7b987c0e6e2f25 100644
--- a/dev/tests/unit/testsuite/Magento/Framework/App/View/Deployment/Version/Generator/TimestampTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Model/Data/FakeRegion.php
@@ -1,5 +1,6 @@
 <?php
 /**
+ *
  * Magento
  *
  * NOTICE OF LICENSE
@@ -21,27 +22,47 @@
  * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
+namespace Magento\Wonderland\Model\Data;
 
-namespace Magento\Framework\App\View\Deployment\Version\Generator;
+use Magento\Framework\Api\AbstractExtensibleObject;
 
-class TimestampTest extends \PHPUnit_Framework_TestCase
+class FakeRegion extends AbstractExtensibleObject
 {
+    /**#@+
+     * Constants for keys of data array
+     */
+    const REGION_CODE = 'region_code';
+    const REGION = 'region';
+    const REGION_ID = 'region_id';
+    /**#@-*/
+
     /**
-     * @var Timestamp
+     * Get region
+     *
+     * @return string
      */
-    private $object;
+    public function getRegion()
+    {
+        return $this->_get(self::REGION);
+    }
 
-    protected function setUp()
+    /**
+     * Get region code
+     *
+     * @return string
+     */
+    public function getRegionCode()
     {
-        $this->object = new Timestamp();
+        return $this->_get(self::REGION_CODE);
     }
 
-    public function testGenerate()
+    /**
+     * Get region id
+     *
+     * @return int
+     */
+    public function getRegionId()
     {
-        $result = $this->object->generate();
-        $this->assertNotEmpty($result);
-        $this->assertInternalType('string', $result);
-        sleep(1);
-        $this->assertNotEquals($result, $this->object->generate(), 'Unique value is expected');
+        return $this->_get(self::REGION_ID);
     }
-}
+}
\ No newline at end of file
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Model/FakeAddress.php b/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Model/FakeAddress.php
index d6f31fabd2209d76f53c01ef3e8397ac47c047fe..a9026a0909b7348775d6307f30926016a340612f 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Model/FakeAddress.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Model/FakeAddress.php
@@ -62,7 +62,7 @@ class FakeAddress extends AbstractExtensibleModel implements FakeAddressInterfac
     /**
      * Get region
      *
-     * @return \Magento\Wonderland\Api\Data\FakeRegionInterface|null
+     * @return \Magento\Wonderland\Api\Data\FakeRegionInterface[]|null
      */
     public function getRegions()
     {
@@ -198,4 +198,24 @@ class FakeAddress extends AbstractExtensibleModel implements FakeAddressInterfac
     {
         return $this->getData(self::VAT_ID);
     }
-}
\ No newline at end of file
+
+    /**
+     * Get if this address is default shipping address.
+     *
+     * @return bool|null
+     */
+    public function isDefaultShipping()
+    {
+        return $this->getData(self::DEFAULT_SHIPPING);
+    }
+
+    /**
+     * Get if this address is default billing address
+     *
+     * @return bool|null
+     */
+    public function isDefaultBilling()
+    {
+        return $this->getData(self::DEFAULT_BILLING);
+    }
+}
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Filter/Template/Tokenizer/ParameterTest.php b/dev/tests/integration/testsuite/Magento/Framework/Filter/Template/Tokenizer/ParameterTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..5cebeeb3a70225ab2dfe1dc774a4f1f4013fabf0
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Framework/Filter/Template/Tokenizer/ParameterTest.php
@@ -0,0 +1,114 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\Framework\Filter\Template\Tokenizer;
+
+class ParameterTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @param string $string
+     * @param array $values
+     * @dataProvider getValueDataProvider
+     */
+    public function testGetValue($string, $values)
+    {
+        $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
+        /** @var \Magento\Framework\Filter\Template\Tokenizer\Parameter $parameter */
+        $parameter = $objectManager->create('Magento\Framework\Filter\Template\Tokenizer\Parameter');
+        $parameter->setString($string);
+
+        foreach ($values as $value) {
+            $this->assertEquals($value, $parameter->getValue());
+        }
+    }
+
+    /**
+     * @dataProvider tokenizeDataProvider
+     * @param string $string
+     * @param array $params
+     */
+    public function testTokenize($string, $params)
+    {
+        $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
+        /** @var \Magento\Framework\Filter\Template\Tokenizer\Parameter $parameter */
+        $parameter = $objectManager->create('Magento\Framework\Filter\Template\Tokenizer\Parameter');
+        $parameter->setString($string);
+        $this->assertEquals($params, $parameter->tokenize());
+    }
+
+    /**
+     * @return array
+     */
+    public function tokenizeDataProvider()
+    {
+        return [
+            [
+                ' type="Magento\\Catalog\\Block\\Product\\Widget\\NewWidget" display_type="all_products"'
+                . ' products_count="10" template="product/widget/new/content/new_grid.phtml"',
+                [
+                    'type' => 'Magento\Catalog\Block\Product\Widget\NewWidget',
+                    'display_type' => 'all_products',
+                    'products_count' => 10,
+                    'template' => 'product/widget/new/content/new_grid.phtml'
+                ]
+            ],
+            [
+                ' type="Magento\Catalog\Block\Product\Widget\NewWidget" display_type="all_products"'
+                . ' products_count="10" template="product/widget/new/content/new_grid.phtml"',
+                [
+                    'type' => 'Magento\Catalog\Block\Product\Widget\NewWidget',
+                    'display_type' => 'all_products',
+                    'products_count' => 10,
+                    'template' => 'product/widget/new/content/new_grid.phtml'
+                ]
+            ]
+        ];
+    }
+
+    /**
+     * @return array
+     */
+    public function getValueDataProvider()
+    {
+        return [
+            [
+                ' type="Magento\\Catalog\\Block\\Product\\Widget\\NewWidget" display_type="all_products"'
+                . ' products_count="10" template="product/widget/new/content/new_grid.phtml"',
+                [
+                    'type="Magento\Catalog\Block\Product\Widget\NewWidget"',
+                    'display_type="all_products"',
+                    'products_count="10"'
+                ]
+            ],
+            [
+                ' type="Magento\Catalog\Block\Product\Widget\NewWidget" display_type="all_products"'
+                . ' products_count="10" template="product/widget/new/content/new_grid.phtml"',
+                [
+                    'type="Magento\Catalog\Block\Product\Widget\NewWidget"',
+                    'display_type="all_products"',
+                    'products_count="10"'
+                ]
+            ]
+        ];
+    }
+} 
\ No newline at end of file
diff --git a/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment.php b/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment.php
index 2bf266baadcec3a719349fa8999ca401039afd39..5f2d5bb560a04f6ab33c7f5c89f8cee7cb5921cd 100644
--- a/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment.php
+++ b/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment.php
@@ -26,7 +26,6 @@ $quote = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Ma
 $quote->load('test01', 'reserved_order_id');
 
 $payment = $quote->getPayment();
-$payment->setMethod(\Magento\Paypal\Model\Config::METHOD_WPP_EXPRESS);
-$payment->setAdditionalInformation(\Magento\Paypal\Model\Express\Checkout::PAYMENT_INFO_TRANSPORT_PAYER_ID, 123);
-
+$payment->setMethod(\Magento\Paypal\Model\Config::METHOD_WPP_EXPRESS)
+    ->setAdditionalInformation(\Magento\Paypal\Model\Express\Checkout::PAYMENT_INFO_TRANSPORT_PAYER_ID, 123);
 $quote->collectTotals()->save();
diff --git a/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment_payflow.php b/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment_payflow.php
index ff87ee92e4df68c96b7ec46b3763d606b0b44ef6..bb1997f88438b4de7e7e54cd40c6430abb41c159 100644
--- a/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment_payflow.php
+++ b/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment_payflow.php
@@ -120,7 +120,7 @@ $quote->collectTotals()->save();
 $payment = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Sales\Model\Order\Payment');
 $payment->setMethod(\Magento\Paypal\Model\Config::METHOD_WPS);
 
-$quote->getPayment()->setMethod(\Magento\Paypal\Model\Config::METHOD_WPS);
+$quote->getPayment()->setMethod(\Magento\Paypal\Model\Config::METHOD_WPS)->save();
 
 /** @var $service \Magento\Sales\Model\Service\Quote */
 $service = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
diff --git a/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment_standard.php b/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment_standard.php
index 308e524ab2f605ad9bf30fade97f7879d837254d..749426b94ec71c7b4fc83a15e502dd45b463f6e0 100644
--- a/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment_standard.php
+++ b/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment_standard.php
@@ -116,7 +116,7 @@ $quote->getShippingAddress()->setShippingMethod('flatrate_flatrate');
 $quote->getShippingAddress()->setCollectShippingRates(true);
 $quote->collectTotals()->save();
 
-$quote->getPayment()->setMethod(\Magento\Paypal\Model\Config::METHOD_WPS);
+$quote->getPayment()->setMethod(\Magento\Paypal\Model\Config::METHOD_WPS)->save();
 $quote->setCustomerEmail('admin@example.com');
 
 /** @var $service \Magento\Sales\Model\Service\Quote */
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/AdminOrder/CreateTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/AdminOrder/CreateTest.php
index 0b498eb491793118eb56c5fcaf1c52396ad5b772..494242ecbe74a30ad9dde224c203f4a9e37ce298 100644
--- a/dev/tests/integration/testsuite/Magento/Sales/Model/AdminOrder/CreateTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Model/AdminOrder/CreateTest.php
@@ -577,7 +577,7 @@ class CreateTest extends \PHPUnit_Framework_TestCase
         );
         $this->assertEquals(
             $paymentMethod,
-            $this->_model->getQuote()->getPaymentsCollection()->getItems()[0]->getData('method'),
+            $this->_model->getQuote()->getPayment()->getData('method'),
             'Precondition failed: Payment method data is invalid in create order model'
         );
     }
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/Service/QuoteTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/Service/QuoteTest.php
index 3e417f80252e972a28052ca96aec0068cd11e65e..7cdeb97df9d48ba907bed3d04c48061c882ab05a 100755
--- a/dev/tests/integration/testsuite/Magento/Sales/Model/Service/QuoteTest.php
+++ b/dev/tests/integration/testsuite/Magento/Sales/Model/Service/QuoteTest.php
@@ -129,7 +129,7 @@ class QuoteTest extends \PHPUnit_Framework_TestCase
         $customerData = $this->_customerBuilder->mergeDataObjectWithArray(
             $customerData,
             array(CustomerData::EMAIL => 'new@example.com')
-        );
+        )->create();
         $addresses = $this->_customerAddressService->getAddresses($existingCustomerId);
         $this->_serviceQuote->getQuote()->setCustomerData($customerData);
         $this->_serviceQuote->getQuote()->setCustomerAddressData($addresses);
diff --git a/dev/tests/integration/testsuite/Magento/SalesRule/Model/Resource/Report/CollectionTest.php b/dev/tests/integration/testsuite/Magento/SalesRule/Model/Resource/Report/CollectionTest.php
index 8f855558094ccd6a09498957388bbb5377edf85b..b6a9d7ad316acd364d70de19f95b1eb021ec3086 100644
--- a/dev/tests/integration/testsuite/Magento/SalesRule/Model/Resource/Report/CollectionTest.php
+++ b/dev/tests/integration/testsuite/Magento/SalesRule/Model/Resource/Report/CollectionTest.php
@@ -96,20 +96,36 @@ class CollectionTest extends \PHPUnit_Framework_TestCase
                 'period'    => 'day',
                 'date_from' => null,
                 'date_to'   => null,
-                'expected_period' => date('Y-m-d', time())
+                'expected_period' => $this->getNow()
             ],
             [
                 'period'    => 'undefinedPeriod',
                 'date_from' => null,
                 'date_to'   => null,
-                'expected_period' => date('Y-m-d', time())
+                'expected_period' => $this->getNow()
             ],
             [
                 'period'    => null,
                 'date_from' => date('Y-m-d', strtotime('-1 year', time())),
                 'date_to'   => date('Y-m-d', time()),
-                'expected_period' => date('Y-m-d', time())
+                'expected_period' => $this->getNow()
             ]
         );
     }
+
+    /**
+     * Retrieve date in MySQL timezone
+     *
+     * @return string
+     */
+    protected function getNow()
+    {
+        /** @var \Magento\Framework\App\Resource $resources */
+        $resources = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
+            'Magento\Framework\App\Resource'
+        );
+        $connection = $resources->getConnection('salesrule_read');
+        $now = $connection->fetchOne("SELECT CURDATE()");
+        return $now;
+    }
 }
diff --git a/dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/QuoteDetails/ItemBuilderTest.php b/dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/QuoteDetails/ItemBuilderTest.php
index 7b418c0423847c7e233469ce3942637d7b43167c..90ec5364aff509a2b2ebcc5db9818e7276bd324c 100644
--- a/dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/QuoteDetails/ItemBuilderTest.php
+++ b/dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/QuoteDetails/ItemBuilderTest.php
@@ -99,7 +99,8 @@ class ItemBuilderTest extends \PHPUnit_Framework_TestCase
         $itemExpected = $this->quoteDetailsItemBuilder->populateWithArray($data['dataMerged'])->create();
         $itemSomeFields = $this->quoteDetailsItemBuilder->populateWithArray($data['data1'])->create();
         $itemMoreFields = $this->quoteDetailsItemBuilder->populateWithArray($data['data2'])->create();
-        $itemMerged = $this->quoteDetailsItemBuilder->mergeDataObjects($itemSomeFields, $itemMoreFields);
+        $itemMerged = $this->quoteDetailsItemBuilder->mergeDataObjects($itemSomeFields, $itemMoreFields)
+            ->create();
         $this->assertEquals($itemExpected->__toArray(), $itemMerged->__toArray());
     }
 
@@ -108,7 +109,8 @@ class ItemBuilderTest extends \PHPUnit_Framework_TestCase
         $data = $this->getData();
         $itemExpected = $this->quoteDetailsItemBuilder->populateWithArray($data['dataMerged'])->create();
         $itemSomeFields = $this->quoteDetailsItemBuilder->populateWithArray($data['data1'])->create();
-        $itemMerged = $this->quoteDetailsItemBuilder->mergeDataObjectWithArray($itemSomeFields, $data['data2']);
+        $itemMerged = $this->quoteDetailsItemBuilder->mergeDataObjectWithArray($itemSomeFields, $data['data2'])
+            ->create();
         $this->assertEquals($itemExpected->__toArray(), $itemMerged->__toArray());
     }
 
diff --git a/dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/QuoteDetailsBuilderTest.php b/dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/QuoteDetailsBuilderTest.php
index 10138b0ca3a99a0354da15a5a2ab871e401d7f05..dd69938b3cfd1bb915a4d7362142b7534a20b601 100644
--- a/dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/QuoteDetailsBuilderTest.php
+++ b/dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/QuoteDetailsBuilderTest.php
@@ -98,7 +98,8 @@ class QuoteDetailsBuilderTest extends \PHPUnit_Framework_TestCase
         $taxRate = $this->builder->populateWithArray($data['dataMerged'])->create();
         $taxRate1 = $this->builder->populateWithArray($data['data1'])->create();
         $taxRate2 = $this->builder->populateWithArray($data['data2'])->create();
-        $taxRateMerged = $this->builder->mergeDataObjects($taxRate1, $taxRate2);
+        $taxRateMerged = $this->builder->mergeDataObjects($taxRate1, $taxRate2)
+            ->create();
         $this->assertEquals($taxRate->__toArray(), $taxRateMerged->__toArray());
     }
 
@@ -108,7 +109,8 @@ class QuoteDetailsBuilderTest extends \PHPUnit_Framework_TestCase
 
         $taxRate = $this->builder->populateWithArray($data['dataMerged'])->create();
         $taxRate1 = $this->builder->populateWithArray($data['data1'])->create();
-        $taxRateMerged = $this->builder->mergeDataObjectWithArray($taxRate1, $data['data2']);
+        $taxRateMerged = $this->builder->mergeDataObjectWithArray($taxRate1, $data['data2'])
+            ->create();
         $this->assertEquals($taxRate->__toArray(), $taxRateMerged->__toArray());
     }
 
diff --git a/dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/TaxDetails/AppliedTaxBuilderTest.php b/dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/TaxDetails/AppliedTaxBuilderTest.php
index 1c5c3aa521dfe7ef59c11d3668a55f1f064eaa78..c77d29612928285ee385274229ef64af56c6af66 100644
--- a/dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/TaxDetails/AppliedTaxBuilderTest.php
+++ b/dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/TaxDetails/AppliedTaxBuilderTest.php
@@ -164,7 +164,8 @@ class AppliedTaxBuilderTest extends \PHPUnit_Framework_TestCase
         $appliedTax = $this->builder->populateWithArray($dataMerged)->create();
         $appliedTax1 = $this->builder->populateWithArray($data1)->create();
         $appliedTax2 = $this->builder->populateWithArray($data2)->create();
-        $appliedTaxMerged = $this->builder->mergeDataObjects($appliedTax1, $appliedTax2);
+        $appliedTaxMerged = $this->builder->mergeDataObjects($appliedTax1, $appliedTax2)
+            ->create();
         $this->assertEquals($appliedTax->__toArray(), $appliedTaxMerged->__toArray());
     }
 
@@ -211,7 +212,8 @@ class AppliedTaxBuilderTest extends \PHPUnit_Framework_TestCase
 
         $appliedTax = $this->builder->populateWithArray($dataMerged)->create();
         $appliedTax1 = $this->builder->populateWithArray($data1)->create();
-        $appliedTaxMerged = $this->builder->mergeDataObjectWithArray($appliedTax1, $data2);
+        $appliedTaxMerged = $this->builder->mergeDataObjectWithArray($appliedTax1, $data2)
+            ->create();
         $this->assertEquals($appliedTax->__toArray(), $appliedTaxMerged->__toArray());
     }
 
diff --git a/dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/TaxRateBuilderTest.php b/dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/TaxRateBuilderTest.php
index 0a94d37f9e717cc9a6005ba8010171606e9d621e..4750e289ff0dba7f10fa771df94fa9b798df682f 100644
--- a/dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/TaxRateBuilderTest.php
+++ b/dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/TaxRateBuilderTest.php
@@ -116,7 +116,8 @@ class TaxRateBuilderTest extends \PHPUnit_Framework_TestCase
         $expectedTaxRate = $this->builder->populateWithArray($expectedResultsArray)->create();
         $taxRate1 = $this->builder->populateWithArray($firstRateArray)->create();
         $taxRate2 = $this->builder->populateWithArray($secondRateArray)->create();
-        $taxRateMerged = $this->builder->mergeDataObjects($taxRate1, $taxRate2);
+        $taxRateMerged = $this->builder->mergeDataObjects($taxRate1, $taxRate2)
+            ->create();
         $this->assertEquals($expectedTaxRate->__toArray(), $taxRateMerged->__toArray());
     }
 
@@ -128,7 +129,8 @@ class TaxRateBuilderTest extends \PHPUnit_Framework_TestCase
 
         $taxRate = $this->builder->populateWithArray($expectedResultsArray)->create();
         $taxRate1 = $this->builder->populateWithArray($firstRateArray)->create();
-        $taxRateMerged = $this->builder->mergeDataObjectWithArray($taxRate1, $secondRateArray);
+        $taxRateMerged = $this->builder->mergeDataObjectWithArray($taxRate1, $secondRateArray)
+            ->create();
         $this->assertEquals($taxRate->__toArray(), $taxRateMerged->__toArray());
     }
 
diff --git a/dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/TaxRateSearchResultsBuilderTest.php b/dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/TaxRateSearchResultsBuilderTest.php
index d9f00a2d47375770d36217b31a6db1deb8617d15..00f707e44af33bd25b89e0c0545948fd87edf2c6 100644
--- a/dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/TaxRateSearchResultsBuilderTest.php
+++ b/dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/TaxRateSearchResultsBuilderTest.php
@@ -110,7 +110,7 @@ class TaxRateSearchResultsBuilderTest extends \PHPUnit_Framework_TestCase
         $taxRateSearchResultsMerged = $this->taxRateSearchResultsBuilder->mergeDataObjects(
             $taxRateSearchResults1,
             $taxRateSearchResults2
-        );
+        )->create();
         $this->assertEquals($taxRateSearchResults->__toArray(), $taxRateSearchResultsMerged->__toArray());
     }
 
@@ -124,7 +124,7 @@ class TaxRateSearchResultsBuilderTest extends \PHPUnit_Framework_TestCase
         $taxRateSearchResultsMerged = $this->taxRateSearchResultsBuilder->mergeDataObjectWithArray(
             $taxRateSearchResults1,
             $secondDataSet
-        );
+        )->create();
         $this->assertEquals($taxRateSearchResults->__toArray(), $taxRateSearchResultsMerged->__toArray());
     }
 
diff --git a/dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/TaxRuleBuilderTest.php b/dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/TaxRuleBuilderTest.php
index 5855de2e250f955429502dfccfb236d7ac1c547f..a201cbd32d98f55c76fd6066ca46f116983e20a8 100644
--- a/dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/TaxRuleBuilderTest.php
+++ b/dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/TaxRuleBuilderTest.php
@@ -147,7 +147,8 @@ class TaxRuleBuilderTest extends \PHPUnit_Framework_TestCase
         $taxRuleExpected = $this->builder->populateWithArray($taxRuleDataExpected)->create();
         $taxRuleSomeFields = $this->builder->populateWithArray($taxRuleDataSomeFields)->create();
         $taxRuleMoreFields = $this->builder->populateWithArray($taxRuleDataMoreFields)->create();
-        $taxRuleMerged = $this->builder->mergeDataObjects($taxRuleSomeFields, $taxRuleMoreFields);
+        $taxRuleMerged = $this->builder->mergeDataObjects($taxRuleSomeFields, $taxRuleMoreFields)
+            ->create();
         $this->assertEquals($taxRuleExpected->__toArray(), $taxRuleMerged->__toArray());
     }
 
@@ -180,7 +181,8 @@ class TaxRuleBuilderTest extends \PHPUnit_Framework_TestCase
 
         $taxRuleExpected = $this->builder->populateWithArray($taxRuleDataExpected)->create();
         $taxRuleSomeFields = $this->builder->populateWithArray($taxRuleDataSomeFields)->create();
-        $taxRuleMerged = $this->builder->mergeDataObjectWithArray($taxRuleSomeFields, $taxRuleDataMoreFields);
+        $taxRuleMerged = $this->builder->mergeDataObjectWithArray($taxRuleSomeFields, $taxRuleDataMoreFields)
+            ->create();
         $this->assertEquals($taxRuleExpected->__toArray(), $taxRuleMerged->__toArray());
     }
 
diff --git a/dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/TaxRuleSearchResultsBuilderTest.php b/dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/TaxRuleSearchResultsBuilderTest.php
index e436e650b949649258c462c1e6ed734a5a6491e8..34923ed3227df08b1c7de2dfb2b4e259d3e92b98 100644
--- a/dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/TaxRuleSearchResultsBuilderTest.php
+++ b/dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/TaxRuleSearchResultsBuilderTest.php
@@ -191,7 +191,8 @@ class TaxRuleSearchResultsBuilderTest extends \PHPUnit_Framework_TestCase
         $taxRuleSearchResults = $this->builder->populateWithArray($dataMerged)->create();
         $taxRuleSearchResults1 = $this->builder->populateWithArray($data1)->create();
         $taxRuleSearchResults2 = $this->builder->populateWithArray($data2)->create();
-        $taxRuleSearchResultsMerged = $this->builder->mergeDataObjects($taxRuleSearchResults1, $taxRuleSearchResults2);
+        $taxRuleSearchResultsMerged = $this->builder->mergeDataObjects($taxRuleSearchResults1, $taxRuleSearchResults2)
+            ->create();
         $this->assertEquals($taxRuleSearchResults->__toArray(), $taxRuleSearchResultsMerged->__toArray());
     }
 
@@ -252,7 +253,8 @@ class TaxRuleSearchResultsBuilderTest extends \PHPUnit_Framework_TestCase
 
         $taxRuleSearchResults = $this->builder->populateWithArray($dataMerged)->create();
         $taxRuleSearchResults1 = $this->builder->populateWithArray($data1)->create();
-        $taxRuleSearchResultsMerged = $this->builder->mergeDataObjectWithArray($taxRuleSearchResults1, $data2);
+        $taxRuleSearchResultsMerged = $this->builder->mergeDataObjectWithArray($taxRuleSearchResults1, $data2)
+            ->create();
         $this->assertEquals($taxRuleSearchResults->__toArray(), $taxRuleSearchResultsMerged->__toArray());
     }
 
diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Di/CompilerTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Di/CompilerTest.php
index 005a517f8d1685a8aa132ab43869c667a34b4e16..d0cd5f25232ee021a758b02244cbf8050b2368d6 100644
--- a/dev/tests/static/testsuite/Magento/Test/Integrity/Di/CompilerTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Di/CompilerTest.php
@@ -337,6 +337,8 @@ class CompilerTest extends \PHPUnit_Framework_TestCase
                     => 'Magento\Framework\Api\Code\Generator\DataBuilder',
                 \Magento\Framework\Api\Code\Generator\SearchResultsBuilder::ENTITY_TYPE
                     => 'Magento\Framework\Api\Code\Generator\SearchResultsBuilder',
+                \Magento\Framework\Api\Code\Generator\DataBuilder::ENTITY_TYPE_BUILDER
+                    => 'Magento\Framework\Api\Code\Generator\DataBuilder',
                 \Magento\Framework\ObjectManager\Code\Generator\Factory::ENTITY_TYPE
                     => 'Magento\Framework\ObjectManager\Code\Generator\Factory',
                 \Magento\Framework\ObjectManager\Code\Generator\Repository::ENTITY_TYPE
@@ -345,8 +347,6 @@ class CompilerTest extends \PHPUnit_Framework_TestCase
                     => 'Magento\Framework\ObjectManager\Code\Generator\Converter',
                 \Magento\Framework\Api\Code\Generator\Mapper::ENTITY_TYPE
                     => 'Magento\Framework\Api\Code\Generator\Mapper',
-                \Magento\Framework\Api\Code\Generator\Builder::ENTITY_TYPE
-                    => 'Magento\Framework\Api\Code\Generator\Builder',
                 \Magento\Framework\Api\Code\Generator\SearchResults::ENTITY_TYPE
                     => 'Magento\Framework\Api\Code\Generator\SearchResults'
             )
diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/namespace.txt b/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/namespace.txt
index 84301c26bb5ded68f30e4886ae63616be6262f9b..29c77a9f6d2f7ec10314908658eecf06424291a6 100644
--- a/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/namespace.txt
+++ b/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/namespace.txt
@@ -25,6 +25,8 @@ dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/
 dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Api/Data/FakeRegionInterface.php
 dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Model/FakeAddress.php
 dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Model/FakeRegion.php
+dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Model/Data/FakeAddress.php
+dev/tests/integration/testsuite/Magento/Framework/Api/_files/Magento/Wonderland/Model/Data/FakeRegion.php
 dev/tests/static/testsuite/Magento/Test/Php/Exemplar/CodeMessTest/phpmd/input/coupling.php
 dev/tests/static/testsuite/Magento/Test/Php/Exemplar/CodeMessTest/phpmd/input/cyclomatic_complexity.php
 dev/tests/static/testsuite/Magento/Test/Php/Exemplar/CodeMessTest/phpmd/input/descendant_count.php
diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/reference.txt b/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/reference.txt
index 02d265b3e8bba4447eaaca1914aeb7e0852aba81..1d55de7b2756da549f1f0657a43e5146a24b7ea3 100644
--- a/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/reference.txt
+++ b/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/reference.txt
@@ -33,4 +33,7 @@ DbTest
 Model1
 Model3
 \Magento\Wonderland\Api\Data\FakeRegionInterface
+\Magento\Wonderland\Api\Data\FakeAddressInterface
+\Magento\Wonderland\Model\Data\FakeRegion
+\Magento\Wonderland\Model\Data\FakeAddress
 \Magento\Framework\Error\Processor
diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/_files/dependency_test/tables_ce.php b/dev/tests/static/testsuite/Magento/Test/Integrity/_files/dependency_test/tables_ce.php
index 553d2482c1e023bb33948f120b902ff4b1ad2d94..ae3641ceaa04e709df5fddc5d90cf3961a0f1a11 100644
--- a/dev/tests/static/testsuite/Magento/Test/Integrity/_files/dependency_test/tables_ce.php
+++ b/dev/tests/static/testsuite/Magento/Test/Integrity/_files/dependency_test/tables_ce.php
@@ -257,53 +257,49 @@ return array(
     'sales_bestsellers_aggregated_yearly' => 'Magento_Sales',
     'paypal_billing_agreement' => 'Magento_Paypal',
     'paypal_billing_agreement_order' => 'Magento_Paypal',
-    'sales_flat_creditmemo' => 'Magento_Sales',
-    'sales_flat_creditmemo_comment' => 'Magento_Sales',
-    'sales_flat_creditmemo_grid' => 'Magento_Sales',
-    'sales_flat_creditmemo_item' => 'Magento_Sales',
-    'sales_flat_invoice' => 'Magento_Sales',
-    'sales_flat_invoice_comment' => 'Magento_Sales',
-    'sales_flat_invoice_grid' => 'Magento_Sales',
-    'sales_flat_invoice_item' => 'Magento_Sales',
+    'sales_creditmemo' => 'Magento_Sales',
+    'sales_creditmemo_comment' => 'Magento_Sales',
+    'sales_creditmemo_grid' => 'Magento_Sales',
+    'sales_creditmemo_item' => 'Magento_Sales',
+    'sales_invoice' => 'Magento_Sales',
+    'sales_invoice_comment' => 'Magento_Sales',
+    'sales_invoice_grid' => 'Magento_Sales',
+    'sales_invoice_item' => 'Magento_Sales',
     'sales_invoiced_aggregated' => 'Magento_Sales',
     'sales_invoiced_aggregated_order' => 'Magento_Sales',
-    'sales_flat_order' => 'Magento_Sales',
-    'sales_flat_order_address' => 'Magento_Sales',
+    'sales_order' => 'Magento_Sales',
+    'sales_order_address' => 'Magento_Sales',
     'sales_order_aggregated_created' => 'Magento_Sales',
     'sales_order_aggregated_updated' => 'Magento_Sales',
-    'sales_flat_order_grid' => 'Magento_Sales',
-    'sales_flat_order_item' => 'Magento_Sales',
-    'sales_flat_order_item_option' => 'Magento_Sales',
-    'sales_flat_order_payment' => 'Magento_Sales',
+    'sales_order_grid' => 'Magento_Sales',
+    'sales_order_item' => 'Magento_Sales',
+    'sales_order_item_option' => 'Magento_Sales',
+    'sales_order_payment' => 'Magento_Sales',
     'sales_order_status' => 'Magento_Sales',
-    'sales_flat_order_status_history' => 'Magento_Sales',
+    'sales_order_status_history' => 'Magento_Sales',
     'sales_order_status_label' => 'Magento_Sales',
     'sales_order_status_state' => 'Magento_Sales',
     'sales_order_tax' => 'Magento_Tax',
     'sales_payment_transaction' => 'Magento_Sales',
-    'sales_flat_quote' => 'Magento_Sales',
-    'sales_flat_quote_address' => 'Magento_Sales',
-    'sales_flat_quote_address_item' => 'Magento_Sales',
-    'sales_flat_quote_shipping_rate' => 'Magento_Sales',
-    'sales_flat_quote_item' => 'Magento_Sales',
-    'sales_flat_quote_item_option' => 'Magento_Sales',
-    'sales_flat_quote_payment' => 'Magento_Sales',
+    'sales_quote' => 'Magento_Sales',
+    'sales_quote_address' => 'Magento_Sales',
+    'sales_quote_address_item' => 'Magento_Sales',
+    'sales_quote_shipping_rate' => 'Magento_Sales',
+    'sales_quote_item' => 'Magento_Sales',
+    'sales_quote_item_option' => 'Magento_Sales',
+    'sales_quote_payment' => 'Magento_Sales',
     'recurring_payment' => 'Magento_RecurringPayment',
     'recurring_payment_order' => 'Magento_RecurringPayment',
     'sales_refunded_aggregated' => 'Magento_Sales',
     'sales_refunded_aggregated_order' => 'Magento_Sales',
-    'sales_flat_shipment' => 'Magento_Sales',
-    'sales_flat_shipment_comment' => 'Magento_Sales',
-    'sales_flat_shipment_grid' => 'Magento_Sales',
-    'sales_flat_shipment_item' => 'Magento_Sales',
-    'sales_flat_shipment_track' => 'Magento_Sales',
+    'sales_shipment' => 'Magento_Sales',
+    'sales_shipment_comment' => 'Magento_Sales',
+    'sales_shipment_grid' => 'Magento_Sales',
+    'sales_shipment_item' => 'Magento_Sales',
+    'sales_shipment_track' => 'Magento_Sales',
     'sales_shipping_aggregated' => 'Magento_Sales',
     'sales_shipping_aggregated_order' => 'Magento_Sales',
-    'sales_order' => 'Magento_Sales',
-    'sales_quote' => 'Magento_Sales',
-    'sales_quote_address' => 'Magento_Sales',
     'sales_quote_entity' => 'Magento_Sales',
-    'sales_quote_item' => 'Magento_Sales',
     'sales_quote_temp' => 'Magento_Sales',
     'salesrule_coupon' => 'Magento_SalesRule',
     'coupon_aggregated' => 'Magento_SalesRule',
diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php
index 13ba81bc77a629c449f31068b4aae066ce75a41f..4d1eb0440e0ac6bc19b21450ab2717325c111b97 100644
--- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php
+++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php
@@ -2843,4 +2843,6 @@ return array(
     ['Magento\Framework\Filesystem\WrapperInterface'],
     ['Magento\Install'],
     ['Magento\Install\Model\Resource\Resource', 'Magento\Framework\Module\Resource'],
+    ['Magento\Framework\App\View\Deployment\Version\Generator\Timestamp', 'Magento\Framework\Stdlib\DateTime'],
+    ['Magento\Framework\App\View\Deployment\Version\GeneratorInterface'],
 );
diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php
index 8a856de5d7b76a932469258aa67da71ebb032c1e..1f18ce64679383b3fb23aa2188f6270ddfeec3d7 100644
--- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php
+++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php
@@ -32,6 +32,9 @@ return array(
     array('_addTaxPercents', 'Magento\Catalog\Model\Resource\Product\Collection'),
     array('_afterSaveCommit', 'Magento\Framework\Model\AbstractModel'),
     array('_afterSetConfig', 'Magento\Eav\Model\Entity\AbstractEntity'),
+    array('getAttributeCodes', 'Magento\Eav\Model\Entity\Type'),
+    array('_loadTypeAttributes', 'Magento\Eav\Model\Resource\Entity\Attribute'),
+    array('preloadAttributes', 'Magento\Eav\Model\Entity\Type\Config'),
     array('_aggregateByOrderCreatedAt', 'Magento\SalesRule\Model\Resource\Report\Rule'),
     array('_amountByCookies', 'Magento\Sendfriend\Model\Sendfriend'),
     array('setCookie', 'Magento\Sendfriend\Model\Sendfriend'),
@@ -48,6 +51,8 @@ return array(
     array('_avoidDoubleTransactionProcessing'),
     array('_beforeChildToHtml'),
     array('_beforeMove', 'Magento\Catalog\Model\Resource\Category\Tree'),
+    array('_getIsActiveAttributeId', 'Magento\Catalog\Model\Resource\Category\Tree', 'Magento\Catalog\Model\Resource\Category::getIsActiveAttributeId'),
+    array('_getIsActiveAttributeId', 'Magento\Catalog\Model\Resource\Category', 'Magento\Catalog\Model\Resource\Category::getIsActiveAttributeId'),
     array('_bytesToMbytes', 'Magento\Catalog\Model\Product\Option\Type\File'),
     array('_calculatePrice', 'Magento\Sales\Model\Quote\Item\AbstractItem'),
     array('_canBeStoreCodeInUrl', 'Magento\Framework\App\Request\Http'),
@@ -2052,4 +2057,14 @@ return array(
     ['_getAllowedActions', 'Magento\Customer\Controller\Account', 'Magento\Customer\Controller\Account::getAllowedActions'],
     ['isRegistrationAllowed', 'Magento\Customer\Controller\Account\CreatePost'],
     ['isRegistrationAllowed', 'Magento\Invitation\Controller\Customer\Account\CreatePost'],
+    ['getFlatIndexer', 'Magento\Catalog\Model\Category'],
+    ['getProductIndexer', 'Magento\Catalog\Model\Category'],
+    ['getFlatIndexer', 'Magento\Catalog\Model\Indexer\AbstractFlatState'],
+    ['getIndexer', 'Magento\Catalog\Model\Indexer\Category\Product\Plugin\StoreGroup'],
+    ['getIndexer', 'Magento\Catalog\Model\Indexer\Category\Flat\Plugin\StoreGroup'],
+    ['getIndexer', 'Magento\Catalog\Model\Indexer\Product\Price\Plugin\AbstractPlugin'],
+    ['getCategoryIndexer', 'Magento\Catalog\Model\Product'],
+    ['getCategoryIndexer', 'Magento\Catalog\Model\Product\Action'],
+    ['getIndexer', 'Magento\CatalogSearch\Model\Indexer\Fulltext\Plugin\AbstractPlugin'],
+    ['_getNewConditionModelInstance', 'Magento\Rule\Model\Condition\Combine'],
 );
diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_properties.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_properties.php
index de6a39980f662a5ebe30bf2884aab56808eacdc2..3ef0f559c993c8d31ec434ee9fa4c8d1315a1f9b 100644
--- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_properties.php
+++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_properties.php
@@ -361,4 +361,5 @@ return array(
     ['_openActions', 'Magento\Customer\Controller\Account', 'Magento\Customer\Controller\Account::openActions'],
     ['_session', 'Magento\Customer\Controller\Account', 'Magento\Customer\Controller\Account::session'],
     ['_directoryData', 'Magento\Customer\Model\Attribute\Data\Postcode', 'Magento\Customer\Model\Attribute\Data\Postcode::directoryHelper'],
+    ['_conditionModels', 'Magento\Rule\Model\Condition\Combine'],
 );
diff --git a/dev/tests/unit/framework/Magento/TestFramework/Helper/ObjectManager.php b/dev/tests/unit/framework/Magento/TestFramework/Helper/ObjectManager.php
index 51c4520f07b49e938e20de085f833a0402d22891..a35b7a99c64316f30b462178977acd93faf83308 100644
--- a/dev/tests/unit/framework/Magento/TestFramework/Helper/ObjectManager.php
+++ b/dev/tests/unit/framework/Magento/TestFramework/Helper/ObjectManager.php
@@ -170,7 +170,9 @@ class ObjectManager
      */
     public function getObject($className, array $arguments = array())
     {
-        if (is_subclass_of($className, '\Magento\Framework\Api\AbstractSimpleObjectBuilder')) {
+        if (is_subclass_of($className, '\Magento\Framework\Api\AbstractSimpleObjectBuilder')
+            || is_subclass_of($className, '\Magento\Framework\Api\Builder')
+        ) {
             return $this->getBuilder($className, $arguments);
         }
         $constructArguments = $this->getConstructArguments($className, $arguments);
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Block/Widget/LinkTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Block/Widget/LinkTest.php
index 84b58dcd75ea957f6ce75ed70c01b284b48b30c2..0dd593aaf19012f2eed481494de8995a0a9a4ea7 100644
--- a/dev/tests/unit/testsuite/Magento/Catalog/Block/Widget/LinkTest.php
+++ b/dev/tests/unit/testsuite/Magento/Catalog/Block/Widget/LinkTest.php
@@ -44,6 +44,11 @@ class LinkTest extends \PHPUnit_Framework_TestCase
      */
     protected $block;
 
+    /**
+     * @var \Magento\Catalog\Model\Resource\AbstractResource|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $entityResource;
+
     protected function setUp()
     {
         $this->storeManager = $this->getMock('Magento\Framework\StoreManagerInterface');
@@ -54,9 +59,12 @@ class LinkTest extends \PHPUnit_Framework_TestCase
             ->method('getStoreManager')
             ->will($this->returnValue($this->storeManager));
 
+        $this->entityResource = $this->getMock('Magento\Catalog\Model\Resource\AbstractResource', [], [], '', false);
+
         $this->block = (new ObjectManager($this))->getObject('Magento\Catalog\Block\Widget\Link', [
             'context' => $context,
             'urlFinder' => $this->urlFinder,
+            'entityResource' => $this->entityResource
         ]);
     }
 
@@ -157,6 +165,27 @@ class LinkTest extends \PHPUnit_Framework_TestCase
         $this->assertEquals($url . $separator . '___store=' . $storeCode, $this->block->getHref());
     }
 
+    public function testGetLabelWithCustomText()
+    {
+        $customText = 'Some text';
+        $this->block->setData('anchor_text', $customText);
+        $this->assertEquals($customText, $this->block->getLabel());
+    }
+
+    public function testGetLabelWithoutCustomText()
+    {
+        $category = 'Some text';
+        $id = 1;
+        $idPath = 'id/' . $id;
+        $store = 1;
+
+        $this->block->setData('id_path', $idPath);
+        $this->storeManager->expects($this->once())->method('getStore')->will($this->returnValue($store));
+        $this->entityResource->expects($this->once())->method('getAttributeRawValue')->with($id, 'name', $store)
+            ->will($this->returnValue($category));
+        $this->assertEquals($category, $this->block->getLabel());
+    }
+
     /**
      * @return array
      */
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute/SaveTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute/SaveTest.php
index 434af4d436c2bf34e22992307ec67a1a21de5650..03c586d6eda56e5e93fd0e0013095e0cbca1772b 100644
--- a/dev/tests/unit/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute/SaveTest.php
+++ b/dev/tests/unit/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute/SaveTest.php
@@ -99,11 +99,14 @@ class SaveTest extends \PHPUnit_Framework_TestCase
 
         $this->stockItemBuilder = $this->getMock(
             'Magento\CatalogInventory\Service\V1\Data\StockItemBuilder',
-            ['mergeDataObjectWithArray'],
+            ['mergeDataObjectWithArray', 'create'],
             [],
             '',
             false
         );
+        $this->stockItemBuilder->expects($this->any())
+            ->method('mergeDataObjectWithArray')
+            ->willReturn($this->stockItemBuilder);
 
         $this->stockIndexerProcessor = $this->getMock(
             'Magento\CatalogInventory\Model\Indexer\Stock\Processor',
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Flat/Plugin/StoreGroupTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Flat/Plugin/StoreGroupTest.php
index 724476e993a6dab67a776747cd503938a7407cb1..23f1a85972ba096a6bf3d5c6d29b11783821b5e2 100644
--- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Flat/Plugin/StoreGroupTest.php
+++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Flat/Plugin/StoreGroupTest.php
@@ -45,6 +45,11 @@ class StoreGroupTest extends \PHPUnit_Framework_TestCase
      */
     protected $subjectMock;
 
+    /**
+     * @var \Magento\Indexer\Model\IndexerRegistry|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $indexerRegistryMock;
+
     /**
      * @var \Closure
      */
@@ -85,14 +90,20 @@ class StoreGroupTest extends \PHPUnit_Framework_TestCase
         $this->closureMock = function () {
             return false;
         };
-        $this->model = new StoreGroup($this->indexerMock, $this->stateMock);
+
+        $this->indexerRegistryMock = $this->getMock('Magento\Indexer\Model\IndexerRegistry', ['get'], [], '', false);
+
+        $this->model = new StoreGroup($this->indexerRegistryMock, $this->stateMock);
     }
 
     public function testAroundSave()
     {
         $this->stateMock->expects($this->once())->method('isFlatEnabled')->will($this->returnValue(true));
-        $this->indexerMock->expects($this->once())->method('getId')->will($this->returnValue(1));
         $this->indexerMock->expects($this->once())->method('invalidate');
+        $this->indexerRegistryMock->expects($this->once())
+            ->method('get')
+            ->with(\Magento\Catalog\Model\Indexer\Category\Flat\State::INDEXER_ID)
+            ->will($this->returnValue($this->indexerMock));
         $this->groupMock->expects(
             $this->once()
         )->method(
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Flat/Plugin/StoreViewTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Flat/Plugin/StoreViewTest.php
index 0f66723ed9c7596addca826cb0bbb9343614b683..038425b8193b9c8866d44603e14e38e5179faccb 100644
--- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Flat/Plugin/StoreViewTest.php
+++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Flat/Plugin/StoreViewTest.php
@@ -40,6 +40,11 @@ class StoreViewTest extends \PHPUnit_Framework_TestCase
      */
     protected $model;
 
+    /**
+     * @var \Magento\Indexer\Model\IndexerRegistry|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $indexerRegistryMock;
+
     /**
      * @var \Closure
      */
@@ -72,7 +77,8 @@ class StoreViewTest extends \PHPUnit_Framework_TestCase
             return false;
         };
         $this->subjectMock = $this->getMock('Magento\Store\Model\Resource\Store', array(), array(), '', false);
-        $this->model = new StoreView($this->indexerMock, $this->stateMock);
+        $this->indexerRegistryMock = $this->getMock('Magento\Indexer\Model\IndexerRegistry', ['get'], [], '', false);
+        $this->model = new StoreView($this->indexerRegistryMock, $this->stateMock);
     }
 
     public function testAroundSaveNewObject()
@@ -117,8 +123,11 @@ class StoreViewTest extends \PHPUnit_Framework_TestCase
 
     protected function mockIndexerMethods()
     {
-        $this->indexerMock->expects($this->once())->method('getId')->will($this->returnValue(1));
         $this->indexerMock->expects($this->once())->method('invalidate');
+        $this->indexerRegistryMock->expects($this->once())
+            ->method('get')
+            ->with(\Magento\Catalog\Model\Indexer\Category\Flat\State::INDEXER_ID)
+            ->will($this->returnValue($this->indexerMock));
     }
 
     protected function mockConfigFlatEnabled()
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Flat/StateTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Flat/StateTest.php
index 85788f0448a0ba9713b7fe68aa4d7dec26e28443..6d03bfc346bf9407b03e9e1176230f4c5d11eaf2 100644
--- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Flat/StateTest.php
+++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Flat/StateTest.php
@@ -40,6 +40,11 @@ class StateTest extends \PHPUnit_Framework_TestCase
      */
     protected $flatIndexerMock;
 
+    /**
+     * @var \Magento\Indexer\Model\IndexerRegistry|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $indexerRegistryMock;
+
     protected function setUp()
     {
         $this->scopeConfigMock = $this->getMockForAbstractClass('Magento\Framework\App\Config\ScopeConfigInterface');
@@ -53,6 +58,8 @@ class StateTest extends \PHPUnit_Framework_TestCase
             true,
             array('getId', 'getState', '__wakeup')
         );
+
+        $this->indexerRegistryMock = $this->getMock('Magento\Indexer\Model\IndexerRegistry', ['get'], [], '', false);
     }
 
     public function testIsFlatEnabled()
@@ -69,7 +76,7 @@ class StateTest extends \PHPUnit_Framework_TestCase
 
         $this->model = new \Magento\Catalog\Model\Indexer\Category\Flat\State(
             $this->scopeConfigMock,
-            $this->flatIndexerMock
+            $this->indexerRegistryMock
         );
         $this->assertEquals(true, $this->model->isFlatEnabled());
     }
@@ -83,9 +90,12 @@ class StateTest extends \PHPUnit_Framework_TestCase
      */
     public function testIsAvailable($isAvailable, $isFlatEnabled, $isValid, $result)
     {
-        $this->flatIndexerMock->expects($this->any())->method('getId')->will($this->returnValue(null));
         $this->flatIndexerMock->expects($this->any())->method('load')->with('catalog_category_flat');
         $this->flatIndexerMock->expects($this->any())->method('isValid')->will($this->returnValue($isValid));
+        $this->indexerRegistryMock->expects($this->any())
+            ->method('get')
+            ->with(\Magento\Catalog\Model\Indexer\Category\Flat\State::INDEXER_ID)
+            ->will($this->returnValue($this->flatIndexerMock));
 
         $this->scopeConfigMock->expects(
             $this->any()
@@ -99,7 +109,7 @@ class StateTest extends \PHPUnit_Framework_TestCase
 
         $this->model = new \Magento\Catalog\Model\Indexer\Category\Flat\State(
             $this->scopeConfigMock,
-            $this->flatIndexerMock,
+            $this->indexerRegistryMock,
             $isAvailable
         );
         $this->assertEquals($result, $this->model->isAvailable());
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Flat/System/Config/ModeTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Flat/System/Config/ModeTest.php
index e1e58ca39ef1817cebb8560282edd1bf5e9c6ccc..5ae836ad25d175e48f85e3a0fc2806ebf85a9e4d 100644
--- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Flat/System/Config/ModeTest.php
+++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Flat/System/Config/ModeTest.php
@@ -40,10 +40,15 @@ class ModeTest extends \PHPUnit_Framework_TestCase
      */
     protected $indexerStateMock;
 
+    /**
+     * @var \Magento\Indexer\Model\IndexerRegistry|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $indexerRegistry;
+
     /**
      * @var \Magento\Indexer\Model\IndexerInterface|\PHPUnit_Framework_MockObject_MockObject
      */
-    protected $flatIndexerMock;
+    protected $flatIndexer;
 
     protected function setUp()
     {
@@ -55,15 +60,9 @@ class ModeTest extends \PHPUnit_Framework_TestCase
             '',
             false
         );
-        $this->flatIndexerMock = $this->getMockForAbstractClass(
-            'Magento\Indexer\Model\IndexerInterface',
-            array(),
-            '',
-            false,
-            false,
-            true,
-            array('load', 'setScheduled', '__wakeup')
-        );
+        $this->indexerRegistry = $this->getMock('Magento\Indexer\Model\IndexerRegistry', [], [], '', false);
+
+        $this->flatIndexer = $this->getMock('Magento\Indexer\Model\IndexerInterface');
 
         $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this);
         $this->model = $objectManager->getObject(
@@ -71,7 +70,7 @@ class ModeTest extends \PHPUnit_Framework_TestCase
             array(
                 'config' => $this->configMock,
                 'indexerState' => $this->indexerStateMock,
-                'flatIndexer' => $this->flatIndexerMock
+                'indexerRegistry' => $this->indexerRegistry
             )
         );
     }
@@ -105,8 +104,8 @@ class ModeTest extends \PHPUnit_Framework_TestCase
         $this->indexerStateMock->expects($this->never())->method('setStatus');
         $this->indexerStateMock->expects($this->never())->method('save');
 
-        $this->flatIndexerMock->expects($this->never())->method('load');
-        $this->flatIndexerMock->expects($this->never())->method('setScheduled');
+        $this->indexerRegistry->expects($this->never())->method('load');
+        $this->indexerRegistry->expects($this->never())->method('setScheduled');
 
         $this->model->processValue();
     }
@@ -156,8 +155,8 @@ class ModeTest extends \PHPUnit_Framework_TestCase
         );
         $this->indexerStateMock->expects($this->once())->method('save')->will($this->returnSelf());
 
-        $this->flatIndexerMock->expects($this->never())->method('load');
-        $this->flatIndexerMock->expects($this->never())->method('setScheduled');
+        $this->indexerRegistry->expects($this->never())->method('load');
+        $this->indexerRegistry->expects($this->never())->method('setScheduled');
 
         $this->model->processValue();
     }
@@ -191,16 +190,9 @@ class ModeTest extends \PHPUnit_Framework_TestCase
         $this->indexerStateMock->expects($this->never())->method('setStatus');
         $this->indexerStateMock->expects($this->never())->method('save');
 
-        $this->flatIndexerMock->expects(
-            $this->once()
-        )->method(
-            'load'
-        )->with(
-            'catalog_category_flat'
-        )->will(
-            $this->returnSelf()
-        );
-        $this->flatIndexerMock->expects($this->once())->method('setScheduled')->with(false);
+        $this->indexerRegistry->expects($this->once())->method('get')->with('catalog_category_flat')
+            ->willReturn($this->flatIndexer);
+        $this->flatIndexer->expects($this->once())->method('setScheduled')->with(false);
 
         $this->model->processValue();
     }
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/FlatTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/FlatTest.php
index 21a358a5e32d9e166147ad4c6f0839cb3e50bfbd..a61d489428c9903739ca1ddead49d237ae4621b1 100644
--- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/FlatTest.php
+++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/FlatTest.php
@@ -45,6 +45,11 @@ class FlatTest extends \PHPUnit_Framework_TestCase
      */
     protected $indexerMock;
 
+    /**
+     * @var \Magento\Indexer\Model\IndexerRegistry|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $indexerRegistryMock;
+
     protected function setUp()
     {
         $this->fullMock = $this->getMock(
@@ -73,25 +78,19 @@ class FlatTest extends \PHPUnit_Framework_TestCase
             array('getId', 'load', 'isInvalid', 'isWorking', '__wakeup')
         );
 
+        $this->indexerRegistryMock = $this->getMock('Magento\Indexer\Model\IndexerRegistry', ['get'], [], '', false);
+
         $this->model = new \Magento\Catalog\Model\Indexer\Category\Flat(
             $this->fullMock,
             $this->rowsMock,
-            $this->indexerMock
+            $this->indexerRegistryMock
         );
     }
 
     public function testExecuteWithIndexerInvalid()
     {
-        $this->indexerMock->expects(
-            $this->once()
-        )->method(
-            'load'
-        )->with(
-            \Magento\Catalog\Model\Indexer\Category\Flat\State::INDEXER_ID
-        )->will(
-            $this->returnSelf()
-        );
         $this->indexerMock->expects($this->once())->method('isInvalid')->will($this->returnValue(true));
+        $this->prepareIndexer();
 
         $this->rowsMock->expects($this->never())->method('create');
 
@@ -102,17 +101,9 @@ class FlatTest extends \PHPUnit_Framework_TestCase
     {
         $ids = array(1, 2, 3);
 
-        $this->indexerMock->expects(
-            $this->once()
-        )->method(
-            'load'
-        )->with(
-            \Magento\Catalog\Model\Indexer\Category\Flat\State::INDEXER_ID
-        )->will(
-            $this->returnSelf()
-        );
         $this->indexerMock->expects($this->once())->method('isInvalid')->will($this->returnValue(false));
         $this->indexerMock->expects($this->once())->method('isWorking')->will($this->returnValue(true));
+        $this->prepareIndexer();
 
         $rowMock = $this->getMock(
             'Magento\Catalog\Model\Indexer\Category\Flat\Action\Rows',
@@ -133,17 +124,9 @@ class FlatTest extends \PHPUnit_Framework_TestCase
     {
         $ids = array(1, 2, 3);
 
-        $this->indexerMock->expects(
-            $this->once()
-        )->method(
-            'load'
-        )->with(
-            \Magento\Catalog\Model\Indexer\Category\Flat\State::INDEXER_ID
-        )->will(
-            $this->returnSelf()
-        );
         $this->indexerMock->expects($this->once())->method('isInvalid')->will($this->returnValue(false));
         $this->indexerMock->expects($this->once())->method('isWorking')->will($this->returnValue(false));
+        $this->prepareIndexer();
 
         $rowMock = $this->getMock(
             'Magento\Catalog\Model\Indexer\Category\Flat\Action\Rows',
@@ -158,4 +141,12 @@ class FlatTest extends \PHPUnit_Framework_TestCase
 
         $this->model->execute($ids);
     }
+
+    protected function prepareIndexer()
+    {
+        $this->indexerRegistryMock->expects($this->once())
+            ->method('get')
+            ->with(\Magento\Catalog\Model\Indexer\Category\Flat\State::INDEXER_ID)
+            ->will($this->returnValue($this->indexerMock));
+    }
 }
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Product/Plugin/StoreGroupTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Product/Plugin/StoreGroupTest.php
index 78108d267133c9fcacdf75d353a74da8b3961a64..e84ca575b21112666ede7c7bf2990ecf0c4ba95f 100644
--- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Product/Plugin/StoreGroupTest.php
+++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Product/Plugin/StoreGroupTest.php
@@ -40,6 +40,11 @@ class StoreGroupTest extends \PHPUnit_Framework_TestCase
      */
     protected $subject;
 
+    /**
+     * @var \Magento\Indexer\Model\IndexerRegistry|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $indexerRegistryMock;
+
     /**
      * @var StoreView
      */
@@ -56,8 +61,10 @@ class StoreGroupTest extends \PHPUnit_Framework_TestCase
             true,
             array('getId', 'getState', '__wakeup')
         );
-        $this->model = new StoreGroup($this->indexerMock);
         $this->subject = $this->getMock('Magento\Store\Model\Resource\Group', array(), array(), '', false);
+        $this->indexerRegistryMock = $this->getMock('Magento\Indexer\Model\IndexerRegistry', ['get'], [], '', false);
+
+        $this->model = new StoreGroup($this->indexerRegistryMock);
     }
 
     /**
@@ -135,8 +142,11 @@ class StoreGroupTest extends \PHPUnit_Framework_TestCase
 
     protected function mockIndexerMethods()
     {
-        $this->indexerMock->expects($this->once())->method('getId')->will($this->returnValue(1));
         $this->indexerMock->expects($this->once())->method('invalidate');
+        $this->indexerRegistryMock->expects($this->once())
+            ->method('get')
+            ->with(\Magento\Catalog\Model\Indexer\Category\Product::INDEXER_ID)
+            ->will($this->returnValue($this->indexerMock));
     }
 
     protected function mockPluginProceed($returnValue = false)
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Product/Plugin/StoreViewTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Product/Plugin/StoreViewTest.php
index 3d1c930b4509483cbd82a2bcef5991523020829b..abd214376760abf66f7904a98dad3b0ee9e3e62b 100644
--- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Product/Plugin/StoreViewTest.php
+++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/Product/Plugin/StoreViewTest.php
@@ -40,6 +40,11 @@ class StoreViewTest extends \PHPUnit_Framework_TestCase
      */
     protected $model;
 
+    /**
+     * @var \Magento\Indexer\Model\IndexerRegistry|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $indexerRegistryMock;
+
     /**
      * @var \PHPUnit_Framework_MockObject_MockObject
      */
@@ -56,8 +61,10 @@ class StoreViewTest extends \PHPUnit_Framework_TestCase
             true,
             array('getId', 'getState', '__wakeup')
         );
-        $this->model = new StoreView($this->indexerMock);
         $this->subject = $this->getMock('Magento\Store\Model\Resource\Group', array(), array(), '', false);
+        $this->indexerRegistryMock = $this->getMock('Magento\Indexer\Model\IndexerRegistry', ['get'], [], '', false);
+
+        $this->model = new StoreView($this->indexerRegistryMock);
     }
 
     public function testAroundSaveNewObject()
@@ -77,6 +84,7 @@ class StoreViewTest extends \PHPUnit_Framework_TestCase
 
     public function testAroundSaveHasChanged()
     {
+        $this->mockIndexerMethods();
         $storeMock = $this->getMock(
             'Magento\Store\Model\Store',
             array('isObjectNew', 'dataHasChangedFor', '__wakeup'),
@@ -139,8 +147,11 @@ class StoreViewTest extends \PHPUnit_Framework_TestCase
 
     protected function mockIndexerMethods()
     {
-        $this->indexerMock->expects($this->once())->method('getId')->will($this->returnValue(1));
         $this->indexerMock->expects($this->once())->method('invalidate');
+        $this->indexerRegistryMock->expects($this->once())
+            ->method('get')
+            ->with(\Magento\Catalog\Model\Indexer\Category\Product::INDEXER_ID)
+            ->will($this->returnValue($this->indexerMock));
     }
 
     protected function mockPluginProceed($returnValue = false)
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/ProductTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/ProductTest.php
index e0a96d8d76d03952e69623c0f2476e7ba124ac75..5c64afc0c4697588f43be6083f912613f6d06100 100644
--- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/ProductTest.php
+++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Category/ProductTest.php
@@ -45,6 +45,11 @@ class ProductTest extends \PHPUnit_Framework_TestCase
      */
     protected $indexerMock;
 
+    /**
+     * @var \Magento\Indexer\Model\IndexerRegistry|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $indexerRegistryMock;
+
     protected function setUp()
     {
         $this->fullMock = $this->getMock(
@@ -73,10 +78,12 @@ class ProductTest extends \PHPUnit_Framework_TestCase
             array('getId', 'load', 'isInvalid', 'isWorking', '__wakeup')
         );
 
+        $this->indexerRegistryMock = $this->getMock('Magento\Indexer\Model\IndexerRegistry', ['get'], [], '', false);
+
         $this->model = new \Magento\Catalog\Model\Indexer\Category\Product(
             $this->fullMock,
             $this->rowsMock,
-            $this->indexerMock
+            $this->indexerRegistryMock
         );
     }
 
@@ -84,16 +91,8 @@ class ProductTest extends \PHPUnit_Framework_TestCase
     {
         $ids = array(1, 2, 3);
 
-        $this->indexerMock->expects(
-            $this->once()
-        )->method(
-            'load'
-        )->with(
-            'catalog_category_product'
-        )->will(
-            $this->returnSelf()
-        );
         $this->indexerMock->expects($this->once())->method('isWorking')->will($this->returnValue(true));
+        $this->prepareIndexer();
 
         $rowMock = $this->getMock(
             'Magento\Catalog\Model\Indexer\Category\Product\Action\Rows',
@@ -114,16 +113,8 @@ class ProductTest extends \PHPUnit_Framework_TestCase
     {
         $ids = array(1, 2, 3);
 
-        $this->indexerMock->expects(
-            $this->once()
-        )->method(
-            'load'
-        )->with(
-            'catalog_category_product'
-        )->will(
-            $this->returnSelf()
-        );
         $this->indexerMock->expects($this->once())->method('isWorking')->will($this->returnValue(false));
+        $this->prepareIndexer();
 
         $rowMock = $this->getMock(
             'Magento\Catalog\Model\Indexer\Category\Product\Action\Rows',
@@ -138,4 +129,12 @@ class ProductTest extends \PHPUnit_Framework_TestCase
 
         $this->model->execute($ids);
     }
+
+    protected function prepareIndexer()
+    {
+        $this->indexerRegistryMock->expects($this->any())
+            ->method('get')
+            ->with(\Magento\Catalog\Model\Indexer\Category\Product::INDEXER_ID)
+            ->will($this->returnValue($this->indexerMock));
+    }
 }
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/CategoryTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/CategoryTest.php
index e1d3a3ee1c63b8fdb026db2f7e7ac0bc94175568..63104731cdd5d3b7a24d439047335ff9044ec463 100644
--- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/CategoryTest.php
+++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/CategoryTest.php
@@ -45,6 +45,11 @@ class CategoryTest extends \PHPUnit_Framework_TestCase
      */
     protected $indexerMock;
 
+    /**
+     * @var \Magento\Indexer\Model\IndexerRegistry|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $indexerRegistryMock;
+
     protected function setUp()
     {
         $this->fullMock = $this->getMock(
@@ -73,10 +78,12 @@ class CategoryTest extends \PHPUnit_Framework_TestCase
             array('getId', 'load', 'isInvalid', 'isWorking', '__wakeup')
         );
 
+        $this->indexerRegistryMock = $this->getMock('Magento\Indexer\Model\IndexerRegistry', ['get'], [], '', false);
+
         $this->model = new \Magento\Catalog\Model\Indexer\Product\Category(
             $this->fullMock,
             $this->rowsMock,
-            $this->indexerMock
+            $this->indexerRegistryMock
         );
     }
 
@@ -84,16 +91,8 @@ class CategoryTest extends \PHPUnit_Framework_TestCase
     {
         $ids = array(1, 2, 3);
 
-        $this->indexerMock->expects(
-            $this->once()
-        )->method(
-            'load'
-        )->with(
-            'catalog_product_category'
-        )->will(
-            $this->returnSelf()
-        );
         $this->indexerMock->expects($this->once())->method('isWorking')->will($this->returnValue(true));
+        $this->prepareIndexer();
 
         $rowMock = $this->getMock(
             'Magento\Catalog\Model\Indexer\Product\Category\Action\Rows',
@@ -114,16 +113,8 @@ class CategoryTest extends \PHPUnit_Framework_TestCase
     {
         $ids = array(1, 2, 3);
 
-        $this->indexerMock->expects(
-            $this->once()
-        )->method(
-            'load'
-        )->with(
-            'catalog_product_category'
-        )->will(
-            $this->returnSelf()
-        );
         $this->indexerMock->expects($this->once())->method('isWorking')->will($this->returnValue(false));
+        $this->prepareIndexer();
 
         $rowMock = $this->getMock(
             'Magento\Catalog\Model\Indexer\Product\Category\Action\Rows',
@@ -138,4 +129,12 @@ class CategoryTest extends \PHPUnit_Framework_TestCase
 
         $this->model->execute($ids);
     }
+
+    protected function prepareIndexer()
+    {
+        $this->indexerRegistryMock->expects($this->once())
+            ->method('get')
+            ->with(\Magento\Catalog\Model\Indexer\Product\Category::INDEXER_ID)
+            ->will($this->returnValue($this->indexerMock));
+    }
 }
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/ProcessorTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/ProcessorTest.php
index 11d55081e84dfb5c8569940dcf3d3d283afc2f74..3bd416af67ac5aeb2fdf75e476c2b26e8e73736c 100644
--- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/ProcessorTest.php
+++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/ProcessorTest.php
@@ -41,14 +41,14 @@ class ProcessorTest extends \PHPUnit_Framework_TestCase
     protected $_indexerMock;
 
     /**
-     * @var \Magento\Indexer\Model\IndexerFactory|\PHPUnit_Framework_MockObject_MockObject
+     * @var \Magento\Catalog\Model\Indexer\Product\Flat\State|\PHPUnit_Framework_MockObject_MockObject
      */
-    protected $_indexerFactoryMock;
+    protected $_stateMock;
 
     /**
-     * @var \Magento\Catalog\Model\Indexer\Product\Flat\State|\PHPUnit_Framework_MockObject_MockObject
+     * @var \Magento\Indexer\Model\IndexerRegistry|\PHPUnit_Framework_MockObject_MockObject
      */
-    protected $_stateMock;
+    protected $indexerRegistryMock;
 
     public function setUp()
     {
@@ -63,15 +63,6 @@ class ProcessorTest extends \PHPUnit_Framework_TestCase
         );
         $this->_indexerMock->expects($this->any())->method('getId')->will($this->returnValue(1));
 
-        $this->_indexerFactoryMock = $this->getMock(
-            'Magento\Indexer\Model\IndexerFactory', array('create'), array(), '', false
-        );
-
-        $this->_indexerFactoryMock
-            ->expects($this->any())
-            ->method('create')
-            ->will($this->returnValue($this->_indexerMock));
-
         $this->_stateMock = $this->getMock(
             'Magento\Catalog\Model\Indexer\Product\Flat\State',
             array('isFlatEnabled'),
@@ -79,8 +70,9 @@ class ProcessorTest extends \PHPUnit_Framework_TestCase
             '',
             false
         );
+        $this->indexerRegistryMock = $this->getMock('Magento\Indexer\Model\IndexerRegistry', ['get'], [], '', false);
         $this->_model = $this->_objectManager->getObject('Magento\Catalog\Model\Indexer\Product\Flat\Processor', array(
-            'indexerFactory' => $this->_indexerFactoryMock,
+            'indexerRegistry' => $this->indexerRegistryMock,
             'state'  => $this->_stateMock
         ));
     }
@@ -90,6 +82,7 @@ class ProcessorTest extends \PHPUnit_Framework_TestCase
      */
     public function testGetIndexer()
     {
+        $this->prepareIndexer();
         $this->assertInstanceOf('\Magento\Indexer\Model\Indexer', $this->_model->getIndexer());
     }
 
@@ -100,6 +93,7 @@ class ProcessorTest extends \PHPUnit_Framework_TestCase
     {
         $this->_stateMock->expects($this->once())->method('isFlatEnabled')->will($this->returnValue(true));
         $this->_indexerMock->expects($this->once())->method('invalidate');
+        $this->prepareIndexer();
         $this->_model->markIndexerAsInvalid();
     }
 
@@ -112,4 +106,12 @@ class ProcessorTest extends \PHPUnit_Framework_TestCase
         $this->_indexerMock->expects($this->never())->method('invalidate');
         $this->_model->markIndexerAsInvalid();
     }
+
+    protected function prepareIndexer()
+    {
+        $this->indexerRegistryMock->expects($this->once())
+            ->method('get')
+            ->with(\Magento\Catalog\Model\Indexer\Product\Flat\Processor::INDEXER_ID)
+            ->will($this->returnValue($this->_indexerMock));
+    }
 }
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Price/Plugin/CatalogRuleTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Price/Plugin/CatalogRuleTest.php
deleted file mode 100644
index 11a6da24e4078df7ba33d6d2a688c10d6e581b76..0000000000000000000000000000000000000000
--- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Price/Plugin/CatalogRuleTest.php
+++ /dev/null
@@ -1,128 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-namespace Magento\Catalog\Model\Indexer\Product\Price\Plugin;
-
-
-class CatalogRuleTest extends \PHPUnit_Framework_TestCase
-{
-    /**
-     * @var \Magento\TestFramework\Helper\ObjectManager
-     */
-    protected $_objectManager;
-
-    /**
-     * @var \Magento\Catalog\Model\Indexer\Product\Price\Plugin\CatalogRule
-     */
-    protected $_model;
-
-    /**
-     * @var \Magento\Catalog\Model\Indexer\Product\Price\Processor|\PHPUnit_Framework_MockObject_MockObject
-     */
-    protected $_priceProcessorMock;
-
-    protected function setUp()
-    {
-        $this->_objectManager = new \Magento\TestFramework\Helper\ObjectManager($this);
-
-        $this->_priceProcessorMock = $this->getMock(
-            'Magento\Catalog\Model\Indexer\Product\Price\Processor', array(), array(), '', false
-        );
-
-        $this->_model = $this->_objectManager->getObject(
-            '\Magento\Catalog\Model\Indexer\Product\Price\Plugin\CatalogRule',
-            array(
-                'processor' => $this->_priceProcessorMock
-            )
-        );
-    }
-
-    public function testAfterApplyAll()
-    {
-        $this->_priceProcessorMock->expects($this->once())
-            ->method('markIndexerAsInvalid');
-
-        $ruleMock = $this->getMock('Magento\CatalogRule\Model\Rule', array(), array(), '', false);
-        $this->_model->afterApplyAll($ruleMock);
-    }
-
-    /**
-     * @param int|\Magento\Catalog\Model\Product $product
-     * @param int $expectedIdCall
-     * @dataProvider affectedProductsDataProvider
-     */
-    public function testAroundApplyToProduct($product, $expectedIdCall)
-    {
-        $this->_priceProcessorMock->expects($this->once())
-            ->method('reindexRow')
-            ->with($expectedIdCall);
-
-        $ruleMock = $this->getMock('Magento\CatalogRule\Model\Rule', array(), array(), '', false);
-        $this->_model->aroundApplyToProduct(
-            $ruleMock,
-            function () {
-
-            },
-            $product
-        );
-    }
-
-    /**
-     * @param int|\Magento\Catalog\Model\Product $product
-     * @param int $expectedIdCall
-     * @dataProvider affectedProductsDataProvider
-     */
-    public function testAroundApplyAllRulesToProduct($product, $expectedIdCall)
-    {
-        $this->_priceProcessorMock->expects($this->once())
-            ->method('reindexRow')
-            ->with($expectedIdCall);
-
-        $ruleMock = $this->getMock('Magento\CatalogRule\Model\Rule', array(), array(), '', false);
-        $this->_model->aroundApplyToProduct(
-            $ruleMock,
-            function () {
-
-            },
-            $product
-        );
-    }
-
-    /**
-     * @return array
-     */
-    public function affectedProductsDataProvider()
-    {
-        $productId = 11;
-        $productMock = $this->getMock('Magento\Catalog\Model\Product', array(), array(), '', false);
-        $productMock->expects($this->any())
-            ->method('getId')
-            ->will($this->returnValue($productId));
-
-        return array(
-            array($productId, $productId),
-            array($productMock, $productId)
-        );
-    }
-}
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Price/Plugin/CustomerGroupTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Price/Plugin/CustomerGroupTest.php
index 9dc1cf3520212ac557a0be04865287d92ab2eab2..915cda1b3c3f7652f57ad5ca804eaa8987dcf863 100644
--- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Price/Plugin/CustomerGroupTest.php
+++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Price/Plugin/CustomerGroupTest.php
@@ -40,6 +40,11 @@ class CustomerGroupTest extends \PHPUnit_Framework_TestCase
      */
     protected $_subjectMock;
 
+    /**
+     * @var \Magento\Indexer\Model\IndexerRegistry|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $indexerRegistryMock;
+
     public function setUp()
     {
         $this->_objectManager = new \Magento\TestFramework\Helper\ObjectManager($this);
@@ -55,12 +60,16 @@ class CustomerGroupTest extends \PHPUnit_Framework_TestCase
             '',
             false
         );
-        $indexerMock->expects($this->any())->method('getId')->will($this->returnValue(1));
         $indexerMock->expects($this->once())->method('invalidate');
+        $this->indexerRegistryMock = $this->getMock('Magento\Indexer\Model\IndexerRegistry', ['get'], [], '', false);
+        $this->indexerRegistryMock->expects($this->once())
+            ->method('get')
+            ->with(\Magento\Catalog\Model\Indexer\Product\Price\Processor::INDEXER_ID)
+            ->will($this->returnValue($indexerMock));
 
         $this->_model = $this->_objectManager->getObject(
             '\Magento\Catalog\Model\Indexer\Product\Price\Plugin\CustomerGroup',
-            array('indexer' => $indexerMock)
+            array('indexerRegistry' => $this->indexerRegistryMock)
         );
     }
 
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Price/System/Config/PriceScopeTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Price/System/Config/PriceScopeTest.php
index e1e7dc870344747ee94512fc746406d900085fb1..c32e4a143cc8e311428747bccd92047ca597e37f 100644
--- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Price/System/Config/PriceScopeTest.php
+++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Price/System/Config/PriceScopeTest.php
@@ -40,6 +40,11 @@ class PriceScopeTest extends \PHPUnit_Framework_TestCase
      */
     protected $_indexerMock;
 
+    /**
+     * @var \Magento\Indexer\Model\IndexerRegistry|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $indexerRegistryMock;
+
     public function setUp()
     {
         $this->_objectManager = new \Magento\TestFramework\Helper\ObjectManager($this);
@@ -51,7 +56,7 @@ class PriceScopeTest extends \PHPUnit_Framework_TestCase
             '',
             false
         );
-        $this->_indexerMock->expects($this->any())->method('load')->will($this->returnValue($this->_indexerMock));
+        $this->indexerRegistryMock = $this->getMock('Magento\Indexer\Model\IndexerRegistry', ['get'], [], '', false);
 
         $contextMock = $this->getMock('Magento\Framework\Model\Context', array(), array(), '', false);
         $registryMock = $this->getMock('Magento\Framework\Registry', array(), array(), '', false);
@@ -66,7 +71,7 @@ class PriceScopeTest extends \PHPUnit_Framework_TestCase
                 'registry' => $registryMock,
                 'storeManager' => $storeManagerMock,
                 'config' => $configMock,
-                'indexer' => $this->_indexerMock
+                'indexerRegistry' => $this->indexerRegistryMock
             )
         );
     }
@@ -74,6 +79,7 @@ class PriceScopeTest extends \PHPUnit_Framework_TestCase
     public function testProcessValue()
     {
         $this->_indexerMock->expects($this->once())->method('invalidate');
+        $this->prepareIndexer(1);
         $this->_model->setValue('1');
         $this->_model->processValue();
     }
@@ -81,6 +87,18 @@ class PriceScopeTest extends \PHPUnit_Framework_TestCase
     public function testProcessValueNotChanged()
     {
         $this->_indexerMock->expects($this->never())->method('invalidate');
+        $this->prepareIndexer(0);
         $this->_model->processValue();
     }
+
+    /**
+     * @param int $countCall
+     */
+    protected function prepareIndexer($countCall)
+    {
+        $this->indexerRegistryMock->expects($this->exactly($countCall))
+            ->method('get')
+            ->with(\Magento\Catalog\Model\Indexer\Product\Price\Processor::INDEXER_ID)
+            ->will($this->returnValue($this->_indexerMock));
+    }
 }
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/ActionTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/ActionTest.php
index f7a42576989ad7120de4beab7a2e309d8d0dfe31..9ceaa1b72e03bf37d6de8e485b34297ef84b85b3 100644
--- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/ActionTest.php
+++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/ActionTest.php
@@ -60,6 +60,11 @@ class ActionTest extends \PHPUnit_Framework_TestCase
      */
     protected $eavAttribute;
 
+    /**
+     * @var \Magento\Indexer\Model\IndexerRegistry|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $indexerRegistryMock;
+
     public function setUp()
     {
         $eventManagerMock = $this->getMock('Magento\Framework\Event\ManagerInterface');
@@ -109,6 +114,8 @@ class ActionTest extends \PHPUnit_Framework_TestCase
             '',
             false
         );
+        $this->indexerRegistryMock = $this->getMock('Magento\Indexer\Model\IndexerRegistry', ['get'], [], '', false);
+
         $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this);
         $this->model = $objectManager->getObject(
             '\Magento\Catalog\Model\Product\Action',
@@ -116,7 +123,7 @@ class ActionTest extends \PHPUnit_Framework_TestCase
                 'eventDispatcher' => $eventManagerMock,
                 'resource' => $this->resource,
                 'productWebsiteFactory' => $this->productWebsiteFactory,
-                'categoryIndexer' => $this->categoryIndexer,
+                'indexerRegistry' => $this->indexerRegistryMock,
                 'eavConfig' => $this->eavConfig
             ]
         );
@@ -134,15 +141,6 @@ class ActionTest extends \PHPUnit_Framework_TestCase
             ->with($productIds, $attrData, $storeId)
             ->will($this->returnSelf());
 
-        $this->categoryIndexer
-            ->expects($this->any())
-            ->method('getId')
-            ->will($this->returnValue(false));
-        $this->categoryIndexer
-            ->expects($this->any())
-            ->method('load')
-            ->with('catalog_product_category')
-            ->will($this->returnSelf());
         $this->categoryIndexer
             ->expects($this->any())
             ->method('isScheduled')
@@ -151,6 +149,7 @@ class ActionTest extends \PHPUnit_Framework_TestCase
             ->expects($this->any())
             ->method('reindexList')
             ->will($this->returnValue($productIds));
+        $this->prepareIndexer();
         $this->eavConfig
             ->expects($this->any())
             ->method('getAttribute')
@@ -181,15 +180,6 @@ class ActionTest extends \PHPUnit_Framework_TestCase
             ->with($websiteIds, $productIds)
             ->will($this->returnSelf());
 
-        $this->categoryIndexer
-            ->expects($this->any())
-            ->method('getId')
-            ->will($this->returnValue(false));
-        $this->categoryIndexer
-            ->expects($this->any())
-            ->method('load')
-            ->with('catalog_product_category')
-            ->will($this->returnSelf());
         $this->categoryIndexer
             ->expects($this->any())
             ->method('isScheduled')
@@ -198,6 +188,7 @@ class ActionTest extends \PHPUnit_Framework_TestCase
             ->expects($this->any())
             ->method('reindexList')
             ->will($this->returnValue($productIds));
+        $this->prepareIndexer();
         $this->model->updateWebsites($productIds, $websiteIds, $type);
         $this->assertEquals($this->model->getDataByKey('product_ids'), $productIdsUnique);
         $this->assertEquals($this->model->getDataByKey('website_ids'), $websiteIds);
@@ -211,4 +202,12 @@ class ActionTest extends \PHPUnit_Framework_TestCase
             ['$type' => 'remove', '$methodName' => 'removeProducts']
         ];
     }
+
+    protected function prepareIndexer()
+    {
+        $this->indexerRegistryMock->expects($this->once())
+            ->method('get')
+            ->with(\Magento\Catalog\Model\Indexer\Product\Category::INDEXER_ID)
+            ->will($this->returnValue($this->categoryIndexer));
+    }
 }
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/CategoryTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/CategoryTest.php
index edc76ac7c54e212646253cfcda714019a90149c3..d769f281d80432b98784266acc59a0d711684f9e 100644
--- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/CategoryTest.php
+++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/CategoryTest.php
@@ -43,8 +43,7 @@ class CategoryTest extends \PHPUnit_Framework_TestCase
             $this->returnValue('category_ids')
         );
 
-        $logger = $this->getMock('Magento\Framework\Logger', array(), array(), '', false);
-        $model = new \Magento\Catalog\Model\Product\Attribute\Backend\Category($logger);
+        $model = new \Magento\Catalog\Model\Product\Attribute\Backend\Category();
         $model->setAttribute($categoryAttribute);
 
         $model->afterLoad($product);
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice/AbstractTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice/AbstractTest.php
index a11d85e686c2bd1f81d1ea55725c6482441dc702..e73a980a912c25cb20f8d1629648563ea698d0b6 100644
--- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice/AbstractTest.php
+++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice/AbstractTest.php
@@ -42,7 +42,6 @@ class AbstractTest extends \PHPUnit_Framework_TestCase
         $this->_helper = $this->getMock('Magento\Catalog\Helper\Data', array('isPriceGlobal'), array(), '', false);
         $this->_helper->expects($this->any())->method('isPriceGlobal')->will($this->returnValue(true));
 
-        $loggerMock = $this->getMock('Magento\Framework\Logger', array(), array(), '', false);
         $currencyFactoryMock = $this->getMock('Magento\Directory\Model\CurrencyFactory', array(), array(), '', false);
         $storeManagerMock = $this->getMock('Magento\Framework\StoreManagerInterface', array(), array(), '', false);
         $productTypeMock = $this->getMock('Magento\Catalog\Model\Product\Type', array(), array(), '', false);
@@ -51,7 +50,6 @@ class AbstractTest extends \PHPUnit_Framework_TestCase
         $this->_model = $this->getMockForAbstractClass(
             'Magento\Catalog\Model\Product\Attribute\Backend\Groupprice\AbstractGroupprice',
             array(
-                'logger' => $loggerMock,
                 'currencyFactory' => $currencyFactoryMock,
                 'storeManager' => $storeManagerMock,
                 'catalogData' => $this->_helper,
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTest.php
index 6803d90bc60e80a21dea29f52769b60878cc9f3e..30ac0a1b706e4cca75ce0e95a30b1ae6c47c5605 100644
--- a/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTest.php
+++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTest.php
@@ -101,6 +101,11 @@ class ProductTest extends \PHPUnit_Framework_TestCase
      */
     private $website;
 
+    /**
+     * @var \Magento\Indexer\Model\IndexerRegistry|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $indexerRegistryMock;
+
     /**
      * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
      */
@@ -193,6 +198,7 @@ class ProductTest extends \PHPUnit_Framework_TestCase
         $storeManager->expects($this->any())
             ->method('getWebsite')
             ->will($this->returnValue($this->website));
+        $this->indexerRegistryMock = $this->getMock('Magento\Indexer\Model\IndexerRegistry', ['get'], [], '', false);
 
         $this->objectManagerHelper = new ObjectManagerHelper($this);
         $this->model = $this->objectManagerHelper->getObject(
@@ -200,7 +206,6 @@ class ProductTest extends \PHPUnit_Framework_TestCase
             [
                 'context' => $contextMock,
                 'catalogProductType' => $this->productTypeInstanceMock,
-                'categoryIndexer' => $this->categoryIndexerMock,
                 'productFlatIndexerProcessor' => $this->productFlatProcessor,
                 'productPriceIndexerProcessor' => $this->productPriceProcessor,
                 'catalogProductOption' => $this->optionInstanceMock,
@@ -208,6 +213,7 @@ class ProductTest extends \PHPUnit_Framework_TestCase
                 'resource' => $this->resource,
                 'registry' => $this->registry,
                 'categoryFactory' => $this->categoryFactory,
+                'indexerRegistry' => $this->indexerRegistryMock,
                 'data' => array('id' => 1)
             ]
         );
@@ -318,6 +324,7 @@ class ProductTest extends \PHPUnit_Framework_TestCase
         $this->categoryIndexerMock->expects($this->once())->method('reindexRow');
         $this->productFlatProcessor->expects($this->once())->method('reindexRow');
         $this->productPriceProcessor->expects($this->once())->method('reindexRow');
+        $this->prepareCategoryIndexer();
         $this->assertSame($this->model, $this->model->delete());
     }
 
@@ -325,6 +332,7 @@ class ProductTest extends \PHPUnit_Framework_TestCase
     {
         $this->categoryIndexerMock->expects($this->once())->method('reindexRow');
         $this->productFlatProcessor->expects($this->once())->method('reindexRow');
+        $this->prepareCategoryIndexer();
         $this->assertNull($this->model->reindex());
     }
 
@@ -465,4 +473,12 @@ class ProductTest extends \PHPUnit_Framework_TestCase
         $this->model->getResource()->expects($this->any())->method('addCommitCallback')->will($this->returnSelf());
         $this->model->getResource()->expects($this->any())->method('commit')->will($this->returnSelf());
     }
+
+    protected function prepareCategoryIndexer()
+    {
+        $this->indexerRegistryMock->expects($this->once())
+            ->method('get')
+            ->with(\Magento\Catalog\Model\Indexer\Product\Category::INDEXER_ID)
+            ->will($this->returnValue($this->categoryIndexerMock));
+    }
 }
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Plugin/Model/Resource/ConfigTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Plugin/Model/Resource/ConfigTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..aee4e934944f9f60a1bb947732851593ae7aa111
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/Catalog/Plugin/Model/Resource/ConfigTest.php
@@ -0,0 +1,199 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Catalog\Plugin\Model\Resource;
+
+use Magento\TestFramework\Helper\ObjectManager;
+
+class ConfigTest extends \PHPUnit_Framework_TestCase
+{
+    /** @var \Magento\Catalog\Plugin\Model\Resource\Config */
+    protected $config;
+
+    /** @var \Magento\Framework\App\CacheInterface|\PHPUnit_Framework_MockObject_MockObject */
+    protected $cache;
+
+    /** @var \Magento\Framework\App\Cache\StateInterface|\PHPUnit_Framework_MockObject_MockObject */
+    protected $cacheState;
+
+    /** @var \Magento\Catalog\Model\Resource\Config|\PHPUnit_Framework_MockObject_MockObject */
+    protected $subject;
+
+    protected function setUp()
+    {
+        $this->cache = $this->getMock('Magento\Framework\App\CacheInterface');
+        $this->cacheState = $this->getMock('Magento\Framework\App\Cache\StateInterface');
+        $this->subject = $this->getMock('Magento\Catalog\Model\Resource\Config', [], [], '', false);
+    }
+
+    public function testGetAttributesUsedInListingOnCacheDisabled()
+    {
+        $this->cache->expects($this->never())->method('load');
+
+        $this->assertEquals(
+            ['attributes'],
+            $this->getConfig(false)->aroundGetAttributesUsedInListing(
+                $this->subject,
+                $this->mockPluginProceed(['attributes'])
+            )
+        );
+    }
+
+    public function testGetAttributesUsedInListingFromCache()
+    {
+        $entityTypeId = 'type';
+        $storeId = 'store';
+        $attributes = ['attributes'];
+        $this->subject->expects($this->any())->method('getEntityTypeId')->willReturn($entityTypeId);
+        $this->subject->expects($this->any())->method('getStoreId')->willReturn($storeId);
+        $cacheId = \Magento\Catalog\Plugin\Model\Resource\Config::PRODUCT_LISTING_ATTRIBUTES_CACHE_ID . $entityTypeId
+            . '_' . $storeId;
+        $this->cache->expects($this->any())->method('load')->with($cacheId)->willReturn(serialize($attributes));
+
+        $this->assertEquals(
+            $attributes,
+            $this->getConfig(true)->aroundGetAttributesUsedInListing(
+                $this->subject,
+                $this->mockPluginProceed()
+            )
+        );
+    }
+
+    public function testGetAttributesUsedInListingWithCacheSave()
+    {
+        $entityTypeId = 'type';
+        $storeId = 'store';
+        $attributes = ['attributes'];
+        $this->subject->expects($this->any())->method('getEntityTypeId')->willReturn($entityTypeId);
+        $this->subject->expects($this->any())->method('getStoreId')->willReturn($storeId);
+        $cacheId = \Magento\Catalog\Plugin\Model\Resource\Config::PRODUCT_LISTING_ATTRIBUTES_CACHE_ID . $entityTypeId
+            . '_' . $storeId;
+        $this->cache->expects($this->any())->method('load')->with($cacheId)->willReturn(false);
+        $this->cache->expects($this->any())->method('save')->with(
+            serialize($attributes),
+            $cacheId,
+            [
+                \Magento\Eav\Model\Cache\Type::CACHE_TAG,
+                \Magento\Eav\Model\Entity\Attribute::CACHE_TAG
+            ]
+        );
+
+        $this->assertEquals(
+            $attributes,
+            $this->getConfig(true)->aroundGetAttributesUsedInListing(
+                $this->subject,
+                $this->mockPluginProceed($attributes)
+            )
+        );
+    }
+
+    public function testGetAttributesUsedForSortByOnCacheDisabled()
+    {
+        $this->cache->expects($this->never())->method('load');
+
+        $this->assertEquals(
+            ['attributes'],
+            $this->getConfig(false)->aroundGetAttributesUsedForSortBy(
+                $this->subject,
+                $this->mockPluginProceed(['attributes'])
+            )
+        );
+    }
+
+    public function testGetAttributesUsedForSortByFromCache()
+    {
+        $entityTypeId = 'type';
+        $storeId = 'store';
+        $attributes = ['attributes'];
+        $this->subject->expects($this->any())->method('getEntityTypeId')->willReturn($entityTypeId);
+        $this->subject->expects($this->any())->method('getStoreId')->willReturn($storeId);
+        $cacheId = \Magento\Catalog\Plugin\Model\Resource\Config::PRODUCT_LISTING_SORT_BY_ATTRIBUTES_CACHE_ID
+            . $entityTypeId . '_' . $storeId;
+        $this->cache->expects($this->any())->method('load')->with($cacheId)->willReturn(serialize($attributes));
+
+        $this->assertEquals(
+            $attributes,
+            $this->getConfig(true)->aroundGetAttributesUsedForSortBy(
+                $this->subject,
+                $this->mockPluginProceed()
+            )
+        );
+    }
+
+    public function testGetAttributesUsedForSortByWithCacheSave()
+    {
+        $entityTypeId = 'type';
+        $storeId = 'store';
+        $attributes = ['attributes'];
+        $this->subject->expects($this->any())->method('getEntityTypeId')->willReturn($entityTypeId);
+        $this->subject->expects($this->any())->method('getStoreId')->willReturn($storeId);
+        $cacheId = \Magento\Catalog\Plugin\Model\Resource\Config::PRODUCT_LISTING_SORT_BY_ATTRIBUTES_CACHE_ID
+            . $entityTypeId . '_' . $storeId;
+        $this->cache->expects($this->any())->method('load')->with($cacheId)->willReturn(false);
+        $this->cache->expects($this->any())->method('save')->with(
+            serialize($attributes),
+            $cacheId,
+            [
+                \Magento\Eav\Model\Cache\Type::CACHE_TAG,
+                \Magento\Eav\Model\Entity\Attribute::CACHE_TAG
+            ]
+        );
+
+        $this->assertEquals(
+            $attributes,
+            $this->getConfig(true)->aroundGetAttributesUsedForSortBy(
+                $this->subject,
+                $this->mockPluginProceed($attributes)
+            )
+        );
+    }
+
+    /**
+     * @param bool $cacheEnabledFlag
+     * @return \Magento\Catalog\Plugin\Model\Resource\Config
+     */
+    protected function getConfig($cacheEnabledFlag)
+    {
+        $this->cacheState->expects($this->any())->method('isEnabled')
+            ->with(\Magento\Eav\Model\Cache\Type::TYPE_IDENTIFIER)->willReturn($cacheEnabledFlag);
+        return (new ObjectManager($this))->getObject(
+            'Magento\Catalog\Plugin\Model\Resource\Config',
+            [
+                'cache' => $this->cache,
+                'cacheState' => $this->cacheState
+            ]
+        );
+    }
+
+    /**
+     * @param mixed $returnValue
+     * @return callable
+     */
+    protected function mockPluginProceed($returnValue = null)
+    {
+        return function () use ($returnValue) {
+            return $returnValue;
+        };
+    }
+}
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Data/ProductBuilderTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Data/ProductBuilderTest.php
index 6b4218d093f74ff7273444af906846151ce3467d..3959cc47c8691856d9cffbd4f3c4621e6da2e540 100644
--- a/dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Data/ProductBuilderTest.php
+++ b/dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Data/ProductBuilderTest.php
@@ -34,7 +34,7 @@ class ProductBuilderTest extends \PHPUnit_Framework_TestCase
     /** @var \Magento\Catalog\Service\V1\MetadataService */
     private $_productMetadataService;
 
-    /** @var \Magento\Framework\Api\AttributeValueBuilder */
+    /** @var \Magento\Framework\Api\AttributeDataBuilder */
     private $_valueBuilder;
 
     protected function setUp()
@@ -57,7 +57,7 @@ class ProductBuilderTest extends \PHPUnit_Framework_TestCase
             )
         );
         $this->_valueBuilder = $this->_objectManager->getObject(
-            'Magento\Framework\Api\AttributeValueBuilder'
+            'Magento\Framework\Api\AttributeDataBuilder'
         );
         $this->_productBuilder = $this->_objectManager->getObject(
             'Magento\Catalog\Service\V1\Data\ProductBuilder',
diff --git a/dev/tests/unit/testsuite/Magento/CatalogImportExport/Model/Indexer/Product/Price/Plugin/ImportTest.php b/dev/tests/unit/testsuite/Magento/CatalogImportExport/Model/Indexer/Product/Price/Plugin/ImportTest.php
index 01cd873bcad46ba48516d3720fe38230ded3165e..4a30b74e6b7e3e83652c4e9dc7d18491f0fb3ff6 100644
--- a/dev/tests/unit/testsuite/Magento/CatalogImportExport/Model/Indexer/Product/Price/Plugin/ImportTest.php
+++ b/dev/tests/unit/testsuite/Magento/CatalogImportExport/Model/Indexer/Product/Price/Plugin/ImportTest.php
@@ -40,6 +40,11 @@ class ImportTest extends \PHPUnit_Framework_TestCase
      */
     protected $_indexerMock;
 
+    /**
+     * @var \Magento\Indexer\Model\IndexerRegistry|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $indexerRegistryMock;
+
     public function setUp()
     {
         $this->_objectManager = new \Magento\TestFramework\Helper\ObjectManager($this);
@@ -51,17 +56,21 @@ class ImportTest extends \PHPUnit_Framework_TestCase
             '',
             false
         );
-        $this->_indexerMock->expects($this->any())->method('getId')->will($this->returnValue(1));
+        $this->indexerRegistryMock = $this->getMock('Magento\Indexer\Model\IndexerRegistry', ['get'], [], '', false);
 
         $this->_model = $this->_objectManager->getObject(
             'Magento\CatalogImportExport\Model\Indexer\Product\Price\Plugin\Import',
-            array('indexer' => $this->_indexerMock)
+            array('indexerRegistry' => $this->indexerRegistryMock)
         );
     }
 
     public function testAfterImportSource()
     {
         $this->_indexerMock->expects($this->once())->method('invalidate');
+        $this->indexerRegistryMock->expects($this->once())
+            ->method('get')
+            ->with(\Magento\Catalog\Model\Indexer\Product\Price\Processor::INDEXER_ID)
+            ->will($this->returnValue($this->_indexerMock));
 
         $importMock = $this->getMock('Magento\ImportExport\Model\Import', array(), array(), '', false);
         $this->assertEquals('return_value', $this->_model->afterImportSource($importMock, 'return_value'));
diff --git a/dev/tests/unit/testsuite/Magento/CatalogInventory/Service/V1/StockItemServiceTest.php b/dev/tests/unit/testsuite/Magento/CatalogInventory/Service/V1/StockItemServiceTest.php
index d1a843d44b12a3504707631ca863f5dbc4c06615..f99ebeee9f99e1ad2c34915e2c81018916d54167 100644
--- a/dev/tests/unit/testsuite/Magento/CatalogInventory/Service/V1/StockItemServiceTest.php
+++ b/dev/tests/unit/testsuite/Magento/CatalogInventory/Service/V1/StockItemServiceTest.php
@@ -496,28 +496,29 @@ class StockItemServiceTest extends \PHPUnit_Framework_TestCase
         $this->stockItemRegistry->expects($this->any())->method('retrieve')
             ->will($this->returnValueMap([[$productId, $stockItem]]));
 
-        $this->stockItemBuilder->expects($this->any())
-            ->method('create')
-            ->will($this->returnValue($stockItemDataObject));
-
         $stockItemDetailsDo->expects($this->any())
             ->method('__toArray')
             ->will($this->returnValue($stockItemDetailsDoData));
 
-        $this->stockItemBuilder->expects($this->any())
-            ->method('mergeDataObjectWithArray')
-            ->will($this->returnValue($stockItemDataObjectMerged));
-
         $stockItemDataObjectMerged->expects($this->any())
             ->method('__toArray')
             ->will($this->returnValue($dataToSave));
 
         // 3. Set expectations
         $stockItem->expects($this->any())->method('setData')->with($dataToSave)->will($this->returnSelf());
-        $this->stockItemBuilder->expects($this->any())
+        $this->stockItemBuilder->expects($this->at(0))
             ->method('populateWithArray')
             ->with($stockItemData)
             ->will($this->returnSelf());
+        $this->stockItemBuilder->expects($this->at(1))
+            ->method('create')
+            ->will($this->returnValue($stockItemDataObject));
+        $this->stockItemBuilder->expects($this->at(2))
+            ->method('mergeDataObjectWithArray')
+            ->will($this->returnValue($this->stockItemBuilder));
+        $this->stockItemBuilder->expects($this->at(3))
+            ->method('create')
+            ->will($this->returnValue($stockItemDataObjectMerged));
 
         // 4. Run tested method
         $result = $this->model->saveStockItemBySku($productSku, $stockItemDetailsDo);
diff --git a/dev/tests/unit/testsuite/Magento/CatalogRule/Model/CronTest.php b/dev/tests/unit/testsuite/Magento/CatalogRule/Model/CronTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..6680b635a89765be4b14dca47f2e6b8ba301c65e
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/CatalogRule/Model/CronTest.php
@@ -0,0 +1,57 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\CatalogRule\Model;
+
+use Magento\TestFramework\Helper\ObjectManager;
+
+class CronTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var \Magento\CatalogRule\Model\Indexer\Rule\RuleProductProcessor|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $ruleProductProcessor;
+
+    /**
+     * @var \Magento\CatalogRule\Model\Cron
+     */
+    protected $cron;
+
+    protected function setUp()
+    {
+        $this->ruleProductProcessor = $this->getMock('Magento\CatalogRule\Model\Indexer\Rule\RuleProductProcessor',
+            [], [], '', false);
+
+        $this->cron = (new ObjectManager($this))->getObject('Magento\CatalogRule\Model\Cron', [
+            'ruleProductProcessor' => $this->ruleProductProcessor,
+        ]);
+    }
+
+    public function testDailyCatalogUpdate()
+    {
+        $this->ruleProductProcessor->expects($this->once())->method('markIndexerAsInvalid');
+
+        $this->cron->dailyCatalogUpdate();
+    }
+}
diff --git a/dev/tests/unit/testsuite/Magento/CatalogRule/Model/Indexer/AbstractIndexerTest.php b/dev/tests/unit/testsuite/Magento/CatalogRule/Model/Indexer/AbstractIndexerTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..6a3f0d3e02474a4298edab98f1fee24ee7dcda11
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/CatalogRule/Model/Indexer/AbstractIndexerTest.php
@@ -0,0 +1,97 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\CatalogRule\Model\Indexer;
+
+class AbstractIndexerTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var \Magento\CatalogRule\Model\Indexer\IndexBuilder|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $indexBuilder;
+
+    /**
+     * @var \Magento\CatalogRule\Model\Indexer\AbstractIndexer|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $indexer;
+
+    protected function setUp()
+    {
+        $this->indexBuilder = $this->getMock('Magento\CatalogRule\Model\Indexer\IndexBuilder', [], [], '', false);
+
+        $this->indexer = $this->getMockForAbstractClass(
+            'Magento\CatalogRule\Model\Indexer\AbstractIndexer',
+            [$this->indexBuilder]
+        );
+    }
+
+    public function testExecute()
+    {
+        $ids = [1, 2, 5];
+        $this->indexer->expects($this->once())->method('doExecuteList')->with($ids);
+
+        $this->indexer->execute($ids);
+    }
+
+    public function testExecuteFull()
+    {
+        $this->indexBuilder->expects($this->once())->method('reindexFull');
+
+        $this->indexer->executeFull();
+    }
+
+    /**
+     * @expectedException \Magento\CatalogRule\CatalogRuleException
+     * @expectedExceptionMessage Could not rebuild index for empty products array
+     */
+    public function testExecuteListWithEmptyIds()
+    {
+        $this->indexer->executeList([]);
+    }
+
+    public function testExecuteList()
+    {
+        $ids = [1, 2, 5];
+        $this->indexer->expects($this->once())->method('doExecuteList')->with($ids);
+
+        $this->indexer->executeList($ids);
+    }
+
+    /**
+     * @expectedException \Magento\CatalogRule\CatalogRuleException
+     * @expectedExceptionMessage Could not rebuild index for undefined product
+     */
+    public function testExecuteRowWithEmptyId()
+    {
+        $this->indexer->executeRow(null);
+    }
+
+    public function testExecuteRow()
+    {
+        $id = 5;
+        $this->indexer->expects($this->once())->method('doExecuteRow')->with($id);
+
+        $this->indexer->executeRow($id);
+    }
+}
diff --git a/dev/tests/unit/testsuite/Magento/CatalogRule/Model/Indexer/Product/ProductRuleIndexerTest.php b/dev/tests/unit/testsuite/Magento/CatalogRule/Model/Indexer/Product/ProductRuleIndexerTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..ccc438ebffa4a0105539db2ea984dd61e22fd12f
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/CatalogRule/Model/Indexer/Product/ProductRuleIndexerTest.php
@@ -0,0 +1,88 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\CatalogRule\Model\Indexer\Product;
+
+use Magento\TestFramework\Helper\ObjectManager;
+
+class ProductRuleIndexerTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var \Magento\CatalogRule\Model\Indexer\IndexBuilder|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $indexBuilder;
+
+    /**
+     * @var \Magento\CatalogRule\Model\Indexer\Product\ProductRuleIndexer
+     */
+    protected $indexer;
+
+    protected function setUp()
+    {
+        $this->indexBuilder = $this->getMock('Magento\CatalogRule\Model\Indexer\IndexBuilder', [], [], '', false);
+
+        $this->indexer = (new ObjectManager($this))->getObject(
+            'Magento\CatalogRule\Model\Indexer\Product\ProductRuleIndexer',
+            [
+                'indexBuilder' => $this->indexBuilder,
+            ]
+        );
+    }
+    /**
+     * @param array $ids
+     * @param array $idsForIndexer
+     * @dataProvider dataProviderForExecuteList
+     */
+    public function testDoExecuteList($ids, $idsForIndexer)
+    {
+        $this->indexBuilder->expects($this->once())->method('reindexByIds')->with($idsForIndexer);
+
+        $this->indexer->executeList($ids);
+    }
+
+    /**
+     * @return array
+     */
+    public function dataProviderForExecuteList()
+    {
+        return [
+            [
+                [1, 2, 3, 2, 3],
+                [1, 2, 3],
+            ],
+            [
+                [1, 2, 3],
+                [1, 2, 3],
+            ],
+        ];
+    }
+
+    public function testDoExecuteRow()
+    {
+        $id = 5;
+        $this->indexBuilder->expects($this->once())->method('reindexById')->with($id);
+
+        $this->indexer->executeRow($id);
+    }
+}
diff --git a/dev/tests/unit/testsuite/Magento/CatalogRule/Model/Indexer/Rule/RuleProductIndexerTest.php b/dev/tests/unit/testsuite/Magento/CatalogRule/Model/Indexer/Rule/RuleProductIndexerTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..5e71cbe9ffa656e7562f36693edb370bd6e12b78
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/CatalogRule/Model/Indexer/Rule/RuleProductIndexerTest.php
@@ -0,0 +1,66 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\CatalogRule\Model\Indexer\Rule;
+
+use Magento\TestFramework\Helper\ObjectManager;
+
+class RuleProductIndexerTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var \Magento\CatalogRule\Model\Indexer\IndexBuilder|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $indexBuilder;
+
+    /**
+     * @var \Magento\CatalogRule\Model\Indexer\Rule\RuleProductIndexer
+     */
+    protected $indexer;
+
+    protected function setUp()
+    {
+        $this->indexBuilder = $this->getMock('Magento\CatalogRule\Model\Indexer\IndexBuilder', [], [], '', false);
+
+        $this->indexer = (new ObjectManager($this))->getObject(
+            'Magento\CatalogRule\Model\Indexer\Rule\RuleProductIndexer',
+            [
+                'indexBuilder' => $this->indexBuilder,
+            ]
+        );
+    }
+
+    public function testDoExecuteList()
+    {
+        $this->indexBuilder->expects($this->once())->method('reindexFull');
+
+        $this->indexer->executeList([1, 2, 5]);
+    }
+
+    public function testDoExecuteRow()
+    {
+        $this->indexBuilder->expects($this->once())->method('reindexFull');
+
+        $this->indexer->executeRow(5);
+    }
+}
diff --git a/dev/tests/unit/testsuite/Magento/CatalogRule/Model/Rule/Condition/ProductTest.php b/dev/tests/unit/testsuite/Magento/CatalogRule/Model/Rule/Condition/ProductTest.php
index 95ffddf34d3ed7501e692a56fb8690fd803f2936..b76cfac92896a1d1ccd57d982122b9f1ebf7a08b 100644
--- a/dev/tests/unit/testsuite/Magento/CatalogRule/Model/Rule/Condition/ProductTest.php
+++ b/dev/tests/unit/testsuite/Magento/CatalogRule/Model/Rule/Condition/ProductTest.php
@@ -58,7 +58,8 @@ class ProductTest extends \PHPUnit_Framework_TestCase
                 'getData',
                 'getId',
                 'getStoreId',
-                'getResource'
+                'getResource',
+                'addAttributeToSelect',
             ),
             array(),
             '',
diff --git a/dev/tests/unit/testsuite/Magento/CatalogRule/Model/Rule/JobTest.php b/dev/tests/unit/testsuite/Magento/CatalogRule/Model/Rule/JobTest.php
index a169032d5b70463df3deafde550150017836d8fd..8cb2e927033db78a0889b665f71548f1bf6f260c 100644
--- a/dev/tests/unit/testsuite/Magento/CatalogRule/Model/Rule/JobTest.php
+++ b/dev/tests/unit/testsuite/Magento/CatalogRule/Model/Rule/JobTest.php
@@ -28,21 +28,45 @@ class JobTest extends \PHPUnit_Framework_TestCase
     /**
      * Test for method applyAll
      *
-     * Checks that dispatch event with param value "catalogrule_apply_all" runs while applying all rules
+     * Checks that invalidate Rule indexer
+     *
+     * @return void
      */
     public function testApplyAll()
     {
-        $objectManagerHelper = new \Magento\TestFramework\Helper\ObjectManager($this);
-
-        $eventManager = $this->getMock('Magento\Framework\Event\ManagerInterface', array(), array(), '', false);
-        $eventManager->expects($this->once())->method('dispatch')->with($this->equalTo('catalogrule_apply_all'));
-
-        /** @var $jobModel \Magento\CatalogRule\Model\Rule\Job */
-        $jobModel = $objectManagerHelper->getObject(
-            'Magento\CatalogRule\Model\Rule\Job',
-            array('eventManager' => $eventManager)
+        $ruleProcessorMock = $this->getMock(
+            'Magento\CatalogRule\Model\Indexer\Rule\RuleProductProcessor',
+            ['markIndexerAsInvalid'],
+            [],
+            '',
+            false
         );
+        $ruleProcessorMock->expects($this->once())->method('markIndexerAsInvalid');
+        $jobModel = new Job($ruleProcessorMock);
+        $jobModel->applyAll();
+    }
 
+    /**
+     * @return void
+     */
+    public function testExceptionApplyAll()
+    {
+        $ruleProcessorMock = $this->getMock(
+            'Magento\CatalogRule\Model\Indexer\Rule\RuleProductProcessor',
+            ['markIndexerAsInvalid'],
+            [],
+            '',
+            false
+        );
+        $exceptionMessage = 'Test exception message';
+        $exceptionCallback = function () use ($exceptionMessage) {
+            throw new \Magento\Framework\Model\Exception($exceptionMessage);
+        };
+        $ruleProcessorMock->expects($this->once())
+            ->method('markIndexerAsInvalid')
+            ->will($this->returnCallback($exceptionCallback));
+        $jobModel = new Job($ruleProcessorMock);
         $jobModel->applyAll();
+        $this->assertEquals($exceptionMessage, $jobModel->getError());
     }
 }
diff --git a/dev/tests/unit/testsuite/Magento/CatalogRule/Plugin/Indexer/CategoryTest.php b/dev/tests/unit/testsuite/Magento/CatalogRule/Plugin/Indexer/CategoryTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..cea3a53a36d5953064100c27eeb3a5582817ddad
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/CatalogRule/Plugin/Indexer/CategoryTest.php
@@ -0,0 +1,81 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\CatalogRule\Plugin\Indexer;
+
+use Magento\TestFramework\Helper\ObjectManager;
+
+class CategoryTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var \Magento\CatalogRule\Model\Indexer\Product\ProductRuleProcessor|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $productRuleProcessor;
+
+    /**
+     * @var \Magento\Catalog\Model\Category|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $subject;
+
+    /**
+     * @var \Magento\CatalogRule\Plugin\Indexer\Category
+     */
+    protected $plugin;
+
+    protected function setUp()
+    {
+        $this->productRuleProcessor = $this->getMock('Magento\CatalogRule\Model\Indexer\Product\ProductRuleProcessor',
+            [], [], '', false);
+        $this->subject = $this->getMock('Magento\Catalog\Model\Category', ['getAffectedProductIds', '__wakeUp'], [],
+            '', false);
+
+        $this->plugin = (new ObjectManager($this))->getObject('Magento\CatalogRule\Plugin\Indexer\Category', [
+            'productRuleProcessor' => $this->productRuleProcessor,
+        ]);
+    }
+
+    public function testAfterSaveWithoutAffectedProductIds()
+    {
+        $this->subject->expects($this->any())->method('getAffectedProductIds')->will($this->returnValue([]));
+        $this->productRuleProcessor->expects($this->never())->method('reindexList');
+
+        $this->assertEquals($this->subject, $this->plugin->afterSave($this->subject, $this->subject));
+    }
+
+    public function testAfterSave()
+    {
+        $productIds = [1, 2, 3];
+
+        $this->subject->expects($this->any())->method('getAffectedProductIds')->will($this->returnValue($productIds));
+        $this->productRuleProcessor->expects($this->once())->method('reindexList')->with($productIds);
+
+        $this->assertEquals($this->subject, $this->plugin->afterSave($this->subject, $this->subject));
+    }
+
+    public function testAfterDelete()
+    {
+        $this->productRuleProcessor->expects($this->once())->method('markIndexerAsInvalid');
+
+        $this->assertEquals($this->subject, $this->plugin->afterDelete($this->subject, $this->subject));
+    }
+}
diff --git a/dev/tests/unit/testsuite/Magento/CatalogRule/Plugin/Indexer/CustomerGroupTest.php b/dev/tests/unit/testsuite/Magento/CatalogRule/Plugin/Indexer/CustomerGroupTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..ee9ab84ffad8a904499a7eb6886b445938799308
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/CatalogRule/Plugin/Indexer/CustomerGroupTest.php
@@ -0,0 +1,62 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\CatalogRule\Plugin\Indexer;
+
+use Magento\TestFramework\Helper\ObjectManager;
+
+class CustomerGroupTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var \Magento\CatalogRule\Model\Indexer\Rule\RuleProductProcessor|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $ruleProductProcessor;
+
+    /**
+     * @var \Magento\Customer\Model\Group|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $subject;
+
+    /**
+     * @var \Magento\CatalogRule\Plugin\Indexer\CustomerGroup
+     */
+    protected $plugin;
+
+    protected function setUp()
+    {
+        $this->ruleProductProcessor = $this->getMock('Magento\CatalogRule\Model\Indexer\Rule\RuleProductProcessor',
+            [], [], '', false);
+        $this->subject = $this->getMock('Magento\Customer\Model\Group', [], [], '', false);
+
+        $this->plugin = (new ObjectManager($this))->getObject('Magento\CatalogRule\Plugin\Indexer\CustomerGroup', [
+            'ruleProductProcessor' => $this->ruleProductProcessor,
+        ]);
+    }
+
+    public function testAfterDelete()
+    {
+        $this->ruleProductProcessor->expects($this->once())->method('markIndexerAsInvalid');
+
+        $this->assertEquals($this->subject, $this->plugin->afterDelete($this->subject, $this->subject));
+    }
+}
diff --git a/dev/tests/unit/testsuite/Magento/CatalogRule/Plugin/Indexer/ImportExportTest.php b/dev/tests/unit/testsuite/Magento/CatalogRule/Plugin/Indexer/ImportExportTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..ed16297c0963681c3dd3f0273b7638290e9dacf2
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/CatalogRule/Plugin/Indexer/ImportExportTest.php
@@ -0,0 +1,64 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\CatalogRule\Plugin\Indexer;
+
+use Magento\TestFramework\Helper\ObjectManager;
+
+class ImportExportTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var \Magento\CatalogRule\Model\Indexer\Rule\RuleProductProcessor|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $ruleProductProcessor;
+
+    /**
+     * @var \Magento\ImportExport\Model\Import|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $subject;
+
+    /**
+     * @var \Magento\CatalogRule\Plugin\Indexer\ImportExport
+     */
+    protected $plugin;
+
+    protected function setUp()
+    {
+        $this->ruleProductProcessor = $this->getMock('Magento\CatalogRule\Model\Indexer\Rule\RuleProductProcessor',
+            [], [], '', false);
+        $this->subject = $this->getMock('Magento\ImportExport\Model\Import', [], [], '', false);
+
+        $this->plugin = (new ObjectManager($this))->getObject('Magento\CatalogRule\Plugin\Indexer\ImportExport', [
+            'ruleProductProcessor' => $this->ruleProductProcessor,
+        ]);
+    }
+
+    public function testAfterImportSource()
+    {
+        $result = true;
+
+        $this->ruleProductProcessor->expects($this->once())->method('markIndexerAsInvalid');
+
+        $this->assertEquals($result, $this->plugin->afterImportSource($this->subject, $result));
+    }
+}
diff --git a/dev/tests/unit/testsuite/Magento/CatalogRule/Plugin/Indexer/Product/PriceIndexerTest.php b/dev/tests/unit/testsuite/Magento/CatalogRule/Plugin/Indexer/Product/PriceIndexerTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..fbb9194b94f0c8b53a33437946e2875d074fb40f
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/CatalogRule/Plugin/Indexer/Product/PriceIndexerTest.php
@@ -0,0 +1,90 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\CatalogRule\Plugin\Indexer\Product;
+
+use Magento\TestFramework\Helper\ObjectManager;
+
+class PriceIndexerTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var \Magento\Catalog\Model\Indexer\Product\Price\Processor|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $priceProcessor;
+
+    /**
+     * @var \Magento\Catalog\Model\Category|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $subject;
+
+    /**
+     * @var \Magento\CatalogRule\Plugin\Indexer\Product\PriceIndexer
+     */
+    protected $plugin;
+
+    protected function setUp()
+    {
+        $this->priceProcessor = $this->getMock(
+            'Magento\Catalog\Model\Indexer\Product\Price\Processor',
+            [],
+            [],
+            '',
+            false
+        );
+        $this->subject = $this->getMock('Magento\CatalogRule\Model\Indexer\IndexBuilder', [], [], '', false);
+
+        $this->plugin = (new ObjectManager($this))->getObject(
+            'Magento\CatalogRule\Plugin\Indexer\Product\PriceIndexer',
+            [
+                'priceProcessor' => $this->priceProcessor,
+            ]
+        );
+    }
+
+    public function testAfterSaveWithoutAffectedProductIds()
+    {
+        $this->priceProcessor->expects($this->once())->method('markIndexerAsInvalid');
+
+        $this->plugin->afterReindexFull($this->subject, $this->subject);
+    }
+
+    public function testReindexRow()
+    {
+        $productIds = [1,2,3];
+        $proceed = function () {
+            return;
+        };
+        $this->priceProcessor->expects($this->once())->method('reindexList')->with($productIds);
+        $this->plugin->aroundReindexByIds($this->subject, $proceed, $productIds);
+    }
+
+    public function testReindexRows()
+    {
+        $productId = 1;
+        $this->priceProcessor->expects($this->once())->method('reindexRow')->with($productId);
+        $proceed = function () {
+            return;
+        };
+        $this->plugin->aroundReindexById($this->subject, $proceed, $productId);
+    }
+}
diff --git a/dev/tests/unit/testsuite/Magento/CatalogRule/Plugin/Indexer/WebsiteTest.php b/dev/tests/unit/testsuite/Magento/CatalogRule/Plugin/Indexer/WebsiteTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..7f7657f5f965b4b32eeff98f3b5f53a40c9bf224
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/CatalogRule/Plugin/Indexer/WebsiteTest.php
@@ -0,0 +1,62 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\CatalogRule\Plugin\Indexer;
+
+use Magento\TestFramework\Helper\ObjectManager;
+
+class WebsiteTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var \Magento\CatalogRule\Model\Indexer\Rule\RuleProductProcessor|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $ruleProductProcessor;
+
+    /**
+     * @var \Magento\Store\Model\Website|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $subject;
+
+    /**
+     * @var \Magento\CatalogRule\Plugin\Indexer\Website
+     */
+    protected $plugin;
+
+    protected function setUp()
+    {
+        $this->ruleProductProcessor = $this->getMock('Magento\CatalogRule\Model\Indexer\Rule\RuleProductProcessor',
+            [], [], '', false);
+        $this->subject = $this->getMock('Magento\Store\Model\Website', [], [], '', false);
+
+        $this->plugin = (new ObjectManager($this))->getObject('Magento\CatalogRule\Plugin\Indexer\Website', [
+            'ruleProductProcessor' => $this->ruleProductProcessor,
+        ]);
+    }
+
+    public function testAfterDelete()
+    {
+        $this->ruleProductProcessor->expects($this->once())->method('markIndexerAsInvalid');
+
+        $this->assertEquals($this->subject, $this->plugin->afterDelete($this->subject, $this->subject));
+    }
+}
diff --git a/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/AttributeTest.php b/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/AttributeTest.php
index 3b63d00e22044f96914bd6087ef987692b649b4c..73eaa529d4ffea01289ee37b86eedec970ca5e54 100644
--- a/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/AttributeTest.php
+++ b/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/AttributeTest.php
@@ -35,6 +35,11 @@ class AttributeTest extends \PHPUnit_Framework_TestCase
      */
     protected $subjectMock;
 
+    /**
+     * @var \Magento\Indexer\Model\IndexerRegistry|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $indexerRegistryMock;
+
     /**
      * @var Attribute
      */
@@ -52,7 +57,8 @@ class AttributeTest extends \PHPUnit_Framework_TestCase
             true,
             ['getId', 'getState', '__wakeup']
         );
-        $this->model = new Attribute($this->indexerMock);
+        $this->indexerRegistryMock = $this->getMock('Magento\Indexer\Model\IndexerRegistry', ['get'], [], '', false);
+        $this->model = new Attribute($this->indexerRegistryMock);
     }
 
     /**
@@ -82,8 +88,8 @@ class AttributeTest extends \PHPUnit_Framework_TestCase
             return $this->subjectMock;
         };
 
-        $this->indexerMock->expects($this->exactly($invalidateCounter))->method('getId')->will($this->returnValue(1));
         $this->indexerMock->expects($this->exactly($invalidateCounter))->method('invalidate');
+        $this->prepareIndexer($invalidateCounter);
 
         $this->assertEquals(
             $this->subjectMock,
@@ -128,8 +134,8 @@ class AttributeTest extends \PHPUnit_Framework_TestCase
             return $this->subjectMock;
         };
 
-        $this->indexerMock->expects($this->exactly($invalidateCounter))->method('getId')->will($this->returnValue(1));
         $this->indexerMock->expects($this->exactly($invalidateCounter))->method('invalidate');
+        $this->prepareIndexer($invalidateCounter);
 
         $this->assertEquals(
             $this->subjectMock,
@@ -149,4 +155,15 @@ class AttributeTest extends \PHPUnit_Framework_TestCase
             [true, true, 0],
         ];
     }
+
+    /**
+     * @param $invalidateCounter
+     */
+    protected function prepareIndexer($invalidateCounter)
+    {
+        $this->indexerRegistryMock->expects($this->exactly($invalidateCounter))
+            ->method('get')
+            ->with(\Magento\CatalogSearch\Model\Indexer\Fulltext::INDEXER_ID)
+            ->will($this->returnValue($this->indexerMock));
+    }
 }
diff --git a/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/Product/ActionTest.php b/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/Product/ActionTest.php
index 62262f4d2387d24afb3e6344c2741037102539c3..320f3ccfca68b4c028f193b29a42f912453b96e4 100644
--- a/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/Product/ActionTest.php
+++ b/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/Product/ActionTest.php
@@ -38,6 +38,11 @@ class ActionTest extends \PHPUnit_Framework_TestCase
      */
     protected $subjectMock;
 
+    /**
+     * @var \Magento\Indexer\Model\IndexerRegistry|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $indexerRegistryMock;
+
     /**
      * @var Action
      */
@@ -56,15 +61,16 @@ class ActionTest extends \PHPUnit_Framework_TestCase
             true,
             array('getId', 'getState', '__wakeup')
         );
+        $this->indexerRegistryMock = $this->getMock('Magento\Indexer\Model\IndexerRegistry', ['get'], [], '', false);
 
-        $this->model = new Action($this->indexerMock);
+        $this->model = new Action($this->indexerRegistryMock);
     }
 
     public function testAroundUpdateAttributesNonScheduled()
     {
-        $this->indexerMock->expects($this->exactly(2))->method('getId')->will($this->returnValue(1));
         $this->indexerMock->expects($this->once())->method('isScheduled')->will($this->returnValue(false));
         $this->indexerMock->expects($this->once())->method('reindexList')->with(array(1, 2, 3));
+        $this->prepareIndexer();
 
         $closureMock = function ($productIds, $attrData, $storeId) {
             $this->assertEquals(array(1, 2, 3), $productIds);
@@ -81,9 +87,9 @@ class ActionTest extends \PHPUnit_Framework_TestCase
 
     public function testAroundUpdateAttributesScheduled()
     {
-        $this->indexerMock->expects($this->once())->method('getId')->will($this->returnValue(1));
         $this->indexerMock->expects($this->once())->method('isScheduled')->will($this->returnValue(true));
         $this->indexerMock->expects($this->never())->method('reindexList');
+        $this->prepareIndexer();
 
         $closureMock = function ($productIds, $attrData, $storeId) {
             $this->assertEquals(array(1, 2, 3), $productIds);
@@ -100,9 +106,9 @@ class ActionTest extends \PHPUnit_Framework_TestCase
 
     public function testAroundUpdateWebsitesNonScheduled()
     {
-        $this->indexerMock->expects($this->exactly(2))->method('getId')->will($this->returnValue(1));
         $this->indexerMock->expects($this->once())->method('isScheduled')->will($this->returnValue(false));
         $this->indexerMock->expects($this->once())->method('reindexList')->with(array(1, 2, 3));
+        $this->prepareIndexer();
 
         $closureMock = function ($productIds, $websiteIds, $type) {
             $this->assertEquals(array(1, 2, 3), $productIds);
@@ -116,9 +122,9 @@ class ActionTest extends \PHPUnit_Framework_TestCase
 
     public function testAroundUpdateWebsitesScheduled()
     {
-        $this->indexerMock->expects($this->once())->method('getId')->will($this->returnValue(1));
         $this->indexerMock->expects($this->once())->method('isScheduled')->will($this->returnValue(true));
         $this->indexerMock->expects($this->never())->method('reindexList');
+        $this->prepareIndexer();
 
         $closureMock = function ($productIds, $websiteIds, $type) {
             $this->assertEquals(array(1, 2, 3), $productIds);
@@ -129,4 +135,12 @@ class ActionTest extends \PHPUnit_Framework_TestCase
 
         $this->model->aroundUpdateWebsites($this->subjectMock, $closureMock, array(1, 2, 3), array(4, 5, 6), 'type');
     }
+
+    protected function prepareIndexer()
+    {
+        $this->indexerRegistryMock->expects($this->once())
+            ->method('get')
+            ->with(\Magento\CatalogSearch\Model\Indexer\Fulltext::INDEXER_ID)
+            ->will($this->returnValue($this->indexerMock));
+    }
 }
diff --git a/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/ProductTest.php b/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/ProductTest.php
index 14f65c8d4e4fe093250e0ec1bf91e51f8c2bb86f..636d013684c1ff56873e4104b8a32cc4b04c8d9f 100644
--- a/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/ProductTest.php
+++ b/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/ProductTest.php
@@ -38,6 +38,11 @@ class ProductTest extends \PHPUnit_Framework_TestCase
      */
     protected $subjectMock;
 
+    /**
+     * @var \Magento\Indexer\Model\IndexerRegistry|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $indexerRegistryMock;
+
     /**
      * @var Product
      */
@@ -57,14 +62,16 @@ class ProductTest extends \PHPUnit_Framework_TestCase
             array('getId', 'getState', '__wakeup')
         );
 
-        $this->model = new Product($this->indexerMock);
+        $this->indexerRegistryMock = $this->getMock('Magento\Indexer\Model\IndexerRegistry', ['get'], [], '', false);
+
+        $this->model = new Product($this->indexerRegistryMock);
     }
 
     public function testAfterSaveNonScheduled()
     {
-        $this->indexerMock->expects($this->exactly(2))->method('getId')->will($this->returnValue(1));
         $this->indexerMock->expects($this->once())->method('isScheduled')->will($this->returnValue(false));
         $this->indexerMock->expects($this->once())->method('reindexRow')->with(1);
+        $this->prepareIndexer();
 
         $this->subjectMock->expects($this->once())->method('getId')->will($this->returnValue(1));
 
@@ -73,9 +80,9 @@ class ProductTest extends \PHPUnit_Framework_TestCase
 
     public function testAfterSaveScheduled()
     {
-        $this->indexerMock->expects($this->once())->method('getId')->will($this->returnValue(1));
         $this->indexerMock->expects($this->once())->method('isScheduled')->will($this->returnValue(true));
         $this->indexerMock->expects($this->never())->method('reindexRow');
+        $this->prepareIndexer();
 
         $this->subjectMock->expects($this->once())->method('getId')->will($this->returnValue(1));
 
@@ -84,9 +91,9 @@ class ProductTest extends \PHPUnit_Framework_TestCase
 
     public function testAfterDeleteNonScheduled()
     {
-        $this->indexerMock->expects($this->exactly(2))->method('getId')->will($this->returnValue(1));
         $this->indexerMock->expects($this->once())->method('isScheduled')->will($this->returnValue(false));
         $this->indexerMock->expects($this->once())->method('reindexRow')->with(1);
+        $this->prepareIndexer();
 
         $this->subjectMock->expects($this->once())->method('getId')->will($this->returnValue(1));
 
@@ -95,12 +102,20 @@ class ProductTest extends \PHPUnit_Framework_TestCase
 
     public function testAfterDeleteScheduled()
     {
-        $this->indexerMock->expects($this->once())->method('getId')->will($this->returnValue(1));
         $this->indexerMock->expects($this->once())->method('isScheduled')->will($this->returnValue(true));
         $this->indexerMock->expects($this->never())->method('reindexRow');
+        $this->prepareIndexer();
 
         $this->subjectMock->expects($this->once())->method('getId')->will($this->returnValue(1));
 
         $this->assertEquals($this->subjectMock, $this->model->afterDelete($this->subjectMock));
     }
+
+    protected function prepareIndexer()
+    {
+        $this->indexerRegistryMock->expects($this->once())
+            ->method('get')
+            ->with(\Magento\CatalogSearch\Model\Indexer\Fulltext::INDEXER_ID)
+            ->will($this->returnValue($this->indexerMock));
+    }
 }
diff --git a/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/Store/GroupTest.php b/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/Store/GroupTest.php
index cadbac0a0aaaa5380646d252878a079b8968c294..b7fbc93277a62777d6b0b944ffad9fcafe025d3a 100644
--- a/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/Store/GroupTest.php
+++ b/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/Store/GroupTest.php
@@ -35,6 +35,11 @@ class GroupTest extends \PHPUnit_Framework_TestCase
      */
     protected $subjectMock;
 
+    /**
+     * @var \Magento\Indexer\Model\IndexerRegistry|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $indexerRegistryMock;
+
     /**
      * @var Group
      */
@@ -52,7 +57,8 @@ class GroupTest extends \PHPUnit_Framework_TestCase
             true,
             ['getId', 'getState', '__wakeup']
         );
-        $this->model = new Group($this->indexerMock);
+        $this->indexerRegistryMock = $this->getMock('Magento\Indexer\Model\IndexerRegistry', ['get'], [], '', false);
+        $this->model = new Group($this->indexerRegistryMock);
     }
 
     /**
@@ -82,8 +88,8 @@ class GroupTest extends \PHPUnit_Framework_TestCase
             return $this->subjectMock;
         };
 
-        $this->indexerMock->expects($this->exactly($invalidateCounter))->method('getId')->will($this->returnValue(1));
         $this->indexerMock->expects($this->exactly($invalidateCounter))->method('invalidate');
+        $this->prepareIndexer($invalidateCounter);
 
         $this->assertEquals(
             $this->subjectMock,
@@ -109,12 +115,23 @@ class GroupTest extends \PHPUnit_Framework_TestCase
      */
     public function testAfterDelete()
     {
-        $this->indexerMock->expects($this->once())->method('getId')->will($this->returnValue(1));
         $this->indexerMock->expects($this->once())->method('invalidate');
+        $this->prepareIndexer(1);
 
         $this->assertEquals(
             $this->subjectMock,
             $this->model->afterDelete($this->subjectMock, $this->subjectMock)
         );
     }
+
+    /**
+     * @param int $invalidateCounter
+     */
+    protected function prepareIndexer($invalidateCounter)
+    {
+        $this->indexerRegistryMock->expects($this->exactly($invalidateCounter))
+            ->method('get')
+            ->with(\Magento\CatalogSearch\Model\Indexer\Fulltext::INDEXER_ID)
+            ->will($this->returnValue($this->indexerMock));
+    }
 }
diff --git a/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/Store/ViewTest.php b/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/Store/ViewTest.php
index d8235f922d678079b954d871f4b36eb097b83418..9b892621f0ee5aa018f9468b5f0bffd616079d8f 100644
--- a/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/Store/ViewTest.php
+++ b/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/Store/ViewTest.php
@@ -35,6 +35,11 @@ class ViewTest extends \PHPUnit_Framework_TestCase
      */
     protected $subjectMock;
 
+    /**
+     * @var \Magento\Indexer\Model\IndexerRegistry|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $indexerRegistryMock;
+
     /**
      * @var View
      */
@@ -52,7 +57,8 @@ class ViewTest extends \PHPUnit_Framework_TestCase
             true,
             ['getId', 'getState', '__wakeup']
         );
-        $this->model = new View($this->indexerMock);
+        $this->indexerRegistryMock = $this->getMock('Magento\Indexer\Model\IndexerRegistry', ['get'], [], '', false);
+        $this->model = new View($this->indexerRegistryMock);
     }
 
     /**
@@ -77,8 +83,8 @@ class ViewTest extends \PHPUnit_Framework_TestCase
             return $this->subjectMock;
         };
 
-        $this->indexerMock->expects($this->exactly($invalidateCounter))->method('getId')->will($this->returnValue(1));
         $this->indexerMock->expects($this->exactly($invalidateCounter))->method('invalidate');
+        $this->prepareIndexer($invalidateCounter);
 
         $this->assertEquals(
             $this->subjectMock,
@@ -102,12 +108,23 @@ class ViewTest extends \PHPUnit_Framework_TestCase
      */
     public function testAfterDelete()
     {
-        $this->indexerMock->expects($this->once())->method('getId')->will($this->returnValue(1));
         $this->indexerMock->expects($this->once())->method('invalidate');
+        $this->prepareIndexer(1);
 
         $this->assertEquals(
             $this->subjectMock,
             $this->model->afterDelete($this->subjectMock, $this->subjectMock)
         );
     }
+
+    /**
+     * @param int $invalidateCounter
+     */
+    protected function prepareIndexer($invalidateCounter)
+    {
+        $this->indexerRegistryMock->expects($this->exactly($invalidateCounter))
+            ->method('get')
+            ->with(\Magento\CatalogSearch\Model\Indexer\Fulltext::INDEXER_ID)
+            ->will($this->returnValue($this->indexerMock));
+    }
 }
diff --git a/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Indexer/FulltextTest.php b/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Indexer/FulltextTest.php
index 2018abe258a6244c0ea7b088db16a3500d242754..aac6c01dac918ac5d9d4516838129ab1d7b55694 100644
--- a/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Indexer/FulltextTest.php
+++ b/dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Indexer/FulltextTest.php
@@ -45,6 +45,11 @@ class FulltextTest extends \PHPUnit_Framework_TestCase
      */
     protected $indexerMock;
 
+    /**
+     * @var \Magento\Indexer\Model\IndexerRegistry|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $indexerRegistryMock;
+
     protected function setUp()
     {
         $this->fullMock = $this->getMock(
@@ -73,10 +78,12 @@ class FulltextTest extends \PHPUnit_Framework_TestCase
             array('getId', 'load', 'isInvalid', 'isWorking', '__wakeup')
         );
 
+        $this->indexerRegistryMock = $this->getMock('Magento\Indexer\Model\IndexerRegistry', ['get'], [], '', false);
+
         $this->model = new \Magento\CatalogSearch\Model\Indexer\Fulltext(
             $this->fullMock,
             $this->rowsMock,
-            $this->indexerMock
+            $this->indexerRegistryMock
         );
     }
 
@@ -84,15 +91,10 @@ class FulltextTest extends \PHPUnit_Framework_TestCase
     {
         $ids = array(1, 2, 3);
 
-        $this->indexerMock->expects(
-            $this->once()
-        )->method(
-            'load'
-        )->with(
-            \Magento\CatalogSearch\Model\Indexer\Fulltext::INDEXER_ID
-        )->will(
-            $this->returnSelf()
-        );
+        $this->indexerRegistryMock->expects($this->once())
+            ->method('get')
+            ->with(\Magento\CatalogSearch\Model\Indexer\Fulltext::INDEXER_ID)
+            ->will($this->returnValue($this->indexerMock));
 
         $rowMock = $this->getMock(
             'Magento\CatalogSearch\Model\Indexer\Fulltext\Action\Rows',
diff --git a/dev/tests/unit/testsuite/Magento/Checkout/Model/Type/OnepageTest.php b/dev/tests/unit/testsuite/Magento/Checkout/Model/Type/OnepageTest.php
index 83be2df63c1f722ee382a50f023d0f19769d1887..63644bbb2ae7c266300ef47b8b54c51d086ab3af 100644
--- a/dev/tests/unit/testsuite/Magento/Checkout/Model/Type/OnepageTest.php
+++ b/dev/tests/unit/testsuite/Magento/Checkout/Model/Type/OnepageTest.php
@@ -399,6 +399,7 @@ class OnepageTest extends \PHPUnit_Framework_TestCase
         $addressMock->expects($this->any())->method('getData')->will($this->returnValue([]));
         $quoteMock->expects($this->any())->method('getBillingAddress')->will($this->returnValue($addressMock));
         $quoteMock->expects($this->any())->method('getCustomerId')->will($this->returnValue($quoteCustomerId));
+        $quoteMock->expects($this->once())->method('save');
         $formMock = $this->getMock('Magento\Customer\Model\Metadata\Form', [], [], '', false);
         $formMock->expects($this->atLeastOnce())->method('validateData')->will($this->returnValue($validateDataResult));
         $this->requestMock
diff --git a/dev/tests/unit/testsuite/Magento/Cms/Block/Adminhtml/Block/EditTest.php b/dev/tests/unit/testsuite/Magento/Cms/Block/Adminhtml/Block/EditTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..07d483b5dcf94396f88bdcb837641de0a1adc39b
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/Cms/Block/Adminhtml/Block/EditTest.php
@@ -0,0 +1,115 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\Cms\Block\Adminhtml\Block;
+
+/**
+ * @covers \Magento\Cms\Block\Adminhtml\Block\Edit
+ */
+class EditTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var \Magento\Cms\Block\Adminhtml\Block\Edit
+     */
+    protected $this;
+
+    /**
+     * @var \Magento\Framework\Registry|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $registryMock;
+
+    /**
+     * @var \Magento\Framework\Escaper|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $escaperMock;
+
+    /**
+     * @var \Magento\Cms\Model\Block|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $modelBlockMock;
+
+    protected function setUp()
+    {
+        $this->registryMock = $this->getMockBuilder('Magento\Framework\Registry')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->escaperMock = $this->getMockBuilder('Magento\Framework\Escaper')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->modelBlockMock = $this->getMockBuilder('Magento\Cms\Model\Block')
+            ->disableOriginalConstructor()
+            ->setMethods(
+                [
+                    'getId',
+                    'getTitle'
+                ]
+            )
+            ->getMock();
+
+        $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this);
+        $this->this = $objectManager->getObject(
+            'Magento\Cms\Block\Adminhtml\Block\Edit',
+            [
+                'registry' => $this->registryMock,
+                'escaper' => $this->escaperMock
+            ]
+        );
+    }
+
+    /**
+     * @covers \Magento\Cms\Block\Adminhtml\Block\Edit::getHeaderText
+     * @param integer|null $modelBlockId
+     *
+     * @dataProvider getHeaderTextDataProvider
+     */
+    public function testGetHeaderText($modelBlockId)
+    {
+        $title = 'some title';
+        $escapedTitle = 'escaped title';
+
+        $this->registryMock->expects($this->atLeastOnce())
+            ->method('registry')
+            ->with('cms_block')
+            ->willReturn($this->modelBlockMock);
+        $this->modelBlockMock->expects($this->atLeastOnce())
+            ->method('getId')
+            ->willReturn($modelBlockId);
+        $this->modelBlockMock->expects($this->any())
+            ->method('getTitle')
+            ->willReturn($title);
+        $this->escaperMock->expects($this->any())
+            ->method('escapeHtml')
+            ->with($title)
+            ->willReturn($escapedTitle);
+
+        $this->assertInternalType('string', $this->this->getHeaderText());
+    }
+
+    public function getHeaderTextDataProvider()
+    {
+        return [
+            'modelBlockId NOT EMPTY' => ['modelBlockId' => 1],
+            'modelBlockId IS EMPTY' => ['modelBlockId' => null]
+        ];
+    }
+}
diff --git a/dev/tests/unit/testsuite/Magento/Cms/Block/Adminhtml/Block/Widget/ChooserTest.php b/dev/tests/unit/testsuite/Magento/Cms/Block/Adminhtml/Block/Widget/ChooserTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..f78e828d2b36f95a1c8677be71261ea1dc2ccb7e
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/Cms/Block/Adminhtml/Block/Widget/ChooserTest.php
@@ -0,0 +1,265 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\Cms\Block\Adminhtml\Block\Widget;
+
+/**
+ * @covers \Magento\Cms\Block\Adminhtml\Block\Widget\Chooser
+ */
+class ChooserTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var \Magento\Cms\Block\Adminhtml\Block\Widget\Chooser
+     */
+    protected $this;
+
+    /**
+     * @var \Magento\Backend\Block\Template\Context
+     */
+    protected $context;
+
+    /**
+     * @var \Magento\Framework\View\LayoutInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $layoutMock;
+
+    /**
+     * @var \Magento\Framework\Math\Random|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $mathRandomMock;
+
+    /**
+     * @var \Magento\Framework\UrlInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $urlBuilderMock;
+
+    /**
+     * @var \Magento\Cms\Model\BlockFactory|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $blockFactoryMock;
+
+    /**
+     * @var \Magento\Framework\Data\Form\Element\AbstractElement|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $elementMock;
+
+    /**
+     * @var \Magento\Cms\Model\Block|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $modelBlockMock;
+
+    /**
+     * @var \Magento\Framework\View\Element\BlockInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $chooserMock;
+
+    protected function setUp()
+    {
+        $this->layoutMock = $this->getMockBuilder('Magento\Framework\View\LayoutInterface')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->mathRandomMock = $this->getMockBuilder('Magento\Framework\Math\Random')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->urlBuilderMock = $this->getMockBuilder('Magento\Framework\UrlInterface')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->blockFactoryMock = $this->getMockBuilder('Magento\Cms\Model\BlockFactory')
+            ->setMethods(
+                [
+                    'create'
+                ]
+            )
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->elementMock = $this->getMockBuilder('Magento\Framework\Data\Form\Element\AbstractElement')
+            ->disableOriginalConstructor()
+            ->setMethods(
+                [
+                    'getId',
+                    'getValue',
+                    'setData'
+                ]
+            )
+            ->getMock();
+        $this->modelBlockMock = $this->getMockBuilder('Magento\Cms\Model\Block')
+            ->disableOriginalConstructor()
+            ->setMethods(
+                [
+                    'getTitle',
+                    'load'
+                ]
+            )
+            ->getMock();
+        $this->chooserMock = $this->getMockBuilder('Magento\Framework\View\Element\BlockInterface')
+            ->disableOriginalConstructor()
+            ->setMethods(
+                [
+                    'setElement',
+                    'setConfig',
+                    'setFieldsetId',
+                    'setSourceUrl',
+                    'setUniqId',
+                    'setLabel',
+                    'toHtml'
+                ]
+            )
+            ->getMock();
+
+        $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this);
+        $this->context = $objectManager->getObject(
+            'Magento\Backend\Block\Template\Context',
+            [
+                'layout' => $this->layoutMock,
+                'mathRandom' => $this->mathRandomMock,
+                'urlBuilder' => $this->urlBuilderMock
+            ]
+        );
+        $this->this = $objectManager->getObject(
+            'Magento\Cms\Block\Adminhtml\Block\Widget\Chooser',
+            [
+                'context' => $this->context,
+                'blockFactory' => $this->blockFactoryMock
+            ]
+        );
+    }
+
+    /**
+     * @covers \Magento\Cms\Block\Adminhtml\Block\Widget\Chooser::prepareElementHtml
+     * @param string $elementValue
+     * @param integer|null $modelBlockId
+     *
+     * @dataProvider prepareElementHtmlDataProvider
+     */
+    public function testPrepareElementHtml($elementValue, $modelBlockId)
+    {
+        $elementId = 1;
+        $uniqId = '126hj4h3j73hk7b347jhkl37gb34';
+        $sourceUrl = 'cms/block_widget/chooser/126hj4h3j73hk7b347jhkl37gb34';
+        $config = ['key1' => 'value1'];
+        $fieldsetId = 2;
+        $html = 'some html';
+        $title = 'some title';
+
+        $this->this->setConfig($config);
+        $this->this->setFieldsetId($fieldsetId);
+
+        $this->elementMock->expects($this->atLeastOnce())
+            ->method('getId')
+            ->willReturn($elementId);
+        $this->mathRandomMock->expects($this->atLeastOnce())
+            ->method('getUniqueHash')
+            ->with($elementId)
+            ->willReturn($uniqId);
+        $this->urlBuilderMock->expects($this->atLeastOnce())
+            ->method('getUrl')
+            ->with('cms/block_widget/chooser', ['uniq_id' => $uniqId])
+            ->willReturn($sourceUrl);
+        $this->layoutMock->expects($this->atLeastOnce())
+            ->method('createBlock')
+            ->with('Magento\Widget\Block\Adminhtml\Widget\Chooser')
+            ->willReturn($this->chooserMock);
+        $this->chooserMock->expects($this->atLeastOnce())
+            ->method('setElement')
+            ->with($this->elementMock)
+            ->willReturnSelf();
+        $this->chooserMock->expects($this->atLeastOnce())
+            ->method('setConfig')
+            ->with($config)
+            ->willReturnSelf();
+        $this->chooserMock->expects($this->atLeastOnce())
+            ->method('setFieldsetId')
+            ->with($fieldsetId)
+            ->willReturnSelf();
+        $this->chooserMock->expects($this->atLeastOnce())
+            ->method('setSourceUrl')
+            ->with($sourceUrl)
+            ->willReturnSelf();
+        $this->chooserMock->expects($this->atLeastOnce())
+            ->method('setUniqId')
+            ->with($uniqId)
+            ->willReturnSelf();
+        $this->elementMock->expects($this->atLeastOnce())
+            ->method('getValue')
+            ->willReturn($elementValue);
+        $this->blockFactoryMock->expects($this->any())
+            ->method('create')
+            ->willReturn($this->modelBlockMock);
+        $this->modelBlockMock->expects($this->any())
+            ->method('load')
+            ->with($elementValue)
+            ->willReturnSelf();
+        $this->modelBlockMock->expects($this->any())
+            ->method('getId')
+            ->willReturn($modelBlockId);
+        $this->modelBlockMock->expects($this->any())
+            ->method('getTitle')
+            ->willReturn($title);
+        $this->chooserMock->expects($this->any())
+            ->method('setLabel')
+            ->with($title)
+            ->willReturnSelf();
+        $this->chooserMock->expects($this->atLeastOnce())
+            ->method('toHtml')
+            ->willReturn($html);
+        $this->elementMock->expects($this->atLeastOnce())
+            ->method('setData')
+            ->with('after_element_html', $html)
+            ->willReturnSelf();
+
+        $this->assertEquals($this->elementMock, $this->this->prepareElementHtml($this->elementMock));
+    }
+
+    public function prepareElementHtmlDataProvider()
+    {
+        return [
+            'elementValue NOT EMPTY, modelBlockId NOT EMPTY' => [
+                'elementValue' => 'some value',
+                'modelBlockId' => 1
+            ],
+            'elementValue NOT EMPTY, modelBlockId IS EMPTY' => [
+                'elementValue' => 'some value',
+                'modelBlockId' => null
+            ],
+            'elementValue IS EMPTY, modelBlockId NEVER REACHED' => [
+                'elementValue' => '',
+                'modelBlockId' => 1
+            ]
+        ];
+    }
+
+    /**
+     * @covers \Magento\Cms\Block\Adminhtml\Block\Widget\Chooser::getGridUrl
+     */
+    public function testGetGridUrl()
+    {
+        $url = 'some url';
+
+        $this->urlBuilderMock->expects($this->atLeastOnce())
+            ->method('getUrl')
+            ->with('cms/block_widget/chooser', ['_current' => true])
+            ->willReturn($url);
+
+        $this->assertEquals($url, $this->this->getGridUrl());
+    }
+}
diff --git a/dev/tests/unit/testsuite/Magento/Cms/Helper/PageTest.php b/dev/tests/unit/testsuite/Magento/Cms/Helper/PageTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..b09ffb1d7e265826a7063b67d6d6086286519bf0
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/Cms/Helper/PageTest.php
@@ -0,0 +1,550 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\Cms\Helper;
+
+/**
+ * @covers \Magento\Cms\Helper\Page
+ */
+class PageTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var \Magento\Cms\Helper\Page
+     */
+    protected $this;
+
+    /**
+     * @var \Magento\Framework\App\Helper\Context
+     */
+    protected $context;
+
+    /**
+     * @var \Magento\Framework\App\Action\Action|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $actionMock;
+
+    /**
+     * @var \Magento\Cms\Model\PageFactory|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $pageFactoryMock;
+
+    /**
+     * @var \Magento\Cms\Model\Page|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $pageMock;
+
+    /**
+     * @var \Magento\Framework\StoreManagerInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $storeManagerMock;
+
+    /**
+     * @var \Magento\Framework\Stdlib\DateTime\TimezoneInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $localeDateMock;
+
+    /**
+     * @var \Magento\Framework\View\DesignInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $designMock;
+
+    /**
+     * @var \Magento\Framework\View\Page\Config|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $pageConfigMock;
+
+    /**
+     * @var \Magento\Framework\App\ViewInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $viewMock;
+
+    /**
+     * @var \Magento\Framework\Escaper|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $escaperMock;
+
+    /**
+     * @var \Magento\Framework\Message\ManagerInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $messageManagerMock;
+
+    /**
+     * @var \Magento\Framework\Event\ManagerInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $eventManagerMock;
+
+    /**
+     * @var \Magento\Framework\UrlInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $urlBuilderMock;
+
+    /**
+     * @var \Magento\Store\Model\Store|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $storeMock;
+
+    /**
+     * @var \Magento\Framework\View\Result\Page|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $resultPageMock;
+
+    /**
+     * @var \Magento\Framework\View\LayoutInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $layoutMock;
+
+    /**
+     * @var \Magento\Framework\View\Layout\ProcessorInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $layoutProcessorMock;
+
+    /**
+     * @var \Magento\Framework\View\Element\BlockInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $blockMock;
+
+    /**
+     * @var \Magento\Framework\View\Element\Messages|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $messagesBlockMock;
+
+    /**
+     * @var \Magento\Framework\Message\Collection|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $messageCollectionMock;
+
+    protected function setUp()
+    {
+        $this->actionMock = $this->getMockBuilder('Magento\Framework\App\Action\Action')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->pageFactoryMock = $this->getMockBuilder('Magento\Cms\Model\PageFactory')
+            ->disableOriginalConstructor()
+            ->setMethods(
+                [
+                    'create'
+                ]
+            )
+            ->getMock();
+        $this->pageMock = $this->getMockBuilder('Magento\Cms\Model\Page')
+            ->disableOriginalConstructor()
+            ->setMethods(
+                [
+                    'getId',
+                    'setStoreId',
+                    'load',
+                    'getCustomThemeFrom',
+                    'getCustomThemeTo',
+                    'getCustomTheme',
+                    'getPageLayout',
+                    'getIdentifier',
+                    'getCustomPageLayout',
+                    'getCustomLayoutUpdateXml',
+                    'getLayoutUpdateXml',
+                    'getContentHeading'
+                ]
+            )
+            ->getMock();
+        $this->storeManagerMock = $this->getMockBuilder('Magento\Framework\StoreManagerInterface')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->localeDateMock = $this->getMockBuilder('Magento\Framework\Stdlib\DateTime\TimezoneInterface')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->designMock = $this->getMockBuilder('Magento\Framework\View\DesignInterface')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->pageConfigMock = $this->getMockBuilder('Magento\Framework\View\Page\Config')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->viewMock = $this->getMockBuilder('Magento\Framework\App\ViewInterface')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->escaperMock = $this->getMockBuilder('Magento\Framework\Escaper')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->eventManagerMock = $this->getMockBuilder('Magento\Framework\Event\ManagerInterface')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->urlBuilderMock = $this->getMockBuilder('Magento\Framework\UrlInterface')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->storeMock = $this->getMockBuilder('Magento\Store\Model\Store')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->resultPageMock = $this->getMockBuilder('Magento\Framework\View\Result\Page')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->layoutMock = $this->getMockBuilder('Magento\Framework\View\LayoutInterface')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->layoutProcessorMock = $this->getMockBuilder('Magento\Framework\View\Layout\ProcessorInterface')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->blockMock = $this->getMockBuilder('Magento\Framework\View\Element\BlockInterface')
+            ->disableOriginalConstructor()
+            ->setMethods(
+                [
+                    'setContentHeading',
+                    'toHtml'
+                ]
+            )
+            ->getMock();
+        $this->messagesBlockMock = $this->getMockBuilder('Magento\Framework\View\Element\Messages')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->messageManagerMock = $this->getMockBuilder('Magento\Framework\Message\ManagerInterface')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->messageCollectionMock = $this->getMockBuilder('Magento\Framework\Message\Collection')
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this);
+        $this->context = $objectManager->getObject(
+            'Magento\Framework\App\Helper\Context',
+            [
+                'eventManager' => $this->eventManagerMock,
+                'urlBuilder' => $this->urlBuilderMock
+            ]
+        );
+        $this->this = $objectManager->getObject(
+            'Magento\Cms\Helper\Page',
+            [
+                'context' => $this->context,
+                'pageFactory' => $this->pageFactoryMock,
+                'page' => $this->pageMock,
+                'storeManager' => $this->storeManagerMock,
+                'localeDate' => $this->localeDateMock,
+                'design' => $this->designMock,
+                'pageConfig' => $this->pageConfigMock,
+                'view' => $this->viewMock,
+                'escaper' => $this->escaperMock,
+                'messageManager' => $this->messageManagerMock
+            ]
+        );
+    }
+
+    /**
+     * @covers \Magento\Cms\Helper\Page::renderPageExtended
+     * @param integer|null $pageId
+     * @param integer|null $internalPageId
+     * @param integer $pageLoadResultIndex
+     * @param string $customPageLayout
+     * @param string $handle
+     * @param string $customLayoutUpdateXml
+     * @param string $layoutUpdate
+     * @param boolean $expectedResult
+     *
+     * @dataProvider renderPageExtendedDataProvider
+     */
+    public function testRenderPageExtended(
+        $pageId,
+        $internalPageId,
+        $pageLoadResultIndex,
+        $customPageLayout,
+        $handle,
+        $customLayoutUpdateXml,
+        $layoutUpdate,
+        $expectedResult
+    ) {
+        $storeId = 321;
+        $customThemeFrom = 'customThemeFrom';
+        $customThemeTo = 'customThemeTo';
+        $isScopeDateInInterval = true;
+        $customTheme = 'customTheme';
+        $pageLayout = 'pageLayout';
+        $pageIdentifier = 111;
+        $layoutUpdateXml = 'layoutUpdateXml';
+        $contentHeading = 'contentHeading';
+        $escapedContentHeading = 'escapedContentHeading';
+        $defaultGroup = 'defaultGroup';
+        $pageLoadResultCollection = [
+            null,
+            $this->pageMock
+        ];
+
+        $this->pageMock->expects($this->any())
+            ->method('getId')
+            ->willReturn($internalPageId);
+        $this->storeManagerMock->expects($this->any())
+            ->method('getStore')
+            ->willReturn($this->storeMock);
+        $this->storeMock->expects($this->any())
+            ->method('getId')
+            ->willReturn($storeId);
+        $this->pageMock->expects($this->any())
+            ->method('setStoreId')
+            ->with($storeId)
+            ->willReturnSelf();
+        $this->pageMock->expects($this->any())
+            ->method('load')
+            ->with($pageId)
+            ->willReturn($pageLoadResultCollection[$pageLoadResultIndex]);
+        $this->pageMock->expects($this->any())
+            ->method('getCustomThemeFrom')
+            ->willReturn($customThemeFrom);
+        $this->pageMock->expects($this->any())
+            ->method('getCustomThemeTo')
+            ->willReturn($customThemeTo);
+        $this->localeDateMock->expects($this->any())
+            ->method('isScopeDateInInterval')
+            ->with(null, $customThemeFrom, $customThemeTo)
+            ->willReturn($isScopeDateInInterval);
+        $this->pageMock->expects($this->any())
+            ->method('getCustomTheme')
+            ->willReturn($customTheme);
+        $this->designMock->expects($this->any())
+            ->method('setDesignTheme')
+            ->with($customTheme)
+            ->willReturnSelf();
+        $this->pageMock->expects($this->any())
+            ->method('getPageLayout')
+            ->willReturn($pageLayout);
+        $this->pageMock->expects($this->any())
+            ->method('getCustomPageLayout')
+            ->willReturn($customPageLayout);
+        $this->resultPageMock->expects($this->any())
+            ->method('getConfig')
+            ->willReturn($this->pageConfigMock);
+        $this->pageConfigMock->expects($this->any())
+            ->method('setPageLayout')
+            ->with($handle)
+            ->willReturnSelf();
+        $this->viewMock->expects($this->any())
+            ->method('getPage')
+            ->willReturn($this->resultPageMock);
+        $this->resultPageMock->expects($this->any())
+            ->method('initLayout')
+            ->willReturnSelf();
+        $this->resultPageMock->expects($this->any())
+            ->method('getLayout')
+            ->willReturn($this->layoutMock);
+        $this->layoutMock->expects($this->any())
+            ->method('getUpdate')
+            ->willReturn($this->layoutProcessorMock);
+        $this->layoutProcessorMock->expects($this->any())
+            ->method('addHandle')
+            ->with('cms_page_view')
+            ->willReturnSelf();
+        $this->pageMock->expects($this->any())
+            ->method('getIdentifier')
+            ->willReturn($pageIdentifier);
+        $this->viewMock->expects($this->any())
+            ->method('addPageLayoutHandles')
+            ->with(['id' => $pageIdentifier])
+            ->willReturn(true);
+        $this->eventManagerMock->expects($this->any())
+            ->method('dispatch')
+            ->with(
+                'cms_page_render',
+                [
+                    'page' => $this->pageMock,
+                    'controller_action' => $this->actionMock
+                ]
+            );
+        $this->viewMock->expects($this->any())
+            ->method('loadLayoutUpdates')
+            ->willReturnSelf();
+        $this->pageMock->expects($this->any())
+            ->method('getCustomLayoutUpdateXml')
+            ->willReturn($customLayoutUpdateXml);
+        $this->pageMock->expects($this->any())
+            ->method('getLayoutUpdateXml')
+            ->willReturn($layoutUpdateXml);
+        $this->layoutProcessorMock->expects($this->any())
+            ->method('addUpdate')
+            ->with($layoutUpdate)
+            ->willReturnSelf();
+        $this->viewMock->expects($this->any())
+            ->method('generateLayoutXml')
+            ->willReturnSelf();
+        $this->viewMock->expects($this->any())
+            ->method('generateLayoutBlocks')
+            ->willReturnSelf();
+        $this->layoutMock->expects($this->any())
+            ->method('getBlock')
+            ->with('page_content_heading')
+            ->willReturn($this->blockMock);
+        $this->pageMock->expects($this->any())
+            ->method('getContentHeading')
+            ->willReturn($contentHeading);
+        $this->escaperMock->expects($this->any())
+            ->method('escapeHtml')
+            ->with($contentHeading)
+            ->willReturn($escapedContentHeading);
+        $this->blockMock->expects($this->any())
+            ->method('setContentHeading')
+            ->with($escapedContentHeading)
+            ->willReturnSelf();
+        $this->layoutMock->expects($this->any())
+            ->method('getMessagesBlock')
+            ->willReturn($this->messagesBlockMock);
+        $this->messageManagerMock->expects($this->any())
+            ->method('getDefaultGroup')
+            ->willReturn($defaultGroup);
+        $this->messagesBlockMock->expects($this->any())
+            ->method('addStorageType')
+            ->with($defaultGroup);
+        $this->messageManagerMock->expects($this->any())
+            ->method('getMessages')
+            ->with(true)
+            ->willReturn($this->messageCollectionMock);
+        $this->messagesBlockMock->expects($this->any())
+            ->method('addMessages')
+            ->with($this->messageCollectionMock)
+            ->willReturnSelf();
+        $this->viewMock->expects($this->any())
+            ->method('renderLayout')
+            ->willReturnSelf();
+
+        $this->assertEquals(
+            $expectedResult,
+            $this->this->renderPageExtended($this->actionMock, $pageId)
+        );
+    }
+
+    public function renderPageExtendedDataProvider()
+    {
+        return [
+            'ids NOT EQUAL BUT page->load() NOT SUCCESSFUL' => [
+                'pageId' => 123,
+                'internalPageId' => 234,
+                'pageLoadResultIndex' => 0,
+                'customPageLayout' => 'DOES NOT MATTER',
+                'handle' => 'DOES NOT MATTER',
+                'customLayoutUpdateXml' => 'DOES NOT MATTER',
+                'layoutUpdate' => 'DOES NOT MATTER',
+                'expectedResult' => false
+            ],
+            'page->load IS SUCCESSFUL BUT internalPageId IS EMPTY' => [
+                'pageId' => 123,
+                'internalPageId' => null,
+                'pageLoadResultIndex' => 1,
+                'customPageLayout' => 'DOES NOT MATTER',
+                'handle' => 'DOES NOT MATTER',
+                'customLayoutUpdateXml' => 'DOES NOT MATTER',
+                'layoutUpdate' => 'DOES NOT MATTER',
+                'expectedResult' => false
+            ],
+            'getPageLayout() AND getLayoutUpdateXml() ARE USED' => [
+                'pageId' => 123,
+                'internalPageId' => 234,
+                'pageLoadResultIndex' => 1,
+                'customPageLayout' => 'empty',
+                'handle' => 'pageLayout',
+                'customLayoutUpdateXml' => '',
+                'layoutUpdate' => 'layoutUpdateXml',
+                'expectedResult' => true
+            ],
+            'getCustomPageLayout() AND getCustomLayoutUpdateXml() ARE USED' => [
+                'pageId' => 123,
+                'internalPageId' => 234,
+                'pageLoadResultIndex' => 1,
+                'customPageLayout' => 'customPageLayout',
+                'handle' => 'customPageLayout',
+                'customLayoutUpdateXml' => 'customLayoutUpdateXml',
+                'layoutUpdate' => 'customLayoutUpdateXml',
+                'expectedResult' => true
+            ]
+        ];
+    }
+
+    /**
+     * @covers \Magento\Cms\Helper\Page::getPageUrl
+     * @param integer|null $pageId
+     * @param integer|null $internalPageId
+     * @param integer $pageLoadResultIndex
+     * @param string|null $expectedResult
+     *
+     * @dataProvider getPageUrlDataProvider
+     */
+    public function testGetPageUrl(
+        $pageId,
+        $internalPageId,
+        $pageLoadResultIndex,
+        $expectedResult
+    ) {
+        $storeId = 321;
+        $pageIdentifier = 111;
+        $url = '/some/url';
+        $pageLoadResultCollection = [
+            null,
+            $this->pageMock
+        ];
+
+        $this->pageFactoryMock->expects($this->any())
+            ->method('create')
+            ->willReturn($this->pageMock);
+        $this->pageMock->expects($this->any())
+            ->method('getId')
+            ->willReturn($internalPageId);
+        $this->storeManagerMock->expects($this->any())
+            ->method('getStore')
+            ->willReturn($this->storeMock);
+        $this->storeMock->expects($this->any())
+            ->method('getId')
+            ->willReturn($storeId);
+        $this->pageMock->expects($this->any())
+            ->method('setStoreId')
+            ->with($storeId)
+            ->willReturnSelf();
+        $this->pageMock->expects($this->any())
+            ->method('load')
+            ->with($pageId)
+            ->willReturn($pageLoadResultCollection[$pageLoadResultIndex]);
+        $this->pageMock->expects($this->any())
+            ->method('getIdentifier')
+            ->willReturn($pageIdentifier);
+        $this->urlBuilderMock->expects($this->any())
+            ->method('getUrl')
+            ->with(null, ['_direct' => $pageIdentifier])
+            ->willReturn($url);
+
+        $this->assertEquals($expectedResult, $this->this->getPageUrl($pageId));
+    }
+
+    public function getPageUrlDataProvider()
+    {
+        return [
+            'ids NOT EQUAL BUT page->load() NOT SUCCESSFUL' => [
+                'pageId' => 123,
+                'internalPageId' => 234,
+                'pageLoadResultIndex' => 0,
+                'expectedResult' => null
+            ],
+            'page->load() IS SUCCESSFUL BUT internalId IS EMPTY' => [
+                'pageId' => 123,
+                'internalPageId' => null,
+                'pageLoadResultIndex' => 1,
+                'expectedResult' => null
+            ],
+            'SUCCESS' => [
+                'pageId' => 123,
+                'internalPageId' => 234,
+                'pageLoadResultIndex' => 1,
+                'expectedResult' => '/some/url'
+            ]
+        ];
+    }
+}
diff --git a/dev/tests/unit/testsuite/Magento/Cms/Model/Config/Source/PageTest.php b/dev/tests/unit/testsuite/Magento/Cms/Model/Config/Source/PageTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..60b841eb6d4c497b47b9d93cf4ab853980033f22
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/Cms/Model/Config/Source/PageTest.php
@@ -0,0 +1,98 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\Cms\Model\Config\Source;
+
+/**
+ * @covers \Magento\Cms\Model\Config\Source\Page
+ */
+class PageTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var \Magento\Cms\Model\Config\Source\Page
+     */
+    protected $this;
+
+    /**
+     * @var \Magento\Cms\Model\Resource\Page\CollectionFactory|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $pageCollectionFactory;
+
+    /**
+     * @var \Magento\Cms\Model\Resource\Page\Collection|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $pageCollection;
+
+    protected function setUp()
+    {
+        $this->pageCollectionFactory = $this
+            ->getMockBuilder('Magento\Cms\Model\Resource\Page\CollectionFactory')
+            ->disableOriginalConstructor()
+            ->setMethods(
+                [
+                    'create'
+                ]
+            )
+            ->getMock();
+        $this->pageCollection = $this
+            ->getMockBuilder('Magento\Cms\Model\Resource\Page\Collection')
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this);
+        $this->this = $objectManager->getObject(
+            'Magento\Cms\Model\Config\Source\Page',
+            [
+                'pageCollectionFactory' => $this->pageCollectionFactory
+            ]
+        );
+
+        $reflection = new \ReflectionClass($this->this);
+        $mathRandomProperty = $reflection->getProperty('_options');
+        $mathRandomProperty->setAccessible(true);
+        $mathRandomProperty->setValue($this->this, null);
+    }
+
+    /**
+     * @covers \Magento\Cms\Model\Config\Source\Page::toOptionArray
+     */
+    public function testToOptionArray()
+    {
+        $resultOptions = ['val1' => 'val2'];
+
+        $this->pageCollectionFactory
+            ->expects($this->atLeastOnce())
+            ->method('create')
+            ->willReturn($this->pageCollection);
+        $this->pageCollection
+            ->expects($this->atLeastOnce())
+            ->method('load')
+            ->willReturnSelf();
+        $this->pageCollection
+            ->expects($this->atLeastOnce())
+            ->method('toOptionIdArray')
+            ->willReturn($resultOptions);
+
+        $this->assertEquals($resultOptions, $this->this->toOptionArray());
+    }
+}
diff --git a/dev/tests/unit/testsuite/Magento/Cms/Model/ObserverTest.php b/dev/tests/unit/testsuite/Magento/Cms/Model/ObserverTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..00ee0630c11a30630ead41b2839bdcfa206bb43a
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/Cms/Model/ObserverTest.php
@@ -0,0 +1,207 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\Cms\Model;
+
+/**
+ * @covers \Magento\Cms\Model\Observer
+ */
+class ObserverTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var \Magento\Cms\Model\Observer
+     */
+    protected $this;
+
+    /**
+     * @var \Magento\Cms\Helper\Page|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $cmsPageMock;
+
+    /**
+     * @var \Magento\Framework\App\Config\ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $scopeConfigMock;
+
+    /**
+     * @var \Magento\Framework\Event\Observer|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $observerMock;
+
+    /**
+     * @var \Magento\Framework\Event|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $eventMock;
+
+    /**
+     * @var \Magento\Framework\Object|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $objectMock;
+
+    protected function setUp()
+    {
+        $this->cmsPageMock = $this
+            ->getMockBuilder('Magento\Cms\Helper\Page')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->scopeConfigMock = $this
+            ->getMockBuilder('Magento\Framework\App\Config\ScopeConfigInterface')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->observerMock = $this
+            ->getMockBuilder('Magento\Framework\Event\Observer')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->eventMock = $this
+            ->getMockBuilder('Magento\Framework\Event')
+            ->setMethods(
+                [
+                    'getStatus',
+                    'getRedirect'
+                ]
+            )
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->objectMock = $this
+            ->getMockBuilder('Magento\Framework\Object')
+            ->setMethods(
+                [
+                    'setLoaded',
+                    'setForwardModule',
+                    'setForwardController',
+                    'setForwardAction',
+                    'setRedirectUrl',
+                    'setRedirect',
+                    'setPath',
+                    'setArguments'
+                ]
+            )
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this);
+        $this->this = $objectManager->getObject(
+            'Magento\Cms\Model\Observer',
+            [
+                'cmsPage' => $this->cmsPageMock,
+                'scopeConfig' => $this->scopeConfigMock
+            ]
+        );
+    }
+
+    /**
+     * @covers \Magento\Cms\Model\Observer::noRoute
+     */
+    public function testNoRoute()
+    {
+        $this->observerMock
+            ->expects($this->atLeastOnce())
+            ->method('getEvent')
+            ->willReturn($this->eventMock);
+        $this->eventMock
+            ->expects($this->atLeastOnce())
+            ->method('getStatus')
+            ->willReturn($this->objectMock);
+        $this->objectMock
+            ->expects($this->atLeastOnce())
+            ->method('setLoaded')
+            ->with(true)
+            ->willReturnSelf();
+        $this->objectMock
+            ->expects($this->atLeastOnce())
+            ->method('setForwardModule')
+            ->with('cms')
+            ->willReturnSelf();
+        $this->objectMock
+            ->expects($this->atLeastOnce())
+            ->method('setForwardController')
+            ->with('index')
+            ->willReturnSelf();
+        $this->objectMock
+            ->expects($this->atLeastOnce())
+            ->method('setForwardAction')
+            ->with('noroute')
+            ->willReturnSelf();
+
+        $this->assertEquals($this->this, $this->this->noRoute($this->observerMock));
+    }
+
+    /**
+     * @covers \Magento\Cms\Model\Observer::noCookies
+     * @param string $pageUrl
+     * @dataProvider noCookiesDataProvider
+     */
+    public function testNoCookies($pageUrl)
+    {
+        $pageId = 1;
+
+        $this->observerMock
+            ->expects($this->atLeastOnce())
+            ->method('getEvent')
+            ->willReturn($this->eventMock);
+        $this->eventMock
+            ->expects($this->atLeastOnce())
+            ->method('getRedirect')
+            ->willReturn($this->objectMock);
+        $this->scopeConfigMock
+            ->expects($this->atLeastOnce())
+            ->method('getValue')
+            ->with('web/default/cms_no_cookies', 'store')
+            ->willReturn($pageId);
+        $this->cmsPageMock
+            ->expects($this->atLeastOnce())
+            ->method('getPageUrl')
+            ->with($pageId)
+            ->willReturn($pageUrl);
+        $this->objectMock
+            ->expects($this->any())
+            ->method('setRedirectUrl')
+            ->with($pageUrl)
+            ->willReturnSelf();
+        $this->objectMock
+            ->expects($this->any())
+            ->method('setRedirect')
+            ->with(true)
+            ->willReturnSelf();
+        $this->objectMock
+            ->expects($this->any())
+            ->method('setPath')
+            ->with('cms/index/noCookies')
+            ->willReturnSelf();
+        $this->objectMock
+            ->expects($this->any())
+            ->method('setArguments')
+            ->with([])
+            ->willReturnSelf();
+
+        $this->assertEquals($this->this, $this->this->noCookies($this->observerMock));
+    }
+
+    public function noCookiesDataProvider()
+    {
+        return [
+            'url IS empty' => ['pageUrl' => ''],
+            'url NOT empty' => ['pageUrl' => '/some/url']
+        ];
+    }
+}
diff --git a/dev/tests/unit/testsuite/Magento/Cms/Model/PageTest.php b/dev/tests/unit/testsuite/Magento/Cms/Model/PageTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..a7ed38aa7fa3ad23686f8889fd33a4cfc94acc57
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/Cms/Model/PageTest.php
@@ -0,0 +1,135 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\Cms\Model;
+
+/**
+ * @covers \Magento\Cms\Model\Page
+ */
+class PageTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var \Magento\Cms\Model\Page|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $thisMock;
+
+    /**
+     * @var \Magento\Backend\Block\Template\Context
+     */
+    protected $context;
+
+    /**
+     * @var \Magento\Framework\Event\ManagerInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $eventManagerMock;
+
+    /**
+     * @var \Magento\Cms\Model\Resource\Page|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $resourcePageMock;
+
+    protected function setUp()
+    {
+        $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this);
+        $this->eventManagerMock = $this->getMockBuilder('Magento\Framework\Event\ManagerInterface')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->context = $objectManager->getObject(
+            'Magento\Framework\Model\Context',
+            [
+                'eventDispatcher' => $this->eventManagerMock
+            ]
+        );
+        $this->resourcePageMock = $this->getMockBuilder('Magento\Cms\Model\Resource\Page')
+            ->disableOriginalConstructor()
+            ->setMethods(
+                [
+                    'getIdFieldName',
+                    'checkIdentifier'
+                ]
+            )
+            ->getMock();
+        $this->thisMock = $this->getMockBuilder('Magento\Cms\Model\Page')
+            ->setConstructorArgs(
+                [
+                    $this->context,
+                    $this->getMockBuilder('Magento\Framework\Registry')
+                        ->disableOriginalConstructor()
+                        ->getMock(),
+                    $this->getMockBuilder('Magento\Framework\Model\Resource\AbstractResource')
+                        ->disableOriginalConstructor()
+                        ->setMethods(
+                            [
+                                '_construct',
+                                '_getReadAdapter',
+                                '_getWriteAdapter'
+                            ]
+                        )
+                        ->getMock(),
+                    $this->getMockBuilder('Magento\Framework\Data\Collection\Db')
+                        ->disableOriginalConstructor()
+                        ->getMock()
+                ]
+            )
+            ->setMethods(
+                [
+                    '_construct',
+                    '_getResource',
+                    'load'
+                ]
+            )
+            ->getMock();
+
+        $this->thisMock->expects($this->any())
+            ->method('_getResource')
+            ->willReturn($this->resourcePageMock);
+        $this->thisMock->expects($this->any())
+            ->method('load')
+            ->willReturnSelf();
+    }
+
+    /**
+     * @covers \Magento\Cms\Model\Page::noRoutePage
+     */
+    public function testNoRoutePage()
+    {
+        $this->assertEquals($this->thisMock, $this->thisMock->noRoutePage());
+    }
+
+    /**
+     * @covers \Magento\Cms\Model\Page::checkIdentifier
+     */
+    public function testCheckIdentifier()
+    {
+        $identifier = 1;
+        $storeId = 2;
+        $fetchOneResult = 'some result';
+
+        $this->resourcePageMock->expects($this->atLeastOnce())
+            ->method('checkIdentifier')
+            ->with($identifier, $storeId)
+            ->willReturn($fetchOneResult);
+
+        $this->assertInternalType('string', $this->thisMock->checkIdentifier($identifier, $storeId));
+    }
+}
diff --git a/dev/tests/unit/testsuite/Magento/Cms/Model/Wysiwyg/ConfigTest.php b/dev/tests/unit/testsuite/Magento/Cms/Model/Wysiwyg/ConfigTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..e790c58ede6c24151456c0d4d2a2e79abbc28652
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/Cms/Model/Wysiwyg/ConfigTest.php
@@ -0,0 +1,251 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\Cms\Model\Wysiwyg;
+
+/**
+ * @covers \Magento\Cms\Model\Wysiwyg\Config
+ */
+class ConfigTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var \Magento\Cms\Model\Wysiwyg\Config
+     */
+    protected $this;
+
+    /**
+     * @var \Magento\Backend\Model\UrlInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $backendUrlMock;
+
+    /**
+     * @var \Magento\Framework\View\Asset\Repository|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $assetRepoMock;
+
+    /**
+     * @var \Magento\Framework\AuthorizationInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $authorizationMock;
+
+    /**
+     * @var \Magento\Core\Model\Variable\Config|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $variableConfigMock;
+
+    /**
+     * @var \Magento\Widget\Model\Widget\Config|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $widgetConfigMock;
+
+    /**
+     * @var \Magento\Framework\App\Config\ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $scopeConfigMock;
+
+    /**
+     * @var array
+     */
+    protected $windowSize = [];
+
+    protected function setUp()
+    {
+        $this->backendUrlMock = $this->getMockBuilder('Magento\Backend\Model\UrlInterface')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->assetRepoMock = $this->getMockBuilder('Magento\Framework\View\Asset\Repository')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->authorizationMock = $this->getMockBuilder('Magento\Framework\AuthorizationInterface')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->variableConfigMock = $this->getMockBuilder('Magento\Core\Model\Variable\Config')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->widgetConfigMock = $this->getMockBuilder('Magento\Widget\Model\Widget\Config')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->scopeConfigMock = $this->getMockBuilder('Magento\Framework\App\Config\ScopeConfigInterface')
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->windowSize = [
+            'width' => 1200,
+            'height' => 800
+        ];
+
+        $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this);
+        $this->this = $objectManager->getObject(
+            'Magento\Cms\Model\Wysiwyg\Config',
+            [
+                'backendUrl' => $this->backendUrlMock,
+                'assetRepo' => $this->assetRepoMock,
+                'authorization' => $this->authorizationMock,
+                'variableConfig' => $this->variableConfigMock,
+                'widgetConfig' => $this->widgetConfigMock,
+                'scopeConfig' => $this->scopeConfigMock,
+                'windowSize' => $this->windowSize
+            ]
+        );
+    }
+
+    /**
+     * @covers \Magento\Cms\Model\Wysiwyg\Config::getConfig
+     * @param array $data
+     * @param boolean $isAuthorizationAllowed
+     * @param array $expectedResults
+     *
+     * @dataProvider getConfigDataProvider
+     */
+    public function testGetConfig($data, $isAuthorizationAllowed, $expectedResults)
+    {
+        $wysiwygPluginSettings = [
+            'wysiwygPluginSettings' => 'wysiwyg is here'
+        ];
+
+        $pluginSettings = [
+            'pluginSettings' => 'plugins are here'
+        ];
+
+        $this->backendUrlMock->expects($this->atLeastOnce())
+            ->method('getUrl')
+            ->withConsecutive(
+                ['cms/wysiwyg/directive'],
+                ['cms/wysiwyg_images/index']
+            );
+        $this->assetRepoMock->expects($this->atLeastOnce())
+            ->method('getUrl')
+            ->withConsecutive(
+                ['mage/adminhtml/wysiwyg/tiny_mce/themes/advanced/skins/default/dialog.css'],
+                ['mage/adminhtml/wysiwyg/tiny_mce/themes/advanced/skins/default/content.css']
+            );
+        $this->authorizationMock->expects($this->atLeastOnce())
+            ->method('isAllowed')
+            ->with('Magento_Cms::media_gallery')
+            ->willReturn($isAuthorizationAllowed);
+        $this->variableConfigMock->expects($this->any())
+            ->method('getWysiwygPluginSettings')
+            ->willReturn($wysiwygPluginSettings);
+        $this->widgetConfigMock->expects($this->any())
+            ->method('getPluginSettings')
+            ->willReturn($pluginSettings);
+
+        $config = $this->this->getConfig($data);
+        $this->assertInstanceOf('Magento\Framework\Object', $config);
+        $this->assertEquals($expectedResults[0], $config->getData('someData'));
+        $this->assertEquals($expectedResults[1], $config->getData('wysiwygPluginSettings'));
+        $this->assertEquals($expectedResults[2], $config->getData('pluginSettings'));
+    }
+
+    public function getConfigDataProvider()
+    {
+        return [
+            'add_variables IS FALSE, add_widgets IS FALSE, isAuthorizationAllowed IS FALSE' => [
+                'data' => [
+                    'add_variables' => false,
+                    'add_widgets' => false
+                ],
+                'isAuthorizationAllowed' => false,
+                'expectedResults' => [null, null, null]
+            ],
+            'add_variables IS TRUE, add_widgets IS TRUE, isAuthorizationAllowed IS TRUE' => [
+                'data' => [
+                    'someData' => 'important data',
+                    'add_variables' => true,
+                    'add_widgets' => true
+                ],
+                'isAuthorizationAllowed' => true,
+                'expectedResults' => ['important data', 'wysiwyg is here', 'plugins are here']
+            ]
+        ];
+    }
+
+    /**
+     * @covers \Magento\Cms\Model\Wysiwyg\Config::getSkinImagePlaceholderUrl
+     */
+    public function testGetSkinImagePlaceholderUrl()
+    {
+        $url = '/some/url';
+
+        $this->assetRepoMock->expects($this->atLeastOnce())
+            ->method('getUrl')
+            ->with('Magento_Cms::images/wysiwyg_skin_image.png')
+            ->willReturn($url);
+
+        $this->assertEquals($url, $this->this->getSkinImagePlaceholderUrl());
+    }
+
+    /**
+     * @covers \Magento\Cms\Model\Wysiwyg\Config::isEnabled
+     * @param string $wysiwygState
+     * @param boolean $expectedResult
+     *
+     * @dataProvider isEnabledDataProvider
+     */
+    public function testIsEnabled($wysiwygState, $expectedResult)
+    {
+        $storeId = 1;
+        $this->this->setStoreId($storeId);
+
+        $this->scopeConfigMock->expects($this->atLeastOnce())
+            ->method('getValue')
+            ->with('cms/wysiwyg/enabled', 'store', $storeId)
+            ->willReturn($wysiwygState);
+
+        $this->assertEquals($expectedResult, $this->this->isEnabled());
+    }
+
+    public function isEnabledDataProvider()
+    {
+        return [
+            ['wysiwygState' => 'enabled', 'expectedResult' => true],
+            ['wysiwygState' => 'hidden', 'expectedResult' => true],
+            ['wysiwygState' => 'masked', 'expectedResult' => false]
+        ];
+    }
+
+    /**
+     * @covers \Magento\Cms\Model\Wysiwyg\Config::isHidden
+     * @param string $status
+     * @param boolean $expectedResult
+     *
+     * @dataProvider isHiddenDataProvider
+     */
+    public function testIsHidden($status, $expectedResult)
+    {
+        $this->scopeConfigMock->expects($this->atLeastOnce())
+            ->method('getValue')
+            ->with('cms/wysiwyg/enabled', 'store')
+            ->willReturn($status);
+
+        $this->assertEquals($expectedResult, $this->this->isHidden());
+    }
+
+    public function isHiddenDataProvider()
+    {
+        return [
+            ['status' => 'hidden', 'expectedResult' => true],
+            ['status' => 'enabled', 'expectedResult' => false],
+            ['status' => 'masked', 'expectedResult' => false]
+        ];
+    }
+}
diff --git a/dev/tests/unit/testsuite/Magento/Contact/Helper/DataTest.php b/dev/tests/unit/testsuite/Magento/Contact/Helper/DataTest.php
index d8904af20d8535a2df4ed557cabbbf1c0a2daa0f..4c2a71c03e4a19493fe3c54636e6f7135be9d444 100644
--- a/dev/tests/unit/testsuite/Magento/Contact/Helper/DataTest.php
+++ b/dev/tests/unit/testsuite/Magento/Contact/Helper/DataTest.php
@@ -96,7 +96,7 @@ class DataTest extends \PHPUnit_Framework_TestCase
             ->will($this->returnValue(true));
 
         $objectBuilder = $this->getMockForAbstractClass(
-            '\Magento\Framework\Api\AbstractSimpleObjectBuilder',
+            '\Magento\Framework\Api\ExtensibleObjectBuilder',
             ['getData'],
             '',
             false
diff --git a/dev/tests/unit/testsuite/Magento/Customer/Model/ConverterTest.php b/dev/tests/unit/testsuite/Magento/Customer/Model/ConverterTest.php
index 9fee2ea16f2675d6547f6eff4af557b6ad6e39e6..ddbffcc52042b014f831746bf18fc738d0abbdcd 100644
--- a/dev/tests/unit/testsuite/Magento/Customer/Model/ConverterTest.php
+++ b/dev/tests/unit/testsuite/Magento/Customer/Model/ConverterTest.php
@@ -28,7 +28,7 @@ namespace Magento\Customer\Model;
 use Magento\Customer\Service\V1\Data\Eav\AttributeMetadata;
 use Magento\Customer\Service\V1\Data\CustomerBuilder;
 use Magento\Customer\Service\V1\CustomerMetadataServiceInterface;
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
 
 class ConverterTest extends \PHPUnit_Framework_TestCase
 {
diff --git a/dev/tests/unit/testsuite/Magento/Customer/Model/Customer/Attribute/Backend/PasswordTest.php b/dev/tests/unit/testsuite/Magento/Customer/Model/Customer/Attribute/Backend/PasswordTest.php
index 05880064c98ea975397eab50174c4fab30ded108..919e1a00a71c351393aa420045265f48a59449aa 100644
--- a/dev/tests/unit/testsuite/Magento/Customer/Model/Customer/Attribute/Backend/PasswordTest.php
+++ b/dev/tests/unit/testsuite/Magento/Customer/Model/Customer/Attribute/Backend/PasswordTest.php
@@ -35,10 +35,8 @@ class PasswordTest extends \PHPUnit_Framework_TestCase
 
     public function setUp()
     {
-        $logger = $this->getMockBuilder('Magento\Framework\Logger')->disableOriginalConstructor()->getMock();
         $string = new String();
-        /** @var \Magento\Framework\Logger $logger */
-        $this->testable = new Password($logger, $string);
+        $this->testable = new Password($string);
     }
 
     public function testValidatePositive()
diff --git a/dev/tests/unit/testsuite/Magento/Customer/Model/Customer/Attribute/Backend/StoreTest.php b/dev/tests/unit/testsuite/Magento/Customer/Model/Customer/Attribute/Backend/StoreTest.php
index 11cfa14ff0708070a420a587749dcb43326757db..41fa4c9a13f97e2eb9121c7a133de9db604ee1a2 100644
--- a/dev/tests/unit/testsuite/Magento/Customer/Model/Customer/Attribute/Backend/StoreTest.php
+++ b/dev/tests/unit/testsuite/Magento/Customer/Model/Customer/Attribute/Backend/StoreTest.php
@@ -38,12 +38,10 @@ class StoreTest extends \PHPUnit_Framework_TestCase
 
     public function setUp()
     {
-        $logger = $this->getMockBuilder('Magento\Framework\Logger')->disableOriginalConstructor()->getMock();
-        /** @var \Magento\Framework\Logger $logger */
         $storeManager = $this->storeManager = $this->getMockBuilder('Magento\Framework\StoreManagerInterface')
             ->getMock();
         /** @var \Magento\Framework\StoreManagerInterface $storeManager */
-        $this->testable = new Store($logger, $storeManager);
+        $this->testable = new Store($storeManager);
     }
 
     public function testBeforeSaveWithId()
diff --git a/dev/tests/unit/testsuite/Magento/Customer/Model/Customer/Attribute/Backend/WebsiteTest.php b/dev/tests/unit/testsuite/Magento/Customer/Model/Customer/Attribute/Backend/WebsiteTest.php
index 7247b735f504744c6314de3a78cb6a880ddb4e03..efad936ac75b567f55dc83ff42d436bd3c561db3 100644
--- a/dev/tests/unit/testsuite/Magento/Customer/Model/Customer/Attribute/Backend/WebsiteTest.php
+++ b/dev/tests/unit/testsuite/Magento/Customer/Model/Customer/Attribute/Backend/WebsiteTest.php
@@ -38,12 +38,10 @@ class WebsiteTest extends \PHPUnit_Framework_TestCase
 
     public function setUp()
     {
-        $logger = $this->getMockBuilder('Magento\Framework\Logger')->disableOriginalConstructor()->getMock();
-        /** @var \Magento\Framework\Logger $logger */
         $storeManager = $this->storeManager = $this->getMockBuilder('Magento\Framework\StoreManagerInterface')
             ->getMock();
         /** @var \Magento\Framework\StoreManagerInterface $storeManager */
-        $this->testable = new Website($logger, $storeManager);
+        $this->testable = new Website($storeManager);
     }
 
     public function testBeforeSaveWithId()
diff --git a/dev/tests/unit/testsuite/Magento/Customer/Model/Layout/DepersonalizePluginTest.php b/dev/tests/unit/testsuite/Magento/Customer/Model/Layout/DepersonalizePluginTest.php
index 826708a45bf7f61a160119e6d7c76e24f8582fdc..649237cc942b464bf9c78555c92736b7f005a2c5 100644
--- a/dev/tests/unit/testsuite/Magento/Customer/Model/Layout/DepersonalizePluginTest.php
+++ b/dev/tests/unit/testsuite/Magento/Customer/Model/Layout/DepersonalizePluginTest.php
@@ -116,7 +116,7 @@ class DepersonalizePluginTest extends \PHPUnit_Framework_TestCase
         );
         $this->moduleManagerMock = $this->getMock('Magento\Framework\Module\Manager', array(), array(), '', false);
         $this->visitorMock = $this->getMock('Magento\Customer\Model\Visitor', array(), array(), '', false);
-        $this->customerFactoryMock->expects($this->once())
+        $this->customerFactoryMock->expects($this->any())
             ->method('create')
             ->will($this->returnValue($this->customerMock));
         $this->cacheConfigMock = $this->getMock('Magento\PageCache\Model\Config', array(), array(), '', false);
@@ -274,7 +274,8 @@ class DepersonalizePluginTest extends \PHPUnit_Framework_TestCase
         $this->customerMock
             ->expects($this->once())
             ->method('setGroupId')
-            ->with($this->equalTo(null));
+            ->with($this->equalTo(null))
+            ->willReturnSelf();
         $this->sessionMock
             ->expects($this->once())
             ->method('setData')
diff --git a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerAccountServiceTest.php b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerAccountServiceTest.php
index 37555bc3c3d11eb6cfc4434696f4eb0d71e1053e..1879111bbed5f6da403b7b37d7fc86a52ff2ba9e 100755
--- a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerAccountServiceTest.php
+++ b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerAccountServiceTest.php
@@ -30,7 +30,7 @@ use Magento\Framework\Api\SearchCriteriaBuilder;
 use Magento\Framework\Exception\InputException;
 use Magento\Framework\Exception\NoSuchEntityException;
 use Magento\Customer\Service\V1\Data\CustomerBuilder;
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
 use Magento\Framework\Api\FilterBuilder;
 use Magento\Framework\Mail\Exception as MailException;
 use Magento\Framework\Api\ExtensibleDataObjectConverter;
diff --git a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerAddressServiceTest.php b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerAddressServiceTest.php
index 1b37a67682c002b17bb4dd4f74f8848d141b8bd0..a698d471b5ed3fe7a2864cadb274e5990101ccd1 100644
--- a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerAddressServiceTest.php
+++ b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerAddressServiceTest.php
@@ -27,7 +27,7 @@ use Magento\Framework\Exception\InputException;
 use Magento\Framework\Exception\NoSuchEntityException;
 use Magento\Customer\Service\V1\Data\RegionBuilder;
 use Magento\Customer\Service\V1\Data\CustomerBuilder;
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
 
 /**
  * \Magento\Customer\Service\V1\CustomerAddressService
diff --git a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/Data/AddressConverterTest.php b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/Data/AddressConverterTest.php
index 9660223cb5c5706243b58e285db1cd9d7a9c6cda..7be2d3ddb891877b6f990b57ec398866e0d88935 100644
--- a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/Data/AddressConverterTest.php
+++ b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/Data/AddressConverterTest.php
@@ -127,7 +127,7 @@ class AddressConverterTest extends \PHPUnit_Framework_TestCase
         );
 
         $addressData = $this->_sampleAddressDataObject();
-        $valueBuilder = $this->_objectManager->getObject('Magento\Framework\Api\AttributeValueBuilder');
+        $valueBuilder = $this->_objectManager->getObject('Magento\Framework\Api\AttributeDataBuilder');
         /** @var \Magento\Customer\Service\V1\Data\AddressBuilder $addressDataBuilder */
         $addressDataBuilder = $this->_objectManager->getObject(
             'Magento\Customer\Service\V1\Data\AddressBuilder',
@@ -137,7 +137,8 @@ class AddressConverterTest extends \PHPUnit_Framework_TestCase
                 'metadataService' => $this->addressMetadataService
             ]
         );
-        $addressData = $addressDataBuilder->mergeDataObjectWithArray($addressData, $updatedAddressData);
+        $addressData = $addressDataBuilder->mergeDataObjectWithArray($addressData, $updatedAddressData)
+            ->create();
 
         $result = AddressConverter::toFlatArray($addressData);
         $this->assertEquals($expected, $result);
@@ -150,7 +151,7 @@ class AddressConverterTest extends \PHPUnit_Framework_TestCase
     {
         $regionBuilder = $this->_objectManager->getObject('\Magento\Customer\Service\V1\Data\RegionBuilder')
             ->setRegion('Texas')->setRegionId(1)->setRegionCode('TX');
-        $valueBuilder = $this->_objectManager->getObject('Magento\Framework\Api\AttributeValueBuilder');
+        $valueBuilder = $this->_objectManager->getObject('Magento\Framework\Api\AttributeDataBuilder');
         /** @var \Magento\Customer\Service\V1\Data\AddressBuilder $addressData */
         $addressData = $this->_objectManager->getObject(
             'Magento\Customer\Service\V1\Data\AddressBuilder',
diff --git a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/Data/AddressTest.php b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/Data/AddressTest.php
index 5c075fdff02be7929caf0bc6a658d8f9884dee94..6128c7e4ab57952cd0006c6f9cdd608cfc1f0a80 100644
--- a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/Data/AddressTest.php
+++ b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/Data/AddressTest.php
@@ -27,7 +27,7 @@ use Magento\Customer\Service\V1\Data\Address;
 use Magento\Customer\Service\V1\Data\AddressBuilder;
 use Magento\Customer\Service\V1\Data\RegionBuilder;
 use Magento\Framework\Api\AttributeValue;
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\AttributeDataBuilder;
 
 class AddressTest extends \PHPUnit_Framework_TestCase
 {
@@ -94,7 +94,7 @@ class AddressTest extends \PHPUnit_Framework_TestCase
     /** @var \Magento\Customer\Service\V1\CustomerMetadataService */
     private $_customerMetadataService;
 
-    /** @var \Magento\Framework\Api\AttributeValueBuilder */
+    /** @var \Magento\Framework\Api\AttributeDataBuilder */
     private $_valueBuilder;
 
     /**
@@ -125,7 +125,7 @@ class AddressTest extends \PHPUnit_Framework_TestCase
             )
         );
         $this->_valueBuilder = $this->objectManagerHelper
-            ->getObject('Magento\Framework\Api\AttributeValueBuilder');
+            ->getObject('Magento\Framework\Api\AttributeDataBuilder');
         $this->_addressBuilder = $this->objectManagerHelper->getObject(
             'Magento\Customer\Service\V1\Data\AddressBuilder',
             [
@@ -313,10 +313,12 @@ class AddressTest extends \PHPUnit_Framework_TestCase
         ];
 
         $attributeValue1 = $this->_valueBuilder
-            ->populateWithArray($customerAttributes['warehouse_zip'])
+            ->setValue('78777')
+            ->setAttributeCode('warehouse_zip')
             ->create();
         $attributeValue2 = $this->_valueBuilder
-            ->populateWithArray($customerAttributes['warehouse_alternate'])
+            ->setValue('90051')
+            ->setAttributeCode('warehouse_alternate')
             ->create();
 
         $address = $this->_addressBuilder
diff --git a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/Data/CustomerBuilderTest.php b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/Data/CustomerBuilderTest.php
index e987df4569d73692f634b68999fcd350f708fb95..8d7774cb6be9420d73af9f66a19e86ceec01ac02 100644
--- a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/Data/CustomerBuilderTest.php
+++ b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/Data/CustomerBuilderTest.php
@@ -39,7 +39,7 @@ class CustomerBuilderTest extends \PHPUnit_Framework_TestCase
     /** @var \Magento\Customer\Service\V1\AddressMetadataService */
     private $_addressMetadataService;
 
-    /** @var \Magento\Framework\Api\AttributeValueBuilder */
+    /** @var \Magento\Framework\Api\AttributeDataBuilder */
     private $_valueBuilder;
 
     protected function setUp()
@@ -81,7 +81,7 @@ class CustomerBuilderTest extends \PHPUnit_Framework_TestCase
                 )
             );
         $this->_valueBuilder = $this->_objectManager->getObject(
-            'Magento\Framework\Api\AttributeValueBuilder'
+            'Magento\Framework\Api\AttributeDataBuilder'
         );
         $this->_customerBuilder = $this->_objectManager->getObject(
             'Magento\Customer\Service\V1\Data\CustomerBuilder',
@@ -110,7 +110,8 @@ class CustomerBuilderTest extends \PHPUnit_Framework_TestCase
         $middlename2 = 'Middlename2';
         $secondDataObject = $this->_customerBuilder->setLastname($lastname2)->setMiddlename($middlename2)->create();
 
-        $mergedDataObject = $this->_customerBuilder->mergeDataObjects($firstDataObject, $secondDataObject);
+        $mergedDataObject = $this->_customerBuilder->mergeDataObjects($firstDataObject, $secondDataObject)
+            ->create();
         $this->assertNotSame(
             $firstDataObject,
             $mergedDataObject,
@@ -147,11 +148,13 @@ class CustomerBuilderTest extends \PHPUnit_Framework_TestCase
             $email1
         )->create();
 
+
         $lastname2 = 'Lastname2';
         $middlename2 = 'Middlename2';
         $dataForMerge = array('lastname' => $lastname2, 'middlename' => $middlename2);
 
-        $mergedDataObject = $this->_customerBuilder->mergeDataObjectWithArray($firstDataObject, $dataForMerge);
+        $mergedDataObject = $this->_customerBuilder->mergeDataObjectWithArray($firstDataObject, $dataForMerge)
+            ->create();
         $this->assertNotSame(
             $firstDataObject,
             $mergedDataObject,
@@ -286,10 +289,12 @@ class CustomerBuilderTest extends \PHPUnit_Framework_TestCase
         ];
 
         $attributeValue1 = $this->_valueBuilder
-            ->populateWithArray($customerAttributes['warehouse_zip'])
+            ->setValue('78777')
+            ->setAttributeCode('warehouse_zip')
             ->create();
         $attributeValue2 = $this->_valueBuilder
-            ->populateWithArray($customerAttributes['warehouse_alternate'])
+            ->setValue('90051')
+            ->setAttributeCode('warehouse_alternate')
             ->create();
 
         $address = $this->_customerBuilder->setCustomAttributes([$attributeValue1, $attributeValue2])
@@ -362,7 +367,7 @@ class CustomerBuilderTest extends \PHPUnit_Framework_TestCase
                     ]
                 ]
             ]
-        );
+        )->create();
 
         $expectedData = array(
             'email' => 'test@example.com',
@@ -438,7 +443,8 @@ class CustomerBuilderTest extends \PHPUnit_Framework_TestCase
         );
         $customer1 = $this->_customerBuilder->populateWithArray($customer1Data)->create();
         $customer2 = $this->_customerBuilder->populateWithArray($customer2Data)->create();
-        $customer3 = $this->_customerBuilder->mergeDataObjects($customer1, $customer2);
+        $customer3 = $this->_customerBuilder->mergeDataObjects($customer1, $customer2)
+            ->create();
         $this->assertEquals('78666', $customer3->getCustomAttribute('warehouse_zip')->getValue());
         $this->assertEquals('90051', $customer3->getCustomAttribute('warehouse_alternate')->getValue());
         foreach ($customer3->getCustomAttributes() as $customAttribute) {
diff --git a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/Data/CustomerTest.php b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/Data/CustomerTest.php
index 91bab28761ab485ebea3ad607a77452949c98365..a19e6ce5831ed164f0a4da442a20a9d5ad4c575e 100644
--- a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/Data/CustomerTest.php
+++ b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/Data/CustomerTest.php
@@ -95,7 +95,7 @@ class CustomerTest extends \PHPUnit_Framework_TestCase
                 new \Magento\Framework\Object(['attribute_code' => 'locale'])
             ])
         );
-        $valueBuilder = $this->_objectManager->getObject('Magento\Framework\Api\AttributeValueBuilder');
+        $valueBuilder = $this->_objectManager->getObject('Magento\Framework\Api\AttributeDataBuilder');
         $this->_customerBuilder = $this->_objectManager->getObject(
             'Magento\Customer\Service\V1\Data\CustomerBuilder',
             [
diff --git a/dev/tests/unit/testsuite/Magento/Downloadable/Model/ObserverTest.php b/dev/tests/unit/testsuite/Magento/Downloadable/Model/ObserverTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..258d918729343607d7aa7a395c27d7748943b232
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/Downloadable/Model/ObserverTest.php
@@ -0,0 +1,288 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Downloadable\Model;
+
+use Magento\Downloadable\Model\Observer;
+use Magento\Downloadable\Model\Product\Type;
+use Magento\Downloadable\Model\Resource\Link\Purchased\Item\CollectionFactory;
+use Magento\Store\Model\ScopeInterface;
+use Magento\TestFramework\Helper\ObjectManager as ObjectManagerHelper;
+
+class ObserverTest extends \PHPUnit_Framework_TestCase
+{
+    /** @var Observer */
+    private $observer;
+
+    /**
+     * @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Core\Helper\Data
+     */
+    private $coreData;
+
+    /**
+     * @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Framework\App\Config
+     */
+    private $scopeConfig;
+
+    /**
+     * @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Downloadable\Model\Link\PurchasedFactory
+     */
+    private $purchasedFactory;
+
+    /**
+     * @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Catalog\Model\ProductFactory
+     */
+    private $productFactory;
+
+    /**
+     * @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Downloadable\Model\Link\Purchased\ItemFactory
+     */
+    private $itemFactory;
+
+    /**
+     * @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Checkout\Model\Session
+     */
+    private $checkoutSession;
+
+    /**
+     * @var \PHPUnit_Framework_MockObject_MockObject | CollectionFactory
+     */
+    private $itemsFactory;
+
+    /**
+     * @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Framework\Object\Copy
+     */
+    private $objectCopyService;
+
+    /**
+     * @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Framework\Object
+     */
+    private $resultMock;
+
+    /**
+     * @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Framework\Object
+     */
+    private $storeMock;
+
+    /**
+     * @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Framework\Event
+     */
+    private $eventMock;
+
+    /**
+     * @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Framework\Event\Observer
+     */
+    private $observerMock;
+
+    /**
+     * Sets up the fixture, for example, open a network connection.
+     * This method is called before a test is executed.
+     */
+    public function setUp()
+    {
+        $this->coreData = $this->getMockBuilder('\Magento\Core\Helper\Data')
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $this->scopeConfig = $this->getMockBuilder('\Magento\Framework\App\Config')
+            ->disableOriginalConstructor()
+            ->setMethods(['isSetFlag'])
+            ->getMock();
+
+        $this->purchasedFactory = $this->getMockBuilder('\Magento\Downloadable\Model\Link\PurchasedFactory')
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $this->productFactory = $this->getMockBuilder('\Magento\Catalog\Model\ProductFactory')
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $this->itemFactory = $this->getMockBuilder('\Magento\Downloadable\Model\Link\Purchased\ItemFactory')
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $this->checkoutSession = $this->getMockBuilder('\Magento\Checkout\Model\Session')
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $this->itemsFactory = $this->getMockBuilder(
+            '\Magento\Downloadable\Model\Resource\Link\Purchased\Item\CollectionFactory'
+        )
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $this->objectCopyService = $this->getMockBuilder('\Magento\Framework\Object\Copy')
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $this->resultMock = $this->getMockBuilder('\Magento\Framework\Object')
+            ->disableOriginalConstructor()
+            ->setMethods(['setIsAllowed'])
+            ->getMock();
+
+        $this->storeMock = $this->getMockBuilder('\Magento\Framework\Object')
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $this->eventMock = $this->getMockBuilder('\Magento\Framework\Event')
+            ->disableOriginalConstructor()
+            ->setMethods(['getStore', 'getResult', 'getQuote'])
+            ->getMock();
+
+        $this->observerMock = $this->getMockBuilder('\Magento\Framework\Event\Observer')
+            ->disableOriginalConstructor()
+            ->setMethods(['getEvent'])
+            ->getMock();
+
+        $this->observer = (new ObjectManagerHelper($this))->getObject(
+            '\Magento\Downloadable\Model\Observer',
+            array(
+                'coreData'          => $this->coreData,
+                'scopeConfig'       => $this->scopeConfig,
+                'purchasedFactory'  => $this->purchasedFactory,
+                'productFactory'    => $this->productFactory,
+                'itemFactory'       => $this->itemFactory,
+                'checkoutSession'   => $this->checkoutSession,
+                'itemsFactory'      => $this->itemsFactory,
+                'objectCopyService' => $this->objectCopyService
+            )
+        );
+    }
+
+    /**
+     *
+     * @dataProvider dataProviderForTestisAllowedGuestCheckoutConfigSetToTrue
+     *
+     * @param $productType
+     * @param $isAllowed
+     */
+    public function testIsAllowedGuestCheckoutConfigSetToTrue($productType, $isAllowed)
+    {
+        $this->resultMock->expects($this->at(0))
+            ->method('setIsAllowed')
+            ->with(true);
+
+        if ($isAllowed) {
+            $this->resultMock->expects($this->at(1))
+                ->method('setIsAllowed')
+                ->with(false);
+        }
+
+        $product = $this->getMockBuilder('\Magento\Catalog\Model\Product')
+            ->disableOriginalConstructor()
+            ->setMethods(['getTypeId'])
+            ->getMock();
+
+        $product->expects($this->once())
+            ->method('getTypeId')
+            ->willReturn($productType);
+
+        $item = $this->getMockBuilder('\Magento\Sales\Model\Quote\Item')
+            ->disableOriginalConstructor()
+            ->setMethods(['getProduct'])
+            ->getMock();
+
+        $item->expects($this->once())
+            ->method('getProduct')
+            ->willReturn($product);
+
+        $quote = $this->getMockBuilder('\Magento\Sales\Model\Quote')
+            ->disableOriginalConstructor()
+            ->setMethods(['getAllItems'])
+            ->getMock();
+
+        $quote->expects($this->once())
+            ->method('getAllItems')
+            ->willReturn([$item]);
+
+        $this->eventMock->expects($this->once())
+            ->method('getStore')
+            ->will($this->returnValue($this->storeMock));
+
+        $this->eventMock->expects($this->once())
+            ->method('getResult')
+            ->will($this->returnValue($this->resultMock));
+
+        $this->eventMock->expects($this->once())
+            ->method('getQuote')
+            ->will($this->returnValue($quote));
+
+        $this->scopeConfig->expects($this->exactly(1))
+            ->method('isSetFlag')
+            ->with(Observer::XML_PATH_DISABLE_GUEST_CHECKOUT, ScopeInterface::SCOPE_STORE, $this->storeMock)
+            ->willReturn(true);
+
+        $this->observerMock->expects($this->exactly(3))
+            ->method('getEvent')
+            ->will($this->returnValue($this->eventMock));
+
+        $this->assertInstanceOf(
+            '\Magento\Downloadable\Model\Observer',
+            $this->observer->isAllowedGuestCheckout($this->observerMock)
+        );
+    }
+
+    /**
+     * @return array
+     */
+    public function dataProviderForTestisAllowedGuestCheckoutConfigSetToTrue()
+    {
+        return [
+            1 => [Type::TYPE_DOWNLOADABLE, true],
+            2 => ['unknown', false],
+        ];
+    }
+
+    /**
+     *
+     */
+    public function testIsAllowedGuestCheckoutConfigSetToFalse()
+    {
+        $this->resultMock->expects($this->once())
+            ->method('setIsAllowed')
+            ->with(true);
+
+        $this->eventMock->expects($this->once())
+            ->method('getStore')
+            ->will($this->returnValue($this->storeMock));
+
+        $this->eventMock->expects($this->once())
+            ->method('getResult')
+            ->will($this->returnValue($this->resultMock));
+
+        $this->scopeConfig->expects($this->exactly(1))
+            ->method('isSetFlag')
+            ->with(Observer::XML_PATH_DISABLE_GUEST_CHECKOUT, ScopeInterface::SCOPE_STORE, $this->storeMock)
+            ->willReturn(false);
+
+        $this->observerMock->expects($this->exactly(2))
+            ->method('getEvent')
+            ->will($this->returnValue($this->eventMock));
+
+        $this->assertInstanceOf(
+            '\Magento\Downloadable\Model\Observer',
+            $this->observer->isAllowedGuestCheckout($this->observerMock)
+        );
+    }
+}
diff --git a/dev/tests/unit/testsuite/Magento/Eav/Model/Entity/AbstractTest.php b/dev/tests/unit/testsuite/Magento/Eav/Model/Entity/AbstractTest.php
index c815194b56ba3c18f8f3cc3d1348eb2f6452e903..f25d75da2a9d9e065ef13774c92c0213db039619 100644
--- a/dev/tests/unit/testsuite/Magento/Eav/Model/Entity/AbstractTest.php
+++ b/dev/tests/unit/testsuite/Magento/Eav/Model/Entity/AbstractTest.php
@@ -112,12 +112,10 @@ class AbstractTest extends \PHPUnit_Framework_TestCase
             );
             $mock->setAttributeId($code);
 
-            $logger = $this->getMock('Magento\Framework\Logger', array(), array(), '', false);
             /** @var $backendModel \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend */
             $backendModel = $this->getMock(
                 'Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend',
-                array('getBackend', 'getBackendTable'),
-                array($logger)
+                array('getBackend', 'getBackendTable')
             );
 
             $backendModel->setAttribute($mock);
@@ -249,7 +247,6 @@ class AbstractTest extends \PHPUnit_Framework_TestCase
 
         $attribute = $this->_getAttributeMock($attributeCode, $attributeSetId);
 
-        $logger = $this->getMock('Magento\Framework\Logger', array(), array(), '', false);
         /** @var $backendModel \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend */
         $backendModel = $this->getMock(
             'Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend',
@@ -260,8 +257,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase
                 'isStatic',
                 'getEntityValueId',
                 'getEntityIdField'
-            ),
-            array($logger)
+            )
         );
 
         $backendModel->expects(
diff --git a/dev/tests/unit/testsuite/Magento/Eav/Plugin/Model/Resource/Entity/AttributeTest.php b/dev/tests/unit/testsuite/Magento/Eav/Plugin/Model/Resource/Entity/AttributeTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..30b8cbb836f0885e397aaf5d1bb2c2442c9e1144
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/Eav/Plugin/Model/Resource/Entity/AttributeTest.php
@@ -0,0 +1,129 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+
+namespace Magento\Eav\Plugin\Model\Resource\Entity;
+
+use Magento\TestFramework\Helper\ObjectManager;
+
+class AttributeTest extends \PHPUnit_Framework_TestCase
+{
+    /** @var \Magento\Framework\App\CacheInterface|\PHPUnit_Framework_MockObject_MockObject */
+    protected $cache;
+
+    /** @var \Magento\Framework\App\Cache\StateInterface|\PHPUnit_Framework_MockObject_MockObject */
+    protected $cacheState;
+
+    /** @var \Magento\Eav\Model\Resource\Entity\Attribute|\PHPUnit_Framework_MockObject_MockObject */
+    protected $subject;
+
+    protected function setUp()
+    {
+        $this->cache = $this->getMock('Magento\Framework\App\CacheInterface');
+        $this->cacheState = $this->getMock('Magento\Framework\App\Cache\StateInterface');
+        $this->subject = $this->getMock('Magento\Eav\Model\Resource\Entity\Attribute', [], [], '', false);
+    }
+
+    public function testGetStoreLabelsByAttributeIdOnCacheDisabled()
+    {
+        $this->cache->expects($this->never())->method('load');
+
+        $this->assertEquals(
+            'attributeId',
+            $this->getAttribute(false)->aroundGetStoreLabelsByAttributeId(
+                $this->subject,
+                $this->mockPluginProceed('attributeId'),
+               'attributeId'
+            )
+        );
+    }
+
+    public function testGetStoreLabelsByAttributeIdFromCache()
+    {
+        $attributeId = 1;
+        $attributes = ['k' => 'v'];
+        $cacheId = \Magento\Eav\Plugin\Model\Resource\Entity\Attribute::STORE_LABEL_ATTRIBUTE . $attributeId;
+        $this->cache->expects($this->any())->method('load')->with($cacheId)->willReturn(serialize($attributes));
+
+        $this->assertEquals(
+            $attributes,
+            $this->getAttribute(true)->aroundGetStoreLabelsByAttributeId(
+                $this->subject,
+                $this->mockPluginProceed(),
+                $attributeId
+            )
+        );
+    }
+
+    public function testGetStoreLabelsByAttributeIdWithCacheSave()
+    {
+        $attributeId = 1;
+        $cacheId = \Magento\Eav\Plugin\Model\Resource\Entity\Attribute::STORE_LABEL_ATTRIBUTE . $attributeId;
+        $this->cache->expects($this->any())->method('load')->with($cacheId)->willReturn(false);
+        $this->cache->expects($this->any())->method('save')->with(
+            serialize([$attributeId]),
+            $cacheId,
+            [
+                \Magento\Eav\Model\Cache\Type::CACHE_TAG,
+                \Magento\Eav\Model\Entity\Attribute::CACHE_TAG
+            ]
+        );
+
+        $this->assertEquals(
+            [$attributeId],
+            $this->getAttribute(true)->aroundGetStoreLabelsByAttributeId(
+                $this->subject,
+                $this->mockPluginProceed([$attributeId]),
+                $attributeId
+            )
+        );
+    }
+
+    /**
+     * @param bool $cacheEnabledFlag
+     * @return \Magento\Eav\Plugin\Model\Resource\Entity\Attribute
+     */
+    protected function getAttribute($cacheEnabledFlag)
+    {
+        $this->cacheState->expects($this->any())->method('isEnabled')
+            ->with(\Magento\Eav\Model\Cache\Type::TYPE_IDENTIFIER)->willReturn($cacheEnabledFlag);
+        return (new ObjectManager($this))->getObject(
+            'Magento\Eav\Plugin\Model\Resource\Entity\Attribute',
+            [
+                'cache' => $this->cache,
+                'cacheState' => $this->cacheState
+            ]
+        );
+    }
+
+    /**
+     * @param mixed $returnValue
+     * @return callable
+     */
+    protected function mockPluginProceed($returnValue = null)
+    {
+        return function () use ($returnValue) {
+            return $returnValue;
+        };
+    }
+}
diff --git a/dev/tests/unit/testsuite/Magento/Framework/Api/Code/Generator/BuilderTest.php b/dev/tests/unit/testsuite/Magento/Framework/Api/Code/Generator/BuilderTest.php
deleted file mode 100644
index 2d4ccee5d96e498bf97af74c8a64ce805065310a..0000000000000000000000000000000000000000
--- a/dev/tests/unit/testsuite/Magento/Framework/Api/Code/Generator/BuilderTest.php
+++ /dev/null
@@ -1,156 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Api\Code\Generator;
-
-use Magento\Framework\Code\Generator\Io;
-use Magento\TestFramework\Helper\ObjectManager;
-
-/**
- * Class BuilderTest
- */
-class BuilderTest extends \PHPUnit_Framework_TestCase
-{
-    const SOURCE_CLASS_NAME = 'Magento\Framework\Api\Code\Generator\Sample';
-    const RESULT_CLASS_NAME = 'Magento\Framework\Api\Code\Generator\SampleBuilder';
-    const GENERATOR_CLASS_NAME = 'Magento\Framework\Api\Code\Generator\Builder';
-    const OUTPUT_FILE_NAME = 'SampleBuilder.php';
-    /**
-     * @var Io | \PHPUnit_Framework_MockObject_MockObject
-     */
-    protected $ioObjectMock;
-
-    /**
-     * @var \Magento\Framework\Code\Generator\EntityAbstract
-     */
-    protected $generator;
-
-    /**
-     * @var \Magento\Framework\Code\Generator\FileResolver | \PHPUnit_Framework_MockObject_MockObject
-     */
-    protected $fileResolverMock;
-
-    /**
-     * @var \Magento\Framework\Code\Generator\CodeGenerator\Zend | \PHPUnit_Framework_MockObject_MockObject
-     */
-    protected $classGenerator;
-
-    protected function setUp()
-    {
-        require_once __DIR__ . '/_files/Sample.php';
-        $this->ioObjectMock = $this->getMock(
-            'Magento\Framework\Code\Generator\Io',
-            [],
-            [],
-            '',
-            false
-        );
-        $this->fileResolverMock = $this->getMock(
-            'Magento\Framework\Code\Generator\FileResolver',
-            [],
-            [],
-            '',
-            false
-        );
-        $this->classGenerator = $this->getMock(
-            'Magento\Framework\Code\Generator\CodeGenerator\Zend',
-            [],
-            [],
-            '',
-            false
-        );
-
-        $objectManager = new ObjectManager($this);
-        $this->generator = $objectManager->getObject(
-            self::GENERATOR_CLASS_NAME,
-            [
-                'sourceClassName' => self::SOURCE_CLASS_NAME,
-                'resultClassName' => self::RESULT_CLASS_NAME,
-                'ioObject' => $this->ioObjectMock,
-                'classGenerator' => $this->classGenerator,
-                'fileResolver' => $this->fileResolverMock
-            ]
-        );
-    }
-
-    /**
-     * generate repository name
-     */
-    public function testGenerate()
-    {
-        $generatedCode = 'Generated code';
-        $sourceFileName = 'Sample.php';
-        $resultFileName = self::OUTPUT_FILE_NAME;
-
-        //Mocking _validateData call
-        $this->fileResolverMock->expects($this->at(0))
-            ->method('getFile')
-            ->with(self::SOURCE_CLASS_NAME)
-            ->will($this->returnValue($sourceFileName));
-        $this->fileResolverMock->expects($this->at(1))
-            ->method('getFile')
-            ->with(self::RESULT_CLASS_NAME)
-            ->will($this->returnValue(false));
-
-        $this->ioObjectMock->expects($this->once())
-            ->method('makeGenerationDirectory')
-            ->will($this->returnValue(true));
-        $this->ioObjectMock->expects($this->once())
-            ->method('makeResultFileDirectory')
-            ->with(self::RESULT_CLASS_NAME)
-            ->will($this->returnValue(true));
-        $this->ioObjectMock->expects($this->once())
-            ->method('fileExists')
-            ->with($resultFileName)
-            ->will($this->returnValue(false));
-
-        //Mocking _generateCode call
-        $this->classGenerator->expects($this->once())
-            ->method('setName')
-            ->with(self::RESULT_CLASS_NAME)
-            ->will($this->returnSelf());
-        $this->classGenerator->expects($this->once())
-            ->method('addProperties')
-            ->will($this->returnSelf());
-        $this->classGenerator->expects($this->once())
-            ->method('addMethods')
-            ->will($this->returnSelf());
-        $this->classGenerator->expects($this->once())
-            ->method('setClassDocBlock')
-            ->will($this->returnSelf());
-        $this->classGenerator->expects($this->once())
-            ->method('generate')
-            ->will($this->returnValue($generatedCode));
-
-        //Mocking generation
-        $this->ioObjectMock->expects($this->any())
-            ->method('getResultFileName')
-            ->with(self::RESULT_CLASS_NAME)
-            ->will($this->returnValue($resultFileName));
-        $this->ioObjectMock->expects($this->once())
-            ->method('writeResultFile')
-            ->with($resultFileName, $generatedCode);
-
-        $this->assertTrue($this->generator->generate());
-    }
-}
diff --git a/dev/tests/unit/testsuite/Magento/Framework/Api/Code/Generator/DataBuilderTest.php b/dev/tests/unit/testsuite/Magento/Framework/Api/Code/Generator/DataBuilderTest.php
index eeb35b66f7af821cfecff0ac38d3afa53b353fa6..2470fc9dbb4a99c7622d4a925661ec72cda99b32 100644
--- a/dev/tests/unit/testsuite/Magento/Framework/Api/Code/Generator/DataBuilderTest.php
+++ b/dev/tests/unit/testsuite/Magento/Framework/Api/Code/Generator/DataBuilderTest.php
@@ -146,8 +146,9 @@ class DataBuilderTest extends \PHPUnit_Framework_TestCase
         //Verify if the generated code is as expected
         $this->ioObjectMock->expects($this->once())
             ->method('writeResultFile')
-            ->with($resultFileName, $generatedCode);
+            ->with($resultFileName, $generatedCode)
+            ->will($this->returnValue(true));
 
-        $this->assertTrue($this->generator->generate());
+        $this->assertTrue($this->generator->generate(), implode("\n", $this->generator->getErrors()));
     }
 }
diff --git a/dev/tests/unit/testsuite/Magento/Framework/Api/Code/Generator/GenerateBuilderTest.php b/dev/tests/unit/testsuite/Magento/Framework/Api/Code/Generator/GenerateBuilderTest.php
deleted file mode 100644
index c2f7d9ccea9b46ba981da7cd6b2db65258262718..0000000000000000000000000000000000000000
--- a/dev/tests/unit/testsuite/Magento/Framework/Api/Code/Generator/GenerateBuilderTest.php
+++ /dev/null
@@ -1,84 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Api\Code\Generator;
-
-/**
- * Class BuilderTest
- */
-class GenerateBuilderTest extends \PHPUnit_Framework_TestCase
-{
-    /**
-     * @var \PHPUnit_Framework_MockObject_MockObject
-     */
-    protected $ioObjectMock;
-
-    /**
-     * Prepare test env
-     */
-    protected function setUp()
-    {
-        $this->ioObjectMock = $this->getMock(
-            '\Magento\Framework\Code\Generator\Io',
-            [],
-            [],
-            '',
-            false
-        );
-    }
-
-    /**
-     * generate repository class
-     */
-    public function testGenerate()
-    {
-        require_once __DIR__ . '/_files/Sample.php';
-        /** @var \Magento\Framework\Api\Code\Generator\Builder $model */
-        $model = $this->getMock(
-            '\Magento\Framework\Api\Code\Generator\Builder',
-            [
-                '_validateData'
-            ],
-            [
-                '\Magento\Framework\Api\Code\Generator\Sample',
-                null,
-                $this->ioObjectMock,
-                null,
-                null
-            ]
-        );
-        $sampleBuilderCode = file_get_contents(__DIR__ . '/_files/SampleBuilder.txt');
-        $this->ioObjectMock->expects($this->once())
-            ->method('getResultFileName')
-            ->with('\Magento\Framework\Api\Code\Generator\SampleBuilder')
-            ->will($this->returnValue('SampleBuilder.php'));
-        $this->ioObjectMock->expects($this->once())
-            ->method('writeResultFile')
-            ->with('SampleBuilder.php', $sampleBuilderCode);
-
-        $model->expects($this->once())
-            ->method('_validateData')
-            ->will($this->returnValue(true));
-        $this->assertTrue($model->generate());
-    }
-}
diff --git a/dev/tests/unit/testsuite/Magento/Framework/Api/Code/Generator/GenerateSearchResultsBuilderTest.php b/dev/tests/unit/testsuite/Magento/Framework/Api/Code/Generator/GenerateSearchResultsBuilderTest.php
index 0a991beb96c260506c5c9267caf5672916723818..3f9381ad6d8bff245c7b1faa5535ec1a17fb95f0 100644
--- a/dev/tests/unit/testsuite/Magento/Framework/Api/Code/Generator/GenerateSearchResultsBuilderTest.php
+++ b/dev/tests/unit/testsuite/Magento/Framework/Api/Code/Generator/GenerateSearchResultsBuilderTest.php
@@ -55,6 +55,7 @@ class GenerateSearchResultsBuilderTest extends \PHPUnit_Framework_TestCase
     public function testGenerate()
     {
         require_once __DIR__ . '/_files/Sample.php';
+        /** @var \Magento\Framework\Api\Code\Generator\SearchResultsBuilder $model */
         $model = $this->getMock(
             'Magento\Framework\Api\Code\Generator\SearchResultsBuilder',
             [
@@ -80,6 +81,6 @@ class GenerateSearchResultsBuilderTest extends \PHPUnit_Framework_TestCase
         $model->expects($this->once())
             ->method('_validateData')
             ->will($this->returnValue(true));
-        $this->assertTrue($model->generate());
+        $this->assertTrue($model->generate(), implode("\n", $model->getErrors()));
     }
 }
diff --git a/dev/tests/unit/testsuite/Magento/Framework/Api/Code/Generator/_files/ExtensibleSampleDataBuilder.txt b/dev/tests/unit/testsuite/Magento/Framework/Api/Code/Generator/_files/ExtensibleSampleDataBuilder.txt
index 5fd08f8ccfcb3884dddb7b4ed27c1bef7b5140cc..829ed168b5deb680c4cc9f7861f3323bda46e8cf 100644
--- a/dev/tests/unit/testsuite/Magento/Framework/Api/Code/Generator/_files/ExtensibleSampleDataBuilder.txt
+++ b/dev/tests/unit/testsuite/Magento/Framework/Api/Code/Generator/_files/ExtensibleSampleDataBuilder.txt
@@ -4,7 +4,7 @@ namespace Magento\Framework\Api\Code\Generator;
  * DataBuilder class for
  * \Magento\Framework\Api\Code\Generator\ExtensibleSampleInterface
  */
-class ExtensibleSampleDataBuilder extends \Magento\Framework\Api\CompositeExtensibleDataBuilder
+class ExtensibleSampleDataBuilder extends \Magento\Framework\Api\Builder
 {
     /**
      * @param array $items
@@ -12,7 +12,7 @@ class ExtensibleSampleDataBuilder extends \Magento\Framework\Api\CompositeExtens
      */
     public function setItems($items)
     {
-        $this->set('items', $items);
+        $this->_set('items', $items);
         return $this;
     }
 
@@ -22,7 +22,7 @@ class ExtensibleSampleDataBuilder extends \Magento\Framework\Api\CompositeExtens
      */
     public function setName($name)
     {
-        $this->set('name', $name);
+        $this->_set('name', $name);
         return $this;
     }
 
@@ -32,7 +32,7 @@ class ExtensibleSampleDataBuilder extends \Magento\Framework\Api\CompositeExtens
      */
     public function setCount($count)
     {
-        $this->set('count', $count);
+        $this->_set('count', $count);
         return $this;
     }
 
@@ -42,19 +42,24 @@ class ExtensibleSampleDataBuilder extends \Magento\Framework\Api\CompositeExtens
      */
     public function setCreatedAt($createdAt)
     {
-        $this->set('created_at', $createdAt);
+        $this->_set('created_at', $createdAt);
         return $this;
     }
 
     /**
      * Initialize the builder
      *
-     * @param \Magento\Framework\ObjectManager $objectManager
+     * @param \Magento\Framework\Api\ObjectFactory $objectFactory
      * @param \Magento\Framework\Api\MetadataServiceInterface $metadataService
+     * @param \Magento\Framework\Api\AttributeDataBuilder $attributeValueBuilder
+     * @param \Magento\Framework\Reflection\DataObjectProcessor $objectProcessor
+     * @param \Magento\Framework\Reflection\TypeProcessor $typeProcessor
+     * @param \Magento\Framework\Serialization\DataBuilderFactory $dataBuilderFactory
      * @param \Magento\Framework\ObjectManager\Config $objectManagerConfig
+     * @param string|null $modelClassInterface
      */
-    public function __construct(\Magento\Framework\ObjectManager $objectManager, \Magento\Framework\Api\MetadataServiceInterface $metadataService, \Magento\Framework\ObjectManager\Config $objectManagerConfig)
+    public function __construct(\Magento\Framework\Api\ObjectFactory $objectFactory, \Magento\Framework\Api\MetadataServiceInterface $metadataService, \Magento\Framework\Api\AttributeDataBuilder $attributeValueBuilder, \Magento\Framework\Reflection\DataObjectProcessor $objectProcessor, \Magento\Framework\Reflection\TypeProcessor $typeProcessor, \Magento\Framework\Serialization\DataBuilderFactory $dataBuilderFactory, \Magento\Framework\ObjectManager\Config $objectManagerConfig, $modelClassInterface = null)
     {
-        parent::__construct($objectManager, $metadataService, $objectManagerConfig, 'Magento\Framework\Api\Code\Generator\ExtensibleSampleInterface');
+        parent::__construct($objectFactory, $metadataService, $attributeValueBuilder, $objectProcessor, $typeProcessor, $dataBuilderFactory, $objectManagerConfig, 'Magento\Framework\Api\Code\Generator\ExtensibleSampleInterface');
     }
 }
diff --git a/dev/tests/unit/testsuite/Magento/Framework/Api/Code/Generator/_files/SampleSearchResultsBuilder.txt b/dev/tests/unit/testsuite/Magento/Framework/Api/Code/Generator/_files/SampleSearchResultsBuilder.txt
index 4bacbf1bd8f9710697e7863aede4093c4ea56a27..96578961ade1fcb36bbeee70a249a9c31e18ec9f 100644
--- a/dev/tests/unit/testsuite/Magento/Framework/Api/Code/Generator/_files/SampleSearchResultsBuilder.txt
+++ b/dev/tests/unit/testsuite/Magento/Framework/Api/Code/Generator/_files/SampleSearchResultsBuilder.txt
@@ -10,7 +10,7 @@ class SampleSearchResultsBuilder extends \Magento\Framework\Api\AbstractSearchRe
      *
      * @param
      */
-    public function __construct(\Magento\Framework\Api\ObjectFactory $objectFactory, \Magento\Framework\Api\AttributeValueBuilder $valueBuilder, \Magento\Framework\Api\Config\MetadataConfig $metadataService, \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder, \Magento\Framework\Api\Code\Generator\SampleBuilder $itemObjectBuilder)
+    public function __construct(\Magento\Framework\Api\ObjectFactory $objectFactory, \Magento\Framework\Api\AttributeDataBuilder $valueBuilder, \Magento\Framework\Api\Config\MetadataConfig $metadataService, \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder, \Magento\Framework\Api\Code\Generator\SampleBuilder $itemObjectBuilder)
     {
         parent::__construct($objectFactory, $valueBuilder, $metadataService, $searchCriteriaBuilder, $itemObjectBuilder);
     }
diff --git a/dev/tests/unit/testsuite/Magento/Framework/Api/Data/AttributeValueTest.php b/dev/tests/unit/testsuite/Magento/Framework/Api/Data/AttributeValueTest.php
index c748e9820c3461a542bcdca7edd6a0a28c647c1d..8505df47f3143a3c47ae2768aebe8f7fbd4e23aa 100644
--- a/dev/tests/unit/testsuite/Magento/Framework/Api/Data/AttributeValueTest.php
+++ b/dev/tests/unit/testsuite/Magento/Framework/Api/Data/AttributeValueTest.php
@@ -40,7 +40,7 @@ class AttributeValueTest extends \PHPUnit_Framework_TestCase
     public function testConstructorAndGettersWithString()
     {
         $helper = new \Magento\TestFramework\Helper\ObjectManager($this);
-        $attributeBuilder = $helper->getObject('\Magento\Framework\Api\AttributeValueBuilder')
+        $attributeBuilder = $helper->getObject('\Magento\Framework\Api\AttributeDataBuilder')
             ->setAttributeCode(self::ATTRIBUTE_CODE)
             ->setValue(self::STRING_VALUE);
         $attribute = new AttributeValue($attributeBuilder);
@@ -52,7 +52,7 @@ class AttributeValueTest extends \PHPUnit_Framework_TestCase
     public function testConstructorAndGettersWithInteger()
     {
         $helper = new \Magento\TestFramework\Helper\ObjectManager($this);
-        $attributeBuilder = $helper->getObject('\Magento\Framework\Api\AttributeValueBuilder')
+        $attributeBuilder = $helper->getObject('\Magento\Framework\Api\AttributeDataBuilder')
             ->setAttributeCode(self::ATTRIBUTE_CODE)
             ->setValue(self::INTEGER_VALUE);
         $attribute = new AttributeValue($attributeBuilder);
@@ -64,7 +64,7 @@ class AttributeValueTest extends \PHPUnit_Framework_TestCase
     public function testConstructorAndGettersWithFloat()
     {
         $helper = new \Magento\TestFramework\Helper\ObjectManager($this);
-        $attributeBuilder = $helper->getObject('\Magento\Framework\Api\AttributeValueBuilder')
+        $attributeBuilder = $helper->getObject('\Magento\Framework\Api\AttributeDataBuilder')
             ->setAttributeCode(self::ATTRIBUTE_CODE)
             ->setValue(self::FLOAT_VALUE);
         $attribute = new AttributeValue($attributeBuilder);
@@ -76,7 +76,7 @@ class AttributeValueTest extends \PHPUnit_Framework_TestCase
     public function testConstructorAndGettersWithBoolean()
     {
         $helper = new \Magento\TestFramework\Helper\ObjectManager($this);
-        $attributeBuilder = $helper->getObject('\Magento\Framework\Api\AttributeValueBuilder')
+        $attributeBuilder = $helper->getObject('\Magento\Framework\Api\AttributeDataBuilder')
             ->setAttributeCode(self::ATTRIBUTE_CODE)
             ->setValue(self::BOOLEAN_VALUE);
         $attribute = new AttributeValue($attributeBuilder);
diff --git a/dev/tests/unit/testsuite/Magento/Framework/App/View/Deployment/VersionTest.php b/dev/tests/unit/testsuite/Magento/Framework/App/View/Deployment/VersionTest.php
index 2cf42e36ab5611c0d504a33bb539a1e99e789b0c..d788d532e7c912aa69a365ffbb0e65110d609b6c 100644
--- a/dev/tests/unit/testsuite/Magento/Framework/App/View/Deployment/VersionTest.php
+++ b/dev/tests/unit/testsuite/Magento/Framework/App/View/Deployment/VersionTest.php
@@ -44,16 +44,16 @@ class VersionTest extends \PHPUnit_Framework_TestCase
     private $versionStorage;
 
     /**
-     * @var \PHPUnit_Framework_MockObject_MockObject
+     * @var \Magento\Framework\Stdlib\DateTime|\PHPUnit_Framework_MockObject_MockObject
      */
-    private $versionGenerator;
+    private $dateTime;
 
     protected function setUp()
     {
         $this->appState = $this->getMock('Magento\Framework\App\State', array(), array(), '', false);
         $this->versionStorage = $this->getMock('Magento\Framework\App\View\Deployment\Version\StorageInterface');
-        $this->versionGenerator = $this->getMock('Magento\Framework\App\View\Deployment\Version\GeneratorInterface');
-        $this->object = new Version($this->appState, $this->versionStorage, $this->versionGenerator);
+        $this->dateTime = $this->getMock('Magento\Framework\Stdlib\DateTime');
+        $this->object = new Version($this->appState, $this->versionStorage, $this->dateTime);
     }
 
     public function testGetValueDeveloperMode()
@@ -64,7 +64,7 @@ class VersionTest extends \PHPUnit_Framework_TestCase
             ->will($this->returnValue(\Magento\Framework\App\State::MODE_DEVELOPER))
         ;
         $this->versionStorage->expects($this->never())->method($this->anything());
-        $this->versionGenerator->expects($this->once())->method('generate')->will($this->returnValue('123'));
+        $this->dateTime->expects($this->once())->method('toTimestamp')->will($this->returnValue('123'));
         $this->assertEquals('123', $this->object->getValue());
         $this->object->getValue(); // Ensure computation occurs only once and result is cached in memory
     }
@@ -82,7 +82,7 @@ class VersionTest extends \PHPUnit_Framework_TestCase
         ;
         $this->versionStorage->expects($this->once())->method('load')->will($this->returnValue('123'));
         $this->versionStorage->expects($this->never())->method('save');
-        $this->versionGenerator->expects($this->never())->method('generate');
+        $this->dateTime->expects($this->never())->method('toTimestamp');
         $this->assertEquals('123', $this->object->getValue());
         $this->object->getValue(); // Ensure caching in memory
     }
@@ -109,7 +109,7 @@ class VersionTest extends \PHPUnit_Framework_TestCase
             ->method('load')
             ->will($this->throwException($storageException))
         ;
-        $this->versionGenerator->expects($this->once())->method('generate')->will($this->returnValue('123'));
+        $this->dateTime->expects($this->once())->method('toTimestamp')->will($this->returnValue('123'));
         $this->versionStorage->expects($this->once())->method('save')->with('123');
         $this->assertEquals('123', $this->object->getValue());
         $this->object->getValue(); // Ensure caching in memory
diff --git a/dev/tests/unit/testsuite/Magento/Framework/Filter/Template/Tokenizer/ParameterTest.php b/dev/tests/unit/testsuite/Magento/Framework/Filter/Template/Tokenizer/ParameterTest.php
index 7fbeaa0c98eb4983834f3794769771894ef35abd..cf97f4bbf09deb9e8a77576a85f2b29fba507ac7 100644
--- a/dev/tests/unit/testsuite/Magento/Framework/Filter/Template/Tokenizer/ParameterTest.php
+++ b/dev/tests/unit/testsuite/Magento/Framework/Filter/Template/Tokenizer/ParameterTest.php
@@ -61,7 +61,8 @@ class ParameterTest extends \PHPUnit_Framework_TestCase
     {
         return [
             [" direct_url='about-magento-demo-store'", ['direct_url' => 'about-magento-demo-store']],
-            [" direct_url='about-magento-demo-store\\[newDemo]", ['direct_url' => 'about-magento-demo-store[newDemo]']],
+            [" direct_url='about-magento-demo-store\\[newDemo]",
+            ['direct_url' => 'about-magento-demo-store\\[newDemo]']],
             ["   ", []]
         ];
     }
@@ -70,7 +71,7 @@ class ParameterTest extends \PHPUnit_Framework_TestCase
     {
         return [
             [" direct_url='about-magento-demo-store'", "direct_url='about-magento-demo-store'"],
-            [" direct_url='about-magento-demo-store\\[newDemo]", "direct_url='about-magento-demo-store[newDemo]"],
+            [" direct_url='about-magento-demo-store\\[newDemo]", "direct_url='about-magento-demo-store\\[newDemo]"],
             ['   ', '']
         ];
     }
diff --git a/dev/tests/unit/testsuite/Magento/Framework/Model/AbstractExtensibleModelTest.php b/dev/tests/unit/testsuite/Magento/Framework/Model/AbstractExtensibleModelTest.php
index b0984d320f7b18347d35a12c1f918afc5a530501..634f28525ab7e0132fa07f35c911ca00d186b828 100644
--- a/dev/tests/unit/testsuite/Magento/Framework/Model/AbstractExtensibleModelTest.php
+++ b/dev/tests/unit/testsuite/Magento/Framework/Model/AbstractExtensibleModelTest.php
@@ -158,7 +158,7 @@ class AbstractExtensibleModelTest extends \PHPUnit_Framework_TestCase
      */
     public function testRestrictedCustomAttributesGet()
     {
-        $this->model->getData(\Magento\Framework\Model\AbstractExtensibleModel::CUSTOM_ATTRIBUTES_KEY);
+        $this->model->getData(\Magento\Framework\Api\ExtensibleDataInterface::CUSTOM_ATTRIBUTES);
     }
 
     /**
@@ -166,7 +166,7 @@ class AbstractExtensibleModelTest extends \PHPUnit_Framework_TestCase
      */
     public function testRestrictedCustomAttributesSet()
     {
-        $this->model->setData(\Magento\Framework\Model\AbstractExtensibleModel::CUSTOM_ATTRIBUTES_KEY, 'value');
+        $this->model->setData(\Magento\Framework\Api\ExtensibleDataInterface::CUSTOM_ATTRIBUTES, 'value');
     }
 
     /**
@@ -177,8 +177,8 @@ class AbstractExtensibleModelTest extends \PHPUnit_Framework_TestCase
     protected function addCustomAttributesToModel($attributesAsArray, $model)
     {
         $objectManager = new ObjectManagerHelper($this);
-        /** @var \Magento\Framework\Api\AttributeValueBuilder $attributeValueBuilder */
-        $attributeValueBuilder = $objectManager->getObject('Magento\Framework\Api\AttributeValueBuilder');
+        /** @var \Magento\Framework\Api\AttributeDataBuilder $attributeValueBuilder */
+        $attributeValueBuilder = $objectManager->getObject('Magento\Framework\Api\AttributeDataBuilder');
         $addedAttributes = [];
         foreach ($attributesAsArray as $attributeCode => $attributeValue) {
             $addedAttributes[$attributeCode] = $attributeValueBuilder
diff --git a/dev/tests/unit/testsuite/Magento/Indexer/Model/IndexerRegistryTest.php b/dev/tests/unit/testsuite/Magento/Indexer/Model/IndexerRegistryTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..70fb6e837d7d0eaa588c9b5a299a511baf882b0b
--- /dev/null
+++ b/dev/tests/unit/testsuite/Magento/Indexer/Model/IndexerRegistryTest.php
@@ -0,0 +1,45 @@
+<?php
+/**
+ * Magento
+ *
+ * NOTICE OF LICENSE
+ *
+ * This source file is subject to the Open Software License (OSL 3.0)
+ * that is bundled with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://opensource.org/licenses/osl-3.0.php
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@magentocommerce.com so we can send you a copy immediately.
+ *
+ * DISCLAIMER
+ *
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
+ * versions in the future. If you wish to customize Magento for your
+ * needs please refer to http://www.magentocommerce.com for more information.
+ *
+ * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
+ * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
+ */
+namespace Magento\Indexer\Model;
+
+class IndexerRegistryTest extends \PHPUnit_Framework_TestCase
+{
+    public function testGetCreatesIndexerInstancesAndReusesExistingOnes()
+    {
+        $firstIndexer = $this->getMock('Magento\Indexer\Model\IndexerInterface');
+        $firstIndexer->expects($this->once())->method('load')->with('first-indexer')->willReturnSelf();
+
+        $secondIndexer = $this->getMock('Magento\Indexer\Model\IndexerInterface');
+        $secondIndexer->expects($this->once())->method('load')->with('second-indexer')->willReturnSelf();
+
+        $objectManager = $this->getMock('Magento\Framework\ObjectManager', [], [], '', false);
+        $objectManager->expects($this->at(0))->method('create')->willReturn($firstIndexer);
+        $objectManager->expects($this->at(1))->method('create')->willReturn($secondIndexer);
+
+        $unit = new IndexerRegistry($objectManager);
+        $this->assertSame($firstIndexer, $unit->get('first-indexer'));
+        $this->assertSame($secondIndexer, $unit->get('second-indexer'));
+        $this->assertSame($firstIndexer, $unit->get('first-indexer'));
+    }
+}
diff --git a/dev/tests/unit/testsuite/Magento/Payment/Model/InfoTest.php b/dev/tests/unit/testsuite/Magento/Payment/Model/InfoTest.php
index 1b68e249709334873e87c5fefb005b6f10411f61..c70b6db1d42f1af91eba2fa07931faa798416e1e 100644
--- a/dev/tests/unit/testsuite/Magento/Payment/Model/InfoTest.php
+++ b/dev/tests/unit/testsuite/Magento/Payment/Model/InfoTest.php
@@ -239,4 +239,12 @@ class InfoTest extends \PHPUnit_Framework_TestCase
         $this->assertTrue($this->info->hasAdditionalInformation('key2'));
         $this->assertTrue($this->info->hasAdditionalInformation());
     }
+
+    public function testInitAdditionalInformationWithUnserialize()
+    {
+        $data = serialize(['key1' => 'data1', 'key2' => 'data2']);
+        $this->info->setData('additional_information', $data);
+
+        $this->assertEquals(unserialize($data), $this->info->getAdditionalInformation());
+    }
 }
diff --git a/dev/tests/unit/testsuite/Magento/Rule/Model/Condition/CombineTest.php b/dev/tests/unit/testsuite/Magento/Rule/Model/Condition/CombineTest.php
index 9320cabcfb8d46e6d417c28062457be8f691cb2d..5805a04fdd4989e93f65d8f10cfc41e7862ffcae 100644
--- a/dev/tests/unit/testsuite/Magento/Rule/Model/Condition/CombineTest.php
+++ b/dev/tests/unit/testsuite/Magento/Rule/Model/Condition/CombineTest.php
@@ -29,46 +29,139 @@ use Magento\TestFramework\Helper\ObjectManager as ObjectManagerHelper;
 class CombineTest extends \PHPUnit_Framework_TestCase
 {
     /**
-     * @var \Magento\Rule\Model\Condition\Combine
+     * @var \Magento\Rule\Model\Condition\Combine | \PHPUnit_Framework_MockObject_MockObject
      */
-    protected $_combine;
+    private $combine;
 
     /**
-     * @var ObjectManagerHelper
+     * @var \Magento\Rule\Model\ConditionFactory | \PHPUnit_Framework_MockObject_MockObject
      */
-    protected $_objectManagerHelper;
+    private $conditionFactoryMock;
 
     /**
-     * @var \Magento\Rule\Model\Condition\Context|\PHPUnit_Framework_MockObject_MockObject
+     * @var \Magento\Framework\Logger | \PHPUnit_Framework_MockObject_MockObject
      */
-    protected $_contextMock;
+    private $loggerMock;
 
+    /**
+     * @var  \Magento\SalesRule\Model\Rule\Condition\Product | \PHPUnit_Framework_MockObject_MockObject
+     */
+    private $conditionObjectMock;
+
+    /**
+     * Sets up the Mocks.
+     * This method is called before a test is executed.
+     */
     protected function setUp()
     {
-        $this->_objectManagerHelper = new ObjectManagerHelper($this);
-        $this->_combine = $this->_objectManagerHelper->getObject('Magento\Rule\Model\Condition\Combine');
+        $this->conditionFactoryMock = $this->getMockBuilder('\Magento\Rule\Model\ConditionFactory')
+            ->disableOriginalConstructor()
+            ->setMethods([])
+            ->getMock();
+
+        $this->loggerMock = $this->getMockBuilder('\Magento\Framework\Logger')
+            ->disableOriginalConstructor()
+            ->setMethods([])
+            ->getMock();
+
+        $this->conditionObjectMock = $this->getMockBuilder('\Magento\SalesRule\Model\Rule\Condition\Product')
+            ->disableOriginalConstructor()
+            ->setMethods([])
+            ->getMock();
+
+        $this->combine = (new ObjectManagerHelper($this))->getObject(
+            '\Magento\Rule\Model\Condition\Combine',
+            [
+                "conditionFactory"    => $this->conditionFactoryMock,
+                "logger"    => $this->loggerMock,
+            ]
+        );
     }
 
     /**
+     *
      * @covers \Magento\Rule\Model\Condition\AbstractCondition::getValueName
+     *
      * @dataProvider optionValuesData
+     *
      * @param string|array $value
      * @param string $expectingData
      */
     public function testGetValueName($value, $expectingData)
     {
-        $this->_combine->setValueOption(array('option_key' => 'option_value'))->setValue($value);
-        $this->assertEquals($expectingData, $this->_combine->getValueName());
+        $this->combine
+            ->setValueOption(['option_key' => 'option_value'])
+            ->setValue($value);
+
+        $this->assertEquals($expectingData, $this->combine->getValueName());
     }
 
+    /**
+     * @return array
+     */
     public function optionValuesData()
     {
-        return array(
-            array('option_key', 'option_value'),
-            array('option_value', 'option_value'),
-            array(array('option_key'), 'option_value'),
-            array('', '...'),
-        );
+        return [
+            ['option_key', 'option_value'],
+            ['option_value', 'option_value'],
+            [['option_key'], 'option_value'],
+            ['', '...'],
+        ];
+    }
+
+    public function testLoadArray()
+    {
+        $array['conditions'] = [
+            [
+                'type' => 'test',
+                'attribute' => '',
+                'operator' => '',
+                'value' => '',
+            ]
+        ];
+
+        $this->conditionObjectMock->expects($this->once())
+            ->method('loadArray')
+            ->with($array['conditions'][0], 'conditions');
+
+        $this->conditionFactoryMock->expects($this->once())
+            ->method('create')
+            ->with($array['conditions'][0]['type'])
+            ->willReturn($this->conditionObjectMock);
+
+        $this->loggerMock->expects($this->never())
+            ->method('logException');
+
+        $result = $this->combine->loadArray($array);
+
+        $this->assertInstanceOf('\Magento\Rule\Model\Condition\Combine', $result);
     }
 
+    public function testLoadArrayLoggerCatchException()
+    {
+        $array['conditions'] = [
+            [
+                'type' => '',
+                'attribute' => '',
+                'operator' => '',
+                'value' => '',
+            ]
+        ];
+
+        $this->conditionObjectMock->expects($this->never())
+            ->method('loadArray');
+
+        $this->conditionFactoryMock->expects($this->once())
+            ->method('create')
+            ->with($array['conditions'][0]['type'])
+            ->willThrowException(new \Exception('everything is fine, it is test'));
+
+        $this->loggerMock->expects($this->once())
+            ->method('logException')
+            ->with();
+
+        $result = $this->combine->loadArray($array);
+
+        $this->assertInstanceOf('\Magento\Rule\Model\Condition\Combine', $result);
+    }
 }
diff --git a/dev/tests/unit/testsuite/Magento/Rule/Model/ConditionFactoryTest.php b/dev/tests/unit/testsuite/Magento/Rule/Model/ConditionFactoryTest.php
index c918965894158b561f72b2019cfce770dd011576..d9f6fcde1a5514c21703ad8c11727f332945e30d 100644
--- a/dev/tests/unit/testsuite/Magento/Rule/Model/ConditionFactoryTest.php
+++ b/dev/tests/unit/testsuite/Magento/Rule/Model/ConditionFactoryTest.php
@@ -56,11 +56,29 @@ class ConditionFactoryTest extends \PHPUnit_Framework_TestCase
         );
     }
 
-    public function testCreate()
+    public function testExceptingToCallMethodCreateInObjectManager()
     {
-        $type = '1';
-        $data = ['data2', 'data3'];
-        $this->objectManagerMock->expects($this->once())->method('create')->with($type, $data);
-        $this->conditionFactory->create($type, $data);
+        $type = 'type';
+        $this->objectManagerMock
+            ->expects($this->once())
+            ->method('create')
+            ->with($type)
+            ->willReturn(new \stdClass());
+
+        $this->conditionFactory->create($type);
+    }
+
+    public function testExceptingClonedObject()
+    {
+        $origin = new \stdClass();
+
+        $this->objectManagerMock->expects($this->once())
+            ->method('create')
+            ->with('clone')
+            ->willReturn($origin);
+
+        $cloned = $this->conditionFactory->create('clone');
+
+        $this->assertNotSame($cloned, $origin);
     }
 }
diff --git a/dev/tests/unit/testsuite/Magento/Sales/Model/AdminOrder/CreateTest.php b/dev/tests/unit/testsuite/Magento/Sales/Model/AdminOrder/CreateTest.php
index 3112c42692d3b0a35e8e363122e8f6765160e5c8..a79c683beb11fd85206e5c609baa6239975b1276 100644
--- a/dev/tests/unit/testsuite/Magento/Sales/Model/AdminOrder/CreateTest.php
+++ b/dev/tests/unit/testsuite/Magento/Sales/Model/AdminOrder/CreateTest.php
@@ -196,7 +196,7 @@ class CreateTest extends \PHPUnit_Framework_TestCase
         )->method(
             'mergeDataObjectWithArray'
         )->will(
-            $this->returnArgument(0)
+            $this->returnValue($this->customerBuilderMock)
         );
 
         $this->customerGroupServiceMock->expects(
diff --git a/dev/tests/unit/testsuite/Magento/Sales/Model/Observer/Frontend/Quote/Address/CollectTotalsTest.php b/dev/tests/unit/testsuite/Magento/Sales/Model/Observer/Frontend/Quote/Address/CollectTotalsTest.php
index 77d2fdf6184242353877137b23f67a1c032a17ad..1ffc4468220847a85ae744d33f7a0ceb19bd52d7 100644
--- a/dev/tests/unit/testsuite/Magento/Sales/Model/Observer/Frontend/Quote/Address/CollectTotalsTest.php
+++ b/dev/tests/unit/testsuite/Magento/Sales/Model/Observer/Frontend/Quote/Address/CollectTotalsTest.php
@@ -95,7 +95,7 @@ class CollectTotalsTest extends \PHPUnit_Framework_TestCase
         $this->customerHelperMock = $this->getMock('Magento\Customer\Helper\Data', array(), array(), '', false);
         $this->customerBuilderMock = $this->getMock(
             'Magento\Customer\Service\V1\Data\CustomerBuilder',
-            array('mergeDataObjectWithArray'),
+            array('mergeDataObjectWithArray', 'create'),
             array(),
             '',
             false
@@ -165,9 +165,9 @@ class CollectTotalsTest extends \PHPUnit_Framework_TestCase
 
     public function testDispatchWithDisableAutoGroupChange()
     {
-        /** @var \Magento\Framework\Api\AttributeValueBuilder $attributeValueBuilder */
+        /** @var \Magento\Framework\Api\AttributeDataBuilder $attributeValueBuilder */
         $attributeValueBuilder = $this->objectManager
-            ->getObject('Magento\Framework\Api\AttributeValueBuilder');
+            ->getObject('Magento\Framework\Api\AttributeDataBuilder');
         $attributeValueBuilder->setAttributeCode('disable_auto_group_change')->setValue(true);
         $this->customerDataMock->expects(
             $this->exactly(2)
@@ -184,9 +184,9 @@ class CollectTotalsTest extends \PHPUnit_Framework_TestCase
 
     public function testDispatchWithDisableVatValidator()
     {
-        /** @var \Magento\Framework\Api\AttributeValueBuilder $attributeValueBuilder */
+        /** @var \Magento\Framework\Api\AttributeDataBuilder $attributeValueBuilder */
         $attributeValueBuilder = $this->objectManager
-            ->getObject('Magento\Framework\Api\AttributeValueBuilder');
+            ->getObject('Magento\Framework\Api\AttributeDataBuilder');
         $attributeValueBuilder->setAttributeCode('disable_auto_group_change')->setValue(false);
         $this->customerDataMock->expects(
             $this->exactly(2)
@@ -213,9 +213,9 @@ class CollectTotalsTest extends \PHPUnit_Framework_TestCase
 
     public function testDispatchWithCustomerCountryNotInEUAndNotLoggedCustomerInGroup()
     {
-        /** @var \Magento\Framework\Api\AttributeValueBuilder $attributeValueBuilder */
+        /** @var \Magento\Framework\Api\AttributeDataBuilder $attributeValueBuilder */
         $attributeValueBuilder = $this->objectManager
-            ->getObject('Magento\Framework\Api\AttributeValueBuilder');
+            ->getObject('Magento\Framework\Api\AttributeDataBuilder');
         $attributeValueBuilder->setAttributeCode('disable_auto_group_change')->setValue(false);
         /** Preconditions */
         $this->customerDataMock->expects(
@@ -271,9 +271,9 @@ class CollectTotalsTest extends \PHPUnit_Framework_TestCase
 
     public function testDispatchWithDefaultCustomerGroupId()
     {
-        /** @var \Magento\Framework\Api\AttributeValueBuilder $attributeValueBuilder */
+        /** @var \Magento\Framework\Api\AttributeDataBuilder $attributeValueBuilder */
         $attributeValueBuilder = $this->objectManager
-            ->getObject('Magento\Framework\Api\AttributeValueBuilder');
+            ->getObject('Magento\Framework\Api\AttributeDataBuilder');
         $attributeValueBuilder->setAttributeCode('disable_auto_group_change')->setValue(false);
         /** Preconditions */
         $this->customerDataMock->expects(
@@ -339,6 +339,13 @@ class CollectTotalsTest extends \PHPUnit_Framework_TestCase
         )->with(
             $this->customerDataMock,
             array('group_id' => 'defaultCustomerGroupId')
+        )->will(
+            $this->returnValue($this->customerBuilderMock)
+        );
+        $this->customerBuilderMock->expects(
+            $this->once()
+        )->method(
+            'create'
         )->will(
             $this->returnValue($this->customerDataMock)
         );
@@ -351,9 +358,9 @@ class CollectTotalsTest extends \PHPUnit_Framework_TestCase
 
     public function testDispatchWithCustomerCountryInEU()
     {
-        /** @var \Magento\Framework\Api\AttributeValueBuilder $attributeValueBuilder */
+        /** @var \Magento\Framework\Api\AttributeDataBuilder $attributeValueBuilder */
         $attributeValueBuilder = $this->objectManager
-            ->getObject('Magento\Framework\Api\AttributeValueBuilder');
+            ->getObject('Magento\Framework\Api\AttributeDataBuilder');
         $attributeValueBuilder->setAttributeCode('disable_auto_group_change')->setValue(false);
         /** Preconditions */
         $this->customerDataMock->expects($this->exactly(2))
@@ -402,6 +409,9 @@ class CollectTotalsTest extends \PHPUnit_Framework_TestCase
         $this->customerBuilderMock->expects($this->once())
             ->method('mergeDataObjectWithArray')
             ->with($this->customerDataMock, array('group_id' => 'customerGroupId'))
+            ->will($this->returnValue($this->customerBuilderMock));
+        $this->customerBuilderMock->expects($this->once())
+            ->method('create')
             ->will($this->returnValue($this->customerDataMock));
         $this->model->dispatch($this->observerMock);
     }
diff --git a/dev/tests/unit/testsuite/Magento/Sales/Model/QuoteTest.php b/dev/tests/unit/testsuite/Magento/Sales/Model/QuoteTest.php
index d1ce3fd60c7f815b85e6623bddc6337b675f210e..6687dd630de0b1a8c67fe4e027afd84019430c21 100644
--- a/dev/tests/unit/testsuite/Magento/Sales/Model/QuoteTest.php
+++ b/dev/tests/unit/testsuite/Magento/Sales/Model/QuoteTest.php
@@ -104,6 +104,16 @@ class QuoteTest extends \PHPUnit_Framework_TestCase
      */
     protected $quoteItemCollectionFactoryMock;
 
+    /**
+     * @var \Magento\Sales\Model\Quote\PaymentFactory
+     */
+    protected $paymentFactoryMock;
+
+    /**
+     * @var \Magento\Sales\Model\Resource\Quote\Payment\CollectionFactory
+     */
+    protected $quotePaymentCollectionFactoryMock;
+
     /**
      * @var \Magento\Framework\App\Config | \PHPUnit_Framework_MockObject_MockObject
      */
@@ -183,6 +193,20 @@ class QuoteTest extends \PHPUnit_Framework_TestCase
             '',
             false
         );
+        $this->quotePaymentCollectionFactoryMock = $this->getMock(
+            'Magento\Sales\Model\Resource\Quote\Payment\CollectionFactory',
+            ['create'],
+            [],
+            '',
+            false
+        );
+        $this->paymentFactoryMock = $this->getMock(
+            'Magento\Sales\Model\Quote\PaymentFactory',
+            ['create'],
+            [],
+            '',
+            false
+        );
         $this->scopeConfig = $this->getMockBuilder('Magento\Framework\App\Config')
             ->disableOriginalConstructor()
             ->getMock();
@@ -202,6 +226,8 @@ class QuoteTest extends \PHPUnit_Framework_TestCase
                     'customerGroupService' => $this->customerGroupServiceMock,
                     'objectFactory' => $this->objectFactoryMock,
                     'quoteItemCollectionFactory' => $this->quoteItemCollectionFactoryMock,
+                    'quotePaymentCollectionFactory' => $this->quotePaymentCollectionFactoryMock,
+                    'quotePaymentFactory' => $this->paymentFactoryMock,
                     'scopeConfig' => $this->scopeConfig
                 ]
             );
@@ -871,4 +897,83 @@ class QuoteTest extends \PHPUnit_Framework_TestCase
 
         $this->assertFalse($this->quote->validateMinimumAmount());
     }
+
+    public function testGetPaymentIsNotDeleted()
+    {
+        $this->quote->setId(1);
+        $payment = $this->getMock(
+            'Magento\Sales\Model\Quote\Payment',
+            ['setQuote', 'isDeleted', '__wakeup'],
+            [],
+            '',
+            false
+        );
+        $payment->expects($this->once())
+            ->method('setQuote');
+        $payment->expects($this->once())
+            ->method('isDeleted')
+            ->willReturn(false);
+        $quotePaymentCollectionMock = $this->getMock(
+            'Magento\Sales\Model\Resource\Quote\Payment\Collection',
+            ['setQuoteFilter', 'getFirstItem'],
+            [],
+            '',
+            false
+        );
+        $quotePaymentCollectionMock->expects($this->once())
+            ->method('setQuoteFilter')
+            ->with(1)
+            ->will($this->returnSelf());
+        $quotePaymentCollectionMock->expects($this->once())
+            ->method('getFirstItem')
+            ->willReturn($payment);
+        $this->quotePaymentCollectionFactoryMock->expects($this->once())
+            ->method('create')
+            ->willReturn($quotePaymentCollectionMock);
+
+        $this->assertInstanceOf('\Magento\Sales\Model\Quote\Payment', $this->quote->getPayment());
+    }
+
+    public function testGetPaymentIsDeleted()
+    {
+        $this->quote->setId(1);
+        $payment = $this->getMock(
+            'Magento\Sales\Model\Quote\Payment',
+            ['setQuote', 'isDeleted', 'getId', '__wakeup'],
+            [],
+            '',
+            false
+        );
+        $payment->expects($this->exactly(2))
+        ->method('setQuote');
+        $payment->expects($this->once())
+            ->method('isDeleted')
+            ->willReturn(true);
+        $payment->expects($this->once())
+            ->method('getId')
+            ->willReturn(1);
+        $quotePaymentCollectionMock = $this->getMock(
+            'Magento\Sales\Model\Resource\Quote\Payment\Collection',
+            ['setQuoteFilter', 'getFirstItem'],
+            [],
+            '',
+            false
+        );
+        $quotePaymentCollectionMock->expects($this->once())
+            ->method('setQuoteFilter')
+            ->with(1)
+            ->will($this->returnSelf());
+        $quotePaymentCollectionMock->expects($this->once())
+            ->method('getFirstItem')
+            ->willReturn($payment);
+        $this->quotePaymentCollectionFactoryMock->expects($this->once())
+            ->method('create')
+            ->willReturn($quotePaymentCollectionMock);
+
+        $this->paymentFactoryMock->expects($this->once())
+            ->method('create')
+            ->willReturn($payment);
+
+        $this->assertInstanceOf('\Magento\Sales\Model\Quote\Payment', $this->quote->getPayment());
+    }
 }
diff --git a/dev/tests/unit/testsuite/Magento/Sales/Model/Resource/Order/Creditmemo/GridTest.php b/dev/tests/unit/testsuite/Magento/Sales/Model/Resource/Order/Creditmemo/GridTest.php
index de530ce459e0cf67deccd43ca8f1a975c53804a7..d7f45cb70a120f00452cfef5c192cc256caae9d0 100644
--- a/dev/tests/unit/testsuite/Magento/Sales/Model/Resource/Order/Creditmemo/GridTest.php
+++ b/dev/tests/unit/testsuite/Magento/Sales/Model/Resource/Order/Creditmemo/GridTest.php
@@ -118,7 +118,7 @@ class GridTest extends \PHPUnit_Framework_TestCase
             ->will($this->returnValue($this->adapterMock));
         $this->appResourceMock->expects($this->any())
             ->method('getTableName')
-            ->will($this->returnValue('sales_flat_creditmemo_grid'));
+            ->will($this->returnValue('sales_creditmemo_grid'));
         $this->adapterMock->expects($this->once())
             ->method('select')
             ->will($this->returnValue($this->selectMock));
@@ -144,7 +144,7 @@ class GridTest extends \PHPUnit_Framework_TestCase
             ->will($this->returnValue($this->statementMock));
         $this->adapterMock->expects($this->once())
             ->method('insertFromSelect')
-            ->with($this->selectMock, 'sales_flat_creditmemo_grid', [], 1)
+            ->with($this->selectMock, 'sales_creditmemo_grid', [], 1)
             ->will($this->returnValue('sql-query'));
         $this->assertEquals($this->statementMock, $this->grid->refresh(1, 'fi.field'));
     }
@@ -159,10 +159,10 @@ class GridTest extends \PHPUnit_Framework_TestCase
             ->will($this->returnValue($this->adapterMock));
         $this->appResourceMock->expects($this->once())
             ->method('getTableName')
-            ->will($this->returnValue('sales_flat_creditmemo_grid'));
+            ->will($this->returnValue('sales_creditmemo_grid'));
         $this->adapterMock->expects($this->once())
             ->method('delete')
-            ->with('sales_flat_creditmemo_grid', ['fi.field = ?' => 1])
+            ->with('sales_creditmemo_grid', ['fi.field = ?' => 1])
             ->will($this->returnValue(1));
         $this->assertEquals(1, $this->grid->purge(1, 'fi.field'));
     }
diff --git a/dev/tests/unit/testsuite/Magento/Sales/Model/Resource/Order/GridTest.php b/dev/tests/unit/testsuite/Magento/Sales/Model/Resource/Order/GridTest.php
index cc1f2f4b5583e6e227fbd41d6885e5e17cf7dc41..58a808b550e0be30dceeda876f8bc8d20c3e9e9f 100644
--- a/dev/tests/unit/testsuite/Magento/Sales/Model/Resource/Order/GridTest.php
+++ b/dev/tests/unit/testsuite/Magento/Sales/Model/Resource/Order/GridTest.php
@@ -118,7 +118,7 @@ class GridTest extends \PHPUnit_Framework_TestCase
             ->will($this->returnValue($this->adapterMock));
         $this->appResourceMock->expects($this->any())
             ->method('getTableName')
-            ->will($this->returnValue('sales_flat_order_grid'));
+            ->will($this->returnValue('sales_order_grid'));
         $this->adapterMock->expects($this->once())
             ->method('select')
             ->will($this->returnValue($this->selectMock));
@@ -141,7 +141,7 @@ class GridTest extends \PHPUnit_Framework_TestCase
             ->will($this->returnValue($this->statementMock));
         $this->adapterMock->expects($this->once())
             ->method('insertFromSelect')
-            ->with($this->selectMock, 'sales_flat_order_grid', [], 1)
+            ->with($this->selectMock, 'sales_order_grid', [], 1)
             ->will($this->returnValue('sql-query'));
         $this->assertEquals($this->statementMock, $this->grid->refresh(1, 'fi.field'));
     }
@@ -156,10 +156,10 @@ class GridTest extends \PHPUnit_Framework_TestCase
             ->will($this->returnValue($this->adapterMock));
         $this->appResourceMock->expects($this->once())
             ->method('getTableName')
-            ->will($this->returnValue('sales_flat_order_grid'));
+            ->will($this->returnValue('sales_order_grid'));
         $this->adapterMock->expects($this->once())
             ->method('delete')
-            ->with('sales_flat_order_grid', ['fi.field = ?' => 1])
+            ->with('sales_order_grid', ['fi.field = ?' => 1])
             ->will($this->returnValue(1));
         $this->assertEquals(1, $this->grid->purge(1, 'fi.field'));
     }
diff --git a/dev/tests/unit/testsuite/Magento/Sales/Model/Resource/Order/Invoice/GridTest.php b/dev/tests/unit/testsuite/Magento/Sales/Model/Resource/Order/Invoice/GridTest.php
index f769982945d2de2e017e48448e6ca880c2b59c41..07bf8902b2f99d0a8d474ad837b6a35c5bb2b1e2 100644
--- a/dev/tests/unit/testsuite/Magento/Sales/Model/Resource/Order/Invoice/GridTest.php
+++ b/dev/tests/unit/testsuite/Magento/Sales/Model/Resource/Order/Invoice/GridTest.php
@@ -118,7 +118,7 @@ class GridTest extends \PHPUnit_Framework_TestCase
             ->will($this->returnValue($this->adapterMock));
         $this->appResourceMock->expects($this->any())
             ->method('getTableName')
-            ->will($this->returnValue('sales_flat_invoice_grid'));
+            ->will($this->returnValue('sales_invoice_grid'));
         $this->adapterMock->expects($this->once())
             ->method('select')
             ->will($this->returnValue($this->selectMock));
@@ -144,7 +144,7 @@ class GridTest extends \PHPUnit_Framework_TestCase
             ->will($this->returnValue($this->statementMock));
         $this->adapterMock->expects($this->once())
             ->method('insertFromSelect')
-            ->with($this->selectMock, 'sales_flat_invoice_grid', [], 1)
+            ->with($this->selectMock, 'sales_invoice_grid', [], 1)
             ->will($this->returnValue('sql-query'));
         $this->assertEquals($this->statementMock, $this->grid->refresh(1, 'fi.field'));
     }
@@ -159,10 +159,10 @@ class GridTest extends \PHPUnit_Framework_TestCase
             ->will($this->returnValue($this->adapterMock));
         $this->appResourceMock->expects($this->once())
             ->method('getTableName')
-            ->will($this->returnValue('sales_flat_invoice_grid'));
+            ->will($this->returnValue('sales_invoice_grid'));
         $this->adapterMock->expects($this->once())
             ->method('delete')
-            ->with('sales_flat_invoice_grid', ['fi.field = ?' => 1])
+            ->with('sales_invoice_grid', ['fi.field = ?' => 1])
             ->will($this->returnValue(1));
         $this->assertEquals(1, $this->grid->purge(1, 'fi.field'));
     }
diff --git a/dev/tests/unit/testsuite/Magento/Sales/Model/Resource/Order/Shipment/GridTest.php b/dev/tests/unit/testsuite/Magento/Sales/Model/Resource/Order/Shipment/GridTest.php
index bcc51895cf15728fc8449c3e8b4bdc1f15c0f28c..83ff86ee8f9030bc702ba54fd3dc60212d7505cf 100644
--- a/dev/tests/unit/testsuite/Magento/Sales/Model/Resource/Order/Shipment/GridTest.php
+++ b/dev/tests/unit/testsuite/Magento/Sales/Model/Resource/Order/Shipment/GridTest.php
@@ -118,7 +118,7 @@ class GridTest extends \PHPUnit_Framework_TestCase
             ->will($this->returnValue($this->adapterMock));
         $this->appResourceMock->expects($this->any())
             ->method('getTableName')
-            ->will($this->returnValue('sales_flat_shipment_grid'));
+            ->will($this->returnValue('sales_shipment_grid'));
         $this->adapterMock->expects($this->once())
             ->method('select')
             ->will($this->returnValue($this->selectMock));
@@ -144,7 +144,7 @@ class GridTest extends \PHPUnit_Framework_TestCase
             ->will($this->returnValue($this->statementMock));
         $this->adapterMock->expects($this->once())
             ->method('insertFromSelect')
-            ->with($this->selectMock, 'sales_flat_shipment_grid', [], 1)
+            ->with($this->selectMock, 'sales_shipment_grid', [], 1)
             ->will($this->returnValue('sql-query'));
         $this->assertEquals($this->statementMock, $this->grid->refresh(1, 'fi.field'));
     }
@@ -159,10 +159,10 @@ class GridTest extends \PHPUnit_Framework_TestCase
             ->will($this->returnValue($this->adapterMock));
         $this->appResourceMock->expects($this->once())
             ->method('getTableName')
-            ->will($this->returnValue('sales_flat_shipment_grid'));
+            ->will($this->returnValue('sales_shipment_grid'));
         $this->adapterMock->expects($this->once())
             ->method('delete')
-            ->with('sales_flat_shipment_grid', ['fi.field = ?' => 1])
+            ->with('sales_shipment_grid', ['fi.field = ?' => 1])
             ->will($this->returnValue(1));
         $this->assertEquals(1, $this->grid->purge(1, 'fi.field'));
     }
diff --git a/dev/tests/unit/testsuite/Magento/SalesRule/Model/Quote/Nominal/DiscountTest.php b/dev/tests/unit/testsuite/Magento/SalesRule/Model/Quote/Nominal/DiscountTest.php
index 9ce463b7600c4de0cdff901fa824c2833bacd69f..461567d1384fabe21af6cce6f9275a7ddd99bc8e 100644
--- a/dev/tests/unit/testsuite/Magento/SalesRule/Model/Quote/Nominal/DiscountTest.php
+++ b/dev/tests/unit/testsuite/Magento/SalesRule/Model/Quote/Nominal/DiscountTest.php
@@ -23,6 +23,8 @@
  */
 namespace Magento\SalesRule\Model\Quote\Nominal;
 
+use Magento\TestFramework\Helper\ObjectManager;
+
 /**
  * Class DiscountTest
  */
@@ -34,14 +36,64 @@ class DiscountTest extends \PHPUnit_Framework_TestCase
     protected $discount;
 
     /**
-     * @var \Magento\TestFramework\Helper\ObjectManager
+     * @var ObjectManager
      */
     protected $objectManager;
 
+    /**
+     * @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Store\Model\StoreManager
+     */
+    protected $storeManagerMock;
+
+    /**
+     * @var \PHPUnit_Framework_MockObject_MockObject | \Magento\SalesRule\Model\Validator
+     */
+    protected $validatorMock;
+
+    /**
+     * @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Framework\Event\Manager
+     */
+    protected $eventManagerMock;
+
     public function setUp()
     {
-        $this->objectManager = new \Magento\TestFramework\Helper\ObjectManager($this);
-        $this->discount = $this->objectManager->getObject('Magento\SalesRule\Model\Quote\Nominal\Discount', []);
+        $this->objectManager = new ObjectManager($this);
+
+        $this->storeManagerMock = $this->getMockBuilder('Magento\Store\Model\StoreManager')
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $this->validatorMock = $this->getMockBuilder('Magento\SalesRule\Model\Validator')
+            ->disableOriginalConstructor()
+            ->setMethods(
+                [
+                    'canApplyRules',
+                    'reset',
+                    'init',
+                    'initTotals',
+                    'sortItemsByPriority',
+                    'setSkipActionsValidation',
+                    'process',
+                    'processShippingAmount',
+                    'canApplyDiscount',
+                    '__wakeup'
+                ]
+            )
+            ->getMock();
+
+        $this->eventManagerMock = $this->getMockBuilder('Magento\Framework\Event\Manager')
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        /** @var \Magento\SalesRule\Model\Quote\Nominal\Discount $discount */
+        $this->discount = $this->objectManager->getObject(
+            'Magento\SalesRule\Model\Quote\Nominal\Discount',
+            [
+                'storeManager' => $this->storeManagerMock,
+                'validator'    => $this->validatorMock,
+                'eventManager' => $this->eventManagerMock
+            ]
+        );
     }
 
     public function testFetch()
@@ -52,33 +104,50 @@ class DiscountTest extends \PHPUnit_Framework_TestCase
         $this->assertInternalType('array', $this->discount->fetch($addressMock));
     }
 
-    public function testGetAddressItems()
+    public function testGetNominalAddressItems()
     {
+        $item = $this->getMockBuilder('Magento\Sales\Model\Quote\Item')
+            ->disableOriginalConstructor()
+            ->setMethods(['__wakeup'])
+            ->getMock();
+
+        $this->validatorMock->expects($this->once())
+            ->method('sortItemsByPriority')
+            ->willReturnArgument(0);
+
+        $storeMock = $this->getMockBuilder('Magento\Store\Model\Store')
+            ->disableOriginalConstructor()
+            ->setMethods(['getStore', '__wakeup'])
+            ->getMock();
+
+        $this->storeManagerMock->expects($this->once())
+            ->method('getStore')
+            ->willReturn($storeMock);
+
         $quoteMock = $this->getMockBuilder('Magento\Sales\Model\Quote')
             ->disableOriginalConstructor()
             ->getMock();
+
         $addressMock = $this->getMockBuilder('Magento\Sales\Model\Quote\Address')
             ->disableOriginalConstructor()
+            ->setMethods(['getQuote', 'getAllNominalItems', 'getShippingAmount', '__wakeup'])
             ->getMock();
+
         $addressMock->expects($this->any())
             ->method('getQuote')
             ->willReturn($quoteMock);
 
-        $storeManagerMock = $this->getMockBuilder('Magento\Store\Model\StoreManager')
-            ->disableOriginalConstructor()
-            ->getMock();
-        $validatorMock = $this->getMockBuilder('Magento\SalesRule\Model\Validator')
-            ->disableOriginalConstructor()
-            ->getMock();
-        /** @var \Magento\SalesRule\Model\Quote\Discount $discount */
-        $discount = $this->objectManager->getObject(
-            'Magento\SalesRule\Model\Quote\Discount',
-            ['storeManager' => $storeManagerMock, 'validator' => $validatorMock]
-        );
+        $addressMock->expects($this->once())
+            ->method('getAllNominalItems')
+            ->willReturn([$item]);
+
+        $addressMock->expects($this->once())
+            ->method('getShippingAmount')
+            ->willReturn(true);
 
         $this->assertInstanceOf(
-            'Magento\Sales\Model\Quote\Address\Total\AbstractTotal',
-            $discount->collect($addressMock)
+            'Magento\SalesRule\Model\Quote\Discount',
+            $this->discount->collect($addressMock)
         );
     }
 }
diff --git a/dev/tests/unit/testsuite/Magento/Tax/Service/V1/TaxClassServiceTest.php b/dev/tests/unit/testsuite/Magento/Tax/Service/V1/TaxClassServiceTest.php
index 86aae952ca9c246ef8b48d0213199bfea5f3d0ea..823f60046314e032e3490de7ecf53784cc68f6b9 100644
--- a/dev/tests/unit/testsuite/Magento/Tax/Service/V1/TaxClassServiceTest.php
+++ b/dev/tests/unit/testsuite/Magento/Tax/Service/V1/TaxClassServiceTest.php
@@ -550,6 +550,10 @@ class TaxClassServiceTest extends \PHPUnit_Framework_TestCase
         )->disableOriginalConstructor()
             ->getMock();
 
+        $filterBuilder = $this->objectManager->getObject(
+            'Magento\Framework\Api\FilterBuilder'
+        );
+
         $taxClassService = $this->objectManager->getObject(
             'Magento\Tax\Service\V1\TaxClassService',
             [
@@ -557,7 +561,8 @@ class TaxClassServiceTest extends \PHPUnit_Framework_TestCase
                 'taxClassCollectionFactory' => $this->taxClassCollectionFactory,
                 'classModelRegistry' => $this->classModelRegistryMock,
                 'searchResultsBuilder' => $this->searchResultBuilder,
-                'converter' => $this->converterMock
+                'converter' => $this->converterMock,
+                'filterBuilder' => $filterBuilder
             ]
         );
 
diff --git a/dev/tests/unit/testsuite/Magento/UrlRewrite/Controller/RouterTest.php b/dev/tests/unit/testsuite/Magento/UrlRewrite/Controller/RouterTest.php
index 137760381909180b5a41b25a31e92e015f5e1001..1a8757d6189a40deae577e22093157c9469e3379 100644
--- a/dev/tests/unit/testsuite/Magento/UrlRewrite/Controller/RouterTest.php
+++ b/dev/tests/unit/testsuite/Magento/UrlRewrite/Controller/RouterTest.php
@@ -84,7 +84,7 @@ class RouterTest extends \PHPUnit_Framework_TestCase
         $this->storeManager->expects($this->any())->method('getStore')->will($this->returnValue($this->store));
         $this->store->expects($this->any())->method('getId')->will($this->returnValue('current-store-id'));
 
-        $this->assertEquals(null, $this->router->match($this->request));
+        $this->assertNull($this->router->match($this->request));
     }
 
     public function testRewriteAfterStoreSwitcher()
@@ -107,28 +107,24 @@ class RouterTest extends \PHPUnit_Framework_TestCase
         $urlRewrite->expects($this->any())->method('getRequestPath')->will($this->returnValue('new-request-path'));
 
         $this->urlFinder->expects($this->any())->method('findOneByData')->will(
-            $this->returnValueMap(
+            $this->returnValueMap([
+                [
+                    [UrlRewrite::REQUEST_PATH => 'request-path', UrlRewrite::STORE_ID => 'old-store-id'],
+                    $oldUrlRewrite
+                ],
                 [
                     [
-                        [UrlRewrite::REQUEST_PATH => 'request-path', UrlRewrite::STORE_ID => 'old-store-id'],
-                        $oldUrlRewrite
+                        UrlRewrite::ENTITY_TYPE => 'entity-type',
+                        UrlRewrite::ENTITY_ID => 'entity-id',
+                        UrlRewrite::STORE_ID => 'current-store-id',
+                        UrlRewrite::IS_AUTOGENERATED => 1,
                     ],
-                    [
-                        [
-                            UrlRewrite::ENTITY_TYPE => 'entity-type',
-                            UrlRewrite::ENTITY_ID => 'entity-id',
-                            UrlRewrite::STORE_ID => 'current-store-id',
-                            UrlRewrite::IS_AUTOGENERATED => 1,
-                        ],
-                        $urlRewrite
-                    ]
+                    $urlRewrite
                 ]
-            )
+            ])
         );
         $this->response->expects($this->once())->method('setRedirect')
-            ->with('request-path-302', OptionProvider::TEMPORARY);
-        $this->url->expects($this->once())->method('getUrl')->with('', array('_direct' => 'new-request-path'))
-            ->will($this->returnValue('request-path-302'));
+            ->with('new-request-path', OptionProvider::TEMPORARY);
         $this->request->expects($this->once())->method('setDispatched')->with(true);
         $this->actionFactory->expects($this->once())->method('create')
             ->with('Magento\Framework\App\Action\Redirect', ['request' => $this->request]);
@@ -136,7 +132,7 @@ class RouterTest extends \PHPUnit_Framework_TestCase
         $this->router->match($this->request);
     }
 
-    public function testNoRewriteAfterStoreSwitcher()
+    public function testNoRewriteAfterStoreSwitcherWhenNoOldRewrite()
     {
         $this->request->expects($this->any())->method('getPathInfo')->will($this->returnValue('request-path'));
         $this->request->expects($this->any())->method('getParam')->with('___from_store')
@@ -155,7 +151,47 @@ class RouterTest extends \PHPUnit_Framework_TestCase
             ->disableOriginalConstructor()->getMock();
         $urlRewrite->expects($this->any())->method('getRequestPath')->will($this->returnValue('request-path'));
 
-        $this->assertEquals(null, $this->router->match($this->request));
+        $this->assertNull($this->router->match($this->request));
+    }
+
+    public function testNoRewriteAfterStoreSwitcherWhenOldRewriteEqualsToNewOne()
+    {
+        $this->request->expects($this->any())->method('getPathInfo')->will($this->returnValue('request-path'));
+        $this->request->expects($this->any())->method('getParam')->with('___from_store')
+            ->will($this->returnValue('old-store'));
+        $oldStore = $this->getMockBuilder('Magento\Store\Model\Store')->disableOriginalConstructor()->getMock();
+        $this->storeManager->expects($this->any())->method('getStore')
+            ->will($this->returnValueMap([['old-store', $oldStore], [null, $this->store]]));
+        $oldStore->expects($this->any())->method('getId')->will($this->returnValue('old-store-id'));
+        $this->store->expects($this->any())->method('getId')->will($this->returnValue('current-store-id'));
+        $oldUrlRewrite = $this->getMockBuilder('Magento\UrlRewrite\Service\V1\Data\UrlRewrite')
+            ->disableOriginalConstructor()->getMock();
+        $oldUrlRewrite->expects($this->any())->method('getEntityType')->will($this->returnValue('entity-type'));
+        $oldUrlRewrite->expects($this->any())->method('getEntityId')->will($this->returnValue('entity-id'));
+        $oldUrlRewrite->expects($this->any())->method('getRequestPath')->will($this->returnValue('old-request-path'));
+        $urlRewrite = $this->getMockBuilder('Magento\UrlRewrite\Service\V1\Data\UrlRewrite')
+            ->disableOriginalConstructor()->getMock();
+        $urlRewrite->expects($this->any())->method('getRequestPath')->will($this->returnValue('old-request-path'));
+
+        $this->urlFinder->expects($this->any())->method('findOneByData')->will(
+            $this->returnValueMap([
+                [
+                    [UrlRewrite::REQUEST_PATH => 'request-path', UrlRewrite::STORE_ID => 'old-store-id'],
+                    $oldUrlRewrite
+                ],
+                [
+                    [
+                        UrlRewrite::ENTITY_TYPE => 'entity-type',
+                        UrlRewrite::ENTITY_ID => 'entity-id',
+                        UrlRewrite::STORE_ID => 'current-store-id',
+                        UrlRewrite::IS_AUTOGENERATED => 1,
+                    ],
+                    $urlRewrite
+                ]
+            ])
+        );
+
+        $this->assertNull($this->router->match($this->request));
     }
 
     public function testMatchWithRedirect()
@@ -177,6 +213,57 @@ class RouterTest extends \PHPUnit_Framework_TestCase
         $this->router->match($this->request);
     }
 
+    public function testMatchWithCustomInternalRedirect()
+    {
+        $this->storeManager->expects($this->any())->method('getStore')->will($this->returnValue($this->store));
+        $urlRewrite = $this->getMockBuilder('Magento\UrlRewrite\Service\V1\Data\UrlRewrite')
+            ->disableOriginalConstructor()->getMock();
+        $urlRewrite->expects($this->any())->method('getEntityType')->will($this->returnValue('custom'));
+        $urlRewrite->expects($this->any())->method('getRedirectType')->will($this->returnValue('redirect-code'));
+        $urlRewrite->expects($this->any())->method('getTargetPath')->will($this->returnValue('target-path'));
+        $this->urlFinder->expects($this->any())->method('findOneByData')->will($this->returnValue($urlRewrite));
+        $this->response->expects($this->once())->method('setRedirect')->with('a', 'redirect-code');
+        $this->url->expects($this->once())->method('getUrl')->with('', ['_direct' => 'target-path'])->willReturn('a');
+        $this->request->expects($this->once())->method('setDispatched')->with(true);
+        $this->actionFactory->expects($this->once())->method('create')
+            ->with('Magento\Framework\App\Action\Redirect', ['request' => $this->request]);
+
+        $this->router->match($this->request);
+    }
+
+    /**
+     * @param string $targetPath
+     * @dataProvider externalRedirectTargetPathDataProvider
+     */
+    public function testMatchWithCustomExternalRedirect($targetPath)
+    {
+        $this->storeManager->expects($this->any())->method('getStore')->will($this->returnValue($this->store));
+        $urlRewrite = $this->getMockBuilder('Magento\UrlRewrite\Service\V1\Data\UrlRewrite')
+            ->disableOriginalConstructor()->getMock();
+        $urlRewrite->expects($this->any())->method('getEntityType')->will($this->returnValue('custom'));
+        $urlRewrite->expects($this->any())->method('getRedirectType')->will($this->returnValue('redirect-code'));
+        $urlRewrite->expects($this->any())->method('getTargetPath')->will($this->returnValue($targetPath));
+        $this->urlFinder->expects($this->any())->method('findOneByData')->will($this->returnValue($urlRewrite));
+        $this->response->expects($this->once())->method('setRedirect')->with($targetPath, 'redirect-code');
+        $this->url->expects($this->never())->method('getUrl');
+        $this->request->expects($this->once())->method('setDispatched')->with(true);
+        $this->actionFactory->expects($this->once())->method('create')
+            ->with('Magento\Framework\App\Action\Redirect', ['request' => $this->request]);
+
+        $this->router->match($this->request);
+    }
+
+    /**
+     * @return array
+     */
+    public function externalRedirectTargetPathDataProvider()
+    {
+        return [
+            ['http://example.com'],
+            ['https://example.com'],
+        ];
+    }
+
     public function testMatch()
     {
         $this->storeManager->expects($this->any())->method('getStore')->will($this->returnValue($this->store));
diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Service/Entity/WebapiBuilderFactory.php b/dev/tests/unit/testsuite/Magento/Webapi/Service/Entity/WebapiBuilderFactory.php
index dead3735e8ac034441a712bba81200466aaee032..901e832d4efd0b3ac74211697f3c2519558d8ce4 100644
--- a/dev/tests/unit/testsuite/Magento/Webapi/Service/Entity/WebapiBuilderFactory.php
+++ b/dev/tests/unit/testsuite/Magento/Webapi/Service/Entity/WebapiBuilderFactory.php
@@ -37,7 +37,7 @@ class WebapiBuilderFactory extends \Magento\Framework\Serialization\DataBuilderF
      * Returns a builder for a given class name.
      *
      * @param string $className
-     * @return \Magento\Framework\Api\ExtensibleDataBuilderInterface Builder Instance
+     * @return \Magento\Framework\Api\BuilderInterface Builder Instance
      */
     public function getDataBuilder($className)
     {
diff --git a/dev/tools/Magento/Tools/Di/compiler.php b/dev/tools/Magento/Tools/Di/compiler.php
index 91aac919d29cf75a1f4aaa136f33f667a98338ad..ebb368ecd9ff4d94900d462fec70ab607a4047a1 100644
--- a/dev/tools/Magento/Tools/Di/compiler.php
+++ b/dev/tools/Magento/Tools/Di/compiler.php
@@ -34,7 +34,6 @@ use Magento\Tools\Di\Compiler\Directory;
 use Magento\Tools\Di\Code\Scanner;
 use Magento\Tools\Di\Definition\Compressor;
 use Magento\Tools\Di\Definition\Serializer;
-use Magento\Framework\Api\Code\Generator\Builder;
 use Magento\Framework\Api\Code\Generator\Mapper;
 use Magento\Framework\Api\Code\Generator\SearchResults;
 use Magento\Framework\Api\Code\Generator\SearchResultsBuilder;
@@ -108,9 +107,9 @@ try {
             \Magento\Framework\Interception\Code\Generator\Interceptor::ENTITY_TYPE =>
                 'Magento\Framework\Interception\Code\Generator\Interceptor',
             SearchResultsBuilder::ENTITY_TYPE => 'Magento\Framework\Api\Code\Generator\SearchResultsBuilder',
+            DataBuilder::ENTITY_TYPE_BUILDER  => 'Magento\Framework\Api\Code\Generator\DataBuilder',
             Proxy::ENTITY_TYPE => 'Magento\Framework\ObjectManager\Code\Generator\Proxy',
             Factory::ENTITY_TYPE => 'Magento\Framework\ObjectManager\Code\Generator\Factory',
-            Builder::ENTITY_TYPE => 'Magento\Framework\Api\Code\Generator\Builder',
             Mapper::ENTITY_TYPE => 'Magento\Framework\Api\Code\Generator\Mapper',
             Repository::ENTITY_TYPE => 'Magento\Framework\ObjectManager\Code\Generator\Repository',
             Converter::ENTITY_TYPE => 'Magento\Framework\ObjectManager\Code\Generator\Converter',
diff --git a/dev/tools/Magento/Tools/Di/entity_generator.php b/dev/tools/Magento/Tools/Di/entity_generator.php
index 58e72db1b02e5e61a39450bbf758252f5dbe5ca3..c917c8f1de5524ca635d4100f7d93ace8a39eb8b 100644
--- a/dev/tools/Magento/Tools/Di/entity_generator.php
+++ b/dev/tools/Magento/Tools/Di/entity_generator.php
@@ -29,7 +29,6 @@ use Magento\Framework\ObjectManager\Code\Generator\Factory;
 use Magento\Framework\ObjectManager\Code\Generator\Proxy;
 use Magento\Framework\Interception\Code\Generator\Interceptor;
 use Magento\Framework\Exception;
-use Magento\Framework\Api\Code\Generator\Builder;
 use Magento\Framework\Api\Code\Generator\DataBuilder;
 use Magento\Framework\Api\Code\Generator\Mapper;
 use Magento\Framework\ObjectManager\Code\Generator\Repository;
@@ -97,14 +96,13 @@ $generator = new Generator(
         DataBuilder::ENTITY_TYPE => 'Magento\Framework\Api\Code\Generator\DataBuilder',
         SearchResultsBuilder::ENTITY_TYPE =>
             'Magento\Framework\Api\Code\Generator\SearchResultsBuilder',
+        DataBuilder::ENTITY_TYPE_BUILDER  => 'Magento\Framework\Api\Code\Generator\DataBuilder',
         Proxy::ENTITY_TYPE =>
             'Magento\Framework\ObjectManager\Code\Generator\Proxy',
         Factory::ENTITY_TYPE =>
             'Magento\Framework\ObjectManager\Code\Generator\Factory',
         Interceptor::ENTITY_TYPE =>
             'Magento\Framework\Interception\Code\Generator\Interceptor',
-        Builder::ENTITY_TYPE =>
-            'Magento\Framework\Api\Code\Generator\Builder',
         Mapper::ENTITY_TYPE =>
             'Magento\Framework\Api\Code\Generator\Mapper',
         Repository::ENTITY_TYPE =>
diff --git a/dev/tools/Magento/Tools/Migration/factory_table_names/blacklist_ce.php b/dev/tools/Magento/Tools/Migration/factory_table_names/blacklist_ce.php
index da13cd6e98c8b97a4d70e4fb47aa321429774f53..8e67cfa4f18a3e4c424adae338f6cd80c8cdac81 100644
--- a/dev/tools/Magento/Tools/Migration/factory_table_names/blacklist_ce.php
+++ b/dev/tools/Magento/Tools/Migration/factory_table_names/blacklist_ce.php
@@ -37,7 +37,7 @@ return array(
     'cat_pro',
     'table_name',
     'rule_customer',
-    'sales_flat_',
+    'sales_',
     'catalog_product_link_attribute_',
     'catalog_category_flat_',
     'catalog_category_entity_',
diff --git a/dev/tools/Magento/Tools/Migration/factory_table_names/replace_ce.php b/dev/tools/Magento/Tools/Migration/factory_table_names/replace_ce.php
index adddc9928605e6328f1be382d5da669b2deee0b6..6148df634c4063f863a8fe1b7b17d1c970fbebdc 100644
--- a/dev/tools/Magento/Tools/Migration/factory_table_names/replace_ce.php
+++ b/dev/tools/Magento/Tools/Migration/factory_table_names/replace_ce.php
@@ -298,47 +298,47 @@ return array(
     'sales/bestsellers_aggregated_yearly' => 'sales_bestsellers_aggregated_yearly',
     'sales/billing_agreement' => 'paypal_billing_agreement',
     'sales/billing_agreement_order' => 'paypal_billing_agreement_order',
-    'sales/creditmemo' => 'sales_flat_creditmemo',
-    'sales/creditmemo_comment' => 'sales_flat_creditmemo_comment',
-    'sales/creditmemo_grid' => 'sales_flat_creditmemo_grid',
-    'sales/creditmemo_item' => 'sales_flat_creditmemo_item',
-    'sales/invoice' => 'sales_flat_invoice',
-    'sales/invoice_comment' => 'sales_flat_invoice_comment',
-    'sales/invoice_grid' => 'sales_flat_invoice_grid',
-    'sales/invoice_item' => 'sales_flat_invoice_item',
+    'sales/creditmemo' => 'sales_creditmemo',
+    'sales/creditmemo_comment' => 'sales_creditmemo_comment',
+    'sales/creditmemo_grid' => 'sales_creditmemo_grid',
+    'sales/creditmemo_item' => 'sales_creditmemo_item',
+    'sales/invoice' => 'sales_invoice',
+    'sales/invoice_comment' => 'sales_invoice_comment',
+    'sales/invoice_grid' => 'sales_invoice_grid',
+    'sales/invoice_item' => 'sales_invoice_item',
     'sales/invoiced_aggregated' => 'sales_invoiced_aggregated',
     'sales/invoiced_aggregated_order' => 'sales_invoiced_aggregated_order',
-    'sales/order' => 'sales_flat_order',
-    'sales/order_address' => 'sales_flat_order_address',
+    'sales/order' => 'sales_order',
+    'sales/order_address' => 'sales_order_address',
     'sales/order_aggregated_created' => 'sales_order_aggregated_created',
     'sales/order_aggregated_updated' => 'sales_order_aggregated_updated',
     'sales/order_entity' => 'sales_order_entity',
-    'sales/order_grid' => 'sales_flat_order_grid',
-    'sales/order_item' => 'sales_flat_order_item',
-    'sales/order_item_option' => 'sales_flat_order_item_option',
-    'sales/order_payment' => 'sales_flat_order_payment',
+    'sales/order_grid' => 'sales_order_grid',
+    'sales/order_item' => 'sales_order_item',
+    'sales/order_item_option' => 'sales_order_item_option',
+    'sales/order_payment' => 'sales_order_payment',
     'sales/order_status' => 'sales_order_status',
-    'sales/order_status_history' => 'sales_flat_order_status_history',
+    'sales/order_status_history' => 'sales_order_status_history',
     'sales/order_status_label' => 'sales_order_status_label',
     'sales/order_status_state' => 'sales_order_status_state',
     'sales/order_tax' => 'sales_order_tax',
     'sales/payment_transaction' => 'sales_payment_transaction',
-    'sales/quote' => 'sales_flat_quote',
-    'sales/quote_address' => 'sales_flat_quote_address',
-    'sales/quote_address_item' => 'sales_flat_quote_address_item',
-    'sales/quote_address_shipping_rate' => 'sales_flat_quote_shipping_rate',
-    'sales/quote_item' => 'sales_flat_quote_item',
-    'sales/quote_item_option' => 'sales_flat_quote_item_option',
-    'sales/quote_payment' => 'sales_flat_quote_payment',
+    'sales/quote' => 'sales_quote',
+    'sales/quote_address' => 'sales_quote_address',
+    'sales/quote_address_item' => 'sales_quote_address_item',
+    'sales/quote_address_shipping_rate' => 'sales_quote_shipping_rate',
+    'sales/quote_item' => 'sales_quote_item',
+    'sales/quote_item_option' => 'sales_quote_item_option',
+    'sales/quote_payment' => 'sales_quote_payment',
     'sales/recurring_payment' => 'recurring_payment',
     'sales/recurring_payment_order' => 'recurring_payment_order',
     'sales/refunded_aggregated' => 'sales_refunded_aggregated',
     'sales/refunded_aggregated_order' => 'sales_refunded_aggregated_order',
-    'sales/shipment' => 'sales_flat_shipment',
-    'sales/shipment_comment' => 'sales_flat_shipment_comment',
-    'sales/shipment_grid' => 'sales_flat_shipment_grid',
-    'sales/shipment_item' => 'sales_flat_shipment_item',
-    'sales/shipment_track' => 'sales_flat_shipment_track',
+    'sales/shipment' => 'sales_shipment',
+    'sales/shipment_comment' => 'sales_shipment_comment',
+    'sales/shipment_grid' => 'sales_shipment_grid',
+    'sales/shipment_item' => 'sales_shipment_item',
+    'sales/shipment_track' => 'sales_shipment_track',
     'sales/shipping_aggregated' => 'sales_shipping_aggregated',
     'sales/shipping_aggregated_order' => 'sales_shipping_aggregated_order',
     'sales_entity/order' => 'sales_order',
diff --git a/dev/tools/Magento/Tools/View/Deployer.php b/dev/tools/Magento/Tools/View/Deployer.php
index 2db6fbe07189709dada117476a7eddefee12f01e..1ef9dad1c2a101234fcaa3b5cd9f646f345297da 100644
--- a/dev/tools/Magento/Tools/View/Deployer.php
+++ b/dev/tools/Magento/Tools/View/Deployer.php
@@ -47,8 +47,8 @@ class Deployer
     /** @var Version\StorageInterface */
     private $versionStorage;
 
-    /** @var Version\GeneratorInterface */
-    private $versionGenerator;
+    /** @var \Magento\Framework\Stdlib\DateTime */
+    private $dateTime;
 
     /** @var \Magento\Framework\View\Asset\Repository */
     private $assetRepo;
@@ -68,21 +68,21 @@ class Deployer
     /**
      * @param Files $filesUtil
      * @param Deployer\Log $logger
+     * @param Version\StorageInterface $versionStorage
+     * @param \Magento\Framework\Stdlib\DateTime $dateTime
      * @param bool $isDryRun
-     * @param \Magento\Framework\App\View\Deployment\Version\StorageInterface $versionStorage
-     * @param \Magento\Framework\App\View\Deployment\Version\GeneratorInterface $versionGenerator
      */
     public function __construct(
         Files $filesUtil,
         Deployer\Log $logger,
         Version\StorageInterface $versionStorage,
-        Version\GeneratorInterface $versionGenerator,
+        \Magento\Framework\Stdlib\DateTime $dateTime,
         $isDryRun = false
     ) {
         $this->filesUtil = $filesUtil;
         $this->logger = $logger;
         $this->versionStorage = $versionStorage;
-        $this->versionGenerator = $versionGenerator;
+        $this->dateTime = $dateTime;
         $this->isDryRun = $isDryRun;
     }
 
@@ -121,7 +121,7 @@ class Deployer
                 }
             }
         }
-        $version = $this->versionGenerator->generate();
+        $version = $this->dateTime->toTimestamp(true);
         $this->logger->logMessage("New version of deployed files: {$version}");
         if (!$this->isDryRun) {
             $this->versionStorage->save($version);
diff --git a/dev/tools/performance-toolkit/benchmark.jmx b/dev/tools/performance-toolkit/benchmark.jmx
index 5a31d4e0c4863d72143cabae91482062220986b3..b6686c0670af63b0a63a00c344d45c6275429cd9 100644
--- a/dev/tools/performance-toolkit/benchmark.jmx
+++ b/dev/tools/performance-toolkit/benchmark.jmx
@@ -116,6 +116,36 @@
             <stringProp name="Argument.value">1</stringProp>
             <stringProp name="Argument.metadata">=</stringProp>
           </elementProp>
+          <elementProp name="jmeter_agent_port" elementType="Argument">
+            <stringProp name="Argument.name">jmeter_agent_port</stringProp>
+            <stringProp name="Argument.value">${__P(jmeter_agent_port,3450)}</stringProp>
+            <stringProp name="Argument.metadata">=</stringProp>
+          </elementProp>
+          <elementProp name="db_server_ip" elementType="Argument">
+            <stringProp name="Argument.name">db_server_ip</stringProp>
+            <stringProp name="Argument.value">${__P(db_server_ip,10.62.51.150)}</stringProp>
+            <stringProp name="Argument.metadata">=</stringProp>
+          </elementProp>
+          <elementProp name="web_server_1_ip" elementType="Argument">
+            <stringProp name="Argument.name">web_server_1_ip</stringProp>
+            <stringProp name="Argument.value">${__P(web_server_1_ip,10.62.51.185)}</stringProp>
+            <stringProp name="Argument.metadata">=</stringProp>
+          </elementProp>
+          <elementProp name="web_server_2_ip" elementType="Argument">
+            <stringProp name="Argument.name">web_server_2_ip</stringProp>
+            <stringProp name="Argument.value">${__P(web_server_2_ip,10.62.51.186)}</stringProp>
+            <stringProp name="Argument.metadata">=</stringProp>
+          </elementProp>
+          <elementProp name="performance_metrics_collector_file_name" elementType="Argument">
+            <stringProp name="Argument.name">performance_metrics_collector_file_name</stringProp>
+            <stringProp name="Argument.value">${__P(performance_metrics_collector_file_name,performance_metrics_collector_file)}</stringProp>
+            <stringProp name="Argument.metadata">=</stringProp>
+          </elementProp>
+          <elementProp name="response_time_file_name" elementType="Argument">
+            <stringProp name="Argument.name">response_time_file_name</stringProp>
+            <stringProp name="Argument.value">${__P(response_time_file_name,response_time_file_name)}</stringProp>
+            <stringProp name="Argument.metadata">=</stringProp>
+          </elementProp>
         </collectionProp>
       </elementProp>
       <stringProp name="TestPlan.user_define_classpath"></stringProp>
@@ -2275,12 +2305,26 @@ vars.put(&quot;category_name&quot;, props.get(&quot;category_name&quot;));</stri
           <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true">
             <collectionProp name="Arguments.arguments">
               <elementProp name="method" elementType="HTTPArgument">
-                <boolProp name="HTTPArgument.always_encode">false</boolProp>
+                <boolProp name="HTTPArgument.always_encode">true</boolProp>
                 <stringProp name="Argument.name">method</stringProp>
                 <stringProp name="Argument.value">guest</stringProp>
                 <stringProp name="Argument.metadata">=</stringProp>
                 <boolProp name="HTTPArgument.use_equals">true</boolProp>
               </elementProp>
+              <elementProp name="isAjax" elementType="HTTPArgument">
+                <boolProp name="HTTPArgument.always_encode">true</boolProp>
+                <stringProp name="Argument.value">1</stringProp>
+                <stringProp name="Argument.metadata">=</stringProp>
+                <boolProp name="HTTPArgument.use_equals">true</boolProp>
+                <stringProp name="Argument.name">isAjax</stringProp>
+              </elementProp>
+              <elementProp name="ajax" elementType="HTTPArgument">
+                <boolProp name="HTTPArgument.always_encode">true</boolProp>
+                <stringProp name="Argument.value">1</stringProp>
+                <stringProp name="Argument.metadata">=</stringProp>
+                <boolProp name="HTTPArgument.use_equals">true</boolProp>
+                <stringProp name="Argument.name">ajax</stringProp>
+              </elementProp>
             </collectionProp>
           </elementProp>
           <stringProp name="HTTPSampler.domain"></stringProp>
@@ -2300,6 +2344,15 @@ vars.put(&quot;category_name&quot;, props.get(&quot;category_name&quot;));</stri
           <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
         </HTTPSamplerProxy>
         <hashTree>
+          <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true">
+            <collectionProp name="HeaderManager.headers">
+              <elementProp name="" elementType="Header">
+                <stringProp name="Header.name">Referer</stringProp>
+                <stringProp name="Header.value">http://mage2.com/checkout/onepage/</stringProp>
+              </elementProp>
+            </collectionProp>
+          </HeaderManager>
+          <hashTree/>
           <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert success" enabled="true">
             <collectionProp name="Asserion.test_strings">
               <stringProp name="2914">[]</stringProp>
@@ -2310,35 +2363,6 @@ vars.put(&quot;category_name&quot;, props.get(&quot;category_name&quot;));</stri
           </ResponseAssertion>
           <hashTree/>
         </hashTree>
-        <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Checkout progress to billing(GuestChkt)" enabled="true">
-          <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true">
-            <collectionProp name="Arguments.arguments">
-              <elementProp name="toStep" elementType="HTTPArgument">
-                <boolProp name="HTTPArgument.always_encode">false</boolProp>
-                <stringProp name="Argument.value">billing</stringProp>
-                <stringProp name="Argument.metadata">=</stringProp>
-                <boolProp name="HTTPArgument.use_equals">true</boolProp>
-                <stringProp name="Argument.name">toStep</stringProp>
-              </elementProp>
-            </collectionProp>
-          </elementProp>
-          <stringProp name="HTTPSampler.domain"></stringProp>
-          <stringProp name="HTTPSampler.port"></stringProp>
-          <stringProp name="HTTPSampler.connect_timeout"></stringProp>
-          <stringProp name="HTTPSampler.response_timeout"></stringProp>
-          <stringProp name="HTTPSampler.protocol">http</stringProp>
-          <stringProp name="HTTPSampler.contentEncoding"></stringProp>
-          <stringProp name="HTTPSampler.path">${base_path}checkout/onepage/progress/</stringProp>
-          <stringProp name="HTTPSampler.method">GET</stringProp>
-          <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
-          <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
-          <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
-          <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
-          <stringProp name="HTTPSampler.implementation">Java</stringProp>
-          <boolProp name="HTTPSampler.monitor">false</boolProp>
-          <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
-        </HTTPSamplerProxy>
-        <hashTree/>
         <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Checkout billing addresses(GuestChkt)" enabled="true">
           <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true">
             <collectionProp name="Arguments.arguments">
@@ -2349,23 +2373,37 @@ vars.put(&quot;category_name&quot;, props.get(&quot;category_name&quot;));</stri
                 <stringProp name="Argument.metadata">=</stringProp>
                 <boolProp name="HTTPArgument.use_equals">true</boolProp>
               </elementProp>
-              <elementProp name="billing[firstname]" elementType="HTTPArgument">
+              <elementProp name="billing[city]" elementType="HTTPArgument">
                 <boolProp name="HTTPArgument.always_encode">true</boolProp>
-                <stringProp name="Argument.name">billing[firstname]</stringProp>
-                <stringProp name="Argument.value">Name</stringProp>
+                <stringProp name="Argument.name">billing[city]</stringProp>
+                <stringProp name="Argument.value">Culver City</stringProp>
                 <stringProp name="Argument.metadata">=</stringProp>
                 <boolProp name="HTTPArgument.use_equals">true</boolProp>
               </elementProp>
-              <elementProp name="billing[lastname]" elementType="HTTPArgument">
+              <elementProp name="billing[company]" elementType="HTTPArgument">
                 <boolProp name="HTTPArgument.always_encode">true</boolProp>
-                <stringProp name="Argument.name">billing[lastname]</stringProp>
-                <stringProp name="Argument.value">Lastname</stringProp>
+                <stringProp name="Argument.name">billing[company]</stringProp>
+                <stringProp name="Argument.value"></stringProp>
                 <stringProp name="Argument.metadata">=</stringProp>
                 <boolProp name="HTTPArgument.use_equals">true</boolProp>
               </elementProp>
-              <elementProp name="billing[company]" elementType="HTTPArgument">
+              <elementProp name="billing[confirm_password]" elementType="HTTPArgument">
                 <boolProp name="HTTPArgument.always_encode">true</boolProp>
-                <stringProp name="Argument.name">billing[company]</stringProp>
+                <stringProp name="Argument.name">billing[confirm_password]</stringProp>
+                <stringProp name="Argument.value"></stringProp>
+                <stringProp name="Argument.metadata">=</stringProp>
+                <boolProp name="HTTPArgument.use_equals">true</boolProp>
+              </elementProp>
+              <elementProp name="billing[country_id]" elementType="HTTPArgument">
+                <boolProp name="HTTPArgument.always_encode">true</boolProp>
+                <stringProp name="Argument.name">billing[country_id]</stringProp>
+                <stringProp name="Argument.value">US</stringProp>
+                <stringProp name="Argument.metadata">=</stringProp>
+                <boolProp name="HTTPArgument.use_equals">true</boolProp>
+              </elementProp>
+              <elementProp name="billing[customer_password]" elementType="HTTPArgument">
+                <boolProp name="HTTPArgument.always_encode">true</boolProp>
+                <stringProp name="Argument.name">billing[customer_password]</stringProp>
                 <stringProp name="Argument.value"></stringProp>
                 <stringProp name="Argument.metadata">=</stringProp>
                 <boolProp name="HTTPArgument.use_equals">true</boolProp>
@@ -2377,31 +2415,31 @@ vars.put(&quot;category_name&quot;, props.get(&quot;category_name&quot;));</stri
                 <stringProp name="Argument.metadata">=</stringProp>
                 <boolProp name="HTTPArgument.use_equals">true</boolProp>
               </elementProp>
-              <elementProp name="billing[street][]" elementType="HTTPArgument">
+              <elementProp name="billing[fax]" elementType="HTTPArgument">
                 <boolProp name="HTTPArgument.always_encode">true</boolProp>
-                <stringProp name="Argument.name">billing[street][]</stringProp>
-                <stringProp name="Argument.value">10441 Jefferson Blvd, ste 200</stringProp>
+                <stringProp name="Argument.name">billing[fax]</stringProp>
+                <stringProp name="Argument.value"></stringProp>
                 <stringProp name="Argument.metadata">=</stringProp>
                 <boolProp name="HTTPArgument.use_equals">true</boolProp>
               </elementProp>
-              <elementProp name="billing[street][]" elementType="HTTPArgument">
+              <elementProp name="billing[firstname]" elementType="HTTPArgument">
                 <boolProp name="HTTPArgument.always_encode">true</boolProp>
-                <stringProp name="Argument.name">billing[street][]</stringProp>
-                <stringProp name="Argument.value"></stringProp>
+                <stringProp name="Argument.name">billing[firstname]</stringProp>
+                <stringProp name="Argument.value">Name</stringProp>
                 <stringProp name="Argument.metadata">=</stringProp>
                 <boolProp name="HTTPArgument.use_equals">true</boolProp>
               </elementProp>
-              <elementProp name="billing[city]" elementType="HTTPArgument">
+              <elementProp name="billing[lastname]" elementType="HTTPArgument">
                 <boolProp name="HTTPArgument.always_encode">true</boolProp>
-                <stringProp name="Argument.name">billing[city]</stringProp>
-                <stringProp name="Argument.value">Culver City</stringProp>
+                <stringProp name="Argument.name">billing[lastname]</stringProp>
+                <stringProp name="Argument.value">Lastname</stringProp>
                 <stringProp name="Argument.metadata">=</stringProp>
                 <boolProp name="HTTPArgument.use_equals">true</boolProp>
               </elementProp>
-              <elementProp name="billing[region_id]" elementType="HTTPArgument">
+              <elementProp name="billing[postcode]" elementType="HTTPArgument">
                 <boolProp name="HTTPArgument.always_encode">true</boolProp>
-                <stringProp name="Argument.name">billing[region_id]</stringProp>
-                <stringProp name="Argument.value">12</stringProp>
+                <stringProp name="Argument.name">billing[postcode]</stringProp>
+                <stringProp name="Argument.value">90232</stringProp>
                 <stringProp name="Argument.metadata">=</stringProp>
                 <boolProp name="HTTPArgument.use_equals">true</boolProp>
               </elementProp>
@@ -2412,61 +2450,61 @@ vars.put(&quot;category_name&quot;, props.get(&quot;category_name&quot;));</stri
                 <stringProp name="Argument.metadata">=</stringProp>
                 <boolProp name="HTTPArgument.use_equals">true</boolProp>
               </elementProp>
-              <elementProp name="billing[postcode]" elementType="HTTPArgument">
+              <elementProp name="billing[region_id]" elementType="HTTPArgument">
                 <boolProp name="HTTPArgument.always_encode">true</boolProp>
-                <stringProp name="Argument.name">billing[postcode]</stringProp>
-                <stringProp name="Argument.value">90232</stringProp>
+                <stringProp name="Argument.name">billing[region_id]</stringProp>
+                <stringProp name="Argument.value">12</stringProp>
                 <stringProp name="Argument.metadata">=</stringProp>
                 <boolProp name="HTTPArgument.use_equals">true</boolProp>
               </elementProp>
-              <elementProp name="billing[country_id]" elementType="HTTPArgument">
+              <elementProp name="billing[save_in_address_book]" elementType="HTTPArgument">
                 <boolProp name="HTTPArgument.always_encode">true</boolProp>
-                <stringProp name="Argument.name">billing[country_id]</stringProp>
-                <stringProp name="Argument.value">US</stringProp>
+                <stringProp name="Argument.value">1</stringProp>
                 <stringProp name="Argument.metadata">=</stringProp>
                 <boolProp name="HTTPArgument.use_equals">true</boolProp>
+                <stringProp name="Argument.name">billing[save_in_address_book]</stringProp>
               </elementProp>
-              <elementProp name="billing[telephone]" elementType="HTTPArgument">
+              <elementProp name="billing[street][]" elementType="HTTPArgument">
                 <boolProp name="HTTPArgument.always_encode">true</boolProp>
-                <stringProp name="Argument.name">billing[telephone]</stringProp>
-                <stringProp name="Argument.value">1-310-945-0345</stringProp>
+                <stringProp name="Argument.name">billing[street][]</stringProp>
+                <stringProp name="Argument.value">10441 Jefferson Blvd, ste 200</stringProp>
                 <stringProp name="Argument.metadata">=</stringProp>
                 <boolProp name="HTTPArgument.use_equals">true</boolProp>
               </elementProp>
-              <elementProp name="billing[fax]" elementType="HTTPArgument">
+              <elementProp name="billing[street][]" elementType="HTTPArgument">
                 <boolProp name="HTTPArgument.always_encode">true</boolProp>
-                <stringProp name="Argument.name">billing[fax]</stringProp>
+                <stringProp name="Argument.name">billing[street][]</stringProp>
                 <stringProp name="Argument.value"></stringProp>
                 <stringProp name="Argument.metadata">=</stringProp>
                 <boolProp name="HTTPArgument.use_equals">true</boolProp>
               </elementProp>
-              <elementProp name="billing[customer_password]" elementType="HTTPArgument">
+              <elementProp name="billing[telephone]" elementType="HTTPArgument">
                 <boolProp name="HTTPArgument.always_encode">true</boolProp>
-                <stringProp name="Argument.name">billing[customer_password]</stringProp>
-                <stringProp name="Argument.value"></stringProp>
+                <stringProp name="Argument.name">billing[telephone]</stringProp>
+                <stringProp name="Argument.value">1-310-945-0345</stringProp>
                 <stringProp name="Argument.metadata">=</stringProp>
                 <boolProp name="HTTPArgument.use_equals">true</boolProp>
               </elementProp>
-              <elementProp name="billing[confirm_password]" elementType="HTTPArgument">
+              <elementProp name="billing[use_for_shipping]" elementType="HTTPArgument">
                 <boolProp name="HTTPArgument.always_encode">true</boolProp>
-                <stringProp name="Argument.name">billing[confirm_password]</stringProp>
-                <stringProp name="Argument.value"></stringProp>
+                <stringProp name="Argument.name">billing[use_for_shipping]</stringProp>
+                <stringProp name="Argument.value">1</stringProp>
                 <stringProp name="Argument.metadata">=</stringProp>
                 <boolProp name="HTTPArgument.use_equals">true</boolProp>
               </elementProp>
-              <elementProp name="billing[use_for_shipping]" elementType="HTTPArgument">
+              <elementProp name="ajax" elementType="HTTPArgument">
                 <boolProp name="HTTPArgument.always_encode">true</boolProp>
-                <stringProp name="Argument.name">billing[use_for_shipping]</stringProp>
                 <stringProp name="Argument.value">1</stringProp>
                 <stringProp name="Argument.metadata">=</stringProp>
                 <boolProp name="HTTPArgument.use_equals">true</boolProp>
+                <stringProp name="Argument.name">ajax</stringProp>
               </elementProp>
-              <elementProp name="billing[save_in_address_book]" elementType="HTTPArgument">
+              <elementProp name="isAjax" elementType="HTTPArgument">
                 <boolProp name="HTTPArgument.always_encode">true</boolProp>
                 <stringProp name="Argument.value">1</stringProp>
                 <stringProp name="Argument.metadata">=</stringProp>
                 <boolProp name="HTTPArgument.use_equals">true</boolProp>
-                <stringProp name="Argument.name">billing[save_in_address_book]</stringProp>
+                <stringProp name="Argument.name">isAjax</stringProp>
               </elementProp>
             </collectionProp>
           </elementProp>
@@ -2487,6 +2525,15 @@ vars.put(&quot;category_name&quot;, props.get(&quot;category_name&quot;));</stri
           <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
         </HTTPSamplerProxy>
         <hashTree>
+          <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true">
+            <collectionProp name="HeaderManager.headers">
+              <elementProp name="" elementType="Header">
+                <stringProp name="Header.name">Referer</stringProp>
+                <stringProp name="Header.value">http://mage2.com/checkout/onepage/</stringProp>
+              </elementProp>
+            </collectionProp>
+          </HeaderManager>
+          <hashTree/>
           <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert success" enabled="true">
             <collectionProp name="Asserion.test_strings">
               <stringProp name="-1549408881">&quot;goto_section&quot;:&quot;shipping_method&quot;</stringProp>
@@ -2497,45 +2544,30 @@ vars.put(&quot;category_name&quot;, props.get(&quot;category_name&quot;));</stri
           </ResponseAssertion>
           <hashTree/>
         </hashTree>
-        <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Checkout progress to shipping method(GuestChkt)" enabled="true">
-          <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true">
-            <collectionProp name="Arguments.arguments">
-              <elementProp name="toStep" elementType="HTTPArgument">
-                <boolProp name="HTTPArgument.always_encode">false</boolProp>
-                <stringProp name="Argument.value">shipping_method</stringProp>
-                <stringProp name="Argument.metadata">=</stringProp>
-                <boolProp name="HTTPArgument.use_equals">true</boolProp>
-                <stringProp name="Argument.name">toStep</stringProp>
-              </elementProp>
-            </collectionProp>
-          </elementProp>
-          <stringProp name="HTTPSampler.domain"></stringProp>
-          <stringProp name="HTTPSampler.port"></stringProp>
-          <stringProp name="HTTPSampler.connect_timeout"></stringProp>
-          <stringProp name="HTTPSampler.response_timeout"></stringProp>
-          <stringProp name="HTTPSampler.protocol">http</stringProp>
-          <stringProp name="HTTPSampler.contentEncoding"></stringProp>
-          <stringProp name="HTTPSampler.path">${base_path}checkout/onepage/progress/</stringProp>
-          <stringProp name="HTTPSampler.method">GET</stringProp>
-          <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
-          <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
-          <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
-          <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
-          <stringProp name="HTTPSampler.implementation">Java</stringProp>
-          <boolProp name="HTTPSampler.monitor">false</boolProp>
-          <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
-        </HTTPSamplerProxy>
-        <hashTree/>
         <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Checkout shipping method(GuestChkt)" enabled="true">
           <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true">
             <collectionProp name="Arguments.arguments">
               <elementProp name="shipping_method" elementType="HTTPArgument">
-                <boolProp name="HTTPArgument.always_encode">false</boolProp>
+                <boolProp name="HTTPArgument.always_encode">true</boolProp>
                 <stringProp name="Argument.name">shipping_method</stringProp>
                 <stringProp name="Argument.value">flatrate_flatrate</stringProp>
                 <stringProp name="Argument.metadata">=</stringProp>
                 <boolProp name="HTTPArgument.use_equals">true</boolProp>
               </elementProp>
+              <elementProp name="ajax" elementType="HTTPArgument">
+                <boolProp name="HTTPArgument.always_encode">true</boolProp>
+                <stringProp name="Argument.value">1</stringProp>
+                <stringProp name="Argument.metadata">=</stringProp>
+                <boolProp name="HTTPArgument.use_equals">true</boolProp>
+                <stringProp name="Argument.name">ajax</stringProp>
+              </elementProp>
+              <elementProp name="isAjax" elementType="HTTPArgument">
+                <boolProp name="HTTPArgument.always_encode">true</boolProp>
+                <stringProp name="Argument.value">1</stringProp>
+                <stringProp name="Argument.metadata">=</stringProp>
+                <boolProp name="HTTPArgument.use_equals">true</boolProp>
+                <stringProp name="Argument.name">isAjax</stringProp>
+              </elementProp>
             </collectionProp>
           </elementProp>
           <stringProp name="HTTPSampler.domain"></stringProp>
@@ -2555,6 +2587,15 @@ vars.put(&quot;category_name&quot;, props.get(&quot;category_name&quot;));</stri
           <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
         </HTTPSamplerProxy>
         <hashTree>
+          <HeaderManager guiclass="HeaderPanel" testclass="HeaderManager" testname="HTTP Header Manager" enabled="true">
+            <collectionProp name="HeaderManager.headers">
+              <elementProp name="" elementType="Header">
+                <stringProp name="Header.name">Referer</stringProp>
+                <stringProp name="Header.value">http://mage2.com/checkout/onepage/</stringProp>
+              </elementProp>
+            </collectionProp>
+          </HeaderManager>
+          <hashTree/>
           <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true">
             <collectionProp name="Asserion.test_strings">
               <stringProp name="-1344413285">&quot;goto_section&quot;:&quot;payment&quot;</stringProp>
@@ -2565,35 +2606,6 @@ vars.put(&quot;category_name&quot;, props.get(&quot;category_name&quot;));</stri
           </ResponseAssertion>
           <hashTree/>
         </hashTree>
-        <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Checkout progressto payment(GuestChkt)" enabled="true">
-          <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true">
-            <collectionProp name="Arguments.arguments">
-              <elementProp name="toStep" elementType="HTTPArgument">
-                <boolProp name="HTTPArgument.always_encode">false</boolProp>
-                <stringProp name="Argument.value">payment</stringProp>
-                <stringProp name="Argument.metadata">=</stringProp>
-                <boolProp name="HTTPArgument.use_equals">true</boolProp>
-                <stringProp name="Argument.name">toStep</stringProp>
-              </elementProp>
-            </collectionProp>
-          </elementProp>
-          <stringProp name="HTTPSampler.domain"></stringProp>
-          <stringProp name="HTTPSampler.port"></stringProp>
-          <stringProp name="HTTPSampler.connect_timeout"></stringProp>
-          <stringProp name="HTTPSampler.response_timeout"></stringProp>
-          <stringProp name="HTTPSampler.protocol">http</stringProp>
-          <stringProp name="HTTPSampler.contentEncoding">UTF-8</stringProp>
-          <stringProp name="HTTPSampler.path">${base_path}checkout/onepage/progress/</stringProp>
-          <stringProp name="HTTPSampler.method">GET</stringProp>
-          <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
-          <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
-          <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
-          <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
-          <stringProp name="HTTPSampler.implementation">Java</stringProp>
-          <boolProp name="HTTPSampler.monitor">false</boolProp>
-          <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
-        </HTTPSamplerProxy>
-        <hashTree/>
         <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Checkout payment method(GuestChkt)" enabled="true">
           <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true">
             <collectionProp name="Arguments.arguments">
@@ -2611,6 +2623,20 @@ vars.put(&quot;category_name&quot;, props.get(&quot;category_name&quot;));</stri
                 <boolProp name="HTTPArgument.use_equals">true</boolProp>
                 <stringProp name="Argument.name">form_key</stringProp>
               </elementProp>
+              <elementProp name="ajax" elementType="HTTPArgument">
+                <boolProp name="HTTPArgument.always_encode">true</boolProp>
+                <stringProp name="Argument.value">1</stringProp>
+                <stringProp name="Argument.metadata">=</stringProp>
+                <boolProp name="HTTPArgument.use_equals">true</boolProp>
+                <stringProp name="Argument.name">ajax</stringProp>
+              </elementProp>
+              <elementProp name="isAjax" elementType="HTTPArgument">
+                <boolProp name="HTTPArgument.always_encode">true</boolProp>
+                <stringProp name="Argument.value">1</stringProp>
+                <stringProp name="Argument.metadata">=</stringProp>
+                <boolProp name="HTTPArgument.use_equals">true</boolProp>
+                <stringProp name="Argument.name">isAjax</stringProp>
+              </elementProp>
             </collectionProp>
           </elementProp>
           <stringProp name="HTTPSampler.domain"></stringProp>
@@ -2640,53 +2666,38 @@ vars.put(&quot;category_name&quot;, props.get(&quot;category_name&quot;));</stri
           </ResponseAssertion>
           <hashTree/>
         </hashTree>
-        <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Checkout progress to review(GuestChkt)" enabled="true">
+        <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Checkout place order(GuestChkt)" enabled="true">
           <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true">
             <collectionProp name="Arguments.arguments">
-              <elementProp name="toStep" elementType="HTTPArgument">
-                <boolProp name="HTTPArgument.always_encode">false</boolProp>
-                <stringProp name="Argument.value">review</stringProp>
-                <stringProp name="Argument.metadata">=</stringProp>
-                <boolProp name="HTTPArgument.use_equals">true</boolProp>
-                <stringProp name="Argument.name">toStep</stringProp>
-              </elementProp>
-            </collectionProp>
-          </elementProp>
-          <stringProp name="HTTPSampler.domain"></stringProp>
-          <stringProp name="HTTPSampler.port"></stringProp>
-          <stringProp name="HTTPSampler.connect_timeout"></stringProp>
-          <stringProp name="HTTPSampler.response_timeout"></stringProp>
-          <stringProp name="HTTPSampler.protocol">http</stringProp>
-          <stringProp name="HTTPSampler.contentEncoding">UTF-8</stringProp>
-          <stringProp name="HTTPSampler.path">${base_path}checkout/onepage/progress/</stringProp>
-          <stringProp name="HTTPSampler.method">GET</stringProp>
-          <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
-          <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
-          <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
-          <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
-          <stringProp name="HTTPSampler.implementation">Java</stringProp>
-          <boolProp name="HTTPSampler.monitor">false</boolProp>
-          <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
-        </HTTPSamplerProxy>
-        <hashTree/>
-        <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Checkout place order(GuestChkt)" enabled="true">
-          <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true">
-            <collectionProp name="Arguments.arguments">
-              <elementProp name="payment[method]" elementType="HTTPArgument">
-                <boolProp name="HTTPArgument.always_encode">true</boolProp>
-                <stringProp name="Argument.name">payment[method]</stringProp>
-                <stringProp name="Argument.value">checkmo</stringProp>
+              <elementProp name="payment[method]" elementType="HTTPArgument">
+                <boolProp name="HTTPArgument.always_encode">true</boolProp>
+                <stringProp name="Argument.name">payment[method]</stringProp>
+                <stringProp name="Argument.value">checkmo</stringProp>
                 <stringProp name="Argument.metadata">=</stringProp>
                 <boolProp name="HTTPArgument.use_equals">true</boolProp>
               </elementProp>
               <elementProp name="form_key" elementType="HTTPArgument">
-                <boolProp name="HTTPArgument.always_encode">false</boolProp>
+                <boolProp name="HTTPArgument.always_encode">true</boolProp>
                 <stringProp name="Argument.value">${form_key}</stringProp>
                 <stringProp name="Argument.metadata">=</stringProp>
                 <boolProp name="HTTPArgument.use_equals">true</boolProp>
                 <stringProp name="Argument.name">form_key</stringProp>
                 <stringProp name="Argument.desc">false</stringProp>
               </elementProp>
+              <elementProp name="ajax" elementType="HTTPArgument">
+                <boolProp name="HTTPArgument.always_encode">true</boolProp>
+                <stringProp name="Argument.value">1</stringProp>
+                <stringProp name="Argument.metadata">=</stringProp>
+                <boolProp name="HTTPArgument.use_equals">true</boolProp>
+                <stringProp name="Argument.name">ajax</stringProp>
+              </elementProp>
+              <elementProp name="isAjax" elementType="HTTPArgument">
+                <boolProp name="HTTPArgument.always_encode">true</boolProp>
+                <stringProp name="Argument.value">1</stringProp>
+                <stringProp name="Argument.metadata">=</stringProp>
+                <boolProp name="HTTPArgument.use_equals">true</boolProp>
+                <stringProp name="Argument.name">isAjax</stringProp>
+              </elementProp>
             </collectionProp>
           </elementProp>
           <stringProp name="HTTPSampler.domain"></stringProp>
@@ -3306,28 +3317,28 @@ if (emailsCount &lt; 1) {
           <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true">
             <collectionProp name="Arguments.arguments">
               <elementProp name="context" elementType="HTTPArgument">
-                <boolProp name="HTTPArgument.always_encode">false</boolProp>
+                <boolProp name="HTTPArgument.always_encode">true</boolProp>
                 <stringProp name="Argument.name">context</stringProp>
                 <stringProp name="Argument.value">checkout</stringProp>
                 <stringProp name="Argument.metadata">=</stringProp>
                 <boolProp name="HTTPArgument.use_equals">true</boolProp>
               </elementProp>
               <elementProp name="login[username]" elementType="HTTPArgument">
-                <boolProp name="HTTPArgument.always_encode">false</boolProp>
+                <boolProp name="HTTPArgument.always_encode">true</boolProp>
                 <stringProp name="Argument.value">${customer_email}</stringProp>
                 <stringProp name="Argument.metadata">=</stringProp>
                 <boolProp name="HTTPArgument.use_equals">true</boolProp>
                 <stringProp name="Argument.name">login[username]</stringProp>
               </elementProp>
               <elementProp name="login[password]" elementType="HTTPArgument">
-                <boolProp name="HTTPArgument.always_encode">false</boolProp>
+                <boolProp name="HTTPArgument.always_encode">true</boolProp>
                 <stringProp name="Argument.value">${customer_password}</stringProp>
                 <stringProp name="Argument.metadata">=</stringProp>
                 <boolProp name="HTTPArgument.use_equals">true</boolProp>
                 <stringProp name="Argument.name">login[password]</stringProp>
               </elementProp>
               <elementProp name="form_key" elementType="HTTPArgument">
-                <boolProp name="HTTPArgument.always_encode">false</boolProp>
+                <boolProp name="HTTPArgument.always_encode">true</boolProp>
                 <stringProp name="Argument.value">${form_key}</stringProp>
                 <stringProp name="Argument.metadata">=</stringProp>
                 <boolProp name="HTTPArgument.use_equals">true</boolProp>
@@ -3472,6 +3483,20 @@ if (emailsCount &lt; 1) {
                 <boolProp name="HTTPArgument.use_equals">true</boolProp>
                 <stringProp name="Argument.name">billing[save_in_address_book]</stringProp>
               </elementProp>
+              <elementProp name="ajax" elementType="HTTPArgument">
+                <boolProp name="HTTPArgument.always_encode">true</boolProp>
+                <stringProp name="Argument.value">1</stringProp>
+                <stringProp name="Argument.metadata">=</stringProp>
+                <boolProp name="HTTPArgument.use_equals">true</boolProp>
+                <stringProp name="Argument.name">ajax</stringProp>
+              </elementProp>
+              <elementProp name="isAjax" elementType="HTTPArgument">
+                <boolProp name="HTTPArgument.always_encode">true</boolProp>
+                <stringProp name="Argument.value">1</stringProp>
+                <stringProp name="Argument.metadata">=</stringProp>
+                <boolProp name="HTTPArgument.use_equals">true</boolProp>
+                <stringProp name="Argument.name">isAjax</stringProp>
+              </elementProp>
             </collectionProp>
           </elementProp>
           <stringProp name="HTTPSampler.domain"></stringProp>
@@ -3501,90 +3526,44 @@ if (emailsCount &lt; 1) {
           </ResponseAssertion>
           <hashTree/>
         </hashTree>
-        <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Checkout shipping method additional (CustomerChkt)" enabled="true">
-          <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true">
-            <collectionProp name="Arguments.arguments"/>
-          </elementProp>
-          <stringProp name="HTTPSampler.domain"></stringProp>
-          <stringProp name="HTTPSampler.port"></stringProp>
-          <stringProp name="HTTPSampler.connect_timeout"></stringProp>
-          <stringProp name="HTTPSampler.response_timeout"></stringProp>
-          <stringProp name="HTTPSampler.protocol">http</stringProp>
-          <stringProp name="HTTPSampler.contentEncoding">UTF-8</stringProp>
-          <stringProp name="HTTPSampler.path">${base_path}checkout/onepage/getAdditional/</stringProp>
-          <stringProp name="HTTPSampler.method">POST</stringProp>
-          <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
-          <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
-          <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
-          <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
-          <stringProp name="HTTPSampler.implementation">Java</stringProp>
-          <boolProp name="HTTPSampler.monitor">false</boolProp>
-          <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
-        </HTTPSamplerProxy>
-        <hashTree>
-          <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Assert success" enabled="true">
-            <collectionProp name="Asserion.test_strings">
-              <stringProp name="-336696320">&lt;!-- BLOCK shipping_method_additional --&gt;</stringProp>
-            </collectionProp>
-            <stringProp name="Assertion.test_field">Assertion.response_data</stringProp>
-            <boolProp name="Assertion.assume_success">false</boolProp>
-            <intProp name="Assertion.test_type">2</intProp>
-          </ResponseAssertion>
-          <hashTree/>
-        </hashTree>
-        <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Checkout progress to shipping method(CustomerChkt)" enabled="true">
-          <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true">
-            <collectionProp name="Arguments.arguments">
-              <elementProp name="toStep" elementType="HTTPArgument">
-                <boolProp name="HTTPArgument.always_encode">false</boolProp>
-                <stringProp name="Argument.value">shipping_method</stringProp>
-                <stringProp name="Argument.metadata">=</stringProp>
-                <boolProp name="HTTPArgument.use_equals">true</boolProp>
-                <stringProp name="Argument.name">toStep</stringProp>
-              </elementProp>
-            </collectionProp>
-          </elementProp>
-          <stringProp name="HTTPSampler.domain"></stringProp>
-          <stringProp name="HTTPSampler.port"></stringProp>
-          <stringProp name="HTTPSampler.connect_timeout"></stringProp>
-          <stringProp name="HTTPSampler.response_timeout"></stringProp>
-          <stringProp name="HTTPSampler.protocol">http</stringProp>
-          <stringProp name="HTTPSampler.contentEncoding"></stringProp>
-          <stringProp name="HTTPSampler.path">${base_path}checkout/onepage/progress/</stringProp>
-          <stringProp name="HTTPSampler.method">GET</stringProp>
-          <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
-          <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
-          <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
-          <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
-          <stringProp name="HTTPSampler.implementation">Java</stringProp>
-          <boolProp name="HTTPSampler.monitor">false</boolProp>
-          <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
-        </HTTPSamplerProxy>
-        <hashTree/>
         <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Checkout shipping method(CustomerChkt)" enabled="true">
           <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true">
             <collectionProp name="Arguments.arguments">
               <elementProp name="giftoptions[1496][type]" elementType="HTTPArgument">
-                <boolProp name="HTTPArgument.always_encode">false</boolProp>
+                <boolProp name="HTTPArgument.always_encode">true</boolProp>
                 <stringProp name="Argument.value">quote_item</stringProp>
                 <stringProp name="Argument.metadata">=</stringProp>
                 <boolProp name="HTTPArgument.use_equals">true</boolProp>
                 <stringProp name="Argument.name">giftoptions[1496][type]</stringProp>
               </elementProp>
               <elementProp name="giftoptions[451][type]" elementType="HTTPArgument">
-                <boolProp name="HTTPArgument.always_encode">false</boolProp>
+                <boolProp name="HTTPArgument.always_encode">true</boolProp>
                 <stringProp name="Argument.value">quote</stringProp>
                 <stringProp name="Argument.metadata">=</stringProp>
                 <boolProp name="HTTPArgument.use_equals">true</boolProp>
                 <stringProp name="Argument.name">giftoptions[451][type]</stringProp>
               </elementProp>
               <elementProp name="shipping_method" elementType="HTTPArgument">
-                <boolProp name="HTTPArgument.always_encode">false</boolProp>
+                <boolProp name="HTTPArgument.always_encode">true</boolProp>
                 <stringProp name="Argument.name">shipping_method</stringProp>
                 <stringProp name="Argument.value">flatrate_flatrate</stringProp>
                 <stringProp name="Argument.metadata">=</stringProp>
                 <boolProp name="HTTPArgument.use_equals">true</boolProp>
               </elementProp>
+              <elementProp name="ajax" elementType="HTTPArgument">
+                <boolProp name="HTTPArgument.always_encode">true</boolProp>
+                <stringProp name="Argument.value">1</stringProp>
+                <stringProp name="Argument.metadata">=</stringProp>
+                <boolProp name="HTTPArgument.use_equals">true</boolProp>
+                <stringProp name="Argument.name">ajax</stringProp>
+              </elementProp>
+              <elementProp name="isAjax" elementType="HTTPArgument">
+                <boolProp name="HTTPArgument.always_encode">true</boolProp>
+                <stringProp name="Argument.value">1</stringProp>
+                <stringProp name="Argument.metadata">=</stringProp>
+                <boolProp name="HTTPArgument.use_equals">true</boolProp>
+                <stringProp name="Argument.name">isAjax</stringProp>
+              </elementProp>
             </collectionProp>
           </elementProp>
           <stringProp name="HTTPSampler.domain"></stringProp>
@@ -3614,35 +3593,6 @@ if (emailsCount &lt; 1) {
           </ResponseAssertion>
           <hashTree/>
         </hashTree>
-        <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Checkout progress to payment(CustomerChkt)" enabled="true">
-          <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true">
-            <collectionProp name="Arguments.arguments">
-              <elementProp name="toStep" elementType="HTTPArgument">
-                <boolProp name="HTTPArgument.always_encode">false</boolProp>
-                <stringProp name="Argument.value">payment</stringProp>
-                <stringProp name="Argument.metadata">=</stringProp>
-                <boolProp name="HTTPArgument.use_equals">true</boolProp>
-                <stringProp name="Argument.name">toStep</stringProp>
-              </elementProp>
-            </collectionProp>
-          </elementProp>
-          <stringProp name="HTTPSampler.domain"></stringProp>
-          <stringProp name="HTTPSampler.port"></stringProp>
-          <stringProp name="HTTPSampler.connect_timeout"></stringProp>
-          <stringProp name="HTTPSampler.response_timeout"></stringProp>
-          <stringProp name="HTTPSampler.protocol">http</stringProp>
-          <stringProp name="HTTPSampler.contentEncoding">UTF-8</stringProp>
-          <stringProp name="HTTPSampler.path">${base_path}checkout/onepage/progress/</stringProp>
-          <stringProp name="HTTPSampler.method">GET</stringProp>
-          <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
-          <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
-          <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
-          <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
-          <stringProp name="HTTPSampler.implementation">Java</stringProp>
-          <boolProp name="HTTPSampler.monitor">false</boolProp>
-          <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
-        </HTTPSamplerProxy>
-        <hashTree/>
         <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Checkout payment method(CustomerChkt)" enabled="true">
           <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true">
             <collectionProp name="Arguments.arguments">
@@ -3660,6 +3610,20 @@ if (emailsCount &lt; 1) {
                 <boolProp name="HTTPArgument.use_equals">true</boolProp>
                 <stringProp name="Argument.name">form_key</stringProp>
               </elementProp>
+              <elementProp name="ajax" elementType="HTTPArgument">
+                <boolProp name="HTTPArgument.always_encode">true</boolProp>
+                <stringProp name="Argument.value">1</stringProp>
+                <stringProp name="Argument.metadata">=</stringProp>
+                <boolProp name="HTTPArgument.use_equals">true</boolProp>
+                <stringProp name="Argument.name">ajax</stringProp>
+              </elementProp>
+              <elementProp name="isAjax" elementType="HTTPArgument">
+                <boolProp name="HTTPArgument.always_encode">true</boolProp>
+                <stringProp name="Argument.value">1</stringProp>
+                <stringProp name="Argument.metadata">=</stringProp>
+                <boolProp name="HTTPArgument.use_equals">true</boolProp>
+                <stringProp name="Argument.name">isAjax</stringProp>
+              </elementProp>
             </collectionProp>
           </elementProp>
           <stringProp name="HTTPSampler.domain"></stringProp>
@@ -3689,35 +3653,6 @@ if (emailsCount &lt; 1) {
           </ResponseAssertion>
           <hashTree/>
         </hashTree>
-        <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Checkout progress to review(CustomerChkt)" enabled="true">
-          <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true">
-            <collectionProp name="Arguments.arguments">
-              <elementProp name="toStep" elementType="HTTPArgument">
-                <boolProp name="HTTPArgument.always_encode">false</boolProp>
-                <stringProp name="Argument.value">review</stringProp>
-                <stringProp name="Argument.metadata">=</stringProp>
-                <boolProp name="HTTPArgument.use_equals">true</boolProp>
-                <stringProp name="Argument.name">toStep</stringProp>
-              </elementProp>
-            </collectionProp>
-          </elementProp>
-          <stringProp name="HTTPSampler.domain"></stringProp>
-          <stringProp name="HTTPSampler.port"></stringProp>
-          <stringProp name="HTTPSampler.connect_timeout"></stringProp>
-          <stringProp name="HTTPSampler.response_timeout"></stringProp>
-          <stringProp name="HTTPSampler.protocol">http</stringProp>
-          <stringProp name="HTTPSampler.contentEncoding">UTF-8</stringProp>
-          <stringProp name="HTTPSampler.path">${base_path}checkout/onepage/progress/</stringProp>
-          <stringProp name="HTTPSampler.method">GET</stringProp>
-          <boolProp name="HTTPSampler.follow_redirects">true</boolProp>
-          <boolProp name="HTTPSampler.auto_redirects">false</boolProp>
-          <boolProp name="HTTPSampler.use_keepalive">true</boolProp>
-          <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
-          <stringProp name="HTTPSampler.implementation">Java</stringProp>
-          <boolProp name="HTTPSampler.monitor">false</boolProp>
-          <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
-        </HTTPSamplerProxy>
-        <hashTree/>
         <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Checkout place order(CustomerChkt)" enabled="true">
           <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true">
             <collectionProp name="Arguments.arguments">
@@ -3729,13 +3664,27 @@ if (emailsCount &lt; 1) {
                 <boolProp name="HTTPArgument.use_equals">true</boolProp>
               </elementProp>
               <elementProp name="form_key" elementType="HTTPArgument">
-                <boolProp name="HTTPArgument.always_encode">false</boolProp>
+                <boolProp name="HTTPArgument.always_encode">true</boolProp>
                 <stringProp name="Argument.value">${form_key}</stringProp>
                 <stringProp name="Argument.metadata">=</stringProp>
                 <boolProp name="HTTPArgument.use_equals">true</boolProp>
                 <stringProp name="Argument.name">form_key</stringProp>
                 <stringProp name="Argument.desc">false</stringProp>
               </elementProp>
+              <elementProp name="ajax" elementType="HTTPArgument">
+                <boolProp name="HTTPArgument.always_encode">true</boolProp>
+                <stringProp name="Argument.value">1</stringProp>
+                <stringProp name="Argument.metadata">=</stringProp>
+                <boolProp name="HTTPArgument.use_equals">true</boolProp>
+                <stringProp name="Argument.name">ajax</stringProp>
+              </elementProp>
+              <elementProp name="isAjax" elementType="HTTPArgument">
+                <boolProp name="HTTPArgument.always_encode">true</boolProp>
+                <stringProp name="Argument.value">1</stringProp>
+                <stringProp name="Argument.metadata">=</stringProp>
+                <boolProp name="HTTPArgument.use_equals">true</boolProp>
+                <stringProp name="Argument.name">isAjax</stringProp>
+              </elementProp>
             </collectionProp>
           </elementProp>
           <stringProp name="HTTPSampler.domain"></stringProp>
@@ -4571,6 +4520,148 @@ props.remove(&quot;customer_emails_list&quot;);</stringProp>
         <stringProp name="exclude_sample_labels"></stringProp>
       </kg.apc.jmeter.vizualizers.CorrectedResultCollector>
       <hashTree/>
+      <kg.apc.jmeter.perfmon.PerfMonCollector guiclass="kg.apc.jmeter.vizualizers.PerfMonGui" testclass="kg.apc.jmeter.perfmon.PerfMonCollector" testname="Performance Metrics Collector" enabled="true">
+        <boolProp name="ResultCollector.error_logging">false</boolProp>
+        <objProp>
+          <name>saveConfig</name>
+          <value class="SampleSaveConfiguration">
+            <time>true</time>
+            <latency>true</latency>
+            <timestamp>true</timestamp>
+            <success>true</success>
+            <label>true</label>
+            <code>true</code>
+            <message>true</message>
+            <threadName>true</threadName>
+            <dataType>true</dataType>
+            <encoding>false</encoding>
+            <assertions>true</assertions>
+            <subresults>true</subresults>
+            <responseData>false</responseData>
+            <samplerData>false</samplerData>
+            <xml>false</xml>
+            <fieldNames>false</fieldNames>
+            <responseHeaders>false</responseHeaders>
+            <requestHeaders>false</requestHeaders>
+            <responseDataOnError>false</responseDataOnError>
+            <saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage>
+            <assertionsResultsToSave>0</assertionsResultsToSave>
+            <bytes>true</bytes>
+          </value>
+        </objProp>
+        <stringProp name="filename">${performance_metrics_collector_file_name}</stringProp>
+        <longProp name="interval_grouping">1000</longProp>
+        <boolProp name="graph_aggregated">false</boolProp>
+        <stringProp name="include_sample_labels"></stringProp>
+        <stringProp name="exclude_sample_labels"></stringProp>
+        <collectionProp name="metricConnections">
+          <collectionProp name="-837026933">
+            <stringProp name="430480420">${db_server_ip}</stringProp>
+            <stringProp name="2061224089">${jmeter_agent_port}</stringProp>
+            <stringProp name="66952">CPU</stringProp>
+            <stringProp name="0"></stringProp>
+          </collectionProp>
+          <collectionProp name="1157226042">
+            <stringProp name="430480420">${db_server_ip}</stringProp>
+            <stringProp name="2061224089">${jmeter_agent_port}</stringProp>
+            <stringProp name="-1993889503">Memory</stringProp>
+            <stringProp name="0"></stringProp>
+          </collectionProp>
+          <collectionProp name="757813414">
+            <stringProp name="430480420">${db_server_ip}</stringProp>
+            <stringProp name="2061224089">${jmeter_agent_port}</stringProp>
+            <stringProp name="2112896831">Disks I/O</stringProp>
+            <stringProp name="541420523">unit=kb:readbytes</stringProp>
+          </collectionProp>
+          <collectionProp name="1511609822">
+            <stringProp name="816265486">${web_server_1_ip}</stringProp>
+            <stringProp name="2061224089">${jmeter_agent_port}</stringProp>
+            <stringProp name="66952">CPU</stringProp>
+            <stringProp name="0"></stringProp>
+          </collectionProp>
+          <collectionProp name="-789104499">
+            <stringProp name="816265486">${web_server_1_ip}</stringProp>
+            <stringProp name="2061224089">${jmeter_agent_port}</stringProp>
+            <stringProp name="-1993889503">Memory</stringProp>
+            <stringProp name="0"></stringProp>
+          </collectionProp>
+          <collectionProp name="-1188517127">
+            <stringProp name="816265486">${web_server_1_ip}</stringProp>
+            <stringProp name="2061224089">${jmeter_agent_port}</stringProp>
+            <stringProp name="2112896831">Disks I/O</stringProp>
+            <stringProp name="541420523">unit=kb:readbytes</stringProp>
+          </collectionProp>
+          <collectionProp name="840790980">
+            <stringProp name="817189007">${web_server_2_ip}</stringProp>
+            <stringProp name="2061224089">${jmeter_agent_port}</stringProp>
+            <stringProp name="66952">CPU</stringProp>
+            <stringProp name="0"></stringProp>
+          </collectionProp>
+          <collectionProp name="-1459923341">
+            <stringProp name="817189007">${web_server_2_ip}</stringProp>
+            <stringProp name="2061224089">${jmeter_agent_port}</stringProp>
+            <stringProp name="-1993889503">Memory</stringProp>
+            <stringProp name="0"></stringProp>
+          </collectionProp>
+          <collectionProp name="-1859335969">
+            <stringProp name="817189007">${web_server_2_ip}</stringProp>
+            <stringProp name="2061224089">${jmeter_agent_port}</stringProp>
+            <stringProp name="2112896831">Disks I/O</stringProp>
+            <stringProp name="541420523">unit=kb:readbytes</stringProp>
+          </collectionProp>
+          <collectionProp name="1158424422">
+            <stringProp name="430480420">${db_server_ip}</stringProp>
+            <stringProp name="2061224089">${jmeter_agent_port}</stringProp>
+            <stringProp name="2112896831">Disks I/O</stringProp>
+            <stringProp name="-962924714">unit=kb:writebytes</stringProp>
+          </collectionProp>
+          <collectionProp name="-787906119">
+            <stringProp name="816265486">${web_server_1_ip}</stringProp>
+            <stringProp name="2061224089">${jmeter_agent_port}</stringProp>
+            <stringProp name="2112896831">Disks I/O</stringProp>
+            <stringProp name="-962924714">unit=kb:writebytes</stringProp>
+          </collectionProp>
+          <collectionProp name="-1458724961">
+            <stringProp name="817189007">${web_server_2_ip}</stringProp>
+            <stringProp name="2061224089">${jmeter_agent_port}</stringProp>
+            <stringProp name="2112896831">Disks I/O</stringProp>
+            <stringProp name="-962924714">unit=kb:writebytes</stringProp>
+          </collectionProp>
+        </collectionProp>
+      </kg.apc.jmeter.perfmon.PerfMonCollector>
+      <hashTree/>
+      <ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="Response Time" enabled="true">
+        <boolProp name="ResultCollector.error_logging">false</boolProp>
+        <objProp>
+          <name>saveConfig</name>
+          <value class="SampleSaveConfiguration">
+            <time>true</time>
+            <latency>true</latency>
+            <timestamp>true</timestamp>
+            <success>true</success>
+            <label>true</label>
+            <code>true</code>
+            <message>true</message>
+            <threadName>true</threadName>
+            <dataType>true</dataType>
+            <encoding>false</encoding>
+            <assertions>true</assertions>
+            <subresults>true</subresults>
+            <responseData>false</responseData>
+            <samplerData>false</samplerData>
+            <xml>true</xml>
+            <fieldNames>false</fieldNames>
+            <responseHeaders>false</responseHeaders>
+            <requestHeaders>false</requestHeaders>
+            <responseDataOnError>false</responseDataOnError>
+            <saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage>
+            <assertionsResultsToSave>0</assertionsResultsToSave>
+            <bytes>true</bytes>
+          </value>
+        </objProp>
+        <stringProp name="filename">${response_time_file_name}</stringProp>
+      </ResultCollector>
+      <hashTree/>
     </hashTree>
   </hashTree>
 </jmeterTestPlan>
diff --git a/dev/tools/performance-toolkit/fixtures/eav_variations.php b/dev/tools/performance-toolkit/fixtures/eav_variations.php
index 1b5ce595984b016e6743d6ee03ebb8acc9b2b890..0dd001ff26aaea8630d117e5d3a5534f808c035e 100644
--- a/dev/tools/performance-toolkit/fixtures/eav_variations.php
+++ b/dev/tools/performance-toolkit/fixtures/eav_variations.php
@@ -96,3 +96,9 @@ $model->setAttributeSetId(ATTRIBUTE_SET_ID)
 
 $model->setAttributeSetId(ATTRIBUTE_SET_ID);
 $model->save();
+
+/* @var $cache \Magento\Framework\App\CacheInterface */
+$cache = $this->getObjectManager()->get('Magento\Framework\App\CacheInterface');
+
+$cacheKey = \Magento\Eav\Model\Config::ATTRIBUTES_CACHE_ID . \Magento\Catalog\Model\Product::ENTITY;
+$cache->remove($cacheKey);
diff --git a/dev/tools/performance-toolkit/fixtures/stores.php b/dev/tools/performance-toolkit/fixtures/stores.php
index 9c958b7d3631e1c175551fcd1d4f960a8f3c65a4..bc9a50c8a421aa170095ccd18a677bbea97a5f54 100644
--- a/dev/tools/performance-toolkit/fixtures/stores.php
+++ b/dev/tools/performance-toolkit/fixtures/stores.php
@@ -55,13 +55,14 @@ for ($i = 0; $i < $websitesCount; $i++) {
         $websiteId = $defaultWebsiteId;
     }
     $website = clone $defaultWebsite;
-    $websiteCode = sprintf('website_%d', $i+1);
-    $websiteName = sprintf('Website %d', $i+1);
+    $websiteCode = sprintf('website_%d', $i + 1);
+    $websiteName = sprintf('Website %d', $i + 1);
     $website->addData(
         array(
-            'website_id' => $websiteId,
-            'code'     => $websiteCode,
-            'name'     => $websiteName
+            'website_id'    => $websiteId,
+            'code'          => $websiteCode,
+            'name'          => $websiteName,
+            'is_default'    => (int)$i == 0,
         )
     );
     $website->save();
@@ -77,7 +78,7 @@ for ($i = 0; $i < $storeGroupsCount; $i++) {
     $parentCategoryId = null;
     $categoryPath = '1';
 
-    $storeGroupName = sprintf('Store Group %d - website_id_%d', $i+1, $websiteId);
+    $storeGroupName = sprintf('Store Group %d - website_id_%d', $i + 1, $websiteId);
 
     if ($i == 0 && $websiteId == $defaultWebsiteId) {
         $groupId = $defaultStoreGroupId;
@@ -124,8 +125,8 @@ for ($i = 0; $i < $storesCount; $i++) {
         $storeId = $defaultStoreViewId;
     }
     $store = clone $defaultStoreView;
-    $storeCode = sprintf('store_view_%d_w_%d_g_%d', $i+1, $websiteId, $groupId);
-    $storeName = sprintf('Store view %d - website_id_%d - group_id_%d', $i+1, $websiteId, $groupId);
+    $storeCode = sprintf('store_view_%d_w_%d_g_%d', $i + 1, $websiteId, $groupId);
+    $storeName = sprintf('Store view %d - website_id_%d - group_id_%d', $i + 1, $websiteId, $groupId);
     $store->addData(
         array(
             'store_id'      => $storeId,
diff --git a/dev/tools/performance-toolkit/framework/Magento/ToolkitFramework/Application.php b/dev/tools/performance-toolkit/framework/Magento/ToolkitFramework/Application.php
index cbaf3b9e39a7f71b1bc647bd0a8e9e8c242647e4..f9f8fa97e9646a1afae322a29383a09f6d76c535 100644
--- a/dev/tools/performance-toolkit/framework/Magento/ToolkitFramework/Application.php
+++ b/dev/tools/performance-toolkit/framework/Magento/ToolkitFramework/Application.php
@@ -34,7 +34,7 @@ class Application
     /**
      * Area code
      */
-    const AREA_CODE = 'install';
+    const AREA_CODE = 'adminhtml';
 
     /**
      * Application object
@@ -186,6 +186,7 @@ class Application
     public function resetObjectManager()
     {
         $this->_objectManager = null;
+        $this->bootstrap();
         return $this;
     }
 }
diff --git a/dev/tools/performance-toolkit/framework/labels.xml b/dev/tools/performance-toolkit/framework/labels.xml
index 6aa5360ebb6ec50fc7a76a86ed54e75960fc1fba..585a2782c969cbc6977c621d938d7ea4b1ad4523 100644
--- a/dev/tools/performance-toolkit/framework/labels.xml
+++ b/dev/tools/performance-toolkit/framework/labels.xml
@@ -33,6 +33,6 @@
         <categories>Categories</categories>
         <catalog_price_rules>Catalog Price Rules</catalog_price_rules>
         <cart_price_rules>Cart Price Rules</cart_price_rules>
-        <customers>Regitered Customers</customers>
+        <customers>Registered Customers</customers>
     </labels>
 </config>
diff --git a/lib/internal/Magento/Framework/Api/AbstractExtensibleObject.php b/lib/internal/Magento/Framework/Api/AbstractExtensibleObject.php
index 6281d9a64250fa55a8862266b0940c577cdb2417..ffff1e55e19d7bb4e8601bc7a09241bf9587d34f 100644
--- a/lib/internal/Magento/Framework/Api/AbstractExtensibleObject.php
+++ b/lib/internal/Magento/Framework/Api/AbstractExtensibleObject.php
@@ -40,23 +40,23 @@ abstract class AbstractExtensibleObject extends AbstractSimpleObject implements
      * Get an attribute value.
      *
      * @param string $attributeCode
-     * @return \Magento\Framework\Api\AttributeValue|null null if the attribute has not been set
+     * @return \Magento\Framework\Api\AttributeInterface|null null if the attribute has not been set
      */
     public function getCustomAttribute($attributeCode)
     {
-        return isset($this->_data[self::CUSTOM_ATTRIBUTES_KEY])
-            && isset($this->_data[self::CUSTOM_ATTRIBUTES_KEY][$attributeCode])
-                ? $this->_data[self::CUSTOM_ATTRIBUTES_KEY][$attributeCode]
+        return isset($this->_data[self::CUSTOM_ATTRIBUTES])
+            && isset($this->_data[self::CUSTOM_ATTRIBUTES][$attributeCode])
+                ? $this->_data[self::CUSTOM_ATTRIBUTES][$attributeCode]
                 : null;
     }
 
     /**
      * Retrieve custom attributes values.
      *
-     * @return \Magento\Framework\Api\AttributeValue[]|null
+     * @return \Magento\Framework\Api\AttributeInterface[]|null
      */
     public function getCustomAttributes()
     {
-        return isset($this->_data[self::CUSTOM_ATTRIBUTES_KEY]) ? $this->_data[self::CUSTOM_ATTRIBUTES_KEY] : array();
+        return isset($this->_data[self::CUSTOM_ATTRIBUTES]) ? $this->_data[self::CUSTOM_ATTRIBUTES] : [];
     }
 }
diff --git a/lib/internal/Magento/Framework/Api/AbstractSearchResultsBuilder.php b/lib/internal/Magento/Framework/Api/AbstractSearchResultsBuilder.php
index bb6c00ef7b8b1c0b6dbb37a26b999ae1186e42f9..bf6dea476f8f154dfe4e2636f3583239076de2c5 100644
--- a/lib/internal/Magento/Framework/Api/AbstractSearchResultsBuilder.php
+++ b/lib/internal/Magento/Framework/Api/AbstractSearchResultsBuilder.php
@@ -24,11 +24,6 @@
 
 namespace Magento\Framework\Api;
 
-use Magento\Framework\Api\ExtensibleObjectBuilder;
-use Magento\Framework\Api\AttributeValueBuilder;
-use Magento\Framework\Api\MetadataServiceInterface;
-use Magento\Framework\Api\ObjectFactory;
-
 /**
  * Builder for the SearchResults Service Data Object
  *
@@ -46,7 +41,7 @@ abstract class AbstractSearchResultsBuilder extends ExtensibleObjectBuilder
     /**
      * Item data object builder
      *
-     * @var ExtensibleObjectBuilder $itemObjectBuilder
+     * @var BuilderInterface $itemObjectBuilder
      */
     protected $itemObjectBuilder;
 
@@ -54,17 +49,17 @@ abstract class AbstractSearchResultsBuilder extends ExtensibleObjectBuilder
      * Constructor
      *
      * @param ObjectFactory $objectFactory
-     * @param AttributeValueBuilder $valueBuilder
+     * @param AttributeDataBuilder $valueBuilder
      * @param MetadataServiceInterface $metadataService
      * @param SearchCriteriaBuilder $searchCriteriaBuilder
-     * @param ExtensibleObjectBuilder $itemObjectBuilder
+     * @param BuilderInterface $itemObjectBuilder
      */
     public function __construct(
         ObjectFactory $objectFactory,
-        AttributeValueBuilder $valueBuilder,
+        AttributeDataBuilder $valueBuilder,
         MetadataServiceInterface $metadataService,
         SearchCriteriaBuilder $searchCriteriaBuilder,
-        ExtensibleObjectBuilder $itemObjectBuilder
+        BuilderInterface $itemObjectBuilder
     ) {
         parent::__construct($objectFactory, $valueBuilder, $metadataService);
         $this->searchCriteriaBuilder = $searchCriteriaBuilder;
diff --git a/lib/internal/Magento/Framework/Api/AbstractSimpleObject.php b/lib/internal/Magento/Framework/Api/AbstractSimpleObject.php
index 5910f4db1cef4a0dedaa8996c18faf23cc3e1e41..d34e48b4e190fe9f59f1ddbe9948eaf4c0a03533 100644
--- a/lib/internal/Magento/Framework/Api/AbstractSimpleObject.php
+++ b/lib/internal/Magento/Framework/Api/AbstractSimpleObject.php
@@ -37,9 +37,9 @@ abstract class AbstractSimpleObject
     /**
      * Initialize internal storage
      *
-     * @param AbstractSimpleObjectBuilder $builder
+     * @param SimpleBuilderInterface $builder
      */
-    public function __construct(AbstractSimpleObjectBuilder $builder)
+    public function __construct(SimpleBuilderInterface $builder)
     {
         $this->_data = $builder->getData();
     }
diff --git a/lib/internal/Magento/Framework/Api/AbstractSimpleObjectBuilder.php b/lib/internal/Magento/Framework/Api/AbstractSimpleObjectBuilder.php
index 1b025c16317d75768d357a120b3a7c7c4948b806..1ea3f9428d2db5869a636551470ce5f9fb9f0630 100644
--- a/lib/internal/Magento/Framework/Api/AbstractSimpleObjectBuilder.php
+++ b/lib/internal/Magento/Framework/Api/AbstractSimpleObjectBuilder.php
@@ -27,7 +27,7 @@ namespace Magento\Framework\Api;
  * Base Builder Class for simple data Objects
  * @SuppressWarnings(PHPMD.NumberOfChildren)
  */
-abstract class AbstractSimpleObjectBuilder
+abstract class AbstractSimpleObjectBuilder implements SimpleBuilderInterface
 {
     /**
      * @var array
@@ -48,37 +48,6 @@ abstract class AbstractSimpleObjectBuilder
         $this->objectFactory = $objectFactory;
     }
 
-    /**
-     * Populates the fields with an existing entity.
-     *
-     * @param AbstractSimpleObject $prototype the prototype to base on
-     * @return $this
-     * @throws \LogicException If $prototype object class is not the same type as object that is constructed
-     */
-    public function populate(AbstractSimpleObject $prototype)
-    {
-        $objectType = $this->_getDataObjectType();
-        if (!($prototype instanceof $objectType)) {
-            throw new \LogicException('Wrong prototype object given. It can only be of "' . $objectType . '" type.');
-        }
-        return $this->populateWithArray($prototype->__toArray());
-    }
-
-    /**
-     * Populates the fields with data from the array.
-     *
-     * Keys for the map are snake_case attribute/field names.
-     *
-     * @param array $data
-     * @return $this
-     */
-    public function populateWithArray(array $data)
-    {
-        $this->data = array();
-        $this->_setDataValues($data);
-        return $this;
-    }
-
     /**
      * Initializes Data Object with the data from array
      *
@@ -101,46 +70,6 @@ abstract class AbstractSimpleObjectBuilder
         return $this;
     }
 
-    /**
-     * Merge second Data Object data with first Data Object data and create new Data Object object based on merge
-     * result.
-     *
-     * @param AbstractSimpleObject $firstDataObject
-     * @param AbstractSimpleObject $secondDataObject
-     * @return AbstractSimpleObject
-     * @throws \LogicException
-     */
-    public function mergeDataObjects(AbstractSimpleObject $firstDataObject, AbstractSimpleObject $secondDataObject)
-    {
-        $objectType = $this->_getDataObjectType();
-        if (get_class($firstDataObject) != $objectType || get_class($secondDataObject) != $objectType) {
-            throw new \LogicException('Wrong prototype object given. It can only be of "' . $objectType . '" type.');
-        }
-        $this->_setDataValues($firstDataObject->__toArray());
-        $this->_setDataValues($secondDataObject->__toArray());
-        return $this->create();
-    }
-
-    /**
-     * Merged data provided in array format with Data Object data and create new Data Object object based on merge
-     * result.
-     *
-     * @param AbstractSimpleObject $dataObject
-     * @param array $data
-     * @return AbstractSimpleObject
-     * @throws \LogicException
-     */
-    public function mergeDataObjectWithArray(AbstractSimpleObject $dataObject, array $data)
-    {
-        $objectType = $this->_getDataObjectType();
-        if (!($dataObject instanceof $objectType)) {
-            throw new \LogicException('Wrong prototype object given. It can only be of "' . $objectType . '" type.');
-        }
-        $this->_setDataValues($dataObject->__toArray());
-        $this->_setDataValues($data);
-        return $this->create();
-    }
-
     /**
      * Builds the Data Object
      *
diff --git a/lib/internal/Magento/Framework/Api/AttributeDataBuilder.php b/lib/internal/Magento/Framework/Api/AttributeDataBuilder.php
index 11bb7df963907ee83717a1fccc1141454da9c2ac..1acde51103007ccb08006a322780da2c63ff302d 100644
--- a/lib/internal/Magento/Framework/Api/AttributeDataBuilder.php
+++ b/lib/internal/Magento/Framework/Api/AttributeDataBuilder.php
@@ -26,7 +26,7 @@ namespace Magento\Framework\Api;
 /**
  * Custom Attribute Data object builder
  */
-class AttributeDataBuilder extends CompositeExtensibleDataBuilder
+class AttributeDataBuilder extends AbstractSimpleObjectBuilder
 {
     /**
      * Set attribute code
@@ -36,7 +36,7 @@ class AttributeDataBuilder extends CompositeExtensibleDataBuilder
      */
     public function setAttributeCode($attributeCode)
     {
-        return $this->set(AttributeInterface::ATTRIBUTE_CODE, $attributeCode);
+        return $this->_set(AttributeValue::ATTRIBUTE_CODE, $attributeCode);
     }
 
     /**
@@ -47,26 +47,16 @@ class AttributeDataBuilder extends CompositeExtensibleDataBuilder
      */
     public function setValue($value)
     {
-        return $this->set(AttributeInterface::VALUE, $value);
+        return $this->_set(AttributeValue::VALUE, $value);
     }
 
     /**
-     * Initialize the builder
+     * Return the Data type class name
      *
-     * @param \Magento\Framework\ObjectManager $objectManager
-     * @param \Magento\Framework\Api\MetadataServiceInterface $metadataService
-     * @param \Magento\Framework\ObjectManager\Config $objectManagerConfig
+     * @return string
      */
-    public function __construct(
-        \Magento\Framework\ObjectManager $objectManager,
-        \Magento\Framework\Api\MetadataServiceInterface $metadataService,
-        \Magento\Framework\ObjectManager\Config $objectManagerConfig
-    ) {
-        parent::__construct(
-            $objectManager,
-            $metadataService,
-            $objectManagerConfig,
-            'Magento\Framework\Api\AttributeInterface'
-        );
+    protected function _getDataObjectType()
+    {
+        return '\Magento\Framework\Api\AttributeValue';
     }
 }
diff --git a/lib/internal/Magento/Framework/Api/AttributeValue.php b/lib/internal/Magento/Framework/Api/AttributeValue.php
index d2c957125684aeb06d393108d47b489a5e2c7cfb..a7a2f0e868407ba2709af568e22fb48a0304af22 100644
--- a/lib/internal/Magento/Framework/Api/AttributeValue.php
+++ b/lib/internal/Magento/Framework/Api/AttributeValue.php
@@ -24,13 +24,22 @@
 
 namespace Magento\Framework\Api;
 
-use Magento\Framework\Api\AttributeInterface;
-
 /**
  * Custom Attribute Data object
  */
 class AttributeValue extends AbstractSimpleObject implements AttributeInterface
 {
+
+    /**
+     * Initialize internal storage
+     *
+     * @param AttributeDataBuilder $builder
+     */
+    public function __construct(AttributeDataBuilder $builder)
+    {
+        $this->_data = $builder->getData();
+    }
+
     /**
      * Get attribute code
      *
diff --git a/lib/internal/Magento/Framework/Api/ExtensibleDataBuilder.php b/lib/internal/Magento/Framework/Api/Builder.php
similarity index 50%
rename from lib/internal/Magento/Framework/Api/ExtensibleDataBuilder.php
rename to lib/internal/Magento/Framework/Api/Builder.php
index 229e95ee06c3e6c6971136f324fd52c323677512..3d77405ca30ee62b8206ec4028fb48b46538f438 100644
--- a/lib/internal/Magento/Framework/Api/ExtensibleDataBuilder.php
+++ b/lib/internal/Magento/Framework/Api/Builder.php
@@ -24,15 +24,18 @@
 
 namespace Magento\Framework\Api;
 
-use Magento\Framework\Api\ExtensibleDataBuilderInterface;
-use Magento\Framework\Model\AbstractExtensibleModel;
-use Magento\Framework\ObjectManager;
-
 /**
- * Implementation for \Magento\Framework\Api\ExtensibleDataBuilderInterface.
+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
  */
-class ExtensibleDataBuilder implements ExtensibleDataBuilderInterface
+class Builder implements BuilderInterface
 {
+    /**#@+
+     * Constant which defines if builder is created for building data objects or data models.
+     */
+    const TYPE_DATA_OBJECT = 'data_object';
+    const TYPE_DATA_MODEL = 'data_model';
+    /**#@-*/
+
     /**
      * @var string
      */
@@ -44,9 +47,9 @@ class ExtensibleDataBuilder implements ExtensibleDataBuilderInterface
     protected $data;
 
     /**
-     * @var ObjectManager
+     * @var ObjectFactory
      */
-    protected $objectManager;
+    protected $objectFactory;
 
     /**
      * @var MetadataServiceInterface
@@ -84,32 +87,38 @@ class ExtensibleDataBuilder implements ExtensibleDataBuilderInterface
     protected $dataBuilderFactory;
 
     /**
-     * Initialize the builder
-     *
-     * @param ObjectManager $objectManager
+     * @var \Magento\Framework\ObjectManager\Config
+     */
+    protected $objectManagerConfig;
+
+    /**
+     * @param ObjectFactory $objectFactory
      * @param MetadataServiceInterface $metadataService
-     * @param \Magento\Framework\Api\AttributeDataBuilder $attributeValueBuilder
+     * @param AttributeDataBuilder $attributeValueBuilder
      * @param \Magento\Framework\Reflection\DataObjectProcessor $objectProcessor
      * @param \Magento\Framework\Reflection\TypeProcessor $typeProcessor
      * @param \Magento\Framework\Serialization\DataBuilderFactory $dataBuilderFactory
+     * @param \Magento\Framework\ObjectManager\Config $objectManagerConfig
      * @param string $modelClassInterface
      */
     public function __construct(
-        ObjectManager $objectManager,
+        ObjectFactory $objectFactory,
         MetadataServiceInterface $metadataService,
         \Magento\Framework\Api\AttributeDataBuilder $attributeValueBuilder,
         \Magento\Framework\Reflection\DataObjectProcessor $objectProcessor,
         \Magento\Framework\Reflection\TypeProcessor $typeProcessor,
         \Magento\Framework\Serialization\DataBuilderFactory $dataBuilderFactory,
-        $modelClassInterface
+        \Magento\Framework\ObjectManager\Config $objectManagerConfig,
+        $modelClassInterface = null
     ) {
-        $this->objectManager = $objectManager;
+        $this->objectFactory = $objectFactory;
         $this->metadataService = $metadataService;
         $this->modelClassInterface = $modelClassInterface;
         $this->objectProcessor = $objectProcessor;
         $this->attributeValueBuilder = $attributeValueBuilder;
         $this->typeProcessor = $typeProcessor;
         $this->dataBuilderFactory = $dataBuilderFactory;
+        $this->objectManagerConfig = $objectManagerConfig;
     }
 
     /**
@@ -117,12 +126,15 @@ class ExtensibleDataBuilder implements ExtensibleDataBuilderInterface
      */
     public function setCustomAttribute($attributeCode, $attributeValue)
     {
-        $attribute = $this->attributeValueBuilder
-            ->setAttributeCode($attributeCode)
-            ->setValue($attributeValue)
-            ->create();
-        // Store as an associative array for easier lookup and processing
-        $this->data[AbstractExtensibleModel::CUSTOM_ATTRIBUTES_KEY][$attributeCode] = $attribute;
+        $customAttributesCodes = $this->getCustomAttributesCodes();
+        if (in_array($attributeCode, $customAttributesCodes)) {
+            $attribute = $this->attributeValueBuilder
+                ->setAttributeCode($attributeCode)
+                ->setValue($attributeValue)
+                ->create();
+            //Stores as an associative array for easier lookup and processing
+            $this->data[ExtensibleDataInterface::CUSTOM_ATTRIBUTES][$attributeCode] = $attribute;
+        }
         return $this;
     }
 
@@ -131,9 +143,16 @@ class ExtensibleDataBuilder implements ExtensibleDataBuilderInterface
      */
     public function setCustomAttributes(array $attributes)
     {
+        $customAttributesCodes = $this->getCustomAttributesCodes();
         /** @var \Magento\Framework\Api\AttributeInterface $attribute */
         foreach ($attributes as $attribute) {
-            $this->data[AbstractExtensibleModel::CUSTOM_ATTRIBUTES_KEY][$attribute->getAttributeCode()] = $attribute;
+            if (!$attribute instanceof AttributeValue) {
+                throw new \LogicException('Custom Attribute array elements can only be type of AttributeValue');
+            }
+            $attributeCode = $attribute->getAttributeCode();
+            if (in_array($attributeCode, $customAttributesCodes)) {
+                $this->data[AbstractExtensibleObject::CUSTOM_ATTRIBUTES_KEY][$attributeCode] = $attribute;
+            }
         }
         return $this;
     }
@@ -143,19 +162,24 @@ class ExtensibleDataBuilder implements ExtensibleDataBuilderInterface
      */
     public function create()
     {
-        return $this->objectManager->create(
-            $this->modelClassInterface,
-            ['data' => $this->data]
-        );
+        if ($this->getDataType() == self::TYPE_DATA_MODEL) {
+            $dataObject = $this->objectFactory->create(
+                $this->_getDataObjectType(),
+                ['data' => $this->data]
+            );
+        } else {
+            $dataObjectType = $this->_getDataObjectType();
+            $dataObject = $this->objectFactory->create(
+                $dataObjectType,
+                ['builder' => $this]
+            );
+        }
+        $this->data = array();
+        return $dataObject;
     }
 
     /**
-     * Populates the fields with data from the array.
-     *
-     * Keys for the map are snake_case attribute/field names.
-     *
-     * @param array $data
-     * @return $this
+     * {@inheritdoc}
      */
     public function populateWithArray(array $data)
     {
@@ -164,6 +188,106 @@ class ExtensibleDataBuilder implements ExtensibleDataBuilderInterface
         return $this;
     }
 
+    /**
+     * {@inheritdoc}
+     */
+    public function populate(ExtensibleDataInterface $prototype)
+    {
+        $objectType = $this->_getDataObjectType();
+        if (!($prototype instanceof $objectType)) {
+            throw new \LogicException('Wrong prototype object given. It can only be of "' . $objectType . '" type.');
+        }
+        $prototypeArray = $this->objectProcessor->buildOutputDataArray($prototype, $objectType);
+        return $this->populateWithArray($prototypeArray);
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function mergeDataObjects(
+        ExtensibleDataInterface $firstDataObject,
+        ExtensibleDataInterface $secondDataObject
+    ) {
+        $objectType = $this->_getDataObjectType();
+        if (get_class($firstDataObject) != $objectType || get_class($secondDataObject) != $objectType) {
+            throw new \LogicException('Wrong prototype object given. It can only be of "' . $objectType . '" type.');
+        }
+        $firstObjectArray = $this->objectProcessor->buildOutputDataArray($firstDataObject, $objectType);
+        $secondObjectArray = $this->objectProcessor->buildOutputDataArray($secondDataObject, $objectType);
+        $this->_setDataValues($firstObjectArray);
+        $this->_setDataValues($secondObjectArray);
+        return $this;
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function mergeDataObjectWithArray(ExtensibleDataInterface $dataObject, array $data)
+    {
+        $objectType = $this->_getDataObjectType();
+        if (!($dataObject instanceof $objectType)) {
+            throw new \LogicException('Wrong prototype object given. It can only be of "' . $objectType . '" type.');
+        }
+        $dataArray = $this->objectProcessor->buildOutputDataArray($dataObject, $objectType);
+        $this->_setDataValues($dataArray);
+        $this->_setDataValues($data);
+        return $this;
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function getData()
+    {
+        return $this->data;
+    }
+
+    /**
+     * @param string $key
+     * @param mixed $value
+     *
+     * @return $this
+     */
+    protected function _set($key, $value)
+    {
+        $this->data[$key] = $value;
+        return $this;
+    }
+
+    /**
+     * Identify type of objects which should be built with generated builder. Value can be one of self::TYPE_DATA_*.
+     *
+     * @return string
+     * @throws \LogicException
+     */
+    protected function getDataType()
+    {
+        $dataType = $this->_getDataObjectType();
+        if (is_subclass_of($dataType, '\Magento\Framework\Api\AbstractSimpleObject')) {
+            return self::TYPE_DATA_OBJECT;
+        } else if (is_subclass_of($dataType, '\Magento\Framework\Model\AbstractExtensibleModel')) {
+            return self::TYPE_DATA_MODEL;
+        }
+
+        $sourceClassPreference = $this->objectManagerConfig->getPreference($dataType);
+        if (empty($sourceClassPreference)) {
+            throw new \LogicException(
+                "Preference for {$this->_getDataObjectType()} is not defined."
+            );
+        }
+
+        if (is_subclass_of($sourceClassPreference, '\Magento\Framework\Api\AbstractSimpleObject')) {
+            return self::TYPE_DATA_OBJECT;
+        } else if (is_subclass_of($sourceClassPreference, '\Magento\Framework\Model\AbstractExtensibleModel')) {
+            return self::TYPE_DATA_MODEL;
+        } else {
+            throw new \LogicException(
+                'Preference of ' . $this->_getDataObjectType()
+                . ' must extend from AbstractSimpleObject or AbstractExtensibleModel'
+            );
+        }
+    }
+
     /**
      * Template method used to configure the attribute codes for the custom attributes
      *
@@ -177,7 +301,7 @@ class ExtensibleDataBuilder implements ExtensibleDataBuilderInterface
         $attributeCodes = [];
         /** @var \Magento\Framework\Api\MetadataObjectInterface[] $customAttributesMetadata */
         $customAttributesMetadata = $this->metadataService
-            ->getCustomAttributesMetadata($this->modelClassInterface);
+            ->getCustomAttributesMetadata($this->_getDataObjectType());
         if (is_array($customAttributesMetadata)) {
             foreach ($customAttributesMetadata as $attribute) {
                 $attributeCodes[] = $attribute->getAttributeCode();
@@ -187,20 +311,6 @@ class ExtensibleDataBuilder implements ExtensibleDataBuilderInterface
         return $attributeCodes;
     }
 
-    /**
-     * Set data item value.
-     *
-     * @param string $key
-     * @param mixed $value
-     * @return $this
-     * @deprecated This method should not be used in the client code and will be removed after Service Layer refactoring
-     */
-    public function set($key, $value)
-    {
-        $this->data[$key] = $value;
-        return $this;
-    }
-
     /**
      * Initializes Data Object with the data from array
      *
@@ -209,7 +319,7 @@ class ExtensibleDataBuilder implements ExtensibleDataBuilderInterface
      */
     protected function _setDataValues(array $data)
     {
-        $dataObjectMethods = get_class_methods($this->modelClassInterface);
+        $dataObjectMethods = get_class_methods($this->_getDataObjectType());
         foreach ($data as $key => $value) {
             /* First, verify is there any getter for the key on the Service Data Object */
             $camelCaseKey = \Magento\Framework\Api\SimpleDataObjectConverter::snakeCaseToUpperCamelCase($key);
@@ -217,14 +327,14 @@ class ExtensibleDataBuilder implements ExtensibleDataBuilderInterface
                 'get' . $camelCaseKey,
                 'is' . $camelCaseKey
             );
-            if ($key == AbstractExtensibleObject::CUSTOM_ATTRIBUTES_KEY
+            if ($key === ExtensibleDataInterface::CUSTOM_ATTRIBUTES
                 && is_array($data[$key])
                 && !empty($data[$key])
             ) {
                 foreach ($data[$key] as $customAttribute) {
                     $this->setCustomAttribute(
-                        $customAttribute[AttributeValue::ATTRIBUTE_CODE],
-                        $customAttribute[AttributeValue::VALUE]
+                        $customAttribute[AttributeInterface::ATTRIBUTE_CODE],
+                        $customAttribute[AttributeInterface::VALUE]
                     );
                 }
             } elseif ($methodName = array_intersect($possibleMethods, $dataObjectMethods)) {
@@ -249,7 +359,7 @@ class ExtensibleDataBuilder implements ExtensibleDataBuilderInterface
      */
     protected function setComplexValue($methodName, $key, array $value)
     {
-        $returnType = $this->objectProcessor->getMethodReturnType($this->modelClassInterface, $methodName);
+        $returnType = $this->objectProcessor->getMethodReturnType($this->_getDataObjectType(), $methodName);
         if ($this->typeProcessor->isTypeSimple($returnType)) {
             $this->data[$key] = $value;
             return $this;
@@ -273,4 +383,25 @@ class ExtensibleDataBuilder implements ExtensibleDataBuilderInterface
         $this->data[$key] = $object;
         return $this;
     }
+
+    /**
+     * Get data object type based on suffix
+     *
+     * @return string
+     */
+    protected function _getDataObjectType()
+    {
+        if ($this->modelClassInterface) {
+            return $this->modelClassInterface;
+        }
+        $currentClass = get_class($this);
+        $dataBuilderSuffix = 'DataBuilder';
+        if (substr($currentClass, -strlen($dataBuilderSuffix)) === $dataBuilderSuffix) {
+            $dataObjectType = substr($currentClass, 0, -strlen($dataBuilderSuffix)) . 'Interface';
+        } else {
+            $builderSuffix = 'Builder';
+            $dataObjectType = substr($currentClass, 0, -strlen($builderSuffix));
+        }
+        return $dataObjectType;
+    }
 }
diff --git a/lib/internal/Magento/Framework/Api/ExtensibleDataBuilderInterface.php b/lib/internal/Magento/Framework/Api/BuilderInterface.php
similarity index 60%
rename from lib/internal/Magento/Framework/Api/ExtensibleDataBuilderInterface.php
rename to lib/internal/Magento/Framework/Api/BuilderInterface.php
index d7de617e06e5f3fa9054e6e526dea214b101ef2b..58f730c640443659ce1f8a70d1fc374dbdf18aa3 100644
--- a/lib/internal/Magento/Framework/Api/ExtensibleDataBuilderInterface.php
+++ b/lib/internal/Magento/Framework/Api/BuilderInterface.php
@@ -24,10 +24,7 @@
 
 namespace Magento\Framework\Api;
 
-/**
- * Base builder interface for \Magento\Framework\Api\ExtensibleDataInterface types.
- */
-interface ExtensibleDataBuilderInterface
+interface BuilderInterface extends SimpleBuilderInterface
 {
     /**
      * Set custom attribute value.
@@ -48,7 +45,7 @@ interface ExtensibleDataBuilderInterface
     public function setCustomAttributes(array $attributes);
 
     /**
-     * Return created DataInterface object
+     * Return created ExtensibleDataInterface object
      *
      * @return \Magento\Framework\Api\ExtensibleDataInterface
      */
@@ -63,4 +60,36 @@ interface ExtensibleDataBuilderInterface
      * @return $this
      */
     public function populateWithArray(array $data);
+
+    /**
+     * Populates the fields with an existing entity.
+     *
+     * @param ExtensibleDataInterface $prototype the prototype to base on
+     * @return $this
+     * @throws \LogicException If $prototype object class is not the same type as object that is constructed
+     */
+    public function populate(ExtensibleDataInterface $prototype);
+
+    /**
+     * Populate builder with the two data interfaces, merging them
+     *
+     * @param ExtensibleDataInterface $firstDataObject
+     * @param ExtensibleDataInterface $secondDataObject
+     * @return $this
+     * @throws \LogicException
+     */
+    public function mergeDataObjects(
+        ExtensibleDataInterface $firstDataObject,
+        ExtensibleDataInterface $secondDataObject
+    );
+
+    /**
+     * Populate builder with the data interface and array, merging them
+     *
+     * @param ExtensibleDataInterface $dataObject
+     * @param array $data
+     * @return $this
+     * @throws \LogicException
+     */
+    public function mergeDataObjectWithArray(ExtensibleDataInterface $dataObject, array $data);
 }
diff --git a/lib/internal/Magento/Framework/Api/Code/Generator/Builder.php b/lib/internal/Magento/Framework/Api/Code/Generator/Builder.php
deleted file mode 100644
index 76928c8432c72ffc2199b3a4209928939276b402..0000000000000000000000000000000000000000
--- a/lib/internal/Magento/Framework/Api/Code/Generator/Builder.php
+++ /dev/null
@@ -1,158 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category    Magento
- * @package     Magento_Code
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-namespace Magento\Framework\Api\Code\Generator;
-
-use Magento\Framework\Code\Generator\EntityAbstract;
-
-/**
- * Class Builder
- *
- * @deprecated Use DataBuilder instead
- */
-class Builder extends EntityAbstract
-{
-    /**
-     * Entity type
-     */
-    const ENTITY_TYPE = 'builder';
-
-    /**
-     * Retrieve class properties
-     *
-     * @return array
-     */
-    protected function _getClassProperties()
-    {
-        return [];
-    }
-
-    /**
-     * Get default constructor definition for generated class
-     *
-     * @return array
-     */
-    protected function _getDefaultConstructorDefinition()
-    {
-        return [];
-    }
-
-    /**
-     * Return a list of methods for class generator
-     *
-     * @return array
-     */
-    protected function _getClassMethods()
-    {
-        $methods = [];
-        $reflectionClass = new \ReflectionClass($this->_getSourceClassName());
-        $publicMethods = $reflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC);
-        foreach ($publicMethods as $method) {
-            if (!($method->isConstructor() ||
-                    $method->isFinal() ||
-                    $method->isStatic() ||
-                    $method->isDestructor()) &&
-                !in_array(
-                    $method->getName(),
-                    array('__sleep', '__wakeup', '__clone')
-                ) &&
-                $method->class !== 'Magento\Framework\Api\AbstractExtensibleObject'
-            ) {
-                if (substr($method->getName(), 0, 3) == 'get') {
-                    $methods[] = $this->_getMethodInfo($reflectionClass, $method);
-                }
-
-            }
-        }
-        return $methods;
-    }
-
-    /**
-     * Retrieve method info
-     *
-     * @param \ReflectionClass $class
-     * @param \ReflectionMethod $method
-     * @return array
-     */
-    protected function _getMethodInfo(\ReflectionClass $class, \ReflectionMethod $method)
-    {
-        $methodInfo = [
-            'name' => 'set' . substr($method->getName(), 3),
-            'parameters' => [
-                ['name' => lcfirst(substr($method->getName(), 3))]
-            ],
-            'body' => "return \$this->_set("
-                . '\\' . $class->getName() . "::"
-                . strtoupper(preg_replace('/(.)([A-Z])/', "$1_$2", substr($method->getName(), 3)))
-                . ", \$" . lcfirst(substr($method->getName(), 3)) . ");",
-            'docblock' => array('shortDescription' => '{@inheritdoc}')
-        ];
-
-        return $methodInfo;
-    }
-
-    /**
-     * Validate data
-     *
-     * @return bool
-     */
-    protected function _validateData()
-    {
-        $result = parent::_validateData();
-
-        if ($result) {
-            $sourceClassName = $this->_getSourceClassName();
-            $resultClassName = $this->_getResultClassName();
-
-            if ($resultClassName !== $sourceClassName . 'Builder') {
-                $this->_addError(
-                    'Invalid Builder class name [' . $resultClassName . ']. Use ' . $sourceClassName . 'Builder'
-                );
-                $result = false;
-            }
-        }
-        return $result;
-    }
-
-    /**
-     * Generate code
-     *
-     * @return string
-     */
-    protected function _generateCode()
-    {
-        $this->_classGenerator->setName(
-            $this->_getResultClassName()
-        )->addProperties(
-            $this->_getClassProperties()
-        )->addMethods(
-            $this->_getClassMethods()
-        )->setClassDocBlock(
-            $this->_getClassDocBlock()
-        )->setExtendedClass('\\Magento\Framework\Api\ExtensibleObjectBuilder');
-
-        return $this->_getGeneratedCode();
-    }
-}
diff --git a/lib/internal/Magento/Framework/Api/Code/Generator/DataBuilder.php b/lib/internal/Magento/Framework/Api/Code/Generator/DataBuilder.php
index 2bb68f6c98ccb29b3b521a3e405aff52ae51f286..1dcb973cbd191d69f144af813f07892898f7a99f 100644
--- a/lib/internal/Magento/Framework/Api/Code/Generator/DataBuilder.php
+++ b/lib/internal/Magento/Framework/Api/Code/Generator/DataBuilder.php
@@ -37,10 +37,15 @@ use Zend\Code\Reflection\ClassReflection;
 class DataBuilder extends EntityAbstract
 {
     /**
-     * Entity type
+     * Builder Entity, used for a builders built based on Data Objects
      */
     const ENTITY_TYPE = 'dataBuilder';
 
+    /**
+     * Builder Entity, used for a builders built based on API interfaces
+     */
+    const ENTITY_TYPE_BUILDER = 'builder';
+
     /**
      * Data Model property name
      */
@@ -102,30 +107,60 @@ class DataBuilder extends EntityAbstract
     protected function _getDefaultConstructorDefinition()
     {
         $constructorDefinition = [
-            'name' => '__construct',
-            'parameters' => [
-                ['name' => 'objectManager', 'type' => '\Magento\Framework\ObjectManager'],
-                ['name' => 'metadataService', 'type' => '\Magento\Framework\Api\MetadataServiceInterface'],
-                ['name' => 'objectManagerConfig', 'type' => '\Magento\Framework\ObjectManager\Config'],
-            ],
-            'docblock' => [
-                'shortDescription' => 'Initialize the builder',
-                'tags' => [
-                    [
-                        'name' => 'param',
-                        'description' => '\Magento\Framework\ObjectManager $objectManager'
-                    ],
+                'name' => '__construct',
+                'parameters' => [
+                    ['name' => 'objectFactory', 'type' => '\Magento\Framework\Api\ObjectFactory'],
+                    ['name' => 'metadataService', 'type' => '\Magento\Framework\Api\MetadataServiceInterface'],
+                    ['name' => 'attributeValueBuilder', 'type' => '\Magento\Framework\Api\AttributeDataBuilder'],
+                    ['name' => 'objectProcessor', 'type' => '\Magento\Framework\Reflection\DataObjectProcessor'],
+                    ['name' => 'typeProcessor', 'type' => '\Magento\Framework\Reflection\TypeProcessor'],
+                    ['name' => 'dataBuilderFactory', 'type' => '\Magento\Framework\Serialization\DataBuilderFactory'],
+                    ['name' => 'objectManagerConfig', 'type' => '\Magento\Framework\ObjectManager\Config'],
                     [
-                        'name' => 'param',
-                        'description' => '\Magento\Framework\Api\MetadataServiceInterface $metadataService'
-                    ],
-                    [
-                        'name' => 'param',
-                        'description' => '\Magento\Framework\ObjectManager\Config $objectManagerConfig'
+                        'name' => 'modelClassInterface',
+                        'type' => 'string',
+                        'defaultValue' => $this->_getNullDefaultValue()
                     ]
-                ]
-            ],
-            'body' => "parent::__construct(\$objectManager, \$metadataService, \$objectManagerConfig, "
+                ],
+                'docblock' => [
+                    'shortDescription' => 'Initialize the builder',
+                    'tags' => [
+                        [
+                            'name' => 'param',
+                            'description' => '\Magento\Framework\Api\ObjectFactory $objectFactory'
+                        ],
+                        [
+                            'name' => 'param',
+                            'description' => '\Magento\Framework\Api\MetadataServiceInterface $metadataService'
+                        ],
+                        [
+                            'name' => 'param',
+                            'description' => '\Magento\Framework\Api\AttributeDataBuilder $attributeValueBuilder'
+                        ],
+                        [
+                            'name' => 'param',
+                            'description' => '\Magento\Framework\Reflection\DataObjectProcessor $objectProcessor'
+                        ],
+                        [
+                            'name' => 'param',
+                            'description' => '\Magento\Framework\Reflection\TypeProcessor $typeProcessor'
+                        ],
+                        [
+                            'name' => 'param',
+                            'description' => '\Magento\Framework\Serialization\DataBuilderFactory $dataBuilderFactory'
+                        ],
+                        [
+                            'name' => 'param',
+                            'description' => '\Magento\Framework\ObjectManager\Config $objectManagerConfig'
+                        ],
+                        [
+                            'name' => 'param',
+                            'description' => 'string|null $modelClassInterface'
+                        ]
+                    ]
+                ],
+            'body' => "parent::__construct(\$objectFactory, \$metadataService, \$attributeValueBuilder, "
+                . "\$objectProcessor, \$typeProcessor, \$dataBuilderFactory, \$objectManagerConfig, "
                 . "'{$this->_getSourceClassName()}');"
         ];
         return $constructorDefinition;
@@ -162,7 +197,7 @@ class DataBuilder extends EntityAbstract
      */
     protected function canUseMethodForGeneration($method)
     {
-        $isGetter = (substr($method->getName(), 0, 3) == 'get');
+        $isGetter = substr($method->getName(), 0, 3) == 'get' || substr($method->getName(), 0, 2) == 'is';
         $isSuitableMethodType = !($method->isConstructor() || $method->isFinal()
             || $method->isStatic() || $method->isDestructor());
         $isMagicMethod = in_array($method->getName(), array('__sleep', '__wakeup', '__clone'));
@@ -178,7 +213,11 @@ class DataBuilder extends EntityAbstract
      */
     protected function _getMethodInfo(\ReflectionMethod $method)
     {
-        $propertyName = substr($method->getName(), 3);
+        if (substr($method->getName(), 0, 2) == 'is') {
+            $propertyName = substr($method->getName(), 2);
+        } else {
+            $propertyName = substr($method->getName(), 3);
+        }
         $returnType = (new ClassReflection($this->_getSourceClassName()))
             ->getMethod($method->getName())
             ->getDocBlock()
@@ -190,7 +229,7 @@ class DataBuilder extends EntityAbstract
             'parameters' => [
                 ['name' => lcfirst($propertyName)]
             ],
-            'body' => "\$this->set('{$fieldName}', \$" . lcfirst($propertyName) . ");"
+            'body' => "\$this->_set('{$fieldName}', \$" . lcfirst($propertyName) . ");"
                 . PHP_EOL . "return \$this;",
             'docblock' => [
                 'tags' => [
@@ -202,31 +241,6 @@ class DataBuilder extends EntityAbstract
         return $methodInfo;
     }
 
-    /**
-     * Validate data
-     *
-     * @return bool
-     */
-    protected function _validateData()
-    {
-        $result = parent::_validateData();
-
-        if ($result) {
-            $sourceClassName = $this->_getSourceClassName();
-            $resultClassName = $this->_getResultClassName();
-
-            if ($resultClassName !== str_replace('Interface', ucfirst(self::ENTITY_TYPE), $sourceClassName)) {
-                $this->_addError(
-                    'Invalid Builder class name [' . $resultClassName . ']. Use '
-                    . $sourceClassName
-                    . ucfirst(self::ENTITY_TYPE)
-                );
-                $result = false;
-            }
-        }
-        return $result;
-    }
-
     /**
      * Generate code
      *
@@ -239,7 +253,7 @@ class DataBuilder extends EntityAbstract
             ->addProperties($this->_getClassProperties())
             ->addMethods($this->_getClassMethods())
             ->setClassDocBlock($this->_getClassDocBlock())
-            ->setExtendedClass('\Magento\Framework\Api\CompositeExtensibleDataBuilder');
+            ->setExtendedClass('\Magento\Framework\Api\Builder');
         return $this->_getGeneratedCode();
     }
 
@@ -248,7 +262,25 @@ class DataBuilder extends EntityAbstract
      */
     protected function _getSourceClassName()
     {
-        return parent::_getSourceClassName() . 'Interface';
+        return $this->_getDataObjectType();
+    }
+
+    /**
+     * Get data object type based on suffix
+     *
+     * @return string
+     */
+    protected function _getDataObjectType()
+    {
+        $currentBuilderClass = $this->_getResultClassName();
+        $dataBuilderSuffix = 'DataBuilder';
+        if (substr($currentBuilderClass, -strlen($dataBuilderSuffix)) === $dataBuilderSuffix) {
+            $dataObjectType = substr($currentBuilderClass, 0, -strlen($dataBuilderSuffix)) . 'Interface';
+        } else {
+            $builderSuffix = 'Builder';
+            $dataObjectType = substr($currentBuilderClass, 0, -strlen($builderSuffix));
+        }
+        return $dataObjectType;
     }
 
     /**
diff --git a/lib/internal/Magento/Framework/Api/Code/Generator/SearchResultsBuilder.php b/lib/internal/Magento/Framework/Api/Code/Generator/SearchResultsBuilder.php
index a668fbbeb50addaee5ef7d51568f1089f468d5b8..eb97dffa6211e0af1de8d70a5f07fde043d92635 100644
--- a/lib/internal/Magento/Framework/Api/Code/Generator/SearchResultsBuilder.php
+++ b/lib/internal/Magento/Framework/Api/Code/Generator/SearchResultsBuilder.php
@@ -68,7 +68,7 @@ class SearchResultsBuilder extends EntityAbstract
                 ],
                 [
                     'name' => 'valueBuilder',
-                    'type' => '\\Magento\Framework\Api\AttributeValueBuilder'
+                    'type' => '\\Magento\Framework\Api\AttributeDataBuilder'
                 ],
                 [
                     'name' => 'metadataService',
diff --git a/lib/internal/Magento/Framework/Api/CompositeExtensibleDataBuilder.php b/lib/internal/Magento/Framework/Api/CompositeExtensibleDataBuilder.php
deleted file mode 100644
index 15726b43411ce9cb2906de412d47971601d03c0f..0000000000000000000000000000000000000000
--- a/lib/internal/Magento/Framework/Api/CompositeExtensibleDataBuilder.php
+++ /dev/null
@@ -1,168 +0,0 @@
-<?php
-/**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
- * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
- */
-
-namespace Magento\Framework\Api;
-
-use Magento\Framework\Model\AbstractExtensibleModel;
-use Magento\Framework\ObjectManager;
-use Magento\Framework\ObjectManager\Config as ObjectManagerConfig;
-
-/**
- * Composite extensible data builder.
- */
-class CompositeExtensibleDataBuilder implements ExtensibleDataBuilderInterface
-{
-    /**#@+
-     * Constant which defines if builder is created for building data objects or data models.
-     */
-    const TYPE_DATA_OBJECT = 'data_object';
-    const TYPE_DATA_MODEL = 'data_model';
-    /**#@-*/
-
-    /** @var string */
-    protected $modelClassInterface;
-
-    /** @var ExtensibleDataBuilderInterface */
-    protected $currentBuilder;
-
-    /** @var ObjectManagerConfig */
-    protected $objectManagerConfig;
-
-    /**
-     * Initialize dependencies.
-     *
-     * @param ObjectManager $objectManager
-     * @param MetadataServiceInterface $metadataService
-     * @param ObjectManagerConfig $objectManagerConfig
-     * @param string $modelClassInterface
-     */
-    public function __construct(
-        ObjectManager $objectManager,
-        MetadataServiceInterface $metadataService,
-        ObjectManagerConfig $objectManagerConfig,
-        $modelClassInterface
-    ) {
-        $this->modelClassInterface = $modelClassInterface;
-        $this->objectManagerConfig = $objectManagerConfig;
-        $arguments = [
-            'metadataService' => $metadataService,
-            'modelClassInterface' => $modelClassInterface
-        ];
-        $builderClass = ($this->getDataType() == self::TYPE_DATA_MODEL)
-            ? 'Magento\Framework\Api\ExtensibleDataBuilder'
-            : 'Magento\Framework\Api\ExtensibleObjectBuilder';
-        $this->currentBuilder = $objectManager->create($builderClass, $arguments);
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function setCustomAttribute($attributeCode, $attributeValue)
-    {
-        $this->currentBuilder->setCustomAttribute($attributeCode, $attributeValue);
-        return $this;
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function setCustomAttributes(array $attributes)
-    {
-        $this->currentBuilder->setCustomAttributes($attributes);
-        return $this;
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function create()
-    {
-        return $this->currentBuilder->create();
-    }
-
-    /**
-     * Proxy all calls to current builder.
-     *
-     * @param string $name
-     * @param array $arguments
-     * @return mixed
-     */
-    public function __call($name, $arguments)
-    {
-        call_user_func_array([$this->currentBuilder, $name], $arguments);
-        return $this;
-    }
-
-    /**
-     * Identify type of objects which should be built with generated builder. Value can be one of self::TYPE_DATA_*.
-     *
-     * @return string
-     * @throws \LogicException
-     */
-    protected function getDataType()
-    {
-        $sourceClassPreference = $this->objectManagerConfig->getPreference($this->modelClassInterface);
-        if (empty($sourceClassPreference)) {
-            throw new \LogicException(
-                "Preference for {$this->modelClassInterface} is not defined."
-            );
-        }
-        if (is_subclass_of($sourceClassPreference, '\Magento\Framework\Api\AbstractSimpleObject')) {
-            return self::TYPE_DATA_OBJECT;
-        } else if (is_subclass_of($sourceClassPreference, '\Magento\Framework\Model\AbstractExtensibleModel')) {
-            return self::TYPE_DATA_MODEL;
-        } else {
-            throw new \LogicException(
-                'Preference of ' . $this->modelClassInterface
-                . ' must extend from AbstractSimpleObject or AbstractExtensibleModel'
-            );
-        }
-    }
-
-    /**
-     * Populates the fields with data from the array.
-     *
-     * Keys for the map are snake_case attribute/field names.
-     *
-     * @param array $data
-     * @return $this
-     */
-    public function populateWithArray(array $data)
-    {
-        $this->currentBuilder->populateWithArray($data);
-        return $this;
-    }
-
-    /**
-     * Populates the fields with data from the prototype.
-     *
-     * @param AbstractSimpleObject $prototype
-     * @return $this
-     */
-    public function populate(AbstractSimpleObject $prototype)
-    {
-        $this->currentBuilder->populate($prototype);
-        return $this;
-    }
-}
diff --git a/lib/internal/Magento/Framework/Api/ExtensibleDataInterface.php b/lib/internal/Magento/Framework/Api/ExtensibleDataInterface.php
index 88cd4f2f40cc1a229b87c865ece97934e652977e..30feb685e95bdb9e52ce15bd41c029d54a46b554 100644
--- a/lib/internal/Magento/Framework/Api/ExtensibleDataInterface.php
+++ b/lib/internal/Magento/Framework/Api/ExtensibleDataInterface.php
@@ -29,6 +29,11 @@ namespace Magento\Framework\Api;
  */
 interface ExtensibleDataInterface
 {
+    /**
+     * Array key for custom attributes
+     */
+    const CUSTOM_ATTRIBUTES = 'custom_attributes';
+
     /**
      * Get an attribute value.
      *
diff --git a/lib/internal/Magento/Framework/Api/ExtensibleObjectBuilder.php b/lib/internal/Magento/Framework/Api/ExtensibleObjectBuilder.php
index b596533bea73e8397c2707659fcb3a9d9e2b2eab..548d6a00c6b1e8519cf3b527a981f598f9d3b69b 100644
--- a/lib/internal/Magento/Framework/Api/ExtensibleObjectBuilder.php
+++ b/lib/internal/Magento/Framework/Api/ExtensibleObjectBuilder.php
@@ -28,10 +28,10 @@ namespace Magento\Framework\Api;
  * Base Builder Class for extensible data Objects
  * @SuppressWarnings(PHPMD.NumberOfChildren)
  */
-class ExtensibleObjectBuilder extends AbstractSimpleObjectBuilder implements ExtensibleDataBuilderInterface
+class ExtensibleObjectBuilder extends AbstractSimpleObjectBuilder implements BuilderInterface
 {
     /**
-     * @var AttributeValueBuilder
+     * @var AttributeDataBuilder
      */
     protected $attributeValueBuilder;
 
@@ -52,13 +52,13 @@ class ExtensibleObjectBuilder extends AbstractSimpleObjectBuilder implements Ext
 
     /**
      * @param \Magento\Framework\Api\ObjectFactory $objectFactory
-     * @param AttributeValueBuilder $valueBuilder
+     * @param AttributeDataBuilder $valueBuilder
      * @param MetadataServiceInterface $metadataService
      * @param string|null $modelClassInterface
      */
     public function __construct(
         \Magento\Framework\Api\ObjectFactory $objectFactory,
-        AttributeValueBuilder $valueBuilder,
+        AttributeDataBuilder $valueBuilder,
         MetadataServiceInterface $metadataService,
         $modelClassInterface = null
     ) {
@@ -103,6 +103,81 @@ class ExtensibleObjectBuilder extends AbstractSimpleObjectBuilder implements Ext
         return $this;
     }
 
+
+    /**
+     * Populates the fields with an existing entity.
+     *
+     * @param ExtensibleDataInterface $prototype the prototype to base on
+     * @return $this
+     * @throws \LogicException If $prototype object class is not the same type as object that is constructed
+     */
+    public function populate(ExtensibleDataInterface $prototype)
+    {
+        $objectType = $this->_getDataObjectType();
+        if (!($prototype instanceof $objectType)) {
+            throw new \LogicException('Wrong prototype object given. It can only be of "' . $objectType . '" type.');
+        }
+        return $this->populateWithArray($prototype->__toArray());
+    }
+
+    /**
+     * Populates the fields with data from the array.
+     *
+     * Keys for the map are snake_case attribute/field names.
+     *
+     * @param array $data
+     * @return $this
+     */
+    public function populateWithArray(array $data)
+    {
+        $this->data = array();
+        $this->_setDataValues($data);
+        return $this;
+    }
+
+
+    /**
+     * Merge second Data Object data with first Data Object data and create new Data Object object based on merge
+     * result.
+     *
+     * @param ExtensibleDataInterface $firstDataObject
+     * @param ExtensibleDataInterface $secondDataObject
+     * @return $this
+     * @throws \LogicException
+     */
+    public function mergeDataObjects(
+        ExtensibleDataInterface $firstDataObject,
+        ExtensibleDataInterface $secondDataObject
+    ) {
+        $objectType = $this->_getDataObjectType();
+        if (get_class($firstDataObject) != $objectType || get_class($secondDataObject) != $objectType) {
+            throw new \LogicException('Wrong prototype object given. It can only be of "' . $objectType . '" type.');
+        }
+        $this->_setDataValues($firstDataObject->__toArray());
+        $this->_setDataValues($secondDataObject->__toArray());
+        return $this;
+    }
+
+    /**
+     * Merged data provided in array format with Data Object data and create new Data Object object based on merge
+     * result.
+     *
+     * @param ExtensibleDataInterface $dataObject
+     * @param array $data
+     * @return $this
+     * @throws \LogicException
+     */
+    public function mergeDataObjectWithArray(ExtensibleDataInterface $dataObject, array $data)
+    {
+        $objectType = $this->_getDataObjectType();
+        if (!($dataObject instanceof $objectType)) {
+            throw new \LogicException('Wrong prototype object given. It can only be of "' . $objectType . '" type.');
+        }
+        $this->_setDataValues($dataObject->__toArray());
+        $this->_setDataValues($data);
+        return $this;
+    }
+
     /**
      * Template method used to configure the attribute codes for the custom attributes
      *
diff --git a/lib/internal/Magento/Framework/Api/Filter.php b/lib/internal/Magento/Framework/Api/Filter.php
index 5d106584dc35e591ab38a953e731947b12a6a3b6..70680d19f59d407d85726020136fbb7850936d72 100644
--- a/lib/internal/Magento/Framework/Api/Filter.php
+++ b/lib/internal/Magento/Framework/Api/Filter.php
@@ -27,7 +27,7 @@ namespace Magento\Framework\Api;
 /**
  * Filter which can be used by any methods from service layer.
  */
-class Filter extends \Magento\Framework\Api\AbstractExtensibleObject
+class Filter extends AbstractExtensibleObject
 {
     /**
      * Get field
diff --git a/lib/internal/Magento/Framework/Api/FilterBuilder.php b/lib/internal/Magento/Framework/Api/FilterBuilder.php
index 506f32587785cacf2d0dad99f5233fbe941bdcb1..92c7a87012179c18cfa694b81e3a2d9b96962f5a 100644
--- a/lib/internal/Magento/Framework/Api/FilterBuilder.php
+++ b/lib/internal/Magento/Framework/Api/FilterBuilder.php
@@ -29,7 +29,7 @@ namespace Magento\Framework\Api;
  *
  * @method Filter create()
  */
-class FilterBuilder extends \Magento\Framework\Api\ExtensibleObjectBuilder
+class FilterBuilder extends \Magento\Framework\Api\Builder
 {
     /**
      * Set field
diff --git a/lib/internal/Magento/Framework/Api/Search/FilterGroupBuilder.php b/lib/internal/Magento/Framework/Api/Search/FilterGroupBuilder.php
index da0fbfc8f22ffe4a8c23103aef448fcb3c4f52f7..21798355167e88bc4499cc24e73870c6d3f87629 100644
--- a/lib/internal/Magento/Framework/Api/Search/FilterGroupBuilder.php
+++ b/lib/internal/Magento/Framework/Api/Search/FilterGroupBuilder.php
@@ -24,15 +24,16 @@
 
 namespace Magento\Framework\Api\Search;
 
-use Magento\Framework\Api\ExtensibleObjectBuilder;
-use Magento\Framework\Api\AttributeValueBuilder;
+use Magento\Framework\Api\Builder;
+use Magento\Framework\Api\ObjectFactory;
+use Magento\Framework\Api\AttributeDataBuilder;
 use Magento\Framework\Api\MetadataServiceInterface;
 use Magento\Framework\Api\FilterBuilder;
 
 /**
  * Builder for FilterGroup Data.
  */
-class FilterGroupBuilder extends ExtensibleObjectBuilder
+class FilterGroupBuilder extends Builder
 {
     /**
      * @var FilterBuilder
@@ -40,18 +41,37 @@ class FilterGroupBuilder extends ExtensibleObjectBuilder
     protected $_filterBuilder;
 
     /**
-     * @param \Magento\Framework\Api\ObjectFactory $objectFactory
-     * @param AttributeValueBuilder $valueBuilder
+     * @param ObjectFactory $objectFactory
      * @param MetadataServiceInterface $metadataService
+     * @param AttributeDataBuilder $attributeValueBuilder
+     * @param \Magento\Framework\Reflection\DataObjectProcessor $objectProcessor
+     * @param \Magento\Framework\Reflection\TypeProcessor $typeProcessor
+     * @param \Magento\Framework\Serialization\DataBuilderFactory $dataBuilderFactory
+     * @param \Magento\Framework\ObjectManager\Config $objectManagerConfig
      * @param FilterBuilder $filterBuilder
+     * @param string|null $modelClassInterface
      */
     public function __construct(
-        \Magento\Framework\Api\ObjectFactory $objectFactory,
-        AttributeValueBuilder $valueBuilder,
+        ObjectFactory $objectFactory,
         MetadataServiceInterface $metadataService,
-        FilterBuilder $filterBuilder
+        \Magento\Framework\Api\AttributeDataBuilder $attributeValueBuilder,
+        \Magento\Framework\Reflection\DataObjectProcessor $objectProcessor,
+        \Magento\Framework\Reflection\TypeProcessor $typeProcessor,
+        \Magento\Framework\Serialization\DataBuilderFactory $dataBuilderFactory,
+        \Magento\Framework\ObjectManager\Config $objectManagerConfig,
+        FilterBuilder $filterBuilder,
+        $modelClassInterface = null
     ) {
-        parent::__construct($objectFactory, $valueBuilder, $metadataService);
+        parent::__construct(
+            $objectFactory,
+            $metadataService,
+            $attributeValueBuilder,
+            $objectProcessor,
+            $typeProcessor,
+            $dataBuilderFactory,
+            $objectManagerConfig,
+            $modelClassInterface
+        );
         $this->_filterBuilder = $filterBuilder;
     }
 
diff --git a/lib/internal/Magento/Framework/Api/SearchCriteriaBuilder.php b/lib/internal/Magento/Framework/Api/SearchCriteriaBuilder.php
index c97d5a94e19dc087165121d8872c60334f130af4..2521a8d8d0086d07a0b6a641a0c1f753b0cd596d 100644
--- a/lib/internal/Magento/Framework/Api/SearchCriteriaBuilder.php
+++ b/lib/internal/Magento/Framework/Api/SearchCriteriaBuilder.php
@@ -24,16 +24,12 @@
 
 namespace Magento\Framework\Api;
 
-use Magento\Framework\Api\ExtensibleObjectBuilder;
-use Magento\Framework\Api\AttributeValueBuilder;
-use Magento\Framework\Api\MetadataServiceInterface;
 use Magento\Framework\Api\Search\FilterGroupBuilder;
-use Magento\Framework\Api\SortOrder;
 
 /**
  * Builder for SearchCriteria Service Data Object
  */
-class SearchCriteriaBuilder extends ExtensibleObjectBuilder
+class SearchCriteriaBuilder extends Builder
 {
     /**
      * @var FilterGroupBuilder
@@ -41,18 +37,37 @@ class SearchCriteriaBuilder extends ExtensibleObjectBuilder
     protected $_filterGroupBuilder;
 
     /**
-     * @param \Magento\Framework\Api\ObjectFactory $objectFactory
-     * @param AttributeValueBuilder $valueBuilder
+     * @param ObjectFactory $objectFactory
      * @param MetadataServiceInterface $metadataService
+     * @param AttributeDataBuilder $attributeValueBuilder
+     * @param \Magento\Framework\Reflection\DataObjectProcessor $objectProcessor
+     * @param \Magento\Framework\Reflection\TypeProcessor $typeProcessor
+     * @param \Magento\Framework\Serialization\DataBuilderFactory $dataBuilderFactory
+     * @param \Magento\Framework\ObjectManager\Config $objectManagerConfig
      * @param FilterGroupBuilder $filterGroupBuilder
+     * @param string|null $modelClassInterface
      */
     public function __construct(
-        \Magento\Framework\Api\ObjectFactory $objectFactory,
-        AttributeValueBuilder $valueBuilder,
+        ObjectFactory $objectFactory,
         MetadataServiceInterface $metadataService,
-        FilterGroupBuilder $filterGroupBuilder
+        AttributeDataBuilder $attributeValueBuilder,
+        \Magento\Framework\Reflection\DataObjectProcessor $objectProcessor,
+        \Magento\Framework\Reflection\TypeProcessor $typeProcessor,
+        \Magento\Framework\Serialization\DataBuilderFactory $dataBuilderFactory,
+        \Magento\Framework\ObjectManager\Config $objectManagerConfig,
+        FilterGroupBuilder $filterGroupBuilder,
+        $modelClassInterface = null
     ) {
-        parent::__construct($objectFactory, $valueBuilder, $metadataService);
+        parent::__construct(
+            $objectFactory,
+            $metadataService,
+            $attributeValueBuilder,
+            $objectProcessor,
+            $typeProcessor,
+            $dataBuilderFactory,
+            $objectManagerConfig,
+            $modelClassInterface
+        );
         $this->_filterGroupBuilder = $filterGroupBuilder;
     }
 
diff --git a/lib/internal/Magento/Framework/App/View/Deployment/Version/GeneratorInterface.php b/lib/internal/Magento/Framework/Api/SimpleBuilderInterface.php
similarity index 74%
rename from lib/internal/Magento/Framework/App/View/Deployment/Version/GeneratorInterface.php
rename to lib/internal/Magento/Framework/Api/SimpleBuilderInterface.php
index 5dc9b87c7cedce38a32c7ec76a50a4ecfa768306..fe4a420473ced690b5762c32a5ead15c5d62fc09 100644
--- a/lib/internal/Magento/Framework/App/View/Deployment/Version/GeneratorInterface.php
+++ b/lib/internal/Magento/Framework/Api/SimpleBuilderInterface.php
@@ -22,17 +22,25 @@
  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  */
 
-namespace Magento\Framework\App\View\Deployment\Version;
+namespace Magento\Framework\Api;
+
 
 /**
- * Algorithm of generation of deployment version of static files
+ * Base Builder interface for simple data Objects
  */
-interface GeneratorInterface
+interface SimpleBuilderInterface
 {
     /**
-     * Return deployment version of static files that is unique enough for the current deployment
+     * Builds the Data Object
+     *
+     * @return AbstractSimpleObject
+     */
+    public function create();
+
+    /**
+     * Return data Object data.
      *
-     * @return string
+     * @return array
      */
-    public function generate();
+    public function getData();
 }
diff --git a/lib/internal/Magento/Framework/App/View/Deployment/Version.php b/lib/internal/Magento/Framework/App/View/Deployment/Version.php
index d88c37aaf569bf950f82201301e5d2491920b12d..0de9bf9a693e304cc752328dbdc5855199b5f078 100644
--- a/lib/internal/Magento/Framework/App/View/Deployment/Version.php
+++ b/lib/internal/Magento/Framework/App/View/Deployment/Version.php
@@ -39,10 +39,8 @@ class Version
      */
     private $versionStorage;
 
-    /**
-     * @var \Magento\Framework\App\View\Deployment\Version\GeneratorInterface
-     */
-    private $versionGenerator;
+    /** @var \Magento\Framework\Stdlib\DateTime */
+    private $dateTime;
 
     /**
      * @var string
@@ -51,17 +49,17 @@ class Version
 
     /**
      * @param \Magento\Framework\App\State $appState
-     * @param \Magento\Framework\App\View\Deployment\Version\StorageInterface $versionStorage
-     * @param \Magento\Framework\App\View\Deployment\Version\GeneratorInterface $versionGenerator
+     * @param Version\StorageInterface $versionStorage
+     * @param \Magento\Framework\Stdlib\DateTime $dateTime
      */
     public function __construct(
         \Magento\Framework\App\State $appState,
         \Magento\Framework\App\View\Deployment\Version\StorageInterface $versionStorage,
-        \Magento\Framework\App\View\Deployment\Version\GeneratorInterface $versionGenerator
+        \Magento\Framework\Stdlib\DateTime $dateTime
     ) {
         $this->appState = $appState;
         $this->versionStorage = $versionStorage;
-        $this->versionGenerator = $versionGenerator;
+        $this->dateTime = $dateTime;
     }
 
     /**
@@ -90,13 +88,13 @@ class Version
                 try {
                     $result = $this->versionStorage->load();
                 } catch (\UnexpectedValueException $e) {
-                    $result = $this->versionGenerator->generate();
+                    $result = $this->dateTime->toTimestamp(true);
                     $this->versionStorage->save($result);
                 }
                 break;
 
             case \Magento\Framework\App\State::MODE_DEVELOPER:
-                $result = $this->versionGenerator->generate();
+                $result = $this->dateTime->toTimestamp(true);
                 break;
 
             default:
diff --git a/lib/internal/Magento/Framework/AppInterface.php b/lib/internal/Magento/Framework/AppInterface.php
index cc6d1fa9c40ffb68a768f08bd45e91d43efc7b37..744daa8ff87313597ae9801e32095bbdec2e5fdf 100644
--- a/lib/internal/Magento/Framework/AppInterface.php
+++ b/lib/internal/Magento/Framework/AppInterface.php
@@ -35,7 +35,7 @@ interface AppInterface
     /**
      * Magento version
      */
-    const VERSION = '0.1.0-alpha103';
+    const VERSION = '0.1.0-alpha104';
 
     /**
      * Launch application
diff --git a/lib/internal/Magento/Framework/Filter/Template/Tokenizer/Parameter.php b/lib/internal/Magento/Framework/Filter/Template/Tokenizer/Parameter.php
index 56065edfcba6c6ce296be3f7312b3fd22772e918..d089aff195a49f454659f833b396e9fa0a4e775e 100644
--- a/lib/internal/Magento/Framework/Filter/Template/Tokenizer/Parameter.php
+++ b/lib/internal/Magento/Framework/Filter/Template/Tokenizer/Parameter.php
@@ -79,6 +79,9 @@ class Parameter extends \Magento\Framework\Filter\Template\Tokenizer\AbstractTok
                 break;
             } elseif ($this->char() == '\\') {
                 $this->next();
+                if ($this->char() != '\\') {
+                    $value .= '\\';
+                }
                 $value .= $this->char();
             } else {
                 $value .= $this->char();
diff --git a/lib/internal/Magento/Framework/Model/AbstractExtensibleModel.php b/lib/internal/Magento/Framework/Model/AbstractExtensibleModel.php
index da46448e7954fb28924a065c4de66856d5958649..db4e2d18c1959d6edaac759e30a62841109423d7 100644
--- a/lib/internal/Magento/Framework/Model/AbstractExtensibleModel.php
+++ b/lib/internal/Magento/Framework/Model/AbstractExtensibleModel.php
@@ -35,8 +35,6 @@ use Magento\Framework\Api\ExtensibleDataInterface;
  */
 abstract class AbstractExtensibleModel extends AbstractModel implements ExtensibleDataInterface
 {
-    const CUSTOM_ATTRIBUTES_KEY = 'custom_attributes';
-
     /**
      * @var MetadataServiceInterface
      */
@@ -76,25 +74,25 @@ abstract class AbstractExtensibleModel extends AbstractModel implements Extensib
      */
     protected function filterCustomAttributes($data)
     {
-        if (empty($data[self::CUSTOM_ATTRIBUTES_KEY])) {
+        if (empty($data[self::CUSTOM_ATTRIBUTES])) {
             return $data;
         }
         $customAttributesCodes = $this->getCustomAttributesCodes();
-        $data[self::CUSTOM_ATTRIBUTES_KEY] =
-            array_intersect_key($data[self::CUSTOM_ATTRIBUTES_KEY], $customAttributesCodes);
+        $data[self::CUSTOM_ATTRIBUTES] =
+            array_intersect_key($data[self::CUSTOM_ATTRIBUTES], $customAttributesCodes);
         return $data;
     }
 
     /**
      * Retrieve custom attributes values.
      *
-     * @return \Magento\Framework\Api\AttributeValue[]|null
+     * @return \Magento\Framework\Api\AttributeInterface[]|null
      */
     public function getCustomAttributes()
     {
         // Returning as a sequential array (instead of stored associative array) to be compatible with the interface
-        return isset($this->_data[self::CUSTOM_ATTRIBUTES_KEY])
-            ? array_values($this->_data[self::CUSTOM_ATTRIBUTES_KEY])
+        return isset($this->_data[self::CUSTOM_ATTRIBUTES])
+            ? array_values($this->_data[self::CUSTOM_ATTRIBUTES])
             : [];
     }
 
@@ -102,12 +100,12 @@ abstract class AbstractExtensibleModel extends AbstractModel implements Extensib
      * Get an attribute value.
      *
      * @param string $attributeCode
-     * @return \Magento\Framework\Api\AttributeValue|null null if the attribute has not been set
+     * @return \Magento\Framework\Api\AttributeInterface|null null if the attribute has not been set
      */
     public function getCustomAttribute($attributeCode)
     {
-        return isset($this->_data[self::CUSTOM_ATTRIBUTES_KEY][$attributeCode])
-            ? $this->_data[self::CUSTOM_ATTRIBUTES_KEY][$attributeCode]
+        return isset($this->_data[self::CUSTOM_ATTRIBUTES][$attributeCode])
+            ? $this->_data[self::CUSTOM_ATTRIBUTES][$attributeCode]
             : null;
     }
 
@@ -125,7 +123,7 @@ abstract class AbstractExtensibleModel extends AbstractModel implements Extensib
      */
     public function setData($key, $value = null)
     {
-        if ($key == self::CUSTOM_ATTRIBUTES_KEY) {
+        if ($key == self::CUSTOM_ATTRIBUTES) {
             throw new \LogicException("Custom attributes must be set only using setCustomAttribute() method.");
         }
         return parent::setData($key, $value);
@@ -150,17 +148,17 @@ abstract class AbstractExtensibleModel extends AbstractModel implements Extensib
      */
     public function getData($key = '', $index = null)
     {
-        if ($key == self::CUSTOM_ATTRIBUTES_KEY) {
+        if ($key == self::CUSTOM_ATTRIBUTES) {
             throw new \LogicException("Custom attributes array should be retrieved via getCustomAttributes() only.");
         } else if ($key == '') {
             /** Represent model data and custom attributes as a flat array */
             $data = array_merge($this->_data, $this->getCustomAttributes());
-            unset($data[self::CUSTOM_ATTRIBUTES_KEY]);
+            unset($data[self::CUSTOM_ATTRIBUTES]);
         } else {
             $data = parent::getData($key, $index);
             if ($data === null) {
                 /** Try to find necessary data in custom attributes */
-                $data = parent::getData(self::CUSTOM_ATTRIBUTES_KEY . "/{$key}", $index);
+                $data = parent::getData(self::CUSTOM_ATTRIBUTES . "/{$key}", $index);
             }
         }
         return $data;
diff --git a/lib/internal/Magento/Framework/Model/AbstractModel.php b/lib/internal/Magento/Framework/Model/AbstractModel.php
index b1e1da7b074e3c10807cbd08c478f62131cd0716..f2f11b58ed3ed30382cc037b7ae869392138d888 100644
--- a/lib/internal/Magento/Framework/Model/AbstractModel.php
+++ b/lib/internal/Magento/Framework/Model/AbstractModel.php
@@ -269,7 +269,7 @@ abstract class AbstractModel extends \Magento\Framework\Object
     /**
      * Get collection instance
      *
-     * @deplacated
+     * @deprecated
      * @throws \Magento\Framework\Model\Exception
      * @return \Magento\Framework\Model\Resource\Db\Collection\AbstractCollection
      */
diff --git a/lib/internal/Magento/Framework/ObjectManager/DefinitionFactory.php b/lib/internal/Magento/Framework/ObjectManager/DefinitionFactory.php
index 2ebbe7ed3dfaa400e28e696d882fee90c364cb7c..db2e5ca7a379f8f68612b825959c6ace179bc8e2 100644
--- a/lib/internal/Magento/Framework/ObjectManager/DefinitionFactory.php
+++ b/lib/internal/Magento/Framework/ObjectManager/DefinitionFactory.php
@@ -31,7 +31,6 @@ use Magento\Framework\ObjectManager\Definition\Runtime;
 use Magento\Framework\ObjectManager\Relations;
 use Magento\Framework\ObjectManager\Code\Generator;
 use Magento\Framework\Interception\Code\Generator as InterceptionGenerator;
-use Magento\Framework\Api\Code\Generator\Builder as BuilderGenerator;
 use Magento\Framework\Api\Code\Generator\DataBuilder as DataBuilderGenerator;
 use Magento\Framework\Api\Code\Generator\Mapper as MapperGenerator;
 use Magento\Framework\ObjectManager\Code\Generator\Converter as ConverterGenerator;
@@ -140,8 +139,7 @@ class DefinitionFactory
                         => '\Magento\Framework\Interception\Code\Generator\Interceptor',
                     DataBuilderGenerator::ENTITY_TYPE
                         => '\Magento\Framework\Api\Code\Generator\DataBuilder',
-                    BuilderGenerator::ENTITY_TYPE
-                        => '\Magento\Framework\Api\Code\Generator\Builder',
+                    DataBuilderGenerator::ENTITY_TYPE_BUILDER  => 'Magento\Framework\Api\Code\Generator\DataBuilder',
                     MapperGenerator::ENTITY_TYPE
                         => '\Magento\Framework\Api\Code\Generator\Mapper',
                     SearchResults::ENTITY_TYPE
diff --git a/lib/internal/Magento/Framework/ObjectManager/Profiler/Log.php b/lib/internal/Magento/Framework/ObjectManager/Profiler/Log.php
index 66dd749bef15f1fe6c8184c5967efed9d4102ccf..d041da84a4775f30b9f02d24bff503426491fe9a 100644
--- a/lib/internal/Magento/Framework/ObjectManager/Profiler/Log.php
+++ b/lib/internal/Magento/Framework/ObjectManager/Profiler/Log.php
@@ -150,16 +150,17 @@ class Log
     {
         $this->stats['used'] = count($this->used);
         $this->stats['unused'] = $this->stats['total'] - $this->stats['used'];
-        echo '<table border="1" cellspacing="0" cellpadding="2">' . PHP_EOL;
-        echo "<caption>Creation chain (Red items are never used) Total: {$this->stats['total']}\n";
-        echo "Used: {$this->stats['used']} Not used: {$this->stats['unused']}</caption>";
-        echo '<tbody>';
-        echo "<tr><th>Instance class</th></tr>";
+        echo '<table border="1" cellspacing="0" cellpadding="2">',
+            '<thead><tr><th>',
+            "Creation chain (Red items are never used) Total: {$this->stats['total']}\n",
+            "Used: {$this->stats['used']} Not used: {$this->stats['unused']}",
+            '</th></tr></thead>',
+            '<tbody>',
+            '<tr><th>Instance class</th></tr>';
         foreach ($this->roots as $root) {
             $this->displayItem($root);
         }
-        echo '</tbody>';
-        echo '</table>';
+        echo '</tbody></table>';
     }
 
     /**
diff --git a/lib/internal/Magento/Framework/Reflection/DataObjectProcessor.php b/lib/internal/Magento/Framework/Reflection/DataObjectProcessor.php
index b50045e3020ec12d590ebd695041019d417164ed..4b27b18f1f4cc7cb326681fcbb45a5d4553779fa 100644
--- a/lib/internal/Magento/Framework/Reflection/DataObjectProcessor.php
+++ b/lib/internal/Magento/Framework/Reflection/DataObjectProcessor.php
@@ -28,7 +28,7 @@ use Zend\Code\Reflection\ClassReflection;
 use Zend\Code\Reflection\MethodReflection;
 use Magento\Framework\Api\SimpleDataObjectConverter;
 use Magento\Framework\Api\AttributeValue;
-use Magento\Framework\Model\AbstractExtensibleModel;
+use Magento\Framework\Api\ExtensibleDataInterface;
 use Magento\Framework\ObjectManager;
 
 /**
@@ -118,7 +118,7 @@ class DataObjectProcessor
                     continue;
                 }
                 $key = SimpleDataObjectConverter::camelCaseToSnakeCase(substr($methodName, 3));
-                if ($key === AbstractExtensibleModel::CUSTOM_ATTRIBUTES_KEY) {
+                if ($key === ExtensibleDataInterface::CUSTOM_ATTRIBUTES) {
                     $value = $this->convertCustomAttributes($value);
                 } else if (is_object($value)) {
                     $value = $this->buildOutputDataArray($value, $returnType);
diff --git a/lib/internal/Magento/Framework/Serialization/DataBuilderFactory.php b/lib/internal/Magento/Framework/Serialization/DataBuilderFactory.php
index c996d3a8b649d09eca8dcc6897e1618b35695025..2ef905716aac1b817f8abc6fcce1a8b69fde1090 100644
--- a/lib/internal/Magento/Framework/Serialization/DataBuilderFactory.php
+++ b/lib/internal/Magento/Framework/Serialization/DataBuilderFactory.php
@@ -48,7 +48,7 @@ class DataBuilderFactory
      * Returns a builder for a given class name.
      *
      * @param string $className
-     * @return \Magento\Framework\Api\ExtensibleDataBuilderInterface Builder Instance
+     * @return \Magento\Framework\Api\BuilderInterface Builder Instance
      */
     public function getDataBuilder($className)
     {
diff --git a/lib/internal/Magento/Framework/composer.json b/lib/internal/Magento/Framework/composer.json
index 41d9cff4101dfc8b3e0e9d3c349c2131438c0a92..493b906ecf30c4f4a10bdcd79baa1dc4d44dcf28 100644
--- a/lib/internal/Magento/Framework/composer.json
+++ b/lib/internal/Magento/Framework/composer.json
@@ -2,7 +2,7 @@
     "name": "magento/framework",
     "description": "N/A",
     "type": "magento2-library",
-    "version": "0.1.0-alpha103",
+    "version": "0.1.0-alpha104",
     "require": {
         "php": "~5.4.11|~5.5.0",
         "ext-spl": "*",
diff --git a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/setup.js b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/setup.js
index f9b00e891277456a761616caee683de5a04f700e..9c82575627fbcc5b443a4efbb9e5ba9d18165371 100644
--- a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/setup.js
+++ b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/setup.js
@@ -310,6 +310,7 @@ define([
             return content.gsub(/\{\{widget(.*?)\}\}/i, function(match){
                 var attributes = this.parseAttributesString(match[1]);
                 if (attributes.type) {
+                    attributes.type = attributes.type.replace(/\\\\/g, "\\");
                     var imageSrc = this.config.widget_placeholders[attributes.type];
                     var imageHtml = '<img';
                         imageHtml+= ' id="' + Base64.idEncode(match[0]) + '"';