@Test
  public void test_322_16_ReadyForAllocation() throws Exception {
    WorkerStatusDAO workerStatus = WorkerDAOFactory.getInstance().getWorkerStatusDAO();

    RemoteWorkerManagementClient rwmc =
        workerAcceptanceUtil.createRemoteWorkerManagementClient(remotePeerID.getPublicKey());

    req_094_Util.getWorkerStatus(WorkerStatus.ALLOCATED_FOR_BROKER);

    TestCase.assertTrue(workerStatus.isLogged());
    TestCase.assertTrue(workerStatus.isAllocatedForBroker());
    TestCase.assertTrue(workerStatus.isAllocatedForRemotePeer());
    TestCase.assertFalse(workerStatus.isWorkingState());
    TestCase.assertTrue(workerStatus.isPreparingAllocationState());
    TestCase.assertEquals(workerStatus.getRemotePeerPublicKey(), remotePeerID.getPublicKey());

    req_092_Util.prepareAllocationCompletedOnPreparingAllocatedForRemoteBrokerWorker(
        component, rwmc, prepFuture);

    req_094_Util.getWorkerStatus(WorkerStatus.ALLOCATED_FOR_BROKER);

    TestCase.assertNotNull(workerStatus.getMasterPeerAddress());
    TestCase.assertEquals(workerStatus.getMasterPeerAddress(), peerID.getServiceID().toString());
    TestCase.assertTrue(workerStatus.isLogged());
    TestCase.assertTrue(workerStatus.isAllocatedForRemotePeer());
    TestCase.assertTrue(workerStatus.isAllocatedForBroker());
    TestCase.assertFalse(workerStatus.isPreparingAllocationState());
    TestCase.assertEquals(workerStatus.getRemotePeerPublicKey(), remotePeerID.getPublicKey());
  }
  @Test
  public void test_322_4_WorkerManagementClientIsUp() throws Exception {
    WorkerStatusDAO workerStatus = WorkerDAOFactory.getInstance().getWorkerStatusDAO();
    req_094_Util.getWorkerStatus(WorkerStatus.ALLOCATED_FOR_BROKER);

    TestCase.assertNotNull(workerStatus.getMasterPeerAddress());
    TestCase.assertTrue(workerStatus.isLogged());
    TestCase.assertFalse(workerStatus.isWorkingState());
    TestCase.assertTrue(workerStatus.isPreparingAllocationState());
    TestCase.assertTrue(workerStatus.isAllocatedForBroker());

    req_126_Util.notifyPeerRecoveryAtWorkerWithPeer(
        component, peerID, workerAcceptanceUtil.getPeerMonitorDeployment().getDeploymentID());

    req_094_Util.getWorkerStatus(WorkerStatus.ALLOCATED_FOR_BROKER);

    TestCase.assertNotNull(workerStatus.getMasterPeerAddress());
    TestCase.assertEquals(workerStatus.getMasterPeerAddress(), peerID.getServiceID().toString());
    TestCase.assertTrue(workerStatus.isLogged());
    TestCase.assertFalse(workerStatus.isWorkingState());
    TestCase.assertTrue(workerStatus.isPreparingAllocationState());
    TestCase.assertTrue(workerStatus.isAllocatedForRemotePeer());
    TestCase.assertTrue(workerStatus.isAllocatedForBroker());
    TestCase.assertEquals(workerStatus.getRemotePeerPublicKey(), remotePeerID.getPublicKey());
  }
  @Test
  public void test_322_8_ExecutionError() throws Exception {
    WorkerStatusDAO workerStatus = WorkerDAOFactory.getInstance().getWorkerStatusDAO();
    TestCase.assertTrue(workerStatus.isLogged());
    TestCase.assertTrue(workerStatus.isPreparingAllocationState());

    req_128_Util.executionErrorOnPreparingWorker(component);

    req_094_Util.getWorkerStatus(WorkerStatus.ALLOCATED_FOR_BROKER);

    TestCase.assertNotNull(workerStatus.getMasterPeerAddress());
    TestCase.assertEquals(workerStatus.getMasterPeerAddress(), peerID.getServiceID().toString());
    TestCase.assertTrue(workerStatus.isLogged());
    TestCase.assertTrue(workerStatus.isAllocatedForBroker());
    TestCase.assertTrue(workerStatus.isAllocatedForRemotePeer());
    TestCase.assertTrue(workerStatus.isPreparingAllocationState());
    TestCase.assertEquals(workerStatus.getRemotePeerPublicKey(), remotePeerID.getPublicKey());
  }
  @Test
  public void test_322_6_LoginSucceeded() throws Exception {
    WorkerStatusDAO workerStatus = WorkerDAOFactory.getInstance().getWorkerStatusDAO();
    req_094_Util.getWorkerStatus(WorkerStatus.ALLOCATED_FOR_BROKER);

    TestCase.assertNotNull(workerStatus.getMasterPeerAddress());
    TestCase.assertEquals(workerStatus.getMasterPeerAddress(), peerID.getServiceID().toString());
    TestCase.assertTrue(workerStatus.isLogged());
    TestCase.assertTrue(workerStatus.isAllocated());
    TestCase.assertTrue(workerStatus.isPreparingAllocationState());

    req_129_Util.loginAlreadyLoggedInIdle(component, peerPubKey, peerID, testStub);

    TestCase.assertTrue(workerStatus.isLogged());
    TestCase.assertTrue(workerStatus.isAllocated());
    TestCase.assertTrue(workerStatus.isAllocatedForRemotePeer());
    TestCase.assertTrue(workerStatus.isAllocatedForBroker());
    TestCase.assertEquals(workerStatus.getRemotePeerPublicKey(), remotePeerID.getPublicKey());
    TestCase.assertTrue(workerStatus.isPreparingAllocationState());
  }
  @Test
  public void test_322_14_WorkerManagementClientIsDown() throws Exception {
    WorkerStatusDAO workerStatus = WorkerDAOFactory.getInstance().getWorkerStatusDAO();
    req_094_Util.getWorkerStatus(WorkerStatus.ALLOCATED_FOR_BROKER);

    TestCase.assertTrue(workerStatus.isLogged());
    TestCase.assertTrue(workerStatus.isAllocatedForBroker());
    TestCase.assertTrue(workerStatus.isAllocatedForRemotePeer());
    TestCase.assertFalse(workerStatus.isWorkingState());
    TestCase.assertTrue(workerStatus.isPreparingAllocationState());
    TestCase.assertEquals(workerStatus.getRemotePeerPublicKey(), remotePeerID.getPublicKey());

    req_127_Util.notifyPeerFailureAtPreparingAllocatedForRemoteBrokerWorker(component, peerID);

    req_094_Util.getWorkerStatus(WorkerStatus.IDLE);
    TestCase.assertNotNull(workerStatus.getMasterPeerAddress());
    TestCase.assertTrue(workerStatus.isPreparingAllocationState());
    TestCase.assertFalse(workerStatus.isLogged());
    TestCase.assertFalse(workerStatus.isAllocated());
    TestCase.assertFalse(workerStatus.isWorkingState());
  }
  @Test
  public void test_322_13_PreparationError() throws Exception {
    WorkerStatusDAO workerStatus = WorkerDAOFactory.getInstance().getWorkerStatusDAO();

    TestCase.assertTrue(workerStatus.isLogged());
    TestCase.assertTrue(workerStatus.isAllocatedForBroker());
    TestCase.assertTrue(workerStatus.isAllocatedForRemotePeer());
    TestCase.assertFalse(workerStatus.isWorkingState());
    TestCase.assertTrue(workerStatus.isPreparingAllocationState());

    req_094_Util.getWorkerStatus(WorkerStatus.ALLOCATED_FOR_BROKER);

    req_125_Util.allocationError(
        component, wmc, prepFuture, true, WorkerStatus.ALLOCATED_FOR_BROKER);

    req_094_Util.getWorkerStatus(WorkerStatus.ERROR);
    TestCase.assertNotNull(workerStatus.getMasterPeerAddress());
    TestCase.assertEquals(workerStatus.getMasterPeerAddress(), peerID.getServiceID().toString());
    TestCase.assertTrue(workerStatus.isLogged());
    TestCase.assertTrue(workerStatus.isErrorState());
    TestCase.assertFalse(workerStatus.isPreparingAllocationState());
  }
  @Test
  public void test_322_17_Pause() throws Exception {
    WorkerStatusDAO workerStatus = WorkerDAOFactory.getInstance().getWorkerStatusDAO();
    req_094_Util.getWorkerStatus(WorkerStatus.ALLOCATED_FOR_BROKER);

    TestCase.assertNotNull(workerStatus.getMasterPeerAddress());
    TestCase.assertEquals(workerStatus.getMasterPeerAddress(), peerID.getServiceID().toString());
    TestCase.assertTrue(workerStatus.isLogged());
    TestCase.assertTrue(workerStatus.isAllocated());
    TestCase.assertTrue(workerStatus.isPreparingAllocationState());

    req_087_Util.pausePreparingAllocatedForBrokerWorker(component, wmc, prepFuture);

    req_094_Util.getWorkerStatus(WorkerStatus.OWNER);

    TestCase.assertNotNull(workerStatus.getMasterPeerAddress());
    TestCase.assertEquals(workerStatus.getMasterPeerAddress(), peerID.getServiceID().toString());
    TestCase.assertTrue(workerStatus.isLogged());
    TestCase.assertFalse(workerStatus.isAllocated());
  }