### Question:
RemoteExecutionOfCommandsAOImpl extends IRODSGenericAO implements RemoteExecutionOfCommandsAO { @Override public InputStream executeARemoteCommandAndGetStreamGivingCommandNameAndArgs( final String commandToExecuteWithoutArguments, final String argumentsToPassWithCommand) throws JargonException { log.info("executing remote command"); RemoteExecutionService remoteExecuteService = RemoteExecuteServiceImpl.instance(getIRODSProtocol(), commandToExecuteWithoutArguments, argumentsToPassWithCommand, ""); if (isAbleToStreamLargeResults()) { return remoteExecuteService.executeAndStream(); } else { return remoteExecuteService.execute(); } } protected  RemoteExecutionOfCommandsAOImpl(final IRODSSession irodsSession, final IRODSAccount irodsAccount); @Override InputStream executeARemoteCommandAndGetStreamGivingCommandNameAndArgs(
			final String commandToExecuteWithoutArguments, final String argumentsToPassWithCommand); @Override InputStream executeARemoteCommandAndGetStreamGivingCommandNameAndArgsAndHost(
			final String commandToExecuteWithoutArguments, final String argumentsToPassWithCommand,
			final String executionHost); @Override InputStream executeARemoteCommandAndGetStreamAddingPhysicalPathAsFirstArgumentToRemoteScript(
			final String commandToExecuteWithoutArguments, final String argumentsToPassWithCommand,
			final String absolutePathOfIrodsFileThatWillBeUsedToFindHostToExecuteOn); @Override InputStream executeARemoteCommandAndGetStreamUsingAnIRODSFileAbsPathToDetermineHost(
			final String commandToExecuteWithoutArguments, final String argumentsToPassWithCommand,
			final String absolutePathOfIrodsFileThatWillBeUsedToFindHostToExecuteOn);  }### Answer:
@Test public final void testExecuteARemoteCommandAndGetStreamGivingCommandNameAndArgs() throws Exception { String cmd = "hello"; String args = ""; IRODSAccount irodsAccount = testingPropertiesHelper.buildIRODSAccountFromTestProperties(testingProperties); RemoteExecutionOfCommandsAO remoteExecutionOfCommandsAO = irodsFileSystem.getIRODSAccessObjectFactory() .getRemoteExecutionOfCommandsAO(irodsAccount); InputStream inputStream = remoteExecutionOfCommandsAO .executeARemoteCommandAndGetStreamGivingCommandNameAndArgs(cmd, args); BufferedReader br = new BufferedReader(new InputStreamReader(inputStream)); StringBuilder sb = new StringBuilder(); String line = null; while ((line = br.readLine()) != null) { sb.append(line + "\n"); } br.close(); String result = sb.toString(); Assert.assertEquals("did not successfully execute hello command", "Hello world from irods".trim(), result.trim()); }
@Test public final void testExecuteARemoteCommandAndGetStreamGivingCommandNameAndArgsTriggerLargeStream() throws Exception { if (!testingPropertiesHelper.isTestRemoteExecStream(testingProperties)) { return; } int testLen = 2097152; String cmd = "test_execstream.py"; String args = String.valueOf(testLen); IRODSAccount irodsAccount = testingPropertiesHelper.buildIRODSAccountFromTestProperties(testingProperties); EnvironmentalInfoAO environmentalInfoAO = irodsFileSystem.getIRODSAccessObjectFactory() .getEnvironmentalInfoAO(irodsAccount); IRODSServerProperties props = environmentalInfoAO.getIRODSServerPropertiesFromIRODSServer(); if (!props.isTheIrodsServerAtLeastAtTheGivenReleaseVersion(RemoteExecuteServiceImpl.STREAMING_API_CUTOFF)) { irodsFileSystem.closeAndEatExceptions(); return; } RemoteExecutionOfCommandsAO remoteExecutionOfCommandsAO = irodsFileSystem.getIRODSAccessObjectFactory() .getRemoteExecutionOfCommandsAO(irodsAccount); InputStream inputStream = remoteExecutionOfCommandsAO .executeARemoteCommandAndGetStreamGivingCommandNameAndArgs(cmd, args); Assert.assertTrue("should have gotten a SequenceInputStream", (inputStream instanceof SequenceInputStream)); inputStream.close(); }