1 package org.onap.clamp.policy.downloader;
3 * ============LICENSE_START=======================================================
5 * ================================================================================
6 * Copyright (C) 2020 AT&T Intellectual Property. All rights
8 * ================================================================================
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 * ============LICENSE_END============================================
21 * ===================================================================
25 import static org.assertj.core.api.Assertions.assertThat;
27 import com.google.gson.JsonSyntaxException;
29 import java.io.IOException;
30 import java.util.List;
32 import javax.transaction.Transactional;
34 import org.junit.Test;
35 import org.junit.runner.RunWith;
36 import org.onap.clamp.clds.Application;
37 import org.onap.clamp.loop.template.PolicyModel;
38 import org.onap.clamp.loop.template.PolicyModelsRepository;
39 import org.springframework.beans.factory.annotation.Autowired;
40 import org.springframework.boot.test.context.SpringBootTest;
41 import org.springframework.test.context.ActiveProfiles;
42 import org.springframework.test.context.junit4.SpringRunner;
44 @RunWith(SpringRunner.class)
45 @SpringBootTest(classes = Application.class)
46 @ActiveProfiles(profiles = "clamp-default,clamp-policy-controller")
47 public class PolicyEngineControllerTestItCase {
50 PolicyEngineController policyController;
53 PolicyModelsRepository policyModelsRepository;
57 public void synchronizeAllPoliciesTest() throws JsonSyntaxException, IOException, InterruptedException {
58 policyController.synchronizeAllPolicies();
59 List<PolicyModel> policyModelsList = policyModelsRepository.findAll();
60 assertThat(policyModelsList.size()).isGreaterThanOrEqualTo(8);
61 assertThat(policyModelsList).contains(new PolicyModel("onap.policies.Monitoring", null, "1.0.0"));
62 assertThat(policyModelsList).contains(new PolicyModel("onap.policies.controlloop.Operational", null, "1.0.0"));