@Test(expected = ConcurrentOperationException.class) public void testLockFails() { when(mockVpcDao.acquireInLockTable(VPC_ID)).thenReturn(null); try { deployment.lock(); } finally { verify(mockVpcDao, times(1)).acquireInLockTable(VPC_ID); assertNull(deployment.tableLockId); } }
@Override protected void lock() { final Vpc vpcLock = vpcDao.acquireInLockTable(vpc.getId()); if (vpcLock == null) { throw new ConcurrentOperationException("Unable to lock vpc " + vpc.getId()); } tableLockId = vpcLock.getId(); }
VpcRouterDeploymentDefinition extends RouterDeploymentDefinition { @Override protected void lock() { final Vpc vpcLock = vpcDao.acquireInLockTable(vpc.getId()); if (vpcLock == null) { throw new ConcurrentOperationException("Unable to lock vpc " + vpc.getId()); } tableLockId = vpcLock.getId(); } }
VpcRouterDeploymentDefinition extends RouterDeploymentDefinition { @Override protected void lock() { final Vpc vpcLock = vpcDao.acquireInLockTable(vpc.getId()); if (vpcLock == null) { throw new ConcurrentOperationException("Unable to lock vpc " + vpc.getId()); } tableLockId = vpcLock.getId(); } protected  VpcRouterDeploymentDefinition(final Network guestNetwork, final Vpc vpc, final DeployDestination dest, final Account owner,
                                            final Map<Param, Object> params); }
VpcRouterDeploymentDefinition extends RouterDeploymentDefinition { @Override protected void lock() { final Vpc vpcLock = vpcDao.acquireInLockTable(vpc.getId()); if (vpcLock == null) { throw new ConcurrentOperationException("Unable to lock vpc " + vpc.getId()); } tableLockId = vpcLock.getId(); } protected  VpcRouterDeploymentDefinition(final Network guestNetwork, final Vpc vpc, final DeployDestination dest, final Account owner,
                                            final Map<Param, Object> params); @Override Vpc getVpc(); @Override boolean isVpcRouter(); @Override boolean needsPublicNic(); @Override boolean hasSourceNatService(); boolean hasGatewayService(); @Override void generateDeploymentPlan(); @Override boolean isRedundant(); }
VpcRouterDeploymentDefinition extends RouterDeploymentDefinition { @Override protected void lock() { final Vpc vpcLock = vpcDao.acquireInLockTable(vpc.getId()); if (vpcLock == null) { throw new ConcurrentOperationException("Unable to lock vpc " + vpc.getId()); } tableLockId = vpcLock.getId(); } protected  VpcRouterDeploymentDefinition(final Network guestNetwork, final Vpc vpc, final DeployDestination dest, final Account owner,
                                            final Map<Param, Object> params); @Override Vpc getVpc(); @Override boolean isVpcRouter(); @Override boolean needsPublicNic(); @Override boolean hasSourceNatService(); boolean hasGatewayService(); @Override void generateDeploymentPlan(); @Override boolean isRedundant();  }