@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_10_ExecutionIsRunning() throws Exception {
    WorkerStatusDAO workerStatus = WorkerDAOFactory.getInstance().getWorkerStatusDAO();
    TestCase.assertTrue(workerStatus.isLogged());
    TestCase.assertTrue(workerStatus.isAllocatedForRemotePeer());
    TestCase.assertTrue(workerStatus.isAllocatedForBroker());
    TestCase.assertFalse(workerStatus.isWorkingState());
    TestCase.assertTrue(workerStatus.isPreparingAllocationState());
    TestCase.assertEquals(workerStatus.getRemotePeerPublicKey(), remotePeerID.getPublicKey());

    req_128_Util.executionIsRunningOnIdleWorker(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.assertFalse(workerStatus.isWorkingState());
    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_18_WorkForBroker() 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.isPreparingAllocationState());

    req_092_Util.workForBrokerOnPreparingAllocatedForRemoteBrokerWorker(
        component, wmc, "brokerPublicKey");

    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.isAllocatedForRemotePeer());
    TestCase.assertTrue(workerStatus.isAllocatedForBroker());
    TestCase.assertNull(workerStatus.getRemotePeerPublicKey());
    TestCase.assertTrue(workerStatus.isPreparingAllocationState());
  }