2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2018 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.xacml.pdp.std.functions;
23 import static org.junit.Assert.assertEquals;
25 import com.att.research.xacml.api.Identifier;
26 import com.att.research.xacml.api.XACML;
27 import com.att.research.xacml.std.IdentifierImpl;
28 import com.att.research.xacml.std.StdAttributeValue;
29 import com.att.research.xacml.std.datatypes.DataTypes;
30 import com.att.research.xacmlatt.pdp.policy.ExpressionResult;
31 import com.att.research.xacmlatt.pdp.policy.FunctionArgument;
32 import com.att.research.xacmlatt.pdp.policy.FunctionArgumentAttributeValue;
34 import java.util.ArrayList;
35 import java.util.List;
37 import org.junit.Test;
39 public class FunctionDefinitionCustomRegexpMatchTest {
41 public final void testRegexp() {
43 final String testVal = "testVal";
44 final String testId = "function:testId";
45 final IdentifierImpl testFnId = new IdentifierImpl(testId);
46 final Identifier identifier = XACML.ID_DATATYPE_STRING;
47 final StdAttributeValue<String> attValue = new StdAttributeValue<String>(identifier, testVal);
48 final FunctionArgument fArg = new FunctionArgumentAttributeValue(attValue);
49 final List<FunctionArgument> listFa = new ArrayList<FunctionArgument>();
54 final FunctionDefinitionCustomRegexpMatch<String> regexpMatch =
55 new FunctionDefinitionCustomRegexpMatch<String>(testFnId, DataTypes.DT_STRING);
56 final ExpressionResult result = regexpMatch.evaluate(null, listFa);
57 assertEquals(result.getStatus().isOk(), true);