use of com.xrtb.common.HttpPostGet in project XRTB by benmfaul.
the class TestSmaato method testNoBidOnTextAd.
/**
* Yoy should not bid on a text ad or rich media ad
* @throws Exception on network errors.
*/
//@Test
public void testNoBidOnTextAd() throws Exception {
HttpPostGet http = new HttpPostGet();
long time = 0;
String s = Charset.defaultCharset().decode(ByteBuffer.wrap(Files.readAllBytes(Paths.get("./SampleBids/smaatoTXTAD.json")))).toString();
time = System.currentTimeMillis();
s = http.sendPost("http://" + Config.testHost + "/rtb/bids/smaato?testbid=bid", s, 100000, 100000);
time = System.currentTimeMillis() - time;
String xtime = http.getHeader("X-TIME");
assertNull(s);
assertTrue(http.getResponseCode() == 204);
}
use of com.xrtb.common.HttpPostGet in project XRTB by benmfaul.
the class TestValidBids method testFyberPrivateMkt.
// Nothing to test with here.
// @Test
public void testFyberPrivateMkt() throws Exception {
HttpPostGet http = new HttpPostGet();
String bid = Charset.defaultCharset().decode(ByteBuffer.wrap(Files.readAllBytes(Paths.get("./SampleBids/fyberVideoPvtMkt.txt")))).toString();
String s = null;
long time = 0;
try {
try {
time = System.currentTimeMillis();
s = http.sendPost("http://" + Config.testHost + "/rtb/bids/fyber", bid);
time = System.currentTimeMillis() - time;
} catch (Exception error) {
fail("Can't connect to test host: " + Config.testHost);
}
assertNotNull(s);
} catch (Exception e) {
e.printStackTrace();
fail(e.toString());
}
}
use of com.xrtb.common.HttpPostGet in project XRTB by benmfaul.
the class TestSmaato method testNoBid.
/**
* Issue a NO BID directive to the RTB
* @throws Exception on network errors.
*/
//@Test
public void testNoBid() throws Exception {
HttpPostGet http = new HttpPostGet();
String s = Charset.defaultCharset().decode(ByteBuffer.wrap(Files.readAllBytes(Paths.get("./SampleBids/smaato.json")))).toString();
String xtime = null;
long time = 0;
s = Charset.defaultCharset().decode(ByteBuffer.wrap(Files.readAllBytes(Paths.get("./SampleBids/smaato.json")))).toString();
time = System.currentTimeMillis();
s = http.sendPost("http://" + Config.testHost + "/rtb/bids/smaato?testbid=nobid", s);
time = System.currentTimeMillis() - time;
xtime = http.getHeader("X-TIME");
assertNull(s);
assertTrue(http.getResponseCode() == 204);
}
use of com.xrtb.common.HttpPostGet in project XRTB by benmfaul.
the class TestSmaato method testIntegrationid.
/**
* Test the RTB will bid as ordered.
* @throws Exception on network errors
*/
//@Test
public void testIntegrationid() throws Exception {
HttpPostGet http = new HttpPostGet();
String xtime = null;
long time = 0;
String s = Charset.defaultCharset().decode(ByteBuffer.wrap(Files.readAllBytes(Paths.get("./SampleBids/smaato.json")))).toString();
time = System.currentTimeMillis();
s = http.sendPost("http://" + Config.testHost + "/rtb/bids/smaato?testbid=bid", s, 100000, 100000);
time = System.currentTimeMillis() - time;
xtime = http.getHeader("X-TIME");
assertTrue(http.getResponseCode() != 204);
assertNotNull(s);
}
use of com.xrtb.common.HttpPostGet in project XRTB by benmfaul.
the class TestDeals method testPreferredOkToBid.
/**
* Test a private auction with a deal not present in the campaigns.
* @throws Exception
*/
@Test
public void testPreferredOkToBid() throws Exception {
HttpPostGet http = new HttpPostGet();
String bid = Charset.defaultCharset().decode(ByteBuffer.wrap(Files.readAllBytes(Paths.get("./SampleBids/nexagePreferredAuction.txt")))).toString();
String s = null;
long time = 0;
String xtime = null;
try {
time = System.currentTimeMillis();
s = http.sendPost("http://" + Config.testHost + "/rtb/bids/nexage", bid, 300000, 300000);
time = System.currentTimeMillis() - time;
xtime = http.getHeader("X-TIME");
} catch (Exception error) {
fail("Can't connect to test host: " + Config.testHost);
}
/**
* Any bid will do
*/
assertNotNull(s);
int code = http.getResponseCode();
assertEquals(code, 200);
}
Aggregations