@Test public void testGetNumberOfRoutersToDeploy() { deployment.routers = new ArrayList<>(); assertEquals(NUMBER_OF_ROUTERS_TO_DEPLOY_IS_NOT_THE_EXPECTED, 1, deployment.getNumberOfRoutersToDeploy()); when(mockNw.isRedundant()).thenReturn(true); assertEquals(NUMBER_OF_ROUTERS_TO_DEPLOY_IS_NOT_THE_EXPECTED, 2, deployment.getNumberOfRoutersToDeploy()); deployment.routers.add(mock(DomainRouterVO.class)); when(mockNw.isRedundant()).thenReturn(false); assertEquals(NUMBER_OF_ROUTERS_TO_DEPLOY_IS_NOT_THE_EXPECTED, 0, deployment.getNumberOfRoutersToDeploy()); when(mockNw.isRedundant()).thenReturn(true); assertEquals(NUMBER_OF_ROUTERS_TO_DEPLOY_IS_NOT_THE_EXPECTED, 1, deployment.getNumberOfRoutersToDeploy()); }
protected int getNumberOfRoutersToDeploy() { if (routers.size() >= LIMIT_NUMBER_OF_ROUTERS) { logger.error("Too many redundant routers!"); } int routersExpected = 1; if (isRedundant()) { routersExpected = 2; } return routersExpected < routers.size() ? 0 : routersExpected - routers.size(); }
RouterDeploymentDefinition { protected int getNumberOfRoutersToDeploy() { if (routers.size() >= LIMIT_NUMBER_OF_ROUTERS) { logger.error("Too many redundant routers!"); } int routersExpected = 1; if (isRedundant()) { routersExpected = 2; } return routersExpected < routers.size() ? 0 : routersExpected - routers.size(); } }
RouterDeploymentDefinition { protected int getNumberOfRoutersToDeploy() { if (routers.size() >= LIMIT_NUMBER_OF_ROUTERS) { logger.error("Too many redundant routers!"); } int routersExpected = 1; if (isRedundant()) { routersExpected = 2; } return routersExpected < routers.size() ? 0 : routersExpected - routers.size(); } protected  RouterDeploymentDefinition(final Network guestNetwork, final DeployDestination dest, final Account owner, final Map<Param, Object> params); }
RouterDeploymentDefinition { protected int getNumberOfRoutersToDeploy() { if (routers.size() >= LIMIT_NUMBER_OF_ROUTERS) { logger.error("Too many redundant routers!"); } int routersExpected = 1; if (isRedundant()) { routersExpected = 2; } return routersExpected < routers.size() ? 0 : routersExpected - routers.size(); } protected  RouterDeploymentDefinition(final Network guestNetwork, final DeployDestination dest, final Account owner, final Map<Param, Object> params); Long getServiceOfferingId(); Long getSecondaryServiceOfferingId(); Vpc getVpc(); Network getGuestNetwork(); DeployDestination getDest(); Account getOwner(); Map<Param, Object> getParams(); boolean isRedundant(); DeploymentPlan getPlan(); boolean isVpcRouter(); Pod getPod(); Long getPodId(); List<DomainRouterVO> getRouters(); VirtualRouterProvider getVirtualProvider(); boolean isBasic(); boolean isPublicNetwork(); PublicIp getSourceNatIP(); boolean needsPublicNic(); boolean hasSourceNatService(); boolean hasGatewayService(); List<DomainRouterVO> deployVirtualRouter(); }
RouterDeploymentDefinition { protected int getNumberOfRoutersToDeploy() { if (routers.size() >= LIMIT_NUMBER_OF_ROUTERS) { logger.error("Too many redundant routers!"); } int routersExpected = 1; if (isRedundant()) { routersExpected = 2; } return routersExpected < routers.size() ? 0 : routersExpected - routers.size(); } protected  RouterDeploymentDefinition(final Network guestNetwork, final DeployDestination dest, final Account owner, final Map<Param, Object> params); Long getServiceOfferingId(); Long getSecondaryServiceOfferingId(); Vpc getVpc(); Network getGuestNetwork(); DeployDestination getDest(); Account getOwner(); Map<Param, Object> getParams(); boolean isRedundant(); DeploymentPlan getPlan(); boolean isVpcRouter(); Pod getPod(); Long getPodId(); List<DomainRouterVO> getRouters(); VirtualRouterProvider getVirtualProvider(); boolean isBasic(); boolean isPublicNetwork(); PublicIp getSourceNatIP(); boolean needsPublicNic(); boolean hasSourceNatService(); boolean hasGatewayService(); List<DomainRouterVO> deployVirtualRouter();  }