/** * Returns the result of an operation invocation or an attribute value. * <br> * If an error occurred on the server, {@link #hasOperationSucceeded(Message)} will return {@code false}. * and the result will be a String corresponding to the server exception. */ public static Object[] getResults(final ICoreMessage message) throws Exception { SimpleString sstring = message.getReadOnlyBodyBuffer().readNullableSimpleString(); String jsonString = (sstring == null) ? null : sstring.toString(); if (jsonString != null) { JsonArray jsonArray = JsonUtil.readJsonArray(jsonString); return JsonUtil.fromJsonArray(jsonArray); } else { return null; } }
/** * Used by ActiveMQ Artemis management service. */ public static Object[] retrieveOperationParameters(final Message message) throws Exception { SimpleString sstring = message.toCore().getReadOnlyBodyBuffer().readNullableSimpleString(); String jsonString = (sstring == null) ? null : sstring.toString(); if (jsonString != null) { JsonArray jsonArray = JsonUtil.readJsonArray(jsonString); return JsonUtil.fromJsonArray(jsonArray); } else { return null; } }
/** * Returns an array of RoleInfo corresponding to the JSON serialization returned * by {@link AddressControl#getRolesAsJSON()}. */ public static RoleInfo[] from(final String jsonString) throws Exception { JsonArray array = JsonUtil.readJsonArray(jsonString); RoleInfo[] roles = new RoleInfo[array.size()]; for (int i = 0; i < array.size(); i++) { JsonObject r = array.getJsonObject(i); RoleInfo role = new RoleInfo(r.getString("name"), r.getBoolean("send"), r.getBoolean("consume"), r.getBoolean("createDurableQueue"), r.getBoolean("deleteDurableQueue"), r.getBoolean("createNonDurableQueue"), r.getBoolean("deleteNonDurableQueue"), r.getBoolean("manage"), r.getBoolean("browse"), r.getBoolean("createAddress")); roles[i] = role; } return roles; }
/** * Returns the result of an operation invocation or an attribute value. * <br> * If an error occurred on the server, {@link #hasOperationSucceeded(Message)} will return {@code false}. * and the result will be a String corresponding to the server exception. */ public static Object[] getResults(final ICoreMessage message) throws Exception { SimpleString sstring = message.getReadOnlyBodyBuffer().readNullableSimpleString(); String jsonString = (sstring == null) ? null : sstring.toString(); if (jsonString != null) { JsonArray jsonArray = JsonUtil.readJsonArray(jsonString); return JsonUtil.fromJsonArray(jsonArray); } else { return null; } }
/** * Returns the result of an operation invocation or an attribute value. * <br> * If an error occurred on the server, {@link #hasOperationSucceeded(Message)} will return {@code false}. * and the result will be a String corresponding to the server exception. */ public static Object[] getResults(final ICoreMessage message) throws Exception { SimpleString sstring = message.getReadOnlyBodyBuffer().readNullableSimpleString(); String jsonString = (sstring == null) ? null : sstring.toString(); if (jsonString != null) { JsonArray jsonArray = JsonUtil.readJsonArray(jsonString); return JsonUtil.fromJsonArray(jsonArray); } else { return null; } }
/** * Used by ActiveMQ Artemis management service. */ public static Object[] retrieveOperationParameters(final Message message) throws Exception { SimpleString sstring = message.toCore().getReadOnlyBodyBuffer().readNullableSimpleString(); String jsonString = (sstring == null) ? null : sstring.toString(); if (jsonString != null) { JsonArray jsonArray = JsonUtil.readJsonArray(jsonString); return JsonUtil.fromJsonArray(jsonArray); } else { return null; } }
/** * Used by ActiveMQ Artemis management service. */ public static Object[] retrieveOperationParameters(final Message message) throws Exception { SimpleString sstring = message.toCore().getReadOnlyBodyBuffer().readNullableSimpleString(); String jsonString = (sstring == null) ? null : sstring.toString(); if (jsonString != null) { JsonArray jsonArray = JsonUtil.readJsonArray(jsonString); return JsonUtil.fromJsonArray(jsonArray); } else { return null; } }
/** * Used by ActiveMQ Artemis management service. */ public static Object[] retrieveOperationParameters(final Message message) throws Exception { SimpleString sstring = message.toCore().getReadOnlyBodyBuffer().readNullableSimpleString(); String jsonString = (sstring == null) ? null : sstring.toString(); if (jsonString != null) { JsonArray jsonArray = JsonUtil.readJsonArray(jsonString); return JsonUtil.fromJsonArray(jsonArray); } else { return null; } }
/** * Used by ActiveMQ Artemis management service. */ public static Object[] retrieveOperationParameters(final Message message) throws Exception { SimpleString sstring = message.toCore().getReadOnlyBodyBuffer().readNullableSimpleString(); String jsonString = (sstring == null) ? null : sstring.toString(); if (jsonString != null) { JsonArray jsonArray = JsonUtil.readJsonArray(jsonString); return JsonUtil.fromJsonArray(jsonArray); } else { return null; } }
/** * Used by ActiveMQ Artemis management service. */ public static Object[] retrieveOperationParameters(final Message message) throws Exception { SimpleString sstring = message.toCore().getReadOnlyBodyBuffer().readNullableSimpleString(); String jsonString = (sstring == null) ? null : sstring.toString(); if (jsonString != null) { JsonArray jsonArray = JsonUtil.readJsonArray(jsonString); return JsonUtil.fromJsonArray(jsonArray); } else { return null; } }
/** * Used by ActiveMQ Artemis management service. */ public static Object[] retrieveOperationParameters(final Message message) throws Exception { SimpleString sstring = message.toCore().getReadOnlyBodyBuffer().readNullableSimpleString(); String jsonString = (sstring == null) ? null : sstring.toString(); if (jsonString != null) { JsonArray jsonArray = JsonUtil.readJsonArray(jsonString); return JsonUtil.fromJsonArray(jsonArray); } else { return null; } }
protected long getFirstMessageId(final QueueControl queueControl) throws Exception { JsonArray array = JsonUtil.readJsonArray(queueControl.getFirstMessageAsJSON()); JsonObject object = (JsonObject) array.get(0); return object.getJsonNumber("messageID").longValue(); }
/** * Returns an array of RoleInfo corresponding to the JSON serialization returned * by {@link AddressControl#getRolesAsJSON()}. */ public static RoleInfo[] from(final String jsonString) throws Exception { JsonArray array = JsonUtil.readJsonArray(jsonString); RoleInfo[] roles = new RoleInfo[array.size()]; for (int i = 0; i < array.size(); i++) { JsonObject r = array.getJsonObject(i); RoleInfo role = new RoleInfo(r.getString("name"), r.getBoolean("send"), r.getBoolean("consume"), r.getBoolean("createDurableQueue"), r.getBoolean("deleteDurableQueue"), r.getBoolean("createNonDurableQueue"), r.getBoolean("deleteNonDurableQueue"), r.getBoolean("manage"), r.getBoolean("browse"), r.getBoolean("createAddress")); roles[i] = role; } return roles; }
/** * Returns an array of RoleInfo corresponding to the JSON serialization returned * by {@link AddressControl#getRolesAsJSON()}. */ public static RoleInfo[] from(final String jsonString) throws Exception { JsonArray array = JsonUtil.readJsonArray(jsonString); RoleInfo[] roles = new RoleInfo[array.size()]; for (int i = 0; i < array.size(); i++) { JsonObject r = array.getJsonObject(i); RoleInfo role = new RoleInfo(r.getString("name"), r.getBoolean("send"), r.getBoolean("consume"), r.getBoolean("createDurableQueue"), r.getBoolean("deleteDurableQueue"), r.getBoolean("createNonDurableQueue"), r.getBoolean("deleteNonDurableQueue"), r.getBoolean("manage"), r.getBoolean("browse"), r.getBoolean("createAddress")); roles[i] = role; } return roles; }
/** * Returns an array of RoleInfo corresponding to the JSON serialization returned * by {@link AddressControl#getRolesAsJSON()}. */ public static RoleInfo[] from(final String jsonString) throws Exception { JsonArray array = JsonUtil.readJsonArray(jsonString); RoleInfo[] roles = new RoleInfo[array.size()]; for (int i = 0; i < array.size(); i++) { JsonObject r = array.getJsonObject(i); RoleInfo role = new RoleInfo(r.getString("name"), r.getBoolean("send"), r.getBoolean("consume"), r.getBoolean("createDurableQueue"), r.getBoolean("deleteDurableQueue"), r.getBoolean("createNonDurableQueue"), r.getBoolean("deleteNonDurableQueue"), r.getBoolean("manage"), r.getBoolean("browse"), r.getBoolean("createAddress")); roles[i] = role; } return roles; }
/** * Returns an array of RoleInfo corresponding to the JSON serialization returned * by {@link AddressControl#getRolesAsJSON()}. */ public static RoleInfo[] from(final String jsonString) throws Exception { JsonArray array = JsonUtil.readJsonArray(jsonString); RoleInfo[] roles = new RoleInfo[array.size()]; for (int i = 0; i < array.size(); i++) { JsonObject r = array.getJsonObject(i); RoleInfo role = new RoleInfo(r.getString("name"), r.getBoolean("send"), r.getBoolean("consume"), r.getBoolean("createDurableQueue"), r.getBoolean("deleteDurableQueue"), r.getBoolean("createNonDurableQueue"), r.getBoolean("deleteNonDurableQueue"), r.getBoolean("manage"), r.getBoolean("browse"), r.getBoolean("createAddress")); roles[i] = role; } return roles; }
/** * Returns an array of RoleInfo corresponding to the JSON serialization returned * by {@link AddressControl#getRolesAsJSON()}. */ public static RoleInfo[] from(final String jsonString) throws Exception { JsonArray array = JsonUtil.readJsonArray(jsonString); RoleInfo[] roles = new RoleInfo[array.size()]; for (int i = 0; i < array.size(); i++) { JsonObject r = array.getJsonObject(i); RoleInfo role = new RoleInfo(r.getString("name"), r.getBoolean("send"), r.getBoolean("consume"), r.getBoolean("createDurableQueue"), r.getBoolean("deleteDurableQueue"), r.getBoolean("createNonDurableQueue"), r.getBoolean("deleteNonDurableQueue"), r.getBoolean("manage"), r.getBoolean("browse"), r.getBoolean("createAddress")); roles[i] = role; } return roles; }
/** * Returns an array of RoleInfo corresponding to the JSON serialization returned * by {@link AddressControl#getRolesAsJSON()}. */ public static RoleInfo[] from(final String jsonString) throws Exception { JsonArray array = JsonUtil.readJsonArray(jsonString); RoleInfo[] roles = new RoleInfo[array.size()]; for (int i = 0; i < array.size(); i++) { JsonObject r = array.getJsonObject(i); RoleInfo role = new RoleInfo(r.getString("name"), r.getBoolean("send"), r.getBoolean("consume"), r.getBoolean("createDurableQueue"), r.getBoolean("deleteDurableQueue"), r.getBoolean("createNonDurableQueue"), r.getBoolean("deleteNonDurableQueue"), r.getBoolean("manage"), r.getBoolean("browse"), r.getBoolean("createAddress")); roles[i] = role; } return roles; }
@Test public void testGetRoutingTypesAsJSON() throws Exception { SimpleString address = RandomUtil.randomSimpleString(); session.createAddress(address, RoutingType.ANYCAST, false); AddressControl addressControl = createManagementControl(address); JsonArray jsonArray = JsonUtil.readJsonArray(addressControl.getRoutingTypesAsJSON()); assertEquals(1, jsonArray.size()); assertEquals(RoutingType.ANYCAST.toString(), ((JsonString) jsonArray.get(0)).getString()); }
@Test public void testGetConnectorsAsJSON() throws Exception { ActiveMQServerControl serverControl = createManagementControl(); String jsonString = serverControl.getConnectorsAsJSON(); Assert.assertNotNull(jsonString); JsonArray array = JsonUtil.readJsonArray(jsonString); Assert.assertEquals(1, array.size()); JsonObject data = array.getJsonObject(0); Assert.assertEquals(connectorConfig.getName(), data.getString("name")); Assert.assertEquals(connectorConfig.getFactoryClassName(), data.getString("factoryClassName")); Assert.assertEquals(connectorConfig.getParams().size(), data.getJsonObject("params").size()); }