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

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