JSONObject sessionInfo = server.sessionAuthenticate("openerp_jsonrpc_client", "admin", "admin", null, null);
// First we search for sale module id
JSONArray domain = new JSONArray("[['name','=','sale']]");
String[] fields = { "name", "state"};
JSONObject jsonResult = server.modelSearchRead("ir.module.module", fields, 0, 0, domain, null, null);
JSONObject moduleObject = (JSONObject) ((JSONArray) jsonResult.get("records")).get(0);
Long saleModuleId = ((Integer)moduleObject.get("id")).longValue();
System.out.println("Sale module (before install)= " + moduleObject);
Assert.assertEquals("uninstalled", (String) moduleObject.get("state"), "Sale module is already installed");