* ============LICENSE_START=======================================================
* ONAP Policy API
* ================================================================================
- * Copyright (C) 2022 Nordix Foundation. All rights reserved.
+ * Copyright (C) 2022-2023 Nordix Foundation. 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 org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.policy.api.main.PolicyApiApplication;
-import org.onap.policy.api.main.rest.provider.NodeTemplateProvider;
import org.onap.policy.api.main.rest.utils.CommonTestRestController;
+import org.onap.policy.api.main.service.ToscaServiceTemplateService;
import org.onap.policy.common.utils.security.SelfSignedKeyStore;
-import org.onap.policy.models.base.PfModelException;
-import org.onap.policy.models.base.PfModelRuntimeException;
import org.onap.policy.models.errors.concepts.ErrorResponse;
import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.boot.web.server.LocalServerPort;
+import org.springframework.boot.test.web.server.LocalServerPort;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.DynamicPropertyRegistry;
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = PolicyApiApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
-@ActiveProfiles("test")
+@ActiveProfiles({ "test", "default" })
@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_CLASS)
public class TestNodeTemplateController extends CommonTestRestController {
private int apiPort;
@Autowired
- private NodeTemplateProvider provider;
+ private ToscaServiceTemplateService toscaServiceTemplateService;
/**
* Initializes parameters and set up test environment.
public void clearDb() {
for (String name : nodeTemplateKeys) {
try {
- provider.deleteToscaNodeTemplate(name, "1.0.0");
- } catch (PfModelException | PfModelRuntimeException e) {
+ toscaServiceTemplateService.deleteToscaNodeTemplate(name, "1.0.0");
+ } catch (Exception e) {
//do nothing
}
}