use of org.eclipse.che.api.factory.shared.dto.FactoryDto in project che by eclipse.
the class FactoryBaseValidatorTest method shouldNotValidateIfOpenWelcomePageActionInsufficientParams.
@Test(expectedExceptions = BadRequestException.class)
public void shouldNotValidateIfOpenWelcomePageActionInsufficientParams() throws Exception {
//given
validator = new TesterFactoryBaseValidator();
List<IdeActionDto> actions = singletonList(newDto(IdeActionDto.class).withId("openWelcomePage"));
IdeDto ide = newDto(IdeDto.class).withOnAppLoaded((newDto(OnAppLoadedDto.class).withActions(actions)));
FactoryDto factoryWithAccountId = requireNonNull(getInstance().clone(factory)).withIde(ide);
//when
validator.validateProjectActions(factoryWithAccountId);
}
use of org.eclipse.che.api.factory.shared.dto.FactoryDto in project che by eclipse.
the class FactoryBaseValidatorTest method shouldValidateFindReplaceAction.
@Test
public void shouldValidateFindReplaceAction() throws Exception {
//given
validator = new TesterFactoryBaseValidator();
Map<String, String> params = new HashMap<>();
params.put("in", "pom.xml");
params.put("find", "123");
params.put("replace", "456");
List<IdeActionDto> actions = singletonList(newDto(IdeActionDto.class).withId("findReplace").withProperties(params));
IdeDto ide = newDto(IdeDto.class).withOnProjectsLoaded(newDto(OnProjectsLoadedDto.class).withActions(actions));
FactoryDto factoryWithAccountId = requireNonNull(getInstance().clone(factory)).withIde(ide);
//when
validator.validateProjectActions(factoryWithAccountId);
}
use of org.eclipse.che.api.factory.shared.dto.FactoryDto in project che by eclipse.
the class FactoryBaseValidatorTest method shouldNotValidateIfFindReplaceActionInsufficientParams.
@Test(expectedExceptions = BadRequestException.class)
public void shouldNotValidateIfFindReplaceActionInsufficientParams() throws Exception {
//given
validator = new TesterFactoryBaseValidator();
Map<String, String> params = new HashMap<>();
params.put("in", "pom.xml");
// find is missing!
params.put("replace", "123");
List<IdeActionDto> actions = singletonList(newDto(IdeActionDto.class).withId("findReplace").withProperties(params));
IdeDto ide = newDto(IdeDto.class).withOnProjectsLoaded(newDto(OnProjectsLoadedDto.class).withActions(actions));
FactoryDto factoryWithAccountId = requireNonNull(getInstance().clone(factory)).withIde(ide);
//when
validator.validateProjectActions(factoryWithAccountId);
}
use of org.eclipse.che.api.factory.shared.dto.FactoryDto in project che by eclipse.
the class FactoryBaseValidatorTest method shouldNotValidateIfOpenfileActionInsufficientParams.
@Test(expectedExceptions = BadRequestException.class)
public void shouldNotValidateIfOpenfileActionInsufficientParams() throws Exception {
//given
validator = new TesterFactoryBaseValidator();
List<IdeActionDto> actions = singletonList(newDto(IdeActionDto.class).withId("openFile"));
IdeDto ide = newDto(IdeDto.class).withOnProjectsLoaded(newDto(OnProjectsLoadedDto.class).withActions(actions));
FactoryDto factoryWithAccountId = requireNonNull(getInstance().clone(factory)).withIde(ide);
//when
validator.validateProjectActions(factoryWithAccountId);
}
use of org.eclipse.che.api.factory.shared.dto.FactoryDto in project che by eclipse.
the class MavenModelImporter method onFactoryAccepted.
@Override
public void onFactoryAccepted(FactoryAcceptedEvent event) {
final FactoryDto factory = event.getFactory();
final List<ProjectConfigDto> projects = factory.getWorkspace().getProjects();
final List<String> paths = new ArrayList<>();
for (ProjectConfigDto project : projects) {
if (MavenAttributes.MAVEN_ID.equals(project.getType())) {
paths.add(project.getPath());
}
}
if (!paths.isEmpty()) {
reimport(paths);
}
}
Aggregations