From 44d51e7682548e25a7079cb7aceea6b88fbfbdc1 Mon Sep 17 00:00:00 2001 From: Aidan Skinner Date: Wed, 7 Jan 2009 11:40:08 +0000 Subject: QPID-1522: Fix spelling error in classname git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@732308 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/qpid/CommandExecusionEngine.java | 88 --------------------- .../org/apache/qpid/CommandExecutionEngine.java | 86 +++++++++++++++++++++ .../org/apache/qpid/CommandLineInterpreter.java | 10 +-- .../qpid-cli/test/org/apache/qpid/AllTest.java | 2 +- .../apache/qpid/TestCommandExecusionEngine.java | 90 ---------------------- .../apache/qpid/TestCommandExecutionEngine.java | 90 ++++++++++++++++++++++ 6 files changed, 179 insertions(+), 187 deletions(-) delete mode 100644 qpid/java/management/tools/qpid-cli/src/org/apache/qpid/CommandExecusionEngine.java create mode 100644 qpid/java/management/tools/qpid-cli/src/org/apache/qpid/CommandExecutionEngine.java delete mode 100644 qpid/java/management/tools/qpid-cli/test/org/apache/qpid/TestCommandExecusionEngine.java create mode 100644 qpid/java/management/tools/qpid-cli/test/org/apache/qpid/TestCommandExecutionEngine.java (limited to 'qpid/java') diff --git a/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/CommandExecusionEngine.java b/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/CommandExecusionEngine.java deleted file mode 100644 index 52131bc1d5..0000000000 --- a/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/CommandExecusionEngine.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * - * 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.apache.qpid.utils.CommandLineOptionParser; -import org.apache.qpid.utils.JMXinfo; -import org.apache.qpid.commands.*; -import org.apache.qpid.commands.CommandImpl; - - -public class CommandExecusionEngine { - private Command currentcommand = null; - private String commandname = null; - private JMXinfo info = null; - - public CommandExecusionEngine(JMXinfo info) { - this.info = info; - this.commandname = info.getCommandLineOptionParser().getcommandname(); - } - - public boolean CommandSelector() { - - if (CommandConstants.INFO_COMMAND.equalsIgnoreCase(this.commandname)) - currentcommand = new Commandinfo(info, this.commandname); - else if (CommandConstants.LIST_COMMAND.equalsIgnoreCase(this.commandname)) - currentcommand = new Commandlist(info, this.commandname); - else if (CommandConstants.HELP_COMMAND.equalsIgnoreCase(this.commandname)) - currentcommand = new Commandhelp(info, this.commandname); - else if (CommandConstants.DELETE_COMMAND.equalsIgnoreCase(this.commandname)) - currentcommand = new Commanddelete(info, this.commandname); - else if (CommandConstants.MOVE_COMMAND.equalsIgnoreCase(this.commandname)) - currentcommand = new Commandmove(info, this.commandname); - else if (CommandConstants.VIEW_COMMAND.equalsIgnoreCase(this.commandname)) - currentcommand = new Commandview(info, this.commandname); - else if (CommandConstants.VIEWCONTENT_COMMAND.equalsIgnoreCase(this.commandname)) - currentcommand = new Commandviewcontent(info, this.commandname); - else { - usage(); - return false; - } - return true; - - - } - - public void runcommand() { - currentcommand.execute(); - } - - public void usage() { - System.out.println(commandname + ":Command not found"); - } -} diff --git a/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/CommandExecutionEngine.java b/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/CommandExecutionEngine.java new file mode 100644 index 0000000000..50bc294780 --- /dev/null +++ b/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/CommandExecutionEngine.java @@ -0,0 +1,86 @@ +/* + * + * 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.apache.qpid.utils.JMXinfo; +import org.apache.qpid.commands.*; + + +public class CommandExecutionEngine { + private Command currentcommand = null; + private String commandname = null; + private JMXinfo info = null; + + public CommandExecutionEngine(JMXinfo info) { + this.info = info; + this.commandname = info.getCommandLineOptionParser().getcommandname(); + } + + public boolean CommandSelector() { + + if (CommandConstants.INFO_COMMAND.equalsIgnoreCase(this.commandname)) + currentcommand = new Commandinfo(info, this.commandname); + else if (CommandConstants.LIST_COMMAND.equalsIgnoreCase(this.commandname)) + currentcommand = new Commandlist(info, this.commandname); + else if (CommandConstants.HELP_COMMAND.equalsIgnoreCase(this.commandname)) + currentcommand = new Commandhelp(info, this.commandname); + else if (CommandConstants.DELETE_COMMAND.equalsIgnoreCase(this.commandname)) + currentcommand = new Commanddelete(info, this.commandname); + else if (CommandConstants.MOVE_COMMAND.equalsIgnoreCase(this.commandname)) + currentcommand = new Commandmove(info, this.commandname); + else if (CommandConstants.VIEW_COMMAND.equalsIgnoreCase(this.commandname)) + currentcommand = new Commandview(info, this.commandname); + else if (CommandConstants.VIEWCONTENT_COMMAND.equalsIgnoreCase(this.commandname)) + currentcommand = new Commandviewcontent(info, this.commandname); + else { + usage(); + return false; + } + return true; + + + } + + public void runcommand() { + currentcommand.execute(); + } + + public void usage() { + System.out.println(commandname + ":Command not found"); + } +} diff --git a/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/CommandLineInterpreter.java b/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/CommandLineInterpreter.java index e9073c79ce..cede874186 100644 --- a/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/CommandLineInterpreter.java +++ b/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/CommandLineInterpreter.java @@ -87,8 +87,6 @@ public class CommandLineInterpreter { } /* Connecting with the broker */ -// commandlineoptionparser = new CommandLineOptionParser(args); -// JMXConfiguration config = new JMXConfiguration(commandlineoptionparser.getAlloptions()); try { if (commandlineoptionparser == null) commandlineoptionparser = new CommandLineOptionParser(args); @@ -122,7 +120,6 @@ public class CommandLineInterpreter { String[] command; /* prividing GNU readline features using Jline library */ - //String list = "list"; PrintWriter out = new PrintWriter(System.out); reader.addCompletor(new ArgumentCompletor( new SimpleCompletor(new String[]{"list", "info", "exit", "quit", "delete", "move", "view", "viewcontent", "queue", "exchange", "connection", "usermanagement", "virtualhost"}))); @@ -136,7 +133,7 @@ public class CommandLineInterpreter { command = line.split("\\s+"); commandlineoptionparser = new CommandLineOptionParser(command); JMXinfo info = new JMXinfo(jmxc, commandlineoptionparser, mbsc); - CommandExecusionEngine engine = new CommandExecusionEngine(info); + CommandExecutionEngine engine = new CommandExecutionEngine(info); if (engine.CommandSelector()) engine.runcommand(); } @@ -164,9 +161,6 @@ public class CommandLineInterpreter { System.out.println("Please check the host name and the port given"); } - private static void commandlineerror() { - System.out.println("Please run the script again and try to connect to broker again"); - } public static String[] oneshotmode(String[] args,CommandLineOptionParser commandlineoptionparser,JMXConnector jmxc,MBeanServerConnection mbsc) { int check = 0; @@ -184,7 +178,7 @@ public class CommandLineInterpreter { commandlineoptionparser = new CommandLineOptionParser(args); //change the args string array which works as interactive mode// JMXinfo info = new JMXinfo(jmxc, commandlineoptionparser, mbsc); - CommandExecusionEngine engine = new CommandExecusionEngine(info); + CommandExecutionEngine engine = new CommandExecutionEngine(info); if (engine.CommandSelector()) engine.runcommand(); return args; 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 index bdae5340b5..db707993ed 100644 --- 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 @@ -55,7 +55,7 @@ import org.apache.qpid.utils.TestJMXConfiguration; @RunWith(Suite.class) @Suite.SuiteClasses({ TestCommand.class, - TestCommandExecusionEngine.class, + TestCommandExecutionEngine.class, TestCommandLineOption.class, TestCommandLineOptionParser.class, TestConnector.class, 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 deleted file mode 100644 index bb5fa914d0..0000000000 --- a/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/TestCommandExecusionEngine.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * - * 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/TestCommandExecutionEngine.java b/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/TestCommandExecutionEngine.java new file mode 100644 index 0000000000..923f34678a --- /dev/null +++ b/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/TestCommandExecutionEngine.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 TestCommandExecutionEngine { + String line; + String [] command; + CommandLineOptionParser commandlineoptionparser; + JMXinfo info; + CommandExecutionEngine 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 CommandExecutionEngine(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. + } + } +} -- cgit v1.2.1