blob: 4ca2b8cc3fc23e360d0ca16f57de39be0f39e15a [file] [log] [blame]
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// ============================
// Test intents and predicates.
// ============================
// Re-usable predicate #1.
fragment=p1
term={id(tok_find_part(token(), "alias")) == 2}
term={meta_frag('a') && has_any(get(meta_frag('b'), 'Москва'), list(1, 2))}
term(userDefined)=/org.apache.MyShit#myMethod/
// Intent #1.
intent=i1
flow=/org.package#method1/ // User-code flow predicate.
fragment(p1, {'a': true, 'b': {'Москва': [1, 2, 3]}}) /* Macro-expansion. */
term~{length("some text") > 0} // Normal term.
term={has_all(list(1, 2, 3, 4, 5), list(3, 5))}
term={if(2==2, "string", list(1, 2, 3))}
// Intent #2.
intent=i2
flow="a[^0-9]b"
meta={'a': 42, 'b': {'Москва': [1, 2, 3]}}
term(t1)={2 == 2 && !(id()) != -25 && meta_model('a') == 42}
term(t2)={
@a = meta_model('a')
@list = list(1, 2, 3, 4)
@a == 42 && has_all(@list, list(3, 2))
}
intent=i3
flow="a[^0-9]b"
term(t1)={
@x = 2
@xx = ((@x * @x) / 2) * 3
@xx == 6 && has(
json(meta_req('user_json_payload')),
list("موسكو\"", 'v1\'v1', "k2", "v2")
)
}