2 * ============LICENSE_START=======================================================
3 * policy-yaml unit test
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=========================================================
21 package org.onap.policy.controlloop.compiler;
23 import static org.junit.Assert.*;
26 import java.io.FileInputStream;
27 import java.io.FileNotFoundException;
28 import java.io.IOException;
29 import java.io.InputStream;
31 import org.junit.Test;
33 public class ControlLoopCompilerTest {
36 public void testTest() {
38 this.test("src/test/resources/v1.0.0/test.yaml");
39 } catch (Exception e) {
45 public void testBad1() {
47 this.test("src/test/resources/v1.0.0/bad_trigger_1.yaml");
48 } catch (Exception e) {
53 public void testBad2() {
55 this.test("src/test/resources/v1.0.0/bad_trigger_2.yaml");
56 } catch (Exception e) {
62 public void testBad() {
64 this.test("src/test/resources/v1.0.0/bad_policies_1.yaml");
65 } catch (Exception e) {
69 public void test(String testFile) throws Exception {
70 try (InputStream is = new FileInputStream(new File(testFile))) {
71 ControlLoopCompiler.compile(is, null);
72 } catch (FileNotFoundException e) {
74 } catch (IOException e) {
76 } catch (Exception e) {