diff --git a/core/modules/migrate/lib/Drupal/migrate/Plugin/migrate/process/DedupeEntity.php b/core/modules/migrate/lib/Drupal/migrate/Plugin/migrate/process/DedupeEntity.php
index a690ce5..58bcdf8 100644
--- a/core/modules/migrate/lib/Drupal/migrate/Plugin/migrate/process/DedupeEntity.php
+++ b/core/modules/migrate/lib/Drupal/migrate/Plugin/migrate/process/DedupeEntity.php
@@ -7,6 +7,11 @@
 
 namespace Drupal\migrate\Plugin\migrate\process;
 
+use Drupal\Core\Entity\Query\QueryFactory;
+use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
+use Drupal\migrate\Entity\MigrationInterface;
+use Symfony\Component\DependencyInjection\ContainerInterface;
+
 /**
  * Ensures value is not duplicated against an entity field.
  *
@@ -14,30 +19,45 @@
  *   id = "dedupe_entity"
  * )
  */
-class DedupeEntity extends DedupeBase {
+class DedupeEntity extends DedupeBase implements ContainerFactoryPluginInterface {
 
   /**
-   * @var \Drupal\Core\Entity\Query\QueryInterface
+   * @var \Drupal\Core\Entity\Query\QueryFactoryInterface
    */
-  protected $entityQuery;
+  protected $entityQueryFactory;
 
   /**
    * {@inheritdoc}
    */
-  protected function exists($value) {
-    return $this->getEntityQuery()->condition($this->configuration['field'], $value)->count()->execute();
+  public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, QueryFactory $entity_query_factory) {
+    parent::__construct($configuration, $plugin_id, $plugin_definition);
+    $this->entityQueryFactory = $entity_query_factory;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
+    return new static(
+      $configuration,
+      $plugin_id,
+      $plugin_definition,
+      $migration,
+      $container->get('entity.query')
+    );
   }
 
   /**
-   * Returns an entity query object.
-   *
-   * @return \Drupal\Core\Entity\Query\QueryInterface
-   *   The entity query object for the configured entity type.
+   * {@inheritdoc}
    */
-  protected function getEntityQuery() {
-    if (!isset($this->entityQuery)) {
-      $this->entityQuery = \Drupal::entityQuery($this->configuration['entity_type']);
-    }
-    return $this->entityQuery;
+  protected function exists($value) {
+    // Plugins are cached so for every run we need a new query object.
+    return $this
+      ->entityQueryFactory
+      ->get($this->configuration['entity_type'], 'AND')
+      ->condition($this->configuration['field'], $value)
+      ->count()
+      ->execute();
   }
+
 }
diff --git a/core/modules/migrate/tests/Drupal/migrate/Tests/process/DedupeEntityTest.php b/core/modules/migrate/tests/Drupal/migrate/Tests/process/DedupeEntityTest.php
index 1060acd..c7a2db5 100644
--- a/core/modules/migrate/tests/Drupal/migrate/Tests/process/DedupeEntityTest.php
+++ b/core/modules/migrate/tests/Drupal/migrate/Tests/process/DedupeEntityTest.php
@@ -6,7 +6,6 @@
 
 namespace Drupal\migrate\Tests\process;
 
-use Drupal\Core\Entity\Query\QueryInterface;
 use Drupal\migrate\Plugin\migrate\process\DedupeEntity;
 
 /**
@@ -23,10 +22,27 @@ class DedupeEntityTest extends MigrateProcessTestCase {
    * The mock entity query.
    *
    * @var \Drupal\Core\Entity\Query\QueryInterface
+   * @var \Drupal\Core\Entity\Query\QueryFactory
    */
   protected $entityQuery;
 
   /**
+   * The mock entity query factory.
+   *
+   * @var  \Drupal\Core\Entity\Query\QueryFactory|\PHPUnit_Framework_MockObject_MockObject
+   */
+  protected $entityQueryFactory;
+
+  /**
+   * The migration configuration, initialized to set the ID to test.
+   *
+   * @var array
+   */
+  protected $migrationConfiguration = array(
+    'id' => 'test',
+  );
+
+  /**
    * {@inheritdoc}
    */
   public static function getInfo() {
@@ -44,6 +60,12 @@ protected function setUp() {
     $this->entityQuery = $this->getMockBuilder('Drupal\Core\Entity\Query\QueryInterface')
       ->disableOriginalConstructor()
       ->getMock();
+    $this->entityQueryFactory = $this->getMockBuilder('Drupal\Core\Entity\Query\QueryFactory')
+      ->disableOriginalConstructor()
+      ->getMock();
+    $this->entityQueryFactory->expects($this->any())
+      ->method('get')
+      ->will($this->returnValue($this->entityQuery));
     parent::setUp();
   }
 
@@ -60,10 +82,9 @@ public function testDedupe($count, $postfix = '') {
     if ($postfix) {
       $configuration['postfix'] = $postfix;
     }
-    $plugin = new TestDedupeEntity($configuration, 'dedupe_entity', array());
+    $plugin = new DedupeEntity($configuration, 'dedupe_entity', array(), $this->getMigration(), $this->entityQueryFactory);
     $this->entityQueryExpects($count);
-    $plugin->setEntityQuery($this->entityQuery);
-    $return = $plugin->transform('test', $this->migrateExecutable, $this->row, 'testpropertty');
+    $return = $plugin->transform('test', $this->migrateExecutable, $this->row, 'testproperty');
     $this->assertSame($return, 'test' . ($count ? $postfix . $count : ''));
   }
 
@@ -105,9 +126,3 @@ protected function entityQueryExpects($count) {
       ->will($this->returnCallback(function () use (&$count) { return $count--;}));
   }
 }
-
-class TestDedupeEntity extends DedupeEntity {
-  public function setEntityQuery(QueryInterface $entity_query) {
-    $this->entityQuery = $entity_query;
-  }
-}
diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_block.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_block.yml
index 1a9db7a..5c33450 100644
--- a/core/modules/migrate_drupal/config/install/migrate.migration.d6_block.yml
+++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_block.yml
@@ -58,4 +58,5 @@ process:
 destination:
   plugin: entity:block
 migration_dependencies:
+  - d6_custom_block
   - d6_menu: false
diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_upload_field_instance.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_upload_field_instance.yml
index a25de1f..6346412 100644
--- a/core/modules/migrate_drupal/config/install/migrate.migration.d6_upload_field_instance.yml
+++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_upload_field_instance.yml
@@ -18,3 +18,4 @@ destination:
   plugin: entity:field_instance_config
 migration_dependencies:
   - d6_upload_field
+  - d6_node_type
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/Block.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/Block.php
index 362abdc..dbc58a9 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/Block.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/Block.php
@@ -108,6 +108,7 @@ public function prepareRow(Row $row) {
   public function getIds() {
     $ids['module']['type'] = 'string';
     $ids['delta']['type'] = 'string';
+    $ids['theme']['type'] = 'string';
     return $ids;
   }
 
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6Block.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6Block.php
index 3144fb7..cb3c9d9 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6Block.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6Block.php
@@ -306,6 +306,21 @@ public function load() {
       'title' => 'Static Block',
       'cache' => '-1'
     ))
+    ->values(array(
+      'bid' => '11',
+      'module' => 'block',
+      'delta' => '2',
+      'theme' => 'bluemarine',
+      'status' => '1',
+      'weight' => '-4',
+      'region' => 'right',
+      'custom' => '0',
+      'throttle' => '0',
+      'visibility' => '1',
+      'pages' => 'node',
+      'title' => 'Another Static Block',
+      'cache' => '-1'
+    ))
     ->execute();
   }
 }
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6Box.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6Box.php
index d042f72..88c40b9 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6Box.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/Dump/Drupal6Box.php
@@ -55,10 +55,16 @@ public function load() {
     ))
     ->values(array(
       'bid' => '1',
-      'body' => '<h3>My custom block body</h3>',
+      'body' => '<h3>My first custom block body</h3>',
       'info' => 'My block 1',
       'format' => 2,
     ))
+    ->values(array(
+      'bid' => '2',
+      'body' => '<h3>My second custom block body</h3>',
+      'info' => 'My block 2',
+      'format' => 2,
+    ))
     ->execute();
   }
 }
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateBlockTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateBlockTest.php
index 3e617f4..bb79dc6 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateBlockTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateBlockTest.php
@@ -48,13 +48,19 @@ public function setUp() {
     $entities = array(
       entity_create('menu', array('id' => 'primary-links')),
       entity_create('menu', array('id' => 'secondary-links')),
-      entity_create('custom_block', array('id' => 1, 'type' => 'basic')),
+      entity_create('custom_block', array('id' => 1, 'type' => 'basic', 'info' => $this->randomName(8))),
+      entity_create('custom_block', array('id' => 2, 'type' => 'basic', 'info' => $this->randomName(8))),
     );
     foreach ($entities as $entity) {
       $entity->enforceIsNew(TRUE);
       $entity->save();
     }
-    $this->prepareIdMappings(array('d6_custom_block'  => array(array(array(1), array(1)))));
+    $this->prepareIdMappings(array(
+      'd6_custom_block'  => array(
+        array(array(10), array(1)),
+        array(array(11), array(2)),
+      )
+    ));
     /** @var \Drupal\migrate\entity\Migration $migration */
     $migration = entity_load('migration', 'd6_block');
     $dumps = array(
@@ -70,7 +76,111 @@ public function setUp() {
    */
   public function testBlockMigration() {
     $blocks = entity_load_multiple('block');
-    $this->assertTrue(count($blocks));
-    // @TODO add more asserts.
+    $this->assertEqual(count($blocks), 11);
+
+    // User blocks
+    $test_block_user = $blocks['user'];
+    $this->assertNotNull($test_block_user);
+    $this->assertEqual('left', $test_block_user->get('region'));
+    $this->assertEqual('garland', $test_block_user->get('theme'));
+    $visibility = $test_block_user->get('visibility');
+    $this->assertEqual(0, $visibility['path']['visibility']);
+    $this->assertEqual('', $visibility['path']['pages']);
+    $this->assertEqual(0, $test_block_user->weight);
+
+    $test_block_user_1 = $blocks['user_1'];
+    $this->assertNotNull($test_block_user_1);
+    $this->assertEqual('left', $test_block_user_1->get('region'));
+    $this->assertEqual('garland', $test_block_user_1->get('theme'));
+    $visibility = $test_block_user_1->get('visibility');
+    $this->assertEqual(0, $visibility['path']['visibility']);
+    $this->assertEqual('', $visibility['path']['pages']);
+    $this->assertEqual(0, $test_block_user_1->weight);
+
+    $test_block_user_2 = $blocks['user_2'];
+    $this->assertNotNull($test_block_user_2);
+    $this->assertEqual('', $test_block_user_2->get('region'));
+    $this->assertEqual('garland', $test_block_user_2->get('theme'));
+    $visibility = $test_block_user_2->get('visibility');
+    $this->assertEqual(0, $visibility['path']['visibility']);
+    $this->assertEqual('', $visibility['path']['pages']);
+    $this->assertEqual(-3, $test_block_user_2->weight);
+
+    $test_block_user_3 = $blocks['user_3'];
+    $this->assertNotNull($test_block_user_3);
+    $this->assertEqual('', $test_block_user_3->get('region'));
+    $this->assertEqual('garland', $test_block_user_3->get('theme'));
+    $visibility = $test_block_user_3->get('visibility');
+    $this->assertEqual(0, $visibility['path']['visibility']);
+    $this->assertEqual('', $visibility['path']['pages']);
+    $this->assertEqual(-1, $test_block_user_3->weight);
+
+    // Check system block
+    $test_block_system = $blocks['system'];
+    $this->assertNotNull($test_block_system);
+    $this->assertEqual('footer', $test_block_system->get('region'));
+    $this->assertEqual('garland', $test_block_system->get('theme'));
+    $visibility = $test_block_system->get('visibility');
+    $this->assertEqual(0, $visibility['path']['visibility']);
+    $this->assertEqual('', $visibility['path']['pages']);
+    $this->assertEqual(-5, $test_block_system->weight);
+
+    // Check comment block
+    $test_block_comment = $blocks['comment'];
+    $this->assertNotNull($test_block_comment);
+    $this->assertEqual('', $test_block_comment->get('region'));
+    $this->assertEqual('garland', $test_block_comment->get('theme'));
+    $visibility = $test_block_comment->get('visibility');
+    $this->assertEqual(0, $visibility['path']['visibility']);
+    $this->assertEqual('', $visibility['path']['pages']);
+    $this->assertEqual(-6, $test_block_comment->weight);
+
+    // Check menu blocks
+    $test_block_menu = $blocks['menu'];
+    $this->assertNotNull($test_block_menu);
+    $this->assertEqual('header', $test_block_menu->get('region'));
+    $this->assertEqual('garland', $test_block_menu->get('theme'));
+    $visibility = $test_block_menu->get('visibility');
+    $this->assertEqual(0, $visibility['path']['visibility']);
+    $this->assertEqual('', $visibility['path']['pages']);
+    $this->assertEqual(-5, $test_block_menu->weight);
+
+    $test_block_menu_1 = $blocks['menu_1'];
+    $this->assertNotNull($test_block_menu_1);
+    $this->assertEqual('', $test_block_menu_1->get('region'));
+    $this->assertEqual('garland', $test_block_menu_1->get('theme'));
+    $visibility = $test_block_menu_1->get('visibility');
+    $this->assertEqual(0, $visibility['path']['visibility']);
+    $this->assertEqual('', $visibility['path']['pages']);
+    $this->assertEqual(-5, $test_block_menu_1->weight);
+
+    // Check node block
+    $test_block_node = $blocks['node'];
+    $this->assertNotNull($test_block_node);
+    $this->assertEqual('', $test_block_node->get('region'));
+    $this->assertEqual('garland', $test_block_node->get('theme'));
+    $visibility = $test_block_node->get('visibility');
+    $this->assertEqual(0, $visibility['path']['visibility']);
+    $this->assertEqual('', $visibility['path']['pages']);
+    $this->assertEqual(-4, $test_block_node->weight);
+
+    // Check custom blocks
+    $test_block_block = $blocks['block'];
+    $this->assertNotNull($test_block_block);
+    $this->assertEqual('content', $test_block_block->get('region'));
+    $this->assertEqual('garland', $test_block_block->get('theme'));
+    $visibility = $test_block_block->get('visibility');
+    $this->assertEqual(1, $visibility['path']['visibility']);
+    $this->assertEqual('<front>', $visibility['path']['pages']);
+    $this->assertEqual(0, $test_block_block->weight);
+
+    $test_block_block_1 = $blocks['block_1'];
+    $this->assertNotNull($test_block_block_1);
+    $this->assertEqual('right', $test_block_block_1->get('region'));
+    $this->assertEqual('bluemarine', $test_block_block_1->get('theme'));
+    $visibility = $test_block_block_1->get('visibility');
+    $this->assertEqual(1, $visibility['path']['visibility']);
+    $this->assertEqual('node', $visibility['path']['pages']);
+    $this->assertEqual(-4, $test_block_block_1->weight);
   }
 }
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCustomBlockTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCustomBlockTest.php
index eb9da18..d48acaf 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCustomBlockTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateCustomBlockTest.php
@@ -60,7 +60,15 @@ public function testBlockMigration() {
     $this->assertEqual(1, $block->getRevisionId());
     $this->assertTrue(REQUEST_TIME <= $block->getChangedTime() && $block->getChangedTime() <= time());
     $this->assertEqual(Language::LANGCODE_NOT_SPECIFIED, $block->language()->id);
-    $this->assertEqual('<h3>My custom block body</h3>', $block->body->value);
+    $this->assertEqual('<h3>My first custom block body</h3>', $block->body->value);
+    $this->assertEqual('full_html', $block->body->format);
+
+    $block = entity_load('custom_block', 2);
+    $this->assertEqual('My block 2', $block->label());
+    $this->assertEqual(2, $block->getRevisionId());
+    $this->assertTrue(REQUEST_TIME <= $block->getChangedTime() && $block->getChangedTime() <= time());
+    $this->assertEqual(Language::LANGCODE_NOT_SPECIFIED, $block->language()->id);
+    $this->assertEqual('<h3>My second custom block body</h3>', $block->body->value);
     $this->assertEqual('full_html', $block->body->format);
   }
 
diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUploadInstanceTest.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUploadInstanceTest.php
index e12f04b..e252423 100644
--- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUploadInstanceTest.php
+++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Tests/d6/MigrateUploadInstanceTest.php
@@ -43,6 +43,11 @@ protected function setUp() {
       'd6_upload_field' => array(
         array(array(1), array('node', 'upload')),
       ),
+      'd6_node_type' => array(
+        array(array('page'), array('page')),
+        array(array('story'), array('story')),
+        array(array('article'), array('article')),
+      ),
     );
     $this->prepareIdMappings($id_mappings);
 
