Thomas Vachuska | 781d18b | 2014-10-27 10:31:25 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * Licensed to the Apache Software Foundation (ASF) under one |
| 3 | * or more contributor license agreements. See the NOTICE file |
| 4 | * distributed with this work for additional information |
| 5 | * regarding copyright ownership. The ASF licenses this file |
| 6 | * to you under the Apache License, Version 2.0 (the |
| 7 | * "License"); you may not use this file except in compliance |
| 8 | * with the License. You may obtain a copy of the License at |
| 9 | * |
| 10 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | * |
| 12 | * Unless required by applicable law or agreed to in writing, |
| 13 | * software distributed under the License is distributed on an |
| 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | * KIND, either express or implied. See the License for the |
| 16 | * specific language governing permissions and limitations |
| 17 | * under the License. |
| 18 | */ |
pankaj | f49b45e | 2014-10-07 14:24:22 -0700 | [diff] [blame] | 19 | package org.onlab.onos.foo; |
| 20 | |
| 21 | import static org.onlab.onos.foo.SimpleNettyClient.startStandalone; |
pankaj | 9fc8759 | 2014-10-10 15:40:43 -0700 | [diff] [blame] | 22 | import static org.onlab.onos.foo.SimpleNettyClient.stop; |
pankaj | f49b45e | 2014-10-07 14:24:22 -0700 | [diff] [blame] | 23 | |
| 24 | import org.apache.karaf.shell.commands.Argument; |
| 25 | import org.apache.karaf.shell.commands.Command; |
| 26 | import org.onlab.onos.cli.AbstractShellCommand; |
| 27 | |
| 28 | /** |
| 29 | * Test Netty client performance. |
| 30 | */ |
| 31 | @Command(scope = "onos", name = "simple-netty-client", |
pankaj | 5364ca9 | 2014-10-09 14:11:58 -0700 | [diff] [blame] | 32 | description = "Starts simple Netty client") |
pankaj | f49b45e | 2014-10-07 14:24:22 -0700 | [diff] [blame] | 33 | public class SimpleNettyClientCommand extends AbstractShellCommand { |
| 34 | |
pankaj | ea0acef | 2014-10-07 15:01:47 -0700 | [diff] [blame] | 35 | //FIXME: replace these arguments with proper ones needed for the test. |
pankaj | f0f80b2 | 2014-10-07 18:37:32 -0700 | [diff] [blame] | 36 | @Argument(index = 0, name = "hostname", description = "Server Hostname", |
pankaj | f49b45e | 2014-10-07 14:24:22 -0700 | [diff] [blame] | 37 | required = false, multiValued = false) |
pankaj | 28c3564 | 2014-10-08 16:42:36 -0700 | [diff] [blame] | 38 | String hostname = "localhost"; |
pankaj | f49b45e | 2014-10-07 14:24:22 -0700 | [diff] [blame] | 39 | |
pankaj | 31b8eab | 2014-10-08 18:14:08 -0700 | [diff] [blame] | 40 | @Argument(index = 1, name = "port", description = "Port", |
pankaj | f49b45e | 2014-10-07 14:24:22 -0700 | [diff] [blame] | 41 | required = false, multiValued = false) |
pankaj | 13373b5 | 2014-10-07 18:26:07 -0700 | [diff] [blame] | 42 | String port = "8081"; |
| 43 | |
pankaj | 31b8eab | 2014-10-08 18:14:08 -0700 | [diff] [blame] | 44 | @Argument(index = 2, name = "warmupCount", description = "Warm-up count", |
pankaj | 13373b5 | 2014-10-07 18:26:07 -0700 | [diff] [blame] | 45 | required = false, multiValued = false) |
pankaj | 6245a7a | 2014-10-10 17:50:55 -0700 | [diff] [blame] | 46 | String warmupCount = "1000"; |
pankaj | f49b45e | 2014-10-07 14:24:22 -0700 | [diff] [blame] | 47 | |
pankaj | 31b8eab | 2014-10-08 18:14:08 -0700 | [diff] [blame] | 48 | @Argument(index = 3, name = "messageCount", description = "Message count", |
pankaj | f49b45e | 2014-10-07 14:24:22 -0700 | [diff] [blame] | 49 | required = false, multiValued = false) |
pankaj | 9fc8759 | 2014-10-10 15:40:43 -0700 | [diff] [blame] | 50 | String messageCount = "1000000"; |
pankaj | f49b45e | 2014-10-07 14:24:22 -0700 | [diff] [blame] | 51 | |
| 52 | @Override |
| 53 | protected void execute() { |
| 54 | try { |
pankaj | 28c3564 | 2014-10-08 16:42:36 -0700 | [diff] [blame] | 55 | startStandalone(new String[]{hostname, port, warmupCount, messageCount}); |
pankaj | f49b45e | 2014-10-07 14:24:22 -0700 | [diff] [blame] | 56 | } catch (Exception e) { |
| 57 | error("Unable to start client %s", e); |
| 58 | } |
pankaj | 9fc8759 | 2014-10-10 15:40:43 -0700 | [diff] [blame] | 59 | stop(); |
pankaj | f49b45e | 2014-10-07 14:24:22 -0700 | [diff] [blame] | 60 | } |
pankaj | f49b45e | 2014-10-07 14:24:22 -0700 | [diff] [blame] | 61 | } |