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());
}
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());
}
Aggregations