* ============LICENSE_START=======================================================
* Copyright (C) 2020 Nordix Foundation.
* Modifications Copyright (C) 2020-2021 AT&T Corp.
- * Modifications Copyright (C) 2020-2021 Bell Canada. All rights reserved.
+ * Modifications Copyright (C) 2020-2022 Bell Canada. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
-import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.when;
import java.io.File;
import org.onap.policy.models.pdp.concepts.PdpGroup;
import org.onap.policy.models.pdp.concepts.PdpGroups;
import org.onap.policy.models.pdp.enums.PdpHealthStatus;
-import org.onap.policy.models.provider.PolicyModelsProvider;
import org.onap.policy.pap.main.PapConstants;
-import org.onap.policy.pap.main.PolicyModelsProviderFactoryWrapper;
import org.onap.policy.pap.main.parameters.CommonTestData;
import org.onap.policy.pap.main.parameters.PapParameterGroup;
+import org.onap.policy.pap.main.service.PdpGroupService;
import org.onap.policy.pap.main.startstop.PapActivator;
import org.springframework.http.HttpStatus;
import org.springframework.test.util.ReflectionTestUtils;
private static final String HEALTHY = "healthy";
@Mock
- private PolicyModelsProvider dao;
-
- @Mock
- private PolicyModelsProviderFactoryWrapper daofact;
+ private PdpGroupService pdpGroupService;
@Mock
private HttpClientFactory clientFactory;
@Before
public void setUp() throws Exception {
groups = loadPdpGroupsFromFile().getGroups();
- when(dao.getPdpGroups(any())).thenReturn(groups);
+ when(pdpGroupService.getPdpGroups()).thenReturn(groups);
- when(daofact.create()).thenReturn(dao);
Registry.newRegistry();
- Registry.register(PapConstants.REG_PAP_DAO_FACTORY, daofact);
when(papActivator.isAlive()).thenReturn(true);
Registry.register(PapConstants.REG_PAP_ACTIVATOR, papActivator);
clients.add(client2);
clients.add(client3);
PapParameterGroup papParameterGroup = ParameterService.get(PAP_GROUP_PARAMS_NAME);
- provider = new PolicyComponentsHealthCheckProvider();
+ provider = new PolicyComponentsHealthCheckProvider(papParameterGroup, pdpGroupService);
ReflectionTestUtils.setField(provider, "papParameterGroup", papParameterGroup);
provider.initializeClientHealthCheckExecutorService();
ReflectionTestUtils.setField(provider, "clients", clients);