public function test()
 {
     $allShardSetting = ['db1' => ['host' => '127.0.0.1', 'port' => '3306', 'username' => 'hello', 'password' => 'world', 'database' => 'db1'], 'db2' => ['host' => '127.0.0.1', 'port' => '3307', 'username' => 'hello', 'password' => 'world', 'database' => 'db2'], 'db3' => ['host' => '127.0.0.1', 'port' => '3308', 'username' => 'hello', 'password' => 'world', 'database' => 'db3']];
     $resourceFacade = new ResourceFacade();
     $collection = $resourceFacade->makeCollection(new ShardConfig(), $allShardSetting);
     $sliceNumber = 2;
     $sliceFacade = new SliceFacade(new RoundRobin());
     $sliceList = $sliceFacade->makeSlice($collection, $sliceNumber);
     $total = 0;
     foreach ($sliceList as $slice) {
         $this->assertGreaterThan(0, count($slice));
         $total += count($slice);
     }
     $this->assertEquals(count($allShardSetting), $total);
     $ownershipFacade = new OwnershipFacade();
     $ownershipFacade->setPerformer(new LocalFSPerformer('/tmp'));
     $ownershipManager = $ownershipFacade->buildManager($collection);
     $ownershipManager2 = $ownershipFacade->buildManager($collection);
     $this->assertEquals($ownershipManager, $ownershipManager2);
     $success = $ownershipManager->acquire();
     $this->assertTrue($success);
     $success = $ownershipManager->acquire();
     $this->assertNotTrue($success);
     $ownershipManager->release();
     $success = $ownershipManager->acquire();
     $this->assertTrue($success);
     $ownershipManager->release();
     try {
         $ownershipManager->release();
     } catch (\Exception $e) {
         $this->assertTrue($e instanceof \LogicException);
     }
 }
 /**
  * @param ResourceCollection[] $sliceList
  *
  * @return ResourceCollection
  */
 protected function execute(array $sliceList)
 {
     $pollPerformer = $this->getPollPerformer();
     $this->ownershipFacade->setPerformer($pollPerformer);
     foreach ($sliceList as $slice) {
         $ownershipManager = $this->ownershipFacade->buildManager($slice);
         if ($ownershipManager->acquire() === false) {
             continue;
         }
         return $slice;
     }
     return new ResourceCollection();
 }