Skip to content

Commit

Permalink
NO-JIRA Moving SimpleManagement to test-support
Browse files Browse the repository at this point in the history
  • Loading branch information
clebertsuconic committed Jul 20, 2023
1 parent 671f48f commit 9ffe062
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand All @@ -45,7 +44,6 @@ private static void listQueueResult(ClientMessage message, Map<String, Integer>

final String result = (String) ManagementHelper.getResult(message, String.class);


JsonObject queuesAsJsonObject = JsonUtil.readJsonObject(result);
JsonArray array = queuesAsJsonObject.getJsonArray("data");

Expand All @@ -55,7 +53,6 @@ private static void listQueueResult(ClientMessage message, Map<String, Integer>
String messageCount = object.getString("messageCount");
mapQueues.put(name, Integer.parseInt(messageCount));
}

}

private static void failed(ClientMessage message) throws Exception {
Expand All @@ -64,5 +61,4 @@ private static void failed(ClientMessage message) throws Exception {

throw new Exception("Failed " + result);
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
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;
Expand Down

0 comments on commit 9ffe062

Please sign in to comment.