use of org.apache.cloudstack.affinity.AffinityGroupService in project cloudstack by apache.
the class IntegrationTestConfiguration method affinityGroupService.
@Bean
public AffinityGroupService affinityGroupService() {
AffinityGroupService mock = Mockito.mock(AffinityGroupService.class);
try {
final AffinityGroupVO gmock = new AffinityGroupVO("grp1", "grp-type", "affinity group", 1, Account.ACCOUNT_ID_SYSTEM, ControlledEntity.ACLType.Account);
Transaction.execute(new TransactionCallbackNoReturn() {
@Override
public void doInTransactionWithoutResult(TransactionStatus status) {
_affinityGroupDao.persist(gmock);
}
});
Mockito.when(mock.createAffinityGroup(Matchers.any(String.class), Matchers.any(Long.class), Matchers.any(Long.class), Matchers.any(String.class), Matchers.any(String.class), Matchers.any(String.class))).thenReturn(gmock);
} catch (Exception e) {
e.printStackTrace();
}
return mock;
}
Aggregations