You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ro...@apache.org on 2012/04/05 18:04:16 UTC
svn commit: r1309918 [6/10] - in /qpid/trunk/qpid/java: ./ perftests/
perftests/etc/ perftests/example/ perftests/example/brokerconfig/
perftests/src/ perftests/src/main/ perftests/src/main/java/
perftests/src/main/java/org/ perftests/src/main/java/org...
Added: qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ConsumerParticipantResult.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ConsumerParticipantResult.java?rev=1309918&view=auto
==============================================================================
--- qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ConsumerParticipantResult.java (added)
+++ qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ConsumerParticipantResult.java Thu Apr 5 16:04:10 2012
@@ -0,0 +1,118 @@
+/*
+ * 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.disttest.message;
+
+import static org.apache.qpid.disttest.message.ParticipantAttribute.IS_BROWSIING_SUBSCRIPTION;
+import static org.apache.qpid.disttest.message.ParticipantAttribute.IS_DURABLE_SUBSCRIPTION;
+import static org.apache.qpid.disttest.message.ParticipantAttribute.IS_NO_LOCAL;
+import static org.apache.qpid.disttest.message.ParticipantAttribute.IS_SELECTOR;
+import static org.apache.qpid.disttest.message.ParticipantAttribute.IS_SYNCHRONOUS_CONSUMER;
+import static org.apache.qpid.disttest.message.ParticipantAttribute.IS_TOPIC;
+
+public class ConsumerParticipantResult extends ParticipantResult
+{
+ private boolean _topic;
+ private boolean _durableSubscription;
+ private boolean _browsingSubscription;
+ private boolean _selector;
+ private boolean _noLocal;
+ private boolean _synchronousConsumer;
+
+ public ConsumerParticipantResult()
+ {
+ super(CommandType.CONSUMER_PARTICIPANT_RESULT);
+ }
+
+ public ConsumerParticipantResult(String participantName)
+ {
+ this();
+ setParticipantName(participantName);
+ }
+
+ @OutputAttribute(attribute=IS_DURABLE_SUBSCRIPTION)
+ public boolean isDurableSubscription()
+ {
+ return _durableSubscription;
+ }
+
+ public void setDurableSubscription(boolean durable)
+ {
+ _durableSubscription = durable;
+ }
+
+
+ @OutputAttribute(attribute=IS_BROWSIING_SUBSCRIPTION)
+ public boolean isBrowsingSubscription()
+ {
+ return _browsingSubscription;
+ }
+
+ public void setBrowsingSubscription(boolean browsingSubscription)
+ {
+ _browsingSubscription = browsingSubscription;
+ }
+
+
+ @OutputAttribute(attribute=IS_SELECTOR)
+ public boolean isSelector()
+ {
+ return _selector;
+ }
+
+ public void setSelector(boolean selector)
+ {
+ _selector = selector;
+ }
+
+
+ @OutputAttribute(attribute=IS_NO_LOCAL)
+ public boolean isNoLocal()
+ {
+ return _noLocal;
+
+ }
+
+ public void setNoLocal(boolean noLocal)
+ {
+ _noLocal = noLocal;
+ }
+
+ @OutputAttribute(attribute=IS_SYNCHRONOUS_CONSUMER)
+ public boolean isSynchronousConsumer()
+ {
+ return _synchronousConsumer;
+ }
+
+ public void setSynchronousConsumer(boolean synchronousConsumer)
+ {
+ _synchronousConsumer = synchronousConsumer;
+ }
+
+
+ public void setTopic(boolean isTopic)
+ {
+ _topic = isTopic;
+ }
+
+ @OutputAttribute(attribute=IS_TOPIC)
+ public boolean isTopic()
+ {
+ return _topic;
+ }
+}
Added: qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateConnectionCommand.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateConnectionCommand.java?rev=1309918&view=auto
==============================================================================
--- qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateConnectionCommand.java (added)
+++ qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateConnectionCommand.java Thu Apr 5 16:04:10 2012
@@ -0,0 +1,58 @@
+/*
+ * 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.disttest.message;
+
+public class CreateConnectionCommand extends Command
+{
+ private String _connectionName;
+ private String _connectionFactoryName;
+
+ public CreateConnectionCommand()
+ {
+ super(CommandType.CREATE_CONNECTION);
+ }
+
+ public CreateConnectionCommand(String connectionName, String connectionFactoryName)
+ {
+ super(CommandType.CREATE_CONNECTION);
+ _connectionName = connectionName;
+ _connectionFactoryName = connectionFactoryName;
+ }
+
+ public void setConnectionName(final String connectionName)
+ {
+ this._connectionName = connectionName;
+ }
+
+ public String getConnectionName()
+ {
+ return _connectionName;
+ }
+
+ public void setConnectionFactoryName(final String connectionFactoryName)
+ {
+ this._connectionFactoryName = connectionFactoryName;
+ }
+
+ public String getConnectionFactoryName()
+ {
+ return _connectionFactoryName;
+ }
+}
Added: qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateConsumerCommand.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateConsumerCommand.java?rev=1309918&view=auto
==============================================================================
--- qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateConsumerCommand.java (added)
+++ qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateConsumerCommand.java Thu Apr 5 16:04:10 2012
@@ -0,0 +1,108 @@
+/*
+ * 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.disttest.message;
+
+public class CreateConsumerCommand extends CreateParticpantCommand
+{
+ private boolean _isTopic;
+ private boolean _isDurableSubscription;
+ private boolean _isBrowsingSubscription;
+ private String _selector;
+ private boolean _noLocal;
+ private boolean _synchronous;
+ private long _receiveTimeout = 5000;
+
+
+ public CreateConsumerCommand()
+ {
+ super(CommandType.CREATE_CONSUMER);
+ }
+
+ public boolean isDurableSubscription()
+ {
+ return _isDurableSubscription;
+ }
+
+ public void setDurableSubscription(final boolean isDurableSubscription)
+ {
+ this._isDurableSubscription = isDurableSubscription;
+ }
+
+ public boolean isBrowsingSubscription()
+ {
+ return _isBrowsingSubscription;
+ }
+
+ public void setBrowsingSubscription(final boolean isBrowsingSubscription)
+ {
+ _isBrowsingSubscription = isBrowsingSubscription;
+ }
+
+ public String getSelector()
+ {
+ return _selector;
+ }
+
+ public void setSelector(final String selector)
+ {
+ this._selector = selector;
+ }
+
+ public boolean isNoLocal()
+ {
+ return _noLocal;
+ }
+
+ public void setNoLocal(final boolean noLocal)
+ {
+ this._noLocal = noLocal;
+ }
+
+ public boolean isTopic()
+ {
+ return _isTopic;
+ }
+
+ public void setTopic(boolean isTopic)
+ {
+ this._isTopic = isTopic;
+ }
+
+ public boolean isSynchronous()
+ {
+ return _synchronous;
+ }
+
+ public void setSynchronous(boolean synchronous)
+ {
+ _synchronous = synchronous;
+ }
+
+ public void setReceiveTimeout(long receiveTimeout)
+ {
+ _receiveTimeout = receiveTimeout;
+
+ }
+
+ public long getReceiveTimeout()
+ {
+ return _receiveTimeout;
+ }
+}
Added: qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateMessageProviderCommand.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateMessageProviderCommand.java?rev=1309918&view=auto
==============================================================================
--- qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateMessageProviderCommand.java (added)
+++ qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateMessageProviderCommand.java Thu Apr 5 16:04:10 2012
@@ -0,0 +1,54 @@
+/*
+ * 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.disttest.message;
+
+import java.util.Map;
+
+import org.apache.qpid.disttest.client.property.PropertyValue;
+
+public class CreateMessageProviderCommand extends Command
+{
+ private String _providerName;
+ private Map<String, PropertyValue> _messageProperties;
+
+ public CreateMessageProviderCommand()
+ {
+ super(CommandType.CREATE_MESSAGE_PROVIDER);
+ }
+
+ public String getProviderName()
+ {
+ return _providerName;
+ }
+
+ public void setProviderName(String providerName)
+ {
+ this._providerName = providerName;
+ }
+
+ public Map<String, PropertyValue> getMessageProperties()
+ {
+ return _messageProperties;
+ }
+
+ public void setMessageProperties(Map<String, PropertyValue> messageProperties)
+ {
+ this._messageProperties = messageProperties;
+ }
+}
Added: qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateParticpantCommand.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateParticpantCommand.java?rev=1309918&view=auto
==============================================================================
--- qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateParticpantCommand.java (added)
+++ qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateParticpantCommand.java Thu Apr 5 16:04:10 2012
@@ -0,0 +1,96 @@
+/*
+ * 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.disttest.message;
+
+public abstract class CreateParticpantCommand extends Command
+{
+ private String _participantName;
+ private String _sessionName;
+ private String _destinationName;
+ private long _numberOfMessages;
+ private int _batchSize;
+ private long _maximumDuration;
+
+ public CreateParticpantCommand(CommandType type)
+ {
+ super(type);
+ }
+
+ public String getParticipantName()
+ {
+ return _participantName;
+ }
+
+ public void setParticipantName(final String participantName)
+ {
+ _participantName = participantName;
+ }
+
+ public String getSessionName()
+ {
+ return _sessionName;
+ }
+
+ public void setSessionName(final String sessionName)
+ {
+ _sessionName = sessionName;
+ }
+
+ public String getDestinationName()
+ {
+ return _destinationName;
+ }
+
+ public void setDestinationName(final String destinationName)
+ {
+ _destinationName = destinationName;
+ }
+
+ public long getNumberOfMessages()
+ {
+ return _numberOfMessages;
+ }
+
+ public void setNumberOfMessages(final long numberOfMessages)
+ {
+ _numberOfMessages = numberOfMessages;
+ }
+
+ public int getBatchSize()
+ {
+ return _batchSize;
+ }
+
+ public void setBatchSize(int batchSize)
+ {
+ _batchSize = batchSize;
+ }
+
+ public long getMaximumDuration()
+ {
+ return _maximumDuration;
+ }
+
+ public void setMaximumDuration(long maximumDuration)
+ {
+ _maximumDuration = maximumDuration;
+ }
+
+}
Added: qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateProducerCommand.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateProducerCommand.java?rev=1309918&view=auto
==============================================================================
--- qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateProducerCommand.java (added)
+++ qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateProducerCommand.java Thu Apr 5 16:04:10 2012
@@ -0,0 +1,106 @@
+/*
+ * 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.disttest.message;
+
+public class CreateProducerCommand extends CreateParticpantCommand
+{
+ private int _deliveryMode;
+ private int _messageSize;
+ private int _priority;
+ private long _timeToLive;
+ private long _interval;
+ private long _startDelay;
+ private String _messageProviderName;
+
+ public CreateProducerCommand()
+ {
+ super(CommandType.CREATE_PRODUCER);
+ }
+
+ public int getMessageSize()
+ {
+ return _messageSize;
+ }
+
+ public void setMessageSize(final int messageSize)
+ {
+ this._messageSize = messageSize;
+ }
+
+ public int getPriority()
+ {
+ return _priority;
+ }
+
+ public void setPriority(final int priority)
+ {
+ this._priority = priority;
+ }
+
+ public int getDeliveryMode()
+ {
+ return _deliveryMode;
+ }
+
+ public void setDeliveryMode(final int deliveryMode)
+ {
+ this._deliveryMode = deliveryMode;
+ }
+
+ public long getTimeToLive()
+ {
+ return _timeToLive;
+ }
+
+ public void setTimeToLive(final long timeToLive)
+ {
+ this._timeToLive = timeToLive;
+ }
+
+ public long getInterval()
+ {
+ return _interval;
+ }
+
+ public void setInterval(long interval)
+ {
+ this._interval = interval;
+ }
+
+ public long getStartDelay()
+ {
+ return _startDelay;
+ }
+
+ public void setStartDelay(long startDelay)
+ {
+ this._startDelay = startDelay;
+ }
+
+ public String getMessageProviderName()
+ {
+ return _messageProviderName;
+ }
+
+ public void setMessageProviderName(String messageProviderName)
+ {
+ this._messageProviderName = messageProviderName;
+ }
+}
Added: qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateResponderCommand.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateResponderCommand.java?rev=1309918&view=auto
==============================================================================
--- qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateResponderCommand.java (added)
+++ qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateResponderCommand.java Thu Apr 5 16:04:10 2012
@@ -0,0 +1,28 @@
+/*
+ * 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.disttest.message;
+
+public class CreateResponderCommand extends Command
+{
+ public CreateResponderCommand()
+ {
+ super(CommandType.CREATE_RESPONDER);
+ }
+}
Added: qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateSessionCommand.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateSessionCommand.java?rev=1309918&view=auto
==============================================================================
--- qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateSessionCommand.java (added)
+++ qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateSessionCommand.java Thu Apr 5 16:04:10 2012
@@ -0,0 +1,62 @@
+/*
+ * 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.disttest.message;
+
+public class CreateSessionCommand extends Command
+{
+ private String sessionName;
+ private String connectionName;
+ private int acknowledgeMode;
+
+ public CreateSessionCommand()
+ {
+ super(CommandType.CREATE_SESSION);
+ }
+
+ public String getSessionName()
+ {
+ return sessionName;
+ }
+
+ public void setSessionName(final String sessionName)
+ {
+ this.sessionName = sessionName;
+ }
+
+ public String getConnectionName()
+ {
+ return connectionName;
+ }
+
+ public void setConnectionName(final String connectionName)
+ {
+ this.connectionName = connectionName;
+ }
+
+ public int getAcknowledgeMode()
+ {
+ return acknowledgeMode;
+ }
+
+ public void setAcknowledgeMode(final int acknowledgeMode)
+ {
+ this.acknowledgeMode = acknowledgeMode;
+ }
+}
Added: qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/NoOpCommand.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/NoOpCommand.java?rev=1309918&view=auto
==============================================================================
--- qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/NoOpCommand.java (added)
+++ qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/NoOpCommand.java Thu Apr 5 16:04:10 2012
@@ -0,0 +1,30 @@
+/*
+ * 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.disttest.message;
+
+
+public class NoOpCommand extends Command
+{
+ public NoOpCommand()
+ {
+ super(CommandType.NO_OP);
+ }
+
+}
Added: qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/OutputAttribute.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/OutputAttribute.java?rev=1309918&view=auto
==============================================================================
--- qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/OutputAttribute.java (added)
+++ qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/OutputAttribute.java Thu Apr 5 16:04:10 2012
@@ -0,0 +1,35 @@
+/*
+ * 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.disttest.message;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+
+/**
+ * Marks an attribute of {@link ParticipantResult} that should be written to the test output file.
+ */
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface OutputAttribute
+{
+ ParticipantAttribute attribute();
+}
Added: qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ParticipantAttribute.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ParticipantAttribute.java?rev=1309918&view=auto
==============================================================================
--- qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ParticipantAttribute.java (added)
+++ qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ParticipantAttribute.java Thu Apr 5 16:04:10 2012
@@ -0,0 +1,67 @@
+/*
+ * 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.disttest.message;
+
+import org.apache.qpid.disttest.client.Participant;
+
+/**
+ * Meta-date representing the attributes of {@link Participant} that we write to the test output file.
+ *
+ * Order of declaration is currently important - it determines they order they appear in the output.
+ *
+ * @see OutputAttribute
+ */
+public enum ParticipantAttribute
+{
+ TEST_NAME("Test Name"),
+ ITERATION_NUMBER("Iteration number"),
+ CONFIGURED_CLIENT_NAME("Client Name"),
+ PARTICIPANT_NAME("Participant name"),
+ NUMBER_OF_MESSAGES_PROCESSED("Number of messages"),
+ PAYLOAD_SIZE("Payload size (bytes)"),
+ PRIORITY("Priority"),
+ TIME_TO_LIVE("Time to live (ms)"),
+ DELIVERY_MODE("Delivery mode"),
+ BATCH_SIZE("Batch size"),
+ MAXIMUM_DURATION("Maximum duration (ms)"),
+ PRODUCER_START_DELAY("Producer start delay (ms)"),
+ PRODUCER_INTERVAL("Producer interval (ms)"),
+ IS_TOPIC("Is topic"),
+ IS_DURABLE_SUBSCRIPTION("Is durable subscription"),
+ IS_BROWSIING_SUBSCRIPTION("Is browsing subscription"),
+ IS_SELECTOR("Is selector"),
+ IS_NO_LOCAL("Is no local"),
+ IS_SYNCHRONOUS_CONSUMER("Is synchronous consumer"),
+ TOTAL_PAYLOAD_PROCESSED("Total payload processed (bytes)"),
+ THROUGHPUT("Throughput (kbytes/s)"),
+ TIME_TAKEN("Time taken (ms)"),
+ ERROR_MESSAGE("Error message");
+
+ private String _displayName;
+
+ ParticipantAttribute(String displayName)
+ {
+ _displayName = displayName;
+ }
+
+ public String getDisplayName()
+ {
+ return _displayName;
+ }
+}
Added: qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ParticipantAttributeExtractor.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ParticipantAttributeExtractor.java?rev=1309918&view=auto
==============================================================================
--- qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ParticipantAttributeExtractor.java (added)
+++ qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ParticipantAttributeExtractor.java Thu Apr 5 16:04:10 2012
@@ -0,0 +1,89 @@
+/*
+ * 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.disttest.message;
+
+import java.beans.PropertyDescriptor;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.commons.beanutils.PropertyUtils;
+
+
+public class ParticipantAttributeExtractor
+{
+ public static Map<ParticipantAttribute, Object> getAttributes(Object targetObject)
+ {
+ Map<ParticipantAttribute, Object> attributes = new HashMap<ParticipantAttribute, Object>();
+
+
+ PropertyDescriptor[] descriptors = PropertyUtils.getPropertyDescriptors(targetObject);
+ for (PropertyDescriptor propertyDescriptor : descriptors)
+ {
+ final Method readMethod = getPropertyReadMethod(targetObject, propertyDescriptor);
+
+ for (Annotation annotation : readMethod.getDeclaredAnnotations())
+ {
+ if (annotation instanceof OutputAttribute)
+ {
+ OutputAttribute outputAttribute = (OutputAttribute) annotation;
+
+ Object value = getPropertyValue(targetObject, propertyDescriptor.getName());
+ attributes.put(outputAttribute.attribute(), value);
+ }
+ }
+ }
+
+ return attributes;
+ }
+
+ public static Method getPropertyReadMethod(Object targetObject, PropertyDescriptor propertyDescriptor)
+ {
+ final Method readMethod = propertyDescriptor.getReadMethod();
+
+ if (readMethod == null)
+ {
+ throw new RuntimeException("No read method for property " + propertyDescriptor.getName() + " on " + targetObject);
+ }
+ return readMethod;
+ }
+
+ public static Object getPropertyValue(Object targetObject, String propertyName)
+ {
+ try
+ {
+ return PropertyUtils.getProperty(targetObject, propertyName);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new RuntimeException("Couldn't get value of property " + propertyName + " from " + targetObject, e);
+ }
+ catch (InvocationTargetException e)
+ {
+ throw new RuntimeException("Couldn't get value of property " + propertyName + " from " + targetObject, e);
+ }
+ catch (NoSuchMethodException e)
+ {
+ throw new RuntimeException("Couldn't get value of property " + propertyName + " from " + targetObject, e);
+ }
+
+ }
+}
Added: qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ParticipantResult.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ParticipantResult.java?rev=1309918&view=auto
==============================================================================
--- qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ParticipantResult.java (added)
+++ qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ParticipantResult.java Thu Apr 5 16:04:10 2012
@@ -0,0 +1,231 @@
+/*
+ * 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.disttest.message;
+
+import static org.apache.qpid.disttest.message.ParticipantAttribute.BATCH_SIZE;
+import static org.apache.qpid.disttest.message.ParticipantAttribute.CONFIGURED_CLIENT_NAME;
+import static org.apache.qpid.disttest.message.ParticipantAttribute.ITERATION_NUMBER;
+import static org.apache.qpid.disttest.message.ParticipantAttribute.MAXIMUM_DURATION;
+import static org.apache.qpid.disttest.message.ParticipantAttribute.PAYLOAD_SIZE;
+import static org.apache.qpid.disttest.message.ParticipantAttribute.NUMBER_OF_MESSAGES_PROCESSED;
+import static org.apache.qpid.disttest.message.ParticipantAttribute.THROUGHPUT;
+import static org.apache.qpid.disttest.message.ParticipantAttribute.PARTICIPANT_NAME;
+import static org.apache.qpid.disttest.message.ParticipantAttribute.TEST_NAME;
+
+import java.util.Comparator;
+import java.util.Date;
+import java.util.Map;
+
+public class ParticipantResult extends Response
+{
+ private String _testName;
+ private String _participantName;
+ private long _startInMillis;
+ private long _endInMillis;
+ private int _batchSize;
+ private long _maximumDuration;
+ private int _iterationNumber;
+
+ private String _configuredClientName;
+
+ private long _numberOfMessagesProcessed;
+ private long _totalPayloadProcessed;
+ private int _payloadSize;
+ private double _throughput;
+
+ public static final Comparator<? super ParticipantResult> PARTICIPANT_NAME_COMPARATOR = new Comparator<ParticipantResult>()
+ {
+ @Override
+ public int compare(ParticipantResult participantResult1, ParticipantResult participantResult2)
+ {
+ return participantResult1.getParticipantName().compareTo(participantResult2.getParticipantName());
+ }
+ };
+
+ public ParticipantResult()
+ {
+ this(CommandType.PARTICIPANT_RESULT);
+ }
+
+ public ParticipantResult(CommandType commandType)
+ {
+ super(commandType);
+ }
+
+ public ParticipantResult(String participantName)
+ {
+ this();
+ setParticipantName(participantName);
+ }
+
+ @OutputAttribute(attribute=TEST_NAME)
+ public String getTestName()
+ {
+ return _testName;
+ }
+
+ public void setTestName(String testName)
+ {
+ _testName = testName;
+ }
+
+ @OutputAttribute(attribute=ITERATION_NUMBER)
+ public int getIterationNumber()
+ {
+ return _iterationNumber;
+ }
+
+ public void setIterationNumber(int iterationNumber)
+ {
+ _iterationNumber = iterationNumber;
+ }
+
+ public void setStartDate(Date start)
+ {
+ _startInMillis = start.getTime();
+ }
+
+ public void setEndDate(Date end)
+ {
+ _endInMillis = end.getTime();
+ }
+
+ public Date getStartDate()
+ {
+ return new Date(_startInMillis);
+ }
+
+ public Date getEndDate()
+ {
+ return new Date(_endInMillis);
+ }
+
+
+ public long getStartInMillis()
+ {
+ return _startInMillis;
+ }
+
+ public long getEndInMillis()
+ {
+ return _endInMillis;
+ }
+
+
+ @OutputAttribute(attribute=PARTICIPANT_NAME)
+ public String getParticipantName()
+ {
+ return _participantName;
+ }
+
+
+ public void setParticipantName(String participantName)
+ {
+ _participantName = participantName;
+ }
+
+ @OutputAttribute(attribute=ParticipantAttribute.TIME_TAKEN)
+ public long getTimeTaken()
+ {
+ return _endInMillis - _startInMillis;
+ }
+
+ @OutputAttribute(attribute=CONFIGURED_CLIENT_NAME)
+ public String getConfiguredClientName()
+ {
+ return _configuredClientName;
+ }
+
+ public void setConfiguredClientName(String configuredClientName)
+ {
+ _configuredClientName = configuredClientName;
+ }
+
+ @OutputAttribute(attribute=NUMBER_OF_MESSAGES_PROCESSED)
+ public long getNumberOfMessagesProcessed()
+ {
+ return _numberOfMessagesProcessed;
+ }
+
+ public void setNumberOfMessagesProcessed(long numberOfMessagesProcessed)
+ {
+ _numberOfMessagesProcessed = numberOfMessagesProcessed;
+ }
+
+ @OutputAttribute(attribute=ParticipantAttribute.TOTAL_PAYLOAD_PROCESSED)
+ public long getTotalPayloadProcessed()
+ {
+ return _totalPayloadProcessed;
+ }
+
+ @OutputAttribute(attribute = PAYLOAD_SIZE)
+ public int getPayloadSize()
+ {
+ return _payloadSize;
+ }
+
+ public void setPayloadSize(int payloadSize)
+ {
+ _payloadSize = payloadSize;
+ }
+
+ public void setTotalPayloadProcessed(long totalPayloadProcessed)
+ {
+ _totalPayloadProcessed = totalPayloadProcessed;
+ }
+
+ public Map<ParticipantAttribute, Object> getAttributes()
+ {
+ return ParticipantAttributeExtractor.getAttributes(this);
+ }
+
+ public void setBatchSize(int batchSize)
+ {
+ _batchSize = batchSize;
+ }
+
+ @OutputAttribute(attribute=BATCH_SIZE)
+ public int getBatchSize()
+ {
+ return _batchSize;
+ }
+
+ public void setMaximumDuration(long maximumDuration)
+ {
+ _maximumDuration = maximumDuration;
+ }
+
+ @OutputAttribute(attribute=MAXIMUM_DURATION)
+ public long getMaximumDuration()
+ {
+ return _maximumDuration;
+ }
+
+ @OutputAttribute(attribute=THROUGHPUT)
+ public double getThroughput()
+ {
+ return _throughput;
+ }
+
+ public void setThroughput(double throughput)
+ {
+ _throughput = throughput;
+ }
+
+}
Added: qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ProducerParticipantResult.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ProducerParticipantResult.java?rev=1309918&view=auto
==============================================================================
--- qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ProducerParticipantResult.java (added)
+++ qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/ProducerParticipantResult.java Thu Apr 5 16:04:10 2012
@@ -0,0 +1,100 @@
+/*
+ * 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.disttest.message;
+
+import static org.apache.qpid.disttest.message.ParticipantAttribute.DELIVERY_MODE;
+import static org.apache.qpid.disttest.message.ParticipantAttribute.PRIORITY;
+import static org.apache.qpid.disttest.message.ParticipantAttribute.PRODUCER_INTERVAL;
+import static org.apache.qpid.disttest.message.ParticipantAttribute.PRODUCER_START_DELAY;
+import static org.apache.qpid.disttest.message.ParticipantAttribute.TIME_TO_LIVE;
+
+public class ProducerParticipantResult extends ParticipantResult
+{
+ private int _priority;
+ private long _timeToLive;
+ private long _startDelay;
+ private long _interval;
+ private int _deliveryMode;
+ public ProducerParticipantResult()
+ {
+ super(CommandType.PRODUCER_PARTICIPANT_RESULT);
+ }
+
+ public ProducerParticipantResult(String participantName)
+ {
+ this();
+ setParticipantName(participantName);
+ }
+
+ @OutputAttribute(attribute=PRIORITY)
+ public int getPriority()
+ {
+ return _priority;
+ }
+
+ public void setPriority(int priority)
+ {
+ _priority = priority;
+ }
+
+ @OutputAttribute(attribute=TIME_TO_LIVE)
+ public long getTimeToLive()
+ {
+ return _timeToLive;
+ }
+
+ public void setTimeToLive(long timeToLive)
+ {
+ _timeToLive = timeToLive;
+ }
+
+ @OutputAttribute(attribute=PRODUCER_START_DELAY)
+ public long getStartDelay()
+ {
+ return _startDelay;
+ }
+
+ public void setStartDelay(long startDelay)
+ {
+ _startDelay = startDelay;
+ }
+
+ @OutputAttribute(attribute=PRODUCER_INTERVAL)
+ public long getInterval()
+ {
+ return _interval;
+ }
+
+ public void setInterval(long producerInterval)
+ {
+ _interval = producerInterval;
+ }
+
+ @OutputAttribute(attribute=DELIVERY_MODE)
+ public int getDeliveryMode()
+ {
+ return _deliveryMode;
+ }
+
+ public void setDeliveryMode(int deliveryMode)
+ {
+ this._deliveryMode = deliveryMode;
+ }
+
+}
Added: qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/RegisterClientCommand.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/RegisterClientCommand.java?rev=1309918&view=auto
==============================================================================
--- qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/RegisterClientCommand.java (added)
+++ qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/RegisterClientCommand.java Thu Apr 5 16:04:10 2012
@@ -0,0 +1,43 @@
+/*
+ * 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.disttest.message;
+
+public class RegisterClientCommand extends Command
+{
+ private final String _clientName;
+ private final String _clientQueueName;
+
+ public RegisterClientCommand(final String clientName, final String clientQueueName)
+ {
+ super(CommandType.REGISTER_CLIENT);
+ _clientName = clientName;
+ _clientQueueName = clientQueueName;
+ }
+
+ public String getClientName()
+ {
+ return _clientName;
+ }
+
+ public String getClientQueueName()
+ {
+ return _clientQueueName;
+ }
+}
Added: qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/Response.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/Response.java?rev=1309918&view=auto
==============================================================================
--- qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/Response.java (added)
+++ qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/Response.java Thu Apr 5 16:04:10 2012
@@ -0,0 +1,80 @@
+/*
+ * 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.disttest.message;
+
+
+public class Response extends Command
+{
+ protected String _registeredClientName;
+ protected String _errorMessage;
+ private CommandType _inReplyToCommandType;
+
+ public Response(final String registeredclientName, final CommandType inReplyToCommandType, final String errorMessage)
+ {
+ super(CommandType.RESPONSE);
+ _registeredClientName = registeredclientName;
+ _errorMessage = errorMessage;
+ _inReplyToCommandType = inReplyToCommandType;
+ }
+
+ public Response(String clientName, CommandType inReplyToCommandType)
+ {
+ this(clientName, inReplyToCommandType, null);
+ }
+
+ /**
+ * Provided so that subclasses can call super(commandType)
+ */
+ protected Response(CommandType commandType)
+ {
+ super(commandType);
+ }
+
+ public String getRegisteredClientName()
+ {
+ return _registeredClientName;
+ }
+
+ public void setRegisteredClientName(String registeredClientName)
+ {
+ _registeredClientName = registeredClientName;
+ }
+
+ @OutputAttribute(attribute=ParticipantAttribute.ERROR_MESSAGE)
+ public String getErrorMessage()
+ {
+ return _errorMessage;
+ }
+
+ public void setErrorMessage(String errorMessage)
+ {
+ _errorMessage = errorMessage;
+ }
+
+ public boolean hasError()
+ {
+ return _errorMessage != null;
+ }
+
+ public CommandType getInReplyToCommandType()
+ {
+ return _inReplyToCommandType;
+ }
+}
Added: qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/StartTestCommand.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/StartTestCommand.java?rev=1309918&view=auto
==============================================================================
--- qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/StartTestCommand.java (added)
+++ qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/StartTestCommand.java Thu Apr 5 16:04:10 2012
@@ -0,0 +1,29 @@
+/*
+ * 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.disttest.message;
+
+public class StartTestCommand extends Command
+{
+
+ public StartTestCommand()
+ {
+ super(CommandType.START_TEST);
+ }
+
+}
\ No newline at end of file
Added: qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/StopClientCommand.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/StopClientCommand.java?rev=1309918&view=auto
==============================================================================
--- qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/StopClientCommand.java (added)
+++ qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/StopClientCommand.java Thu Apr 5 16:04:10 2012
@@ -0,0 +1,28 @@
+/*
+ * 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.disttest.message;
+
+public class StopClientCommand extends Command
+{
+ public StopClientCommand()
+ {
+ super(CommandType.STOP_CLIENT);
+ }
+}
Added: qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/TearDownTestCommand.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/TearDownTestCommand.java?rev=1309918&view=auto
==============================================================================
--- qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/TearDownTestCommand.java (added)
+++ qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/message/TearDownTestCommand.java Thu Apr 5 16:04:10 2012
@@ -0,0 +1,29 @@
+/*
+ * 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.disttest.message;
+
+public class TearDownTestCommand extends Command
+{
+
+ public TearDownTestCommand()
+ {
+ super(CommandType.TEAR_DOWN_TEST);
+ }
+
+}
Added: qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/AggregatedTestResult.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/AggregatedTestResult.java?rev=1309918&view=auto
==============================================================================
--- qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/AggregatedTestResult.java (added)
+++ qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/AggregatedTestResult.java Thu Apr 5 16:04:10 2012
@@ -0,0 +1,97 @@
+/*
+ * 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.disttest.results.aggregation;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.qpid.disttest.message.ParticipantResult;
+
+public class AggregatedTestResult implements ITestResult
+{
+ private ParticipantResult _allParticipantResult;
+ private ParticipantResult _allConsumerParticipantResult;
+ private ParticipantResult _allProducerParticipantResult;
+ private final ITestResult _originalTestResult;
+
+ public AggregatedTestResult(ITestResult originalTestResult)
+ {
+ _originalTestResult = originalTestResult;
+ }
+
+ /**
+ * Returns the result where {@link ParticipantResult#getNumberOfMessagesProcessed()}
+ * is the total number of messages consumed during the test, and {@link ParticipantResult#getTimeTaken()}
+ * is the time between the start of the first producer and the end of the last consumer to finish.
+ */
+ public ParticipantResult getAllParticipantResult()
+ {
+ return _allParticipantResult;
+ }
+
+ public void setAllParticipantResult(ParticipantResult allParticipantResult)
+ {
+ _allParticipantResult = allParticipantResult;
+ }
+
+ public ParticipantResult getAllConsumerParticipantResult()
+ {
+ return _allConsumerParticipantResult;
+ }
+ public void setAllConsumerParticipantResult(ParticipantResult allConsumerParticipantResult)
+ {
+ _allConsumerParticipantResult = allConsumerParticipantResult;
+ }
+ public ParticipantResult getAllProducerParticipantResult()
+ {
+ return _allProducerParticipantResult;
+ }
+ public void setAllProducerParticipantResult(ParticipantResult allProducerParticipantResult)
+ {
+ _allProducerParticipantResult = allProducerParticipantResult;
+ }
+
+ // TODO should weaken to Collection
+ @Override
+ public List<ParticipantResult> getParticipantResults()
+ {
+ List<ParticipantResult> allParticipantResults = new ArrayList<ParticipantResult>(_originalTestResult.getParticipantResults());
+
+ allParticipantResults.add(_allConsumerParticipantResult);
+ allParticipantResults.add(_allProducerParticipantResult);
+ allParticipantResults.add(_allParticipantResult);
+
+ return allParticipantResults;
+ }
+
+ @Override
+ public boolean hasErrors()
+ {
+ return _originalTestResult.hasErrors();
+ }
+
+ @Override
+ public String getName()
+ {
+ return _originalTestResult.getName();
+ }
+
+
+
+}
Added: qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/Aggregator.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/Aggregator.java?rev=1309918&view=auto
==============================================================================
--- qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/Aggregator.java (added)
+++ qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/Aggregator.java Thu Apr 5 16:04:10 2012
@@ -0,0 +1,49 @@
+/*
+ * 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.disttest.results.aggregation;
+
+import org.apache.qpid.disttest.controller.ResultsForAllTests;
+
+public class Aggregator
+{
+
+ private TestResultAggregator _testResultAggregator = new TestResultAggregator();
+
+ public ResultsForAllTests aggregateResults(ResultsForAllTests rawResultsForAllTests)
+ {
+
+ ResultsForAllTests aggregatedResultsForAllTests = new ResultsForAllTests();
+
+
+ for (ITestResult testResult : rawResultsForAllTests.getTestResults())
+ {
+ AggregatedTestResult aggregateTestResult = _testResultAggregator.aggregateTestResult(testResult);
+ aggregatedResultsForAllTests.add(aggregateTestResult);
+ }
+
+
+ return aggregatedResultsForAllTests;
+ }
+
+ void setTestResultAggregator(TestResultAggregator testResultAggregator)
+ {
+ _testResultAggregator = testResultAggregator;
+ }
+
+}
Added: qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/ITestResult.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/ITestResult.java?rev=1309918&view=auto
==============================================================================
--- qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/ITestResult.java (added)
+++ qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/ITestResult.java Thu Apr 5 16:04:10 2012
@@ -0,0 +1,36 @@
+/*
+ * 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.disttest.results.aggregation;
+
+import java.util.List;
+
+import org.apache.qpid.disttest.message.ParticipantResult;
+
+// TODO rename me!!
+public interface ITestResult
+{
+
+ // TODO should weaken to Collection
+ List<ParticipantResult> getParticipantResults();
+
+ boolean hasErrors();
+
+ String getName();
+
+}
\ No newline at end of file
Added: qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/ParticipantResultAggregator.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/ParticipantResultAggregator.java?rev=1309918&view=auto
==============================================================================
--- qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/ParticipantResultAggregator.java (added)
+++ qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/ParticipantResultAggregator.java Thu Apr 5 16:04:10 2012
@@ -0,0 +1,124 @@
+/*
+ * 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.disttest.results.aggregation;
+
+import java.util.Date;
+import java.util.NavigableSet;
+import java.util.TreeSet;
+
+import org.apache.qpid.disttest.message.ParticipantResult;
+
+public class ParticipantResultAggregator
+{
+ private final String _aggregatedResultName;
+ private final Class<? extends ParticipantResult> _targetClass;
+
+ private long _minStartDate = Long.MAX_VALUE;
+ private long _maxEndDate = 0;
+ private long _numberOfMessagesProcessed = 0;
+ private long _totalPayloadProcessed = 0;
+
+ private NavigableSet<Integer> _encounteredPayloadSizes = new TreeSet<Integer>();
+ private NavigableSet<Integer> _encounteredIterationNumbers = new TreeSet<Integer>();
+ private NavigableSet<String> _encountedTestNames = new TreeSet<String>();
+
+ public ParticipantResultAggregator(Class<? extends ParticipantResult> taregtClass, String aggregateResultName)
+ {
+ _aggregatedResultName = aggregateResultName;
+ _targetClass = taregtClass;
+ }
+
+ public void aggregate(ParticipantResult result)
+ {
+ if (isAggregatable(result))
+ {
+ rollupConstantAttributes(result);
+ computeVariableAttributes(result);
+ }
+ }
+
+ public ParticipantResult getAggregatedResult()
+ {
+ ParticipantResult aggregatedResult = new ParticipantResult(_aggregatedResultName);
+
+ setRolledUpConstantAttributes(aggregatedResult);
+ setComputedVariableAttributes(aggregatedResult);
+
+ return aggregatedResult;
+ }
+
+ private boolean isAggregatable(ParticipantResult result)
+ {
+ return _targetClass.isAssignableFrom(result.getClass());
+ }
+
+ private void computeVariableAttributes(ParticipantResult result)
+ {
+ _numberOfMessagesProcessed += result.getNumberOfMessagesProcessed();
+ _totalPayloadProcessed += result.getTotalPayloadProcessed();
+ _minStartDate = Math.min(_minStartDate, result.getStartInMillis());
+ _maxEndDate = Math.max(_maxEndDate, result.getEndInMillis());
+ }
+
+ private void rollupConstantAttributes(ParticipantResult result)
+ {
+ if (result.getTestName() != null)
+ {
+ _encountedTestNames.add(result.getTestName());
+ }
+ _encounteredPayloadSizes.add(result.getPayloadSize());
+ _encounteredIterationNumbers.add(result.getIterationNumber());
+ }
+
+ private void setComputedVariableAttributes(ParticipantResult aggregatedResult)
+ {
+ aggregatedResult.setNumberOfMessagesProcessed(_numberOfMessagesProcessed);
+ aggregatedResult.setTotalPayloadProcessed(_totalPayloadProcessed);
+ aggregatedResult.setStartDate(new Date(_minStartDate));
+ aggregatedResult.setEndDate(new Date(_maxEndDate));
+ aggregatedResult.setThroughput(calculateThroughputInKiloBytesPerSecond());
+ }
+
+ private void setRolledUpConstantAttributes(ParticipantResult aggregatedResult)
+ {
+ if (_encounteredIterationNumbers.size() == 1)
+ {
+ aggregatedResult.setIterationNumber( _encounteredIterationNumbers.first());
+ }
+ if (_encounteredPayloadSizes.size() == 1)
+ {
+ aggregatedResult.setPayloadSize(_encounteredPayloadSizes.first());
+ }
+ if (_encountedTestNames.size() == 1)
+ {
+ aggregatedResult.setTestName(_encountedTestNames.first());
+ }
+ }
+
+ private double calculateThroughputInKiloBytesPerSecond()
+ {
+ double durationInMillis = _maxEndDate - _minStartDate;
+ double durationInSeconds = durationInMillis / 1000;
+ double totalPayloadProcessedInKiloBytes = ((double)_totalPayloadProcessed) / 1024;
+
+ return totalPayloadProcessedInKiloBytes/durationInSeconds;
+ }
+
+}
Added: qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/TestResultAggregator.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/TestResultAggregator.java?rev=1309918&view=auto
==============================================================================
--- qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/TestResultAggregator.java (added)
+++ qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/TestResultAggregator.java Thu Apr 5 16:04:10 2012
@@ -0,0 +1,98 @@
+/*
+ * 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.disttest.results.aggregation;
+
+import org.apache.qpid.disttest.message.ConsumerParticipantResult;
+import org.apache.qpid.disttest.message.ParticipantResult;
+import org.apache.qpid.disttest.message.ProducerParticipantResult;
+
+public class TestResultAggregator
+{
+ static final String AGGREGATED_ERROR_MESSAGE = "One or more participants reported errors.";
+ public static final String ALL_PARTICIPANTS_NAME = "All";
+ public static final String ALL_PRODUCER_PARTICIPANTS_NAME = "All Producers";
+ public static final String ALL_CONSUMER_PARTICIPANTS_NAME = "All Consumers";
+
+ public AggregatedTestResult aggregateTestResult(ITestResult originalTestResult)
+ {
+ AggregatedTestResult newTestResult = new AggregatedTestResult(originalTestResult);
+
+ ParticipantResultAggregator consumerParticipantResultAggregator = new ParticipantResultAggregator(ConsumerParticipantResult.class,
+ ALL_CONSUMER_PARTICIPANTS_NAME);
+ ParticipantResultAggregator producerParticipantResultAggregator = new ParticipantResultAggregator(ProducerParticipantResult.class,
+ ALL_PRODUCER_PARTICIPANTS_NAME);
+
+ boolean hasError = aggregate(originalTestResult,
+ consumerParticipantResultAggregator,
+ producerParticipantResultAggregator);
+
+ ParticipantResult aggregatedProducerResult = producerParticipantResultAggregator.getAggregatedResult();
+ newTestResult.setAllProducerParticipantResult(aggregatedProducerResult);
+
+ ParticipantResult aggregaredConsumerResult = consumerParticipantResultAggregator.getAggregatedResult();
+ newTestResult.setAllConsumerParticipantResult(aggregaredConsumerResult);
+
+ ParticipantResult aggregatedAllResult = buildAllResultFromOtherAggregatedResults(
+ aggregatedProducerResult, aggregaredConsumerResult);
+
+ if (hasError)
+ {
+ aggregatedAllResult.setErrorMessage(TestResultAggregator.AGGREGATED_ERROR_MESSAGE);
+ }
+ newTestResult.setAllParticipantResult(aggregatedAllResult);
+
+ return newTestResult;
+ }
+
+ private boolean aggregate(ITestResult originalTestResult,
+ ParticipantResultAggregator consumerParticipantResultAggregator,
+ ParticipantResultAggregator producerParticipantResultAggregator)
+ {
+ boolean hasError = false;
+ for (ParticipantResult result : originalTestResult.getParticipantResults())
+ {
+ consumerParticipantResultAggregator.aggregate(result);
+ producerParticipantResultAggregator.aggregate(result);
+
+ if (result.hasError())
+ {
+ hasError = true;
+ }
+ }
+ return hasError;
+ }
+
+ private ParticipantResult buildAllResultFromOtherAggregatedResults(
+ ParticipantResult aggregatedProducerResult, ParticipantResult aggregaredConsumerResult)
+ {
+ ParticipantResult aggregatedAllResult = new ParticipantResult(ALL_PARTICIPANTS_NAME);
+ aggregatedAllResult.setStartDate(aggregatedProducerResult.getStartDate());
+
+ aggregatedAllResult.setEndDate(aggregaredConsumerResult.getEndDate());
+
+ aggregatedAllResult.setIterationNumber(aggregaredConsumerResult.getIterationNumber());
+ aggregatedAllResult.setTestName(aggregaredConsumerResult.getTestName());
+ aggregatedAllResult.setNumberOfMessagesProcessed(aggregaredConsumerResult.getNumberOfMessagesProcessed());
+ aggregatedAllResult.setPayloadSize(aggregaredConsumerResult.getPayloadSize());
+ aggregatedAllResult.setTotalPayloadProcessed(aggregaredConsumerResult.getTotalPayloadProcessed());
+ aggregatedAllResult.setThroughput(aggregaredConsumerResult.getThroughput());
+
+ return aggregatedAllResult;
+ }
+}
Added: qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/formatting/CSVFormater.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/formatting/CSVFormater.java?rev=1309918&view=auto
==============================================================================
--- qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/formatting/CSVFormater.java (added)
+++ qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/formatting/CSVFormater.java Thu Apr 5 16:04:10 2012
@@ -0,0 +1,89 @@
+/*
+ * 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.disttest.results.formatting;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.qpid.disttest.controller.ResultsForAllTests;
+import org.apache.qpid.disttest.message.ParticipantAttribute;
+import org.apache.qpid.disttest.message.ParticipantResult;
+import org.apache.qpid.disttest.results.aggregation.ITestResult;
+
+/**
+ * produces CSV output using the ordered enums in {@link ParticipantAttribute}
+ */
+public class CSVFormater
+{
+ public String format(ResultsForAllTests results)
+ {
+ StringBuilder builder = new StringBuilder();
+
+ builder.append(header());
+
+ List<ITestResult> testResults = results.getTestResults();
+
+ for (ITestResult testResult : testResults)
+ {
+
+ List<ParticipantResult> participantResults = new ArrayList<ParticipantResult>(testResult.getParticipantResults());
+ Collections.sort(participantResults, new CSVOrderParticipantResultComparator());
+
+ for (ParticipantResult participantResult : participantResults)
+ {
+ Map<ParticipantAttribute, Object> attributes = participantResult.getAttributes();
+ builder.append(row(attributes));
+ }
+ }
+
+ return builder.toString();
+ }
+
+ /**
+ * return a row, including a newline character at the end
+ */
+ private String row(Map<ParticipantAttribute, Object> attributeValueMap)
+ {
+ List<Object> attributeValues = new ArrayList<Object>();
+ for (ParticipantAttribute attribute : ParticipantAttribute.values())
+ {
+ attributeValues.add(attributeValueMap.get(attribute));
+ }
+
+ String row = StringUtils.join(attributeValues.toArray(), ",");
+ return row + "\n";
+ }
+
+ /** return the header row, including a newline at the end */
+ private String header()
+ {
+ List<String> displayNames = new ArrayList<String>();
+ for (ParticipantAttribute attribute : ParticipantAttribute.values())
+ {
+ displayNames.add(attribute.getDisplayName());
+ }
+
+ String header = StringUtils.join(displayNames.toArray(), ",");
+ return header + "\n";
+ }
+
+}
Added: qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/formatting/CSVOrderParticipantResultComparator.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/formatting/CSVOrderParticipantResultComparator.java?rev=1309918&view=auto
==============================================================================
--- qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/formatting/CSVOrderParticipantResultComparator.java (added)
+++ qpid/trunk/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/results/formatting/CSVOrderParticipantResultComparator.java Thu Apr 5 16:04:10 2012
@@ -0,0 +1,55 @@
+/*
+ * 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.disttest.results.formatting;
+
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.commons.lang.builder.CompareToBuilder;
+import org.apache.qpid.disttest.message.ConsumerParticipantResult;
+import org.apache.qpid.disttest.message.ParticipantResult;
+import org.apache.qpid.disttest.message.ProducerParticipantResult;
+
+public class CSVOrderParticipantResultComparator implements Comparator<ParticipantResult>
+{
+ // TODO yuk
+ private static final Map<Class<? extends ParticipantResult>, Integer> TYPE_CODES = new HashMap<Class<? extends ParticipantResult>, Integer>();
+ static {
+ TYPE_CODES.put(ProducerParticipantResult.class, 0);
+ TYPE_CODES.put(ConsumerParticipantResult.class, 1);
+ TYPE_CODES.put(ParticipantResult.class, 2);
+ }
+
+ @Override
+ public int compare(ParticipantResult left, ParticipantResult right)
+ {
+ return new CompareToBuilder()
+ .append(getTypeCode(left), getTypeCode(right))
+ .append(left.getParticipantName(), right.getParticipantName())
+ .toComparison();
+ }
+
+
+ private int getTypeCode(ParticipantResult participantResult)
+ {
+ return TYPE_CODES.get(participantResult.getClass());
+ }
+
+}
Added: qpid/trunk/qpid/java/perftests/src/main/resources/perftests.properties
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/perftests/src/main/resources/perftests.properties?rev=1309918&view=auto
==============================================================================
--- qpid/trunk/qpid/java/perftests/src/main/resources/perftests.properties (added)
+++ qpid/trunk/qpid/java/perftests/src/main/resources/perftests.properties Thu Apr 5 16:04:10 2012
@@ -0,0 +1,20 @@
+# 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.
+
+java.naming.factory.initial = org.apache.qpid.jndi.PropertiesFileInitialContextFactory
+
+connectionfactory.connectionfactory = amqp://guest:guest@clientid/test?brokerlist='tcp://localhost:5672'
Added: qpid/trunk/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/ArgumentParserTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/ArgumentParserTest.java?rev=1309918&view=auto
==============================================================================
--- qpid/trunk/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/ArgumentParserTest.java (added)
+++ qpid/trunk/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/ArgumentParserTest.java Thu Apr 5 16:04:10 2012
@@ -0,0 +1,96 @@
+/*
+ * 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.disttest;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.qpid.test.utils.QpidTestCase;
+
+public class ArgumentParserTest extends QpidTestCase
+{
+ private static final String TEST_CONFIG_FILENAME = "ControllerRunnerTest-test-config-filename.json";
+ private static final String JNDI_CONFIG_FILENAME = "ControllerRunnerTest-jndi-config-filename.properties";
+ private static final String DISTRIBUTED_MODE = "true";
+
+ public static final String TEST_CONFIG_PROP = "test-config";
+ public static final String JNDI_CONFIG_PROP = "jndi-config";
+ public static final String DISTRIBUTED_PROP = "distributed";
+
+ public static final String TEST_CONFIG_DEFAULT = "perftests-config.json";
+ public static final String JNDI_CONFIG_DEFAULT = "perftests-jndi.properties";
+ public static final String DISTRIBUTED_DEFAULT = "false";
+
+ private Map<String,String> _options = new HashMap<String, String>();
+
+ private ArgumentParser _parser;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ _parser = new ArgumentParser();
+
+ _options.clear();
+ _options.put(TEST_CONFIG_PROP, TEST_CONFIG_DEFAULT);
+ _options.put(JNDI_CONFIG_PROP, JNDI_CONFIG_DEFAULT);
+ _options.put(DISTRIBUTED_PROP, DISTRIBUTED_DEFAULT);
+ }
+
+ public void testInvalidArguments()
+ {
+ String[] args = new String[]{"nonExistentConfigProperty" + "=" + TEST_CONFIG_FILENAME};
+
+ try
+ {
+ _parser.parseArgumentsIntoConfig(_options, args);
+ fail("expected exception to be thrown due to provision of a non existent config property");
+ }
+ catch(IllegalArgumentException e)
+ {
+ //expected
+ }
+ }
+
+ public void testDefaultConfigValues()
+ {
+ String[] args = new String[0];
+
+ _parser.parseArgumentsIntoConfig(_options, args);
+
+ assertEquals("unexpected config value", TEST_CONFIG_DEFAULT, _options.get(TEST_CONFIG_PROP));
+ assertEquals("unexpected config value", JNDI_CONFIG_DEFAULT, _options.get(JNDI_CONFIG_PROP));
+ assertEquals("unexpected config value", DISTRIBUTED_DEFAULT, _options.get(DISTRIBUTED_PROP));
+ }
+
+ public void testConfigurationParsingOverridesDefault() throws Exception
+ {
+ String[] args = new String[]{TEST_CONFIG_PROP + "=" + TEST_CONFIG_FILENAME,
+ JNDI_CONFIG_PROP + "=" + JNDI_CONFIG_FILENAME,
+ DISTRIBUTED_PROP + "=" + DISTRIBUTED_MODE};
+
+ _parser.parseArgumentsIntoConfig(_options, args);
+
+ assertEquals("unexpected config value", TEST_CONFIG_FILENAME, _options.get(TEST_CONFIG_PROP));
+ assertEquals("unexpected config value", JNDI_CONFIG_FILENAME, _options.get(JNDI_CONFIG_PROP));
+ assertEquals("unexpected config value", DISTRIBUTED_MODE, _options.get(DISTRIBUTED_PROP));
+ assertFalse("override value was the same as the default", DISTRIBUTED_MODE.equalsIgnoreCase(_options.get(DISTRIBUTED_DEFAULT)));
+ }
+}
Added: qpid/trunk/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/ConfigFileHelper.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/ConfigFileHelper.java?rev=1309918&view=auto
==============================================================================
--- qpid/trunk/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/ConfigFileHelper.java (added)
+++ qpid/trunk/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/ConfigFileHelper.java Thu Apr 5 16:04:10 2012
@@ -0,0 +1,48 @@
+/*
+ * 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.disttest;
+
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+
+import org.apache.qpid.disttest.controller.config.Config;
+import org.apache.qpid.disttest.controller.config.ConfigReader;
+
+public class ConfigFileHelper
+{
+ public static Reader getConfigFileReader(Class<?> testClass, String resourceName)
+ {
+ InputStream inputStream = testClass.getResourceAsStream(resourceName);
+ if(inputStream == null)
+ {
+ throw new RuntimeException("Can't find resource " + resourceName + " using classloader of class " + testClass);
+ }
+ Reader reader = new InputStreamReader(inputStream);
+ return reader;
+ }
+
+ public static Config getConfigFromResource(Class<?> testClass, String resourceName)
+ {
+ ConfigReader configReader = new ConfigReader();
+ Config config = configReader.readConfig(getConfigFileReader(testClass, resourceName));
+ return config;
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org