Examples of CommandHandler


Examples of jmockmongo.CommandHandler

      String[] db = fc.split("\\.", 2);

      if ("$cmd".equals(db[1])) {
        BSONObject command = query.getQuery();
        String c = command.keySet().iterator().next();
        CommandHandler handler = commands.get(c);
        if (handler != null) {
          BSONObject result = handler.handleCommand(db[0], command);
          e.getChannel().write(
              ReplyMessage.reply((Message) e.getMessage(), 0, 0,
                  0, result).getBytes());
          return;
        }
View Full Code Here

Examples of net.minecraft.command.CommandHandler

    public void initCommands(MinecraftServer server)
    {
        ICommandManager manager = server.getCommandManager();
        if(manager instanceof CommandHandler)
        {
            CommandHandler handler = (CommandHandler)manager;
            handler.registerCommand(new CommandMorph());
        }
    }
View Full Code Here

Examples of net.rim.device.api.command.CommandHandler

        add(_views[5]);

        final MenuItem cancelItem =
                new MenuItem(new StringProvider("Cancel spinners "), 0x230020,
                        0);
        cancelItem.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                for (int i = _views.length - 1; i >= 0; --i) {
                    _views[i].getModel().cancel();
                }
            }
        }));

        final MenuItem resetItem =
                new MenuItem(new StringProvider("Reset spinners "), 0x230030, 0);
        resetItem.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                for (int i = _views.length - 1; i >= 0; --i) {
                    _views[i].getModel().reset();
                }
            }
        }));

        final MenuItem resumeItem =
                new MenuItem(new StringProvider("Resume spinners "), 0x230040,
                        0);
        resumeItem.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                for (int i = _views.length - 1; i >= 0; --i) {
                    _views[i].getModel().resume();
                }
            }
        }));

        final MenuItem delayedStop =
                new MenuItem(new StringProvider("Delayed start"), 0x230050, 0);
        delayedStop.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                for (int i = _views.length - 1; i >= 0; --i) {
                    final DelayedStart ds = new DelayedStart(_views[i]);
                    ds.start();
                }
            }
        }));

        final MenuItem delayedStart =
                new MenuItem(new StringProvider("Delayed stop"), 0x230060, 0);
        delayedStart.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                for (int i = _views.length - 1; i >= 0; --i) {
                    final DelayedStop ds = new DelayedStop(_views[i]);
                    ds.start();
                }
            }
        }));

        final MenuItem showPopupItem =
                new MenuItem(new StringProvider("Show Popup"), 0x230010, 0);
        showPopupItem.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
View Full Code Here

Examples of org.apache.hadoop.hdfs.tools.GetConf.CommandHandler

    System.out.println(getAddressListFromTool(TestType.BACKUP, conf, false));
    getAddressListFromTool(TestType.SECONDARY, conf, false);
    getAddressListFromTool(TestType.NNRPCADDRESSES, conf, false);
    for (Command cmd : Command.values()) {
      String arg = cmd.getName();
      CommandHandler handler = Command.getHandler(arg);
      assertNotNull("missing handler: " + cmd, handler);
      if (handler.key != null) {
        // First test with configuration missing the required key
        String[] args = {handler.key};
        runTool(conf, args, false);
View Full Code Here

Examples of org.apache.hadoop.hdfs.tools.GetConf.CommandHandler

   */
  @Test
  public void testTool() throws Exception {
    HdfsConfiguration conf = new HdfsConfiguration(false);
    for (Command cmd : Command.values()) {
      CommandHandler handler = Command.getHandler(cmd.getName());
      if (handler.key != null && !"-confKey".equals(cmd.getName())) {
        // Add the key to the conf and ensure tool returns the right value
        String[] args = {cmd.getName()};
        conf.set(handler.key, "value");
        assertTrue(runTool(conf, args, true).contains("value"));
View Full Code Here

Examples of org.apache.hadoop.hdfs.tools.GetConf.CommandHandler

    System.out.println(getAddressListFromTool(TestType.BACKUP, conf, false));
    getAddressListFromTool(TestType.SECONDARY, conf, false);
    getAddressListFromTool(TestType.NNRPCADDRESSES, conf, false);
    for (Command cmd : Command.values()) {
      String arg = cmd.getName();
      CommandHandler handler = Command.getHandler(arg);
      assertNotNull("missing handler: " + cmd, handler);
      if (handler.key != null) {
        // First test with configuration missing the required key
        String[] args = {handler.key};
        runTool(conf, args, false);
View Full Code Here

Examples of org.apache.hadoop.hdfs.tools.GetConf.CommandHandler

   */
  @Test(timeout=10000)
  public void testTool() throws Exception {
    HdfsConfiguration conf = new HdfsConfiguration(false);
    for (Command cmd : Command.values()) {
      CommandHandler handler = Command.getHandler(cmd.getName());
      if (handler.key != null && !"-confKey".equals(cmd.getName())) {
        // Add the key to the conf and ensure tool returns the right value
        String[] args = {cmd.getName()};
        conf.set(handler.key, "value");
        assertTrue(runTool(conf, args, true).contains("value"));
View Full Code Here

Examples of org.apache.hadoop.hdfs.tools.GetConf.CommandHandler

    getAddressListFromTool(TestType.NAMENODE, conf, false);
    System.out.println(getAddressListFromTool(TestType.BACKUP, conf, false));
    getAddressListFromTool(TestType.SECONDARY, conf, false);
    getAddressListFromTool(TestType.NNRPCADDRESSES, conf, false);
    for (Command cmd : Command.values()) {
      CommandHandler handler = Command.getHandler(cmd.getName());
      if (handler.key != null) {
        // First test with configuration missing the required key
        String[] args = {handler.key};
        runTool(conf, args, false);
      }
View Full Code Here

Examples of org.apache.hadoop.hdfs.tools.GetConf.CommandHandler

   * {@link Command#SECONDARY} and {@link Command#NNRPCADDRESSES}
   */
  public void testTool() throws Exception {
    HdfsConfiguration conf = new HdfsConfiguration(false);
    for (Command cmd : Command.values()) {
      CommandHandler handler = Command.getHandler(cmd.getName());
      if (handler.key != null) {
        // Add the key to the conf and ensure tool returns the right value
        String[] args = {handler.key};
        conf.set(handler.key, "value");
        assertTrue(runTool(conf, args, true).contains("value"));
View Full Code Here

Examples of org.apache.hadoop.tools.GetConf.CommandHandler

  public void testEmptyConf() throws Exception {
    Configuration conf = new Configuration();
    // Verify getting addresses fails
    getAddressListFromTool(TestType.NAMENODE, conf, false);
    for (Command cmd : Command.values()) {
      CommandHandler handler = Command.getHandler(cmd.getName());
      if (handler.key != null) {
        // First test with configuration missing the required key
        String[] args = {handler.key};
        runTool(conf, args, false);
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.