Package org.openhab.binding.dmx.internal.cmd

Examples of org.openhab.binding.dmx.internal.cmd.DmxCommand


        } else {

          String dmxCommandType = cmdValue.split("\\|")[0];
          if (dmxCommandType.equals(DmxCommand.types.FADE.toString())) {
            DmxCommand dmxCommand = new DmxFadeCommand(this,
                cmdValue.substring(cmdValue.indexOf("|") + 1));
            customCommands.put(cmd, dmxCommand);
          } else if (dmxCommandType.equals(DmxCommand.types.SFADE
              .toString())) {
            DmxCommand dmxCommand = new DmxSuspendingFadeCommand(
                this,
                cmdValue.substring(cmdValue.indexOf("|") + 1));
            customCommands.put(cmd, dmxCommand);
          } else {
            throw new BindingConfigParseException(
View Full Code Here


      return;
    }

    // process custom commands if they are available
    if (isRedefinedByCustomCommand(command)) {
      DmxCommand dmxCommand = customCommands.get(command.toString());
      dmxCommand.execute(service);
      return;
    }

  }
View Full Code Here

  @SuppressWarnings("unchecked")
  public void canCallCustomCommand() throws BindingConfigParseException {

    DmxItem item = getValidInstance();
    DmxService service = Mockito.mock(DmxService.class);
    DmxCommand cmd = Mockito.mock(DmxCommand.class);
    Map<String, DmxCommand> commands = (Map<String, DmxCommand>) Whitebox.getInternalState(item, "customCommands");
    commands.put("ON", cmd);
   
    item.processCommand(service, OnOffType.ON);
    Mockito.verify(cmd).execute(service);
View Full Code Here

  public void canHaveCustomCommandConfiguration() throws BindingConfigParseException {

    // test valid configurations
    DmxItem item = getItemInstance("CHANNEL[7/3:1000] ON[FADE|0:255,255,255:30000|5000:0,0,0:-1]");
   
    DmxCommand cmd = ((Map<String, DmxCommand>) Whitebox.getInternalState(item, "customCommands")).get("ON");
    assertTrue(cmd instanceof DmxFadeCommand);
   
    getItemInstance("CHANNEL[7/4] ,ON[SFADE|0:255,255,255:30000|5000:0,0,0:-1]");
   
    cmd = ((Map<String, DmxCommand>) Whitebox.getInternalState(item, "customCommands")).get("ON");
View Full Code Here

TOP

Related Classes of org.openhab.binding.dmx.internal.cmd.DmxCommand

Copyright © 2018 www.massapicom. 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.