+
+ public JSONObject validateMMExists(DMaaPContext ctx, String name) throws Exception {
+ // Create a listAllMirrorMaker Json object
+ JSONObject listAll = new JSONObject();
+ try {
+ listAll.put("listAllMirrorMaker", new JSONObject());
+
+ } catch (JSONException e) {
+
+ e.printStackTrace();
+ }
+
+ // set a random number as messageID
+ String randomStr = getRandomNum();
+ listAll.put("messageID", randomStr);
+ InputStream inStream = null;
+
+ // convert listAll Json object to InputStream object
+ try {
+ inStream = IOUtils.toInputStream(listAll.toString(), "UTF-8");
+
+ } catch (IOException ioe) {
+ ioe.printStackTrace();
+ }
+ JSONObject listMirrorMaker = new JSONObject();
+ listMirrorMaker = callPubSub(randomStr, ctx, inStream, name, false);
+ if (null != listMirrorMaker && listMirrorMaker.length() > 0) {
+ listMirrorMaker.put("exists", true);
+ return listMirrorMaker;
+
+ }
+ listMirrorMaker.put("exists", false);
+ return listMirrorMaker;
+
+ }