Precess step 3 in CLI mode
@throws UnexpectedValueException
429310
protected function installCliStep3()
    {
        $this->data['step'] = 3;
        $result = $this->installFinish($this->data, $this->db);

        if ($result['severity'] !== 'success') {
            throw new UnexpectedValueException($result['message']);
        }
    }
625700
final public function beforeStep(\Codeception\Event\StepEvent $e)
  {
    $step = $e->getStep();
    // access to the protected property using reflection
    $refArgs = new ReflectionProperty(get_class($step), 'arguments');
    // change property accessibility to public
    $refArgs->setAccessible(true);
    // retrieve 'arguments' value
    $args = $refArgs->getValue($step);
    foreach ($args as $index => $arg) {
      if (is_string($arg)) {
      // case if arg is a string
      // e.g. I see "{{param}}"
        $args[$index] = $this->getValueFromParam($arg);
      } elseif (is_a($arg, '\Behat\Gherkin\Node\TableNode')) {
      // case if arg is a table
      // e.g. I see :
      //  | paramater |
      //  | {{param}} |
        $table = [];
        foreach ($arg->getRows() as $i => $row) {
          foreach ($row as $j => $cell) {
              $table[$i][$j] = $this->getValueFromParam($cell);
          }
        }
        $args[$index] = new TableNode($table);
      }
    }
    // set new arguments value
    $refArgs->setValue($step, $args);
  }
101706
@Override
    protected void executeImpl(CommandLine cmd) {

        String taskQueueNames = cmd.getOptionValue(TASK_QUEUES_OPTION);
        if (taskQueueNames != null) {
            setSystemProperty(ConfigConstants.QUEUE_TASK_ORDERED, taskQueueNames);
        }

        List<PropertyDefinition> defintions =
            new PropertyDefinitionListBuilder().addAws()
                                               .addMillDb()
                                               .addMcDb()
                                               .addDeadLetterQueue()
                                               .addAuditQueue()
                                               .addBitIntegrityQueue()
                                               .addBitIntegrityErrorQueue()
                                               .addBitIntegrityReportQueue()
                                               .addNotifications()
                                               .addWorkDir()
                                               .addTaskQueueOrder()
                                               .addDuplicationPolicyBucketSuffix()
                                               .addDuplicationPolicyRefreshFrequency()
                                               .addDuplicationHighPriorityQueue()
                                               .addLocalDuplicationDir()
                                               .addMaxWorkers()
                                               .build();
        PropertyVerifier verifier = new PropertyVerifier(defintions);
        verifier.verify(System.getProperties());

        TaskProducerConfigurationManager config = new WorkmanConfigurationManager();

        String workDirPath = config.getWorkDirectoryPath();

        if (workDirPath == null || workDirPath.trim() == "") {
            // this should never happen since workDirPath is required,
            // but I'll leave this in here as a sanity check.
            workDirPath = System.getProperty("java.io.tmpdir") + File.separator + "workman-work";
        }

        initializeWorkDir(workDirPath);

        String localDuplicationPolicyDirPath = config.getDuplicationPolicyDir();

        if (localDuplicationPolicyDirPath != null && !new File(localDuplicationPolicyDirPath).exists()) {
            System.err.print("The local duplication policy directory "
                             + "path you specified, "
                             + localDuplicationPolicyDirPath + " does not exist: ");
            die();
        }

        ApplicationContext context = new AnnotationConfigApplicationContext("org.duracloud.mill");
    }
337043
public function asEnumerated(): Primitive\Enumerated
    {
        if (!$this->_element instanceof Primitive\Enumerated) {
            throw new \UnexpectedValueException(
                $this->_generateExceptionMessage(Element::TYPE_ENUMERATED));
        }
        return $this->_element;
    }
1066898
@Override
	public void increase(final int steps) throws IOException {

		int maxValue = getMaxValue();

		if (currentValue == maxValue) {
			return;
		}
		if (steps < 0) {
			throw new RuntimeException("only positive values for parameter 'steps' allowed!");
		}
		if (getNonVolatileMode() != MicrochipPotentiometerNonVolatileMode.VOLATILE_ONLY) {
			throw new RuntimeException("'increase' is only valid for NonVolatileMode.VOLATILE_ONLY!");
		}

		// check boundaries
		final int actualSteps;
		if ((steps + currentValue) > maxValue) {
			actualSteps = maxValue - currentValue;
		} else {
			actualSteps = steps;
		}

		int newValue = currentValue + actualSteps;

		// if upper-boundary then set value in device to ensure sync
		// and for a large number of steps it is better to set a new value
		if ((newValue == maxValue)
				|| (steps > 5)) {

			setCurrentValue(newValue);

		}
		// for a small number of step simply repeat 'increase'-commands
		else {

			controller.increase(DeviceControllerChannel.valueOf(channel), actualSteps);

			currentValue = newValue;

		}

	}
1042738
protected function initConnectionData()
    {
        if ($this->connectionData) {
            return;
        }

        if (!$this->connectionUrl) {
            throw new \UnexpectedValueException(
                'Expected a connectionUrl, got nowt.'
            );
        }

        $parsed = parse_url($this->connectionUrl);
        if ($parsed === false) {
            throw new UnexpectedValueException(
                'Expected a sensible connectionUrl, got nowt but rubbish.'
            );
        }
        $this->connectionData = $parsed;
    }
815352
public function lInsert($key, $relativePosition, $pivot, $value) {
        $relativePosition = strtolower($relativePosition);

        if ($relativePosition !== 'before' && $relativePosition !== 'after') {
            throw new \UnexpectedValueException(
                sprintf("relativePosition must be 'before' or 'after', was '%s'", $relativePosition)
            );
        }

        return $this->send(['linsert', $key, $relativePosition, $pivot, $value]);
    }
432965
@Override
    public void executeNext()
    {
        final LifecycleStage nextStage = getNextStage();
        if (nextStage == null) {
            throw new IllegalStateException("Lifecycle already hit the final stage!");
        }
        execute(nextStage);
    }
596886
public void process() throws CmdLineException {
		ProcessingContext context = new ProcessingContext();

		for (String arg : this.args) {
			if (arg != null && !context.processPendingOptionAction(arg)
					&& !context.processOptionAction(arg, this.optionActions)
					&& !context.processSwitchAction(arg, this.switchActions)) {
				// No action found so far. Invoke the corresponding default action.
				Consumer<String> defaultAction = (isActionArg(arg) ? this.unknownAction : this.unnamedAction);

				if (defaultAction != null) {
					try {
						defaultAction.accept(arg);
					} catch (RuntimeException e) {
						throw new CmdLineException(this, arg, e);
					}
				} else {
					throw new CmdLineException(this, arg);
				}
			}
		}
		context.verifyNoPendingOptionAction();
	}
807133
private int run(String[] args) throws Exception {
    Configuration conf = new Configuration();
    String numMaps =  new GenericOptionsParser(conf, args).getRemainingArgs()[0];
    conf.set(MRJobConfig.NUM_MAPS, numMaps);
    createHdfsFilesystem(conf);

    Job job = Job.getInstance(conf, "MapReduceIntegrationChecker");
    job.setJarByClass(MapReduceIntegrationChecker.class);
    job.setMapperClass(CheckerMapper.class);
    job.setCombinerClass(CheckerReducer.class);
    job.setReducerClass(CheckerReducer.class);
    job.setOutputKeyClass(Text.class);
    job.setOutputValueClass(Text.class);
    job.setInputFormatClass(EmptyInputFormat.class);
    FileOutputFormat.setOutputPath(job, mOutputFilePath);

    try {
      if (!job.waitForCompletion(true)) {
        return 1;
      }
      Status resultStatus = generateReport();
      return resultStatus.equals(Status.SUCCESS) ? 0
          : (resultStatus.equals(Status.FAIL_TO_FIND_CLASS) ? 2 : 1);
    } finally {
      if (mFileSystem.exists(mOutputFilePath)) {
        mFileSystem.delete(mOutputFilePath, true);
      }
      mFileSystem.close();
    }
  }
613886
public function push($path, $value)
    {
        $node = $this->get($path);

        if (!$node) {
            $node = [];
        } elseif (\is_object($node)) {
            $node = get_object_vars($node);
        }

        if (!\is_array($node)) {
            throw new \UnexpectedValueException(
                sprintf(
                    'The value at path: %s should be object or array but is %s.',
                    $path,
                    \gettype($node)
                )
            );
        }

        $args = \func_get_args();

        if (count($args) <= 2) {
            $num = array_push($node, $value);
        } else {
            $args[0] = &$node;

            $num = call_user_func_array('array_push', $args);
        }

        $this->set($path, $node);

        return $num;
    }
563280
private void clinkstep3(DBIDRef id, DBIDArrayIter i, int n, WritableDBIDDataStore pi, WritableDoubleDataStore lambda, WritableDoubleDataStore m) {
    DBIDVar p_i = DBIDUtil.newVar();
    // for i = 1..n
    for(i.seek(0); i.getOffset() < n; i.advance()) {
      double l_i = lambda.doubleValue(i);
      double m_i = m.doubleValue(i);

      // if L(i) < M(i)
      if(l_i < m_i) {
        p_i.from(pi, i); // p_i = pi(it)
        double mp_i = m.doubleValue(p_i);
        // M(P(i)) = max { M(P(i)), M(i) }
        if(mp_i < m_i) {
          m.putDouble(p_i, m_i);
        }

        // M(i) = inf
        m.putDouble(i, Double.POSITIVE_INFINITY);
      }
    }
  }
447267
public function asSequence(): Constructed\Sequence
    {
        if (!$this->_element instanceof Constructed\Sequence) {
            throw new \UnexpectedValueException(
                $this->_generateExceptionMessage(Element::TYPE_SEQUENCE));
        }
        return $this->_element;
    }
1167364
private void processIfCmd(String parms, int cmdTPosBegin, int cmdTPosEnd)
            throws MiniTemplator.TemplateSyntaxException {
        excludeTemplateRange(cmdTPosBegin, cmdTPosEnd);
        if (condLevel >= maxCondLevels - 1) {
            throw new MiniTemplator.TemplateSyntaxException("Too many nested $if commands.");
        }
        condLevel++;
        boolean enabled = isCondEnabled(condLevel - 1) && evaluateConditionFlags(parms);
        condEnabled[condLevel] = enabled;
        condPassed[condLevel] = enabled;
    }
442593
public function asReal(): Primitive\Real
    {
        if (!$this->_element instanceof Primitive\Real) {
            throw new \UnexpectedValueException(
                $this->_generateExceptionMessage(Element::TYPE_REAL));
        }
        return $this->_element;
    }
1210295
protected void step() throws UnrecognizedFieldException,
            ObjectIntegrityException, RepositoryConfigurationException,
            StreamIOException, ServerException {
        m_objectFields = new ArrayList<ObjectFields>();
        int resultCount = 0;
        // Run through resultSet, adding each result to m_objectFields
        // for up to maxResults objects, or until the result set is
        // empty, whichever comes first.
        // Note: If this is the first chunk of results for the entire search,
        // m_nextPID will be null, and will require the cursor to be advanced
        // to the first result.  For all remaining chunks, the cursor will
        // already be in the correct position (and m_nextPID will have been set)
        // so a call to m_resultSet.next() is not initially necessary.
        try {
            while (resultCount < m_maxResults
                    && (m_nextPID != null || m_resultSet.next())) {
                resultCount++;
                // add the current object's info to m_objectFields
                String pid;
                if (m_nextPID == null) {
                    pid = m_resultSet.getString("pid");
                } else {
                    pid = m_nextPID;
                    m_nextPID = null;
                }
                m_objectFields.add(getObjectFields(pid));
            }
            // done with this block. now, are there more results?
            if (resultCount == m_maxResults && m_resultSet.next()) {
                // yes, and we've now advanced the cursor so we must remember
                // the pid so the next chunk can use it
                m_nextPID = m_resultSet.getString("pid");
                // generate a token, make sure the cursor is set,
                // and make sure the expirationDate is set
                long now = System.currentTimeMillis();
                m_token = MD5Utility.getBase16Hash(hashCode() + "" + now);
                m_cursor = m_nextCursor;
                // keep m_nextCursor updated for next block
                m_nextCursor += resultCount;
                m_startMillis = now;
                Date dt = new Date();
                dt.setTime(m_startMillis + 1000 * m_maxSeconds);
                m_expirationDate = dt;
            } else {
                // no, so make sure the token is null and clean up
                m_token = null;
                try {
                    if (m_resultSet != null) {
                        m_resultSet.close();
                    }
                    if (m_statement != null) {
                        m_statement.close();
                    }
                    if (m_conn != null) {
                        m_cPool.free(m_conn);
                    }
                } catch (SQLException sqle2) {
                    throw new StorageDeviceException("Error closing statement "
                            + "or result set." + sqle2.getMessage());
                } finally {
                    m_resultSet = null;
                    m_statement = null;
                }
            }
        } catch (SQLException sqle) {
            try {
                if (m_resultSet != null) {
                    m_resultSet.close();
                }
                if (m_statement != null) {
                    m_statement.close();
                }
                if (m_conn != null) {
                    m_cPool.free(m_conn);
                }
                throw new StorageDeviceException("Error with sql database. "
                        + sqle.getMessage());
            } catch (SQLException sqle2) {
                throw new StorageDeviceException("Error closing statement "
                        + "or result set." + sqle.getMessage()
                        + sqle2.getMessage());
            } finally {
                m_resultSet = null;
                m_statement = null;
            }
        }
    }
1259642
public function grant()
    {
        if (!$this->name) {
            throw new UnexpectedValueException(
                'Cannot grant privileges to a user with no name'
            );
        }
        if (!$this->grants) {
            throw new UnexpectedValueException(
                'Cannot grant privileges without being told what privileges to grant'
            );
        }
        if (!$this->grantLevel) {
            throw new UnexpectedValueException(
                'Cannot grant privileges without being told on what to grant them'
            );
        }

        $params = array();
        $parts = array(
            sprintf(
                'GRANT %s ON %s',
                strtolower($this->grants) == 'all'
                    ? 'ALL PRIVILEGES'
                    : $this->grants,
                $this->grantLevel
            )
        );

        $parts[] = 'TO :user';
        $params[':user'] = $this->name;

        if ($this->host) {
            $parts[] = '@:host';
            $params[':host'] = strtolower($this->host) == 'any' ? '%' : $this->host;
        }

        if ($this->grantGrant) {
            $parts[] = 'WITH GRANT OPTION';
        }
        
        // Wrap in 'FLUSH PRIVILEGES' commands to update in-memory state
        $this->client->execute('FLUSH PRIVILEGES');
        $this->client->execute(implode(' ', $parts), $params);
        $this->client->execute('FLUSH PRIVILEGES');
    }