You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by rg...@apache.org on 2016/11/25 12:50:18 UTC
svn commit: r1771313 - in /qpid/java/trunk:
broker-core/src/main/java/org/apache/qpid/server/logging/subjects/
broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/
systests/src/test/java/org/apache/qpid/server/logging/ t...
Author: rgodfrey
Date: Fri Nov 25 12:50:18 2016
New Revision: 1771313
URL: http://svn.apache.org/viewvc?rev=1771313&view=rev
Log:
QPID-7546 : Enable ChannelLoggingTest
Modified:
qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/subjects/ChannelLogSubject.java
qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/AMQPConnection_1_0.java
qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Session_1_0.java
qpid/java/trunk/systests/src/test/java/org/apache/qpid/server/logging/AbstractTestLogging.java
qpid/java/trunk/systests/src/test/java/org/apache/qpid/server/logging/ChannelLoggingTest.java
qpid/java/trunk/test-profiles/Java10Excludes
qpid/java/trunk/test-profiles/Java10UninvestigatedTestsExcludes
qpid/java/trunk/test-profiles/test-provider-1-0.properties
Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/subjects/ChannelLogSubject.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/subjects/ChannelLogSubject.java?rev=1771313&r1=1771312&r2=1771313&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/subjects/ChannelLogSubject.java (original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/subjects/ChannelLogSubject.java Fri Nov 25 12:50:18 2016
@@ -20,16 +20,22 @@
*/
package org.apache.qpid.server.logging.subjects;
+import static org.apache.qpid.server.logging.subjects.LogSubjectFormat.CHANNEL_FORMAT;
+
import org.apache.qpid.server.protocol.AMQSessionModel;
import org.apache.qpid.server.transport.AMQPConnection;
-import static org.apache.qpid.server.logging.subjects.LogSubjectFormat.CHANNEL_FORMAT;
-
public class ChannelLogSubject extends AbstractLogSubject
{
-
+ private final AMQSessionModel<?> _sessionModel;
public ChannelLogSubject(AMQSessionModel session)
{
+ _sessionModel = session;
+ updateSessionDetails();
+ }
+
+ public void updateSessionDetails()
+ {
/**
* LOG FORMAT used by the AMQPConnectorActor follows
* ChannelLogSubject.CHANNEL_FORMAT : con:{0}({1}@{2}/{3})/ch:{4}.
@@ -43,14 +49,12 @@ public class ChannelLogSubject extends A
* 3 - Virtualhost
* 4 - Channel ID
*/
- AMQPConnection connection = session.getAMQPConnection();
+ AMQPConnection connection = _sessionModel.getAMQPConnection();
setLogStringWithFormat(CHANNEL_FORMAT,
connection == null ? -1L : connection.getConnectionId(),
(connection == null || connection.getAuthorizedPrincipal() == null) ? "?" : connection.getAuthorizedPrincipal().getName(),
(connection == null || connection.getRemoteAddressString() == null) ? "?" : connection.getRemoteAddressString(),
(connection == null || connection.getAddressSpaceName() == null) ? "?" : connection.getAddressSpaceName(),
- session.getChannelId());
-
+ _sessionModel.getChannelId());
}
-
}
Modified: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/AMQPConnection_1_0.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/AMQPConnection_1_0.java?rev=1771313&r1=1771312&r2=1771313&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/AMQPConnection_1_0.java (original)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/AMQPConnection_1_0.java Fri Nov 25 12:50:18 2016
@@ -501,12 +501,20 @@ public class AMQPConnection_1_0 extends
{
assertState(FrameReceivingState.ANY_FRAME);
- Session_1_0 endpoint = _receivingSessions[channel];
- if (endpoint != null)
+ final Session_1_0 session = getSession(channel);
+ if (session != null)
{
- _receivingSessions[channel] = null;
+ AccessController.doPrivileged(new PrivilegedAction<Object>()
+ {
+ @Override
+ public Object run()
+ {
+ _receivingSessions[channel] = null;
- endpoint.receiveEnd(end);
+ session.receiveEnd(end);
+ return null;
+ }
+ }, session.getAccessControllerContext());
}
else
{
@@ -1423,7 +1431,14 @@ public class AMQPConnection_1_0 extends
@Override
public void performAction(final ConnectionHandler object)
{
- ((Session_1_0)session).close(cause, message);
+ AccessController.doPrivileged(new PrivilegedAction<Void>() {
+ @Override
+ public Void run()
+ {
+ ((Session_1_0)session).close(cause, message);
+ return null;
+ }
+ }, ((Session_1_0)session).getAccessControllerContext());
}
});
Modified: qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Session_1_0.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Session_1_0.java?rev=1771313&r1=1771312&r2=1771313&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Session_1_0.java (original)
+++ qpid/java/trunk/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Session_1_0.java Fri Nov 25 12:50:18 2016
@@ -24,6 +24,8 @@ import static org.apache.qpid.server.log
import java.security.AccessControlContext;
import java.security.AccessControlException;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collection;
@@ -146,7 +148,7 @@ public class Session_1_0 implements AMQS
private long _lastAttachedTime;
private short _receivingChannel;
- private short _sendingChannel;
+ private short _sendingChannel = -1;
// has to be a power of two
@@ -205,6 +207,7 @@ public class Session_1_0 implements AMQS
public void setReceivingChannel(final short receivingChannel)
{
_receivingChannel = receivingChannel;
+ _logSubject.updateSessionDetails();
switch(_state)
{
case INACTIVE:
@@ -551,6 +554,7 @@ public class Session_1_0 implements AMQS
public void setSendingChannel(final short sendingChannel)
{
_sendingChannel = sendingChannel;
+ _logSubject.updateSessionDetails();
switch(_state)
{
case INACTIVE:
@@ -563,6 +567,17 @@ public class Session_1_0 implements AMQS
// TODO error
}
+
+ AccessController.doPrivileged((new PrivilegedAction<Object>()
+ {
+ @Override
+ public Object run()
+ {
+ _connection.getEventLogger().message(ChannelMessages.CREATE());
+
+ return null;
+ }
+ }), _accessControllerContext);
}
public void sendFlow(final Flow flow)
@@ -1249,6 +1264,7 @@ public class Session_1_0 implements AMQS
{
task.performAction(this);
}
+ getAMQPConnection().getEventLogger().message(_logSubject,ChannelMessages.CLOSE());
}
}
Modified: qpid/java/trunk/systests/src/test/java/org/apache/qpid/server/logging/AbstractTestLogging.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/systests/src/test/java/org/apache/qpid/server/logging/AbstractTestLogging.java?rev=1771313&r1=1771312&r2=1771313&view=diff
==============================================================================
--- qpid/java/trunk/systests/src/test/java/org/apache/qpid/server/logging/AbstractTestLogging.java (original)
+++ qpid/java/trunk/systests/src/test/java/org/apache/qpid/server/logging/AbstractTestLogging.java Fri Nov 25 12:50:18 2016
@@ -20,10 +20,6 @@
*/
package org.apache.qpid.server.logging;
-import org.apache.qpid.server.logging.subjects.AbstractTestLogSubject;
-import org.apache.qpid.test.utils.QpidBrokerTestCase;
-import org.apache.qpid.util.LogMonitor;
-
import java.io.FileNotFoundException;
import java.io.IOException;
import java.text.NumberFormat;
@@ -33,6 +29,10 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
+import org.apache.qpid.server.logging.subjects.AbstractTestLogSubject;
+import org.apache.qpid.test.utils.QpidBrokerTestCase;
+import org.apache.qpid.util.LogMonitor;
+
/**
* Abstract superclass for logging test set up and utility methods.
*
Modified: qpid/java/trunk/systests/src/test/java/org/apache/qpid/server/logging/ChannelLoggingTest.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/systests/src/test/java/org/apache/qpid/server/logging/ChannelLoggingTest.java?rev=1771313&r1=1771312&r2=1771313&view=diff
==============================================================================
--- qpid/java/trunk/systests/src/test/java/org/apache/qpid/server/logging/ChannelLoggingTest.java (original)
+++ qpid/java/trunk/systests/src/test/java/org/apache/qpid/server/logging/ChannelLoggingTest.java Fri Nov 25 12:50:18 2016
@@ -20,18 +20,19 @@
*/
package org.apache.qpid.server.logging;
-import org.apache.qpid.QpidException;
-import org.apache.qpid.client.AMQConnection;
-import org.apache.qpid.client.AMQDestination;
-import org.apache.qpid.client.AMQSession;
-import org.apache.qpid.server.virtualhost.VirtualHostPropertiesNodeCreator;
+import java.util.List;
+import java.util.regex.Pattern;
import javax.jms.Connection;
import javax.jms.MessageConsumer;
import javax.jms.Queue;
import javax.jms.Session;
-import java.util.List;
-import java.util.regex.Pattern;
+
+import org.apache.qpid.QpidException;
+import org.apache.qpid.client.AMQConnection;
+import org.apache.qpid.client.AMQDestination;
+import org.apache.qpid.client.AMQSession;
+import org.apache.qpid.server.virtualhost.VirtualHostPropertiesNodeCreator;
public class ChannelLoggingTest extends AbstractTestLogging
{
@@ -74,8 +75,15 @@ public class ChannelLoggingTest extends
int PREFETCH = 12;
- // Test that calling session.close gives us the expected output
- ((AMQConnection)connection).createSession(false, Session.AUTO_ACKNOWLEDGE,PREFETCH);
+ if(!(isBroker010() || isBroker10()))
+ {
+ // Test that calling session.close gives us the expected output
+ ((AMQConnection) connection).createSession(false, Session.AUTO_ACKNOWLEDGE, PREFETCH);
+ }
+ else
+ {
+ connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ }
// Wait to ensure that the CHN-1001 message is logged
waitForMessage("CHN-1001");
@@ -83,16 +91,16 @@ public class ChannelLoggingTest extends
List<String> results = findMatches("CHN-1001");
// Validation
- assertEquals("CHN-1001 messages not logged", 1, results.size());
+ assertEquals("CHN-1001 messages not logged", isBroker10() ? 2 : 1, results.size());
- String log = getLogMessage(results, 0);
+ String log = getLogMessage(results, isBroker10() ? 1 : 0);
// MESSAGE [con:0(guest@anonymous(3273383)/test)/ch:1] CHN-1001 : Create
validateMessageID("CHN-1001", log);
final String fromActor = fromActor(log);
final int channelID = getChannelID(fromActor);
assertEquals("Incorrect Channel in actor:"+fromActor(log), isBroker010()? 0 : 1, channelID);
- if (!isBroker010())
+ if (!(isBroker010() || isBroker10()))
{
// Wait to ensure that the CHN-1004 message is logged
waitForMessage("CHN-1004");
@@ -363,13 +371,13 @@ public class ChannelLoggingTest extends
}
private void validateChannelClose(List<String> results)
{
- String open = getLogMessage(results, 0);
+ String open = getLogMessage(results, isBroker10() ? 1 : 0);
String close = getLogMessageFromEnd(results, 0);
validateMessageID("CHN-1001", open);
validateMessageID("CHN-1003", close);
assertEquals("Message should be Close", "Close", getMessageString(fromMessage(close)));
- assertEquals("Incorrect Channel ID closed", isBroker010()? 0 : 1, getChannelID(fromSubject(close)));
+ assertEquals("Incorrect Channel ID closed: " + close, isBroker010()? 0 : 1, getChannelID(fromSubject(close)));
assertEquals("Channel IDs should be the same", getChannelID(fromActor(open)), getChannelID(fromSubject(close)));
assertEquals("Connection IDs should be the same", getConnectionID(fromActor(open)), getConnectionID(fromSubject(close)));
}
Modified: qpid/java/trunk/test-profiles/Java10Excludes
URL: http://svn.apache.org/viewvc/qpid/java/trunk/test-profiles/Java10Excludes?rev=1771313&r1=1771312&r2=1771313&view=diff
==============================================================================
--- qpid/java/trunk/test-profiles/Java10Excludes (original)
+++ qpid/java/trunk/test-profiles/Java10Excludes Fri Nov 25 12:50:18 2016
@@ -74,5 +74,16 @@ org.apache.qpid.test.client.QueueBrowser
// The new client does not (and should not) support our custom MD5 HEXED / HASHED mechanisms
org.apache.qpid.server.security.auth.manager.MD5AuthenticationManagerTest#*
+// The binding logging tests focus on the behaviour of the old client with regard to creating (and binding) queues on
+// the creation of consumers.
+org.apache.qpid.server.logging.BindingLoggingTest#*
+
+// These tests are 0-8/9/9-1 specific and are also excluded in the 0-10 profile
+org.apache.qpid.server.logging.ChannelLoggingTest#testChannelStartsFlowStopped
+org.apache.qpid.server.logging.ChannelLoggingTest#testChannelStartConsumerFlowStarted
+// This test is testing AMQP 0-x specific behaviour
+org.apache.qpid.server.logging.ChannelLoggingTest#testChannelClosedOnExclusiveQueueDeclaredOnDifferentSession
+
+
Modified: qpid/java/trunk/test-profiles/Java10UninvestigatedTestsExcludes
URL: http://svn.apache.org/viewvc/qpid/java/trunk/test-profiles/Java10UninvestigatedTestsExcludes?rev=1771313&r1=1771312&r2=1771313&view=diff
==============================================================================
--- qpid/java/trunk/test-profiles/Java10UninvestigatedTestsExcludes (original)
+++ qpid/java/trunk/test-profiles/Java10UninvestigatedTestsExcludes Fri Nov 25 12:50:18 2016
@@ -21,8 +21,6 @@
// working, defined as broken, or excluded as they test version specific functionality
org.apache.qpid.server.AbruptClientDisconnectTest#*
-org.apache.qpid.server.logging.BindingLoggingTest#*
-org.apache.qpid.server.logging.ChannelLoggingTest#*
org.apache.qpid.server.logging.ConnectionLoggingTest#*
org.apache.qpid.server.logging.ConsumerLoggingTest#*
org.apache.qpid.server.logging.DurableQueueLoggingTest#*
Modified: qpid/java/trunk/test-profiles/test-provider-1-0.properties
URL: http://svn.apache.org/viewvc/qpid/java/trunk/test-profiles/test-provider-1-0.properties?rev=1771313&r1=1771312&r2=1771313&view=diff
==============================================================================
--- qpid/java/trunk/test-profiles/test-provider-1-0.properties (original)
+++ qpid/java/trunk/test-profiles/test-provider-1-0.properties Fri Nov 25 12:50:18 2016
@@ -36,6 +36,6 @@ queue.MyQueue = example.MyQueue
queue.queue = example.queue
queue.xaQueue = xaQueue
-topic.topic = topic
+topic.topic = amq.topic/topic
topic.xaTopic = xaTopic
topic.durableSubscriberTopic = durableSubscriberTopic
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org