Skip to content

Commit

Permalink
Pull request #708: Release branch v8.6.1
Browse files Browse the repository at this point in the history
Merge in MOBILE-SDK/app_mobile-sdk-android from release_branch_v8.6.1 to master

* commit 'd3765cd4d5111fbd9842a814070dd1b61c322f29': (26 commits)
  release version 8.6.1
  change sdk version
  release version 8.6.1
  handled index out of bound exception
  jenkins test
  mediation changes and code clean
  uncommenting mediation classes
  UTAdResponse changes
  UTAd Responses test changes
  merged develop branch conflict
  commenting sdk settings for testing purpose
  native ad changes
  commenting mediation classes
  mediatition native ad working
  mediated timedout test working changes
  test unit case
  instream build roboelectric changes
  sdk build revert changes
  roboelectric lib changes
  revert instream build changes
  ...
  • Loading branch information
Ritesh Zaveri committed Jun 7, 2023
2 parents 26cf8d0 + d3765cd commit 334c821
Show file tree
Hide file tree
Showing 47 changed files with 620 additions and 549 deletions.
5 changes: 5 additions & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 8.6.1

### Improvement/Bug Fixes
+ MS-5321 Fixed ArrayIndexOutOfBoundsException in XandrAd.init()

## 8.6

### Improvement/Bug Fixes
Expand Down
6 changes: 3 additions & 3 deletions instreamvideo/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Project Properties
version = "1.44" // Instream SDK version
version = "1.45" // Instream SDK version

apply plugin: 'com.android.library'

Expand All @@ -10,7 +10,7 @@ android {
defaultConfig {
minSdkVersion 14
targetSdkVersion 32
versionCode 43 // An integer value that represents the version of the code, relative to other versions. Increase for each release.
versionCode 44 // An integer value that represents the version of the code, relative to other versions. Increase for each release.
versionName version
consumerProguardFiles 'proguard-project.txt'
}
Expand Down Expand Up @@ -134,4 +134,4 @@ repositories {
}
jcenter()
mavenCentral()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import com.appnexus.opensdk.instreamvideo.shadows.ShadowSettings;
import com.appnexus.opensdk.instreamvideo.shadows.ShadowWebSettings;
import com.appnexus.opensdk.ut.UTConstants;
import com.squareup.okhttp.mockwebserver.MockResponse;

import org.junit.Test;
import org.junit.runner.RunWith;
Expand Down Expand Up @@ -60,9 +59,10 @@ public void tearDown() {
adResponseInfo = null;
}

//test
@Test
public void testAdResponseInfoRTBVideo() {
server.enqueue(new MockResponse().setResponseCode(200).setBody(TestUTResponses.video())); // First queue a regular HTML banner response
server.setDispatcher(getDispatcher(TestUTResponses.video())); // First queue a regular HTML banner response
assertNull(videoAd.getAdResponseInfo());
executeVideoRequest();
assertNotNull(videoAd.getAdResponseInfo());
Expand All @@ -80,7 +80,7 @@ public void testAdResponseInfoRTBVideo() {

@Test
public void testAdResponseInfoRTBVideoNoBid() {
server.enqueue(new MockResponse().setResponseCode(200).setBody(TestUTResponses.NO_BID));
server.setDispatcher(getDispatcher(TestUTResponses.NO_BID));
assertNull(videoAd.getAdResponseInfo());
executeVideoRequest();
assertNotNull(videoAd.getAdResponseInfo());
Expand All @@ -99,7 +99,7 @@ public void testAdResponseInfoRTBVideoNoBid() {

@Test
public void testAdResponseInfoRTBVideoBlank() {
server.enqueue(new MockResponse().setResponseCode(200).setBody(TestUTResponses.blank()));
server.setDispatcher(getDispatcher(TestUTResponses.blank()));
assertNull(videoAd.getAdResponseInfo());
executeVideoRequest();
assertNull(videoAd.getAdResponseInfo());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package com.appnexus.opensdk.instreamvideo;

import android.app.Activity;


import com.appnexus.opensdk.ANAdResponseInfo;
import com.appnexus.opensdk.XandrAd;
import com.appnexus.opensdk.instreamvideo.shadows.ShadowSettings;
import com.appnexus.opensdk.instreamvideo.util.Lock;
import com.appnexus.opensdk.ut.UTConstants;
import com.squareup.okhttp.HttpUrl;
import com.squareup.okhttp.mockwebserver.Dispatcher;
import com.squareup.okhttp.mockwebserver.MockResponse;
import com.squareup.okhttp.mockwebserver.MockWebServer;
import com.squareup.okhttp.mockwebserver.RecordedRequest;

import org.junit.After;
import org.junit.Before;
Expand All @@ -23,6 +23,8 @@

import static org.robolectric.Shadows.shadowOf;

import androidx.annotation.NonNull;

public class BaseRoboTest {
public static final int placementID = 1;
public static final int width = 320;
Expand Down Expand Up @@ -89,4 +91,18 @@ public void waitForTasks() {
scheduleTimerToCheckForTasks();
Lock.pause();
}

/**
*creates a mock web server dispatcher with prerecorded requests and responses
**/
public Dispatcher getDispatcher(final String response) {
return new Dispatcher() {
@NonNull
@Override
public MockResponse dispatch(@NonNull RecordedRequest request) {
return new MockResponse().setResponseCode(200)
.setBody(response);
}
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import com.appnexus.opensdk.instreamvideo.shadows.ShadowCustomClickThroughWebView;
import com.appnexus.opensdk.instreamvideo.shadows.ShadowSettings;
import com.appnexus.opensdk.instreamvideo.shadows.ShadowWebSettings;
import com.squareup.okhttp.mockwebserver.MockResponse;

import org.junit.Test;
import org.junit.runner.RunWith;
Expand Down Expand Up @@ -60,7 +59,7 @@ public void tearDown() {
@Test
public void testVideoANClickThroughActionReturnURL() {
videoAd.setClickThroughAction(ANClickThroughAction.RETURN_URL);
server.enqueue(new MockResponse().setResponseCode(200).setBody(TestUTResponses.video())); // First queue a regular HTML banner response
server.setDispatcher(getDispatcher(TestUTResponses.video())); // First queue a regular HTML banner response
executeVideoRequest();
waitForTasks();
Robolectric.flushBackgroundThreadScheduler();
Expand All @@ -73,7 +72,7 @@ public void testVideoANClickThroughActionReturnURL() {
@Test
public void testVideoANClickThroughActionSDKBrowser() {
videoAd.setClickThroughAction(ANClickThroughAction.OPEN_SDK_BROWSER);
server.enqueue(new MockResponse().setResponseCode(200).setBody(TestUTResponses.video())); // First queue a regular HTML banner response
server.setDispatcher(getDispatcher(TestUTResponses.video())); // First queue a regular HTML banner response
executeVideoRequest();

waitForTasks();
Expand All @@ -87,7 +86,7 @@ public void testVideoANClickThroughActionSDKBrowser() {
@Test
public void testVideoANClickThroughActionDeviceBrowser() {
videoAd.setClickThroughAction(ANClickThroughAction.OPEN_DEVICE_BROWSER);
server.enqueue(new MockResponse().setResponseCode(200).setBody(TestUTResponses.video())); // First queue a regular HTML banner response
server.setDispatcher(getDispatcher(TestUTResponses.video())); // First queue a regular HTML banner response
executeVideoRequest();

waitForTasks();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import com.appnexus.opensdk.instreamvideo.shadows.ShadowSettings;
import com.appnexus.opensdk.instreamvideo.shadows.ShadowWebSettings;
import com.appnexus.opensdk.instreamvideo.util.Lock;
import com.squareup.okhttp.mockwebserver.MockResponse;

import org.junit.Test;
import org.junit.runner.RunWith;
Expand Down Expand Up @@ -63,7 +62,7 @@ public void tearDown(){

@Test
public void testBannerAddFriendlyObstruction() {
server.enqueue(new MockResponse().setResponseCode(200).setBody(TestUTResponses.video())); // First queue a regular HTML banner response
server.setDispatcher(getDispatcher(TestUTResponses.video())); // First queue a regular HTML banner response
assertFriendlyObstruction(videoAd, 0);
SDKSettings.setOMEnabled(true);
View v1 = new View(activity);
Expand All @@ -78,7 +77,7 @@ public void testBannerAddFriendlyObstruction() {

@Test
public void testBannerAddAndRemoveFriendlyObstruction() {
server.enqueue(new MockResponse().setResponseCode(200).setBody(TestUTResponses.video())); // First queue a regular HTML banner response
server.setDispatcher(getDispatcher(TestUTResponses.video())); // First queue a regular HTML banner response
assertFriendlyObstruction(videoAd, 0);
SDKSettings.setOMEnabled(true);
View v1 = new View(activity);
Expand All @@ -97,7 +96,7 @@ public void testBannerAddAndRemoveFriendlyObstruction() {

@Test
public void testBannerAddAndRemoveAllFriendlyObstruction() {
server.enqueue(new MockResponse().setResponseCode(200).setBody(TestUTResponses.video())); // First queue a regular HTML banner response
server.setDispatcher(getDispatcher(TestUTResponses.video())); // First queue a regular HTML banner response
assertFriendlyObstruction(videoAd, 0);
SDKSettings.setOMEnabled(true);
View v1 = new View(activity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import com.appnexus.opensdk.instreamvideo.util.Lock;
import com.appnexus.opensdk.instreamvideo.util.TestUtil;
import com.appnexus.opensdk.utils.Clog;
import com.squareup.okhttp.mockwebserver.MockResponse;

import junit.framework.Assert;

Expand Down Expand Up @@ -78,7 +77,7 @@ public void testVideoDuration() throws Exception {
@Test
public void testGetVideoOrientationPortrait() throws Exception {
ShadowCustomWebView.aspectRatio = "0.5625"; // 9:16
server.enqueue(new MockResponse().setResponseCode(200).setBody(TestUTResponses.video()));
server.setDispatcher(getDispatcher(TestUTResponses.video()));

videoAd.loadAd();
Lock.pause(1000);
Expand All @@ -97,7 +96,7 @@ public void testGetVideoOrientationPortrait() throws Exception {
@Test
public void testGetVideoOrientationLandscape() throws Exception {
ShadowCustomWebView.aspectRatio = "1.7778"; // 16:9
server.enqueue(new MockResponse().setResponseCode(200).setBody(TestUTResponses.video()));
server.setDispatcher(getDispatcher(TestUTResponses.video()));

videoAd.loadAd();
Lock.pause(1000);
Expand All @@ -116,7 +115,7 @@ public void testGetVideoOrientationLandscape() throws Exception {
@Test
public void testGetVideoOrientationSquare() throws Exception {
ShadowCustomWebView.aspectRatio = "1";
server.enqueue(new MockResponse().setResponseCode(200).setBody(TestUTResponses.video()));
server.setDispatcher(getDispatcher(TestUTResponses.video()));

videoAd.loadAd();
Lock.pause(1000);
Expand All @@ -135,7 +134,7 @@ public void testGetVideoOrientationSquare() throws Exception {
@Test
public void testGetVideoOrientationUnknown() throws Exception {
ShadowCustomWebView.aspectRatio = "";
server.enqueue(new MockResponse().setResponseCode(200).setBody(TestUTResponses.video()));
server.setDispatcher(getDispatcher(TestUTResponses.video()));

videoAd.loadAd();
Lock.pause(1000);
Expand All @@ -154,7 +153,7 @@ public void testGetVideoOrientationUnknown() throws Exception {

@Test
public void testGetCreativeURL() throws Exception {
server.enqueue(new MockResponse().setResponseCode(200).setBody(TestUTResponses.video()));
server.setDispatcher(getDispatcher(TestUTResponses.video()));

videoAd.loadAd();
Lock.pause(1000);
Expand All @@ -173,7 +172,7 @@ public void testGetCreativeURL() throws Exception {

@Test
public void testGetVideoAdDuration() throws Exception {
server.enqueue(new MockResponse().setResponseCode(200).setBody(TestUTResponses.video()));
server.setDispatcher(getDispatcher(TestUTResponses.video()));

videoAd.loadAd();
Lock.pause(1000);
Expand All @@ -191,7 +190,7 @@ public void testGetVideoAdDuration() throws Exception {

@Test
public void testGetVastXML() throws Exception {
server.enqueue(new MockResponse().setResponseCode(200).setBody(TestUTResponses.video()));
server.setDispatcher(getDispatcher(TestUTResponses.video()));

videoAd.loadAd();
Lock.pause(1000);
Expand All @@ -209,7 +208,7 @@ public void testGetVastXML() throws Exception {

@Test
public void testGetVastURL() throws Exception {
server.enqueue(new MockResponse().setResponseCode(200).setBody(TestUTResponses.video()));
server.setDispatcher(getDispatcher(TestUTResponses.video()));

videoAd.loadAd();
Lock.pause(1000);
Expand All @@ -227,7 +226,7 @@ public void testGetVastURL() throws Exception {

@Test
public void testAdPlayStarted() throws Exception {
server.enqueue(new MockResponse().setResponseCode(200).setBody(TestUTResponses.video()));
server.setDispatcher(getDispatcher(TestUTResponses.video()));

videoAd.loadAd();
Lock.pause(1000);
Expand Down
4 changes: 2 additions & 2 deletions sdk/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Project properties
version = "8.6"
version = "8.6.1"
group='com.appnexus.opensdk'

// Android build
Expand All @@ -10,7 +10,7 @@ android {
buildToolsVersion '32.0.0'

defaultConfig {
versionCode 102 // An integer value that represents the version of the code, relative to other versions. Increase for each release.
versionCode 103 // An integer value that represents the version of the code, relative to other versions. Increase for each release.
versionName version
consumerProguardFiles 'proguard-project.txt'
minSdkVersion 14
Expand Down
7 changes: 4 additions & 3 deletions sdk/src/com/appnexus/opensdk/XandrAd.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,15 @@
import android.content.pm.PackageManager;
import android.net.Uri;
import android.provider.CalendarContract;

import com.appnexus.opensdk.tasksmanager.TasksManager;
import com.appnexus.opensdk.utils.Clog;
import com.appnexus.opensdk.utils.HTTPGet;
import com.appnexus.opensdk.utils.HTTPResponse;
import com.appnexus.opensdk.utils.Settings;
import org.json.JSONArray;
import org.json.JSONException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;

/**
* This class holds the responsibility of caching the memberId and memberId list,
Expand All @@ -45,7 +44,7 @@ public class XandrAd {
/**
* Cached member IDs list
* */
private static List<Integer> cachedViewableImpressionMemberIds = new ArrayList<>();
private static List<Integer> cachedViewableImpressionMemberIds = new CopyOnWriteArrayList<>();
/**
* Viewable Impression Config URL
* */
Expand Down Expand Up @@ -133,6 +132,8 @@ protected void onPostExecute(HTTPResponse response) {
}
} catch (JSONException e) {
Clog.e(Clog.baseLogTag, Clog.getString(R.string.fetch_viewable_impression_member_id_error));
} catch (ArrayIndexOutOfBoundsException boundsException) {
Clog.e(Clog.baseLogTag, Clog.getString(R.string.fetch_viewable_impression_member_id_error));
}
}

Expand Down
4 changes: 2 additions & 2 deletions sdk/src/com/appnexus/opensdk/utils/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ public enum ImpressionType {
public boolean debug_mode = false; // This should always be false here.
public String ua = null;

public final String sdkVersion = "8.6";
// BuildConfig.VERSION_NAME;
public final String sdkVersion = "8.6.1";
// BuildConfig.VERSION_NAME;


public String mcc;
Expand Down
Loading

0 comments on commit 334c821

Please sign in to comment.