diff --git a/app/code/Magento/Customer/Model/ResourceModel/CustomerRepository.php b/app/code/Magento/Customer/Model/ResourceModel/CustomerRepository.php
index 10f969db430f7aed0759cc4e14fbec63870223fa..d709e9667eac34d0cadfe55554da18d3311b50e4 100644
--- a/app/code/Magento/Customer/Model/ResourceModel/CustomerRepository.php
+++ b/app/code/Magento/Customer/Model/ResourceModel/CustomerRepository.php
@@ -145,9 +145,13 @@ class CustomerRepository implements \Magento\Customer\Api\CustomerRepositoryInte
     public function save(\Magento\Customer\Api\Data\CustomerInterface $customer, $passwordHash = null)
     {
         $prevCustomerData = null;
+        $prevCustomerDataArr = null;
         if ($customer->getId()) {
             $prevCustomerData = $this->getById($customer->getId());
+            $prevCustomerDataArr = $prevCustomerData->__toArray();
         }
+        /** @var $customer \Magento\Customer\Model\Data\Customer */
+        $customerArr = $customer->__toArray();
         $customer = $this->imageProcessor->save(
             $customer,
             CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER,
@@ -185,6 +189,20 @@ class CustomerRepository implements \Magento\Customer\Api\CustomerRepositoryInte
             $customerModel->setRpToken(null);
             $customerModel->setRpTokenCreatedAt(null);
         }
+        if (!array_key_exists('default_billing', $customerArr) &&
+            null !== $prevCustomerDataArr &&
+            array_key_exists('default_billing', $prevCustomerDataArr)
+        ) {
+            $customerModel->setDefaultBilling($prevCustomerDataArr['default_billing']);
+        }
+
+        if (!array_key_exists('default_shipping', $customerArr) &&
+            null !== $prevCustomerDataArr &&
+            array_key_exists('default_shipping', $prevCustomerDataArr)
+        ) {
+            $customerModel->setDefaultShipping($prevCustomerDataArr['default_shipping']);
+        }
+
         $customerModel->save();
         $this->customerRegistry->push($customerModel);
         $customerId = $customerModel->getId();
diff --git a/app/code/Magento/Customer/Test/Unit/Model/ResourceModel/CustomerRepositoryTest.php b/app/code/Magento/Customer/Test/Unit/Model/ResourceModel/CustomerRepositoryTest.php
index 54a0b8040d2db35521010102a3c896a58ac3f58d..3f6dd14f5aa1842637653004b7f91d94ca62abe0 100644
--- a/app/code/Magento/Customer/Test/Unit/Model/ResourceModel/CustomerRepositoryTest.php
+++ b/app/code/Magento/Customer/Test/Unit/Model/ResourceModel/CustomerRepositoryTest.php
@@ -101,13 +101,8 @@ class CustomerRepositoryTest extends \PHPUnit_Framework_TestCase
             $this->getMock(\Magento\Customer\Model\ResourceModel\Customer::class, [], [], '', false);
         $this->customerRegistry = $this->getMock(\Magento\Customer\Model\CustomerRegistry::class, [], [], '', false);
         $this->dataObjectHelper = $this->getMock(\Magento\Framework\Api\DataObjectHelper::class, [], [], '', false);
-        $this->customerFactory  = $this->getMock(
-            \Magento\Customer\Model\CustomerFactory::class,
-            ['create'],
-            [],
-            '',
-            false
-        );
+        $this->customerFactory  =
+            $this->getMock(\Magento\Customer\Model\CustomerFactory::class, ['create'], [], '', false);
         $this->customerSecureFactory  = $this->getMock(
             \Magento\Customer\Model\Data\CustomerSecureFactory::class,
             ['create'],
@@ -115,7 +110,6 @@ class CustomerRepositoryTest extends \PHPUnit_Framework_TestCase
             '',
             false
         );
-
         $this->addressRepository = $this->getMock(
             \Magento\Customer\Model\ResourceModel\AddressRepository::class,
             [],
@@ -123,7 +117,6 @@ class CustomerRepositoryTest extends \PHPUnit_Framework_TestCase
             '',
             false
         );
-
         $this->customerMetadata = $this->getMockForAbstractClass(
             \Magento\Customer\Api\CustomerMetadataInterface::class,
             [],
@@ -172,11 +165,15 @@ class CustomerRepositoryTest extends \PHPUnit_Framework_TestCase
             \Magento\Customer\Api\Data\CustomerInterface::class,
             [],
             '',
-            false
+            true,
+            true,
+            true,
+            [
+                '__toArray'
+            ]
         );
         $this->collectionProcessorMock = $this->getMockBuilder(CollectionProcessorInterface::class)
             ->getMock();
-
         $this->model = new \Magento\Customer\Model\ResourceModel\CustomerRepository(
             $this->customerFactory,
             $this->customerSecureFactory,
@@ -254,6 +251,11 @@ class CustomerRepositoryTest extends \PHPUnit_Framework_TestCase
             '',
             false
         );
+
+        $this->customer->expects($this->atLeastOnce())
+            ->method('__toArray')
+            ->willReturn(['default_billing', 'default_shipping']);
+
         $customerAttributesMetaData = $this->getMockForAbstractClass(
             \Magento\Framework\Api\CustomAttributesDataInterface::class,
             [],
@@ -495,6 +497,11 @@ class CustomerRepositoryTest extends \PHPUnit_Framework_TestCase
                 'getId'
             ]
         );
+
+        $this->customer->expects($this->atLeastOnce())
+            ->method('__toArray')
+            ->willReturn(['default_billing', 'default_shipping']);
+
         $customerModel = $this->getMock(
             \Magento\Customer\Model\Customer::class,
             [
diff --git a/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php b/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php
index e46f9384bdfda1e9c79260d360aa3e29089f6ceb..b83cc0c8cf2f587dd4368496a04ebebd70bf4df0 100644
--- a/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php
+++ b/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php
@@ -395,6 +395,8 @@ class Multishipping extends \Magento\Framework\DataObject
                 }
             }
 
+            $this->prepareShippingAssignment($quote);
+
             /**
              * Delete all not virtual quote items which are not added to shipping address
              * MultishippingQty should be defined for each quote item when it processed with _addShippingItem
diff --git a/app/code/Magento/Multishipping/Test/Unit/Model/Checkout/Type/MultishippingTest.php b/app/code/Magento/Multishipping/Test/Unit/Model/Checkout/Type/MultishippingTest.php
index a8930f1d0d58d4c392091a0ecd97c4262c8bf7e9..24a6f32b37a8d3d81c740427ca82775975e376da 100644
--- a/app/code/Magento/Multishipping/Test/Unit/Model/Checkout/Type/MultishippingTest.php
+++ b/app/code/Magento/Multishipping/Test/Unit/Model/Checkout/Type/MultishippingTest.php
@@ -5,130 +5,148 @@
  */
 namespace Magento\Multishipping\Test\Unit\Model\Checkout\Type;
 
+use Magento\Checkout\Model\Session;
+use Magento\Customer\Api\AddressRepositoryInterface;
+use Magento\Customer\Api\Data\AddressInterface;
+use Magento\Customer\Api\Data\AddressSearchResultsInterface;
+use Magento\Customer\Api\Data\CustomerInterface;
+use Magento\Customer\Model\Data\Address;
+use Magento\Customer\Model\Session as CustomerSession;
+use Magento\Framework\Api\FilterBuilder;
+use Magento\Framework\Api\SearchCriteria;
+use Magento\Framework\Api\SearchCriteriaBuilder;
+use Magento\Framework\App\Config\ScopeConfigInterface;
+use Magento\Framework\Event\ManagerInterface;
+use Magento\Framework\Pricing\PriceCurrencyInterface;
+use Magento\Framework\Session\Generic;
+use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
+use Magento\Multishipping\Helper\Data;
+use Magento\Multishipping\Model\Checkout\Type\Multishipping;
+use Magento\Payment\Model\Method\SpecificationInterface;
+use Magento\Quote\Api\CartRepositoryInterface;
+use Magento\Quote\Api\Data\CartExtension;
+use Magento\Quote\Api\Data\CartExtensionFactory;
+use Magento\Quote\Model\Quote;
+use Magento\Quote\Model\Quote\Address as QuoteAddress;
+use Magento\Quote\Model\Quote\Address\Item as AddressItem;
+use Magento\Quote\Model\Quote\Address\ToOrder;
+use Magento\Quote\Model\Quote\Address\ToOrderAddress;
+use Magento\Quote\Model\Quote\AddressFactory;
+use Magento\Quote\Model\Quote\Item;
+use Magento\Quote\Model\Quote\Item\ToOrderItem;
+use Magento\Quote\Model\Quote\Payment\ToOrderPayment;
+use Magento\Quote\Model\Quote\ShippingAssignment\ShippingAssignmentProcessor;
+use Magento\Quote\Model\Quote\TotalsCollector;
+use Magento\Quote\Model\Shipping;
+use Magento\Quote\Model\ShippingAssignment;
+use Magento\Sales\Model\Order\Email\Sender\OrderSender;
+use Magento\Sales\Model\OrderFactory;
+use Magento\Store\Model\StoreManagerInterface;
+use PHPUnit_Framework_MockObject_MockObject;
+use PHPUnit_Framework_TestCase;
+
 /**
  * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
  */
-class MultishippingTest extends \PHPUnit_Framework_TestCase
+class MultishippingTest extends PHPUnit_Framework_TestCase
 {
     /**
-     * @var \Magento\Multishipping\Model\Checkout\Type\Multishipping
+     * @var Multishipping
      */
     protected $model;
 
     /**
-     * @var \PHPUnit_Framework_MockObject_MockObject
+     * @var PHPUnit_Framework_MockObject_MockObject
      */
     protected $checkoutSessionMock;
 
     /**
-     * @var \PHPUnit_Framework_MockObject_MockObject
+     * @var PHPUnit_Framework_MockObject_MockObject
      */
     protected $customerSessionMock;
 
     /**
-     * @var \PHPUnit_Framework_MockObject_MockObject
+     * @var PHPUnit_Framework_MockObject_MockObject
      */
     protected $customerMock;
 
     /**
-     * @var \PHPUnit_Framework_MockObject_MockObject
+     * @var PHPUnit_Framework_MockObject_MockObject
      */
     protected $quoteMock;
 
     /**
-     * @var \PHPUnit_Framework_MockObject_MockObject
+     * @var PHPUnit_Framework_MockObject_MockObject
      */
     protected $helperMock;
 
     /**
-     * @var \PHPUnit_Framework_MockObject_MockObject
+     * @var PHPUnit_Framework_MockObject_MockObject
      */
     protected $filterBuilderMock;
 
     /**
-     * @var \PHPUnit_Framework_MockObject_MockObject
+     * @var PHPUnit_Framework_MockObject_MockObject
      */
     protected $addressRepositoryMock;
 
     /**
-     * @var \PHPUnit_Framework_MockObject_MockObject
+     * @var PHPUnit_Framework_MockObject_MockObject
      */
     protected $searchCriteriaBuilderMock;
 
     /**
-     * @var \PHPUnit_Framework_MockObject_MockObject
+     * @var PHPUnit_Framework_MockObject_MockObject
      */
     protected $totalsCollectorMock;
 
     /**
-     * @var \PHPUnit_Framework_MockObject_MockObject
+     * @var PHPUnit_Framework_MockObject_MockObject
      */
     private $cartExtensionFactoryMock;
 
     /**
-     * @var \PHPUnit_Framework_MockObject_MockObject
+     * @var PHPUnit_Framework_MockObject_MockObject
      */
     private $shippingAssignmentProcessorMock;
 
     /**
-     * @var \PHPUnit_Framework_MockObject_MockObject
+     * @var PHPUnit_Framework_MockObject_MockObject
      */
     private $quoteRepositoryMock;
 
     protected function setUp()
     {
-        $this->checkoutSessionMock = $this->getMock(\Magento\Checkout\Model\Session::class, [], [], '', false);
-        $this->customerSessionMock = $this->getMock(\Magento\Customer\Model\Session::class, [], [], '', false);
-        $orderFactoryMock = $this->getMock(\Magento\Sales\Model\OrderFactory::class, [], [], '', false);
-        $eventManagerMock = $this->getMock(\Magento\Framework\Event\ManagerInterface::class, [], [], '', false);
-        $scopeConfigMock = $this->getMock(\Magento\Framework\App\Config\ScopeConfigInterface::class, [], [], '', false);
-        $sessionMock = $this->getMock(\Magento\Framework\Session\Generic::class, [], [], '', false);
-        $addressFactoryMock = $this->getMock(\Magento\Quote\Model\Quote\AddressFactory::class, [], [], '', false);
-        $toOrderMock = $this->getMock(\Magento\Quote\Model\Quote\Address\ToOrder::class, [], [], '', false);
-        $toOrderAddressMock =
-            $this->getMock(\Magento\Quote\Model\Quote\Address\ToOrderAddress::class, [], [], '', false);
-        $toOrderPaymentMock =
-            $this->getMock(\Magento\Quote\Model\Quote\Payment\ToOrderPayment::class, [], [], '', false);
-        $toOrderItemMock = $this->getMock(\Magento\Quote\Model\Quote\Item\ToOrderItem::class, [], [], '', false);
-        $storeManagerMock = $this->getMock(\Magento\Store\Model\StoreManagerInterface::class, [], [], '', false);
-        $paymentSpecMock =
-            $this->getMock(\Magento\Payment\Model\Method\SpecificationInterface::class, [], [], '', false);
-        $this->helperMock = $this->getMock(\Magento\Multishipping\Helper\Data::class, [], [], '', false);
-        $orderSenderMock =
-            $this->getMock(\Magento\Sales\Model\Order\Email\Sender\OrderSender::class, [], [], '', false);
-        $priceMock = $this->getMock(\Magento\Framework\Pricing\PriceCurrencyInterface::class, [], [], '', false);
-        $this->quoteRepositoryMock = $this->getMock(\Magento\Quote\Api\CartRepositoryInterface::class);
-        $this->filterBuilderMock = $this->getMock(\Magento\Framework\Api\FilterBuilder::class, [], [], '', false);
-        $this->searchCriteriaBuilderMock = $this->getMock(
-            \Magento\Framework\Api\SearchCriteriaBuilder::class,
-            [],
-            [],
-            '',
-            false
-        );
-        $this->addressRepositoryMock = $this->getMock(
-            \Magento\Customer\Api\AddressRepositoryInterface::class,
-            [],
-            [],
-            '',
-            false
-        );
+        $this->checkoutSessionMock = $this->createSimpleMock(Session::class);
+        $this->customerSessionMock = $this->createSimpleMock(CustomerSession::class);
+        $orderFactoryMock = $this->createSimpleMock(OrderFactory::class);
+        $eventManagerMock = $this->createSimpleMock(ManagerInterface::class);
+        $scopeConfigMock = $this->createSimpleMock(ScopeConfigInterface::class);
+        $sessionMock = $this->createSimpleMock(Generic::class);
+        $addressFactoryMock = $this->createSimpleMock(AddressFactory::class);
+        $toOrderMock = $this->createSimpleMock(ToOrder::class);
+        $toOrderAddressMock = $this->createSimpleMock(ToOrderAddress::class);
+        $toOrderPaymentMock = $this->createSimpleMock(ToOrderPayment::class);
+        $toOrderItemMock = $this->createSimpleMock(ToOrderItem::class);
+        $storeManagerMock = $this->createSimpleMock(StoreManagerInterface::class);
+        $paymentSpecMock = $this->createSimpleMock(SpecificationInterface::class);
+        $this->helperMock = $this->createSimpleMock(Data::class);
+        $orderSenderMock = $this->createSimpleMock(OrderSender::class);
+        $priceMock = $this->createSimpleMock(PriceCurrencyInterface::class);
+        $this->quoteRepositoryMock = $this->createSimpleMock(CartRepositoryInterface::class);
+        $this->filterBuilderMock = $this->createSimpleMock(FilterBuilder::class);
+        $this->searchCriteriaBuilderMock = $this->createSimpleMock(SearchCriteriaBuilder::class);
+        $this->addressRepositoryMock = $this->createSimpleMock(AddressRepositoryInterface::class);
         /** This is used to get past _init() which is called in construct. */
         $data['checkout_session'] = $this->checkoutSessionMock;
-        $this->quoteMock = $this->getMock(\Magento\Quote\Model\Quote::class, [], [], '', false);
-        $this->customerMock = $this->getMock(\Magento\Customer\Api\Data\CustomerInterface::class, [], [], '', false);
+        $this->quoteMock = $this->createSimpleMock(Quote::class);
+        $this->customerMock = $this->createSimpleMock(CustomerInterface::class);
         $this->customerMock->expects($this->atLeastOnce())->method('getId')->willReturn(null);
         $this->checkoutSessionMock->expects($this->atLeastOnce())->method('getQuote')->willReturn($this->quoteMock);
         $this->customerSessionMock->expects($this->atLeastOnce())->method('getCustomerDataObject')
             ->willReturn($this->customerMock);
-        $this->totalsCollectorMock = $this->getMock(
-            \Magento\Quote\Model\Quote\TotalsCollector::class,
-            [],
-            [],
-            '',
-            false
-        );
-        $this->model = new \Magento\Multishipping\Model\Checkout\Type\Multishipping(
+        $this->totalsCollectorMock = $this->createSimpleMock(TotalsCollector::class);
+        $this->model = new Multishipping(
             $this->checkoutSessionMock,
             $this->customerSessionMock,
             $orderFactoryMock,
@@ -152,21 +170,14 @@ class MultishippingTest extends \PHPUnit_Framework_TestCase
             $this->totalsCollectorMock,
             $data
         );
-        $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
-        $this->cartExtensionFactoryMock = $this->getMock(
-            \Magento\Quote\Api\Data\CartExtensionFactory::class,
-            ['create'],
-            [],
-            '',
-            false
-        );
-        $this->shippingAssignmentProcessorMock = $this->getMock(
-            \Magento\Quote\Model\Quote\ShippingAssignment\ShippingAssignmentProcessor::class,
-            [],
-            [],
-            '',
-            false
-        );
+
+        $this->cartExtensionFactoryMock = $this->getMockBuilder(CartExtensionFactory::class)
+            ->setMethods(['create'])
+            ->disableOriginalConstructor()
+            ->getMock();
+        $this->shippingAssignmentProcessorMock = $this->createSimpleMock(ShippingAssignmentProcessor::class);
+
+        $objectManager = new ObjectManager($this);
         $objectManager->setBackwardCompatibleProperty(
             $this->model,
             'cartExtensionFactory',
@@ -204,23 +215,21 @@ class MultishippingTest extends \PHPUnit_Framework_TestCase
         $this->filterBuilderMock->expects($this->atLeastOnce())->method('setConditionType')->willReturnSelf();
         $this->filterBuilderMock->expects($this->atLeastOnce())->method('create')->willReturnSelf();
 
-        $searchCriteriaMock = $this->getMock(\Magento\Framework\Api\SearchCriteria::class, [], [], '', false);
+        $searchCriteriaMock = $this->createSimpleMock(SearchCriteria::class);
         $this->searchCriteriaBuilderMock->expects($this->atLeastOnce())->method('addFilters')->willReturnSelf();
-        $this->searchCriteriaBuilderMock->expects($this->atLeastOnce())->method('create')
+        $this->searchCriteriaBuilderMock
+            ->expects($this->atLeastOnce())
+            ->method('create')
             ->willReturn($searchCriteriaMock);
 
-        $resultMock = $this->getMock(
-            \Magento\Customer\Api\Data\AddressSearchResultsInterface::class,
-            [],
-            [],
-            '',
-            false
-        );
+        $resultMock = $this->createSimpleMock(AddressSearchResultsInterface::class);
         $this->addressRepositoryMock->expects($this->atLeastOnce())->method('getList')->willReturn($resultMock);
-        $addressItemMock = $this->getMock(\Magento\Customer\Api\Data\AddressInterface::class, [], [], '', false);
+        $addressItemMock = $this->createSimpleMock(AddressInterface::class);
         $resultMock->expects($this->atLeastOnce())->method('getItems')->willReturn([$addressItemMock]);
         $addressItemMock->expects($this->atLeastOnce())->method('getId')->willReturn(null);
 
+        $this->mockShippingAssignment();
+
         $this->assertEquals($this->model, $this->model->setShippingItemsInformation($info));
     }
 
@@ -240,11 +249,11 @@ class MultishippingTest extends \PHPUnit_Framework_TestCase
         ];
         $customerAddressId = 42;
 
-        $customerAddressMock = $this->getMock(\Magento\Customer\Model\Data\Address::class, [], [], '', false);
-        $customerAddressMock->expects($this->atLeastOnce())->method('getId')->willReturn($customerAddressId);
-        $customerAddresses = [$customerAddressMock];
+        $customerAddresses = [
+            $this->getCustomerAddressMock($customerAddressId)
+        ];
 
-        $quoteItemMock = $this->getMock(\Magento\Quote\Model\Quote\Item::class, [], [], '', false);
+        $quoteItemMock = $this->createSimpleMock(Item::class);
         $this->quoteMock->expects($this->once())->method('getItemById')->willReturn($quoteItemMock);
         $this->quoteMock->expects($this->once())->method('getAllShippingAddresses')->willReturn([]);
 
@@ -260,11 +269,11 @@ class MultishippingTest extends \PHPUnit_Framework_TestCase
         $addressId = 42;
         $customerAddressId = 42;
 
-        $customerAddressMock = $this->getMock(\Magento\Customer\Model\Data\Address::class, [], [], '', false);
-        $customerAddressMock->expects($this->atLeastOnce())->method('getId')->willReturn($customerAddressId);
-        $customerAddresses = [$customerAddressMock];
-        $this->customerMock->expects($this->once())->method('getAddresses')->willReturn($customerAddresses);
+        $customerAddresses = [
+            $this->getCustomerAddressMock($customerAddressId)
+        ];
 
+        $this->customerMock->expects($this->once())->method('getAddresses')->willReturn($customerAddresses);
         $this->addressRepositoryMock->expects($this->once())->method('getById')->willReturn(null);
 
         $this->assertEquals($this->model, $this->model->updateQuoteCustomerShippingAddress($addressId));
@@ -279,9 +288,9 @@ class MultishippingTest extends \PHPUnit_Framework_TestCase
         $addressId = 43;
         $customerAddressId = 42;
 
-        $customerAddressMock = $this->getMock(\Magento\Customer\Model\Data\Address::class, [], [], '', false);
-        $customerAddressMock->expects($this->atLeastOnce())->method('getId')->willReturn($customerAddressId);
-        $customerAddresses = [$customerAddressMock];
+        $customerAddresses = [
+            $this->getCustomerAddressMock($customerAddressId)
+        ];
         $this->customerMock->expects($this->once())->method('getAddresses')->willReturn($customerAddresses);
 
         $this->assertEquals($this->model, $this->model->updateQuoteCustomerShippingAddress($addressId));
@@ -292,9 +301,9 @@ class MultishippingTest extends \PHPUnit_Framework_TestCase
         $addressId = 42;
         $customerAddressId = 42;
 
-        $customerAddressMock = $this->getMock(\Magento\Customer\Model\Data\Address::class, [], [], '', false);
-        $customerAddressMock->expects($this->atLeastOnce())->method('getId')->willReturn($customerAddressId);
-        $customerAddresses = [$customerAddressMock];
+        $customerAddresses = [
+            $this->getCustomerAddressMock($customerAddressId)
+        ];
         $this->customerMock->expects($this->once())->method('getAddresses')->willReturn($customerAddresses);
 
         $this->assertEquals($this->model, $this->model->setQuoteCustomerBillingAddress($addressId));
@@ -309,9 +318,9 @@ class MultishippingTest extends \PHPUnit_Framework_TestCase
         $addressId = 43;
         $customerAddressId = 42;
 
-        $customerAddressMock = $this->getMock(\Magento\Customer\Model\Data\Address::class, [], [], '', false);
-        $customerAddressMock->expects($this->atLeastOnce())->method('getId')->willReturn($customerAddressId);
-        $customerAddresses = [$customerAddressMock];
+        $customerAddresses = [
+            $this->getCustomerAddressMock($customerAddressId)
+        ];
         $this->customerMock->expects($this->once())->method('getAddresses')->willReturn($customerAddresses);
 
         $this->assertEquals($this->model, $this->model->setQuoteCustomerBillingAddress($addressId));
@@ -319,7 +328,9 @@ class MultishippingTest extends \PHPUnit_Framework_TestCase
 
     public function testGetQuoteShippingAddressesItems()
     {
-        $quoteItem = $this->getMock(\Magento\Quote\Model\Quote\Address\Item::class, [], [], '', false);
+        $quoteItem = $this->getMockBuilder(AddressItem::class)
+            ->disableOriginalConstructor()
+            ->getMock();
         $this->checkoutSessionMock->expects($this->once())->method('getQuote')->willReturn($this->quoteMock);
         $this->quoteMock->expects($this->once())->method('getShippingAddressesItems')->willReturn($quoteItem);
         $this->model->getQuoteShippingAddressesItems();
@@ -327,57 +338,113 @@ class MultishippingTest extends \PHPUnit_Framework_TestCase
 
     public function testSetShippingMethods()
     {
-
         $methodsArray = [1 => 'flatrate_flatrate', 2 => 'tablerate_bestway'];
         $addressId = 1;
-        $addressMock = $this->getMock(
-            \Magento\Quote\Model\Quote\Address::class,
-            ['getId', 'setShippingMethod'],
-            [],
-            '',
-            false
-        );
-        $extensionAttributesMock = $this->getMock(
-            \Magento\Quote\Api\Data\CartExtension::class,
-            ['setShippingAssignments'],
-            [],
-            '',
-            false
-        );
-        $shippingAssignmentMock = $this->getMock(
-            \Magento\Quote\Model\ShippingAssignment::class,
-            ['getShipping', 'setShipping'],
-            [],
-            '',
-            false
-        );
-        $shippingMock = $this->getMock(\Magento\Quote\Model\Shipping::class, ['setMethod'], [], '', false);
+        $addressMock = $this->getMockBuilder(QuoteAddress::class)
+            ->setMethods(['getId', 'setShippingMethod'])
+            ->disableOriginalConstructor()
+            ->getMock();
 
         $addressMock->expects($this->once())->method('getId')->willReturn($addressId);
         $this->quoteMock->expects($this->once())->method('getAllShippingAddresses')->willReturn([$addressMock]);
         $addressMock->expects($this->once())->method('setShippingMethod')->with($methodsArray[$addressId]);
-        //mock for prepareShippingAssignment
-        $this->quoteMock
+
+        $this->mockShippingAssignment();
+
+        //save mock
+        $this->quoteMock->expects($this->once())->method('collectTotals')->willReturnSelf();
+        $this->quoteRepositoryMock->expects($this->once())->method('save')->with($this->quoteMock);
+        $this->model->setShippingMethods($methodsArray);
+    }
+
+    /**
+     * @param ShippingAssignment $shippingAssignmentMock
+     * @return CartExtension|PHPUnit_Framework_MockObject_MockObject
+     */
+    private function getExtensionAttributesMock(ShippingAssignment $shippingAssignmentMock)
+    {
+        $extensionAttributesMock = $this->getMockBuilder(CartExtension::class)
+            ->setMethods(['setShippingAssignments'])
+            ->getMock();
+
+        $extensionAttributesMock
             ->expects($this->once())
-            ->method('getExtensionAttributes')
-            ->willReturn($extensionAttributesMock);
+            ->method('setShippingAssignments')
+            ->with([$shippingAssignmentMock])
+            ->willReturnSelf();
+
+        return $extensionAttributesMock;
+    }
+
+    /**
+     * @return ShippingAssignment | PHPUnit_Framework_MockObject_MockObject
+     */
+    private function getShippingAssignmentMock()
+    {
+        $shippingAssignmentMock = $this->getMockBuilder(ShippingAssignment::class)
+            ->disableOriginalConstructor()
+            ->setMethods(['getShipping', 'setShipping'])
+            ->getMock();
+        $shippingMock = $this->getMockBuilder(Shipping::class)
+            ->disableOriginalConstructor()
+            ->setMethods(['setMethod'])
+            ->getMock();
+
+        $shippingAssignmentMock->expects($this->once())->method('getShipping')->willReturn($shippingMock);
+        $shippingMock->expects($this->once())->method('setMethod')->with(null)->willReturnSelf();
+        $shippingAssignmentMock->expects($this->once())->method('setShipping')->with($shippingMock);
+
+        return $shippingAssignmentMock;
+    }
+
+    private function mockShippingAssignment()
+    {
+        $shippingAssignmentMock = $this->getShippingAssignmentMock();
+
+        $extensionAttributesMock = $this->getExtensionAttributesMock($shippingAssignmentMock);
+
         $this->shippingAssignmentProcessorMock
             ->expects($this->once())
             ->method('create')
             ->with($this->quoteMock)
             ->willReturn($shippingAssignmentMock);
-        $shippingAssignmentMock->expects($this->once())->method('getShipping')->willReturn($shippingMock);
-        $shippingMock->expects($this->once())->method('setMethod')->with(null)->willReturnSelf();
-        $shippingAssignmentMock->expects($this->once())->method('setShipping')->with($shippingMock);
-        $extensionAttributesMock
+
+        $this->quoteMock
             ->expects($this->once())
-            ->method('setShippingAssignments')
-            ->with([$shippingAssignmentMock])
-            ->willReturnSelf();
-        $this->quoteMock->expects($this->once())->method('setExtensionAttributes')->with($extensionAttributesMock);
-        //save mock
-        $this->quoteMock->expects($this->once())->method('collectTotals')->willReturnSelf();
-        $this->quoteRepositoryMock->expects($this->once())->method('save')->with($this->quoteMock);
-        $this->model->setShippingMethods($methodsArray);
+            ->method('getExtensionAttributes')
+            ->willReturn($extensionAttributesMock);
+
+        $this->quoteMock
+            ->expects($this->once())
+            ->method('setExtensionAttributes')
+            ->with($extensionAttributesMock);
+    }
+
+    /**
+     * @param $customerAddressId
+     * @return Address | PHPUnit_Framework_MockObject_MockObject
+     */
+    private function getCustomerAddressMock($customerAddressId)
+    {
+        $customerAddressMock = $this->getMockBuilder(Address::class)
+            ->setMethods(['getId'])
+            ->disableOriginalConstructor()
+            ->getMock();
+        $customerAddressMock
+            ->expects($this->atLeastOnce())
+            ->method('getId')
+            ->willReturn($customerAddressId);
+        return $customerAddressMock;
+    }
+
+    /**
+     * @param string $className
+     * @return PHPUnit_Framework_MockObject_MockObject
+     */
+    private function createSimpleMock($className)
+    {
+        return $this->getMockBuilder($className)
+            ->disableOriginalConstructor()
+            ->getMock();
     }
 }
diff --git a/app/code/Magento/ProductVideo/view/frontend/web/js/load-player.js b/app/code/Magento/ProductVideo/view/frontend/web/js/load-player.js
index bddfdf9d39aa5e1537d868a6f3f1b8459445f9fc..81aec707dbe234d3dd72188c655195c829d84a65 100644
--- a/app/code/Magento/ProductVideo/view/frontend/web/js/load-player.js
+++ b/app/code/Magento/ProductVideo/view/frontend/web/js/load-player.js
@@ -317,7 +317,7 @@ define(['jquery', 'jquery/ui'], function ($) {
             if (this._loop) {
                 additionalParams += '&loop=1';
             }
-            src = 'http://player.vimeo.com/video/' +
+            src = window.location.protocol + '//player.vimeo.com/video/' +
                 this._code + '?api=1&player_id=vimeo' +
                 this._code +
                 timestamp +
diff --git a/app/code/Magento/Sitemap/Model/Sitemap.php b/app/code/Magento/Sitemap/Model/Sitemap.php
index 6e31c255526411d293dc1fd54c0f32a256378e8b..5bd25c978b7c31001e4346b13a9e72eee588e40c 100644
--- a/app/code/Magento/Sitemap/Model/Sitemap.php
+++ b/app/code/Magento/Sitemap/Model/Sitemap.php
@@ -586,7 +586,9 @@ class Sitemap extends \Magento\Framework\Model\AbstractModel
      */
     protected function _getStoreBaseUrl($type = \Magento\Framework\UrlInterface::URL_TYPE_LINK)
     {
-        return rtrim($this->_storeManager->getStore($this->getStoreId())->getBaseUrl($type), '/') . '/';
+        $store = $this->_storeManager->getStore($this->getStoreId());
+        $isSecure = $store->isUrlSecure();
+        return rtrim($store->getBaseUrl($type, $isSecure), '/') . '/';
     }
 
     /**
diff --git a/app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php b/app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php
index 8daa4d6e9331a2a533a19189b99e5b7821719157..65b55f3e8dc87c1019a4b08d7f96b8b1ec0ff7f8 100644
--- a/app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php
+++ b/app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php
@@ -50,6 +50,11 @@ class SitemapTest extends \PHPUnit_Framework_TestCase
      */
     protected $_fileMock;
 
+    /**
+     * @var \Magento\Store\Model\StoreManagerInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private $storeManagerMock;
+
     /**
      * Set helper mocks, create resource model mock
      */
@@ -473,6 +478,20 @@ class SitemapTest extends \PHPUnit_Framework_TestCase
 
         $model = $this->_getModelMock(true);
 
+        $storeMock = $this->getMockBuilder(\Magento\Store\Model\Store::class)
+            ->setMethods(['isFrontUrlSecure', 'getBaseUrl'])
+            ->disableOriginalConstructor()
+            ->getMock();
+        $storeMock->expects($this->atLeastOnce())->method('isFrontUrlSecure')->willReturn(false);
+        $storeMock->expects($this->atLeastOnce())
+            ->method('getBaseUrl')
+            ->with($this->isType('string'), false)
+            ->willReturn('http://store.com/');
+        $this->storeManagerMock->expects($this->atLeastOnce())
+            ->method('getStore')
+            ->with(1)
+            ->willReturn($storeMock);
+
         return $model;
     }
 
@@ -490,7 +509,6 @@ class SitemapTest extends \PHPUnit_Framework_TestCase
             '_getBaseDir',
             '_getFileObject',
             '_afterSave',
-            '_getStoreBaseUrl',
             '_getCurrentDateTime',
             '_getCategoryItemsCollection',
             '_getProductItemsCollection',
@@ -562,7 +580,6 @@ class SitemapTest extends \PHPUnit_Framework_TestCase
         )->getMock();
 
         $model->expects($this->any())->method('_getResource')->will($this->returnValue($this->_resourceMock));
-        $model->expects($this->any())->method('_getStoreBaseUrl')->will($this->returnValue('http://store.com/'));
         $model->expects(
             $this->any()
         )->method(
@@ -611,6 +628,10 @@ class SitemapTest extends \PHPUnit_Framework_TestCase
         )->disableOriginalConstructor()->getMock();
         $cmsFactory->expects($this->any())->method('create')->will($this->returnValue($this->_sitemapCmsPageMock));
 
+        $this->storeManagerMock = $this->getMockBuilder(\Magento\Store\Model\StoreManagerInterface::class)
+            ->setMethods(['getStore'])
+            ->getMockForAbstractClass();
+
         $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
         $constructArguments = $objectManager->getConstructArguments(
             \Magento\Sitemap\Model\Sitemap::class,
@@ -618,6 +639,7 @@ class SitemapTest extends \PHPUnit_Framework_TestCase
                 'categoryFactory' => $categoryFactory,
                 'productFactory' => $productFactory,
                 'cmsFactory' => $cmsFactory,
+                'storeManager' => $this->storeManagerMock,
                 'sitemapData' => $this->_helperMockSitemap,
                 'filesystem' => $this->_filesystemMock
             ]
diff --git a/dev/tests/functional/lib/Magento/Mtf/Client/Element/LiselectstoreElement.php b/dev/tests/functional/lib/Magento/Mtf/Client/Element/LiselectstoreElement.php
index 65985c017d08195438e94d07b032d035c6712788..1ef99365d95eb681d06b9295bd85649e2886fb6d 100644
--- a/dev/tests/functional/lib/Magento/Mtf/Client/Element/LiselectstoreElement.php
+++ b/dev/tests/functional/lib/Magento/Mtf/Client/Element/LiselectstoreElement.php
@@ -74,7 +74,7 @@ class LiselectstoreElement extends SimpleElement
         }
         $optionSelector = './/' . implode($this->optionMaskFollowing, $optionSelector) . '/a';
 
-        $option = $this->driver->find($optionSelector, Locator::SELECTOR_XPATH);
+        $option = $this->context->find($optionSelector, Locator::SELECTOR_XPATH);
         if (!$option->isVisible()) {
             throw new \Exception('[' . implode('/', $value) . '] option is not visible in store switcher.');
         }
diff --git a/dev/tests/functional/phpunit.xml.dist b/dev/tests/functional/phpunit.xml.dist
index bcd8adec52eee81173b52bcaa3efca23efaa6a6e..afc68476ee4123c72a4f52e9f3cc8cf84c67aa0b 100644
--- a/dev/tests/functional/phpunit.xml.dist
+++ b/dev/tests/functional/phpunit.xml.dist
@@ -39,6 +39,7 @@
         <env name="basedir" value="var/log" />
         <env name="credentials_file_path" value="./credentials.xml.dist" />
         <env name="mage_mode" value="developer" />
+        <env name="magento_timezone" value="America/Los_Angeles" />
     </php>
 
 </phpunit>
diff --git a/dev/tests/functional/tests/app/Magento/Backend/Test/Fixture/Source/Date.php b/dev/tests/functional/tests/app/Magento/Backend/Test/Fixture/Source/Date.php
index 9bc78a1416ef8536e51da1e69b499add05a4567f..2d625e2a7213153a2d3f98a9829645187b261691 100644
--- a/dev/tests/functional/tests/app/Magento/Backend/Test/Fixture/Source/Date.php
+++ b/dev/tests/functional/tests/app/Magento/Backend/Test/Fixture/Source/Date.php
@@ -13,9 +13,17 @@ use Magento\Mtf\Fixture\DataSource;
  *
  * Data keys:
  *  - pattern (Format a local time/date with delta, e.g. 'm/d/Y -3 days' = current day - 3 days)
+ *  - apply_timezone (true if it is needed to apply timezone)
  */
 class Date extends DataSource
 {
+    /**
+     * Indicates whether timezone setting is applied or not.
+     *
+     * @var bool
+     */
+    private $isTimezoneApplied;
+
     /**
      * @constructor
      * @param array $params
@@ -35,7 +43,16 @@ class Date extends DataSource
             if (!$timestamp) {
                 throw new \Exception('Invalid date format for "' . $this->params['attribute_code'] . '" field');
             }
-            $date = date(str_replace($delta, '', $data['pattern']), $timestamp);
+            if (isset($data['apply_timezone']) && $data['apply_timezone'] === true) {
+                $date = new \DateTime();
+                $date->setTimestamp($timestamp);
+                $date->setTimezone(new \DateTimeZone($_ENV['magento_timezone']));
+                $date = $date->format(str_replace($delta, '', $data['pattern']));
+                $this->isTimezoneApplied = true;
+            } else {
+                $date = date(str_replace($delta, '', $data['pattern']), $timestamp);
+                $this->isTimezoneApplied = false;
+            }
             if (!$date) {
                 $date = date('m/d/Y');
             }
@@ -44,4 +61,14 @@ class Date extends DataSource
             $this->data = $data;
         }
     }
+
+    /**
+     * Verifies if timezone setting has been already applied.
+     *
+     * @return bool
+     */
+    public function isTimezoneApplied()
+    {
+        return $this->isTimezoneApplied;
+    }
 }
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/ProductForm.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/ProductForm.xml
index 2f0b248b800b3ce9feb2c42129a13975821dfefe..ebab7cc83b283e2a8bd5285c5361cdba7f453385 100644
--- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/ProductForm.xml
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/ProductForm.xml
@@ -57,6 +57,10 @@
                 <selector>[name="use_default[name]"]</selector>
                 <input>checkbox</input>
             </use_default_name>
+            <use_default_price>
+                <selector>[name="use_default[price]"]</selector>
+                <input>checkbox</input>
+            </use_default_price>
         </fields>
     </product-details>
     <advanced-pricing>
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/CatalogProductSimple.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/CatalogProductSimple.xml
index bb2c8bc6ead7cdca55ab42daf72e3e88f0f79310..8f73299d5f6dcfc234465faddec418a67964d092 100644
--- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/CatalogProductSimple.xml
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/CatalogProductSimple.xml
@@ -48,6 +48,7 @@
         <field name="msrp_display_actual_price_type" is_required="0" />
         <field name="name" is_required="1" group="product-details" />
         <field name="use_default_name" group="product-details" />
+        <field name="use_default_price" group="product-details" />
         <field name="old_id" is_required="0" />
         <field name="options_container" is_required="0" />
         <field name="page_layout" is_required="0" />
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple.xml
index 79b00f58cd742cb3bf19175e5916209b21810d0d..e9791de338bd36e9c5ec904423888913a54f6211 100644
--- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple.xml
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductSimple.xml
@@ -1799,5 +1799,35 @@
                 <item name="dataset" xsi:type="string">simple_order_default</item>
             </field>
         </dataset>
+
+        <dataset name="product_with_additional_website">
+            <field name="sku" xsi:type="string">simple_product_with_category_%isolation%</field>
+            <field name="name" xsi:type="string">Simple product with category %isolation%</field>
+            <field name="quantity_and_stock_status" xsi:type="array">
+                <item name="qty" xsi:type="string">777</item>
+                <item name="is_in_stock" xsi:type="string">In Stock</item>
+            </field>
+            <field name="product_has_weight" xsi:type="string">This item has weight</field>
+            <field name="weight" xsi:type="string">1</field>
+            <field name="attribute_set_id" xsi:type="array">
+                <item name="dataset" xsi:type="string">default</item>
+            </field>
+            <field name="price" xsi:type="array">
+                <item name="value" xsi:type="string">10</item>
+                <item name="dataset" xsi:type="string" />
+            </field>
+            <field name="category_ids" xsi:type="array">
+                <item name="dataset" xsi:type="string">default_subcategory</item>
+            </field>
+            <field name="website_ids" xsi:type="array">
+                <item name="0" xsi:type="array">
+                    <item name="dataset" xsi:type="string">default</item>
+                </item>
+                <item name="1" xsi:type="array">
+                    <item name="dataset" xsi:type="string">custom_store</item>
+                </item>
+            </field>
+            <field name="url_key" xsi:type="string">simple-product-%isolation%</field>
+        </dataset>
     </repository>
 </config>
diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/ConfigData.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/ConfigData.xml
index 308bff869265fb64eb4a667c30397e84dd174864..28ea191568cb6c8bc4b12cb3eb84b9aeb5092907 100644
--- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/ConfigData.xml
+++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/ConfigData.xml
@@ -45,5 +45,21 @@
                 <item name="inherit" xsi:type="number">1</item>
             </field>
         </dataset>
+        <dataset name="price_scope_website">
+            <field name="catalog/price/scope" xsi:type="array">
+                <item name="scope" xsi:type="string">default</item>
+                <item name="scope_id" xsi:type="number">0</item>
+                <item name="label" xsi:type="string">Website</item>
+                <item name="value" xsi:type="number">1</item>
+            </field>
+        </dataset>
+        <dataset name="price_scope_website_rollback">
+            <field name="catalog/price/scope" xsi:type="array">
+                <item name="scope" xsi:type="string">default</item>
+                <item name="scope_id" xsi:type="number">0</item>
+                <item name="label" xsi:type="string">Global</item>
+                <item name="value" xsi:type="number">0</item>
+            </field>
+        </dataset>
     </repository>
 </config>
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/CustomerRepositoryTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/CustomerRepositoryTest.php
index 33ad076c0fce299f0b461ed19dfb13dc29150cc7..a74c86e8e093d5b7e92706321fc2f2dd08315196 100644
--- a/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/CustomerRepositoryTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/CustomerRepositoryTest.php
@@ -505,4 +505,42 @@ class CustomerRepositoryTest extends \PHPUnit_Framework_TestCase
             'default_shipping customer attribute did not updated'
         );
     }
+
+    /**
+     * @magentoDataFixture Magento/Customer/_files/customer.php
+     * @magentoDbIsolation enabled
+     */
+    public function testUpdateDefaultShippingAndDefaultBillingTest()
+    {
+        $customerId = 1;
+        $customerData = [
+            "id" => 1,
+            "website_id" => 1,
+            "email" => "roni_cost@example.com",
+            "firstname" => "1111",
+            "lastname" => "Boss",
+            "middlename" => null,
+            "gender" => 0
+        ];
+
+        $customerEntity = $this->customerFactory->create(['data' => $customerData]);
+
+        $customer = $this->customerRepository->getById($customerId);
+        $oldDefaultBilling = $customer->getDefaultBilling();
+        $oldDefaultShipping = $customer->getDefaultShipping();
+
+        $savedCustomer = $this->customerRepository->save($customerEntity);
+
+        $this->assertEquals(
+            $savedCustomer->getDefaultBilling(),
+            $oldDefaultBilling,
+            'Default billing shoud not be overridden'
+        );
+
+        $this->assertEquals(
+            $savedCustomer->getDefaultShipping(),
+            $oldDefaultShipping,
+            'Default shipping shoud not be overridden'
+        );
+    }
 }
diff --git a/nginx.conf.sample b/nginx.conf.sample
index ec524374900f64b4ed0307ae8e17501e814a3f62..9f94f72e6c876930eb82db865907594ee174705e 100644
--- a/nginx.conf.sample
+++ b/nginx.conf.sample
@@ -108,7 +108,7 @@ location /static/ {
         expires +1y;
 
         if (!-f $request_filename) {
-            rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
+            rewrite ^/static/?(.*)$ /static.php?resource=$1 last;
         }
     }
     location ~* \.(zip|gz|gzip|bz2|csv|xml)$ {
@@ -117,11 +117,11 @@ location /static/ {
         expires    off;
 
         if (!-f $request_filename) {
-           rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
+           rewrite ^/static/?(.*)$ /static.php?resource=$1 last;
         }
     }
     if (!-f $request_filename) {
-        rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;
+        rewrite ^/static/?(.*)$ /static.php?resource=$1 last;
     }
     add_header X-Frame-Options "SAMEORIGIN";
 }