test_class.file: oak-core/src/test/java/org/apache/jackrabbit/oak/query/stats/QueryRecorderTest.java
test_class.identifier: QueryRecorderTest
test_case.body: @Test
      public void simplify() {
          // SQL-2
          // dummy
          assertEquals("SELECT sling:alias FROM nt:base WHERE sling:alias IS NOT NULL", 
                  QueryRecorder.simplify("SELECT sling:alias FROM nt:base WHERE sling:alias IS NOT NULL"));
          // replace strings and paths
          assertEquals("SELECT * FROM [acme] AS s WHERE ISDESCENDANTNODE('x') " + 
                  "AND s.[sling:resourceType] = 'x'", 
                  QueryRecorder.simplify("SELECT * FROM [acme] AS s WHERE ISDESCENDANTNODE([/conf]) " + 
                          "AND s.[sling:resourceType] = 'dam/123'"));
          
          // XPath
          // keep two path segment
          assertEquals("  /jcr:root//element(*,sling:Job)[@status='x'] order by @startTime descending", 
                  QueryRecorder.simplify("  /jcr:root//element(*,sling:Job)[@status='RUNNING'] order by @startTime descending"));
          assertEquals("/jcr:root/content/element(*,sling:Job)[@status='x']", 
                  QueryRecorder.simplify("/jcr:root/content/element(*,sling:Job)[@status='RUNNING']"));
          assertEquals("/jcr:root/content/abc/element(*,sling:Job)[@status='x']", 
                  QueryRecorder.simplify("/jcr:root/content/abc/element(*,sling:Job)[@status='RUNNING']"));
          assertEquals("/jcr:root/content/abc/.../element(*, acme)[@status='x']", 
                  QueryRecorder.simplify("/jcr:root/content/abc/def/element(*, acme)[@status='RUNNING']"));
          assertEquals("/jcr:root/content/abc/.../*[@status='x']", 
                  QueryRecorder.simplify("/jcr:root/content/abc/def/*[@status='RUNNING']"));
          assertEquals("/jcr:root/content/*/jcr:content[@deviceIdentificationMode]", 
                  QueryRecorder.simplify("/jcr:root/content/*/jcr:content[@deviceIdentificationMode]"));
          assertEquals("/jcr:root/(content|var)/b/.../*/jcr:content", 
                  QueryRecorder.simplify("/jcr:root/(content|var)/b/c/*/jcr:content"));
          
      }
test_case.class_method_signature: QueryRecorderTest.simplify()
test_case.full_signature: @Test public void simplify()
test_case.identifier: simplify
test_case.invocations: assertEquals simplify assertEquals simplify assertEquals simplify assertEquals simplify assertEquals simplify assertEquals simplify assertEquals simplify assertEquals simplify assertEquals simplify
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void simplify()
focal_class.declarator: LOG = LoggerFactory.getLogger(QueryRecorder.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOG = LoggerFactory.getLogger(QueryRecorder.class);
focal_class.type: Logger
focal_class.var_name: LOG
focal_class.declarator: RECORD_QUERIES_MAP = new HashMap<String, Integer>()
focal_class.modifier: private static final
focal_class.original_string: private static final HashMap<String, Integer> RECORD_QUERIES_MAP = new HashMap<String, Integer>();
focal_class.type: HashMap<String, Integer>
focal_class.var_name: RECORD_QUERIES_MAP
focal_class.declarator: QUERIES_MAX =  Integer.getInteger("oak.query.record", 5000)
focal_class.modifier: private final static
focal_class.original_string: private final static int QUERIES_MAX =  Integer.getInteger("oak.query.record", 5000);
focal_class.type: int
focal_class.var_name: QUERIES_MAX
focal_class.file: oak-core/src/main/java/org/apache/jackrabbit/oak/query/stats/QueryRecorder.java
focal_class.identifier: QueryRecorder
focal_class.class_method_signature: QueryRecorder.main(String... args)
focal_class.full_signature: public static void main(String... args)
focal_class.identifier: main
focal_class.modifiers: public static
focal_class.parameters: (String... args)
focal_class.return: void
focal_class.signature: void main(String... args)
focal_class.class_method_signature: QueryRecorder.record(String query, boolean internal)
focal_class.full_signature: public static void record(String query, boolean internal)
focal_class.identifier: record
focal_class.modifiers: public static
focal_class.parameters: (String query, boolean internal)
focal_class.return: void
focal_class.signature: void record(String query, boolean internal)
focal_class.class_method_signature: QueryRecorder.simplify(String query)
focal_class.full_signature: public static String simplify(String query)
focal_class.identifier: simplify
focal_class.modifiers: public static
focal_class.parameters: (String query)
focal_class.return: String
focal_class.signature: String simplify(String query)
focal_class.class_method_signature: QueryRecorder.getFirstOccurance(String text, int start, String... strings)
focal_class.full_signature: static int getFirstOccurance(String text, int start, String... strings)
focal_class.identifier: getFirstOccurance
focal_class.modifiers: static
focal_class.parameters: (String text, int start, String... strings)
focal_class.return: int
focal_class.signature: int getFirstOccurance(String text, int start, String... strings)
focal_class.class_method_signature: QueryRecorder.record(String query)
focal_class.full_signature: private static void record(String query)
focal_class.identifier: record
focal_class.modifiers: private static
focal_class.parameters: (String query)
focal_class.return: void
focal_class.signature: void record(String query)
focal_class.class_method_signature: QueryRecorder.log(String query, int count)
focal_class.full_signature: private static void log(String query, int count)
focal_class.identifier: log
focal_class.modifiers: private static
focal_class.parameters: (String query, int count)
focal_class.return: void
focal_class.signature: void log(String query, int count)
focal_method.body: public static String simplify(String query) {
          query = query.replaceAll("'[^']*'", "'x'");
          query = query.replaceAll("ISDESCENDANTNODE\\(\\[/[^]]*\\]\\)", "ISDESCENDANTNODE('x')");
          int pathIndex = query.indexOf("/jcr:root/");
          if (pathIndex >= 0) {
              int start = pathIndex + "/jcr:root/".length();
              int end = getFirstOccurance(query, start,
                      " ", "/element(", "/text(", "/*", "/(", "/jcr:deref(");
              String path = query.substring(start, end);
              int first = path.indexOf('/');
              if (first > 0) {
                  first = path.indexOf('/', first + 1);
                  if (first > 0) {
                      path = path.substring(0, first + 1) + "...";
                  }
              }
              String newQuery = query.substring(0, pathIndex) + "/jcr:root/" + path + query.substring(end, query.length());
              query = newQuery;
          }
          return query;
      }
focal_method.class_method_signature: QueryRecorder.simplify(String query)
focal_method.full_signature: public static String simplify(String query)
focal_method.identifier: simplify
focal_method.invocations: replaceAll replaceAll indexOf length getFirstOccurance substring indexOf indexOf substring substring substring length
focal_method.modifiers: public static
focal_method.parameters: (String query)
focal_method.return: String
focal_method.signature: String simplify(String query)