Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/MessageStoreMessages.java URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/MessageStoreMessages.java?rev=1676511&r1=1676510&r2=1676511&view=diff ============================================================================== --- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/MessageStoreMessages.java (original) +++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/MessageStoreMessages.java Tue Apr 28 12:14:42 2015 @@ -95,6 +95,32 @@ public class MessageStoreMessages { return RECOVERY_COMPLETE_LOG_HIERARCHY; } + + @Override + public boolean equals(final Object o) + { + if (this == o) + { + return true; + } + if (o == null || getClass() != o.getClass()) + { + return false; + } + + final LogMessage that = (LogMessage) o; + + return getLogHierarchy().equals(that.getLogHierarchy()) && toString().equals(that.toString()); + + } + + @Override + public int hashCode() + { + int result = toString().hashCode(); + result = 31 * result + getLogHierarchy().hashCode(); + return result; + } }; } @@ -122,6 +148,32 @@ public class MessageStoreMessages { return CLOSED_LOG_HIERARCHY; } + + @Override + public boolean equals(final Object o) + { + if (this == o) + { + return true; + } + if (o == null || getClass() != o.getClass()) + { + return false; + } + + final LogMessage that = (LogMessage) o; + + return getLogHierarchy().equals(that.getLogHierarchy()) && toString().equals(that.toString()); + + } + + @Override + public int hashCode() + { + int result = toString().hashCode(); + result = 31 * result + getLogHierarchy().hashCode(); + return result; + } }; } @@ -149,6 +201,32 @@ public class MessageStoreMessages { return OVERFULL_LOG_HIERARCHY; } + + @Override + public boolean equals(final Object o) + { + if (this == o) + { + return true; + } + if (o == null || getClass() != o.getClass()) + { + return false; + } + + final LogMessage that = (LogMessage) o; + + return getLogHierarchy().equals(that.getLogHierarchy()) && toString().equals(that.toString()); + + } + + @Override + public int hashCode() + { + int result = toString().hashCode(); + result = 31 * result + getLogHierarchy().hashCode(); + return result; + } }; } @@ -181,6 +259,32 @@ public class MessageStoreMessages { return RECOVERED_LOG_HIERARCHY; } + + @Override + public boolean equals(final Object o) + { + if (this == o) + { + return true; + } + if (o == null || getClass() != o.getClass()) + { + return false; + } + + final LogMessage that = (LogMessage) o; + + return getLogHierarchy().equals(that.getLogHierarchy()) && toString().equals(that.toString()); + + } + + @Override + public int hashCode() + { + int result = toString().hashCode(); + result = 31 * result + getLogHierarchy().hashCode(); + return result; + } }; } @@ -208,6 +312,32 @@ public class MessageStoreMessages { return UNDERFULL_LOG_HIERARCHY; } + + @Override + public boolean equals(final Object o) + { + if (this == o) + { + return true; + } + if (o == null || getClass() != o.getClass()) + { + return false; + } + + final LogMessage that = (LogMessage) o; + + return getLogHierarchy().equals(that.getLogHierarchy()) && toString().equals(that.toString()); + + } + + @Override + public int hashCode() + { + int result = toString().hashCode(); + result = 31 * result + getLogHierarchy().hashCode(); + return result; + } }; } @@ -235,6 +365,32 @@ public class MessageStoreMessages { return PASSIVATE_LOG_HIERARCHY; } + + @Override + public boolean equals(final Object o) + { + if (this == o) + { + return true; + } + if (o == null || getClass() != o.getClass()) + { + return false; + } + + final LogMessage that = (LogMessage) o; + + return getLogHierarchy().equals(that.getLogHierarchy()) && toString().equals(that.toString()); + + } + + @Override + public int hashCode() + { + int result = toString().hashCode(); + result = 31 * result + getLogHierarchy().hashCode(); + return result; + } }; } @@ -262,6 +418,32 @@ public class MessageStoreMessages { return CREATED_LOG_HIERARCHY; } + + @Override + public boolean equals(final Object o) + { + if (this == o) + { + return true; + } + if (o == null || getClass() != o.getClass()) + { + return false; + } + + final LogMessage that = (LogMessage) o; + + return getLogHierarchy().equals(that.getLogHierarchy()) && toString().equals(that.toString()); + + } + + @Override + public int hashCode() + { + int result = toString().hashCode(); + result = 31 * result + getLogHierarchy().hashCode(); + return result; + } }; } @@ -294,6 +476,32 @@ public class MessageStoreMessages { return STORE_LOCATION_LOG_HIERARCHY; } + + @Override + public boolean equals(final Object o) + { + if (this == o) + { + return true; + } + if (o == null || getClass() != o.getClass()) + { + return false; + } + + final LogMessage that = (LogMessage) o; + + return getLogHierarchy().equals(that.getLogHierarchy()) && toString().equals(that.toString()); + + } + + @Override + public int hashCode() + { + int result = toString().hashCode(); + result = 31 * result + getLogHierarchy().hashCode(); + return result; + } }; } @@ -321,6 +529,32 @@ public class MessageStoreMessages { return RECOVERY_START_LOG_HIERARCHY; } + + @Override + public boolean equals(final Object o) + { + if (this == o) + { + return true; + } + if (o == null || getClass() != o.getClass()) + { + return false; + } + + final LogMessage that = (LogMessage) o; + + return getLogHierarchy().equals(that.getLogHierarchy()) && toString().equals(that.toString()); + + } + + @Override + public int hashCode() + { + int result = toString().hashCode(); + result = 31 * result + getLogHierarchy().hashCode(); + return result; + } }; }
Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/PortMessages.java URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/PortMessages.java?rev=1676511&r1=1676510&r2=1676511&view=diff ============================================================================== --- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/PortMessages.java (original) +++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/PortMessages.java Tue Apr 28 12:14:42 2015 @@ -87,6 +87,32 @@ public class PortMessages { return OPEN_LOG_HIERARCHY; } + + @Override + public boolean equals(final Object o) + { + if (this == o) + { + return true; + } + if (o == null || getClass() != o.getClass()) + { + return false; + } + + final LogMessage that = (LogMessage) o; + + return getLogHierarchy().equals(that.getLogHierarchy()) && toString().equals(that.toString()); + + } + + @Override + public int hashCode() + { + int result = toString().hashCode(); + result = 31 * result + getLogHierarchy().hashCode(); + return result; + } }; } @@ -114,6 +140,32 @@ public class PortMessages { return CREATE_LOG_HIERARCHY; } + + @Override + public boolean equals(final Object o) + { + if (this == o) + { + return true; + } + if (o == null || getClass() != o.getClass()) + { + return false; + } + + final LogMessage that = (LogMessage) o; + + return getLogHierarchy().equals(that.getLogHierarchy()) && toString().equals(that.toString()); + + } + + @Override + public int hashCode() + { + int result = toString().hashCode(); + result = 31 * result + getLogHierarchy().hashCode(); + return result; + } }; } @@ -141,6 +193,32 @@ public class PortMessages { return CLOSE_LOG_HIERARCHY; } + + @Override + public boolean equals(final Object o) + { + if (this == o) + { + return true; + } + if (o == null || getClass() != o.getClass()) + { + return false; + } + + final LogMessage that = (LogMessage) o; + + return getLogHierarchy().equals(that.getLogHierarchy()) && toString().equals(that.toString()); + + } + + @Override + public int hashCode() + { + int result = toString().hashCode(); + result = 31 * result + getLogHierarchy().hashCode(); + return result; + } }; } @@ -173,6 +251,32 @@ public class PortMessages { return CONNECTION_REJECTED_LOG_HIERARCHY; } + + @Override + public boolean equals(final Object o) + { + if (this == o) + { + return true; + } + if (o == null || getClass() != o.getClass()) + { + return false; + } + + final LogMessage that = (LogMessage) o; + + return getLogHierarchy().equals(that.getLogHierarchy()) && toString().equals(that.toString()); + + } + + @Override + public int hashCode() + { + int result = toString().hashCode(); + result = 31 * result + getLogHierarchy().hashCode(); + return result; + } }; } @@ -205,6 +309,32 @@ public class PortMessages { return CONNECTION_COUNT_WARN_LOG_HIERARCHY; } + + @Override + public boolean equals(final Object o) + { + if (this == o) + { + return true; + } + if (o == null || getClass() != o.getClass()) + { + return false; + } + + final LogMessage that = (LogMessage) o; + + return getLogHierarchy().equals(that.getLogHierarchy()) && toString().equals(that.toString()); + + } + + @Override + public int hashCode() + { + int result = toString().hashCode(); + result = 31 * result + getLogHierarchy().hashCode(); + return result; + } }; } Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/QueueMessages.java URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/QueueMessages.java?rev=1676511&r1=1676510&r2=1676511&view=diff ============================================================================== --- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/QueueMessages.java (original) +++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/QueueMessages.java Tue Apr 28 12:14:42 2015 @@ -90,6 +90,32 @@ public class QueueMessages { return OVERFULL_LOG_HIERARCHY; } + + @Override + public boolean equals(final Object o) + { + if (this == o) + { + return true; + } + if (o == null || getClass() != o.getClass()) + { + return false; + } + + final LogMessage that = (LogMessage) o; + + return getLogHierarchy().equals(that.getLogHierarchy()) && toString().equals(that.toString()); + + } + + @Override + public int hashCode() + { + int result = toString().hashCode(); + result = 31 * result + getLogHierarchy().hashCode(); + return result; + } }; } @@ -122,6 +148,32 @@ public class QueueMessages { return UNDERFULL_LOG_HIERARCHY; } + + @Override + public boolean equals(final Object o) + { + if (this == o) + { + return true; + } + if (o == null || getClass() != o.getClass()) + { + return false; + } + + final LogMessage that = (LogMessage) o; + + return getLogHierarchy().equals(that.getLogHierarchy()) && toString().equals(that.toString()); + + } + + @Override + public int hashCode() + { + int result = toString().hashCode(); + result = 31 * result + getLogHierarchy().hashCode(); + return result; + } }; } @@ -217,6 +269,32 @@ public class QueueMessages { return CREATED_LOG_HIERARCHY; } + + @Override + public boolean equals(final Object o) + { + if (this == o) + { + return true; + } + if (o == null || getClass() != o.getClass()) + { + return false; + } + + final LogMessage that = (LogMessage) o; + + return getLogHierarchy().equals(that.getLogHierarchy()) && toString().equals(that.toString()); + + } + + @Override + public int hashCode() + { + int result = toString().hashCode(); + result = 31 * result + getLogHierarchy().hashCode(); + return result; + } }; } @@ -244,6 +322,32 @@ public class QueueMessages { return DELETED_LOG_HIERARCHY; } + + @Override + public boolean equals(final Object o) + { + if (this == o) + { + return true; + } + if (o == null || getClass() != o.getClass()) + { + return false; + } + + final LogMessage that = (LogMessage) o; + + return getLogHierarchy().equals(that.getLogHierarchy()) && toString().equals(that.toString()); + + } + + @Override + public int hashCode() + { + int result = toString().hashCode(); + result = 31 * result + getLogHierarchy().hashCode(); + return result; + } }; } Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/SubscriptionMessages.java URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/SubscriptionMessages.java?rev=1676511&r1=1676510&r2=1676511&view=diff ============================================================================== --- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/SubscriptionMessages.java (original) +++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/SubscriptionMessages.java Tue Apr 28 12:14:42 2015 @@ -88,6 +88,32 @@ public class SubscriptionMessages { return STATE_LOG_HIERARCHY; } + + @Override + public boolean equals(final Object o) + { + if (this == o) + { + return true; + } + if (o == null || getClass() != o.getClass()) + { + return false; + } + + final LogMessage that = (LogMessage) o; + + return getLogHierarchy().equals(that.getLogHierarchy()) && toString().equals(that.toString()); + + } + + @Override + public int hashCode() + { + int result = toString().hashCode(); + result = 31 * result + getLogHierarchy().hashCode(); + return result; + } }; } @@ -153,6 +179,32 @@ public class SubscriptionMessages { return CREATE_LOG_HIERARCHY; } + + @Override + public boolean equals(final Object o) + { + if (this == o) + { + return true; + } + if (o == null || getClass() != o.getClass()) + { + return false; + } + + final LogMessage that = (LogMessage) o; + + return getLogHierarchy().equals(that.getLogHierarchy()) && toString().equals(that.toString()); + + } + + @Override + public int hashCode() + { + int result = toString().hashCode(); + result = 31 * result + getLogHierarchy().hashCode(); + return result; + } }; } @@ -180,6 +232,32 @@ public class SubscriptionMessages { return CLOSE_LOG_HIERARCHY; } + + @Override + public boolean equals(final Object o) + { + if (this == o) + { + return true; + } + if (o == null || getClass() != o.getClass()) + { + return false; + } + + final LogMessage that = (LogMessage) o; + + return getLogHierarchy().equals(that.getLogHierarchy()) && toString().equals(that.toString()); + + } + + @Override + public int hashCode() + { + int result = toString().hashCode(); + result = 31 * result + getLogHierarchy().hashCode(); + return result; + } }; } Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/TransactionLogMessages.java URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/TransactionLogMessages.java?rev=1676511&r1=1676510&r2=1676511&view=diff ============================================================================== --- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/TransactionLogMessages.java (original) +++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/TransactionLogMessages.java Tue Apr 28 12:14:42 2015 @@ -93,6 +93,32 @@ public class TransactionLogMessages { return CLOSED_LOG_HIERARCHY; } + + @Override + public boolean equals(final Object o) + { + if (this == o) + { + return true; + } + if (o == null || getClass() != o.getClass()) + { + return false; + } + + final LogMessage that = (LogMessage) o; + + return getLogHierarchy().equals(that.getLogHierarchy()) && toString().equals(that.toString()); + + } + + @Override + public int hashCode() + { + int result = toString().hashCode(); + result = 31 * result + getLogHierarchy().hashCode(); + return result; + } }; } @@ -148,6 +174,32 @@ public class TransactionLogMessages { return RECOVERY_COMPLETE_LOG_HIERARCHY; } + + @Override + public boolean equals(final Object o) + { + if (this == o) + { + return true; + } + if (o == null || getClass() != o.getClass()) + { + return false; + } + + final LogMessage that = (LogMessage) o; + + return getLogHierarchy().equals(that.getLogHierarchy()) && toString().equals(that.toString()); + + } + + @Override + public int hashCode() + { + int result = toString().hashCode(); + result = 31 * result + getLogHierarchy().hashCode(); + return result; + } }; } @@ -180,6 +232,32 @@ public class TransactionLogMessages { return XA_INCOMPLETE_MESSAGE_LOG_HIERARCHY; } + + @Override + public boolean equals(final Object o) + { + if (this == o) + { + return true; + } + if (o == null || getClass() != o.getClass()) + { + return false; + } + + final LogMessage that = (LogMessage) o; + + return getLogHierarchy().equals(that.getLogHierarchy()) && toString().equals(that.toString()); + + } + + @Override + public int hashCode() + { + int result = toString().hashCode(); + result = 31 * result + getLogHierarchy().hashCode(); + return result; + } }; } @@ -212,6 +290,32 @@ public class TransactionLogMessages { return XA_INCOMPLETE_QUEUE_LOG_HIERARCHY; } + + @Override + public boolean equals(final Object o) + { + if (this == o) + { + return true; + } + if (o == null || getClass() != o.getClass()) + { + return false; + } + + final LogMessage that = (LogMessage) o; + + return getLogHierarchy().equals(that.getLogHierarchy()) && toString().equals(that.toString()); + + } + + @Override + public int hashCode() + { + int result = toString().hashCode(); + result = 31 * result + getLogHierarchy().hashCode(); + return result; + } }; } @@ -244,6 +348,32 @@ public class TransactionLogMessages { return RECOVERED_LOG_HIERARCHY; } + + @Override + public boolean equals(final Object o) + { + if (this == o) + { + return true; + } + if (o == null || getClass() != o.getClass()) + { + return false; + } + + final LogMessage that = (LogMessage) o; + + return getLogHierarchy().equals(that.getLogHierarchy()) && toString().equals(that.toString()); + + } + + @Override + public int hashCode() + { + int result = toString().hashCode(); + result = 31 * result + getLogHierarchy().hashCode(); + return result; + } }; } @@ -271,6 +401,32 @@ public class TransactionLogMessages { return CREATED_LOG_HIERARCHY; } + + @Override + public boolean equals(final Object o) + { + if (this == o) + { + return true; + } + if (o == null || getClass() != o.getClass()) + { + return false; + } + + final LogMessage that = (LogMessage) o; + + return getLogHierarchy().equals(that.getLogHierarchy()) && toString().equals(that.toString()); + + } + + @Override + public int hashCode() + { + int result = toString().hashCode(); + result = 31 * result + getLogHierarchy().hashCode(); + return result; + } }; } @@ -303,6 +459,32 @@ public class TransactionLogMessages { return STORE_LOCATION_LOG_HIERARCHY; } + + @Override + public boolean equals(final Object o) + { + if (this == o) + { + return true; + } + if (o == null || getClass() != o.getClass()) + { + return false; + } + + final LogMessage that = (LogMessage) o; + + return getLogHierarchy().equals(that.getLogHierarchy()) && toString().equals(that.toString()); + + } + + @Override + public int hashCode() + { + int result = toString().hashCode(); + result = 31 * result + getLogHierarchy().hashCode(); + return result; + } }; } @@ -358,6 +540,32 @@ public class TransactionLogMessages { return RECOVERY_START_LOG_HIERARCHY; } + + @Override + public boolean equals(final Object o) + { + if (this == o) + { + return true; + } + if (o == null || getClass() != o.getClass()) + { + return false; + } + + final LogMessage that = (LogMessage) o; + + return getLogHierarchy().equals(that.getLogHierarchy()) && toString().equals(that.toString()); + + } + + @Override + public int hashCode() + { + int result = toString().hashCode(); + result = 31 * result + getLogHierarchy().hashCode(); + return result; + } }; } Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/VirtualHostMessages.java URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/VirtualHostMessages.java?rev=1676511&r1=1676510&r2=1676511&view=diff ============================================================================== --- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/VirtualHostMessages.java (original) +++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/logging/messages/VirtualHostMessages.java Tue Apr 28 12:14:42 2015 @@ -96,6 +96,32 @@ public class VirtualHostMessages { return CLOSED_LOG_HIERARCHY; } + + @Override + public boolean equals(final Object o) + { + if (this == o) + { + return true; + } + if (o == null || getClass() != o.getClass()) + { + return false; + } + + final LogMessage that = (LogMessage) o; + + return getLogHierarchy().equals(that.getLogHierarchy()) && toString().equals(that.toString()); + + } + + @Override + public int hashCode() + { + int result = toString().hashCode(); + result = 31 * result + getLogHierarchy().hashCode(); + return result; + } }; } @@ -128,6 +154,32 @@ public class VirtualHostMessages { return STATS_DATA_LOG_HIERARCHY; } + + @Override + public boolean equals(final Object o) + { + if (this == o) + { + return true; + } + if (o == null || getClass() != o.getClass()) + { + return false; + } + + final LogMessage that = (LogMessage) o; + + return getLogHierarchy().equals(that.getLogHierarchy()) && toString().equals(that.toString()); + + } + + @Override + public int hashCode() + { + int result = toString().hashCode(); + result = 31 * result + getLogHierarchy().hashCode(); + return result; + } }; } @@ -160,6 +212,32 @@ public class VirtualHostMessages { return STATS_MSGS_LOG_HIERARCHY; } + + @Override + public boolean equals(final Object o) + { + if (this == o) + { + return true; + } + if (o == null || getClass() != o.getClass()) + { + return false; + } + + final LogMessage that = (LogMessage) o; + + return getLogHierarchy().equals(that.getLogHierarchy()) && toString().equals(that.toString()); + + } + + @Override + public int hashCode() + { + int result = toString().hashCode(); + result = 31 * result + getLogHierarchy().hashCode(); + return result; + } }; } @@ -192,6 +270,32 @@ public class VirtualHostMessages { return FILESYSTEM_FULL_LOG_HIERARCHY; } + + @Override + public boolean equals(final Object o) + { + if (this == o) + { + return true; + } + if (o == null || getClass() != o.getClass()) + { + return false; + } + + final LogMessage that = (LogMessage) o; + + return getLogHierarchy().equals(that.getLogHierarchy()) && toString().equals(that.toString()); + + } + + @Override + public int hashCode() + { + int result = toString().hashCode(); + result = 31 * result + getLogHierarchy().hashCode(); + return result; + } }; } @@ -224,6 +328,32 @@ public class VirtualHostMessages { return FILESYSTEM_NOTFULL_LOG_HIERARCHY; } + + @Override + public boolean equals(final Object o) + { + if (this == o) + { + return true; + } + if (o == null || getClass() != o.getClass()) + { + return false; + } + + final LogMessage that = (LogMessage) o; + + return getLogHierarchy().equals(that.getLogHierarchy()) && toString().equals(that.toString()); + + } + + @Override + public int hashCode() + { + int result = toString().hashCode(); + result = 31 * result + getLogHierarchy().hashCode(); + return result; + } }; } @@ -256,6 +386,32 @@ public class VirtualHostMessages { return CREATED_LOG_HIERARCHY; } + + @Override + public boolean equals(final Object o) + { + if (this == o) + { + return true; + } + if (o == null || getClass() != o.getClass()) + { + return false; + } + + final LogMessage that = (LogMessage) o; + + return getLogHierarchy().equals(that.getLogHierarchy()) && toString().equals(that.toString()); + + } + + @Override + public int hashCode() + { + int result = toString().hashCode(); + result = 31 * result + getLogHierarchy().hashCode(); + return result; + } }; } @@ -288,6 +444,32 @@ public class VirtualHostMessages { return ERRORED_LOG_HIERARCHY; } + + @Override + public boolean equals(final Object o) + { + if (this == o) + { + return true; + } + if (o == null || getClass() != o.getClass()) + { + return false; + } + + final LogMessage that = (LogMessage) o; + + return getLogHierarchy().equals(that.getLogHierarchy()) && toString().equals(that.toString()); + + } + + @Override + public int hashCode() + { + int result = toString().hashCode(); + result = 31 * result + getLogHierarchy().hashCode(); + return result; + } }; } Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/AbstractConfiguredObject.java URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/AbstractConfiguredObject.java?rev=1676511&r1=1676510&r2=1676511&view=diff ============================================================================== --- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/AbstractConfiguredObject.java (original) +++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/AbstractConfiguredObject.java Tue Apr 28 12:14:42 2015 @@ -27,6 +27,7 @@ import java.lang.reflect.InvocationTarge import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.lang.reflect.Proxy; +import java.lang.reflect.Type; import java.security.AccessControlException; import java.security.PrivilegedAction; import java.util.ArrayList; @@ -2277,7 +2278,13 @@ public abstract class AbstractConfigured @Override public final <T> T getContextValue(Class<T> clazz, String propertyName) { - AttributeValueConverter<T> converter = AttributeValueConverter.getConverter(clazz, clazz); + return getContextValue(clazz, clazz, propertyName); + } + + @Override + public <T> T getContextValue(final Class<T> clazz, final Type type, final String propertyName) + { + AttributeValueConverter<T> converter = AttributeValueConverter.getConverter(clazz, type); return converter.convert("${" + propertyName + "}", this); } Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/AttributeValueConverter.java URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/AttributeValueConverter.java?rev=1676511&r1=1676510&r2=1676511&view=diff ============================================================================== --- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/AttributeValueConverter.java (original) +++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/AttributeValueConverter.java Tue Apr 28 12:14:42 2015 @@ -500,7 +500,7 @@ abstract class AttributeValueConverter<T // fall through to the non-JSON single object case } } - return Collections.unmodifiableList(Collections.singletonList(_memberConverter.convert(value, object))); + return "".equals(value) ? Collections.emptyList() : Collections.unmodifiableList(Collections.singletonList(_memberConverter.convert(value, object))); } } } Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObject.java URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObject.java?rev=1676511&r1=1676510&r2=1676511&view=diff ============================================================================== --- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObject.java (original) +++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObject.java Tue Apr 28 12:14:42 2015 @@ -20,6 +20,7 @@ */ package org.apache.qpid.server.model; +import java.lang.reflect.Type; import java.security.AccessControlException; import java.util.Collection; import java.util.Map; @@ -83,6 +84,8 @@ public interface ConfiguredObject<X exte <T> T getContextValue(Class<T> clazz, String propertyName); + <T> T getContextValue(Class<T> clazz, Type t, String propertyName); + Set<String> getContextKeys(final boolean excludeSystem); @DerivedAttribute( persist = true ) Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/VirtualHost.java URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/VirtualHost.java?rev=1676511&r1=1676510&r2=1676511&view=diff ============================================================================== --- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/VirtualHost.java (original) +++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/VirtualHost.java Tue Apr 28 12:14:42 2015 @@ -135,6 +135,8 @@ public interface VirtualHost<X extends V @ManagedStatistic long getMessagesOut(); + Broker<?> getBroker(); + //children Collection<VirtualHostAlias> getAliases(); Collection<Connection> getConnections(); Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/plugin/ConnectionValidator.java URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/plugin/ConnectionValidator.java?rev=1676511&r1=1676510&r2=1676511&view=diff ============================================================================== --- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/plugin/ConnectionValidator.java (original) +++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/plugin/ConnectionValidator.java Tue Apr 28 12:14:42 2015 @@ -20,9 +20,10 @@ */ package org.apache.qpid.server.plugin; +import org.apache.qpid.server.model.VirtualHost; import org.apache.qpid.server.protocol.AMQConnectionModel; public interface ConnectionValidator extends Pluggable { - boolean validateConnectionCreation(AMQConnectionModel<?, ?> connection); + boolean validateConnectionCreation(AMQConnectionModel<?, ?> connection, final VirtualHost<?, ?, ?> virtualHost); } Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java?rev=1676511&r1=1676510&r2=1676511&view=diff ============================================================================== --- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java (original) +++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java Tue Apr 28 12:14:42 2015 @@ -526,7 +526,7 @@ public abstract class AbstractVirtualHos getSecurityManager().authoriseCreateConnection(connection); for(ConnectionValidator validator : _connectionValidators) { - if(!validator.validateConnectionCreation(connection)) + if(!validator.validateConnectionCreation(connection, this)) { return false; } @@ -674,6 +674,12 @@ public abstract class AbstractVirtualHos } @Override + public Broker<?> getBroker() + { + return _broker; + } + + @Override public Collection<AMQQueue<?>> getQueues() { Collection children = getChildren(Queue.class); Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/RedirectingVirtualHostImpl.java URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/RedirectingVirtualHostImpl.java?rev=1676511&r1=1676510&r2=1676511&view=diff ============================================================================== --- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/RedirectingVirtualHostImpl.java (original) +++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/RedirectingVirtualHostImpl.java Tue Apr 28 12:14:42 2015 @@ -36,6 +36,7 @@ import org.apache.qpid.server.logging.Ev import org.apache.qpid.server.message.MessageDestination; import org.apache.qpid.server.message.MessageSource; import org.apache.qpid.server.model.AbstractConfiguredObject; +import org.apache.qpid.server.model.Broker; import org.apache.qpid.server.model.BrokerModel; import org.apache.qpid.server.model.ConfiguredObject; import org.apache.qpid.server.model.Connection; @@ -66,6 +67,7 @@ class RedirectingVirtualHostImpl { public static final String TYPE = "REDIRECTOR"; private final StatisticsCounter _messagesDelivered, _dataDelivered, _messagesReceived, _dataReceived; + private final Broker<?> _broker; @ManagedAttributeField private boolean _queue_deadLetterQueueEnabled; @@ -101,6 +103,7 @@ class RedirectingVirtualHostImpl { super(parentsMap(virtualHostNode), attributes); + _broker = virtualHostNode.getParent(Broker.class); _messagesDelivered = new StatisticsCounter("messages-delivered-" + getName()); _dataDelivered = new StatisticsCounter("bytes-delivered-" + getName()); _messagesReceived = new StatisticsCounter("messages-received-" + getName()); @@ -132,6 +135,12 @@ class RedirectingVirtualHostImpl } @Override + public Broker<?> getBroker() + { + return _broker; + } + + @Override public ExchangeImpl createExchange(final Map<String, Object> attributes) { throwUnsupportedForRedirector(); @@ -302,6 +311,7 @@ class RedirectingVirtualHostImpl return null; } + @Override public Collection<AMQQueue<?>> getQueues() { Added: qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/connection/ConnectionVersionValidatorTest.java URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/connection/ConnectionVersionValidatorTest.java?rev=1676511&view=auto ============================================================================== --- qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/connection/ConnectionVersionValidatorTest.java (added) +++ qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/connection/ConnectionVersionValidatorTest.java Tue Apr 28 12:14:42 2015 @@ -0,0 +1,200 @@ +/* + * + * 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.qpid.server.connection; + +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyBoolean; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.lang.reflect.Type; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.qpid.server.logging.EventLogger; +import org.apache.qpid.server.logging.LogMessage; +import org.apache.qpid.server.logging.messages.ConnectionMessages; +import org.apache.qpid.server.model.Broker; +import org.apache.qpid.server.model.VirtualHost; +import org.apache.qpid.server.protocol.AMQConnectionModel; +import org.apache.qpid.test.utils.QpidTestCase; + +public class ConnectionVersionValidatorTest extends QpidTestCase +{ + + private VirtualHost _virtualHostMock; + private AMQConnectionModel _connectionMock; + private EventLogger _eventLoggerMock; + private ConnectionVersionValidator _connectionValidator; + + public void setUp() throws Exception + { + super.setUp(); + + _connectionValidator = new ConnectionVersionValidator(); + _virtualHostMock = mock(VirtualHost.class); + _connectionMock = mock(AMQConnectionModel.class); + _eventLoggerMock = mock(EventLogger.class); + Broker brokerMock = mock(Broker.class); + + when(_virtualHostMock.getBroker()).thenReturn(brokerMock); + when(brokerMock.getEventLogger()).thenReturn(_eventLoggerMock); + } + + private void setContextValues(Map<String, List<String>> values) + { + when(_virtualHostMock.getContextKeys(anyBoolean())).thenReturn(values.keySet()); + for (Map.Entry<String, List<String>> entry : values.entrySet()) + { + when(_virtualHostMock.getContextValue(any(Class.class), any(Type.class), eq(entry.getKey()))).thenReturn(entry.getValue()); + } + } + + public void testInvalidRegex() + { + Map<String, List<String>> contextValues = new HashMap<>(); + contextValues.put(ConnectionVersionValidator.VIRTUALHOST_REJECTED_CONNECTION_VERSION, Arrays.asList("${}", "foo")); + setContextValues(contextValues); + when(_connectionMock.getClientVersion()).thenReturn("foo"); + assertFalse(_connectionValidator.validateConnectionCreation(_connectionMock, _virtualHostMock)); + verify(_eventLoggerMock).message(ConnectionMessages.CLIENT_VERSION_REJECT("foo")); + // TODO: We should verify that the invalid regex is logged + } + + public void testNullClientDefaultAllowed() + { + assertTrue(_connectionValidator.validateConnectionCreation(_connectionMock, _virtualHostMock)); + } + + public void testClientDefaultAllowed() + { + when(_connectionMock.getClientVersion()).thenReturn("foo"); + assertTrue(_connectionValidator.validateConnectionCreation(_connectionMock, _virtualHostMock)); + } + + public void testEmptyList() + { + Map<String, List<String>> contextValues = new HashMap<>(); + contextValues.put(ConnectionVersionValidator.VIRTUALHOST_REJECTED_CONNECTION_VERSION, Collections.<String>emptyList()); + setContextValues(contextValues); + when(_connectionMock.getClientVersion()).thenReturn("foo"); + assertTrue(_connectionValidator.validateConnectionCreation(_connectionMock, _virtualHostMock)); + verify(_eventLoggerMock, never()).message(any(LogMessage.class)); + } + + public void testEmptyString() + { + Map<String, List<String>> contextValues = new HashMap<>(); + contextValues.put(ConnectionVersionValidator.VIRTUALHOST_REJECTED_CONNECTION_VERSION, Arrays.asList("")); + setContextValues(contextValues); + when(_connectionMock.getClientVersion()).thenReturn(""); + assertFalse(_connectionValidator.validateConnectionCreation(_connectionMock, _virtualHostMock)); + verify(_eventLoggerMock).message(ConnectionMessages.CLIENT_VERSION_REJECT("")); + when(_connectionMock.getClientVersion()).thenReturn(null); + assertFalse(_connectionValidator.validateConnectionCreation(_connectionMock, _virtualHostMock)); + verify(_eventLoggerMock).message(ConnectionMessages.CLIENT_VERSION_REJECT("")); + verify(_eventLoggerMock).message(ConnectionMessages.CLIENT_VERSION_REJECT(null)); + } + + public void testClientRejected() + { + when(_connectionMock.getClientVersion()).thenReturn("foo"); + Map<String, List<String>> contextValues = new HashMap<>(); + contextValues.put(ConnectionVersionValidator.VIRTUALHOST_REJECTED_CONNECTION_VERSION, Arrays.asList("foo")); + setContextValues(contextValues); + assertFalse(_connectionValidator.validateConnectionCreation(_connectionMock, _virtualHostMock)); + verify(_eventLoggerMock).message(ConnectionMessages.CLIENT_VERSION_REJECT("foo")); + } + + public void testClientLogged() + { + when(_connectionMock.getClientVersion()).thenReturn("foo"); + Map<String, List<String>> contextValues = new HashMap<>(); + contextValues.put(ConnectionVersionValidator.VIRTUALHOST_LOGGED_CONNECTION_VERSION, Arrays.asList("foo")); + setContextValues(contextValues); + assertTrue(_connectionValidator.validateConnectionCreation(_connectionMock, _virtualHostMock)); + verify(_eventLoggerMock).message(ConnectionMessages.CLIENT_VERSION_LOG("foo")); + } + + public void testAllowedTakesPrecedence() + { + when(_connectionMock.getClientVersion()).thenReturn("foo"); + Map<String, List<String>> contextValues = new HashMap<>(); + contextValues.put(ConnectionVersionValidator.VIRTUALHOST_ALLOWED_CONNECTION_VERSION, Arrays.asList("foo")); + contextValues.put(ConnectionVersionValidator.VIRTUALHOST_LOGGED_CONNECTION_VERSION, Arrays.asList("foo")); + contextValues.put(ConnectionVersionValidator.VIRTUALHOST_REJECTED_CONNECTION_VERSION, Arrays.asList("foo")); + setContextValues(contextValues); + assertTrue(_connectionValidator.validateConnectionCreation(_connectionMock, _virtualHostMock)); + verify(_eventLoggerMock, never()).message(any(LogMessage.class)); + } + + public void testLoggedTakesPrecedenceOverRejected() + { + when(_connectionMock.getClientVersion()).thenReturn("foo"); + Map<String, List<String>> contextValues = new HashMap<>(); + contextValues.put(ConnectionVersionValidator.VIRTUALHOST_LOGGED_CONNECTION_VERSION, Arrays.asList("foo")); + contextValues.put(ConnectionVersionValidator.VIRTUALHOST_REJECTED_CONNECTION_VERSION, Arrays.asList("foo")); + setContextValues(contextValues); + assertTrue(_connectionValidator.validateConnectionCreation(_connectionMock, _virtualHostMock)); + verify(_eventLoggerMock).message(ConnectionMessages.CLIENT_VERSION_LOG("foo")); + } + + public void testRegex() + { + Map<String, List<String>> contextValues = new HashMap<>(); + contextValues.put(ConnectionVersionValidator.VIRTUALHOST_ALLOWED_CONNECTION_VERSION, Arrays.asList("foo")); + contextValues.put(ConnectionVersionValidator.VIRTUALHOST_LOGGED_CONNECTION_VERSION, Arrays.asList("f.*")); + setContextValues(contextValues); + when(_connectionMock.getClientVersion()).thenReturn("foo"); + assertTrue(_connectionValidator.validateConnectionCreation(_connectionMock, _virtualHostMock)); + verify(_eventLoggerMock, never()).message(any(LogMessage.class)); + when(_connectionMock.getClientVersion()).thenReturn("foo2"); + assertTrue(_connectionValidator.validateConnectionCreation(_connectionMock, _virtualHostMock)); + verify(_eventLoggerMock).message(ConnectionMessages.CLIENT_VERSION_LOG("foo2")); + when(_connectionMock.getClientVersion()).thenReturn("baz"); + assertTrue(_connectionValidator.validateConnectionCreation(_connectionMock, _virtualHostMock)); + verify(_eventLoggerMock, never()).message(ConnectionMessages.CLIENT_VERSION_LOG("baz")); + } + + public void testRegexLists() + { + Map<String, List<String>> contextValues = new HashMap<>(); + contextValues.put(ConnectionVersionValidator.VIRTUALHOST_ALLOWED_CONNECTION_VERSION, Arrays.asList("foo")); + contextValues.put(ConnectionVersionValidator.VIRTUALHOST_LOGGED_CONNECTION_VERSION, Arrays.asList("f.*", "baz")); + setContextValues(contextValues); + when(_connectionMock.getClientVersion()).thenReturn("foo"); + assertTrue(_connectionValidator.validateConnectionCreation(_connectionMock, _virtualHostMock)); + verify(_eventLoggerMock, never()).message(any(LogMessage.class)); + when(_connectionMock.getClientVersion()).thenReturn("foo2"); + assertTrue(_connectionValidator.validateConnectionCreation(_connectionMock, _virtualHostMock)); + verify(_eventLoggerMock).message(ConnectionMessages.CLIENT_VERSION_LOG("foo2")); + when(_connectionMock.getClientVersion()).thenReturn("baz"); + assertTrue(_connectionValidator.validateConnectionCreation(_connectionMock, _virtualHostMock)); + verify(_eventLoggerMock).message(ConnectionMessages.CLIENT_VERSION_LOG("baz")); + } + +} Propchange: qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/connection/ConnectionVersionValidatorTest.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: qpid/java/trunk/broker-core/src/velocity/templates/org/apache/qpid/server/logging/messages/LogMessages.vm URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/velocity/templates/org/apache/qpid/server/logging/messages/LogMessages.vm?rev=1676511&r1=1676510&r2=1676511&view=diff ============================================================================== --- qpid/java/trunk/broker-core/src/velocity/templates/org/apache/qpid/server/logging/messages/LogMessages.vm (original) +++ qpid/java/trunk/broker-core/src/velocity/templates/org/apache/qpid/server/logging/messages/LogMessages.vm Tue Apr 28 12:14:42 2015 @@ -175,6 +175,32 @@ public class ${type.name}Messages { return ${message.methodName.toUpperCase()}_LOG_HIERARCHY; } + + @Override + public boolean equals(final Object o) + { + if (this == o) + { + return true; + } + if (o == null || getClass() != o.getClass()) + { + return false; + } + + final LogMessage that = (LogMessage) o; + + return getLogHierarchy().equals(that.getLogHierarchy()) && toString().equals(that.toString()); + + } + + @Override + public int hashCode() + { + int result = toString().hashCode(); + result = 31 * result + getLogHierarchy().hashCode(); + return result; + } }; } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
