Blame SOURCES/0007-Add-tests-for-reason-message-shortening.patch

23d3c3
From 306de4dcbe3fdc7fc4037e0feda58a0ec1d6efc5 Mon Sep 17 00:00:00 2001
23d3c3
From: Jakub Filak <jfilak@redhat.com>
23d3c3
Date: Sat, 26 Oct 2013 21:01:28 +0200
23d3c3
Subject: [PATCH 07/39] Add tests for reason message shortening
23d3c3
23d3c3
Related to rhbz#1023081
23d3c3
Related to rhbz#1055581
23d3c3
23d3c3
Signed-off-by: Jakub Filak <jfilak@redhat.com>
23d3c3
---
23d3c3
 test/CMakeLists.txt                                | 34 +++++++++
23d3c3
 ...eHavingExtremlyLongAndSenselessMethodNames.java | 83 ++++++++++++++++++++++
23d3c3
 test/outputs/run_cut_exception_namespace.log.in    |  4 ++
23d3c3
 test/outputs/run_cut_method_class.log.in           |  4 ++
23d3c3
 test/outputs/run_cut_method_namespace.log.in       |  4 ++
23d3c3
 test/outputs/run_cut_reason_message.log.in         |  4 ++
23d3c3
 6 files changed, 133 insertions(+)
23d3c3
 create mode 100644 test/com/redhat/abrt/test/UnbelievableLongJavaClassNameHavingExtremlyLongAndSenselessMethodNames.java
23d3c3
 create mode 100644 test/outputs/run_cut_exception_namespace.log.in
23d3c3
 create mode 100644 test/outputs/run_cut_method_class.log.in
23d3c3
 create mode 100644 test/outputs/run_cut_method_namespace.log.in
23d3c3
 create mode 100644 test/outputs/run_cut_reason_message.log.in
23d3c3
23d3c3
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
23d3c3
index c84ebe5..5d3aa0d 100644
23d3c3
--- a/test/CMakeLists.txt
23d3c3
+++ b/test/CMakeLists.txt
23d3c3
@@ -45,6 +45,7 @@ _add_class_target(RemoteTest TEST_JAVA_TARGETS SimpleTest)
23d3c3
 _add_class_target(MultiThreadTest TEST_JAVA_TARGETS SimpleTest)
23d3c3
 _add_class_target(Test TEST_JAVA_TARGETS)
23d3c3
 _add_class_target(com/redhat/abrt/test/Test TEST_JAVA_TARGETS)
23d3c3
+_add_class_target(com/redhat/abrt/test/UnbelievableLongJavaClassNameHavingExtremlyLongAndSenselessMethodNames TEST_JAVA_TARGETS)
23d3c3
 _add_class_target(BadClassTest TEST_JAVA_TARGETS)
23d3c3
 _add_class_target(MissingClass TEST_JAVA_TARGETS)
23d3c3
 _add_class_target(MissingClassTest TEST_JAVA_TARGETS MissingClass)
23d3c3
@@ -200,6 +201,39 @@ _add_test_target(
23d3c3
 )
23d3c3
 #_add_test(run_overriden_eqauls 2)
23d3c3
 
23d3c3
+_add_test_target(
23d3c3
+    run_cut_method_namespace
23d3c3
+    com/redhat/abrt/test/UnbelievableLongJavaClassNameHavingExtremlyLongAndSenselessMethodNames
23d3c3
+    3
23d3c3
+    DEPENDS ${TEST_JAVA_TARGETS}
23d3c3
+)
23d3c3
+_add_test(run_cut_method_namespace 2)
23d3c3
+
23d3c3
+_add_test_target(
23d3c3
+    run_cut_exception_namespace
23d3c3
+    com/redhat/abrt/test/UnbelievableLongJavaClassNameHavingExtremlyLongAndSenselessMethodNames
23d3c3
+    2
23d3c3
+    DEPENDS ${TEST_JAVA_TARGETS}
23d3c3
+)
23d3c3
+_add_test(run_cut_exception_namespace 2)
23d3c3
+
23d3c3
+_add_test_target(
23d3c3
+    run_cut_method_class
23d3c3
+    com/redhat/abrt/test/UnbelievableLongJavaClassNameHavingExtremlyLongAndSenselessMethodNames
23d3c3
+    1
23d3c3
+    DEPENDS ${TEST_JAVA_TARGETS}
23d3c3
+)
23d3c3
+_add_test(run_cut_method_class 2)
23d3c3
+
23d3c3
+_add_test_target(
23d3c3
+    run_cut_reason_message
23d3c3
+    com/redhat/abrt/test/UnbelievableLongJavaClassNameHavingExtremlyLongAndSenselessMethodNames
23d3c3
+    0
23d3c3
+    DEPENDS ${TEST_JAVA_TARGETS}
23d3c3
+)
23d3c3
+_add_test(run_cut_reason_message 2)
23d3c3
+
23d3c3
+
23d3c3
 add_custom_target(
23d3c3
     run_thread_stress
23d3c3
     COMMAND LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/src ${Java_JAVA_EXECUTABLE} -agentlib:${AGENT_NAME}=caught=java.lang.ArrayIndexOutOfBoundsException,output= ThreadStressTest
23d3c3
diff --git a/test/com/redhat/abrt/test/UnbelievableLongJavaClassNameHavingExtremlyLongAndSenselessMethodNames.java b/test/com/redhat/abrt/test/UnbelievableLongJavaClassNameHavingExtremlyLongAndSenselessMethodNames.java
23d3c3
new file mode 100644
23d3c3
index 0000000..4a12322
23d3c3
--- /dev/null
23d3c3
+++ b/test/com/redhat/abrt/test/UnbelievableLongJavaClassNameHavingExtremlyLongAndSenselessMethodNames.java
23d3c3
@@ -0,0 +1,83 @@
23d3c3
+package com.redhat.abrt.test;
23d3c3
+
23d3c3
+
23d3c3
+
23d3c3
+/**
23d3c3
+ * An exception class with very long name for test of message shortening
23d3c3
+ * algorithm.
23d3c3
+ *
23d3c3
+ * @author Jakub Filak <jfilak@redhat.com>
23d3c3
+ */
23d3c3
+class UnbelievableLongJavaClassNameException extends RuntimeException {
23d3c3
+    public UnbelievableLongJavaClassNameException() { super(); }
23d3c3
+    public UnbelievableLongJavaClassNameException(String message) { super(message); }
23d3c3
+    public UnbelievableLongJavaClassNameException(String message, Throwable cause) { super(message, cause); }
23d3c3
+    public UnbelievableLongJavaClassNameException(Throwable cause) { super(cause); }
23d3c3
+}
23d3c3
+
23d3c3
+
23d3c3
+
23d3c3
+/**
23d3c3
+ * A class with very long name, method names and throwing an exception with
23d3c3
+ * very long name for test of message shortening algorithm.
23d3c3
+ *
23d3c3
+ * @author Jakub Filak <jfilak@redhat.com>
23d3c3
+ */
23d3c3
+public class UnbelievableLongJavaClassNameHavingExtremlyLongAndSenselessMethodNames
23d3c3
+{
23d3c3
+    public static void oneTwoThreeFroFiveSixSevenEightNineTenElevenTwelveThirteenSixteenSeventeenEighteenNineteenTwentyTwentyOneTwentyTwooTwentyThreeTwentyFourTwentyFiveTwentySixTwentySevenTwentyEightTwentyNineUpToOneHundredThousand()
23d3c3
+    {
23d3c3
+        throw new UnbelievableLongJavaClassNameException();
23d3c3
+    }
23d3c3
+
23d3c3
+    public static void oneTwoThreeFroFiveSixSevenEightNineTenElevenTwelveThirteenSixteenSeventeenEighteenNineteenTwentyUpToOneHundredThousand()
23d3c3
+    {
23d3c3
+        throw new UnbelievableLongJavaClassNameException();
23d3c3
+    }
23d3c3
+
23d3c3
+    public static void oneTwoThreeFroFiveSixSevenEightNineTenElevenTwelveThirteenSixteenSeventeenUpToOneHundredThousand()
23d3c3
+    {
23d3c3
+        throw new UnbelievableLongJavaClassNameException();
23d3c3
+    }
23d3c3
+
23d3c3
+    public static void oneTwoThreeFroFiveSixSevenEightNineTenElevenTwelveThirteenSixteenUpToOneHundredThousand()
23d3c3
+    {
23d3c3
+        throw new UnbelievableLongJavaClassNameException();
23d3c3
+    }
23d3c3
+
23d3c3
+    /**
23d3c3
+     * Entry point to this shortening test.
23d3c3
+     */
23d3c3
+    public static void main(String args[]) {
23d3c3
+        System.out.println("Long names handling started");
23d3c3
+        if (args.length == 0) {
23d3c3
+            System.out.println("You better pass an argument from [0, 1, 2]");
23d3c3
+            oneTwoThreeFroFiveSixSevenEightNineTenElevenTwelveThirteenSixteenSeventeenEighteenNineteenTwentyUpToOneHundredThousand();
23d3c3
+        }
23d3c3
+        else {
23d3c3
+            switch(args[0]) {
23d3c3
+                case "0":
23d3c3
+                    System.out.println("Last Twenty Nine");
23d3c3
+                    oneTwoThreeFroFiveSixSevenEightNineTenElevenTwelveThirteenSixteenSeventeenEighteenNineteenTwentyTwentyOneTwentyTwooTwentyThreeTwentyFourTwentyFiveTwentySixTwentySevenTwentyEightTwentyNineUpToOneHundredThousand();
23d3c3
+                    break;
23d3c3
+                case "1":
23d3c3
+                    System.out.println("Last Twenty");
23d3c3
+                    oneTwoThreeFroFiveSixSevenEightNineTenElevenTwelveThirteenSixteenSeventeenEighteenNineteenTwentyUpToOneHundredThousand();
23d3c3
+                    break;
23d3c3
+                case "2":
23d3c3
+                    System.out.println("Last Seventeen");
23d3c3
+                    oneTwoThreeFroFiveSixSevenEightNineTenElevenTwelveThirteenSixteenSeventeenUpToOneHundredThousand();
23d3c3
+                    break;
23d3c3
+                case "3":
23d3c3
+                    System.out.println("Last Sixteen");
23d3c3
+                    oneTwoThreeFroFiveSixSevenEightNineTenElevenTwelveThirteenSixteenUpToOneHundredThousand();
23d3c3
+                    break;
23d3c3
+                default:
23d3c3
+                    System.err.println("Argument is not in range [0, 1, 2]: " + args[0]);
23d3c3
+                    System.exit(1);
23d3c3
+            }
23d3c3
+        }
23d3c3
+
23d3c3
+        System.exit(0);
23d3c3
+    }
23d3c3
+}
23d3c3
diff --git a/test/outputs/run_cut_exception_namespace.log.in b/test/outputs/run_cut_exception_namespace.log.in
23d3c3
new file mode 100644
23d3c3
index 0000000..75b54c1
23d3c3
--- /dev/null
23d3c3
+++ b/test/outputs/run_cut_exception_namespace.log.in
23d3c3
@@ -0,0 +1,4 @@
23d3c3
+Uncaught exception UnbelievableLongJavaClassNameException in method UnbelievableLongJavaClassNameHavingExtremlyLongAndSenselessMethodNames.oneTwoThreeFroFiveSixSevenEightNineTenElevenTwelveThirteenSixteenSeventeenUpToOneHundredThousand()
23d3c3
+Exception in thread "main" com.redhat.abrt.test.UnbelievableLongJavaClassNameException
23d3c3
+	at com.redhat.abrt.test.UnbelievableLongJavaClassNameHavingExtremlyLongAndSenselessMethodNames.oneTwoThreeFroFiveSixSevenEightNineTenElevenTwelveThirteenSixteenSeventeenUpToOneHundredThousand(UnbelievableLongJavaClassNameHavingExtremlyLongAndSenselessMethodNames.java:40) [file:@CMAKE_BINARY_DIR@/test/com/redhat/abrt/test/UnbelievableLongJavaClassNameHavingExtremlyLongAndSenselessMethodNames.class]
23d3c3
+	at com.redhat.abrt.test.UnbelievableLongJavaClassNameHavingExtremlyLongAndSenselessMethodNames.main(UnbelievableLongJavaClassNameHavingExtremlyLongAndSenselessMethodNames.java:69) [file:@CMAKE_BINARY_DIR@/test/com/redhat/abrt/test/UnbelievableLongJavaClassNameHavingExtremlyLongAndSenselessMethodNames.class]
23d3c3
diff --git a/test/outputs/run_cut_method_class.log.in b/test/outputs/run_cut_method_class.log.in
23d3c3
new file mode 100644
23d3c3
index 0000000..eb464a7
23d3c3
--- /dev/null
23d3c3
+++ b/test/outputs/run_cut_method_class.log.in
23d3c3
@@ -0,0 +1,4 @@
23d3c3
+Uncaught exception UnbelievableLongJavaClassNameException in method oneTwoThreeFroFiveSixSevenEightNineTenElevenTwelveThirteenSixteenSeventeenEighteenNineteenTwentyUpToOneHundredThousand()
23d3c3
+Exception in thread "main" com.redhat.abrt.test.UnbelievableLongJavaClassNameException
23d3c3
+	at com.redhat.abrt.test.UnbelievableLongJavaClassNameHavingExtremlyLongAndSenselessMethodNames.oneTwoThreeFroFiveSixSevenEightNineTenElevenTwelveThirteenSixteenSeventeenEighteenNineteenTwentyUpToOneHundredThousand(UnbelievableLongJavaClassNameHavingExtremlyLongAndSenselessMethodNames.java:35) [file:@CMAKE_BINARY_DIR@/test/com/redhat/abrt/test/UnbelievableLongJavaClassNameHavingExtremlyLongAndSenselessMethodNames.class]
23d3c3
+	at com.redhat.abrt.test.UnbelievableLongJavaClassNameHavingExtremlyLongAndSenselessMethodNames.main(UnbelievableLongJavaClassNameHavingExtremlyLongAndSenselessMethodNames.java:65) [file:@CMAKE_BINARY_DIR@/test/com/redhat/abrt/test/UnbelievableLongJavaClassNameHavingExtremlyLongAndSenselessMethodNames.class]
23d3c3
diff --git a/test/outputs/run_cut_method_namespace.log.in b/test/outputs/run_cut_method_namespace.log.in
23d3c3
new file mode 100644
23d3c3
index 0000000..0ec2438
23d3c3
--- /dev/null
23d3c3
+++ b/test/outputs/run_cut_method_namespace.log.in
23d3c3
@@ -0,0 +1,4 @@
23d3c3
+Uncaught exception com.redhat.abrt.test.UnbelievableLongJavaClassNameException in method UnbelievableLongJavaClassNameHavingExtremlyLongAndSenselessMethodNames.oneTwoThreeFroFiveSixSevenEightNineTenElevenTwelveThirteenSixteenUpToOneHundredThousand()
23d3c3
+Exception in thread "main" com.redhat.abrt.test.UnbelievableLongJavaClassNameException
23d3c3
+	at com.redhat.abrt.test.UnbelievableLongJavaClassNameHavingExtremlyLongAndSenselessMethodNames.oneTwoThreeFroFiveSixSevenEightNineTenElevenTwelveThirteenSixteenUpToOneHundredThousand(UnbelievableLongJavaClassNameHavingExtremlyLongAndSenselessMethodNames.java:45) [file:@CMAKE_BINARY_DIR@/test/com/redhat/abrt/test/UnbelievableLongJavaClassNameHavingExtremlyLongAndSenselessMethodNames.class]
23d3c3
+	at com.redhat.abrt.test.UnbelievableLongJavaClassNameHavingExtremlyLongAndSenselessMethodNames.main(UnbelievableLongJavaClassNameHavingExtremlyLongAndSenselessMethodNames.java:73) [file:@CMAKE_BINARY_DIR@/test/com/redhat/abrt/test/UnbelievableLongJavaClassNameHavingExtremlyLongAndSenselessMethodNames.class]
23d3c3
diff --git a/test/outputs/run_cut_reason_message.log.in b/test/outputs/run_cut_reason_message.log.in
23d3c3
new file mode 100644
23d3c3
index 0000000..5364f65
23d3c3
--- /dev/null
23d3c3
+++ b/test/outputs/run_cut_reason_message.log.in
23d3c3
@@ -0,0 +1,4 @@
23d3c3
+Uncaught exception UnbelievableLongJavaClassNameException in method oneTwoThreeFroFiveSixSevenEightNineTenElevenTwelveThirteenSixteenSeventeenEighteenNineteenTwentyTwentyOneTwentyTwooTwentyThreeTwentyFourTwentyFiveTwentySixTwentySevenTwentyEightTwentyNin
23d3c3
+Exception in thread "main" com.redhat.abrt.test.UnbelievableLongJavaClassNameException
23d3c3
+	at com.redhat.abrt.test.UnbelievableLongJavaClassNameHavingExtremlyLongAndSenselessMethodNames.oneTwoThreeFroFiveSixSevenEightNineTenElevenTwelveThirteenSixteenSeventeenEighteenNineteenTwentyTwentyOneTwentyTwooTwentyThreeTwentyFourTwentyFiveTwentySixTwentySevenTwentyEightTwentyNineUpToOneHundredThousand(UnbelievableLongJavaClassNameHavingExtremlyLongAndSenselessMethodNames.java:30) [file:@CMAKE_BINARY_DIR@/test/com/redhat/abrt/test/UnbelievableLongJavaClassNameHavingExtremlyLongAndSenselessMethodNames.class]
23d3c3
+	at com.redhat.abrt.test.UnbelievableLongJavaClassNameHavingExtremlyLongAndSenselessMethodNames.main(UnbelievableLongJavaClassNameHavingExtremlyLongAndSenselessMethodNames.java:61) [file:@CMAKE_BINARY_DIR@/test/com/redhat/abrt/test/UnbelievableLongJavaClassNameHavingExtremlyLongAndSenselessMethodNames.class]
23d3c3
-- 
23d3c3
1.8.3.1
23d3c3