You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ri...@apache.org on 2007/04/24 11:02:04 UTC
svn commit: r531842 [2/2] - in /incubator/qpid/trunk/qpid: ./
java/broker/src/main/java/org/apache/qpid/server/
java/broker/src/main/java/org/apache/qpid/server/exchange/
java/broker/src/main/java/org/apache/qpid/server/filter/
java/broker/src/main/jav...
Modified: incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/EditAttribute.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/EditAttribute.java?view=diff&rev=531842&r1=531841&r2=531842
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/EditAttribute.java (original)
+++ incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/EditAttribute.java Tue Apr 24 02:01:58 2007
@@ -20,22 +20,16 @@
*/
package org.apache.qpid.management.ui.actions;
-import org.apache.qpid.management.ui.ApplicationWorkbenchAdvisor;
+import static org.apache.qpid.management.ui.Constants.ACTION_EDITATTRIBUTE;
import org.apache.qpid.management.ui.exceptions.InfoRequiredException;
import org.apache.qpid.management.ui.views.MBeanView;
import org.apache.qpid.management.ui.views.ViewUtility;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-public class EditAttribute implements IWorkbenchWindowActionDelegate
-{
- private IWorkbenchWindow _window;
-
+public class EditAttribute extends AbstractAction implements IWorkbenchWindowActionDelegate
+{
public void run(IAction action)
{
if(_window != null)
@@ -47,13 +41,11 @@
}
catch(InfoRequiredException ex)
{
- ViewUtility.popupInfoMessage("Edit Attribute", ex.getMessage());
+ ViewUtility.popupInfoMessage(ACTION_EDITATTRIBUTE, ex.getMessage());
}
catch(Exception ex)
{
- IStatus status = new Status(IStatus.ERROR, ApplicationWorkbenchAdvisor.PERSPECTIVE_ID,
- IStatus.OK, ex.getMessage(), ex.getCause());
- ErrorDialog.openError(_window.getShell(), "Error", "Attribute could not be edited", status);
+ handleException(ex, "Attribute could not be edited", null);
}
}
}
@@ -74,14 +66,6 @@
* @see IWorkbenchWindowActionDelegate#dispose
*/
public void dispose() {
- }
-
- /**
- * We will cache window object in order to
- * be able to provide parent shell for the message dialog.
- * @see IWorkbenchWindowActionDelegate#init
- */
- public void init(IWorkbenchWindow window) {
- this._window = window;
+
}
}
Modified: incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/ReconnectServer.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/ReconnectServer.java?view=diff&rev=531842&r1=531841&r2=531842
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/ReconnectServer.java (original)
+++ incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/ReconnectServer.java Tue Apr 24 02:01:58 2007
@@ -20,19 +20,20 @@
*/
package org.apache.qpid.management.ui.actions;
-import static org.apache.qpid.management.ui.Constants.*;
+import static org.apache.qpid.management.ui.Constants.ACTION_LOGIN;
+import static org.apache.qpid.management.ui.Constants.CONSOLE_IMAGE;
+import static org.apache.qpid.management.ui.Constants.INFO_PASSWORD;
+import static org.apache.qpid.management.ui.Constants.INFO_USERNAME;
+import static org.apache.qpid.management.ui.Constants.PASSWORD;
+import static org.apache.qpid.management.ui.Constants.USERNAME;
import org.apache.qpid.management.ui.ApplicationRegistry;
-import org.apache.qpid.management.ui.ApplicationWorkbenchAdvisor;
import org.apache.qpid.management.ui.Constants;
import org.apache.qpid.management.ui.exceptions.InfoRequiredException;
import org.apache.qpid.management.ui.views.NavigationView;
import org.apache.qpid.management.ui.views.TreeObject;
import org.apache.qpid.management.ui.views.ViewUtility;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
@@ -40,18 +41,15 @@
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-public class ReconnectServer implements IWorkbenchWindowActionDelegate
+public class ReconnectServer extends AbstractAction implements IWorkbenchWindowActionDelegate
{
- private IWorkbenchWindow _window;
private NavigationView _navigationView;
private String _title;
private String _serverName;
@@ -80,16 +78,6 @@
{
}
-
- /**
- * We will cache window object in order to
- * be able to provide parent shell for the message dialog.
- * @see IWorkbenchWindowActionDelegate#init
- */
- public void init(IWorkbenchWindow window)
- {
- this._window = window;
- }
private NavigationView getNavigationView()
{
@@ -126,11 +114,9 @@
{
ViewUtility.popupInfoMessage("Reconnect Qpid server", ex.getMessage());
}
- catch(Exception ex)
+ catch (Exception ex)
{
- IStatus status = new Status(IStatus.ERROR, ApplicationWorkbenchAdvisor.PERSPECTIVE_ID,
- IStatus.OK, ex.getMessage(), ex.getCause());
- ErrorDialog.openError(_window.getShell(), "Error", ERROR_SERVER_CONNECTION, status);
+ handleException(ex, null, null);
}
}
}
Modified: incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/Refresh.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/Refresh.java?view=diff&rev=531842&r1=531841&r2=531842
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/Refresh.java (original)
+++ incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/Refresh.java Tue Apr 24 02:01:58 2007
@@ -25,17 +25,14 @@
import org.apache.qpid.management.ui.views.NavigationView;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
/**
* This action refreshes both the views -Navigation and MBeanView
* @author Bhupendra Bhardwaj
*/
-public class Refresh implements IWorkbenchWindowActionDelegate
+public class Refresh extends AbstractAction implements IWorkbenchWindowActionDelegate
{
- private IWorkbenchWindow _window;
-
/**
* Selection in the workbench has been changed. We
* can change the state of the 'real' action here
@@ -56,16 +53,6 @@
public void dispose()
{
- }
-
- /**
- * We will cache window object in order to
- * be able to provide parent shell for the message dialog.
- * @see IWorkbenchWindowActionDelegate#init
- */
- public void init(IWorkbenchWindow window)
- {
- this._window = window;
}
public void run(IAction action)
Modified: incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/RemoveServer.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/RemoveServer.java?view=diff&rev=531842&r1=531841&r2=531842
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/RemoveServer.java (original)
+++ incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/RemoveServer.java Tue Apr 24 02:01:58 2007
@@ -20,22 +20,15 @@
*/
package org.apache.qpid.management.ui.actions;
-import org.apache.qpid.management.ui.ApplicationWorkbenchAdvisor;
import org.apache.qpid.management.ui.exceptions.InfoRequiredException;
import org.apache.qpid.management.ui.views.NavigationView;
import org.apache.qpid.management.ui.views.ViewUtility;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-public class RemoveServer implements IWorkbenchWindowActionDelegate
-{
- private IWorkbenchWindow _window;
-
+public class RemoveServer extends AbstractAction implements IWorkbenchWindowActionDelegate
+{
/**
* Selection in the workbench has been changed. We
* can change the state of the 'real' action here
@@ -57,16 +50,6 @@
{
}
-
- /**
- * We will cache window object in order to
- * be able to provide parent shell for the message dialog.
- * @see IWorkbenchWindowActionDelegate#init
- */
- public void init(IWorkbenchWindow window)
- {
- this._window = window;
- }
public void run(IAction action)
{
@@ -83,9 +66,7 @@
}
catch(Exception ex)
{
- IStatus status = new Status(IStatus.ERROR, ApplicationWorkbenchAdvisor.PERSPECTIVE_ID,
- IStatus.OK, ex.getMessage(), ex.getCause());
- ErrorDialog.openError(_window.getShell(), "Error", "Server could not be removed", status);
+ handleException(ex, "Server could not be removed", null);
}
}
}
Modified: incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/MBeanUtility.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/MBeanUtility.java?view=diff&rev=531842&r1=531841&r2=531842
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/MBeanUtility.java (original)
+++ incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/jmx/MBeanUtility.java Tue Apr 24 02:01:58 2007
@@ -20,7 +20,6 @@
*/
package org.apache.qpid.management.ui.jmx;
-import java.io.IOException;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
@@ -149,11 +148,6 @@
ViewUtility.popupErrorMessage("Error", "Managed Object is null \n" + ex.toString());
printStackTrace(ex);
}
- else if (ex instanceof IOException)
- {
- ViewUtility.popupErrorMessage(mbean.getInstanceName(), "IO Error occured \n" + ex.toString());
- printStackTrace(ex);
- }
else if (ex instanceof ReflectionException)
{
ViewUtility.popupErrorMessage(mbean.getInstanceName(), "Server has thrown error \n" + ex.toString());
@@ -462,7 +456,7 @@
}
}
- private static void printStackTrace(Throwable ex)
+ public static void printStackTrace(Throwable ex)
{
if (ApplicationRegistry.debug)
{
Modified: incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/AttributesTabControl.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/AttributesTabControl.java?view=diff&rev=531842&r1=531841&r2=531842
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/AttributesTabControl.java (original)
+++ incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/AttributesTabControl.java Tue Apr 24 02:01:58 2007
@@ -21,6 +21,7 @@
package org.apache.qpid.management.ui.views;
import static org.apache.qpid.management.ui.Constants.*;
+
import org.apache.qpid.management.ui.ApplicationRegistry;
import org.apache.qpid.management.ui.ManagedBean;
import org.apache.qpid.management.ui.jmx.JMXServerRegistry;
@@ -51,8 +52,6 @@
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.VerifyEvent;
-import org.eclipse.swt.events.VerifyListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;
Modified: incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanTypeTabControl.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanTypeTabControl.java?view=diff&rev=531842&r1=531841&r2=531842
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanTypeTabControl.java (original)
+++ incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanTypeTabControl.java Tue Apr 24 02:01:58 2007
@@ -1,9 +1,13 @@
package org.apache.qpid.management.ui.views;
+import static org.apache.qpid.management.ui.Constants.BUTTON_REFRESH;
+import static org.apache.qpid.management.ui.Constants.FONT_BOLD;
+import static org.apache.qpid.management.ui.Constants.FONT_ITALIC;
+import static org.apache.qpid.management.ui.Constants.FONT_NORMAL;
+
import java.util.Collections;
import java.util.HashMap;
-import static org.apache.qpid.management.ui.Constants.*;
import org.apache.qpid.management.ui.ApplicationRegistry;
import org.apache.qpid.management.ui.ManagedBean;
import org.apache.qpid.management.ui.jmx.MBeanUtility;
Modified: incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NavigationView.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NavigationView.java?view=diff&rev=531842&r1=531841&r2=531842
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NavigationView.java (original)
+++ incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NavigationView.java Tue Apr 24 02:01:58 2007
@@ -20,6 +20,8 @@
*/
package org.apache.qpid.management.ui.views;
+import static org.apache.qpid.management.ui.Constants.*;
+
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
@@ -27,14 +29,12 @@
import java.util.List;
import org.apache.qpid.management.ui.ApplicationRegistry;
-import static org.apache.qpid.management.ui.Constants.*;
import org.apache.qpid.management.ui.ManagedBean;
import org.apache.qpid.management.ui.ManagedServer;
import org.apache.qpid.management.ui.ServerRegistry;
import org.apache.qpid.management.ui.exceptions.InfoRequiredException;
import org.apache.qpid.management.ui.jmx.JMXServerRegistry;
import org.apache.qpid.management.ui.jmx.MBeanUtility;
-
import org.eclipse.jface.preference.PreferenceStore;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
@@ -48,7 +48,6 @@
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerSorter;
-
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;
@@ -63,7 +62,6 @@
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeItem;
-
import org.eclipse.ui.part.ViewPart;
/**
@@ -216,10 +214,9 @@
ServerRegistry serverRegistry = new JMXServerRegistry(server);
ApplicationRegistry.addServer(server, serverRegistry);
}
- catch (Exception ex)
+ catch (IOException ex)
{
- ex.printStackTrace();
- throw new Exception("Error in connecting to Qpid broker at " + server.getUrl(), ex);
+ throw (Exception)ex.getCause();
}
}
@@ -274,7 +271,15 @@
_managedServerMap.put(managedServer, serverNode);
// populate the server tree
- populateServer(serverNode);
+ try
+ {
+ populateServer(serverNode);
+ }
+ catch (SecurityException ex)
+ {
+ disconnect(managedServer);
+ throw ex;
+ }
// Add the Queue/Exchanges/Connections from config file into the navigation tree
addConfiguredItems(managedServer);
@@ -413,38 +418,30 @@
* the given server node.
* @param serverNode
*/
- private void populateServer(TreeObject serverNode)
+ private void populateServer(TreeObject serverNode) throws Exception
{
ManagedServer server = (ManagedServer) serverNode.getManagedObject();
String domain = server.getDomain();
- try
+ if (!domain.equals(ALL))
+ {
+ TreeObject domainNode = new TreeObject(domain, NODE_TYPE_DOMAIN);
+ domainNode.setParent(serverNode);
+
+ populateDomain(domainNode);
+ }
+ else
{
- if (!domain.equals(ALL))
+ List<TreeObject> domainList = new ArrayList<TreeObject>();
+ List<String> domains = MBeanUtility.getAllDomains(server);
+
+ for (String domainName : domains)
{
- TreeObject domainNode = new TreeObject(domain, NODE_TYPE_DOMAIN);
+ TreeObject domainNode = new TreeObject(domainName, NODE_TYPE_DOMAIN);
domainNode.setParent(serverNode);
+ domainList.add(domainNode);
populateDomain(domainNode);
}
- else
- {
- List<TreeObject> domainList = new ArrayList<TreeObject>();
- List<String> domains = MBeanUtility.getAllDomains(server);
- ;
- for (String domainName : domains)
- {
- TreeObject domainNode = new TreeObject(domainName, NODE_TYPE_DOMAIN);
- domainNode.setParent(serverNode);
-
- domainList.add(domainNode);
- populateDomain(domainNode);
- }
- }
- }
- catch (Exception ex)
- {
- System.out.println("\nError in connecting to Qpid broker ");
- ex.printStackTrace();
}
}
@@ -726,6 +723,11 @@
{
TreeObject selectedNode = getSelectedServerNode();
ManagedServer managedServer = (ManagedServer) selectedNode.getManagedObject();
+ disconnect(managedServer);
+ }
+
+ private void disconnect(ManagedServer managedServer) throws Exception
+ {
if (!_managedServerMap.containsKey(managedServer))
{
return;
@@ -763,8 +765,17 @@
// put the server in the managed server map
_managedServerMap.put(managedServer, selectedNode);
- // populate the server tree now
- populateServer(selectedNode);
+ try
+ {
+ // populate the server tree now
+ populateServer(selectedNode);
+ }
+ catch (SecurityException ex)
+ {
+ disconnect(managedServer);
+ throw ex;
+ }
+
// Add the Queue/Exchanges/Connections from config file into the navigation tree
addConfiguredItems(managedServer);
Modified: incubator/qpid/trunk/qpid/java/systests/pom.xml
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/systests/pom.xml?view=diff&rev=531842&r1=531841&r2=531842
==============================================================================
--- incubator/qpid/trunk/qpid/java/systests/pom.xml (original)
+++ incubator/qpid/trunk/qpid/java/systests/pom.xml Tue Apr 24 02:01:58 2007
@@ -62,7 +62,8 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
- <skip>true</skip>
+ <testSourceDirectory>${basedir}/src/main</testSourceDirectory>
+ <testClassesDirectory>target/classes</testClassesDirectory>
</configuration>
</plugin>
@@ -89,3 +90,4 @@
</resources>
</build>
</project>
+
Modified: incubator/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/ack/TxAckTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/ack/TxAckTest.java?view=diff&rev=531842&r1=531841&r2=531842
==============================================================================
--- incubator/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/ack/TxAckTest.java (original)
+++ incubator/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/ack/TxAckTest.java Tue Apr 24 02:01:58 2007
@@ -24,6 +24,8 @@
import org.apache.qpid.AMQException;
import org.apache.qpid.framing.BasicPublishBody;
import org.apache.qpid.framing.AMQShortString;
+import org.apache.qpid.framing.ContentHeaderBody;
+import org.apache.qpid.framing.AMQFrameDecodingException;
import org.apache.qpid.framing.abstraction.MessagePublishInfo;
import org.apache.qpid.server.RequiredDeliveryException;
import org.apache.qpid.server.queue.AMQMessage;
@@ -102,7 +104,7 @@
_storeContext, null,
new LinkedList<RequiredDeliveryException>(),
new HashSet<Long>());
- for(int i = 0; i < messageCount; i++)
+ for (int i = 0; i < messageCount; i++)
{
long deliveryTag = i + 1;
@@ -144,7 +146,7 @@
private void assertCount(List<Long> tags, int expected)
{
- for(long tag : tags)
+ for (long tag : tags)
{
UnacknowledgedMessage u = _map.get(tag);
assertTrue("Message not found for tag " + tag, u != null);
@@ -161,6 +163,7 @@
assertCount(_unacked, 0);
}
+
void undoPrepare()
{
_op.consolidate();
@@ -175,7 +178,6 @@
_op.consolidate();
_op.commit(_storeContext);
-
//check acked messages are removed from map
Set<Long> keys = new HashSet<Long>(_map.getDeliveryTags());
keys.retainAll(_acked);
@@ -195,6 +197,20 @@
TestMessage(long tag, long messageId, MessagePublishInfo publishBody, TransactionalContext txnContext)
{
super(messageId, publishBody, txnContext);
+ try
+ {
+ setContentHeaderBody(new ContentHeaderBody()
+ {
+ public int getSize()
+ {
+ return 1;
+ }
+ });
+ }
+ catch (AMQException e)
+ {
+ // won't happen
+ }
_tag = tag;
}
Modified: incubator/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/exchange/ReturnUnroutableMandatoryMessageTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/exchange/ReturnUnroutableMandatoryMessageTest.java?view=diff&rev=531842&r1=531841&r2=531842
==============================================================================
--- incubator/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/exchange/ReturnUnroutableMandatoryMessageTest.java (original)
+++ incubator/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/exchange/ReturnUnroutableMandatoryMessageTest.java Tue Apr 24 02:01:58 2007
@@ -22,6 +22,8 @@
private static final Logger _logger = Logger.getLogger(ReturnUnroutableMandatoryMessageTest.class);
private final List<Message> _bouncedMessageList = Collections.synchronizedList(new ArrayList<Message>());
+ private static final String VIRTUALHOST = "test";
+ private static final String BROKER = "vm://:1";
static
{
@@ -53,10 +55,10 @@
*
* @throws Exception
*/
- public void testReturnUnroutableMandatoryMessage() throws Exception
+ public void testReturnUnroutableMandatoryMessage_HEADERS() throws Exception
{
_bouncedMessageList.clear();
- Connection con = new AMQConnection("vm://:1", "guest", "guest", "consumer1", "/test");
+ Connection con = new AMQConnection(BROKER, "guest", "guest", "consumer1", VIRTUALHOST);
AMQSession consumerSession = (AMQSession) con.createSession(false, Session.CLIENT_ACKNOWLEDGE);
@@ -70,7 +72,7 @@
//((AMQSession) consumerSession).declareExchangeSynch(ExchangeDefaults.HEADERS_EXCHANGE_NAME, ExchangeDefaults.HEADERS_EXCHANGE_CLASS);
// This is the default now
- Connection con2 = new AMQConnection("vm://:1", "guest", "guest", "producer1", "/test");
+ Connection con2 = new AMQConnection(BROKER, "guest", "guest", "producer1", VIRTUALHOST);
con2.setExceptionListener(this);
AMQSession producerSession = (AMQSession) con2.createSession(false, Session.CLIENT_ACKNOWLEDGE);
@@ -126,6 +128,138 @@
}
+
+ public void testReturnUnroutableMandatoryMessage_QUEUE() throws Exception
+ {
+ _bouncedMessageList.clear();
+ Connection con = new AMQConnection(BROKER, "guest", "guest", "consumer1", VIRTUALHOST);
+
+
+ AMQSession consumerSession = (AMQSession) con.createSession(false, Session.CLIENT_ACKNOWLEDGE);
+
+ AMQQueue valid_queue = new AMQQueue(ExchangeDefaults.DIRECT_EXCHANGE_CLASS, "testReturnUnroutableMandatoryMessage_QUEUE");
+ AMQQueue invalid_queue = new AMQQueue(ExchangeDefaults.DIRECT_EXCHANGE_CLASS, "testReturnUnroutableMandatoryMessage_QUEUE_INVALID");
+ MessageConsumer consumer = consumerSession.createConsumer(valid_queue);
+
+ //force synch to ensure the consumer has resulted in a bound queue
+ //((AMQSession) consumerSession).declareExchangeSynch(ExchangeDefaults.HEADERS_EXCHANGE_NAME, ExchangeDefaults.HEADERS_EXCHANGE_CLASS);
+ // This is the default now
+
+ Connection con2 = new AMQConnection(BROKER, "guest", "guest", "producer1", VIRTUALHOST);
+
+ con2.setExceptionListener(this);
+ AMQSession producerSession = (AMQSession) con2.createSession(false, Session.CLIENT_ACKNOWLEDGE);
+
+ // Need to start the "producer" connection in order to receive bounced messages
+ _logger.info("Starting producer connection");
+ con2.start();
+
+
+ MessageProducer nonMandatoryProducer = producerSession.createProducer(valid_queue, false, false);
+ MessageProducer mandatoryProducer = producerSession.createProducer(invalid_queue);
+
+ // First test - should be routed
+ _logger.info("Sending non-mandatory message");
+ TextMessage msg1 = producerSession.createTextMessage("msg1");
+ nonMandatoryProducer.send(msg1);
+
+ // Second test - should be bounced
+ _logger.info("Sending non-routable mandatory message");
+ TextMessage msg2 = producerSession.createTextMessage("msg2");
+ mandatoryProducer.send(msg2);
+
+
+ _logger.info("Starting consumer connection");
+ con.start();
+ TextMessage tm = (TextMessage) consumer.receive(1000L);
+
+ assertTrue("No message routed to receiver", tm != null);
+ assertTrue("Wrong message routed to receiver: " + tm.getText(), "msg1".equals(tm.getText()));
+
+ try
+ {
+ Thread.sleep(1000L);
+ }
+ catch (InterruptedException e)
+ {
+ ;
+ }
+
+ assertTrue("Wrong number of messages bounced (expect 1): " + _bouncedMessageList.size(), _bouncedMessageList.size() == 1);
+ Message m = _bouncedMessageList.get(0);
+ assertTrue("Wrong message bounced: " + m.toString(), m.toString().contains("msg2"));
+
+
+ con.close();
+ con2.close();
+ }
+
+
+ public void testReturnUnroutableMandatoryMessage_TOPIC() throws Exception
+ {
+ _bouncedMessageList.clear();
+ Connection con = new AMQConnection(BROKER, "guest", "guest", "consumer1", VIRTUALHOST);
+
+
+ AMQSession consumerSession = (AMQSession) con.createSession(false, Session.CLIENT_ACKNOWLEDGE);
+
+ AMQTopic valid_topic = new AMQTopic(ExchangeDefaults.TOPIC_EXCHANGE_CLASS, "test.Return.Unroutable.Mandatory.Message.TOPIC");
+ AMQTopic invalid_topic = new AMQTopic(ExchangeDefaults.TOPIC_EXCHANGE_CLASS, "test.Return.Unroutable.Mandatory.Message.TOPIC.invalid");
+ MessageConsumer consumer = consumerSession.createConsumer(valid_topic);
+
+ //force synch to ensure the consumer has resulted in a bound queue
+ //((AMQSession) consumerSession).declareExchangeSynch(ExchangeDefaults.HEADERS_EXCHANGE_NAME, ExchangeDefaults.HEADERS_EXCHANGE_CLASS);
+ // This is the default now
+
+ Connection con2 = new AMQConnection(BROKER, "guest", "guest", "producer1", VIRTUALHOST);
+
+ con2.setExceptionListener(this);
+ AMQSession producerSession = (AMQSession) con2.createSession(false, Session.CLIENT_ACKNOWLEDGE);
+
+ // Need to start the "producer" connection in order to receive bounced messages
+ _logger.info("Starting producer connection");
+ con2.start();
+
+
+ MessageProducer nonMandatoryProducer = producerSession.createProducer(valid_topic, false, false);
+ MessageProducer mandatoryProducer = producerSession.createProducer(invalid_topic);
+
+ // First test - should be routed
+ _logger.info("Sending non-mandatory message");
+ TextMessage msg1 = producerSession.createTextMessage("msg1");
+ nonMandatoryProducer.send(msg1);
+
+ // Second test - should be bounced
+ _logger.info("Sending non-routable mandatory message");
+ TextMessage msg2 = producerSession.createTextMessage("msg2");
+ mandatoryProducer.send(msg2);
+
+
+ _logger.info("Starting consumer connection");
+ con.start();
+ TextMessage tm = (TextMessage) consumer.receive(1000L);
+
+ assertTrue("No message routed to receiver", tm != null);
+ assertTrue("Wrong message routed to receiver: " + tm.getText(), "msg1".equals(tm.getText()));
+
+ try
+ {
+ Thread.sleep(1000L);
+ }
+ catch (InterruptedException e)
+ {
+ ;
+ }
+
+ assertTrue("Wrong number of messages bounced (expect 1): " + _bouncedMessageList.size(), _bouncedMessageList.size() == 1);
+ Message m = _bouncedMessageList.get(0);
+ assertTrue("Wrong message bounced: " + m.toString(), m.toString().contains("msg2"));
+
+
+ con.close();
+ con2.close();
+ }
+
public static junit.framework.Test suite()
{
Modified: incubator/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/failure/HeapExhaustion.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/failure/HeapExhaustion.java?view=diff&rev=531842&r1=531841&r2=531842
==============================================================================
--- incubator/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/failure/HeapExhaustion.java (original)
+++ incubator/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/failure/HeapExhaustion.java Tue Apr 24 02:01:58 2007
@@ -16,7 +16,7 @@
{
private static final Logger _logger = Logger.getLogger(HeapExhaustion.class);
- protected QpidClientConnection conn;
+ protected QpidClientConnection conn;
protected final String BROKER = "localhost";
protected final String vhost = "/test";
protected final String queue = "direct://amq.direct//queue";
@@ -65,7 +65,7 @@
conn.put(queue, payload, 1);
copies++;
total += size;
- _logger.info("put copy " + copies + " OK for total bytes: " + total);
+ System.out.println("put copy " + copies + " OK for total bytes: " + total);
}
}
@@ -85,7 +85,7 @@
conn.put(queue, payload, 1);
copies++;
total += size;
- _logger.debug("put copy " + copies + " OK for total bytes: " + total);
+ System.out.println("put copy " + copies + " OK for total bytes: " + total);
Thread.sleep(200);
}
}
Modified: incubator/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/MessageTestHelper.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/MessageTestHelper.java?view=diff&rev=531842&r1=531841&r2=531842
==============================================================================
--- incubator/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/MessageTestHelper.java (original)
+++ incubator/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/queue/MessageTestHelper.java Tue Apr 24 02:01:58 2007
@@ -29,6 +29,7 @@
import org.apache.qpid.server.store.StoreContext;
import org.apache.qpid.server.registry.ApplicationRegistry;
import org.apache.qpid.server.util.TestApplicationRegistry;
+import org.apache.qpid.server.util.NullApplicationRegistry;
import org.apache.qpid.server.txn.TransactionalContext;
import org.apache.qpid.server.txn.NonTransactionalContext;
import org.apache.qpid.server.RequiredDeliveryException;
@@ -51,7 +52,7 @@
MessageTestHelper() throws Exception
{
- ApplicationRegistry.initialise(new TestApplicationRegistry());
+ ApplicationRegistry.initialise(new NullApplicationRegistry());
}
AMQMessage message() throws AMQException
Modified: incubator/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/VMTestCase.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/VMTestCase.java?view=diff&rev=531842&r1=531841&r2=531842
==============================================================================
--- incubator/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/VMTestCase.java (original)
+++ incubator/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/VMTestCase.java Tue Apr 24 02:01:58 2007
@@ -114,4 +114,9 @@
TransportConnection.killVMBroker(1);
super.tearDown();
}
+
+ public void testDummyinVMTestCase()
+ {
+ // keep maven happy
+ }
}
Modified: incubator/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserTest.java?view=diff&rev=531842&r1=531841&r2=531842
==============================================================================
--- incubator/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserTest.java (original)
+++ incubator/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserTest.java Tue Apr 24 02:01:58 2007
@@ -20,8 +20,8 @@
*/
package org.apache.qpid.test.client;
-import org.apache.qpid.test.VMTestCase;
import org.apache.log4j.Logger;
+import org.apache.qpid.test.VMTestCase;
import javax.jms.Queue;
import javax.jms.ConnectionFactory;
@@ -36,6 +36,8 @@
import javax.jms.Message;
import java.util.Enumeration;
+import junit.framework.TestCase;
+
public class QueueBrowserTest extends VMTestCase
{
private static final Logger _logger = Logger.getLogger(QueueBrowserTest.class);
@@ -87,7 +89,7 @@
*
*/
- public void queueBrowserMsgsRemainOnQueueTest() throws JMSException
+ public void testQueueBrowserMsgsRemainOnQueue() throws JMSException
{
// create QueueBrowser