@Test public void createAffinityGroupFromCmdTest() { when(_acctMgr.finalizeOwner((Account) anyObject(), anyString(), anyLong(), anyLong())).thenReturn(acct); when(_groupDao.isNameInUse(anyLong(), anyLong(), eq(AFFINITY_GROUP_NAME))).thenReturn(false); final CreateAffinityGroupCmd mockCreateAffinityGroupCmd = Mockito.mock(CreateAffinityGroupCmd.class); when(mockCreateAffinityGroupCmd.getProjectId()).thenReturn(PROJECT_ID); when(mockCreateAffinityGroupCmd.getAffinityGroupName()).thenReturn(AFFINITY_GROUP_NAME); when(mockCreateAffinityGroupCmd.getAffinityGroupType()).thenReturn("mock"); when(mockCreateAffinityGroupCmd.getDescription()).thenReturn("affinity group one"); final AffinityGroup group = _affinityService.createAffinityGroup(mockCreateAffinityGroupCmd); assertNotNull("Affinity group 'group1' of type 'mock' failed to create ", group); }
@DB @Override @ActionEvent(eventType = EventTypes.EVENT_AFFINITY_GROUP_CREATE, eventDescription = "Creating Affinity Group", create = true) public AffinityGroup createAffinityGroup(final CreateAffinityGroupCmd createAffinityGroupCmd) { return createAffinityGroup(createAffinityGroupCmd.getAccountName(), createAffinityGroupCmd.getProjectId(), createAffinityGroupCmd.getDomainId(), createAffinityGroupCmd .getAffinityGroupName(), createAffinityGroupCmd.getAffinityGroupType(), createAffinityGroupCmd.getDescription()); }
AffinityGroupServiceImpl extends ManagerBase implements AffinityGroupService, Manager, StateListener<State, VirtualMachine.Event, VirtualMachine> { @DB @Override @ActionEvent(eventType = EventTypes.EVENT_AFFINITY_GROUP_CREATE, eventDescription = "Creating Affinity Group", create = true) public AffinityGroup createAffinityGroup(final CreateAffinityGroupCmd createAffinityGroupCmd) { return createAffinityGroup(createAffinityGroupCmd.getAccountName(), createAffinityGroupCmd.getProjectId(), createAffinityGroupCmd.getDomainId(), createAffinityGroupCmd .getAffinityGroupName(), createAffinityGroupCmd.getAffinityGroupType(), createAffinityGroupCmd.getDescription()); } }
AffinityGroupServiceImpl extends ManagerBase implements AffinityGroupService, Manager, StateListener<State, VirtualMachine.Event, VirtualMachine> { @DB @Override @ActionEvent(eventType = EventTypes.EVENT_AFFINITY_GROUP_CREATE, eventDescription = "Creating Affinity Group", create = true) public AffinityGroup createAffinityGroup(final CreateAffinityGroupCmd createAffinityGroupCmd) { return createAffinityGroup(createAffinityGroupCmd.getAccountName(), createAffinityGroupCmd.getProjectId(), createAffinityGroupCmd.getDomainId(), createAffinityGroupCmd .getAffinityGroupName(), createAffinityGroupCmd.getAffinityGroupType(), createAffinityGroupCmd.getDescription()); }  }
AffinityGroupServiceImpl extends ManagerBase implements AffinityGroupService, Manager, StateListener<State, VirtualMachine.Event, VirtualMachine> { @DB @Override @ActionEvent(eventType = EventTypes.EVENT_AFFINITY_GROUP_CREATE, eventDescription = "Creating Affinity Group", create = true) public AffinityGroup createAffinityGroup(final CreateAffinityGroupCmd createAffinityGroupCmd) { return createAffinityGroup(createAffinityGroupCmd.getAccountName(), createAffinityGroupCmd.getProjectId(), createAffinityGroupCmd.getDomainId(), createAffinityGroupCmd .getAffinityGroupName(), createAffinityGroupCmd.getAffinityGroupType(), createAffinityGroupCmd.getDescription()); }  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> { @DB @Override @ActionEvent(eventType = EventTypes.EVENT_AFFINITY_GROUP_CREATE, eventDescription = "Creating Affinity Group", create = true) public AffinityGroup createAffinityGroup(final CreateAffinityGroupCmd createAffinityGroupCmd) { return createAffinityGroup(createAffinityGroupCmd.getAccountName(), createAffinityGroupCmd.getProjectId(), createAffinityGroupCmd.getDomainId(), createAffinityGroupCmd .getAffinityGroupName(), createAffinityGroupCmd.getAffinityGroupType(), createAffinityGroupCmd.getDescription()); }  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; }