Example #1
0
  def test_04_reTransfer(self):
    kwargs = getKwargsReTransfer()
    removalTask = RemovalTask( **kwargs )
    removalTask.dataLoggingClient = Mock( return_value = Mock(spec = DataLoggingClient ) )
    removalTask.dataLoggingClient().addFileRecord = Mock()
    removalTask.dataLoggingClient().addFileRecord.return_value = { "OK" : True, "Value" : "" }

    removalTask.requestClient = Mock( return_value = Mock(spec=RequestClient) ) 

    removalTask.requestClient().updateRequest = Mock()
    removalTask.requestClient().updateRequest.return_value = { "OK" : True, "Value" : None }

    removalTask.requestClient().getRequestStatus = Mock()
    removalTask.requestClient().getRequestStatus.return_value = { "OK" : True, 
                                                                  "Value" : { "RequestStatus" : "Done", 
                                                                              "SubRequestStatus" : "Done" }}
    removalTask.requestClient().finalizeRequest = Mock()
    removalTask.requestClient().finalizeRequest.return_value = { "OK" : True, "Value" : None }

    removalTask.replicaManager = Mock( return_value = Mock( spec=ReplicaManager) )
    removalTask.replicaManager().onlineRetransfer = Mock()
    removalTask.replicaManager().onlineRetransfer.return_value = { "OK" : True,
                                                                    "Value" : 
                                                                    { "Failed" : {},
                                                                      "Successful" : { "srm://srm-lhcb.gridpp.rl.ac.uk/castor/ads.rl.ac.uk/prod/lhcb/user/c/cibak/11889/11889410/test.zzz" : True } } }
    self.assertEqual( removalTask.__call__(),
                      {'OK': True, 'Value': {'monitor': {'Execute': 1, 'Done': 1}}} )
    del removalTask
Example #2
0
  def test_03_physicalRemoval( self ):
    kwargs = getKwargsPhysicalRemoval()
    removalTask = RemovalTask( **kwargs )
    removalTask.dataLoggingClient = Mock( return_value = Mock(spec = DataLoggingClient ) )
    removalTask.dataLoggingClient().addFileRecord = Mock()
    removalTask.dataLoggingClient().addFileRecord.return_value = { "OK" : True, "Value" : "" }

    removalTask.getProxyForLFN = Mock( return_value = { "OK" : True, "Value" : None} )

    removalTask.requestClient = Mock( return_value = Mock(spec=RequestClient) ) 

    removalTask.requestClient().updateRequest = Mock()
    removalTask.requestClient().updateRequest.return_value = { "OK" : True, "Value" : None }

    removalTask.requestClient().getRequestStatus = Mock()
    removalTask.requestClient().getRequestStatus.return_value = { "OK" : True, 
                                                                  "Value" : { "RequestStatus" : "Done", 
                                                                              "SubRequestStatus" : "Done" }}
    removalTask.requestClient().finalizeRequest = Mock()
    removalTask.requestClient().finalizeRequest.return_value = { "OK" : True, "Value" : None }

    removalTask.replicaManager = Mock( return_value = Mock( spec=ReplicaManager) )
    removalTask.replicaManager().removeStorageFile = Mock()
    removalTask.replicaManager().removeStorageFile.return_value = { "OK" : True,
                                                                    "Value" : 
                                                                    { "Failed" : {},
                                                                      "Successful" : { "/lhcb/user/c/cibak/11889/11889410/test.zzz" : True } } }
    self.assertEqual( removalTask.__call__(),
                      {'OK': True, 'Value': {'monitor': {'Done': 1, 'Execute': 1, 'PhysicalRemovalAtt': 1, 'PhysicalRemovalDone': 1}}} )
    del removalTask