use of org.eclipse.che.api.workspace.server.model.impl.devfile.DevfileImpl in project che-server by eclipse-che.
the class DefaultEditorProvisionerTest method shouldNotProvisionDefaultEditorOrDefaultPluginsIfDevfileAlreadyHasNonDefaultEditor.
@Test
public void shouldNotProvisionDefaultEditorOrDefaultPluginsIfDevfileAlreadyHasNonDefaultEditor() throws Exception {
// given
provisioner = new DefaultEditorProvisioner(EDITOR_REF, "", "", fqnParser, pluginFQNParser);
DevfileImpl devfile = new DevfileImpl();
ComponentImpl nonDefaultEditor = new ComponentImpl(EDITOR_COMPONENT_TYPE, "anypublisher/anyname/v" + EDITOR_VERSION);
devfile.getComponents().add(nonDefaultEditor);
// when
provisioner.apply(devfile, fileContentProvider);
// then
List<ComponentImpl> components = devfile.getComponents();
assertEquals(components.size(), 1);
assertTrue(components.contains(nonDefaultEditor));
}
use of org.eclipse.che.api.workspace.server.model.impl.devfile.DevfileImpl in project che-server by eclipse-che.
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.DevfileImpl in project che-server by eclipse-che.
the class DefaultEditorProvisionerTest method shouldProvisionAsyncStoragePluginsIfWorkspaceHasBothAttributes.
@Test
public void shouldProvisionAsyncStoragePluginsIfWorkspaceHasBothAttributes() 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", Constants.PERSIST_VOLUMES_ATTRIBUTE, "false"));
// when
provisioner.apply(devfile, fileContentProvider);
// then
List<ComponentImpl> components = devfile.getComponents();
assertEquals(components.size(), 3);
assertTrue(components.contains(new ComponentImpl(PLUGIN_COMPONENT_TYPE, ASYNC_STORAGE_PLUGIN_REF)));
}
use of org.eclipse.che.api.workspace.server.model.impl.devfile.DevfileImpl in project che-server by eclipse-che.
the class DefaultEditorProvisionerTest method shouldNotProvisionDefaultPluginsIfDevfileContainsEditorFreeAttribute.
@Test
public void shouldNotProvisionDefaultPluginsIfDevfileContainsEditorFreeAttribute() throws Exception {
// given
provisioner = new DefaultEditorProvisioner(EDITOR_REF, TERMINAL_PLUGIN_REF, "", fqnParser, pluginFQNParser);
DevfileImpl devfile = new DevfileImpl();
devfile.getAttributes().put(EDITOR_FREE_DEVFILE_ATTRIBUTE, "true");
// when
provisioner.apply(devfile, fileContentProvider);
// then
List<ComponentImpl> components = devfile.getComponents();
assertTrue(components.isEmpty());
}
use of org.eclipse.che.api.workspace.server.model.impl.devfile.DevfileImpl in project che-server by eclipse-che.
the class DefaultEditorProvisionerTest method shouldNotProvisionDefaultEditorIfDevfileAlreadyContainsSuchButWithDifferentVersion.
@Test
public void shouldNotProvisionDefaultEditorIfDevfileAlreadyContainsSuchButWithDifferentVersion() throws Exception {
// given
provisioner = new DefaultEditorProvisioner(EDITOR_REF, "", "", fqnParser, pluginFQNParser);
DevfileImpl devfile = new DevfileImpl();
ComponentImpl myTheiaEditor = new ComponentImpl(EDITOR_COMPONENT_TYPE, EDITOR_PUBLISHER + "/" + EDITOR_NAME + "/my-custom");
devfile.getComponents().add(myTheiaEditor);
// when
provisioner.apply(devfile, fileContentProvider);
// then
List<ComponentImpl> components = devfile.getComponents();
assertEquals(components.size(), 1);
assertTrue(components.contains(myTheiaEditor));
}
Aggregations