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

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