Skip to content

Commit

Permalink
[build/1515162076] Automated build
Browse files Browse the repository at this point in the history
  • Loading branch information
mnetapps committed Jan 5, 2018
1 parent d13ae02 commit 6463525
Show file tree
Hide file tree
Showing 15 changed files with 395 additions and 110 deletions.
25 changes: 22 additions & 3 deletions Example/MNAdSdk.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
AE3751711F865C1B00DB2BA7 /* MNetTpdReusePrefetchTimeout.m in Sources */ = {isa = PBXBuildFile; fileRef = AE3751701F865C1B00DB2BA7 /* MNetTpdReusePrefetchTimeout.m */; };
AE3D8B031EF9526800CC80F0 /* GameKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AE3D8B021EF9526800CC80F0 /* GameKit.framework */; };
AE3D8B051EF952B100CC80F0 /* StoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AE3D8B041EF952B100CC80F0 /* StoreKit.framework */; };
AE3F5B021FF391BF00FEBE12 /* MNetDefaultBidsManagerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = AE3F5B011FF391BF00FEBE12 /* MNetDefaultBidsManagerTests.m */; };
AE423F001F6FCF3200EDF1DE /* MNetPrefetchBidsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = AE423EFF1F6FCF3200EDF1DE /* MNetPrefetchBidsTests.m */; };
AE47A8F41E699C2D00B6E5E8 /* CoreLocation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AE47A8F31E699C2D00B6E5E8 /* CoreLocation.framework */; };
AE4A8BC61F27174A00295139 /* MNetPulseStoreTests.m in Sources */ = {isa = PBXBuildFile; fileRef = AE4A8BC51F27174A00295139 /* MNetPulseStoreTests.m */; };
Expand Down Expand Up @@ -158,6 +159,7 @@
AE3751701F865C1B00DB2BA7 /* MNetTpdReusePrefetchTimeout.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MNetTpdReusePrefetchTimeout.m; sourceTree = "<group>"; };
AE3D8B021EF9526800CC80F0 /* GameKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GameKit.framework; path = System/Library/Frameworks/GameKit.framework; sourceTree = SDKROOT; };
AE3D8B041EF952B100CC80F0 /* StoreKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = StoreKit.framework; path = System/Library/Frameworks/StoreKit.framework; sourceTree = SDKROOT; };
AE3F5B011FF391BF00FEBE12 /* MNetDefaultBidsManagerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MNetDefaultBidsManagerTests.m; sourceTree = "<group>"; };
AE423EFF1F6FCF3200EDF1DE /* MNetPrefetchBidsTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MNetPrefetchBidsTests.m; sourceTree = "<group>"; };
AE47A8F31E699C2D00B6E5E8 /* CoreLocation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreLocation.framework; path = System/Library/Frameworks/CoreLocation.framework; sourceTree = SDKROOT; };
AE4A8BC51F27174A00295139 /* MNetPulseStoreTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MNetPulseStoreTests.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -312,6 +314,7 @@
6003F5B5195388D20070C39A /* Tests */ = {
isa = PBXGroup;
children = (
AE3F5B001FF3919E00FEBE12 /* MNetDefaultBidsTests */,
AE8DD68F1FB0DB3A00EC453A /* MNetHbTests */,
AE8C291D1F9F220C005058FB /* MNetAuctionLoggerRequestTests */,
AE5CBE091F96885100E6DB37 /* MNetClientAuctions */,
Expand Down Expand Up @@ -443,6 +446,14 @@
name = MNetTpdBidsReuse;
sourceTree = "<group>";
};
AE3F5B001FF3919E00FEBE12 /* MNetDefaultBidsTests */ = {
isa = PBXGroup;
children = (
AE3F5B011FF391BF00FEBE12 /* MNetDefaultBidsManagerTests.m */,
);
name = MNetDefaultBidsTests;
sourceTree = "<group>";
};
AE423EFE1F6FCF0B00EDF1DE /* MNetPrefetchBidsTests */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -801,12 +812,9 @@
files = (
);
inputPaths = (
"${SRCROOT}/Pods/Target Support Files/Pods-MNAdSdk_Example/Pods-MNAdSdk_Example-resources.sh",
"${PODS_ROOT}/../../MNetAdSdk/ios/MNetAdSdk.framework/Versions/A/Resources/mraid.js",
);
name = "[CP] Copy Pods Resources";
outputPaths = (
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
Expand Down Expand Up @@ -873,8 +881,13 @@
"${SRCROOT}/Pods/Target Support Files/Pods-MNAdSdk_Example/Pods-MNAdSdk_Example-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/AFNetworkActivityLogger/AFNetworkActivityLogger.framework",
"${BUILT_PRODUCTS_DIR}/AFNetworking/AFNetworking.framework",
"${BUILT_PRODUCTS_DIR}/Bugsnag/Bugsnag.framework",
"${BUILT_PRODUCTS_DIR}/GoogleToolboxForMac/GoogleToolboxForMac.framework",
"${BUILT_PRODUCTS_DIR}/KSCrash/KSCrash.framework",
"${BUILT_PRODUCTS_DIR}/MBProgressHUD/MBProgressHUD.framework",
"${BUILT_PRODUCTS_DIR}/MNALApplink/MNALApplink.framework",
"${BUILT_PRODUCTS_DIR}/MNetAdSdk/MNetAdSdk.framework",
"${BUILT_PRODUCTS_DIR}/MNetJSONModeller/MNetJSONModeller.framework",
"${BUILT_PRODUCTS_DIR}/Toast/Toast.framework",
"${BUILT_PRODUCTS_DIR}/mopub-ios-sdk/MoPub.framework",
"${BUILT_PRODUCTS_DIR}/nanopb/nanopb.framework",
Expand All @@ -883,8 +896,13 @@
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AFNetworkActivityLogger.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AFNetworking.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Bugsnag.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GoogleToolboxForMac.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/KSCrash.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MBProgressHUD.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MNALApplink.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MNetAdSdk.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MNetJSONModeller.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Toast.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MoPub.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/nanopb.framework",
Expand Down Expand Up @@ -936,6 +954,7 @@
AEDA10291F28779E00A28A6F /* MNetURLTests.m in Sources */,
AEC914491FEA37D300E58EA5 /* MNetTestChildContentRequests.m in Sources */,
AE1241051EAE94CC00EED2F4 /* MNetTestBannerIncomplete.m in Sources */,
AE3F5B021FF391BF00FEBE12 /* MNetDefaultBidsManagerTests.m in Sources */,
AE37516F1F86425400DB2BA7 /* MNetTpdReusePrefetch.m in Sources */,
8A4CBFCC1F668B47009CCB02 /* MNetAdViewReuseRepositoryTests.m in Sources */,
AEFC29831F2B419E004A5F93 /* MNetVideoWithBannerDelegates.m in Sources */,
Expand Down
10 changes: 0 additions & 10 deletions Example/MNAdSdk.xcworkspace/contents.xcworkspacedata

This file was deleted.

2 changes: 1 addition & 1 deletion Example/MNAdSdk/MNAdSdk-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.4.0</string>
<string>1.5.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
84 changes: 0 additions & 84 deletions Example/Podfile.lock

This file was deleted.

150 changes: 150 additions & 0 deletions Example/Tests/MNetDefaultBidsManagerTests.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
//
// MNetDefaultBidsManagerTests.m
// MNAdSdk_Tests
//
// Created by nithin.g on 27/12/17.
// Copyright © 2017 Nithin. All rights reserved.
//

#import <XCTest/XCTest.h>
#import "MNetTestManager.h"

@interface MNetDefaultBidsManagerTests : MNetTestManager
@property (nonatomic) MNetDefaultBid *defaultBid;
@end

@implementation MNetDefaultBidsManagerTests

static NSString *sampleAdUnitId = @"sample-ad-unit-id";
static NSString *contextUrlRegex = @"http://mnadsdkdemo\\.beta\\.media\\.net\\.imnapp[^.]+";
static NSString *contextUrl = @"http://mnadsdkdemo.beta.media.net.imnapp/1-3-0b21/uiviewcontroller?intent=a6e7d5d1b1032af2b708d9f17caf0a27";
static NSUInteger bidVal = 300;
static NSUInteger bidderIdVal = 41;

- (void)setUp{
self.defaultBid = [self generateDefaultBid];
}

- (MNetDefaultBid *)generateDefaultBid{
MNetDefaultBid *defaultBid = [MNetDefaultBid new];
defaultBid.bid = [NSNumber numberWithInteger:bidVal];
defaultBid.bidderId = [NSNumber numberWithInteger:bidderIdVal];
defaultBid.contextUrlRegex = contextUrlRegex;
defaultBid.adUnitId = sampleAdUnitId;
defaultBid.bidResponse = [self getTestBidResponse];

return defaultBid;
}

- (NSArray<MNetDefaultBid *> *)generatedMultipleBids{
NSMutableArray<MNetDefaultBid *> *defaultBidsList = [NSMutableArray new];
NSUInteger numBids = 10;
NSUInteger numAdUnits = 3;
for(NSUInteger i=0;i<numBids;i++){
for (NSUInteger j=0;j<numAdUnits;j++){
NSNumber *bidderId = [NSNumber numberWithInteger:i];
NSString *adUnitId = [NSString stringWithFormat:@"%@-%lud", sampleAdUnitId,(unsigned long)j];
MNetDefaultBid *defaultBid = [self generateDefaultBid];
defaultBid.bidderId = bidderId;
defaultBid.adUnitId = adUnitId;
defaultBid.bidResponse.bidderId = bidderId;
defaultBid.bidResponse.creativeId = adUnitId;
[defaultBidsList addObject:defaultBid];
}
}
return defaultBidsList;
}

- (void)testAddBids{
MNetDefaultBidsManager *bidsManager = [MNetDefaultBidsManager getSharedInstance];
NSArray *defaultBidsList = @[self.defaultBid];
BOOL additionStatus = [bidsManager addDefaultBids:defaultBidsList];
XCTAssert(additionStatus, @"Addition into the default bid-store failed!");
}

- (void)testAddMultipleBids{
MNetDefaultBidsManager *bidsManager = [MNetDefaultBidsManager getSharedInstance];
BOOL additionStatus = [bidsManager addDefaultBids:[self generatedMultipleBids]];
XCTAssert(additionStatus, @"Adding multiple default-bids failed!");
}

- (void)testFiltersOnDefaultBids{
NSMutableArray *defaultBidsList = [[self generatedMultipleBids] mutableCopy];
MNetDefaultBidsDataStore *dataStore = [MNetDefaultBidsDataStore getSharedInstance];

MNetBidResponse *bidResponse = [dataStore applyFiltersOnDefaultBids:defaultBidsList withContextUrl:contextUrl];
XCTAssert(bidResponse != nil, @"Apply filters on bids failed to fetch a response");
}

- (void)testGetBids{
MNetDefaultBidsManager *bidsManager = [MNetDefaultBidsManager getSharedInstance];
BOOL additionStatus = [bidsManager addDefaultBids:[self generatedMultipleBids]];
XCTAssert(additionStatus, @"Adding multiple default-bids failed!");

NSArray<MNetBidResponse *> *bidResponses = [bidsManager getBidResponsesForAdUnitId:@"invalid-adunit-id" andContextUrl:contextUrl];
XCTAssert(bidResponses == nil, @"getBidResponsesForAdUnitId should return nil for invalid adunitIds");
NSString *expectedAdUnitId = [NSString stringWithFormat:@"%@-%lud", sampleAdUnitId,(unsigned long)0];
bidResponses = [bidsManager getBidResponsesForAdUnitId:expectedAdUnitId andContextUrl:contextUrl];
XCTAssert(bidResponses != nil, @"Fetching getBidResponsesForAdUnitIdAndContextUrl failed!");
}

- (void)testGetBidForInvalidUrls{
NSString *expectedAdUnitId = [NSString stringWithFormat:@"%@-%lud", sampleAdUnitId,(unsigned long)0];

MNetDefaultBidsManager *bidsManager = [MNetDefaultBidsManager getSharedInstance];
BOOL additionStatus = [bidsManager addDefaultBids:[self generatedMultipleBids]];
XCTAssert(additionStatus, @"Adding multiple default-bids failed!");

NSArray<MNetBidResponse *> *bidResponses = [bidsManager getBidResponsesForAdUnitId:expectedAdUnitId andContextUrl:nil];
XCTAssert(bidResponses == nil, "getBidResponsesForAdUnitId should fail");

bidResponses = [bidsManager getBidResponsesForAdUnitId:expectedAdUnitId andContextUrl:nil];
XCTAssert(bidResponses == nil, "getBidResponsesForAdUnitId should fail");

bidResponses = [bidsManager getBidResponsesForAdUnitId:expectedAdUnitId andContextUrl:@""];
XCTAssert(bidResponses == nil, "getBidResponsesForAdUnitId should fail");

bidResponses = [bidsManager getBidResponsesForAdUnitId:expectedAdUnitId andContextUrl:@"http://mnadsdkdemo.beta.media.net.imnapp"];
XCTAssert(bidResponses == nil, "getBidResponsesForAdUnitId should fail");

bidResponses = [bidsManager getBidResponsesForAdUnitId:expectedAdUnitId andContextUrl:@"http://mnadsdkdemo.beta.media.net.imnapp?something_random"];
XCTAssert(bidResponses != nil, "getBidResponsesForAdUnitId should not fail");
}

- (void)testResponsesContainer{
NSString *expectedAdUnitId = [NSString stringWithFormat:@"%@-%lud", sampleAdUnitId,(unsigned long)0];

MNetDefaultBidsManager *bidsManager = [MNetDefaultBidsManager getSharedInstance];
BOOL additionStatus = [bidsManager addDefaultBids:[self generatedMultipleBids]];
XCTAssert(additionStatus, @"Adding multiple default-bids failed!");

MNetAdRequest *adRequest = [MNetAdRequest newRequest];
[adRequest setAdUnitId:expectedAdUnitId];
[adRequest setContextLink:contextUrl];

MNetBidRequest *bidRequest = [MNetBidRequest create:adRequest];
MNetBidResponsesContainer *responseContainer = [bidsManager getDefaultBidsForBidRequest:bidRequest];
XCTAssert(responseContainer != nil, @"Response container cannot be empty!");
XCTAssert([responseContainer areDefaultBids] == YES, @"Default bids need to be set in the default-bids response container");
}

- (void)testEmptyBidInsertion{
MNetDefaultBidsManager *bidsManager = [MNetDefaultBidsManager getSharedInstance];
MNetDefaultBid *sampleBid = [self generateDefaultBid];
sampleBid.adUnitId = @"";
BOOL additionStatus = [bidsManager addDefaultBids:@[sampleBid]];
XCTAssert(additionStatus == NO, @"bidsManager should prevent adding bids");
}

- (void)testCatchAllDefaultBid{
MNetDefaultBidsManager *bidsManager = [MNetDefaultBidsManager getSharedInstance];
MNetDefaultBid *sampleBid = [self generateDefaultBid];
[sampleBid setAdUnitId:@"*"];
[sampleBid setContextUrlRegex:@".*"];
[bidsManager addDefaultBids:@[sampleBid]];

NSArray<MNetBidResponse *> *bidResponsesList = [bidsManager getBidResponsesForAdUnitId:@"random-adunit-id" andContextUrl:@"random-context-url"];
XCTAssert(bidResponsesList != nil, @"bid-responses cannot be nil in catch-all case");
XCTAssert([bidResponsesList count] > 0, @"bid-responses needs to have atleast 1 entry");
}
@end
Loading

0 comments on commit 6463525

Please sign in to comment.