use of org.eclipse.che.api.workspace.server.model.impl.CommandImpl in project che-server by eclipse-che.
the class PreviewUrlLinksVariableGeneratorTest method shouldDoNothingWhenNoCommandWithPreviewurlAttribute.
@Test
public void shouldDoNothingWhenNoCommandWithPreviewurlAttribute() {
CommandImpl command = new CommandImpl("a", "a", "a", new PreviewUrlImpl(123, null), Collections.emptyMap());
WorkspaceImpl w = createWorkspaceWithCommands(singletonList(command));
assertTrue(generator.genLinksMapAndUpdateCommands(w, uriBuilder).isEmpty());
}
use of org.eclipse.che.api.workspace.server.model.impl.CommandImpl in project che-server by eclipse-che.
the class PreviewUrlLinksVariableGeneratorTest method shouldGetHttpsWhenUriBuilderHasHttps.
@Test
public void shouldGetHttpsWhenUriBuilderHasHttps() {
UriBuilder httpsUriBuilder = UriBuilder.fromUri("https://host/path");
Map<String, String> commandAttrs = new HashMap<>();
commandAttrs.put(Command.PREVIEW_URL_ATTRIBUTE, "preview_url_host");
CommandImpl command = new CommandImpl("run command", "a", "a", new PreviewUrlImpl(123, null), commandAttrs);
Map<String, String> linkMap = generator.genLinksMapAndUpdateCommands(createWorkspaceWithCommands(singletonList(command)), httpsUriBuilder);
assertTrue(linkMap.values().iterator().next().startsWith("https://"));
}
use of org.eclipse.che.api.workspace.server.model.impl.CommandImpl in project che-server by eclipse-che.
the class KubernetesRuntimeStateCacheTest method shouldThrowExceptionUpdateCommands.
@Test(expectedExceptions = InfrastructureException.class, expectedExceptionsMessageRegExp = "Runtime state for workspace with id 'non-existent-ws' was not found")
public void shouldThrowExceptionUpdateCommands() throws Exception {
// given
CommandImpl newCommand = new CommandImpl("new", "build", "custom");
// when
runtimesStatesCache.updateCommands(new RuntimeIdentityImpl("non-existent-ws", "defEnv", "acc1", "infraNamespace"), singletonList(newCommand));
}
use of org.eclipse.che.api.workspace.server.model.impl.CommandImpl in project che-server by eclipse-che.
the class TestObjectsFactory method createCommand.
public static CommandImpl createCommand() {
CommandImpl cmd = new CommandImpl(generate("command", 5), "echo " + generate("command", 5), "CUSTOM");
cmd.getAttributes().put("attr1", "val1");
cmd.getAttributes().put("attr2", "val2");
return cmd;
}
use of org.eclipse.che.api.workspace.server.model.impl.CommandImpl in project che-server by eclipse-che.
the class PluginComponentToWorkspaceApplierTest method shouldProvisionPluginCommandAttributeWhenIdIsURLToCustomPluginRegistry.
@Test
public void shouldProvisionPluginCommandAttributeWhenIdIsURLToCustomPluginRegistry() throws Exception {
// given
ComponentImpl superPluginComponent = new ComponentImpl();
superPluginComponent.setAlias("super-plugin");
superPluginComponent.setId("https://custom-plugin.registry/plugins/#eclipse/super-plugin/0.0.1");
superPluginComponent.setType(PLUGIN_COMPONENT_TYPE);
WorkspaceConfigImpl workspaceConfig = new WorkspaceConfigImpl();
CommandImpl command = new CommandImpl();
command.getAttributes().put(COMPONENT_ALIAS_COMMAND_ATTRIBUTE, "super-plugin");
workspaceConfig.getCommands().add(command);
// when
pluginComponentApplier.apply(workspaceConfig, superPluginComponent, null);
// then
assertEquals(workspaceConfig.getCommands().get(0).getAttributes().get(PLUGIN_ATTRIBUTE), "eclipse/super-plugin/0.0.1");
}
Aggregations