private Api newApi() {
Api api = new Api();
ApiContext env = new ApiContext();
env.setDefaultContext(true);
env.setId("test");
api.getContexts().add(env);
env.setStatus(Status.ACTIVE);
/*env.setMaxRateLimitTPMThreshold(1);
env.setMaxRateLimitTPMWarning(1);
env.setMaxRateLimitTPSThreshold(1);
env.setMaxRateLimitTPSWarning(1);*/
api.setId("getLocation" + (new Random().nextLong()));
api.setDisplayName("test");
api.setType(ApiType.PASS_THROUGH);
api.setVersion("1.0");
api.setEndpoint(new Random().nextLong()+"");
api.setStatus(Status.ACTIVE);
ProvisionAuthentication pauth = new ProvisionAuthentication();
Authkey authKey = new Authkey(); authKey.setKeyName("key");
pauth.setAuthKey(authKey);
api.setAuthentication(pauth);
pauth.getAuths().add(AuthType.AUTHKEY);
pauth.getAuths().add(AuthType.BASIC);
pauth.getAuths().add(AuthType.IP_WHITE_LIST);
TargetHost th = new TargetHost();
th.setUrl("http://www.yahoo.com");
TargetHost th2 = new TargetHost();
th2.setUrl("http://www.google.com");
Authentication auth = new Authentication();
auth.setType("NoAuth");
Data d = new Data();
Key k = new Key();
k.setName("aKey00");
k.setValue("key000Val");
d.setKey(Arrays.asList(k));
auth.setData(d);
th.setAuthentication(auth);
th2.setAuthentication(auth);
env.setTargetHosts(Arrays.asList(th, th2));
api.setTdrEnabled(new TdrEnabled());
api.getTdrEnabled().setEnabled("true");
HTTPSType httpsType = new HTTPSType();
httpsType.setEnabled(true);