qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ai...@apache.org
Subject svn commit: r732308 - in /qpid/trunk/qpid/java/management/tools/qpid-cli: src/org/apache/qpid/ test/org/apache/qpid/
Date Wed, 07 Jan 2009 11:40:08 GMT
Author: aidan
Date: Wed Jan  7 03:40:08 2009
New Revision: 732308

URL: http://svn.apache.org/viewvc?rev=732308&view=rev
Log:
QPID-1522: Fix spelling error in classname

Added:
    qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/CommandExecutionEngine.java
    qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/TestCommandExecutionEngine.java
Removed:
    qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/CommandExecusionEngine.java
    qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/TestCommandExecusionEngine.java
Modified:
    qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/CommandLineInterpreter.java
    qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/AllTest.java

Added: qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/CommandExecutionEngine.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/CommandExecutionEngine.java?rev=732308&view=auto
==============================================================================
--- qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/CommandExecutionEngine.java
(added)
+++ qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/CommandExecutionEngine.java
Wed Jan  7 03:40:08 2009
@@ -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");
+    }
+}

Modified: qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/CommandLineInterpreter.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/CommandLineInterpreter.java?rev=732308&r1=732307&r2=732308&view=diff
==============================================================================
--- qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/CommandLineInterpreter.java
(original)
+++ qpid/trunk/qpid/java/management/tools/qpid-cli/src/org/apache/qpid/CommandLineInterpreter.java
Wed Jan  7 03:40:08 2009
@@ -87,8 +87,6 @@
             }
 
             /* 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 @@
             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 @@
                     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 @@
         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 @@
 
         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;

Modified: qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/AllTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/AllTest.java?rev=732308&r1=732307&r2=732308&view=diff
==============================================================================
--- qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/AllTest.java (original)
+++ qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/AllTest.java Wed Jan
 7 03:40:08 2009
@@ -55,7 +55,7 @@
 @RunWith(Suite.class)
 @Suite.SuiteClasses({
         TestCommand.class,
-        TestCommandExecusionEngine.class,
+        TestCommandExecutionEngine.class,
         TestCommandLineOption.class,
         TestCommandLineOptionParser.class,
         TestConnector.class,

Added: qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/TestCommandExecutionEngine.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/TestCommandExecutionEngine.java?rev=732308&view=auto
==============================================================================
--- qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/TestCommandExecutionEngine.java
(added)
+++ qpid/trunk/qpid/java/management/tools/qpid-cli/test/org/apache/qpid/TestCommandExecutionEngine.java
Wed Jan  7 03:40:08 2009
@@ -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.
+        }
+    }
+}



Mime
View raw message