Author: rgodfrey Date: Tue Jan 10 09:29:55 2017 New Revision: 1778099 URL: http://svn.apache.org/viewvc?rev=1778099&view=rev Log: QPID-7612 : Fix mocking and allow parent to be null so that tests pass
Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectFactoryImpl.java qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/model/adapter/PortFactoryTest.java qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/security/FileKeyStoreTest.java qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/security/FileTrustStoreTest.java Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectFactoryImpl.java URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectFactoryImpl.java?rev=1778099&r1=1778098&r2=1778099&view=diff ============================================================================== --- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectFactoryImpl.java (original) +++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectFactoryImpl.java Tue Jan 10 09:29:55 2017 @@ -111,14 +111,17 @@ public class ConfiguredObjectFactoryImpl private String getOnlyValidChildTypeIfKnown(final ConfiguredObject<?> parent, final String category) { - String foo = null; - final Collection<String> validChildTypes = - _model.getTypeRegistry().getValidChildTypes(parent.getTypeClass(), category); - if (validChildTypes != null && validChildTypes.size() == 1) + if(parent != null) { - foo = validChildTypes.iterator().next(); + final Collection<String> validChildTypes = + _model.getTypeRegistry().getValidChildTypes(parent.getTypeClass(), category); + if (validChildTypes != null && validChildTypes.size() == 1) + { + return validChildTypes.iterator().next(); + } } - return foo; + return null; + } @Override Modified: qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/model/adapter/PortFactoryTest.java URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/model/adapter/PortFactoryTest.java?rev=1778099&r1=1778098&r2=1778099&view=diff ============================================================================== --- qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/model/adapter/PortFactoryTest.java (original) +++ qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/model/adapter/PortFactoryTest.java Tue Jan 10 09:29:55 2017 @@ -87,6 +87,7 @@ public class PortFactoryTest extends Qpi when(_broker.getCategoryClass()).thenReturn(Broker.class); when(_broker.getEventLogger()).thenReturn(new EventLogger()); when(_broker.getParent()).thenReturn(systemConfig); + when(_broker.getTypeClass()).thenReturn(Broker.class); ConfiguredObjectFactory objectFactory = new ConfiguredObjectFactoryImpl(BrokerModel.getInstance()); when(_broker.getObjectFactory()).thenReturn(objectFactory); Modified: qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/security/FileKeyStoreTest.java URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/security/FileKeyStoreTest.java?rev=1778099&r1=1778098&r2=1778099&view=diff ============================================================================== --- qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/security/FileKeyStoreTest.java (original) +++ qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/security/FileKeyStoreTest.java Tue Jan 10 09:29:55 2017 @@ -62,6 +62,7 @@ public class FileKeyStoreTest extends Qp when(_broker.getModel()).thenReturn(_model); when(_broker.getCategoryClass()).thenReturn(Broker.class); when(_broker.getEventLogger()).thenReturn(new EventLogger()); + when(_broker.getTypeClass()).thenReturn(Broker.class); } public void testCreateKeyStoreFromFile_Success() throws Exception Modified: qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/security/FileTrustStoreTest.java URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/security/FileTrustStoreTest.java?rev=1778099&r1=1778098&r2=1778099&view=diff ============================================================================== --- qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/security/FileTrustStoreTest.java (original) +++ qpid/java/trunk/broker-core/src/test/java/org/apache/qpid/server/security/FileTrustStoreTest.java Tue Jan 10 09:29:55 2017 @@ -66,6 +66,7 @@ public class FileTrustStoreTest extends when(_broker.getModel()).thenReturn(_model); when(_broker.getCategoryClass()).thenReturn(Broker.class); when(_broker.getEventLogger()).thenReturn(new EventLogger()); + when(_broker.getTypeClass()).thenReturn(Broker.class); } public void testCreateTrustStoreFromFile_Success() throws Exception --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org