You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by la...@apache.org on 2008/10/07 11:07:36 UTC
svn commit: r702402 [3/4] - in
/incubator/qpid/trunk/qpid/java/management/tools: ./ qpid-cli/
qpid-cli/bin/ qpid-cli/lib/ qpid-cli/src/ qpid-cli/src/org/
qpid-cli/src/org/apache/ qpid-cli/src/org/apache/qpid/
qpid-cli/src/org/apache/qpid/commands/ qpid...
Added: incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/UserManagementObject.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/UserManagementObject.java?rev=702402&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/UserManagementObject.java (added)
+++ incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/UserManagementObject.java Tue Oct 7 02:07:34 2008
@@ -0,0 +1,45 @@
+/*
+ *
+ * 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.commands.objects;
+
+import javax.management.MBeanServerConnection;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: lahiru
+ * Date: Jun 24, 2008
+ * Time: 12:11:52 AM
+ * To change this template use File | Settings | File Templates.
+ */
+public class UserManagementObject extends ObjectNames {
+ public UserManagementObject(MBeanServerConnection mbsc) {
+ ObjectNames(mbsc);
+// querystring = "org.apache.qpid:type=UserManagement,*";
+// set = returnObjects();
+
+ }
+
+ public void setQueryString(String object, String name, String vhost) {
+ querystring = "org.apache.qpid:type=UserManagement,*";
+ }
+
+}
Added: incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/VirtualHostObject.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/VirtualHostObject.java?rev=702402&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/VirtualHostObject.java (added)
+++ incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/commands/objects/VirtualHostObject.java Tue Oct 7 02:07:34 2008
@@ -0,0 +1,53 @@
+/*
+ *
+ * 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.commands.objects;
+
+import javax.management.MBeanServerConnection;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: lahiru
+ * Date: Jun 20, 2008
+ * Time: 9:02:04 AM
+ * To change this template use File | Settings | File Templates.
+ */
+public class VirtualHostObject extends ObjectNames {
+
+ public VirtualHostObject(MBeanServerConnection mbsc) {
+ ObjectNames(mbsc);
+// querystring = "org.apache.qpid:type=VirtualHost.VirtualHostManager,*";
+// set = returnObjects();
+ }
+
+ public void setQueryString(String object, String name, String vhost) {
+ if (name != null && vhost == null)
+ querystring = "org.apache.qpid:type=VirtualHost.VirtualHostManager,name=" + name + ",*";
+ else if (name != null && vhost != null)
+ querystring = "org.apache.qpid:type=VirtualHost.VirtualHostManager,VirtualHost=" + vhost + ",name=" + name + ",*";
+ else if (name == null && vhost != null)
+ querystring = "org.apache.qpid:type=VirtualHost.VirtualHostManager,VirtualHost=" + vhost + ",*";
+ else
+ querystring = "org.apache.qpid:type=VirtualHost.VirtualHostManager,*";
+
+
+ }
+}
Added: incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/utils/CommandLineOption.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/utils/CommandLineOption.java?rev=702402&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/utils/CommandLineOption.java (added)
+++ incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/utils/CommandLineOption.java Tue Oct 7 02:07:34 2008
@@ -0,0 +1,112 @@
+/*
+ *
+ * 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.
+ *
+ */
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed 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.utils;
+
+import java.util.ArrayList;
+
+public class CommandLineOption implements CommandLineOptionConstants {
+ private String type;
+ private ArrayList optionValues;
+
+ public CommandLineOption(String type, String[] values) {
+ setOptionType(type);
+ ArrayList arrayList = new ArrayList(values.length);
+ for (int i = 0; i < values.length; i++) {
+ arrayList.add(values[i]);
+ }
+ this.optionValues = arrayList;
+ }
+
+ private void setOptionType(String type) {
+ //cater for the long options first
+ if (type.startsWith("--")) {
+ type = type.replaceFirst("--", "");
+ }
+ if (type.startsWith("-")) {
+ type = type.replaceFirst("-", "");
+ }
+
+ //we do not change the case of the option!
+
+ this.type = type;
+ }
+
+ /**
+ * @param type
+ */
+ public CommandLineOption(String type, ArrayList values) {
+ setOptionType(type);
+
+ if (null != values) {
+ this.optionValues = values;
+ }
+ }
+
+
+ /**
+ * @return Returns the type.
+ * @see CommandLineOptionConstants
+ */
+ public String getOptionType() {
+ return type;
+ }
+
+
+ /**
+ * @return Returns the optionValues.
+ */
+ public String getOptionValue() {
+ if ((optionValues != null) && (optionValues.size() > 0)) {
+ return (String) optionValues.get(0);
+ } else {
+ return null;
+ }
+ }
+
+
+ /**
+ * @return Returns the optionValues.
+ */
+ public ArrayList getOptionValues() {
+ return optionValues;
+ }
+
+
+}
Added: incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/utils/CommandLineOptionConstants.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/utils/CommandLineOptionConstants.java?rev=702402&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/utils/CommandLineOptionConstants.java (added)
+++ incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/utils/CommandLineOptionConstants.java Tue Oct 7 02:07:34 2008
@@ -0,0 +1,53 @@
+/*
+ *
+ * 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.
+ *
+ */
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed 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.utils;
+
+
+public interface CommandLineOptionConstants {
+ static interface JMXCommandLineOptionConstants {
+ String HOST_OPTION = "h";
+ String PORT_OPTION = "p";
+ String INTERVAL_OPTION = "i";
+ String REPORT_OPTION = "r";
+
+ }
+
+
+}
Added: incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/utils/CommandLineOptionParser.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/utils/CommandLineOptionParser.java?rev=702402&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/utils/CommandLineOptionParser.java (added)
+++ incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/utils/CommandLineOptionParser.java Tue Oct 7 02:07:34 2008
@@ -0,0 +1,218 @@
+/*
+ *
+ * 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.
+ *
+ */
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed 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.utils;
+
+import java.util.Map;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.StringTokenizer;
+
+
+public class CommandLineOptionParser {
+ private static int STARTED = 0;
+ private static int NEW_OPTION = 1;
+ private static int SUB_PARAM_OF_OPTION = 2;
+
+ private Map commandlineoption;
+ private String commandname;
+
+ public CommandLineOptionParser(Map commandlineoptions) {
+ this.commandlineoption = commandlineoptions;
+ }
+
+ public CommandLineOptionParser(String[] args) {
+ /* check whether user just type the enter key */
+ this.commandlineoption = this.parse(args);
+
+ }
+
+ public CommandLineOptionParser(String[] args, String first) {
+ this.commandname = first;
+ this.commandlineoption = this.parsefirst(args);
+ }
+
+ public Map parse(String[] args) {
+ Map commandLineOptions = new HashMap();
+
+ if (0 == args.length) {
+ return commandLineOptions;
+ } else if (1 == args.length) {
+ commandname = args[0];
+ return commandLineOptions;
+ }
+ /* when user is not giving the command line option with a "=" */
+// if (!args[2].startsWith("-"))
+// return commandLineOptions;
+
+ //State 0 means started
+ //State 1 means earlier one was a new -option
+ //State 2 means earlier one was a sub param of a -option
+
+ int state = STARTED;
+ ArrayList optionBundle = null;
+ String optionType = null;
+ CommandLineOption commandLineOption;
+ String newcommand = "";
+ String[] newargs;
+ int j;
+ if (args[1].compareTo("list") == 0 || args[1].compareTo("info") == 0 || args[1].compareTo("delete") == 0 ||
+ args[1].compareTo("move") == 0 || args[1].compareTo("view") == 0 || args[1].compareTo("viewcontent") == 0) {
+ String object = args[0];
+ for (j = 0; j < (args.length - 1); j++) {
+ newcommand = newcommand + args[j + 1] + " ";
+ }
+ newcommand = newcommand + "-o " + object;
+ newargs = newcommand.split(" ");
+ args = newargs;
+ } else
+ if (!args[1].startsWith("-")) //if user give command like list queue or something without minus argument
+ return commandLineOptions; //for the second wordxi
+
+ commandname = args[0];
+ for (int i = 0; i < args.length; i++) {
+ if (args[i].startsWith("-")) {
+ if (STARTED == state) {
+ // fresh one
+ state = NEW_OPTION;
+ optionType = args[i];
+ } else if (SUB_PARAM_OF_OPTION == state || NEW_OPTION == state) {
+ // new one but old one should be saved
+ commandLineOption =
+ new CommandLineOption(optionType, optionBundle);
+ commandLineOptions.put(commandLineOption.getOptionType(),
+ commandLineOption);
+ state = NEW_OPTION;
+ optionType = args[i];
+ optionBundle = null;
+
+ }
+ } else {
+ if (NEW_OPTION == state) {
+ optionBundle = new ArrayList();
+ optionBundle.add(args[i]);
+ state = SUB_PARAM_OF_OPTION;
+
+ } else if (SUB_PARAM_OF_OPTION == state) {
+ optionBundle.add(args[i]);
+ }
+
+
+ }
+ }
+ commandLineOption = new CommandLineOption(optionType, optionBundle);
+ commandLineOptions.put(commandLineOption.getOptionType(), commandLineOption);
+ return commandLineOptions;
+
+ }
+
+ public Map parsefirst(String[] args) {
+ Map commandLineOptions = new HashMap();
+ if (0 == args.length) {
+ return commandLineOptions;
+ } else if (1 == args.length) {
+ return commandLineOptions;
+ }
+ /* when user is not giving the command line option with a "=" */
+// if (!args[2].startsWith("-"))
+// return commandLineOptions;
+
+ //State 0 means started
+ //State 1 means earlier one was a new -option
+ //State 2 means earlier one was a sub param of a -option
+
+ int state = STARTED;
+ ArrayList optionBundle = null;
+ String optionType = null;
+ CommandLineOption commandLineOption;
+ String newcommand = "";
+ String[] newargs;
+ int j;
+
+ for (int i = 0; i < args.length; i++) {
+ if (args[i].startsWith("-")) {
+ if (STARTED == state) {
+ // fresh one
+ state = NEW_OPTION;
+ optionType = args[i];
+ } else if (SUB_PARAM_OF_OPTION == state || NEW_OPTION == state) {
+ // new one but old one should be saved
+ commandLineOption =
+ new CommandLineOption(optionType, optionBundle);
+ commandLineOptions.put(commandLineOption.getOptionType(),
+ commandLineOption);
+ state = NEW_OPTION;
+ optionType = args[i];
+ optionBundle = null;
+
+ }
+ } else {
+ if (NEW_OPTION == state) {
+ optionBundle = new ArrayList();
+ optionBundle.add(args[i]);
+ state = SUB_PARAM_OF_OPTION;
+
+ } else if (SUB_PARAM_OF_OPTION == state) {
+ optionBundle.add(args[i]);
+ }
+
+
+ }
+ }
+ commandLineOption = new CommandLineOption(optionType, optionBundle);
+ commandLineOptions.put(commandLineOption.getOptionType(), commandLineOption);
+ return commandLineOptions;
+
+ }
+
+ public Map getAlloptions() {
+ return this.commandlineoption;
+ }
+
+ public String getcommandname() {
+ return this.commandname;
+ }
+
+ private static String removeSpaces(String s) {
+ StringTokenizer st = new StringTokenizer(s, " ", false);
+ String t = "";
+ while (st.hasMoreElements()) t += st.nextElement();
+ return t;
+ }
+
+}
Added: incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/utils/JMXConfigProperty.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/utils/JMXConfigProperty.java?rev=702402&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/utils/JMXConfigProperty.java (added)
+++ incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/utils/JMXConfigProperty.java Tue Oct 7 02:07:34 2008
@@ -0,0 +1,47 @@
+/*
+*
+* 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.
+*
+*/
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed 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.utils;
+
+
+public class JMXConfigProperty {
+
+ private static final String DEFAULT_HOST_NAME = "localhost";
+ private static final String DEFAULT_PORT = "8999";
+ private static final String DEFAULT_INTERVAL = "4000";
+}
Added: incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/utils/JMXConfiguration.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/utils/JMXConfiguration.java?rev=702402&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/utils/JMXConfiguration.java (added)
+++ incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/utils/JMXConfiguration.java Tue Oct 7 02:07:34 2008
@@ -0,0 +1,148 @@
+/*
+ *
+ * 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.
+ *
+ */
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed 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.utils;
+
+import org.apache.qpid.Command;
+
+import java.util.Map;
+
+public class JMXConfiguration {
+ private String hostname = "localhost";
+ private String port = "8999";
+ private String interval = "40000";
+ private String outputpath = ".";
+ private String report_file = "report.output";
+ private boolean isreport_mode = false;
+
+ public JMXConfiguration(Map map) {
+ if (checkoptionsetting(CommandLineOptionConstants.JMXCommandLineOptionConstants.HOST_OPTION, map)) {
+ this.hostname = optionchecker(CommandLineOptionConstants.JMXCommandLineOptionConstants.HOST_OPTION, map);
+ }
+ if (checkoptionsetting(CommandLineOptionConstants.JMXCommandLineOptionConstants.PORT_OPTION, map)) {
+ this.port = optionchecker(CommandLineOptionConstants.JMXCommandLineOptionConstants.PORT_OPTION, map);
+ }
+ if (checkoptionsetting(CommandLineOptionConstants.JMXCommandLineOptionConstants.REPORT_OPTION, map)) {
+
+ this.report_file = optionchecker(CommandLineOptionConstants.JMXCommandLineOptionConstants.REPORT_OPTION, map);
+ }
+
+ }
+
+ public void sethostname(String hostname) {
+ this.hostname = hostname;
+ }
+
+ public void setport(String port) {
+ this.port = port;
+ }
+
+ public void setinterval(String interval) {
+ this.interval = interval;
+ }
+
+ public void setoutputpath(String output) {
+ this.outputpath = output;
+ }
+
+ public String gethostname() {
+ return this.hostname;
+ }
+
+ public String getport() {
+ return this.port;
+ }
+
+ public String getinterval() {
+ return this.interval;
+ }
+
+ public String getoutputpath() {
+ return this.outputpath;
+ }
+
+ public CommandLineOption loadoption(String option, Map options) {
+ CommandLineOption op = null;
+ if (option != null) {
+ op = (CommandLineOption) options.get(option);
+
+ }
+ return op;
+
+ }
+
+ public void setreportfile(String reportfile) {
+ this.report_file = reportfile;
+ this.isreport_mode = true;
+
+ }
+
+ public boolean isreportmode() {
+ return this.isreport_mode;
+ }
+
+ public String getreportfile() {
+ return this.report_file;
+ }
+
+ public String optionchecker(String option_letter, Map map) {
+
+ if (map == null)
+ return null;
+ CommandLineOption option = (CommandLineOption) map.get(option_letter);
+ if (option == null)
+ return null;
+ String value = option.getOptionValue();
+ return value;
+ }
+
+ public boolean checkoptionsetting(String option_letter, Map map) {
+ if (map == null)
+ return false;
+ CommandLineOption option = (CommandLineOption) map.get(option_letter);
+ if (option == null)
+ return false;
+ String value = option.getOptionType();
+
+ if (value != null)
+ return true;
+ else
+ return false;
+ }
+
+}
Added: incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/utils/JMXinfo.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/utils/JMXinfo.java?rev=702402&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/utils/JMXinfo.java (added)
+++ incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/utils/JMXinfo.java Tue Oct 7 02:07:34 2008
@@ -0,0 +1,72 @@
+ /*
+ *
+ * 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.
+ *
+ */
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed 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.utils;
+
+import javax.management.remote.JMXConnector;
+import javax.management.MBeanServerConnection;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: lahiru
+ * Date: Jun 3, 2008
+ * Time: 9:21:08 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class JMXinfo {
+ private JMXConnector jmxconnector;
+ private CommandLineOptionParser input;
+ private MBeanServerConnection mbserverconnector;
+
+ public JMXinfo(JMXConnector jmxc, CommandLineOptionParser input, MBeanServerConnection mbsc) {
+ this.jmxconnector = jmxc;
+ this.input = input;
+ this.mbserverconnector = mbsc;
+ }
+
+ public JMXConnector getjmxconnectot() {
+ return jmxconnector;
+ }
+
+ public CommandLineOptionParser getCommandLineOptionParser() {
+ return input;
+ }
+
+ public MBeanServerConnection getmbserverconnector() {
+ return mbserverconnector;
+ }
+}
Added: incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/AllTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/AllTest.java?rev=702402&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/AllTest.java (added)
+++ incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/AllTest.java Tue Oct 7 02:07:34 2008
@@ -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.
+ *
+ */
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.apache.qpid.commands.*;
+import org.apache.qpid.commands.objects.*;
+import org.apache.qpid.utils.TestCommandLineOption;
+import org.apache.qpid.utils.TestCommandLineOptionParser;
+import org.apache.qpid.utils.TestJMXConfiguration;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: lahiru
+ * Date: Jul 7, 2008
+ * Time: 1:09:50 PM
+ * To change this template use File | Settings | File Templates.
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+ TestCommand.class,
+ TestCommandExecusionEngine.class,
+ TestCommandLineOption.class,
+ TestCommandLineOptionParser.class,
+ TestConnector.class,
+ TestJMXConfiguration.class,
+ TestAllObject.class,
+ TestConnectionObject.class,
+ TestExchangeObject.class,
+ TestQueueObject.class,
+ TestVirtualHostObject.class,
+ TestUserManagementObject.class,
+ TestCommanddelete.class,
+ TestCommandlist.class,
+ TestCommandinfo.class,
+ TestCommandmove.class,
+ TestCommandview.class,
+ TestCommandviewcontent.class,
+ TestCommandLineInterpreter.class
+
+
+ })
+public class AllTest {
+}
Added: incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/ConnectionConstants.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/ConnectionConstants.java?rev=702402&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/ConnectionConstants.java (added)
+++ incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/ConnectionConstants.java Tue Oct 7 02:07:34 2008
@@ -0,0 +1,51 @@
+/*
+ *
+ * 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.
+ *
+ */
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: lahiru
+ * Date: Aug 16, 2008
+ * Time: 4:55:21 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public interface ConnectionConstants {
+ String BROKER_HOSTNAME="localhost";
+ String BROKER_PORT="8999";
+}
Added: incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/TestCommandExecusionEngine.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/TestCommandExecusionEngine.java?rev=702402&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/TestCommandExecusionEngine.java (added)
+++ incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/TestCommandExecusionEngine.java Tue Oct 7 02:07:34 2008
@@ -0,0 +1,90 @@
+/*
+ *
+ * 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.
+ *
+ */
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+import junit.framework.TestCase;
+import org.apache.qpid.utils.JMXinfo;
+import org.apache.qpid.utils.CommandLineOptionParser;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.Assert;
+import org.junit.After;
+
+import java.io.IOException;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: lahiru
+ * Date: Jun 30, 2008
+ * Time: 12:06:25 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class TestCommandExecusionEngine {
+ String line;
+ String [] command;
+ CommandLineOptionParser commandlineoptionparser;
+ JMXinfo info;
+ CommandExecusionEngine engine;
+ Connector connector;
+ @Before
+ public void setup(){
+
+ connector = ConnectorFactory.getConnector("localhost","8999");
+
+
+ }
+ @Test
+ public void TestCommandSelector()
+ {
+ line = "list -o queue";
+ command = line.split(" ");
+ commandlineoptionparser = new CommandLineOptionParser(command);
+ info = new JMXinfo(connector.getConnector(), commandlineoptionparser,connector.getMBeanServerConnection());
+ engine = new CommandExecusionEngine(info);
+ Assert.assertEquals(engine.CommandSelector(),true);
+ }
+ @After
+ public void cleanup()
+ {
+ try {
+ connector.getConnector().close();
+ } catch (IOException e) {
+ e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }
+ }
+}
Added: incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/TestCommandLineInterpreter.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/TestCommandLineInterpreter.java?rev=702402&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/TestCommandLineInterpreter.java (added)
+++ incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/TestCommandLineInterpreter.java Tue Oct 7 02:07:34 2008
@@ -0,0 +1,101 @@
+/*
+ *
+ * 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.
+ *
+ */
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+import junit.framework.TestCase;
+import org.apache.qpid.utils.JMXinfo;
+import org.apache.qpid.utils.CommandLineOptionParser;
+import org.apache.qpid.commands.Commandinfo;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.Assert;
+import org.junit.After;
+
+import javax.management.remote.JMXConnector;
+import javax.management.MBeanServerConnection;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: lahiru
+ * Date: Jun 30, 2008
+ * Time: 12:08:52 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class TestCommandLineInterpreter {
+
+// CommandLineInterpreter test = new CommandLineInterpreter();
+ /* In this class there are only methodes which are displaying data on console so no test can be written*/
+ String command = "-h " + ConnectionConstants.BROKER_HOSTNAME + " -p " + ConnectionConstants.BROKER_PORT + " info -o queue -n ping -v test";
+ Connector conn= null;
+ JMXConnector jmxc=null;
+ MBeanServerConnection mbsc=null;
+ CommandLineOptionParser parser=null;
+
+
+ String [] args = null;
+ @Before
+ public void startup()
+ {
+ args = command.split(" ");
+// System.out.println(args[0]);
+ conn = ConnectorFactory.getConnector(ConnectionConstants.BROKER_HOSTNAME, ConnectionConstants.BROKER_PORT);
+ jmxc = conn.getConnector();
+ mbsc = conn.getMBeanServerConnection();
+ parser = new CommandLineOptionParser(args,args[0]);
+
+ }
+ @Test
+ public void TestSetQueryString()
+ {
+ CommandLineInterpreter.oneshotmode(args,parser,jmxc,mbsc);
+ Assert.assertEquals(args[0],"info");
+ Assert.assertEquals(args[1],"-o");
+ Assert.assertEquals(args[2],"queue");
+ Assert.assertEquals(args[3],"-n");
+ Assert.assertEquals(args[4],"ping");
+ Assert.assertEquals(args[5],"-v");
+ Assert.assertEquals(args[6],"test");
+ }
+
+ @After
+ public void cleanup()
+ {
+
+ }
+}
+
Added: incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/TestConnector.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/TestConnector.java?rev=702402&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/TestConnector.java (added)
+++ incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/TestConnector.java Tue Oct 7 02:07:34 2008
@@ -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.
+*
+*/
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+import junit.framework.TestCase;
+
+import javax.management.remote.JMXServiceURL;
+import javax.management.remote.JMXConnectorFactory;
+import javax.management.remote.JMXConnector;
+import javax.management.MBeanServerConnection;
+import java.net.MalformedURLException;
+import java.io.IOException;
+
+import org.junit.Test;
+import org.junit.Before;
+import org.junit.After;
+import org.junit.Assert;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: lahiru
+ * Date: Jun 30, 2008
+ * Time: 12:11:50 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class TestConnector {
+ Connector test;
+ JMXServiceURL svc_url;
+ JMXConnector connector;
+ MBeanServerConnection mbsc;
+
+ @Before
+ public void setup()
+ {
+ test = ConnectorFactory.getConnector("localhost","8999");
+ String url = "service:jmx:rmi:///jndi/rmi://localhost:8999/jmxrmi";
+
+ }
+ @Test
+ public void testGetURL()
+ {
+
+
+// Assert.assertNotNull(test);
+ Assert.assertEquals(test.getURL(),test.getURL());
+ }
+ @Test
+ public void testGetConnector()
+ {
+ Assert.assertEquals(test.getConnector(),test.getConnector());
+ }
+ @Test
+ public void testGetMBeanServerConnection()
+ {
+ Assert.assertEquals(test.getMBeanServerConnection(),test.getMBeanServerConnection());
+ }
+ @After
+ public void cleanup()
+ {
+ try {
+
+ test.getConnector().close();
+ test = null;
+ } catch (IOException e) {
+ e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }
+ test = null;
+ }
+
+
+}
Added: incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/TestReportGenerator.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/TestReportGenerator.java?rev=702402&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/TestReportGenerator.java (added)
+++ incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/TestReportGenerator.java Tue Oct 7 02:07:34 2008
@@ -0,0 +1,50 @@
+/*
+*
+* 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.
+*
+*/
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed 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;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: lahiru
+ * Date: Aug 13, 2008
+ * Time: 7:16:17 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class TestReportGenerator {
+
+
+}
Added: incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommand.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommand.java?rev=702402&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommand.java (added)
+++ incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommand.java Tue Oct 7 02:07:34 2008
@@ -0,0 +1,99 @@
+/*
+ *
+ * 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.
+ *
+ */
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed 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.commands;
+
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import junit.framework.JUnit4TestAdapter;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.After;
+import org.junit.Assert;
+import org.apache.qpid.Connector;
+import org.apache.qpid.ConnectorFactory;
+import org.apache.qpid.ConnectionConstants;
+import org.apache.qpid.utils.JMXinfo;
+import org.apache.qpid.utils.CommandLineOptionParser;
+
+import javax.management.MBeanServerConnection;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: lahiru
+ * Date: Jun 30, 2008
+ * Time: 12:21:32 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class TestCommand{
+ String command = "list -o queue";
+ String [] list;
+ Connector test;
+ MBeanServerConnection mbsc;
+ JMXinfo info;
+ CommandLineOptionParser parser;
+ Command cmd;
+ @Before
+ public void setup()
+ {
+ list = command.split(" ");
+ parser = new CommandLineOptionParser(list);
+ test = ConnectorFactory.getConnector(ConnectionConstants.BROKER_HOSTNAME,ConnectionConstants.BROKER_PORT);
+ info = new JMXinfo(test.getConnector(),parser,test.getMBeanServerConnection());
+ cmd = new Command(info,"list");
+
+ }
+ @Test
+ public void TestOptionChecker()
+ {
+ Assert.assertEquals(cmd.optionchecker("o"),"queue");
+ }
+ @Test
+ public void TestCheckOptionSetting()
+ {
+ Assert.assertEquals(cmd.checkoptionsetting("o"),true);
+ Assert.assertEquals(cmd.checkoptionsetting("p"),false);
+ }
+ @After
+ public void cleanup()
+ {
+ parser = null;
+ test = null;
+ info = null;
+ cmd = null;
+ }
+}
Added: incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommanddelete.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommanddelete.java?rev=702402&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommanddelete.java (added)
+++ incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommanddelete.java Tue Oct 7 02:07:34 2008
@@ -0,0 +1,99 @@
+/*
+ *
+ * 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.
+ *
+ */
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed 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.commands;
+
+import org.junit.After;
+import org.junit.Test;
+import org.junit.Before;
+import org.junit.Assert;
+import org.apache.qpid.ConnectorFactory;
+import org.apache.qpid.Connector;
+import org.apache.qpid.ConnectionConstants;
+import org.apache.qpid.utils.JMXinfo;
+import org.apache.qpid.utils.CommandLineOptionParser;
+
+import javax.management.remote.JMXConnector;
+import javax.management.MBeanServerConnection;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: lahiru
+ * Date: Aug 11, 2008
+ * Time: 10:13:45 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class TestCommanddelete {
+ JMXinfo info=null;
+ String command = "delete -o queue -n ping -v test -t 1";
+ Commanddelete delete = null;
+ Connector conn;
+ @Before
+ public void startup()
+ {
+ conn = ConnectorFactory.getConnector(ConnectionConstants.BROKER_HOSTNAME, ConnectionConstants.BROKER_PORT);
+ JMXConnector jmxc = conn.getConnector();
+ MBeanServerConnection mbsc = conn.getMBeanServerConnection();
+ CommandLineOptionParser parser = new CommandLineOptionParser(command.split(" "));
+ info = new JMXinfo(jmxc,parser,mbsc);
+ delete = new Commanddelete(info,"delete");
+
+
+
+ }
+ @Test
+ public void TestSetQueryString()
+ {
+ delete.execute();
+ Assert.assertEquals(delete.getobject(),"queue");
+ Assert.assertEquals(delete.getvhost(),"test");
+ Assert.assertEquals(delete.getname(),"ping");
+ Assert.assertEquals(delete.getnumber(),1);
+
+ }
+
+ @After
+ public void cleanup()
+ {
+ try{
+ conn.getConnector().close();
+ }catch(Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+}
Added: incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandinfo.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandinfo.java?rev=702402&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandinfo.java (added)
+++ incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandinfo.java Tue Oct 7 02:07:34 2008
@@ -0,0 +1,95 @@
+/*
+ *
+ * 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.
+ *
+ */
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed 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.commands;
+
+import org.apache.qpid.utils.JMXinfo;
+import org.apache.qpid.utils.CommandLineOptionParser;
+import org.apache.qpid.Connector;
+import org.apache.qpid.ConnectorFactory;
+import org.apache.qpid.ConnectionConstants;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.Assert;
+import org.junit.After;
+
+import javax.management.remote.JMXConnector;
+import javax.management.MBeanServerConnection;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: lahiru
+ * Date: Aug 16, 2008
+ * Time: 6:30:24 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class TestCommandinfo {
+ JMXinfo info=null;
+ String command = "info -o queue -n ping -v test";
+ Commandinfo infocommand = null;
+ Connector conn = null;
+ @Before
+ public void startup()
+ {
+ conn = ConnectorFactory.getConnector(ConnectionConstants.BROKER_HOSTNAME, ConnectionConstants.BROKER_PORT);
+ JMXConnector jmxc = conn.getConnector();
+ MBeanServerConnection mbsc = conn.getMBeanServerConnection();
+ CommandLineOptionParser parser = new CommandLineOptionParser(command.split(" "));
+ info = new JMXinfo(jmxc,parser,mbsc);
+ infocommand = new Commandinfo(info,"list");
+
+ }
+ @Test
+ public void TestSetQueryString()
+ {
+ infocommand.execute();
+ Assert.assertEquals(infocommand.getobject(),"queue");
+ Assert.assertEquals(infocommand.getvirtualhost(),"test");
+ Assert.assertEquals(infocommand.getname(),"ping");
+ }
+
+ @After
+ public void cleanup()
+ {
+ try{
+ conn.getConnector().close();
+ }catch(Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+}
Added: incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandlist.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandlist.java?rev=702402&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandlist.java (added)
+++ incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandlist.java Tue Oct 7 02:07:34 2008
@@ -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.
+ *
+ */
+ /*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed 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.commands;
+
+import junit.framework.TestCase;
+import org.apache.qpid.ConnectionConstants;
+import org.apache.qpid.Connector;
+import org.apache.qpid.ConnectorFactory;
+import org.apache.qpid.utils.CommandLineOptionParser;
+import org.apache.qpid.utils.JMXinfo;
+import org.junit.Test;
+import org.junit.Before;
+import org.junit.After;
+import org.junit.Assert;
+
+import javax.management.remote.JMXConnector;
+import javax.management.MBeanServerConnection;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: lahiru
+ * Date: Jun 30, 2008
+ * Time: 12:18:28 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class TestCommandlist {
+ /* All the methods in Commandlist doesn't have any arguments
+ and no return type.
+ */
+ JMXinfo info=null;
+ String command = "list -o queue -n ping -v test";
+ Commandlist list = null;
+ Connector conn = null;
+ @Before
+ public void startup()
+ {
+ conn = ConnectorFactory.getConnector(ConnectionConstants.BROKER_HOSTNAME, ConnectionConstants.BROKER_PORT);
+ JMXConnector jmxc = conn.getConnector();
+ MBeanServerConnection mbsc = conn.getMBeanServerConnection();
+ CommandLineOptionParser parser = new CommandLineOptionParser(command.split(" "));
+ info = new JMXinfo(jmxc,parser,mbsc);
+ list = new Commandlist(info,"list");
+
+ }
+ @Test
+ public void TestSetQueryString()
+ {
+ list.execute();
+ Assert.assertEquals(list.getobject(),"queue");
+ Assert.assertEquals(list.getvhost(),"test");
+ Assert.assertEquals(list.getname(),"ping");
+ }
+
+ @After
+ public void cleanup()
+ {
+ try{
+ conn.getConnector().close();
+ }catch(Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+
+}
Added: incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandmove.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandmove.java?rev=702402&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandmove.java (added)
+++ incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandmove.java Tue Oct 7 02:07:34 2008
@@ -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.
+ *
+ */
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed 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.commands;
+
+import org.apache.qpid.ConnectionConstants;
+import org.apache.qpid.Connector;
+import org.apache.qpid.ConnectorFactory;
+import org.apache.qpid.utils.CommandLineOptionParser;
+import org.apache.qpid.utils.JMXinfo;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.After;
+import org.junit.Assert;
+
+import javax.management.remote.JMXConnector;
+import javax.management.MBeanServerConnection;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: lahiru
+ * Date: Aug 11, 2008
+ * Time: 10:14:34 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class TestCommandmove {
+ JMXinfo info=null;
+ String command = "move -o queue -n1 ping -v1 test -n2 message_queue -fmid 10 -tmid 12";
+ Commandmove move = null;
+ Connector conn=null;
+ @Before
+ public void startup()
+ {
+ conn = ConnectorFactory.getConnector(ConnectionConstants.BROKER_HOSTNAME, ConnectionConstants.BROKER_PORT);
+ JMXConnector jmxc = conn.getConnector();
+ MBeanServerConnection mbsc = conn.getMBeanServerConnection();
+ CommandLineOptionParser parser = new CommandLineOptionParser(command.split(" "));
+ info = new JMXinfo(jmxc,parser,mbsc);
+ move = new Commandmove(info,"move");
+
+
+
+ }
+ @Test
+ public void TestSetQueryString()
+ {
+ move.execute();
+ Assert.assertEquals(move.getobject(),"queue");
+ Assert.assertEquals(move.getvhost(),"test");
+ Assert.assertEquals(move.getname1(),"ping");
+ Assert.assertEquals(move.getname2(),"message_queue");
+ Assert.assertEquals(move.getfmid(),10);
+ Assert.assertEquals(move.gettmid(),12);
+ }
+
+ @After
+ public void cleanup()
+ {
+ try{
+ conn.getConnector().close();
+ }catch(Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+}
Added: incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandview.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandview.java?rev=702402&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandview.java (added)
+++ incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandview.java Tue Oct 7 02:07:34 2008
@@ -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.
+ *
+ */
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed 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.commands;
+
+import org.apache.qpid.ConnectionConstants;
+import org.apache.qpid.ConnectorFactory;
+import org.apache.qpid.Connector;
+import org.apache.qpid.utils.CommandLineOptionParser;
+import org.apache.qpid.utils.JMXinfo;
+import org.junit.Test;
+import org.junit.Before;
+import org.junit.After;
+import org.junit.Assert;
+
+import javax.management.MBeanServerConnection;
+import javax.management.remote.JMXConnector;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: lahiru
+ * Date: Aug 11, 2008
+ * Time: 10:14:58 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class TestCommandview {
+ JMXinfo info=null;
+ String command = "view -o queue -n ping -v test -t 10";
+ Commandview view =null;
+ Connector conn=null;
+ @Before
+ public void startup()
+ {
+ conn = ConnectorFactory.getConnector(ConnectionConstants.BROKER_HOSTNAME, ConnectionConstants.BROKER_PORT);
+ JMXConnector jmxc = conn.getConnector();
+ MBeanServerConnection mbsc = conn.getMBeanServerConnection();
+ CommandLineOptionParser parser = new CommandLineOptionParser(command.split(" "));
+ info = new JMXinfo(jmxc,parser,mbsc);
+ view = new Commandview(info,"view");
+ }
+ @Test
+ public void TestSetQueryString()
+ {
+ view.execute();
+ Assert.assertEquals(view.getobject(),"queue");
+ Assert.assertEquals(view.getvhost(),"test");
+ Assert.assertEquals(view.getname(),"ping");
+ Assert.assertEquals(view.getnumber(),10);
+
+ }
+
+ @After
+ public void cleanup()
+ {
+ try{
+ conn.getConnector().close();
+ }catch(Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+}
Added: incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandviewcontent.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandviewcontent.java?rev=702402&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandviewcontent.java (added)
+++ incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandviewcontent.java Tue Oct 7 02:07:34 2008
@@ -0,0 +1,99 @@
+/*
+ *
+ * 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.
+ *
+ */
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed 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.commands;
+
+import org.apache.qpid.utils.JMXinfo;
+import org.apache.qpid.utils.CommandLineOptionParser;
+import org.apache.qpid.Connector;
+import org.apache.qpid.ConnectorFactory;
+import org.apache.qpid.ConnectionConstants;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.After;
+import org.junit.Assert;
+
+import javax.management.remote.JMXConnector;
+import javax.management.MBeanServerConnection;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: lahiru
+ * Date: Aug 11, 2008
+ * Time: 10:15:17 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class TestCommandviewcontent {
+ JMXinfo info=null;
+ String command = "viewcontent -o queue -n ping -v test -id 10";
+ Commandviewcontent viewcontent =null;
+ Connector conn = null;
+ @Before
+ public void startup()
+ {
+ conn = ConnectorFactory.getConnector(ConnectionConstants.BROKER_HOSTNAME, ConnectionConstants.BROKER_PORT);
+ JMXConnector jmxc = conn.getConnector();
+ MBeanServerConnection mbsc = conn.getMBeanServerConnection();
+ CommandLineOptionParser parser = new CommandLineOptionParser(command.split(" "));
+ info = new JMXinfo(jmxc,parser,mbsc);
+ viewcontent = new Commandviewcontent(info,"viewcontent");
+
+
+
+ }
+ @Test
+ public void TestSetQueryString()
+ {
+ viewcontent.execute();
+ Assert.assertEquals(viewcontent.getobject(),"queue");
+ Assert.assertEquals(viewcontent.getnumber(),10);
+ Assert.assertEquals(viewcontent.getname(),"ping");
+ Assert.assertEquals(viewcontent.getvhost(),"test");
+
+ }
+
+ @After
+ public void cleanup()
+ {
+ try{
+ conn.getConnector().close();
+ }catch(Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+}
Added: incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/objects/TestAllObject.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/objects/TestAllObject.java?rev=702402&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/objects/TestAllObject.java (added)
+++ incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/objects/TestAllObject.java Tue Oct 7 02:07:34 2008
@@ -0,0 +1,93 @@
+/*
+ *
+ * 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.
+ *
+ */
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed 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.commands.objects;
+
+import junit.framework.TestCase;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.After;
+import org.junit.Assert;
+import org.apache.qpid.ConnectorFactory;
+import org.apache.qpid.Connector;
+
+import javax.management.MBeanServerConnection;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: lahiru
+ * Date: Jun 30, 2008
+ * Time: 12:23:25 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class TestAllObject {
+ Connector conn;
+ MBeanServerConnection mbsc;
+ AllObjects test;
+ String test1,test2;
+
+ @Before
+ public void startup()
+ {
+ conn = ConnectorFactory.getConnector("localhost", "8999");
+ mbsc = conn.getMBeanServerConnection();
+ test = new AllObjects(mbsc);
+ test1 = "empty input1";
+ test2 = "empty input2";
+
+
+ }
+ @Test
+ public void TestSetQueryString()
+ {
+ test.setQueryString(test1,test2);
+ Assert.assertEquals(test.querystring,"org.apache.qpid:*");
+
+ }
+
+ @After
+ public void cleanup()
+ {
+ try{
+ conn.getConnector().close();
+ }catch(Exception ex)
+ {
+ ex.printStackTrace();
+ }
+
+ }
+}
Added: incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/objects/TestConnectionObject.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/objects/TestConnectionObject.java?rev=702402&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/objects/TestConnectionObject.java (added)
+++ incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/objects/TestConnectionObject.java Tue Oct 7 02:07:34 2008
@@ -0,0 +1,105 @@
+/*
+ *
+ * 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.
+ *
+ */
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed 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.commands.objects;
+
+import junit.framework.TestCase;
+import org.apache.qpid.ConnectorFactory;
+import org.apache.qpid.Connector;
+import org.junit.After;
+import org.junit.Test;
+import org.junit.Assert;
+import org.junit.Before;
+
+import javax.management.MBeanServerConnection;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: lahiru
+ * Date: Jun 30, 2008
+ * Time: 12:24:14 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class TestConnectionObject {
+ Connector conn;
+ MBeanServerConnection mbsc;
+ ConnectionObject test;
+ String test1,test2,test3;
+
+ @Before
+ public void startup()
+ {
+ conn = ConnectorFactory.getConnector("localhost", "8999");
+ mbsc = conn.getMBeanServerConnection();
+ test = new ConnectionObject(mbsc);
+ test1 = "ping";
+ test2 = "test";
+ test3 = "object";
+
+
+ }
+ @Test
+ public void TestSetQueryString()
+ {
+ test.setQueryString(test3,test1,null);
+ Assert.assertEquals(test.querystring,"org.apache.qpid:type=Connection,name=ping,*");
+ test.querystring = null;
+ test.setQueryString(test3,null,test2);
+ Assert.assertEquals(test.querystring,"org.apache.qpid:type=Connection,VirtualHost=test,*");
+ test.querystring = null;
+ test.setQueryString(test3,test1,test2);
+ Assert.assertEquals(test.querystring,"org.apache.qpid:type=Connection,VirtualHost=test,name=ping,*");
+ test.querystring = null;
+ test.setQueryString(test3,null,null);
+ Assert.assertEquals(test.querystring,"org.apache.qpid:type=Connection,*");
+
+
+
+ }
+
+ @After
+ public void cleanup()
+ {
+ try{
+ conn.getConnector().close();
+ }catch(Exception ex)
+ {
+ ex.printStackTrace();
+ }
+
+ }
+}
Added: incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/objects/TestExchangeObject.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/objects/TestExchangeObject.java?rev=702402&view=auto
==============================================================================
--- incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/objects/TestExchangeObject.java (added)
+++ incubator/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/objects/TestExchangeObject.java Tue Oct 7 02:07:34 2008
@@ -0,0 +1,103 @@
+/*
+ *
+ * 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.
+ *
+ */
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed 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.commands.objects;
+
+import junit.framework.TestCase;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.After;
+import org.junit.Before;
+import org.apache.qpid.Connector;
+import org.apache.qpid.ConnectorFactory;
+
+import javax.management.MBeanServerConnection;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: lahiru
+ * Date: Jun 30, 2008
+ * Time: 12:24:49 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class TestExchangeObject {
+ Connector conn;
+ MBeanServerConnection mbsc;
+ ExchangeObject test;
+ String test1,test2,test3;
+
+ @Before
+ public void startup()
+ {
+ conn = ConnectorFactory.getConnector("localhost", "8999");
+ mbsc = conn.getMBeanServerConnection();
+ test = new ExchangeObject(mbsc);
+ test1 = "ping";
+ test2 = "test";
+ test3 = "object";
+
+
+ }
+ @Test
+ public void TestSetQueryString()
+ {
+ test.setQueryString(test3,test1,null);
+// System.out.println(test.querystring);
+// System.out.println("org.apache.qpid:type=VitualHost.Exchange,name=ping,*");
+ Assert.assertEquals(test.querystring,"org.apache.qpid:type=VirtualHost.Exchange,name=ping,*");
+ test.querystring = null;
+ test.setQueryString(test3,null,test2);
+ Assert.assertEquals(test.querystring,"org.apache.qpid:type=VirtualHost.Exchange,VirtualHost=test,*");
+ test.querystring = null;
+ test.setQueryString(test3,test1,test2);
+ Assert.assertEquals(test.querystring,"org.apache.qpid:type=VirtualHost.Exchange,VirtualHost=test,name=ping,*");
+ test.querystring = null;
+ test.setQueryString(test3,null,null);
+ }
+
+ @After
+ public void cleanup()
+ {
+ try{
+ conn.getConnector().close();
+ }catch(Exception ex)
+ {
+ ex.printStackTrace();
+ }
+
+ }
+}