application_insights 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +6 -14
- data/.travis.yml +21 -9
- data/CONTRIBUTING.md +30 -0
- data/Gemfile +4 -4
- data/LICENSE.txt +11 -11
- data/README.md +13 -14
- data/Rakefile +14 -14
- data/application_insights.gemspec +28 -29
- data/lib/application_insights.rb +9 -9
- data/lib/application_insights/channel/asynchronous_queue.rb +58 -51
- data/lib/application_insights/channel/asynchronous_sender.rb +132 -123
- data/lib/application_insights/channel/contracts/application.rb +14 -53
- data/lib/application_insights/channel/contracts/cloud.rb +14 -0
- data/lib/application_insights/channel/contracts/data.rb +14 -48
- data/lib/application_insights/channel/contracts/data_point.rb +24 -130
- data/lib/application_insights/channel/contracts/data_point_type.rb +7 -16
- data/lib/application_insights/channel/contracts/dependency_kind.rb +9 -19
- data/lib/application_insights/channel/contracts/dependency_source_type.rb +9 -19
- data/lib/application_insights/channel/contracts/device.rb +28 -257
- data/lib/application_insights/channel/contracts/envelope.rb +40 -266
- data/lib/application_insights/channel/contracts/event_data.rb +28 -77
- data/lib/application_insights/channel/contracts/exception_data.rb +37 -140
- data/lib/application_insights/channel/contracts/exception_details.rb +28 -129
- data/lib/application_insights/channel/contracts/internal.rb +14 -53
- data/lib/application_insights/channel/contracts/json_serializable.rb +59 -59
- data/lib/application_insights/channel/contracts/location.rb +16 -36
- data/lib/application_insights/channel/contracts/message_data.rb +24 -77
- data/lib/application_insights/channel/contracts/metric_data.rb +27 -60
- data/lib/application_insights/channel/contracts/operation.rb +19 -121
- data/lib/application_insights/channel/contracts/page_view_data.rb +30 -111
- data/lib/application_insights/channel/contracts/remote_dependency_data.rb +56 -260
- data/lib/application_insights/channel/contracts/request_data.rb +36 -176
- data/lib/application_insights/channel/contracts/session.rb +15 -70
- data/lib/application_insights/channel/contracts/severity_level.rb +13 -25
- data/lib/application_insights/channel/contracts/stack_frame.rb +17 -94
- data/lib/application_insights/channel/contracts/user.rb +19 -104
- data/lib/application_insights/channel/event.rb +68 -64
- data/lib/application_insights/channel/queue_base.rb +65 -62
- data/lib/application_insights/channel/sender_base.rb +79 -72
- data/lib/application_insights/channel/synchronous_queue.rb +45 -39
- data/lib/application_insights/channel/synchronous_sender.rb +17 -15
- data/lib/application_insights/channel/telemetry_channel.rb +120 -102
- data/lib/application_insights/channel/telemetry_context.rb +85 -68
- data/lib/application_insights/rack/track_request.rb +87 -84
- data/lib/application_insights/telemetry_client.rb +229 -217
- data/lib/application_insights/unhandled_exception.rb +49 -47
- data/lib/application_insights/version.rb +3 -3
- data/test/application_insights.rb +8 -9
- data/test/application_insights/channel/contracts/test_application.rb +44 -44
- data/test/application_insights/channel/contracts/test_cloud.rb +44 -0
- data/test/application_insights/channel/contracts/test_data.rb +44 -44
- data/test/application_insights/channel/contracts/test_data_point.rb +109 -109
- data/test/application_insights/channel/contracts/test_device.rb +200 -200
- data/test/application_insights/channel/contracts/test_envelope.rb +209 -209
- data/test/application_insights/channel/contracts/test_event_data.rb +62 -62
- data/test/application_insights/channel/contracts/test_exception_data.rb +111 -111
- data/test/application_insights/channel/contracts/test_exception_details.rb +106 -106
- data/test/application_insights/channel/contracts/test_internal.rb +44 -44
- data/test/application_insights/channel/contracts/test_location.rb +70 -31
- data/test/application_insights/channel/contracts/test_message_data.rb +66 -66
- data/test/application_insights/channel/contracts/test_metric_data.rb +50 -50
- data/test/application_insights/channel/contracts/test_operation.rb +109 -96
- data/test/application_insights/channel/contracts/test_page_view_data.rb +88 -88
- data/test/application_insights/channel/contracts/test_remote_dependency_data.rb +209 -209
- data/test/application_insights/channel/contracts/test_request_data.rb +153 -153
- data/test/application_insights/channel/contracts/test_session.rb +57 -57
- data/test/application_insights/channel/contracts/test_stack_frame.rb +83 -83
- data/test/application_insights/channel/contracts/test_user.rb +96 -83
- data/test/application_insights/channel/test_asynchronous_queue.rb +47 -47
- data/test/application_insights/channel/test_asynchronous_sender.rb +80 -80
- data/test/application_insights/channel/test_event.rb +52 -52
- data/test/application_insights/channel/test_queue_base.rb +88 -88
- data/test/application_insights/channel/test_sender_base.rb +87 -87
- data/test/application_insights/channel/test_synchronous_queue.rb +27 -27
- data/test/application_insights/channel/test_synchronous_sender.rb +10 -10
- data/test/application_insights/channel/test_telemetry_channel.rb +126 -102
- data/test/application_insights/channel/test_telemetry_context.rb +82 -74
- data/test/application_insights/mock_sender.rb +37 -37
- data/test/application_insights/rack/test_track_request.rb +142 -139
- data/test/application_insights/test_telemetry_client.rb +133 -123
- data/test/application_insights/test_unhandled_exception.rb +23 -24
- metadata +23 -33
@@ -1,62 +1,62 @@
|
|
1
|
-
require_relative '../../../../lib/application_insights/channel/contracts/event_data'
|
2
|
-
require 'test/unit'
|
3
|
-
|
4
|
-
include ApplicationInsights::Channel
|
5
|
-
|
6
|
-
class TestEventData < Test::Unit::TestCase
|
7
|
-
def test_initialize
|
8
|
-
item = Contracts::EventData.new
|
9
|
-
assert_not_nil item
|
10
|
-
end
|
11
|
-
|
12
|
-
def test_ver_works_as_expected
|
13
|
-
expected = 42
|
14
|
-
item = Contracts::EventData.new
|
15
|
-
item.ver = expected
|
16
|
-
actual = item.ver
|
17
|
-
assert_equal expected, actual
|
18
|
-
expected = 13
|
19
|
-
item.ver = expected
|
20
|
-
actual = item.ver
|
21
|
-
assert_equal expected, actual
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_name_works_as_expected
|
25
|
-
expected = 'Test string'
|
26
|
-
item = Contracts::EventData.new
|
27
|
-
item.name = expected
|
28
|
-
actual = item.name
|
29
|
-
assert_equal expected, actual
|
30
|
-
expected = 'Other string'
|
31
|
-
item.name = expected
|
32
|
-
actual = item.name
|
33
|
-
assert_equal expected, actual
|
34
|
-
end
|
35
|
-
|
36
|
-
def test_properties_works_as_expected
|
37
|
-
item = Contracts::EventData.new
|
38
|
-
actual = item.properties
|
39
|
-
assert_not_nil actual
|
40
|
-
end
|
41
|
-
|
42
|
-
def test_measurements_works_as_expected
|
43
|
-
item = Contracts::EventData.new
|
44
|
-
actual = item.measurements
|
45
|
-
assert_not_nil actual
|
46
|
-
end
|
47
|
-
|
48
|
-
def test_to_json_works_as_expected
|
49
|
-
item = Contracts::EventData.new
|
50
|
-
item.ver = 42
|
51
|
-
item.name = 'Test string'
|
52
|
-
{ 'key1' => 'test value 1' , 'key2' => 'test value 2' }.each do |key, value|
|
53
|
-
item.properties[key] = value
|
54
|
-
end
|
55
|
-
{ 'key1' => 3.1415 , 'key2' => 42.2 }.each do |key, value|
|
56
|
-
item.measurements[key] = value
|
57
|
-
end
|
58
|
-
actual = item.to_json
|
59
|
-
expected = '{"ver":42,"name":"Test string","properties":{"key1":"test value 1","key2":"test value 2"},"measurements":{"key1":3.1415,"key2":42.2}}'
|
60
|
-
assert_equal expected, actual
|
61
|
-
end
|
62
|
-
end
|
1
|
+
require_relative '../../../../lib/application_insights/channel/contracts/event_data'
|
2
|
+
require 'test/unit'
|
3
|
+
|
4
|
+
include ApplicationInsights::Channel
|
5
|
+
|
6
|
+
class TestEventData < Test::Unit::TestCase
|
7
|
+
def test_initialize
|
8
|
+
item = Contracts::EventData.new
|
9
|
+
assert_not_nil item
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_ver_works_as_expected
|
13
|
+
expected = 42
|
14
|
+
item = Contracts::EventData.new
|
15
|
+
item.ver = expected
|
16
|
+
actual = item.ver
|
17
|
+
assert_equal expected, actual
|
18
|
+
expected = 13
|
19
|
+
item.ver = expected
|
20
|
+
actual = item.ver
|
21
|
+
assert_equal expected, actual
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_name_works_as_expected
|
25
|
+
expected = 'Test string'
|
26
|
+
item = Contracts::EventData.new
|
27
|
+
item.name = expected
|
28
|
+
actual = item.name
|
29
|
+
assert_equal expected, actual
|
30
|
+
expected = 'Other string'
|
31
|
+
item.name = expected
|
32
|
+
actual = item.name
|
33
|
+
assert_equal expected, actual
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_properties_works_as_expected
|
37
|
+
item = Contracts::EventData.new
|
38
|
+
actual = item.properties
|
39
|
+
assert_not_nil actual
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_measurements_works_as_expected
|
43
|
+
item = Contracts::EventData.new
|
44
|
+
actual = item.measurements
|
45
|
+
assert_not_nil actual
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_to_json_works_as_expected
|
49
|
+
item = Contracts::EventData.new
|
50
|
+
item.ver = 42
|
51
|
+
item.name = 'Test string'
|
52
|
+
{ 'key1' => 'test value 1' , 'key2' => 'test value 2' }.each do |key, value|
|
53
|
+
item.properties[key] = value
|
54
|
+
end
|
55
|
+
{ 'key1' => 3.1415 , 'key2' => 42.2 }.each do |key, value|
|
56
|
+
item.measurements[key] = value
|
57
|
+
end
|
58
|
+
actual = item.to_json
|
59
|
+
expected = '{"ver":42,"name":"Test string","properties":{"key1":"test value 1","key2":"test value 2"},"measurements":{"key1":3.1415,"key2":42.2}}'
|
60
|
+
assert_equal expected, actual
|
61
|
+
end
|
62
|
+
end
|
@@ -1,111 +1,111 @@
|
|
1
|
-
require_relative '../../../../lib/application_insights/channel/contracts/exception_data'
|
2
|
-
require 'test/unit'
|
3
|
-
|
4
|
-
include ApplicationInsights::Channel
|
5
|
-
|
6
|
-
class TestExceptionData < Test::Unit::TestCase
|
7
|
-
def test_initialize
|
8
|
-
item = Contracts::ExceptionData.new
|
9
|
-
assert_not_nil item
|
10
|
-
end
|
11
|
-
|
12
|
-
def test_ver_works_as_expected
|
13
|
-
expected = 42
|
14
|
-
item = Contracts::ExceptionData.new
|
15
|
-
item.ver = expected
|
16
|
-
actual = item.ver
|
17
|
-
assert_equal expected, actual
|
18
|
-
expected = 13
|
19
|
-
item.ver = expected
|
20
|
-
actual = item.ver
|
21
|
-
assert_equal expected, actual
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_handled_at_works_as_expected
|
25
|
-
expected = 'Test string'
|
26
|
-
item = Contracts::ExceptionData.new
|
27
|
-
item.handled_at = expected
|
28
|
-
actual = item.handled_at
|
29
|
-
assert_equal expected, actual
|
30
|
-
expected = 'Other string'
|
31
|
-
item.handled_at = expected
|
32
|
-
actual = item.handled_at
|
33
|
-
assert_equal expected, actual
|
34
|
-
end
|
35
|
-
|
36
|
-
def test_exceptions_works_as_expected
|
37
|
-
item = Contracts::ExceptionData.new
|
38
|
-
actual = item.exceptions
|
39
|
-
assert_not_nil actual
|
40
|
-
end
|
41
|
-
|
42
|
-
def test_severity_level_works_as_expected
|
43
|
-
expected = 5
|
44
|
-
item = Contracts::ExceptionData.new
|
45
|
-
item.severity_level = expected
|
46
|
-
actual = item.severity_level
|
47
|
-
assert_equal expected, actual
|
48
|
-
expected = 3
|
49
|
-
item.severity_level = expected
|
50
|
-
actual = item.severity_level
|
51
|
-
assert_equal expected, actual
|
52
|
-
end
|
53
|
-
|
54
|
-
def test_problem_id_works_as_expected
|
55
|
-
expected = 'Test string'
|
56
|
-
item = Contracts::ExceptionData.new
|
57
|
-
item.problem_id = expected
|
58
|
-
actual = item.problem_id
|
59
|
-
assert_equal expected, actual
|
60
|
-
expected = 'Other string'
|
61
|
-
item.problem_id = expected
|
62
|
-
actual = item.problem_id
|
63
|
-
assert_equal expected, actual
|
64
|
-
end
|
65
|
-
|
66
|
-
def test_crash_thread_id_works_as_expected
|
67
|
-
expected = 42
|
68
|
-
item = Contracts::ExceptionData.new
|
69
|
-
item.crash_thread_id = expected
|
70
|
-
actual = item.crash_thread_id
|
71
|
-
assert_equal expected, actual
|
72
|
-
expected = 13
|
73
|
-
item.crash_thread_id = expected
|
74
|
-
actual = item.crash_thread_id
|
75
|
-
assert_equal expected, actual
|
76
|
-
end
|
77
|
-
|
78
|
-
def test_properties_works_as_expected
|
79
|
-
item = Contracts::ExceptionData.new
|
80
|
-
actual = item.properties
|
81
|
-
assert_not_nil actual
|
82
|
-
end
|
83
|
-
|
84
|
-
def test_measurements_works_as_expected
|
85
|
-
item = Contracts::ExceptionData.new
|
86
|
-
actual = item.measurements
|
87
|
-
assert_not_nil actual
|
88
|
-
end
|
89
|
-
|
90
|
-
def test_to_json_works_as_expected
|
91
|
-
item = Contracts::ExceptionData.new
|
92
|
-
item.ver = 42
|
93
|
-
item.handled_at = 'Test string'
|
94
|
-
[ { 'key' => 'value' } ].each do |value|
|
95
|
-
item.exceptions.push value
|
96
|
-
end
|
97
|
-
|
98
|
-
item.severity_level = 5
|
99
|
-
item.problem_id = 'Test string'
|
100
|
-
item.crash_thread_id = 42
|
101
|
-
{ 'key1' => 'test value 1' , 'key2' => 'test value 2' }.each do |key, value|
|
102
|
-
item.properties[key] = value
|
103
|
-
end
|
104
|
-
{ 'key1' => 3.1415 , 'key2' => 42.2 }.each do |key, value|
|
105
|
-
item.measurements[key] = value
|
106
|
-
end
|
107
|
-
actual = item.to_json
|
108
|
-
expected = '{"ver":42,"handledAt":"Test string","exceptions":[{"key":"value"}],"severityLevel":5,"problemId":"Test string","crashThreadId":42,"properties":{"key1":"test value 1","key2":"test value 2"},"measurements":{"key1":3.1415,"key2":42.2}}'
|
109
|
-
assert_equal expected, actual
|
110
|
-
end
|
111
|
-
end
|
1
|
+
require_relative '../../../../lib/application_insights/channel/contracts/exception_data'
|
2
|
+
require 'test/unit'
|
3
|
+
|
4
|
+
include ApplicationInsights::Channel
|
5
|
+
|
6
|
+
class TestExceptionData < Test::Unit::TestCase
|
7
|
+
def test_initialize
|
8
|
+
item = Contracts::ExceptionData.new
|
9
|
+
assert_not_nil item
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_ver_works_as_expected
|
13
|
+
expected = 42
|
14
|
+
item = Contracts::ExceptionData.new
|
15
|
+
item.ver = expected
|
16
|
+
actual = item.ver
|
17
|
+
assert_equal expected, actual
|
18
|
+
expected = 13
|
19
|
+
item.ver = expected
|
20
|
+
actual = item.ver
|
21
|
+
assert_equal expected, actual
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_handled_at_works_as_expected
|
25
|
+
expected = 'Test string'
|
26
|
+
item = Contracts::ExceptionData.new
|
27
|
+
item.handled_at = expected
|
28
|
+
actual = item.handled_at
|
29
|
+
assert_equal expected, actual
|
30
|
+
expected = 'Other string'
|
31
|
+
item.handled_at = expected
|
32
|
+
actual = item.handled_at
|
33
|
+
assert_equal expected, actual
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_exceptions_works_as_expected
|
37
|
+
item = Contracts::ExceptionData.new
|
38
|
+
actual = item.exceptions
|
39
|
+
assert_not_nil actual
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_severity_level_works_as_expected
|
43
|
+
expected = 5
|
44
|
+
item = Contracts::ExceptionData.new
|
45
|
+
item.severity_level = expected
|
46
|
+
actual = item.severity_level
|
47
|
+
assert_equal expected, actual
|
48
|
+
expected = 3
|
49
|
+
item.severity_level = expected
|
50
|
+
actual = item.severity_level
|
51
|
+
assert_equal expected, actual
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_problem_id_works_as_expected
|
55
|
+
expected = 'Test string'
|
56
|
+
item = Contracts::ExceptionData.new
|
57
|
+
item.problem_id = expected
|
58
|
+
actual = item.problem_id
|
59
|
+
assert_equal expected, actual
|
60
|
+
expected = 'Other string'
|
61
|
+
item.problem_id = expected
|
62
|
+
actual = item.problem_id
|
63
|
+
assert_equal expected, actual
|
64
|
+
end
|
65
|
+
|
66
|
+
def test_crash_thread_id_works_as_expected
|
67
|
+
expected = 42
|
68
|
+
item = Contracts::ExceptionData.new
|
69
|
+
item.crash_thread_id = expected
|
70
|
+
actual = item.crash_thread_id
|
71
|
+
assert_equal expected, actual
|
72
|
+
expected = 13
|
73
|
+
item.crash_thread_id = expected
|
74
|
+
actual = item.crash_thread_id
|
75
|
+
assert_equal expected, actual
|
76
|
+
end
|
77
|
+
|
78
|
+
def test_properties_works_as_expected
|
79
|
+
item = Contracts::ExceptionData.new
|
80
|
+
actual = item.properties
|
81
|
+
assert_not_nil actual
|
82
|
+
end
|
83
|
+
|
84
|
+
def test_measurements_works_as_expected
|
85
|
+
item = Contracts::ExceptionData.new
|
86
|
+
actual = item.measurements
|
87
|
+
assert_not_nil actual
|
88
|
+
end
|
89
|
+
|
90
|
+
def test_to_json_works_as_expected
|
91
|
+
item = Contracts::ExceptionData.new
|
92
|
+
item.ver = 42
|
93
|
+
item.handled_at = 'Test string'
|
94
|
+
[ { 'key' => 'value' } ].each do |value|
|
95
|
+
item.exceptions.push value
|
96
|
+
end
|
97
|
+
|
98
|
+
item.severity_level = 5
|
99
|
+
item.problem_id = 'Test string'
|
100
|
+
item.crash_thread_id = 42
|
101
|
+
{ 'key1' => 'test value 1' , 'key2' => 'test value 2' }.each do |key, value|
|
102
|
+
item.properties[key] = value
|
103
|
+
end
|
104
|
+
{ 'key1' => 3.1415 , 'key2' => 42.2 }.each do |key, value|
|
105
|
+
item.measurements[key] = value
|
106
|
+
end
|
107
|
+
actual = item.to_json
|
108
|
+
expected = '{"ver":42,"handledAt":"Test string","exceptions":[{"key":"value"}],"severityLevel":5,"problemId":"Test string","crashThreadId":42,"properties":{"key1":"test value 1","key2":"test value 2"},"measurements":{"key1":3.1415,"key2":42.2}}'
|
109
|
+
assert_equal expected, actual
|
110
|
+
end
|
111
|
+
end
|
@@ -1,106 +1,106 @@
|
|
1
|
-
require_relative '../../../../lib/application_insights/channel/contracts/exception_details'
|
2
|
-
require 'test/unit'
|
3
|
-
|
4
|
-
include ApplicationInsights::Channel
|
5
|
-
|
6
|
-
class TestExceptionDetails < Test::Unit::TestCase
|
7
|
-
def test_initialize
|
8
|
-
item = Contracts::ExceptionDetails.new
|
9
|
-
assert_not_nil item
|
10
|
-
end
|
11
|
-
|
12
|
-
def test_id_works_as_expected
|
13
|
-
expected = 42
|
14
|
-
item = Contracts::ExceptionDetails.new
|
15
|
-
item.id = expected
|
16
|
-
actual = item.id
|
17
|
-
assert_equal expected, actual
|
18
|
-
expected = 13
|
19
|
-
item.id = expected
|
20
|
-
actual = item.id
|
21
|
-
assert_equal expected, actual
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_outer_id_works_as_expected
|
25
|
-
expected = 42
|
26
|
-
item = Contracts::ExceptionDetails.new
|
27
|
-
item.outer_id = expected
|
28
|
-
actual = item.outer_id
|
29
|
-
assert_equal expected, actual
|
30
|
-
expected = 13
|
31
|
-
item.outer_id = expected
|
32
|
-
actual = item.outer_id
|
33
|
-
assert_equal expected, actual
|
34
|
-
end
|
35
|
-
|
36
|
-
def test_type_name_works_as_expected
|
37
|
-
expected = 'Test string'
|
38
|
-
item = Contracts::ExceptionDetails.new
|
39
|
-
item.type_name = expected
|
40
|
-
actual = item.type_name
|
41
|
-
assert_equal expected, actual
|
42
|
-
expected = 'Other string'
|
43
|
-
item.type_name = expected
|
44
|
-
actual = item.type_name
|
45
|
-
assert_equal expected, actual
|
46
|
-
end
|
47
|
-
|
48
|
-
def test_message_works_as_expected
|
49
|
-
expected = 'Test string'
|
50
|
-
item = Contracts::ExceptionDetails.new
|
51
|
-
item.message = expected
|
52
|
-
actual = item.message
|
53
|
-
assert_equal expected, actual
|
54
|
-
expected = 'Other string'
|
55
|
-
item.message = expected
|
56
|
-
actual = item.message
|
57
|
-
assert_equal expected, actual
|
58
|
-
end
|
59
|
-
|
60
|
-
def test_has_full_stack_works_as_expected
|
61
|
-
expected =
|
62
|
-
item = Contracts::ExceptionDetails.new
|
63
|
-
item.has_full_stack = expected
|
64
|
-
actual = item.has_full_stack
|
65
|
-
assert_equal expected, actual
|
66
|
-
expected =
|
67
|
-
item.has_full_stack = expected
|
68
|
-
actual = item.has_full_stack
|
69
|
-
assert_equal expected, actual
|
70
|
-
end
|
71
|
-
|
72
|
-
def test_stack_works_as_expected
|
73
|
-
expected = 'Test string'
|
74
|
-
item = Contracts::ExceptionDetails.new
|
75
|
-
item.stack = expected
|
76
|
-
actual = item.stack
|
77
|
-
assert_equal expected, actual
|
78
|
-
expected = 'Other string'
|
79
|
-
item.stack = expected
|
80
|
-
actual = item.stack
|
81
|
-
assert_equal expected, actual
|
82
|
-
end
|
83
|
-
|
84
|
-
def test_parsed_stack_works_as_expected
|
85
|
-
item = Contracts::ExceptionDetails.new
|
86
|
-
actual = item.parsed_stack
|
87
|
-
assert_not_nil actual
|
88
|
-
end
|
89
|
-
|
90
|
-
def test_to_json_works_as_expected
|
91
|
-
item = Contracts::ExceptionDetails.new
|
92
|
-
item.id = 42
|
93
|
-
item.outer_id = 42
|
94
|
-
item.type_name = 'Test string'
|
95
|
-
item.message = 'Test string'
|
96
|
-
item.has_full_stack =
|
97
|
-
item.stack = 'Test string'
|
98
|
-
[ { 'key' => 'value' } ].each do |value|
|
99
|
-
item.parsed_stack.push value
|
100
|
-
end
|
101
|
-
|
102
|
-
actual = item.to_json
|
103
|
-
expected = '{"id":42,"outerId":42,"typeName":"Test string","message":"Test string","hasFullStack":true,"stack":"Test string","parsedStack":[{"key":"value"}]}'
|
104
|
-
assert_equal expected, actual
|
105
|
-
end
|
106
|
-
end
|
1
|
+
require_relative '../../../../lib/application_insights/channel/contracts/exception_details'
|
2
|
+
require 'test/unit'
|
3
|
+
|
4
|
+
include ApplicationInsights::Channel
|
5
|
+
|
6
|
+
class TestExceptionDetails < Test::Unit::TestCase
|
7
|
+
def test_initialize
|
8
|
+
item = Contracts::ExceptionDetails.new
|
9
|
+
assert_not_nil item
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_id_works_as_expected
|
13
|
+
expected = 42
|
14
|
+
item = Contracts::ExceptionDetails.new
|
15
|
+
item.id = expected
|
16
|
+
actual = item.id
|
17
|
+
assert_equal expected, actual
|
18
|
+
expected = 13
|
19
|
+
item.id = expected
|
20
|
+
actual = item.id
|
21
|
+
assert_equal expected, actual
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_outer_id_works_as_expected
|
25
|
+
expected = 42
|
26
|
+
item = Contracts::ExceptionDetails.new
|
27
|
+
item.outer_id = expected
|
28
|
+
actual = item.outer_id
|
29
|
+
assert_equal expected, actual
|
30
|
+
expected = 13
|
31
|
+
item.outer_id = expected
|
32
|
+
actual = item.outer_id
|
33
|
+
assert_equal expected, actual
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_type_name_works_as_expected
|
37
|
+
expected = 'Test string'
|
38
|
+
item = Contracts::ExceptionDetails.new
|
39
|
+
item.type_name = expected
|
40
|
+
actual = item.type_name
|
41
|
+
assert_equal expected, actual
|
42
|
+
expected = 'Other string'
|
43
|
+
item.type_name = expected
|
44
|
+
actual = item.type_name
|
45
|
+
assert_equal expected, actual
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_message_works_as_expected
|
49
|
+
expected = 'Test string'
|
50
|
+
item = Contracts::ExceptionDetails.new
|
51
|
+
item.message = expected
|
52
|
+
actual = item.message
|
53
|
+
assert_equal expected, actual
|
54
|
+
expected = 'Other string'
|
55
|
+
item.message = expected
|
56
|
+
actual = item.message
|
57
|
+
assert_equal expected, actual
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_has_full_stack_works_as_expected
|
61
|
+
expected = true
|
62
|
+
item = Contracts::ExceptionDetails.new
|
63
|
+
item.has_full_stack = expected
|
64
|
+
actual = item.has_full_stack
|
65
|
+
assert_equal expected, actual
|
66
|
+
expected = false
|
67
|
+
item.has_full_stack = expected
|
68
|
+
actual = item.has_full_stack
|
69
|
+
assert_equal expected, actual
|
70
|
+
end
|
71
|
+
|
72
|
+
def test_stack_works_as_expected
|
73
|
+
expected = 'Test string'
|
74
|
+
item = Contracts::ExceptionDetails.new
|
75
|
+
item.stack = expected
|
76
|
+
actual = item.stack
|
77
|
+
assert_equal expected, actual
|
78
|
+
expected = 'Other string'
|
79
|
+
item.stack = expected
|
80
|
+
actual = item.stack
|
81
|
+
assert_equal expected, actual
|
82
|
+
end
|
83
|
+
|
84
|
+
def test_parsed_stack_works_as_expected
|
85
|
+
item = Contracts::ExceptionDetails.new
|
86
|
+
actual = item.parsed_stack
|
87
|
+
assert_not_nil actual
|
88
|
+
end
|
89
|
+
|
90
|
+
def test_to_json_works_as_expected
|
91
|
+
item = Contracts::ExceptionDetails.new
|
92
|
+
item.id = 42
|
93
|
+
item.outer_id = 42
|
94
|
+
item.type_name = 'Test string'
|
95
|
+
item.message = 'Test string'
|
96
|
+
item.has_full_stack = true
|
97
|
+
item.stack = 'Test string'
|
98
|
+
[ { 'key' => 'value' } ].each do |value|
|
99
|
+
item.parsed_stack.push value
|
100
|
+
end
|
101
|
+
|
102
|
+
actual = item.to_json
|
103
|
+
expected = '{"id":42,"outerId":42,"typeName":"Test string","message":"Test string","hasFullStack":true,"stack":"Test string","parsedStack":[{"key":"value"}]}'
|
104
|
+
assert_equal expected, actual
|
105
|
+
end
|
106
|
+
end
|