Skip to content

Commit

Permalink
Merge pull request #130 from WideSpectrumComputing/GH-ref-#127
Browse files Browse the repository at this point in the history
Improving unit tests and sample apps
  • Loading branch information
akornich authored Mar 8, 2022
2 parents 1b3c259 + 1b9d9d5 commit eeed750
Show file tree
Hide file tree
Showing 47 changed files with 284 additions and 148 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ The change log has moved to this repo's [GitHub Releases Page](https://github.co

## Release Notes

**2.0.3
- docs: resolve #122 - Update RollbarCommon public API doc comments so they are properly rendered by Xcode Quick Help
- docs: resolve #124 - Update RollbarDeploys public API doc comments so they are properly rendered by Xcode Quick Help
- docs: resolve #126 - Update RollbarSwift, RollbarAUL, RollbarPLCrashReporter, and RollbarKSCrash public API doc comments so they are properly rendered by Xcode Quick Help
- docs: resolve #127 - Update RollbarNotifier public API doc comments so they are properly rendered by Xcode Quick Help
- chore: resolve #114 - Consolidate destination parameters for samples
- chore: resolve #113 - Consolidate destination parameters for unit tests

**2.0.2
- fix: resolve #110 - Xcode autocomplete for Swift expects person.id, but codebase expects person.ID
- chore: resolve #118 - Remove source file header comments from RollbarCommon
Expand Down
16 changes: 16 additions & 0 deletions Demos/RollbarDemoSettings.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#ifndef RollbarDemoSettings_h
#define RollbarDemoSettings_h

static NSString * const ROLLBAR_DEMO_ENVIRONMENT =
@"Rollbar-Apple-Samples";

static NSString * const ROLLBAR_DEMO_PAYLOADS_ACCESS_TOKEN =
@"09da180aba21479e9ed3d91e0b8d58d6";

static NSString * const ROLLBAR_DEMO_DEPLOYS_WRITE_ACCESS_TOKEN =
@"efdc4b85d66045f293a7f9e99c732f61";

static NSString * const ROLLBAR_DEMO_DEPLOYS_READ_ACCESS_TOKEN =
@"595cbf76b05b45f2b3ef661a2e0078d4";

#endif /* RollbarDemoSettings_h */
8 changes: 8 additions & 0 deletions Demos/RollbarDemoSettings.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import Foundation

struct RollbarDemoSettings {
static let environment = "Rollbar-Apple-Samples";
static let payloadsPostAccessToken = "09da180aba21479e9ed3d91e0b8d58d6";
static let deploysWriteAccessToken = "efdc4b85d66045f293a7f9e99c732f61";
static let deploysReadAccessToken = "595cbf76b05b45f2b3ef661a2e0078d4";
}
2 changes: 2 additions & 0 deletions Demos/iosAppObjC/iosAppObjC.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
55684F802553B4C700F82F34 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
55684F9B2553BD1B00F82F34 /* iosAppObjC.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = iosAppObjC.entitlements; sourceTree = "<group>"; };
55684F9C2553BD1C00F82F34 /* NetworkExtension.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = NetworkExtension.framework; path = System/Library/Frameworks/NetworkExtension.framework; sourceTree = SDKROOT; };
55C1B42127C5C95000017B22 /* RollbarDemoSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RollbarDemoSettings.h; path = ../../RollbarDemoSettings.h; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -74,6 +75,7 @@
55684F6D2553B4C400F82F34 /* iosAppObjC */ = {
isa = PBXGroup;
children = (
55C1B42127C5C95000017B22 /* RollbarDemoSettings.h */,
55684F9B2553BD1B00F82F34 /* iosAppObjC.entitlements */,
55684F6E2553B4C400F82F34 /* AppDelegate.h */,
55684F6F2553B4C400F82F34 /* AppDelegate.m */,
Expand Down
12 changes: 8 additions & 4 deletions Demos/iosAppObjC/iosAppObjC/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//

#import "AppDelegate.h"
#import "RollbarDemoSettings.h"

@import RollbarNotifier;
@import RollbarKSCrash;
Expand Down Expand Up @@ -55,14 +56,17 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
#pragma mark - UISceneSession lifecycle


- (UISceneConfiguration *)application:(UIApplication *)application configurationForConnectingSceneSession:(UISceneSession *)connectingSceneSession options:(UISceneConnectionOptions *)options {
- (UISceneConfiguration *) application:(UIApplication *)application
configurationForConnectingSceneSession:(UISceneSession *)connectingSceneSession
options:(UISceneConnectionOptions *)options {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return [[UISceneConfiguration alloc] initWithName:@"Default Configuration" sessionRole:connectingSceneSession.role];
}


- (void)application:(UIApplication *)application didDiscardSceneSessions:(NSSet<UISceneSession *> *)sceneSessions {
- (void) application:(UIApplication *)application
didDiscardSceneSessions:(NSSet<UISceneSession *> *)sceneSessions {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
Expand All @@ -73,8 +77,8 @@ - (void)initRollbar {
// configure Rollbar:
RollbarConfig *config = [RollbarConfig new];

config.destination.accessToken = @"09da180aba21479e9ed3d91e0b8d58d6";
config.destination.environment = @"Rollbar-Apple-Samples";
config.destination.accessToken = ROLLBAR_DEMO_PAYLOADS_ACCESS_TOKEN;
config.destination.environment = ROLLBAR_DEMO_ENVIRONMENT;
config.customData = @{ @"someKey": @"someValue", };

// init Rollbar shared instance:
Expand Down
4 changes: 3 additions & 1 deletion Demos/iosAppObjC/iosAppObjC/SceneDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ @interface SceneDelegate ()
@implementation SceneDelegate


- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions {
- (void) scene:(UIScene *)scene
willConnectToSession:(UISceneSession *)session
options:(UISceneConnectionOptions *)connectionOptions {
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
Expand Down
2 changes: 2 additions & 0 deletions Demos/macosAppObjC/macosAppObjC.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
55759A772477561100ED3F04 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
55759A782477561100ED3F04 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
55759A7A2477561100ED3F04 /* macosAppObjC.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = macosAppObjC.entitlements; sourceTree = "<group>"; };
55C1B42027C5C4E800017B22 /* RollbarDemoSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RollbarDemoSettings.h; path = ../../RollbarDemoSettings.h; sourceTree = "<group>"; };
55FD07122478614B000BBC22 /* RollbarDeploysDemoClient.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RollbarDeploysDemoClient.h; sourceTree = "<group>"; };
55FD07132478614B000BBC22 /* RollbarDeploysDemoClient.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RollbarDeploysDemoClient.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
Expand Down Expand Up @@ -71,6 +72,7 @@
55759A6B2477560D00ED3F04 /* macosAppObjC */ = {
isa = PBXGroup;
children = (
55C1B42027C5C4E800017B22 /* RollbarDemoSettings.h */,
55759A6C2477560D00ED3F04 /* AppDelegate.h */,
55759A6D2477560D00ED3F04 /* AppDelegate.m */,
55759A6F2477560D00ED3F04 /* ViewController.h */,
Expand Down
5 changes: 3 additions & 2 deletions Demos/macosAppObjC/macosAppObjC/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#import "AppDelegate.h"

#import "RollbarDeploysDemoClient.h"
#import "RollbarDemoSettings.h"

@import RollbarNotifier;
@import RollbarAUL;
Expand Down Expand Up @@ -77,8 +78,8 @@ - (void)initRollbar {

// configure Rollbar:
RollbarConfig *config = [RollbarConfig new];
config.destination.accessToken = @"09da180aba21479e9ed3d91e0b8d58d6";
config.destination.environment = @"Rollbar-Apple-Samples";
config.destination.accessToken = ROLLBAR_DEMO_PAYLOADS_ACCESS_TOKEN;
config.destination.environment = ROLLBAR_DEMO_ENVIRONMENT;
//config.developerOptions.suppressSdkInfoLogging = YES;
config.customData = @{ @"someKey": @"someValue", };

Expand Down
17 changes: 9 additions & 8 deletions Demos/macosAppObjC/macosAppObjC/RollbarDeploysDemoClient.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

#import "RollbarDeploysDemoClient.h"
#import "RollbarDemoSettings.h"
@import RollbarDeploys;

@interface RollbarDeploysObserver
Expand Down Expand Up @@ -57,11 +58,11 @@ - (void)demoDeploymentRegistration {
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];

NSString * const environment = @"Rollbar-Apple-UnitTests";
NSString * const environment = ROLLBAR_DEMO_ENVIRONMENT;
NSString * const comment =
[NSString stringWithFormat:@"a new deploy at %@", [dateFormatter stringFromDate:[NSDate date]]];
NSString * const revision = @"a_revision";
NSString * const localUsername = @"UnitTestRunner";
NSString * const localUsername = @"DemosRunner";
NSString * const rollbarUsername = @"rollbar";

RollbarDeploysObserver *observer = [[RollbarDeploysObserver alloc] init];
Expand All @@ -71,8 +72,8 @@ - (void)demoDeploymentRegistration {
localUserName:localUsername
rollbarUserName:rollbarUsername];
RollbarDeploysManager *deploysManager =
[[RollbarDeploysManager alloc] initWithWriteAccessToken:@"efdc4b85d66045f293a7f9e99c732f61"
readAccessToken:@"595cbf76b05b45f2b3ef661a2e0078d4"
[[RollbarDeploysManager alloc] initWithWriteAccessToken:ROLLBAR_DEMO_DEPLOYS_WRITE_ACCESS_TOKEN
readAccessToken:ROLLBAR_DEMO_DEPLOYS_READ_ACCESS_TOKEN
deploymentRegistrationObserver:observer
deploymentDetailsObserver:observer
deploymentDetailsPageObserver:observer
Expand All @@ -85,8 +86,8 @@ - (void)demoGetDeploymentDetailsById {
NSString * const testDeploymentId = @"23922850";
RollbarDeploysObserver *observer = [[RollbarDeploysObserver alloc] init];
RollbarDeploysManager *deploysManager =
[[RollbarDeploysManager alloc] initWithWriteAccessToken:@"efdc4b85d66045f293a7f9e99c732f61"
readAccessToken:@"595cbf76b05b45f2b3ef661a2e0078d4"
[[RollbarDeploysManager alloc] initWithWriteAccessToken:ROLLBAR_DEMO_DEPLOYS_WRITE_ACCESS_TOKEN
readAccessToken:ROLLBAR_DEMO_DEPLOYS_READ_ACCESS_TOKEN
deploymentRegistrationObserver:observer
deploymentDetailsObserver:observer
deploymentDetailsPageObserver:observer
Expand All @@ -98,8 +99,8 @@ - (void)demoGetDeploymentsPage {

RollbarDeploysObserver *observer = [[RollbarDeploysObserver alloc] init];
RollbarDeploysManager *deploysManager =
[[RollbarDeploysManager alloc] initWithWriteAccessToken:@"efdc4b85d66045f293a7f9e99c732f61"
readAccessToken:@"595cbf76b05b45f2b3ef661a2e0078d4"
[[RollbarDeploysManager alloc] initWithWriteAccessToken:ROLLBAR_DEMO_DEPLOYS_WRITE_ACCESS_TOKEN
readAccessToken:ROLLBAR_DEMO_DEPLOYS_READ_ACCESS_TOKEN
deploymentRegistrationObserver:observer
deploymentDetailsObserver:observer
deploymentDetailsPageObserver:observer
Expand Down
4 changes: 4 additions & 0 deletions Demos/macosAppSwift/macosAppSwift.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
5544A01F25FB074300C710A1 /* RollbarCommon in Frameworks */ = {isa = PBXBuildFile; productRef = 5544A01E25FB074300C710A1 /* RollbarCommon */; };
5544A02125FB074300C710A1 /* RollbarNotifier in Frameworks */ = {isa = PBXBuildFile; productRef = 5544A02025FB074300C710A1 /* RollbarNotifier */; };
5544A02325FB074300C710A1 /* RollbarSwift in Frameworks */ = {isa = PBXBuildFile; productRef = 5544A02225FB074300C710A1 /* RollbarSwift */; };
55C1B41F27C5BDF000017B22 /* RollbarDemoSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55C1B41E27C5BDF000017B22 /* RollbarDemoSettings.swift */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand All @@ -26,6 +27,7 @@
55098C6B25FA93110045C180 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
55098C6D25FA93110045C180 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
55098C6E25FA93110045C180 /* macosAppSwift.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = macosAppSwift.entitlements; sourceTree = "<group>"; };
55C1B41E27C5BDF000017B22 /* RollbarDemoSettings.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = RollbarDemoSettings.swift; path = ../../RollbarDemoSettings.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -64,6 +66,7 @@
55098C6325FA930D0045C180 /* macosAppSwift */ = {
isa = PBXGroup;
children = (
55C1B41E27C5BDF000017B22 /* RollbarDemoSettings.swift */,
55098C6425FA930D0045C180 /* macosAppSwiftApp.swift */,
55098C6625FA930D0045C180 /* ContentView.swift */,
55098C6825FA93110045C180 /* Assets.xcassets */,
Expand Down Expand Up @@ -166,6 +169,7 @@
buildActionMask = 2147483647;
files = (
55098C6725FA930D0045C180 /* ContentView.swift in Sources */,
55C1B41F27C5BDF000017B22 /* RollbarDemoSettings.swift in Sources */,
55098C6525FA930D0045C180 /* macosAppSwiftApp.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
8 changes: 6 additions & 2 deletions Demos/macosAppSwift/macosAppSwift/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,12 @@ func handleSwiftError() {
func createGuard() -> RollbarExceptionGuard {

let config = RollbarConfig();
config.destination.accessToken = "09da180aba21479e9ed3d91e0b8d58d6";
config.destination.environment = "Rollbar-Apple-Samples";

config.destination.accessToken =
RollbarDemoSettings.payloadsPostAccessToken;

config.destination.environment =
RollbarDemoSettings.environment;

// AUL capture setup:
// config.developerOptions.transmit = true;
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.2
// swift-tools-version:5.5
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription
Expand Down
2 changes: 1 addition & 1 deletion RollbarAUL.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

Pod::Spec.new do |s|

s.version = "2.0.2"
s.version = "2.0.3"
s.name = "RollbarAUL"
s.summary = "Application or client side SDK for interacting with the Rollbar API Server."
s.description = <<-DESC
Expand Down
16 changes: 7 additions & 9 deletions RollbarAUL/Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.3
// swift-tools-version:5.5
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription
Expand All @@ -23,6 +23,9 @@ let package = Package(
// .package(url: /* package url */, from: "1.0.0"),
.package(path: "../RollbarCommon"),
.package(path: "../RollbarNotifier"),
.package(name: "UnitTesting",
path: "../UnitTesting"
),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
Expand All @@ -42,14 +45,9 @@ let package = Package(
),
.testTarget(
name: "RollbarAULTests",
dependencies: ["RollbarAUL"],
cSettings: [
.headerSearchPath("Tests/RollbarAULTests/**"),
// .headerSearchPath("Sources/RollbarNotifier"),
// .headerSearchPath("Sources/RollbarNotifier/include"),
// .headerSearchPath("Sources/RollbarNotifier/DTOs"),

// .define("DEFINES_MODULE"),
dependencies: [
"UnitTesting",
"RollbarAUL",
]
),
.testTarget(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

#if !TARGET_OS_WATCH
#import <XCTest/XCTest.h>
#import "../../../UnitTests/RollbarUnitTestSettings.h"

@import RollbarNotifier;
@import RollbarAUL;
Expand Down Expand Up @@ -62,8 +63,8 @@ - (void)generateLogEntries {
//- (void)testRollbarAulStoreMonitor {
//
// RollbarConfig *rollbarConfig = [[RollbarConfig alloc] init];
// rollbarConfig.destination.accessToken = @"efdc4b85d66045f293a7f9e99c732f61";
// rollbarConfig.destination.environment = @"Rollbar-Apple-UnitTests";
// rollbarConfig.destination.accessToken = ROLLBAR_UNIT_TEST_DEPLOYS_WRITE_ACCESS_TOKEN;
// rollbarConfig.destination.environment = ROLLBAR_UNIT_TEST_ENVIRONMENT;
// rollbarConfig.telemetry.enabled = YES;
// rollbarConfig.telemetry.captureLog = YES;
// rollbarConfig.telemetry.maximumTelemetryData = 100;
Expand Down
2 changes: 1 addition & 1 deletion RollbarCommon.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

Pod::Spec.new do |s|

s.version = "2.0.2"
s.version = "2.0.3"
s.name = "RollbarCommon"
s.summary = "Application or client side SDK for interacting with the Rollbar API Server."
s.description = <<-DESC
Expand Down
8 changes: 6 additions & 2 deletions RollbarCommon/Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.2
// swift-tools-version:5.5
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription
Expand Down Expand Up @@ -29,6 +29,7 @@ let package = Package(
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
.package(path: "../UnitTesting"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
Expand All @@ -48,7 +49,10 @@ let package = Package(
),
.testTarget(
name: "RollbarCommonTests",
dependencies: ["RollbarCommon"]
dependencies: [
"UnitTesting",
"RollbarCommon",
]
),
.testTarget(
name: "RollbarCommonTests-ObjC",
Expand Down
2 changes: 1 addition & 1 deletion RollbarDeploys.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

Pod::Spec.new do |s|

s.version = "2.0.2"
s.version = "2.0.3"
s.name = "RollbarDeploys"
s.summary = "Application or client side SDK for interacting with the Rollbar API Server."
s.description = <<-DESC
Expand Down
9 changes: 7 additions & 2 deletions RollbarDeploys/Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.2
// swift-tools-version:5.5
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription
Expand All @@ -22,6 +22,7 @@ let package = Package(
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
.package(path: "../RollbarCommon"),
.package(path: "../UnitTesting"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
Expand All @@ -41,7 +42,11 @@ let package = Package(
),
.testTarget(
name: "RollbarDeploysTests",
dependencies: ["RollbarDeploys"]),
dependencies: [
"UnitTesting",
"RollbarDeploys",
]
),
.testTarget(
name: "RollbarDeploysTests-ObjC",
dependencies: ["RollbarDeploys"],
Expand Down
Loading

0 comments on commit eeed750

Please sign in to comment.