diff --git a/app/code/Magento/Eav/Model/Config.php b/app/code/Magento/Eav/Model/Config.php
index 36be7733dcd75a1fed3c7f63072f546d32378416..89d0bc93c80073ae3f305445f808305265ab9848 100644
--- a/app/code/Magento/Eav/Model/Config.php
+++ b/app/code/Magento/Eav/Model/Config.php
@@ -6,6 +6,8 @@
 namespace Magento\Eav\Model;
 
 use Magento\Eav\Model\Entity\Type;
+use Magento\Framework\Serialize\SerializerInterface;
+use Magento\Framework\App\ObjectManager;
 
 /**
  * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -92,6 +94,11 @@ class Config
      */
     protected $_universalFactory;
 
+    /**
+     * @var SerializerInterface
+     */
+    private $serializer;
+
     /**
      * @param \Magento\Framework\App\CacheInterface $cache
      * @param \Magento\Eav\Model\Entity\TypeFactory $entityTypeFactory
@@ -105,13 +112,15 @@ class Config
         \Magento\Eav\Model\Entity\TypeFactory $entityTypeFactory,
         \Magento\Eav\Model\ResourceModel\Entity\Type\CollectionFactory $entityTypeCollectionFactory,
         \Magento\Framework\App\Cache\StateInterface $cacheState,
-        \Magento\Framework\Validator\UniversalFactory $universalFactory
+        \Magento\Framework\Validator\UniversalFactory $universalFactory,
+        SerializerInterface $serializer = null
     ) {
         $this->_cache = $cache;
         $this->_entityTypeFactory = $entityTypeFactory;
         $this->entityTypeCollectionFactory = $entityTypeCollectionFactory;
         $this->_cacheState = $cacheState;
         $this->_universalFactory = $universalFactory;
+        $this->serializer = $serializer ?: ObjectManager::getInstance()->get(SerializerInterface::class);
     }
 
     /**
@@ -278,7 +287,7 @@ class Config
         \Magento\Framework\Profiler::start('EAV: ' . __METHOD__, ['group' => 'EAV', 'method' => __METHOD__]);
 
         if ($this->isCacheEnabled() && ($cache = $this->_cache->load(self::ENTITIES_CACHE_ID))) {
-            $this->_entityTypeData = unserialize($cache);
+            $this->_entityTypeData = $this->serializer->unserialize($cache);
             foreach ($this->_entityTypeData as $typeCode => $data) {
                 $typeId = $data['entity_type_id'];
                 $this->_addEntityTypeReference($typeId, $typeCode);
@@ -302,7 +311,7 @@ class Config
 
         if ($this->isCacheEnabled()) {
             $this->_cache->save(
-                serialize($this->_entityTypeData),
+                $this->serializer->serialize($this->_entityTypeData),
                 self::ENTITIES_CACHE_ID,
                 [
                     \Magento\Eav\Model\Cache\Type::CACHE_TAG,
@@ -372,7 +381,7 @@ class Config
         }
         $cacheKey = self::ATTRIBUTES_CACHE_ID . $entityTypeCode;
         if ($this->isCacheEnabled() && ($attributes = $this->_cache->load($cacheKey))) {
-            $attributes = unserialize($attributes);
+            $attributes = $this->serializer->unserialize($attributes);
             if ($attributes) {
                 foreach ($attributes as $attribute) {
                     $this->_createAttribute($entityType, $attribute);
@@ -402,7 +411,7 @@ class Config
         }
         if ($this->isCacheEnabled()) {
             $this->_cache->save(
-                serialize($this->_attributeData[$entityTypeCode]),
+                $this->serializer->serialize($this->_attributeData[$entityTypeCode]),
                 $cacheKey,
                 [
                     \Magento\Eav\Model\Cache\Type::CACHE_TAG,
@@ -487,7 +496,7 @@ class Config
         }
 
         if ($this->isCacheEnabled() && ($attributes = $this->_cache->load($cacheKey))) {
-            $this->_attributeCodes[$cacheKey] = unserialize($attributes);
+            $this->_attributeCodes[$cacheKey] = $this->serializer->unserialize($attributes);
             return $this->_attributeCodes[$cacheKey];
         }
 
@@ -514,7 +523,7 @@ class Config
         $this->_attributeCodes[$cacheKey] = $attributes;
         if ($this->isCacheEnabled()) {
             $this->_cache->save(
-                serialize($attributes),
+                $this->serializer->serialize($attributes),
                 $cacheKey,
                 [
                     \Magento\Eav\Model\Cache\Type::CACHE_TAG,
diff --git a/app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute/Set.php b/app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute/Set.php
index 4e6e45f5d2270aa42e049ae2fe52c60bd1bce82b..b3e7bf2bc3925224cace683b4aba2fe57b29e63e 100644
--- a/app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute/Set.php
+++ b/app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute/Set.php
@@ -5,11 +5,8 @@
  */
 namespace Magento\Eav\Model\ResourceModel\Entity\Attribute;
 
-/**
- * Eav attribute set resource model
- *
- * @author      Magento Core Team <core@magentocommerce.com>
- */
+use Magento\Framework\Serialize\SerializerInterface;
+
 class Set extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
 {
     /**
@@ -27,6 +24,11 @@ class Set extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
      */
     protected $eavConfig;
 
+    /**
+     * @var SerializerInterface
+     */
+    private $serializer;
+
     /**
      * @param \Magento\Framework\Model\ResourceModel\Db\Context $context
      * @param GroupFactory $attrGroupFactory
@@ -152,7 +154,7 @@ class Set extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
         $cacheKey = self::ATTRIBUTES_CACHE_ID . $setId;
 
         if ($this->eavConfig->isCacheEnabled() && ($cache = $this->eavConfig->getCache()->load($cacheKey))) {
-            $setInfoData = unserialize($cache);
+            $setInfoData = $this->getSerializer()->unserialize($cache);
         } else {
             $attributeSetData = $this->fetchAttributeSetData($setId);
 
@@ -168,7 +170,7 @@ class Set extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
 
             if ($this->eavConfig->isCacheEnabled()) {
                 $this->eavConfig->getCache()->save(
-                    serialize($setInfoData),
+                    $this->getSerializer()->serialize($setInfoData),
                     $cacheKey,
                     [
                         \Magento\Eav\Model\Cache\Type::CACHE_TAG,
@@ -233,4 +235,19 @@ class Set extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
         }
         return $connection->fetchAll($select, $bind);
     }
+
+    /**
+     * Get serializer
+     *
+     * @return SerializerInterface
+     * @deprecated
+     */
+    private function getSerializer()
+    {
+        if (null === $this->serializer) {
+            $this->serializer = \Magento\Framework\App\ObjectManager::getInstance()
+                ->get(SerializerInterface::class);
+        }
+        return $this->serializer;
+    }
 }
diff --git a/app/code/Magento/Eav/Plugin/Model/ResourceModel/Entity/Attribute.php b/app/code/Magento/Eav/Plugin/Model/ResourceModel/Entity/Attribute.php
index c76449b1223ed3369df37202da1415c7f14a5187..3452d452ac490c759c33e8e380acb0593de63125 100644
--- a/app/code/Magento/Eav/Plugin/Model/ResourceModel/Entity/Attribute.php
+++ b/app/code/Magento/Eav/Plugin/Model/ResourceModel/Entity/Attribute.php
@@ -5,6 +5,13 @@
  */
 namespace Magento\Eav\Plugin\Model\ResourceModel\Entity;
 
+use Magento\Framework\App\CacheInterface;
+use Magento\Framework\App\Cache\StateInterface;
+use Magento\Framework\Serialize\SerializerInterface;
+use Magento\Eav\Model\ResourceModel\Entity\Attribute as AttributeResource;
+use Magento\Eav\Model\Cache\Type;
+use Magento\Eav\Model\Entity\Attribute as EntityAttribute;
+
 class Attribute
 {
     /**
@@ -12,52 +19,74 @@ class Attribute
      */
     const STORE_LABEL_ATTRIBUTE = 'EAV_STORE_LABEL_ATTRIBUTE';
 
-    /** @var \Magento\Framework\App\CacheInterface */
-    protected $cache;
+    /**
+     * @var CacheInterface
+     */
+    private $cache;
+
+    /**
+     * @var StateInterface
+     */
+    private $cacheState;
 
-    /** @var bool|null */
-    protected $isCacheEnabled = null;
+    /**
+     * @var SerializerInterface
+     */
+    private $serializer;
 
     /**
-     * @param \Magento\Framework\App\CacheInterface $cache
-     * @param \Magento\Framework\App\Cache\StateInterface $cacheState
+     * @param CacheInterface $cache
+     * @param StateInterface $cacheState
+     * @param SerializerInterface $serializer
      * @codeCoverageIgnore
      */
     public function __construct(
-        \Magento\Framework\App\CacheInterface $cache,
-        \Magento\Framework\App\Cache\StateInterface $cacheState
+        CacheInterface $cache,
+        StateInterface $cacheState,
+        SerializerInterface $serializer
     ) {
         $this->cache = $cache;
-        $this->isCacheEnabled = $cacheState->isEnabled(\Magento\Eav\Model\Cache\Type::TYPE_IDENTIFIER);
+        $this->serializer = $serializer;
+        $this->cacheState = $cacheState;;
     }
 
     /**
-     * @param \Magento\Eav\Model\ResourceModel\Entity\Attribute $subject
+     * @param AttributeResource $subject
      * @param callable $proceed
      * @param int $attributeId
      * @return array
      * @SuppressWarnings(PHPMD.UnusedFormalParameter)
      */
     public function aroundGetStoreLabelsByAttributeId(
-        \Magento\Eav\Model\ResourceModel\Entity\Attribute $subject,
+        AttributeResource $subject,
         \Closure $proceed,
         $attributeId
     ) {
         $cacheId = self::STORE_LABEL_ATTRIBUTE . $attributeId;
-        if ($this->isCacheEnabled && ($storeLabels = $this->cache->load($cacheId))) {
-            return unserialize($storeLabels);
+        if ($this->isCacheEnabled() && ($storeLabels = $this->cache->load($cacheId))) {
+            return $this->serializer->unserialize($storeLabels);
         }
         $storeLabels = $proceed($attributeId);
-        if ($this->isCacheEnabled) {
+        if ($this->isCacheEnabled()) {
             $this->cache->save(
-                serialize($storeLabels),
+                $this->serializer->serialize($storeLabels),
                 $cacheId,
                 [
-                    \Magento\Eav\Model\Cache\Type::CACHE_TAG,
-                    \Magento\Eav\Model\Entity\Attribute::CACHE_TAG
+                    Type::CACHE_TAG,
+                    EntityAttribute::CACHE_TAG
                 ]
             );
         }
         return $storeLabels;
     }
+
+    /**
+     * Check if cache is enabled
+     * 
+     * @return bool
+     */
+    private function isCacheEnabled()
+    {
+        return $this->cacheState->isEnabled(Type::TYPE_IDENTIFIER);
+    }
 }
diff --git a/app/code/Magento/Eav/Test/Unit/Model/ConfigTest.php b/app/code/Magento/Eav/Test/Unit/Model/ConfigTest.php
index f5fad571f205c14232676327269c52b3cb61370a..ff1e186de604a0b71b0bf765579f74fdd73aa4c4 100644
--- a/app/code/Magento/Eav/Test/Unit/Model/ConfigTest.php
+++ b/app/code/Magento/Eav/Test/Unit/Model/ConfigTest.php
@@ -3,11 +3,15 @@
  * Copyright © 2016 Magento. All rights reserved.
  * See COPYING.txt for license details.
  */
-
 namespace Magento\Eav\Test\Unit\Model;
 
 use Magento\Framework\DataObject;
 use Magento\Eav\Model\Config;
+use Magento\Framework\Serialize\SerializerInterface;
+use Magento\Eav\Model\Entity\Type;
+use Magento\Eav\Model\Cache\Type as Cache;
+use Magento\Eav\Model\Entity\Attribute;
+use Magento\Eav\Model\ResourceModel\Entity\Attribute\Collection;
 
 class ConfigTest extends \PHPUnit_Framework_TestCase
 {
@@ -34,19 +38,26 @@ class ConfigTest extends \PHPUnit_Framework_TestCase
     /**
      * @var \Magento\Framework\App\Cache\StateInterface|\PHPUnit_Framework_MockObject_MockObject
      */
-    protected $stateMock;
+    protected $cacheStateMock;
 
     /**
      * @var \Magento\Framework\Validator\UniversalFactory|\PHPUnit_Framework_MockObject_MockObject
      */
     protected $universalFactoryMock;
 
+    /**
+     * @var SerializerInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private $serializerMock;
+
+    /**
+     * @var Type|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private $typeMock;
+
     protected function setUp()
     {
-        $this->cacheMock = $this->getMockBuilder(\Magento\Framework\App\CacheInterface::class)
-            ->disableOriginalConstructor()
-            ->setMethods(['load', 'getFrontend', 'save', 'remove', 'clean'])
-            ->getMock();
+        $this->cacheMock = $this->getMock(\Magento\Framework\App\CacheInterface::class);
         $this->typeFactoryMock = $this->getMockBuilder(\Magento\Eav\Model\Entity\TypeFactory::class)
             ->setMethods(['create'])
             ->disableOriginalConstructor()
@@ -56,35 +67,44 @@ class ConfigTest extends \PHPUnit_Framework_TestCase
             ->setMethods(['create'])
             ->disableOriginalConstructor()
             ->getMock();
-        $this->stateMock = $this->getMockBuilder(\Magento\Framework\App\Cache\StateInterface::class)
-            ->setMethods(['isEnabled', 'setEnabled', 'persist'])
-            ->disableOriginalConstructor()
-            ->getMock();
+        $this->cacheStateMock = $this->getMock(\Magento\Framework\App\Cache\StateInterface::class);
         $this->universalFactoryMock = $this->getMockBuilder(\Magento\Framework\Validator\UniversalFactory::class)
             ->setMethods(['create'])
             ->disableOriginalConstructor()
             ->getMock();
 
+        $this->serializerMock = $this->getMock(SerializerInterface::class);
+
+        $this->typeMock = $this->getMock(Type::class, [], [], '', false);
+
         $this->config = new Config(
             $this->cacheMock,
             $this->typeFactoryMock,
             $this->collectionFactoryMock,
-            $this->stateMock,
-            $this->universalFactoryMock
+            $this->cacheStateMock,
+            $this->universalFactoryMock,
+            $this->serializerMock
         );
     }
 
     /**
      * @param boolean $cacheEnabled
      * @param int $loadCalls
-     * @param string $cachedValue
+     * @param int $cachedValue
+     * @param int $unserializeCalls
      * @dataProvider getAttributeCacheDataProvider
      * @return void
      */
-    public function testGetAttributeCache($cacheEnabled, $loadCalls, $cachedValue)
+    public function testGetAttributeCache($cacheEnabled, $loadCalls, $unserializeCalls, $cachedValue)
     {
+        $attributeData = [
+            [
+                'attribute_code' => 'attribute_code_1',
+                'attribute_id' => 1
+            ]
+        ];
         $attributeCollectionMock = $this->getMockBuilder(
-            \Magento\Eav\Model\ResourceModel\Entity\Attribute\Collection::class
+            Collection::class
         )->disableOriginalConstructor()
             ->setMethods(['getData', 'setEntityTypeFilter'])
             ->getMock();
@@ -96,29 +116,40 @@ class ConfigTest extends \PHPUnit_Framework_TestCase
             ->expects($this->any())
             ->method('getData')
             ->willReturn([]);
-        $entityAttributeMock = $this->getMockBuilder(\Magento\Eav\Model\Entity\Attribute::class)
+        $entityAttributeMock = $this->getMockBuilder(Attribute::class)
             ->setMethods(['setData'])
             ->disableOriginalConstructor()
             ->getMock();
         $factoryCalls = [
-            [\Magento\Eav\Model\ResourceModel\Entity\Attribute\Collection::class, [], $attributeCollectionMock],
-            [\Magento\Eav\Model\Entity\Attribute::class, [], $entityAttributeMock],
+            [
+                Collection::class,
+                [],
+                $attributeCollectionMock
+            ],
+            [
+                Attribute::class,
+                [],
+                $entityAttributeMock
+            ],
         ];
 
-        $this->stateMock
+        $this->cacheStateMock
             ->expects($this->atLeastOnce())
             ->method('isEnabled')
-            ->with(\Magento\Eav\Model\Cache\Type::TYPE_IDENTIFIER)
+            ->with(Cache::TYPE_IDENTIFIER)
             ->willReturn($cacheEnabled);
         $this->cacheMock
             ->expects($this->exactly($loadCalls))
             ->method('load')
             ->with(Config::ATTRIBUTES_CACHE_ID)
             ->willReturn($cachedValue);
+        $this->serializerMock
+            ->expects($this->exactly($unserializeCalls))
+            ->method('unserialize')
+            ->with($cachedValue)
+            ->willReturn($attributeData);
 
-        $collectionStub = new DataObject([
-            ['entity_type_code' => 'type_code_1', 'entity_type_id' => 1],
-        ]);
+        $collectionStub = new DataObject([$attributeData]);
         $this->collectionFactoryMock
             ->expects($this->any())
             ->method('create')
@@ -134,7 +165,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase
             ->method('create')
             ->will($this->returnValueMap($factoryCalls));
 
-        $entityType = $this->getMockBuilder(\Magento\Eav\Model\Entity\Type::class)
+        $entityType = $this->getMockBuilder(Type::class)
             ->setMethods(['getEntity', 'setData', 'getData'])
             ->disableOriginalConstructor()
             ->getMock();
@@ -151,38 +182,145 @@ class ConfigTest extends \PHPUnit_Framework_TestCase
             'cache-disabled' => [
                 false,
                 0,
+                0,
                 false,
             ],
             'cache-miss' => [
                 true,
                 1,
+                0,
                 false,
             ],
             'cached' => [
                 true,
                 1,
-                serialize(
-                    [
-                        ['attribute_code' => 'attribute_code_1', 'attribute_id' => 1],
-                    ]
-                ),
+                1,
+                'attribute serialzied data',
             ],
         ];
     }
 
     public function testClear()
     {
-        $this->cacheMock
-            ->expects($this->once())
+        $this->cacheMock->expects($this->once())
             ->method('clean')
             ->with(
                 $this->equalTo(
                     [
-                        \Magento\Eav\Model\Cache\Type::CACHE_TAG,
-                        \Magento\Eav\Model\Entity\Attribute::CACHE_TAG,
+                        Cache::CACHE_TAG,
+                        Attribute::CACHE_TAG,
                     ]
                 )
             );
         $this->config->clear();
     }
+
+    public function testGetEntityTypeInstanceOfTypePassed()
+    {
+        $this->assertEquals(
+            $this->typeMock,
+            $this->config->getEntityType($this->typeMock)
+        );
+    }
+
+    public function testGetEntityTypeCacheExists()
+    {
+        $entityTypeCode = 'catalog_product';
+        $data = [
+            $entityTypeCode => [
+                'entity_type_id' => 1
+            ]
+        ];
+        $serializedData = 'serialized data';
+        $this->cacheStateMock->expects($this->once())
+            ->method('isEnabled')
+            ->with(Cache::TYPE_IDENTIFIER)
+            ->willReturn(true);
+        $this->cacheMock->expects($this->once())
+            ->method('load')
+            ->with(Config::ENTITIES_CACHE_ID)
+            ->willReturn($serializedData);
+        $this->serializerMock->expects($this->once())
+            ->method('unserialize')
+            ->with($serializedData)
+            ->willReturn($data);
+        $this->typeMock->expects($this->exactly(2))
+            ->method('getId')
+            ->willReturn($data[$entityTypeCode]['entity_type_id']);
+        $this->typeMock->expects($this->once())
+            ->method('getEntityTypeCode')
+            ->willReturn($entityTypeCode);
+        $this->typeFactoryMock->expects($this->once())
+            ->method('create')
+            ->with(['data' => $data[$entityTypeCode]])
+            ->willReturn($this->typeMock);
+        $this->assertInstanceOf(
+            Type::class,
+            $this->config->getEntityType($entityTypeCode)
+        );
+    }
+
+    public function testGetEntityTypeCacheDoesNotExist()
+    {
+        $entityTypeCode = 'catalog_product';
+        $collectionData = [
+            [
+                'entity_type_id' => 1,
+                'entity_type_code' => $entityTypeCode
+            ]
+        ];
+        $data = [
+            $entityTypeCode => [
+                'entity_type_id' => 1,
+                'entity_type_code' => $entityTypeCode,
+                'attribute_model' => Attribute::class
+            ]
+        ];
+        $serializedData = 'serialized data';
+        $this->cacheStateMock->expects($this->once())
+            ->method('isEnabled')
+            ->with(Cache::TYPE_IDENTIFIER)
+            ->willReturn(true);
+        $this->cacheMock->expects($this->once())
+            ->method('load')
+            ->with(Config::ENTITIES_CACHE_ID)
+            ->willReturn(false);
+        $this->serializerMock->expects($this->never())
+            ->method('unserialize');
+        $attributeCollectionMock = $this->getMock(Collection::class, [], [], '', false);
+        $this->collectionFactoryMock->expects($this->once())
+            ->method('create')
+            ->willReturn($attributeCollectionMock);
+        $attributeCollectionMock->expects($this->once())
+            ->method('getData')
+            ->willReturn($collectionData);
+        $this->serializerMock->expects($this->once())
+            ->method('serialize')
+            ->with($data)
+            ->willReturn($serializedData);
+        $this->cacheMock->expects($this->once())
+            ->method('save')
+            ->with(
+                $serializedData,
+                Config::ENTITIES_CACHE_ID,
+                [
+                    Cache::CACHE_TAG,
+                    Attribute::CACHE_TAG
+                ]
+            );
+        $this->typeMock->expects($this->exactly(2))
+            ->method('getId')
+            ->willReturn($data[$entityTypeCode]['entity_type_id']);
+        $this->typeMock->expects($this->once())
+            ->method('getEntityTypeCode')
+            ->willReturn($entityTypeCode);
+        $this->typeFactoryMock->expects($this->once())
+            ->method('create')
+            ->with(['data' => $data[$entityTypeCode]])
+            ->willReturn($this->typeMock);
+        $this->assertInstanceOf(
+            Type::class,
+            $this->config->getEntityType($entityTypeCode)
+        );
+    }
 }
diff --git a/app/code/Magento/Eav/Test/Unit/Model/ResourceModel/Entity/Attribute/SetTest.php b/app/code/Magento/Eav/Test/Unit/Model/ResourceModel/Entity/Attribute/SetTest.php
index a380b14595eb24afb563dfccb94f867de55e5eff..e00a8ee97648c0768c7dac4c10359e1378856674 100644
--- a/app/code/Magento/Eav/Test/Unit/Model/ResourceModel/Entity/Attribute/SetTest.php
+++ b/app/code/Magento/Eav/Test/Unit/Model/ResourceModel/Entity/Attribute/SetTest.php
@@ -1,14 +1,14 @@
 <?php
 /** 
- *
  * Copyright © 2016 Magento. All rights reserved.
  * See COPYING.txt for license details.
  */
-
 namespace Magento\Eav\Test\Unit\Model\ResourceModel\Entity\Attribute;
 
 use Magento\Eav\Model\ResourceModel\Entity\Attribute\Set;
- 
+use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
+use Magento\Framework\Serialize\SerializerInterface;
+
 /**
  * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
  */
@@ -49,11 +49,17 @@ class SetTest extends \PHPUnit_Framework_TestCase
      */
     protected $relationProcessor;
 
+    /**
+     * @var SerializerInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private $serializerMock;
+
     /**
      * {@inheritdoc}
      */
     protected function setUp()
     {
+        $objectManager = new ObjectManager($this);
         $this->resourceMock = $this->getMockBuilder(\Magento\Framework\App\ResourceConnection::class)
             ->disableOriginalConstructor()
             ->setMethods(['getConnection', 'getTableName'])
@@ -81,31 +87,28 @@ class SetTest extends \PHPUnit_Framework_TestCase
             ->setMethods(['isCacheEnabled', 'getEntityType', 'getCache'])
             ->disableOriginalConstructor()
             ->getMock();
-        $this->model = $this->getMock(
+
+        $this->serializerMock = $this->getMock(SerializerInterface::class);
+
+        $attributeGroupFactoryMock = $this->getMock(
+            \Magento\Eav\Model\ResourceModel\Entity\Attribute\GroupFactory::class,
+            [],
+            [],
+            '',
+            false
+        );
+
+        $this->model = $objectManager->getObject(
             \Magento\Eav\Model\ResourceModel\Entity\Attribute\Set::class,
             [
-                'beginTransaction',
-                'getMainTable',
-                'getIdFieldName',
-                '_afterDelete',
-                'commit',
-                'rollBack',
-                '__wakeup'
-            ],
-            [
-                $contextMock,
-                $this->getMock(
-                    \Magento\Eav\Model\ResourceModel\Entity\Attribute\GroupFactory::class,
-                    [],
-                    [],
-                    '',
-                    false
-                ),
-                $this->eavConfigMock
-            ],
-            '',
-            true
+                'context' => $contextMock,
+                'attrGroupFactory' => $attributeGroupFactoryMock,
+                'eavConfig' => $this->eavConfigMock
+            ]
         );
+
+        $objectManager->setBackwardCompatibleProperty($this->model, 'serializer', $this->serializerMock);
+
         $this->typeMock = $this->getMock(\Magento\Eav\Model\Entity\Type::class, [], [], '', false);
         $this->objectMock = $this->getMock(
             \Magento\Framework\Model\AbstractModel::class,
@@ -123,7 +126,6 @@ class SetTest extends \PHPUnit_Framework_TestCase
             '',
             false
         );
-
     }
 
     /**
@@ -182,6 +184,22 @@ class SetTest extends \PHPUnit_Framework_TestCase
      */
     public function testGetSetInfoCacheMiss()
     {
+        $serializedData = 'serialized data';
+        $setElement = [
+            10000 => [
+                'group_id' => 10,
+                'group_sort' => 100,
+                'sort' => 1000
+            ]
+        ];
+        $setData = [
+            1 => $setElement,
+            2 => [],
+            3 => []
+        ];
+        $cached = [
+            1 => $setElement
+        ];
         $cacheMock = $this->getMockBuilder(\Magento\Framework\App\CacheInterface::class)
             ->disableOriginalConstructor()
             ->setMethods(['load', 'save', 'getFrontend', 'remove', 'clean'])
@@ -192,21 +210,15 @@ class SetTest extends \PHPUnit_Framework_TestCase
             ->method('load')
             ->with($cacheKey)
             ->willReturn(false);
+        $this->serializerMock->expects($this->once())
+            ->method('serialize')
+            ->with($cached)
+            ->willReturn($serializedData);
         $cacheMock
             ->expects($this->once())
             ->method('save')
             ->with(
-                serialize(
-                    [
-                        1 => [
-                            10000 => [
-                                'group_id' =>  10,
-                                'group_sort' =>  100,
-                                'sort' =>  1000
-                            ]
-                        ]
-                    ]
-                ),
+                $serializedData,
                 $cacheKey,
                 [\Magento\Eav\Model\Cache\Type::CACHE_TAG, \Magento\Eav\Model\Entity\Attribute::CACHE_TAG]
             );
@@ -242,17 +254,7 @@ class SetTest extends \PHPUnit_Framework_TestCase
         $this->resourceMock->expects($this->any())->method('getConnection')->willReturn($connectionMock);
         $this->resourceMock->expects($this->any())->method('getTableName')->willReturn('_TABLE_');
         $this->assertEquals(
-            [
-                1 => [
-                    10000 => [
-                        'group_id' =>  10,
-                        'group_sort' =>  100,
-                        'sort' =>  1000
-                    ]
-                ],
-                2 => [],
-                3 => []
-            ],
+            $setData,
             $this->model->getSetInfo([1, 2, 3], 1)
         );
     }
@@ -262,42 +264,41 @@ class SetTest extends \PHPUnit_Framework_TestCase
      */
     public function testGetSetInfoCacheHit()
     {
-        $cached = [
-            1 => [
-                10000 => [
-                    'group_id' => 10,
-                    'group_sort' => 100,
-                    'sort' => 1000
-                ]
+        $setElement = [
+            10000 => [
+                'group_id' => 10,
+                'group_sort' => 100,
+                'sort' => 1000
             ]
         ];
-
+        $setData = [
+            1 => $setElement,
+            2 => [],
+            3 => []
+        ];
+        $cached = [
+            1 => $setElement
+        ];
+        $serializedData = 'serialized data';
         $this->resourceMock->expects($this->never())->method('getConnection');
         $this->eavConfigMock->expects($this->any())->method('isCacheEnabled')->willReturn(true);
         $cacheMock = $this->getMockBuilder(\Magento\Framework\App\CacheInterface::class)
             ->disableOriginalConstructor()
             ->setMethods(['load', 'save', 'getFrontend', 'remove', 'clean'])
             ->getMock();
-        $cacheMock
-            ->expects($this->once())
+        $cacheMock->expects($this->once())
             ->method('load')
             ->with(Set::ATTRIBUTES_CACHE_ID . 1)
-            ->willReturn(serialize($cached));
+            ->willReturn($serializedData);
+        $this->serializerMock->expects($this->once())
+            ->method('unserialize')
+            ->with($serializedData)
+            ->willReturn($cached);
 
         $this->eavConfigMock->expects($this->any())->method('getCache')->willReturn($cacheMock);
 
         $this->assertEquals(
-            [
-                1 => [
-                    10000 => [
-                        'group_id' =>  10,
-                        'group_sort' =>  100,
-                        'sort' =>  1000
-                    ]
-                ],
-                2 => [],
-                3 => []
-            ],
+            $setData,
             $this->model->getSetInfo([1, 2, 3], 1)
         );
     }
diff --git a/app/code/Magento/Eav/Test/Unit/Plugin/Model/ResourceModel/Entity/AttributeTest.php b/app/code/Magento/Eav/Test/Unit/Plugin/Model/ResourceModel/Entity/AttributeTest.php
index 7d4561259cf88f1fdaf4a5bb53ac2d2eac7408f7..67ea1912ccf8e07ac8410f7ede977b8da52dc330 100644
--- a/app/code/Magento/Eav/Test/Unit/Plugin/Model/ResourceModel/Entity/AttributeTest.php
+++ b/app/code/Magento/Eav/Test/Unit/Plugin/Model/ResourceModel/Entity/AttributeTest.php
@@ -3,111 +3,166 @@
  * Copyright © 2016 Magento. All rights reserved.
  * See COPYING.txt for license details.
  */
-
-// @codingStandardsIgnoreFile
-
 namespace Magento\Eav\Test\Unit\Plugin\Model\ResourceModel\Entity;
 
 use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
+use Magento\Framework\Serialize\SerializerInterface;
+use Magento\Framework\App\CacheInterface;
+use Magento\Framework\App\Cache\StateInterface;
+use Magento\Eav\Model\ResourceModel\Entity\Attribute as AttributeResource;
+use Magento\Eav\Plugin\Model\ResourceModel\Entity\Attribute as AttributeResourcePlugin;
+use Magento\Eav\Model\Cache\Type;
+use Magento\Eav\Model\Entity\Attribute;
 
 class AttributeTest extends \PHPUnit_Framework_TestCase
 {
-    /** @var \Magento\Framework\App\CacheInterface|\PHPUnit_Framework_MockObject_MockObject */
-    protected $cache;
+    /**
+     * @var CacheInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $cacheMock;
 
-    /** @var \Magento\Framework\App\Cache\StateInterface|\PHPUnit_Framework_MockObject_MockObject */
-    protected $cacheState;
+    /**
+     * @var StateInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    protected $cacheStateMock;
+
+    /**
+     * @var SerializerInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private $serializerMock;
+
+    /**
+     * @var AttributeResource|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private $attributeResourceMock;
 
-    /** @var \Magento\Eav\Model\ResourceModel\Entity\Attribute|\PHPUnit_Framework_MockObject_MockObject */
-    protected $subject;
+    /**
+     * @var AttributeResourcePlugin
+     */
+    private $attributeResourcePlugin;
 
     protected function setUp()
     {
-        $this->cache = $this->getMock(\Magento\Framework\App\CacheInterface::class);
-        $this->cacheState = $this->getMock(\Magento\Framework\App\Cache\StateInterface::class);
-        $this->subject = $this->getMock(\Magento\Eav\Model\ResourceModel\Entity\Attribute::class, [], [], '', false);
+        $objectManager = new ObjectManager($this);
+        $this->cacheMock = $this->getMock(CacheInterface::class);
+        $this->cacheStateMock = $this->getMock(StateInterface::class);
+        $this->attributeResourceMock = $this->getMock(AttributeResource::class, [], [], '', false);
+        $this->serializerMock = $this->getMock(SerializerInterface::class);
+        $this->attributeResourcePlugin = $objectManager->getObject(
+            AttributeResourcePlugin::class,
+            [
+                'cache' => $this->cacheMock,
+                'cacheState' => $this->cacheStateMock,
+                'serializer' => $this->serializerMock
+            ]
+        );
     }
 
-    public function testGetStoreLabelsByAttributeIdOnCacheDisabled()
+    public function testAroundGetStoreLabelsByAttributeIdCacheIsDisabled()
     {
-        $this->cache->expects($this->never())->method('load');
+        $attributeId = 1;
+        $this->cacheMock->expects($this->never())
+            ->method('load');
+        $this->cacheStateMock->expects($this->exactly(2))
+            ->method('isEnabled')
+            ->with(Type::TYPE_IDENTIFIER)
+            ->willReturn(false);
 
-        $this->assertEquals(
-            'attributeId',
-            $this->getAttribute(false)->aroundGetStoreLabelsByAttributeId(
-                $this->subject,
-                $this->mockPluginProceed('attributeId'),
-               'attributeId'
-            )
+        $isProceedCalled = false;
+        // @SuppressWarnings(PHPMD.UnusedFormalParameter)
+        $proceed = function($attributeId) use (&$isProceedCalled) {
+            $isProceedCalled = true;
+        };
+
+        $this->attributeResourcePlugin->aroundGetStoreLabelsByAttributeId(
+            $this->attributeResourceMock,
+            $proceed,
+            $attributeId
         );
+        $this->assertTrue($isProceedCalled);
     }
 
-    public function testGetStoreLabelsByAttributeIdFromCache()
+    public function testAroundGetStoreLabelsByAttributeIdCacheExists()
     {
         $attributeId = 1;
-        $attributes = ['k' => 'v'];
-        $cacheId = \Magento\Eav\Plugin\Model\ResourceModel\Entity\Attribute::STORE_LABEL_ATTRIBUTE . $attributeId;
-        $this->cache->expects($this->any())->method('load')->with($cacheId)->willReturn(serialize($attributes));
+        $attributes = ['foo' => 'bar'];
+        $serializedAttributes = 'serialized attributes';
+        $cacheId = AttributeResourcePlugin::STORE_LABEL_ATTRIBUTE . $attributeId;
+        $this->cacheStateMock->expects($this->once())
+            ->method('isEnabled')
+            ->with(Type::TYPE_IDENTIFIER)
+            ->willReturn(true);
+        $this->cacheMock->expects($this->once())
+            ->method('load')
+            ->with($cacheId)
+            ->willReturn($serializedAttributes);
+        $this->serializerMock->expects($this->once())
+            ->method('unserialize')
+            ->with($serializedAttributes)
+            ->willReturn($attributes);
+
+        $isProceedCalled = false;
+        // @SuppressWarnings(PHPMD.UnusedFormalParameter)
+        $proceed = function($attributeId) use (&$isProceedCalled) {
+            $isProceedCalled = true;
+        };
 
         $this->assertEquals(
             $attributes,
-            $this->getAttribute(true)->aroundGetStoreLabelsByAttributeId(
-                $this->subject,
-                $this->mockPluginProceed(),
+            $this->attributeResourcePlugin->aroundGetStoreLabelsByAttributeId(
+                $this->attributeResourceMock,
+                $proceed,
                 $attributeId
             )
         );
+        $this->assertFalse($isProceedCalled);
     }
 
-    public function testGetStoreLabelsByAttributeIdWithCacheSave()
+    public function testAroundGetStoreLabelsByAttributeIdCacheDoesNotExist()
     {
         $attributeId = 1;
-        $cacheId = \Magento\Eav\Plugin\Model\ResourceModel\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
-            ]
-        );
+        $attributes = ['foo' => 'bar'];
+        $serializedAttributes = 'serialized attributes';
+        $cacheId = AttributeResourcePlugin::STORE_LABEL_ATTRIBUTE . $attributeId;
+        $this->cacheStateMock->expects($this->exactly(2))
+            ->method('isEnabled')
+            ->with(Type::TYPE_IDENTIFIER)
+            ->willReturn(true);
+        $this->cacheMock->expects($this->once())
+            ->method('load')
+            ->with($cacheId)
+            ->willReturn(false);
+        $this->serializerMock->expects($this->never())
+            ->method('unserialize')
+            ->with($serializedAttributes)
+            ->willReturn($attributes);
+        $this->serializerMock->expects($this->once())
+            ->method('serialize')
+            ->with($attributes)
+            ->willReturn($serializedAttributes);
+        $this->cacheMock->expects($this->once())
+            ->method('save')
+            ->with(
+                $serializedAttributes,
+                $cacheId,
+                [
+                    Type::CACHE_TAG,
+                    Attribute::CACHE_TAG
+                ]
+            );
+
+        // @SuppressWarnings(PHPMD.UnusedFormalParameter)
+        $proceed = function($attributeId) use ($attributes) {
+            return $attributes;
+        };
 
         $this->assertEquals(
-            [$attributeId],
-            $this->getAttribute(true)->aroundGetStoreLabelsByAttributeId(
-                $this->subject,
-                $this->mockPluginProceed([$attributeId]),
+            $attributes,
+            $this->attributeResourcePlugin->aroundGetStoreLabelsByAttributeId(
+                $this->attributeResourceMock,
+                $proceed,
                 $attributeId
             )
         );
     }
-
-    /**
-     * @param bool $cacheEnabledFlag
-     * @return \Magento\Eav\Plugin\Model\ResourceModel\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\ResourceModel\Entity\Attribute::class,
-            [
-                '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/app/code/Magento/Integration/Model/Config.php b/app/code/Magento/Integration/Model/Config.php
index 70795cae0035034a7801c6a21cc3bb90ab566e1f..3cea4d33743198988c44d8c8aae9bf6e9f247efa 100644
--- a/app/code/Magento/Integration/Model/Config.php
+++ b/app/code/Magento/Integration/Model/Config.php
@@ -5,6 +5,8 @@
  */
 namespace Magento\Integration\Model;
 
+use Magento\Framework\App\ObjectManager;
+use Magento\Framework\Serialize\SerializerInterface;
 use Magento\Integration\Model\Cache\Type;
 
 /**
@@ -34,14 +36,24 @@ class Config
      */
     protected $_integrations;
 
+    /**
+     * @var SerializerInterface
+     */
+    private $serializer;
+
     /**
      * @param Cache\Type $configCacheType
      * @param Config\Reader $configReader
+     * @param SerializerInterface $serializer
      */
-    public function __construct(Cache\Type $configCacheType, Config\Reader $configReader)
-    {
+    public function __construct(
+        Cache\Type $configCacheType,
+        Config\Reader $configReader,
+        SerializerInterface $serializer = null
+    ) {
         $this->_configCacheType = $configCacheType;
         $this->_configReader = $configReader;
+        $this->serializer = $serializer ?: ObjectManager::getInstance()->get(SerializerInterface::class);
     }
 
     /**
@@ -55,10 +67,14 @@ class Config
         if (null === $this->_integrations) {
             $integrations = $this->_configCacheType->load(self::CACHE_ID);
             if ($integrations && is_string($integrations)) {
-                $this->_integrations = unserialize($integrations);
+                $this->_integrations = $this->serializer->unserialize($integrations);
             } else {
                 $this->_integrations = $this->_configReader->read();
-                $this->_configCacheType->save(serialize($this->_integrations), self::CACHE_ID, [Type::CACHE_TAG]);
+                $this->_configCacheType->save(
+                    $this->serializer->serialize($this->_integrations),
+                    self::CACHE_ID,
+                    [Type::CACHE_TAG]
+                );
             }
         }
         return $this->_integrations;
diff --git a/app/code/Magento/Integration/Model/ConsolidatedConfig.php b/app/code/Magento/Integration/Model/ConsolidatedConfig.php
index 9027bf774bc30a9a5b7cb6a427057efc45971742..9208d19e7028f8f753d6e20c2d43765163cb9bec 100644
--- a/app/code/Magento/Integration/Model/ConsolidatedConfig.php
+++ b/app/code/Magento/Integration/Model/ConsolidatedConfig.php
@@ -5,6 +5,8 @@
  */
 namespace Magento\Integration\Model;
 
+use Magento\Framework\App\ObjectManager;
+use Magento\Framework\Serialize\SerializerInterface;
 use Magento\Integration\Model\Cache\TypeConsolidated;
 
 /**
@@ -31,14 +33,24 @@ class ConsolidatedConfig
      */
     protected $integrations;
 
+    /**
+     * @var SerializerInterface
+     */
+    private $serializer;
+
     /**
      * @param Cache\TypeConsolidated $configCacheType
      * @param Config\Consolidated\Reader $configReader
+     * @param SerializerInterface $serializer
      */
-    public function __construct(Cache\TypeConsolidated $configCacheType, Config\Consolidated\Reader $configReader)
-    {
+    public function __construct(
+        Cache\TypeConsolidated $configCacheType,
+        Config\Consolidated\Reader $configReader,
+        SerializerInterface $serializer = null
+    ) {
         $this->configCacheType = $configCacheType;
         $this->configReader = $configReader;
+        $this->serializer = $serializer ?: ObjectManager::getInstance()->get(SerializerInterface::class);
     }
 
     /**
@@ -51,11 +63,11 @@ class ConsolidatedConfig
         if (null === $this->integrations) {
             $integrations = $this->configCacheType->load(self::CACHE_ID);
             if ($integrations && is_string($integrations)) {
-                $this->integrations = unserialize($integrations);
+                $this->integrations = $this->serializer->unserialize($integrations);
             } else {
                 $this->integrations = $this->configReader->read();
                 $this->configCacheType->save(
-                    serialize($this->integrations),
+                    $this->serializer->serialize($this->integrations),
                     self::CACHE_ID,
                     [TypeConsolidated::CACHE_TAG]
                 );
diff --git a/app/code/Magento/Integration/Model/IntegrationConfig.php b/app/code/Magento/Integration/Model/IntegrationConfig.php
index 647bff70efe4afdffd35e5294251e0fe9e98aa98..cde4fc20d22351ff4b9dedd9d93254f8d838438a 100644
--- a/app/code/Magento/Integration/Model/IntegrationConfig.php
+++ b/app/code/Magento/Integration/Model/IntegrationConfig.php
@@ -6,6 +6,8 @@
 
 namespace Magento\Integration\Model;
 
+use Magento\Framework\App\ObjectManager;
+use Magento\Framework\Serialize\SerializerInterface;
 use Magento\Integration\Model\Cache\TypeIntegration;
 use Magento\Integration\Model\Config\Integration\Reader;
 
@@ -36,14 +38,24 @@ class IntegrationConfig
      */
     protected $_integrations;
 
+    /**
+     * @var SerializerInterface
+     */
+    private $serializer;
+
     /**
      * @param TypeIntegration $configCacheType
      * @param Reader $configReader
+     * @param SerializerInterface $serializer
      */
-    public function __construct(TypeIntegration $configCacheType, Reader $configReader)
-    {
+    public function __construct(
+        TypeIntegration $configCacheType,
+        Reader $configReader,
+        SerializerInterface $serializer = null
+    ) {
         $this->_configCacheType = $configCacheType;
         $this->_configReader = $configReader;
+        $this->serializer = $serializer ?: ObjectManager::getInstance()->get(SerializerInterface::class);
     }
 
     /**
@@ -57,11 +69,11 @@ class IntegrationConfig
         if (null === $this->_integrations) {
             $integrations = $this->_configCacheType->load(self::CACHE_ID);
             if ($integrations && is_string($integrations)) {
-                $this->_integrations = unserialize($integrations);
+                $this->_integrations = $this->serializer->unserialize($integrations);
             } else {
                 $this->_integrations = $this->_configReader->read();
                 $this->_configCacheType->save(
-                    serialize($this->_integrations),
+                    $this->serializer->serialize($this->_integrations),
                     self::CACHE_ID,
                     [TypeIntegration::CACHE_TAG]
                 );
diff --git a/app/code/Magento/Integration/Test/Unit/Model/ConsolidatedConfigTest.php b/app/code/Magento/Integration/Test/Unit/Model/ConsolidatedConfigTest.php
index 0b75592782773d504061e4e6f9a56c67ebe5982e..22b50a8aef8d070c479ca2a28b499308a6a95c80 100644
--- a/app/code/Magento/Integration/Test/Unit/Model/ConsolidatedConfigTest.php
+++ b/app/code/Magento/Integration/Test/Unit/Model/ConsolidatedConfigTest.php
@@ -5,6 +5,7 @@
  */
 namespace Magento\Integration\Test\Unit\Model;
 
+use Magento\Framework\Serialize\SerializerInterface;
 use Magento\Integration\Model\ConsolidatedConfig as Config;
 use Magento\Integration\Model\Cache\TypeConsolidated as Type;
 
@@ -18,17 +19,22 @@ class ConsolidatedConfigTest extends \PHPUnit_Framework_TestCase
      *
      * @var Config
      */
-    protected $configModel;
+    private $configModel;
 
     /**
      * @var Type|\PHPUnit_Framework_MockObject_MockObject
      */
-    protected $configCacheTypeMock;
+    private $configCacheTypeMock;
 
     /**
      * @var  \Magento\Integration\Model\Config\Consolidated\Reader|\PHPUnit_Framework_MockObject_MockObject
      */
-    protected $configReaderMock;
+    private $configReaderMock;
+
+    /**
+     * @var  SerializerInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private $serializer;
 
     protected function setUp()
     {
@@ -38,12 +44,16 @@ class ConsolidatedConfigTest extends \PHPUnit_Framework_TestCase
         $this->configReaderMock = $this->getMockBuilder(\Magento\Integration\Model\Config\Consolidated\Reader::class)
             ->disableOriginalConstructor()
             ->getMock();
+        $this->serializer = $this->getMockBuilder(SerializerInterface::class)
+            ->disableOriginalConstructor()
+            ->getMock();
         $objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
         $this->configModel = $objectManagerHelper->getObject(
             \Magento\Integration\Model\ConsolidatedConfig::class,
             [
                 'configCacheType' => $this->configCacheTypeMock,
-                'configReader' => $this->configReaderMock
+                'configReader' => $this->configReaderMock,
+                'serializer' => $this->serializer,
             ]
         );
     }
@@ -51,10 +61,15 @@ class ConsolidatedConfigTest extends \PHPUnit_Framework_TestCase
     public function testGetIntegrationsFromConfigCacheType()
     {
         $integrations = ['foo', 'bar', 'baz'];
+        $serializedIntegrations = '["foo","bar","baz"]';
         $this->configCacheTypeMock->expects($this->once())
             ->method('load')
             ->with(Config::CACHE_ID)
-            ->will($this->returnValue(serialize($integrations)));
+            ->will($this->returnValue($serializedIntegrations));
+        $this->serializer->expects($this->once())
+            ->method('unserialize')
+            ->with($serializedIntegrations)
+            ->willReturn($integrations);
 
         $this->assertEquals($integrations, $this->configModel->getIntegrations());
     }
@@ -62,17 +77,21 @@ class ConsolidatedConfigTest extends \PHPUnit_Framework_TestCase
     public function testGetIntegrationsFromConfigReader()
     {
         $integrations = ['foo', 'bar', 'baz'];
+        $serializedIntegrations = '["foo","bar","baz"]';
         $this->configCacheTypeMock->expects($this->once())
             ->method('load')
             ->with(Config::CACHE_ID)
             ->will($this->returnValue(null));
-        $this->configCacheTypeMock->expects($this->once())
-            ->method('save')
-            ->with(serialize($integrations), Config::CACHE_ID, [Type::CACHE_TAG])
-            ->will($this->returnValue(null));
         $this->configReaderMock->expects($this->once())
             ->method('read')
             ->will($this->returnValue($integrations));
+        $this->serializer->expects($this->once())
+            ->method('serialize')
+            ->with($integrations)
+            ->willReturn($serializedIntegrations);
+        $this->configCacheTypeMock->expects($this->once())
+            ->method('save')
+            ->with($serializedIntegrations, Config::CACHE_ID, [Type::CACHE_TAG]);
 
         $this->assertEquals($integrations, $this->configModel->getIntegrations());
     }
diff --git a/app/code/Magento/Integration/Test/Unit/Model/IntegrationConfigTest.php b/app/code/Magento/Integration/Test/Unit/Model/IntegrationConfigTest.php
index aed4e02453dc435fa5ff87f30931560bace8721e..14871420a621aceec2d5dcb79f209c60fac1f9f6 100644
--- a/app/code/Magento/Integration/Test/Unit/Model/IntegrationConfigTest.php
+++ b/app/code/Magento/Integration/Test/Unit/Model/IntegrationConfigTest.php
@@ -5,6 +5,7 @@
  */
 namespace Magento\Integration\Test\Unit\Model;
 
+use Magento\Framework\Serialize\SerializerInterface;
 use Magento\Integration\Model\IntegrationConfig;
 use Magento\Integration\Model\Cache\TypeIntegration;
 
@@ -16,17 +17,22 @@ class IntegrationConfigTest extends \PHPUnit_Framework_TestCase
     /**
      * @var IntegrationConfig
      */
-    protected $integrationConfigModel;
+    private $integrationConfigModel;
 
     /**
      * @var TypeIntegration|\PHPUnit_Framework_MockObject_MockObject
      */
-    protected $configCacheTypeMock;
+    private $configCacheTypeMock;
 
     /**
      * @var  \Magento\Integration\Model\Config\Integration\Reader|\PHPUnit_Framework_MockObject_MockObject
      */
-    protected $configReaderMock;
+    private $configReaderMock;
+
+    /**
+     * @var SerializerInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private $serializer;
 
     protected function setUp()
     {
@@ -36,19 +42,28 @@ class IntegrationConfigTest extends \PHPUnit_Framework_TestCase
         $this->configReaderMock = $this->getMockBuilder(\Magento\Integration\Model\Config\Integration\Reader::class)
             ->disableOriginalConstructor()
             ->getMock();
+        $this->serializer = $this->getMockBuilder(SerializerInterface::class)
+            ->disableOriginalConstructor()
+            ->getMock();
         $this->integrationConfigModel = new IntegrationConfig(
             $this->configCacheTypeMock,
-            $this->configReaderMock
+            $this->configReaderMock,
+            $this->serializer
         );
     }
 
     public function testGetIntegrationsFromConfigCacheType()
     {
         $integrations = ['foo', 'bar', 'baz'];
+        $serializedIntegrations = '["foo","bar","baz"]';
         $this->configCacheTypeMock->expects($this->once())
             ->method('load')
             ->with(IntegrationConfig::CACHE_ID)
-            ->will($this->returnValue(serialize($integrations)));
+            ->will($this->returnValue($serializedIntegrations));
+        $this->serializer->expects($this->once())
+            ->method('unserialize')
+            ->with($serializedIntegrations)
+            ->willReturn($integrations);
 
         $this->assertEquals($integrations, $this->integrationConfigModel->getIntegrations());
     }
@@ -56,17 +71,22 @@ class IntegrationConfigTest extends \PHPUnit_Framework_TestCase
     public function testGetIntegrationsFromConfigReader()
     {
         $integrations = ['foo', 'bar', 'baz'];
+        $serializedIntegrations = '["foo","bar","baz"]';
         $this->configCacheTypeMock->expects($this->once())
             ->method('load')
             ->with(IntegrationConfig::CACHE_ID)
             ->will($this->returnValue(null));
-        $this->configCacheTypeMock->expects($this->once())
-            ->method('save')
-            ->with(serialize($integrations), IntegrationConfig::CACHE_ID, [TypeIntegration::CACHE_TAG])
-            ->will($this->returnValue(null));
         $this->configReaderMock->expects($this->once())
             ->method('read')
             ->will($this->returnValue($integrations));
+        $this->serializer->expects($this->once())
+            ->method('serialize')
+            ->with($integrations)
+            ->willReturn($serializedIntegrations);
+        $this->configCacheTypeMock->expects($this->once())
+            ->method('save')
+            ->with($serializedIntegrations, IntegrationConfig::CACHE_ID, [TypeIntegration::CACHE_TAG])
+            ->will($this->returnValue(null));
 
         $this->assertEquals($integrations, $this->integrationConfigModel->getIntegrations());
     }
diff --git a/app/code/Magento/Marketplace/Helper/Cache.php b/app/code/Magento/Marketplace/Helper/Cache.php
index 1cb5fb9c710e67885f0e7266d57873ca29cb3e21..a0a4ce73e0373ac7d057777160c7ac5028321e8c 100644
--- a/app/code/Magento/Marketplace/Helper/Cache.php
+++ b/app/code/Magento/Marketplace/Helper/Cache.php
@@ -6,7 +6,8 @@
 
 namespace Magento\Marketplace\Helper;
 
-use Magento\Framework\Filesystem;
+use Magento\Framework\App\ObjectManager;
+use Magento\Framework\Serialize\SerializerInterface;
 
 /**
  * Cache helper
@@ -25,15 +26,23 @@ class Cache extends \Magento\Framework\App\Helper\AbstractHelper
      */
     protected $cache;
 
+    /**
+     * @var SerializerInterface
+     */
+    private $serializer;
+
     /**
      * @param \Magento\Framework\App\Helper\Context $context
      * @param \Magento\Framework\Config\CacheInterface $cache
+     * @param SerializerInterface $serializer
      */
     public function __construct(
         \Magento\Framework\App\Helper\Context $context,
-        \Magento\Framework\Config\CacheInterface $cache
+        \Magento\Framework\Config\CacheInterface $cache,
+        SerializerInterface $serializer = null
     ) {
         $this->cache = $cache;
+        $this->serializer = $serializer ?: ObjectManager::getInstance()->get(SerializerInterface::class);
         parent::__construct($context);
     }
 
@@ -46,7 +55,7 @@ class Cache extends \Magento\Framework\App\Helper\AbstractHelper
     {
         $data = $this->getCache()->load($this->pathToCacheFile);
         if (false !== $data) {
-            $data = unserialize($data);
+            $data = $this->serializer->unserialize($data);
         }
         return $data;
     }
@@ -59,7 +68,7 @@ class Cache extends \Magento\Framework\App\Helper\AbstractHelper
      */
     public function savePartnersToCache($partners)
     {
-        return $this->getCache()->save(serialize($partners), $this->pathToCacheFile);
+        return $this->getCache()->save($this->serializer->serialize($partners), $this->pathToCacheFile);
     }
 
     /**
diff --git a/app/code/Magento/Marketplace/Test/Unit/Helper/CacheTest.php b/app/code/Magento/Marketplace/Test/Unit/Helper/CacheTest.php
index 75c6e6110389c5a920c3053aa451a6d0deab3775..00b78a47eb4b0be4c5b89cf3383dac80028dc899 100644
--- a/app/code/Magento/Marketplace/Test/Unit/Helper/CacheTest.php
+++ b/app/code/Magento/Marketplace/Test/Unit/Helper/CacheTest.php
@@ -6,70 +6,79 @@
 
 namespace Magento\Marketplace\Test\Unit\Helper;
 
+use Magento\Framework\Serialize\SerializerInterface;
+
 class CacheTest extends \PHPUnit_Framework_TestCase
 {
     /**
-     * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Marketplace\Helper\Cache
+     * @var \Magento\Framework\Config\CacheInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private $cache;
+
+    /**
+     * @var  SerializerInterface|\PHPUnit_Framework_MockObject_MockObject
      */
-    private $cacheHelperMock;
+    private $serializer;
+
+    /**
+     * @var \Magento\Marketplace\Helper\Cache
+     */
+    private $cacheHelper;
 
     protected function setUp()
     {
-        $this->cacheHelperMock = $this->getCacheHelperMock(['getCache']);
+        $this->cache = $this->getMockForAbstractClass(\Magento\Framework\Config\CacheInterface::class);
+        $this->serializer = $this->getMockForAbstractClass(SerializerInterface::class);
+        $objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
+        $this->cacheHelper = $objectManagerHelper->getObject(
+            \Magento\Marketplace\Helper\Cache::class,
+            [
+                'cache' => $this->cache,
+                'serializer' => $this->serializer,
+            ]
+        );
     }
 
-    /**
-     * @covers \Magento\Marketplace\Helper\Cache::loadPartnersFromCache
-     */
     public function testLoadPartnersFromCache()
     {
-        $cache = $this->getCacheMock();
-        $this->cacheHelperMock
-            ->expects($this->once())
-            ->method('getCache')
-            ->will($this->returnValue($cache));
-        $cache->expects($this->once())
+        $partners = ['partner1', 'partner2'];
+        $serializedPartners = '["partner1", "partner2"]';
+        $this->cache->expects($this->once())
             ->method('load')
-            ->will($this->returnValue(''));
+            ->with('partners')
+            ->willReturn($serializedPartners);
+        $this->serializer->expects($this->once())
+            ->method('unserialize')
+            ->with($serializedPartners)
+            ->willReturn($partners);
 
-        $this->cacheHelperMock->loadPartnersFromCache();
+        $this->assertSame($partners, $this->cacheHelper->loadPartnersFromCache());
     }
 
-    /**
-     * @covers \Magento\Marketplace\Helper\Cache::savePartnersToCache
-     */
-    public function testSavePartnersToCache()
+    public function testLoadPartnersFromCacheNoCachedData()
     {
-        $cache = $this->getCacheMock();
-        $this->cacheHelperMock
-            ->expects($this->once())
-            ->method('getCache')
-            ->will($this->returnValue($cache));
-        $cache->expects($this->once())
-            ->method('save')
-            ->will($this->returnValue(true));
+        $this->cache->expects($this->once())
+            ->method('load')
+            ->with('partners')
+            ->willReturn(false);
+        $this->serializer->expects($this->never())
+            ->method('unserialize');
 
-        $this->cacheHelperMock->savePartnersToCache([]);
+        $this->assertSame(false, $this->cacheHelper->loadPartnersFromCache());
     }
 
-    /**
-     * Gets cache helper mock
-     *
-     * @param null $methods
-     * @return \PHPUnit_Framework_MockObject_MockObject|\Magento\Marketplace\Helper\Cache
-     */
-    public function getCacheHelperMock($methods = null)
+    public function testSavePartnersToCache()
     {
-        return $this->getMock(\Magento\Marketplace\Helper\Cache::class, $methods, [], '', false);
-    }
+        $partners = ['partner1', 'partner2'];
+        $serializedPartners = '["partner1", "partner2"]';
+        $this->serializer->expects($this->once())
+            ->method('serialize')
+            ->with($partners)
+            ->willReturn($serializedPartners);
+        $this->cache->expects($this->once())
+            ->method('save')
+            ->with($serializedPartners);
 
-    /**
-     * Gets Filesystem mock
-     *
-     * @return \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Config\CacheInterface
-     */
-    public function getCacheMock()
-    {
-        return $this->getMockForAbstractClass(\Magento\Framework\Config\CacheInterface::class);
+        $this->cacheHelper->savePartnersToCache($partners);
     }
 }
diff --git a/app/code/Magento/Quote/Model/QueryResolver.php b/app/code/Magento/Quote/Model/QueryResolver.php
index cfc1480feb66386a122b21a6484107a205cad566..04d83bab85b2bf4b31c5d57e8c2b742614a4694b 100644
--- a/app/code/Magento/Quote/Model/QueryResolver.php
+++ b/app/code/Magento/Quote/Model/QueryResolver.php
@@ -5,8 +5,10 @@
  */
 namespace Magento\Quote\Model;
 
+use Magento\Framework\App\ObjectManager;
 use Magento\Framework\Config\CacheInterface;
 use Magento\Framework\App\ResourceConnection\ConfigInterface;
+use Magento\Framework\Serialize\SerializerInterface;
 
 class QueryResolver
 {
@@ -37,19 +39,27 @@ class QueryResolver
      */
     private $cacheTags = [];
 
+    /**
+     * @var SerializerInterface
+     */
+    private $serializer;
+
     /**
      * @param ConfigInterface $config
      * @param CacheInterface $cache
      * @param string $cacheId
+     * @param SerializerInterface $serializer
      */
     public function __construct(
         ConfigInterface $config,
         CacheInterface $cache,
-        $cacheId = 'connection_config_cache'
+        $cacheId = 'connection_config_cache',
+        SerializerInterface $serializer = null
     ) {
         $this->config = $config;
         $this->cache = $cache;
         $this->cacheId = $cacheId;
+        $this->serializer = $serializer ?: ObjectManager::getInstance()->get(SerializerInterface::class);
     }
 
     /**
@@ -75,9 +85,9 @@ class QueryResolver
         if (false === $data) {
             $singleQuery = $this->config->getConnectionName('checkout_setup') == 'default' ? true : false;
             $data['checkout'] = $singleQuery;
-            $this->cache->save(serialize($data), $this->cacheId, $this->cacheTags);
+            $this->cache->save($this->serializer->serialize($data), $this->cacheId, $this->cacheTags);
         } else {
-            $data = unserialize($data);
+            $data = $this->serializer->unserialize($data);
         }
         $this->merge($data);
     }
diff --git a/app/code/Magento/Quote/Model/Quote/Address/Total/Collector.php b/app/code/Magento/Quote/Model/Quote/Address/Total/Collector.php
index 8e62d1b942f1e2a5808e76ac293c94abd9830cad..d430bf3acc6cd08d22b0f352efde6b9dc7774fed 100644
--- a/app/code/Magento/Quote/Model/Quote/Address/Total/Collector.php
+++ b/app/code/Magento/Quote/Model/Quote/Address/Total/Collector.php
@@ -5,6 +5,8 @@
  */
 namespace Magento\Quote\Model\Quote\Address\Total;
 
+use Magento\Framework\Serialize\SerializerInterface;
+
 /**
  * Address Total Collector model
  */
@@ -69,6 +71,7 @@ class Collector extends \Magento\Sales\Model\Config\Ordered
      * @param \Magento\Quote\Model\Quote\Address\TotalFactory $totalFactory
      * @param mixed $sourceData
      * @param mixed $store
+     * @param SerializerInterface $serializer
      */
     public function __construct(
         \Magento\Framework\App\Cache\Type\Config $configCacheType,
@@ -78,11 +81,12 @@ class Collector extends \Magento\Sales\Model\Config\Ordered
         \Magento\Store\Model\StoreManagerInterface $storeManager,
         \Magento\Quote\Model\Quote\Address\TotalFactory $totalFactory,
         $sourceData = null,
-        $store = null
+        $store = null,
+        SerializerInterface $serializer = null
     ) {
         $this->_scopeConfig = $scopeConfig;
         $this->_totalFactory = $totalFactory;
-        parent::__construct($configCacheType, $logger, $salesConfig, $sourceData);
+        parent::__construct($configCacheType, $logger, $salesConfig, $sourceData, $serializer);
         $this->_store = $store ?: $storeManager->getStore();
         $this->_initModels()->_initCollectors()->_initRetrievers();
     }
diff --git a/app/code/Magento/Quote/Test/Unit/Model/QueryResolverTest.php b/app/code/Magento/Quote/Test/Unit/Model/QueryResolverTest.php
index a2075b1161fc2a9cde83ba9af7bd2729244aa9a3..eb6828afff4edc79f0fb32bea383515ebacdcf86 100644
--- a/app/code/Magento/Quote/Test/Unit/Model/QueryResolverTest.php
+++ b/app/code/Magento/Quote/Test/Unit/Model/QueryResolverTest.php
@@ -6,83 +6,100 @@
 
 namespace Magento\Quote\Test\Unit\Model;
 
+use Magento\Framework\Serialize\SerializerInterface;
+
 class QueryResolverTest extends \PHPUnit_Framework_TestCase
 {
     /**
      * @var \Magento\Quote\Model\QueryResolver
      */
-    protected $quoteResolver;
+    private $quoteResolver;
 
     /**
      * @var \PHPUnit_Framework_MockObject_MockObject
      */
-    protected $configMock;
+    private $configMock;
 
     /**
      * @var \PHPUnit_Framework_MockObject_MockObject
      */
-    protected $cacheMock;
+    private $cacheMock;
+
+    /**
+     * @var SerializerInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private $serializer;
 
     protected function setUp()
     {
         $this->configMock = $this->getMock(\Magento\Framework\App\ResourceConnection\ConfigInterface::class);
         $this->cacheMock = $this->getMock(\Magento\Framework\Config\CacheInterface::class);
+        $this->serializer = $this->getMockForAbstractClass(SerializerInterface::class);
         $this->quoteResolver = new \Magento\Quote\Model\QueryResolver(
             $this->configMock,
             $this->cacheMock,
-            'connection_config_cache'
+            'connection_config_cache',
+            $this->serializer
         );
-
     }
 
     public function testIsSingleQueryWhenDataWereCached()
     {
-        $queryData['checkout'] = true;
+        $serializedData = '{"checkout":true}';
+        $data = ['checkout' => true];
         $this->cacheMock
             ->expects($this->once())
             ->method('load')
             ->with('connection_config_cache')
-            ->willReturn(serialize($queryData));
+            ->willReturn($serializedData);
+        $this->serializer->expects($this->once())
+            ->method('unserialize')
+            ->with($serializedData)
+            ->willReturn($data);
         $this->assertTrue($this->quoteResolver->isSingleQuery());
     }
 
-    public function testIsSingleQueryWhenDataNotCached()
+    /**
+     * @param string $connectionName
+     * @param bool $isSingleQuery
+     *
+     * @dataProvider isSingleQueryWhenDataNotCachedDataProvider
+     */
+    public function testIsSingleQueryWhenDataNotCached($connectionName, $isSingleQuery)
     {
-        $queryData['checkout'] = true;
+        $data = ['checkout' => $isSingleQuery];
+        $serializedData = '{"checkout":true}';
         $this->cacheMock
             ->expects($this->once())
             ->method('load')
             ->with('connection_config_cache')
             ->willReturn(false);
+        $this->serializer->expects($this->never())
+            ->method('unserialize');
         $this->configMock
             ->expects($this->once())
             ->method('getConnectionName')
             ->with('checkout_setup')
-            ->willReturn('default');
+            ->willReturn($connectionName);
+        $this->serializer->expects($this->once())
+            ->method('serialize')
+            ->with($data)
+            ->willReturn($serializedData);
         $this->cacheMock
             ->expects($this->once())
             ->method('save')
-            ->with(serialize($queryData), 'connection_config_cache', []);
-        $this->assertTrue($this->quoteResolver->isSingleQuery());
+            ->with($serializedData, 'connection_config_cache', []);
+        $this->assertEquals($isSingleQuery, $this->quoteResolver->isSingleQuery());
     }
 
-    public function testIsSingleQueryWhenSeveralConnectionsExist()
+    /**
+     * @return array
+     */
+    public function isSingleQueryWhenDataNotCachedDataProvider()
     {
-        $queryData['checkout'] = false;
-        $this->cacheMock
-            ->expects($this->once())
-            ->method('load')
-            ->with('connection_config_cache')
-            ->willReturn(false);
-        $this->configMock
-            ->expects($this->once())
-            ->method('getConnectionName')
-            ->with('checkout_setup')
-            ->willReturn('checkout');
-        $this->cacheMock
-            ->expects($this->once())
-            ->method('save')
-            ->with(serialize($queryData), 'connection_config_cache', []);
-        $this->assertFalse($this->quoteResolver->isSingleQuery());
+        return [
+            ['default', true],
+            ['checkout', false],
+        ];
     }
 }
diff --git a/app/code/Magento/Sales/Model/Config/Ordered.php b/app/code/Magento/Sales/Model/Config/Ordered.php
index 7ea7d1f8cc5fae05277754e033c9a4cb9fac37f6..806a7b522c189f495e080307981bf8fd95f3d420 100644
--- a/app/code/Magento/Sales/Model/Config/Ordered.php
+++ b/app/code/Magento/Sales/Model/Config/Ordered.php
@@ -5,6 +5,9 @@
  */
 namespace Magento\Sales\Model\Config;
 
+use Magento\Framework\App\ObjectManager;
+use Magento\Framework\Serialize\SerializerInterface;
+
 /**
  * Configuration class for ordered items
  *
@@ -69,22 +72,30 @@ abstract class Ordered extends \Magento\Framework\App\Config\Base
      */
     protected $_salesConfig;
 
+    /**
+     * @var SerializerInterface
+     */
+    private $serializer;
+
     /**
      * @param \Magento\Framework\App\Cache\Type\Config $configCacheType
      * @param \Psr\Log\LoggerInterface $logger
      * @param \Magento\Sales\Model\Config $salesConfig
      * @param \Magento\Framework\Simplexml\Element $sourceData
+     * @param SerializerInterface $serializer
      */
     public function __construct(
         \Magento\Framework\App\Cache\Type\Config $configCacheType,
         \Psr\Log\LoggerInterface $logger,
         \Magento\Sales\Model\Config $salesConfig,
-        $sourceData = null
+        $sourceData = null,
+        SerializerInterface $serializer = null
     ) {
         parent::__construct($sourceData);
         $this->_configCacheType = $configCacheType;
         $this->_logger = $logger;
         $this->_salesConfig = $salesConfig;
+        $this->serializer = $serializer ?: ObjectManager::getInstance()->get(SerializerInterface::class);
     }
 
     /**
@@ -179,11 +190,11 @@ abstract class Ordered extends \Magento\Framework\App\Config\Base
         $sortedCodes = [];
         $cachedData = $this->_configCacheType->load($this->_collectorsCacheKey);
         if ($cachedData) {
-            $sortedCodes = unserialize($cachedData);
+            $sortedCodes = $this->serializer->unserialize($cachedData);
         }
         if (!$sortedCodes) {
             $sortedCodes = $this->_getSortedCollectorCodes($this->_modelsConfig);
-            $this->_configCacheType->save(serialize($sortedCodes), $this->_collectorsCacheKey);
+            $this->_configCacheType->save($this->serializer->serialize($sortedCodes), $this->_collectorsCacheKey);
         }
         foreach ($sortedCodes as $code) {
             $this->_collectors[$code] = $this->_models[$code];
diff --git a/app/code/Magento/Sales/Model/Order/Total/Config/Base.php b/app/code/Magento/Sales/Model/Order/Total/Config/Base.php
index 22c71f48b6f35189bf532362a8647e53069a39a5..d96591118b82296a937445256e01e75ee942a569 100644
--- a/app/code/Magento/Sales/Model/Order/Total/Config/Base.php
+++ b/app/code/Magento/Sales/Model/Order/Total/Config/Base.php
@@ -5,6 +5,8 @@
  */
 namespace Magento\Sales\Model\Order\Total\Config;
 
+use Magento\Framework\Serialize\SerializerInterface;
+
 /**
  * Configuration class for totals
  */
@@ -42,15 +44,17 @@ class Base extends \Magento\Sales\Model\Config\Ordered
      * @param \Magento\Sales\Model\Config $salesConfig
      * @param \Magento\Sales\Model\Order\TotalFactory $orderTotalFactory
      * @param mixed $sourceData
+     * @param SerializerInterface $serializer
      */
     public function __construct(
         \Magento\Framework\App\Cache\Type\Config $configCacheType,
         \Psr\Log\LoggerInterface $logger,
         \Magento\Sales\Model\Config $salesConfig,
         \Magento\Sales\Model\Order\TotalFactory $orderTotalFactory,
-        $sourceData = null
+        $sourceData = null,
+        SerializerInterface $serializer = null
     ) {
-        parent::__construct($configCacheType, $logger, $salesConfig, $sourceData);
+        parent::__construct($configCacheType, $logger, $salesConfig, $sourceData, $serializer);
         $this->_orderTotalFactory = $orderTotalFactory;
     }
 
diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Total/Config/BaseTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Total/Config/BaseTest.php
index ed44331f577d06ebdbe4df00401f85f34c59284d..bd519e76585ba452bb066ccac2cfbd27c5d58d7f 100644
--- a/app/code/Magento/Sales/Test/Unit/Model/Order/Total/Config/BaseTest.php
+++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Total/Config/BaseTest.php
@@ -5,24 +5,28 @@
  */
 namespace Magento\Sales\Test\Unit\Model\Order\Total\Config;
 
+use Magento\Framework\Serialize\SerializerInterface;
 use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
 
 class BaseTest extends \PHPUnit_Framework_TestCase
 {
     /** @var \Magento\Sales\Model\Order\Total\Config\Base */
-    protected $object;
+    private $object;
+
+    /** @var  SerializerInterface|\PHPUnit_Framework_MockObject_MockObject */
+    private $serializer;
 
     /** @var \Magento\Framework\App\Cache\Type\Config|\PHPUnit_Framework_MockObject_MockObject */
-    protected $configCacheType;
+    private $configCacheType;
 
     /** @var \Psr\Log\LoggerInterface|\PHPUnit_Framework_MockObject_MockObject */
-    protected $logger;
+    private $logger;
 
     /** @var \Magento\Sales\Model\Config|\PHPUnit_Framework_MockObject_MockObject */
-    protected $salesConfig;
+    private $salesConfig;
 
     /** @var \Magento\Sales\Model\Order\TotalFactory|\PHPUnit_Framework_MockObject_MockObject */
-    protected $orderTotalFactory;
+    private $orderTotalFactory;
 
     protected function setUp()
     {
@@ -30,6 +34,7 @@ class BaseTest extends \PHPUnit_Framework_TestCase
         $this->logger = $this->getMock(\Psr\Log\LoggerInterface::class);
         $this->salesConfig = $this->getMock(\Magento\Sales\Model\Config::class, [], [], '', false);
         $this->orderTotalFactory = $this->getMock(\Magento\Sales\Model\Order\TotalFactory::class, [], [], '', false);
+        $this->serializer = $this->getMockForAbstractClass(SerializerInterface::class);
 
         $objectManager = new ObjectManager($this);
         $this->object = $objectManager->getObject(
@@ -39,6 +44,7 @@ class BaseTest extends \PHPUnit_Framework_TestCase
                 'logger' => $this->logger,
                 'salesConfig' => $this->salesConfig,
                 'orderTotalFactory' => $this->orderTotalFactory,
+                'serializer' => $this->serializer,
             ]
         );
     }
@@ -59,8 +65,14 @@ class BaseTest extends \PHPUnit_Framework_TestCase
             ->with(\Magento\Sales\Model\Order\Total\AbstractTotal::class)
             ->will($this->returnValue($total));
 
+        $sortedCodes = ['other_code', 'some_code'];
+        $serializedCodes = '["other_code", "some_code"]';
+        $this->serializer->expects($this->once())
+            ->method('serialize')
+            ->with($sortedCodes)
+            ->willReturn($serializedCodes);
         $this->configCacheType->expects($this->once())->method('save')
-            ->with('a:2:{i:0;s:10:"other_code";i:1;s:9:"some_code";}', 'sorted_collectors');
+            ->with($serializedCodes, 'sorted_collectors');
 
         $this->assertSame(
             ['other_code' => $total, 'some_code' => $total],
@@ -106,8 +118,14 @@ class BaseTest extends \PHPUnit_Framework_TestCase
             ->with(\Magento\Sales\Model\Order\Total\AbstractTotal::class)
             ->will($this->returnValue($total));
 
+        $sortedCodes = ['other_code', 'some_code'];
+        $serializedCodes = '["other_code", "some_code"]';
         $this->configCacheType->expects($this->once())->method('load')->with('sorted_collectors')
-            ->will($this->returnValue('a:2:{i:0;s:10:"other_code";i:1;s:9:"some_code";}'));
+            ->will($this->returnValue($serializedCodes));
+        $this->serializer->expects($this->once())
+            ->method('unserialize')
+            ->with($serializedCodes)
+            ->willReturn($sortedCodes);
         $this->configCacheType->expects($this->never())->method('save');
 
         $this->assertSame(
diff --git a/app/code/Magento/Webapi/Model/Config.php b/app/code/Magento/Webapi/Model/Config.php
index 45d29bc59cf0d6a1c9c1be78ff84343f50b1029d..fb6dc894e3c0ae87915f12bdf38311a5be541874 100644
--- a/app/code/Magento/Webapi/Model/Config.php
+++ b/app/code/Magento/Webapi/Model/Config.php
@@ -8,6 +8,8 @@ namespace Magento\Webapi\Model;
 
 use Magento\Webapi\Model\Cache\Type\Webapi as WebapiCache;
 use Magento\Webapi\Model\Config\Reader;
+use Magento\Framework\App\ObjectManager;
+use Magento\Framework\Serialize\SerializerInterface;
 
 /**
  * Web API Config Model.
@@ -40,16 +42,26 @@ class Config
      */
     protected $services;
 
+    /**
+     * @var SerializerInterface
+     */
+    private $serializer;
+
     /**
      * Initialize dependencies.
      *
      * @param WebapiCache $cache
      * @param Reader $configReader
+     * @param SerializerInterface|null $serializer
      */
-    public function __construct(WebapiCache $cache, Reader $configReader)
-    {
+    public function __construct(
+        WebapiCache $cache,
+        Reader $configReader,
+        SerializerInterface $serializer = null
+    ) {
         $this->cache = $cache;
         $this->configReader = $configReader;
+        $this->serializer = $serializer ?: ObjectManager::getInstance()->get(SerializerInterface::class);
     }
 
     /**
@@ -62,10 +74,10 @@ class Config
         if (null === $this->services) {
             $services = $this->cache->load(self::CACHE_ID);
             if ($services && is_string($services)) {
-                $this->services = unserialize($services);
+                $this->services = $this->serializer->unserialize($services);
             } else {
                 $this->services = $this->configReader->read();
-                $this->cache->save(serialize($this->services), self::CACHE_ID);
+                $this->cache->save($this->serializer->serialize($this->services), self::CACHE_ID);
             }
         }
         return $this->services;
diff --git a/app/code/Magento/Webapi/Model/ServiceMetadata.php b/app/code/Magento/Webapi/Model/ServiceMetadata.php
index b75d10f9a271f7a3f39fff2ac9494f020b5cf660..14e45ccb409db24df2dd2f1c4f8d5693a55d3126 100644
--- a/app/code/Magento/Webapi/Model/ServiceMetadata.php
+++ b/app/code/Magento/Webapi/Model/ServiceMetadata.php
@@ -7,6 +7,8 @@ namespace Magento\Webapi\Model;
 
 use Magento\Webapi\Model\Config\Converter;
 use Magento\Webapi\Model\Cache\Type\Webapi as WebApiCache;
+use Magento\Framework\App\ObjectManager;
+use Magento\Framework\Serialize\SerializerInterface;
 
 /**
  * Service Metadata Model
@@ -74,6 +76,11 @@ class ServiceMetadata
      */
     protected $typeProcessor;
 
+    /**
+     * @var SerializerInterface
+     */
+    private $serializer;
+
     /**
      * Initialize dependencies.
      *
@@ -81,17 +88,20 @@ class ServiceMetadata
      * @param WebApiCache $cache
      * @param \Magento\Webapi\Model\Config\ClassReflector $classReflector
      * @param \Magento\Framework\Reflection\TypeProcessor $typeProcessor
+     * @param SerializerInterface|null $serializer
      */
     public function __construct(
         \Magento\Webapi\Model\Config $config,
         WebApiCache $cache,
         \Magento\Webapi\Model\Config\ClassReflector $classReflector,
-        \Magento\Framework\Reflection\TypeProcessor $typeProcessor
+        \Magento\Framework\Reflection\TypeProcessor $typeProcessor,
+        SerializerInterface $serializer = null
     ) {
         $this->config = $config;
         $this->cache = $cache;
         $this->classReflector = $classReflector;
         $this->typeProcessor = $typeProcessor;
+        $this->serializer = $serializer ?: ObjectManager::getInstance()->get(SerializerInterface::class);
     }
 
     /**
@@ -142,12 +152,18 @@ class ServiceMetadata
             $servicesConfig = $this->cache->load(self::SERVICES_CONFIG_CACHE_ID);
             $typesData = $this->cache->load(self::REFLECTED_TYPES_CACHE_ID);
             if ($servicesConfig && is_string($servicesConfig) && $typesData && is_string($typesData)) {
-                $this->services = unserialize($servicesConfig);
-                $this->typeProcessor->setTypesData(unserialize($typesData));
+                $this->services = $this->serializer->unserialize($servicesConfig);
+                $this->typeProcessor->setTypesData($this->serializer->unserialize($typesData));
             } else {
                 $this->services = $this->initServicesMetadata();
-                $this->cache->save(serialize($this->services), self::SERVICES_CONFIG_CACHE_ID);
-                $this->cache->save(serialize($this->typeProcessor->getTypesData()), self::REFLECTED_TYPES_CACHE_ID);
+                $this->cache->save(
+                    $this->serializer->serialize($this->services),
+                    self::SERVICES_CONFIG_CACHE_ID
+                );
+                $this->cache->save(
+                    $this->serializer->serialize($this->typeProcessor->getTypesData()),
+                    self::REFLECTED_TYPES_CACHE_ID
+                );
             }
         }
         return $this->services;
@@ -256,12 +272,18 @@ class ServiceMetadata
             $routesConfig = $this->cache->load(self::ROUTES_CONFIG_CACHE_ID);
             $typesData = $this->cache->load(self::REFLECTED_TYPES_CACHE_ID);
             if ($routesConfig && is_string($routesConfig) && $typesData && is_string($typesData)) {
-                $this->routes = unserialize($routesConfig);
-                $this->typeProcessor->setTypesData(unserialize($typesData));
+                $this->routes = $this->serializer->unserialize($routesConfig);
+                $this->typeProcessor->setTypesData($this->serializer->unserialize($typesData));
             } else {
                 $this->routes = $this->initRoutesMetadata();
-                $this->cache->save(serialize($this->routes), self::ROUTES_CONFIG_CACHE_ID);
-                $this->cache->save(serialize($this->typeProcessor->getTypesData()), self::REFLECTED_TYPES_CACHE_ID);
+                $this->cache->save(
+                    $this->serializer->serialize($this->routes),
+                    self::ROUTES_CONFIG_CACHE_ID
+                );
+                $this->cache->save(
+                    $this->serializer->serialize($this->typeProcessor->getTypesData()),
+                    self::REFLECTED_TYPES_CACHE_ID
+                );
             }
         }
         return $this->routes;
diff --git a/app/code/Magento/Webapi/Test/Unit/Model/ConfigTest.php b/app/code/Magento/Webapi/Test/Unit/Model/ConfigTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..74280f61916d7182e90bdf1e9b6125da55a6c31b
--- /dev/null
+++ b/app/code/Magento/Webapi/Test/Unit/Model/ConfigTest.php
@@ -0,0 +1,96 @@
+<?php
+/**
+ * Copyright © 2016 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+namespace Magento\Webapi\Test\Unit\Model;
+
+use Magento\Framework\Serialize\SerializerInterface;
+use Magento\Webapi\Model\Config;
+use Magento\Webapi\Model\Config\Reader;
+use Magento\Webapi\Model\Cache\Type\Webapi;
+
+class ConfigTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var Config
+     */
+    private $config;
+
+    /**
+     * @var Webapi|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private $webapiCacheMock;
+
+    /**
+     * @var Reader|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private $configReaderMock;
+
+    /**
+     * @var SerializerInterface|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private $serializerMock;
+
+    protected function setUp()
+    {
+        $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
+
+        $this->webapiCacheMock = $this->getMock(\Magento\Webapi\Model\Cache\Type\Webapi::class, [], [], '', false);
+        $this->configReaderMock = $this->getMock(\Magento\Webapi\Model\Config\Reader::class, [], [], '', false);
+        $this->serializerMock = $this->getMock(SerializerInterface::class);
+
+        $this->config = $objectManager->getObject(
+            Config::class,
+            [
+                'cache' => $this->webapiCacheMock,
+                'configReader' => $this->configReaderMock,
+                'serializer' => $this->serializerMock
+            ]
+        );
+    }
+
+    public function testGetServices()
+    {
+        $data = ['foo' => 'bar'];
+        $serializedData = 'serialized data';
+        $this->webapiCacheMock->expects($this->once())
+            ->method('load')
+            ->with(Config::CACHE_ID)
+            ->willReturn($serializedData);
+        $this->serializerMock->expects($this->once())
+            ->method('unserialize')
+            ->with($serializedData)
+            ->willReturn($data);
+        $this->config->getServices();
+        $this->assertEquals($data, $this->config->getServices());
+    }
+
+    public function testGetServicesNoCache()
+    {
+        $data = ['foo' => 'bar'];
+        $serializedData = 'serialized data';
+        $this->webapiCacheMock->expects($this->once())
+            ->method('load')
+            ->with(Config::CACHE_ID)
+            ->willReturn(false);
+        $this->serializerMock->expects($this->never())
+            ->method('unserialize');
+        $this->configReaderMock->expects($this->once())
+            ->method('read')
+            ->willReturn($data);
+        $this->serializerMock->expects($this->once())
+            ->method('serialize')
+            ->with($data)
+            ->willReturn($serializedData);
+        $this->webapiCacheMock->expects($this->once())
+            ->method('save')
+            ->with(
+                $serializedData,
+                Config::CACHE_ID
+            );
+
+        $this->config->getServices();
+        $this->assertEquals($data, $this->config->getServices());
+    }
+}
diff --git a/app/code/Magento/Webapi/Test/Unit/Model/ServiceMetadataTest.php b/app/code/Magento/Webapi/Test/Unit/Model/ServiceMetadataTest.php
index 29c1bf90402ebe36d6ca91c5585cacb03f739cc3..4125f82b7923ffb30a3bfc0d86f3414255498231 100644
--- a/app/code/Magento/Webapi/Test/Unit/Model/ServiceMetadataTest.php
+++ b/app/code/Magento/Webapi/Test/Unit/Model/ServiceMetadataTest.php
@@ -1,187 +1,450 @@
 <?php
 /**
- * ServiceMetadata Unit tests.
- *
  * Copyright © 2016 Magento. All rights reserved.
  * See COPYING.txt for license details.
  */
-
-/**
- * Class implements tests for \Magento\Webapi\Model\ServiceMetadata class.
- */
 namespace Magento\Webapi\Test\Unit\Model;
 
+use Magento\Framework\Serialize\SerializerInterface;
+use Magento\Webapi\Model\Config;
+use Magento\Webapi\Model\Cache\Type\Webapi;
+use Magento\Webapi\Model\Config\ClassReflector;
+use Magento\Framework\Reflection\TypeProcessor;
+use Magento\Webapi\Model\ServiceMetadata;
+use Magento\Customer\Api\CustomerRepositoryInterface;
+
 class ServiceMetadataTest extends \PHPUnit_Framework_TestCase
 {
-    /** @var \Magento\Webapi\Model\ServiceMetadata */
-    protected $serviceMetadata;
+    /**
+     * @var ServiceMetadata
+     */
+    private $serviceMetadata;
 
     /**
-     * Set up helper.
-     * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
+     * @var Webapi|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private $cacheMock;
+
+    /**
+     * @var Config|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private $configMock;
+
+    /**
+     * @var ClassReflector|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private $classReflectorMock;
+
+    /**
+     * @var TypeProcessor|\PHPUnit_Framework_MockObject_MockObject
+     */
+    private $typeProcessorMock;
+
+    /**
+     * @var SerializerInterface|\PHPUnit_Framework_MockObject_MockObject
      */
+    private $serializerMock;
+
     protected function setUp()
     {
-        $interfaceParameters = [
-            'activateById' => [
+        $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
+
+        $this->configMock = $this->getMock(Config::class, [], [], '', false);
+        $this->cacheMock = $this->getMock(Webapi::class, [], [], '', false);
+        $this->classReflectorMock = $this->getMock(ClassReflector::class, [], [], '', false);
+        $this->typeProcessorMock = $this->getMock(TypeProcessor::class, [], [], '', false);
+        $this->serializerMock = $this->getMock(SerializerInterface::class);
+
+        $this->serviceMetadata = $objectManager->getObject(
+            ServiceMetadata::class,
+            [
+                'config' => $this->configMock,
+                'cache' => $this->cacheMock,
+                'classReflector' => $this->classReflectorMock,
+                'typeProcessor' => $this->typeProcessorMock,
+                'serializer' => $this->serializerMock
+            ]
+        );
+    }
+
+    public function testGetServicesConfig()
+    {
+        $servicesConfig = ['foo' => 'bar'];
+        $typeData = ['bar' => 'foo'];
+        $serializedServicesConfig = 'serialized services config';
+        $serializedTypeData = 'serialized type data';
+        $this->cacheMock->expects($this->at(0))
+            ->method('load')
+            ->with(ServiceMetadata::SERVICES_CONFIG_CACHE_ID)
+            ->willReturn($serializedServicesConfig);
+        $this->cacheMock->expects($this->at(1))
+            ->method('load')
+            ->with(ServiceMetadata::REFLECTED_TYPES_CACHE_ID)
+            ->willReturn($serializedTypeData);
+        $this->serializerMock->expects($this->at(0))
+            ->method('unserialize')
+            ->with($serializedServicesConfig)
+            ->willReturn($servicesConfig);
+        $this->serializerMock->expects($this->at(1))
+            ->method('unserialize')
+            ->with($serializedTypeData)
+            ->willReturn($typeData);
+        $this->typeProcessorMock->expects($this->once())
+            ->method('setTypesData')
+            ->with($typeData);
+        $this->serviceMetadata->getServicesConfig();
+        $this->assertEquals($servicesConfig, $this->serviceMetadata->getServicesConfig());
+    }
+
+    /**
+     * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
+     */
+    public function testGetServicesConfigNoCache()
+    {
+        $servicesConfig = [
+            'services' => [
+                CustomerRepositoryInterface::class => [
+                    'V1' => [
+                        'methods' => [
+                            'getById' => [
+                                'resources' => [
+                                    [
+                                        'Magento_Customer::customer',
+                                    ]
+                                ],
+                                'secure' => false
+                            ]
+                        ]
+                    ]
+                ]
+            ]
+        ];
+        $methodsReflectionData = [
+            'getById' => [
+                'documentation' => 'Get customer by customer ID.',
                 'interface' => [
                     'in' => [
                         'parameters' => [
                             'customerId' => [
-                                'force' => true,
-                                'value' => '%customer_id%',
-                            ],
-                            'requiredInputParameter' => [
+                                'type' => 'int',
                                 'required' => true,
-                            ],
-                        ],
+                                'documentation' => null
+                            ]
+                        ]
                     ],
                     'out' => [
                         'parameters' => [
-                            'outputParameter' => [
-                                'type' => 'string',
+                            'result' => [
+                                'type' => 'CustomerDataCustomerInterface',
+                                'required' => true,
+                                'documentation' => null
+                            ]
+                        ]
+                    ]
+                ]
+            ]
+        ];
+        $servicesMetadata = [
+            'customerCustomerRepositoryV1' => [
+                'methods' => array_merge_recursive(
+                    [
+                        'getById' => [
+                            'resources' => [
+                                [
+                                    'Magento_Customer::customer',
+                                ],
                             ],
-                        ],
+                            'method' => 'getById',
+                            'inputRequired' => false,
+                            'isSecure' => false,
+                        ]
                     ],
-                ],
-            ],
+                    $methodsReflectionData
+                ),
+                'class' => CustomerRepositoryInterface::class,
+                'description' => 'Customer CRUD interface.'
+            ]
         ];
-        $classReflection = $this->getMock(
-            \Magento\Webapi\Model\Config\ClassReflector::class,
-            ['reflectClassMethods', 'extractClassDescription'],
-            [],
-            '',
-            false
-        );
-        $classReflection->expects($this->any())
+        $typeData = [
+            'CustomerDataCustomerInterface' => [
+                'documentation' => 'Customer interface.',
+                'parameters' => [
+                    'id' => [
+                        'type' => 'int',
+                        'required' => false,
+                        'documentation' => 'Customer id'
+                    ]
+                ]
+            ]
+        ];
+        $serializedServicesConfig = 'serialized services config';
+        $serializedTypeData = 'serialized type data';
+        $this->cacheMock->expects($this->at(0))
+            ->method('load')
+            ->with(ServiceMetadata::SERVICES_CONFIG_CACHE_ID)
+            ->willReturn(false);
+        $this->cacheMock->expects($this->at(1))
+            ->method('load')
+            ->with(ServiceMetadata::REFLECTED_TYPES_CACHE_ID)
+            ->willReturn(false);
+        $this->serializerMock->expects($this->never())
+            ->method('unserialize');
+        $this->configMock->expects($this->once())
+            ->method('getServices')
+            ->willReturn($servicesConfig);
+        $this->classReflectorMock->expects($this->once())
             ->method('reflectClassMethods')
-            ->will($this->returnValue($interfaceParameters));
-        $classReflection->expects($this->any())
+            ->willReturn($methodsReflectionData);
+        $this->classReflectorMock->expects($this->once())
             ->method('extractClassDescription')
-            ->will($this->returnValue('classDescription'));
+            ->with(CustomerRepositoryInterface::class)
+            ->willReturn('Customer CRUD interface.');
+        $this->typeProcessorMock->expects($this->once())
+            ->method('getTypesData')
+            ->willReturn($typeData);
+        $this->serializerMock->expects($this->at(0))
+            ->method('serialize')
+            ->with($servicesMetadata)
+            ->willReturn($serializedServicesConfig);
+        $this->serializerMock->expects($this->at(1))
+            ->method('serialize')
+            ->with($typeData)
+            ->willReturn($serializedTypeData);
+        $this->cacheMock->expects($this->at(2))
+            ->method('save')
+            ->with(
+                $serializedServicesConfig,
+                ServiceMetadata::SERVICES_CONFIG_CACHE_ID
+            );
+        $this->cacheMock->expects($this->at(3))
+            ->method('save')
+            ->with(
+                $serializedTypeData,
+                ServiceMetadata::REFLECTED_TYPES_CACHE_ID
+            );
+        $this->serviceMetadata->getServicesConfig();
+        $this->assertEquals($servicesMetadata, $this->serviceMetadata->getServicesConfig());
+    }
+
+    public function testGetRoutesConfig()
+    {
+        $routesConfig = ['foo' => 'bar'];
+        $typeData = ['bar' => 'foo'];
+        $serializedRoutesConfig = 'serialized routes config';
+        $serializedTypeData = 'serialized type data';
+        $this->cacheMock->expects($this->at(0))
+            ->method('load')
+            ->with(ServiceMetadata::ROUTES_CONFIG_CACHE_ID)
+            ->willReturn($serializedRoutesConfig);
+        $this->cacheMock->expects($this->at(1))
+            ->method('load')
+            ->with(ServiceMetadata::REFLECTED_TYPES_CACHE_ID)
+            ->willReturn($serializedTypeData);
+        $this->serializerMock->expects($this->at(0))
+            ->method('unserialize')
+            ->with($serializedRoutesConfig)
+            ->willReturn($routesConfig);
+        $this->serializerMock->expects($this->at(1))
+            ->method('unserialize')
+            ->with($serializedTypeData)
+            ->willReturn($typeData);
+        $this->typeProcessorMock->expects($this->once())
+            ->method('setTypesData')
+            ->with($typeData);
+        $this->serviceMetadata->getRoutesConfig();
+        $this->assertEquals($routesConfig, $this->serviceMetadata->getRoutesConfig());
+    }
 
+    /**
+     * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
+     */
+    public function testGetRoutesConfigNoCache()
+    {
         $servicesConfig = [
-            'services' => [\Magento\Customer\Api\AccountManagementInterface::class => [
-                    'V1' => [
-                        'methods' => [
-                            'activateById' => [
-                                'resources' => [
-                                    [
-                                        'Magento_Customer::manage',
-                                    ],
-                                ],
-                                'secure' => false,
-                            ],
-                        ],
-                    ],
-                ], \Magento\Customer\Api\CustomerRepositoryInterface::class => [
+            'services' => [
+                CustomerRepositoryInterface::class => [
                     'V1' => [
                         'methods' => [
                             'getById' => [
                                 'resources' => [
                                     [
                                         'Magento_Customer::customer',
-                                    ],
+                                    ]
                                 ],
-                                'secure' => false,
-                            ],
-                        ],
-                    ],
-                ],
+                                'secure' => false
+                            ]
+                        ]
+                    ]
+                ]
             ],
             'routes' => [
-                '/V1/customers/me/activate' => [
-                    'PUT' => [
+                '/V1/customers/:customerId' => [
+                    'GET' => [
                         'secure' => false,
                         'service' => [
-                            'class' => \Magento\Customer\Api\AccountManagementInterface::class,
-                            'method' => 'activateById',
+                            'class' => CustomerRepositoryInterface::class,
+                            'method' => 'getById'
                         ],
                         'resources' => [
-                            'self' => true,
+                            'Magento_Customer::customer' => true
                         ],
+                        'parameters' => []
+                    ]
+                ]
+            ],
+            'class' => CustomerRepositoryInterface::class,
+            'description' => 'Customer CRUD interface.',
+        ];
+        $methodsReflectionData = [
+            'getById' => [
+                'documentation' => 'Get customer by customer ID.',
+                'interface' => [
+                    'in' => [
                         'parameters' => [
                             'customerId' => [
-                                'force' => true,
-                                'value' => '%customer_id%',
-                            ],
-                        ],
+                                'type' => 'int',
+                                'required' => true,
+                                'documentation' => null
+                            ]
+                        ]
                     ],
-                ],
-                '/V1/customers/:customerId' => [
-                    'GET' => [
-                        'secure' => false,
-                        'service' => [
-                            'class' => \Magento\Customer\Api\CustomerRepositoryInterface::class,
-                            'method' => 'getById',
-                        ],
-                        'resources' => [
-                            'Magento_Customer::customer' => true,
-                        ],
+                    'out' => [
                         'parameters' => [
-                        ],
+                            'result' => [
+                                'type' => 'CustomerDataCustomerInterface',
+                                'required' => true,
+                                'documentation' => null
+                            ]
+                        ]
+                    ]
+                ]
+            ]
+        ];
+        $routesMetadata = [
+            'customerCustomerRepositoryV1' => [
+                'methods' => array_merge_recursive(
+                    [
+                        'getById' => [
+                            'resources' => [
+                                [
+                                    'Magento_Customer::customer',
+                                ]
+                            ],
+                            'method' => 'getById',
+                            'inputRequired' => false,
+                            'isSecure' => false,
+                        ]
                     ],
+                    $methodsReflectionData
+                ),
+                'routes' => [
+                    '/V1/customers/:customerId' => [
+                        'GET' => [
+                            'method' => 'getById',
+                            'parameters' => []
+                        ]
+                    ]
                 ],
+                'class' => CustomerRepositoryInterface::class,
+                'description' => 'Customer CRUD interface.'
             ]
         ];
-
-        /**
-         * @var $cacheMock \Magento\Webapi\Model\Cache\Type\Webapi
-         */
-        $cacheMock = $this->getMockBuilder(\Magento\Webapi\Model\Cache\Type\Webapi::class)
-            ->disableOriginalConstructor()
-            ->getMock();
-
-        /** @var $readerMock \Magento\Webapi\Model\Config\Reader */
-        $readerMock = $this->getMockBuilder(\Magento\Webapi\Model\Config\Reader::class)
-            ->disableOriginalConstructor()
-            ->getMock();
-        $readerMock->expects($this->any())->method('read')->will($this->returnValue($servicesConfig));
-
-        /** @var $config \Magento\Webapi\Model\Config */
-        $config = new \Magento\Webapi\Model\Config($cacheMock, $readerMock);
-
-        $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
-        $typeProcessor = $objectManager->getObject(\Magento\Framework\Reflection\TypeProcessor::class);
-
-        /** @var $config \Magento\Webapi\Model\ServiceMetadata */
-        $this->serviceMetadata = new \Magento\Webapi\Model\ServiceMetadata(
-            $config,
-            $cacheMock,
-            $classReflection,
-            $typeProcessor
-        );
-
-        parent::setUp();
+        $typeData = [
+            'CustomerDataCustomerInterface' => [
+                'documentation' => 'Customer interface.',
+                'parameters' => [
+                    'id' => [
+                        'type' => 'int',
+                        'required' => false,
+                        'documentation' => 'Customer id'
+                    ]
+                ]
+            ]
+        ];
+        $serializedRoutesConfig = 'serialized routes config';
+        $serializedTypeData = 'serialized type data';
+        $this->cacheMock->expects($this->at(0))
+            ->method('load')
+            ->with(ServiceMetadata::ROUTES_CONFIG_CACHE_ID)
+            ->willReturn(false);
+        $this->cacheMock->expects($this->at(1))
+            ->method('load')
+            ->with(ServiceMetadata::REFLECTED_TYPES_CACHE_ID)
+            ->willReturn(false);
+        $this->serializerMock->expects($this->never())
+            ->method('unserialize');
+        $this->configMock->expects($this->exactly(2))
+            ->method('getServices')
+            ->willReturn($servicesConfig);
+        $this->classReflectorMock->expects($this->once())
+            ->method('reflectClassMethods')
+            ->willReturn($methodsReflectionData);
+        $this->classReflectorMock->expects($this->once())
+            ->method('extractClassDescription')
+            ->with(CustomerRepositoryInterface::class)
+            ->willReturn('Customer CRUD interface.');
+        $this->typeProcessorMock->expects($this->exactly(2))
+            ->method('getTypesData')
+            ->willReturn($typeData);
+        $this->serializerMock->expects($this->at(2))
+            ->method('serialize')
+            ->with($routesMetadata)
+            ->willReturn($serializedRoutesConfig);
+        $this->serializerMock->expects($this->at(3))
+            ->method('serialize')
+            ->with($typeData)
+            ->willReturn($serializedTypeData);
+        $this->cacheMock->expects($this->at(6))
+            ->method('save')
+            ->with(
+                $serializedRoutesConfig,
+                ServiceMetadata::ROUTES_CONFIG_CACHE_ID
+            );
+        $this->cacheMock->expects($this->at(7))
+            ->method('save')
+            ->with(
+                $serializedTypeData,
+                ServiceMetadata::REFLECTED_TYPES_CACHE_ID
+            );
+        $this->serviceMetadata->getRoutesConfig();
+        $this->assertEquals($routesMetadata, $this->serviceMetadata->getRoutesConfig());
     }
 
     /**
-     * Test identifying service name including subservices using class name.
-     *
-     * @dataProvider serviceNameDataProvider
+     * @dataProvider getServiceNameDataProvider
      */
     public function testGetServiceName($className, $version, $preserveVersion, $expected)
     {
-        $actual = $this->serviceMetadata->getServiceName($className, $version, $preserveVersion);
-        $this->assertEquals($expected, $actual);
+        $this->assertEquals(
+            $expected,
+            $this->serviceMetadata->getServiceName($className, $version, $preserveVersion)
+        );
     }
 
     /**
-     * Dataprovider for testGetServiceName
-     *
      * @return string
      */
-    public function serviceNameDataProvider()
+    public function getServiceNameDataProvider()
     {
         return [
-            [\Magento\Customer\Api\AccountManagementInterface::class, 'V1', false, 'customerAccountManagement'],
-            [\Magento\Customer\Api\AddressRepositoryInterface::class, 'V1', true, 'customerAddressRepositoryV1'],
+            [
+                \Magento\Customer\Api\AccountManagementInterface::class,
+                'V1',
+                false,
+                'customerAccountManagement'
+            ],
+            [
+                \Magento\Customer\Api\AddressRepositoryInterface::class,
+                'V1',
+                true,
+                'customerAddressRepositoryV1'
+            ],
         ];
     }
 
     /**
      * @expectedException \InvalidArgumentException
-     * @dataProvider dataProviderForTestGetServiceNameInvalidName
+     * @dataProvider getServiceNameInvalidNameDataProvider
      */
     public function testGetServiceNameInvalidName($interfaceClassName, $version)
     {
@@ -189,111 +452,18 @@ class ServiceMetadataTest extends \PHPUnit_Framework_TestCase
     }
 
     /**
-     * Dataprovider for testGetServiceNameInvalidName
-     *
      * @return string
      */
-    public function dataProviderForTestGetServiceNameInvalidName()
+    public function getServiceNameInvalidNameDataProvider()
     {
         return [
-            ['BarV1Interface', 'V1'], // Missed vendor, module, 'Service'
+            ['BarV1Interface', 'V1'], // Missed vendor, module and Service
             ['Service\\V1Interface', 'V1'], // Missed vendor and module
             ['Magento\\Foo\\Service\\BarVxInterface', 'V1'], // Version number should be a number
-            ['Magento\\Foo\\Service\\BarInterface', 'V1'], // Version missed
-            ['Magento\\Foo\\Service\\BarV1', 'V1'], // 'Interface' missed
-            ['Foo\\Service\\BarV1Interface', 'V1'], // Module missed
-            ['Foo\\BarV1Interface', 'V1'] // Module and 'Service' missed
-        ];
-    }
-
-    public function testGetServiceMetadata()
-    {
-        $expectedResult = [
-            'methods' => [
-                'activateById' => [
-                    'method' => 'activateById',
-                    'inputRequired' => '',
-                    'isSecure' => '',
-                    'resources' => [['Magento_Customer::manage']],
-                    'interface' => [
-                        'in' => [
-                            'parameters' => [
-                                'customerId' => [
-                                    'force' => true,
-                                    'value' => '%customer_id%',
-                                ],
-                                'requiredInputParameter' => [
-                                    'required' => true,
-                                ],
-                            ],
-                        ],
-                        'out' => [
-                            'parameters' => [
-                                'outputParameter' => [
-                                    'type' => 'string',
-                                ],
-                            ],
-                        ],
-                    ],
-                ],
-            ],
-            'class' => \Magento\Customer\Api\AccountManagementInterface::class,
-            'description' => 'classDescription',
+            ['Magento\\Foo\\Service\\BarInterface', 'V1'], // Missed version
+            ['Magento\\Foo\\Service\\BarV1', 'V1'], // Missed Interface
+            ['Foo\\Service\\BarV1Interface', 'V1'], // Missed module
+            ['Foo\\BarV1Interface', 'V1'] // Missed module and Service
         ];
-        $result = $this->serviceMetadata->getServiceMetadata('customerAccountManagementV1');
-        $this->assertEquals($expectedResult, $result);
-    }
-
-    public function testGetRouteMetadata()
-    {
-        $expectedResult = [
-            'methods' => [
-                'activateById' => [
-                    'method' => 'activateById',
-                    'inputRequired' => '',
-                    'isSecure' => '',
-                    'resources' => [['Magento_Customer::manage']],
-                    'interface' => [
-                        'in' => [
-                            'parameters' => [
-                                'customerId' => [
-                                    'force' => true,
-                                    'value' => '%customer_id%',
-                                ],
-                                'requiredInputParameter' => [
-                                    'required' => true,
-                                ],
-                            ],
-                        ],
-                        'out' => [
-                            'parameters' => [
-                                'outputParameter' => [
-                                    'type' => 'string',
-                                ],
-                            ],
-                        ],
-                    ],
-                ],
-            ],
-            'class' => \Magento\Customer\Api\AccountManagementInterface::class,
-            'description' => 'classDescription',
-            'routes' => [
-                '/V1/customers/me/activate' => [
-                    'PUT' => [
-                        'method' => 'activateById',
-                        'parameters' => [
-                            'customerId' => [
-                                'force' => true,
-                                'value' => '%customer_id%'
-                            ]
-                        ]
-                    ]
-                ]
-            ]
-        ];
-        $result = $this->serviceMetadata->getRouteMetadata('customerAccountManagementV1');
-        $this->assertEquals($expectedResult, $result);
     }
 }
-
-require_once realpath(__DIR__ . '/../_files/test_interfaces.php');
diff --git a/app/code/Magento/Webapi/Test/Unit/Model/Soap/ConfigTest.php b/app/code/Magento/Webapi/Test/Unit/Model/Soap/ConfigTest.php
deleted file mode 100644
index aa5d1a7bfab7e5a1858ae9b321d41a1accba3955..0000000000000000000000000000000000000000
--- a/app/code/Magento/Webapi/Test/Unit/Model/Soap/ConfigTest.php
+++ /dev/null
@@ -1,166 +0,0 @@
-<?php
-/**
- * Config helper Unit tests.
- *
- * Copyright © 2016 Magento. All rights reserved.
- * See COPYING.txt for license details.
- */
-
-// @codingStandardsIgnoreFile
-
-/**
- * Class implements tests for \Magento\Webapi\Model\Soap\Config class.
- */
-namespace Magento\Webapi\Test\Unit\Model\Soap;
-
-class ConfigTest extends \PHPUnit_Framework_TestCase
-{
-    /** @var \Magento\Webapi\Model\Soap\Config */
-    protected $_soapConfig;
-
-    /** @var  \Magento\Framework\TestFramework\Unit\Helper\ObjectManager */
-    protected $objectManager;
-
-    /**
-     * Set up helper.
-     */
-    protected function setUp()
-    {
-        $this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
-
-        $typeProcessor = $this->objectManager->getObject(\Magento\Framework\Reflection\TypeProcessor::class);
-
-        $objectManagerMock = $this->getMockBuilder(
-            \Magento\Framework\App\ObjectManager::class
-        )->disableOriginalConstructor()->getMock();
-
-        $classReflection = $this->getMock(
-            \Magento\Webapi\Model\Config\ClassReflector::class,
-            ['reflectClassMethods'],
-            ['_typeProcessor' => $typeProcessor],
-            ''
-        );
-        $classReflection->expects($this->any())->method('reflectClassMethods')->will($this->returnValue([]));
-
-        $servicesConfig = [
-            'services' => [\Magento\Customer\Api\AccountManagementInterface::class => [
-                    'V1' => [
-                        'methods' => [
-                            'activate' => [
-                                'resources' => [
-                                    [
-                                        'Magento_Customer::manage',
-                                    ],
-                                ],
-                                'secure' => false,
-                            ],
-                        ],
-                    ],
-                ], \Magento\Customer\Api\CustomerRepositoryInterface::class => [
-                    'V1' => [
-                        'methods' => [
-                            'getById' => [
-                                'resources' => [
-                                    [
-                                        'Magento_Customer::customer',
-                                    ],
-                                ],
-                                'secure' => false,
-                            ],
-                        ],
-                    ],
-                ],
-            ],
-        ];
-
-        /**
-         * @var $registryMock \Magento\Framework\Registry
-         */
-        $registryMock = $this->getMockBuilder(\Magento\Framework\Registry::class)
-            ->disableOriginalConstructor()
-            ->getMock();
-
-        /**
-         * @var $cacheMock \Magento\Webapi\Model\Cache\Type\Webapi
-         */
-        $cacheMock = $this->getMockBuilder(\Magento\Webapi\Model\Cache\Type\Webapi::class)
-            ->disableOriginalConstructor()
-            ->getMock();
-
-        /** @var $readerMock \Magento\Webapi\Model\Config\Reader */
-        $readerMock = $this->getMockBuilder(\Magento\Webapi\Model\Config\Reader::class)
-            ->disableOriginalConstructor()
-            ->getMock();
-        $readerMock->expects($this->any())->method('read')->will($this->returnValue($servicesConfig));
-
-        /** @var $config \Magento\Webapi\Model\Config */
-        $config = new \Magento\Webapi\Model\Config($cacheMock, $readerMock);
-
-        /** @var $config \Magento\Webapi\Model\ServiceMetadata */
-        $serviceMetadata = new \Magento\Webapi\Model\ServiceMetadata(
-            $config,
-            $cacheMock,
-            $classReflection,
-            $typeProcessor);
-
-        $this->_soapConfig = $this->objectManager->getObject(
-            \Magento\Webapi\Model\Soap\Config::class,
-            [
-                'objectManager' => $objectManagerMock,
-                'registry' => $registryMock,
-                'serviceMetadata' => $serviceMetadata,
-            ]
-        );
-        parent::setUp();
-    }
-
-    public function testGetRequestedSoapServices()
-    {
-        $expectedResult = [
-            'customerAccountManagementV1' =>
-                [
-                    'methods' => [
-                        'activate' => [
-                            'method' => 'activate',
-                            'inputRequired' => '',
-                            'isSecure' => '',
-                            'resources' => [['Magento_Customer::manage']],
-                        ],
-                    ],
-                    'class' => \Magento\Customer\Api\AccountManagementInterface::class,
-                    'description' => 'Interface for managing customers accounts.',
-                ],
-        ];
-
-        $result = $this->_soapConfig->getRequestedSoapServices(
-            ['customerAccountManagementV1', 'moduleBarV2', 'moduleBazV1']
-        );
-
-        $this->assertEquals($expectedResult, $result);
-    }
-
-    public function testGetServiceMethodInfo()
-    {
-        $expectedResult = [
-            'class' => \Magento\Customer\Api\CustomerRepositoryInterface::class,
-            'method' => 'getById',
-            'isSecure' => false,
-            'resources' => [['Magento_Customer::customer']],
-        ];
-        $methodInfo = $this->_soapConfig->getServiceMethodInfo(
-            'customerCustomerRepositoryV1GetById',
-            ['customerCustomerRepositoryV1', 'moduleBazV1']
-        );
-        $this->assertEquals($expectedResult, $methodInfo);
-    }
-
-    public function testGetSoapOperation()
-    {
-        $expectedResult = 'customerAccountManagementV1Activate';
-        $soapOperation = $this->_soapConfig
-            ->getSoapOperation(\Magento\Customer\Api\AccountManagementInterface::class, 'activate', 'V1');
-        $this->assertEquals($expectedResult, $soapOperation);
-    }
-}
-
-require_once realpath(__DIR__ . '/../../_files/test_interfaces.php');
diff --git a/app/code/Magento/Webapi/Test/Unit/_files/test_interfaces.php b/app/code/Magento/Webapi/Test/Unit/_files/test_interfaces.php
deleted file mode 100644
index 288a747cefd89cec4182de66890127eebd552806..0000000000000000000000000000000000000000
--- a/app/code/Magento/Webapi/Test/Unit/_files/test_interfaces.php
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-/**
- * Copyright © 2016 Magento. All rights reserved.
- * See COPYING.txt for license details.
- */
-
-// @codingStandardsIgnoreFile
-
-namespace Magento\Framework\Module\Service;
-
-/**
- * The list of test interfaces.
- */
-interface FooV1Interface
-{
-    public function someMethod();
-}
-interface BarV1Interface
-{
-    public function someMethod();
-}
-interface FooBarV1Interface
-{
-    public function someMethod();
-}
-namespace Magento\Framework\Module\Service\Foo;
-
-interface BarV1Interface
-{
-    public function someMethod();
-}
diff --git a/dev/tests/integration/testsuite/Magento/Eav/Model/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Eav/Model/ConfigTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..97b3cb473177149eb1d4abf391c26b76464a39eb
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Eav/Model/ConfigTest.php
@@ -0,0 +1,49 @@
+<?php
+/**
+ * Copyright © 2016 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+namespace Magento\Eav\Model;
+
+use Magento\Eav\Model\Config;
+use Magento\TestFramework\ObjectManager;
+use Magento\TestFramework\Helper\Bootstrap;
+
+class ConfigTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var Config
+     */
+    private $config;
+    
+    /**
+     * @var ObjectManager
+     */
+    private $objectManager;
+    
+    protected function setUp()
+    {
+        $this->objectManager = Bootstrap::getObjectManager();
+        $this->config = $this->objectManager->get(Config::class);
+    }
+
+    public function testGetEntityAttributeCodes()
+    {
+        $entityType = 'catalog_product';
+        $this->cleanAllCache();
+        $this->assertEquals(
+            $this->config->getEntityAttributeCodes($entityType),
+            $this->config->getEntityAttributeCodes($entityType)
+        );
+    }
+
+    private function cleanAllCache()
+    {
+        /** @var \Magento\Framework\App\Cache\Frontend\Pool $cachePool */
+        $cachePool = $this->objectManager->get(\Magento\Framework\App\Cache\Frontend\Pool::class);
+        /** @var \Magento\Framework\Cache\FrontendInterface $cacheType */
+        foreach ($cachePool as $cacheType) {
+            $cacheType->getBackend()->clean();
+        }
+    }
+}
diff --git a/dev/tests/integration/testsuite/Magento/Webapi/Model/ServiceMetadataTest.php b/dev/tests/integration/testsuite/Magento/Webapi/Model/ServiceMetadataTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..7bfbe08a34a096ccd60b0f99ee859b4387bbb336
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Webapi/Model/ServiceMetadataTest.php
@@ -0,0 +1,134 @@
+<?php
+/**
+ * Copyright © 2016 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+namespace Magento\Webapi\Model;
+
+use Magento\TestFramework\Helper\Bootstrap;
+use Magento\Customer\Api\AccountManagementInterface;
+
+class ServiceMetadataTest extends \PHPUnit_Framework_TestCase
+{
+    /**bootstrap.sh
+     * @var ServiceMetadata
+     */
+    private $serviceMetadata;
+
+    protected function setUp()
+    {
+        $objectManager = Bootstrap::getObjectManager();
+        $this->serviceMetadata = $objectManager->create(ServiceMetadata::class);
+    }
+
+    public function testGetServiceMetadata()
+    {
+        $expected = [
+            'methods' => [
+                'activate' => [
+                    'method' => 'activate',
+                    'inputRequired' => false,
+                    'isSecure' => false,
+                    'resources' => [
+                        'Magento_Customer::manage'
+                    ],
+                    'documentation' => 'Activate a customer account using a key that was sent in a confirmation email.',
+                    'interface' => [
+                        'in' => [
+                            'parameters' => [
+                                'email' => [
+                                    'type' => 'string',
+                                    'required' => true,
+                                    'documentation' => null
+                                ],
+                                'confirmationKey' => [
+                                    'type' => 'string',
+                                    'required' => true,
+                                    'documentation' => null
+                                ]
+                            ]
+                        ],
+                        'out' => [
+                            'parameters' => [
+                                'result' => [
+                                    'type' => 'CustomerDataCustomerInterface',
+                                    'required' => true,
+                                    'documentation' => ''
+                                ]
+                            ],
+                            'throws' => [
+                                "\\Magento\\Framework\\Exception\\LocalizedException"
+                            ]
+                        ]
+                    ]
+                ]
+            ],
+            'class' => AccountManagementInterface::class,
+            'description' => 'Interface for managing customers accounts.',
+        ];
+        $actual = $this->serviceMetadata->getServiceMetadata('customerAccountManagementV1');
+        $this->assertEquals(array_replace_recursive($actual, $expected), $actual);
+    }
+
+    public function testGetRouteMetadata()
+    {
+        $expected = [
+            'methods' => [
+                'activate' => [
+                    'method' => 'activate',
+                    'inputRequired' => false,
+                    'isSecure' => false,
+                    'resources' => [
+                        'Magento_Customer::manage'
+                    ],
+                    'documentation' => 'Activate a customer account using a key that was sent in a confirmation email.',
+                    'interface' => [
+                        'in' => [
+                            'parameters' => [
+                                'email' => [
+                                    'type' => 'string',
+                                    'required' => true,
+                                    'documentation' => null
+                                ],
+                                'confirmationKey' => [
+                                    'type' => 'string',
+                                    'required' => true,
+                                    'documentation' => null
+                                ]
+                            ]
+                        ],
+                        'out' => [
+                            'parameters' => [
+                                'result' => [
+                                    'type' => 'CustomerDataCustomerInterface',
+                                    'required' => true,
+                                    'documentation' => ''
+                                ]
+                            ],
+                            'throws' => [
+                                "\\Magento\\Framework\\Exception\\LocalizedException"
+                            ]
+                        ]
+                    ]
+                ]
+            ],
+            'class' => AccountManagementInterface::class,
+            'description' => 'Interface for managing customers accounts.',
+            'routes' => [
+                '/V1/customers/me/activate' => [
+                    'PUT' => [
+                        'method' => 'activateById',
+                        'parameters' => [
+                            'customerId' => [
+                                'force' => true,
+                                'value' => '%customer_id%'
+                            ]
+                        ]
+                    ]
+                ]
+            ]
+        ];
+        $actual = $this->serviceMetadata->getRouteMetadata('customerAccountManagementV1');
+        $this->assertEquals(array_replace_recursive($actual, $expected), $actual);
+    }
+}
diff --git a/dev/tests/integration/testsuite/Magento/Webapi/Model/Soap/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Webapi/Model/Soap/ConfigTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..95743e9e10537a74d2e9afd7eced8dbe76a7af77
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Webapi/Model/Soap/ConfigTest.php
@@ -0,0 +1,114 @@
+<?php
+/**
+ * Copyright © 2016 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+namespace Magento\Webapi\Model\Soap;
+
+use Magento\TestFramework\Helper\Bootstrap;
+use Magento\Customer\Api\AccountManagementInterface;
+use Magento\Customer\Api\CustomerRepositoryInterface;
+
+class ConfigTest extends \PHPUnit_Framework_TestCase
+{
+    /**
+     * @var Config
+     */
+    private $soapConfig;
+
+    protected function setUp()
+    {
+        $objectManager = Bootstrap::getObjectManager();
+        $this->soapConfig = $objectManager->create(Config::class);
+    }
+
+    public function testGetRequestedSoapServices()
+    {
+        $expected = [
+            'customerAccountManagementV1' => [
+                'methods' => [
+                    'activate' => [
+                        'method' => 'activate',
+                        'inputRequired' => false,
+                        'isSecure' => false,
+                        'resources' => [
+                            'Magento_Customer::manage'
+                        ],
+                        'documentation'
+                            => 'Activate a customer account using a key that was sent in a confirmation email.',
+                        'interface' => [
+                            'in' => [
+                                'parameters' => [
+                                    'email' => [
+                                        'type' => 'string',
+                                        'required' => true,
+                                        'documentation' => null
+                                    ],
+                                    'confirmationKey' => [
+                                        'type' => 'string',
+                                        'required' => true,
+                                        'documentation' => null
+                                    ]
+                                ]
+                            ],
+                            'out' => [
+                                'parameters' => [
+                                    'result' => [
+                                        'type' => 'CustomerDataCustomerInterface',
+                                        'required' => true,
+                                        'documentation' => null
+                                    ]
+                                ],
+                                'throws' => [
+                                    "\\Magento\\Framework\\Exception\\LocalizedException"
+                                ]
+                            ]
+                        ]
+                    ]
+                ],
+                'class' => AccountManagementInterface::class,
+                'description' => 'Interface for managing customers accounts.',
+            ]
+        ];
+        $actual = $this->soapConfig->getRequestedSoapServices(
+            [
+                'customerAccountManagementV1',
+                'NonExistentService'
+            ]
+        );
+        $this->assertEquals(array_replace_recursive($actual, $expected), $actual);
+    }
+
+    public function testGetServiceMethodInfo()
+    {
+        $expected = [
+            'class' => CustomerRepositoryInterface::class,
+            'method' => 'getById',
+            'isSecure' => false,
+            'resources' => [
+                'Magento_Customer::customer',
+                'self'
+            ],
+        ];
+        $actual = $this->soapConfig->getServiceMethodInfo(
+            'customerCustomerRepositoryV1GetById',
+            [
+                'customerCustomerRepositoryV1',
+                'NonExistentService'
+            ]
+        );
+        $this->assertEquals($expected, $actual);
+    }
+
+    public function testGetSoapOperation()
+    {
+        $expected = 'customerAccountManagementV1Activate';
+        $actual = $this->soapConfig
+            ->getSoapOperation(
+                AccountManagementInterface::class,
+                'activate',
+                'V1'
+            );
+        $this->assertEquals($expected, $actual);
+    }
+}
diff --git a/dev/tests/static/framework/Magento/TestFramework/CodingStandard/Tool/CopyPasteDetector.php b/dev/tests/static/framework/Magento/TestFramework/CodingStandard/Tool/CopyPasteDetector.php
index b2d9c164fbd1bc57cf9f2497ff02d6fe6f6895e9..b2766ebd90d92e85072bd84c7c7939813d863bc8 100644
--- a/dev/tests/static/framework/Magento/TestFramework/CodingStandard/Tool/CopyPasteDetector.php
+++ b/dev/tests/static/framework/Magento/TestFramework/CodingStandard/Tool/CopyPasteDetector.php
@@ -56,8 +56,7 @@ class CopyPasteDetector implements ToolInterface, BlacklistInterface
      */
     public function canRun()
     {
-        $vendorDir = require BP . '/app/etc/vendor_path.php';
-        exec('php ' . BP . '/' . $vendorDir . '/bin/phpcpd --version', $output, $exitCode);
+        exec($this->getCommand() . ' --version', $output, $exitCode);
         return $exitCode === 0;
     }
 
@@ -71,22 +70,37 @@ class CopyPasteDetector implements ToolInterface, BlacklistInterface
      */
     public function run(array $whiteList)
     {
-        $blackListStr = ' ';
+        $blacklistedDirs = [];
+        $blacklistedFileNames = [];
         foreach ($this->blacklist as $file) {
             $file = escapeshellarg(trim($file));
             if (!$file) {
                 continue;
             }
-            $blackListStr .= '--exclude ' . $file . ' ';
+            $ext = pathinfo($file, PATHINFO_EXTENSION);
+            if ($ext != '') {
+                $blacklistedFileNames[] = $file;
+            } else {
+                $blacklistedDirs[] = '--exclude ' . $file . ' ';
+            }
         }
 
-        $vendorDir = require BP . '/app/etc/vendor_path.php';
-        $command = 'php ' . BP . '/' . $vendorDir . '/bin/phpcpd' . ' --log-pmd ' . escapeshellarg(
-                $this->reportFile
-            ) . ' --names-exclude "*Test.php" --min-lines 13' . $blackListStr . ' ' . implode(' ', $whiteList);
-
+        $command = $this->getCommand() . ' --log-pmd ' . escapeshellarg($this->reportFile)
+            . ' --names-exclude ' . join(',', $blacklistedFileNames) . ' --min-lines 13 ' . join(' ', $blacklistedDirs)
+            . ' ' . implode(' ', $whiteList);
         exec($command, $output, $exitCode);
 
         return !(bool)$exitCode;
     }
+
+    /**
+     * Get PHPCPD command
+     *
+     * @return string
+     */
+    private function getCommand()
+    {
+        $vendorDir = require BP . '/app/etc/vendor_path.php';
+        return 'php ' . BP . '/' . $vendorDir . '/bin/phpcpd';
+    }
 }
diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/UnsecureFunctionsUsageTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/UnsecureFunctionsUsageTest.php
index 6b18eb2b71478463e39e815dec078478c4034a07..e5263713d71d7af374ea1f32c2d765d3639e56ce 100644
--- a/dev/tests/static/testsuite/Magento/Test/Legacy/UnsecureFunctionsUsageTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Legacy/UnsecureFunctionsUsageTest.php
@@ -64,7 +64,7 @@ class UnsecureFunctionsUsageTest extends \PHPUnit_Framework_TestCase
                 if ($regexp) {
                     $matches = preg_grep(
                         $regexp,
-                        file($fileName, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES)
+                        file($fileName)
                     );
                     if (!empty($matches)) {
                         foreach (array_keys($matches) as $line) {
@@ -114,7 +114,8 @@ class UnsecureFunctionsUsageTest extends \PHPUnit_Framework_TestCase
                     if (strpos($path, $directory) === 0) {
                         if (preg_match($fileExtensions, $path)) {
                             foreach ($blackListFiles as $blackListFile) {
-                                if (preg_match($blackListFile, $path)) {
+                                $blackListFile = preg_quote($blackListFile, '#');
+                                if (preg_match('#' . $blackListFile . '#', $path)) {
                                     return false;
                                 }
                             }
@@ -158,10 +159,6 @@ class UnsecureFunctionsUsageTest extends \PHPUnit_Framework_TestCase
         if (empty($functions)) {
             return '';
         }
-        $regexArray = [];
-        foreach ($functions as $function) {
-            $regexArray[] = '\b' . $function . '\b\(';
-        }
-        return '/' . implode('|', $regexArray) . '/i';
+        return '/(?<!function |[^\s])\b(' . join('|', $functions) . ')\s*\(/i';
     }
 }
diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/security/blacklist.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/security/blacklist.php
index d120a4543b9ddced597d330ab489de15c80cdb86..3c93d37deba52f6c54bf7574a1c0f46212a785dc 100644
--- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/security/blacklist.php
+++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/security/blacklist.php
@@ -4,6 +4,6 @@
  * See COPYING.txt for license details.
  */
 return [
-    '/Test\/Unit/',
-    '/lib\/internal\/Magento\/Framework\/DB\/Adapter\/Pdo\/Mysql\.php/',
+    'Test/Unit',
+    'lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php',
 ];
diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/security/whitelist.txt b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/security/whitelist.txt
index 2567475de6a035b2a369ac342c076ce1e5cad07d..e464d9713657f6341ccbf1f6d77986ebac08d979 100644
--- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/security/whitelist.txt
+++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/security/whitelist.txt
@@ -1,4 +1,5 @@
+# "Component Type" "Component Name" "Path Pattern"
 module * /
 library * /
 setup
-pub
\ No newline at end of file
+pub
diff --git a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt
index 56e0d51516c2632a28acd50ca2c3999e984720df..3afe3af79b14ff3177a0dc1c5ea9fe42e93b6331 100644
--- a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt
+++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt
@@ -196,4 +196,6 @@ Magento/Framework/Mview/Config/Data
 Magento/Framework/View/File/Collector/Override
 Magento/Framework/MessageQueue/Consumer/Config/ConsumerConfigItem
 Magento/Framework/MessageQueue/Publisher/Config/PublisherConfigItem
-Magento/Framework/MessageQueue/Topology/Config/ExchangeConfigItem
\ No newline at end of file
+Magento/Framework/MessageQueue/Topology/Config/ExchangeConfigItem
+IntegrationConfig.php
+*Test.php