Search in sources :

Example 1 with CreateAffinityGroupCmd

use of org.apache.cloudstack.api.command.user.affinitygroup.CreateAffinityGroupCmd in project cloudstack by apache.

the class AffinityGroupServiceImplTest method createAffinityGroupFromCmdTest.

@Test
public void createAffinityGroupFromCmdTest() {
    when(_acctMgr.finalizeOwner(any(Account.class), nullable(String.class), anyLong(), nullable(Long.class))).thenReturn(acct);
    when(_groupDao.isNameInUse(anyLong(), anyLong(), eq(AFFINITY_GROUP_NAME))).thenReturn(false);
    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");
    AffinityGroup group = _affinityService.createAffinityGroup(mockCreateAffinityGroupCmd);
    assertNotNull("Affinity group 'group1' of type 'mock' failed to create ", group);
}
Also used : Account(com.cloud.user.Account) Matchers.anyLong(org.mockito.Matchers.anyLong) Matchers.anyString(org.mockito.Matchers.anyString) CreateAffinityGroupCmd(org.apache.cloudstack.api.command.user.affinitygroup.CreateAffinityGroupCmd) Test(org.junit.Test)

Aggregations

Account (com.cloud.user.Account)1 CreateAffinityGroupCmd (org.apache.cloudstack.api.command.user.affinitygroup.CreateAffinityGroupCmd)1 Test (org.junit.Test)1 Matchers.anyLong (org.mockito.Matchers.anyLong)1 Matchers.anyString (org.mockito.Matchers.anyString)1