use of com.synopsys.integration.detect.configuration.help.DetectArgumentState in project synopsys-detect by blackducksoftware.
the class DiagnosticDecisionTest method propertyDecisionExtended.
@Test
void propertyDecisionExtended() {
PropertyConfiguration propertyConfiguration = createPropertyConfiguration(false, true);
DetectArgumentState detectArgumentState = createDetectArgumentState(false, false);
DiagnosticDecision diagnosticDecision = DiagnosticDecision.decide(detectArgumentState, propertyConfiguration);
Assertions.assertTrue(diagnosticDecision.shouldCreateDiagnosticSystem());
Assertions.assertTrue(diagnosticDecision.isExtended());
}
use of com.synopsys.integration.detect.configuration.help.DetectArgumentState in project synopsys-detect by blackducksoftware.
the class ArgumentStateParserTests method helpIgnoresDash.
@Test
public void helpIgnoresDash() {
String[] args = new String[] { "-h", "-ignoreme" };
DetectArgumentState state = parser.parseArgs(args);
Assertions.assertTrue(state.isHelp());
Assertions.assertNull(state.getParsedValue());
}
use of com.synopsys.integration.detect.configuration.help.DetectArgumentState in project synopsys-detect by blackducksoftware.
the class ArgumentStateParserTests method helpParsesValue.
@Test
public void helpParsesValue() {
String[] args = new String[] { "-h", "value" };
DetectArgumentState state = parser.parseArgs(args);
Assertions.assertTrue(state.isHelp());
Assertions.assertEquals("value", state.getParsedValue());
}
use of com.synopsys.integration.detect.configuration.help.DetectArgumentState in project synopsys-detect by blackducksoftware.
the class ArgumentStateParserTests method helpParsesInMiddleWithNoValue.
@Test
public void helpParsesInMiddleWithNoValue() {
String[] args = new String[] { "--propert", "--property", "-h", "--property", "--property" };
DetectArgumentState state = parser.parseArgs(args);
Assertions.assertTrue(state.isHelp());
Assertions.assertNull(state.getParsedValue());
}
use of com.synopsys.integration.detect.configuration.help.DetectArgumentState in project synopsys-detect by blackducksoftware.
the class Application method bootApplication.
private Optional<DetectBootResult> bootApplication(DetectRunId detectRunId, String[] sourceArgs, EventSystem eventSystem, ExitCodeManager exitCodeManager, Gson gson, DetectInfo detectInfo, FileFinder fileFinder, InstalledToolManager installedToolManager, ExceptionUtility exceptionUtility) {
Optional<DetectBootResult> bootResult = Optional.empty();
try {
logger.debug("Detect boot begin.");
DetectArgumentStateParser detectArgumentStateParser = new DetectArgumentStateParser();
DetectArgumentState detectArgumentState = detectArgumentStateParser.parseArgs(sourceArgs);
List<PropertySource> propertySources = new ArrayList<>(SpringConfigurationPropertySource.fromConfigurableEnvironmentSafely(environment, logger::error));
DetectBootFactory detectBootFactory = new DetectBootFactory(detectRunId, detectInfo, gson, eventSystem, fileFinder);
DetectBoot detectBoot = new DetectBoot(eventSystem, gson, detectBootFactory, detectArgumentState, propertySources, installedToolManager);
bootResult = detectBoot.boot(detectInfo.getDetectVersion(), detectInfo.getBuildDateString());
logger.debug("Detect boot completed.");
} catch (Exception e) {
logger.error("Detect boot failed.");
logger.error("");
exceptionUtility.logException(e);
exitCodeManager.requestExitCode(e);
logger.error("");
// TODO- should we return a DetectBootResult.exception(...) here?
}
return bootResult;
}
Aggregations