Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,11 @@ public Object getField(ServerConsumer consumer, String fieldName) {
}

public static String checkConsumerStatus(ServerConsumer consumer, ActiveMQServer server) {
if (server.getRemotingService().getConnection((consumer).getConnectionID()) == null) {
if (server.getRemotingService() != null && server.getRemotingService().getConnection((consumer).getConnectionID()) == null) {
return CONSUMER_STATUS_ORPHANED;
} else {
return CONSUMER_STATUS_OK;
}

}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,12 @@ public boolean test(ServerConsumer consumer) {
matches(server.getSessionByID(consumer.getSessionID()).getRemotingConnection().getTransportConnection().getRemoteAddress());
case MESSAGES_IN_TRANSIT -> matches(consumer.getMessagesInTransit());
case MESSAGES_IN_TRANSIT_SIZE -> matches(consumer.getMessagesInTransitSize());
case MESSAGES_DELIVERED -> matches(consumer.getDeliveringMessages());
case MESSAGES_DELIVERED -> matches(consumer.getMessagesDelivered());
case MESSAGES_DELIVERED_SIZE -> matches(consumer.getMessagesDeliveredSize());
case MESSAGES_ACKNOWLEDGED -> matches(consumer.getMessagesAcknowledged());
case MESSAGES_ACKNOWLEDGED_AWAITING_COMMIT -> matches(consumer.getMessagesAcknowledgedAwaitingCommit());
case LAST_ACKNOWLEDGED_TIME -> matches(consumer.getLastAcknowledgedTime());
case LAST_DELIVERED_TIME -> matches(consumer.getLastDeliveredTime());
default -> true;
};
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.activemq.artemis.core.management.impl.view;

import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;

public class AddressViewTest extends ViewTest {

@Test
public void testDefaultViewNullOptions() {
AddressView addressView = new AddressView(Mockito.mock(ActiveMQServer.class));
// sanity check to ensure this doesn't just blow up
addressView.setOptions(null);
}

@Test
public void testDefaultViewEmptyOptions() {
AddressView addressView = new AddressView(Mockito.mock(ActiveMQServer.class));
// sanity check to ensure this doesn't just blow up
addressView.setOptions("");
}

@Test
public void testViewLegacySort() {
AddressView view = new AddressView(Mockito.mock(ActiveMQServer.class));
assertNotEquals("name", view.getDefaultOrderColumn());
view.setOptions(createLegacyJsonFilter("name", "EQUALS", "123", "name", "asc"));
assertEquals("name", view.getSortField());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.activemq.artemis.core.management.impl.view;

import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;

public class ConnectionViewTest extends ViewTest {

@Test
public void testDefaultViewNullOptions() {
ConnectionView connectionView = new ConnectionView(Mockito.mock(ActiveMQServer.class));
// sanity check to ensure this doesn't just blow up
connectionView.setOptions(null);
}

@Test
public void testDefaultViewEmptyOptions() {
ConnectionView connectionView = new ConnectionView(Mockito.mock(ActiveMQServer.class));
// sanity check to ensure this doesn't just blow up
connectionView.setOptions("");
}

@Test
public void testViewLegacySort() {
ConnectionView view = new ConnectionView(Mockito.mock(ActiveMQServer.class));
assertNotEquals("protocol", view.getDefaultOrderColumn());
view.setOptions(createLegacyJsonFilter("protocol", "EQUALS", "123", "protocol", "asc"));
assertEquals("protocol", view.getSortField());
}
}
Loading