Search in sources :

Example 16 with BidRequest

use of org.prebid.mobile.rendering.models.openrtb.BidRequest in project prebid-mobile-android by prebid.

the class BasicParameterBuilderTest method getExpectedBidRequest.

private BidRequest getExpectedBidRequest(AdConfiguration adConfiguration, String uuid) {
    BidRequest bidRequest = new BidRequest();
    bidRequest.setId(uuid);
    boolean isVideo = adConfiguration.isAdType(AdConfiguration.AdUnitIdentifierType.VAST);
    bidRequest.getExt().put("prebid", Prebid.getJsonObjectForBidRequest(PrebidRenderingSettings.getAccountId(), isVideo));
    // if coppaEnabled - set 1, else No coppa is sent
    if (PrebidRenderingSettings.isCoppaEnabled) {
        bidRequest.getRegs().coppa = 1;
    }
    Imp imp = getExpectedImp(adConfiguration, uuid);
    bidRequest.getImp().add(imp);
    Source source = bidRequest.getSource();
    source.setTid(uuid);
    source.getExt().put(KEY_OM_PARTNER_NAME, OmAdSessionManager.PARTNER_NAME);
    source.getExt().put(KEY_OM_PARTNER_VERSION, OmAdSessionManager.PARTNER_VERSION);
    bidRequest.getUser();
    return bidRequest;
}
Also used : Imp(org.prebid.mobile.rendering.models.openrtb.bidRequests.Imp) Source(org.prebid.mobile.rendering.models.openrtb.bidRequests.source.Source) BidRequest(org.prebid.mobile.rendering.models.openrtb.BidRequest)

Example 17 with BidRequest

use of org.prebid.mobile.rendering.models.openrtb.BidRequest in project prebid-mobile-android by prebid.

the class GeoLocationParameterBuilderTest method testAppendBuilderParameters.

@Test
public void testAppendBuilderParameters() throws Exception {
    GeoLocationParameterBuilder builder = new GeoLocationParameterBuilder();
    AdRequestInput adRequestInput = new AdRequestInput();
    builder.appendBuilderParameters(adRequestInput);
    BidRequest expectedBidRequest = new BidRequest();
    expectedBidRequest.getDevice().getGeo().lat = LATITUDE.floatValue();
    expectedBidRequest.getDevice().getGeo().lon = LONGITUDE.floatValue();
    expectedBidRequest.getDevice().getGeo().type = GeoLocationParameterBuilder.LOCATION_SOURCE_GPS;
    assertEquals(expectedBidRequest.getJsonObject().toString(), adRequestInput.getBidRequest().getJsonObject().toString());
}
Also used : BidRequest(org.prebid.mobile.rendering.models.openrtb.BidRequest) Test(org.junit.Test)

Example 18 with BidRequest

use of org.prebid.mobile.rendering.models.openrtb.BidRequest in project prebid-mobile-android by prebid.

the class AppInfoParameterBuilderTest method testAppendBuilderParameters.

@Test
public void testAppendBuilderParameters() throws Exception {
    AdConfiguration adConfiguration = new AdConfiguration();
    ContentObject contentObject = new ContentObject();
    contentObject.setUrl("test.com");
    adConfiguration.setAppContent(contentObject);
    AppInfoParameterBuilder builder = new AppInfoParameterBuilder(adConfiguration);
    AdRequestInput adRequestInput = new AdRequestInput();
    final String expectedStoreurl = "https://google.play.com";
    final String expectedPublisherName = "prebid";
    Targeting.setPublisherName(expectedPublisherName);
    Targeting.setAppStoreMarketUrl(expectedStoreurl);
    builder.appendBuilderParameters(adRequestInput);
    BidRequest expectedBidRequest = new BidRequest();
    final App expectedApp = expectedBidRequest.getApp();
    expectedApp.name = APP_NAME;
    expectedApp.bundle = APP_BUNDLE;
    expectedApp.storeurl = expectedStoreurl;
    expectedApp.getPublisher().name = expectedPublisherName;
    expectedApp.getExt().put("prebid", Prebid.getJsonObjectForApp(BasicParameterBuilder.DISPLAY_MANAGER_VALUE, PrebidRenderingSettings.SDK_VERSION));
    ContentObject expectedContentObject = new ContentObject();
    expectedContentObject.setUrl("test.com");
    expectedApp.contentObject = expectedContentObject;
    assertEquals(expectedBidRequest.getJsonObject().toString(), adRequestInput.getBidRequest().getJsonObject().toString());
}
Also used : App(org.prebid.mobile.rendering.models.openrtb.bidRequests.App) AdConfiguration(org.prebid.mobile.rendering.models.AdConfiguration) ContentObject(org.prebid.mobile.ContentObject) BidRequest(org.prebid.mobile.rendering.models.openrtb.BidRequest) Test(org.junit.Test)

Example 19 with BidRequest

use of org.prebid.mobile.rendering.models.openrtb.BidRequest in project prebid-mobile-android by prebid.

the class DeviceInfoParameterBuilderTest method testAppendBuilderParameters.

@Test
public void testAppendBuilderParameters() throws Exception {
    BidRequest expectedBidRequest = new BidRequest();
    final Device expectedBidRequestDevice = expectedBidRequest.getDevice();
    final String ipAddress = "192.168.0.1";
    final String carrier = "carrier";
    AdConfiguration adConfiguration = new AdConfiguration();
    ParameterBuilder builder = new DeviceInfoParameterBuilder(adConfiguration);
    AdRequestInput adRequestInput = new AdRequestInput();
    builder.appendBuilderParameters(adRequestInput);
    expectedBidRequestDevice.os = DeviceInfoParameterBuilder.PLATFORM_VALUE;
    expectedBidRequestDevice.w = SCREEN_WIDTH;
    expectedBidRequestDevice.h = SCREEN_HEIGHT;
    expectedBidRequestDevice.language = Locale.getDefault().getLanguage();
    expectedBidRequestDevice.osv = "4.4";
    expectedBidRequestDevice.os = "Android";
    expectedBidRequestDevice.model = "robolectric";
    expectedBidRequestDevice.make = "unknown";
    expectedBidRequestDevice.pxratio = 1f;
    expectedBidRequestDevice.ua = AppInfoManager.getUserAgent();
    expectedBidRequestDevice.ifa = AdIdManager.getAdId();
    expectedBidRequestDevice.lmt = AdIdManager.isLimitAdTrackingEnabled() ? 1 : 0;
    assertJsonEquals(expectedBidRequest.getJsonObject(), adRequestInput.getBidRequest().getJsonObject());
}
Also used : Device(org.prebid.mobile.rendering.models.openrtb.bidRequests.Device) AdConfiguration(org.prebid.mobile.rendering.models.AdConfiguration) BidRequest(org.prebid.mobile.rendering.models.openrtb.BidRequest) Test(org.junit.Test)

Example 20 with BidRequest

use of org.prebid.mobile.rendering.models.openrtb.BidRequest in project prebid-mobile-android by prebid.

the class AutoDetectedOpenRtbTest method overwrittenDeviceInfoParameterBuilder.

@Test
public void overwrittenDeviceInfoParameterBuilder() {
    mOriginalOpenRtbParams.getDevice().dpidmd5 = "foo";
    mOriginalOpenRtbParams.getDevice().dpidsha1 = "foo";
    mOriginalOpenRtbParams.getDevice().w = 0;
    mOriginalOpenRtbParams.getDevice().h = 0;
    mParamBuilderArray.add(new DeviceInfoParameterBuilder(new AdConfiguration()));
    AdRequestInput newAdRequestInput = URLBuilder.buildParameters(mParamBuilderArray, mOriginalAdRequestInput);
    BidRequest newOpenRtbParams = newAdRequestInput.getBidRequest();
    assertNotEquals(mOriginalOpenRtbParams.getDevice().dpidmd5, newOpenRtbParams.getDevice().dpidmd5);
    assertNotEquals(mOriginalOpenRtbParams.getDevice().dpidsha1, newOpenRtbParams.getDevice().dpidsha1);
    assertNotEquals(mOriginalOpenRtbParams.getDevice().w, newOpenRtbParams.getDevice().w);
    assertNotEquals(mOriginalOpenRtbParams.getDevice().h, newOpenRtbParams.getDevice().h);
}
Also used : AdRequestInput(org.prebid.mobile.rendering.networking.parameters.AdRequestInput) DeviceInfoParameterBuilder(org.prebid.mobile.rendering.networking.parameters.DeviceInfoParameterBuilder) AdConfiguration(org.prebid.mobile.rendering.models.AdConfiguration) BidRequest(org.prebid.mobile.rendering.models.openrtb.BidRequest) Test(org.junit.Test)

Aggregations

BidRequest (org.prebid.mobile.rendering.models.openrtb.BidRequest)24 Test (org.junit.Test)20 AdConfiguration (org.prebid.mobile.rendering.models.AdConfiguration)11 AdRequestInput (org.prebid.mobile.rendering.networking.parameters.AdRequestInput)8 BasicParameterBuilder (org.prebid.mobile.rendering.networking.parameters.BasicParameterBuilder)7 Imp (org.prebid.mobile.rendering.models.openrtb.bidRequests.Imp)5 AdSize (org.prebid.mobile.rendering.bidding.data.AdSize)4 NetworkInfo (android.net.NetworkInfo)2 JSONObject (org.json.JSONObject)2 Device (org.prebid.mobile.rendering.models.openrtb.bidRequests.Device)2 Activity (android.app.Activity)1 Location (android.location.Location)1 LocationManager (android.location.LocationManager)1 JSONArray (org.json.JSONArray)1 JSONException (org.json.JSONException)1 Before (org.junit.Before)1 ContentObject (org.prebid.mobile.ContentObject)1 App (org.prebid.mobile.rendering.models.openrtb.bidRequests.App)1 User (org.prebid.mobile.rendering.models.openrtb.bidRequests.User)1 Geo (org.prebid.mobile.rendering.models.openrtb.bidRequests.devices.Geo)1