Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
Merge pull request #66 from Microsoft/feature/endpoint-fix
Browse files Browse the repository at this point in the history
Make server endpoint completely configurable
  • Loading branch information
Christoph Wendt committed Apr 27, 2015
2 parents 5ea1037 + f2e99f5 commit 76616af
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 25 deletions.
3 changes: 1 addition & 2 deletions Classes/MSAIApplicationInsights.m
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@ - (void)start {
_startManagerIsInvoked = YES;

// Configure Http-client and send persisted data
MSAITelemetryContext *telemetryContext = [[MSAITelemetryContext alloc] initWithAppContext:_appContext
endpointPath:kMSAITelemetryPath];
MSAITelemetryContext *telemetryContext = [[MSAITelemetryContext alloc] initWithAppContext:_appContext];
[[MSAIEnvelopeManager sharedManager] configureWithTelemetryContext:telemetryContext];

[[MSAISender sharedSender] configureWithAppClient:[self appClient]
Expand Down
4 changes: 2 additions & 2 deletions Classes/MSAIChannel.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ + (id)sharedChannel {
dispatch_once(&once_token, ^{
if (_sharedChannel == nil) {
_sharedChannel = [self new];
dispatch_queue_t serialQueue = dispatch_queue_create(MSAIDataItemsOperationsQueue, DISPATCH_QUEUE_SERIAL);
[_sharedChannel setDataItemsOperations:serialQueue];
}
});
return _sharedChannel;
Expand All @@ -55,6 +53,8 @@ - (instancetype)init {
_senderBatchSize = defaultMaxBatchCount;
_senderInterval = defaultBatchInterval;
}
dispatch_queue_t serialQueue = dispatch_queue_create(MSAIDataItemsOperationsQueue, DISPATCH_QUEUE_SERIAL);
_dataItemsOperations = serialQueue;
}
return self;
}
Expand Down
4 changes: 1 addition & 3 deletions Classes/MSAITelemetryContext.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ @implementation MSAITelemetryContext

#pragma mark - Initialisation

- (instancetype)initWithAppContext:(MSAIContext *)appContext
endpointPath:(NSString *)endpointPath {
- (instancetype)initWithAppContext:(MSAIContext *)appContext {

if ((self = [self init])) {

Expand Down Expand Up @@ -49,7 +48,6 @@ - (instancetype)initWithAppContext:(MSAIContext *)appContext
MSAILocation *locationContext = [MSAILocation new];

_instrumentationKey = appContext.instrumentationKey;
_endpointPath = endpointPath;
_application = applicationContext;
_device = deviceContext;
_location = locationContext;
Expand Down
8 changes: 1 addition & 7 deletions Classes/MSAITelemetryContextPrivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ NS_ASSUME_NONNULL_BEGIN
/// @name Initialisation
///-----------------------------------------------------------------------------

/**
* The path to the telemetry endpoint.
*/
@property(nonatomic, strong, readonly) NSString *endpointPath;

/**
* The instrumentation key of the app.
*/
Expand Down Expand Up @@ -70,8 +65,7 @@ NS_ASSUME_NONNULL_BEGIN
*
* @return the telemetry context
*/
- (instancetype)initWithAppContext:(MSAIContext *)appContext
endpointPath:(NSString *)endpointPath;
- (instancetype)initWithAppContext:(MSAIContext *)appContext;

///-----------------------------------------------------------------------------
/// @name Session
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,3 @@
#define __nonnull
#define __null_unspecified
#endif

10 changes: 4 additions & 6 deletions Support/ApplicationInsightsTests/MSAIChannelTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,11 @@ - (void)setUp {
[super setUp];

self.appClient = [[MSAIAppClient alloc]initWithBaseURL:[NSURL URLWithString:@"http://test.com/"]];
[MSAIChannel setSharedChannel:[MSAIChannel new]];
self.sut = [MSAIChannel sharedChannel];
MSAISafeJsonEventsString = NULL;
}

- (void)tearDown {
[MSAIChannel setSharedChannel:nil];
}

#pragma mark - Setup Tests

- (void)testsharedChannelCreated {
Expand Down Expand Up @@ -114,7 +111,8 @@ - (void)testEnqueueEnvelopeWithMultipleEnvelopes {
}

#pragma mark - Safe JSON String Tests

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wnonnull"
- (void)testAppendDictionaryToSafeJsonString {
msai_appendDictionaryToSafeJsonString(nil, 0);
XCTAssertTrue(MSAISafeJsonEventsString == NULL);
Expand Down Expand Up @@ -142,5 +140,5 @@ - (void)testResetSafeJsonString {
msai_resetSafeJsonString(&MSAISafeJsonEventsString);
XCTAssertEqual(strcmp(MSAISafeJsonEventsString,"["), 0);
}

#pragma clang diagnostic pop
@end
2 changes: 1 addition & 1 deletion Support/ApplicationInsightsTests/MSAICrashManagerTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ - (void)setUp {
_startManagerInitialized = NO;

MSAIContext *context = [[MSAIContext alloc]initWithInstrumentationKey:@"123"];
MSAITelemetryContext *telemetryContext = [[MSAITelemetryContext alloc] initWithAppContext:context endpointPath:@""];
MSAITelemetryContext *telemetryContext = [[MSAITelemetryContext alloc] initWithAppContext:context];
[[MSAIEnvelopeManager sharedManager] configureWithTelemetryContext:telemetryContext];

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ - (void)setUp {
[super setUp];

MSAIContext *context = [[MSAIContext alloc]initWithInstrumentationKey:@"123"];
_telemetryContext = [[MSAITelemetryContext alloc] initWithAppContext:context endpointPath:@""];
_telemetryContext = [[MSAITelemetryContext alloc] initWithAppContext:context];
[[MSAIEnvelopeManager sharedManager] configureWithTelemetryContext:_telemetryContext];
_sut = [MSAIEnvelopeManager sharedManager];
}
Expand Down
3 changes: 1 addition & 2 deletions Support/ApplicationInsightsTests/MSAITelemetryContextTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ - (void)testThatItInstantiates {
assertThat(_sut.user, notNilValue());
assertThat(_sut.location, notNilValue());
assertThat(_sut.instrumentationKey, notNilValue());
assertThat(_sut.endpointPath, notNilValue());
}

- (void)testContextDictionaryPerformance {
Expand All @@ -64,7 +63,7 @@ - (void)testContextDictionaryPerformance {
- (MSAITelemetryContext *)telemetryContext{

MSAIContext *context = [[MSAIContext alloc]initWithInstrumentationKey:@"123"];
MSAITelemetryContext *telemetryContext = [[MSAITelemetryContext alloc] initWithAppContext:context endpointPath:@"path"];
MSAITelemetryContext *telemetryContext = [[MSAITelemetryContext alloc] initWithAppContext:context];

return telemetryContext;
}
Expand Down

0 comments on commit 76616af

Please sign in to comment.