2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
20 package org.openecomp.policy.controlloop.compiler;
22 import static org.junit.Assert.fail;
25 import java.io.FileInputStream;
26 import java.io.FileNotFoundException;
27 import java.io.IOException;
28 import java.io.InputStream;
30 import org.junit.Test;
31 import org.openecomp.policy.controlloop.guard.compiler.ControlLoopGuardCompiler;
33 public class ControlLoopGuardCompilerTest {
36 public void testTest1() {
38 this.test("src/test/resources/v2.0.0-guard/policy_guard_OpenECOMP_demo_vDNS.yaml");
39 } catch (Exception e) {
45 public void testTest2() {
47 this.test("src/test/resources/v2.0.0-guard/policy_guard_1707_appc.yaml");
48 } catch (Exception e) {
54 public void testBad1() {
56 this.test("src/test/resources/v2.0.0-guard/no_guard_policy.yaml");
57 } catch (Exception e) {
63 public void testBad2() {
65 this.test("src/test/resources/v2.0.0-guard/duplicate_guard_policy.yaml");
66 } catch (Exception e) {
72 public void testBad3() {
74 this.test("src/test/resources/v2.0.0-guard/no_guard_constraint.yaml");
75 } catch (Exception e) {
81 public void testBad4() {
83 this.test("src/test/resources/v2.0.0-guard/duplicate_guard_constraint.yaml");
84 } catch (Exception e) {
89 public void test(String testFile) throws Exception {
90 try (InputStream is = new FileInputStream(new File(testFile))) {
91 ControlLoopGuardCompiler.compile(is, null);
92 } catch (FileNotFoundException e) {
94 } catch (IOException e) {
96 } catch (Exception e) {