use of org.eclipse.che.api.environment.server.model.CheServicesEnvironmentImpl in project che by eclipse.
the class DefaultServicesStartStrategyTest method shouldFailIfVolumesFromFieldHasIllegalFormat.
@Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "Service volumes_from '.*' is invalid")
public void shouldFailIfVolumesFromFieldHasIllegalFormat() throws Exception {
// given
CheServicesEnvironmentImpl composeEnvironment = new CheServicesEnvironmentImpl();
composeEnvironment.getServices().put("second", new CheServiceImpl().withVolumesFrom(singletonList("first:broken:dependency")));
composeEnvironment.getServices().put("third", new CheServiceImpl());
composeEnvironment.getServices().put("first", new CheServiceImpl());
// when
strategy.order(composeEnvironment);
}
use of org.eclipse.che.api.environment.server.model.CheServicesEnvironmentImpl in project che by eclipse.
the class DefaultServicesStartStrategyTest method shouldFailIfMachineDependsOnByItSelf.
@Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "A machine can not depend on itself: .*")
public void shouldFailIfMachineDependsOnByItSelf() {
// given
CheServicesEnvironmentImpl composeEnvironment = new CheServicesEnvironmentImpl();
composeEnvironment.getServices().put("first", new CheServiceImpl().withDependsOn(singletonList("first")));
// when
strategy.order(composeEnvironment);
}
use of org.eclipse.che.api.environment.server.model.CheServicesEnvironmentImpl in project che by eclipse.
the class DefaultServicesStartStrategyTest method shouldFailIfLinksFieldContainsNonExistingService.
@Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "Dependency 'fifth' in machine 'second' points to unknown machine.")
public void shouldFailIfLinksFieldContainsNonExistingService() throws Exception {
// given
CheServicesEnvironmentImpl composeEnvironment = new CheServicesEnvironmentImpl();
composeEnvironment.getServices().put("second", new CheServiceImpl().withLinks(singletonList("fifth")));
composeEnvironment.getServices().put("third", new CheServiceImpl());
composeEnvironment.getServices().put("first", new CheServiceImpl());
// when
strategy.order(composeEnvironment);
}
use of org.eclipse.che.api.environment.server.model.CheServicesEnvironmentImpl in project che by eclipse.
the class DefaultServicesStartStrategyTest method shouldOrderServicesWithComplementaryDependenciesInDependsOnLinksAndVolumesFrom.
@Test
public void shouldOrderServicesWithComplementaryDependenciesInDependsOnLinksAndVolumesFrom() throws Exception {
// given
CheServicesEnvironmentImpl composeEnvironment = new CheServicesEnvironmentImpl();
composeEnvironment.getServices().put("second", new CheServiceImpl().withVolumesFrom(singletonList("first")));
composeEnvironment.getServices().put("third", new CheServiceImpl().withVolumesFrom(singletonList("second")).withDependsOn(singletonList("first")));
composeEnvironment.getServices().put("first", new CheServiceImpl());
composeEnvironment.getServices().put("forth", new CheServiceImpl().withVolumesFrom(singletonList("third")).withDependsOn(singletonList("second")).withLinks(singletonList("first:alias")));
composeEnvironment.getServices().put("fifth", new CheServiceImpl().withVolumesFrom(singletonList("first")).withLinks(singletonList("forth")).withDependsOn(singletonList("second")));
List<String> expected = asList("first", "second", "third", "forth", "fifth");
// when
List<String> actual = strategy.order(composeEnvironment);
// then
assertEquals(actual, expected);
}
use of org.eclipse.che.api.environment.server.model.CheServicesEnvironmentImpl in project che by eclipse.
the class DefaultServicesStartStrategyTest method shouldOrderServicesWithLinks.
@Test
public void shouldOrderServicesWithLinks() throws Exception {
// given
CheServicesEnvironmentImpl composeEnvironment = new CheServicesEnvironmentImpl();
composeEnvironment.getServices().put("second", new CheServiceImpl().withLinks(singletonList("first:alias")));
composeEnvironment.getServices().put("third", new CheServiceImpl().withLinks(asList("first", "second")));
composeEnvironment.getServices().put("first", new CheServiceImpl().withLinks(emptyList()));
composeEnvironment.getServices().put("forth", new CheServiceImpl().withLinks(singletonList("third")));
composeEnvironment.getServices().put("fifth", new CheServiceImpl().withLinks(asList("forth:alias", "first:alias")));
List<String> expected = asList("first", "second", "third", "forth", "fifth");
// when
List<String> actual = strategy.order(composeEnvironment);
// then
assertEquals(actual, expected);
}
Aggregations