use of org.eclipse.che.api.workspace.server.model.impl.devfile.ComponentImpl in project devspaces-images by redhat-developer.
the class DefaultEditorProvisionerTest method shouldProvisionAsyncStoragePluginsIfWorkspaceHasOnlyOneAttribute.
@Test
public void shouldProvisionAsyncStoragePluginsIfWorkspaceHasOnlyOneAttribute() throws Exception {
// given
provisioner = new DefaultEditorProvisioner(EDITOR_REF, TERMINAL_PLUGIN_REF, ASYNC_STORAGE_PLUGIN_REF, fqnParser, pluginFQNParser);
DevfileImpl devfile = new DevfileImpl();
devfile.setAttributes(ImmutableMap.of(Constants.ASYNC_PERSIST_ATTRIBUTE, "true"));
// when
provisioner.apply(devfile, fileContentProvider);
// then
List<ComponentImpl> components = devfile.getComponents();
assertEquals(components.size(), 2);
assertFalse(components.contains(new ComponentImpl(PLUGIN_COMPONENT_TYPE, ASYNC_STORAGE_PLUGIN_REF)));
}
use of org.eclipse.che.api.workspace.server.model.impl.devfile.ComponentImpl in project devspaces-images by redhat-developer.
the class DefaultEditorProvisionerTest method shouldProvisionDefaultEditorWithPluginsWhenDevfileDoNotHaveAny.
@Test
public void shouldProvisionDefaultEditorWithPluginsWhenDevfileDoNotHaveAny() throws Exception {
// given
provisioner = new DefaultEditorProvisioner(EDITOR_REF, TERMINAL_PLUGIN_REF + "," + COMMAND_PLUGIN_REF, "", fqnParser, pluginFQNParser);
DevfileImpl devfile = new DevfileImpl();
// when
provisioner.apply(devfile, fileContentProvider);
// then
List<ComponentImpl> components = devfile.getComponents();
assertEquals(components.size(), 3);
assertTrue(components.contains(new ComponentImpl(EDITOR_COMPONENT_TYPE, EDITOR_REF)));
assertTrue(components.contains(new ComponentImpl(PLUGIN_COMPONENT_TYPE, COMMAND_PLUGIN_REF)));
assertTrue(components.contains(new ComponentImpl(PLUGIN_COMPONENT_TYPE, TERMINAL_PLUGIN_REF)));
}
use of org.eclipse.che.api.workspace.server.model.impl.devfile.ComponentImpl in project devspaces-images by redhat-developer.
the class DefaultEditorProvisionerTest method shouldGenerateDefaultPluginNameIfIdIsNotUnique.
@Test
public void shouldGenerateDefaultPluginNameIfIdIsNotUnique() throws Exception {
// given
provisioner = new DefaultEditorProvisioner(EDITOR_REF, EDITOR_PUBLISHER + "/" + "my-plugin/v2.0", "", fqnParser, pluginFQNParser);
DevfileImpl devfile = new DevfileImpl();
ComponentImpl myPlugin = new ComponentImpl(PLUGIN_COMPONENT_TYPE, EDITOR_PUBLISHER + "/" + "my-custom-plugin/v0.0.3");
devfile.getComponents().add(myPlugin);
// when
provisioner.apply(devfile, fileContentProvider);
// then
List<ComponentImpl> components = devfile.getComponents();
assertEquals(components.size(), 3);
assertTrue(components.contains(new ComponentImpl(EDITOR_COMPONENT_TYPE, EDITOR_REF)));
assertTrue(components.contains(myPlugin));
ComponentImpl defaultPlugin = findByRef(components, EDITOR_PUBLISHER + "/" + "my-plugin/v2.0");
assertNotNull(defaultPlugin);
assertNull(defaultPlugin.getAlias());
}
use of org.eclipse.che.api.workspace.server.model.impl.devfile.ComponentImpl in project devspaces-images by redhat-developer.
the class DefaultEditorProvisionerTest method shouldProvisionDefaultPluginsIfTheyAreNotSpecifiedAndDefaultEditorIsConfigured.
@Test
public void shouldProvisionDefaultPluginsIfTheyAreNotSpecifiedAndDefaultEditorIsConfigured() throws Exception {
// given
provisioner = new DefaultEditorProvisioner(EDITOR_REF, TERMINAL_PLUGIN_REF, "", fqnParser, pluginFQNParser);
DevfileImpl devfile = new DevfileImpl();
ComponentImpl defaultEditorWithDifferentVersion = new ComponentImpl(EDITOR_COMPONENT_TYPE, EDITOR_PUBLISHER + "/" + EDITOR_NAME + "/latest");
devfile.getComponents().add(defaultEditorWithDifferentVersion);
// when
provisioner.apply(devfile, fileContentProvider);
// then
List<ComponentImpl> components = devfile.getComponents();
assertEquals(components.size(), 2);
assertTrue(components.contains(defaultEditorWithDifferentVersion));
assertTrue(components.contains(new ComponentImpl(PLUGIN_COMPONENT_TYPE, TERMINAL_PLUGIN_REF)));
}
use of org.eclipse.che.api.workspace.server.model.impl.devfile.ComponentImpl in project devspaces-images by redhat-developer.
the class DefaultEditorProvisionerTest method shouldProvisionDefaultPluginIfDevfileAlreadyContainPluginWithNameWhichStartWithDefaultOne.
@Test
public void shouldProvisionDefaultPluginIfDevfileAlreadyContainPluginWithNameWhichStartWithDefaultOne() throws Exception {
// given
provisioner = new DefaultEditorProvisioner(EDITOR_REF, TERMINAL_PLUGIN_REF, "", fqnParser, pluginFQNParser);
DevfileImpl devfile = new DevfileImpl();
ComponentImpl pluginWithNameSimilarToDefault = new ComponentImpl(PLUGIN_COMPONENT_TYPE, EDITOR_PUBLISHER + "/" + TERMINAL_PLUGIN_NAME + "-dummy/latest");
devfile.getComponents().add(pluginWithNameSimilarToDefault);
// when
provisioner.apply(devfile, fileContentProvider);
// then
List<ComponentImpl> components = devfile.getComponents();
assertEquals(components.size(), 3);
assertTrue(components.contains(new ComponentImpl(EDITOR_COMPONENT_TYPE, EDITOR_REF)));
assertTrue(components.contains(new ComponentImpl(PLUGIN_COMPONENT_TYPE, TERMINAL_PLUGIN_REF)));
assertTrue(components.contains(pluginWithNameSimilarToDefault));
}
Aggregations