public DataNode elementToDataNode( RepositoryElementInterface element ) throws KettleException {
    SlaveServer slaveServer = (SlaveServer) element;
    DataNode rootNode = new DataNode( NODE_ROOT );

    /*
     * // Check for naming collision ObjectId slaveId = repo.getSlaveID(slaveServer.getName()); if (slaveId != null &&
     * slaveServer.getObjectId()!=null && !slaveServer.getObjectId().equals(slaveId)) { // We have a naming collision,
     * abort the save throw new KettleException("Failed to save object to repository. Object [" + slaveServer.getName()
     * + "] already exists."); }
     */

    // Create or version a new slave node
    //
    rootNode.setProperty( PROP_HOST_NAME, slaveServer.getHostname() );
    rootNode.setProperty( PROP_PORT, slaveServer.getPort() );
    rootNode.setProperty( PROP_WEBAPP_NAME, slaveServer.getWebAppName() );
    rootNode.setProperty( PROP_USERNAME, slaveServer.getUsername() );
    rootNode.setProperty( PROP_PASSWORD, Encr.encryptPasswordIfNotUsingVariables( slaveServer.getPassword() ) );
    rootNode.setProperty( PROP_PROXY_HOST_NAME, slaveServer.getProxyHostname() );
    rootNode.setProperty( PROP_PROXY_PORT, slaveServer.getProxyPort() );
    rootNode.setProperty( PROP_NON_PROXY_HOSTS, slaveServer.getNonProxyHosts() );
    rootNode.setProperty( PROP_MASTER, slaveServer.isMaster() );
    rootNode.setProperty( PROP_USE_HTTPS_PROTOCOL, slaveServer.isSslMode() );
    return rootNode;
  }
@Test
  public void testElementToDataNode() throws KettleException {
    DataNode dataNode = slaveDelegate.elementToDataNode( mockSlaveServer );

    Assert.assertEquals( PROP_HOST_NAME_VALUE, slaveDelegate.getString( dataNode, SlaveDelegate.PROP_HOST_NAME ) );
    Assert.assertEquals( PROP_USERNAME_VALUE, slaveDelegate.getString( dataNode, SlaveDelegate.PROP_USERNAME ) );
    Assert.assertEquals( Encr.encryptPasswordIfNotUsingVariables( PROP_PASSWORD_VALUE ), slaveDelegate.getString( dataNode, SlaveDelegate.PROP_PASSWORD ) );
    Assert.assertEquals( PROP_PORT_VALUE, slaveDelegate.getString( dataNode, SlaveDelegate.PROP_PORT ) );
    Assert.assertEquals( PROP_PROXY_HOST_NAME_VALUE, slaveDelegate.getString( dataNode, SlaveDelegate.PROP_PROXY_HOST_NAME ) );
    Assert.assertEquals( PROP_PROXY_PORT_VALUE, slaveDelegate.getString( dataNode, SlaveDelegate.PROP_PROXY_PORT ) );
    Assert.assertEquals( PROP_WEBAPP_NAME_VALUE, slaveDelegate.getString( dataNode, SlaveDelegate.PROP_WEBAPP_NAME ) );
    Assert.assertEquals( PROP_NON_PROXY_HOSTS_VALUE, slaveDelegate.getString( dataNode, SlaveDelegate.PROP_NON_PROXY_HOSTS ) );
    Assert.assertEquals( PROP_MASTER_VALUE, slaveDelegate.getBoolean( dataNode, SlaveDelegate.PROP_MASTER ) );
    Assert.assertEquals( PROP_USE_HTTPS_PROTOCOL_VALUE, slaveDelegate.getBoolean( dataNode, SlaveDelegate.PROP_USE_HTTPS_PROTOCOL ) );
  }