KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > activemq > maven > MemtestMojo


1 package org.apache.activemq.maven;
2
3 /*
4  * Licensed to the Apache Software Foundation (ASF) under one or more
5  * contributor license agreements. See the NOTICE file distributed with
6  * this work for additional information regarding copyright ownership.
7  * The ASF licenses this file to You under the Apache License, Version 2.0
8  * (the "License"); you may not use this file except in compliance with
9  * the License. You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */

19
20
21 import org.apache.maven.plugin.AbstractMojo;
22 import org.apache.maven.plugin.MojoExecutionException;
23 import org.apache.activemq.tool.JMSMemtest;
24
25 import javax.jms.JMSException JavaDoc;
26
27
28 /**
29  * Goal which does a memory usage test to check for any memory leak
30  *
31  * @goal memtest
32  * @phase process-sources
33  */

34 public class MemtestMojo
35         extends AbstractMojo {
36
37     /**
38      * @parameter expression="${url}
39      *
40      */

41     private String JavaDoc url;
42
43     /**
44      * @parameter expression="${topic}" default-value="true"
45      * @required
46      */

47     private String JavaDoc topic;
48
49     /**
50      * @parameter expression="${connectionCheckpointSize}" default-value="-1"
51      * @required
52      */

53     private String JavaDoc connectionCheckpointSize;
54
55     /**
56      * @parameter expression="${durable}" default-value="false"
57      * @required
58      */

59     private String JavaDoc durable;
60
61     /**
62      * @parameter expression="${producerCount}" default-value="1"
63      * @required
64      */

65     private String JavaDoc producerCount;
66
67     /**
68      * @parameter expression="${prefetchSize}" default-value="-1"
69      * @required
70      */

71     private String JavaDoc prefetchSize;
72
73
74     /**
75      * @parameter expression="${consumerCount}" default-value="1"
76      * @required
77      */

78     private String JavaDoc consumerCount;
79
80     /**
81      * @parameter expression="${messageCount}" default-value="100000"
82      * @required
83      */

84     private String JavaDoc messageCount;
85
86     /**
87      * @parameter expression="${messageSize}" default-value="10240"
88      * @required
89      */

90     private String JavaDoc messageSize;
91
92     /**
93      * @parameter expression="${checkpointInterval}" default-value="2"
94      * @required
95      */

96     private String JavaDoc checkpointInterval;
97
98     /**
99      * @parameter expression="${destinationName}" default-value="FOO.BAR"
100      * @required
101      */

102     private String JavaDoc destinationName;
103
104     /**
105      * @parameter expression="${reportName}" default-value="activemq-memory-usage-report"
106      * @required
107      */

108     private String JavaDoc reportName;
109
110     /**
111      * @parameter expression="${reportDirectory}" default-value="${project.build.directory}/test-memtest"
112      * @required
113      */

114     private String JavaDoc reportDirectory;
115
116
117
118     public void execute()
119             throws MojoExecutionException {
120
121         JMSMemtest.main(createArgument());
122     }
123
124
125
126     public String JavaDoc[] createArgument() {
127
128
129         String JavaDoc[] options = {
130             "url=" + url,
131             "topic=" + topic,
132             "durable=" + durable,
133             "connectionCheckpointSize=" + connectionCheckpointSize,
134             "producerCount=" + producerCount,
135             "consumerCount=" + consumerCount,
136             "messageCount=" + messageCount,
137             "messageSize=" + messageSize,
138             "checkpointInterval=" + checkpointInterval,
139             "destinationName=" + destinationName,
140             "reportName=" + reportName,
141             "prefetchSize=" + prefetchSize,
142             "reportDirectory=" + reportDirectory,
143         };
144         return options;
145     }
146 }
147
Popular Tags