You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by or...@apache.org on 2018/05/25 20:39:11 UTC

[1/2] qpid-broker-j git commit: QPID-7830: [Broker-J] Simplify string caching functionality

Repository: qpid-broker-j
Updated Branches:
  refs/heads/master db971ea2b -> 4ac5997f4


QPID-7830: [Broker-J] Simplify string caching functionality


Project: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/commit/57bda83d
Tree: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/tree/57bda83d
Diff: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/diff/57bda83d

Branch: refs/heads/master
Commit: 57bda83de7fbe6291aea507b5c1098fda5cf130d
Parents: db971ea
Author: Alex Rudyy <or...@apache.org>
Authored: Fri May 25 15:40:57 2018 +0100
Committer: Alex Rudyy <or...@apache.org>
Committed: Fri May 25 15:40:57 2018 +0100

----------------------------------------------------------------------
 .../server/protocol/v0_8/AMQShortString.java    | 17 +++---
 .../protocol/v0_8/AMQShortStringTest.java       | 23 ++++----
 .../server/protocol/v0_8/MessageMetaData.java   |  9 ----
 .../transport/BasicContentHeaderProperties.java | 24 ---------
 .../v0_8/transport/BasicPublishBody.java        |  8 ---
 .../v1_0/codec/StringTypeConstructor.java       | 29 +++++++++-
 .../type/messaging/ApplicationProperties.java   |  5 +-
 .../messaging/NonEncodingRetainingSection.java  | 30 -----------
 .../v1_0/type/messaging/Properties.java         |  4 +-
 .../v1_0/codec/StringTypeConstructorTest.java   | 57 ++++++++++++++++++++
 .../NonEncodingRetainingSectionTest.java        | 54 -------------------
 11 files changed, 110 insertions(+), 150 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/57bda83d/broker-core/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQShortString.java
----------------------------------------------------------------------
diff --git a/broker-core/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQShortString.java b/broker-core/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQShortString.java
index a01c02f..59f96e5 100644
--- a/broker-core/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQShortString.java
+++ b/broker-core/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQShortString.java
@@ -98,8 +98,14 @@ public final class AMQShortString implements Comparable<AMQShortString>
             byte[] data = new byte[length];
             buffer.get(data);
 
-            final AMQShortString cached = getShortStringCache().getIfPresent(ByteBuffer.wrap(data));
-            return cached != null ? cached : new AMQShortString(data);
+            ByteBuffer stringBuffer = ByteBuffer.wrap(data);
+            AMQShortString cached = getShortStringCache().getIfPresent(stringBuffer);
+            if (cached == null)
+            {
+                cached = new AMQShortString(data);
+                getShortStringCache().put(stringBuffer, cached);
+            }
+            return cached;
         }
     }
 
@@ -297,11 +303,6 @@ public final class AMQShortString implements Comparable<AMQShortString>
         return false;
     }
 
-    public void intern()
-    {
-        getShortStringCache().put(ByteBuffer.wrap(_data), this);
-    }
-
     public static AMQShortString validValueOf(Object obj)
     {
         return valueOf(obj,true,true);
@@ -365,7 +366,7 @@ public final class AMQShortString implements Comparable<AMQShortString>
     }
 
     /** Unit testing only */
-    static void setCache(final Cache<ByteBuffer, AMQShortString> cache)
+    static void setShortStringCache(final Cache<ByteBuffer, AMQShortString> cache)
     {
         CACHE.set(cache);
     }

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/57bda83d/broker-core/src/test/java/org/apache/qpid/server/protocol/v0_8/AMQShortStringTest.java
----------------------------------------------------------------------
diff --git a/broker-core/src/test/java/org/apache/qpid/server/protocol/v0_8/AMQShortStringTest.java b/broker-core/src/test/java/org/apache/qpid/server/protocol/v0_8/AMQShortStringTest.java
index 38f5ac2..4c72060 100644
--- a/broker-core/src/test/java/org/apache/qpid/server/protocol/v0_8/AMQShortStringTest.java
+++ b/broker-core/src/test/java/org/apache/qpid/server/protocol/v0_8/AMQShortStringTest.java
@@ -34,6 +34,7 @@ import com.google.common.cache.Cache;
 import com.google.common.cache.CacheBuilder;
 import org.junit.Test;
 
+import org.apache.qpid.server.bytebuffer.QpidByteBuffer;
 import org.apache.qpid.test.utils.UnitTestBase;
 
 public class AMQShortStringTest extends UnitTestBase
@@ -157,28 +158,30 @@ public class AMQShortStringTest extends UnitTestBase
     }
 
     @Test
-    public void testInterning()
+    public void testCaching()
     {
         Cache<ByteBuffer, AMQShortString> original = AMQShortString.getShortStringCache();
         Cache<ByteBuffer, AMQShortString> cache = CacheBuilder.newBuilder().maximumSize(1).build();
-        AMQShortString.setCache(cache);
-
+        AMQShortString.setShortStringCache(cache);
         try
         {
-            AMQShortString str1 = AMQShortString.createAMQShortString("hello");
-            str1.intern();
-            AMQShortString str2 = AMQShortString.createAMQShortString("hello");
-            AMQShortString str3 = AMQShortString.createAMQShortString("hello".getBytes(StandardCharsets.UTF_8));
+            AMQShortString string = AMQShortString.createAMQShortString("hello");
+            QpidByteBuffer qpidByteBuffer = QpidByteBuffer.allocate(2 * (string.length() + 1));
+            string.writeToBuffer(qpidByteBuffer);
+            string.writeToBuffer(qpidByteBuffer);
+
+            qpidByteBuffer.flip();
+
+            AMQShortString str1 = AMQShortString.readAMQShortString(qpidByteBuffer);
+            AMQShortString str2 = AMQShortString.readAMQShortString(qpidByteBuffer);
 
             assertEquals(str1, str2);
-            assertEquals(str1, str3);
             assertSame(str1, str2);
-            assertSame(str1, str3);
         }
         finally
         {
             cache.cleanUp();
-            AMQShortString.setCache(original);
+            AMQShortString.setShortStringCache(original);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/57bda83d/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/MessageMetaData.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/MessageMetaData.java b/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/MessageMetaData.java
index 2ad8511..1defedb 100644
--- a/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/MessageMetaData.java
+++ b/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/MessageMetaData.java
@@ -164,16 +164,7 @@ public class MessageMetaData implements StorableMessageMetaData
 
                 ContentHeaderBody chb = ContentHeaderBody.createFromBuffer(buf, size);
                 final AMQShortString exchange = AMQShortString.readAMQShortString(buf);
-                if (exchange != null)
-                {
-                    exchange.intern();
-                }
                 final AMQShortString routingKey = AMQShortString.readAMQShortString(buf);
-                if (routingKey != null)
-                {
-                    routingKey.intern();
-                }
-
                 final byte flags = buf.get();
                 long arrivalTime = buf.getLong();
 

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/57bda83d/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/transport/BasicContentHeaderProperties.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/transport/BasicContentHeaderProperties.java b/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/transport/BasicContentHeaderProperties.java
index 52183fc..43c26f1 100644
--- a/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/transport/BasicContentHeaderProperties.java
+++ b/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/transport/BasicContentHeaderProperties.java
@@ -374,19 +374,11 @@ public class BasicContentHeaderProperties
         if ((_propertyFlags & (CONTENT_TYPE_MASK)) != 0)
         {
             _contentType = AMQShortString.readAMQShortString(buffer);
-            if (_contentType != null)
-            {
-                _contentType.intern();
-            }
         }
 
         if ((_propertyFlags & ENCODING_MASK) != 0)
         {
             _encoding = AMQShortString.readAMQShortString(buffer);
-            if (_encoding != null)
-            {
-                _encoding.intern();
-            }
         }
 
         if ((_propertyFlags & HEADERS_MASK) != 0)
@@ -418,10 +410,6 @@ public class BasicContentHeaderProperties
         if ((_propertyFlags & REPLY_TO_MASK) != 0)
         {
             _replyTo = AMQShortString.readAMQShortString(buffer);
-            if (_replyTo != null)
-            {
-                _replyTo.intern();
-            }
         }
 
         if ((_propertyFlags & EXPIRATION_MASK) != 0)
@@ -447,28 +435,16 @@ public class BasicContentHeaderProperties
         if ((_propertyFlags & USER_ID_MASK) != 0)
         {
             _userId = AMQShortString.readAMQShortString(buffer);
-            if (_userId != null)
-            {
-                _userId.intern();
-            }
         }
 
         if ((_propertyFlags & APPLICATION_ID_MASK) != 0)
         {
             _appId = AMQShortString.readAMQShortString(buffer);
-            if (_appId != null)
-            {
-                _appId.intern();
-            }
         }
 
         if ((_propertyFlags & CLUSTER_ID_MASK) != 0)
         {
             _clusterId = AMQShortString.readAMQShortString(buffer);
-            if (_clusterId != null)
-            {
-                _clusterId.intern();
-            }
         }
 
     }

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/57bda83d/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/transport/BasicPublishBody.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/transport/BasicPublishBody.java b/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/transport/BasicPublishBody.java
index a8243ea..9821383 100644
--- a/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/transport/BasicPublishBody.java
+++ b/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/transport/BasicPublishBody.java
@@ -152,15 +152,7 @@ public class BasicPublishBody extends AMQMethodBodyImpl implements EncodableAMQD
 
         int ticket = buffer.getUnsignedShort();
         AMQShortString exchange = AMQShortString.readAMQShortString(buffer);
-        if (exchange != null)
-        {
-            exchange.intern();
-        }
         AMQShortString routingKey = AMQShortString.readAMQShortString(buffer);
-        if (routingKey != null)
-        {
-            routingKey.intern();
-        }
         byte bitfield = buffer.get();
 
         boolean mandatory = (bitfield & 0x01) != 0;

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/57bda83d/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/StringTypeConstructor.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/StringTypeConstructor.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/StringTypeConstructor.java
index 946dc4a..ffa708a 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/StringTypeConstructor.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/StringTypeConstructor.java
@@ -22,13 +22,22 @@ package org.apache.qpid.server.protocol.v1_0.codec;
 
 import static java.nio.charset.StandardCharsets.UTF_8;
 
+import java.nio.ByteBuffer;
+
+import com.google.common.cache.Cache;
+
 import org.apache.qpid.server.bytebuffer.QpidByteBuffer;
 import org.apache.qpid.server.protocol.v1_0.type.AmqpErrorException;
 import org.apache.qpid.server.protocol.v1_0.type.transport.AmqpError;
+import org.apache.qpid.server.virtualhost.CacheFactory;
+import org.apache.qpid.server.virtualhost.NullCache;
 
 public class StringTypeConstructor extends VariableWidthTypeConstructor<String>
 {
+    private static final NullCache<ByteBuffer, String> NULL_CACHE = new NullCache<>();
 
+    private static final ThreadLocal<Cache<ByteBuffer, String>> CACHE =
+            ThreadLocal.withInitial(() -> CacheFactory.getCache("stringCache", NULL_CACHE));
 
     public static StringTypeConstructor getInstance(int i)
     {
@@ -67,6 +76,24 @@ public class StringTypeConstructor extends VariableWidthTypeConstructor<String>
 
         byte[] data = new byte[size];
         in.get(data);
-        return new String(data, UTF_8);
+
+        ByteBuffer buffer = ByteBuffer.wrap(data);
+        String cached = getCache().getIfPresent(buffer);
+        if (cached == null)
+        {
+            cached = new String(data, UTF_8);
+            getCache().put(buffer, cached);
+        }
+        return cached;
+    }
+
+    static Cache<ByteBuffer, String> getCache()
+    {
+        return CACHE.get();
+    }
+
+    static void setCache(final Cache<ByteBuffer, String> cache)
+    {
+        CACHE.set(cache);
     }
 }

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/57bda83d/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/ApplicationProperties.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/ApplicationProperties.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/ApplicationProperties.java
index f44f960..b2d3954 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/ApplicationProperties.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/ApplicationProperties.java
@@ -42,7 +42,6 @@ public class ApplicationProperties implements NonEncodingRetainingSection<Map<St
         {
             throw new IllegalArgumentException("Value must not be null");
         }
-        LinkedHashMap<String,Object> copy = new LinkedHashMap<>();
         for(Map.Entry<String,Object> entry: value.entrySet())
         {
             if (entry.getKey() == null)
@@ -53,10 +52,8 @@ public class ApplicationProperties implements NonEncodingRetainingSection<Map<St
             {
                 throw new IllegalArgumentException("Application properties do not allow non-primitive values");
             }
-
-            copy.put(NonEncodingRetainingSection.getCached(entry.getKey()), entry.getValue());
         }
-        _value = copy;
+        _value = value;
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/57bda83d/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/NonEncodingRetainingSection.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/NonEncodingRetainingSection.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/NonEncodingRetainingSection.java
index b6385c2..fc9a43d 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/NonEncodingRetainingSection.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/NonEncodingRetainingSection.java
@@ -20,39 +20,9 @@
  */
 package org.apache.qpid.server.protocol.v1_0.type.messaging;
 
-import com.google.common.cache.Cache;
-
 import org.apache.qpid.server.protocol.v1_0.type.Section;
-import org.apache.qpid.server.virtualhost.CacheFactory;
-import org.apache.qpid.server.virtualhost.NullCache;
 
 public interface NonEncodingRetainingSection<T> extends Section<T>
 {
-    NullCache<String, String> NULL_CACHE = new NullCache<>();
-    ThreadLocal<Cache<String, String>> CACHE =
-            ThreadLocal.withInitial(() -> CacheFactory.getCache("stringCache", NULL_CACHE));
-
-    static Cache<String, String> getStringCache()
-    {
-        return CACHE.get();
-    }
-
-    /** Unit testing only */
-    static void setCache(final Cache<String, String> cache)
-    {
-        CACHE.set(cache);
-    }
-
-    static String getCached(final String value)
-    {
-        String cached = getStringCache().getIfPresent(value);
-        if (cached == null)
-        {
-            cached = value;
-            getStringCache().put(cached, cached);
-        }
-        return cached;
-    }
-
     EncodingRetainingSection<T> createEncodingRetainingSection();
 }

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/57bda83d/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/Properties.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/Properties.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/Properties.java
index 2fcc9ca..9c10cee 100644
--- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/Properties.java
+++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/Properties.java
@@ -98,7 +98,7 @@ public class Properties implements NonEncodingRetainingSection<Properties>
 
     public void setTo(String to)
     {
-        _to = (to == null ? null : NonEncodingRetainingSection.getCached(to));
+        _to = to;
     }
 
     public String getSubject()
@@ -108,7 +108,7 @@ public class Properties implements NonEncodingRetainingSection<Properties>
 
     public void setSubject(String subject)
     {
-        _subject = (subject == null ? null : NonEncodingRetainingSection.getCached(subject));
+        _subject = subject;
     }
 
     public String getReplyTo()

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/57bda83d/broker-plugins/amqp-1-0-protocol/src/test/java/org/apache/qpid/server/protocol/v1_0/codec/StringTypeConstructorTest.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/test/java/org/apache/qpid/server/protocol/v1_0/codec/StringTypeConstructorTest.java b/broker-plugins/amqp-1-0-protocol/src/test/java/org/apache/qpid/server/protocol/v1_0/codec/StringTypeConstructorTest.java
new file mode 100644
index 0000000..6e87a44
--- /dev/null
+++ b/broker-plugins/amqp-1-0-protocol/src/test/java/org/apache/qpid/server/protocol/v1_0/codec/StringTypeConstructorTest.java
@@ -0,0 +1,57 @@
+/*
+ *
+ * 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.protocol.v1_0.codec;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertSame;
+
+import java.nio.ByteBuffer;
+
+import com.google.common.cache.Cache;
+import com.google.common.cache.CacheBuilder;
+import org.junit.Test;
+
+import org.apache.qpid.server.bytebuffer.QpidByteBuffer;
+
+public class StringTypeConstructorTest
+{
+
+    @Test
+    public void construct() throws Exception
+    {
+        StringTypeConstructor constructor = StringTypeConstructor.getInstance(1);
+        Cache<ByteBuffer, String> original = StringTypeConstructor.getCache();
+        Cache<ByteBuffer, String> cache = CacheBuilder.newBuilder().maximumSize(2).build();
+        StringTypeConstructor.setCache(cache);
+        try
+        {
+            String string1 = constructor.construct(QpidByteBuffer.wrap(new byte[]{4, 't', 'e', 's', 't'}), null);
+            String string2 = constructor.construct(QpidByteBuffer.wrap(new byte[]{4, 't', 'e', 's', 't'}), null);
+            assertEquals(string1, string2);
+            assertSame(string1, string2);
+        }
+        finally
+        {
+            cache.cleanUp();
+            StringTypeConstructor.setCache(original);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/57bda83d/broker-plugins/amqp-1-0-protocol/src/test/java/org/apache/qpid/server/protocol/v1_0/type/messaging/NonEncodingRetainingSectionTest.java
----------------------------------------------------------------------
diff --git a/broker-plugins/amqp-1-0-protocol/src/test/java/org/apache/qpid/server/protocol/v1_0/type/messaging/NonEncodingRetainingSectionTest.java b/broker-plugins/amqp-1-0-protocol/src/test/java/org/apache/qpid/server/protocol/v1_0/type/messaging/NonEncodingRetainingSectionTest.java
deleted file mode 100644
index a56745a..0000000
--- a/broker-plugins/amqp-1-0-protocol/src/test/java/org/apache/qpid/server/protocol/v1_0/type/messaging/NonEncodingRetainingSectionTest.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- *
- * 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.protocol.v1_0.type.messaging;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertSame;
-
-import com.google.common.cache.Cache;
-import com.google.common.cache.CacheBuilder;
-import org.junit.Test;
-
-public class NonEncodingRetainingSectionTest
-{
-
-    @Test
-    public void getCached()
-    {
-        Cache<String, String> original = NonEncodingRetainingSection.getStringCache();
-        Cache<String, String> cache = CacheBuilder.newBuilder().maximumSize(1).build();
-        NonEncodingRetainingSection.setCache(cache);
-
-        try
-        {
-            String string1 = NonEncodingRetainingSection.getCached(new String(new char[]{'t', 'e', 's', 't'}));
-            String string2 = NonEncodingRetainingSection.getCached(new String(new char[]{'t', 'e', 's', 't'}));
-
-            assertEquals(string1, string2);
-            assertSame(string1, string2);
-        }
-        finally
-        {
-            cache.cleanUp();
-            NonEncodingRetainingSection.setCache(original);
-        }
-    }
-}


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


[2/2] qpid-broker-j git commit: QPID-8196) [Broker-J] [WMC] Make sure that edit form controls are populated with current values for type-based UI fragments loaded dynamically into editing form

Posted by or...@apache.org.
QPID-8196) [Broker-J] [WMC] Make sure that edit form controls are populated with current values for type-based UI fragments loaded dynamically into editing form


Project: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/commit/4ac5997f
Tree: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/tree/4ac5997f
Diff: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/diff/4ac5997f

Branch: refs/heads/master
Commit: 4ac5997f450d167d8afbe2f3a49f7a7414c21656
Parents: 57bda83
Author: Alex Rudyy <or...@apache.org>
Authored: Fri May 18 12:45:16 2018 +0100
Committer: Alex Rudyy <or...@apache.org>
Committed: Fri May 25 20:58:34 2018 +0100

----------------------------------------------------------------------
 .../js/qpid/management/virtualhost/bdb/edit.js  |  2 +
 .../qpid/management/virtualhost/bdb_ha/edit.js  |  2 +
 .../qpid/management/virtualhost/bdb_ha/show.js  |  9 +++
 .../qpid/management/virtualhostnode/bdb/edit.js |  2 +
 .../management/virtualhostnode/bdb_ha/edit.js   |  2 +
 .../qpid/management/virtualhost/derby/edit.js   |  3 +
 .../management/virtualhostnode/derby/edit.js    |  2 +
 .../qpid/management/store/pool/bonecp/show.js   |  9 +++
 .../js/qpid/management/virtualhost/jdbc/edit.js |  3 +
 .../js/qpid/management/virtualhost/jdbc/show.js |  9 +++
 .../management/virtualhostnode/jdbc/edit.js     |  2 +
 .../management/virtualhostnode/jdbc/show.js     |  9 +++
 .../main/java/resources/editVirtualHost.html    |  5 +-
 .../js/qpid/management/editVirtualHost.js       | 80 ++++++++------------
 .../virtualhost/providedstore/edit.js           |  3 +
 .../management/virtualhostnode/json/edit.js     |  2 +
 16 files changed, 93 insertions(+), 51 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/4ac5997f/bdbstore/src/main/java/resources/js/qpid/management/virtualhost/bdb/edit.js
----------------------------------------------------------------------
diff --git a/bdbstore/src/main/java/resources/js/qpid/management/virtualhost/bdb/edit.js b/bdbstore/src/main/java/resources/js/qpid/management/virtualhost/bdb/edit.js
index e59bcf2..19c5fc5 100644
--- a/bdbstore/src/main/java/resources/js/qpid/management/virtualhost/bdb/edit.js
+++ b/bdbstore/src/main/java/resources/js/qpid/management/virtualhost/bdb/edit.js
@@ -27,6 +27,8 @@ define(["dijit/registry", "qpid/common/util", "dojo/domReady!"], function (regis
                     .set("regExpGen", util.numericOrContextVarRegexp);
                 registry.byId("editVirtualHost.storeOverfullSize")
                     .set("regExpGen", util.numericOrContextVarRegexp);
+
+                util.applyToWidgets(data.containerNode, "VirtualHost", data.data.type, data.data, data.metadata);
             });
         }
     };

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/4ac5997f/bdbstore/src/main/java/resources/js/qpid/management/virtualhost/bdb_ha/edit.js
----------------------------------------------------------------------
diff --git a/bdbstore/src/main/java/resources/js/qpid/management/virtualhost/bdb_ha/edit.js b/bdbstore/src/main/java/resources/js/qpid/management/virtualhost/bdb_ha/edit.js
index becc1e6..9c47130 100644
--- a/bdbstore/src/main/java/resources/js/qpid/management/virtualhost/bdb_ha/edit.js
+++ b/bdbstore/src/main/java/resources/js/qpid/management/virtualhost/bdb_ha/edit.js
@@ -27,6 +27,8 @@ define(["qpid/common/util", "dijit/registry", "dojo/domReady!"], function (util,
                     .set("regExpGen", util.numericOrContextVarRegexp);
                 registry.byId("editVirtualHost.storeOverfullSize")
                     .set("regExpGen", util.numericOrContextVarRegexp);
+
+                util.applyToWidgets(data.containerNode, "VirtualHost", data.data.type, data.data, data.metadata);
             });
         }
     };

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/4ac5997f/bdbstore/src/main/java/resources/js/qpid/management/virtualhost/bdb_ha/show.js
----------------------------------------------------------------------
diff --git a/bdbstore/src/main/java/resources/js/qpid/management/virtualhost/bdb_ha/show.js b/bdbstore/src/main/java/resources/js/qpid/management/virtualhost/bdb_ha/show.js
index 5e65c51..4d8d52f 100644
--- a/bdbstore/src/main/java/resources/js/qpid/management/virtualhost/bdb_ha/show.js
+++ b/bdbstore/src/main/java/resources/js/qpid/management/virtualhost/bdb_ha/show.js
@@ -33,11 +33,20 @@ define(["qpid/common/util", "dojo/query", "dojo/domReady!"], function (util, que
                 query("." + localTransactionSynchronizationPolicy, data.containerNode)[0];
             that[remoteTransactionSynchronizationPolicy] =
                 query("." + remoteTransactionSynchronizationPolicy, data.containerNode)[0];
+            that._initialized = true;
         });
     }
 
     BDB.prototype.update = function (data)
     {
+        if (this._initialized)
+        {
+            this._update(data);
+        }
+    };
+
+    BDB.prototype._update = function (data)
+    {
         util.updateUI(data, fields, this);
 
         var localSyncPolicy = data[localTransactionSynchronizationPolicy]

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/4ac5997f/bdbstore/src/main/java/resources/js/qpid/management/virtualhostnode/bdb/edit.js
----------------------------------------------------------------------
diff --git a/bdbstore/src/main/java/resources/js/qpid/management/virtualhostnode/bdb/edit.js b/bdbstore/src/main/java/resources/js/qpid/management/virtualhostnode/bdb/edit.js
index 75b7dba..f7d51b7 100644
--- a/bdbstore/src/main/java/resources/js/qpid/management/virtualhostnode/bdb/edit.js
+++ b/bdbstore/src/main/java/resources/js/qpid/management/virtualhostnode/bdb/edit.js
@@ -25,6 +25,8 @@ define(["qpid/common/util", "dijit/registry", "dojo/domReady!"], function (util,
             {
                 registry.byId("editVirtualHostNode.storePath")
                     .set("disabled", !(data.data.state == "STOPPED" || data.data.state == "ERRORED"));
+
+                util.applyToWidgets(data.containerNode, "VirtualHostNode", data.data.type, data.data, data.metadata);
             });
         }
     };

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/4ac5997f/bdbstore/src/main/java/resources/js/qpid/management/virtualhostnode/bdb_ha/edit.js
----------------------------------------------------------------------
diff --git a/bdbstore/src/main/java/resources/js/qpid/management/virtualhostnode/bdb_ha/edit.js b/bdbstore/src/main/java/resources/js/qpid/management/virtualhostnode/bdb_ha/edit.js
index 14cd2d7..59d2337 100644
--- a/bdbstore/src/main/java/resources/js/qpid/management/virtualhostnode/bdb_ha/edit.js
+++ b/bdbstore/src/main/java/resources/js/qpid/management/virtualhostnode/bdb_ha/edit.js
@@ -125,6 +125,8 @@ define(["qpid/common/util",
                 // add new option to list
                 this.permittedNodesList.containerNode.appendChild(newOption);
             }
+
+            util.applyToWidgets(data.containerNode, "VirtualHostNode", node.type, node, data.metadata);
         },
         _clickAddPermittedNodeButton: function (e)
         {

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/4ac5997f/broker-plugins/derby-store/src/main/java/resources/js/qpid/management/virtualhost/derby/edit.js
----------------------------------------------------------------------
diff --git a/broker-plugins/derby-store/src/main/java/resources/js/qpid/management/virtualhost/derby/edit.js b/broker-plugins/derby-store/src/main/java/resources/js/qpid/management/virtualhost/derby/edit.js
index 23442b1..c593946 100644
--- a/broker-plugins/derby-store/src/main/java/resources/js/qpid/management/virtualhost/derby/edit.js
+++ b/broker-plugins/derby-store/src/main/java/resources/js/qpid/management/virtualhost/derby/edit.js
@@ -27,6 +27,9 @@ define(["qpid/common/util", "dijit/registry", "dojo/domReady!"], function (util,
                     .set("regExpGen", util.numericOrContextVarRegexp);
                 registry.byId("editVirtualHost.storeOverfullSize")
                     .set("regExpGen", util.numericOrContextVarRegexp);
+
+
+                util.applyToWidgets(data.containerNode, "VirtualHost", data.data.type, data.data, data.metadata);
             });
         }
     };

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/4ac5997f/broker-plugins/derby-store/src/main/java/resources/js/qpid/management/virtualhostnode/derby/edit.js
----------------------------------------------------------------------
diff --git a/broker-plugins/derby-store/src/main/java/resources/js/qpid/management/virtualhostnode/derby/edit.js b/broker-plugins/derby-store/src/main/java/resources/js/qpid/management/virtualhostnode/derby/edit.js
index 03a943c..91af754 100644
--- a/broker-plugins/derby-store/src/main/java/resources/js/qpid/management/virtualhostnode/derby/edit.js
+++ b/broker-plugins/derby-store/src/main/java/resources/js/qpid/management/virtualhostnode/derby/edit.js
@@ -25,6 +25,8 @@ define(["qpid/common/util", "dijit/registry", "dojo/domReady!"], function (util,
             {
                 registry.byId("editVirtualHostNode.storePath")
                     .set("disabled", data.data.state != "STOPPED");
+
+                util.applyToWidgets(data.containerNode, "VirtualHostNode", data.data.type, data.data, data.metadata);
             });
         }
     };

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/4ac5997f/broker-plugins/jdbc-provider-bone/src/main/java/resources/js/qpid/management/store/pool/bonecp/show.js
----------------------------------------------------------------------
diff --git a/broker-plugins/jdbc-provider-bone/src/main/java/resources/js/qpid/management/store/pool/bonecp/show.js b/broker-plugins/jdbc-provider-bone/src/main/java/resources/js/qpid/management/store/pool/bonecp/show.js
index 14e4ff0..0297165 100644
--- a/broker-plugins/jdbc-provider-bone/src/main/java/resources/js/qpid/management/store/pool/bonecp/show.js
+++ b/broker-plugins/jdbc-provider-bone/src/main/java/resources/js/qpid/management/store/pool/bonecp/show.js
@@ -40,6 +40,7 @@ define(["dojo/_base/xhr", "dojo/parser", "dojox/html/entities", "dojo/query", "d
                             {
                                 var fieldName = fieldNames[i];
                                 that[fieldName] = query("." + fieldName, containerNode)[0];
+                                that._initialized = true;
                             }
                         });
                 }
@@ -48,6 +49,14 @@ define(["dojo/_base/xhr", "dojo/parser", "dojox/html/entities", "dojo/query", "d
 
         BoneCP.prototype.update = function (data)
         {
+            if (this._initialized)
+            {
+                this._update(data);
+            }
+        };
+
+        BoneCP.prototype._update = function (data)
+        {
             this.parent.management.load(this.parent.modelObj,
                 {
                     excludeInheritedContext: false,

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/4ac5997f/broker-plugins/jdbc-store/src/main/java/resources/js/qpid/management/virtualhost/jdbc/edit.js
----------------------------------------------------------------------
diff --git a/broker-plugins/jdbc-store/src/main/java/resources/js/qpid/management/virtualhost/jdbc/edit.js b/broker-plugins/jdbc-store/src/main/java/resources/js/qpid/management/virtualhost/jdbc/edit.js
index 3fff164..2cbd3ac 100644
--- a/broker-plugins/jdbc-store/src/main/java/resources/js/qpid/management/virtualhost/jdbc/edit.js
+++ b/broker-plugins/jdbc-store/src/main/java/resources/js/qpid/management/virtualhost/jdbc/edit.js
@@ -87,6 +87,9 @@ define(["qpid/common/util",
                     });
                 }
             });
+
+
+            util.applyToWidgets(data.containerNode, "VirtualHost", data.data.type, data.data, data.metadata);
         }
     };
 });

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/4ac5997f/broker-plugins/jdbc-store/src/main/java/resources/js/qpid/management/virtualhost/jdbc/show.js
----------------------------------------------------------------------
diff --git a/broker-plugins/jdbc-store/src/main/java/resources/js/qpid/management/virtualhost/jdbc/show.js b/broker-plugins/jdbc-store/src/main/java/resources/js/qpid/management/virtualhost/jdbc/show.js
index edf8dc3..2071881 100644
--- a/broker-plugins/jdbc-store/src/main/java/resources/js/qpid/management/virtualhost/jdbc/show.js
+++ b/broker-plugins/jdbc-store/src/main/java/resources/js/qpid/management/virtualhost/jdbc/show.js
@@ -37,11 +37,20 @@ define(["qpid/common/util", "dojo/query", "dojo/_base/array", "dojo/dom-construc
                     that.usernameAttributeContainer = query(".usernameAttributeContainer", data.containerNode)[0];
                     that.connectionPoolTypeAttributeContainer =
                         query(".connectionPoolTypeAttributeContainer", data.containerNode)[0];
+                    that._initialized = true;
                 });
         }
 
         JDBC.prototype.update = function (data)
         {
+            if (this._initialized)
+            {
+                this._update(data);
+            }
+        };
+
+        JDBC.prototype._update = function (data)
+        {
             var previousConnectionPoolType = this.connectionPoolType ? this.connectionPoolType.innerHTML : null;
             util.updateUI(data, fieldNames, this);
             this.usernameAttributeContainer.style.display = data.username ? "block" : "none";

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/4ac5997f/broker-plugins/jdbc-store/src/main/java/resources/js/qpid/management/virtualhostnode/jdbc/edit.js
----------------------------------------------------------------------
diff --git a/broker-plugins/jdbc-store/src/main/java/resources/js/qpid/management/virtualhostnode/jdbc/edit.js b/broker-plugins/jdbc-store/src/main/java/resources/js/qpid/management/virtualhostnode/jdbc/edit.js
index 86ccb52..068412d 100644
--- a/broker-plugins/jdbc-store/src/main/java/resources/js/qpid/management/virtualhostnode/jdbc/edit.js
+++ b/broker-plugins/jdbc-store/src/main/java/resources/js/qpid/management/virtualhostnode/jdbc/edit.js
@@ -94,6 +94,8 @@ define(["qpid/common/util",
                     });
                 }
             });
+
+            util.applyToWidgets(data.containerNode, "VirtualHostNode", data.data.type, data.data, data.metadata);
         }
     };
 });

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/4ac5997f/broker-plugins/jdbc-store/src/main/java/resources/js/qpid/management/virtualhostnode/jdbc/show.js
----------------------------------------------------------------------
diff --git a/broker-plugins/jdbc-store/src/main/java/resources/js/qpid/management/virtualhostnode/jdbc/show.js b/broker-plugins/jdbc-store/src/main/java/resources/js/qpid/management/virtualhostnode/jdbc/show.js
index 1b7f9d8..3b3b97e 100644
--- a/broker-plugins/jdbc-store/src/main/java/resources/js/qpid/management/virtualhostnode/jdbc/show.js
+++ b/broker-plugins/jdbc-store/src/main/java/resources/js/qpid/management/virtualhostnode/jdbc/show.js
@@ -38,11 +38,20 @@ define(["qpid/common/util", "dojo/query", "dojo/_base/array", "dojo/dom-construc
                     that.usernameAttributeContainer = query(".usernameAttributeContainer", data.containerNode)[0];
                     that.connectionPoolTypeAttributeContainer =
                         query(".connectionPoolTypeAttributeContainer", data.containerNode)[0];
+                    this._initialized = true;
                 });
         }
 
         Jdbc.prototype.update = function (data)
         {
+            if (this._initialized)
+            {
+                this._update(data);
+            }
+        };
+
+        Jdbc.prototype._update = function (data)
+        {
             var previousConnectionPoolType = this.connectionPoolType ? this.connectionPoolType.innerHTML : null;
             this.parent.editNodeButton.set("disabled", !(data.state == "STOPPED" || data.state == "ERRORED"));
             util.updateUI(data, fieldNames, this);

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/4ac5997f/broker-plugins/management-http/src/main/java/resources/editVirtualHost.html
----------------------------------------------------------------------
diff --git a/broker-plugins/management-http/src/main/java/resources/editVirtualHost.html b/broker-plugins/management-http/src/main/java/resources/editVirtualHost.html
index 042e05b..7d396d9 100644
--- a/broker-plugins/management-http/src/main/java/resources/editVirtualHost.html
+++ b/broker-plugins/management-http/src/main/java/resources/editVirtualHost.html
@@ -119,14 +119,15 @@
                     </div>
                 </div>
                 <div class="clear">
-                    <div class="formLabel-labelCell tableContainer-labelCell">Statistics reporting period (s)</div>
+                    <div class="formLabel-labelCell tableContainer-labelCell">Statistics reporting period (s):</div>
                     <div class="tableContainer-valueCell formLabel-controlCell">
                         <input type="text"
                                data-dojo-type="dijit/form/ValidationTextBox"
+                               id="editVirtualHost.statisticsReportingPeriod"
                                data-dojo-props="
                               name: 'statisticsReportingPeriod',
                               trim: true,
-                              placeholder: 'Time in seconds',
+                              placeHolder: 'Time in seconds',
                               label: 'Statistics reporting period (s):',
                               promptMessage: 'Period with which statistics are reported to the log.'" />
                     </div>

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/4ac5997f/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editVirtualHost.js
----------------------------------------------------------------------
diff --git a/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editVirtualHost.js b/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editVirtualHost.js
index fd0c577..67c8fa4 100644
--- a/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editVirtualHost.js
+++ b/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editVirtualHost.js
@@ -81,21 +81,14 @@ define(["dojox/html/entities",
               TrackableStore,
               keys)
     {
-        var fields = ["name",
-                      "connectionThreadPoolSize",
-                      "storeTransactionIdleTimeoutWarn",
-                      "storeTransactionIdleTimeoutClose",
-                      "storeTransactionOpenTimeoutWarn",
-                      "storeTransactionOpenTimeoutClose",
-                      "housekeepingCheckPeriod",
-                      "housekeepingThreadCount"];
         var numericFieldNames = ["storeTransactionIdleTimeoutWarn",
                                  "storeTransactionIdleTimeoutClose",
                                  "storeTransactionOpenTimeoutWarn",
                                  "storeTransactionOpenTimeoutClose",
                                  "housekeepingCheckPeriod",
                                  "housekeepingThreadCount",
-                                 "connectionThreadPoolSize"];
+                                 "connectionThreadPoolSize",
+                                 "statisticsReportingPeriod"];
 
         var virtualHostEditor = {
             init: function ()
@@ -124,10 +117,10 @@ define(["dojox/html/entities",
                 {
                     that._save(e);
                 });
-                for (var i = 0; i < fields.length; i++)
+                // Add regexp to the numeric fields
+                for (var i = 0; i < numericFieldNames.length; i++)
                 {
-                    var fieldName = fields[i];
-                    this[fieldName] = registry.byId("editVirtualHost." + fieldName);
+                    registry.byId("editVirtualHost." + numericFieldNames[i]).set("regExpGen", util.numericOrContextVarRegexp);
                 }
                 this.form = registry.byId("editVirtualHostForm");
                 this.form.on("submit", function ()
@@ -181,7 +174,13 @@ define(["dojox/html/entities",
                     {
                         data["context"] = context;
                     }
-                    data.nodeAutoCreationPolicies = this._getNodeAutoCreationPolicies();
+                    var nodeAutoCreationPolicies = this._getNodeAutoCreationPolicies();
+
+                    if (!util.equals(nodeAutoCreationPolicies, this.initialData.nodeAutoCreationPolicies))
+                    {
+                        data.nodeAutoCreationPolicies = nodeAutoCreationPolicies;
+                    }
+
                     var that = this;
                     this.management.update(that.modelObj, data)
                         .then(function (x)
@@ -197,30 +196,8 @@ define(["dojox/html/entities",
             _show: function (data)
             {
                 this.initialData = data.actual;
-                for (var i = 0; i < fields.length; i++)
-                {
-                    var fieldName = fields[i];
-                    var widget = this[fieldName];
-                    widget.reset();
-
-                    if (widget instanceof dijit.form.CheckBox)
-                    {
-                        widget.set("checked", data.actual[fieldName]);
-                    }
-                    else
-                    {
-                        widget.set("value", data.actual[fieldName]);
-                    }
-                }
-
+                this.form.reset();
                 this.context.setData(data.actual.context, data.effective.context, data.inheritedActual.context);
-
-                // Add regexp to the numeric fields
-                for (var i = 0; i < numericFieldNames.length; i++)
-                {
-                    this[numericFieldNames[i]].set("regExpGen", util.numericOrContextVarRegexp);
-                }
-
                 var that = this;
 
                 var widgets = registry.findWidgets(this.typeFieldsContainer);
@@ -241,13 +218,6 @@ define(["dojox/html/entities",
                             data: data.actual,
                             metadata: metadata
                         });
-                        that.form.connectChildren();
-
-                        util.applyToWidgets(that.allFieldsContainer,
-                            "VirtualHost",
-                            data.actual.type,
-                            data.actual,
-                            metadata);
                     }
                     catch (e)
                     {
@@ -257,7 +227,12 @@ define(["dojox/html/entities",
                         }
                     }
                 });
-
+                util.applyToWidgets(this.allFieldsContainer,
+                    "VirtualHost",
+                    data.actual.type,
+                    data.actual,
+                    this.management.metadata,
+                    data.effective);
                 this._initNodeAutoCreationPolicies(data.actual && data.actual.nodeAutoCreationPolicies ? data.actual.nodeAutoCreationPolicies : []);
                 this.dialog.startup();
                 this.dialog.show();
@@ -441,14 +416,21 @@ define(["dojox/html/entities",
                 return policies;
             },
             _toNodeAutoCreationPolicyObject: function (policy) {
-                return {
+                var obj =  {
                     pattern: policy.pattern,
                     nodeType: policy.type,
-                    attributes: policy.attributes,
-                    createdOnPublish: policy.createdOnPublish,
-                    createdOnConsume: policy.createdOnConsume
+                    attributes: policy.attributes
                 };
-            },
+                if (policy.createdOnPublish === true)
+                {
+                    obj.createdOnPublish = policy.createdOnPublish;
+                }
+                if (policy.createdOnConsume === true)
+                {
+                    obj.createdOnConsume = policy.createdOnConsume;
+                }
+                return obj;
+            }
         };
 
         virtualHostEditor.init();

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/4ac5997f/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhost/providedstore/edit.js
----------------------------------------------------------------------
diff --git a/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhost/providedstore/edit.js b/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhost/providedstore/edit.js
index 680c623..c03a254 100644
--- a/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhost/providedstore/edit.js
+++ b/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhost/providedstore/edit.js
@@ -28,6 +28,9 @@ define(["dijit/registry", "qpid/common/util", "dojo/domReady!"], function (regis
                     .set("regExpGen", util.numericOrContextVarRegexp);
                 registry.byId("editVirtualHost.storeOverfullSize")
                     .set("regExpGen", util.numericOrContextVarRegexp);
+
+
+                util.applyToWidgets(data.containerNode, "VirtualHost", data.data.type, data.data, data.metadata);
             });
         }
     };

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/4ac5997f/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhostnode/json/edit.js
----------------------------------------------------------------------
diff --git a/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhostnode/json/edit.js b/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhostnode/json/edit.js
index 75b7dba..f7d51b7 100644
--- a/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhostnode/json/edit.js
+++ b/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhostnode/json/edit.js
@@ -25,6 +25,8 @@ define(["qpid/common/util", "dijit/registry", "dojo/domReady!"], function (util,
             {
                 registry.byId("editVirtualHostNode.storePath")
                     .set("disabled", !(data.data.state == "STOPPED" || data.data.state == "ERRORED"));
+
+                util.applyToWidgets(data.containerNode, "VirtualHostNode", data.data.type, data.data, data.metadata);
             });
         }
     };


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org