2 * Copyright © 2016-2018 European Support Limited
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package org.openecomp.sdc.be.nodeFilter;
19 import org.junit.Test;
20 import org.openecomp.sdc.be.impl.ServiceFilterUtils;
21 import org.openecomp.sdc.be.model.InputDefinition;
23 import java.util.Arrays;
26 import static org.junit.Assert.assertFalse;
27 import static org.junit.Assert.assertNotNull;
28 import static org.junit.Assert.assertTrue;
30 public class ServiceFilterUtilsServiceInputTest extends BaseServiceFilterUtilsTest {
32 private static final String CONSTRAINT_NAME = "InputName";
36 public void checkInputStreamIsFound() {
37 Set<String> nodesFiltersToBeDeleted = getNodeFiltersToBeDeleted(CONSTRAINT_NAME);
38 assertNotNull(nodesFiltersToBeDeleted);
39 assertTrue(nodesFiltersToBeDeleted.contains(CI_NAME));
42 private Set<String> getNodeFiltersToBeDeleted(String constraintName) {
43 requirementNodeFilterPropertyDataDefinition
44 .setConstraints(Arrays.asList("mem_size:\n equal: {get_input: " + CONSTRAINT_NAME + "}\n"));
45 InputDefinition inputDefinition = new InputDefinition();
46 inputDefinition.setName(constraintName);
47 return ServiceFilterUtils.getNodesFiltersToBeDeleted(service, inputDefinition);
51 public void checkInputStreamIsNOtFound() {
52 Set<String> nodesFiltersToBeDeleted = getNodeFiltersToBeDeleted(CONSTRAINT_NAME + " aaa bbb");
53 assertNotNull(nodesFiltersToBeDeleted);
54 assertTrue(nodesFiltersToBeDeleted.isEmpty());
55 assertFalse(nodesFiltersToBeDeleted.contains(CI_NAME));