use of org.eclipse.che.api.workspace.server.model.impl.devfile.ComponentImpl in project che-server by eclipse-che.
the class EditorComponentToWorkspaceApplierTest method shouldProvisionWorkspaceEditorAttributeDuringCheEditorComponentApplying.
@Test
public void shouldProvisionWorkspaceEditorAttributeDuringCheEditorComponentApplying() throws Exception {
String editorId = "eclipse/super-editor/0.0.1";
// given
WorkspaceConfigImpl workspaceConfig = new WorkspaceConfigImpl();
ComponentImpl editorComponent = new ComponentImpl();
editorComponent.setType(EDITOR_COMPONENT_TYPE);
editorComponent.setAlias("editor");
editorComponent.setId(editorId);
editorComponent.setMemoryLimit("12345M");
// when
editorComponentApplier.apply(workspaceConfig, editorComponent, null);
// then
assertEquals(workspaceConfig.getAttributes().get(WORKSPACE_TOOLING_EDITOR_ATTRIBUTE), editorId);
}
use of org.eclipse.che.api.workspace.server.model.impl.devfile.ComponentImpl in project che-server by eclipse-che.
the class EditorComponentToWorkspaceApplierTest method shouldProvisionPluginCommandAttributesDuringCheEditorComponentApplying.
@Test
public void shouldProvisionPluginCommandAttributesDuringCheEditorComponentApplying() throws Exception {
// given
ComponentImpl superPluginComponent = new ComponentImpl();
superPluginComponent.setAlias("editor");
superPluginComponent.setId("eclipse/super-editor/0.0.1");
superPluginComponent.setType(EDITOR_COMPONENT_TYPE);
WorkspaceConfigImpl workspaceConfig = new WorkspaceConfigImpl();
CommandImpl command = new CommandImpl();
command.getAttributes().put(COMPONENT_ALIAS_COMMAND_ATTRIBUTE, "editor");
workspaceConfig.getCommands().add(command);
// when
editorComponentApplier.apply(workspaceConfig, superPluginComponent, null);
// then
assertEquals(workspaceConfig.getCommands().get(0).getAttributes().get(PLUGIN_ATTRIBUTE), "eclipse/super-editor/0.0.1");
}
use of org.eclipse.che.api.workspace.server.model.impl.devfile.ComponentImpl in project che-server by eclipse-che.
the class EditorComponentToWorkspaceApplierTest method shouldProvisionPluginCommandAttributeWhenIdIsURLToCustomPluginRegistry.
@Test
public void shouldProvisionPluginCommandAttributeWhenIdIsURLToCustomPluginRegistry() throws Exception {
// given
ComponentImpl superPluginComponent = new ComponentImpl();
superPluginComponent.setAlias("editor");
superPluginComponent.setId("https://custom-plugin.registry/plugins#eclipse/super-editor/0.0.1");
superPluginComponent.setType(EDITOR_COMPONENT_TYPE);
WorkspaceConfigImpl workspaceConfig = new WorkspaceConfigImpl();
CommandImpl command = new CommandImpl();
command.getAttributes().put(COMPONENT_ALIAS_COMMAND_ATTRIBUTE, "editor");
workspaceConfig.getCommands().add(command);
// when
editorComponentApplier.apply(workspaceConfig, superPluginComponent, null);
// then
assertEquals(workspaceConfig.getCommands().get(0).getAttributes().get(PLUGIN_ATTRIBUTE), "eclipse/super-editor/0.0.1");
}
use of org.eclipse.che.api.workspace.server.model.impl.devfile.ComponentImpl in project che-server by eclipse-che.
the class PluginComponentToWorkspaceApplierTest method shouldProvisionPluginWorkspaceAttributeDuringChePluginComponentApplying.
@Test
public void shouldProvisionPluginWorkspaceAttributeDuringChePluginComponentApplying() throws Exception {
String superPluginId = "eclipse/super-plugin/0.0.1";
// given
ComponentImpl superPluginComponent = new ComponentImpl();
superPluginComponent.setAlias("super-plugin");
superPluginComponent.setId(superPluginId);
superPluginComponent.setType(PLUGIN_COMPONENT_TYPE);
superPluginComponent.setMemoryLimit("1234M");
superPluginComponent.getPreferences().put("java-home", "/home/user/jdk11");
ComponentImpl customPluginComponent = new ComponentImpl();
customPluginComponent.setAlias("custom");
customPluginComponent.setId("publisher1/custom-plugin/v1");
customPluginComponent.setType(PLUGIN_COMPONENT_TYPE);
WorkspaceConfigImpl workspaceConfig = new WorkspaceConfigImpl();
// when
pluginComponentApplier.apply(workspaceConfig, superPluginComponent, null);
pluginComponentApplier.apply(workspaceConfig, customPluginComponent, null);
// then
String workspaceTooling = workspaceConfig.getAttributes().get(WORKSPACE_TOOLING_PLUGINS_ATTRIBUTE);
assertTrue(workspaceTooling.matches("(.+/.+/.+),(.+/.+/.+)"));
assertTrue(workspaceTooling.contains(superPluginId));
assertTrue(workspaceTooling.contains("publisher1/custom-plugin/v1"));
}
use of org.eclipse.che.api.workspace.server.model.impl.devfile.ComponentImpl in project che-server by eclipse-che.
the class PluginComponentToWorkspaceApplierTest method shouldProvisionPluginWorkspaceAttributeWithCustomRegistryDuringChePluginComponentApplying.
@Test
public void shouldProvisionPluginWorkspaceAttributeWithCustomRegistryDuringChePluginComponentApplying() throws Exception {
String superPluginId = "eclipse/super-plugin/0.0.1";
String registryUrl = "https://myregistry.com/infolder/";
// given
ComponentImpl superPluginComponent = new ComponentImpl();
superPluginComponent.setAlias("super-plugin");
superPluginComponent.setId(superPluginId);
superPluginComponent.setType(PLUGIN_COMPONENT_TYPE);
superPluginComponent.setMemoryLimit("1234M");
ComponentImpl customPluginComponent = new ComponentImpl();
customPluginComponent.setAlias("custom");
customPluginComponent.setId("publisher1/custom-plugin/v1");
customPluginComponent.setRegistryUrl(registryUrl);
customPluginComponent.setType(PLUGIN_COMPONENT_TYPE);
WorkspaceConfigImpl workspaceConfig = new WorkspaceConfigImpl();
// when
pluginComponentApplier.apply(workspaceConfig, superPluginComponent, null);
pluginComponentApplier.apply(workspaceConfig, customPluginComponent, null);
// then
String workspaceTooling = workspaceConfig.getAttributes().get(WORKSPACE_TOOLING_PLUGINS_ATTRIBUTE);
assertTrue(workspaceTooling.matches("(.+/.+/.+),(.+/.+/.+)"));
assertTrue(workspaceTooling.contains(superPluginId));
assertTrue(workspaceTooling.contains(registryUrl + "#" + "publisher1/custom-plugin/v1"));
}
Aggregations