2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 ONAP
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.ccsdk.sli.core.sli;
23 import java.io.BufferedReader;
24 import java.io.InputStream;
25 import java.io.InputStreamReader;
27 import org.onap.ccsdk.sli.core.sli.SvcLogicExprListener;
28 import org.onap.ccsdk.sli.core.sli.SvcLogicExpression;
29 import org.onap.ccsdk.sli.core.sli.SvcLogicExpressionFactory;
30 import org.slf4j.Logger;
31 import org.slf4j.LoggerFactory;
33 import junit.framework.TestCase;
35 public class SvcLogicExpressionParserTest extends TestCase {
37 private static final Logger LOG = LoggerFactory
38 .getLogger(SvcLogicExprListener.class);
40 public void testParse() {
43 InputStream testStr = getClass().getResourceAsStream("/expression.tests");
44 BufferedReader testsReader = new BufferedReader(new InputStreamReader(testStr));
46 String testExpr = null;
47 while ((testExpr = testsReader.readLine()) != null) {
49 SvcLogicExpression parsedExpr = SvcLogicExpressionFactory.parse(testExpr);
50 if (parsedExpr == null)
52 fail("parse("+testExpr+") returned null");
56 LOG.info("test expression = ["+testExpr+"] ; parsed expression = ["+parsedExpr.asParsedExpr()+"]");
64 fail("Caught exception processing test cases");