Search in sources :

Example 6 with IdeActionDto

use of org.eclipse.che.api.factory.shared.dto.IdeActionDto 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);
}
Also used : OnAppLoadedDto(org.eclipse.che.api.factory.shared.dto.OnAppLoadedDto) IdeActionDto(org.eclipse.che.api.factory.shared.dto.IdeActionDto) IdeDto(org.eclipse.che.api.factory.shared.dto.IdeDto) FactoryDto(org.eclipse.che.api.factory.shared.dto.FactoryDto) Test(org.testng.annotations.Test)

Example 7 with IdeActionDto

use of org.eclipse.che.api.factory.shared.dto.IdeActionDto 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);
}
Also used : IdeActionDto(org.eclipse.che.api.factory.shared.dto.IdeActionDto) IdeDto(org.eclipse.che.api.factory.shared.dto.IdeDto) HashMap(java.util.HashMap) FactoryDto(org.eclipse.che.api.factory.shared.dto.FactoryDto) Test(org.testng.annotations.Test)

Example 8 with IdeActionDto

use of org.eclipse.che.api.factory.shared.dto.IdeActionDto 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);
}
Also used : IdeActionDto(org.eclipse.che.api.factory.shared.dto.IdeActionDto) IdeDto(org.eclipse.che.api.factory.shared.dto.IdeDto) HashMap(java.util.HashMap) FactoryDto(org.eclipse.che.api.factory.shared.dto.FactoryDto) Test(org.testng.annotations.Test)

Example 9 with IdeActionDto

use of org.eclipse.che.api.factory.shared.dto.IdeActionDto 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);
}
Also used : IdeActionDto(org.eclipse.che.api.factory.shared.dto.IdeActionDto) IdeDto(org.eclipse.che.api.factory.shared.dto.IdeDto) FactoryDto(org.eclipse.che.api.factory.shared.dto.FactoryDto) Test(org.testng.annotations.Test)

Aggregations

IdeActionDto (org.eclipse.che.api.factory.shared.dto.IdeActionDto)9 IdeDto (org.eclipse.che.api.factory.shared.dto.IdeDto)9 FactoryDto (org.eclipse.che.api.factory.shared.dto.FactoryDto)8 Test (org.testng.annotations.Test)8 HashMap (java.util.HashMap)3 OnAppLoadedDto (org.eclipse.che.api.factory.shared.dto.OnAppLoadedDto)2 ArrayList (java.util.ArrayList)1 BadRequestException (org.eclipse.che.api.core.BadRequestException)1 OnProjectsLoadedDto (org.eclipse.che.api.factory.shared.dto.OnProjectsLoadedDto)1