use of com.google.idea.blaze.base.run.state.BlazeCommandRunConfigurationCommonState in project intellij by bazelbuild.
the class BlazeCommandRunConfigurationGenericHandlerIntegrationTest method testReadAndWriteMatches.
@Test
public void testReadAndWriteMatches() throws Exception {
TargetExpression targetExpression = TargetExpression.fromStringSafe("//...");
configuration.setTarget(targetExpression);
BlazeCommandRunConfigurationCommonState state = (BlazeCommandRunConfigurationCommonState) configuration.getHandler().getState();
state.getCommandState().setCommand(COMMAND);
state.getBlazeFlagsState().setRawFlags(ImmutableList.of("--flag1", "--flag2"));
state.getExeFlagsState().setRawFlags(ImmutableList.of("--exeFlag1"));
state.getBlazeBinaryState().setBlazeBinary("/usr/bin/blaze");
Element element = new Element("test");
configuration.writeExternal(element);
BlazeCommandRunConfiguration readConfiguration = type.getFactory().createTemplateConfiguration(getProject());
readConfiguration.readExternal(element);
assertThat(readConfiguration.getTarget()).isEqualTo(targetExpression);
assertThat(readConfiguration.getHandler()).isInstanceOf(BlazeCommandGenericRunConfigurationHandler.class);
BlazeCommandRunConfigurationCommonState readState = (BlazeCommandRunConfigurationCommonState) readConfiguration.getHandler().getState();
assertThat(readState.getCommandState().getCommand()).isEqualTo(COMMAND);
assertThat(readState.getBlazeFlagsState().getRawFlags()).containsExactly("--flag1", "--flag2").inOrder();
assertThat(readState.getExeFlagsState().getRawFlags()).containsExactly("--exeFlag1");
assertThat(readState.getBlazeBinaryState().getBlazeBinary()).isEqualTo("/usr/bin/blaze");
}
use of com.google.idea.blaze.base.run.state.BlazeCommandRunConfigurationCommonState in project intellij by bazelbuild.
the class BlazeGoTestConfigurationProducer method doIsConfigFromContext.
@Override
protected boolean doIsConfigFromContext(BlazeCommandRunConfiguration configuration, ConfigurationContext context) {
BlazeCommandRunConfigurationCommonState handlerState = configuration.getHandlerStateIfType(BlazeCommandRunConfigurationCommonState.class);
if (handlerState == null || !BlazeCommandName.TEST.equals(handlerState.getCommandState().getCommand())) {
return false;
}
TestLocation testlocation = testLocation(context);
return testlocation != null && testlocation.target.label.equals(configuration.getTarget()) && Objects.equals(handlerState.getTestFilterFlag(), testlocation.testFilter());
}
Aggregations