use of com.cloud.legacymodel.communication.answer.CreateLogicalRouterAnswer in project cosmic by MissionCriticalCloud.
the class NiciraNvpResourceTest method testCreateLogicalRouterApiExceptionRollbackRouter.
@Test
public void testCreateLogicalRouterApiExceptionRollbackRouter() throws ConfigurationException, NiciraNvpApiException {
resource.configure("NiciraNvpResource", parameters);
final LogicalRouter lrc = mock(LogicalRouter.class);
when(lrc.getUuid()).thenReturn("ccccc");
when(nvpApi.createLogicalRouter((LogicalRouter) any())).thenReturn(lrc);
when(nvpApi.createLogicalRouterPort(eq("ccccc"), (LogicalRouterPort) any())).thenThrow(new NiciraNvpApiException());
final CreateLogicalRouterCommand clrc = new CreateLogicalRouterCommand("aaaaa", 50, "bbbbb", "lrouter", "publiccidr", "nexthop", "internalcidr", "owner");
final CreateLogicalRouterAnswer clra = (CreateLogicalRouterAnswer) resource.executeRequest(clrc);
assertFalse(clra.getResult());
verify(nvpApi, atLeast(1)).deleteLogicalRouter(eq("ccccc"));
}
Aggregations