@Before
  public void setUp() throws Exception {
    super.setUp();

    peerPubKey = workerAcceptanceUtil.simulateAuthentication();
    peerID =
        new DeploymentID(
            new ContainerID("peerUser", "peerServer", PeerConstants.MODULE_NAME, peerPubKey),
            PeerConstants.WORKER_MANAGEMENT_CLIENT_OBJECT_NAME);

    remotePeerID =
        new DeploymentID(
            new ContainerID(
                "remotePeerUser", "peerServer", PeerConstants.MODULE_NAME, "remotePeerPubKey"),
            PeerConstants.REMOTE_WORKER_MANAGEMENT_CLIENT);

    component = req_003_Util.createWorkerComponent(peerID.getServiceID(), false);
    req_004_Util.startWorker(component);
    req_092_Util.prepareAllocationCompletedOnPreparingWorker(component);
    testStub =
        req_126_Util.notifyPeerRecoveryAtWorkerWithoutPeer(
            component, peerID, workerAcceptanceUtil.getPeerMonitorDeployment().getDeploymentID());
    req_129_Util.loginCompleteIdle(component, peerPubKey, peerID, testStub);
    wmc = workerAcceptanceUtil.createWorkerManagementClient(peerID);

    req_006_Util.workForPeerOnIdleWorkerLoggedPeer(
        component, wmc, peerID.getPublicKey(), remotePeerID.getPublicKey());

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

    remoteBrokerID =
        new DeploymentID(
            new ContainerID(
                "brokerUserName", "brokerServer", BrokerConstants.MODULE_NAME, "brokerPublicKey"),
            BrokerConstants.WORKER_CLIENT);

    otherRemoteBrokerID =
        new DeploymentID(
            new ContainerID(
                "brokerUserName2", "brokerServer", BrokerConstants.MODULE_NAME, "brokerPublicKey2"),
            BrokerConstants.WORKER_CLIENT);

    req_121_Util.workForBrokerOnAllocatedForPeerWorker(
        component, rwmc, remotePeerID.getPublicKey(), remoteBrokerID.getServiceID());

    req_079_Util.startWorkSuccessfully(component, workerAcceptanceUtil.getWorker(), remoteBrokerID);

    prepFuture =
        req_121_Util.workForBrokerOnWorkingWorkerAndDiffPubKey(
            component, rwmc, remotePeerID.getPublicKey(), otherRemoteBrokerID.getServiceID());
  }
  @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());
  }