Exemple #1
0
  def test_05_replicateAndRegister( self ):
    """ 'replicateAndRegister' operation """
    kwargs = getKwargs( "replicateAndRegister" )
    tTask = TransferTask( **kwargs )
    tTask.dataLoggingClient = Mock( return_value = Mock(spec = DataLoggingClient ) )
    tTask.dataLoggingClient().addFileRecord = Mock()
    tTask.dataLoggingClient().addFileRecord.return_value = SOK
    tTask.requestClient = Mock( return_value = Mock(spec=RequestClient) ) 
    tTask.requestClient().updateRequest = Mock()
    tTask.requestClient().updateRequest.return_value = SOK
    tTask.requestClient().getRequestStatus = Mock()
    tTask.requestClient().getRequestStatus.return_value = { "OK" : True, 
                                                            "Value" : { "RequestStatus" : "Done", 
                                                                        "SubRequestStatus" : "Done" }}
    tTask.requestClient().finalizeRequest = Mock()
    tTask.requestClient().finalizeRequest.return_value = SOK
    tTask.replicaManager = Mock( return_value = Mock( spec=ReplicaManager) )
    tTask.replicaManager().replicateAndRegister = Mock()
    tTask.replicaManager().replicateAndRegister.return_value = { "OK": True, 
                                                                 "Value": { 
        "Failed": {}, 
        "Successful": { "/lhcb/user/c/cibak/11889/11889410/test.zzz" : { "replicate": 1, "register": 1 } } } }

    self.assertEqual( tTask(),
                      { 'OK': True, 
                        'Value': { 'monitor': 
                                   { 'Replica registration successful': 1, 
                                     'Execute': 1, 
                                     'Done': 1, 
                                     'Replication successful': 1, 
                                     'Replicate and register': 1}}} )
                      
    del tTask
Exemple #2
0
    def test_05_replicateAndRegister(self):
        """ 'replicateAndRegister' operation """
        kwargs = getKwargs("replicateAndRegister")
        tTask = TransferTask(**kwargs)
        tTask.dataLoggingClient = Mock(return_value=Mock(
            spec=DataLoggingClient))
        tTask.dataLoggingClient().addFileRecord = Mock()
        tTask.dataLoggingClient().addFileRecord.return_value = SOK
        tTask.requestClient = Mock(return_value=Mock(spec=RequestClient))
        tTask.requestClient().updateRequest = Mock()
        tTask.requestClient().updateRequest.return_value = SOK
        tTask.requestClient().getRequestStatus = Mock()
        tTask.requestClient().getRequestStatus.return_value = {
            "OK": True,
            "Value": {
                "RequestStatus": "Done",
                "SubRequestStatus": "Done"
            }
        }
        tTask.requestClient().finalizeRequest = Mock()
        tTask.requestClient().finalizeRequest.return_value = SOK
        tTask.replicaManager = Mock(return_value=Mock(spec=ReplicaManager))
        tTask.replicaManager().replicateAndRegister = Mock()
        tTask.replicaManager().replicateAndRegister.return_value = {
            "OK": True,
            "Value": {
                "Failed": {},
                "Successful": {
                    "/lhcb/user/c/cibak/11889/11889410/test.zzz": {
                        "replicate": 1,
                        "register": 1
                    }
                }
            }
        }

        self.assertEqual(
            tTask(), {
                'OK': True,
                'Value': {
                    'monitor': {
                        'Replica registration successful': 1,
                        'Execute': 1,
                        'Done': 1,
                        'Replication successful': 1,
                        'Replicate and register': 1
                    }
                }
            })

        del tTask