diff options
Diffstat (limited to 'ECOMP-PDP-REST/src/test/java/org/openecomp/policy/pdp/rest/api/test/getConfigTest.java')
-rw-r--r-- | ECOMP-PDP-REST/src/test/java/org/openecomp/policy/pdp/rest/api/test/getConfigTest.java | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/ECOMP-PDP-REST/src/test/java/org/openecomp/policy/pdp/rest/api/test/getConfigTest.java b/ECOMP-PDP-REST/src/test/java/org/openecomp/policy/pdp/rest/api/test/getConfigTest.java deleted file mode 100644 index ebe86b0d8..000000000 --- a/ECOMP-PDP-REST/src/test/java/org/openecomp/policy/pdp/rest/api/test/getConfigTest.java +++ /dev/null @@ -1,70 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ECOMP-PDP-REST - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package org.openecomp.policy.pdp.rest.api.test; - -import static org.junit.Assert.assertEquals; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.Collection; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -import org.junit.Test; -import org.openecomp.policy.api.ConfigRequestParameters; -import org.openecomp.policy.api.PolicyConfigStatus; -import org.openecomp.policy.pdp.rest.api.models.PolicyConfig; -import org.openecomp.policy.pdp.rest.api.services.GetConfigService; - -public class getConfigTest { - private static final String TEST = "test"; - - @SuppressWarnings("unchecked") - @Test - public void filterMethodTest() throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException{ - ConfigRequestParameters configRequestParameters = new ConfigRequestParameters(); - GetConfigService getConfigService= new GetConfigService(configRequestParameters, null); - Method filter = GetConfigService.class.getDeclaredMethod("filterResults", Collection.class,ConfigRequestParameters.class); - filter.setAccessible(true); - List<PolicyConfig> policyConfigs = new LinkedList<>(); - - List<PolicyConfig> filterResults = (List<PolicyConfig>) filter.invoke(getConfigService, policyConfigs,configRequestParameters); - assertEquals(PolicyConfigStatus.CONFIG_NOT_FOUND, filterResults.get(0).getPolicyConfigStatus()); - // Check again with some values - configRequestParameters.setPolicyName(TEST); - configRequestParameters.setEcompName(TEST); - configRequestParameters.setConfigName(TEST); - Map<String,String> configAttributes = new HashMap<>(); - configAttributes.put(TEST, TEST); - configRequestParameters.setConfigAttributes(configAttributes); - PolicyConfig pConfig = new PolicyConfig(); - pConfig.setPolicyName(TEST); - Map<String,String> matching = new HashMap<>(); - matching.put("ECOMPName", TEST); - matching.put("ConfigName", TEST); - matching.put("TEST", TEST); - pConfig.setMatchingConditions(matching); - policyConfigs.add(pConfig); - filterResults = (List<PolicyConfig>) filter.invoke(getConfigService, policyConfigs,configRequestParameters); - assertEquals(PolicyConfigStatus.CONFIG_NOT_FOUND, filterResults.get(0).getPolicyConfigStatus()); - } -} |