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 2014/04/04 23:06:09 UTC
svn commit: r1584910 [3/3] - in
/qpid/branches/java-broker-config-store-changes/qpid/java:
bdbstore/systests/src/main/java/org/apache/qpid/server/store/berkeleydb/
broker-core/src/main/java/org/apache/qpid/server/
broker-core/src/main/java/org/apache/q...
Modified: qpid/branches/java-broker-config-store-changes/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/SaslRestTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-store-changes/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/SaslRestTest.java?rev=1584910&r1=1584909&r2=1584910&view=diff
==============================================================================
--- qpid/branches/java-broker-config-store-changes/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/SaslRestTest.java (original)
+++ qpid/branches/java-broker-config-store-changes/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/SaslRestTest.java Fri Apr 4 21:06:08 2014
@@ -35,12 +35,13 @@ import java.util.List;
import java.util.Map;
import org.apache.commons.codec.binary.Base64;
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
+
import org.apache.qpid.server.model.AuthenticationProvider;
import org.apache.qpid.server.security.auth.manager.Base64MD5PasswordFileAuthenticationManagerFactory;
import org.apache.qpid.test.utils.TestBrokerConfiguration;
import org.apache.qpid.tools.security.Passwd;
-import org.codehaus.jackson.JsonParseException;
-import org.codehaus.jackson.map.JsonMappingException;
public class SaslRestTest extends QpidRestTestCase
{
@@ -378,6 +379,6 @@ public class SaslRestTest extends QpidRe
Map<String, Object> newAttributes = new HashMap<String, Object>();
newAttributes.put("path", passwordFile.getAbsolutePath());
newAttributes.put(AuthenticationProvider.TYPE, Base64MD5PasswordFileAuthenticationManagerFactory.PROVIDER_TYPE);
- getBrokerConfiguration().setObjectAttributes(TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER, newAttributes);
+ getBrokerConfiguration().setObjectAttributes(AuthenticationProvider.class,TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER, newAttributes);
}
}
Modified: qpid/branches/java-broker-config-store-changes/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/TrustStoreRestTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-store-changes/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/TrustStoreRestTest.java?rev=1584910&r1=1584909&r2=1584910&view=diff
==============================================================================
--- qpid/branches/java-broker-config-store-changes/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/TrustStoreRestTest.java (original)
+++ qpid/branches/java-broker-config-store-changes/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/TrustStoreRestTest.java Fri Apr 4 21:06:08 2014
@@ -26,15 +26,16 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.codehaus.jackson.JsonGenerationException;
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
+
import org.apache.qpid.server.model.Port;
import org.apache.qpid.server.model.Transport;
import org.apache.qpid.server.model.TrustStore;
import org.apache.qpid.server.security.AbstractKeyStoreAdapter;
import org.apache.qpid.test.utils.TestBrokerConfiguration;
import org.apache.qpid.test.utils.TestSSLConstants;
-import org.codehaus.jackson.JsonGenerationException;
-import org.codehaus.jackson.JsonParseException;
-import org.codehaus.jackson.map.JsonMappingException;
public class TrustStoreRestTest extends QpidRestTestCase
{
@@ -106,7 +107,7 @@ public class TrustStoreRestTest extends
sslTrustStoreAttributes.put(TrustStore.NAME, name);
sslTrustStoreAttributes.put(TrustStore.PATH, TestSSLConstants.TRUSTSTORE);
sslTrustStoreAttributes.put(TrustStore.PASSWORD, TestSSLConstants.TRUSTSTORE_PASSWORD);
- getBrokerConfiguration().addTrustStoreConfiguration(sslTrustStoreAttributes);
+ getBrokerConfiguration().addObjectConfiguration(TrustStore.class,sslTrustStoreAttributes);
//add the SSL port using it
Map<String, Object> sslPortAttributes = new HashMap<String, Object>();
@@ -116,7 +117,7 @@ public class TrustStoreRestTest extends
sslPortAttributes.put(Port.AUTHENTICATION_PROVIDER, TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER);
sslPortAttributes.put(Port.KEY_STORE, TestBrokerConfiguration.ENTRY_NAME_SSL_KEYSTORE);
sslPortAttributes.put(Port.TRUST_STORES, Collections.singleton(name));
- getBrokerConfiguration().addPortConfiguration(sslPortAttributes);
+ getBrokerConfiguration().addObjectConfiguration(Port.class, sslPortAttributes);
super.setUp();
Modified: qpid/branches/java-broker-config-store-changes/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/BrokerACLTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-store-changes/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/BrokerACLTest.java?rev=1584910&r1=1584909&r2=1584910&view=diff
==============================================================================
--- qpid/branches/java-broker-config-store-changes/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/BrokerACLTest.java (original)
+++ qpid/branches/java-broker-config-store-changes/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/BrokerACLTest.java Fri Apr 4 21:06:08 2014
@@ -27,12 +27,16 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.codehaus.jackson.JsonGenerationException;
+import org.codehaus.jackson.map.JsonMappingException;
+
import org.apache.qpid.server.management.plugin.HttpManagement;
import org.apache.qpid.server.model.AccessControlProvider;
import org.apache.qpid.server.model.AuthenticationProvider;
import org.apache.qpid.server.model.Broker;
import org.apache.qpid.server.model.GroupProvider;
import org.apache.qpid.server.model.KeyStore;
+import org.apache.qpid.server.model.Plugin;
import org.apache.qpid.server.model.Port;
import org.apache.qpid.server.model.Protocol;
import org.apache.qpid.server.model.TrustStore;
@@ -48,8 +52,6 @@ import org.apache.qpid.systest.rest.Qpid
import org.apache.qpid.test.utils.TestBrokerConfiguration;
import org.apache.qpid.test.utils.TestFileUtils;
import org.apache.qpid.test.utils.TestSSLConstants;
-import org.codehaus.jackson.JsonGenerationException;
-import org.codehaus.jackson.map.JsonMappingException;
public class BrokerACLTest extends QpidRestTestCase
{
@@ -74,7 +76,7 @@ public class BrokerACLTest extends QpidR
"ACL DENY-LOG " + DENIED_USER + " CONFIGURE BROKER\n" +
"ACL DENY-LOG ALL ALL";
- getBrokerConfiguration().setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT,
+ getBrokerConfiguration().setObjectAttribute(Plugin.class, TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT,
HttpManagement.HTTP_BASIC_AUTHENTICATION_ENABLED, true);
}
Modified: qpid/branches/java-broker-config-store-changes/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/ExchangeRestACLTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-store-changes/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/ExchangeRestACLTest.java?rev=1584910&r1=1584909&r2=1584910&view=diff
==============================================================================
--- qpid/branches/java-broker-config-store-changes/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/ExchangeRestACLTest.java (original)
+++ qpid/branches/java-broker-config-store-changes/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/ExchangeRestACLTest.java Fri Apr 4 21:06:08 2014
@@ -20,14 +20,10 @@
*/
package org.apache.qpid.systest.rest.acl;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
import org.apache.qpid.server.management.plugin.HttpManagement;
import org.apache.qpid.server.model.Binding;
import org.apache.qpid.server.model.Exchange;
+import org.apache.qpid.server.model.Plugin;
import org.apache.qpid.server.model.Queue;
import org.apache.qpid.server.security.acl.AbstractACLTestCase;
import org.apache.qpid.systest.rest.QpidRestTestCase;
@@ -35,6 +31,11 @@ import org.apache.qpid.test.utils.TestBr
import org.codehaus.jackson.JsonGenerationException;
import org.codehaus.jackson.map.JsonMappingException;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
public class ExchangeRestACLTest extends QpidRestTestCase
{
private static final String ALLOWED_USER = "user1";
@@ -61,7 +62,7 @@ public class ExchangeRestACLTest extends
"ACL DENY-LOG " + DENIED_USER + " UNBIND EXCHANGE",
"ACL DENY-LOG ALL ALL");
- getBrokerConfiguration().setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT,
+ getBrokerConfiguration().setObjectAttribute(Plugin.class, TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT,
HttpManagement.HTTP_BASIC_AUTHENTICATION_ENABLED, true);
}
Modified: qpid/branches/java-broker-config-store-changes/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/GroupRestACLTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-store-changes/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/GroupRestACLTest.java?rev=1584910&r1=1584909&r2=1584910&view=diff
==============================================================================
--- qpid/branches/java-broker-config-store-changes/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/GroupRestACLTest.java (original)
+++ qpid/branches/java-broker-config-store-changes/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/GroupRestACLTest.java Fri Apr 4 21:06:08 2014
@@ -29,6 +29,7 @@ import java.util.Properties;
import javax.servlet.http.HttpServletResponse;
import org.apache.qpid.server.management.plugin.HttpManagement;
+import org.apache.qpid.server.model.Plugin;
import org.apache.qpid.server.security.acl.AbstractACLTestCase;
import org.apache.qpid.systest.rest.QpidRestTestCase;
import org.apache.qpid.test.utils.TestBrokerConfiguration;
@@ -60,7 +61,7 @@ public class GroupRestACLTest extends Qp
protected void customizeConfiguration() throws IOException
{
super.customizeConfiguration();
- getBrokerConfiguration().setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT, HttpManagement.HTTP_BASIC_AUTHENTICATION_ENABLED, true);
+ getBrokerConfiguration().setObjectAttribute(Plugin.class, TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT, HttpManagement.HTTP_BASIC_AUTHENTICATION_ENABLED, true);
}
@Override
Modified: qpid/branches/java-broker-config-store-changes/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/LogViewerACLTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-store-changes/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/LogViewerACLTest.java?rev=1584910&r1=1584909&r2=1584910&view=diff
==============================================================================
--- qpid/branches/java-broker-config-store-changes/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/LogViewerACLTest.java (original)
+++ qpid/branches/java-broker-config-store-changes/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/LogViewerACLTest.java Fri Apr 4 21:06:08 2014
@@ -23,6 +23,7 @@ package org.apache.qpid.systest.rest.acl
import java.io.IOException;
import org.apache.qpid.server.management.plugin.HttpManagement;
+import org.apache.qpid.server.model.Plugin;
import org.apache.qpid.server.security.acl.AbstractACLTestCase;
import org.apache.qpid.systest.rest.QpidRestTestCase;
import org.apache.qpid.test.utils.TestBrokerConfiguration;
@@ -43,7 +44,7 @@ public class LogViewerACLTest extends Qp
"ACL DENY-LOG " + DENIED_USER + " ACCESS_LOGS BROKER",
"ACL DENY-LOG ALL ALL");
- getBrokerConfiguration().setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT,
+ getBrokerConfiguration().setObjectAttribute(Plugin.class, TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT,
HttpManagement.HTTP_BASIC_AUTHENTICATION_ENABLED, true);
}
Modified: qpid/branches/java-broker-config-store-changes/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/QueueRestACLTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-store-changes/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/QueueRestACLTest.java?rev=1584910&r1=1584909&r2=1584910&view=diff
==============================================================================
--- qpid/branches/java-broker-config-store-changes/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/QueueRestACLTest.java (original)
+++ qpid/branches/java-broker-config-store-changes/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/QueueRestACLTest.java Fri Apr 4 21:06:08 2014
@@ -26,6 +26,7 @@ import java.util.List;
import java.util.Map;
import org.apache.qpid.server.management.plugin.HttpManagement;
+import org.apache.qpid.server.model.Plugin;
import org.apache.qpid.server.model.Queue;
import org.apache.qpid.server.security.acl.AbstractACLTestCase;
import org.apache.qpid.systest.rest.QpidRestTestCase;
@@ -51,7 +52,7 @@ public class QueueRestACLTest extends Qp
"ACL DENY-LOG " + DENIED_USER + " DELETE QUEUE",
"ACL DENY-LOG ALL ALL");
- getBrokerConfiguration().setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT,
+ getBrokerConfiguration().setObjectAttribute(Plugin.class, TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT,
HttpManagement.HTTP_BASIC_AUTHENTICATION_ENABLED, true);
}
Modified: qpid/branches/java-broker-config-store-changes/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/UserPreferencesRestACLTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-store-changes/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/UserPreferencesRestACLTest.java?rev=1584910&r1=1584909&r2=1584910&view=diff
==============================================================================
--- qpid/branches/java-broker-config-store-changes/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/UserPreferencesRestACLTest.java (original)
+++ qpid/branches/java-broker-config-store-changes/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/UserPreferencesRestACLTest.java Fri Apr 4 21:06:08 2014
@@ -29,6 +29,7 @@ import java.util.List;
import java.util.Map;
import org.apache.qpid.server.management.plugin.HttpManagement;
+import org.apache.qpid.server.model.Plugin;
import org.apache.qpid.server.model.PreferencesProvider;
import org.apache.qpid.server.model.adapter.FileSystemPreferencesProvider;
import org.apache.qpid.server.security.acl.AbstractACLTestCase;
@@ -80,7 +81,7 @@ public class UserPreferencesRestACLTest
+ " UPDATE USER", "ACL DENY-LOG " + DENIED_USER + " UPDATE USER", "ACL DENY-LOG ALL ALL");
TestBrokerConfiguration brokerConfiguration = getBrokerConfiguration();
- brokerConfiguration.setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT,
+ brokerConfiguration.setObjectAttribute(Plugin.class, TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT,
HttpManagement.HTTP_BASIC_AUTHENTICATION_ENABLED, true);
Map<String, Object> attributes = new HashMap<String, Object>();
Modified: qpid/branches/java-broker-config-store-changes/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/UserRestACLTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-store-changes/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/UserRestACLTest.java?rev=1584910&r1=1584909&r2=1584910&view=diff
==============================================================================
--- qpid/branches/java-broker-config-store-changes/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/UserRestACLTest.java (original)
+++ qpid/branches/java-broker-config-store-changes/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/acl/UserRestACLTest.java Fri Apr 4 21:06:08 2014
@@ -28,12 +28,14 @@ import java.util.Properties;
import javax.servlet.http.HttpServletResponse;
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
+
import org.apache.qpid.server.management.plugin.HttpManagement;
+import org.apache.qpid.server.model.Plugin;
import org.apache.qpid.server.security.acl.AbstractACLTestCase;
import org.apache.qpid.systest.rest.QpidRestTestCase;
import org.apache.qpid.test.utils.TestBrokerConfiguration;
-import org.codehaus.jackson.JsonParseException;
-import org.codehaus.jackson.map.JsonMappingException;
public class UserRestACLTest extends QpidRestTestCase
{
@@ -62,7 +64,7 @@ public class UserRestACLTest extends Qpi
protected void customizeConfiguration() throws IOException
{
super.customizeConfiguration();
- getBrokerConfiguration().setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT, HttpManagement.HTTP_BASIC_AUTHENTICATION_ENABLED, true);
+ getBrokerConfiguration().setObjectAttribute(Plugin.class, TestBrokerConfiguration.ENTRY_NAME_HTTP_MANAGEMENT, HttpManagement.HTTP_BASIC_AUTHENTICATION_ENABLED, true);
}
@Override
Modified: qpid/branches/java-broker-config-store-changes/qpid/java/systests/src/main/java/org/apache/qpid/test/client/destination/AddressBasedDestinationTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-store-changes/qpid/java/systests/src/main/java/org/apache/qpid/test/client/destination/AddressBasedDestinationTest.java?rev=1584910&r1=1584909&r2=1584910&view=diff
==============================================================================
--- qpid/branches/java-broker-config-store-changes/qpid/java/systests/src/main/java/org/apache/qpid/test/client/destination/AddressBasedDestinationTest.java (original)
+++ qpid/branches/java-broker-config-store-changes/qpid/java/systests/src/main/java/org/apache/qpid/test/client/destination/AddressBasedDestinationTest.java Fri Apr 4 21:06:08 2014
@@ -20,8 +20,34 @@
*/
package org.apache.qpid.test.client.destination;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import javax.jms.Connection;
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.QueueBrowser;
+import javax.jms.QueueReceiver;
+import javax.jms.QueueSession;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.jms.Topic;
+import javax.jms.TopicSession;
+import javax.jms.TopicSubscriber;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+
import org.apache.qpid.client.AMQAnyDestination;
import org.apache.qpid.client.AMQConnection;
import org.apache.qpid.client.AMQDestination;
@@ -35,17 +61,6 @@ import org.apache.qpid.test.utils.QpidBr
import org.apache.qpid.test.utils.TestBrokerConfiguration;
import org.apache.qpid.transport.ExecutionErrorCode;
-import javax.jms.*;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
public class AddressBasedDestinationTest extends QpidBrokerTestCase
{
private static final Logger _logger = LoggerFactory.getLogger(AddressBasedDestinationTest.class);
@@ -55,7 +70,7 @@ public class AddressBasedDestinationTest
public void setUp() throws Exception
{
TestBrokerConfiguration config = getBrokerConfiguration();
- config.setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_VIRTUAL_HOST, VirtualHost.QUEUE_MAXIMUM_DELIVERY_ATTEMPTS, 0);
+ config.setObjectAttribute(VirtualHost.class, TestBrokerConfiguration.ENTRY_NAME_VIRTUAL_HOST, VirtualHost.QUEUE_MAXIMUM_DELIVERY_ATTEMPTS, 0);
super.setUp();
_connection = getConnection() ;
Modified: qpid/branches/java-broker-config-store-changes/qpid/java/systests/src/main/java/org/apache/qpid/test/client/timeouts/SyncWaitDelayTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-store-changes/qpid/java/systests/src/main/java/org/apache/qpid/test/client/timeouts/SyncWaitDelayTest.java?rev=1584910&r1=1584909&r2=1584910&view=diff
==============================================================================
--- qpid/branches/java-broker-config-store-changes/qpid/java/systests/src/main/java/org/apache/qpid/test/client/timeouts/SyncWaitDelayTest.java (original)
+++ qpid/branches/java-broker-config-store-changes/qpid/java/systests/src/main/java/org/apache/qpid/test/client/timeouts/SyncWaitDelayTest.java Fri Apr 4 21:06:08 2014
@@ -31,13 +31,14 @@ import javax.jms.MessageProducer;
import javax.jms.Queue;
import javax.jms.Session;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import org.apache.qpid.server.model.VirtualHost;
import org.apache.qpid.server.store.MessageStore;
import org.apache.qpid.server.store.SlowMessageStore;
import org.apache.qpid.test.utils.QpidBrokerTestCase;
import org.apache.qpid.test.utils.TestBrokerConfiguration;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
/**
* This tests that when the commit takes a long time(due to POST_COMMIT_DELAY) that the commit does not timeout
@@ -66,7 +67,7 @@ public class SyncWaitDelayTest extends Q
messageStoreSettings.put(SlowMessageStore.DELAYS, slowMessageStoreDelays);
TestBrokerConfiguration config = getBrokerConfiguration();
- config.setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_VIRTUAL_HOST, VirtualHost.MESSAGE_STORE_SETTINGS, messageStoreSettings);
+ config.setObjectAttribute(VirtualHost.class, TestBrokerConfiguration.ENTRY_NAME_VIRTUAL_HOST, VirtualHost.MESSAGE_STORE_SETTINGS, messageStoreSettings);
super.setUp();
Modified: qpid/branches/java-broker-config-store-changes/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-store-changes/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java?rev=1584910&r1=1584909&r2=1584910&view=diff
==============================================================================
--- qpid/branches/java-broker-config-store-changes/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java (original)
+++ qpid/branches/java-broker-config-store-changes/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/QpidBrokerTestCase.java Fri Apr 4 21:06:08 2014
@@ -17,36 +17,6 @@
*/
package org.apache.qpid.test.utils;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.PrintStream;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-
-import javax.jms.BytesMessage;
-import javax.jms.Connection;
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.MapMessage;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.ObjectMessage;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.jms.StreamMessage;
-import javax.jms.TextMessage;
-import javax.jms.Topic;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.apache.qpid.AMQException;
@@ -71,6 +41,23 @@ import org.apache.qpid.url.URLSyntaxExce
import org.apache.qpid.util.FileUtils;
import org.apache.qpid.util.SystemUtils;
+import javax.jms.*;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+import java.lang.IllegalStateException;
+
/**
* Qpid base class for system testing test cases.
*/
@@ -232,17 +219,17 @@ public class QpidBrokerTestCase extends
}
if (actualPort != DEFAULT_PORT)
{
- configuration.setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_AMQP_PORT, Port.PORT, actualPort);
- configuration.setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_RMI_PORT, Port.PORT, getManagementPort(actualPort));
- configuration.setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_JMX_PORT, Port.PORT, getManagementPort(actualPort) + JMXPORT_CONNECTORSERVER_OFFSET);
+ configuration.setObjectAttribute(Port.class, TestBrokerConfiguration.ENTRY_NAME_AMQP_PORT, Port.PORT, actualPort);
+ configuration.setObjectAttribute(Port.class, TestBrokerConfiguration.ENTRY_NAME_RMI_PORT, Port.PORT, getManagementPort(actualPort));
+ configuration.setObjectAttribute(Port.class, TestBrokerConfiguration.ENTRY_NAME_JMX_PORT, Port.PORT, getManagementPort(actualPort) + JMXPORT_CONNECTORSERVER_OFFSET);
String workDir = System.getProperty("QPID_WORK") + File.separator + TestBrokerConfiguration.ENTRY_NAME_VIRTUAL_HOST + File.separator + actualPort;
- Map<String, Object> virtualHostSettings = configuration.getObjectAttributes(TestBrokerConfiguration.ENTRY_NAME_VIRTUAL_HOST);
+ Map<String, Object> virtualHostSettings = configuration.getObjectAttributes(VirtualHost.class, TestBrokerConfiguration.ENTRY_NAME_VIRTUAL_HOST);
@SuppressWarnings("unchecked")
Map<String, Object> storeSettings = (Map<String, Object>)virtualHostSettings.get(VirtualHost.MESSAGE_STORE_SETTINGS);
storeSettings.put(MessageStore.STORE_PATH, workDir);
- configuration.setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_VIRTUAL_HOST, VirtualHost.MESSAGE_STORE_SETTINGS, storeSettings);
+ configuration.setObjectAttribute(VirtualHost.class, TestBrokerConfiguration.ENTRY_NAME_VIRTUAL_HOST, VirtualHost.MESSAGE_STORE_SETTINGS, storeSettings);
}
return configuration;
@@ -851,7 +838,7 @@ public class QpidBrokerTestCase extends
messageStoreSettings.put(MessageStore.STORE_PATH, storeDir);
attributes.put(VirtualHost.MESSAGE_STORE_SETTINGS, messageStoreSettings );
int port = getPort(brokerPort);
- getBrokerConfiguration(port).addVirtualHostConfiguration(attributes);
+ getBrokerConfiguration(port).addObjectConfiguration(VirtualHost.class, attributes);
}
/**
Modified: qpid/branches/java-broker-config-store-changes/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/TestBrokerConfiguration.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-store-changes/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/TestBrokerConfiguration.java?rev=1584910&r1=1584909&r2=1584910&view=diff
==============================================================================
--- qpid/branches/java-broker-config-store-changes/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/TestBrokerConfiguration.java (original)
+++ qpid/branches/java-broker-config-store-changes/qpid/java/systests/src/main/java/org/apache/qpid/test/utils/TestBrokerConfiguration.java Fri Apr 4 21:06:08 2014
@@ -20,24 +20,36 @@
*/
package org.apache.qpid.test.utils;
-import org.apache.qpid.server.configuration.ConfigurationEntry;
-import org.apache.qpid.server.configuration.ConfigurationEntryImpl;
-import org.apache.qpid.server.configuration.IllegalConfigurationException;
-import org.apache.qpid.server.configuration.store.MemoryConfigurationEntryStore;
-import org.apache.qpid.server.model.*;
-import org.apache.qpid.server.security.access.FileAccessControlProviderConstants;
-import org.apache.qpid.server.security.group.FileGroupManagerFactory;
-import org.apache.qpid.server.store.ConfiguredObjectRecord;
+import static org.mockito.Mockito.mock;
import java.io.File;
-import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.Map;
-import java.util.Set;
import java.util.UUID;
+import org.apache.qpid.server.BrokerOptions;
+import org.apache.qpid.server.configuration.store.MemoryConfigurationEntryStore;
+import org.apache.qpid.server.configuration.updater.TaskExecutor;
+import org.apache.qpid.server.logging.EventLogger;
+import org.apache.qpid.server.logging.LogRecorder;
+import org.apache.qpid.server.model.AccessControlProvider;
+import org.apache.qpid.server.model.AuthenticationProvider;
+import org.apache.qpid.server.model.Broker;
+import org.apache.qpid.server.model.ConfiguredObject;
+import org.apache.qpid.server.model.ConfiguredObjectFactory;
+import org.apache.qpid.server.model.GroupProvider;
+import org.apache.qpid.server.model.Plugin;
+import org.apache.qpid.server.model.PreferencesProvider;
+import org.apache.qpid.server.model.SystemContext;
+import org.apache.qpid.server.model.UUIDGenerator;
+import org.apache.qpid.server.security.access.FileAccessControlProviderConstants;
+import org.apache.qpid.server.security.group.FileGroupManagerFactory;
+import org.apache.qpid.server.store.ConfigurationRecoveryHandler;
+import org.apache.qpid.server.store.ConfiguredObjectRecord;
+import org.apache.qpid.server.store.ConfiguredObjectRecordImpl;
+import org.apache.qpid.server.store.DurableConfigurationStore;
+
public class TestBrokerConfiguration
{
public static final String ENTRY_NAME_HTTP_PORT = "http";
@@ -63,17 +75,30 @@ public class TestBrokerConfiguration
public TestBrokerConfiguration(String storeType, String intialStoreLocation)
{
- _store = new MemoryConfigurationEntryStore(intialStoreLocation, null, Collections.<String,String>emptyMap());
+ _store = new MemoryConfigurationEntryStore(new SystemContext(new TaskExecutor(), new ConfiguredObjectFactory(),
+ mock(EventLogger.class), mock(LogRecorder.class),
+ mock(BrokerOptions.class)),
+ intialStoreLocation,
+ null, Collections.<String,String>emptyMap());
}
public boolean setBrokerAttribute(String name, Object value)
{
- return setObjectAttribute(_store.getRootEntry(), name, value);
+ ConfiguredObjectRecord entry = findObject(Broker.class, null);
+ if (entry == null)
+ {
+ return false;
+ }
+
+ return setObjectAttribute(entry, name, value);
}
- public boolean setObjectAttribute(String objectName, String attributeName, Object value)
+ public boolean setObjectAttribute(final Class<? extends ConfiguredObject> category,
+ String objectName,
+ String attributeName,
+ Object value)
{
- ConfigurationEntry entry = findObjectByName(objectName);
+ ConfiguredObjectRecord entry = findObject(category, objectName);
if (entry == null)
{
return false;
@@ -81,9 +106,11 @@ public class TestBrokerConfiguration
return setObjectAttribute(entry, attributeName, value);
}
- public boolean setObjectAttributes(String objectName, Map<String, Object> attributes)
+ public boolean setObjectAttributes(final Class<? extends ConfiguredObject> category,
+ String objectName,
+ Map<String, Object> attributes)
{
- ConfigurationEntry entry = findObjectByName(objectName);
+ ConfiguredObjectRecord entry = findObject(category, objectName);
if (entry == null)
{
return false;
@@ -97,63 +124,38 @@ public class TestBrokerConfiguration
return true;
}
- public UUID[] removeObjectConfiguration(String name)
+ public UUID[] removeObjectConfiguration(final Class<? extends ConfiguredObject> category,
+ String name)
{
- final ConfigurationEntry entry = findObjectByName(name);
+ final ConfiguredObjectRecord entry = findObject(category, name);
if (entry != null)
{
- return _store.remove(new ConfiguredObjectRecord()
- {
- @Override
- public UUID getId()
- {
- return entry.getId();
- }
-
- @Override
- public String getType()
- {
- return entry.getType();
- }
-
- @Override
- public Map<String, Object> getAttributes()
- {
- return entry.getAttributes();
- }
-
- @Override
- public Map<String, ConfiguredObjectRecord> getParents()
- {
- // TODO RG : this should be rectified
- return null;
- }
- });
+ return _store.remove(entry);
}
return null;
}
- public UUID addObjectConfiguration(String name, String type, Map<String, Object> attributes)
+ public UUID addObjectConfiguration(Class<? extends ConfiguredObject> type, Map<String, Object> attributes)
{
UUID id = UUIDGenerator.generateRandomUUID();
- addObjectConfiguration(id, type, attributes);
+ addObjectConfiguration(id, type.getSimpleName(), attributes);
return id;
}
public UUID addJmxManagementConfiguration()
{
Map<String, Object> attributes = new HashMap<String, Object>();
- attributes.put(ConfiguredObject.TYPE, MANAGEMENT_JMX_PLUGIN_TYPE);
+ attributes.put(Plugin.TYPE, MANAGEMENT_JMX_PLUGIN_TYPE);
attributes.put(Plugin.NAME, ENTRY_NAME_JMX_MANAGEMENT);
- return addObjectConfiguration(ENTRY_NAME_JMX_MANAGEMENT, Plugin.class.getSimpleName(), attributes);
+ return addObjectConfiguration(Plugin.class, attributes);
}
public UUID addHttpManagementConfiguration()
{
Map<String, Object> attributes = new HashMap<String, Object>();
- attributes.put(ConfiguredObject.TYPE, MANAGEMENT_HTTP_PLUGIN_TYPE);
+ attributes.put(Plugin.TYPE, MANAGEMENT_HTTP_PLUGIN_TYPE);
attributes.put(Plugin.NAME, ENTRY_NAME_HTTP_MANAGEMENT);
- return addObjectConfiguration(ENTRY_NAME_HTTP_MANAGEMENT, Plugin.class.getSimpleName(), attributes);
+ return addObjectConfiguration(Plugin.class, attributes);
}
public UUID addGroupFileConfiguration(String groupFilePath)
@@ -163,7 +165,7 @@ public class TestBrokerConfiguration
attributes.put(GroupProvider.TYPE, FileGroupManagerFactory.GROUP_FILE_PROVIDER_TYPE);
attributes.put(FileGroupManagerFactory.PATH, groupFilePath);
- return addGroupProviderConfiguration(attributes);
+ return addObjectConfiguration(GroupProvider.class, attributes);
}
public UUID addAclFileConfiguration(String aclFilePath)
@@ -173,164 +175,104 @@ public class TestBrokerConfiguration
attributes.put(AccessControlProvider.TYPE, FileAccessControlProviderConstants.ACL_FILE_PROVIDER_TYPE);
attributes.put(FileAccessControlProviderConstants.PATH, aclFilePath);
- return addAccessControlConfiguration(attributes);
+ return addObjectConfiguration(AccessControlProvider.class, attributes);
}
- public UUID addPortConfiguration(Map<String, Object> attributes)
+ private boolean setObjectAttributes(ConfiguredObjectRecord entry, Map<String, Object> attributes)
{
- String name = (String) attributes.get(Port.NAME);
- return addObjectConfiguration(name, Port.class.getSimpleName(), attributes);
+ Map<String, Object> newAttributes = new HashMap<String, Object>(entry.getAttributes());
+ newAttributes.putAll(attributes);
+ ConfiguredObjectRecord newEntry = new ConfiguredObjectRecordImpl(entry.getId(), entry.getType(), newAttributes,
+ entry.getParents());
+ _store.update(false, newEntry);
+ return true;
}
- public UUID addVirtualHostConfiguration(Map<String, Object> attributes)
+ private ConfiguredObjectRecord findObject(final Class<? extends ConfiguredObject> category, final String objectName)
{
- String name = (String) attributes.get(VirtualHost.NAME);
- return addObjectConfiguration(name, VirtualHost.class.getSimpleName(), attributes);
+ final RecordFindingVisitor visitor = new RecordFindingVisitor(category, objectName);
+ _store.recoverConfigurationStore(visitor);
+ return visitor.getFoundRecord();
}
- public UUID addAuthenticationProviderConfiguration(Map<String, Object> attributes)
+ private void addObjectConfiguration(UUID id, String type, Map<String, Object> attributes)
{
- String name = (String) attributes.get(AuthenticationProvider.NAME);
- return addObjectConfiguration(name, AuthenticationProvider.class.getSimpleName(), attributes);
- }
+ ConfiguredObjectRecord entry = new ConfiguredObjectRecordImpl(id, type, attributes, Collections.singletonMap(Broker.class.getSimpleName(), findObject(Broker.class,null)));
- public UUID addGroupProviderConfiguration(Map<String, Object> attributes)
- {
- String name = (String) attributes.get(GroupProvider.NAME);
- return addObjectConfiguration(name, GroupProvider.class.getSimpleName(), attributes);
+ _store.update(true, entry);
}
- public UUID addAccessControlConfiguration(Map<String, Object> attributes)
+ private boolean setObjectAttribute(ConfiguredObjectRecord entry, String attributeName, Object value)
{
- String name = (String) attributes.get(AccessControlProvider.NAME);
- return addObjectConfiguration(name, AccessControlProvider.class.getSimpleName(), attributes);
+ Map<String, Object> attributes = new HashMap<String, Object>(entry.getAttributes());
+ attributes.put(attributeName, value);
+ ConfiguredObjectRecord newEntry = new ConfiguredObjectRecordImpl(entry.getId(), entry.getType(), attributes, entry.getParents());
+ _store.update(false, newEntry);
+ return true;
}
- public UUID addTrustStoreConfiguration(Map<String, Object> attributes)
+ public boolean isSaved()
{
- String name = (String) attributes.get(TrustStore.NAME);
- return addObjectConfiguration(name, TrustStore.class.getSimpleName(), attributes);
+ return _saved;
}
- public UUID addKeyStoreConfiguration(Map<String, Object> attributes)
+ public void setSaved(boolean saved)
{
- String name = (String) attributes.get(KeyStore.NAME);
- return addObjectConfiguration(name, KeyStore.class.getSimpleName(), attributes);
+ _saved = saved;
}
- private boolean setObjectAttributes(ConfigurationEntry entry, Map<String, Object> attributes)
+ public void addPreferencesProviderConfiguration(String authenticationProvider, Map<String, Object> attributes)
{
- Map<String, Object> newAttributes = new HashMap<String, Object>(entry.getAttributes());
- newAttributes.putAll(attributes);
- ConfigurationEntry newEntry = new ConfigurationEntryImpl(entry.getId(), entry.getType(), newAttributes,
- entry.getChildrenIds(), _store);
- _store.save(newEntry);
- return true;
- }
+ ConfiguredObjectRecord authProviderRecord = findObject(AuthenticationProvider.class, authenticationProvider);
+ ConfiguredObjectRecord pp = new ConfiguredObjectRecordImpl(UUIDGenerator.generateRandomUUID(),
+ PreferencesProvider.class.getSimpleName(), attributes, Collections.<String, ConfiguredObjectRecord>singletonMap(AuthenticationProvider.class.getSimpleName(),authProviderRecord));
- private ConfigurationEntry findObjectByName(String objectName)
- {
- ConfigurationEntry root = _store.getRootEntry();
- return findObjectByName(root, objectName);
+ _store.create(pp);
}
- private ConfigurationEntry findObjectByName(ConfigurationEntry entry, String objectName)
+ public Map<String,Object> getObjectAttributes(final Class<? extends ConfiguredObject> category, final String name)
{
- Map<String, Object> attributes = entry.getAttributes();
- if (attributes != null)
- {
- String name = (String) attributes.get("name");
- if (objectName.equals(name))
- {
- return entry;
- }
- }
- Set<UUID> childrenIds = entry.getChildrenIds();
- for (UUID uuid : childrenIds)
- {
- ConfigurationEntry child = _store.getEntry(uuid);
- ConfigurationEntry result = findObjectByName(child, objectName);
- if (result != null)
- {
- return result;
- }
- }
- return null;
+ return findObject(category, name).getAttributes();
}
- private void addObjectConfiguration(UUID id, String type, Map<String, Object> attributes)
+ private static class RecordFindingVisitor implements ConfigurationRecoveryHandler
{
- ConfigurationEntry entry = new ConfigurationEntryImpl(id, type, attributes, Collections.<UUID> emptySet(), _store);
- ConfigurationEntry root = _store.getRootEntry();
-
- Map<String, Collection<ConfigurationEntry>> children = root.getChildren();
+ private final Class<? extends ConfiguredObject> _category;
+ private final String _objectName;
+ public ConfiguredObjectRecord _foundRecord;
- verifyChildWithNameDoesNotExist(id, type, attributes, children);
+ public RecordFindingVisitor(final Class<? extends ConfiguredObject> category, final String objectName)
+ {
+ _category = category;
+ _objectName = objectName;
+ }
- Set<UUID> childrenIds = new HashSet<UUID>(root.getChildrenIds());
- childrenIds.add(id);
- ConfigurationEntry
- newRoot = new ConfigurationEntryImpl(root.getId(), root.getType(), root.getAttributes(), childrenIds,
- _store);
- _store.save(newRoot, entry);
- }
+ @Override
+ public void beginConfigurationRecovery(final DurableConfigurationStore store, final int configVersion)
+ {
- private void verifyChildWithNameDoesNotExist(UUID id, String type,
- Map<String, Object> attributes,
- Map<String, Collection<ConfigurationEntry>> children)
- {
- Collection<ConfigurationEntry> childrenOfType = children.get(type);
+ }
- if(childrenOfType != null)
+ @Override
+ public void configuredObject(final ConfiguredObjectRecord object)
{
- String name = (String) attributes.get("name");
- for(ConfigurationEntry ce : childrenOfType)
+ if (object.getType().equals(_category.getSimpleName())
+ && (_objectName == null
+ || _objectName.equals(object.getAttributes().get(ConfiguredObject.NAME))))
{
- Object ceName = ce.getAttributes().get("name");
- if(name.equals(ceName) && !id.equals(ce.getId()))
- {
- throw new IllegalConfigurationException("A " + type + " with name " + name + " already exists with a different ID");
- }
+ _foundRecord = object;
}
}
- }
-
- private boolean setObjectAttribute(ConfigurationEntry entry, String attributeName, Object value)
- {
- Map<String, Object> attributes = new HashMap<String, Object>(entry.getAttributes());
- attributes.put(attributeName, value);
- ConfigurationEntry
- newEntry = new ConfigurationEntryImpl(entry.getId(), entry.getType(), attributes, entry.getChildrenIds(),
- _store);
- _store.save(newEntry);
- return true;
- }
-
- public boolean isSaved()
- {
- return _saved;
- }
- public void setSaved(boolean saved)
- {
- _saved = saved;
- }
-
- public void addPreferencesProviderConfiguration(String authenticationProvider, Map<String, Object> attributes)
- {
- ConfigurationEntry pp = new ConfigurationEntryImpl(UUIDGenerator.generateRandomUUID(),
- PreferencesProvider.class.getSimpleName(), attributes, Collections.<UUID> emptySet(), _store);
- ConfigurationEntry ap = findObjectByName(authenticationProvider);
- Set<UUID> children = new HashSet<UUID>();
- children.addAll(ap.getChildrenIds());
- children.add(pp.getId());
- ConfigurationEntry
- newAp = new ConfigurationEntryImpl(ap.getId(), ap.getType(), ap.getAttributes(), children, _store);
- _store.save(newAp, pp);
- }
+ @Override
+ public int completeConfigurationRecovery()
+ {
+ return 0;
+ }
- public Map<String, Object> getObjectAttributes(String name)
- {
- return findObjectByName(name).getAttributes();
+ public ConfiguredObjectRecord getFoundRecord()
+ {
+ return _foundRecord;
+ }
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org