├── Classes
├── ApplicationInsightsOSX.h
├── MSAIDomain.h
├── MSAIEnums.h
├── MSAILocation.h
├── MSAIContext.h
├── MSAIReachability.h
├── MSAIEnvelopeManager.h
├── MSAIInternal.h
├── MSAITestResult.h
├── MSAISessionState.h
├── MSAICategoryContainer.h
├── ApplicationInsightsPrivate.m
├── MSAIDataPointType.h
├── MSAIObject.h
├── MSAISession.h
├── MSAIDependencyKind.h
├── MSAIDependencySourceType.h
├── MSAIData.h
├── MSAIMetricData.h
├── MSAIEventData.h
├── MSAIBase.h
├── MSAISessionStateData.h
├── MSAISeverityLevel.h
├── ApplicationInsightsFeatureConfig.h
├── MSAIApplication.h
├── MSAITelemetryContext.h
├── MSAIContextHelper.h
├── MSAIMessageData.h
├── MSAIChannel.h
├── MSAIOrderedDictionary.h
├── MSAIOperation.h
├── MSAIPageViewData.h
├── MSAITelemetryData.h
├── MSAISender.h
├── MSAIApplicationInsightsPrivate.h
├── MSAIPageViewPerfData.h
├── MSAIUser.h
├── MSAIDataPoint.h
├── MSAIContextPrivate.h
├── MSAIRequestData.h
├── MSAIAvailabilityData.h
├── MSAINullability.h
├── MSAIContext.m
├── ApplicationInsights.h
├── MSAIEnvelope.h
├── MSAILocation.m
├── ApplicationInsightsPrivate.h
├── MSAIBase.m
├── MSAIOrderedDictionary.m
├── MSAIRemoteDependencyData.h
├── MSAIDevice.h
├── MSAITelemetryData.m
├── MSAIHelper.h
├── MSAIHTTPOperation.h
├── MSAIObject.m
├── MSAIData.m
├── MSAIInternal.m
├── MSAIDomain.m
├── MSAIGZIP.h
├── MSAISession.m
├── MSAIApplication.m
├── MSAIPersistence.h
├── MSAISessionStateData.m
├── MSAIPageViewData.m
├── MSAIEnvelopeManagerPrivate.h
├── MSAIMetricData.m
├── MSAIMessageData.m
├── MSAIEnvelopeManager.m
├── MSAIDataPoint.m
├── MSAIOperation.m
├── MSAIEventData.m
├── MSAIKeychainUtils.h
├── MSAITelemetryManagerPrivate.h
└── MSAIPageViewPerfData.m
├── Support
├── ApplicationInsightsTests
│ ├── OCMock.framework
│ │ ├── Versions
│ │ │ ├── Current
│ │ │ └── A
│ │ │ │ ├── OCMock
│ │ │ │ ├── Resources
│ │ │ │ ├── en.lproj
│ │ │ │ │ └── InfoPlist.strings
│ │ │ │ └── Info.plist
│ │ │ │ └── Headers
│ │ │ │ ├── NSNotificationCenter+OCMAdditions.h
│ │ │ │ ├── OCMRecorder.h
│ │ │ │ ├── OCMLocation.h
│ │ │ │ ├── OCMMacroState.h
│ │ │ │ ├── OCMArg.h
│ │ │ │ ├── OCMConstraint.h
│ │ │ │ ├── OCMStubRecorder.h
│ │ │ │ └── OCMockObject.h
│ │ ├── Headers
│ │ ├── OCMock
│ │ └── Resources
│ ├── OCHamcrest.framework
│ │ ├── Versions
│ │ │ ├── Current
│ │ │ └── A
│ │ │ │ ├── OCHamcrest
│ │ │ │ ├── Headers
│ │ │ │ ├── HCRequireNonNilObject.h
│ │ │ │ ├── HCClassMatcher.h
│ │ │ │ ├── HCSubstringMatcher.h
│ │ │ │ ├── HCTestFailureHandlerChain.h
│ │ │ │ ├── HCWrapInMatcher.h
│ │ │ │ ├── HCTestFailureHandler.h
│ │ │ │ ├── HCBaseDescription.h
│ │ │ │ ├── HCDiagnosingMatcher.h
│ │ │ │ ├── HCSelfDescribing.h
│ │ │ │ ├── HCIsEmptyCollection.h
│ │ │ │ ├── HCTestFailure.h
│ │ │ │ ├── HCBaseMatcher.h
│ │ │ │ ├── HCIsTypeOf.h
│ │ │ │ ├── HCStringDescription.h
│ │ │ │ ├── HCIsIn.h
│ │ │ │ ├── HCIsSame.h
│ │ │ │ ├── HCIsNil.h
│ │ │ │ ├── HCThrowsException.h
│ │ │ │ ├── HCIsEqual.h
│ │ │ │ ├── HCIsInstanceOf.h
│ │ │ │ ├── HCConformsToProtocol.h
│ │ │ │ ├── HCStringContains.h
│ │ │ │ ├── HCStringEndsWith.h
│ │ │ │ ├── HCIsTrueFalse.h
│ │ │ │ ├── HCStringStartsWith.h
│ │ │ │ ├── HCCollect.h
│ │ │ │ ├── HCAnyOf.h
│ │ │ │ ├── HCAllOf.h
│ │ │ │ ├── HCEvery.h
│ │ │ │ ├── HCDescription.h
│ │ │ │ ├── HCIsNot.h
│ │ │ │ ├── HCIsEqualIgnoringCase.h
│ │ │ │ ├── HCIsCollectionContainingInOrder.h
│ │ │ │ ├── HCIsCloseTo.h
│ │ │ │ ├── HCIsCollectionOnlyContaining.h
│ │ │ │ ├── HCHasDescription.h
│ │ │ │ ├── HCIsEqualIgnoringWhiteSpace.h
│ │ │ │ ├── HCIsDictionaryContainingKey.h
│ │ │ │ ├── HCInvocationMatcher.h
│ │ │ │ ├── HCIsDictionaryContainingValue.h
│ │ │ │ ├── HCDescribedAs.h
│ │ │ │ ├── HCStringContainsInOrder.h
│ │ │ │ ├── HCIsCollectionContainingInAnyOrder.h
│ │ │ │ ├── HCIs.h
│ │ │ │ ├── HCHasProperty.h
│ │ │ │ ├── HCIsDictionaryContainingEntries.h
│ │ │ │ ├── HCHasCount.h
│ │ │ │ ├── HCIsAnything.h
│ │ │ │ ├── HCIsDictionaryContaining.h
│ │ │ │ ├── HCMatcher.h
│ │ │ │ └── HCIsCollectionContaining.h
│ │ │ │ └── Resources
│ │ │ │ └── Info.plist
│ │ ├── Headers
│ │ ├── OCHamcrest
│ │ └── Resources
│ ├── OCMockito.framework
│ │ ├── Versions
│ │ │ ├── Current
│ │ │ └── A
│ │ │ │ ├── OCMockito
│ │ │ │ ├── Headers
│ │ │ │ ├── MKTArgumentCaptor.h
│ │ │ │ ├── MKTBaseMockObject.h
│ │ │ │ ├── NSInvocation+OCMockito.h
│ │ │ │ ├── MKTObjectMock.h
│ │ │ │ ├── MKTClassObjectMock.h
│ │ │ │ ├── MKTObjectAndProtocolMock.h
│ │ │ │ ├── MKTProtocolMock.h
│ │ │ │ └── MKTPrimitiveArgumentMatching.h
│ │ │ │ └── Resources
│ │ │ │ └── Info.plist
│ │ ├── Headers
│ │ ├── OCMockito
│ │ └── Resources
│ ├── MSAITestHelper.h
│ ├── MSAIDomainTests.m
│ ├── MSAITestsDependencyInjection.h
│ ├── ApplicationInsightsTests-Prefix.pch
│ ├── ApplicationInsightsTests-Info.plist
│ ├── MSAIBaseTests.m
│ ├── MSAIDataTests.m
│ ├── MSAILocationTests.m
│ ├── MSAIApplicationInsightsTests.m
│ ├── MSAIApplicationTests.m
│ ├── MSAITestHelper.m
│ ├── MSAIReachabilityTests.m
│ ├── MSAITestsDependencyInjection.m
│ ├── MSAIInternalTests.m
│ ├── MSAIPageViewDataTests.m
│ ├── MSAIMetricDataTests.m
│ ├── MSAITelemetryContextTests.m
│ ├── MSAISessionTests.m
│ ├── MSAIEventDataTests.m
│ ├── MSAIMessageDataTests.m
│ ├── MSAICategoryContainerTests.m
│ ├── MSAIEnvelopeManagerTests.m
│ └── MSAIOperationTests.m
├── module.modulemap
├── ApplicationInsights.xcconfig
├── ApplicationInsights.xcodeproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ ├── AppInsights.xccheckout
│ │ │ ├── ApplicationInsights.xccheckout
│ │ │ ├── ApplicationInsights.xcscmblueprint
│ │ │ └── AppInsights-iOS.xccheckout
│ └── xcshareddata
│ │ └── xcbaselines
│ │ └── 1E5A458F16F0DFC200B55C04.xcbaseline
│ │ ├── 0E03ADBE-1442-48B6-ADD5-807E0C73245B.plist
│ │ ├── 5C0AC091-0676-4E63-8E6F-B855856B85CA.plist
│ │ └── Info.plist
├── buildnumber.xcconfig
└── Info.plist
├── docs
├── index.html
└── index.md
├── .travis.yml
├── .gitignore
├── Resources
└── ApplicationInsights-Info.plist
└── ApplicationInsights-OSX.podspec
/Classes/ApplicationInsightsOSX.h:
--------------------------------------------------------------------------------
1 | #import "ApplicationInsights.h"
2 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCMock.framework/Versions/Current:
--------------------------------------------------------------------------------
1 | A
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCHamcrest.framework/Versions/Current:
--------------------------------------------------------------------------------
1 | A
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCMockito.framework/Versions/Current:
--------------------------------------------------------------------------------
1 | A
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCMock.framework/Headers:
--------------------------------------------------------------------------------
1 | Versions/Current/Headers
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCMock.framework/OCMock:
--------------------------------------------------------------------------------
1 | Versions/Current/OCMock
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCHamcrest.framework/Headers:
--------------------------------------------------------------------------------
1 | Versions/Current/Headers
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCMock.framework/Resources:
--------------------------------------------------------------------------------
1 | Versions/Current/Resources
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCMockito.framework/Headers:
--------------------------------------------------------------------------------
1 | Versions/Current/Headers
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCMockito.framework/OCMockito:
--------------------------------------------------------------------------------
1 | Versions/Current/OCMockito
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCMockito.framework/Resources:
--------------------------------------------------------------------------------
1 | Versions/Current/Resources
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCHamcrest.framework/OCHamcrest:
--------------------------------------------------------------------------------
1 | Versions/Current/OCHamcrest
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCHamcrest.framework/Resources:
--------------------------------------------------------------------------------
1 | Versions/Current/Resources
--------------------------------------------------------------------------------
/docs/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Classes/MSAIDomain.h:
--------------------------------------------------------------------------------
1 | #import "MSAITelemetryData.h"
2 |
3 | @interface MSAIDomain : MSAITelemetryData
4 |
5 | @end
6 |
--------------------------------------------------------------------------------
/Classes/MSAIEnums.h:
--------------------------------------------------------------------------------
1 | #import "MSAIDependencyKind.h"
2 | #import "MSAISeverityLevel.h"
3 | #import "MSAIDataPointType.h"
4 | #import "MSAIDependencySourceType.h"
5 |
--------------------------------------------------------------------------------
/Classes/MSAILocation.h:
--------------------------------------------------------------------------------
1 | #import "MSAIObject.h"
2 |
3 | @interface MSAILocation : MSAIObject
4 |
5 | @property (nonatomic, copy) NSString *ip;
6 |
7 | @end
8 |
--------------------------------------------------------------------------------
/Support/module.modulemap:
--------------------------------------------------------------------------------
1 | framework module ApplicationInsights {
2 | umbrella header "ApplicationInsights.h"
3 |
4 | export *
5 | module * { export * }
6 | }
7 |
--------------------------------------------------------------------------------
/Support/ApplicationInsights.xcconfig:
--------------------------------------------------------------------------------
1 | OTHER_LDFLAGS=$(inherited) -framework Foundation -framework Security -framework SystemConfiguration -lz -lc++
2 | MSAI_DOCSET_NAME=ApplicationInsights
3 |
--------------------------------------------------------------------------------
/Classes/MSAIContext.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "MSAINullability.h"
3 |
4 | NS_ASSUME_NONNULL_BEGIN
5 | @interface MSAIContext : NSObject
6 |
7 | @end
8 | NS_ASSUME_NONNULL_END
9 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCMock.framework/Versions/A/OCMock:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/ApplicationInsights-OSX/HEAD/Support/ApplicationInsightsTests/OCMock.framework/Versions/A/OCMock
--------------------------------------------------------------------------------
/Classes/MSAIReachability.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "MSAINullability.h"
3 |
4 | NS_ASSUME_NONNULL_BEGIN
5 | @interface MSAIReachability : NSObject
6 |
7 | @end
8 | NS_ASSUME_NONNULL_END
9 |
--------------------------------------------------------------------------------
/Classes/MSAIEnvelopeManager.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "MSAINullability.h"
3 |
4 | NS_ASSUME_NONNULL_BEGIN
5 | @interface MSAIEnvelopeManager : NSObject
6 |
7 | @end
8 | NS_ASSUME_NONNULL_END
9 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCMockito.framework/Versions/A/OCMockito:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/ApplicationInsights-OSX/HEAD/Support/ApplicationInsightsTests/OCMockito.framework/Versions/A/OCMockito
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCHamcrest.framework/Versions/A/OCHamcrest:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/ApplicationInsights-OSX/HEAD/Support/ApplicationInsightsTests/OCHamcrest.framework/Versions/A/OCHamcrest
--------------------------------------------------------------------------------
/Classes/MSAIInternal.h:
--------------------------------------------------------------------------------
1 | #import "MSAIObject.h"
2 |
3 | @interface MSAIInternal : MSAIObject
4 |
5 | @property (nonatomic, copy) NSString *sdkVersion;
6 | @property (nonatomic, copy) NSString *agentVersion;
7 |
8 | @end
9 |
--------------------------------------------------------------------------------
/Classes/MSAITestResult.h:
--------------------------------------------------------------------------------
1 | #import
2 | /// Enum class for type TestResult.
3 | typedef NS_ENUM(NSInteger, MSAITestResult) {
4 | MSAITestResult_pass = 0,
5 |
6 | MSAITestResult_fail = 1,
7 |
8 | };
9 |
--------------------------------------------------------------------------------
/Classes/MSAISessionState.h:
--------------------------------------------------------------------------------
1 | #import
2 | /// Enum class for type SessionState.
3 | typedef NS_ENUM(NSInteger, MSAISessionState) {
4 | MSAISessionState_start = 0,
5 |
6 | MSAISessionState_end = 1,
7 |
8 | };
9 |
--------------------------------------------------------------------------------
/Classes/MSAICategoryContainer.h:
--------------------------------------------------------------------------------
1 | @import AppKit;
2 | #import "MSAINullability.h"
3 |
4 | NS_ASSUME_NONNULL_BEGIN
5 | @interface MSAICategoryContainer : NSObject
6 |
7 | + (void)activateCategory;
8 |
9 | @end
10 | NS_ASSUME_NONNULL_END
11 |
--------------------------------------------------------------------------------
/Classes/ApplicationInsightsPrivate.m:
--------------------------------------------------------------------------------
1 | #import "ApplicationInsights.h"
2 | #import "ApplicationInsightsPrivate.h"
3 |
4 | NSString *const kMSAIName = @"ApplicationInsights";
5 | NSString *const kMSAIIdentifier = @"com.microsoft.applicationinsights.ios";
6 |
7 |
--------------------------------------------------------------------------------
/Classes/MSAIDataPointType.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Enum class for type DataPointType.
3 | */
4 |
5 | typedef NS_ENUM(NSInteger, MSAIDataPointType) {
6 | MSAIDataPointType_measurement = 0,
7 |
8 | MSAIDataPointType_aggregation = 1,
9 |
10 | };
11 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCMock.framework/Versions/A/Resources/en.lproj/InfoPlist.strings:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/ApplicationInsights-OSX/HEAD/Support/ApplicationInsightsTests/OCMock.framework/Versions/A/Resources/en.lproj/InfoPlist.strings
--------------------------------------------------------------------------------
/Classes/MSAIObject.h:
--------------------------------------------------------------------------------
1 | #import
2 | @class MSAIOrderedDictionary;
3 |
4 | @interface MSAIObject : NSObject
5 |
6 | - (MSAIOrderedDictionary *)serializeToDictionary;
7 | - (NSString *)serializeToString;
8 |
9 | @end
10 |
--------------------------------------------------------------------------------
/Support/ApplicationInsights.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Classes/MSAISession.h:
--------------------------------------------------------------------------------
1 | #import "MSAIObject.h"
2 |
3 | @interface MSAISession : MSAIObject
4 |
5 | @property (nonatomic, copy) NSString *sessionId;
6 | @property (nonatomic, copy) NSString *isFirst;
7 | @property (nonatomic, copy) NSString *isNew;
8 |
9 | @end
10 |
--------------------------------------------------------------------------------
/Classes/MSAIDependencyKind.h:
--------------------------------------------------------------------------------
1 | #import
2 | /// Enum class for type DependencyKind.
3 | typedef NS_ENUM(NSInteger, MSAIDependencyKind) {
4 | MSAIDependencyKind_s_q_l = 0,
5 |
6 | MSAIDependencyKind_http = 1,
7 |
8 | MSAIDependencyKind_other = 2,
9 |
10 | };
11 |
--------------------------------------------------------------------------------
/Classes/MSAIDependencySourceType.h:
--------------------------------------------------------------------------------
1 | /// Enum class for type DependencySourceType.
2 | typedef NS_ENUM(NSInteger, MSAIDependencySourceType) {
3 | MSAIDependencySourceType_undefined = 0,
4 |
5 | MSAIDependencySourceType_aic = 1,
6 |
7 | MSAIDependencySourceType_apmc = 2,
8 |
9 | };
10 |
--------------------------------------------------------------------------------
/Classes/MSAIData.h:
--------------------------------------------------------------------------------
1 | #import "MSAIBase.h"
2 | @class MSAITelemetryData;
3 |
4 | @interface MSAIData : MSAIBase
5 |
6 | @property (nonatomic, strong) MSAITelemetryData *baseData;
7 |
8 | - (instancetype)initWithCoder:(NSCoder *)coder;
9 |
10 | - (void)encodeWithCoder:(NSCoder *)coder;
11 |
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/Classes/MSAIMetricData.h:
--------------------------------------------------------------------------------
1 | #import "MSAIDomain.h"
2 |
3 | @interface MSAIMetricData : MSAIDomain
4 |
5 | @property(nonatomic, copy, readonly)NSString *envelopeTypeName;
6 | @property(nonatomic, copy, readonly)NSString *dataTypeName;
7 | @property (nonatomic, strong) NSMutableArray *metrics;
8 |
9 | @end
10 |
--------------------------------------------------------------------------------
/Classes/MSAIEventData.h:
--------------------------------------------------------------------------------
1 | #import "MSAIDomain.h"
2 |
3 | @interface MSAIEventData : MSAIDomain
4 |
5 | @property (nonatomic, copy, readonly) NSString *envelopeTypeName;
6 | @property (nonatomic, copy, readonly) NSString *dataTypeName;
7 | @property (nonatomic, strong) NSDictionary *measurements;
8 |
9 | @end
10 |
--------------------------------------------------------------------------------
/Support/buildnumber.xcconfig:
--------------------------------------------------------------------------------
1 | #include "ApplicationInsights.xcconfig"
2 |
3 | BUILD_NUMBER = 8
4 | VERSION_STRING = 1.0-beta.2
5 | GCC_PREPROCESSOR_DEFINITIONS = MSAI_VERSION="@\""$(VERSION_STRING)"\"" MSAI_BUILD="@\""$(BUILD_NUMBER)"\"" MSAI_C_VERSION="\""$(VERSION_STRING)"\"" MSAI_C_BUILD="\""$(BUILD_NUMBER)"\"" $(XCODEBUILD_GCC_PREPROCESSOR_DEFINITIONS)
6 |
--------------------------------------------------------------------------------
/Classes/MSAIBase.h:
--------------------------------------------------------------------------------
1 | #import "MSAIObject.h"
2 | #import "MSAITelemetryData.h"
3 | #import "MSAIDomain.h"
4 |
5 | @interface MSAIBase : MSAITelemetryData
6 |
7 | @property (nonatomic, copy) NSString *baseType;
8 |
9 | - (instancetype)initWithCoder:(NSCoder *)coder;
10 |
11 | - (void)encodeWithCoder:(NSCoder *)coder;
12 |
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/Classes/MSAISessionStateData.h:
--------------------------------------------------------------------------------
1 | #import "MSAIDomain.h"
2 | #import "MSAISessionState.h"
3 |
4 | @interface MSAISessionStateData : MSAIDomain
5 |
6 | @property (nonatomic, copy, readonly) NSString *envelopeTypeName;
7 | @property (nonatomic, copy, readonly) NSString *dataTypeName;
8 | @property (nonatomic, assign) MSAISessionState state;
9 |
10 | @end
11 |
--------------------------------------------------------------------------------
/Classes/MSAISeverityLevel.h:
--------------------------------------------------------------------------------
1 | /// Enum class for type SeverityLevel.
2 | typedef NS_ENUM(NSInteger, MSAISeverityLevel) {
3 | MSAISeverityLevel_verbose = 0,
4 |
5 | MSAISeverityLevel_information = 1,
6 |
7 | MSAISeverityLevel_warning = 2,
8 |
9 | MSAISeverityLevel_error = 3,
10 |
11 | MSAISeverityLevel_critical = 4,
12 |
13 | };
14 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/MSAITestHelper.h:
--------------------------------------------------------------------------------
1 | #import "ApplicationInsights.h"
2 |
3 | NS_ASSUME_NONNULL_BEGIN
4 | extern NSString *const kMSAIDummyInstrumentationKey;
5 |
6 | @interface MSAITestHelper : NSObject
7 |
8 | + (NSString *)jsonFixture:(NSString *)fixture;
9 | + (BOOL)createTempDirectory:(NSString *)directory;
10 |
11 | @end
12 | NS_ASSUME_NONNULL_END
13 |
--------------------------------------------------------------------------------
/Classes/ApplicationInsightsFeatureConfig.h:
--------------------------------------------------------------------------------
1 | #ifndef MSAI_FeatureConfig_h
2 | #define MSAI_FeatureConfig_h
3 |
4 | /**
5 | * If true, include support for gathering telemetry
6 | *
7 | * _Default_: Enabled
8 | */
9 | #ifndef MSAI_FEATURE_TELEMETRY
10 | # define MSAI_FEATURE_TELEMETRY 1
11 | #endif /* MSAI_FEATURE_TELEMETRY */
12 |
13 |
14 | #endif /* MSAI_FeatureConfig_h */
15 |
--------------------------------------------------------------------------------
/Classes/MSAIApplication.h:
--------------------------------------------------------------------------------
1 | #import "MSAIObject.h"
2 |
3 | @interface MSAIApplication : MSAIObject
4 |
5 | @property (nonatomic, copy) NSString *version;
6 | @property (nonatomic, copy) NSString *build;
7 | @property (nonatomic, copy) NSString *typeId;
8 |
9 | - (instancetype)initWithCoder:(NSCoder *)coder;
10 | - (void)encodeWithCoder:(NSCoder *)coder;
11 |
12 | @end
13 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCMockito.framework/Versions/A/Headers/MKTArgumentCaptor.h:
--------------------------------------------------------------------------------
1 | // OCMockito by Jon Reid, http://qualitycoding.org/about/
2 | // Copyright 2015 Jonathan M. Reid. See LICENSE.txt
3 |
4 | #import
5 |
6 |
7 | @interface MKTArgumentCaptor : NSObject
8 |
9 | - (id)capture;
10 | - (id)value;
11 | - (NSArray *)allValues;
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/Classes/MSAITelemetryContext.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "MSAINullability.h"
3 |
4 | FOUNDATION_EXPORT NSString *const kMSAIApplicationWasLaunched;
5 |
6 | NS_ASSUME_NONNULL_BEGIN
7 | /**
8 | * Context object which contains information about the device, user, session etc.
9 | */
10 | @interface MSAITelemetryContext : NSObject
11 |
12 | @end
13 | NS_ASSUME_NONNULL_END
14 |
--------------------------------------------------------------------------------
/Classes/MSAIContextHelper.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "MSAINullability.h"
3 |
4 | NS_ASSUME_NONNULL_BEGIN
5 | /**
6 | * A helper class that allows to persist and retrieve session IDs attached to different timestamps.
7 | */
8 | @interface MSAIContextHelper : NSObject
9 |
10 | @property NSUInteger appBackgroundTimeBeforeSessionExpires;
11 |
12 | @end
13 | NS_ASSUME_NONNULL_END
14 |
--------------------------------------------------------------------------------
/Classes/MSAIMessageData.h:
--------------------------------------------------------------------------------
1 | #import "MSAIDomain.h"
2 | #import "MSAIEnums.h"
3 |
4 | @interface MSAIMessageData : MSAIDomain
5 |
6 | @property(nonatomic, copy, readonly)NSString *envelopeTypeName;
7 | @property(nonatomic, copy, readonly)NSString *dataTypeName;
8 | @property (nonatomic, copy) NSString *message;
9 | @property (nonatomic, assign) MSAISeverityLevel severityLevel;
10 |
11 | @end
12 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCHamcrest.framework/Versions/A/Headers/HCRequireNonNilObject.h:
--------------------------------------------------------------------------------
1 | // OCHamcrest by Jon Reid, http://qualitycoding.org/about/
2 | // Copyright 2014 hamcrest.org. See LICENSE.txt
3 |
4 | #import
5 |
6 |
7 | /**
8 | Throws an NSException if @a obj is @c nil.
9 |
10 | @ingroup helpers
11 | */
12 | FOUNDATION_EXPORT void HCRequireNonNilObject(id obj);
13 |
--------------------------------------------------------------------------------
/Classes/MSAIChannel.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "MSAINullability.h"
3 |
4 | NS_ASSUME_NONNULL_BEGIN
5 |
6 | FOUNDATION_EXPORT char *MSAISafeJsonEventsString;
7 |
8 | /**
9 | * Prepares telemetry data and forwards it to the persistence layer. Once data has been persisted it will be sent by the sender automatically.
10 | */
11 | @interface MSAIChannel : NSObject
12 |
13 | @end
14 | NS_ASSUME_NONNULL_END
15 |
--------------------------------------------------------------------------------
/Classes/MSAIOrderedDictionary.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "MSAINullability.h"
3 |
4 | NS_ASSUME_NONNULL_BEGIN
5 | @interface MSAIOrderedDictionary : NSMutableDictionary {
6 | NSMutableDictionary *dictionary;
7 | NSMutableArray *order;
8 | }
9 |
10 | - (instancetype)initWithCapacity:(NSUInteger)numItems;
11 | - (void)setObject:(id)anObject forKey:(id)aKey;
12 |
13 | @end
14 | NS_ASSUME_NONNULL_END
15 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCHamcrest.framework/Versions/A/Headers/HCClassMatcher.h:
--------------------------------------------------------------------------------
1 | // OCHamcrest by Jon Reid, http://qualitycoding.org/about/
2 | // Copyright 2014 hamcrest.org. See LICENSE.txt
3 |
4 | #import
5 |
6 |
7 | @interface HCClassMatcher : HCBaseMatcher
8 |
9 | @property (readonly, nonatomic, strong) Class theClass;
10 |
11 | - (instancetype)initWithType:(Class)type;
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/Classes/MSAIOperation.h:
--------------------------------------------------------------------------------
1 | #import "MSAIObject.h"
2 |
3 | @interface MSAIOperation : MSAIObject
4 |
5 | @property (nonatomic, copy) NSString *operationId;
6 | @property (nonatomic, copy) NSString *name;
7 | @property (nonatomic, copy) NSString *parentId;
8 | @property (nonatomic, copy) NSString *rootId;
9 | @property (nonatomic, copy) NSString *syntheticSource;
10 | @property (nonatomic, copy) NSString *isSynthetic;
11 |
12 | @end
13 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCMockito.framework/Versions/A/Headers/MKTBaseMockObject.h:
--------------------------------------------------------------------------------
1 | // OCMockito by Jon Reid, http://qualitycoding.org/about/
2 | // Copyright 2015 Jonathan M. Reid. See LICENSE.txt
3 |
4 | #import
5 | #import "MKTPrimitiveArgumentMatching.h"
6 |
7 |
8 | @interface MKTBaseMockObject : NSProxy
9 |
10 | - (instancetype)init;
11 | - (void)reset;
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCMockito.framework/Versions/A/Headers/NSInvocation+OCMockito.h:
--------------------------------------------------------------------------------
1 | // OCMockito by Jon Reid, http://qualitycoding.org/about/
2 | // Copyright 2015 Jonathan M. Reid. See LICENSE.txt
3 |
4 | #import
5 |
6 | @interface NSInvocation (OCMockito)
7 |
8 | - (NSArray *)mkt_arguments;
9 | - (void)mkt_setReturnValue:(id)returnValue;
10 | - (void)mkt_retainArgumentsWithWeakTarget;
11 |
12 | @end
13 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/MSAIDomainTests.m:
--------------------------------------------------------------------------------
1 | #import
2 | #import "MSAIDomain.h"
3 |
4 | @interface MSAIDomainTests : XCTestCase
5 |
6 | @end
7 |
8 | @implementation MSAIDomainTests
9 |
10 | - (void)testSerialize {
11 | MSAIDomain *item = [MSAIDomain new];
12 | NSString *actual = [item serializeToString];
13 | NSString *expected = @"{}";
14 | XCTAssertTrue([actual isEqualToString:expected]);
15 | }
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCHamcrest.framework/Versions/A/Headers/HCSubstringMatcher.h:
--------------------------------------------------------------------------------
1 | // OCHamcrest by Jon Reid, http://qualitycoding.org/about/
2 | // Copyright 2014 hamcrest.org. See LICENSE.txt
3 |
4 | #import
5 |
6 |
7 | @interface HCSubstringMatcher : HCBaseMatcher
8 |
9 | @property (readonly, nonatomic, copy) NSString *substring;
10 |
11 | - (instancetype)initWithSubstring:(NSString *)aString;
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCMockito.framework/Versions/A/Headers/MKTObjectMock.h:
--------------------------------------------------------------------------------
1 | // OCMockito by Jon Reid, http://qualitycoding.org/about/
2 | // Copyright 2015 Jonathan M. Reid. See LICENSE.txt
3 |
4 | #import "MKTBaseMockObject.h"
5 |
6 |
7 | /**
8 | Mock object of a given class.
9 | */
10 | @interface MKTObjectMock : MKTBaseMockObject
11 |
12 | + (instancetype)mockForClass:(Class)aClass;
13 | - (instancetype)initWithClass:(Class)aClass;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/Classes/MSAIPageViewData.h:
--------------------------------------------------------------------------------
1 | #import "MSAIEventData.h"
2 |
3 | @interface MSAIPageViewData : MSAIEventData
4 |
5 | @property(nonatomic, copy, readonly)NSString *envelopeTypeName;
6 | @property(nonatomic, copy, readonly)NSString *dataTypeName;
7 | @property (nonatomic, copy) NSString *url;
8 | @property (nonatomic, copy) NSString *duration;
9 | @property (nonatomic, copy) NSString *referrer;
10 | @property (nonatomic, copy) NSString *referrerData;
11 |
12 | @end
13 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCHamcrest.framework/Versions/A/Headers/HCTestFailureHandlerChain.h:
--------------------------------------------------------------------------------
1 | // OCHamcrest by Jon Reid, http://qualitycoding.org/about/
2 | // Copyright 2014 hamcrest.org. See LICENSE.txt
3 |
4 | #import
5 |
6 | @class HCTestFailureHandler;
7 |
8 |
9 | /**
10 | Returns chain of test failure handlers.
11 |
12 | @ingroup integration
13 | */
14 | FOUNDATION_EXPORT HCTestFailureHandler *HC_testFailureHandlerChain(void);
15 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: objective-c
2 | osx_image: xcode7.2
3 |
4 | before_install:
5 | - xcrun simctl list
6 | - gem install cocoapods --no-rdoc --no-ri --no-document --quiet
7 | - gem install xcpretty --no-rdoc --no-ri --no-document --quiet
8 |
9 | script:
10 | - set -o pipefail
11 | - xcodebuild -project Support/ApplicationInsights.xcodeproj -scheme ApplicationInsightsOSX -configuration Release -destination "platform=OS X" XCODEBUILD_GCC_PREPROCESSOR_DEFINITIONS="CI=1" test | xcpretty -c
--------------------------------------------------------------------------------
/Classes/MSAITelemetryData.h:
--------------------------------------------------------------------------------
1 | #import "MSAIObject.h"
2 |
3 | ///Data contract class for type MSAITelemetryData.
4 | @interface MSAITelemetryData : MSAIObject
5 |
6 | @property (nonatomic, readonly, copy) NSString *envelopeTypeName;
7 | @property (nonatomic, readonly, copy) NSString *dataTypeName;
8 |
9 | @property (nonatomic, copy) NSNumber *version;
10 | @property (nonatomic, copy) NSString *name;
11 | @property (nonatomic, strong) NSDictionary *properties;
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/Classes/MSAISender.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "MSAINullability.h"
3 |
4 | NS_ASSUME_NONNULL_BEGIN
5 | /**
6 | * Utility class that's responsible for sending a bundle of data to the server
7 | */
8 | @interface MSAISender : NSObject
9 |
10 | /**
11 | * Triggers sending the saved data. Does nothing if nothing has been persisted, yet. This method should be called by MSAITelemetryManager on app start.
12 | */
13 | - (void)sendSavedData;
14 |
15 | @end
16 | NS_ASSUME_NONNULL_END
17 |
--------------------------------------------------------------------------------
/Classes/MSAIApplicationInsightsPrivate.h:
--------------------------------------------------------------------------------
1 | #import "MSAIApplicationInsights.h"
2 |
3 | NS_ASSUME_NONNULL_BEGIN
4 | @interface MSAIApplicationInsights ()
5 |
6 | /**
7 | * Checks whether Instrumentation Key is plausible.
8 | *
9 | * @param instrumentationKey the Instrumentation Key which should be tested
10 | *
11 | * @return YES if Instrumentation Key conforms to length and charset
12 | */
13 | - (BOOL)checkValidityOfInstrumentationKey:(NSString *)instrumentationKey;
14 |
15 | @end
16 | NS_ASSUME_NONNULL_END
17 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCMockito.framework/Versions/A/Headers/MKTClassObjectMock.h:
--------------------------------------------------------------------------------
1 | // OCMockito by Jon Reid, http://qualitycoding.org/about/
2 | // Copyright 2015 Jonathan M. Reid. See LICENSE.txt
3 | // Contribution by David Hart
4 |
5 | #import "MKTBaseMockObject.h"
6 |
7 |
8 | /**
9 | Mock object of a given class object.
10 | */
11 | @interface MKTClassObjectMock : MKTBaseMockObject
12 |
13 | + (instancetype)mockForClass:(Class)aClass;
14 | - (instancetype)initWithClass:(Class)aClass;
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/Classes/MSAIPageViewPerfData.h:
--------------------------------------------------------------------------------
1 | #import "MSAIPageViewData.h"
2 |
3 | @interface MSAIPageViewPerfData : MSAIPageViewData
4 |
5 | @property(nonatomic, copy, readonly)NSString *envelopeTypeName;
6 | @property(nonatomic, copy, readonly)NSString *dataTypeName;
7 | @property (nonatomic, copy) NSString *perfTotal;
8 | @property (nonatomic, copy) NSString *networkConnect;
9 | @property (nonatomic, copy) NSString *sentRequest;
10 | @property (nonatomic, copy) NSString *receivedResponse;
11 | @property (nonatomic, copy) NSString *domProcessing;
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/MSAITestsDependencyInjection.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | #import
4 |
5 | #define HC_SHORTHAND
6 | #import
7 |
8 | #define MOCKITO_SHORTHAND
9 | #import
10 |
11 | @interface MSAITestsDependencyInjection : XCTestCase
12 |
13 | - (void)setMockNotificationCenter:(id)mockNotificationCenter;
14 | - (id)mockNotificationCenter;
15 |
16 | - (void)setMockUserDefaults:(NSUserDefaults *)userDefaults;
17 | - (NSUserDefaults *)mockUserDefaults;
18 |
19 | @end
20 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCHamcrest.framework/Versions/A/Headers/HCWrapInMatcher.h:
--------------------------------------------------------------------------------
1 | // OCHamcrest by Jon Reid, http://qualitycoding.org/about/
2 | // Copyright 2014 hamcrest.org. See LICENSE.txt
3 |
4 | #import
5 |
6 | @protocol HCMatcher;
7 |
8 |
9 | /**
10 | Wraps argument in a matcher, if necessary.
11 |
12 | @return The argument as-if if it is already a matcher, otherwise wrapped in an @ref equalTo matcher.
13 |
14 | @ingroup helpers
15 | */
16 | FOUNDATION_EXPORT id HCWrapInMatcher(id matcherOrValue);
17 |
--------------------------------------------------------------------------------
/Classes/MSAIUser.h:
--------------------------------------------------------------------------------
1 | #import "MSAIObject.h"
2 |
3 | @interface MSAIUser : MSAIObject
4 |
5 | @property (nonatomic, copy) NSString *accountAcquisitionDate;
6 | @property (nonatomic, copy) NSString *accountId;
7 | @property (nonatomic, copy) NSString *userAgent;
8 | @property (nonatomic, copy) NSString *userId;
9 | @property (nonatomic, copy) NSString *storeRegion;
10 | @property (nonatomic, copy) NSString *authUserId;
11 | @property (nonatomic, copy) NSString *anonUserAcquisitionDate;
12 | @property (nonatomic, copy) NSString *authUserAcquisitionDate;
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/Classes/MSAIDataPoint.h:
--------------------------------------------------------------------------------
1 | #import "MSAIObject.h"
2 | #import "MSAIDataPointType.h"
3 |
4 | @interface MSAIDataPoint : MSAIObject
5 |
6 | @property (nonatomic, copy) NSString *name;
7 | @property (nonatomic, assign) MSAIDataPointType kind;
8 | @property (nonatomic, copy) NSNumber *value;
9 | @property (nonatomic, copy) NSNumber *count;
10 | @property (nonatomic, copy) NSNumber *min;
11 | @property (nonatomic, copy) NSNumber *max;
12 | @property (nonatomic, copy) NSNumber *stdDev;
13 |
14 | - (instancetype)initWithCoder:(NSCoder *)coder;
15 |
16 | - (void)encodeWithCoder:(NSCoder *)coder;
17 |
18 |
19 | @end
20 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCMockito.framework/Versions/A/Headers/MKTObjectAndProtocolMock.h:
--------------------------------------------------------------------------------
1 | // OCMockito by Jon Reid, http://qualitycoding.org/about/
2 | // Copyright 2015 Jonathan M. Reid. See LICENSE.txt
3 | // Contribution by Kevin Lundberg
4 |
5 | #import "MKTProtocolMock.h"
6 |
7 |
8 | /**
9 | Mock object of a given class that also implements a given protocol.
10 | */
11 | @interface MKTObjectAndProtocolMock : MKTProtocolMock
12 |
13 | + (instancetype)mockForClass:(Class)aClass protocol:(Protocol *)protocol;
14 | - (instancetype)initWithClass:(Class)aClass protocol:(Protocol *)protocol;
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/Classes/MSAIContextPrivate.h:
--------------------------------------------------------------------------------
1 | #import "MSAIContext.h"
2 |
3 | NS_ASSUME_NONNULL_BEGIN
4 | @interface MSAIContext()
5 |
6 | @property (nonatomic, copy, readonly) NSString *instrumentationKey;
7 | @property (nonatomic, copy, readonly) NSString *osVersion;
8 | @property (nonatomic, copy, readonly) NSString *osName;
9 | @property (nonatomic, copy, readonly) NSString *deviceType;
10 | @property (nonatomic, copy, readonly) NSString *deviceModel;
11 | @property (nonatomic, copy, readonly) NSString *appVersion;
12 |
13 | - (instancetype)initWithInstrumentationKey:(NSString *)instrumentationKey;
14 |
15 | @end
16 | NS_ASSUME_NONNULL_END
17 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCHamcrest.framework/Versions/A/Headers/HCTestFailureHandler.h:
--------------------------------------------------------------------------------
1 | // OCHamcrest by Jon Reid, http://qualitycoding.org/about/
2 | // Copyright 2014 hamcrest.org. See LICENSE.txt
3 |
4 | #import
5 |
6 | @class HCTestFailure;
7 |
8 |
9 | /**
10 | Chain-of-responsibility for handling test failures.
11 |
12 | @ingroup integration
13 | */
14 | @interface HCTestFailureHandler : NSObject
15 |
16 | - (instancetype)initWithSuccessor:(HCTestFailureHandler *)successor;
17 |
18 | /**
19 | Handle test failure at specific location, or pass to successor.
20 | */
21 | - (void)handleFailure:(HCTestFailure *)failure;
22 |
23 | @end
24 |
--------------------------------------------------------------------------------
/Classes/MSAIRequestData.h:
--------------------------------------------------------------------------------
1 | #import "MSAIDomain.h"
2 |
3 | @interface MSAIRequestData : MSAIDomain
4 |
5 | @property(nonatomic, copy, readonly)NSString *envelopeTypeName;
6 | @property(nonatomic, copy, readonly)NSString *dataTypeName;
7 | @property (nonatomic, copy) NSString *requestDataId;
8 | @property (nonatomic, copy) NSString *startTime;
9 | @property (nonatomic, copy) NSString *duration;
10 | @property (nonatomic, copy) NSString *responseCode;
11 | @property (nonatomic, assign) BOOL success;
12 | @property (nonatomic, copy) NSString *httpMethod;
13 | @property (nonatomic, copy) NSString *url;
14 | @property (nonatomic, strong) MSAIOrderedDictionary *measurements;
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/ApplicationInsightsTests-Prefix.pch:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #import
4 | #endif
5 |
6 | #if !__has_feature(nullability)
7 | #define NS_ASSUME_NONNULL_BEGIN
8 | #define NS_ASSUME_NONNULL_END
9 | #define nullable
10 | #define nonnull
11 | #define null_unspecified
12 | #define null_resettable
13 | #define __nullable
14 | #define __nonnull
15 | #define __null_unspecified
16 | #endif
17 |
18 | #ifndef NS_ASSUME_NONNULL_BEGIN
19 | #define NS_ASSUME_NONNULL_BEGIN _Pragma("clang assume_nonnull begin")
20 | #endif
21 | #ifndef NS_ASSUME_NONNULL_END
22 | #define NS_ASSUME_NONNULL_END _Pragma("clang assume_nonnull end")
23 | #endif
24 |
--------------------------------------------------------------------------------
/Classes/MSAIAvailabilityData.h:
--------------------------------------------------------------------------------
1 | #import "MSAITestResult.h"
2 | #import "MSAIObject.h"
3 | #import "MSAITelemetryData.h"
4 | #import "MSAIDomain.h"
5 |
6 | @interface MSAIAvailabilityData : MSAIDomain
7 |
8 | @property (nonatomic, copy) NSString *testRunId;
9 | @property (nonatomic, copy) NSString *testTimeStamp;
10 | @property (nonatomic, copy) NSString *testName;
11 | @property (nonatomic, copy) NSString *duration;
12 | @property (nonatomic, strong) MSAITestResult *result;
13 | @property (nonatomic, copy) NSString *runLocation;
14 | @property (nonatomic, copy) NSString *message;
15 | @property (nonatomic, copy) NSNumber *dataSize;
16 | @property (nonatomic, strong) NSDictionary *measurements;
17 |
18 | @end
19 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCHamcrest.framework/Versions/A/Headers/HCBaseDescription.h:
--------------------------------------------------------------------------------
1 | // OCHamcrest by Jon Reid, http://qualitycoding.org/about/
2 | // Copyright 2014 hamcrest.org. See LICENSE.txt
3 |
4 | #import
5 | #import
6 |
7 |
8 | /**
9 | Base class for all HCDescription implementations.
10 |
11 | @ingroup core
12 | */
13 | @interface HCBaseDescription : NSObject
14 | @end
15 |
16 |
17 | /**
18 | Methods that must be provided by subclasses of HCBaseDescription.
19 | */
20 | @interface HCBaseDescription (SubclassResponsibility)
21 |
22 | /**
23 | Append the string @a str to the description.
24 | */
25 | - (void)append:(NSString *)str;
26 |
27 | @end
28 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCHamcrest.framework/Versions/A/Headers/HCDiagnosingMatcher.h:
--------------------------------------------------------------------------------
1 | // OCHamcrest by Jon Reid, http://qualitycoding.org/about/
2 | // Copyright 2014 hamcrest.org. See LICENSE.txt
3 |
4 | #import
5 |
6 |
7 | /**
8 | Base class for matchers that generate mismatch descriptions during the matching.
9 |
10 | Some matching algorithms have several "no match" paths. It helps to make the mismatch description
11 | as precise as possible, but we don't want to have to repeat the matching logic to do so. For such
12 | matchers, subclass HCDiagnosingMatcher and implement -matches:describingMismatchTo:.
13 |
14 | @ingroup core
15 | */
16 | @interface HCDiagnosingMatcher : HCBaseMatcher
17 | @end
18 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Xcode
2 | #
3 | build/
4 | *.pbxuser
5 | !default.pbxuser
6 | *.mode1v3
7 | !default.mode1v3
8 | *.mode2v3
9 | !default.mode2v3
10 | *.perspectivev3
11 | !default.perspectivev3
12 | xcuserdata
13 | *.xccheckout
14 | *.moved-aside
15 | DerivedData
16 | *.hmap
17 | *.ipa
18 | *.xcuserstate
19 |
20 | # CocoaPods
21 | #
22 | # We recommend against adding the Pods directory to your .gitignore. However
23 | # you should judge for yourself, the pros and cons are mentioned at:
24 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control
25 | #
26 | #Pods/
27 |
28 | # osx noise
29 | .DS_Store
30 | *.ipa
31 | *.swp
32 | *~.nib
33 | profile
34 |
35 | # App Code
36 | **/.idea/
37 | **/.idea/**
38 |
39 | documentation/
40 | Products/
41 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCMockito.framework/Versions/A/Headers/MKTProtocolMock.h:
--------------------------------------------------------------------------------
1 | // OCMockito by Jon Reid, http://qualitycoding.org/about/
2 | // Copyright 2015 Jonathan M. Reid. See LICENSE.txt
3 |
4 | #import "MKTBaseMockObject.h"
5 |
6 |
7 | /**
8 | Mock object implementing a given protocol.
9 | */
10 | @interface MKTProtocolMock : MKTBaseMockObject
11 |
12 | @property (readonly, nonatomic, strong) Protocol *mockedProtocol;
13 |
14 | + (instancetype)mockForProtocol:(Protocol *)aProtocol;
15 | + (instancetype)mockForProtocol:(Protocol *)aProtocol includeOptionalMethods:(BOOL)includeOptionalMethods;
16 |
17 | - (instancetype)initWithProtocol:(Protocol *)aProtocol;
18 | - (instancetype)initWithProtocol:(Protocol *)aProtocol includeOptionalMethods:(BOOL)includeOptionalMethods;
19 |
20 | @end
21 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCHamcrest.framework/Versions/A/Headers/HCSelfDescribing.h:
--------------------------------------------------------------------------------
1 | // OCHamcrest by Jon Reid, http://qualitycoding.org/about/
2 | // Copyright 2014 hamcrest.org. See LICENSE.txt
3 |
4 | #import
5 |
6 | #import "HCDescription.h" // Convenience header
7 |
8 |
9 | /**
10 | The ability of an object to describe itself.
11 |
12 | @ingroup core
13 | */
14 | @protocol HCSelfDescribing
15 |
16 | /**
17 | Generates a description of the object.
18 |
19 | The description may be part of a description of a larger object of which this is just a
20 | component, so it should be worded appropriately.
21 |
22 | @param description The description to be built or appended to.
23 | */
24 | - (void)describeTo:(id)description;
25 |
26 | @end
27 |
--------------------------------------------------------------------------------
/Classes/MSAINullability.h:
--------------------------------------------------------------------------------
1 | #ifndef ApplicationInsights_MSAINullability_h
2 | #define ApplicationInsights_MSAINullability_h
3 |
4 | // Define nullability fallback for backwards compatibility
5 | #if !__has_feature(nullability)
6 | #define NS_ASSUME_NONNULL_BEGIN
7 | #define NS_ASSUME_NONNULL_END
8 | #define nullable
9 | #define nonnull
10 | #define null_unspecified
11 | #define null_resettable
12 | #define __nullable
13 | #define __nonnull
14 | #define __null_unspecified
15 | #endif
16 |
17 | // Fallback for convenience syntax which might not be available in older SDKs
18 | #ifndef NS_ASSUME_NONNULL_BEGIN
19 | #define NS_ASSUME_NONNULL_BEGIN _Pragma("clang assume_nonnull begin")
20 | #endif
21 | #ifndef NS_ASSUME_NONNULL_END
22 | #define NS_ASSUME_NONNULL_END _Pragma("clang assume_nonnull end")
23 | #endif
24 |
25 | #endif
26 |
--------------------------------------------------------------------------------
/Classes/MSAIContext.m:
--------------------------------------------------------------------------------
1 | #import "MSAIContext.h"
2 | #import "MSAIContextPrivate.h"
3 | #import "MSAIHelper.h"
4 |
5 | @implementation MSAIContext
6 |
7 | @synthesize osVersion = _osVersion;
8 | @synthesize osName = _osName;
9 | @synthesize instrumentationKey = _instrumentationKey;
10 | @synthesize deviceModel = _deviceModel;
11 | @synthesize deviceType = _deviceType;
12 | @synthesize appVersion = _appVersion;
13 |
14 | - (instancetype)initWithInstrumentationKey:(NSString *)instrumentationKey {
15 |
16 | if ((self = [self init])) {
17 | _instrumentationKey = instrumentationKey;
18 | _deviceModel = msai_devicePlatform();
19 | _deviceType = msai_deviceType();
20 | _osName = msai_osName();
21 | _osVersion = msai_osVersionBuild();
22 | _appVersion = msai_appVersion();
23 | }
24 | return self;
25 | }
26 | @end
27 |
--------------------------------------------------------------------------------
/Classes/ApplicationInsights.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | //! Project version number for ApplicationInsights.
4 | FOUNDATION_EXPORT double ApplicationInsightsVersionNumber;
5 |
6 | //! Project version string for ApplicationInsights.
7 | FOUNDATION_EXPORT const unsigned char ApplicationInsightsVersionString[];
8 |
9 | #import "ApplicationInsightsFeatureConfig.h"
10 | #import "MSAINullability.h"
11 | #import "MSAIApplicationInsights.h"
12 |
13 | #if MSAI_FEATURE_TELEMETRY
14 | #import "MSAITelemetryManager.h"
15 | #endif /* MSAI_FEATURE_TELEMETRY */
16 |
17 | // Notification message which MSAIApplicationInsights is listening to, to retry requesting updated from the server
18 | #define MSAINetworkDidBecomeReachableNotification @"MSAINetworkDidBecomeReachable"
19 |
20 | #define MSAI_SERVER_URL @"https://dc.services.visualstudio.com/v2/track"
21 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCHamcrest.framework/Versions/A/Headers/HCIsEmptyCollection.h:
--------------------------------------------------------------------------------
1 | // OCHamcrest by Jon Reid, http://qualitycoding.org/about/
2 | // Copyright 2014 hamcrest.org. See LICENSE.txt
3 |
4 | #import
5 |
6 |
7 | @interface HCIsEmptyCollection : HCHasCount
8 |
9 | + (instancetype)isEmptyCollection;
10 | - (instancetype)init;
11 |
12 | @end
13 |
14 |
15 | FOUNDATION_EXPORT id HC_isEmpty(void);
16 |
17 | /**
18 | Matches empty collection.
19 |
20 | This matcher invokes @c -count on the evaluated object to determine if the number of elements it
21 | contains is zero.
22 |
23 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
24 | @c HC_isEmpty instead.)
25 |
26 | @ingroup collection_matchers
27 | */
28 | #ifdef HC_SHORTHAND
29 | #define isEmpty() HC_isEmpty()
30 | #endif
31 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCHamcrest.framework/Versions/A/Headers/HCTestFailure.h:
--------------------------------------------------------------------------------
1 | // OCHamcrest by Jon Reid, http://qualitycoding.org/about/
2 | // Copyright 2014 hamcrest.org. See LICENSE.txt
3 |
4 | #import
5 |
6 |
7 | /**
8 | Test failure location and reason.
9 |
10 | @ingroup integration
11 | */
12 | @interface HCTestFailure : NSObject
13 |
14 | @property (readonly, nonatomic, strong) id testCase;
15 | @property (readonly, nonatomic, copy) NSString *fileName;
16 | @property (readonly, nonatomic, assign) NSUInteger lineNumber;
17 | @property (readonly, nonatomic, strong) NSString *reason;
18 |
19 | - (instancetype)initWithTestCase:(id)testCase
20 | fileName:(NSString *)fileName
21 | lineNumber:(NSUInteger)lineNumber
22 | reason:(NSString *)reason;
23 |
24 | @end
25 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/ApplicationInsightsTests-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCHamcrest.framework/Versions/A/Headers/HCBaseMatcher.h:
--------------------------------------------------------------------------------
1 | // OCHamcrest by Jon Reid, http://qualitycoding.org/about/
2 | // Copyright 2014 hamcrest.org. See LICENSE.txt
3 |
4 | #import
5 | #import
6 |
7 | #define HC_ABSTRACT_METHOD [self subclassResponsibility:_cmd]
8 |
9 |
10 | /**
11 | Base class for all HCMatcher implementations.
12 |
13 | Simple matchers can just subclass HCBaseMatcher and implement @c -matches: and @c -describeTo:. But
14 | if the matching algorithm has several "no match" paths, consider subclassing HCDiagnosingMatcher
15 | instead.
16 |
17 | @ingroup core
18 | */
19 | @interface HCBaseMatcher : NSObject
20 |
21 | /// Raises exception that command (a pseudo-abstract method) is not implemented.
22 | - (void)subclassResponsibility:(SEL)command;
23 |
24 | @end
25 |
--------------------------------------------------------------------------------
/Classes/MSAIEnvelope.h:
--------------------------------------------------------------------------------
1 | #import "MSAIObject.h"
2 | @class MSAIBase;
3 |
4 | @interface MSAIEnvelope : MSAIObject
5 |
6 | @property (nonatomic, copy) NSNumber *version;
7 | @property (nonatomic, copy) NSString *name;
8 | @property (nonatomic, copy) NSString *time;
9 | @property (nonatomic, copy) NSNumber *sampleRate;
10 | @property (nonatomic, copy) NSString *seq;
11 | @property (nonatomic, copy) NSString *iKey;
12 | @property (nonatomic, copy) NSNumber *flags;
13 | @property (nonatomic, copy) NSString *deviceId;
14 | @property (nonatomic, copy) NSString *os;
15 | @property (nonatomic, copy) NSString *osVer;
16 | @property (nonatomic, copy) NSString *appId;
17 | @property (nonatomic, copy) NSString *appVer;
18 | @property (nonatomic, copy) NSString *userId;
19 | @property (nonatomic, strong) MSAIOrderedDictionary *tags;
20 | @property (nonatomic, strong) MSAIBase *data;
21 |
22 |
23 | @end
24 |
--------------------------------------------------------------------------------
/Classes/MSAILocation.m:
--------------------------------------------------------------------------------
1 | #import "MSAILocation.h"
2 | #import "MSAIOrderedDictionary.h"
3 |
4 | /// Data contract class for type Location.
5 | @implementation MSAILocation
6 |
7 | ///
8 | /// Adds all members of this class to a dictionary
9 | /// @param dictionary to which the members of this class will be added.
10 | ///
11 | - (MSAIOrderedDictionary *)serializeToDictionary {
12 | MSAIOrderedDictionary *dict = [super serializeToDictionary];
13 | if (self.ip != nil) {
14 | [dict setObject:self.ip forKey:@"ai.location.ip"];
15 | }
16 | return dict;
17 | }
18 |
19 | #pragma mark - NSCoding
20 |
21 | - (instancetype)initWithCoder:(NSCoder *)coder {
22 | self = [super init];
23 | if(self) {
24 | _ip = [coder decodeObjectForKey:@"self.ip"];
25 | }
26 |
27 | return self;
28 | }
29 |
30 | - (void)encodeWithCoder:(NSCoder *)coder {
31 | [coder encodeObject:self.ip forKey:@"self.ip"];
32 | }
33 |
34 |
35 | @end
36 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/MSAIBaseTests.m:
--------------------------------------------------------------------------------
1 | #import
2 | #import "MSAIBase.h"
3 |
4 | @interface MSAIBaseTests : XCTestCase
5 |
6 | @end
7 |
8 | @implementation MSAIBaseTests
9 |
10 | - (void)testbase_typePropertyWorksAsExpected {
11 | NSString *expected = @"Test string";
12 | MSAIBase *item = [MSAIBase new];
13 | item.baseType = expected;
14 | NSString *actual = item.baseType;
15 | XCTAssertTrue([actual isEqualToString:expected]);
16 |
17 | expected = @"Other string";
18 | item.baseType = expected;
19 | actual = item.baseType;
20 | XCTAssertTrue([actual isEqualToString:expected]);
21 | }
22 |
23 | - (void)testSerialize {
24 | MSAIBase *item = [MSAIBase new];
25 | item.baseType = @"Test string";
26 | NSString *actual = [item serializeToString];
27 | NSString *expected = @"{\"baseType\":\"Test string\"}";
28 | XCTAssertTrue([actual isEqualToString:expected]);
29 | }
30 |
31 | @end
32 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/MSAIDataTests.m:
--------------------------------------------------------------------------------
1 | #import
2 | #import "MSAIData.h"
3 |
4 | @interface MSAIDataTests : XCTestCase
5 |
6 | @end
7 |
8 | @implementation MSAIDataTests
9 |
10 | - (void)testbase_dataPropertyWorksAsExpected {
11 | MSAITelemetryData *expected = [MSAITelemetryData new];
12 | MSAIData *item = [MSAIData new];
13 | item.baseData = expected;
14 | MSAITelemetryData *actual = item.baseData;
15 | XCTAssertTrue(actual == expected);
16 |
17 | expected = [MSAITelemetryData new];
18 | item.baseData = expected;
19 | actual = item.baseData;
20 | XCTAssertTrue(actual == expected);
21 | }
22 |
23 | - (void)testSerialize {
24 | MSAIData *item = [MSAIData new];
25 | item.baseData = [MSAITelemetryData new];
26 | NSString *actual = [item serializeToString];
27 | NSString *expected = @"{\"baseData\":{}}";
28 | XCTAssertTrue([actual isEqualToString:expected]);
29 | }
30 |
31 | @end
32 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/MSAILocationTests.m:
--------------------------------------------------------------------------------
1 | #import
2 | #import "MSAILocation.h"
3 |
4 | @interface MSAILocationTests : XCTestCase
5 |
6 | @end
7 |
8 | @implementation MSAILocationTests
9 |
10 | - (void)testipPropertyWorksAsExpected {
11 | NSString *expected = @"Test string";
12 | MSAILocation *item = [MSAILocation new];
13 | item.ip = expected;
14 | NSString *actual = item.ip;
15 | XCTAssertTrue([actual isEqualToString:expected]);
16 |
17 | expected = @"Other string";
18 | item.ip = expected;
19 | actual = item.ip;
20 | XCTAssertTrue([actual isEqualToString:expected]);
21 | }
22 |
23 | - (void)testSerialize {
24 | MSAILocation *item = [MSAILocation new];
25 | item.ip = @"Test string";
26 | NSString *actual = [item serializeToString];
27 | NSString *expected = @"{\"ai.location.ip\":\"Test string\"}";
28 | XCTAssertTrue([actual isEqualToString:expected]);
29 | }
30 |
31 | @end
32 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCHamcrest.framework/Versions/A/Headers/HCIsTypeOf.h:
--------------------------------------------------------------------------------
1 | // OCHamcrest by Jon Reid, http://qualitycoding.org/about/
2 | // Copyright 2014 hamcrest.org. See LICENSE.txt
3 |
4 | #import
5 |
6 |
7 | @interface HCIsTypeOf : HCClassMatcher
8 |
9 | + (id)isTypeOf:(Class)type;
10 |
11 | @end
12 |
13 |
14 | FOUNDATION_EXPORT id HC_isA(Class aClass);
15 |
16 | /**
17 | isA(aClass) -
18 | Matches if object is an instance of a given class (but not of a subclass).
19 |
20 | @param aClass The class to compare against as the expected class.
21 |
22 | This matcher checks whether the evaluated object is an instance of @a aClass.
23 |
24 | Example:
25 | @li @ref isA([Foo class])
26 |
27 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
28 | @c HC_isA instead.)
29 |
30 | @ingroup object_matchers
31 | */
32 | #ifdef HC_SHORTHAND
33 | #define isA HC_isA
34 | #endif
35 |
--------------------------------------------------------------------------------
/Classes/ApplicationInsightsPrivate.h:
--------------------------------------------------------------------------------
1 | #import "MSAIApplicationInsights.h"
2 |
3 | NS_ASSUME_NONNULL_BEGIN
4 | #ifndef MSAI_Private_h
5 | #define MSAI_Private_h
6 |
7 | FOUNDATION_EXPORT NSString *const kMSAIName;
8 | FOUNDATION_EXPORT NSString *const kMSAIIdentifier;
9 |
10 | #if MSAI_FEATURE_TELEMETRY
11 |
12 | FOUNDATION_EXPORT NSString *const __unused kMSAITelemetryCachesSessions;
13 | FOUNDATION_EXPORT NSString *const __unused kMSAITelemetryTempSessionData;
14 | FOUNDATION_EXPORT NSString *const __unused kMSAITelemetryLastAppVersion;
15 |
16 | #endif /* MSAI_FEATURE_METRICS */
17 |
18 | FOUNDATION_EXPORT NSString *const kMSAIIntegrationflowTimestamp;
19 |
20 | #define MSAILog(fmt, ...) do { if([MSAIApplicationInsights sharedInstance].isDebugLogEnabled) { NSLog((@"[MSAI] %s/%d " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__); }} while(0)
21 |
22 | #ifndef __IPHONE_8_0
23 | #define __IPHONE_8_0 80000
24 | #endif
25 |
26 | #endif /* MSAI_Private_h */
27 | NS_ASSUME_NONNULL_END
28 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCHamcrest.framework/Versions/A/Headers/HCStringDescription.h:
--------------------------------------------------------------------------------
1 | // OCHamcrest by Jon Reid, http://qualitycoding.org/about/
2 | // Copyright 2014 hamcrest.org. See LICENSE.txt
3 |
4 | #import
5 |
6 | @protocol HCSelfDescribing;
7 |
8 |
9 | /**
10 | An HCDescription that is stored as a string.
11 |
12 | @ingroup core
13 | */
14 | @interface HCStringDescription : HCBaseDescription
15 | {
16 | NSMutableString *accumulator;
17 | }
18 |
19 | /**
20 | Returns the description of an HCSelfDescribing object as a string.
21 |
22 | @param selfDescribing The object to be described.
23 | @return The description of the object.
24 | */
25 | + (NSString *)stringFrom:(id)selfDescribing;
26 |
27 | /**
28 | Returns an empty description.
29 | */
30 | + (instancetype)stringDescription;
31 |
32 | /**
33 | Returns an initialized HCStringDescription object that is empty.
34 | */
35 | - (instancetype)init;
36 |
37 | @end
38 |
--------------------------------------------------------------------------------
/Classes/MSAIBase.m:
--------------------------------------------------------------------------------
1 | #import "MSAIBase.h"
2 | #import "MSAIOrderedDictionary.h"
3 |
4 | /// Data contract class for type Base.
5 | @implementation MSAIBase
6 |
7 | ///
8 | /// Adds all members of this class to a dictionary
9 | /// @param dictionary to which the members of this class will be added.
10 | ///
11 | - (MSAIOrderedDictionary *)serializeToDictionary {
12 | MSAIOrderedDictionary *dict = [super serializeToDictionary];
13 | if (self.baseType != nil) {
14 | [dict setObject:self.baseType forKey:@"baseType"];
15 | }
16 | return dict;
17 | }
18 |
19 | #pragma mark - NSCoding
20 |
21 | - (instancetype)initWithCoder:(NSCoder *)coder {
22 | self = [super initWithCoder:coder];
23 | if(self) {
24 | _baseType = [coder decodeObjectForKey:@"self.baseType"];
25 | }
26 |
27 | return self;
28 | }
29 |
30 | - (void)encodeWithCoder:(NSCoder *)coder {
31 | [super encodeWithCoder:coder];
32 | [coder encodeObject:self.baseType forKey:@"self.baseType"];
33 | }
34 |
35 | @end
36 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCHamcrest.framework/Versions/A/Headers/HCIsIn.h:
--------------------------------------------------------------------------------
1 | // OCHamcrest by Jon Reid, http://qualitycoding.org/about/
2 | // Copyright 2014 hamcrest.org. See LICENSE.txt
3 |
4 | #import
5 |
6 |
7 | @interface HCIsIn : HCBaseMatcher
8 |
9 | + (instancetype)isInCollection:(id)collection;
10 | - (instancetype)initWithCollection:(id)collection;
11 |
12 | @end
13 |
14 |
15 | FOUNDATION_EXPORT id HC_isIn(id aCollection);
16 |
17 | /**
18 | isIn(aCollection) -
19 | Matches if evaluated object is present in a given collection.
20 |
21 | @param aCollection The collection to search.
22 |
23 | This matcher invokes @c -containsObject: on @a aCollection to determine if the evaluated object
24 | is an element of the collection.
25 |
26 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
27 | @c HC_isIn instead.)
28 |
29 | @ingroup collection_matchers
30 | */
31 | #ifdef HC_SHORTHAND
32 | #define isIn HC_isIn
33 | #endif
34 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCHamcrest.framework/Versions/A/Headers/HCIsSame.h:
--------------------------------------------------------------------------------
1 | // OCHamcrest by Jon Reid, http://qualitycoding.org/about/
2 | // Copyright 2014 hamcrest.org. See LICENSE.txt
3 |
4 | #import
5 |
6 |
7 | @interface HCIsSame : HCBaseMatcher
8 |
9 | + (instancetype)isSameAs:(id)object;
10 | - (instancetype)initSameAs:(id)object;
11 |
12 | @end
13 |
14 |
15 | FOUNDATION_EXPORT id HC_sameInstance(id object);
16 |
17 | /**
18 | sameInstance(anObject) -
19 | Matches if evaluated object is the same instance as a given object.
20 |
21 | @param anObject The object to compare against as the expected value.
22 |
23 | This matcher compares the address of the evaluated object to determine if it is the same object
24 | as @a anObject.
25 |
26 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
27 | @c HC_sameInstance instead.)
28 |
29 | @ingroup object_matchers
30 | */
31 | #ifdef HC_SHORTHAND
32 | #define sameInstance HC_sameInstance
33 | #endif
34 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCHamcrest.framework/Versions/A/Headers/HCIsNil.h:
--------------------------------------------------------------------------------
1 | // OCHamcrest by Jon Reid, http://qualitycoding.org/about/
2 | // Copyright 2014 hamcrest.org. See LICENSE.txt
3 |
4 | #import
5 |
6 |
7 | @interface HCIsNil : HCBaseMatcher
8 |
9 | + (id)isNil;
10 |
11 | @end
12 |
13 |
14 | FOUNDATION_EXPORT id HC_nilValue(void);
15 |
16 | /**
17 | Matches if object is @c nil.
18 |
19 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
20 | @c HC_nilValue instead.)
21 |
22 | @ingroup object_matchers
23 | */
24 | #ifdef HC_SHORTHAND
25 | #define nilValue() HC_nilValue()
26 | #endif
27 |
28 |
29 | FOUNDATION_EXPORT id HC_notNilValue(void);
30 |
31 | /**
32 | Matches if object is not @c nil.
33 |
34 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
35 | @c HC_notNilValue instead.)
36 |
37 | @ingroup object_matchers
38 | */
39 | #ifdef HC_SHORTHAND
40 | #define notNilValue() HC_notNilValue()
41 | #endif
42 |
--------------------------------------------------------------------------------
/Support/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | ${VERSION_STRING}
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | ${BUILD_NUMBER}
23 | NSHumanReadableCopyright
24 | Copyright © 2015 Microsoft. All rights reserved.
25 | NSPrincipalClass
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/Classes/MSAIOrderedDictionary.m:
--------------------------------------------------------------------------------
1 | #import "MSAIOrderedDictionary.h"
2 |
3 | @implementation MSAIOrderedDictionary
4 |
5 | - (instancetype)init {
6 | if (self = [super init]) {
7 | dictionary = [NSMutableDictionary new];
8 | order = [NSMutableArray new];
9 | }
10 | return self;
11 | }
12 |
13 | - (instancetype)initWithCapacity:(NSUInteger)numItems {
14 | self = [super init];
15 | if ( self != nil )
16 | {
17 | dictionary = [[NSMutableDictionary alloc] initWithCapacity:numItems];
18 | order = [NSMutableArray new];
19 | }
20 | return self;
21 | }
22 |
23 | - (void)setObject:(id)anObject forKey:(id)aKey {
24 | if(!dictionary[aKey]) {
25 | [order addObject:aKey];
26 | }
27 | dictionary[aKey] = anObject;
28 | }
29 |
30 | - (NSEnumerator *)keyEnumerator {
31 | return [order objectEnumerator];
32 | }
33 |
34 | - (id)objectForKey:(id)key {
35 | return dictionary[key];
36 | }
37 |
38 | - (NSUInteger)count {
39 | return [dictionary count];
40 | }
41 |
42 | @end
43 |
--------------------------------------------------------------------------------
/Classes/MSAIRemoteDependencyData.h:
--------------------------------------------------------------------------------
1 | #import "MSAIDomain.h"
2 | #import "MSAIDataPointType.h"
3 | #import "MSAIDependencyKind.h"
4 | #import "MSAIDependencySourceType.h"
5 |
6 | @interface MSAIRemoteDependencyData : MSAIDomain
7 |
8 | @property (nonatomic, copy, readonly) NSString *envelopeTypeName;
9 | @property (nonatomic, copy, readonly) NSString *dataTypeName;
10 | @property (nonatomic, assign) MSAIDataPointType kind;
11 | @property (nonatomic, copy) NSNumber *value;
12 | @property (nonatomic, copy) NSNumber *count;
13 | @property (nonatomic, copy) NSNumber *min;
14 | @property (nonatomic, copy) NSNumber *max;
15 | @property (nonatomic, copy) NSNumber *stdDev;
16 | @property (nonatomic, assign) MSAIDependencyKind dependencyKind;
17 | @property (nonatomic, assign) BOOL success;
18 | @property (nonatomic, assign) BOOL async;
19 | @property (nonatomic, assign) MSAIDependencySourceType dependencySource;
20 | @property (nonatomic, copy) NSString *commandName;
21 | @property (nonatomic, copy) NSString *dependencyTypeName;
22 |
23 | @end
24 |
--------------------------------------------------------------------------------
/Classes/MSAIDevice.h:
--------------------------------------------------------------------------------
1 | #import "MSAIObject.h"
2 |
3 | @interface MSAIDevice : MSAIObject
4 |
5 | @property (nonatomic, copy) NSString *deviceId;
6 | @property (nonatomic, copy) NSString *ip;
7 | @property (nonatomic, copy) NSString *language;
8 | @property (nonatomic, copy) NSString *locale;
9 | @property (nonatomic, copy) NSString *machineName;
10 | @property (nonatomic, copy) NSString *model;
11 | @property (nonatomic, copy) NSString *network;
12 | @property (nonatomic, copy) NSString *networkName;
13 | @property (nonatomic, copy) NSString *oemName;
14 | @property (nonatomic, copy) NSString *os;
15 | @property (nonatomic, copy) NSString *osVersion;
16 | @property (nonatomic, copy) NSString *roleInstance;
17 | @property (nonatomic, copy) NSString *roleName;
18 | @property (nonatomic, copy) NSString *screenResolution;
19 | @property (nonatomic, copy) NSString *type;
20 | @property (nonatomic, copy) NSString *vmName;
21 |
22 | - (instancetype)initWithCoder:(NSCoder *)coder;
23 |
24 | - (void)encodeWithCoder:(NSCoder *)coder;
25 |
26 |
27 | @end
28 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCHamcrest.framework/Versions/A/Headers/HCThrowsException.h:
--------------------------------------------------------------------------------
1 | // OCHamcrest by Jon Reid, http://qualitycoding.org/about/
2 | // Copyright 2014 hamcrest.org. See LICENSE.txt
3 |
4 | #import
5 |
6 |
7 | @interface HCThrowsException : HCDiagnosingMatcher
8 |
9 | - (id)initWithExceptionMatcher:(id)exceptionMatcher;
10 |
11 | @end
12 |
13 |
14 | FOUNDATION_EXPORT id HC_throwsException(id exceptionMatcher);
15 |
16 | /**
17 | throwsException(exceptionMatcher) -
18 | Matches if object is a block which, when executed, throws an exception satisfying a given matcher.
19 |
20 | @param exceptionMatcher The matcher to satisfy when passed the exception.
21 |
22 | Example:
23 | @li @ref throwsException(instanceOf([NSException class]))
24 |
25 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
26 | @c HC_throwsException instead.)
27 |
28 | @ingroup object_matchers
29 | */
30 | #ifdef HC_SHORTHAND
31 | #define throwsException HC_throwsException
32 | #endif
33 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCHamcrest.framework/Versions/A/Headers/HCIsEqual.h:
--------------------------------------------------------------------------------
1 | // OCHamcrest by Jon Reid, http://qualitycoding.org/about/
2 | // Copyright 2014 hamcrest.org. See LICENSE.txt
3 |
4 | #import
5 |
6 |
7 | @interface HCIsEqual : HCBaseMatcher
8 |
9 | + (instancetype)isEqualTo:(id)object;
10 | - (instancetype)initEqualTo:(id)object;
11 |
12 | @end
13 |
14 |
15 | FOUNDATION_EXPORT id HC_equalTo(id object);
16 |
17 | /**
18 | equalTo(anObject) -
19 | Matches if object is equal to a given object.
20 |
21 | @param anObject The object to compare against as the expected value.
22 |
23 | This matcher compares the evaluated object to @a anObject for equality, as determined by the
24 | @c -isEqual: method.
25 |
26 | If @a anObject is @c nil, the matcher will successfully match @c nil.
27 |
28 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
29 | @c HC_equalTo instead.)
30 |
31 | @ingroup object_matchers
32 | */
33 | #ifdef HC_SHORTHAND
34 | #define equalTo HC_equalTo
35 | #endif
36 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCHamcrest.framework/Versions/A/Headers/HCIsInstanceOf.h:
--------------------------------------------------------------------------------
1 | // OCHamcrest by Jon Reid, http://qualitycoding.org/about/
2 | // Copyright 2014 hamcrest.org. See LICENSE.txt
3 |
4 | #import
5 |
6 |
7 | @interface HCIsInstanceOf : HCClassMatcher
8 |
9 | + (id)isInstanceOf:(Class)type;
10 |
11 | @end
12 |
13 |
14 | FOUNDATION_EXPORT id HC_instanceOf(Class aClass);
15 |
16 | /**
17 | instanceOf(aClass) -
18 | Matches if object is an instance of, or inherits from, a given class.
19 |
20 | @param aClass The class to compare against as the expected class.
21 |
22 | This matcher checks whether the evaluated object is an instance of @a aClass or an instance of
23 | any class that inherits from @a aClass.
24 |
25 | Example:
26 | @li @ref instanceOf([NSString class])
27 |
28 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
29 | @c HC_instanceOf instead.)
30 |
31 | @ingroup object_matchers
32 | */
33 | #ifdef HC_SHORTHAND
34 | #define instanceOf HC_instanceOf
35 | #endif
36 |
--------------------------------------------------------------------------------
/Classes/MSAITelemetryData.m:
--------------------------------------------------------------------------------
1 | #import "MSAITelemetryData.h"
2 | #import "MSAIOrderedDictionary.h"
3 |
4 | @implementation MSAITelemetryData
5 |
6 | - (MSAIOrderedDictionary *)serializeToDictionary {
7 | MSAIOrderedDictionary *dict = [super serializeToDictionary];
8 | if (self.version != nil) {
9 | [dict setObject:self.version forKey:@"ver"];
10 | }
11 |
12 | return dict;
13 | }
14 |
15 | #pragma mark - NSCoding
16 |
17 | - (instancetype)initWithCoder:(NSCoder *)coder {
18 | self = [super initWithCoder:coder];
19 | if(self) {
20 | _version = [coder decodeObjectForKey:@"self.version"];
21 | _name = [coder decodeObjectForKey:@"self.name"];
22 | _properties = [coder decodeObjectForKey:@"self.properties"];
23 | }
24 |
25 | return self;
26 | }
27 |
28 | - (void)encodeWithCoder:(NSCoder *)coder {
29 | [super encodeWithCoder:coder];
30 | [coder encodeObject:self.version forKey:@"self.version"];
31 | [coder encodeObject:self.name forKey:@"self.name"];
32 | [coder encodeObject:self.properties forKey:@"self.properties"];
33 | }
34 |
35 |
36 | @end
37 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCMock.framework/Versions/A/Headers/NSNotificationCenter+OCMAdditions.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2009-2014 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import
18 |
19 | @class OCObserverMockObject;
20 |
21 |
22 | @interface NSNotificationCenter(OCMAdditions)
23 |
24 | - (void)addMockObserver:(OCObserverMockObject *)notificationObserver name:(NSString *)notificationName object:(id)notificationSender;
25 |
26 | @end
27 |
--------------------------------------------------------------------------------
/Support/ApplicationInsights.xcodeproj/xcshareddata/xcbaselines/1E5A458F16F0DFC200B55C04.xcbaseline/0E03ADBE-1442-48B6-ADD5-807E0C73245B.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | classNames
6 |
7 | MSAIHelperTests
8 |
9 | testUtcDateString
10 |
11 | com.apple.XCTPerformanceMetric_WallClockTime
12 |
13 | baselineAverage
14 | 0
15 | baselineIntegrationDisplayName
16 | Local Baseline
17 |
18 |
19 | testUtcDateStringPerformane
20 |
21 | com.apple.XCTPerformanceMetric_WallClockTime
22 |
23 | baselineAverage
24 | 0.005
25 | baselineIntegrationDisplayName
26 | Local Baseline
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/Classes/MSAIHelper.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "ApplicationInsights.h"
3 |
4 | NS_ASSUME_NONNULL_BEGIN
5 | /* NSString helpers */
6 | NSString *msai_URLEncodedString(NSString *inputString);
7 | NSString *msai_URLDecodedString(NSString *inputString);
8 | NSString *msai_base64String(NSData *data);
9 |
10 | NSString *msai_keychainMSAIServiceName(void);
11 |
12 | NSString *msai_utcDateString(NSDate *date);
13 | NSString *msai_appVersion(void);
14 | NSString *msai_devicePlatform(void);
15 | NSString *msai_deviceLanguage(void);
16 | NSString *msai_deviceLocale(void);
17 | NSString *msai_osVersionBuild(void);
18 | NSString *msai_osName(void);
19 | NSString *msai_deviceType(void);
20 | NSString *msai_screenSize(void);
21 | NSString *msai_sdkVersion(void);
22 | NSString *msai_sdkBuild(void);
23 | NSString *msai_dec(void);
24 | NSString *msai_mainBundleIdentifier(void);
25 | NSString *msai_encodeInstrumentationKey(NSString *inputString);
26 | NSString *msai_UUID(void);
27 | NSString *msai_appAnonID(void);
28 | BOOL msai_isRunningInAppExtension(void);
29 | BOOL msai_isDebuggerAttached(void);
30 | NS_ASSUME_NONNULL_END
31 |
--------------------------------------------------------------------------------
/Resources/ApplicationInsights-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | English
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIconFile
10 |
11 | CFBundleIdentifier
12 | com.microsoft.${PRODUCT_NAME:rfc1034identifier}
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | ${PRODUCT_NAME}
17 | CFBundlePackageType
18 | FMWK
19 | CFBundleShortVersionString
20 | ${VERSION_STRING}
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | ${BUILD_NUMBER}
25 | NSHumanReadableCopyright
26 | Copyright © Microsoft. All rights reserved.
27 | NSPrincipalClass
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/MSAIApplicationInsightsTests.m:
--------------------------------------------------------------------------------
1 | #import
2 | #import "MSAIApplicationInsightsPrivate.h"
3 | #import "MSAIApplicationInsights.h"
4 |
5 | @interface MSAIManagerTests : XCTestCase
6 |
7 | @property (nonatomic, strong) MSAIApplicationInsights *sut;
8 |
9 | @end
10 |
11 | @implementation MSAIManagerTests
12 |
13 | - (void)setUp {
14 | [super setUp];
15 | self.sut = [MSAIApplicationInsights new];
16 | }
17 |
18 | - (void)tearDown {
19 | // Put teardown code here. This method is called after the invocation of each test method in the class.
20 | [super tearDown];
21 | }
22 |
23 | - (void)testCheckValidityOfInstrumentationKey {
24 | NSString *validInstrumentationKey = @"d604e87f-7530-0675-9606-cb358fe8ac76";
25 | NSString *invalidInstrumentationKey = @"ff5c62817410e2413a67c5df144dc35c";
26 |
27 | XCTAssertTrue([self.sut checkValidityOfInstrumentationKey:validInstrumentationKey]);
28 |
29 | XCTAssertFalse([self.sut checkValidityOfInstrumentationKey:invalidInstrumentationKey]);
30 | XCTAssertFalse([self.sut checkValidityOfInstrumentationKey:@""]);
31 | }
32 |
33 | @end
34 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCHamcrest.framework/Versions/A/Headers/HCConformsToProtocol.h:
--------------------------------------------------------------------------------
1 | // OCHamcrest by Jon Reid, http://qualitycoding.org/about/
2 | // Copyright 2014 hamcrest.org. See LICENSE.txt
3 | // Contribution by Todd Farrell
4 |
5 | #import
6 |
7 |
8 | @interface HCConformsToProtocol : HCBaseMatcher
9 |
10 | + (instancetype)conformsTo:(Protocol *)protocol;
11 | - (instancetype)initWithProtocol:(Protocol *)protocol;
12 |
13 | @end
14 |
15 |
16 | FOUNDATION_EXPORT id HC_conformsTo(Protocol *aProtocol);
17 |
18 | /**
19 | conformsTo(aProtocol) -
20 | Matches if object conforms to a given protocol.
21 |
22 | @param aProtocol The protocol to compare against as the expected protocol.
23 |
24 | This matcher checks whether the evaluated object conforms to @a aProtocol.
25 |
26 | Example:
27 | @li @ref conformsTo(\@protocol(NSObject))
28 |
29 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
30 | @c HC_conformsTo instead.)
31 |
32 | @ingroup object_matchers
33 | */
34 | #ifdef HC_SHORTHAND
35 | #define conformsTo HC_conformsTo
36 | #endif
37 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCHamcrest.framework/Versions/A/Headers/HCStringContains.h:
--------------------------------------------------------------------------------
1 | // OCHamcrest by Jon Reid, http://qualitycoding.org/about/
2 | // Copyright 2014 hamcrest.org. See LICENSE.txt
3 |
4 | #import
5 |
6 |
7 | @interface HCStringContains : HCSubstringMatcher
8 |
9 | + (id)stringContains:(NSString *)aSubstring;
10 |
11 | @end
12 |
13 |
14 | FOUNDATION_EXPORT id HC_containsString(NSString *aSubstring);
15 |
16 | /**
17 | containsString(aString) -
18 | Matches if object is a string containing a given string.
19 |
20 | @param aString The string to search for. This value must not be @c nil.
21 |
22 | This matcher first checks whether the evaluated object is a string. If so, it checks whether it
23 | contains @a aString.
24 |
25 | Example:
26 |
27 | @par
28 | @ref containsString(@"def")
29 |
30 | will match "abcdefg".
31 |
32 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
33 | @c HC_containsString instead.)
34 |
35 | @ingroup text_matchers
36 | */
37 | #ifdef HC_SHORTHAND
38 | #define containsString HC_containsString
39 | #endif
40 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCHamcrest.framework/Versions/A/Headers/HCStringEndsWith.h:
--------------------------------------------------------------------------------
1 | // OCHamcrest by Jon Reid, http://qualitycoding.org/about/
2 | // Copyright 2014 hamcrest.org. See LICENSE.txt
3 |
4 | #import
5 |
6 |
7 | @interface HCStringEndsWith : HCSubstringMatcher
8 |
9 | + (id)stringEndsWith:(NSString *)aSubstring;
10 |
11 | @end
12 |
13 |
14 | FOUNDATION_EXPORT id HC_endsWith(NSString *aSubstring);
15 |
16 | /**
17 | endsWith(aString) -
18 | Matches if object is a string ending with a given string.
19 |
20 | @param aString The string to search for. This value must not be @c nil.
21 |
22 | This matcher first checks whether the evaluated object is a string. If so, it checks if
23 | @a aString matches the ending characters of the evaluated object.
24 |
25 | Example:
26 |
27 | @par
28 | @ref endsWith(@"bar")
29 |
30 | will match "foobar".
31 |
32 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
33 | @c HC_endsWith instead.)
34 |
35 | @ingroup text_matchers
36 | */
37 | #ifdef HC_SHORTHAND
38 | #define endsWith HC_endsWith
39 | #endif
40 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCHamcrest.framework/Versions/A/Headers/HCIsTrueFalse.h:
--------------------------------------------------------------------------------
1 | // OCHamcrest by Jon Reid, http://qualitycoding.org/about/
2 | // Copyright 2014 hamcrest.org. See LICENSE.txt
3 |
4 | #import
5 |
6 |
7 | @interface HCIsTrue : HCBaseMatcher
8 | @end
9 |
10 | @interface HCIsFalse : HCBaseMatcher
11 | @end
12 |
13 |
14 | FOUNDATION_EXPORT id HC_isTrue(void);
15 |
16 | /**
17 | isTrue() -
18 | Matches if object is equal to @c NSNumber with non-zero value.
19 |
20 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
21 | @c HC_isTrue instead.)
22 |
23 | @ingroup primitive_number_matchers
24 | */
25 | #ifdef HC_SHORTHAND
26 | #define isTrue() HC_isTrue()
27 | #endif
28 |
29 |
30 | FOUNDATION_EXPORT id HC_isFalse(void);
31 |
32 | /**
33 | isFalse() -
34 | Matches if object is equal to @c NSNumber with zero value.
35 |
36 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
37 | @c HC_isFalse instead.)
38 |
39 | @ingroup primitive_number_matchers
40 | */
41 | #ifdef HC_SHORTHAND
42 | #define isFalse() HC_isFalse()
43 | #endif
44 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCHamcrest.framework/Versions/A/Headers/HCStringStartsWith.h:
--------------------------------------------------------------------------------
1 | // OCHamcrest by Jon Reid, http://qualitycoding.org/about/
2 | // Copyright 2014 hamcrest.org. See LICENSE.txt
3 |
4 | #import
5 |
6 |
7 | @interface HCStringStartsWith : HCSubstringMatcher
8 |
9 | + (id)stringStartsWith:(NSString *)aSubstring;
10 |
11 | @end
12 |
13 |
14 | FOUNDATION_EXPORT id HC_startsWith(NSString *aSubstring);
15 |
16 | /**
17 | startsWith(aString) -
18 | Matches if object is a string starting with a given string.
19 |
20 | @param aString The string to search for. This value must not be @c nil.
21 |
22 | This matcher first checks whether the evaluated object is a string. If so, it checks if
23 | @a aString matches the beginning characters of the evaluated object.
24 |
25 | Example:
26 |
27 | @par
28 | @ref endsWith(@"foo")
29 |
30 | will match "foobar".
31 |
32 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
33 | @c HC_startsWith instead.)
34 |
35 | @ingroup text_matchers
36 | */
37 | #ifdef HC_SHORTHAND
38 | #define startsWith HC_startsWith
39 | #endif
40 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/MSAIApplicationTests.m:
--------------------------------------------------------------------------------
1 | #import
2 | #import "MSAIApplication.h"
3 |
4 | @interface MSAIApplicationTests : XCTestCase
5 |
6 | @end
7 |
8 | @implementation MSAIApplicationTests
9 |
10 | - (void)testverPropertyWorksAsExpected {
11 | NSString *expected = @"Test string";
12 | MSAIApplication *item = [MSAIApplication new];
13 | item.version = expected;
14 | NSString *actual = item.version;
15 | XCTAssertTrue([actual isEqualToString:expected]);
16 |
17 | expected = @"Other string";
18 | item.version = expected;
19 | actual = item.version;
20 | XCTAssertTrue([actual isEqualToString:expected]);
21 | }
22 |
23 | - (void)testSerialize {
24 | MSAIApplication *item = [MSAIApplication new];
25 | item.version = @"Test string";
26 | item.build = @"Test build";
27 | item.typeId = @"Test typeId";
28 | NSString *actual = [item serializeToString];
29 | NSString *expected = @"{\"ai.application.ver\":\"Test string\",\"ai.application.build\":\"Test build\",\"ai.application.typeId\":\"Test typeId\"}";
30 | XCTAssertTrue([actual isEqualToString:expected]);
31 | }
32 |
33 | @end
34 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCHamcrest.framework/Versions/A/Headers/HCCollect.h:
--------------------------------------------------------------------------------
1 | // OCHamcrest by Jon Reid, http://qualitycoding.org/about/
2 | // Copyright 2014 hamcrest.org. See LICENSE.txt
3 |
4 | #import
5 |
6 | #import
7 |
8 | @protocol HCMatcher;
9 |
10 |
11 | /**
12 | Returns an array of values from a variable-length comma-separated list terminated by @c nil.
13 |
14 | @ingroup helpers
15 | */
16 | FOUNDATION_EXPORT NSMutableArray *HCCollectItems(id item, va_list args);
17 |
18 | /**
19 | Returns an array of matchers from a variable-length comma-separated list terminated by @c nil.
20 |
21 | Each item is wrapped in HCWrapInMatcher to transform non-matcher items into equality matchers.
22 |
23 | @ingroup helpers
24 | */
25 | FOUNDATION_EXPORT NSMutableArray *HCCollectMatchers(id item, va_list args);
26 |
27 | /**
28 | Returns an array of wrapped items from a variable-length comma-separated list terminated by @c nil.
29 |
30 | Each item is transformed by passing it to the given @c wrap function.
31 |
32 | @ingroup helpers
33 | */
34 | FOUNDATION_EXPORT NSMutableArray *HCCollectWrappedItems(id item, va_list args, id (*wrap)(id));
35 |
--------------------------------------------------------------------------------
/Classes/MSAIHTTPOperation.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "MSAINullability.h"
3 |
4 | @class MSAIHTTPOperation;
5 |
6 | NS_ASSUME_NONNULL_BEGIN
7 | /**
8 | * A typedefed block that can be used for MSAIHTTPOperation
9 | */
10 | typedef void (^MSAINetworkCompletionBlock)(MSAIHTTPOperation * operation, NSData* data, NSError* error);
11 |
12 | /**
13 | * Subclass of NSOperation that is used for communication with the server.
14 | */
15 |
16 | @interface MSAIHTTPOperation : NSOperation
17 |
18 | + (instancetype)operationWithRequest:(NSURLRequest *)urlRequest;
19 |
20 | @property (nonatomic, readonly) NSURLRequest *URLRequest;
21 |
22 | /**
23 | * @param completionBlock block of type MSAINetworkCompletionBlock that will be called in case the MSAIHTTPOperation is not cancelled
24 | * @param queue Dispatch Queue on which the completionBlock will be executed
25 | */
26 | - (void) setCompletion:(MSAINetworkCompletionBlock) completionBlock onQueue:(dispatch_queue_t)queue;
27 |
28 | @property (nonatomic, readonly) NSHTTPURLResponse *response;
29 | @property (nonatomic, readonly) NSData *data;
30 | @property (nonatomic, readonly) NSError *error;
31 |
32 | @end
33 | NS_ASSUME_NONNULL_END
34 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCHamcrest.framework/Versions/A/Headers/HCAnyOf.h:
--------------------------------------------------------------------------------
1 | // OCHamcrest by Jon Reid, http://qualitycoding.org/about/
2 | // Copyright 2014 hamcrest.org. See LICENSE.txt
3 |
4 | #import
5 |
6 |
7 | @interface HCAnyOf : HCBaseMatcher
8 |
9 | + (instancetype)anyOf:(NSArray *)matchers;
10 | - (instancetype)initWithMatchers:(NSArray *)matchers;
11 |
12 | @end
13 |
14 |
15 | FOUNDATION_EXPORT id HC_anyOf(id match, ...) NS_REQUIRES_NIL_TERMINATION;
16 |
17 | /**
18 | anyOf(firstMatcher, ...) -
19 | Matches if any of the given matchers evaluate to @c YES.
20 |
21 | @param firstMatcher,... A comma-separated list of matchers ending with @c nil.
22 |
23 | The matchers are evaluated from left to right using short-circuit evaluation, so evaluation
24 | stops as soon as a matcher returns @c YES.
25 |
26 | Any argument that is not a matcher is implicitly wrapped in an @ref equalTo matcher to check for
27 | equality.
28 |
29 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
30 | @c HC_anyOf instead.)
31 |
32 | @ingroup logical_matchers
33 | */
34 | #ifdef HC_SHORTHAND
35 | #define anyOf HC_anyOf
36 | #endif
37 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCHamcrest.framework/Versions/A/Headers/HCAllOf.h:
--------------------------------------------------------------------------------
1 | // OCHamcrest by Jon Reid, http://qualitycoding.org/about/
2 | // Copyright 2014 hamcrest.org. See LICENSE.txt
3 |
4 | #import
5 |
6 |
7 | @interface HCAllOf : HCDiagnosingMatcher
8 |
9 | + (instancetype)allOf:(NSArray *)matchers;
10 | - (instancetype)initWithMatchers:(NSArray *)matchers;
11 |
12 | @end
13 |
14 |
15 | FOUNDATION_EXPORT id HC_allOf(id match, ...) NS_REQUIRES_NIL_TERMINATION;
16 |
17 | /**
18 | allOf(firstMatcher, ...) -
19 | Matches if all of the given matchers evaluate to @c YES.
20 |
21 | @param firstMatcher,... A comma-separated list of matchers ending with @c nil.
22 |
23 | The matchers are evaluated from left to right using short-circuit evaluation, so evaluation
24 | stops as soon as a matcher returns @c NO.
25 |
26 | Any argument that is not a matcher is implicitly wrapped in an @ref equalTo matcher to check for
27 | equality.
28 |
29 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
30 | @c HC_allOf instead.)
31 |
32 | @ingroup logical_matchers
33 | */
34 | #ifdef HC_SHORTHAND
35 | #define allOf HC_allOf
36 | #endif
37 |
--------------------------------------------------------------------------------
/Classes/MSAIObject.m:
--------------------------------------------------------------------------------
1 | #import "ApplicationInsightsPrivate.h"
2 | #import "MSAIObject.h"
3 | #import "MSAIOrderedDictionary.h"
4 |
5 | @implementation MSAIObject
6 |
7 | // empty implementation for the base class
8 | - (MSAIOrderedDictionary *)serializeToDictionary{
9 | MSAIOrderedDictionary *dict = [MSAIOrderedDictionary new];
10 | return dict;
11 | }
12 |
13 | - (NSString *)serializeToString {
14 | MSAIOrderedDictionary *dict = [self serializeToDictionary];
15 | NSMutableString *jsonString;
16 | NSError *error = nil;
17 | NSData *json;
18 | json = [NSJSONSerialization dataWithJSONObject:dict options:0 error:&error];
19 | if (json == nil) {
20 | MSAILog(@"NSJSONSerialization error: %@", error.localizedDescription);
21 | }
22 | jsonString = [[NSMutableString alloc] initWithData:json encoding:NSUTF8StringEncoding];
23 | NSString *returnString = [[jsonString stringByReplacingOccurrencesOfString:@"\"true\"" withString:@"true"] stringByReplacingOccurrencesOfString:@"\"false\"" withString:@"false"];
24 | return returnString;
25 | }
26 |
27 | - (void)encodeWithCoder:(NSCoder *)coder {
28 | }
29 |
30 | - (instancetype)initWithCoder:(NSCoder *)coder {
31 | return [super init];
32 | }
33 |
34 |
35 | @end
36 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/MSAITestHelper.m:
--------------------------------------------------------------------------------
1 | #import "MSAITestHelper.h"
2 | #import "ApplicationInsightsPrivate.h"
3 |
4 | NSString *const kMSAIDummyInstrumentationKey = @"aaaaaaa-bbbb-cccc-dddd-01234567";
5 |
6 | @implementation MSAITestHelper
7 |
8 | // loads test fixture from json file
9 | // http://blog.roberthoglund.com/2010/12/ios-unit-testing-loading-bundle.html
10 | + (NSString *)jsonFixture:(NSString *)fixture {
11 | NSString *path = [[NSBundle bundleForClass:self.class] pathForResource:fixture ofType:@"json"];
12 |
13 | NSError *error = nil;
14 | NSString *content = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:&error];
15 |
16 | return content;
17 | }
18 |
19 | + (BOOL)createTempDirectory:(NSString *)directory {
20 | NSFileManager *fm = [[NSFileManager alloc] init];
21 |
22 | if (![fm fileExistsAtPath:directory]) {
23 | NSDictionary *attributes;
24 | attributes = @{NSFilePosixPermissions : @0755};
25 | NSError *theError = NULL;
26 |
27 | [fm createDirectoryAtPath:directory withIntermediateDirectories:YES attributes:attributes error:&theError];
28 | if (theError)
29 | return NO;
30 | }
31 |
32 | return YES;
33 | }
34 |
35 | @end
36 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCHamcrest.framework/Versions/A/Headers/HCEvery.h:
--------------------------------------------------------------------------------
1 | // OCHamcrest by Jon Reid, http://qualitycoding.org/about/
2 | // Copyright 2014 hamcrest.org. See LICENSE.txt
3 |
4 | #import
5 |
6 |
7 | @interface HCEvery : HCDiagnosingMatcher
8 |
9 | @property (readonly, nonatomic, strong) id matcher;
10 |
11 | - (instancetype)initWithMatcher:(id )matcher;
12 |
13 | @end
14 |
15 |
16 | FOUNDATION_EXPORT id HC_everyItem(id itemMatcher);
17 |
18 | /**
19 | everyItem(itemMatcher) -
20 | Matches if every element of a collection satisfies the given matcher.
21 |
22 | @param itemMatcher The matcher to apply to every item provided by the examined collection.
23 |
24 | This matcher iterates the evaluated collection, confirming that each element satisfies the given
25 | matcher.
26 |
27 | Example:
28 |
29 | @par
30 | @ref everyItem(startsWith(@"Jo"))
31 |
32 | will match a collection [@"Jon", @"John", @"Johann"].
33 |
34 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
35 | @c HC_everyItem instead.)
36 |
37 | @ingroup collection_matchers
38 | */
39 | #ifdef HC_SHORTHAND
40 | #define everyItem HC_everyItem
41 | #endif
42 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCHamcrest.framework/Versions/A/Headers/HCDescription.h:
--------------------------------------------------------------------------------
1 | // OCHamcrest by Jon Reid, http://qualitycoding.org/about/
2 | // Copyright 2014 hamcrest.org. See LICENSE.txt
3 |
4 | #import
5 |
6 |
7 | /**
8 | A description of an HCMatcher.
9 |
10 | An HCMatcher will describe itself to a description which can later be used for reporting.
11 |
12 | @ingroup core
13 | */
14 | @protocol HCDescription
15 |
16 | /**
17 | Appends some plain text to the description.
18 |
19 | @return @c self, for chaining.
20 | */
21 | - (id)appendText:(NSString *)text;
22 |
23 | /**
24 | Appends description of given value to @c self.
25 |
26 | If the value implements the @ref HCSelfDescribing protocol, then it will be used.
27 |
28 | @return @c self, for chaining.
29 | */
30 | - (id)appendDescriptionOf:(id)value;
31 |
32 | /**
33 | Appends a list of objects to the description.
34 |
35 | @return @c self, for chaining.
36 | */
37 | - (id)appendList:(NSArray *)values
38 | start:(NSString *)start
39 | separator:(NSString *)separator
40 | end:(NSString *)end;
41 |
42 | @end
43 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCHamcrest.framework/Versions/A/Headers/HCIsNot.h:
--------------------------------------------------------------------------------
1 | // OCHamcrest by Jon Reid, http://qualitycoding.org/about/
2 | // Copyright 2014 hamcrest.org. See LICENSE.txt
3 |
4 | #import
5 |
6 |
7 | @interface HCIsNot : HCBaseMatcher
8 |
9 | + (instancetype)isNot:(id )matcher;
10 | - (instancetype)initNot:(id )matcher;
11 |
12 | @end
13 |
14 |
15 | FOUNDATION_EXPORT id HC_isNot(id aMatcher);
16 |
17 | /**
18 | isNot(aMatcher) -
19 | Inverts the given matcher to its logical negation.
20 |
21 | @param aMatcher The matcher to negate.
22 |
23 | This matcher compares the evaluated object to the negation of the given matcher. If the
24 | @a aMatcher argument is not a matcher, it is implicitly wrapped in an @ref equalTo matcher to
25 | check for equality, and thus matches for inequality.
26 |
27 | Examples:
28 | @li @ref assertThat(cheese, isNot(equalTo(smelly)))
29 | @li @ref assertThat(cheese, isNot(smelly))
30 |
31 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
32 | @c HC_isNot instead.)
33 |
34 | @ingroup logical_matchers
35 | */
36 | #ifdef HC_SHORTHAND
37 | #define isNot HC_isNot
38 | #endif
39 |
--------------------------------------------------------------------------------
/Classes/MSAIData.m:
--------------------------------------------------------------------------------
1 | #import "MSAIData.h"
2 | #import "MSAIOrderedDictionary.h"
3 |
4 | /// Data contract class for type Data.
5 | @implementation MSAIData
6 |
7 | ///
8 | /// Adds all members of this class to a dictionary
9 | /// @param dictionary to which the members of this class will be added.
10 | ///
11 | - (MSAIOrderedDictionary *)serializeToDictionary {
12 | MSAIOrderedDictionary *dict = [super serializeToDictionary];
13 | MSAIOrderedDictionary *baseDataDict = [self.baseData serializeToDictionary];
14 | if ([NSJSONSerialization isValidJSONObject:baseDataDict]) {
15 | [dict setObject:baseDataDict forKey:@"baseData"];
16 | } else {
17 | NSLog(@"[ApplicationInsights] Some of the telemetry data was not NSJSONSerialization compatible and could not be serialized!");
18 | }
19 | return dict;
20 | }
21 |
22 | #pragma mark - NSCoding
23 |
24 | - (instancetype)initWithCoder:(NSCoder *)coder {
25 | self = [super initWithCoder:coder];
26 | if(self) {
27 | _baseData = [coder decodeObjectForKey:@"self.baseData"];
28 | }
29 |
30 | return self;
31 | }
32 |
33 | - (void)encodeWithCoder:(NSCoder *)coder {
34 | [super encodeWithCoder:coder];
35 | [coder encodeObject:self.baseData forKey:@"self.baseData"];
36 | }
37 |
38 |
39 | @end
40 |
--------------------------------------------------------------------------------
/Classes/MSAIInternal.m:
--------------------------------------------------------------------------------
1 | #import "MSAIInternal.h"
2 | #import "MSAIOrderedDictionary.h"
3 |
4 | /// Data contract class for type Internal.
5 | @implementation MSAIInternal
6 |
7 | ///
8 | /// Adds all members of this class to a dictionary
9 | /// @param dictionary to which the members of this class will be added.
10 | ///
11 | - (MSAIOrderedDictionary *)serializeToDictionary {
12 | MSAIOrderedDictionary *dict = [super serializeToDictionary];
13 | if (self.sdkVersion != nil) {
14 | [dict setObject:self.sdkVersion forKey:@"ai.internal.sdkVersion"];
15 | }
16 | if (self.agentVersion != nil) {
17 | [dict setObject:self.agentVersion forKey:@"ai.internal.agentVersion"];
18 | }
19 | return dict;
20 | }
21 |
22 | #pragma mark - NSCoding
23 |
24 | - (instancetype)initWithCoder:(NSCoder *)coder {
25 | self = [super init];
26 | if(self) {
27 | _sdkVersion = [coder decodeObjectForKey:@"self.sdkVersion"];
28 | _agentVersion = [coder decodeObjectForKey:@"self.agentVersion"];
29 | }
30 |
31 | return self;
32 | }
33 |
34 | - (void)encodeWithCoder:(NSCoder *)coder {
35 | [coder encodeObject:self.sdkVersion forKey:@"self.sdkVersion"];
36 | [coder encodeObject:self.agentVersion forKey:@"self.agentVersion"];
37 | }
38 |
39 |
40 | @end
41 |
--------------------------------------------------------------------------------
/ApplicationInsights-OSX.podspec:
--------------------------------------------------------------------------------
1 | Pod::Spec.new do |s|
2 | s.name = "ApplicationInsights-OSX"
3 | s.version = "1.0-beta.2"
4 | s.summary = "Microsoft Application Insights SDK for OSX"
5 | s.description = <<-DESC
6 | Application Insights is a service that allows developers to keep their applications available, performant, and successful.
7 | This SDK will allow you to send telemetry of various kinds (event, trace, page views, etc.) to the Application Insights service where they can be visualized in the Azure Portal.
8 | DESC
9 | s.homepage = "https://github.com/Microsoft/ApplicationInsights-OSX/"
10 | s.license = { :type => 'MIT', :file => 'ApplicationInsightsOSX/LICENSE' }
11 | s.author = { "Microsoft" => "appinsights-ios@microsoft.com" }
12 |
13 | s.source = { :http => "https://github.com/Microsoft/ApplicationInsights-OSX/releases/download/v#{s.version}/ApplicationInsightsOSX-#{s.version}.zip" }
14 |
15 | s.platform = :osx, '10.8'
16 | s.requires_arc = true
17 |
18 | s.osx.vendored_frameworks = 'ApplicationInsightsOSX/ApplicationInsightsOSX.framework'
19 | s.preserve_path = 'ApplicationInsightsOSX/README.md'
20 | end
21 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCHamcrest.framework/Versions/A/Headers/HCIsEqualIgnoringCase.h:
--------------------------------------------------------------------------------
1 | // OCHamcrest by Jon Reid, http://qualitycoding.org/about/
2 | // Copyright 2014 hamcrest.org. See LICENSE.txt
3 |
4 | #import
5 |
6 |
7 | @interface HCIsEqualIgnoringCase : HCBaseMatcher
8 |
9 | + (instancetype)isEqualIgnoringCase:(NSString *)string;
10 | - (instancetype)initWithString:(NSString *)string;
11 |
12 | @end
13 |
14 |
15 | FOUNDATION_EXPORT id HC_equalToIgnoringCase(NSString *aString);
16 |
17 | /**
18 | equalToIgnoringCase(string) -
19 | Matches if object is a string equal to a given string, ignoring case differences.
20 |
21 | @param aString The string to compare against as the expected value. This value must not be @c nil.
22 |
23 | This matcher first checks whether the evaluated object is a string. If so, it compares it with
24 | @a aString, ignoring differences of case.
25 |
26 | Example:
27 |
28 | @par
29 | @ref equalToIgnoringCase(@"hello world")
30 |
31 | will match "heLLo WorlD".
32 |
33 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
34 | @c HC_equalToIgnoringCase instead.)
35 |
36 | @ingroup text_matchers
37 | */
38 | #ifdef HC_SHORTHAND
39 | #define equalToIgnoringCase HC_equalToIgnoringCase
40 | #endif
41 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCMock.framework/Versions/A/Headers/OCMRecorder.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import
18 |
19 | @class OCMockObject;
20 | @class OCMInvocationMatcher;
21 |
22 |
23 | @interface OCMRecorder : NSProxy
24 | {
25 | OCMockObject *mockObject;
26 | OCMInvocationMatcher *invocationMatcher;
27 | }
28 |
29 | - (instancetype)init;
30 | - (instancetype)initWithMockObject:(OCMockObject *)aMockObject;
31 |
32 | - (void)setMockObject:(OCMockObject *)aMockObject;
33 |
34 | - (OCMInvocationMatcher *)invocationMatcher;
35 |
36 | - (id)classMethod;
37 | - (id)ignoringNonObjectArgs;
38 |
39 | @end
40 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/MSAIReachabilityTests.m:
--------------------------------------------------------------------------------
1 | #import
2 | #import "MSAIReachability.h"
3 | #import "MSAIReachabilityPrivate.h"
4 |
5 | #define HC_SHORTHAND
6 | #import
7 |
8 | @interface MSAIReachabilityTests : XCTestCase
9 | @end
10 |
11 | NSString *const testHostName = @"www.google.com";
12 |
13 | @implementation MSAIReachabilityTests{
14 | MSAIReachability *_sut;
15 | }
16 |
17 | - (void)setUp {
18 | [super setUp];
19 |
20 | _sut = [MSAIReachability sharedInstance];
21 | }
22 |
23 | - (void)tearDown {
24 | _sut = nil;
25 |
26 | [super tearDown];
27 | }
28 |
29 | - (void)testThatItInstantiates {
30 | assertThat(_sut, notNilValue());
31 | assertThat(_sut.networkQueue, notNilValue());
32 | assertThat(_sut.singletonQueue, notNilValue());
33 | }
34 |
35 |
36 | - (void)testDescriptionForReachabilityType{
37 | MSAIReachabilityType type = MSAIReachabilityTypeNone;
38 | assertThat([_sut descriptionForReachabilityType:type], equalToIgnoringCase(@"none"));
39 |
40 | type = MSAIReachabilityTypeWIFI;
41 | assertThat([_sut descriptionForReachabilityType:type], equalToIgnoringCase(@"wifi"));
42 |
43 | type = MSAIReachabilityTypeWWAN;
44 | assertThat([_sut descriptionForReachabilityType:type], equalToIgnoringCase(@"wwan"));
45 | }
46 |
47 | @end
48 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCHamcrest.framework/Versions/A/Headers/HCIsCollectionContainingInOrder.h:
--------------------------------------------------------------------------------
1 | // OCHamcrest by Jon Reid, http://qualitycoding.org/about/
2 | // Copyright 2014 hamcrest.org. See LICENSE.txt
3 |
4 | #import
5 |
6 |
7 | @interface HCIsCollectionContainingInOrder : HCDiagnosingMatcher
8 |
9 | + (instancetype)isCollectionContainingInOrder:(NSArray *)itemMatchers;
10 | - (instancetype)initWithMatchers:(NSArray *)itemMatchers;
11 |
12 | @end
13 |
14 |
15 | FOUNDATION_EXPORT id HC_contains(id itemMatch, ...) NS_REQUIRES_NIL_TERMINATION;
16 |
17 | /**
18 | contains(firstMatcher, ...) -
19 | Matches if collection's elements satisfy a given list of matchers, in order.
20 |
21 | @param firstMatcher,... A comma-separated list of matchers ending with @c nil.
22 |
23 | This matcher iterates the evaluated collection and a given list of matchers, seeing if each
24 | element satisfies its corresponding matcher.
25 |
26 | Any argument that is not a matcher is implicitly wrapped in an @ref equalTo matcher to check for
27 | equality.
28 |
29 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
30 | @c HC_contains instead.)
31 |
32 | @ingroup collection_matchers
33 | */
34 | #ifdef HC_SHORTHAND
35 | #define contains HC_contains
36 | #endif
37 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCMock.framework/Versions/A/Headers/OCMLocation.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import
18 |
19 | @interface OCMLocation : NSObject
20 | {
21 | id testCase;
22 | NSString *file;
23 | NSUInteger line;
24 | }
25 |
26 | + (instancetype)locationWithTestCase:(id)aTestCase file:(NSString *)aFile line:(NSUInteger)aLine;
27 |
28 | - (instancetype)initWithTestCase:(id)aTestCase file:(NSString *)aFile line:(NSUInteger)aLine;
29 |
30 | - (id)testCase;
31 | - (NSString *)file;
32 | - (NSUInteger)line;
33 |
34 | @end
35 |
36 | extern OCMLocation *OCMMakeLocation(id testCase, const char *file, int line);
37 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCHamcrest.framework/Versions/A/Headers/HCIsCloseTo.h:
--------------------------------------------------------------------------------
1 | // OCHamcrest by Jon Reid, http://qualitycoding.org/about/
2 | // Copyright 2014 hamcrest.org. See LICENSE.txt
3 |
4 | #import
5 |
6 |
7 | @interface HCIsCloseTo : HCBaseMatcher
8 |
9 | + (instancetype)isCloseTo:(double)value within:(double)delta;
10 | - (instancetype)initWithValue:(double)value delta:(double)delta;
11 |
12 | @end
13 |
14 |
15 | FOUNDATION_EXPORT id HC_closeTo(double aValue, double aDelta);
16 |
17 | /**
18 | closeTo(aValue, aDelta) -
19 | Matches if object is a number close to a given value, within a given delta.
20 |
21 | @param aValue The @c double value to compare against as the expected value.
22 | @param aDelta The @c double maximum delta between the values for which the numbers are considered close.
23 |
24 | This matcher invokes @c -doubleValue on the evaluated object to get its value as a @c double.
25 | The result is compared against @a aValue to see if the difference is within a positive @a aDelta.
26 |
27 | Example:
28 | @li @ref closeTo(3.0, 0.25)
29 |
30 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
31 | @c HC_closeTo instead.)
32 |
33 | @ingroup number_matchers
34 | */
35 | #ifdef HC_SHORTHAND
36 | #define closeTo HC_closeTo
37 | #endif
38 |
--------------------------------------------------------------------------------
/Classes/MSAIDomain.m:
--------------------------------------------------------------------------------
1 | #import "MSAIDomain.h"
2 | /// Data contract class for type Domain.
3 | @implementation MSAIDomain
4 | @synthesize envelopeTypeName = _envelopeTypeName;
5 | @synthesize dataTypeName = _dataTypeName;
6 |
7 | /// Initializes a new instance of the class.
8 | - (instancetype)init {
9 | if (self = [super init]) {
10 | _envelopeTypeName = @"Microsoft.ApplicationInsights.Domain";
11 | _dataTypeName = @"Domain";
12 | }
13 | return self;
14 | }
15 |
16 | ///
17 | /// Adds all members of this class to a dictionary
18 | /// @param dictionary to which the members of this class will be added.
19 | ///
20 | - (MSAIOrderedDictionary *)serializeToDictionary {
21 | MSAIOrderedDictionary *dict = [super serializeToDictionary];
22 | return dict;
23 | }
24 |
25 | #pragma mark - NSCoding
26 |
27 | - (instancetype)initWithCoder:(NSCoder *)coder {
28 | self = [super initWithCoder:coder];
29 | if(self) {
30 | _envelopeTypeName = [coder decodeObjectForKey:@"_envelopeTypeName"];
31 | _dataTypeName = [coder decodeObjectForKey:@"_dataTypeName"];
32 | }
33 |
34 | return self;
35 | }
36 |
37 | - (void)encodeWithCoder:(NSCoder *)coder {
38 | [super encodeWithCoder:coder];
39 | [coder encodeObject:_envelopeTypeName forKey:@"_envelopeTypeName"];
40 | [coder encodeObject:_dataTypeName forKey:@"_dataTypeName"];
41 | }
42 |
43 |
44 | @end
45 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCHamcrest.framework/Versions/A/Headers/HCIsCollectionOnlyContaining.h:
--------------------------------------------------------------------------------
1 | // OCHamcrest by Jon Reid, http://qualitycoding.org/about/
2 | // Copyright 2014 hamcrest.org. See LICENSE.txt
3 |
4 | #import
5 |
6 |
7 | @interface HCIsCollectionOnlyContaining : HCEvery
8 |
9 | + (instancetype)isCollectionOnlyContaining:(id )matcher;
10 |
11 | @end
12 |
13 |
14 | FOUNDATION_EXPORT id HC_onlyContains(id itemMatch, ...) NS_REQUIRES_NIL_TERMINATION;
15 |
16 | /**
17 | onlyContains(firstMatcher, ...) -
18 | Matches if each element of collection satisfies any of the given matchers.
19 |
20 | @param firstMatcher,... A comma-separated list of matchers ending with @c nil.
21 |
22 | This matcher iterates the evaluated collection, confirming whether each element satisfies any of
23 | the given matchers.
24 |
25 | Any argument that is not a matcher is implicitly wrapped in an @ref equalTo matcher to check for
26 | equality.
27 |
28 | Example:
29 |
30 | @par
31 | @ref onlyContains(startsWith(@"Jo"), nil)
32 |
33 | will match a collection [@"Jon", @"John", @"Johann"].
34 |
35 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
36 | @c HC_onlyContains instead.)
37 |
38 | @ingroup collection_matchers
39 | */
40 | #ifdef HC_SHORTHAND
41 | #define onlyContains HC_onlyContains
42 | #endif
43 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCMock.framework/Versions/A/Headers/OCMMacroState.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import
18 |
19 | @class OCMLocation;
20 | @class OCMRecorder;
21 | @class OCMStubRecorder;
22 | @class OCMockObject;
23 |
24 |
25 | @interface OCMMacroState : NSObject
26 | {
27 | OCMRecorder *recorder;
28 | }
29 |
30 | + (void)beginStubMacro;
31 | + (OCMStubRecorder *)endStubMacro;
32 |
33 | + (void)beginExpectMacro;
34 | + (OCMStubRecorder *)endExpectMacro;
35 |
36 | + (void)beginVerifyMacroAtLocation:(OCMLocation *)aLocation;
37 | + (void)endVerifyMacro;
38 |
39 | + (OCMMacroState *)globalState;
40 |
41 | - (OCMRecorder *)recorder;
42 |
43 | - (void)switchToClassMethod;
44 |
45 | @end
46 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCHamcrest.framework/Versions/A/Headers/HCHasDescription.h:
--------------------------------------------------------------------------------
1 | // OCHamcrest by Jon Reid, http://qualitycoding.org/about/
2 | // Copyright 2014 hamcrest.org. See LICENSE.txt
3 |
4 | #import
5 |
6 |
7 | @interface HCHasDescription : HCInvocationMatcher
8 |
9 | + (instancetype)hasDescription:(id )descriptionMatcher;
10 | - (instancetype)initWithDescription:(id )descriptionMatcher;
11 |
12 | @end
13 |
14 |
15 | FOUNDATION_EXPORT id HC_hasDescription(id match);
16 |
17 | /**
18 | hasDescription(aMatcher) -
19 | Matches if object's @c -description satisfies a given matcher.
20 |
21 | @param aMatcher The matcher to satisfy, or an expected value for @ref equalTo matching.
22 |
23 | This matcher invokes @c -description on the evaluated object to get its description, passing the
24 | result to a given matcher for evaluation. If the @a aMatcher argument is not a matcher, it is
25 | implicitly wrapped in an @ref equalTo matcher to check for equality.
26 |
27 | Examples:
28 | @li @ref hasDescription(@ref startsWith(\@"foo"))
29 | @li @ref hasDescription(\@"bar")
30 |
31 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
32 | @c HC_hasDescription instead.)
33 |
34 | @ingroup object_matchers
35 | */
36 | #ifdef HC_SHORTHAND
37 | #define hasDescription HC_hasDescription
38 | #endif
39 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCHamcrest.framework/Versions/A/Headers/HCIsEqualIgnoringWhiteSpace.h:
--------------------------------------------------------------------------------
1 | // OCHamcrest by Jon Reid, http://qualitycoding.org/about/
2 | // Copyright 2014 hamcrest.org. See LICENSE.txt
3 |
4 | #import
5 |
6 |
7 | @interface HCIsEqualIgnoringWhiteSpace : HCBaseMatcher
8 |
9 | + (instancetype)isEqualIgnoringWhiteSpace:(NSString *)string;
10 | - (instancetype)initWithString:(NSString *)string;
11 |
12 | @end
13 |
14 |
15 | FOUNDATION_EXPORT id HC_equalToIgnoringWhiteSpace(NSString *aString);
16 |
17 | /**
18 | equalToIgnoringWhiteSpace(aString) -
19 | Matches if object is a string equal to a given string, ignoring differences in whitespace.
20 |
21 | @param aString The string to compare against as the expected value. This value must not be @c nil.
22 |
23 | This matcher first checks whether the evaluated object is a string. If so, it compares it with
24 | @a aString, ignoring differences in runs of whitespace.
25 |
26 | Example:
27 |
28 | @par
29 | @ref equalToIgnoringWhiteSpace(@"hello world")
30 |
31 | will match @verbatim "hello world" @endverbatim
32 |
33 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
34 | @c HC_equalToIgnoringWhiteSpace instead.)
35 |
36 | @ingroup text_matchers
37 | */
38 | #ifdef HC_SHORTHAND
39 | #define equalToIgnoringWhiteSpace HC_equalToIgnoringWhiteSpace
40 | #endif
41 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCHamcrest.framework/Versions/A/Headers/HCIsDictionaryContainingKey.h:
--------------------------------------------------------------------------------
1 | // OCHamcrest by Jon Reid, http://qualitycoding.org/about/
2 | // Copyright 2014 hamcrest.org. See LICENSE.txt
3 |
4 | #import
5 |
6 |
7 | @interface HCIsDictionaryContainingKey : HCBaseMatcher
8 |
9 | + (instancetype)isDictionaryContainingKey:(id )keyMatcher;
10 | - (instancetype)initWithKeyMatcher:(id )keyMatcher;
11 |
12 | @end
13 |
14 |
15 | FOUNDATION_EXPORT id HC_hasKey(id keyMatch);
16 |
17 | /**
18 | hasKey(keyMatcher) -
19 | Matches if dictionary contains an entry whose key satisfies a given matcher.
20 |
21 | @param keyMatcher The matcher to satisfy for the key, or an expected value for @ref equalTo matching.
22 |
23 | This matcher iterates the evaluated dictionary, searching for any key-value entry whose key
24 | satisfies the given matcher. If a matching entry is found, @c hasKey is satisfied.
25 |
26 | Any argument that is not a matcher is implicitly wrapped in an @ref equalTo matcher to check for
27 | equality.
28 |
29 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
30 | @c HC_hasKey instead.)
31 |
32 | Examples:
33 | @li @ref hasEntry(equalTo(@"foo"))
34 | @li @ref hasEntry(@"foo")
35 |
36 | @ingroup collection_matchers
37 | */
38 | #ifdef HC_SHORTHAND
39 | #define hasKey HC_hasKey
40 | #endif
41 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCHamcrest.framework/Versions/A/Headers/HCInvocationMatcher.h:
--------------------------------------------------------------------------------
1 | // OCHamcrest by Jon Reid, http://qualitycoding.org/about/
2 | // Copyright 2014 hamcrest.org. See LICENSE.txt
3 |
4 | #import
5 |
6 |
7 | /**
8 | Supporting class for matching a feature of an object.
9 |
10 | Tests whether the result of passing a given invocation to the value satisfies a given matcher.
11 |
12 | @ingroup helpers
13 | */
14 | @interface HCInvocationMatcher : HCBaseMatcher
15 | {
16 | NSInvocation *_invocation;
17 | id _subMatcher;
18 | }
19 |
20 | /**
21 | Determines whether a mismatch will be described in short form.
22 |
23 | Default is long form, which describes the object, the name of the invocation, and the
24 | sub-matcher's mismatch diagnosis. Short form only has the sub-matcher's mismatch diagnosis.
25 | */
26 | @property (nonatomic, assign) BOOL shortMismatchDescription;
27 |
28 | /**
29 | Returns an HCInvocationMatcher object initialized with an invocation and a matcher.
30 | */
31 | - (instancetype)initWithInvocation:(NSInvocation *)anInvocation matching:(id )aMatcher;
32 |
33 | /**
34 | Invokes stored invocation on given item and returns the result.
35 | */
36 | - (id)invokeOn:(id)item;
37 |
38 | /**
39 | Returns string representation of the invocation's selector.
40 | */
41 | - (NSString *)stringFromSelector;
42 |
43 | @end
44 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCHamcrest.framework/Versions/A/Headers/HCIsDictionaryContainingValue.h:
--------------------------------------------------------------------------------
1 | // OCHamcrest by Jon Reid, http://qualitycoding.org/about/
2 | // Copyright 2014 hamcrest.org. See LICENSE.txt
3 |
4 | #import
5 |
6 |
7 | @interface HCIsDictionaryContainingValue : HCBaseMatcher
8 |
9 | + (instancetype)isDictionaryContainingValue:(id )valueMatcher;
10 | - (instancetype)initWithValueMatcher:(id )valueMatcher;
11 |
12 | @end
13 |
14 |
15 | FOUNDATION_EXPORT id HC_hasValue(id valueMatch);
16 |
17 | /**
18 | hasValue(valueMatcher) -
19 | Matches if dictionary contains an entry whose value satisfies a given matcher.
20 |
21 | @param valueMatcher The matcher to satisfy for the value, or an expected value for @ref equalTo matching.
22 |
23 | This matcher iterates the evaluated dictionary, searching for any key-value entry whose value
24 | satisfies the given matcher. If a matching entry is found, @c hasValue is satisfied.
25 |
26 | Any argument that is not a matcher is implicitly wrapped in an @ref equalTo matcher to check for
27 | equality.
28 |
29 | Examples:
30 | @li @ref hasValue(equalTo(@"bar"))
31 | @li @ref hasValue(@"bar")
32 |
33 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
34 | @c HC_hasValue instead.)
35 |
36 | @ingroup collection_matchers
37 | */
38 | #ifdef HC_SHORTHAND
39 | #define hasValue HC_hasValue
40 | #endif
41 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/MSAITestsDependencyInjection.m:
--------------------------------------------------------------------------------
1 | #import "MSAITestsDependencyInjection.h"
2 |
3 | static NSUserDefaults *mockUserDefaults;
4 | static id testNotificationCenter;
5 | static id mockCenter;
6 |
7 | @implementation NSUserDefaults (UnitTests)
8 |
9 | + (instancetype)standardUserDefaults {
10 | if (!mockUserDefaults) {
11 | mockUserDefaults = OCMPartialMock([NSUserDefaults new]);
12 | }
13 | return mockUserDefaults;
14 | }
15 |
16 | @end
17 |
18 | @implementation MSAITestsDependencyInjection
19 |
20 | - (void)setUp {
21 | [self setMockNotificationCenter:OCMPartialMock([NSNotificationCenter new])];
22 | }
23 |
24 | - (void)tearDown {
25 | [super tearDown];
26 | mockUserDefaults = nil;
27 | }
28 |
29 | # pragma mark - Helper
30 |
31 | - (void)setMockNotificationCenter:(id)mockNotificationCenter {
32 | mockCenter = OCMClassMock([NSNotificationCenter class]);
33 | #pragma clang diagnostic push
34 | #pragma clang diagnostic ignored "-Wstrict-selector-match"
35 | OCMStub([mockCenter defaultCenter]).andReturn(mockNotificationCenter);
36 | #pragma clang diagnostic pop
37 | testNotificationCenter = mockNotificationCenter;
38 | }
39 |
40 | - (id)mockNotificationCenter {
41 | return testNotificationCenter;
42 | }
43 |
44 | - (void)setMockUserDefaults:(NSUserDefaults *)userDefaults {
45 | mockUserDefaults = userDefaults;
46 | }
47 |
48 | - (NSUserDefaults *)mockUserDefaults {
49 | return mockUserDefaults;
50 | }
51 |
52 | @end
53 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCMock.framework/Versions/A/Resources/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | BuildMachineOSBuild
6 | 13F34
7 | CFBundleDevelopmentRegion
8 | English
9 | CFBundleExecutable
10 | OCMock
11 | CFBundleIdentifier
12 | com.mulle-kybernetik.OCMock
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | OCMock
17 | CFBundlePackageType
18 | FMWK
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | 1
25 | DTCompiler
26 | com.apple.compilers.llvm.clang.1_0
27 | DTPlatformBuild
28 | 6A2008a
29 | DTPlatformVersion
30 | GM
31 | DTSDKBuild
32 | 14A382
33 | DTSDKName
34 | macosx10.10
35 | DTXcode
36 | 0611
37 | DTXcodeBuild
38 | 6A2008a
39 | NSHumanReadableCopyright
40 | Copyright © 2004-2013 Mulle Kybernetik.
41 |
42 |
43 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCMockito.framework/Versions/A/Resources/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | BuildMachineOSBuild
6 | 14B25
7 | CFBundleDevelopmentRegion
8 | English
9 | CFBundleExecutable
10 | OCMockito
11 | CFBundleIdentifier
12 | org.mockito.OCMockito
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | OCMockito
17 | CFBundlePackageType
18 | FMWK
19 | CFBundleShortVersionString
20 | 1.4.0
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | 1.4.0
25 | DTCompiler
26 | com.apple.compilers.llvm.clang.1_0
27 | DTPlatformBuild
28 | 6A2008a
29 | DTPlatformVersion
30 | GM
31 | DTSDKBuild
32 | 14A382
33 | DTSDKName
34 | macosx10.10
35 | DTXcode
36 | 0611
37 | DTXcodeBuild
38 | 6A2008a
39 | NSHumanReadableCopyright
40 | Copyright © 2015 Jonathan M. Reid
41 |
42 |
43 |
--------------------------------------------------------------------------------
/Classes/MSAIGZIP.h:
--------------------------------------------------------------------------------
1 | //
2 | // GZIP.h
3 | //
4 | // Version 1.0.3
5 | //
6 | // Created by Nick Lockwood on 03/06/2012.
7 | // Copyright (C) 2012 Charcoal Design
8 | //
9 | // Distributed under the permissive zlib License
10 | // Get the latest version from here:
11 | //
12 | // https://github.com/nicklockwood/GZIP
13 | //
14 | // This software is provided 'as-is', without any express or implied
15 | // warranty. In no event will the authors be held liable for any damages
16 | // arising from the use of this software.
17 | //
18 | // Permission is granted to anyone to use this software for any purpose,
19 | // including commercial applications, and to alter it and redistribute it
20 | // freely, subject to the following restrictions:
21 | //
22 | // 1. The origin of this software must not be misrepresented; you must not
23 | // claim that you wrote the original software. If you use this software
24 | // in a product, an acknowledgment in the product documentation would be
25 | // appreciated but is not required.
26 | //
27 | // 2. Altered source versions must be plainly marked as such, and must not be
28 | // misrepresented as being the original software.
29 | //
30 | // 3. This notice may not be removed or altered from any source distribution.
31 | //
32 |
33 |
34 | #import
35 |
36 | @interface NSData (GZIP)
37 |
38 | - (NSData *)gzippedDataWithCompressionLevel:(float)level;
39 | - (NSData *)gzippedData;
40 | - (NSData *)gunzippedData;
41 |
42 | @end
43 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCHamcrest.framework/Versions/A/Resources/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | BuildMachineOSBuild
6 | 14A389
7 | CFBundleDevelopmentRegion
8 | English
9 | CFBundleExecutable
10 | OCHamcrest
11 | CFBundleIdentifier
12 | org.hamcrest.OCHamcrest
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | OCHamcrest
17 | CFBundlePackageType
18 | FMWK
19 | CFBundleShortVersionString
20 | 4.1.1
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | 4.1.1
25 | DTCompiler
26 | com.apple.compilers.llvm.clang.1_0
27 | DTPlatformBuild
28 | 6A2008a
29 | DTPlatformVersion
30 | GM
31 | DTSDKBuild
32 | 14A382
33 | DTSDKName
34 | macosx10.10
35 | DTXcode
36 | 0611
37 | DTXcodeBuild
38 | 6A2008a
39 | NSHumanReadableCopyright
40 | Copyright © 2014 hamcrest.org
41 |
42 |
43 |
--------------------------------------------------------------------------------
/Classes/MSAISession.m:
--------------------------------------------------------------------------------
1 | #import "MSAISession.h"
2 | #import "MSAIOrderedDictionary.h"
3 |
4 | /// Data contract class for type Session.
5 | @implementation MSAISession
6 |
7 | ///
8 | /// Adds all members of this class to a dictionary
9 | /// @param dictionary to which the members of this class will be added.
10 | ///
11 | - (MSAIOrderedDictionary *)serializeToDictionary {
12 | MSAIOrderedDictionary *dict = [super serializeToDictionary];
13 | if (self.sessionId != nil) {
14 | [dict setObject:self.sessionId forKey:@"ai.session.id"];
15 | }
16 | if (self.isFirst != nil) {
17 | [dict setObject:self.isFirst forKey:@"ai.session.isFirst"];
18 | }
19 | if (self.isNew != nil) {
20 | [dict setObject:self.isNew forKey:@"ai.session.isNew"];
21 | }
22 | return dict;
23 | }
24 |
25 | #pragma mark - NSCoding
26 |
27 | - (instancetype)initWithCoder:(NSCoder *)coder {
28 | self = [super initWithCoder:coder];
29 | if(self) {
30 | _sessionId = [coder decodeObjectForKey:@"self.sessionId"];
31 | _isFirst = [coder decodeObjectForKey:@"self.isFirst"];
32 | _isNew = [coder decodeObjectForKey:@"self.isNew"];
33 | }
34 |
35 | return self;
36 | }
37 |
38 | - (void)encodeWithCoder:(NSCoder *)coder {
39 | [super encodeWithCoder:coder];
40 | [coder encodeObject:self.sessionId forKey:@"self.sessionId"];
41 | [coder encodeObject:self.isFirst forKey:@"self.isFirst"];
42 | [coder encodeObject:self.isNew forKey:@"self.isNew"];
43 | }
44 |
45 |
46 | @end
47 |
--------------------------------------------------------------------------------
/Classes/MSAIApplication.m:
--------------------------------------------------------------------------------
1 | #import "MSAIApplication.h"
2 | #import "MSAIOrderedDictionary.h"
3 |
4 | /// Data contract class for type Application.
5 | @implementation MSAIApplication
6 |
7 | ///
8 | /// Adds all members of this class to a dictionary
9 | /// @param dictionary to which the members of this class will be added.
10 | ///
11 | - (MSAIOrderedDictionary *)serializeToDictionary {
12 | MSAIOrderedDictionary *dict = [super serializeToDictionary];
13 | if (self.version != nil) {
14 | [dict setObject:self.version forKey:@"ai.application.ver"];
15 | }
16 | if (self.build != nil) {
17 | [dict setObject:self.build forKey:@"ai.application.build"];
18 | }
19 | if (self.typeId != nil) {
20 | [dict setObject:self.typeId forKey:@"ai.application.typeId"];
21 | }
22 | return dict;
23 | }
24 |
25 | #pragma mark - NSCoding
26 |
27 | - (instancetype)initWithCoder:(NSCoder *)coder {
28 | self = [super initWithCoder:coder];
29 | if (self) {
30 | _version = [coder decodeObjectForKey:@"self.version"];
31 | _build = [coder decodeObjectForKey:@"self.build"];
32 | _typeId = [coder decodeObjectForKey:@"self.typeId"];
33 | }
34 |
35 | return self;
36 | }
37 |
38 | - (void)encodeWithCoder:(NSCoder *)coder {
39 | [super encodeWithCoder:coder];
40 | [coder encodeObject:self.version forKey:@"self.version"];
41 | [coder encodeObject:self.build forKey:@"self.build"];
42 | [coder encodeObject:self.typeId forKey:@"self.typeId"];
43 | }
44 |
45 |
46 | @end
47 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCHamcrest.framework/Versions/A/Headers/HCDescribedAs.h:
--------------------------------------------------------------------------------
1 | // OCHamcrest by Jon Reid, http://qualitycoding.org/about/
2 | // Copyright 2014 hamcrest.org. See LICENSE.txt
3 |
4 | #import
5 |
6 |
7 | @interface HCDescribedAs : HCBaseMatcher
8 |
9 | + (instancetype)describedAs:(NSString *)description
10 | forMatcher:(id )matcher
11 | overValues:(NSArray *)templateValues;
12 |
13 | - (instancetype)initWithDescription:(NSString *)description
14 | forMatcher:(id )matcher
15 | overValues:(NSArray *)templateValues;
16 |
17 | @end
18 |
19 |
20 | FOUNDATION_EXPORT id HC_describedAs(NSString *description, id matcher, ...) NS_REQUIRES_NIL_TERMINATION;
21 |
22 | /**
23 | describedAs(description, matcher, ...) -
24 | Adds custom failure description to a given matcher.
25 |
26 | @param description Overrides the matcher's description.
27 | @param matcher,... The matcher to satisfy, followed by a comma-separated list of substitution values ending with @c nil.
28 |
29 | The description may contain substitution placeholders \%0, \%1, etc. These will be replaced by
30 | any values that follow the matcher.
31 |
32 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
33 | @c HC_describedAs instead.)
34 |
35 | @ingroup decorator_matchers
36 | */
37 | #ifdef HC_SHORTHAND
38 | #define describedAs HC_describedAs
39 | #endif
40 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCHamcrest.framework/Versions/A/Headers/HCStringContainsInOrder.h:
--------------------------------------------------------------------------------
1 | // OCHamcrest by Jon Reid, http://qualitycoding.org/about/
2 | // Copyright 2014 hamcrest.org. See LICENSE.txt
3 |
4 | #import
5 |
6 |
7 | @interface HCStringContainsInOrder : HCBaseMatcher
8 | {
9 | NSArray *substrings;
10 | }
11 |
12 | + (instancetype)containsInOrder:(NSArray *)substringList;
13 | - (instancetype)initWithSubstrings:(NSArray *)substringList;
14 |
15 | @end
16 |
17 |
18 | FOUNDATION_EXPORT id HC_stringContainsInOrder(NSString *substring, ...) NS_REQUIRES_NIL_TERMINATION;
19 |
20 | /**
21 | stringContainsInOrder(firstString, ...) -
22 | Matches if object is a string containing a given list of substrings in relative order.
23 |
24 | @param firstString,... A comma-separated list of strings ending with @c nil.
25 |
26 | This matcher first checks whether the evaluated object is a string. If so, it checks whether it
27 | contains a given list of strings, in relative order to each other. The searches are performed
28 | starting from the beginning of the evaluated string.
29 |
30 | Example:
31 |
32 | @par
33 | @ref stringContainsInOrder(@"bc", @"fg", @"jkl", nil)
34 |
35 | will match "abcdefghijklm".
36 |
37 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
38 | @c HC_stringContainsInOrder instead.)
39 |
40 | @ingroup text_matchers
41 | */
42 | #ifdef HC_SHORTHAND
43 | #define stringContainsInOrder HC_stringContainsInOrder
44 | #endif
45 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/MSAIInternalTests.m:
--------------------------------------------------------------------------------
1 | #import
2 | #import "MSAIInternal.h"
3 |
4 | @interface MSAIInternalTests : XCTestCase
5 |
6 | @end
7 |
8 | @implementation MSAIInternalTests
9 |
10 | - (void)testsdk_versionPropertyWorksAsExpected {
11 | NSString *expected = @"Test string";
12 | MSAIInternal *item = [MSAIInternal new];
13 | item.sdkVersion = expected;
14 | NSString *actual = item.sdkVersion;
15 | XCTAssertTrue([actual isEqualToString:expected]);
16 |
17 | expected = @"Other string";
18 | item.sdkVersion = expected;
19 | actual = item.sdkVersion;
20 | XCTAssertTrue([actual isEqualToString:expected]);
21 | }
22 |
23 | - (void)testagent_versionPropertyWorksAsExpected {
24 | NSString *expected = @"Test string";
25 | MSAIInternal *item = [MSAIInternal new];
26 | item.agentVersion = expected;
27 | NSString *actual = item.agentVersion;
28 | XCTAssertTrue([actual isEqualToString:expected]);
29 |
30 | expected = @"Other string";
31 | item.agentVersion = expected;
32 | actual = item.agentVersion;
33 | XCTAssertTrue([actual isEqualToString:expected]);
34 | }
35 |
36 | - (void)testSerialize {
37 | MSAIInternal *item = [MSAIInternal new];
38 | item.sdkVersion = @"Test string";
39 | item.agentVersion = @"Test string";
40 | NSString *actual = [item serializeToString];
41 | NSString *expected = @"{\"ai.internal.sdkVersion\":\"Test string\",\"ai.internal.agentVersion\":\"Test string\"}";
42 | XCTAssertTrue([actual isEqualToString:expected]);
43 | }
44 |
45 | @end
46 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCHamcrest.framework/Versions/A/Headers/HCIsCollectionContainingInAnyOrder.h:
--------------------------------------------------------------------------------
1 | // OCHamcrest by Jon Reid, http://qualitycoding.org/about/
2 | // Copyright 2014 hamcrest.org. See LICENSE.txt
3 |
4 | #import
5 |
6 |
7 | @interface HCIsCollectionContainingInAnyOrder : HCDiagnosingMatcher
8 |
9 | + (instancetype)isCollectionContainingInAnyOrder:(NSArray *)itemMatchers;
10 | - (instancetype)initWithMatchers:(NSArray *)itemMatchers;
11 |
12 | @end
13 |
14 |
15 | FOUNDATION_EXPORT id HC_containsInAnyOrder(id itemMatch, ...) NS_REQUIRES_NIL_TERMINATION;
16 |
17 | /**
18 | containsInAnyOrder(firstMatcher, ...) -
19 | Matches if collection's elements, in any order, satisfy a given list of matchers.
20 |
21 | @param firstMatcher,... A comma-separated list of matchers ending with @c nil.
22 |
23 | This matcher iterates the evaluated collection, seeing if each element satisfies any of the
24 | given matchers. The matchers are tried from left to right, and when a satisfied matcher is
25 | found, it is no longer a candidate for the remaining elements. If a one-to-one correspondence is
26 | established between elements and matchers, @c containsInAnyOrder is satisfied.
27 |
28 | Any argument that is not a matcher is implicitly wrapped in an @ref equalTo matcher to check for
29 | equality.
30 |
31 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
32 | @c HC_containsInAnyOrder instead.)
33 |
34 | @ingroup collection_matchers
35 | */
36 | #ifdef HC_SHORTHAND
37 | #define containsInAnyOrder HC_containsInAnyOrder
38 | #endif
39 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/MSAIPageViewDataTests.m:
--------------------------------------------------------------------------------
1 | #import
2 | #import "MSAIPageViewData.h"
3 |
4 | @interface MSAIPageViewDataTests : XCTestCase
5 |
6 | @end
7 |
8 | @implementation MSAIPageViewDataTests
9 |
10 | - (void)testurlPropertyWorksAsExpected {
11 | NSString *expected = @"Test string";
12 | MSAIPageViewData *item = [MSAIPageViewData new];
13 | item.url = expected;
14 | NSString *actual = item.url;
15 | XCTAssertTrue([actual isEqualToString:expected]);
16 |
17 | expected = @"Other string";
18 | item.url = expected;
19 | actual = item.url;
20 | XCTAssertTrue([actual isEqualToString:expected]);
21 | }
22 |
23 | - (void)testdurationPropertyWorksAsExpected {
24 | NSString *expected = @"Test string";
25 | MSAIPageViewData *item = [MSAIPageViewData new];
26 | item.duration = expected;
27 | NSString *actual = item.duration;
28 | XCTAssertTrue([actual isEqualToString:expected]);
29 |
30 | expected = @"Other string";
31 | item.duration = expected;
32 | actual = item.duration;
33 | XCTAssertTrue([actual isEqualToString:expected]);
34 | }
35 |
36 | - (void)testSerialize {
37 | MSAIPageViewData *item = [MSAIPageViewData new];
38 | item.url = @"Test string";
39 | item.duration = @"Test string";
40 | item.referrer = @"Test referrer";
41 | item.referrerData = @"Test data";
42 | NSString *actual = [item serializeToString];
43 | NSString *expected = @"{\"ver\":2,\"properties\":{},\"measurements\":{},\"url\":\"Test string\",\"duration\":\"Test string\"}";
44 | XCTAssertTrue([actual isEqualToString:expected]);
45 | }
46 |
47 | @end
48 |
--------------------------------------------------------------------------------
/docs/index.md:
--------------------------------------------------------------------------------
1 | ## Introduction
2 |
3 | This project provides an iOS SDK for Application Insights. [Application Insights](http://azure.microsoft.com/en-us/services/application-insights/) is a service that allows developers to keep their applications available, performing, and succeeding. This module allows you to send telemetry of various kinds (events, traces, exceptions, etc.) to the Application Insights service where your data can be visualized in the Azure Portal.
4 |
5 | The following features are currently supported:
6 |
7 | 1. **Send telemetry data:** The SDK allows you to send telemetry of various kinds (event, trace, measurement, etc.) to the Application Insights service where they can be visualized in the Azure Portal.
8 |
9 | 2. **Collect crash reports:** If you app crashes, a crash log with the same format as from the Apple Crash Reporter is written to the device's storage. If the user starts the app again, he is asked to submit the crash report to Application Insights. This works for both beta and live apps, i.e. those submitted to the App Store!
10 |
11 | The main SDK class is `MSAIAppInsights`. It initializes all modules and provides access to them, so they can be further adjusted if required. Additionally all modules provide their own protocols.
12 |
13 | ## Howto
14 |
15 | Please have a look at our [Readme](Readme)
16 |
17 | ## Repository
18 |
19 | We're on [Github](https://github.com/Microsoft/ApplicationInsights-iOS)
20 |
21 | ## Contact
22 |
23 | If you have further questions or are running into trouble that cannot be resolved by any of the steps here, feel free to contact us at [AppInsights-iOS@microsoft.com](mailto:AppInsights-ios@microsoft.com)
24 |
--------------------------------------------------------------------------------
/Classes/MSAIPersistence.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "MSAINullability.h"
3 |
4 | NS_ASSUME_NONNULL_BEGIN
5 |
6 | /**
7 | * The MSAIPersistenceType determines the way how a bundle is saved.
8 | * Bundles of type MSAIPersistenceTypeHighPriority will be loaded before all bundles if type MSAIPersistenceTypeRegular.
9 | */
10 | typedef NS_ENUM(NSInteger, MSAIPersistenceType) {
11 | MSAIPersistenceTypeHighPriority = 0,
12 | MSAIPersistenceTypeRegular = 1,
13 | };
14 |
15 | /**
16 | * A simple class that handles serialisation and deserialisation of bundles of data.
17 | */
18 | @interface MSAIPersistence : NSObject
19 |
20 | ///-----------------------------------------------------------------------------
21 | /// @name Create an instance
22 | ///-----------------------------------------------------------------------------
23 |
24 | /**
25 | * Returns a shared MSAIPersistence object.
26 | *
27 | * @return A singleton MSAIPersistence instance ready use
28 | */
29 | + (instancetype)sharedInstance;
30 |
31 | ///-----------------------------------------------------------------------------
32 | /// @name Getting a path
33 | ///-----------------------------------------------------------------------------
34 |
35 | /**
36 | * Creates the path for a file depending on the MSAIPersistenceType.
37 | * The filename includes the timestamp.
38 | * For each MSAIPersistenceType, we create a folder within the app's Application Support directory directory
39 | *
40 | * @param type The MSAIPersistenceType for which a matching file URL will be returned.
41 | */
42 | - (NSString *)newFileURLForPersitenceType:(MSAIPersistenceType)type;
43 |
44 | @end
45 | NS_ASSUME_NONNULL_END
46 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCHamcrest.framework/Versions/A/Headers/HCIs.h:
--------------------------------------------------------------------------------
1 | // OCHamcrest by Jon Reid, http://qualitycoding.org/about/
2 | // Copyright 2014 hamcrest.org. See LICENSE.txt
3 |
4 | #import
5 |
6 |
7 | @interface HCIs : HCBaseMatcher
8 |
9 | + (instancetype)is:(id )matcher;
10 | - (instancetype)initWithMatcher:(id )matcher;
11 |
12 | @end
13 |
14 |
15 | FOUNDATION_EXPORT id HC_is(id match);
16 |
17 | /**
18 | is(aMatcher) -
19 | Decorates another matcher, or provides a shortcut to the frequently used @ref is(equalTo(x)).
20 |
21 | @param aMatcher The matcher to satisfy, or an expected value for @ref equalTo matching.
22 |
23 | This matcher compares the evaluated object to the given matcher.
24 |
25 | If the @a aMatcher argument is a matcher, its behavior is retained, but the test may be more
26 | expressive. For example:
27 | @li @ref assertThat(@(value), equalTo(@5))
28 | @li @ref assertThat(@(value), is(equalTo(@5)))
29 |
30 | If the @a aMatcher argument is not a matcher, it is wrapped in an @ref equalTo matcher. This
31 | makes the following statements equivalent:
32 | @li @ref assertThat(cheese, equalTo(smelly))
33 | @li @ref assertThat(cheese, is(equalTo(smelly)))
34 | @li @ref assertThat(cheese, is(smelly))
35 |
36 | Choose the style that makes your expression most readable. This will vary depending on context.
37 |
38 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
39 | @c HC_is instead.)
40 |
41 | @ingroup decorator_matchers
42 | */
43 | #ifdef HC_SHORTHAND
44 | #define is HC_is
45 | #endif
46 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCHamcrest.framework/Versions/A/Headers/HCHasProperty.h:
--------------------------------------------------------------------------------
1 | // OCHamcrest by Jon Reid, http://qualitycoding.org/about/
2 | // Copyright 2014 hamcrest.org. See LICENSE.txt
3 | // Contribution by Justin Shacklette
4 |
5 | #import
6 |
7 |
8 | @interface HCHasProperty : HCDiagnosingMatcher
9 |
10 | + (instancetype)hasProperty:(NSString *)property value:(id )valueMatcher;
11 | - (instancetype)initWithProperty:(NSString *)property value:(id )valueMatcher;
12 |
13 | @end
14 |
15 |
16 | FOUNDATION_EXPORT id HC_hasProperty(NSString *name, id valueMatch);
17 |
18 | /**
19 | hasProperty(name, valueMatcher) -
20 | Matches if object has a method of a given name whose return value satisfies a given matcher.
21 |
22 | @param name The name of a method without arguments that returns an object.
23 | @param valueMatcher The matcher to satisfy for the return value, or an expected value for @ref equalTo matching.
24 |
25 | This matcher first checks if the evaluated object has a method with a name matching the given
26 | @c name. If so, it invokes the method and sees if the returned value satisfies @c valueMatcher.
27 |
28 | While this matcher is called "hasProperty", it's useful for checking the results of any simple
29 | methods, not just properties.
30 |
31 | Examples:
32 | @li @ref hasProperty(\@"firstName", \@"Joe")
33 | @li @ref hasProperty(\@"firstName", startsWith(\@"J"))
34 |
35 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
36 | @c HC_hasProperty instead.)
37 |
38 | @ingroup object_matchers
39 | */
40 | #ifdef HC_SHORTHAND
41 | #define hasProperty HC_hasProperty
42 | #endif
43 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCHamcrest.framework/Versions/A/Headers/HCIsDictionaryContainingEntries.h:
--------------------------------------------------------------------------------
1 | // OCHamcrest by Jon Reid, http://qualitycoding.org/about/
2 | // Copyright 2014 hamcrest.org. See LICENSE.txt
3 |
4 | #import
5 |
6 |
7 | @interface HCIsDictionaryContainingEntries : HCDiagnosingMatcher
8 |
9 |
10 | + (instancetype)isDictionaryContainingKeys:(NSArray *)keys
11 | valueMatchers:(NSArray *)valueMatchers;
12 |
13 | - (instancetype)initWithKeys:(NSArray *)keys
14 | valueMatchers:(NSArray *)valueMatchers;
15 |
16 | @end
17 |
18 |
19 | FOUNDATION_EXPORT id HC_hasEntries(id keysAndValueMatch, ...) NS_REQUIRES_NIL_TERMINATION;
20 |
21 | /**
22 | hasEntries(firstKey, valueMatcher, ...) -
23 | Matches if dictionary contains entries satisfying a list of alternating keys and their value
24 | matchers.
25 |
26 | @param firstKey A key (not a matcher) to look up.
27 | @param valueMatcher,... The matcher to satisfy for the value, or an expected value for @ref equalTo matching.
28 |
29 | Note that the keys must be actual keys, not matchers. Any value argument that is not a matcher
30 | is implicitly wrapped in an @ref equalTo matcher to check for equality. The list must end with
31 | @c nil.
32 |
33 | Examples:
34 | @li @ref hasEntries(@"first", equalTo(@"Jon"), @"last", equalTo(@"Reid"), nil)
35 | @li @ref hasEntries(@"first", @"Jon", @"last", @"Reid", nil)
36 |
37 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
38 | @c HC_hasEntry instead.)
39 |
40 | @ingroup collection_matchers
41 | */
42 | #ifdef HC_SHORTHAND
43 | #define hasEntries HC_hasEntries
44 | #endif
45 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCHamcrest.framework/Versions/A/Headers/HCHasCount.h:
--------------------------------------------------------------------------------
1 | // OCHamcrest by Jon Reid, http://qualitycoding.org/about/
2 | // Copyright 2014 hamcrest.org. See LICENSE.txt
3 |
4 | #import
5 |
6 |
7 | @interface HCHasCount : HCBaseMatcher
8 |
9 | + (instancetype)hasCount:(id )matcher;
10 | - (instancetype)initWithCount:(id )matcher;
11 |
12 | @end
13 |
14 |
15 | FOUNDATION_EXPORT id HC_hasCount(id matcher);
16 |
17 | /**
18 | hasCount(aMatcher) -
19 | Matches if object's @c -count satisfies a given matcher.
20 |
21 | @param aMatcher The matcher to satisfy.
22 |
23 | This matcher invokes @c -count on the evaluated object to get the number of elements it
24 | contains, passing the result to @a aMatcher for evaluation.
25 |
26 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
27 | @c HC_hasCount instead.)
28 |
29 | @ingroup collection_matchers
30 | */
31 | #ifdef HC_SHORTHAND
32 | #define hasCount HC_hasCount
33 | #endif
34 |
35 |
36 | FOUNDATION_EXPORT id HC_hasCountOf(NSUInteger count);
37 |
38 | /**
39 | hasCountOf(value) -
40 | Matches if object's @c -count equals a given value.
41 |
42 | @param value @c NSUInteger value to compare against as the expected value.
43 |
44 | This matcher invokes @c -count on the evaluated object to get the number of elements it
45 | contains, comparing the result to @a value for equality.
46 |
47 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
48 | @c HC_hasCountOf instead.)
49 |
50 | @ingroup collection_matchers
51 | */
52 | #ifdef HC_SHORTHAND
53 | #define hasCountOf HC_hasCountOf
54 | #endif
55 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCHamcrest.framework/Versions/A/Headers/HCIsAnything.h:
--------------------------------------------------------------------------------
1 | // OCHamcrest by Jon Reid, http://qualitycoding.org/about/
2 | // Copyright 2014 hamcrest.org. See LICENSE.txt
3 |
4 | #import
5 |
6 |
7 | @interface HCIsAnything : HCBaseMatcher
8 | {
9 | NSString *description;
10 | }
11 |
12 | + (instancetype)isAnything;
13 | + (instancetype)isAnythingWithDescription:(NSString *)aDescription;
14 |
15 | - (instancetype)init;
16 | - (instancetype)initWithDescription:(NSString *)aDescription;
17 |
18 | @end
19 |
20 |
21 | FOUNDATION_EXPORT id HC_anything(void);
22 |
23 | /**
24 | Matches anything.
25 |
26 | This matcher always evaluates to @c YES. Specify this in composite matchers when the value of a
27 | particular element is unimportant.
28 |
29 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
30 | @c HC_anything instead.)
31 |
32 | @ingroup logical_matchers
33 | */
34 | #ifdef HC_SHORTHAND
35 | #define anything() HC_anything()
36 | #endif
37 |
38 |
39 | FOUNDATION_EXPORT id HC_anythingWithDescription(NSString *aDescription);
40 |
41 | /**
42 | anythingWithDescription(description) -
43 | Matches anything.
44 |
45 | @param description A string used to describe this matcher.
46 |
47 | This matcher always evaluates to @c YES. Specify this in collection matchers when the value of a
48 | particular element in a collection is unimportant.
49 |
50 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
51 | @c HC_anything instead.)
52 |
53 | @ingroup logical_matchers
54 | */
55 | #ifdef HC_SHORTHAND
56 | #define anythingWithDescription HC_anythingWithDescription
57 | #endif
58 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCMockito.framework/Versions/A/Headers/MKTPrimitiveArgumentMatching.h:
--------------------------------------------------------------------------------
1 | // OCMockito by Jon Reid, http://qualitycoding.org/about/
2 | // Copyright 2015 Jonathan M. Reid. See LICENSE.txt
3 |
4 | @protocol HCMatcher;
5 |
6 |
7 | /**
8 | Ability to specify OCHamcrest matchers for primitive numeric arguments.
9 | */
10 | @protocol MKTPrimitiveArgumentMatching
11 |
12 | /**
13 | Specifies OCHamcrest matcher for a specific argument of a method.
14 |
15 | For methods arguments that take objects, just pass the matcher directly as a method call. But
16 | for arguments that take primitive numeric types, call this to specify the matcher before passing
17 | in a dummy value. Upon verification, the actual numeric argument received will be converted to
18 | an NSNumber before being checked by the matcher.
19 |
20 | The argument index is 0-based, so the first argument of a method has index 0.
21 |
22 | Example:
23 | @code
24 | [[verify(mockArray) withMatcher:greaterThan([NSNumber numberWithInt:1]) forArgument:0]
25 | removeObjectAtIndex:0];
26 | @endcode
27 | This verifies that @c removeObjectAtIndex: was called with a number greater than 1.
28 | */
29 | - (id)withMatcher:(id )matcher forArgument:(NSUInteger)index;
30 |
31 | /**
32 | Specifies OCHamcrest matcher for the first argument of a method.
33 |
34 | Equivalent to withMatcher:matcher forArgument:0.
35 |
36 | Example:
37 | @code
38 | [[verify(mockArray) withMatcher:greaterThan([NSNumber numberWithInt:1]) forArgument:0]
39 | removeObjectAtIndex:0];
40 | @endcode
41 | This verifies that @c removeObjectAtIndex: was called with a number greater than 1.
42 | */
43 | - (id)withMatcher:(id )matcher;
44 |
45 | @end
46 |
--------------------------------------------------------------------------------
/Support/ApplicationInsights.xcodeproj/project.xcworkspace/xcshareddata/AppInsights.xccheckout:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDESourceControlProjectFavoriteDictionaryKey
6 |
7 | IDESourceControlProjectIdentifier
8 | AE5FFEA8-B181-488F-B659-A78FED549A1F
9 | IDESourceControlProjectName
10 | AppInsights
11 | IDESourceControlProjectOriginsDictionary
12 |
13 | 5B023693EFFEF2F44FB6AB33FD2AAF34F28DA39D
14 | https://github.com/Microsoft/AppInsights-iOS
15 |
16 | IDESourceControlProjectPath
17 | Support/AppInsights.xcodeproj
18 | IDESourceControlProjectRelativeInstallPathDictionary
19 |
20 | 5B023693EFFEF2F44FB6AB33FD2AAF34F28DA39D
21 | ../../..
22 |
23 | IDESourceControlProjectURL
24 | https://github.com/Microsoft/AppInsights-iOS
25 | IDESourceControlProjectVersion
26 | 111
27 | IDESourceControlProjectWCCIdentifier
28 | 5B023693EFFEF2F44FB6AB33FD2AAF34F28DA39D
29 | IDESourceControlProjectWCConfigurations
30 |
31 |
32 | IDESourceControlRepositoryExtensionIdentifierKey
33 | public.vcs.git
34 | IDESourceControlWCCIdentifierKey
35 | 5B023693EFFEF2F44FB6AB33FD2AAF34F28DA39D
36 | IDESourceControlWCCName
37 | AppInsights-iOS
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/Classes/MSAISessionStateData.m:
--------------------------------------------------------------------------------
1 | #import "MSAISessionStateData.h"
2 | #import "MSAIOrderedDictionary.h"
3 |
4 | /// Data contract class for type SessionStateData.
5 | @implementation MSAISessionStateData
6 | @synthesize envelopeTypeName = _envelopeTypeName;
7 | @synthesize dataTypeName = _dataTypeName;
8 | @synthesize version = _version;
9 |
10 | /// Initializes a new instance of the class.
11 | - (instancetype)init {
12 | if(self = [super init]) {
13 | _envelopeTypeName = @"Microsoft.ApplicationInsights.SessionState";
14 | _dataTypeName = @"SessionStateData";
15 | _version = @2;
16 | _state = MSAISessionState_start;
17 | }
18 | return self;
19 | }
20 |
21 | ///
22 | /// Adds all members of this class to a dictionary
23 | /// @param dictionary to which the members of this class will be added.
24 | ///
25 | - (MSAIOrderedDictionary *)serializeToDictionary {
26 | MSAIOrderedDictionary *dict = [super serializeToDictionary];
27 | [dict setObject:[NSNumber numberWithInt:(int)self.state] forKey:@"state"];
28 | return dict;
29 | }
30 |
31 | #pragma mark - NSCoding
32 |
33 | - (instancetype)initWithCoder:(NSCoder *)coder {
34 | self = [super initWithCoder:coder];
35 | if(self) {
36 | _envelopeTypeName =[coder decodeObjectForKey:@"envelopeTypeName"];
37 | _dataTypeName = [coder decodeObjectForKey:@"dataTypeName"];
38 | _state = (MSAISessionState)[coder decodeIntForKey:@"self.state"];
39 | }
40 | return self;
41 | }
42 |
43 | - (void)encodeWithCoder:(NSCoder *)coder {
44 | [super encodeWithCoder:coder];
45 | [coder encodeObject:self.envelopeTypeName forKey:@"envelopeTypeName"];
46 | [coder encodeObject:self.dataTypeName forKey:@"dataTypeName"];
47 | [coder encodeInt:self.state forKey:@"self.state"];
48 | }
49 |
50 | @end
51 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCHamcrest.framework/Versions/A/Headers/HCIsDictionaryContaining.h:
--------------------------------------------------------------------------------
1 | // OCHamcrest by Jon Reid, http://qualitycoding.org/about/
2 | // Copyright 2014 hamcrest.org. See LICENSE.txt
3 |
4 | #import
5 |
6 |
7 | @interface HCIsDictionaryContaining : HCBaseMatcher
8 |
9 | + (instancetype)isDictionaryContainingKey:(id )keyMatcher
10 | value:(id )valueMatcher;
11 |
12 | - (instancetype)initWithKeyMatcher:(id )keyMatcher
13 | valueMatcher:(id )valueMatcher;
14 |
15 | @end
16 |
17 |
18 | FOUNDATION_EXPORT id HC_hasEntry(id keyMatch, id valueMatch);
19 |
20 | /**
21 | hasEntry(keyMatcher, valueMatcher) -
22 | Matches if dictionary contains key-value entry satisfying a given pair of matchers.
23 |
24 | @param keyMatcher The matcher to satisfy for the key, or an expected value for @ref equalTo matching.
25 | @param valueMatcher The matcher to satisfy for the value, or an expected value for @ref equalTo matching.
26 |
27 | This matcher iterates the evaluated dictionary, searching for any key-value entry that satisfies
28 | @a keyMatcher and @a valueMatcher. If a matching entry is found, @c hasEntry is satisfied.
29 |
30 | Any argument that is not a matcher is implicitly wrapped in an @ref equalTo matcher to check for
31 | equality.
32 |
33 | Examples:
34 | @li @ref hasEntry(@ref equalTo(@"foo"), equalTo(@"bar"))
35 | @li @ref hasEntry(@"foo", @"bar")
36 |
37 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
38 | @c HC_hasEntry instead.)
39 |
40 | @ingroup collection_matchers
41 | */
42 | #ifdef HC_SHORTHAND
43 | #define hasEntry HC_hasEntry
44 | #endif
45 |
--------------------------------------------------------------------------------
/Support/ApplicationInsights.xcodeproj/project.xcworkspace/xcshareddata/ApplicationInsights.xccheckout:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDESourceControlProjectFavoriteDictionaryKey
6 |
7 | IDESourceControlProjectIdentifier
8 | 30C66B34-1CE3-4549-90A5-68744255C4D7
9 | IDESourceControlProjectName
10 | ApplicationInsights
11 | IDESourceControlProjectOriginsDictionary
12 |
13 | 5B023693EFFEF2F44FB6AB33FD2AAF34F28DA39D
14 | https://github.com/Microsoft/AppInsights-iOS.git
15 |
16 | IDESourceControlProjectPath
17 | Support/ApplicationInsights.xcodeproj
18 | IDESourceControlProjectRelativeInstallPathDictionary
19 |
20 | 5B023693EFFEF2F44FB6AB33FD2AAF34F28DA39D
21 | ../../..
22 |
23 | IDESourceControlProjectURL
24 | https://github.com/Microsoft/AppInsights-iOS.git
25 | IDESourceControlProjectVersion
26 | 111
27 | IDESourceControlProjectWCCIdentifier
28 | 5B023693EFFEF2F44FB6AB33FD2AAF34F28DA39D
29 | IDESourceControlProjectWCConfigurations
30 |
31 |
32 | IDESourceControlRepositoryExtensionIdentifierKey
33 | public.vcs.git
34 | IDESourceControlWCCIdentifierKey
35 | 5B023693EFFEF2F44FB6AB33FD2AAF34F28DA39D
36 | IDESourceControlWCCName
37 | AppInsights-iOS
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCMock.framework/Versions/A/Headers/OCMArg.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2009-2014 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import
18 |
19 | @interface OCMArg : NSObject
20 |
21 | // constraining arguments
22 |
23 | + (id)any;
24 | + (SEL)anySelector;
25 | + (void *)anyPointer;
26 | + (id __autoreleasing *)anyObjectRef;
27 | + (id)isNil;
28 | + (id)isNotNil;
29 | + (id)isEqual:(id)value;
30 | + (id)isNotEqual:(id)value;
31 | + (id)isKindOfClass:(Class)cls;
32 | + (id)checkWithSelector:(SEL)selector onObject:(id)anObject;
33 | + (id)checkWithBlock:(BOOL (^)(id obj))block;
34 |
35 | // manipulating arguments
36 |
37 | + (id *)setTo:(id)value;
38 | + (void *)setToValue:(NSValue *)value;
39 |
40 | // internal use only
41 |
42 | + (id)resolveSpecialValues:(NSValue *)value;
43 |
44 | @end
45 |
46 | #define OCMOCK_ANY [OCMArg any]
47 |
48 | #if defined(__GNUC__) && !defined(__STRICT_ANSI__)
49 | #define OCMOCK_VALUE(variable) \
50 | ({ __typeof__(variable) __v = (variable); [NSValue value:&__v withObjCType:@encode(__typeof__(__v))]; })
51 | #else
52 | #define OCMOCK_VALUE(variable) [NSValue value:&variable withObjCType:@encode(__typeof__(variable))]
53 | #endif
54 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/MSAIMetricDataTests.m:
--------------------------------------------------------------------------------
1 | #import
2 | #import "MSAIMetricData.h"
3 | #import "MSAIDataPoint.h"
4 | #import "MSAIOrderedDictionary.h"
5 |
6 | @interface MSAIMetricDataTests : XCTestCase
7 |
8 | @end
9 |
10 | @implementation MSAIMetricDataTests
11 |
12 | - (void)testverPropertyWorksAsExpected {
13 | NSNumber *expected;
14 | expected = @42;
15 | MSAIMetricData *item = [MSAIMetricData new];
16 | item.version = expected;
17 | NSNumber *actual = item.version;
18 | XCTAssertTrue([actual isEqual:expected]);
19 |
20 | expected = @13;
21 | item.version = expected;
22 | actual = item.version;
23 | XCTAssertTrue([actual isEqual:expected]);
24 | }
25 |
26 | - (void)testMetricsPropertyWorksAsExpected {
27 | MSAIMetricData *item = [MSAIMetricData new];
28 | NSMutableArray *actual = (NSMutableArray *)item.metrics;
29 | XCTAssertNotNil(actual, @"Pass");
30 | }
31 |
32 | - (void)testPropertiesPropertyWorksAsExpected {
33 | MSAIMetricData *item = [MSAIMetricData new];
34 | MSAIOrderedDictionary *actual = (MSAIOrderedDictionary *)item.properties;
35 | XCTAssertNotNil(actual, @"Pass");
36 | }
37 |
38 | - (void)testSerialize {
39 | MSAIMetricData *item = [MSAIMetricData new];
40 | item.version = @42;
41 | NSArray *arrmetrics = @[[MSAIDataPoint new]];
42 | for (MSAIDataPoint *arrItem in arrmetrics) {
43 | [item.metrics addObject:arrItem];
44 | }
45 | item.properties = [MSAIOrderedDictionary dictionaryWithObjectsAndKeys: @"test value 1", @"key1", @"test value 2", @"key2", nil];
46 |
47 | NSString *actual = [item serializeToString];
48 | NSString *expected = @"{\"ver\":42,\"metrics\":[{\"kind\":0}],\"properties\":{\"key1\":\"test value 1\",\"key2\":\"test value 2\"}}";
49 | XCTAssertTrue([actual isEqualToString:expected]);
50 | }
51 |
52 | @end
53 |
--------------------------------------------------------------------------------
/Classes/MSAIPageViewData.m:
--------------------------------------------------------------------------------
1 | #import "MSAIPageViewData.h"
2 | #import "MSAIOrderedDictionary.h"
3 |
4 | /// Data contract class for type PageViewData.
5 | @implementation MSAIPageViewData
6 | @synthesize envelopeTypeName = _envelopeTypeName;
7 | @synthesize dataTypeName = _dataTypeName;
8 |
9 | /// Initializes a new instance of the class.
10 | - (instancetype)init {
11 | if (self = [super init]) {
12 | _envelopeTypeName = @"Microsoft.ApplicationInsights.PageView";
13 | _dataTypeName = @"PageViewData";
14 | }
15 | return self;
16 | }
17 |
18 | ///
19 | /// Adds all members of this class to a dictionary
20 | /// @param dictionary to which the members of this class will be added.
21 | ///
22 | - (MSAIOrderedDictionary *)serializeToDictionary {
23 | MSAIOrderedDictionary *dict = [super serializeToDictionary];
24 | if (self.url != nil) {
25 | [dict setObject:self.url forKey:@"url"];
26 | }
27 | if (self.duration != nil) {
28 | [dict setObject:self.duration forKey:@"duration"];
29 | }
30 | return dict;
31 | }
32 |
33 | #pragma mark - NSCoding
34 |
35 | - (instancetype)initWithCoder:(NSCoder *)coder {
36 | self = [super initWithCoder:coder];
37 | if(self) {
38 | _url = [coder decodeObjectForKey:@"self.url"];
39 | _duration = [coder decodeObjectForKey:@"self.duration"];
40 | _referrer = [coder decodeObjectForKey:@"self.referrer"];
41 | _referrerData = [coder decodeObjectForKey:@"self.referrerData"];
42 | }
43 |
44 | return self;
45 | }
46 |
47 | - (void)encodeWithCoder:(NSCoder *)coder {
48 | [super encodeWithCoder:coder];
49 | [coder encodeObject:self.url forKey:@"self.url"];
50 | [coder encodeObject:self.duration forKey:@"self.duration"];
51 | [coder encodeObject:self.referrer forKey:@"self.referrer"];
52 | [coder encodeObject:self.referrerData forKey:@"self.referrerData"];
53 | }
54 |
55 |
56 | @end
57 |
--------------------------------------------------------------------------------
/Classes/MSAIEnvelopeManagerPrivate.h:
--------------------------------------------------------------------------------
1 | @class MSAIEnvelope;
2 | @class MSAITelemetryData;
3 | @class MSAITelemetryContext;
4 | #import
5 | #import "MSAIEnvelopeManager.h"
6 | #import "ApplicationInsights.h"
7 |
8 | NS_ASSUME_NONNULL_BEGIN
9 | @interface MSAIEnvelopeManager()
10 |
11 | ///-----------------------------------------------------------------------------
12 | /// @name Initialize and configure singleton instance
13 | ///-----------------------------------------------------------------------------
14 |
15 | /**
16 | * The context object, which contains information about current session, the device, the user etc.
17 | */
18 | @property(nonatomic, strong, readonly)MSAITelemetryContext *telemetryContext;
19 |
20 | /**
21 | * Get the singleton instance.
22 | *
23 | * @return the singleton instance
24 | */
25 | + (instancetype)sharedManager;
26 |
27 | /**
28 | * Configure the manager with a given context object.
29 | *
30 | * @param telemetryContext information about the client and the AI account
31 | */
32 | - (void)configureWithTelemetryContext:(MSAITelemetryContext *)telemetryContext;
33 |
34 | ///-----------------------------------------------------------------------------
35 | /// @name Create envelope objects
36 | ///-----------------------------------------------------------------------------
37 |
38 | /**
39 | * Creates an envelope object with the current context information, but without any base data.
40 | *
41 | * @return the created envelope object
42 | */
43 | - (MSAIEnvelope *)envelope;
44 |
45 | /**
46 | * Creates an envelope object with the current context information and base data.
47 | *
48 | * @param telemetryData the base data for the envelope
49 | *
50 | * @return the created envelope object
51 | */
52 | - (MSAIEnvelope *)envelopeForTelemetryData:(MSAITelemetryData *)telemetryData;
53 |
54 | @end
55 | NS_ASSUME_NONNULL_END
56 |
--------------------------------------------------------------------------------
/Support/ApplicationInsights.xcodeproj/project.xcworkspace/xcshareddata/ApplicationInsights.xcscmblueprint:
--------------------------------------------------------------------------------
1 | {
2 | "DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey" : "E905C92652839D1FD1E3B7D0AF920F8EA9314E1B",
3 | "DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey" : {
4 |
5 | },
6 | "DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey" : {
7 | "E905C92652839D1FD1E3B7D0AF920F8EA9314E1B" : 0,
8 | "5B023693EFFEF2F44FB6AB33FD2AAF34F28DA39D" : 0
9 | },
10 | "DVTSourceControlWorkspaceBlueprintIdentifierKey" : "30C66B34-1CE3-4549-90A5-68744255C4D7",
11 | "DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : {
12 | "E905C92652839D1FD1E3B7D0AF920F8EA9314E1B" : "ApplicationInsights-OSX\/",
13 | "5B023693EFFEF2F44FB6AB33FD2AAF34F28DA39D" : "AppInsights-iOS"
14 | },
15 | "DVTSourceControlWorkspaceBlueprintNameKey" : "ApplicationInsights",
16 | "DVTSourceControlWorkspaceBlueprintVersion" : 204,
17 | "DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey" : "Support\/ApplicationInsights.xcodeproj",
18 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey" : [
19 | {
20 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/Microsoft\/AppInsights-iOS.git",
21 | "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
22 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "5B023693EFFEF2F44FB6AB33FD2AAF34F28DA39D"
23 | },
24 | {
25 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/Microsoft\/ApplicationInsights-OSX.git",
26 | "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
27 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "E905C92652839D1FD1E3B7D0AF920F8EA9314E1B"
28 | }
29 | ]
30 | }
--------------------------------------------------------------------------------
/Classes/MSAIMetricData.m:
--------------------------------------------------------------------------------
1 | #import "MSAIMetricData.h"
2 | #import "MSAIOrderedDictionary.h"
3 | #import "MSAIDataPoint.h"
4 |
5 | /// Data contract class for type MetricData.
6 | @implementation MSAIMetricData
7 | @synthesize envelopeTypeName = _envelopeTypeName;
8 | @synthesize dataTypeName = _dataTypeName;
9 | @synthesize version = _version;
10 | @synthesize properties = _properties;
11 |
12 | /// Initializes a new instance of the class.
13 | - (instancetype)init {
14 | if (self = [super init]) {
15 | _envelopeTypeName = @"Microsoft.ApplicationInsights.Metric";
16 | _dataTypeName = @"MetricData";
17 | _version = @2;
18 | _metrics = [NSMutableArray new];
19 | _properties = [MSAIOrderedDictionary new];
20 | }
21 | return self;
22 | }
23 |
24 | ///
25 | /// Adds all members of this class to a dictionary
26 | /// @param dictionary to which the members of this class will be added.
27 | ///
28 | - (MSAIOrderedDictionary *)serializeToDictionary {
29 | MSAIOrderedDictionary *dict = [super serializeToDictionary];
30 | if (self.metrics != nil) {
31 | NSMutableArray *metricsArray = [NSMutableArray array];
32 | for (MSAIDataPoint *metricsElement in self.metrics) {
33 | [metricsArray addObject:[metricsElement serializeToDictionary]];
34 | }
35 | [dict setObject:metricsArray forKey:@"metrics"];
36 | }
37 | if(self.properties){
38 | [dict setObject:self.properties forKey:@"properties"];
39 | }
40 |
41 | return dict;
42 | }
43 |
44 | #pragma mark - NSCoding
45 |
46 | - (instancetype)initWithCoder:(NSCoder *)coder {
47 | self = [super initWithCoder:coder];
48 | if(self) {
49 | _metrics = [coder decodeObjectForKey:@"self.metrics"];
50 | }
51 |
52 | return self;
53 | }
54 |
55 | - (void)encodeWithCoder:(NSCoder *)coder {
56 | [super encodeWithCoder:coder];
57 | [coder encodeObject:self.metrics forKey:@"self.metrics"];
58 | }
59 |
60 |
61 | @end
62 |
--------------------------------------------------------------------------------
/Classes/MSAIMessageData.m:
--------------------------------------------------------------------------------
1 | #import "MSAIMessageData.h"
2 | #import "MSAIOrderedDictionary.h"
3 | #import "MSAIEnums.h"
4 |
5 | /// Data contract class for type MessageData.
6 | @implementation MSAIMessageData
7 |
8 | @synthesize envelopeTypeName = _envelopeTypeName;
9 | @synthesize dataTypeName = _dataTypeName;
10 | @synthesize version = _version;
11 | @synthesize properties = _properties;
12 |
13 | /// Initializes a new instance of the class.
14 | - (instancetype)init {
15 | if (self = [super init]) {
16 | _envelopeTypeName = @"Microsoft.ApplicationInsights.Message";
17 | _dataTypeName = @"MessageData";
18 | _version = @2;
19 | _properties = [MSAIOrderedDictionary new];
20 | }
21 | return self;
22 | }
23 |
24 | ///
25 | /// Adds all members of this class to a dictionary
26 | /// @param dictionary to which the members of this class will be added.
27 | ///
28 | - (MSAIOrderedDictionary *)serializeToDictionary {
29 | MSAIOrderedDictionary *dict = [super serializeToDictionary];
30 | if (self.message != nil) {
31 | [dict setObject:self.message forKey:@"message"];
32 | }
33 |
34 | [dict setObject:@((int) self.severityLevel) forKey:@"severityLevel"];
35 |
36 | if(self.properties){
37 | [dict setObject:self.properties forKey:@"properties"];
38 | }
39 | return dict;
40 | }
41 |
42 | #pragma mark - NSCoding
43 |
44 | - (instancetype)initWithCoder:(NSCoder *)coder {
45 | self = [super initWithCoder:coder];
46 | if(self) {
47 | _message = [coder decodeObjectForKey:@"self.message"];
48 | _severityLevel = (MSAISeverityLevel) [coder decodeIntForKey:@"self.severityLevel"];
49 | }
50 |
51 | return self;
52 | }
53 |
54 | - (void)encodeWithCoder:(NSCoder *)coder {
55 | [super encodeWithCoder:coder];
56 | [coder encodeObject:self.message forKey:@"self.message"];
57 | [coder encodeInt:self.severityLevel forKey:@"self.severityLevel"];
58 | }
59 |
60 |
61 | @end
62 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCHamcrest.framework/Versions/A/Headers/HCMatcher.h:
--------------------------------------------------------------------------------
1 | // OCHamcrest by Jon Reid, http://qualitycoding.org/about/
2 | // Copyright 2014 hamcrest.org. See LICENSE.txt
3 |
4 | #import "HCSelfDescribing.h"
5 |
6 |
7 | /**
8 | A matcher over acceptable values.
9 |
10 | A matcher is able to describe itself to give feedback when it fails.
11 |
12 | HCMatcher implementations should @b not directly implement this protocol.
13 | Instead, @b extend the HCBaseMatcher class, which will ensure that the HCMatcher API can grow
14 | to support new features and remain compatible with all HCMatcher implementations.
15 |
16 | @ingroup core
17 | */
18 | @protocol HCMatcher
19 |
20 | /**
21 | Evaluates the matcher for argument @a item.
22 |
23 | @param item The object against which the matcher is evaluated.
24 | @return @c YES if @a item matches, otherwise @c NO.
25 | */
26 | - (BOOL)matches:(id)item;
27 |
28 | /**
29 | Evaluates the matcher for argument @a item.
30 |
31 | @param item The object against which the matcher is evaluated.
32 | @param mismatchDescription The description to be built or appended to if @a item does not match.
33 | @return @c YES if @a item matches, otherwise @c NO.
34 | */
35 | - (BOOL)matches:(id)item describingMismatchTo:(id)mismatchDescription;
36 |
37 | /**
38 | Generates a description of why the matcher has not accepted the item.
39 |
40 | The description will be part of a larger description of why a matching failed, so it should be
41 | concise.
42 |
43 | This method assumes that @c matches:item is false, but will not check this.
44 |
45 | @param item The item that the HCMatcher has rejected.
46 | @param mismatchDescription The description to be built or appended to.
47 | */
48 | - (void)describeMismatchOf:(id)item to:(id)mismatchDescription;
49 |
50 | @end
51 |
--------------------------------------------------------------------------------
/Support/ApplicationInsights.xcodeproj/xcshareddata/xcbaselines/1E5A458F16F0DFC200B55C04.xcbaseline/5C0AC091-0676-4E63-8E6F-B855856B85CA.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | classNames
6 |
7 | MSAIEnvelopeManagerTests
8 |
9 | testEnvelopePerformance
10 |
11 | com.apple.XCTPerformanceMetric_WallClockTime
12 |
13 | baselineAverage
14 | 0.03
15 | baselineIntegrationDisplayName
16 | Local Baseline
17 |
18 |
19 |
20 | MSAIHelperTests
21 |
22 | testUtcDateStringPerformane
23 |
24 | com.apple.XCTPerformanceMetric_WallClockTime
25 |
26 | baselineAverage
27 | 0.01
28 | baselineIntegrationDisplayName
29 | Local Baseline
30 |
31 |
32 |
33 | MSAIPersistenceTest
34 |
35 | testFolderPathForPersistenceTypePerformance
36 |
37 | com.apple.XCTPerformanceMetric_WallClockTime
38 |
39 | baselineAverage
40 | 0.01
41 | baselineIntegrationDisplayName
42 | Local Baseline
43 |
44 |
45 |
46 | MSAITelemetryContextTests
47 |
48 | testContextDictionaryPerformance
49 |
50 | com.apple.XCTPerformanceMetric_WallClockTime
51 |
52 | baselineAverage
53 | 0.02
54 | baselineIntegrationDisplayName
55 | Local Baseline
56 |
57 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/MSAITelemetryContextTests.m:
--------------------------------------------------------------------------------
1 | #import
2 | #import "MSAITestsDependencyInjection.h"
3 |
4 | #define HC_SHORTHAND
5 | #import
6 |
7 | #define MOCKITO_SHORTHAND
8 | #import
9 |
10 | #import "MSAITelemetryContext.h"
11 | #import "MSAITelemetryContextPrivate.h"
12 |
13 | #import "MSAITelemetryManagerPrivate.h"
14 | #import "MSAIApplication.h"
15 | #import "MSAIDevice.h"
16 | #import "MSAIOperation.h"
17 | #import "MSAIInternal.h"
18 | #import "MSAIUser.h"
19 | #import "MSAISession.h"
20 | #import "MSAILocation.h"
21 | #import "MSAIContextHelper.h"
22 |
23 | @interface MSAITelemetryContextTests : MSAITestsDependencyInjection
24 |
25 | @end
26 |
27 |
28 | @implementation MSAITelemetryContextTests {
29 | MSAITelemetryContext *_sut;
30 | }
31 |
32 | - (void)setUp {
33 | [super setUp];
34 |
35 | _sut = [self telemetryContext];
36 | }
37 |
38 | - (void)tearDown {
39 | [super tearDown];
40 | }
41 |
42 | - (void)testThatItInstantiates {
43 | assertThat(_sut.device, notNilValue());
44 | assertThat(_sut.internal, notNilValue());
45 | assertThat(_sut.application, notNilValue());
46 | assertThat(_sut.session, notNilValue());
47 | assertThat(_sut.operation, notNilValue());
48 | assertThat(_sut.user, notNilValue());
49 | assertThat(_sut.location, notNilValue());
50 | assertThat(_sut.instrumentationKey, notNilValue());
51 | }
52 |
53 | #ifndef CI
54 | - (void)testContextDictionaryPerformance {
55 | [self measureBlock:^{
56 | for (int i = 0; i < 1000; ++i) {
57 | [_sut contextDictionary];
58 | }
59 | }];
60 | }
61 | #endif
62 |
63 | #pragma mark - Setup helpers
64 |
65 | - (MSAITelemetryContext *)telemetryContext{
66 |
67 | MSAIContext *context = [[MSAIContext alloc] initWithInstrumentationKey:@"123"];
68 | MSAITelemetryContext *telemetryContext = [[MSAITelemetryContext alloc] initWithAppContext:context];
69 |
70 | return telemetryContext;
71 | }
72 |
73 | @end
74 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/MSAISessionTests.m:
--------------------------------------------------------------------------------
1 | #import
2 | #import "MSAISession.h"
3 |
4 | @interface MSAISessionTests : XCTestCase
5 |
6 | @end
7 |
8 | @implementation MSAISessionTests
9 |
10 | - (void)testidPropertyWorksAsExpected {
11 | NSString *expected = @"Test string";
12 | MSAISession *item = [MSAISession new];
13 | item.sessionId = expected;
14 | NSString *actual = item.sessionId;
15 | XCTAssertTrue([actual isEqualToString:expected]);
16 |
17 | expected = @"Other string";
18 | item.sessionId = expected;
19 | actual = item.sessionId;
20 | XCTAssertTrue([actual isEqualToString:expected]);
21 | }
22 |
23 | - (void)testis_firstPropertyWorksAsExpected {
24 | NSString *expected = @"Test string";
25 | MSAISession *item = [MSAISession new];
26 | item.isFirst = expected;
27 | NSString *actual = item.isFirst;
28 | XCTAssertTrue([actual isEqualToString:expected]);
29 |
30 | expected = @"Other string";
31 | item.isFirst = expected;
32 | actual = item.isFirst;
33 | XCTAssertTrue([actual isEqualToString:expected]);
34 | }
35 |
36 | - (void)testis_newPropertyWorksAsExpected {
37 | NSString *expected = @"Test string";
38 | MSAISession *item = [MSAISession new];
39 | item.isNew = expected;
40 | NSString *actual = item.isNew;
41 | XCTAssertTrue([actual isEqualToString:expected]);
42 |
43 | expected = @"Other string";
44 | item.isNew = expected;
45 | actual = item.isNew;
46 | XCTAssertTrue([actual isEqualToString:expected]);
47 | }
48 |
49 | - (void)testSerialize {
50 | MSAISession *item = [MSAISession new];
51 | item.sessionId = @"Test string";
52 | item.isFirst = @"Test string";
53 | item.isNew = @"Test string";
54 | NSString *actual = [item serializeToString];
55 | NSString *expected = @"{\"ai.session.id\":\"Test string\",\"ai.session.isFirst\":\"Test string\",\"ai.session.isNew\":\"Test string\"}";
56 | XCTAssertTrue([actual isEqualToString:expected]);
57 | }
58 |
59 | @end
60 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCMock.framework/Versions/A/Headers/OCMConstraint.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2007-2014 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import
18 |
19 |
20 | @interface OCMConstraint : NSObject
21 |
22 | + (instancetype)constraint;
23 | - (BOOL)evaluate:(id)value;
24 |
25 | // if you are looking for any, isNil, etc, they have moved to OCMArg
26 |
27 | // try to use [OCMArg checkWith...] instead of the constraintWith... methods below
28 |
29 | + (instancetype)constraintWithSelector:(SEL)aSelector onObject:(id)anObject;
30 | + (instancetype)constraintWithSelector:(SEL)aSelector onObject:(id)anObject withValue:(id)aValue;
31 |
32 |
33 | @end
34 |
35 | @interface OCMAnyConstraint : OCMConstraint
36 | @end
37 |
38 | @interface OCMIsNilConstraint : OCMConstraint
39 | @end
40 |
41 | @interface OCMIsNotNilConstraint : OCMConstraint
42 | @end
43 |
44 | @interface OCMIsNotEqualConstraint : OCMConstraint
45 | {
46 | @public
47 | id testValue;
48 | }
49 |
50 | @end
51 |
52 | @interface OCMInvocationConstraint : OCMConstraint
53 | {
54 | @public
55 | NSInvocation *invocation;
56 | }
57 |
58 | @end
59 |
60 | @interface OCMBlockConstraint : OCMConstraint
61 | {
62 | BOOL (^block)(id);
63 | }
64 |
65 | - (instancetype)initWithConstraintBlock:(BOOL (^)(id))block;
66 |
67 | @end
68 |
69 |
70 | #define CONSTRAINT(aSelector) [OCMConstraint constraintWithSelector:aSelector onObject:self]
71 | #define CONSTRAINTV(aSelector, aValue) [OCMConstraint constraintWithSelector:aSelector onObject:self withValue:(aValue)]
72 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCHamcrest.framework/Versions/A/Headers/HCIsCollectionContaining.h:
--------------------------------------------------------------------------------
1 | // OCHamcrest by Jon Reid, http://qualitycoding.org/about/
2 | // Copyright 2014 hamcrest.org. See LICENSE.txt
3 |
4 | #import
5 |
6 |
7 | @interface HCIsCollectionContaining : HCDiagnosingMatcher
8 |
9 | + (instancetype)isCollectionContaining:(id )elementMatcher;
10 | - (instancetype)initWithMatcher:(id )elementMatcher;
11 |
12 | @end
13 |
14 |
15 | FOUNDATION_EXPORT id HC_hasItem(id itemMatch);
16 |
17 | /**
18 | hasItem(aMatcher) -
19 | Matches if any element of collection satisfies a given matcher.
20 |
21 | @param aMatcher The matcher to satisfy, or an expected value for @ref equalTo matching.
22 |
23 | This matcher iterates the evaluated collection, searching for any element that satisfies a
24 | given matcher. If a matching element is found, @c hasItem is satisfied.
25 |
26 | If the @a aMatcher argument is not a matcher, it is implicitly wrapped in an @ref equalTo
27 | matcher to check for equality.
28 |
29 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
30 | @c HC_hasItem instead.)
31 |
32 | @ingroup collection_matchers
33 | */
34 | #ifdef HC_SHORTHAND
35 | #define hasItem HC_hasItem
36 | #endif
37 |
38 |
39 | FOUNDATION_EXPORT id HC_hasItems(id itemMatch, ...) NS_REQUIRES_NIL_TERMINATION;
40 |
41 | /**
42 | hasItems(firstMatcher, ...) -
43 | Matches if all of the given matchers are satisfied by any elements of the collection.
44 |
45 | @param firstMatcher,... A comma-separated list of matchers ending with @c nil.
46 |
47 | This matcher iterates the given matchers, searching for any elements in the evaluated collection
48 | that satisfy them. If each matcher is satisfied, then @c hasItems is satisfied.
49 |
50 | Any argument that is not a matcher is implicitly wrapped in an @ref equalTo matcher to check for
51 | equality.
52 |
53 | (In the event of a name clash, don't \#define @c HC_SHORTHAND and use the synonym
54 | @c hasItems instead.)
55 |
56 | @ingroup collection_matchers
57 | */
58 | #ifdef HC_SHORTHAND
59 | #define hasItems HC_hasItems
60 | #endif
61 |
--------------------------------------------------------------------------------
/Classes/MSAIEnvelopeManager.m:
--------------------------------------------------------------------------------
1 | #import "MSAIEnvelopeManager.h"
2 | #import "MSAIEnvelopeManagerPrivate.h"
3 | #import "MSAIEnvelope.h"
4 | #import "MSAIData.h"
5 | #import "MSAIDevice.h"
6 | #import "MSAITelemetryContext.h"
7 | #import "MSAITelemetryContextPrivate.h"
8 | #import "MSAIHelper.h"
9 | #import "MSAIHelper.h"
10 |
11 | static NSInteger const schemaVersion = 2;
12 |
13 | @implementation MSAIEnvelopeManager
14 |
15 | #pragma mark - Initialize and configure singleton instance
16 |
17 | - (void)configureWithTelemetryContext:(MSAITelemetryContext *)telemetryContext {
18 |
19 | @synchronized(self) {
20 | _telemetryContext = telemetryContext;
21 | }
22 | }
23 |
24 | + (instancetype)sharedManager {
25 | static MSAIEnvelopeManager *sharedManager = nil;
26 |
27 | static dispatch_once_t onceToken;
28 | dispatch_once(&onceToken, ^{
29 | sharedManager = [self new];
30 | });
31 | return sharedManager;
32 | }
33 |
34 | #pragma mark - Create envelope objects
35 |
36 | - (MSAIEnvelope *)envelope {
37 | MSAIEnvelope *envelope = [MSAIEnvelope new];
38 | envelope.appId = msai_mainBundleIdentifier();
39 | envelope.appVer = _telemetryContext.application.version;
40 | envelope.time = msai_utcDateString([NSDate date]);
41 | envelope.iKey = _telemetryContext.instrumentationKey;
42 |
43 | MSAIDevice *deviceContext = _telemetryContext.device;
44 | if (deviceContext.deviceId) {
45 | envelope.deviceId = deviceContext.deviceId;
46 | }
47 | if (deviceContext.os) {
48 | envelope.os = deviceContext.os;
49 | }
50 | if (deviceContext.osVersion) {
51 | envelope.osVer = deviceContext.osVersion;
52 | }
53 |
54 | envelope.tags = _telemetryContext.contextDictionary;
55 | return envelope;
56 | }
57 |
58 | - (MSAIEnvelope *)envelopeForTelemetryData:(MSAITelemetryData *)telemetryData {
59 | telemetryData.version = @(schemaVersion);
60 |
61 | MSAIData *data = [MSAIData new];
62 | data.baseData = telemetryData;
63 | data.baseType = telemetryData.dataTypeName;
64 |
65 | MSAIEnvelope *envelope = [self envelope];
66 | envelope.data = data;
67 | envelope.name = telemetryData.envelopeTypeName;
68 |
69 | return envelope;
70 | }
71 |
72 | @end
73 |
--------------------------------------------------------------------------------
/Classes/MSAIDataPoint.m:
--------------------------------------------------------------------------------
1 | #import "MSAIDataPoint.h"
2 | #import "MSAIOrderedDictionary.h"
3 |
4 | /// Data contract class for type DataPoint.
5 | @implementation MSAIDataPoint
6 |
7 | /// Initializes a new instance of the class.
8 | - (instancetype)init {
9 | if(self = [super init]) {
10 | _kind = MSAIDataPointType_measurement;
11 | }
12 | return self;
13 | }
14 |
15 | ///
16 | /// Adds all members of this class to a dictionary
17 | /// @param dictionary to which the members of this class will be added.
18 | ///
19 | - (MSAIOrderedDictionary *)serializeToDictionary {
20 | MSAIOrderedDictionary *dict = [super serializeToDictionary];
21 | if(self.name != nil) {
22 | [dict setObject:self.name forKey:@"name"];
23 | }
24 | dict[@"kind"] = @((int) self.kind);
25 | if(self.value != nil) {
26 | dict[@"value"] = self.value;
27 | }
28 | if(self.count != nil) {
29 | dict[@"count"] = self.count;
30 | }
31 | if(self.min != nil) {
32 | dict[@"min"] = self.min;
33 | }
34 | if(self.max != nil) {
35 | dict[@"max"] = self.max;
36 | }
37 | if(self.stdDev != nil) {
38 | dict[@"stdDev"] = self.stdDev;
39 | }
40 | return dict;
41 | }
42 |
43 | #pragma mark - NSCoding
44 |
45 | - (instancetype)initWithCoder:(NSCoder *)coder {
46 | self = [self init];
47 | if(self) {
48 | _name = [coder decodeObjectForKey:@"self.name"];
49 | _kind = (MSAIDataPointType) [coder decodeIntForKey:@"self.kind"];
50 | _value = [coder decodeObjectForKey:@"self.value"];
51 | _count = [coder decodeObjectForKey:@"self.count"];
52 | _min = [coder decodeObjectForKey:@"self.min"];
53 | _max = [coder decodeObjectForKey:@"self.max"];
54 | _stdDev = [coder decodeObjectForKey:@"self.stdDev"];
55 | }
56 |
57 | return self;
58 | }
59 |
60 | - (void)encodeWithCoder:(NSCoder *)coder {
61 | [coder encodeObject:self.name forKey:@"self.name"];
62 | [coder encodeInt:self.kind forKey:@"self.kind"];
63 | [coder encodeObject:self.value forKey:@"self.value"];
64 | [coder encodeObject:self.count forKey:@"self.count"];
65 | [coder encodeObject:self.min forKey:@"self.min"];
66 | [coder encodeObject:self.max forKey:@"self.max"];
67 | [coder encodeObject:self.stdDev forKey:@"self.stdDev"];
68 | }
69 |
70 |
71 | @end
72 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCMock.framework/Versions/A/Headers/OCMStubRecorder.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004-2014 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import "OCMRecorder.h"
18 |
19 |
20 | @interface OCMStubRecorder : OCMRecorder
21 |
22 | - (id)andReturn:(id)anObject;
23 | - (id)andReturnValue:(NSValue *)aValue;
24 | - (id)andThrow:(NSException *)anException;
25 | - (id)andPost:(NSNotification *)aNotification;
26 | - (id)andCall:(SEL)selector onObject:(id)anObject;
27 | - (id)andDo:(void (^)(NSInvocation *invocation))block;
28 | - (id)andForwardToRealObject;
29 |
30 | @end
31 |
32 |
33 | @interface OCMStubRecorder (Properties)
34 |
35 | #define andReturn(aValue) _andReturn(({ __typeof__(aValue) _v = (aValue); [NSValue value:&_v withObjCType:@encode(__typeof__(_v))]; }))
36 | @property (nonatomic, readonly) OCMStubRecorder *(^ _andReturn)(NSValue *);
37 |
38 | #define andThrow(anException) _andThrow(anException)
39 | @property (nonatomic, readonly) OCMStubRecorder *(^ _andThrow)(NSException *);
40 |
41 | #define andPost(aNotification) _andPost(aNotification)
42 | @property (nonatomic, readonly) OCMStubRecorder *(^ _andPost)(NSNotification *);
43 |
44 | #define andCall(anObject, aSelector) _andCall(anObject, aSelector)
45 | @property (nonatomic, readonly) OCMStubRecorder *(^ _andCall)(id, SEL);
46 |
47 | #define andDo(aBlock) _andDo(aBlock)
48 | @property (nonatomic, readonly) OCMStubRecorder *(^ _andDo)(void (^)(NSInvocation *));
49 |
50 | #define andForwardToRealObject() _andForwardToRealObject()
51 | @property (nonatomic, readonly) OCMStubRecorder *(^ _andForwardToRealObject)(void);
52 |
53 | @end
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/MSAIEventDataTests.m:
--------------------------------------------------------------------------------
1 | #import
2 | #import "MSAIEventData.h"
3 | #import "MSAIOrderedDictionary.h"
4 |
5 | @interface MSAIEventDataTests : XCTestCase
6 |
7 | @end
8 |
9 | @implementation MSAIEventDataTests
10 |
11 | - (void)testverPropertyWorksAsExpected {
12 | NSNumber *expected = @42;
13 | MSAIEventData *item = [MSAIEventData new];
14 | item.version = expected;
15 | NSNumber *actual = item.version;
16 | XCTAssertTrue([actual isEqual:expected]);
17 |
18 | expected = @13;
19 | item.version = expected;
20 | actual = item.version;
21 | XCTAssertTrue([actual isEqual:expected]);
22 | }
23 |
24 | - (void)testnamePropertyWorksAsExpected {
25 | NSString *expected = @"Test string";
26 | MSAIEventData *item = [MSAIEventData new];
27 | item.name = expected;
28 | NSString *actual = item.name;
29 | XCTAssertTrue([actual isEqualToString:expected]);
30 |
31 | expected = @"Other string";
32 | item.name = expected;
33 | actual = item.name;
34 | XCTAssertTrue([actual isEqualToString:expected]);
35 | }
36 |
37 | - (void)testPropertiesPropertyWorksAsExpected {
38 | MSAIEventData *item = [MSAIEventData new];
39 | MSAIOrderedDictionary *actual = (MSAIOrderedDictionary *)item.properties;
40 | XCTAssertNotNil(actual, @"Pass");
41 | }
42 |
43 | - (void)testMeasurementsPropertyWorksAsExpected {
44 | MSAIEventData *item = [MSAIEventData new];
45 | MSAIOrderedDictionary *actual = (MSAIOrderedDictionary *)item.measurements;
46 | XCTAssertNotNil(actual, @"Pass");
47 | }
48 |
49 | - (void)testSerialize {
50 | MSAIEventData *item = [MSAIEventData new];
51 | item.version = @42;
52 | item.name = @"Test string";
53 | item.properties = [MSAIOrderedDictionary dictionaryWithObjectsAndKeys: @"test value 1", @"key1", @"test value 2", @"key2", nil];
54 | item.measurements = [MSAIOrderedDictionary dictionaryWithObjectsAndKeys:@3.1415, @"key1", @42.2, @"key2", nil];
55 |
56 | NSString *actual = [item serializeToString];
57 | NSString *expected = @"{\"ver\":42,\"name\":\"Test string\",\"properties\":{\"key1\":\"test value 1\",\"key2\":\"test value 2\"},\"measurements\":{\"key1\":3.1415,\"key2\":42.2}}";
58 | XCTAssertTrue([actual isEqualToString:expected]);
59 | }
60 |
61 | @end
62 |
--------------------------------------------------------------------------------
/Classes/MSAIOperation.m:
--------------------------------------------------------------------------------
1 | #import "MSAIOperation.h"
2 | #import "MSAIOrderedDictionary.h"
3 |
4 | /// Data contract class for type Operation.
5 | @implementation MSAIOperation
6 |
7 | ///
8 | /// Adds all members of this class to a dictionary
9 | /// @param dictionary to which the members of this class will be added.
10 | ///
11 | - (MSAIOrderedDictionary *)serializeToDictionary {
12 | MSAIOrderedDictionary *dict = [super serializeToDictionary];
13 | if (self.operationId != nil) {
14 | [dict setObject:self.operationId forKey:@"ai.operation.id"];
15 | }
16 | if (self.name != nil) {
17 | [dict setObject:self.name forKey:@"ai.operation.name"];
18 | }
19 | if (self.parentId != nil) {
20 | [dict setObject:self.parentId forKey:@"ai.operation.parentId"];
21 | }
22 | if (self.rootId != nil) {
23 | [dict setObject:self.rootId forKey:@"ai.operation.rootId"];
24 | }
25 | if (self.syntheticSource != nil) {
26 | [dict setObject:self.syntheticSource forKey:@"ai.operation.syntheticSource"];
27 | }
28 | if(self.isSynthetic != nil) {
29 | [dict setObject:self.isSynthetic forKey:@"ai.operation.isSynthetic"];
30 | }
31 | return dict;
32 | }
33 |
34 | #pragma mark - NSCoding
35 |
36 | - (instancetype)initWithCoder:(NSCoder *)coder {
37 | self = [super initWithCoder:coder];
38 | if(self) {
39 | _operationId = [coder decodeObjectForKey:@"self.operationId"];
40 | _name = [coder decodeObjectForKey:@"self.name"];
41 | _parentId = [coder decodeObjectForKey:@"self.parentId"];
42 | _rootId = [coder decodeObjectForKey:@"self.rootId"];
43 | _syntheticSource = [coder decodeObjectForKey:@"self.syntheticSource"];
44 | _isSynthetic = [coder decodeObjectForKey:@"self.isSynthetic"];
45 | }
46 |
47 | return self;
48 | }
49 |
50 | - (void)encodeWithCoder:(NSCoder *)coder {
51 | [super encodeWithCoder:coder];
52 | [coder encodeObject:self.operationId forKey:@"self.operationId"];
53 | [coder encodeObject:self.name forKey:@"self.name"];
54 | [coder encodeObject:self.parentId forKey:@"self.parentId"];
55 | [coder encodeObject:self.rootId forKey:@"self.rootId"];
56 | [coder encodeObject:self.syntheticSource forKey:@"self.syntheticSource"];
57 | [coder encodeObject:self.isSynthetic forKey:@"self.isSynthetic"];
58 | }
59 |
60 | @end
61 |
--------------------------------------------------------------------------------
/Support/ApplicationInsights.xcodeproj/project.xcworkspace/xcshareddata/AppInsights-iOS.xccheckout:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDESourceControlProjectFavoriteDictionaryKey
6 |
7 | IDESourceControlProjectIdentifier
8 | FC3298E4-780D-4BB4-A9B2-06FA6AC4B2AA
9 | IDESourceControlProjectName
10 | AppInsights-iOS
11 | IDESourceControlProjectOriginsDictionary
12 |
13 | 282B3C9687893D4207A7AF9F6F5E9CC1D7CCA8C0
14 | https://github.com/Microsoft/AppInsights-iOS-DemoApps.git
15 | 5B023693EFFEF2F44FB6AB33FD2AAF34F28DA39D
16 | https://github.com/Microsoft/AppInsights-iOS.git
17 |
18 | IDESourceControlProjectPath
19 | Support/AppInsights-iOS.xcodeproj
20 | IDESourceControlProjectRelativeInstallPathDictionary
21 |
22 | 282B3C9687893D4207A7AF9F6F5E9CC1D7CCA8C0
23 | ../../../..
24 | 5B023693EFFEF2F44FB6AB33FD2AAF34F28DA39D
25 | ../../..
26 |
27 | IDESourceControlProjectURL
28 | https://github.com/Microsoft/AppInsights-iOS.git
29 | IDESourceControlProjectVersion
30 | 111
31 | IDESourceControlProjectWCCIdentifier
32 | 5B023693EFFEF2F44FB6AB33FD2AAF34F28DA39D
33 | IDESourceControlProjectWCConfigurations
34 |
35 |
36 | IDESourceControlRepositoryExtensionIdentifierKey
37 | public.vcs.git
38 | IDESourceControlWCCIdentifierKey
39 | 282B3C9687893D4207A7AF9F6F5E9CC1D7CCA8C0
40 | IDESourceControlWCCName
41 |
42 |
43 |
44 | IDESourceControlRepositoryExtensionIdentifierKey
45 | public.vcs.git
46 | IDESourceControlWCCIdentifierKey
47 | 5B023693EFFEF2F44FB6AB33FD2AAF34F28DA39D
48 | IDESourceControlWCCName
49 | AppInsights-iOS
50 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/Support/ApplicationInsights.xcodeproj/xcshareddata/xcbaselines/1E5A458F16F0DFC200B55C04.xcbaseline/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | runDestinationsByUUID
6 |
7 | 0E03ADBE-1442-48B6-ADD5-807E0C73245B
8 |
9 | localComputer
10 |
11 | busSpeedInMHz
12 | 100
13 | cpuCount
14 | 1
15 | cpuKind
16 | Intel Core i5
17 | cpuSpeedInMHz
18 | 2800
19 | logicalCPUCoresPerPackage
20 | 4
21 | modelCode
22 | MacBookPro11,1
23 | physicalCPUCoresPerPackage
24 | 2
25 | platformIdentifier
26 | com.apple.platform.macosx
27 |
28 | targetArchitecture
29 | x86_64
30 | targetDevice
31 |
32 | modelCode
33 | iPhone7,2
34 | platformIdentifier
35 | com.apple.platform.iphonesimulator
36 |
37 |
38 | 5C0AC091-0676-4E63-8E6F-B855856B85CA
39 |
40 | localComputer
41 |
42 | busSpeedInMHz
43 | 100
44 | cpuCount
45 | 1
46 | cpuKind
47 | Intel Core i7
48 | cpuSpeedInMHz
49 | 2800
50 | logicalCPUCoresPerPackage
51 | 8
52 | modelCode
53 | MacBookPro11,3
54 | physicalCPUCoresPerPackage
55 | 4
56 | platformIdentifier
57 | com.apple.platform.macosx
58 |
59 | targetArchitecture
60 | x86_64
61 | targetDevice
62 |
63 | modelCode
64 | iPhone7,2
65 | platformIdentifier
66 | com.apple.platform.iphonesimulator
67 |
68 |
69 |
70 |
71 |
72 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/OCMock.framework/Versions/A/Headers/OCMockObject.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2004-2014 Erik Doernenburg and contributors
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
5 | * not use these files except in compliance with the License. You may obtain
6 | * a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations
14 | * under the License.
15 | */
16 |
17 | #import
18 |
19 | @class OCMLocation;
20 | @class OCMInvocationStub;
21 | @class OCMStubRecorder;
22 | @class OCMInvocationMatcher;
23 | @class OCMInvocationExpectation;
24 |
25 |
26 | @interface OCMockObject : NSProxy
27 | {
28 | BOOL isNice;
29 | BOOL expectationOrderMatters;
30 | NSMutableArray *stubs;
31 | NSMutableArray *expectations;
32 | NSMutableArray *exceptions;
33 | NSMutableArray *invocations;
34 | }
35 |
36 | + (id)mockForClass:(Class)aClass;
37 | + (id)mockForProtocol:(Protocol *)aProtocol;
38 | + (id)partialMockForObject:(NSObject *)anObject;
39 |
40 | + (id)niceMockForClass:(Class)aClass;
41 | + (id)niceMockForProtocol:(Protocol *)aProtocol;
42 |
43 | + (id)observerMock;
44 |
45 | - (instancetype)init;
46 |
47 | - (void)setExpectationOrderMatters:(BOOL)flag;
48 |
49 | - (id)stub;
50 | - (id)expect;
51 | - (id)reject;
52 |
53 | - (id)verify;
54 | - (id)verifyAtLocation:(OCMLocation *)location;
55 |
56 | - (void)verifyWithDelay:(NSTimeInterval)delay;
57 | - (void)verifyWithDelay:(NSTimeInterval)delay atLocation:(OCMLocation *)location;
58 |
59 | - (void)stopMocking;
60 |
61 | // internal use only
62 |
63 | - (void)addStub:(OCMInvocationStub *)aStub;
64 | - (void)addExpectation:(OCMInvocationExpectation *)anExpectation;
65 |
66 | - (BOOL)handleInvocation:(NSInvocation *)anInvocation;
67 | - (void)handleUnRecordedInvocation:(NSInvocation *)anInvocation;
68 | - (BOOL)handleSelector:(SEL)sel;
69 |
70 | - (void)verifyInvocation:(OCMInvocationMatcher *)matcher;
71 | - (void)verifyInvocation:(OCMInvocationMatcher *)matcher atLocation:(OCMLocation *)location;
72 |
73 | @end
74 |
75 |
--------------------------------------------------------------------------------
/Classes/MSAIEventData.m:
--------------------------------------------------------------------------------
1 | #import "MSAIEventData.h"
2 | #import "MSAIOrderedDictionary.h"
3 |
4 | /// Data contract class for type EventData.
5 | @implementation MSAIEventData
6 | @synthesize envelopeTypeName = _envelopeTypeName;
7 | @synthesize dataTypeName = _dataTypeName;
8 | @synthesize version = _version;
9 | @synthesize properties = _properties;
10 | @synthesize measurements = _measurements;
11 |
12 | /// Initializes a new instance of the class.
13 | - (instancetype)init {
14 | if (self = [super init]) {
15 | _envelopeTypeName = @"Microsoft.ApplicationInsights.Event";
16 | _dataTypeName = @"EventData";
17 | _version = @2;
18 | _properties = [MSAIOrderedDictionary new];
19 | _measurements = [MSAIOrderedDictionary new];
20 | }
21 | return self;
22 | }
23 |
24 | ///
25 | /// Adds all members of this class to a dictionary
26 | /// @param dictionary to which the members of this class will be added.
27 | ///
28 | - (MSAIOrderedDictionary *)serializeToDictionary {
29 | MSAIOrderedDictionary *dict = [super serializeToDictionary];
30 | if (self.name != nil) {
31 | [dict setObject:self.name forKey:@"name"];
32 | }
33 | if (self.properties !=nil) {
34 | [dict setObject:self.properties forKey:@"properties"];
35 | }
36 | if (self.measurements) {
37 | [dict setObject:self.measurements forKey:@"measurements"];
38 | }
39 |
40 |
41 | return dict;
42 | }
43 |
44 | #pragma mark - NSCoding
45 |
46 | - (instancetype)initWithCoder:(NSCoder *)coder {
47 | self = [super initWithCoder:coder];
48 | if(self) {
49 | _envelopeTypeName = [coder decodeObjectForKey:@"self.envelopeTypeName"];
50 | _dataTypeName = [coder decodeObjectForKey:@"self.dataTypeName"];
51 | _version = [coder decodeObjectForKey:@"self.version"];
52 | _properties = [coder decodeObjectForKey:@"self.properties"];
53 | _measurements = [coder decodeObjectForKey:@"self.measurements"];
54 | }
55 |
56 | return self;
57 | }
58 |
59 | - (void)encodeWithCoder:(NSCoder *)coder {
60 | [super encodeWithCoder:coder];
61 | [coder encodeObject:self.envelopeTypeName forKey:@"self.envelopeTypeName"];
62 | [coder encodeObject:self.dataTypeName forKey:@"self.dataTypeName"];
63 | [coder encodeObject:self.version forKey:@"self.version"];
64 | [coder encodeObject:self.properties forKey:@"self.properties"];
65 | [coder encodeObject:self.measurements forKey:@"self.measurements"];
66 | }
67 |
68 |
69 | @end
70 |
--------------------------------------------------------------------------------
/Classes/MSAIKeychainUtils.h:
--------------------------------------------------------------------------------
1 | //
2 | // SFHFKeychainUtils.h
3 | //
4 | // Created by Buzz Andersen on 10/20/08.
5 | // Based partly on code by Jonathan Wight, Jon Crosby, and Mike Malone.
6 | // Copyright 2008 Sci-Fi Hi-Fi. All rights reserved.
7 | //
8 | // Permission is hereby granted, free of charge, to any person
9 | // obtaining a copy of this software and associated documentation
10 | // files (the "Software"), to deal in the Software without
11 | // restriction, including without limitation the rights to use,
12 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | // copies of the Software, and to permit persons to whom the
14 | // Software is furnished to do so, subject to the following
15 | // conditions:
16 | //
17 | // The above copyright notice and this permission notice shall be
18 | // included in all copies or substantial portions of the Software.
19 | //
20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 | // OTHER DEALINGS IN THE SOFTWARE.
28 | //
29 |
30 | #import "ApplicationInsights.h"
31 |
32 | NS_ASSUME_NONNULL_BEGIN
33 | @interface MSAIKeychainUtils : NSObject
34 |
35 | + (NSString *) getPasswordForUsername: (NSString *) username andServiceName: (NSString *) serviceName error: (NSError **) error;
36 | //uses the default kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly
37 | + (BOOL) storeUsername: (NSString *) username andPassword: (NSString *) password forServiceName: (NSString *) serviceName updateExisting: (BOOL) updateExisting error: (NSError **) error;
38 | + (BOOL) storeUsername: (NSString *) username andPassword: (NSString *) password forServiceName: (NSString *) serviceName updateExisting: (BOOL) updateExisting accessibility:(CFTypeRef) accessiblity error: (NSError **) error;
39 | + (BOOL) deleteItemForUsername: (NSString *) username andServiceName: (NSString *) serviceName error: (NSError **) error;
40 | + (BOOL) purgeItemsForServiceName:(NSString *) serviceName error: (NSError **) error;
41 |
42 | @end
43 | NS_ASSUME_NONNULL_END
44 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/MSAIMessageDataTests.m:
--------------------------------------------------------------------------------
1 | #import
2 | #import "MSAIMessageData.h"
3 | #import "MSAIOrderedDictionary.h"
4 |
5 | @interface MSAIMessageDataTests : XCTestCase
6 |
7 | @end
8 |
9 | @implementation MSAIMessageDataTests
10 |
11 | - (void)testverPropertyWorksAsExpected {
12 | NSNumber *expected;
13 | expected = @42;
14 | MSAIMessageData *item = [MSAIMessageData new];
15 | item.version = expected;
16 | NSNumber *actual = item.version;
17 | XCTAssertTrue([actual isEqual:expected]);
18 |
19 | expected = @13;
20 | item.version = expected;
21 | actual = item.version;
22 | XCTAssertTrue([actual isEqual:expected]);
23 | }
24 |
25 | - (void)testmessagePropertyWorksAsExpected {
26 | NSString *expected = @"Test string";
27 | MSAIMessageData *item = [MSAIMessageData new];
28 | item.message = expected;
29 | NSString *actual = item.message;
30 | XCTAssertTrue([actual isEqualToString:expected]);
31 |
32 | expected = @"Other string";
33 | item.message = expected;
34 | actual = item.message;
35 | XCTAssertTrue([actual isEqualToString:expected]);
36 | }
37 |
38 | - (void)testseverity_levelPropertyWorksAsExpected {
39 | MSAISeverityLevel expected = 5;
40 | MSAIMessageData *item = [MSAIMessageData new];
41 | item.severityLevel = expected;
42 | MSAISeverityLevel actual = item.severityLevel;
43 | XCTAssertTrue(actual == expected);
44 |
45 | expected = 3;
46 | item.severityLevel = expected;
47 | actual = item.severityLevel;
48 | XCTAssertTrue(actual == expected);
49 | }
50 |
51 | - (void)testPropertiesPropertyWorksAsExpected {
52 | MSAIMessageData *item = [MSAIMessageData new];
53 | MSAIOrderedDictionary *actual = (MSAIOrderedDictionary *)item.properties;
54 | XCTAssertNotNil(actual, @"Pass");
55 | }
56 |
57 | - (void)testSerialize {
58 | MSAIMessageData *item = [MSAIMessageData new];
59 | item.version = @42;
60 | item.message = @"Test string";
61 | item.severityLevel = 5;
62 | item.properties = [MSAIOrderedDictionary dictionaryWithObjectsAndKeys: @"test value 1", @"key1", @"test value 2", @"key2", nil];
63 |
64 | NSString *actual = [item serializeToString];
65 | NSString *expected = @"{\"ver\":42,\"message\":\"Test string\",\"severityLevel\":5,\"properties\":{\"key1\":\"test value 1\",\"key2\":\"test value 2\"}}";
66 | XCTAssertTrue([actual isEqualToString:expected]);
67 | }
68 |
69 | @end
70 |
--------------------------------------------------------------------------------
/Classes/MSAITelemetryManagerPrivate.h:
--------------------------------------------------------------------------------
1 | #import "ApplicationInsights.h"
2 |
3 | #if MSAI_FEATURE_TELEMETRY
4 |
5 | #import "MSAITelemetryManager.h"
6 |
7 | @class MSAITelemetryData;
8 |
9 | NS_ASSUME_NONNULL_BEGIN
10 | @interface MSAITelemetryManager ()
11 |
12 | ///-----------------------------------------------------------------------------
13 | /// @name Start the manager
14 | ///-----------------------------------------------------------------------------
15 |
16 | /**
17 | * A flag which determines whether the manager has been enabled and started, yet.
18 | */
19 | @property BOOL managerInitialised;
20 |
21 | /**
22 | * Flag which determines whether the manager is enabled or not. This can only be set before the
23 | * manager has been started.
24 | */
25 | @property BOOL telemetryManagerDisabled;
26 |
27 | /**
28 | * This method should be called after the manager has been configured in order to create and send data.
29 | */
30 | - (void)startManager;
31 |
32 | ///-----------------------------------------------------------------------------
33 | /// @name Forward data to channel
34 | ///-----------------------------------------------------------------------------
35 |
36 | /**
37 | * A flag which determines rather collecting page views automatically is enabled or not.
38 | * NO by default.
39 | */
40 | @property BOOL autoPageViewTrackingDisabled;
41 |
42 | /**
43 | * A concurrent queue which creates telemetry objects and forwards them to the channel.
44 | */
45 | @property (nonatomic, strong)dispatch_queue_t telemetryEventQueue;
46 |
47 | /**
48 | * A concurrent queue which makes writing and accessing the commonProperties thread-safe.
49 | */
50 | @property (nonatomic, strong) dispatch_queue_t commonPropertiesQueue;
51 |
52 | /**
53 | * Helper method that converts am NSTimeInterval value to a string of the format "d:hh:mm:ss.fffffff"
54 | */
55 | - (NSString *)durationStringFromDuration:(NSTimeInterval)duration;
56 |
57 | /**
58 | * Converts the tracked to an envelope object and forwards it to the channel.
59 | *
60 | * @param telemetry the data which should be forwarded by the channel
61 | */
62 | - (void)trackDataItem:(MSAITelemetryData *)dataItem;
63 |
64 | /**
65 | * Registers the manager for all notifications that are necessary for automatic session tracking
66 | */
67 | - (void)registerObservers;
68 |
69 | /**
70 | * Disable notifications for automatic session tracking.
71 | */
72 | - (void)unregisterObservers;
73 |
74 | @end
75 | NS_ASSUME_NONNULL_END
76 |
77 | #endif /* MSAI_FEATURE_METRICS */
78 |
--------------------------------------------------------------------------------
/Classes/MSAIPageViewPerfData.m:
--------------------------------------------------------------------------------
1 | #import "MSAIPageViewPerfData.h"
2 | #import "MSAIOrderedDictionary.h"
3 |
4 | /// Data contract class for type PageViewPerfData.
5 | @implementation MSAIPageViewPerfData
6 | @synthesize envelopeTypeName = _envelopeTypeName;
7 | @synthesize dataTypeName = _dataTypeName;
8 |
9 | /// Initializes a new instance of the class.
10 | - (instancetype)init {
11 | if (self = [super init]) {
12 | _envelopeTypeName = @"Microsoft.ApplicationInsights.PageViewPerf";
13 | _dataTypeName = @"PageViewPerfData";
14 | }
15 | return self;
16 | }
17 |
18 | ///
19 | /// Adds all members of this class to a dictionary
20 | /// @param dictionary to which the members of this class will be added.
21 | ///
22 | - (MSAIOrderedDictionary *)serializeToDictionary {
23 | MSAIOrderedDictionary *dict = [super serializeToDictionary];
24 | if (self.perfTotal != nil) {
25 | [dict setObject:self.perfTotal forKey:@"perfTotal"];
26 | }
27 | if (self.networkConnect != nil) {
28 | [dict setObject:self.networkConnect forKey:@"networkConnect"];
29 | }
30 | if (self.sentRequest != nil) {
31 | [dict setObject:self.sentRequest forKey:@"sentRequest"];
32 | }
33 | if (self.receivedResponse != nil) {
34 | [dict setObject:self.receivedResponse forKey:@"receivedResponse"];
35 | }
36 | if (self.domProcessing != nil) {
37 | [dict setObject:self.domProcessing forKey:@"domProcessing"];
38 | }
39 | return dict;
40 | }
41 |
42 | #pragma mark - NSCoding
43 |
44 | - (instancetype)initWithCoder:(NSCoder *)coder {
45 | self = [super initWithCoder:coder];
46 | if(self) {
47 | _perfTotal = [coder decodeObjectForKey:@"self.perfTotal"];
48 | _networkConnect = [coder decodeObjectForKey:@"self.networkConnect"];
49 | _sentRequest = [coder decodeObjectForKey:@"self.sentRequest"];
50 | _receivedResponse = [coder decodeObjectForKey:@"self.receivedResponse"];
51 | _domProcessing = [coder decodeObjectForKey:@"self.domProcessing"];
52 | }
53 |
54 | return self;
55 | }
56 |
57 | - (void)encodeWithCoder:(NSCoder *)coder {
58 | [super encodeWithCoder:coder];
59 | [coder encodeObject:self.perfTotal forKey:@"self.perfTotal"];
60 | [coder encodeObject:self.networkConnect forKey:@"self.networkConnect"];
61 | [coder encodeObject:self.sentRequest forKey:@"self.sentRequest"];
62 | [coder encodeObject:self.receivedResponse forKey:@"self.receivedResponse"];
63 | [coder encodeObject:self.domProcessing forKey:@"self.domProcessing"];
64 | }
65 |
66 |
67 | @end
68 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/MSAICategoryContainerTests.m:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 | #import
4 | #import "MSAITelemetryManager.h"
5 | #import "MSAICategoryContainer.h"
6 |
7 | @interface MSAICategoryContainerTests : XCTestCase
8 |
9 | @property (nonatomic, strong) MSAICategoryContainer *sut;
10 |
11 | @end
12 |
13 | @implementation MSAICategoryContainerTests
14 |
15 | - (void)setUp {
16 | [super setUp];
17 | self.sut = [MSAICategoryContainer new];
18 | }
19 |
20 | - (void)tearDown {
21 | [super tearDown];
22 | }
23 |
24 | - (void)testmsai_viewWillAppear {
25 | UIViewController *vc = [UIViewController new];
26 | [MSAICategoryContainer activateCategory];
27 |
28 | NSString *className = NSStringFromClass([vc class]);
29 |
30 | id mockTelemetryManager = OCMClassMock([MSAITelemetryManager class]);
31 | [[[mockTelemetryManager stub] andReturn:mockTelemetryManager] sharedManager];
32 | OCMExpect([mockTelemetryManager trackPageView:className]);
33 |
34 | [vc viewWillAppear:NO];
35 |
36 | OCMVerifyAll(mockTelemetryManager);
37 | [mockTelemetryManager stopMocking];
38 | }
39 |
40 | - (void)testShouldTrackPageView {
41 | BOOL shouldTrack;
42 |
43 | shouldTrack = msai_shouldTrackPageView([UIViewController new]);
44 | XCTAssertTrue(shouldTrack);
45 |
46 | shouldTrack = msai_shouldTrackPageView([UINavigationController new]);
47 | XCTAssertFalse(shouldTrack);
48 |
49 | shouldTrack = msai_shouldTrackPageView([UITabBarController new]);
50 | XCTAssertFalse(shouldTrack);
51 | if ([UIDevice currentDevice].orientation == UIUserInterfaceIdiomPad) {
52 | shouldTrack = msai_shouldTrackPageView([UISplitViewController new]);
53 | XCTAssertFalse(shouldTrack);
54 | }
55 |
56 | // shouldTrack = msai_shouldTrackPageView([UIInputWindowController new]);
57 | // XCTAssertFalse(shouldTrack);
58 |
59 | shouldTrack = msai_shouldTrackPageView([UIPageViewController new]);
60 | XCTAssertFalse(shouldTrack);
61 | }
62 |
63 | - (void)testPageViewNameForViewController {
64 | NSString *pageViewName = @"";
65 | NSString *testTitle = @"TestTitle";
66 |
67 | UINavigationController *testViewController = [UINavigationController new];
68 | testViewController.title = testTitle;
69 |
70 | pageViewName = msai_pageViewNameForViewController(testViewController);
71 |
72 | XCTAssertEqualObjects(pageViewName, @"UINavigationController TestTitle");
73 |
74 |
75 | testViewController = [UINavigationController new];
76 |
77 | pageViewName = msai_pageViewNameForViewController(testViewController);
78 |
79 | XCTAssertEqualObjects(pageViewName, @"UINavigationController");
80 | }
81 |
82 | @end
83 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/MSAIEnvelopeManagerTests.m:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | #define HC_SHORTHAND
4 | #import
5 |
6 | #define MOCKITO_SHORTHAND
7 | #import
8 |
9 | #import "MSAIAppClient.h"
10 | #import "MSAIEnvelopeManager.h"
11 | #import "MSAIEnvelopeManagerPrivate.h"
12 | #import "MSAITelemetryContext.h"
13 | #import "MSAITelemetryContextPrivate.h"
14 | #import "MSAIEnvelope.h"
15 | #import "MSAIApplication.h"
16 | #import "MSAIEventData.h"
17 | #import "MSAIData.h"
18 |
19 | #import "ApplicationInsightsFeatureConfig.h"
20 |
21 | @interface MSAIEnvelopeManagerTests : XCTestCase
22 |
23 | @end
24 |
25 | @implementation MSAIEnvelopeManagerTests {
26 | MSAIEnvelopeManager *_sut;
27 | MSAITelemetryContext *_telemetryContext;
28 | }
29 |
30 | - (void)setUp {
31 | [super setUp];
32 |
33 | MSAIContext *context = [[MSAIContext alloc]initWithInstrumentationKey:@"123"];
34 | _telemetryContext = [[MSAITelemetryContext alloc] initWithAppContext:context];
35 | [[MSAIEnvelopeManager sharedManager] configureWithTelemetryContext:_telemetryContext];
36 | _sut = [MSAIEnvelopeManager sharedManager];
37 | }
38 |
39 | #pragma mark - Setup Tests
40 |
41 | - (void)testThatItInstantiates {
42 | assertThat(_sut, notNilValue());
43 | assertThat(_sut.telemetryContext, notNilValue());
44 | }
45 |
46 | - (void)testThatItInstantiatesEnvelopeTemplate {
47 | MSAIEnvelope *template = [_sut envelope];
48 |
49 | [self checkEnvelopeTemplate:template];
50 | }
51 |
52 | #ifndef CI
53 | - (void)testEnvelopePerformance {
54 | [self measureBlock:^{
55 | for (int i = 0; i < 1000; ++i) {
56 | [_sut envelope];
57 | }
58 | }];
59 | }
60 | #endif
61 |
62 | - (void)testThatItInstantiatesEnvelopeForTelemetryData {
63 | MSAIEventData *testEvent = [MSAIEventData new];
64 | testEvent.name = @"Test event";
65 |
66 | MSAIEnvelope *envelope = [_sut envelopeForTelemetryData:testEvent];
67 | assertThat(envelope.data, notNilValue());
68 | assertThat(envelope.name, equalTo(@"Microsoft.ApplicationInsights.Event"));
69 |
70 | MSAIData *data = (MSAIData *)envelope.data;
71 | [self checkEnvelopeTemplate:envelope];
72 | assertThat(data.baseData, instanceOf([MSAIEventData class]));
73 | assertThat([(MSAIEventData *)data.baseData name], equalTo(@"Test event"));
74 | assertThat(data.baseType, equalTo(@"EventData"));
75 | }
76 |
77 | #pragma mark - Helper
78 |
79 | - (void)checkEnvelopeTemplate:(MSAIEnvelope *)template{
80 | assertThat(template, notNilValue());
81 | assertThat(template.time, notNilValue());
82 | assertThat(template.tags, notNilValue());
83 | assertThat(template.iKey, equalTo(@"123"));
84 | }
85 |
86 | @end
87 |
--------------------------------------------------------------------------------
/Support/ApplicationInsightsTests/MSAIOperationTests.m:
--------------------------------------------------------------------------------
1 | #import
2 | #import "MSAIOperation.h"
3 |
4 | @interface MSAIOperationTests : XCTestCase
5 |
6 | @end
7 |
8 | @implementation MSAIOperationTests
9 |
10 | - (void)testidPropertyWorksAsExpected {
11 | NSString *expected = @"Test string";
12 | MSAIOperation *item = [MSAIOperation new];
13 | item.operationId = expected;
14 | NSString *actual = item.operationId;
15 | XCTAssertTrue([actual isEqualToString:expected]);
16 |
17 | expected = @"Other string";
18 | item.operationId = expected;
19 | actual = item.operationId;
20 | XCTAssertTrue([actual isEqualToString:expected]);
21 | }
22 |
23 | - (void)testnamePropertyWorksAsExpected {
24 | NSString *expected = @"Test string";
25 | MSAIOperation *item = [MSAIOperation new];
26 | item.name = expected;
27 | NSString *actual = item.name;
28 | XCTAssertTrue([actual isEqualToString:expected]);
29 |
30 | expected = @"Other string";
31 | item.name = expected;
32 | actual = item.name;
33 | XCTAssertTrue([actual isEqualToString:expected]);
34 | }
35 |
36 | - (void)testparent_idPropertyWorksAsExpected {
37 | NSString *expected = @"Test string";
38 | MSAIOperation *item = [MSAIOperation new];
39 | item.parentId = expected;
40 | NSString *actual = item.parentId;
41 | XCTAssertTrue([actual isEqualToString:expected]);
42 |
43 | expected = @"Other string";
44 | item.parentId = expected;
45 | actual = item.parentId;
46 | XCTAssertTrue([actual isEqualToString:expected]);
47 | }
48 |
49 | - (void)testroot_idPropertyWorksAsExpected {
50 | NSString *expected = @"Test string";
51 | MSAIOperation *item = [MSAIOperation new];
52 | item.rootId = expected;
53 | NSString *actual = item.rootId;
54 | XCTAssertTrue([actual isEqualToString:expected]);
55 |
56 | expected = @"Other string";
57 | item.rootId = expected;
58 | actual = item.rootId;
59 | XCTAssertTrue([actual isEqualToString:expected]);
60 | }
61 |
62 | - (void)testSerialize {
63 | MSAIOperation *item = [MSAIOperation new];
64 | item.operationId = @"Test string";
65 | item.name = @"Test string";
66 | item.parentId = @"Test string";
67 | item.rootId = @"Test string";
68 | item.syntheticSource = @"Test source";
69 | item.isSynthetic = @"false";
70 | NSString *actual = [item serializeToString];
71 | NSString *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 source\",\"ai.operation.isSynthetic\":false}";
72 | XCTAssertTrue([actual isEqualToString:expected]);
73 | }
74 |
75 | @end
76 |
--------------------------------------------------------------------------------