summaryrefslogtreecommitdiff
path: root/qpid/java/management/tools/qpid-cli/test
diff options
context:
space:
mode:
authorLahiru Gunathilake <lahiru@apache.org>2008-10-07 09:07:34 +0000
committerLahiru Gunathilake <lahiru@apache.org>2008-10-07 09:07:34 +0000
commit72b302e7c6ce04f700dfc8f52a17599dd2268eb8 (patch)
tree478c74e63dc35eb81a6e6bf31ed851ab935268ae /qpid/java/management/tools/qpid-cli/test
parent6498fc705816a435f8a9a5f2fdd60816b19beb90 (diff)
downloadqpid-python-72b302e7c6ce04f700dfc8f52a17599dd2268eb8.tar.gz
committing qpid-cli for the first time.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@702402 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/management/tools/qpid-cli/test')
-rw-r--r--qpid/java/management/tools/qpid-cli/test/org/apache/qpid/AllTest.java80
-rw-r--r--qpid/java/management/tools/qpid-cli/test/org/apache/qpid/ConnectionConstants.java51
-rw-r--r--qpid/java/management/tools/qpid-cli/test/org/apache/qpid/TestCommandExecusionEngine.java90
-rw-r--r--qpid/java/management/tools/qpid-cli/test/org/apache/qpid/TestCommandLineInterpreter.java101
-rw-r--r--qpid/java/management/tools/qpid-cli/test/org/apache/qpid/TestConnector.java106
-rw-r--r--qpid/java/management/tools/qpid-cli/test/org/apache/qpid/TestReportGenerator.java50
-rw-r--r--qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommand.java99
-rw-r--r--qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommanddelete.java99
-rw-r--r--qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandinfo.java95
-rw-r--r--qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandlist.java100
-rw-r--r--qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandmove.java100
-rw-r--r--qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandview.java96
-rw-r--r--qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandviewcontent.java99
-rw-r--r--qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/objects/TestAllObject.java93
-rw-r--r--qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/objects/TestConnectionObject.java105
-rw-r--r--qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/objects/TestExchangeObject.java103
-rw-r--r--qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/objects/TestObjectNames.java51
-rw-r--r--qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/objects/TestQueueObject.java106
-rw-r--r--qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/objects/TestUserManagementObject.java102
-rw-r--r--qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/objects/TestVirtualHostObject.java88
-rw-r--r--qpid/java/management/tools/qpid-cli/test/org/apache/qpid/utils/TestCommandLineOption.java85
-rw-r--r--qpid/java/management/tools/qpid-cli/test/org/apache/qpid/utils/TestCommandLineOptionParser.java100
-rw-r--r--qpid/java/management/tools/qpid-cli/test/org/apache/qpid/utils/TestJMXConfigProperty.java51
-rw-r--r--qpid/java/management/tools/qpid-cli/test/org/apache/qpid/utils/TestJMXConfiguration.java85
-rw-r--r--qpid/java/management/tools/qpid-cli/test/org/apache/qpid/utils/TestJMXinfo.java53
25 files changed, 2188 insertions, 0 deletions
diff --git a/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/AllTest.java b/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/AllTest.java
new file mode 100644
index 0000000000..bdae5340b5
--- /dev/null
+++ b/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/AllTest.java
@@ -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 {
+}
diff --git a/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/ConnectionConstants.java b/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/ConnectionConstants.java
new file mode 100644
index 0000000000..58953e1693
--- /dev/null
+++ b/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/ConnectionConstants.java
@@ -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";
+}
diff --git a/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/TestCommandExecusionEngine.java b/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/TestCommandExecusionEngine.java
new file mode 100644
index 0000000000..bb5fa914d0
--- /dev/null
+++ b/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/TestCommandExecusionEngine.java
@@ -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.
+ }
+ }
+}
diff --git a/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/TestCommandLineInterpreter.java b/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/TestCommandLineInterpreter.java
new file mode 100644
index 0000000000..36a2d29dfd
--- /dev/null
+++ b/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/TestCommandLineInterpreter.java
@@ -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()
+ {
+
+ }
+}
+
diff --git a/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/TestConnector.java b/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/TestConnector.java
new file mode 100644
index 0000000000..e6b80aae66
--- /dev/null
+++ b/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/TestConnector.java
@@ -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;
+ }
+
+
+}
diff --git a/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/TestReportGenerator.java b/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/TestReportGenerator.java
new file mode 100644
index 0000000000..a2ed94d948
--- /dev/null
+++ b/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/TestReportGenerator.java
@@ -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 {
+
+
+}
diff --git a/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommand.java b/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommand.java
new file mode 100644
index 0000000000..2c92b8d66d
--- /dev/null
+++ b/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommand.java
@@ -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;
+ }
+}
diff --git a/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommanddelete.java b/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommanddelete.java
new file mode 100644
index 0000000000..5bdca118d5
--- /dev/null
+++ b/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommanddelete.java
@@ -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();
+ }
+ }
+}
diff --git a/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandinfo.java b/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandinfo.java
new file mode 100644
index 0000000000..f4bb403e18
--- /dev/null
+++ b/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandinfo.java
@@ -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();
+ }
+ }
+}
diff --git a/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandlist.java b/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandlist.java
new file mode 100644
index 0000000000..c8e044d6fe
--- /dev/null
+++ b/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandlist.java
@@ -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();
+ }
+ }
+
+}
diff --git a/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandmove.java b/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandmove.java
new file mode 100644
index 0000000000..278fa72365
--- /dev/null
+++ b/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandmove.java
@@ -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();
+ }
+ }
+}
diff --git a/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandview.java b/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandview.java
new file mode 100644
index 0000000000..385d197475
--- /dev/null
+++ b/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandview.java
@@ -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();
+ }
+ }
+}
diff --git a/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandviewcontent.java b/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandviewcontent.java
new file mode 100644
index 0000000000..2b8f0e3ffd
--- /dev/null
+++ b/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/TestCommandviewcontent.java
@@ -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();
+ }
+ }
+}
diff --git a/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/objects/TestAllObject.java b/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/objects/TestAllObject.java
new file mode 100644
index 0000000000..25069e6dbb
--- /dev/null
+++ b/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/objects/TestAllObject.java
@@ -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();
+ }
+
+ }
+}
diff --git a/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/objects/TestConnectionObject.java b/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/objects/TestConnectionObject.java
new file mode 100644
index 0000000000..8f98d1ac37
--- /dev/null
+++ b/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/objects/TestConnectionObject.java
@@ -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();
+ }
+
+ }
+}
diff --git a/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/objects/TestExchangeObject.java b/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/objects/TestExchangeObject.java
new file mode 100644
index 0000000000..64f2bef79a
--- /dev/null
+++ b/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/objects/TestExchangeObject.java
@@ -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();
+ }
+
+ }
+}
diff --git a/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/objects/TestObjectNames.java b/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/objects/TestObjectNames.java
new file mode 100644
index 0000000000..b26d1f5a82
--- /dev/null
+++ b/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/objects/TestObjectNames.java
@@ -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.commands.objects;
+
+import junit.framework.TestCase;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: lahiru
+ * Date: Jun 30, 2008
+ * Time: 12:22:54 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class TestObjectNames {
+
+}
diff --git a/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/objects/TestQueueObject.java b/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/objects/TestQueueObject.java
new file mode 100644
index 0000000000..96b153f65d
--- /dev/null
+++ b/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/objects/TestQueueObject.java
@@ -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.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:25:21 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class TestQueueObject{
+ Connector conn;
+ MBeanServerConnection mbsc;
+ QueueObject test;
+ String test1,test2,test3;
+
+ @Before
+ public void startup()
+ {
+ conn = ConnectorFactory.getConnector("localhost", "8999");
+ mbsc = conn.getMBeanServerConnection();
+ test = new QueueObject(mbsc);
+ test1 = "ping";
+ test2 = "test";
+ test3 = "object";
+
+
+ }
+ @Test
+ public void TestSetQueryString()
+ {
+ test.setQueryString(test3,test1,null);
+ Assert.assertEquals(test.querystring,"org.apache.qpid:type=VirtualHost.Queue,name=ping,*");
+ test.querystring = null;
+ test.setQueryString(test3,null,test2);
+ Assert.assertEquals(test.querystring,"org.apache.qpid:type=VirtualHost.Queue,VirtualHost=test,*");
+ test.querystring = null;
+ test.setQueryString(test3,test1,test2);
+ Assert.assertEquals(test.querystring,"org.apache.qpid:type=VirtualHost.Queue,VirtualHost=test,name=ping,*");
+ test.querystring = null;
+ test.setQueryString(test3,null,null);
+ Assert.assertEquals(test.querystring,"org.apache.qpid:type=VirtualHost.Queue,*");
+
+
+
+ }
+
+ @After
+ public void cleanup()
+ {
+ try{
+ conn.getConnector().close();
+ }catch(Exception ex)
+ {
+ ex.printStackTrace();
+ }
+
+ }
+}
+
diff --git a/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/objects/TestUserManagementObject.java b/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/objects/TestUserManagementObject.java
new file mode 100644
index 0000000000..a9123eb604
--- /dev/null
+++ b/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/objects/TestUserManagementObject.java
@@ -0,0 +1,102 @@
+/*
+ *
+ * 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.After;
+import org.junit.Test;
+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:26:09 PM
+ * To change this template use File | Settings | File Templates.
+ */
+
+
+
+public class TestUserManagementObject{
+ Connector conn;
+ MBeanServerConnection mbsc;
+ UserManagementObject test;
+ String test1,test2,test3;
+
+ @Before
+ public void startup()
+ {
+ conn = ConnectorFactory.getConnector("localhost", "8999");
+ mbsc = conn.getMBeanServerConnection();
+ test = new UserManagementObject(mbsc);
+ test1 = "ping";
+ test2 = "test";
+ test3 = "object";
+
+
+ }
+ @Test
+ public void TestSetQueryString()
+ {
+ test.setQueryString(test3,test1,test2);
+ Assert.assertEquals(test.querystring,"org.apache.qpid:type=UserManagement,*");
+
+
+
+
+ }
+
+ @After
+ public void cleanup()
+ {
+ try{
+ conn.getConnector().close();
+ }catch(Exception ex)
+ {
+ ex.printStackTrace();
+ }
+
+ }
+}
+
+
diff --git a/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/objects/TestVirtualHostObject.java b/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/objects/TestVirtualHostObject.java
new file mode 100644
index 0000000000..29a233733d
--- /dev/null
+++ b/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/commands/objects/TestVirtualHostObject.java
@@ -0,0 +1,88 @@
+/*
+*
+* 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 junit.framework.TestCase;
+import org.junit.Assert;
+import org.junit.After;
+import org.junit.Test;
+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:26:40 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class TestVirtualHostObject{
+ Connector conn;
+ MBeanServerConnection mbsc;
+ VirtualHostObject test;
+ String test1,test2,test3;
+
+ @Before
+ public void startup()
+ {
+ conn = ConnectorFactory.getConnector("localhost", "8999");
+ mbsc = conn.getMBeanServerConnection();
+ test = new VirtualHostObject(mbsc);
+ test1 = "ping";
+ test2 = "test";
+ test3 = "object";
+
+
+ }
+ @Test
+ public void TestSetQueryString()
+ {
+ test.setQueryString(test3,test1,null);
+ Assert.assertEquals(test.querystring,"org.apache.qpid:type=VirtualHost.VirtualHostManager,name=ping,*");
+ test.querystring = null;
+ test.setQueryString(test3,null,test2);
+ Assert.assertEquals(test.querystring,"org.apache.qpid:type=VirtualHost.VirtualHostManager,VirtualHost=test,*");
+ test.querystring = null;
+ test.setQueryString(test3,test1,test2);
+ Assert.assertEquals(test.querystring,"org.apache.qpid:type=VirtualHost.VirtualHostManager,VirtualHost=test,name=ping,*");
+ test.querystring = null;
+ test.setQueryString(test3,null,null);
+ Assert.assertEquals(test.querystring,"org.apache.qpid:type=VirtualHost.VirtualHostManager,*");
+
+
+
+ }
+
+ @After
+ public void cleanup()
+ {
+ try{
+ conn.getConnector().close();
+ }catch(Exception ex)
+ {
+ ex.printStackTrace();
+ }
+
+ }
+}
diff --git a/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/utils/TestCommandLineOption.java b/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/utils/TestCommandLineOption.java
new file mode 100644
index 0000000000..58d71a4de6
--- /dev/null
+++ b/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/utils/TestCommandLineOption.java
@@ -0,0 +1,85 @@
+/*
+ *
+ * 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 junit.framework.TestCase;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.Assert;
+import org.junit.After;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: lahiru
+ * Date: Jun 30, 2008
+ * Time: 12:17:26 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class TestCommandLineOption {
+ String input1;
+ String input2;
+ String options;
+ String [] list;
+ CommandLineOption option;
+
+ @Before
+ public void setup()
+ {
+ input1 = "-h";
+ input2 = "--help";
+ options = "localhost testing";
+ list = options.split(" ");
+ option = new CommandLineOption(input1,list);
+
+ }
+ @Test
+ public void TestGetOptinValue()
+ {
+ Assert.assertEquals(option.getOptionValue(),"localhost");
+ }
+ @Test
+ public void TestGetOptionType()
+ {
+ Assert.assertEquals(option.getOptionType(),"h");
+ }
+ @After
+ public void cleanup()
+ {
+ option = null;
+ }
+}
diff --git a/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/utils/TestCommandLineOptionParser.java b/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/utils/TestCommandLineOptionParser.java
new file mode 100644
index 0000000000..989fc61418
--- /dev/null
+++ b/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/utils/TestCommandLineOptionParser.java
@@ -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.utils;
+
+import junit.framework.TestCase;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.After;
+import org.junit.Assert;
+
+import java.util.Map;
+import java.util.HashMap;
+import java.util.ArrayList;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: lahiru
+ * Date: Jun 30, 2008
+ * Time: 12:16:30 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class TestCommandLineOptionParser {
+ CommandLineOptionParser parser;
+ String [] input;
+ CommandLineOption option1;
+ CommandLineOption option2;
+ ArrayList list1;
+ ArrayList list2;
+ @Before
+ public void setup()
+ {
+ String temp = "run -h localhost -p 23232";
+ input = temp.split(" ");
+ parser = new CommandLineOptionParser(input);
+ list1 = new ArrayList();
+ list2 = new ArrayList();
+ }
+ @Test
+ public void TestParse()
+ {
+ Map hash = new HashMap();
+
+ list1.add("localhost");
+ list2.add("23232");
+ option1 = new CommandLineOption("h",list1);
+ option2 = new CommandLineOption("p",list2);
+ hash.put("h",option1);
+ hash.put("p",option2);
+ option1 = (CommandLineOption)parser.parse(input).get("h");
+ Assert.assertEquals(option1.getOptionType(),"h");
+ Assert.assertEquals(option1.getOptionValue(),"localhost");
+ option1 = (CommandLineOption)parser.parse(input).get("p");
+ Assert.assertEquals(option1.getOptionType(),"p");
+ Assert.assertEquals(option1.getOptionValue(),"23232");
+ Assert.assertEquals(parser.parse(input).size(),hash.size());
+ }
+ @After
+ public void cleanup()
+ {
+ parser = null;
+ option1 = null;
+ option2 = null;
+
+ }
+}
diff --git a/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/utils/TestJMXConfigProperty.java b/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/utils/TestJMXConfigProperty.java
new file mode 100644
index 0000000000..a5d3122406
--- /dev/null
+++ b/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/utils/TestJMXConfigProperty.java
@@ -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.utils;
+
+import junit.framework.TestCase;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: lahiru
+ * Date: Jun 30, 2008
+ * Time: 12:15:35 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class TestJMXConfigProperty {
+
+}
diff --git a/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/utils/TestJMXConfiguration.java b/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/utils/TestJMXConfiguration.java
new file mode 100644
index 0000000000..02dd7219db
--- /dev/null
+++ b/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/utils/TestJMXConfiguration.java
@@ -0,0 +1,85 @@
+/*
+ *
+ * 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 junit.framework.TestCase;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.After;
+import org.junit.Assert;
+
+import java.util.ArrayList;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: lahiru
+ * Date: Jun 30, 2008
+ * Time: 12:14:32 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class TestJMXConfiguration {
+ CommandLineOptionParser clop;
+ JMXConfiguration jmc;
+ CommandLineOption option;
+ String [] input;
+ @Before
+ public void setup()
+ {
+ String temp = "command -h 127.0.0.1 -p 1234";
+ input = temp.split(" ");
+ clop = new CommandLineOptionParser(input);
+ jmc = new JMXConfiguration(clop.getAlloptions());
+ }
+ @Test
+ public void TestLoadOption()
+ {
+ ArrayList list = new ArrayList();
+ list.add("127.0.0.1");
+ option = new CommandLineOption("-h",list);
+ CommandLineOption expect = jmc.loadoption("h",clop.getAlloptions());
+ Assert.assertEquals(expect.getOptionType(),option.getOptionType());
+ Assert.assertEquals(expect.getOptionValue(),option.getOptionValue());
+ }
+ @After
+ public void cleanup()
+ {
+ clop = null;
+ jmc = null;
+ option = null;
+ }
+}
diff --git a/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/utils/TestJMXinfo.java b/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/utils/TestJMXinfo.java
new file mode 100644
index 0000000000..449609c639
--- /dev/null
+++ b/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/utils/TestJMXinfo.java
@@ -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;
+
+import junit.framework.TestCase;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: lahiru
+ * Date: Jun 30, 2008
+ * Time: 12:12:43 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class TestJMXinfo {
+ /* this class is having only three simple getter methods. Therefore no
+ testcases
+ */
+}