|
| 1 | +/** |
| 2 | + * Copyright (C) 2018 European Spallation Source ERIC. |
| 3 | + * <p> |
| 4 | + * This program is free software; you can redistribute it and/or |
| 5 | + * modify it under the terms of the GNU General Public License |
| 6 | + * as published by the Free Software Foundation; either version 2 |
| 7 | + * of the License, or (at your option) any later version. |
| 8 | + * <p> |
| 9 | + * This program is distributed in the hope that it will be useful, |
| 10 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | + * GNU General Public License for more details. |
| 13 | + * <p> |
| 14 | + * You should have received a copy of the GNU General Public License |
| 15 | + * along with this program; if not, write to the Free Software |
| 16 | + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 17 | + */ |
| 18 | + |
| 19 | +package org.phoebus.service.saveandrestore.filterselection; |
| 20 | + |
| 21 | +import co.elastic.clients.elasticsearch.ElasticsearchClient; |
| 22 | +import com.fasterxml.jackson.databind.ObjectMapper; |
| 23 | +import org.mockito.Mockito; |
| 24 | +import org.phoebus.saveandrestore.util.SnapshotUtil; |
| 25 | +import org.phoebus.service.saveandrestore.persistence.dao.NodeDAO; |
| 26 | +import org.phoebus.service.saveandrestore.persistence.dao.impl.elasticsearch.ConfigurationDataRepository; |
| 27 | +import org.phoebus.service.saveandrestore.persistence.dao.impl.elasticsearch.ElasticsearchTreeRepository; |
| 28 | +import org.phoebus.service.saveandrestore.persistence.dao.impl.elasticsearch.FilterRepository; |
| 29 | +import org.phoebus.service.saveandrestore.persistence.dao.impl.elasticsearch.SnapshotDataRepository; |
| 30 | +import org.phoebus.service.saveandrestore.search.SearchUtil; |
| 31 | +import org.phoebus.service.saveandrestore.web.config.AcceptHeaderResolver; |
| 32 | +import org.phoebus.service.saveandrestore.web.config.WebSecurityConfig; |
| 33 | +import org.phoebus.service.saveandrestore.websocket.WebSocketHandler; |
| 34 | +import org.springframework.beans.factory.annotation.Autowired; |
| 35 | +import org.springframework.boot.SpringBootConfiguration; |
| 36 | +import org.springframework.context.annotation.Bean; |
| 37 | +import org.springframework.context.annotation.ComponentScan; |
| 38 | +import org.springframework.context.annotation.Import; |
| 39 | +import org.springframework.context.annotation.Profile; |
| 40 | +import org.springframework.util.Base64Utils; |
| 41 | +import org.springframework.web.socket.WebSocketSession; |
| 42 | + |
| 43 | +import java.util.List; |
| 44 | +import java.util.concurrent.ExecutorService; |
| 45 | +import java.util.concurrent.Executors; |
| 46 | + |
| 47 | +@SpringBootConfiguration |
| 48 | +@ComponentScan(basePackages = "org.phoebus.service.saveandrestore.filterselection") |
| 49 | +@SuppressWarnings("unused") |
| 50 | +@Profile("!IT") |
| 51 | +public class FilterSelectorTestConfig { |
| 52 | + |
| 53 | + @Bean |
| 54 | + public FilterSelector testFilterSelector(){ |
| 55 | + FilterSelector filterSelector = new FilterSelector() { |
| 56 | + @Override |
| 57 | + public List<String> getSupportedFilterNames() { |
| 58 | + return List.of("a", "b"); |
| 59 | + } |
| 60 | + }; |
| 61 | + return filterSelector; |
| 62 | + } |
| 63 | + |
| 64 | + @Bean |
| 65 | + public WebSocketHandler webSocketHandler(){ |
| 66 | + return Mockito.mock(WebSocketHandler.class); |
| 67 | + } |
| 68 | + |
| 69 | + @Bean |
| 70 | + public ObjectMapper objectMapper(){ |
| 71 | + return new ObjectMapper(); |
| 72 | + } |
| 73 | + |
| 74 | + @Bean |
| 75 | + public NodeDAO nodeDAO(){ |
| 76 | + return Mockito.mock(NodeDAO.class); |
| 77 | + } |
| 78 | +} |
0 commit comments