Search in sources :

Example 1 with MachineConfigsValidator

use of org.eclipse.che.api.workspace.server.spi.environment.MachineConfigsValidator in project devspaces-images by redhat-developer.

the class DockerimageComponentToWorkspaceApplierTest method testGeneratesValidMachineNameFromImageName.

@Test(dataProvider = "imageNames")
public void testGeneratesValidMachineNameFromImageName(String imageName) throws ValidationException, DevfileException {
    // given
    String machineName = DockerimageComponentToWorkspaceApplier.toMachineName(imageName);
    MachineConfigsValidator validator = new MachineConfigsValidator();
    Map<String, InternalMachineConfig> configs = new HashMap<>();
    configs.put(machineName, new InternalMachineConfig());
    // when
    validator.validate(configs);
// then no exception is thrown
}
Also used : InternalMachineConfig(org.eclipse.che.api.workspace.server.spi.environment.InternalMachineConfig) HashMap(java.util.HashMap) MachineConfigsValidator(org.eclipse.che.api.workspace.server.spi.environment.MachineConfigsValidator) Test(org.testng.annotations.Test)

Example 2 with MachineConfigsValidator

use of org.eclipse.che.api.workspace.server.spi.environment.MachineConfigsValidator in project che-server by eclipse-che.

the class DockerimageComponentToWorkspaceApplierTest method testGeneratesValidMachineNameFromImageName.

@Test(dataProvider = "imageNames")
public void testGeneratesValidMachineNameFromImageName(String imageName) throws ValidationException, DevfileException {
    // given
    String machineName = DockerimageComponentToWorkspaceApplier.toMachineName(imageName);
    MachineConfigsValidator validator = new MachineConfigsValidator();
    Map<String, InternalMachineConfig> configs = new HashMap<>();
    configs.put(machineName, new InternalMachineConfig());
    // when
    validator.validate(configs);
// then no exception is thrown
}
Also used : InternalMachineConfig(org.eclipse.che.api.workspace.server.spi.environment.InternalMachineConfig) HashMap(java.util.HashMap) MachineConfigsValidator(org.eclipse.che.api.workspace.server.spi.environment.MachineConfigsValidator) Test(org.testng.annotations.Test)

Aggregations

HashMap (java.util.HashMap)2 InternalMachineConfig (org.eclipse.che.api.workspace.server.spi.environment.InternalMachineConfig)2 MachineConfigsValidator (org.eclipse.che.api.workspace.server.spi.environment.MachineConfigsValidator)2 Test (org.testng.annotations.Test)2