|
| 1 | +// Licensed to the Apache Software Foundation (ASF) under one |
| 2 | +// or more contributor license agreements. See the NOTICE file |
| 3 | +// distributed with this work for additional information |
| 4 | +// regarding copyright ownership. The ASF licenses this file |
| 5 | +// to you under the Apache License, Version 2.0 (the |
| 6 | +// "License"); you may not use this file except in compliance |
| 7 | +// with the License. You may obtain a copy of the License at |
| 8 | +// |
| 9 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +// |
| 11 | +// Unless required by applicable law or agreed to in writing, |
| 12 | +// software distributed under the License is distributed on an |
| 13 | +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 14 | +// KIND, either express or implied. See the License for the |
| 15 | +// specific language governing permissions and limitations |
| 16 | +// under the License. |
| 17 | +package com.cloud.async; |
| 18 | + |
| 19 | +import org.mockito.Mockito; |
| 20 | +import org.springframework.context.annotation.Bean; |
| 21 | +import org.springframework.context.annotation.Configuration; |
| 22 | + |
| 23 | +import com.cloud.api.ApiDispatcher; |
| 24 | +import com.cloud.async.dao.AsyncJobDao; |
| 25 | +import com.cloud.async.dao.AsyncJobDaoImpl; |
| 26 | +import com.cloud.async.dao.SyncQueueDao; |
| 27 | +import com.cloud.async.dao.SyncQueueDaoImpl; |
| 28 | +import com.cloud.async.dao.SyncQueueItemDao; |
| 29 | +import com.cloud.async.dao.SyncQueueItemDaoImpl; |
| 30 | +import com.cloud.cluster.ClusterManager; |
| 31 | +import com.cloud.configuration.ConfigurationManager; |
| 32 | +import com.cloud.configuration.dao.ConfigurationDao; |
| 33 | +import com.cloud.dao.EntityManager; |
| 34 | +import com.cloud.user.AccountManager; |
| 35 | +import com.cloud.user.dao.AccountDao; |
| 36 | + |
| 37 | +@Configuration |
| 38 | +public class AsyncJobTestConfiguration { |
| 39 | + |
| 40 | + @Bean |
| 41 | + public ClusterManager clusterManager() { |
| 42 | + return Mockito.mock(ClusterManager.class); |
| 43 | + } |
| 44 | + |
| 45 | + @Bean |
| 46 | + public AsyncJobDao asyncJobDao() { |
| 47 | + return new AsyncJobDaoImpl(); |
| 48 | + } |
| 49 | + |
| 50 | + @Bean |
| 51 | + public AccountManager accountManager() { |
| 52 | + return Mockito.mock(AccountManager.class); |
| 53 | + } |
| 54 | + |
| 55 | + @Bean |
| 56 | + public ApiDispatcher apiDispatcher() { |
| 57 | + return Mockito.mock(ApiDispatcher.class); |
| 58 | + } |
| 59 | + |
| 60 | + @Bean |
| 61 | + public EntityManager entityManager() { |
| 62 | + return Mockito.mock(EntityManager.class); |
| 63 | + } |
| 64 | + |
| 65 | + @Bean |
| 66 | + public SyncQueueManager syncQueueManager() { |
| 67 | + return new SyncQueueManagerImpl(); |
| 68 | + } |
| 69 | + |
| 70 | + @Bean |
| 71 | + public AccountDao accountDao() { |
| 72 | + return Mockito.mock(AccountDao.class); |
| 73 | + } |
| 74 | + |
| 75 | + @Bean |
| 76 | + public SyncQueueDao syncQueueDao() { |
| 77 | + return new SyncQueueDaoImpl(); |
| 78 | + } |
| 79 | + |
| 80 | + @Bean |
| 81 | + public SyncQueueItemDao syncQueueItemDao() { |
| 82 | + return new SyncQueueItemDaoImpl(); |
| 83 | + } |
| 84 | + |
| 85 | + @Bean |
| 86 | + public ConfigurationDao configurationDao() { |
| 87 | + return Mockito.mock(ConfigurationDao.class); |
| 88 | + } |
| 89 | + |
| 90 | + @Bean |
| 91 | + public ConfigurationManager configurationManager() { |
| 92 | + return Mockito.mock(ConfigurationManager.class); |
| 93 | + } |
| 94 | +} |
0 commit comments