You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by rg...@apache.org on 2015/01/27 23:23:05 UTC

svn commit: r1655180 - /qpid/trunk/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/ConfiguredObjectToMapConverterTest.java

Author: rgodfrey
Date: Tue Jan 27 22:23:04 2015
New Revision: 1655180

URL: http://svn.apache.org/r1655180
Log:
QPID-6341 : Fix test

Modified:
    qpid/trunk/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/ConfiguredObjectToMapConverterTest.java

Modified: qpid/trunk/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/ConfiguredObjectToMapConverterTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/ConfiguredObjectToMapConverterTest.java?rev=1655180&r1=1655179&r2=1655180&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/ConfiguredObjectToMapConverterTest.java (original)
+++ qpid/trunk/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/ConfiguredObjectToMapConverterTest.java Tue Jan 27 22:23:04 2015
@@ -20,6 +20,7 @@
 package org.apache.qpid.server.management.plugin.servlet.rest;
 
 import static org.apache.qpid.server.management.plugin.servlet.rest.ConfiguredObjectToMapConverter.STATISTICS_MAP_KEY;
+import static org.mockito.Matchers.any;
 import static org.mockito.Matchers.anyBoolean;
 import static org.mockito.Matchers.eq;
 import static org.mockito.Mockito.mock;
@@ -37,6 +38,8 @@ import java.util.Set;
 import junit.framework.TestCase;
 
 import org.apache.qpid.server.model.ConfiguredObject;
+import org.apache.qpid.server.model.ConfiguredObjectAttribute;
+import org.apache.qpid.server.model.ConfiguredObjectTypeRegistry;
 import org.apache.qpid.server.model.Model;
 
 public class ConfiguredObjectToMapConverterTest extends TestCase
@@ -75,6 +78,8 @@ public class ConfiguredObjectToMapConver
     {
         final String attributeName = "attribute";
         final String attributeValue = "value";
+        Model model = createTestModel();
+        when(_configuredObject.getModel()).thenReturn(model);
         configureMockToReturnOneAttribute(_configuredObject, attributeName, attributeValue);
 
         Map<String, Object> resultMap = _converter.convertObjectToMap(_configuredObject,
@@ -217,6 +222,11 @@ public class ConfiguredObjectToMapConver
         final List<Class<? extends ConfiguredObject>> list = new ArrayList<Class<? extends ConfiguredObject>>();
         list.add(TestChild.class);
         when(model.getChildTypes(ConfiguredObject.class)).thenReturn(list);
+        final ConfiguredObjectTypeRegistry typeRegistry = mock(ConfiguredObjectTypeRegistry.class);
+        final Map<String, ConfiguredObjectAttribute<?, ?>> attrTypes = mock(Map.class);
+        when(attrTypes.get(any(String.class))).thenReturn(mock(ConfiguredObjectAttribute.class));
+        when(typeRegistry.getAttributeTypes(any(Class.class))).thenReturn(attrTypes);
+        when(model.getTypeRegistry()).thenReturn(typeRegistry);
         return model;
     }
 



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