RouterDeploymentDefinition { protected void lock() { final Network lock = networkDao.acquireInLockTable(guestNetwork.getId(), NetworkOrchestrationService.NetworkLockTimeout.value()); if (lock == null) { throw new ConcurrentOperationException("Unable to lock network " + guestNetwork.getId()); } tableLockId = lock.getId(); } protected  RouterDeploymentDefinition(final Network guestNetwork, final DeployDestination dest,
                                         final Account owner, final Map<Param, Object> params); Long getServiceOfferingId(); 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(); List<DomainRouterVO> deployVirtualRouter();  }
@Test public void testLock() { when(mockNwDao.acquireInLockTable(NW_ID_1, NetworkOrchestrationService.NetworkLockTimeout.value())) .thenReturn(mockNw); deployment.lock(); verify(mockNwDao, times(1)).acquireInLockTable(NW_ID_1, 600); assertNotNull(LOCK_NOT_CORRECTLY_GOT, deployment.tableLockId); assertEquals(LOCK_NOT_CORRECTLY_GOT, NW_ID_1, NW_ID_1, deployment.tableLockId.longValue()); }
@Test(expected = ConcurrentOperationException.class) public void testLockFails() { when(mockNwDao.acquireInLockTable(NW_ID_1, NetworkOrchestrationService.NetworkLockTimeout.value())) .thenReturn(null); try { deployment.lock(); } finally { verify(mockNwDao, times(1)).acquireInLockTable(NW_ID_1, 600); assertNull(deployment.tableLockId); } }