Search in sources :

Example 1 with UpdateBcfAttachmentCommand

use of com.cloud.agent.api.UpdateBcfAttachmentCommand in project cloudstack by apache.

the class BigSwitchBcfResourceTest method testUpdateAttachmentException.

@Test
public void testUpdateAttachmentException() throws ConfigurationException, BigSwitchBcfApiException {
    _resource.configure("BigSwitchBcfResource", _parameters);
    doThrow(new BigSwitchBcfApiException()).when(_bigswitchBcfApi).modifyAttachment((String) any(), (String) any(), (AttachmentData) any());
    BcfAnswer ans = (BcfAnswer) _resource.executeRequest(new UpdateBcfAttachmentCommand("networkId", "portId", "tenantId", "portname"));
    assertFalse(ans.getResult());
    verify(_bigswitchBcfApi, times(3)).modifyAttachment((String) any(), (String) any(), (AttachmentData) any());
}
Also used : BcfAnswer(com.cloud.agent.api.BcfAnswer) BigSwitchBcfApiException(com.cloud.network.bigswitch.BigSwitchBcfApiException) UpdateBcfAttachmentCommand(com.cloud.agent.api.UpdateBcfAttachmentCommand) Test(org.junit.Test)

Example 2 with UpdateBcfAttachmentCommand

use of com.cloud.agent.api.UpdateBcfAttachmentCommand in project cloudstack by apache.

the class BigSwitchBcfResourceTest method testUpdateAttachmentRetryOnce.

@Test
public void testUpdateAttachmentRetryOnce() throws ConfigurationException, BigSwitchBcfApiException {
    _resource.configure("BigSwitchBcfResource", _parameters);
    when(_bigswitchBcfApi.modifyAttachment((String) any(), (String) any(), (AttachmentData) any())).thenThrow(new BigSwitchBcfApiException()).thenReturn(UUID.randomUUID().toString());
    BcfAnswer ans = (BcfAnswer) _resource.executeRequest(new UpdateBcfAttachmentCommand("networkId", "portId", "tenantId", "portname"));
    assertTrue(ans.getResult());
}
Also used : BcfAnswer(com.cloud.agent.api.BcfAnswer) BigSwitchBcfApiException(com.cloud.network.bigswitch.BigSwitchBcfApiException) UpdateBcfAttachmentCommand(com.cloud.agent.api.UpdateBcfAttachmentCommand) AttachmentData(com.cloud.network.bigswitch.AttachmentData) Test(org.junit.Test)

Aggregations

BcfAnswer (com.cloud.agent.api.BcfAnswer)2 UpdateBcfAttachmentCommand (com.cloud.agent.api.UpdateBcfAttachmentCommand)2 BigSwitchBcfApiException (com.cloud.network.bigswitch.BigSwitchBcfApiException)2 Test (org.junit.Test)2 AttachmentData (com.cloud.network.bigswitch.AttachmentData)1