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,44 +1,44 @@
|
|
1
|
-
require_relative '../../../../lib/application_insights/channel/contracts/internal'
|
2
|
-
require 'test/unit'
|
3
|
-
|
4
|
-
include ApplicationInsights::Channel
|
5
|
-
|
6
|
-
class TestInternal < Test::Unit::TestCase
|
7
|
-
def test_initialize
|
8
|
-
item = Contracts::Internal.new
|
9
|
-
assert_not_nil item
|
10
|
-
end
|
11
|
-
|
12
|
-
def test_sdk_version_works_as_expected
|
13
|
-
expected = 'Test string'
|
14
|
-
item = Contracts::Internal.new
|
15
|
-
item.sdk_version = expected
|
16
|
-
actual = item.sdk_version
|
17
|
-
assert_equal expected, actual
|
18
|
-
expected = 'Other string'
|
19
|
-
item.sdk_version = expected
|
20
|
-
actual = item.sdk_version
|
21
|
-
assert_equal expected, actual
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_agent_version_works_as_expected
|
25
|
-
expected = 'Test string'
|
26
|
-
item = Contracts::Internal.new
|
27
|
-
item.agent_version = expected
|
28
|
-
actual = item.agent_version
|
29
|
-
assert_equal expected, actual
|
30
|
-
expected = 'Other string'
|
31
|
-
item.agent_version = expected
|
32
|
-
actual = item.agent_version
|
33
|
-
assert_equal expected, actual
|
34
|
-
end
|
35
|
-
|
36
|
-
def test_to_json_works_as_expected
|
37
|
-
item = Contracts::Internal.new
|
38
|
-
item.sdk_version = 'Test string'
|
39
|
-
item.agent_version = 'Test string'
|
40
|
-
actual = item.to_json
|
41
|
-
expected = '{"ai.internal.sdkVersion":"Test string","ai.internal.agentVersion":"Test string"}'
|
42
|
-
assert_equal expected, actual
|
43
|
-
end
|
44
|
-
end
|
1
|
+
require_relative '../../../../lib/application_insights/channel/contracts/internal'
|
2
|
+
require 'test/unit'
|
3
|
+
|
4
|
+
include ApplicationInsights::Channel
|
5
|
+
|
6
|
+
class TestInternal < Test::Unit::TestCase
|
7
|
+
def test_initialize
|
8
|
+
item = Contracts::Internal.new
|
9
|
+
assert_not_nil item
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_sdk_version_works_as_expected
|
13
|
+
expected = 'Test string'
|
14
|
+
item = Contracts::Internal.new
|
15
|
+
item.sdk_version = expected
|
16
|
+
actual = item.sdk_version
|
17
|
+
assert_equal expected, actual
|
18
|
+
expected = 'Other string'
|
19
|
+
item.sdk_version = expected
|
20
|
+
actual = item.sdk_version
|
21
|
+
assert_equal expected, actual
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_agent_version_works_as_expected
|
25
|
+
expected = 'Test string'
|
26
|
+
item = Contracts::Internal.new
|
27
|
+
item.agent_version = expected
|
28
|
+
actual = item.agent_version
|
29
|
+
assert_equal expected, actual
|
30
|
+
expected = 'Other string'
|
31
|
+
item.agent_version = expected
|
32
|
+
actual = item.agent_version
|
33
|
+
assert_equal expected, actual
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_to_json_works_as_expected
|
37
|
+
item = Contracts::Internal.new
|
38
|
+
item.sdk_version = 'Test string'
|
39
|
+
item.agent_version = 'Test string'
|
40
|
+
actual = item.to_json
|
41
|
+
expected = '{"ai.internal.sdkVersion":"Test string","ai.internal.agentVersion":"Test string"}'
|
42
|
+
assert_equal expected, actual
|
43
|
+
end
|
44
|
+
end
|
@@ -1,31 +1,70 @@
|
|
1
|
-
require_relative '../../../../lib/application_insights/channel/contracts/location'
|
2
|
-
require 'test/unit'
|
3
|
-
|
4
|
-
include ApplicationInsights::Channel
|
5
|
-
|
6
|
-
class TestLocation < Test::Unit::TestCase
|
7
|
-
def test_initialize
|
8
|
-
item = Contracts::Location.new
|
9
|
-
assert_not_nil item
|
10
|
-
end
|
11
|
-
|
12
|
-
def test_ip_works_as_expected
|
13
|
-
expected = 'Test string'
|
14
|
-
item = Contracts::Location.new
|
15
|
-
item.ip = expected
|
16
|
-
actual = item.ip
|
17
|
-
assert_equal expected, actual
|
18
|
-
expected = 'Other string'
|
19
|
-
item.ip = expected
|
20
|
-
actual = item.ip
|
21
|
-
assert_equal expected, actual
|
22
|
-
end
|
23
|
-
|
24
|
-
def
|
25
|
-
|
26
|
-
item
|
27
|
-
|
28
|
-
|
29
|
-
assert_equal expected, actual
|
30
|
-
|
31
|
-
|
1
|
+
require_relative '../../../../lib/application_insights/channel/contracts/location'
|
2
|
+
require 'test/unit'
|
3
|
+
|
4
|
+
include ApplicationInsights::Channel
|
5
|
+
|
6
|
+
class TestLocation < Test::Unit::TestCase
|
7
|
+
def test_initialize
|
8
|
+
item = Contracts::Location.new
|
9
|
+
assert_not_nil item
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_ip_works_as_expected
|
13
|
+
expected = 'Test string'
|
14
|
+
item = Contracts::Location.new
|
15
|
+
item.ip = expected
|
16
|
+
actual = item.ip
|
17
|
+
assert_equal expected, actual
|
18
|
+
expected = 'Other string'
|
19
|
+
item.ip = expected
|
20
|
+
actual = item.ip
|
21
|
+
assert_equal expected, actual
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_country_works_as_expected
|
25
|
+
expected = 'Test string'
|
26
|
+
item = Contracts::Location.new
|
27
|
+
item.country = expected
|
28
|
+
actual = item.country
|
29
|
+
assert_equal expected, actual
|
30
|
+
expected = 'Other string'
|
31
|
+
item.country = expected
|
32
|
+
actual = item.country
|
33
|
+
assert_equal expected, actual
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_province_works_as_expected
|
37
|
+
expected = 'Test string'
|
38
|
+
item = Contracts::Location.new
|
39
|
+
item.province = expected
|
40
|
+
actual = item.province
|
41
|
+
assert_equal expected, actual
|
42
|
+
expected = 'Other string'
|
43
|
+
item.province = expected
|
44
|
+
actual = item.province
|
45
|
+
assert_equal expected, actual
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_city_works_as_expected
|
49
|
+
expected = 'Test string'
|
50
|
+
item = Contracts::Location.new
|
51
|
+
item.city = expected
|
52
|
+
actual = item.city
|
53
|
+
assert_equal expected, actual
|
54
|
+
expected = 'Other string'
|
55
|
+
item.city = expected
|
56
|
+
actual = item.city
|
57
|
+
assert_equal expected, actual
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_to_json_works_as_expected
|
61
|
+
item = Contracts::Location.new
|
62
|
+
item.ip = 'Test string'
|
63
|
+
item.country = 'US'
|
64
|
+
item.province = 'WA'
|
65
|
+
item.city = 'Redmond'
|
66
|
+
actual = item.to_json
|
67
|
+
expected = '{"ai.location.ip":"Test string","ai.location.country":"US","ai.location.province":"WA","ai.location.city":"Redmond"}'
|
68
|
+
assert_equal expected, actual
|
69
|
+
end
|
70
|
+
end
|
@@ -1,66 +1,66 @@
|
|
1
|
-
require_relative '../../../../lib/application_insights/channel/contracts/message_data'
|
2
|
-
require 'test/unit'
|
3
|
-
|
4
|
-
include ApplicationInsights::Channel
|
5
|
-
|
6
|
-
class TestMessageData < Test::Unit::TestCase
|
7
|
-
def test_initialize
|
8
|
-
item = Contracts::MessageData.new
|
9
|
-
assert_not_nil item
|
10
|
-
end
|
11
|
-
|
12
|
-
def test_ver_works_as_expected
|
13
|
-
expected = 42
|
14
|
-
item = Contracts::MessageData.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_message_works_as_expected
|
25
|
-
expected = 'Test string'
|
26
|
-
item = Contracts::MessageData.new
|
27
|
-
item.message = expected
|
28
|
-
actual = item.message
|
29
|
-
assert_equal expected, actual
|
30
|
-
expected = 'Other string'
|
31
|
-
item.message = expected
|
32
|
-
actual = item.message
|
33
|
-
assert_equal expected, actual
|
34
|
-
end
|
35
|
-
|
36
|
-
def test_severity_level_works_as_expected
|
37
|
-
expected = 5
|
38
|
-
item = Contracts::MessageData.new
|
39
|
-
item.severity_level = expected
|
40
|
-
actual = item.severity_level
|
41
|
-
assert_equal expected, actual
|
42
|
-
expected = 3
|
43
|
-
item.severity_level = expected
|
44
|
-
actual = item.severity_level
|
45
|
-
assert_equal expected, actual
|
46
|
-
end
|
47
|
-
|
48
|
-
def test_properties_works_as_expected
|
49
|
-
item = Contracts::MessageData.new
|
50
|
-
actual = item.properties
|
51
|
-
assert_not_nil actual
|
52
|
-
end
|
53
|
-
|
54
|
-
def test_to_json_works_as_expected
|
55
|
-
item = Contracts::MessageData.new
|
56
|
-
item.ver = 42
|
57
|
-
item.message = 'Test string'
|
58
|
-
item.severity_level = 5
|
59
|
-
{ 'key1' => 'test value 1' , 'key2' => 'test value 2' }.each do |key, value|
|
60
|
-
item.properties[key] = value
|
61
|
-
end
|
62
|
-
actual = item.to_json
|
63
|
-
expected = '{"ver":42,"message":"Test string","severityLevel":5,"properties":{"key1":"test value 1","key2":"test value 2"}}'
|
64
|
-
assert_equal expected, actual
|
65
|
-
end
|
66
|
-
end
|
1
|
+
require_relative '../../../../lib/application_insights/channel/contracts/message_data'
|
2
|
+
require 'test/unit'
|
3
|
+
|
4
|
+
include ApplicationInsights::Channel
|
5
|
+
|
6
|
+
class TestMessageData < Test::Unit::TestCase
|
7
|
+
def test_initialize
|
8
|
+
item = Contracts::MessageData.new
|
9
|
+
assert_not_nil item
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_ver_works_as_expected
|
13
|
+
expected = 42
|
14
|
+
item = Contracts::MessageData.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_message_works_as_expected
|
25
|
+
expected = 'Test string'
|
26
|
+
item = Contracts::MessageData.new
|
27
|
+
item.message = expected
|
28
|
+
actual = item.message
|
29
|
+
assert_equal expected, actual
|
30
|
+
expected = 'Other string'
|
31
|
+
item.message = expected
|
32
|
+
actual = item.message
|
33
|
+
assert_equal expected, actual
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_severity_level_works_as_expected
|
37
|
+
expected = 5
|
38
|
+
item = Contracts::MessageData.new
|
39
|
+
item.severity_level = expected
|
40
|
+
actual = item.severity_level
|
41
|
+
assert_equal expected, actual
|
42
|
+
expected = 3
|
43
|
+
item.severity_level = expected
|
44
|
+
actual = item.severity_level
|
45
|
+
assert_equal expected, actual
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_properties_works_as_expected
|
49
|
+
item = Contracts::MessageData.new
|
50
|
+
actual = item.properties
|
51
|
+
assert_not_nil actual
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_to_json_works_as_expected
|
55
|
+
item = Contracts::MessageData.new
|
56
|
+
item.ver = 42
|
57
|
+
item.message = 'Test string'
|
58
|
+
item.severity_level = 5
|
59
|
+
{ 'key1' => 'test value 1' , 'key2' => 'test value 2' }.each do |key, value|
|
60
|
+
item.properties[key] = value
|
61
|
+
end
|
62
|
+
actual = item.to_json
|
63
|
+
expected = '{"ver":42,"message":"Test string","severityLevel":5,"properties":{"key1":"test value 1","key2":"test value 2"}}'
|
64
|
+
assert_equal expected, actual
|
65
|
+
end
|
66
|
+
end
|
@@ -1,50 +1,50 @@
|
|
1
|
-
require_relative '../../../../lib/application_insights/channel/contracts/metric_data'
|
2
|
-
require 'test/unit'
|
3
|
-
|
4
|
-
include ApplicationInsights::Channel
|
5
|
-
|
6
|
-
class TestMetricData < Test::Unit::TestCase
|
7
|
-
def test_initialize
|
8
|
-
item = Contracts::MetricData.new
|
9
|
-
assert_not_nil item
|
10
|
-
end
|
11
|
-
|
12
|
-
def test_ver_works_as_expected
|
13
|
-
expected = 42
|
14
|
-
item = Contracts::MetricData.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_metrics_works_as_expected
|
25
|
-
item = Contracts::MetricData.new
|
26
|
-
actual = item.metrics
|
27
|
-
assert_not_nil actual
|
28
|
-
end
|
29
|
-
|
30
|
-
def test_properties_works_as_expected
|
31
|
-
item = Contracts::MetricData.new
|
32
|
-
actual = item.properties
|
33
|
-
assert_not_nil actual
|
34
|
-
end
|
35
|
-
|
36
|
-
def test_to_json_works_as_expected
|
37
|
-
item = Contracts::MetricData.new
|
38
|
-
item.ver = 42
|
39
|
-
[ { 'key' => 'value' } ].each do |value|
|
40
|
-
item.metrics.push value
|
41
|
-
end
|
42
|
-
|
43
|
-
{ 'key1' => 'test value 1' , 'key2' => 'test value 2' }.each do |key, value|
|
44
|
-
item.properties[key] = value
|
45
|
-
end
|
46
|
-
actual = item.to_json
|
47
|
-
expected = '{"ver":42,"metrics":[{"key":"value"}],"properties":{"key1":"test value 1","key2":"test value 2"}}'
|
48
|
-
assert_equal expected, actual
|
49
|
-
end
|
50
|
-
end
|
1
|
+
require_relative '../../../../lib/application_insights/channel/contracts/metric_data'
|
2
|
+
require 'test/unit'
|
3
|
+
|
4
|
+
include ApplicationInsights::Channel
|
5
|
+
|
6
|
+
class TestMetricData < Test::Unit::TestCase
|
7
|
+
def test_initialize
|
8
|
+
item = Contracts::MetricData.new
|
9
|
+
assert_not_nil item
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_ver_works_as_expected
|
13
|
+
expected = 42
|
14
|
+
item = Contracts::MetricData.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_metrics_works_as_expected
|
25
|
+
item = Contracts::MetricData.new
|
26
|
+
actual = item.metrics
|
27
|
+
assert_not_nil actual
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_properties_works_as_expected
|
31
|
+
item = Contracts::MetricData.new
|
32
|
+
actual = item.properties
|
33
|
+
assert_not_nil actual
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_to_json_works_as_expected
|
37
|
+
item = Contracts::MetricData.new
|
38
|
+
item.ver = 42
|
39
|
+
[ { 'key' => 'value' } ].each do |value|
|
40
|
+
item.metrics.push value
|
41
|
+
end
|
42
|
+
|
43
|
+
{ 'key1' => 'test value 1' , 'key2' => 'test value 2' }.each do |key, value|
|
44
|
+
item.properties[key] = value
|
45
|
+
end
|
46
|
+
actual = item.to_json
|
47
|
+
expected = '{"ver":42,"metrics":[{"key":"value"}],"properties":{"key1":"test value 1","key2":"test value 2"}}'
|
48
|
+
assert_equal expected, actual
|
49
|
+
end
|
50
|
+
end
|
@@ -1,96 +1,109 @@
|
|
1
|
-
require_relative '../../../../lib/application_insights/channel/contracts/operation'
|
2
|
-
require 'test/unit'
|
3
|
-
|
4
|
-
include ApplicationInsights::Channel
|
5
|
-
|
6
|
-
class TestOperation < Test::Unit::TestCase
|
7
|
-
def test_initialize
|
8
|
-
item = Contracts::Operation.new
|
9
|
-
assert_not_nil item
|
10
|
-
end
|
11
|
-
|
12
|
-
def test_id_works_as_expected
|
13
|
-
expected = 'Test string'
|
14
|
-
item = Contracts::Operation.new
|
15
|
-
item.id = expected
|
16
|
-
actual = item.id
|
17
|
-
assert_equal expected, actual
|
18
|
-
expected = 'Other string'
|
19
|
-
item.id = expected
|
20
|
-
actual = item.id
|
21
|
-
assert_equal expected, actual
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_name_works_as_expected
|
25
|
-
expected = 'Test string'
|
26
|
-
item = Contracts::Operation.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_parent_id_works_as_expected
|
37
|
-
expected = 'Test string'
|
38
|
-
item = Contracts::Operation.new
|
39
|
-
item.parent_id = expected
|
40
|
-
actual = item.parent_id
|
41
|
-
assert_equal expected, actual
|
42
|
-
expected = 'Other string'
|
43
|
-
item.parent_id = expected
|
44
|
-
actual = item.parent_id
|
45
|
-
assert_equal expected, actual
|
46
|
-
end
|
47
|
-
|
48
|
-
def test_root_id_works_as_expected
|
49
|
-
expected = 'Test string'
|
50
|
-
item = Contracts::Operation.new
|
51
|
-
item.root_id = expected
|
52
|
-
actual = item.root_id
|
53
|
-
assert_equal expected, actual
|
54
|
-
expected = 'Other string'
|
55
|
-
item.root_id = expected
|
56
|
-
actual = item.root_id
|
57
|
-
assert_equal expected, actual
|
58
|
-
end
|
59
|
-
|
60
|
-
def test_synthetic_source_works_as_expected
|
61
|
-
expected = 'Test string'
|
62
|
-
item = Contracts::Operation.new
|
63
|
-
item.synthetic_source = expected
|
64
|
-
actual = item.synthetic_source
|
65
|
-
assert_equal expected, actual
|
66
|
-
expected = 'Other string'
|
67
|
-
item.synthetic_source = expected
|
68
|
-
actual = item.synthetic_source
|
69
|
-
assert_equal expected, actual
|
70
|
-
end
|
71
|
-
|
72
|
-
def test_is_synthetic_works_as_expected
|
73
|
-
expected = 'Test string'
|
74
|
-
item = Contracts::Operation.new
|
75
|
-
item.is_synthetic = expected
|
76
|
-
actual = item.is_synthetic
|
77
|
-
assert_equal expected, actual
|
78
|
-
expected = 'Other string'
|
79
|
-
item.is_synthetic = expected
|
80
|
-
actual = item.is_synthetic
|
81
|
-
assert_equal expected, actual
|
82
|
-
end
|
83
|
-
|
84
|
-
def
|
85
|
-
|
86
|
-
item
|
87
|
-
item.
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
item.
|
92
|
-
actual = item.
|
93
|
-
expected
|
94
|
-
|
95
|
-
|
96
|
-
|
1
|
+
require_relative '../../../../lib/application_insights/channel/contracts/operation'
|
2
|
+
require 'test/unit'
|
3
|
+
|
4
|
+
include ApplicationInsights::Channel
|
5
|
+
|
6
|
+
class TestOperation < Test::Unit::TestCase
|
7
|
+
def test_initialize
|
8
|
+
item = Contracts::Operation.new
|
9
|
+
assert_not_nil item
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_id_works_as_expected
|
13
|
+
expected = 'Test string'
|
14
|
+
item = Contracts::Operation.new
|
15
|
+
item.id = expected
|
16
|
+
actual = item.id
|
17
|
+
assert_equal expected, actual
|
18
|
+
expected = 'Other string'
|
19
|
+
item.id = expected
|
20
|
+
actual = item.id
|
21
|
+
assert_equal expected, actual
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_name_works_as_expected
|
25
|
+
expected = 'Test string'
|
26
|
+
item = Contracts::Operation.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_parent_id_works_as_expected
|
37
|
+
expected = 'Test string'
|
38
|
+
item = Contracts::Operation.new
|
39
|
+
item.parent_id = expected
|
40
|
+
actual = item.parent_id
|
41
|
+
assert_equal expected, actual
|
42
|
+
expected = 'Other string'
|
43
|
+
item.parent_id = expected
|
44
|
+
actual = item.parent_id
|
45
|
+
assert_equal expected, actual
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_root_id_works_as_expected
|
49
|
+
expected = 'Test string'
|
50
|
+
item = Contracts::Operation.new
|
51
|
+
item.root_id = expected
|
52
|
+
actual = item.root_id
|
53
|
+
assert_equal expected, actual
|
54
|
+
expected = 'Other string'
|
55
|
+
item.root_id = expected
|
56
|
+
actual = item.root_id
|
57
|
+
assert_equal expected, actual
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_synthetic_source_works_as_expected
|
61
|
+
expected = 'Test string'
|
62
|
+
item = Contracts::Operation.new
|
63
|
+
item.synthetic_source = expected
|
64
|
+
actual = item.synthetic_source
|
65
|
+
assert_equal expected, actual
|
66
|
+
expected = 'Other string'
|
67
|
+
item.synthetic_source = expected
|
68
|
+
actual = item.synthetic_source
|
69
|
+
assert_equal expected, actual
|
70
|
+
end
|
71
|
+
|
72
|
+
def test_is_synthetic_works_as_expected
|
73
|
+
expected = 'Test string'
|
74
|
+
item = Contracts::Operation.new
|
75
|
+
item.is_synthetic = expected
|
76
|
+
actual = item.is_synthetic
|
77
|
+
assert_equal expected, actual
|
78
|
+
expected = 'Other string'
|
79
|
+
item.is_synthetic = expected
|
80
|
+
actual = item.is_synthetic
|
81
|
+
assert_equal expected, actual
|
82
|
+
end
|
83
|
+
|
84
|
+
def test_correlation_vector_works_as_expected
|
85
|
+
expected = 'Test string'
|
86
|
+
item = Contracts::Operation.new
|
87
|
+
item.correlation_vector = expected
|
88
|
+
actual = item.correlation_vector
|
89
|
+
assert_equal expected, actual
|
90
|
+
expected = 'Other string'
|
91
|
+
item.correlation_vector = expected
|
92
|
+
actual = item.correlation_vector
|
93
|
+
assert_equal expected, actual
|
94
|
+
end
|
95
|
+
|
96
|
+
def test_to_json_works_as_expected
|
97
|
+
item = Contracts::Operation.new
|
98
|
+
item.id = 'Test string'
|
99
|
+
item.name = 'Test string'
|
100
|
+
item.parent_id = 'Test string'
|
101
|
+
item.root_id = 'Test string'
|
102
|
+
item.synthetic_source = 'Test string'
|
103
|
+
item.is_synthetic = 'Test string'
|
104
|
+
item.correlation_vector = 'Test string'
|
105
|
+
actual = item.to_json
|
106
|
+
expected = '{"ai.operation.id":"Test string","ai.operation.name":"Test string","ai.operation.parentId":"Test string","ai.operation.rootId":"Test string","ai.operation.syntheticSource":"Test string","ai.operation.isSynthetic":"Test string","ai.operation.correlationVector":"Test string"}'
|
107
|
+
assert_equal expected, actual
|
108
|
+
end
|
109
|
+
end
|