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

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