1 /** 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 package org.apache.activemq.maven; 18 19 import org.apache.activemq.tool.JMSMemtest; 20 import org.apache.maven.plugin.AbstractMojo; 21 import org.apache.maven.plugin.MojoExecutionException; 22 23 /** 24 * Goal which does a memory usage test to check for any memory leak 25 * 26 * @goal memtest 27 * @phase process-sources 28 */ 29 public class MemtestMojo extends AbstractMojo { 30 31 /** 32 * @parameter expression="${url} 33 */ 34 private String url; 35 36 /** 37 * @parameter expression="${topic}" default-value="true" 38 * @required 39 */ 40 private String topic; 41 42 /** 43 * @parameter expression="${connectionCheckpointSize}" default-value="-1" 44 * @required 45 */ 46 private String connectionCheckpointSize; 47 48 /** 49 * @parameter expression="${durable}" default-value="false" 50 * @required 51 */ 52 private String durable; 53 54 /** 55 * @parameter expression="${producerCount}" default-value="1" 56 * @required 57 */ 58 private String producerCount; 59 60 /** 61 * @parameter expression="${prefetchSize}" default-value="-1" 62 * @required 63 */ 64 private String prefetchSize; 65 66 /** 67 * @parameter expression="${consumerCount}" default-value="1" 68 * @required 69 */ 70 private String consumerCount; 71 72 /** 73 * @parameter expression="${messageCount}" default-value="100000" 74 * @required 75 */ 76 private String messageCount; 77 78 /** 79 * @parameter expression="${messageSize}" default-value="10240" 80 * @required 81 */ 82 private String messageSize; 83 84 /** 85 * @parameter expression="${checkpointInterval}" default-value="2" 86 * @required 87 */ 88 private String checkpointInterval; 89 90 /** 91 * @parameter expression="${destinationName}" default-value="FOO.BAR" 92 * @required 93 */ 94 private String destinationName; 95 96 /** 97 * @parameter expression="${reportName}" 98 * default-value="activemq-memory-usage-report" 99 * @required 100 */ 101 private String reportName; 102 103 /** 104 * @parameter expression="${reportDirectory}" 105 * default-value="${project.build.directory}/test-memtest" 106 * @required 107 */ 108 private String reportDirectory; 109 110 public void execute() throws MojoExecutionException { 111 112 JMSMemtest.main(createArgument()); 113 } 114 115 public String[] createArgument() { 116 String[] options = { 117 "url=" + url, "topic=" + topic, "durable=" + durable, "connectionCheckpointSize=" + connectionCheckpointSize, "producerCount=" + producerCount, "consumerCount=" + consumerCount, 118 "messageCount=" + messageCount, "messageSize=" + messageSize, "checkpointInterval=" + checkpointInterval, "destinationName=" + destinationName, "reportName=" + reportName, 119 "prefetchSize=" + prefetchSize, "reportDirectory=" + reportDirectory, 120 }; 121 return options; 122 } 123 }