Class SqlJsonFunctionsTest


  • public class SqlJsonFunctionsTest
    extends java.lang.Object
    Unit test for the methods in SqlFunctions that implement JSON processing functions.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private void assertDejsonize​(java.lang.String input, org.hamcrest.Matcher<java.lang.Object> matcher)  
      private void assertDejsonizeFailed​(java.lang.String input, org.hamcrest.Matcher<? super java.lang.Throwable> matcher)  
      private void assertFailed​(java.lang.String invocationDesc, java.util.function.Supplier<?> supplier, org.hamcrest.Matcher<? super java.lang.Throwable> matcher)  
      private void assertIsJsonArray​(java.lang.String input, org.hamcrest.Matcher<? super java.lang.Boolean> matcher)  
      private void assertIsJsonObject​(java.lang.String input, org.hamcrest.Matcher<? super java.lang.Boolean> matcher)  
      private void assertIsJsonScalar​(java.lang.String input, org.hamcrest.Matcher<? super java.lang.Boolean> matcher)  
      private void assertIsJsonValue​(java.lang.String input, org.hamcrest.Matcher<? super java.lang.Boolean> matcher)  
      private void assertJsonApiCommonSyntax​(java.lang.String input, java.lang.String pathSpec, org.hamcrest.Matcher<? super org.apache.calcite.runtime.JsonFunctions.JsonPathContext> matcher)  
      private void assertJsonApiCommonSyntax​(org.apache.calcite.runtime.JsonFunctions.JsonValueContext input, java.lang.String pathSpec, org.hamcrest.Matcher<? super org.apache.calcite.runtime.JsonFunctions.JsonPathContext> matcher)  
      private void assertJsonArray​(org.hamcrest.Matcher<? super java.lang.String> matcher, org.apache.calcite.sql.SqlJsonConstructorNullClause nullClause, java.lang.Object... elements)  
      private void assertJsonArrayAggAdd​(java.util.List list, java.lang.Object element, org.apache.calcite.sql.SqlJsonConstructorNullClause nullClause, org.hamcrest.Matcher<? super java.util.List> matcher)  
      private void assertJsonDepth​(org.hamcrest.Matcher<? super java.lang.Integer> matcher, java.lang.String input)  
      private void assertJsonExists​(org.apache.calcite.runtime.JsonFunctions.JsonPathContext context, org.apache.calcite.sql.SqlJsonExistsErrorBehavior errorBehavior, org.hamcrest.Matcher<? super java.lang.Boolean> matcher)  
      private void assertJsonExistsFailed​(org.apache.calcite.runtime.JsonFunctions.JsonPathContext context, org.apache.calcite.sql.SqlJsonExistsErrorBehavior errorBehavior, org.hamcrest.Matcher<? super java.lang.Throwable> matcher)  
      private void assertJsonize​(java.lang.Object input, org.hamcrest.Matcher<? super java.lang.String> matcher)  
      private void assertJsonKeys​(org.apache.calcite.runtime.JsonFunctions.JsonPathContext input, org.hamcrest.Matcher<? super java.lang.String> matcher)  
      private void assertJsonKeysFailed​(org.apache.calcite.runtime.JsonFunctions.JsonValueContext input, org.hamcrest.Matcher<? super java.lang.Throwable> matcher)  
      private void assertJsonLength​(org.apache.calcite.runtime.JsonFunctions.JsonPathContext input, org.hamcrest.Matcher<? super java.lang.Integer> matcher)  
      private void assertJsonLengthFailed​(org.apache.calcite.runtime.JsonFunctions.JsonValueContext input, org.hamcrest.Matcher<? super java.lang.Throwable> matcher)  
      private void assertJsonObject​(org.hamcrest.Matcher<? super java.lang.String> matcher, org.apache.calcite.sql.SqlJsonConstructorNullClause nullClause, java.lang.Object... kvs)  
      private void assertJsonObjectAggAdd​(java.util.Map map, java.lang.String k, java.lang.Object v, org.apache.calcite.sql.SqlJsonConstructorNullClause nullClause, org.hamcrest.Matcher<? super java.util.Map> matcher)  
      void assertJsonPretty()  
      private void assertJsonPretty​(org.apache.calcite.runtime.JsonFunctions.JsonValueContext input, org.hamcrest.Matcher<? super java.lang.String> matcher)  
      private void assertJsonPrettyFailed​(org.apache.calcite.runtime.JsonFunctions.JsonValueContext input, org.hamcrest.Matcher<? super java.lang.Throwable> matcher)  
      private void assertJsonQuery​(org.apache.calcite.runtime.JsonFunctions.JsonPathContext input, org.apache.calcite.sql.SqlJsonQueryWrapperBehavior wrapperBehavior, org.apache.calcite.sql.SqlJsonQueryEmptyOrErrorBehavior emptyBehavior, org.apache.calcite.sql.SqlJsonQueryEmptyOrErrorBehavior errorBehavior, org.hamcrest.Matcher<? super java.lang.String> matcher)  
      private void assertJsonQueryFailed​(org.apache.calcite.runtime.JsonFunctions.JsonPathContext input, org.apache.calcite.sql.SqlJsonQueryWrapperBehavior wrapperBehavior, org.apache.calcite.sql.SqlJsonQueryEmptyOrErrorBehavior emptyBehavior, org.apache.calcite.sql.SqlJsonQueryEmptyOrErrorBehavior errorBehavior, org.hamcrest.Matcher<? super java.lang.Throwable> matcher)  
      private void assertJsonRemove​(org.apache.calcite.runtime.JsonFunctions.JsonValueContext input, java.lang.String[] pathSpecs, org.hamcrest.Matcher<? super java.lang.String> matcher)  
      private void assertJsonStorageSize​(java.lang.String input, org.hamcrest.Matcher<? super java.lang.Integer> matcher)  
      private void assertJsonStorageSize​(org.apache.calcite.runtime.JsonFunctions.JsonValueContext input, org.hamcrest.Matcher<? super java.lang.Integer> matcher)  
      private void assertJsonStorageSizeFailed​(java.lang.String input, org.hamcrest.Matcher<? super java.lang.Throwable> matcher)  
      private void assertJsonType​(org.hamcrest.Matcher<? super java.lang.String> matcher, java.lang.String input)  
      private void assertJsonValueAny​(org.apache.calcite.runtime.JsonFunctions.JsonPathContext context, org.apache.calcite.sql.SqlJsonValueEmptyOrErrorBehavior emptyBehavior, java.lang.Object defaultValueOnEmpty, org.apache.calcite.sql.SqlJsonValueEmptyOrErrorBehavior errorBehavior, java.lang.Object defaultValueOnError, org.hamcrest.Matcher<java.lang.Object> matcher)  
      private void assertJsonValueAnyFailed​(org.apache.calcite.runtime.JsonFunctions.JsonPathContext input, org.apache.calcite.sql.SqlJsonValueEmptyOrErrorBehavior emptyBehavior, java.lang.Object defaultValueOnEmpty, org.apache.calcite.sql.SqlJsonValueEmptyOrErrorBehavior errorBehavior, java.lang.Object defaultValueOnError, org.hamcrest.Matcher<? super java.lang.Throwable> matcher)  
      private void assertJsonValueExpression​(java.lang.String input, org.hamcrest.Matcher<? super org.apache.calcite.runtime.JsonFunctions.JsonValueContext> matcher)  
      private org.hamcrest.BaseMatcher<org.apache.calcite.runtime.JsonFunctions.JsonPathContext> contextMatches​(org.apache.calcite.runtime.JsonFunctions.JsonPathContext expected)  
      private org.hamcrest.Matcher<? super java.lang.Throwable> errorMatches​(java.lang.Throwable expected)  
      private java.lang.String invocationDesc​(java.lang.String methodName, java.lang.Object... args)  
      void testDejsonize()  
      void testJsonApiCommonSyntax()  
      void testJsonArray()  
      void testJsonArrayAggAdd()  
      void testJsonDepth()  
      void testJsonExists()  
      void testJsonize()  
      void testJsonKeys()  
      void testJsonLength()  
      void testJsonObject()  
      void testJsonObjectAggAdd()  
      void testJsonPredicate()  
      void testJsonQuery()  
      void testJsonRemove()  
      void testJsonStorageSize()  
      void testJsonType()  
      void testJsonValueAny()  
      void testJsonValueExpression()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SqlJsonFunctionsTest

        public SqlJsonFunctionsTest()
    • Method Detail

      • testJsonValueExpression

        public void testJsonValueExpression()
      • testJsonApiCommonSyntax

        public void testJsonApiCommonSyntax()
      • testJsonExists

        public void testJsonExists()
      • testJsonValueAny

        public void testJsonValueAny()
      • testJsonQuery

        public void testJsonQuery()
      • testJsonize

        public void testJsonize()
      • assertJsonPretty

        public void assertJsonPretty()
      • testDejsonize

        public void testDejsonize()
      • testJsonObject

        public void testJsonObject()
      • testJsonType

        public void testJsonType()
      • testJsonDepth

        public void testJsonDepth()
      • testJsonLength

        public void testJsonLength()
      • testJsonKeys

        public void testJsonKeys()
      • testJsonRemove

        public void testJsonRemove()
      • testJsonStorageSize

        public void testJsonStorageSize()
      • testJsonObjectAggAdd

        public void testJsonObjectAggAdd()
      • testJsonArray

        public void testJsonArray()
      • testJsonArrayAggAdd

        public void testJsonArrayAggAdd()
      • testJsonPredicate

        public void testJsonPredicate()
      • assertJsonValueExpression

        private void assertJsonValueExpression​(java.lang.String input,
                                               org.hamcrest.Matcher<? super org.apache.calcite.runtime.JsonFunctions.JsonValueContext> matcher)
      • assertJsonApiCommonSyntax

        private void assertJsonApiCommonSyntax​(java.lang.String input,
                                               java.lang.String pathSpec,
                                               org.hamcrest.Matcher<? super org.apache.calcite.runtime.JsonFunctions.JsonPathContext> matcher)
      • assertJsonApiCommonSyntax

        private void assertJsonApiCommonSyntax​(org.apache.calcite.runtime.JsonFunctions.JsonValueContext input,
                                               java.lang.String pathSpec,
                                               org.hamcrest.Matcher<? super org.apache.calcite.runtime.JsonFunctions.JsonPathContext> matcher)
      • assertJsonExists

        private void assertJsonExists​(org.apache.calcite.runtime.JsonFunctions.JsonPathContext context,
                                      org.apache.calcite.sql.SqlJsonExistsErrorBehavior errorBehavior,
                                      org.hamcrest.Matcher<? super java.lang.Boolean> matcher)
      • assertJsonExistsFailed

        private void assertJsonExistsFailed​(org.apache.calcite.runtime.JsonFunctions.JsonPathContext context,
                                            org.apache.calcite.sql.SqlJsonExistsErrorBehavior errorBehavior,
                                            org.hamcrest.Matcher<? super java.lang.Throwable> matcher)
      • assertJsonValueAny

        private void assertJsonValueAny​(org.apache.calcite.runtime.JsonFunctions.JsonPathContext context,
                                        org.apache.calcite.sql.SqlJsonValueEmptyOrErrorBehavior emptyBehavior,
                                        java.lang.Object defaultValueOnEmpty,
                                        org.apache.calcite.sql.SqlJsonValueEmptyOrErrorBehavior errorBehavior,
                                        java.lang.Object defaultValueOnError,
                                        org.hamcrest.Matcher<java.lang.Object> matcher)
      • assertJsonValueAnyFailed

        private void assertJsonValueAnyFailed​(org.apache.calcite.runtime.JsonFunctions.JsonPathContext input,
                                              org.apache.calcite.sql.SqlJsonValueEmptyOrErrorBehavior emptyBehavior,
                                              java.lang.Object defaultValueOnEmpty,
                                              org.apache.calcite.sql.SqlJsonValueEmptyOrErrorBehavior errorBehavior,
                                              java.lang.Object defaultValueOnError,
                                              org.hamcrest.Matcher<? super java.lang.Throwable> matcher)
      • assertJsonQuery

        private void assertJsonQuery​(org.apache.calcite.runtime.JsonFunctions.JsonPathContext input,
                                     org.apache.calcite.sql.SqlJsonQueryWrapperBehavior wrapperBehavior,
                                     org.apache.calcite.sql.SqlJsonQueryEmptyOrErrorBehavior emptyBehavior,
                                     org.apache.calcite.sql.SqlJsonQueryEmptyOrErrorBehavior errorBehavior,
                                     org.hamcrest.Matcher<? super java.lang.String> matcher)
      • assertJsonQueryFailed

        private void assertJsonQueryFailed​(org.apache.calcite.runtime.JsonFunctions.JsonPathContext input,
                                           org.apache.calcite.sql.SqlJsonQueryWrapperBehavior wrapperBehavior,
                                           org.apache.calcite.sql.SqlJsonQueryEmptyOrErrorBehavior emptyBehavior,
                                           org.apache.calcite.sql.SqlJsonQueryEmptyOrErrorBehavior errorBehavior,
                                           org.hamcrest.Matcher<? super java.lang.Throwable> matcher)
      • assertJsonize

        private void assertJsonize​(java.lang.Object input,
                                   org.hamcrest.Matcher<? super java.lang.String> matcher)
      • assertJsonPretty

        private void assertJsonPretty​(org.apache.calcite.runtime.JsonFunctions.JsonValueContext input,
                                      org.hamcrest.Matcher<? super java.lang.String> matcher)
      • assertJsonPrettyFailed

        private void assertJsonPrettyFailed​(org.apache.calcite.runtime.JsonFunctions.JsonValueContext input,
                                            org.hamcrest.Matcher<? super java.lang.Throwable> matcher)
      • assertJsonLength

        private void assertJsonLength​(org.apache.calcite.runtime.JsonFunctions.JsonPathContext input,
                                      org.hamcrest.Matcher<? super java.lang.Integer> matcher)
      • assertJsonLengthFailed

        private void assertJsonLengthFailed​(org.apache.calcite.runtime.JsonFunctions.JsonValueContext input,
                                            org.hamcrest.Matcher<? super java.lang.Throwable> matcher)
      • assertJsonKeys

        private void assertJsonKeys​(org.apache.calcite.runtime.JsonFunctions.JsonPathContext input,
                                    org.hamcrest.Matcher<? super java.lang.String> matcher)
      • assertJsonKeysFailed

        private void assertJsonKeysFailed​(org.apache.calcite.runtime.JsonFunctions.JsonValueContext input,
                                          org.hamcrest.Matcher<? super java.lang.Throwable> matcher)
      • assertJsonRemove

        private void assertJsonRemove​(org.apache.calcite.runtime.JsonFunctions.JsonValueContext input,
                                      java.lang.String[] pathSpecs,
                                      org.hamcrest.Matcher<? super java.lang.String> matcher)
      • assertJsonStorageSize

        private void assertJsonStorageSize​(java.lang.String input,
                                           org.hamcrest.Matcher<? super java.lang.Integer> matcher)
      • assertJsonStorageSize

        private void assertJsonStorageSize​(org.apache.calcite.runtime.JsonFunctions.JsonValueContext input,
                                           org.hamcrest.Matcher<? super java.lang.Integer> matcher)
      • assertJsonStorageSizeFailed

        private void assertJsonStorageSizeFailed​(java.lang.String input,
                                                 org.hamcrest.Matcher<? super java.lang.Throwable> matcher)
      • assertDejsonize

        private void assertDejsonize​(java.lang.String input,
                                     org.hamcrest.Matcher<java.lang.Object> matcher)
      • assertDejsonizeFailed

        private void assertDejsonizeFailed​(java.lang.String input,
                                           org.hamcrest.Matcher<? super java.lang.Throwable> matcher)
      • assertJsonObject

        private void assertJsonObject​(org.hamcrest.Matcher<? super java.lang.String> matcher,
                                      org.apache.calcite.sql.SqlJsonConstructorNullClause nullClause,
                                      java.lang.Object... kvs)
      • assertJsonType

        private void assertJsonType​(org.hamcrest.Matcher<? super java.lang.String> matcher,
                                    java.lang.String input)
      • assertJsonDepth

        private void assertJsonDepth​(org.hamcrest.Matcher<? super java.lang.Integer> matcher,
                                     java.lang.String input)
      • assertJsonObjectAggAdd

        private void assertJsonObjectAggAdd​(java.util.Map map,
                                            java.lang.String k,
                                            java.lang.Object v,
                                            org.apache.calcite.sql.SqlJsonConstructorNullClause nullClause,
                                            org.hamcrest.Matcher<? super java.util.Map> matcher)
      • assertJsonArray

        private void assertJsonArray​(org.hamcrest.Matcher<? super java.lang.String> matcher,
                                     org.apache.calcite.sql.SqlJsonConstructorNullClause nullClause,
                                     java.lang.Object... elements)
      • assertJsonArrayAggAdd

        private void assertJsonArrayAggAdd​(java.util.List list,
                                           java.lang.Object element,
                                           org.apache.calcite.sql.SqlJsonConstructorNullClause nullClause,
                                           org.hamcrest.Matcher<? super java.util.List> matcher)
      • assertIsJsonValue

        private void assertIsJsonValue​(java.lang.String input,
                                       org.hamcrest.Matcher<? super java.lang.Boolean> matcher)
      • assertIsJsonScalar

        private void assertIsJsonScalar​(java.lang.String input,
                                        org.hamcrest.Matcher<? super java.lang.Boolean> matcher)
      • assertIsJsonArray

        private void assertIsJsonArray​(java.lang.String input,
                                       org.hamcrest.Matcher<? super java.lang.Boolean> matcher)
      • assertIsJsonObject

        private void assertIsJsonObject​(java.lang.String input,
                                        org.hamcrest.Matcher<? super java.lang.Boolean> matcher)
      • invocationDesc

        private java.lang.String invocationDesc​(java.lang.String methodName,
                                                java.lang.Object... args)
      • assertFailed

        private void assertFailed​(java.lang.String invocationDesc,
                                  java.util.function.Supplier<?> supplier,
                                  org.hamcrest.Matcher<? super java.lang.Throwable> matcher)
      • errorMatches

        private org.hamcrest.Matcher<? super java.lang.Throwable> errorMatches​(java.lang.Throwable expected)
      • contextMatches

        @Nonnull
        private org.hamcrest.BaseMatcher<org.apache.calcite.runtime.JsonFunctions.JsonPathContext> contextMatches​(org.apache.calcite.runtime.JsonFunctions.JsonPathContext expected)