Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove installers entity #18130

Merged
merged 2 commits into from
Oct 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
*/
package org.eclipse.che.api.core.model.workspace.config;

import java.util.List;
import java.util.Map;
import org.eclipse.che.api.core.model.workspace.devfile.Component;

Expand Down Expand Up @@ -75,15 +74,6 @@ public interface MachineConfig {
*/
String DEVFILE_COMPONENT_ALIAS_ATTRIBUTE = "component";

/**
* Returns configured installers.
*
* <p>Values can be installer id with version separated with ':' symbol or just id then latest
* version will be used. Values examples: org.exec-agent:v1.0, org.exec-agent,
* org.exec-agent:latest.
*/
List<String> getInstallers();

/** Returns mapping of references to configurations of servers deployed into machine. */
Map<String, ? extends ServerConfig> getServers();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,6 @@ private static MachineImpl createMachine(long memoryMb) {

private static MachineConfigImpl createMachineConfig(long memoryMb) {
return new MachineConfigImpl(
null, null, null, ImmutableMap.of(MEMORY_LIMIT_ATTRIBUTE, valueOf(memoryMb)), null);
null, null, ImmutableMap.of(MEMORY_LIMIT_ATTRIBUTE, valueOf(memoryMb)), null);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

import static com.jayway.restassured.RestAssured.given;
import static java.lang.String.valueOf;
import static java.util.Collections.singletonList;
import static java.util.Collections.singletonMap;
import static javax.ws.rs.core.Response.Status.BAD_REQUEST;
import static org.eclipse.che.api.factory.server.FactoryService.VALIDATE_QUERY_PARAMETER;
Expand Down Expand Up @@ -242,7 +241,6 @@ private static EnvironmentDto createEnvDto() {
environmentRecipe.setLocation("location");
final EnvironmentImpl env = new EnvironmentImpl();
final MachineConfigImpl extendedMachine = new MachineConfigImpl();
extendedMachine.setInstallers(singletonList("agent"));
extendedMachine.setAttributes(singletonMap("att1", "value"));
extendedMachine.setServers(
singletonMap(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,6 @@ private static FactoryDto prepareFactory() {
singletonMap(
"devmachine",
newDto(MachineConfigDto.class)
.withInstallers(singletonList("org.eclipse.che.ws-agent"))
.withAttributes(
singletonMap(MEMORY_LIMIT_ATTRIBUTE, "" + 512L * 1024L * 1024L))));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,6 @@ private static WorkspaceConfigImpl createWorkspaceConfig(int index) {
final ServerConfigImpl serverConf2 =
new ServerConfigImpl("2266", "ftp", "/path2", singletonMap("key", "value"));
exMachine1.setServers(ImmutableMap.of("ref1", serverConf1, "ref2", serverConf2));
exMachine1.setInstallers(ImmutableList.of("agent5", "agent4"));
exMachine1.setAttributes(singletonMap("att1", "val"));
exMachine1.setEnv(singletonMap("CHE_ENV", "value"));

Expand All @@ -357,15 +356,13 @@ private static WorkspaceConfigImpl createWorkspaceConfig(int index) {
final ServerConfigImpl serverConf4 =
new ServerConfigImpl("2334", "wss", "/path2", singletonMap("key", "value"));
exMachine2.setServers(ImmutableMap.of("ref1", serverConf3, "ref2", serverConf4));
exMachine2.setInstallers(ImmutableList.of("agent2", "agent1"));
exMachine2.setAttributes(singletonMap("att1", "val"));
exMachine2.setEnv(singletonMap("CHE_ENV2", "value"));

final MachineConfigImpl exMachine3 = new MachineConfigImpl();
final ServerConfigImpl serverConf5 =
new ServerConfigImpl("2333", "https", "/path3", singletonMap("key", "value"));
exMachine3.setServers(singletonMap("ref1", serverConf5));
exMachine3.setInstallers(ImmutableList.of("agent6", "agent2"));
exMachine3.setAttributes(singletonMap("att1", "val"));
exMachine3.setEnv(singletonMap("CHE_ENV3", "value"));

Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import java.time.Instant;
import java.util.ArrayList;
Expand Down Expand Up @@ -368,7 +367,6 @@ private static WorkspaceConfigImpl createWorkspaceConfig(String name) {
final ServerConfigImpl serverConf1 =
new ServerConfigImpl("2265", "http", "path1", singletonMap("key", "value"));
exMachine1.setServers(ImmutableMap.of("ref1", serverConf1));
exMachine1.setInstallers(ImmutableList.of("agent5", "agent4"));
exMachine1.setAttributes(singletonMap("att1", "val"));
exMachine1.setEnv(ImmutableMap.of("CHE_ENV1", "value", "CHE_ENV2", "value"));
exMachine1.setVolumes(ImmutableMap.of("vol1", new VolumeImpl().withPath("/path/1")));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

import static org.eclipse.che.api.core.factory.FactoryParameter.Obligation.OPTIONAL;

import java.util.List;
import java.util.Map;
import org.eclipse.che.api.core.factory.FactoryParameter;
import org.eclipse.che.api.core.model.workspace.config.MachineConfig;
Expand All @@ -22,13 +21,6 @@
/** @author Alexander Garagatyi */
@DTO
public interface MachineConfigDto extends MachineConfig {
@Override
@FactoryParameter(obligation = OPTIONAL)
List<String> getInstallers();

void setInstallers(List<String> installers);

MachineConfigDto withInstallers(List<String> installers);

@Override
@FactoryParameter(obligation = OPTIONAL)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,8 +307,7 @@ public static EnvironmentDto asDto(Environment env) {

/** Converts {@link MachineConfig} to {@link MachineConfigDto}. */
public static MachineConfigDto asDto(MachineConfig machine) {
MachineConfigDto machineDto =
newDto(MachineConfigDto.class).withInstallers(machine.getInstallers());
MachineConfigDto machineDto = newDto(MachineConfigDto.class);
if (machine.getServers() != null) {
machineDto.setServers(
machine
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import java.util.Map;
import java.util.Map.Entry;
import java.util.Optional;
import java.util.Set;
import java.util.regex.Pattern;
import javax.inject.Inject;
Expand Down Expand Up @@ -94,9 +93,6 @@ public void validateConfig(WorkspaceConfig config) throws ValidationException, S
command.getName(),
config.getName());
}

// ensure using either plugins or installers but not both
validatePlugins(config);
}

/**
Expand Down Expand Up @@ -209,28 +205,6 @@ private void validateLongAttribute(
}
}

/**
* Check that workspace has either plugins defined in attributes (Che 7) or installers defined in
* machines (Che 6).
*
* @throws ValidationException if workspace config contains both installers section and nonempty
* plugins or editor field in attributes.
*/
private void validatePlugins(WorkspaceConfig config) throws ValidationException {
Optional<String> installers =
config
.getEnvironments()
.values()
.stream()
.flatMap(env -> env.getMachines().values().stream())
.flatMap(machine -> machine.getInstallers().stream())
.findAny();
Map<String, String> attributes = config.getAttributes();
if (isSidecarBasedWorkspace(attributes) && installers.isPresent()) {
throw new ValidationException("Workspace config cannot have both plugins and installers.");
}
}

/**
* Checks that object reference is not null, throws {@link ValidationException} in the case of
* null {@code object} with given {@code message}.
Expand Down
Loading