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

    req_094_Util.getWorkerStatus(WorkerStatus.OWNER);
    TestCase.assertTrue(
        AcceptanceTestUtil.isInterested(component, peerID.getServiceID(), workerID));
    TestCase.assertNotNull(workerStatus.getMasterPeerAddress());

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

    req_094_Util.getWorkerStatus(WorkerStatus.OWNER);
    TestCase.assertNotNull(workerStatus.getMasterPeerAddress());
    TestCase.assertEquals(workerStatus.getMasterPeerAddress(), peerID.getServiceID().toString());
  }
  @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_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());
  }
  @Test
  public void test_322_19_RemoteWorkerManagementClientIsDown() throws Exception {
    WorkerStatusDAO workerStatus = WorkerDAOFactory.getInstance().getWorkerStatusDAO();
    req_094_Util.getWorkerStatus(WorkerStatus.ALLOCATED_FOR_BROKER);

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

    req_127_Util.notifyRemotePeerFailureAtPreparingAllocatedForRemoteBroker(
        component, remotePeerID);

    req_094_Util.getWorkerStatus(WorkerStatus.IDLE);

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

    req_126_Util.notifyRemotePeerRecovery(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());
  }