NO-JIRA Moving SimpleManagement to test-support

This commit is contained in:
Clebert Suconic 2023-07-19 10:23:15 -04:00 committed by clebertsuconic
parent 671f48fb31
commit 9ffe062c41
3 changed files with 4 additions and 8 deletions

View File

@ -27,7 +27,7 @@ import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
public abstract class AbstractAction extends ConnectionAbstract {
// TODO: This call could be replaced by a direct call into ManagementHelpr.doManagement and their lambdas
// TODO: This call could be replaced by a direct call into ManagementHelper.doManagement and their lambdas
public void performCoreManagement(ManagementCallback<ClientMessage> cb) throws Exception {
try (ActiveMQConnectionFactory factory = createCoreConnectionFactory();
ServerLocator locator = factory.getServerLocator();

View File

@ -15,7 +15,7 @@
* limitations under the License.
*/
package org.apache.activemq.artemis.tests.smoke.common;
package org.apache.activemq.artemis.utils;
import java.util.HashMap;
import java.util.Map;
@ -30,7 +30,6 @@ public class SimpleManagement {
private static final String SIMPLE_OPTIONS = "{\"field\":\"\",\"value\":\"\",\"operation\":\"\"}";
/** Simple management function that will return a list of Pair<Name of Queue, Number of Messages> */
public static Map<String, Integer> listQueues(String uri, String user, String password, int maxRows) throws Exception {
Map<String, Integer> queues = new HashMap<>();
ManagementHelper.doManagement(uri, user, password, t -> setupListQueue(t, maxRows), t -> listQueueResult(t, queues), SimpleManagement::failed);
@ -45,7 +44,6 @@ public class SimpleManagement {
final String result = (String) ManagementHelper.getResult(message, String.class);
JsonObject queuesAsJsonObject = JsonUtil.readJsonObject(result);
JsonArray array = queuesAsJsonObject.getJsonArray("data");
@ -55,7 +53,6 @@ public class SimpleManagement {
String messageCount = object.getString("messageCount");
mapQueues.put(name, Integer.parseInt(messageCount));
}
}
private static void failed(ClientMessage message) throws Exception {
@ -64,5 +61,4 @@ public class SimpleManagement {
throw new Exception("Failed " + result);
}
}

View File

@ -32,10 +32,10 @@ import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.activemq.artemis.tests.smoke.common.SimpleManagement;
import org.apache.activemq.artemis.tests.smoke.common.SmokeTestBase;
import org.apache.activemq.artemis.tests.util.CFUtil;
import org.apache.activemq.artemis.util.ServerUtil;
import org.apache.activemq.artemis.utils.SimpleManagement;
import org.apache.activemq.artemis.utils.Wait;
import org.junit.Assert;
import org.junit.Before;