machinesValidator.validate(machines);
- final T environment = doCreate(recipe, machines, warnings);
-
- // sets default ram limit attribute if not present
- for (InternalMachineConfig machineConfig : environment.getMachines().values()) {
- if (isNullOrEmpty(machineConfig.getAttributes().get(MEMORY_LIMIT_ATTRIBUTE))) {
- machineConfig
- .getAttributes()
- .put(MEMORY_LIMIT_ATTRIBUTE, defaultMachineMemorySizeAttribute);
- }
- }
- return environment;
+ return doCreate(recipe, machines, warnings);
}
/**
- * Implementation validates downloaded recipe and creates specific InternalEnvironment. Returned
- * InternalEnvironment must contains all machine that are defined in recipe and in source machine
- * collection.
+ * Implementation validates downloaded recipe and creates specific InternalEnvironment.
+ *
+ * Returned InternalEnvironment must contains all machine that are defined in recipe and in
+ * source machines collection. Also, if memory limitation is supported, it may add memory limit
+ * attribute {@link MachineConfig#MEMORY_LIMIT_ATTRIBUTE} from recipe or configured system-wide
+ * default value.
*
* @param recipe downloaded recipe
* @param machines machines configuration
diff --git a/wsmaster/che-core-api-workspace/src/test/java/org/eclipse/che/api/workspace/server/spi/environment/InternalEnvironmentFactoryTest.java b/wsmaster/che-core-api-workspace/src/test/java/org/eclipse/che/api/workspace/server/spi/environment/InternalEnvironmentFactoryTest.java
index 803d53c908..211c42fa59 100644
--- a/wsmaster/che-core-api-workspace/src/test/java/org/eclipse/che/api/workspace/server/spi/environment/InternalEnvironmentFactoryTest.java
+++ b/wsmaster/che-core-api-workspace/src/test/java/org/eclipse/che/api/workspace/server/spi/environment/InternalEnvironmentFactoryTest.java
@@ -25,7 +25,6 @@ import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
@@ -176,21 +175,6 @@ public class InternalEnvironmentFactoryTest {
ImmutableMap.of("serverWithoutProtocol", normalizedServer, "udpServer", udpServer));
}
- @Test
- public void testSetsDefaultRamLimitAttributeToMachineThatDoesNotContainIt() throws Exception {
- final Map attributes = new HashMap<>();
- final InternalEnvironment internalEnv = mock(InternalEnvironment.class);
- final InternalMachineConfig machine = mock(InternalMachineConfig.class);
- when(environmentFactory.doCreate(any(), any(), any())).thenReturn(internalEnv);
- when(internalEnv.getMachines()).thenReturn(ImmutableMap.of("testMachine", machine));
- when(machine.getAttributes()).thenReturn(attributes);
-
- environmentFactory.create(mock(Environment.class));
-
- assertTrue(attributes.containsKey(MEMORY_LIMIT_ATTRIBUTE));
- assertEquals(attributes.get(MEMORY_LIMIT_ATTRIBUTE), String.valueOf(RAM_LIMIT * 2 << 19));
- }
-
@Test
public void testDoNotOverrideRamLimitAttributeWhenMachineAlreadyContainsIt() throws Exception {
final String ramLimit = "2147483648";
@@ -216,7 +200,7 @@ public class InternalEnvironmentFactoryTest {
InstallerRegistry installerRegistry,
RecipeRetriever recipeRetriever,
MachineConfigsValidator machinesValidator) {
- super(installerRegistry, recipeRetriever, machinesValidator, RAM_LIMIT);
+ super(installerRegistry, recipeRetriever, machinesValidator);
}
@Override