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/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";
 }