Search in sources :

Example 31 with CheServiceImpl

use of org.eclipse.che.api.environment.server.model.CheServiceImpl in project che by eclipse.

the class DefaultServicesStartStrategyTest method shouldFailIfMachineLinksByItSelf.

@Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "A machine can not link to itself: .*")
public void shouldFailIfMachineLinksByItSelf() {
    // given
    CheServicesEnvironmentImpl composeEnvironment = new CheServicesEnvironmentImpl();
    composeEnvironment.getServices().put("first", new CheServiceImpl().withLinks(singletonList("first")));
    // when
    strategy.order(composeEnvironment);
}
Also used : CheServiceImpl(org.eclipse.che.api.environment.server.model.CheServiceImpl) CheServicesEnvironmentImpl(org.eclipse.che.api.environment.server.model.CheServicesEnvironmentImpl) Test(org.testng.annotations.Test)

Example 32 with CheServiceImpl

use of org.eclipse.che.api.environment.server.model.CheServiceImpl in project che by eclipse.

the class AgentConfigApplier method apply.

/**
     * Applies docker specific properties to an environment of machines.
     *
     * @param envConfig
     *         environment config with the list of agents that should be injected into machine
     * @param internalEnv
     *         affected environment of machines
     * @throws AgentException
     *         if any error occurs
     */
public void apply(Environment envConfig, CheServicesEnvironmentImpl internalEnv) throws AgentException {
    for (Map.Entry<String, ? extends ExtendedMachine> machineEntry : envConfig.getMachines().entrySet()) {
        String machineName = machineEntry.getKey();
        ExtendedMachine machineConf = machineEntry.getValue();
        CheServiceImpl internalMachine = internalEnv.getServices().get(machineName);
        apply(machineConf, internalMachine);
    }
}
Also used : CheServiceImpl(org.eclipse.che.api.environment.server.model.CheServiceImpl) HashMap(java.util.HashMap) Map(java.util.Map) ExtendedMachine(org.eclipse.che.api.core.model.workspace.ExtendedMachine)

Example 33 with CheServiceImpl

use of org.eclipse.che.api.environment.server.model.CheServiceImpl in project che by eclipse.

the class CheEnvironmentEngine method normalizeNames.

/**
     * Sets specific names for this environment instance where it is required.
     *
     * @param environment
     *         environment in which names will be normalized
     */
private void normalizeNames(CheServicesEnvironmentImpl environment) {
    Map<String, CheServiceImpl> services = environment.getServices();
    for (Map.Entry<String, CheServiceImpl> serviceEntry : services.entrySet()) {
        CheServiceImpl service = serviceEntry.getValue();
        normalizeVolumesFrom(service, services);
        normalizeLinks(service, services);
    }
}
Also used : CheServiceImpl(org.eclipse.che.api.environment.server.model.CheServiceImpl) Map(java.util.Map) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap)

Example 34 with CheServiceImpl

use of org.eclipse.che.api.environment.server.model.CheServiceImpl in project che by eclipse.

the class MachineProviderImplTest method createInstanceFromSnapshot.

private void createInstanceFromSnapshot(int memorySizeInMB) throws ServerException {
    CheServiceImpl machine = createService();
    machine.setMemLimit(memorySizeInMB * 1024L * 1024L);
    createInstanceFromSnapshot(machine, false, WORKSPACE_ID);
}
Also used : CheServiceImpl(org.eclipse.che.api.environment.server.model.CheServiceImpl)

Example 35 with CheServiceImpl

use of org.eclipse.che.api.environment.server.model.CheServiceImpl in project che by eclipse.

the class MachineProviderImplTest method createInstanceFromRecipe.

private void createInstanceFromRecipe(int memorySizeInMB) throws Exception {
    CheServiceImpl machine = createService();
    machine.setMemLimit(memorySizeInMB * 1024L * 1024L);
    createInstanceFromRecipe(machine);
}
Also used : CheServiceImpl(org.eclipse.che.api.environment.server.model.CheServiceImpl)

Aggregations

CheServiceImpl (org.eclipse.che.api.environment.server.model.CheServiceImpl)93 Test (org.testng.annotations.Test)63 CheServicesEnvironmentImpl (org.eclipse.che.api.environment.server.model.CheServicesEnvironmentImpl)46 Matchers.anyString (org.mockito.Matchers.anyString)32 LineConsumer (org.eclipse.che.api.core.util.LineConsumer)28 ArrayList (java.util.ArrayList)24 HashMap (java.util.HashMap)24 Map (java.util.Map)18 Machine (org.eclipse.che.api.core.model.machine.Machine)17 CreateContainerParams (org.eclipse.che.plugin.docker.client.params.CreateContainerParams)17 ServerException (org.eclipse.che.api.core.ServerException)16 EnvironmentImpl (org.eclipse.che.api.workspace.server.model.impl.EnvironmentImpl)16 IOException (java.io.IOException)14 List (java.util.List)14 ServerConf (org.eclipse.che.api.core.model.machine.ServerConf)14 Collections.singletonMap (java.util.Collections.singletonMap)13 Set (java.util.Set)13 CheServiceBuildContextImpl (org.eclipse.che.api.environment.server.model.CheServiceBuildContextImpl)13 Instance (org.eclipse.che.api.machine.server.spi.Instance)13 EnvironmentContext (org.eclipse.che.commons.env.EnvironmentContext)13