@Test(expected = InvalidParameterValueException.class) public void deleteAffinityGroupNullIdName() throws ResourceInUseException { when(_acctMgr.finalizeOwner((Account) anyObject(), anyString(), anyLong(), anyLong())).thenReturn(acct); _affinityService.deleteAffinityGroup(null, ACCOUNT_NAME, null, DOMAIN_ID, null); }
@Override @DB @ActionEvent(eventType = EventTypes.EVENT_AFFINITY_GROUP_DELETE, eventDescription = "Deleting affinity group") public boolean deleteAffinityGroup(final Long affinityGroupId, final String account, final Long projectId, final Long domainId, final String affinityGroupName) { final AffinityGroupVO group = getAffinityGroup(affinityGroupId, account, projectId, domainId, affinityGroupName); final Account caller = CallContext.current().getCallingAccount(); _accountMgr.checkAccess(caller, AccessType.OperateEntry, true, group); final Long affinityGroupIdFinal = group.getId(); deleteAffinityGroup(affinityGroupIdFinal); final Pair<Class<?>, Long> params = new Pair<>(AffinityGroup.class, affinityGroupIdFinal); _messageBus.publish(_name, EntityManager.MESSAGE_REMOVE_ENTITY_EVENT, PublishScope.LOCAL, params); if (s_logger.isDebugEnabled()) { s_logger.debug("Deleted affinity group id=" + affinityGroupIdFinal); } return true; }
AffinityGroupServiceImpl extends ManagerBase implements AffinityGroupService, Manager, StateListener<State, VirtualMachine.Event, VirtualMachine> { @Override @DB @ActionEvent(eventType = EventTypes.EVENT_AFFINITY_GROUP_DELETE, eventDescription = "Deleting affinity group") public boolean deleteAffinityGroup(final Long affinityGroupId, final String account, final Long projectId, final Long domainId, final String affinityGroupName) { final AffinityGroupVO group = getAffinityGroup(affinityGroupId, account, projectId, domainId, affinityGroupName); final Account caller = CallContext.current().getCallingAccount(); _accountMgr.checkAccess(caller, AccessType.OperateEntry, true, group); final Long affinityGroupIdFinal = group.getId(); deleteAffinityGroup(affinityGroupIdFinal); final Pair<Class<?>, Long> params = new Pair<>(AffinityGroup.class, affinityGroupIdFinal); _messageBus.publish(_name, EntityManager.MESSAGE_REMOVE_ENTITY_EVENT, PublishScope.LOCAL, params); if (s_logger.isDebugEnabled()) { s_logger.debug("Deleted affinity group id=" + affinityGroupIdFinal); } return true; } }
AffinityGroupServiceImpl extends ManagerBase implements AffinityGroupService, Manager, StateListener<State, VirtualMachine.Event, VirtualMachine> { @Override @DB @ActionEvent(eventType = EventTypes.EVENT_AFFINITY_GROUP_DELETE, eventDescription = "Deleting affinity group") public boolean deleteAffinityGroup(final Long affinityGroupId, final String account, final Long projectId, final Long domainId, final String affinityGroupName) { final AffinityGroupVO group = getAffinityGroup(affinityGroupId, account, projectId, domainId, affinityGroupName); final Account caller = CallContext.current().getCallingAccount(); _accountMgr.checkAccess(caller, AccessType.OperateEntry, true, group); final Long affinityGroupIdFinal = group.getId(); deleteAffinityGroup(affinityGroupIdFinal); final Pair<Class<?>, Long> params = new Pair<>(AffinityGroup.class, affinityGroupIdFinal); _messageBus.publish(_name, EntityManager.MESSAGE_REMOVE_ENTITY_EVENT, PublishScope.LOCAL, params); if (s_logger.isDebugEnabled()) { s_logger.debug("Deleted affinity group id=" + affinityGroupIdFinal); } return true; }  }
AffinityGroupServiceImpl extends ManagerBase implements AffinityGroupService, Manager, StateListener<State, VirtualMachine.Event, VirtualMachine> { @Override @DB @ActionEvent(eventType = EventTypes.EVENT_AFFINITY_GROUP_DELETE, eventDescription = "Deleting affinity group") public boolean deleteAffinityGroup(final Long affinityGroupId, final String account, final Long projectId, final Long domainId, final String affinityGroupName) { final AffinityGroupVO group = getAffinityGroup(affinityGroupId, account, projectId, domainId, affinityGroupName); final Account caller = CallContext.current().getCallingAccount(); _accountMgr.checkAccess(caller, AccessType.OperateEntry, true, group); final Long affinityGroupIdFinal = group.getId(); deleteAffinityGroup(affinityGroupIdFinal); final Pair<Class<?>, Long> params = new Pair<>(AffinityGroup.class, affinityGroupIdFinal); _messageBus.publish(_name, EntityManager.MESSAGE_REMOVE_ENTITY_EVENT, PublishScope.LOCAL, params); if (s_logger.isDebugEnabled()) { s_logger.debug("Deleted affinity group id=" + affinityGroupIdFinal); } return true; }  List<AffinityGroupProcessor> getAffinityGroupProcessors(); void setAffinityGroupProcessors(final List<AffinityGroupProcessor> affinityProcessors); @Override String getName(); @Override boolean configure(final String name, final Map<String, Object> params); @DB @Override @ActionEvent(eventType = EventTypes.EVENT_AFFINITY_GROUP_CREATE, eventDescription = "Creating Affinity Group", create = true) AffinityGroup createAffinityGroup(final CreateAffinityGroupCmd createAffinityGroupCmd); @Override boolean start(); @Override boolean stop(); @DB @Override AffinityGroup createAffinityGroup(final String accountName, final Long projectId, final Long domainId, final String affinityGroupName, final String affinityGroupType,
                                             final String description); @Override boolean preStateTransitionEvent(final State oldState, final Event event, final State newState, final VirtualMachine vo, final boolean status, final Object opaque); @Override boolean postStateTransitionEvent(final Transition<State, Event> transition, final VirtualMachine vo, final boolean status, final Object opaque); @Override @DB @ActionEvent(eventType = EventTypes.EVENT_AFFINITY_GROUP_DELETE, eventDescription = "Deleting affinity group") boolean deleteAffinityGroup(final Long affinityGroupId, final String account, final Long projectId, final Long domainId, final String affinityGroupName); @Override List<String> listAffinityGroupTypes(); @Override boolean isAdminControlledGroup(final AffinityGroup group); @Override AffinityGroup getAffinityGroup(final Long groupId); @Override UserVm updateVMAffinityGroups(final Long vmId, final List<Long> affinityGroupIds); @Override boolean isAffinityGroupProcessorAvailable(final String affinityGroupType); @Override boolean isAffinityGroupAvailableInDomain(final long affinityGroupId, final long domainId); }
AffinityGroupServiceImpl extends ManagerBase implements AffinityGroupService, Manager, StateListener<State, VirtualMachine.Event, VirtualMachine> { @Override @DB @ActionEvent(eventType = EventTypes.EVENT_AFFINITY_GROUP_DELETE, eventDescription = "Deleting affinity group") public boolean deleteAffinityGroup(final Long affinityGroupId, final String account, final Long projectId, final Long domainId, final String affinityGroupName) { final AffinityGroupVO group = getAffinityGroup(affinityGroupId, account, projectId, domainId, affinityGroupName); final Account caller = CallContext.current().getCallingAccount(); _accountMgr.checkAccess(caller, AccessType.OperateEntry, true, group); final Long affinityGroupIdFinal = group.getId(); deleteAffinityGroup(affinityGroupIdFinal); final Pair<Class<?>, Long> params = new Pair<>(AffinityGroup.class, affinityGroupIdFinal); _messageBus.publish(_name, EntityManager.MESSAGE_REMOVE_ENTITY_EVENT, PublishScope.LOCAL, params); if (s_logger.isDebugEnabled()) { s_logger.debug("Deleted affinity group id=" + affinityGroupIdFinal); } return true; }  List<AffinityGroupProcessor> getAffinityGroupProcessors(); void setAffinityGroupProcessors(final List<AffinityGroupProcessor> affinityProcessors); @Override String getName(); @Override boolean configure(final String name, final Map<String, Object> params); @DB @Override @ActionEvent(eventType = EventTypes.EVENT_AFFINITY_GROUP_CREATE, eventDescription = "Creating Affinity Group", create = true) AffinityGroup createAffinityGroup(final CreateAffinityGroupCmd createAffinityGroupCmd); @Override boolean start(); @Override boolean stop(); @DB @Override AffinityGroup createAffinityGroup(final String accountName, final Long projectId, final Long domainId, final String affinityGroupName, final String affinityGroupType,
                                             final String description); @Override boolean preStateTransitionEvent(final State oldState, final Event event, final State newState, final VirtualMachine vo, final boolean status, final Object opaque); @Override boolean postStateTransitionEvent(final Transition<State, Event> transition, final VirtualMachine vo, final boolean status, final Object opaque); @Override @DB @ActionEvent(eventType = EventTypes.EVENT_AFFINITY_GROUP_DELETE, eventDescription = "Deleting affinity group") boolean deleteAffinityGroup(final Long affinityGroupId, final String account, final Long projectId, final Long domainId, final String affinityGroupName); @Override List<String> listAffinityGroupTypes(); @Override boolean isAdminControlledGroup(final AffinityGroup group); @Override AffinityGroup getAffinityGroup(final Long groupId); @Override UserVm updateVMAffinityGroups(final Long vmId, final List<Long> affinityGroupIds); @Override boolean isAffinityGroupProcessorAvailable(final String affinityGroupType); @Override boolean isAffinityGroupAvailableInDomain(final long affinityGroupId, final long domainId); static final Logger s_logger; }