/** * @param id - id of banner you want to remove * @throws XmlRpcException * @throws MalformedURLException */ public boolean deleteBanner(Integer id) throws XmlRpcException, MalformedURLException { // set URL ((XmlRpcClientConfigImpl) client.getClientConfig()) .setServerURL(new URL(GlobalSettings.getBannerServiceUrl())); return (Boolean) client.execute(DELETE_BANNER_METHOD, new Object[] {sessionId, id}); }
public Object execute(String method, Object[] params) throws XmlRpcException, MalformedURLException { // set URL ((XmlRpcClientConfigImpl) client.getClientConfig()) .setServerURL(new URL(GlobalSettings.getBannerServiceUrl())); return client.execute(method, params); }
/** * @return banner id * @throws XmlRpcException * @throws MalformedURLException */ public Integer createBanner(Map<String, Object> params) throws XmlRpcException, MalformedURLException { ((XmlRpcClientConfigImpl) client.getClientConfig()) .setServerURL(new URL(GlobalSettings.getBannerServiceUrl())); Object[] paramsWithId = new Object[] {sessionId, params}; final Integer result = (Integer) client.execute(ADD_BANNER_METHOD, paramsWithId); return result; }
public boolean deleteManager(Integer id) throws XmlRpcException, MalformedURLException { ((XmlRpcClientConfigImpl) client.getClientConfig()) .setServerURL(new URL(GlobalSettings.getServiceUrl())); final Boolean result = (Boolean) client.execute("ox.deleteAgency", new Object[] {sessionId, id}); assertTrue(result); return result; }
private Integer createManager() throws XmlRpcException, MalformedURLException { ((XmlRpcClientConfigImpl) client.getClientConfig()) .setServerURL(new URL(GlobalSettings.getServiceUrl())); Map<String, Object> params = new HashMap<String, Object>(); params.put("agencyName", "manager"); params.put("contactName", "contact"); params.put("emailAddress", "*****@*****.**"); Object[] paramsWithId = new Object[] {sessionId, params}; final Integer result = (Integer) client.execute("ox.addAgency", paramsWithId); return result; }
/** * Try to add publisher with unknown agency id * * @throws XmlRpcException * @throws MalformedURLException */ public void testAddPublisherUnknownAgencyIdError() throws XmlRpcException, MalformedURLException { final Integer id = createAgency(); deleteAgency(id); ((XmlRpcClientConfigImpl) client.getClientConfig()) .setServerURL(new URL(GlobalSettings.getPublisherServiceUrl())); Map<String, Object> struct = new HashMap<String, Object>(); struct.put(PUBLISHER_NAME, TextUtils.MIN_ALLOWED_STRING); struct.put(AGENCY_ID, id); Object[] params = new Object[] {sessionId, struct}; try { final Integer result = (Integer) client.execute(ADD_PUBLISHER_METHOD, params); deletePublisher(result); fail(ErrorMessage.METHOD_EXECUTED_SUCCESSFULLY_BUT_SHOULD_NOT_HAVE); } catch (XmlRpcException e) { assertEquals( ErrorMessage.WRONG_ERROR_MESSAGE, ErrorMessage.getMessage(ErrorMessage.UNKNOWN_ID_ERROR, AGENCY_ID), e.getMessage()); } }