diff --git a/Agent/Analytics/Events/NRMAMobileEvent.m b/Agent/Analytics/Events/NRMAMobileEvent.m index e90f400c..54140998 100644 --- a/Agent/Analytics/Events/NRMAMobileEvent.m +++ b/Agent/Analytics/Events/NRMAMobileEvent.m @@ -8,7 +8,6 @@ #import "NRMAMobileEvent.h" #import "Constants.h" -#import "NewRelicInternalUtils.h" static NSString* const kTimestampKey = @"Timestamp"; static NSString* const kSessionElapsedTimeKey = @"SessionElapsedTime"; @@ -57,7 +56,6 @@ - (id)JSONObject { dict[kNRMA_RA_timestamp] = @(self.timestamp); dict[kNRMA_RA_sessionElapsedTime] = @(self.sessionElapsedTimeSeconds); dict[kNRMA_RA_eventType] = self.eventType; - return [NSDictionary dictionaryWithDictionary:dict]; } diff --git a/Agent/Harvester/NRMAHarvesterConnection.h b/Agent/Harvester/NRMAHarvesterConnection.h index db2ce709..d08075f8 100644 --- a/Agent/Harvester/NRMAHarvesterConnection.h +++ b/Agent/Harvester/NRMAHarvesterConnection.h @@ -12,7 +12,6 @@ #import "NRMAJSON.h" #import "NRMAConnection.h" #import "NRMAOfflineStorage.h" -#import "NRMAHarvestData.h" #define kCOLLECTOR_CONNECT_URI @"/mobile/v4/connect" #define kCOLLECTOR_DATA_URL @"/mobile/v3/data" diff --git a/Test Harness/NRTestApp/NRTestApp/ViewModels/UtilViewModel.swift b/Test Harness/NRTestApp/NRTestApp/ViewModels/UtilViewModel.swift index e1c2b402..558735aa 100644 --- a/Test Harness/NRTestApp/NRTestApp/ViewModels/UtilViewModel.swift +++ b/Test Harness/NRTestApp/NRTestApp/ViewModels/UtilViewModel.swift @@ -39,6 +39,7 @@ class UtilViewModel { options.append(UtilOption(title: "Record Error", handler: { [self] in makeError()})) options.append(UtilOption(title: "Record Handled Exception", handler: { triggerException.testing()})) options.append(UtilOption(title: "Set UserID", handler: { [self] in changeUserID()})) + options.append(UtilOption(title: "Make 100 events", handler: { [self] in make100Events()})) options.append(UtilOption(title: "Make 100 events every 10 seconds", handler: { [self] in startCustomEventTimer()})) options.append(UtilOption(title: "Stop 100 events every 10 seconds", handler: { [self] in stopCustomEventTimer()})) options.append(UtilOption(title: "Start Interaction Trace", handler: { [self] in startInteractionTrace()})) diff --git a/Tests/Unit-Tests/NewRelicAgentTests/Uncategorized/NRMASupportMetricHelperTests.m b/Tests/Unit-Tests/NewRelicAgentTests/Uncategorized/NRMASupportMetricHelperTests.m index 0c316b13..6f0ab505 100644 --- a/Tests/Unit-Tests/NewRelicAgentTests/Uncategorized/NRMASupportMetricHelperTests.m +++ b/Tests/Unit-Tests/NewRelicAgentTests/Uncategorized/NRMASupportMetricHelperTests.m @@ -73,4 +73,21 @@ -(void)testAgentStopSupportMetric { XCTAssertEqualObjects(measurement.name, fullMetricName, @"Name is not generated properly."); } +-(void)testOfflinePayloadSupportMetric { + + [NRMASupportMetricHelper enqueueOfflinePayloadMetric:1]; + + [NRMASupportMetricHelper processDeferredMetrics]; + + [NRMATaskQueue synchronousDequeue]; + + XCTAssertTrue([helper.result isKindOfClass:[NRMANamedValueMeasurement class]], @"The result is not a named value."); + + NRMANamedValueMeasurement* measurement = ((NRMANamedValueMeasurement*)helper.result); + + NSString* fullMetricName = [NSString stringWithFormat: kNRMAOfflineSupportabilityFormatString, [NewRelicInternalUtils osName], [NewRelicInternalUtils stringFromNRMAApplicationPlatform:[NRMAAgentConfiguration connectionInformation].deviceInformation.platform], kNRMACollectorDest]; + XCTAssertEqualObjects(measurement.name, fullMetricName, @"Name is not generated properly."); + XCTAssertTrue(([measurement.value isEqual: @1]), @"Value is not generated properly."); +} + @end