Merge branch 'master' into spi
# Conflicts: # assembly/assembly-wsmaster-war/pom.xml # infrastructures/docker/pom.xml # plugins/plugin-docker/che-plugin-docker-compose/pom.xml # plugins/plugin-github/che-plugin-github-pullrequest/src/main/java/org/eclipse/che/plugin/pullrequest/client/GitHubHostingService.java # plugins/plugin-testing-java/plugin-testing-junit/che-plugin-testing-junit-ide/src/main/java/org/eclipse/che/plugin/testing/junit/ide/action/RunAllTestAction.java # plugins/plugin-testing-java/plugin-testing-junit/che-plugin-testing-junit-ide/src/main/java/org/eclipse/che/plugin/testing/junit/ide/action/RunClassTestAction.java # plugins/plugin-testing-java/plugin-testing-testng/che-plugin-testing-testng-ide/src/main/java/org/eclipse/che/plugin/testing/testng/ide/action/RunAllTestAction.java # plugins/plugin-testing-java/plugin-testing-testng/che-plugin-testing-testng-ide/src/main/java/org/eclipse/che/plugin/testing/testng/ide/action/RunClassTestAction.java # plugins/plugin-testing-java/plugin-testing-testng/che-plugin-testing-testng-ide/src/main/java/org/eclipse/che/plugin/testing/testng/ide/action/RunTestXMLAction.java # pom.xml # wsmaster/che-core-api-machine/pom.xml6.19.x
commit
cce79bf469
|
|
@ -16,7 +16,7 @@
|
|||
<parent>
|
||||
<artifactId>che-agents-parent</artifactId>
|
||||
<groupId>org.eclipse.che</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<groupId>org.eclipse.che.core</groupId>
|
||||
<artifactId>che-core-api-agent-shared</artifactId>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<parent>
|
||||
<artifactId>che-agents-parent</artifactId>
|
||||
<groupId>org.eclipse.che</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<groupId>org.eclipse.che.core</groupId>
|
||||
<artifactId>che-core-api-agent</artifactId>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<parent>
|
||||
<artifactId>che-agents-parent</artifactId>
|
||||
<groupId>org.eclipse.che</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>exec-agent</artifactId>
|
||||
<name>Agent :: Exec</name>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
Copyright (c) 2012-2017 Codenvy, S.A.
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are made available under the terms of the Eclipse Public License v1.0
|
||||
which accompanies this distribution, and is available at
|
||||
http://www.eclipse.org/legal/epl-v10.html
|
||||
|
||||
Contributors:
|
||||
Codenvy, S.A. - initial API and implementation
|
||||
|
||||
-->
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<artifactId>che-agents-parent</artifactId>
|
||||
<groupId>org.eclipse.che</groupId>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>git-credentials-agent</artifactId>
|
||||
<name>Git Credentials Agent</name>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.google.inject</groupId>
|
||||
<artifactId>guice</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.che.core</groupId>
|
||||
<artifactId>che-core-api-agent-shared</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2012-2017 Codenvy, S.A.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Codenvy, S.A. - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.che.api.agent;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Singleton;
|
||||
|
||||
import org.eclipse.che.api.agent.shared.model.Agent;
|
||||
import org.eclipse.che.api.agent.shared.model.impl.BasicAgent;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Git credentials agent.
|
||||
* Creates sh script that retrieves SSH keys from user preferences for console Git SSH operations.
|
||||
* Injects Git username and email from user preferences to console Git preferences.
|
||||
*
|
||||
* @see Agent
|
||||
*
|
||||
* @author Igor Vinokur
|
||||
*/
|
||||
@Singleton
|
||||
public class GitCredentialsAgent extends BasicAgent {
|
||||
private static final String AGENT_DESCRIPTOR = "org.eclipse.che.git.json";
|
||||
private static final String AGENT_SCRIPT = "org.eclipse.che.git.script.sh";
|
||||
|
||||
@Inject
|
||||
public GitCredentialsAgent() throws IOException {
|
||||
super(AGENT_DESCRIPTOR, AGENT_SCRIPT);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"id": "org.eclipse.che.git-credentials",
|
||||
"name": "Git-Credentials-Agent",
|
||||
"description": "Agent fetches SSH keys, Git username and email from CHE user preferences, and injects to console Git"
|
||||
}
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
#
|
||||
# Copyright (c) 2012-2017 Codenvy, S.A.
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# are made available under the terms of the Eclipse Public License v1.0
|
||||
# which accompanies this distribution, and is available at
|
||||
# http://www.eclipse.org/legal/epl-v10.html
|
||||
#
|
||||
# Contributors:
|
||||
# Codenvy, S.A. - initial API and implementation
|
||||
#
|
||||
|
||||
SCRIPT_FILE=~/.ssh/git.sh
|
||||
|
||||
token=$(if [ "$USER_TOKEN" != "dummy_token" ]; then echo "$USER_TOKEN"; fi)
|
||||
che_host=$(cat /etc/hosts | grep che-host | awk '{print $1;}')
|
||||
api_url=$(if [ "$CHE_API" != "http://che-host:8080/wsmaster/api" ]; then echo "$CHE_API"; else echo "$che_host:8080/api"; fi)
|
||||
|
||||
CURL_INSTALLED=false
|
||||
WGET_INSTALLED=false
|
||||
command -v curl >/dev/null 2>&1 && CURL_INSTALLED=true
|
||||
command -v wget >/dev/null 2>&1 && WGET_INSTALLED=true
|
||||
|
||||
# no curl, no wget, install curl
|
||||
if [ ${CURL_INSTALLED} = false ] && [ ${WGET_INSTALLED} = false ]; then
|
||||
PACKAGES=${PACKAGES}" curl";
|
||||
CURL_INSTALLED=true
|
||||
fi
|
||||
|
||||
request=$(if ${CURL_INSTALLED}; then echo 'curl -s'; else echo 'wget -qO-'; fi)
|
||||
|
||||
echo 'host=$(echo $(if [ "$1" = "-p" ]; then echo "$3" ; else echo "$1"; fi) | sed -e "s/git@//")' > ${SCRIPT_FILE}
|
||||
echo 'token='"$token" >> ${SCRIPT_FILE}
|
||||
echo 'api_url='"$api_url" >> ${SCRIPT_FILE}
|
||||
echo 'request="'${request}'"' >> ${SCRIPT_FILE}
|
||||
# Ssh key request may return key with decoded '=' symbol, so need to replace '\u003d' to '='.
|
||||
# TODO remove the replacement after https://github.com/eclipse/che/issues/5253 will be fixed.
|
||||
echo 'ssh_key=$(${request} "$api_url/ssh/vcs/find?name=$host$(if [ -n "$token" ]; then echo "&token=$token"; fi)"| grep -Po '\''"privateKey":.*?[^\\\\]",'\''| sed -e "s/\"privateKey\":\"//" | sed -e "s/\\\\\u003d/=/g")' >> ${SCRIPT_FILE}
|
||||
echo 'if [ -n "$ssh_key" ]' >> ${SCRIPT_FILE}
|
||||
echo 'then' >> ${SCRIPT_FILE}
|
||||
echo ' key_file=$(mktemp)' >> ${SCRIPT_FILE}
|
||||
echo ' echo "$ssh_key" > "$key_file"' >> ${SCRIPT_FILE}
|
||||
echo ' ssh -i "$key_file" "$@"' >> ${SCRIPT_FILE}
|
||||
echo ' rm "$key_file"' >> ${SCRIPT_FILE}
|
||||
echo 'else' >> ${SCRIPT_FILE}
|
||||
echo ' ssh "$@"' >> ${SCRIPT_FILE}
|
||||
echo 'fi' >> ${SCRIPT_FILE}
|
||||
|
||||
chmod +x ${SCRIPT_FILE}
|
||||
|
||||
user_name="$(${request} "$api_url/preferences$(if [ -n "$token" ]; then echo "?token=$token"; fi)" | grep -Po '"git.committer.name":.*?[^\\]",' | sed -e "s/\"git.committer.name\":\"//" | sed -e "s/\",//")"
|
||||
user_email="$(${request} "$api_url/preferences$(if [ -n "$token" ]; then echo "?token=$token"; fi)" | grep -Po '"git.committer.email":.*?[^\\]",' | sed -e "s/\"git.committer.email\":\"//" | sed -e "s/\",//")"
|
||||
git config --global user.name \""$user_name"\"
|
||||
git config --global user.email \""$user_email"\"
|
||||
|
||||
if [ -z "$(cat ~/.bashrc | grep GIT_SSH)" ]
|
||||
then
|
||||
printf '\n export GIT_SSH='"$SCRIPT_FILE" >> ~/.bashrc
|
||||
fi
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
<parent>
|
||||
<artifactId>che-agents-parent</artifactId>
|
||||
<groupId>org.eclipse.che</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>go-agents</artifactId>
|
||||
<name>Agent :: Golang agents</name>
|
||||
|
|
@ -26,7 +26,9 @@
|
|||
<groupId>com.mycila</groupId>
|
||||
<artifactId>license-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<includes>**/**</includes>
|
||||
<includes>
|
||||
<include>**/**</include>
|
||||
</includes>
|
||||
<excludes>
|
||||
<exclude>docs/**</exclude>
|
||||
<exclude>terminal-agent/term/server.go</exclude>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<parent>
|
||||
<artifactId>che-agents-parent</artifactId>
|
||||
<groupId>org.eclipse.che</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>ls-csharp-agent</artifactId>
|
||||
<name>Language Server C# Agent</name>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<parent>
|
||||
<artifactId>che-agents-parent</artifactId>
|
||||
<groupId>org.eclipse.che</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>ls-json-agent</artifactId>
|
||||
<name>Language Server Json Agent</name>
|
||||
|
|
|
|||
|
|
@ -154,4 +154,4 @@ curl -s ${AGENT_BINARIES_URI} | tar xzf - -C ${LS_DIR}
|
|||
|
||||
touch ${LS_LAUNCHER}
|
||||
chmod +x ${LS_LAUNCHER}
|
||||
echo "nodejs ${LS_DIR}/vscode-json-server/server.js" > ${LS_LAUNCHER}
|
||||
echo "nodejs ${LS_DIR}/vscode-json-server/out/jsonServerMain.js --stdio" > ${LS_LAUNCHER}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<parent>
|
||||
<artifactId>che-agents-parent</artifactId>
|
||||
<groupId>org.eclipse.che</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>ls-php-agent</artifactId>
|
||||
<name>Language Server PHP Agent</name>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<parent>
|
||||
<artifactId>che-agents-parent</artifactId>
|
||||
<groupId>org.eclipse.che</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>ls-python-agent</artifactId>
|
||||
<name>Language Server python Agent</name>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<parent>
|
||||
<artifactId>che-agents-parent</artifactId>
|
||||
<groupId>org.eclipse.che</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>ls-typescript-agent</artifactId>
|
||||
<name>Language Server typescript Agent</name>
|
||||
|
|
|
|||
|
|
@ -16,11 +16,11 @@
|
|||
<parent>
|
||||
<artifactId>che-parent</artifactId>
|
||||
<groupId>org.eclipse.che</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
<artifactId>che-agents-parent</artifactId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
<name>Che Agents Parent</name>
|
||||
<modules>
|
||||
|
|
@ -32,6 +32,7 @@
|
|||
<module>che-core-api-agent-shared</module>
|
||||
<module>che-core-api-agent</module>
|
||||
<module>ls-json</module>
|
||||
<module>git-credentials</module>
|
||||
<module>ls-php</module>
|
||||
<module>ls-python</module>
|
||||
<module>ls-typescript</module>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<parent>
|
||||
<artifactId>che-agents-parent</artifactId>
|
||||
<groupId>org.eclipse.che</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>ssh-agent</artifactId>
|
||||
<name>SSH Agent</name>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<parent>
|
||||
<artifactId>che-agents-parent</artifactId>
|
||||
<groupId>org.eclipse.che</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>terminal-agent</artifactId>
|
||||
<name>Agent :: Terminal</name>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<parent>
|
||||
<artifactId>che-agents-parent</artifactId>
|
||||
<groupId>org.eclipse.che</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>unison-agent</artifactId>
|
||||
<name>Unison Agent</name>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<parent>
|
||||
<artifactId>che-assembly-parent</artifactId>
|
||||
<groupId>org.eclipse.che</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>assembly-ide-war</artifactId>
|
||||
<packaging>war</packaging>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<parent>
|
||||
<artifactId>che-assembly-parent</artifactId>
|
||||
<groupId>org.eclipse.che</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>assembly-main</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<parent>
|
||||
<artifactId>che-assembly-parent</artifactId>
|
||||
<groupId>org.eclipse.che</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>assembly-wsagent-server</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<parent>
|
||||
<artifactId>che-assembly-parent</artifactId>
|
||||
<groupId>org.eclipse.che</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>assembly-wsagent-war</artifactId>
|
||||
<packaging>war</packaging>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<parent>
|
||||
<artifactId>che-assembly-parent</artifactId>
|
||||
<groupId>org.eclipse.che</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>assembly-wsmaster-war</artifactId>
|
||||
<packaging>war</packaging>
|
||||
|
|
@ -66,6 +66,10 @@
|
|||
<groupId>org.eclipse.che</groupId>
|
||||
<artifactId>exec-agent</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.che</groupId>
|
||||
<artifactId>git-credentials-agent</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.che</groupId>
|
||||
<artifactId>infrastructure-docker</artifactId>
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import com.google.inject.AbstractModule;
|
|||
import com.google.inject.multibindings.Multibinder;
|
||||
import com.google.inject.name.Names;
|
||||
|
||||
import org.eclipse.che.api.agent.GitCredentialsAgent;
|
||||
import org.eclipse.che.api.agent.LSCSharpAgent;
|
||||
import org.eclipse.che.api.agent.LSJsonAgent;
|
||||
import org.eclipse.che.api.agent.LSPhpAgent;
|
||||
|
|
@ -164,6 +165,7 @@ public class WsMasterModule extends AbstractModule {
|
|||
agents.addBinding().to(LSJsonAgent.class);
|
||||
agents.addBinding().to(LSCSharpAgent.class);
|
||||
agents.addBinding().to(LSTypeScriptAgent.class);
|
||||
agents.addBinding().to(GitCredentialsAgent.class);
|
||||
|
||||
Multibinder<AgentLauncher> launchers = Multibinder.newSetBinder(binder(), AgentLauncher.class);
|
||||
// FIXME: spi
|
||||
|
|
|
|||
|
|
@ -16,12 +16,12 @@
|
|||
<parent>
|
||||
<artifactId>che-parent</artifactId>
|
||||
<groupId>org.eclipse.che</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
<groupId>org.eclipse.che</groupId>
|
||||
<artifactId>che-assembly-parent</artifactId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
<name>Che IDE :: Parent</name>
|
||||
<modules>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<parent>
|
||||
<artifactId>che-core-parent</artifactId>
|
||||
<groupId>org.eclipse.che.core</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>che-core-api-core</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.che.api.core.jsonrpc.commons;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
|
|
@ -27,13 +28,32 @@ import static com.google.common.base.Preconditions.checkState;
|
|||
public class JsonRpcPromise<R> {
|
||||
private BiConsumer<String, R> successConsumer;
|
||||
private BiConsumer<String, JsonRpcError> failureConsumer;
|
||||
private Runnable timeoutRunnable;
|
||||
|
||||
BiConsumer<String, R> getSuccessConsumer() {
|
||||
return successConsumer;
|
||||
Optional<BiConsumer<String, R>> getSuccessConsumer() {
|
||||
return Optional.ofNullable(successConsumer);
|
||||
}
|
||||
|
||||
BiConsumer<String, JsonRpcError> getFailureConsumer() {
|
||||
return failureConsumer;
|
||||
Optional<BiConsumer<String, JsonRpcError>> getFailureConsumer() {
|
||||
return Optional.ofNullable(failureConsumer);
|
||||
}
|
||||
|
||||
Optional<Runnable> getTimeoutRunnable() {
|
||||
return Optional.ofNullable(timeoutRunnable);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set timeout runnable to be called on this promise timeout.
|
||||
*
|
||||
* @param runnable
|
||||
* timeout runnable
|
||||
* @return the instance of this very promise
|
||||
*/
|
||||
public JsonRpcPromise<R> onTimeout(Runnable runnable) {
|
||||
checkNotNull(runnable, "JSON RPC timeout runnable argument must not be null");
|
||||
checkState(this.timeoutRunnable == null, "JSON RPC timeout runnable field must not be set");
|
||||
this.timeoutRunnable = runnable;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -14,11 +14,10 @@ import org.slf4j.Logger;
|
|||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
|
@ -31,17 +30,19 @@ import static org.slf4j.LoggerFactory.getLogger;
|
|||
public class ResponseDispatcher {
|
||||
private final static Logger LOGGER = getLogger(ResponseDispatcher.class);
|
||||
|
||||
private final JsonRpcComposer composer;
|
||||
private final JsonRpcComposer composer;
|
||||
private final TimeoutActionRunner timeoutActionRunner;
|
||||
|
||||
private final Map<String, JsonRpcPromise> promises = new ConcurrentHashMap<>();
|
||||
private final Map<String, Class<?>> rClasses = new ConcurrentHashMap<>();
|
||||
private final Map<String, SingleTypedPromise<?>> singleTypedPromises = new ConcurrentHashMap<>();
|
||||
private final Map<String, ListTypedPromise<?>> listTypedPromises = new ConcurrentHashMap<>();
|
||||
|
||||
@Inject
|
||||
public ResponseDispatcher(JsonRpcComposer composer) {
|
||||
public ResponseDispatcher(JsonRpcComposer composer, TimeoutActionRunner timeoutActionRunner) {
|
||||
this.composer = composer;
|
||||
this.timeoutActionRunner = timeoutActionRunner;
|
||||
}
|
||||
|
||||
private static void checkArguments(String endpointId, String requestId, Class<?> rClass, JsonRpcPromise success) {
|
||||
private static void checkArguments(String endpointId, String requestId, Class<?> rClass) {
|
||||
checkNotNull(endpointId, "Endpoint ID must not be null");
|
||||
checkArgument(!endpointId.isEmpty(), "Endpoint ID must not be empty");
|
||||
|
||||
|
|
@ -49,103 +50,105 @@ public class ResponseDispatcher {
|
|||
checkArgument(!requestId.isEmpty(), "Request ID must not be empty");
|
||||
|
||||
checkNotNull(rClass, "Result class must not be null");
|
||||
|
||||
checkNotNull(success, "Json rpc promise must not be null");
|
||||
}
|
||||
|
||||
private static String combine(String endpointId, String requestId) {
|
||||
private static String generateKey(String endpointId, String requestId) {
|
||||
return endpointId + '@' + requestId;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private static <T> T cast(Object object) {
|
||||
return (T)object;
|
||||
}
|
||||
|
||||
private <R> void processOne(String endpointId, JsonRpcResult jsonRpcResult, Class<R> resultClass, BiConsumer<String, R> consumer) {
|
||||
LOGGER.debug("Result is a single object - processing single object...");
|
||||
|
||||
R result = composer.composeOne(jsonRpcResult, resultClass);
|
||||
consumer.accept(endpointId, result);
|
||||
}
|
||||
|
||||
private <R> void processMany(String endpointId, JsonRpcResult jsonRpcResult, Class<R> resultClass, BiConsumer<String, List> consumer) {
|
||||
LOGGER.debug("Result is an array - processing array...");
|
||||
|
||||
List<R> result = composer.composeMany(jsonRpcResult, resultClass);
|
||||
consumer.accept(endpointId, result);
|
||||
}
|
||||
|
||||
public void dispatch(String endpointId, JsonRpcResponse response) {
|
||||
checkNotNull(endpointId, "Endpoint ID name must not be null");
|
||||
checkArgument(!endpointId.isEmpty(), "Endpoint ID name must not be empty");
|
||||
checkNotNull(response, "Response name must not be null");
|
||||
|
||||
LOGGER.debug("Dispatching a response: " + response + ", from endpoint: " + endpointId);
|
||||
|
||||
String responseId = response.getId();
|
||||
if (responseId == null) {
|
||||
LOGGER.debug("Response ID is not defined, skipping...");
|
||||
return;
|
||||
}
|
||||
LOGGER.debug("Fetching response ID: " + responseId);
|
||||
|
||||
String key = combine(endpointId, responseId);
|
||||
LOGGER.debug("Generating key: " + key);
|
||||
|
||||
Class<?> rClass = rClasses.remove(key);
|
||||
LOGGER.debug("Fetching result class:" + rClass);
|
||||
String key = generateKey(endpointId, responseId);
|
||||
|
||||
if (response.hasResult()) {
|
||||
processResult(endpointId, response, key, rClass);
|
||||
dispatchResult(endpointId, response, key);
|
||||
} else if (response.hasError()) {
|
||||
processError(endpointId, response, key);
|
||||
dispatchError(endpointId, response, key);
|
||||
} else {
|
||||
LOGGER.error("Received incorrect response: no error, no result");
|
||||
}
|
||||
}
|
||||
|
||||
private void processError(String endpointId, JsonRpcResponse response, String key) {
|
||||
LOGGER.debug("Response has error. Proceeding...");
|
||||
public synchronized <R> JsonRpcPromise<R> registerPromiseForSingleObject(String endpointId, String requestId, Class<R> rClass,
|
||||
int timeoutInMillis) {
|
||||
checkArguments(endpointId, requestId, rClass);
|
||||
|
||||
JsonRpcError error = response.getError();
|
||||
JsonRpcPromise<JsonRpcError> jsonRpcPromise = cast(promises.remove(key));
|
||||
BiConsumer<String, JsonRpcError> consumer = jsonRpcPromise.getFailureConsumer();
|
||||
if (consumer != null) {
|
||||
LOGGER.debug("Failure consumer is found, accepting...");
|
||||
consumer.accept(endpointId, error);
|
||||
} else {
|
||||
LOGGER.debug("Reject function is not found, skipping");
|
||||
SingleTypedPromise<R> promise = new SingleTypedPromise<>(rClass);
|
||||
String key = generateKey(endpointId, requestId);
|
||||
singleTypedPromises.put(key, promise);
|
||||
if (timeoutInMillis > 0) {
|
||||
timeoutActionRunner.schedule(timeoutInMillis, () -> runTimeoutConsumer(singleTypedPromises.remove(key)));
|
||||
}
|
||||
}
|
||||
|
||||
private void processResult(String endpointId, JsonRpcResponse response, String key, Class<?> rClass) {
|
||||
LOGGER.debug("Response has result. Proceeding...");
|
||||
|
||||
JsonRpcResult result = response.getResult();
|
||||
if (result.isSingle()) {
|
||||
processOne(endpointId, result, rClass, cast(promises.remove(key).getSuccessConsumer()));
|
||||
} else {
|
||||
processMany(endpointId, result, rClass, cast(promises.remove(key).getSuccessConsumer()));
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized <R> JsonRpcPromise<R> registerPromiseOfOne(String endpointId, String requestId, Class<R> rClass) {
|
||||
return cast(registerInternal(endpointId, requestId, rClass, new JsonRpcPromise<R>()));
|
||||
}
|
||||
|
||||
public synchronized <R> JsonRpcPromise<List<R>> registerPromiseOfMany(String endpointId, String requestId, Class<R> rClass) {
|
||||
return cast(registerInternal(endpointId, requestId, rClass, new JsonRpcPromise<List<R>>()));
|
||||
}
|
||||
|
||||
private <R> JsonRpcPromise registerInternal(String endpointId, String requestId, Class<R> rClass, JsonRpcPromise promise) {
|
||||
checkArguments(endpointId, requestId, rClass, promise);
|
||||
|
||||
String key = combine(endpointId, requestId);
|
||||
|
||||
promises.put(key, promise);
|
||||
rClasses.put(key, rClass);
|
||||
|
||||
return promise;
|
||||
}
|
||||
|
||||
public synchronized <R> JsonRpcPromise<List<R>> registerPromiseForListOfObjects(String endpointId, String requestId, Class<R> rClass,
|
||||
int timeoutInMillis) {
|
||||
checkArguments(endpointId, requestId, rClass);
|
||||
|
||||
ListTypedPromise<R> promise = new ListTypedPromise<>(rClass);
|
||||
String key = generateKey(endpointId, requestId);
|
||||
listTypedPromises.put(key, promise);
|
||||
if (timeoutInMillis > 0) {
|
||||
timeoutActionRunner.schedule(timeoutInMillis, () -> runTimeoutConsumer(listTypedPromises.remove(key)));
|
||||
}
|
||||
return promise;
|
||||
}
|
||||
|
||||
private void runTimeoutConsumer(JsonRpcPromise<?> promise) {
|
||||
Optional.ofNullable(promise)
|
||||
.flatMap(JsonRpcPromise::getTimeoutRunnable)
|
||||
.ifPresent(Runnable::run);
|
||||
}
|
||||
|
||||
private void dispatchResult(String endpointId, JsonRpcResponse response, String key) {
|
||||
Optional.ofNullable(listTypedPromises.remove(key)).ifPresent(
|
||||
promise -> promise.getSuccessConsumer().ifPresent(
|
||||
consumer -> promise.getType().ifPresent(
|
||||
type -> consumer.accept(endpointId, composer.composeMany(response.getResult(), type)))));
|
||||
|
||||
Optional.ofNullable(singleTypedPromises.remove(key)).ifPresent(
|
||||
promise -> promise.getSuccessConsumer().ifPresent(
|
||||
consumer -> promise.getType().ifPresent(
|
||||
type -> consumer.accept(endpointId, composer.composeOne(response.getResult(), type)))));
|
||||
}
|
||||
|
||||
private void dispatchError(String endpointId, JsonRpcResponse response, String key) {
|
||||
SingleTypedPromise<?> singlePromise = singleTypedPromises.remove(key);
|
||||
ListTypedPromise<?> listPromise = listTypedPromises.remove(key);
|
||||
JsonRpcPromise<?> promise = singlePromise != null ? singlePromise : listPromise;
|
||||
promise.getFailureConsumer().ifPresent(it -> it.accept(endpointId, response.getError()));
|
||||
}
|
||||
|
||||
private class ListTypedPromise<R> extends JsonRpcPromise<List<R>> {
|
||||
private final Class<R> type;
|
||||
|
||||
private ListTypedPromise(Class<R> type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
private Optional<Class<R>> getType() {
|
||||
return Optional.ofNullable(type);
|
||||
}
|
||||
}
|
||||
|
||||
private class SingleTypedPromise<R> extends JsonRpcPromise<R> {
|
||||
private final Class<R> type;
|
||||
|
||||
private SingleTypedPromise(Class<R> type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public Optional<Class<R>> getType() {
|
||||
return Optional.ofNullable(type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2012-2017 Codenvy, S.A.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Codenvy, S.A. - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.che.api.core.jsonrpc.commons;
|
||||
|
||||
/**
|
||||
* Executes operation on timeout
|
||||
*/
|
||||
public interface TimeoutActionRunner {
|
||||
void schedule(int timeoutInMillis, Runnable runnable);
|
||||
}
|
||||
|
|
@ -10,7 +10,6 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.che.api.core.jsonrpc.commons.transmission;
|
||||
|
||||
import org.eclipse.che.api.core.jsonrpc.commons.JsonRpcErrorTransmitter;
|
||||
import org.eclipse.che.api.core.jsonrpc.commons.JsonRpcMarshaller;
|
||||
import org.eclipse.che.api.core.jsonrpc.commons.JsonRpcParams;
|
||||
import org.eclipse.che.api.core.jsonrpc.commons.JsonRpcPromise;
|
||||
|
|
@ -65,7 +64,11 @@ public class SendConfiguratorFromMany<P> {
|
|||
transmitNotification();
|
||||
}
|
||||
|
||||
public <R> JsonRpcPromise<R> sendAndReceiveResultAsDto(final Class<R> rClass) {
|
||||
public <R> JsonRpcPromise<R> sendAndReceiveResultAsDto(Class<R> rClass) {
|
||||
return sendAndReceiveResultAsDto(rClass, 0);
|
||||
}
|
||||
|
||||
public <R> JsonRpcPromise<R> sendAndReceiveResultAsDto(Class<R> rClass, int timeoutInMillis) {
|
||||
checkNotNull(rClass, "Result class value must not be null");
|
||||
|
||||
final String requestId = transmitRequest();
|
||||
|
|
@ -78,10 +81,14 @@ public class SendConfiguratorFromMany<P> {
|
|||
"params list value" + pListValue + ", " +
|
||||
"result object class: " + rClass);
|
||||
|
||||
return dispatcher.registerPromiseOfOne(endpointId, requestId, rClass);
|
||||
return dispatcher.registerPromiseForSingleObject(endpointId, requestId, rClass, timeoutInMillis);
|
||||
}
|
||||
|
||||
public JsonRpcPromise<String> sendAndReceiveResultAsString() {
|
||||
return sendAndReceiveResultAsString(0);
|
||||
}
|
||||
|
||||
public JsonRpcPromise<String> sendAndReceiveResultAsString(int timeoutInMillis) {
|
||||
final String requestId = transmitRequest();
|
||||
|
||||
LOGGER.debug("Transmitting request: " +
|
||||
|
|
@ -92,10 +99,14 @@ public class SendConfiguratorFromMany<P> {
|
|||
"params list value" + pListValue + ", " +
|
||||
"result object class: " + String.class);
|
||||
|
||||
return dispatcher.registerPromiseOfOne(endpointId, requestId, String.class);
|
||||
return dispatcher.registerPromiseForSingleObject(endpointId, requestId, String.class, timeoutInMillis);
|
||||
}
|
||||
|
||||
public JsonRpcPromise<Boolean> sendAndReceiveResultAsBoolean() {
|
||||
return sendAndReceiveResultAsBoolean(0);
|
||||
}
|
||||
|
||||
public JsonRpcPromise<Boolean> sendAndReceiveResultAsBoolean(int timeoutInMillis) {
|
||||
final String requestId = transmitRequest();
|
||||
|
||||
LOGGER.debug("Transmitting request: " +
|
||||
|
|
@ -106,10 +117,14 @@ public class SendConfiguratorFromMany<P> {
|
|||
"params list value" + pListValue + ", " +
|
||||
"result object class: " + Boolean.class);
|
||||
|
||||
return dispatcher.registerPromiseOfOne(endpointId, requestId, Boolean.class);
|
||||
return dispatcher.registerPromiseForSingleObject(endpointId, requestId, Boolean.class, timeoutInMillis);
|
||||
}
|
||||
|
||||
public <R> JsonRpcPromise<List<R>> sendAndReceiveResultAsListOfDto(Class<R> rClass) {
|
||||
return sendAndReceiveResultAsListOfDto(rClass, 0);
|
||||
}
|
||||
|
||||
public <R> JsonRpcPromise<List<R>> sendAndReceiveResultAsListOfDto(Class<R> rClass, int timeoutInMillis) {
|
||||
checkNotNull(rClass, "Result class value must not be null");
|
||||
|
||||
final String requestId = transmitRequest();
|
||||
|
|
@ -122,11 +137,14 @@ public class SendConfiguratorFromMany<P> {
|
|||
"params list value" + pListValue + ", " +
|
||||
"result list items class: " + rClass);
|
||||
|
||||
return dispatcher.registerPromiseOfMany(endpointId, requestId, rClass);
|
||||
|
||||
return dispatcher.registerPromiseForListOfObjects(endpointId, requestId, rClass, timeoutInMillis);
|
||||
}
|
||||
|
||||
public JsonRpcPromise<List<String>> sendAndReceiveResultAsListOfString() {
|
||||
return sendAndReceiveResultAsListOfString(0);
|
||||
}
|
||||
|
||||
public JsonRpcPromise<List<String>> sendAndReceiveResultAsListOfString(int timeoutInMillis) {
|
||||
final String requestId = transmitRequest();
|
||||
|
||||
LOGGER.debug("Transmitting request: " +
|
||||
|
|
@ -137,10 +155,14 @@ public class SendConfiguratorFromMany<P> {
|
|||
"params list value" + pListValue + ", " +
|
||||
"result list items class: " + String.class);
|
||||
|
||||
return dispatcher.registerPromiseOfMany(endpointId, requestId, String.class);
|
||||
return dispatcher.registerPromiseForListOfObjects(endpointId, requestId, String.class, timeoutInMillis);
|
||||
}
|
||||
|
||||
public JsonRpcPromise<List<Boolean>> sendAndReceiveResultAsListOfBoolean() {
|
||||
return sendAndReceiveResultAsListOfBoolean(0);
|
||||
}
|
||||
|
||||
public JsonRpcPromise<List<Boolean>> sendAndReceiveResultAsListOfBoolean(int timeoutInMillis) {
|
||||
final String requestId = transmitRequest();
|
||||
|
||||
LOGGER.debug("Transmitting request: " +
|
||||
|
|
@ -151,10 +173,14 @@ public class SendConfiguratorFromMany<P> {
|
|||
"params list value" + pListValue + ", " +
|
||||
"result list items class: " + Boolean.class);
|
||||
|
||||
return dispatcher.registerPromiseOfMany(endpointId, requestId, Boolean.class);
|
||||
return dispatcher.registerPromiseForListOfObjects(endpointId, requestId, Boolean.class, timeoutInMillis);
|
||||
}
|
||||
|
||||
public JsonRpcPromise<Void> sendAndReceiveResultAsEmpty() {
|
||||
return sendAndReceiveResultAsEmpty(0);
|
||||
}
|
||||
|
||||
public JsonRpcPromise<Void> sendAndReceiveResultAsEmpty(int timeoutInMillis) {
|
||||
final String requestId = transmitRequest();
|
||||
|
||||
LOGGER.debug("Transmitting request: " +
|
||||
|
|
@ -165,7 +191,7 @@ public class SendConfiguratorFromMany<P> {
|
|||
"params list value" + pListValue + ", " +
|
||||
"result object class: " + Void.class);
|
||||
|
||||
return dispatcher.registerPromiseOfOne(endpointId, requestId, Void.class);
|
||||
return dispatcher.registerPromiseForSingleObject(endpointId, requestId, Void.class, timeoutInMillis);
|
||||
}
|
||||
|
||||
private void transmitNotification() {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.che.api.core.jsonrpc.commons.transmission;
|
||||
|
||||
import org.eclipse.che.api.core.jsonrpc.commons.JsonRpcErrorTransmitter;
|
||||
import org.eclipse.che.api.core.jsonrpc.commons.JsonRpcMarshaller;
|
||||
import org.eclipse.che.api.core.jsonrpc.commons.JsonRpcPromise;
|
||||
import org.eclipse.che.api.core.jsonrpc.commons.JsonRpcRequest;
|
||||
|
|
@ -58,6 +57,10 @@ public class SendConfiguratorFromNone {
|
|||
}
|
||||
|
||||
public <R> JsonRpcPromise<R> sendAndReceiveResultAsDto(final Class<R> rClass) {
|
||||
return sendAndReceiveResultAsDto(rClass, 0);
|
||||
}
|
||||
|
||||
public <R> JsonRpcPromise<R> sendAndReceiveResultAsDto(final Class<R> rClass, int timeInMillis) {
|
||||
checkNotNull(rClass, "Result class value must not be null");
|
||||
|
||||
final String requestId = transmitRequest();
|
||||
|
|
@ -68,11 +71,14 @@ public class SendConfiguratorFromNone {
|
|||
"method: " + method + ", " +
|
||||
"result object class: " + rClass);
|
||||
|
||||
return dispatcher.registerPromiseOfOne(endpointId, requestId, rClass);
|
||||
return dispatcher.registerPromiseForSingleObject(endpointId, requestId, rClass, timeInMillis);
|
||||
}
|
||||
|
||||
|
||||
public JsonRpcPromise<String> sendAndReceiveResultAsString() {
|
||||
return sendAndReceiveResultAsString(0);
|
||||
}
|
||||
|
||||
public JsonRpcPromise<String> sendAndReceiveResultAsString(int timeInMillis) {
|
||||
final String requestId = transmitRequest();
|
||||
|
||||
LOGGER.debug("Transmitting request: " +
|
||||
|
|
@ -81,11 +87,14 @@ public class SendConfiguratorFromNone {
|
|||
"method: " + method + ", " +
|
||||
"result object class: " + String.class);
|
||||
|
||||
return dispatcher.registerPromiseOfOne(endpointId, requestId, String.class);
|
||||
|
||||
return dispatcher.registerPromiseForSingleObject(endpointId, requestId, String.class, timeInMillis);
|
||||
}
|
||||
|
||||
public JsonRpcPromise<Double> sendAndReceiveResultAsDouble() {
|
||||
return sendAndReceiveResultAsDouble(0);
|
||||
}
|
||||
|
||||
public JsonRpcPromise<Double> sendAndReceiveResultAsDouble(int timeInMillis) {
|
||||
final String requestId = transmitRequest();
|
||||
|
||||
LOGGER.debug("Transmitting request: " +
|
||||
|
|
@ -94,11 +103,14 @@ public class SendConfiguratorFromNone {
|
|||
"method: " + method + ", " +
|
||||
"result object class: " + Double.class);
|
||||
|
||||
return dispatcher.registerPromiseOfOne(endpointId, requestId, Double.class);
|
||||
|
||||
return dispatcher.registerPromiseForSingleObject(endpointId, requestId, Double.class, timeInMillis);
|
||||
}
|
||||
|
||||
public JsonRpcPromise<Boolean> sendAndReceiveResultAsBoolean() {
|
||||
return sendAndReceiveResultAsBoolean(0);
|
||||
}
|
||||
|
||||
public JsonRpcPromise<Boolean> sendAndReceiveResultAsBoolean(int timeInMillis) {
|
||||
final String requestId = transmitRequest();
|
||||
|
||||
LOGGER.debug("Transmitting request: " +
|
||||
|
|
@ -107,10 +119,14 @@ public class SendConfiguratorFromNone {
|
|||
"method: " + method + ", " +
|
||||
"result object class: " + Boolean.class);
|
||||
|
||||
return dispatcher.registerPromiseOfOne(endpointId, requestId, Boolean.class);
|
||||
return dispatcher.registerPromiseForSingleObject(endpointId, requestId, Boolean.class, timeInMillis);
|
||||
}
|
||||
|
||||
public <R> JsonRpcPromise<List<R>> sendAndReceiveResultAsListOfDto(final Class<R> rClass) {
|
||||
return sendAndReceiveResultAsListOfDto(rClass, 0);
|
||||
}
|
||||
|
||||
public <R> JsonRpcPromise<List<R>> sendAndReceiveResultAsListOfDto(final Class<R> rClass, int timeInMillis) {
|
||||
checkNotNull(rClass, "Result class value must not be null");
|
||||
|
||||
final String requestId = transmitRequest();
|
||||
|
|
@ -121,11 +137,14 @@ public class SendConfiguratorFromNone {
|
|||
"method: " + method + ", " +
|
||||
"result list items class: " + rClass);
|
||||
|
||||
return dispatcher.registerPromiseOfMany(endpointId, requestId, rClass);
|
||||
|
||||
return dispatcher.registerPromiseForListOfObjects(endpointId, requestId, rClass, timeInMillis);
|
||||
}
|
||||
|
||||
public JsonRpcPromise<List<String>> sendAndReceiveResultAsListOfString() {
|
||||
return sendAndReceiveResultAsListOfString(0);
|
||||
}
|
||||
|
||||
public JsonRpcPromise<List<String>> sendAndReceiveResultAsListOfString(int timeInMillis) {
|
||||
final String requestId = transmitRequest();
|
||||
|
||||
LOGGER.debug("Transmitting request: " +
|
||||
|
|
@ -134,10 +153,14 @@ public class SendConfiguratorFromNone {
|
|||
"method: " + method + ", " +
|
||||
"result list items class: " + String.class);
|
||||
|
||||
return dispatcher.registerPromiseOfMany(endpointId, requestId, String.class);
|
||||
return dispatcher.registerPromiseForListOfObjects(endpointId, requestId, String.class, timeInMillis);
|
||||
}
|
||||
|
||||
public JsonRpcPromise<List<Boolean>> sendAndReceiveResultAsListOfBoolean() {
|
||||
return sendAndReceiveResultAsListOfBoolean(0);
|
||||
}
|
||||
|
||||
public JsonRpcPromise<List<Boolean>> sendAndReceiveResultAsListOfBoolean(int timeInMillis) {
|
||||
final String requestId = transmitRequest();
|
||||
|
||||
LOGGER.debug("Transmitting request: " +
|
||||
|
|
@ -146,10 +169,14 @@ public class SendConfiguratorFromNone {
|
|||
"method: " + method + ", " +
|
||||
"result list items class: " + Boolean.class);
|
||||
|
||||
return dispatcher.registerPromiseOfMany(endpointId, requestId, Boolean.class);
|
||||
return dispatcher.registerPromiseForListOfObjects(endpointId, requestId, Boolean.class, timeInMillis);
|
||||
}
|
||||
|
||||
public JsonRpcPromise<Void> sendAndReceiveResultAsEmpty() {
|
||||
return sendAndReceiveResultAsEmpty(0);
|
||||
}
|
||||
|
||||
public JsonRpcPromise<Void> sendAndReceiveResultAsEmpty(int timeInMillis) {
|
||||
final String requestId = transmitRequest();
|
||||
|
||||
LOGGER.debug("Transmitting request: " +
|
||||
|
|
@ -158,7 +185,7 @@ public class SendConfiguratorFromNone {
|
|||
"method: " + method + ", " +
|
||||
"result list items class: " + Void.class);
|
||||
|
||||
return dispatcher.registerPromiseOfOne(endpointId, requestId, Void.class);
|
||||
return dispatcher.registerPromiseForSingleObject(endpointId, requestId, Void.class, timeInMillis);
|
||||
}
|
||||
|
||||
private void transmitNotification() {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.che.api.core.jsonrpc.commons.transmission;
|
||||
|
||||
import org.eclipse.che.api.core.jsonrpc.commons.JsonRpcErrorTransmitter;
|
||||
import org.eclipse.che.api.core.jsonrpc.commons.JsonRpcMarshaller;
|
||||
import org.eclipse.che.api.core.jsonrpc.commons.JsonRpcParams;
|
||||
import org.eclipse.che.api.core.jsonrpc.commons.JsonRpcPromise;
|
||||
|
|
@ -66,6 +65,10 @@ public class SendConfiguratorFromOne<P> {
|
|||
}
|
||||
|
||||
public <R> JsonRpcPromise<R> sendAndReceiveResultAsDto(final Class<R> rClass) {
|
||||
return sendAndReceiveResultAsDto(rClass, 0);
|
||||
}
|
||||
|
||||
public <R> JsonRpcPromise<R> sendAndReceiveResultAsDto(final Class<R> rClass, int timeoutInMillis) {
|
||||
checkNotNull(rClass, "Result class value must not be null");
|
||||
|
||||
final String requestId = transmitRequest();
|
||||
|
|
@ -78,11 +81,14 @@ public class SendConfiguratorFromOne<P> {
|
|||
"params list value" + pValue + ", " +
|
||||
"result object class: " + rClass);
|
||||
|
||||
return dispatcher.registerPromiseOfOne(endpointId, requestId, rClass);
|
||||
return dispatcher.registerPromiseForSingleObject(endpointId, requestId, rClass, timeoutInMillis);
|
||||
}
|
||||
|
||||
|
||||
public JsonRpcPromise<String> sendAndReceiveResultAsString() {
|
||||
return sendAndReceiveResultAsString(0);
|
||||
}
|
||||
|
||||
public JsonRpcPromise<String> sendAndReceiveResultAsString(int timeoutInMillis) {
|
||||
final String requestId = transmitRequest();
|
||||
|
||||
LOGGER.debug("Transmitting request: " +
|
||||
|
|
@ -93,11 +99,14 @@ public class SendConfiguratorFromOne<P> {
|
|||
"params list value" + pValue + ", " +
|
||||
"result object class: " + String.class);
|
||||
|
||||
return dispatcher.registerPromiseOfOne(endpointId, requestId, String.class);
|
||||
|
||||
return dispatcher.registerPromiseForSingleObject(endpointId, requestId, String.class, timeoutInMillis);
|
||||
}
|
||||
|
||||
public JsonRpcPromise<Double> sendAndReceiveResultAsDouble() {
|
||||
return sendAndReceiveResultAsDouble(0);
|
||||
}
|
||||
|
||||
public JsonRpcPromise<Double> sendAndReceiveResultAsDouble(int timeoutInMillis) {
|
||||
final String requestId = transmitRequest();
|
||||
|
||||
LOGGER.debug("Transmitting request: " +
|
||||
|
|
@ -108,11 +117,14 @@ public class SendConfiguratorFromOne<P> {
|
|||
"params list value" + pValue + ", " +
|
||||
"result object class: " + Double.class);
|
||||
|
||||
return dispatcher.registerPromiseOfOne(endpointId, requestId, Double.class);
|
||||
|
||||
return dispatcher.registerPromiseForSingleObject(endpointId, requestId, Double.class, timeoutInMillis);
|
||||
}
|
||||
|
||||
public JsonRpcPromise<Boolean> sendAndReceiveResultAsBoolean() {
|
||||
return sendAndReceiveResultAsBoolean(0);
|
||||
}
|
||||
|
||||
public JsonRpcPromise<Boolean> sendAndReceiveResultAsBoolean(int timeoutInMillis) {
|
||||
final String requestId = transmitRequest();
|
||||
|
||||
LOGGER.debug("Transmitting request: " +
|
||||
|
|
@ -123,10 +135,14 @@ public class SendConfiguratorFromOne<P> {
|
|||
"params list value" + pValue + ", " +
|
||||
"result object class: " + Boolean.class);
|
||||
|
||||
return dispatcher.registerPromiseOfOne(endpointId, requestId, Boolean.class);
|
||||
return dispatcher.registerPromiseForSingleObject(endpointId, requestId, Boolean.class, timeoutInMillis);
|
||||
}
|
||||
|
||||
public <R> JsonRpcPromise<List<R>> sendAndReceiveResultAsListOfDto(final Class<R> rClass) {
|
||||
public <R> JsonRpcPromise<List<R>> sendAndReceiveResultAsListOfDto(Class<R> rClass) {
|
||||
return sendAndReceiveResultAsListOfDto(rClass, 0);
|
||||
}
|
||||
|
||||
public <R> JsonRpcPromise<List<R>> sendAndReceiveResultAsListOfDto(Class<R> rClass, int timeoutInMillis) {
|
||||
checkNotNull(rClass, "Result class value must not be null");
|
||||
|
||||
final String requestId = transmitRequest();
|
||||
|
|
@ -139,11 +155,14 @@ public class SendConfiguratorFromOne<P> {
|
|||
"params list value" + pValue + ", " +
|
||||
"result list items class: " + rClass);
|
||||
|
||||
return dispatcher.registerPromiseOfMany(endpointId, requestId, rClass);
|
||||
|
||||
return dispatcher.registerPromiseForListOfObjects(endpointId, requestId, rClass, timeoutInMillis);
|
||||
}
|
||||
|
||||
public JsonRpcPromise<List<String>> sendAndReceiveResultAsListOfString() {
|
||||
return sendAndReceiveResultAsListOfString(0);
|
||||
}
|
||||
|
||||
public JsonRpcPromise<List<String>> sendAndReceiveResultAsListOfString(int timeoutInMillis) {
|
||||
final String requestId = transmitRequest();
|
||||
|
||||
LOGGER.debug("Transmitting request: " +
|
||||
|
|
@ -154,10 +173,14 @@ public class SendConfiguratorFromOne<P> {
|
|||
"params list value" + pValue + ", " +
|
||||
"result list items class: " + String.class);
|
||||
|
||||
return dispatcher.registerPromiseOfMany(endpointId, requestId, String.class);
|
||||
return dispatcher.registerPromiseForListOfObjects(endpointId, requestId, String.class, timeoutInMillis);
|
||||
}
|
||||
|
||||
public JsonRpcPromise<List<Boolean>> sendAndReceiveResultAsListOfBoolean() {
|
||||
return sendAndReceiveResultAsListOfBoolean(0);
|
||||
}
|
||||
|
||||
public JsonRpcPromise<List<Boolean>> sendAndReceiveResultAsListOfBoolean(int timeoutInMillis) {
|
||||
final String requestId = transmitRequest();
|
||||
|
||||
LOGGER.debug("Transmitting request: " +
|
||||
|
|
@ -168,10 +191,14 @@ public class SendConfiguratorFromOne<P> {
|
|||
"params list value" + pValue + ", " +
|
||||
"result list items class: " + Boolean.class);
|
||||
|
||||
return dispatcher.registerPromiseOfMany(endpointId, requestId, Boolean.class);
|
||||
return dispatcher.registerPromiseForListOfObjects(endpointId, requestId, Boolean.class, timeoutInMillis);
|
||||
}
|
||||
|
||||
public JsonRpcPromise<Void> sendAndReceiveResultAsEmpty() {
|
||||
return sendAndReceiveResultAsEmpty(0);
|
||||
}
|
||||
|
||||
public JsonRpcPromise<Void> sendAndReceiveResultAsEmpty(int timeoutInMillis) {
|
||||
final String requestId = transmitRequest();
|
||||
|
||||
LOGGER.debug("Transmitting request: " +
|
||||
|
|
@ -182,7 +209,7 @@ public class SendConfiguratorFromOne<P> {
|
|||
"params list value" + pValue + ", " +
|
||||
"result list items class: " + Void.class);
|
||||
|
||||
return dispatcher.registerPromiseOfOne(endpointId, requestId, Void.class);
|
||||
return dispatcher.registerPromiseForSingleObject(endpointId, requestId, Void.class, timeoutInMillis);
|
||||
}
|
||||
|
||||
private void transmitNotification() {
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import org.eclipse.che.api.core.jsonrpc.commons.JsonRpcMarshaller;
|
|||
import org.eclipse.che.api.core.jsonrpc.commons.JsonRpcQualifier;
|
||||
import org.eclipse.che.api.core.jsonrpc.commons.JsonRpcUnmarshaller;
|
||||
import org.eclipse.che.api.core.jsonrpc.commons.RequestHandlerConfigurator;
|
||||
import org.eclipse.che.api.core.jsonrpc.commons.TimeoutActionRunner;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
|
|
@ -37,6 +38,7 @@ public class JsonRpcModule extends AbstractModule {
|
|||
bind(JsonRpcComposer.class).to(GsonJsonRpcComposer.class);
|
||||
|
||||
bind(RequestProcessor.class).to(ServerSideRequestProcessor.class);
|
||||
bind(TimeoutActionRunner.class).to(ServerSideTimeoutActionRunner.class);
|
||||
}
|
||||
|
||||
@Provides
|
||||
|
|
|
|||
|
|
@ -0,0 +1,32 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2012-2017 Codenvy, S.A.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Codenvy, S.A. - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.che.api.core.jsonrpc.impl;
|
||||
|
||||
import com.google.inject.Singleton;
|
||||
|
||||
import org.eclipse.che.api.core.jsonrpc.commons.TimeoutActionRunner;
|
||||
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
@Singleton
|
||||
public class ServerSideTimeoutActionRunner implements TimeoutActionRunner {
|
||||
|
||||
@Override
|
||||
public void schedule(int timeoutInMillis, Runnable runnable) {
|
||||
new Timer().schedule(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
runnable.run();
|
||||
}
|
||||
}, timeoutInMillis);
|
||||
}
|
||||
}
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
<parent>
|
||||
<artifactId>che-core-parent</artifactId>
|
||||
<groupId>org.eclipse.che.core</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>che-core-api-dto-maven-plugin</artifactId>
|
||||
<packaging>maven-plugin</packaging>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<parent>
|
||||
<artifactId>che-core-parent</artifactId>
|
||||
<groupId>org.eclipse.che.core</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>che-core-api-dto</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<parent>
|
||||
<artifactId>che-core-parent</artifactId>
|
||||
<groupId>org.eclipse.che.core</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>che-core-api-model</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<parent>
|
||||
<artifactId>che-core-parent</artifactId>
|
||||
<groupId>org.eclipse.che.core</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>che-core-db-vendor-h2</artifactId>
|
||||
<name>Che Core :: DB :: Vendor H2</name>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<parent>
|
||||
<artifactId>che-core-parent</artifactId>
|
||||
<groupId>org.eclipse.che.core</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>che-core-db-vendor-postgresql</artifactId>
|
||||
<name>Che Core :: DB :: Vendor PostgreSQL</name>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<parent>
|
||||
<artifactId>che-core-parent</artifactId>
|
||||
<groupId>org.eclipse.che.core</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>che-core-db</artifactId>
|
||||
<name>Che Core :: DB</name>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<parent>
|
||||
<artifactId>che-core-parent</artifactId>
|
||||
<groupId>org.eclipse.che.core</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<groupId>org.eclipse.che.core</groupId>
|
||||
<artifactId>che-core-typescript-dto-maven-plugin</artifactId>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<parent>
|
||||
<artifactId>che-core-commons-parent</artifactId>
|
||||
<groupId>org.eclipse.che.core</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>che-core-commons-annotations</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<parent>
|
||||
<artifactId>che-core-commons-parent</artifactId>
|
||||
<groupId>org.eclipse.che.core</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>che-core-commons-inject</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<parent>
|
||||
<artifactId>che-core-commons-parent</artifactId>
|
||||
<groupId>org.eclipse.che.core</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>che-core-commons-j2ee</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<parent>
|
||||
<artifactId>che-core-commons-parent</artifactId>
|
||||
<groupId>org.eclipse.che.core</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>che-core-commons-json</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<parent>
|
||||
<artifactId>che-core-commons-parent</artifactId>
|
||||
<groupId>org.eclipse.che.core</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>che-core-commons-lang</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<parent>
|
||||
<artifactId>che-core-commons-parent</artifactId>
|
||||
<groupId>org.eclipse.che.core</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>che-core-commons-schedule</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<parent>
|
||||
<artifactId>che-core-commons-parent</artifactId>
|
||||
<groupId>org.eclipse.che.core</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>che-core-commons-test</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<parent>
|
||||
<artifactId>che-core-commons-parent</artifactId>
|
||||
<groupId>org.eclipse.che.core</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>che-core-commons-xml</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<parent>
|
||||
<artifactId>che-core-parent</artifactId>
|
||||
<groupId>org.eclipse.che.core</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
<artifactId>che-core-commons-parent</artifactId>
|
||||
|
|
|
|||
|
|
@ -16,12 +16,12 @@
|
|||
<parent>
|
||||
<artifactId>che-parent</artifactId>
|
||||
<groupId>org.eclipse.che</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
<groupId>org.eclipse.che.core</groupId>
|
||||
<artifactId>che-core-parent</artifactId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
<name>Che Core Parent</name>
|
||||
<modules>
|
||||
|
|
|
|||
|
|
@ -16,12 +16,12 @@
|
|||
<parent>
|
||||
<artifactId>che-parent</artifactId>
|
||||
<groupId>org.eclipse.che</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
<groupId>org.eclipse.che.dashboard</groupId>
|
||||
<artifactId>che-dashboard-war</artifactId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
<packaging>war</packaging>
|
||||
<name>Che Dashboard :: Web App</name>
|
||||
<inceptionYear>2015</inceptionYear>
|
||||
|
|
|
|||
|
|
@ -78,6 +78,7 @@ export class CreateProjectController {
|
|||
|
||||
private stackId: string;
|
||||
private stacks: Array<che.IStack>;
|
||||
private recipeContentCopy: string;
|
||||
|
||||
/**
|
||||
* Default constructor that is using resource
|
||||
|
|
@ -1083,7 +1084,9 @@ export class CreateProjectController {
|
|||
return;
|
||||
}
|
||||
this.workspaceConfig = config;
|
||||
this.updateCurrentStack(stackId);
|
||||
if (stackId !== this.stackId) {
|
||||
this.updateCurrentStack(stackId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1268,7 +1271,9 @@ export class CreateProjectController {
|
|||
getStackMachines(environment: any): any {
|
||||
let recipeType = environment.recipe.type;
|
||||
let environmentManager = this.cheEnvironmentRegistry.getEnvironmentManager(recipeType);
|
||||
|
||||
if (this.recipeContentCopy && angular.equals(this.recipeContentCopy, environment.recipe.content)) {
|
||||
return this.stackMachines[this.stackId];
|
||||
}
|
||||
if (!this.stackMachines[this.stackId] || !this.stackMachines[this.stackId].length) {
|
||||
let machines = environmentManager.getMachines(environment);
|
||||
machines.forEach((machine: IEnvironmentManagerMachine) => {
|
||||
|
|
@ -1277,6 +1282,7 @@ export class CreateProjectController {
|
|||
environmentManager.setMemoryLimit(machine, this.workspaceRam);
|
||||
}
|
||||
});
|
||||
this.recipeContentCopy = angular.copy(environment.recipe.content);
|
||||
this.stackMachines[this.stackId] = machines;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -131,8 +131,12 @@ export class WorkspaceRecipeAuthoringController {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns validation state of the recipe.
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isRecipeValid(): boolean {
|
||||
return this.recipeValidationError.length === 0;
|
||||
return angular.isUndefined(this.recipeValidationError) || this.recipeValidationError.length === 0;
|
||||
}
|
||||
|
||||
onRecipeChange(): void {
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@
|
|||
ng-required>
|
||||
<che-error-messages che-message-scope="workspace-details-environment"
|
||||
che-message-name="Recipe content">
|
||||
<!-- TODO: remove this empty ng-message after investigating the first message crashing problem -->
|
||||
<div ng-message></div>
|
||||
<div ng-message="required">The recipe is required.</div>
|
||||
<div ng-message="customValidator">{{workspaceRecipeAuthoringController.recipeValidationError}}</div>
|
||||
</che-error-messages>
|
||||
|
|
|
|||
|
|
@ -91,4 +91,11 @@ export class CheEditorController {
|
|||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns validation state of the editor content.
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isEditorValid(): boolean {
|
||||
return this.editorState && this.editorState.isValid;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
ng-model-options="{ updateOn: 'default blur', debounce: { 'default': 500, 'blur': 0 }, allowInvalid: true }"
|
||||
ng-model="cheEditorController.editorContent"
|
||||
name="editor"
|
||||
custom-validator="!!cheEditorController.editorState.isValid"
|
||||
custom-validator="cheEditorController.isEditorValid()"
|
||||
required></textarea>
|
||||
<div ng-messages="codemirrorForm.editor.$error">
|
||||
<div ng-message="required">Editor's content is required.</div>
|
||||
|
|
|
|||
|
|
@ -1 +1,2 @@
|
|||
version/nightly/images
|
||||
tests/testrun/*
|
||||
|
|
|
|||
|
|
@ -37,11 +37,18 @@ run_test_in_docker_container() {
|
|||
$IMAGE_NAME bats ${BATS_OPTIONS} /dockerfiles/cli/tests/$1
|
||||
}
|
||||
|
||||
|
||||
echo "Running tests in container from image $IMAGE_NAME"
|
||||
echo "Running functional bats tests for CLI prompts and usage"
|
||||
#run_test_in_docker_container cli_prompts_usage_tests.bats
|
||||
run_test_in_docker_container cli_prompts_usage_tests.bats
|
||||
echo "Running functionals bats tests for config command"
|
||||
run_test_in_docker_container cmd_config_tests.bats
|
||||
echo "Running functionals bats tests for info command"
|
||||
run_test_in_docker_container cmd_info_tests.bats
|
||||
echo "Running functional bats tests for init and destroy commands"
|
||||
#run_test_in_docker_container cmd_init_destroy_tests.bats
|
||||
echo "Running functionals bats tests for start command"
|
||||
run_test_in_docker_container cmd_start_tests.bats --net=host
|
||||
run_test_in_docker_container cmd_init_destroy_tests.bats
|
||||
echo "Running functionals bats tests for start, stop, restart command"
|
||||
run_test_in_docker_container cmd_start_stop_restart_tests.bats --net=host
|
||||
echo "Running functionals bats tests for backup / restore commands"
|
||||
run_test_in_docker_container cmd_backup_restore_tests.bats
|
||||
echo "Running functionals bats tests for offline command"
|
||||
run_test_in_docker_container cmd_offline_tests.bats
|
||||
|
|
|
|||
|
|
@ -17,12 +17,11 @@ source /dockerfiles/cli/tests/test_base.sh
|
|||
prompt_substring="-v /var/run/docker.sock:/var/run/docker.sock"
|
||||
|
||||
#WHEN
|
||||
run docker run --rm $CLI_IMAGE start
|
||||
run execute_cli_command --che-cli-mount-scripts=false --che-cli-use-docker-sock=false --che-cli-command=start
|
||||
|
||||
#THEN
|
||||
assert_failure
|
||||
assert_output --partial ${prompt_substring}
|
||||
|
||||
}
|
||||
|
||||
@test "test CLI prompt to provide directory for user data" {
|
||||
|
|
@ -30,7 +29,7 @@ source /dockerfiles/cli/tests/test_base.sh
|
|||
prompt_substring="-v <YOUR_LOCAL_PATH>:/data"
|
||||
|
||||
#WHEN
|
||||
run docker run --rm -v "${SCRIPTS_DIR}":/scripts/base -v /var/run/docker.sock:/var/run/docker.sock $CLI_IMAGE start
|
||||
run execute_cli_command --che-cli-command=start
|
||||
|
||||
#THEN
|
||||
assert_failure
|
||||
|
|
@ -42,10 +41,8 @@ source /dockerfiles/cli/tests/test_base.sh
|
|||
expected_output="USAGE:"
|
||||
|
||||
#WHEN
|
||||
result=$(docker run --rm -v "${SCRIPTS_DIR}":/scripts/base -v /var/run/docker.sock:/var/run/docker.sock $CLI_IMAGE || true)
|
||||
result=$(execute_cli_command || true)
|
||||
|
||||
#THEN
|
||||
[[ $result == *${expected_output}* ]]
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,127 @@
|
|||
#!/usr/bin/env bats
|
||||
# Copyright (c) 2017 Codenvy, S.A.
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# are made available under the terms of the Eclipse Public License v1.0
|
||||
# which accompanies this distribution, and is available at
|
||||
# http://www.eclipse.org/legal/epl-v10.html
|
||||
#
|
||||
# Contributors:
|
||||
# Roman Iuvshyn
|
||||
|
||||
source /dockerfiles/cli/tests/test_base.sh
|
||||
|
||||
# Kill running che server instance if there is any to be able to run tests
|
||||
setup() {
|
||||
kill_running_named_container che
|
||||
remove_named_container che
|
||||
}
|
||||
|
||||
teardown() {
|
||||
kill_running_named_container che
|
||||
remove_named_container che
|
||||
}
|
||||
|
||||
@test "test cli 'backup' command: backup fail if che is running" {
|
||||
#GIVEN
|
||||
if [ ! port_is_free 8080 ]; then
|
||||
[ "$status" -eq 1 ]
|
||||
[ "$output" = "Default port 8080 for che server is used. Cannot run this test on default che server port" ]
|
||||
fi
|
||||
tmp_path="${TESTRUN_DIR}"/cli_cmd_backup_fail_if_che_is_running
|
||||
mkdir -p "${tmp_path}"
|
||||
execute_cli_command --che-data-path=${tmp_path} --che-cli-command=start --che-cli-extra-options="--skip:nightly --skip:pull"
|
||||
check_che_state
|
||||
#WHEN
|
||||
result=$(execute_cli_command --che-data-path=${tmp_path} --che-cli-command=backup --che-cli-extra-options="--skip:nightly --skip:pull" || true)
|
||||
|
||||
#THEN
|
||||
[[ $result == *"che is running. Stop before performing a backup."* ]]
|
||||
}
|
||||
|
||||
@test "test cli 'restore' command: restore fail if che is running" {
|
||||
#GIVEN
|
||||
if [ ! port_is_free 8080 ]; then
|
||||
[ "$status" -eq 1 ]
|
||||
[ "$output" = "Default port 8080 for che server is used. Cannot run this test on default che server port" ]
|
||||
fi
|
||||
tmp_path="${TESTRUN_DIR}"/cli_cmd_restore_fail_if_che_is_running
|
||||
mkdir -p "${tmp_path}"
|
||||
execute_cli_command --che-data-path=${tmp_path} --che-cli-command=start --che-cli-extra-options="--skip:nightly --skip:pull"
|
||||
check_che_state
|
||||
#WHEN
|
||||
result=$(execute_cli_command --che-data-path=${tmp_path} --che-cli-command=restore --che-cli-extra-options="--quiet --skip:nightly --skip:pull")
|
||||
|
||||
#THEN
|
||||
[[ $result == *"Eclipse Che is running. Stop before performing a restore."* ]]
|
||||
}
|
||||
|
||||
@test "test cli 'restore' command: restore fail if no backup found" {
|
||||
#GIVEN
|
||||
if [ ! port_is_free 8080 ]; then
|
||||
[ "$status" -eq 1 ]
|
||||
[ "$output" = "Default port 8080 for che server is used. Cannot run this test on default che server port" ]
|
||||
fi
|
||||
tmp_path="${TESTRUN_DIR}"/cli_cmd_restore_fail_if_no_backup_found
|
||||
mkdir -p "${tmp_path}"
|
||||
execute_cli_command --che-data-path=${tmp_path} --che-cli-command=start --che-cli-extra-options="--skip:nightly --skip:pull"
|
||||
check_che_state
|
||||
execute_cli_command --che-data-path=${tmp_path} --che-cli-command=stop --che-cli-extra-options="--skip:nightly --skip:pull"
|
||||
|
||||
#WHEN
|
||||
result=$(execute_cli_command --che-data-path=${tmp_path} --che-cli-command=restore --che-cli-extra-options="--quiet --skip:nightly --skip:pull")
|
||||
|
||||
#THEN
|
||||
[[ $result == *"Backup files not found. To do restore please do backup first."* ]]
|
||||
}
|
||||
|
||||
@test "test cli 'backup / restore' commands" {
|
||||
# TEST BACKUP
|
||||
#GIVEN
|
||||
if [ ! port_is_free 8080 ]; then
|
||||
[ "$status" -eq 1 ]
|
||||
[ "$output" = "Default port 8080 for che server is used. Cannot run this test on default che server port" ]
|
||||
fi
|
||||
tmp_path="${TESTRUN_DIR}"/cli_cmd_backup_do_backup_restore
|
||||
container_tmp_path="${CONTAINER_TESTRUN_DIR}"/cli_cmd_backup_do_backup_restore
|
||||
workspace_name="backup-restore"
|
||||
mkdir -p "${tmp_path}"
|
||||
#start che
|
||||
execute_cli_command --che-data-path=${tmp_path} --che-cli-command=start --che-cli-extra-options="--skip:nightly --skip:pull"
|
||||
check_che_state
|
||||
#create a workspace
|
||||
|
||||
ws_create=$(curl 'http://'${ip_address}':8080/api/workspace?namespace=che&attribute=stackId:java-default' -H 'Content-Type: application/json;charset=UTF-8' -H 'Accept: application/json, text/plain, */*' --data-binary '{"defaultEnv":"wksp-1p0b","environments":{"wksp-1p0b":{"recipe":{"location":"eclipse/ubuntu_jdk8","type":"dockerimage"},"machines":{"dev-machine":{"servers":{},"agents":["org.eclipse.che.exec","org.eclipse.che.terminal","org.eclipse.che.ws-agent","org.eclipse.che.ssh"],"attributes":{"memoryLimitBytes":"2147483648"}}}}},"projects":[],"commands":[{"commandLine":"mvn clean install -f ${current.project.path}","name":"build","type":"mvn","attributes":{"goal":"Build","previewUrl":""}}],"name":"backup-restore","links":[]}' --compressed)
|
||||
[[ "$ws_create" == *"created"* ]]
|
||||
[[ "$ws_create" == *"STOPPED"* ]]
|
||||
#stop che
|
||||
execute_cli_command --che-data-path=${tmp_path} --che-cli-command=stop --che-cli-extra-options="--skip:nightly --skip:pull"
|
||||
|
||||
#WHEN
|
||||
backup=$(execute_cli_command --che-data-path=${tmp_path} --che-cli-command=backup --che-cli-extra-options="--skip:nightly --skip:pull")
|
||||
|
||||
#THEN
|
||||
[[ "$backup" == *"Saving codenvy data..."* ]]
|
||||
[[ "$backup" == *"che data saved in ${tmp_path}/backup/che_backup.tar.gz"* ]]
|
||||
[[ -f "${container_tmp_path}"/backup/che_backup.tar.gz ]]
|
||||
|
||||
# TEST RESTORE
|
||||
#GIVEN
|
||||
#destroy to wipe data
|
||||
execute_cli_command --che-data-path=${tmp_path} --che-cli-command=destroy --che-cli-extra-options="--quiet --skip:nightly --skip:pull"
|
||||
[[ ! -d "${container_tmp_path}"/instance ]]
|
||||
#WHEN
|
||||
#perform restore from backup
|
||||
restore=$(execute_cli_command --che-data-path=${tmp_path} --che-cli-command=restore --che-cli-extra-options="--quiet --skip:nightly --skip:pull")
|
||||
|
||||
#THEN
|
||||
[[ "$restore" == *"Recovering Eclipse Che data..."* ]]
|
||||
[[ -d "${container_tmp_path}"/instance ]]
|
||||
[[ -d "${container_tmp_path}"/instance/data ]]
|
||||
|
||||
#WHEN
|
||||
execute_cli_command --che-data-path=${tmp_path} --che-cli-command=start --che-cli-extra-options="--skip:nightly --skip:pull"
|
||||
check_che_state
|
||||
|
||||
#THEN
|
||||
[[ "$(curl -fsS http://${ip_address}:8080/api/workspace)" == *"$workspace_name"* ]]
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
#!/usr/bin/env bats
|
||||
# Copyright (c) 2017 Codenvy, S.A.
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# are made available under the terms of the Eclipse Public License v1.0
|
||||
# which accompanies this distribution, and is available at
|
||||
# http://www.eclipse.org/legal/epl-v10.html
|
||||
#
|
||||
# Contributors:
|
||||
# Roman Iuvshyn
|
||||
|
||||
load '/bats-support/load.bash'
|
||||
load '/bats-assert/load.bash'
|
||||
source /dockerfiles/cli/tests/test_base.sh
|
||||
|
||||
@test "test CLI 'config' command" {
|
||||
#GIVEN
|
||||
tmp_path="${TESTRUN_DIR}"/cli_cmd_config
|
||||
container_tmp_path="${CONTAINER_TESTRUN_DIR}"/cli_cmd_config
|
||||
|
||||
#WHEN
|
||||
execute_cli_command --che-data-path=${tmp_path} --che-cli-command=config --che-cli-extra-options="--skip:nightly --skip:pull"
|
||||
|
||||
#THEN
|
||||
[[ -d "${container_tmp_path}"/docs ]]
|
||||
[[ -e "${container_tmp_path}"/che.env ]]
|
||||
[[ -e "${container_tmp_path}"/cli.log ]]
|
||||
[[ -d "${container_tmp_path}"/instance ]]
|
||||
[[ -d "${container_tmp_path}"/instance/config ]]
|
||||
[[ -f "${container_tmp_path}"/instance/config/che.env ]]
|
||||
[[ -d "${container_tmp_path}"/instance/data ]]
|
||||
[[ -d "${container_tmp_path}"/instance/logs ]]
|
||||
[[ -d "${container_tmp_path}"/instance/stacks ]]
|
||||
[[ -d "${container_tmp_path}"/instance/templates ]]
|
||||
[[ -f "${container_tmp_path}"/instance/docker-compose-container.yml ]]
|
||||
[[ -f "${container_tmp_path}"/instance/che.ver.do_not_modify ]]
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
#!/usr/bin/env bats
|
||||
# Copyright (c) 2017 Codenvy, S.A.
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# are made available under the terms of the Eclipse Public License v1.0
|
||||
# which accompanies this distribution, and is available at
|
||||
# http://www.eclipse.org/legal/epl-v10.html
|
||||
#
|
||||
# Contributors:
|
||||
# Roman Iuvshyn
|
||||
|
||||
load '/bats-support/load.bash'
|
||||
load '/bats-assert/load.bash'
|
||||
source /dockerfiles/cli/tests/test_base.sh
|
||||
|
||||
@test "test CLI 'info' command" {
|
||||
#GIVEN
|
||||
tmp_path="${TESTRUN_DIR}"/cli_cmd_info
|
||||
expected_output_1="CLI:"
|
||||
expected_output_2="Mounts:"
|
||||
expected_output_3="System:"
|
||||
expected_output_4="Internal:"
|
||||
expected_output_5="Image Registry:"
|
||||
|
||||
#WHEN
|
||||
result=$(execute_cli_command --che-data-path=${tmp_path} --che-cli-command=info --che-cli-extra-options="--skip:nightly --skip:pull")
|
||||
|
||||
#THEN
|
||||
[[ $result == *${expected_output_1}* ]]
|
||||
[[ $result == *${expected_output_2}* ]]
|
||||
[[ $result == *${expected_output_3}* ]]
|
||||
[[ $result == *${expected_output_4}* ]]
|
||||
[[ $result == *${expected_output_5}* ]]
|
||||
}
|
||||
|
|
@ -18,7 +18,7 @@ source /dockerfiles/cli/tests/test_base.sh
|
|||
mkdir -p "${tmp_path}"
|
||||
|
||||
#WHEN
|
||||
docker run --rm -v "${SCRIPTS_DIR}":/scripts/base -v /var/run/docker.sock:/var/run/docker.sock -v "${tmp_path}":/data $CLI_IMAGE init --skip:nightly --skip:pull
|
||||
execute_cli_command --che-data-path=${tmp_path} --che-cli-command=init --che-cli-extra-options="--skip:nightly --skip:pull"
|
||||
|
||||
#THEN
|
||||
[[ -d "${container_tmp_path}"/docs ]]
|
||||
|
|
@ -27,8 +27,8 @@ source /dockerfiles/cli/tests/test_base.sh
|
|||
[[ -e "${container_tmp_path}"/cli.log ]]
|
||||
|
||||
#WHEN
|
||||
docker run --rm -v "${SCRIPTS_DIR}":/scripts/base -v /var/run/docker.sock:/var/run/docker.sock -v "${tmp_path}":/data $CLI_IMAGE destroy --quiet --skip:nightly --skip:pull
|
||||
|
||||
execute_cli_command --che-data-path=${tmp_path} --che-cli-command=destroy --che-cli-extra-options="--quiet --skip:nightly --skip:pull"
|
||||
|
||||
#THEN
|
||||
[[ ! -d "${container_tmp_path}"/docs ]]
|
||||
[[ ! -d "${container_tmp_path}"/instance ]]
|
||||
|
|
@ -43,8 +43,8 @@ source /dockerfiles/cli/tests/test_base.sh
|
|||
tmp_path="${TESTRUN_DIR}"/init-destroy2
|
||||
container_tmp_path="${CONTAINER_TESTRUN_DIR}"/init-destroy2
|
||||
|
||||
#WHEN
|
||||
docker run --rm -v "${SCRIPTS_DIR}":/scripts/base -v /var/run/docker.sock:/var/run/docker.sock -v "${tmp_path}":/data $CLI_IMAGE init --skip:nightly --skip:pull 1>/dev/null
|
||||
#WHEN
|
||||
execute_cli_command --che-data-path=${tmp_path} --che-cli-command=init --che-cli-extra-options="--skip:nightly --skip:pull 1>/dev/null"
|
||||
|
||||
#THEN
|
||||
[[ -e "${container_tmp_path}" ]]
|
||||
|
|
@ -54,7 +54,7 @@ source /dockerfiles/cli/tests/test_base.sh
|
|||
[[ -e "${container_tmp_path}"/cli.log ]]
|
||||
|
||||
#WHEN
|
||||
docker run --rm -v "${SCRIPTS_DIR}":/scripts/base -v /var/run/docker.sock:/var/run/docker.sock -v "${tmp_path}":/data $CLI_IMAGE destroy --skip:nightly --skip:pull --quiet 1>/dev/null
|
||||
execute_cli_command --che-data-path=${tmp_path} --che-cli-command=destroy --che-cli-extra-options="--quiet --skip:nightly --skip:pull 1>/dev/null"
|
||||
|
||||
#THEN
|
||||
[[ ! -d "${container_tmp_path}"/docs ]]
|
||||
|
|
@ -73,7 +73,7 @@ source /dockerfiles/cli/tests/test_base.sh
|
|||
mkdir -p "${tmp_path}"
|
||||
|
||||
#WHEN
|
||||
docker run --rm -v "${SCRIPTS_DIR}":/scripts/base -v /var/run/docker.sock:/var/run/docker.sock -v "${tmp_path}":/data $CLI_IMAGE init --skip:nightly --skip:pull 1>/dev/null
|
||||
execute_cli_command --che-data-path=${tmp_path} --che-cli-command=init --che-cli-extra-options="--skip:nightly --skip:pull 1>/dev/null"
|
||||
remove_named_container $CLI_CONTAINER
|
||||
|
||||
#THEN
|
||||
|
|
@ -83,7 +83,7 @@ source /dockerfiles/cli/tests/test_base.sh
|
|||
[[ -e "${container_tmp_path}"/cli.log ]]
|
||||
|
||||
#WHEN
|
||||
docker run --rm -v "${SCRIPTS_DIR}":/scripts/base -v /var/run/docker.sock:/var/run/docker.sock -v "${tmp_path}":/data $CLI_IMAGE destroy --skip:nightly --skip:pull --quiet --cli 1>/dev/null
|
||||
execute_cli_command --che-data-path=${tmp_path} --che-cli-command=destroy --che-cli-extra-options="--quiet --skip:nightly --skip:pull --cli 1>/dev/null"
|
||||
|
||||
#THEN
|
||||
[[ ! -d "${container_tmp_path}"/docs ]]
|
||||
|
|
@ -101,7 +101,7 @@ source /dockerfiles/cli/tests/test_base.sh
|
|||
container_tmp_path="${CONTAINER_TESTRUN_DIR}"/init-destroy4
|
||||
|
||||
#WHEN
|
||||
docker run --rm -v "${SCRIPTS_DIR}":/scripts/base -v /var/run/docker.sock:/var/run/docker.sock -v "${tmp_path}":/data $CLI_IMAGE init --skip:nightly --skip:pull 1>/dev/null
|
||||
execute_cli_command --che-data-path=${tmp_path} --che-cli-command=init --che-cli-extra-options="--skip:nightly --skip:pull 1>/dev/null"
|
||||
|
||||
#THEN
|
||||
[[ -d "${container_tmp_path}" ]]
|
||||
|
|
@ -111,14 +111,12 @@ source /dockerfiles/cli/tests/test_base.sh
|
|||
[[ -e "${container_tmp_path}"/cli.log ]]
|
||||
|
||||
#WHEN
|
||||
docker run --rm -v "${SCRIPTS_DIR}":/scripts/base -v /var/run/docker.sock:/var/run/docker.sock -v "${tmp_path}":/data $CLI_IMAGE destroy --skip:nightly --skip:pull --quiet --cli 1>/dev/null
|
||||
|
||||
execute_cli_command --che-data-path=${tmp_path} --che-cli-command=destroy --che-cli-extra-options="--skip:nightly --skip:pull --quiet --cli 1>/dev/null"
|
||||
|
||||
#THEN
|
||||
[[ ! -d "${container_tmp_path}"/docs ]]
|
||||
[[ ! -d "${container_tmp_path}"/instance ]]
|
||||
[[ ! -e "${container_tmp_path}"/che.env ]]
|
||||
[[ ! -e "${container_tmp_path}"/cli.log ]]
|
||||
rm -rf "${container_tmp_path}"
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,71 @@
|
|||
#!/usr/bin/env bats
|
||||
# Copyright (c) 2017 Codenvy, S.A.
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# are made available under the terms of the Eclipse Public License v1.0
|
||||
# which accompanies this distribution, and is available at
|
||||
# http://www.eclipse.org/legal/epl-v10.html
|
||||
#
|
||||
# Contributors:
|
||||
# Roman Iuvshyn
|
||||
|
||||
source /dockerfiles/cli/tests/test_base.sh
|
||||
|
||||
@test "test cli 'offline' command: with default parameters" {
|
||||
#GIVEN
|
||||
tmp_path="${TESTRUN_DIR}"/cli_cmd_offline_with_default_parameters
|
||||
container_tmp_path="${CONTAINER_TESTRUN_DIR}"/cli_cmd_offline_with_default_parameters
|
||||
mkdir -p "${tmp_path}"
|
||||
|
||||
#WHEN
|
||||
result=$(execute_cli_command --che-data-path=${tmp_path} --che-cli-command=offline --che-cli-extra-options="--skip:nightly --skip:pull")
|
||||
|
||||
#THEN
|
||||
[[ $result == *"Saving che cli image..."* ]]
|
||||
[[ $result == *"Saving che bootstrap images..."* ]]
|
||||
[[ $result == *"Saving che system images..."* ]]
|
||||
[[ $result == *"Saving utility images..."* ]]
|
||||
[[ $result == *"Saving che stack images..."* ]]
|
||||
|
||||
[[ -f $(ls "${container_tmp_path}"/backup/alpine*.tar) ]]
|
||||
[[ -f $(ls "${container_tmp_path}"/backup/docker_compose*.tar) ]]
|
||||
[[ -f $(ls "${container_tmp_path}"/backup/eclipse_che-action*.tar) ]]
|
||||
[[ -f $(ls "${container_tmp_path}"/backup/eclipse_che-cli*.tar) ]]
|
||||
[[ -f $(ls "${container_tmp_path}"/backup/eclipse_che-dir*.tar) ]]
|
||||
[[ -f $(ls "${container_tmp_path}"/backup/eclipse_che-init*.tar) ]]
|
||||
[[ -f $(ls "${container_tmp_path}"/backup/eclipse_che-ip*.tar) ]]
|
||||
[[ -f $(ls "${container_tmp_path}"/backup/eclipse_che-mount*.tar) ]]
|
||||
[[ -f $(ls "${container_tmp_path}"/backup/eclipse_che-server*.tar) ]]
|
||||
[[ -f $(ls "${container_tmp_path}"/backup/eclipse_che-test*.tar) ]]
|
||||
[[ -f $(ls "${container_tmp_path}"/backup/traefik*.tar) ]]
|
||||
}
|
||||
|
||||
@test "test cli 'offline' command: include custom stack images" {
|
||||
#GIVEN
|
||||
tmp_path="${TESTRUN_DIR}"/cli_cmd_offline_with_custom_stack_images
|
||||
container_tmp_path="${CONTAINER_TESTRUN_DIR}"/cli_cmd_offline_with_custom_stack_images
|
||||
mkdir -p "${tmp_path}"
|
||||
|
||||
#WHEN
|
||||
result=$(execute_cli_command --che-data-path=${tmp_path} --che-cli-command=offline --che-cli-extra-options="--image:eclipse/alpine_jdk8 --image:eclipse/debian_jre --skip:nightly --skip:pull")
|
||||
|
||||
#THEN
|
||||
[[ $result == *"Saving che cli image..."* ]]
|
||||
[[ $result == *"Saving che bootstrap images..."* ]]
|
||||
[[ $result == *"Saving che system images..."* ]]
|
||||
[[ $result == *"Saving utility images..."* ]]
|
||||
[[ $result == *"Saving che stack images..."* ]]
|
||||
|
||||
[[ -f $(ls "${container_tmp_path}"/backup/alpine*.tar) ]]
|
||||
[[ -f $(ls "${container_tmp_path}"/backup/docker_compose*.tar) ]]
|
||||
[[ -f $(ls "${container_tmp_path}"/backup/eclipse_che-action*.tar) ]]
|
||||
[[ -f $(ls "${container_tmp_path}"/backup/eclipse_che-cli*.tar) ]]
|
||||
[[ -f $(ls "${container_tmp_path}"/backup/eclipse_che-dir*.tar) ]]
|
||||
[[ -f $(ls "${container_tmp_path}"/backup/eclipse_che-init*.tar) ]]
|
||||
[[ -f $(ls "${container_tmp_path}"/backup/eclipse_che-ip*.tar) ]]
|
||||
[[ -f $(ls "${container_tmp_path}"/backup/eclipse_che-mount*.tar) ]]
|
||||
[[ -f $(ls "${container_tmp_path}"/backup/eclipse_che-server*.tar) ]]
|
||||
[[ -f $(ls "${container_tmp_path}"/backup/eclipse_che-test*.tar) ]]
|
||||
[[ -f $(ls "${container_tmp_path}"/backup/traefik*.tar) ]]
|
||||
[[ -f "${container_tmp_path}"/backup/eclipse_alpine_jdk8.tar ]]
|
||||
[[ -f "${container_tmp_path}"/backup/eclipse_debian_jre.tar ]]
|
||||
}
|
||||
|
|
@ -0,0 +1,88 @@
|
|||
#!/usr/bin/env bats
|
||||
# Copyright (c) 2012-2017 Red Hat, Inc
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# are made available under the terms of the Eclipse Public License v1.0
|
||||
# which accompanies this distribution, and is available at
|
||||
# http://www.eclipse.org/legal/epl-v10.html
|
||||
#
|
||||
# Contributors:
|
||||
# Marian Labuda - Initial Implementation
|
||||
# Roman Iuvshyn
|
||||
|
||||
source /dockerfiles/cli/tests/test_base.sh
|
||||
|
||||
# Kill running che server instance if there is any to be able to run tests
|
||||
setup() {
|
||||
kill_running_named_container chetest
|
||||
remove_named_container chetest
|
||||
}
|
||||
|
||||
teardown() {
|
||||
kill_running_named_container chetest
|
||||
remove_named_container chetest
|
||||
}
|
||||
|
||||
@test "test cli 'start' command with default settings" {
|
||||
#GIVEN
|
||||
if [ ! port_is_free 8080 ]; then
|
||||
[ "$status" -eq 1 ]
|
||||
[ "$output" = "Default port 8080 for che server is used. Cannot run this test on default che server port" ]
|
||||
fi
|
||||
tmp_path="${TESTRUN_DIR}"/cli_cmd_start_with_default_params
|
||||
mkdir -p "${tmp_path}"
|
||||
|
||||
#WHEN
|
||||
execute_cli_command --che-data-path=${tmp_path} --che-container-name=chetest --che-cli-command=start --che-cli-extra-options="--skip:nightly --skip:pull"
|
||||
|
||||
#THEN
|
||||
check_che_state --che-container-name="chetest"
|
||||
}
|
||||
|
||||
@test "test cli 'stop' command with default settings" {
|
||||
#GIVEN
|
||||
if [ ! port_is_free 8080 ]; then
|
||||
[ "$status" -eq 1 ]
|
||||
[ "$output" = "Default port 8080 for che server is used. Cannot run this test on default che server port" ]
|
||||
fi
|
||||
tmp_path="${TESTRUN_DIR}"/cli_cmd_stop_with_default_settings
|
||||
mkdir -p "${tmp_path}"
|
||||
execute_cli_command --che-data-path=${tmp_path} --che-container-name=chetest --che-cli-command=start --che-cli-extra-options="--skip:nightly --skip:pull"
|
||||
check_che_state --che-container-name="chetest"
|
||||
#WHEN
|
||||
execute_cli_command --che-data-path=${tmp_path} --che-container-name=chetest --che-cli-command=stop --che-cli-extra-options="--skip:nightly --skip:pull"
|
||||
|
||||
#THEN
|
||||
#check that container is stopped and removed
|
||||
[[ "$(docker ps -a)" != *"chetest"* ]]
|
||||
}
|
||||
|
||||
@test "test cli 'restart' command with default settings" {
|
||||
#GIVEN
|
||||
if [ ! port_is_free 8080 ]; then
|
||||
[ "$status" -eq 1 ]
|
||||
[ "$output" = "Default port 8080 for che server is used. Cannot run this test on default che server port" ]
|
||||
fi
|
||||
tmp_path="${TESTRUN_DIR}"/cli_cmd_restart_with_default_settings
|
||||
mkdir -p "${tmp_path}"
|
||||
execute_cli_command --che-data-path=${tmp_path} --che-container-name=chetest --che-cli-command=start --che-cli-extra-options="--skip:nightly --skip:pull"
|
||||
check_che_state --che-container-name="chetest"
|
||||
che_container_id=$(docker inspect --format="{{.Id}}" chetest)
|
||||
|
||||
#WHEN
|
||||
execute_cli_command --che-data-path=${tmp_path} --che-container-name=chetest --che-cli-command=restart --che-cli-extra-options="--skip:nightly --skip:pull"
|
||||
|
||||
#THEN
|
||||
[[ "$(docker inspect --format="{{.Id}}" chetest)" != "$che_container_id" ]]
|
||||
check_che_state --che-container-name="chetest"
|
||||
}
|
||||
|
||||
@test "test cli 'start' with custom port" {
|
||||
#GIVEN
|
||||
tmp_path=${TESTRUN_DIR}/cli_cmd_start_with_custom_port
|
||||
free_port=$(get_free_port)
|
||||
|
||||
#WHEN
|
||||
execute_cli_command --che-data-path=${tmp_path} --che-port=$free_port --che-container-name=chetest --che-cli-command=start --che-cli-extra-options="--skip:nightly --skip:pull"
|
||||
#THEN
|
||||
check_che_state --che-container-name="chetest" --che-port="$free_port"
|
||||
}
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
#!/usr/bin/env bats
|
||||
# Copyright (c) 2012-2017 Red Hat, Inc
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# are made available under the terms of the Eclipse Public License v1.0
|
||||
# which accompanies this distribution, and is available at
|
||||
# http://www.eclipse.org/legal/epl-v10.html
|
||||
#
|
||||
# Contributors:
|
||||
# Marian Labuda - Initial Implementation
|
||||
|
||||
source /dockerfiles/cli/tests/test_base.sh
|
||||
|
||||
# Kill running che server instance if there is any to be able to run tests
|
||||
setup() {
|
||||
kill_running_named_container chetest
|
||||
remove_named_container chetest
|
||||
}
|
||||
|
||||
teardown() {
|
||||
docker run --rm -v "${SCRIPTS_DIR}":/scripts/base -v /var/run/docker.sock:/var/run/docker.sock -v "${tmp_path}":/data -e CHE_CONTAINER=chetest $CLI_IMAGE stop --skip:nightly --skip:pull
|
||||
docker run --rm -v "${SCRIPTS_DIR}":/scripts/base -v /var/run/docker.sock:/var/run/docker.sock -v "${tmp_path}":/data -e CHE_CONTAINER=chetest $CLI_IMAGE destroy --quiet --skip:nightly --skip:pull
|
||||
}
|
||||
|
||||
@test "test cli 'start' with default settings" {
|
||||
#GIVEN
|
||||
if [ ! port_is_free 8080 ]; then
|
||||
[ "$status" -eq 1 ]
|
||||
[ "$output" = "Default port 8080 for che server is used. Cannot run this test on default che server port" ]
|
||||
fi
|
||||
tmp_path="${TESTRUN_DIR}"/start1
|
||||
echo $tmp_path
|
||||
mkdir -p "${tmp_path}"
|
||||
|
||||
#WHEN
|
||||
docker run --rm -v "${SCRIPTS_DIR}":/scripts/base -v /var/run/docker.sock:/var/run/docker.sock -v "${tmp_path}":/data -e CHE_CONTAINER=chetest $CLI_IMAGE start --skip:nightly --skip:pull
|
||||
|
||||
#THEN
|
||||
[[ $(docker inspect --format="{{.State.Running}}" chetest) -eq "true" ]]
|
||||
ip_address=$(docker inspect -f {{.NetworkSettings.Networks.bridge.IPAddress}} chetest)
|
||||
curl -fsS http://${ip_address}:8080 > /dev/null
|
||||
}
|
||||
|
||||
@test "test cli 'start' with custom port" {
|
||||
#GIVEN
|
||||
tmp_path=${TESTRUN_DIR}/start2
|
||||
free_port=$(get_free_port)
|
||||
|
||||
#WHEN
|
||||
docker run --rm -e CHE_PORT=$free_port -v "${SCRIPTS_DIR}":/scripts/base -v /var/run/docker.sock:/var/run/docker.sock -v "${tmp_path}":/data -e CHE_CONTAINER=chetest $CLI_IMAGE start --skip:nightly --skip:pull
|
||||
|
||||
#THEN
|
||||
[[ $(docker inspect --format="{{.State.Running}}" chetest) -eq "true" ]]
|
||||
ip_address=$(docker inspect -f {{.NetworkSettings.Networks.bridge.IPAddress}} chetest)
|
||||
curl -fsS http://${ip_address}:${free_port} > /dev/null
|
||||
}
|
||||
|
|
@ -14,8 +14,9 @@ export SCRIPTS_DIR="${BATS_BASE_DIR}"/base/scripts/base
|
|||
export TESTS_DIR="${BATS_BASE_DIR}"/cli/tests
|
||||
export TESTRUN_DIR="${TESTS_DIR}"/testrun
|
||||
export CONTAINER_TESTRUN_DIR=/dockerfiles/cli/tests/testrun
|
||||
if [ -d "${TESTRUN_DIR}" ]; then
|
||||
rm -rf "${TESTRUN_DIR}"
|
||||
|
||||
if [ -d "${CONTAINER_TESTRUN_DIR}" ]; then
|
||||
rm -rf "${CONTAINER_TESTRUN_DIR}"
|
||||
fi
|
||||
mkdir "${TESTRUN_DIR}" -p
|
||||
|
||||
|
|
@ -56,3 +57,99 @@ get_free_port() {
|
|||
echo $port
|
||||
}
|
||||
|
||||
check_che_state() {
|
||||
local CHE_CONTAINER_NAME="che"
|
||||
local CHE_PORT="8080"
|
||||
local IS_RUNNING="true"
|
||||
for i in "${@}"
|
||||
do
|
||||
case $i in
|
||||
--che-container-name=*)
|
||||
CHE_CONTAINER_NAME="${i#*=}"
|
||||
shift
|
||||
;;
|
||||
--che-port=*)
|
||||
CHE_PORT="${i#*=}"
|
||||
shift
|
||||
;;
|
||||
--is-running=*)
|
||||
IS_RUNNING="${i#*=}"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
echo "You've passed unknown option"
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
done
|
||||
[[ "$(docker inspect --format='{{.State.Running}}' $CHE_CONTAINER_NAME)" == "$IS_RUNNING" ]]
|
||||
ip_address=$(docker inspect -f {{.NetworkSettings.Networks.bridge.IPAddress}} $CHE_CONTAINER_NAME)
|
||||
curl -fsS http://${ip_address}:$CHE_PORT > /dev/null
|
||||
}
|
||||
|
||||
execute_cli_command() {
|
||||
local CHE_CONTAINER_NAME="che"
|
||||
local CHE_DATA_PATH=""
|
||||
local CHE_CLI_COMMAND=""
|
||||
local CHE_CLI_EXTRA_OPTIONS=""
|
||||
local CHE_PORT="8080"
|
||||
local DATA_VOLUME=""
|
||||
local USE_DOCKER_SOCK="true"
|
||||
local MOUNT_SCRIPTS="true"
|
||||
|
||||
for i in "${@}"
|
||||
do
|
||||
case $i in
|
||||
--che-container-name=*)
|
||||
CHE_CONTAINER_NAME="${i#*=}"
|
||||
shift
|
||||
;;
|
||||
--che-port=*)
|
||||
CHE_PORT="${i#*=}"
|
||||
shift
|
||||
;;
|
||||
--che-data-path=*)
|
||||
CHE_DATA_PATH="${i#*=}"
|
||||
shift
|
||||
;;
|
||||
--che-cli-command=*)
|
||||
CHE_CLI_COMMAND="${i#*=}"
|
||||
shift
|
||||
;;
|
||||
--che-cli-extra-options=*)
|
||||
CHE_CLI_EXTRA_OPTIONS="${i#*=}"
|
||||
shift
|
||||
;;
|
||||
--che-cli-use-docker-sock=*)
|
||||
USE_DOCKER_SOCK="${i#*=}"
|
||||
shift
|
||||
;;
|
||||
--che-cli-mount-scripts=*)
|
||||
MOUNT_SCRIPTS="${i#*=}"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
echo "You've passed unknown option"
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ ! -z $CHE_DATA_PATH ]; then
|
||||
DATA_VOLUME="-v ${CHE_DATA_PATH}:/data"
|
||||
fi
|
||||
if [ $USE_DOCKER_SOCK == "true" ]; then
|
||||
DOCKER_SOCK_VOLUME="-v /var/run/docker.sock:/var/run/docker.sock"
|
||||
fi
|
||||
if [ $MOUNT_SCRIPTS == "true" ]; then
|
||||
SCRIPTS_VOLUME="-v ${SCRIPTS_DIR}:/scripts/base"
|
||||
fi
|
||||
if [ $CHE_PORT -ne 8080 ]; then
|
||||
CLI_CUSTOM_PORT="-e CHE_PORT=${CHE_PORT}"
|
||||
fi
|
||||
if [ $CHE_CONTAINER_NAME != "che" ]; then
|
||||
CLI_CUSTOM_CHE_CONTAINER_NAME="-e CHE_CONTAINER=${CHE_CONTAINER_NAME}"
|
||||
fi
|
||||
|
||||
docker run --rm ${CLI_CUSTOM_PORT} ${SCRIPTS_VOLUME} ${DOCKER_SOCK_VOLUME} ${DATA_VOLUME} ${CLI_CUSTOM_CHE_CONTAINER_NAME} $CLI_IMAGE ${CHE_CLI_COMMAND} ${CHE_CLI_EXTRA_OPTIONS}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,4 @@
|
|||
IMAGE_INIT=eclipse/che-init:5.13.0
|
||||
IMAGE_CHE=eclipse/che-server:5.13.0
|
||||
IMAGE_COMPOSE=docker/compose:1.8.1
|
||||
IMAGE_TRAEFIK=traefik:v1.3.0-rc3
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
eclipse/alpine_jdk8
|
||||
eclipse/aspnet
|
||||
eclipse/centos_jdk8
|
||||
eclipse/cpp_gcc
|
||||
eclipse/debian_jdk8
|
||||
eclipse/debian_jdk8_node
|
||||
eclipse/debian_jre
|
||||
eclipse/dotnet_core
|
||||
eclipse/hadoop-dev
|
||||
eclipse/meteor
|
||||
eclipse/node
|
||||
eclipse/php
|
||||
eclipse/platformio
|
||||
eclipse/ruby_rails
|
||||
eclipse/selenium
|
||||
eclipse/ubuntu_android
|
||||
eclipse/ubuntu_go
|
||||
eclipse/ubuntu_gradle
|
||||
eclipse/ubuntu_jdk8
|
||||
eclipse/ubuntu_jre
|
||||
eclipse/ubuntu_python
|
||||
eclipse/ubuntu_wildfly8
|
||||
registry.centos.org/che-stacks/vertx
|
||||
|
||||
|
|
@ -1 +1 @@
|
|||
5.11.2
|
||||
5.12.0
|
||||
|
|
@ -17,13 +17,13 @@
|
|||
<parent>
|
||||
<artifactId>maven-depmgt-pom</artifactId>
|
||||
<groupId>org.eclipse.che.depmgt</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>dto-typescript</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<name>Che TypeScript DTO</name>
|
||||
<properties>
|
||||
<che.version>5.12.0-SNAPSHOT</che.version>
|
||||
<che.version>5.13.0-SNAPSHOT</che.version>
|
||||
</properties>
|
||||
<repositories>
|
||||
<repository>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<parent>
|
||||
<artifactId>che-core-ide-parent</artifactId>
|
||||
<groupId>org.eclipse.che.core</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>che-core-dyna-provider-generator-maven-plugin</artifactId>
|
||||
<packaging>maven-plugin</packaging>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<parent>
|
||||
<artifactId>che-core-ide-parent</artifactId>
|
||||
<groupId>org.eclipse.che.core</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<groupId>org.eclipse.che.core</groupId>
|
||||
<artifactId>che-core-ide-api</artifactId>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<parent>
|
||||
<artifactId>che-core-ide-parent</artifactId>
|
||||
<groupId>org.eclipse.che.core</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>che-core-ide-app</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
|
|
|||
|
|
@ -20,9 +20,11 @@ import org.eclipse.che.api.core.jsonrpc.commons.JsonRpcMarshaller;
|
|||
import org.eclipse.che.api.core.jsonrpc.commons.JsonRpcQualifier;
|
||||
import org.eclipse.che.api.core.jsonrpc.commons.JsonRpcUnmarshaller;
|
||||
import org.eclipse.che.api.core.jsonrpc.commons.RequestHandlerConfigurator;
|
||||
import org.eclipse.che.api.core.jsonrpc.commons.TimeoutActionRunner;
|
||||
import org.eclipse.che.ide.api.event.ng.JsonRpcWebSocketAgentEventListener;
|
||||
import org.eclipse.che.ide.api.jsonrpc.WorkspaceMasterJsonRpcInitializer;
|
||||
import org.eclipse.che.ide.jsonrpc.ClientSideRequestProcessor;
|
||||
import org.eclipse.che.ide.jsonrpc.ClientSideTimeoutActionRunner;
|
||||
import org.eclipse.che.ide.jsonrpc.ElementalJsonRpcComposer;
|
||||
import org.eclipse.che.ide.jsonrpc.ElementalJsonRpcMarshaller;
|
||||
import org.eclipse.che.ide.jsonrpc.ElementalJsonRpcQualifier;
|
||||
|
|
@ -53,5 +55,6 @@ public class JsonRpcModule extends AbstractGinModule {
|
|||
bind(JsonRpcQualifier.class).to(ElementalJsonRpcQualifier.class);
|
||||
|
||||
bind(RequestProcessor.class).to(ClientSideRequestProcessor.class);
|
||||
bind(TimeoutActionRunner.class).to(ClientSideTimeoutActionRunner.class);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<parent>
|
||||
<artifactId>che-core-ide-parent</artifactId>
|
||||
<groupId>org.eclipse.che.core</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<groupId>org.eclipse.che.core</groupId>
|
||||
<artifactId>che-core-ide-generators</artifactId>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<parent>
|
||||
<artifactId>che-core-ide-parent</artifactId>
|
||||
<groupId>org.eclipse.che.core</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<groupId>org.eclipse.che.core</groupId>
|
||||
<artifactId>che-core-ide-stacks</artifactId>
|
||||
|
|
|
|||
|
|
@ -2437,11 +2437,7 @@
|
|||
{
|
||||
"commandLine": "scl enable rh-maven33 'mvn clean install -f ${current.project.path}'",
|
||||
"name": "build",
|
||||
"type": "custom",
|
||||
"attributes": {
|
||||
"previewUrl": "",
|
||||
"goal": "Build"
|
||||
}
|
||||
"type": "mvn"
|
||||
},
|
||||
{
|
||||
"commandLine": "java -jar ${current.project.path}/target/*.jar",
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<parent>
|
||||
<artifactId>che-core-ide-parent</artifactId>
|
||||
<groupId>org.eclipse.che.core</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<groupId>org.eclipse.che.core</groupId>
|
||||
<artifactId>che-core-ide-templates</artifactId>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<parent>
|
||||
<artifactId>che-core-ide-parent</artifactId>
|
||||
<groupId>org.eclipse.che.core</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<groupId>org.eclipse.che.core</groupId>
|
||||
<artifactId>che-core-ide-ui</artifactId>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<parent>
|
||||
<artifactId>che-core-ide-parent</artifactId>
|
||||
<groupId>org.eclipse.che.core</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>che-core-orion-editor</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<parent>
|
||||
<artifactId>che-parent</artifactId>
|
||||
<groupId>org.eclipse.che</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<groupId>org.eclipse.che.core</groupId>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<parent>
|
||||
<artifactId>che-core-ide-parent</artifactId>
|
||||
<groupId>org.eclipse.che.core</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>che-core-commons-gwt</artifactId>
|
||||
<name>Che Core :: Commons :: GWT</name>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,31 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2012-2017 Codenvy, S.A.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Codenvy, S.A. - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.che.ide.jsonrpc;
|
||||
|
||||
import com.google.gwt.user.client.Timer;
|
||||
|
||||
import org.eclipse.che.api.core.jsonrpc.commons.TimeoutActionRunner;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
@Singleton
|
||||
public class ClientSideTimeoutActionRunner implements TimeoutActionRunner {
|
||||
|
||||
@Override
|
||||
public void schedule(int timeoutInMillis, Runnable runnable) {
|
||||
new Timer() {
|
||||
@Override
|
||||
public void run() {
|
||||
runnable.run();
|
||||
}
|
||||
}.schedule(timeoutInMillis);
|
||||
}
|
||||
}
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
<parent>
|
||||
<artifactId>che-core-ide-parent</artifactId>
|
||||
<groupId>org.eclipse.che.core</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>che-core-gwt-logger</artifactId>
|
||||
<name>Che Core :: Commons :: GWT Logger</name>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<parent>
|
||||
<artifactId>che-parent</artifactId>
|
||||
<groupId>org.eclipse.che</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
<groupId>org.eclipse.che.core</groupId>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<parent>
|
||||
<artifactId>che-infrastructures-parent</artifactId>
|
||||
<groupId>org.eclipse.che</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
<artifactId>infrastructure-docker</artifactId>
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import static java.util.Arrays.asList;
|
|||
import static java.util.Collections.singletonList;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
import static org.testng.Assert.fail;
|
||||
|
||||
/**
|
||||
* Test deserialization field {@link ComposeService#command}
|
||||
|
|
@ -178,17 +179,16 @@ public class CommandDeserializerTest {
|
|||
};
|
||||
}
|
||||
|
||||
@Test(expectedExceptions = ReaderException.class,
|
||||
expectedExceptionsMessageRegExp = "special characters are not allowed",
|
||||
dataProvider = "inValidSymbols")
|
||||
public void symbolsShouldBeInvalidForYaml(String command) throws Exception {
|
||||
String content = format(RECIPE_WITHOUT_COMMAND_VALUE, command);
|
||||
|
||||
@Test(dataProvider = "inValidSymbols")
|
||||
public void symbolsShouldBeInvalidForYaml(InvalidSymbolCommand command) throws Exception {
|
||||
String content = format(RECIPE_WITHOUT_COMMAND_VALUE, command.getCommand());
|
||||
try {
|
||||
composeEnvironmentParser.parse(content, "application/x-yaml");
|
||||
} catch (Exception e) {
|
||||
System.out.println(e.getLocalizedMessage());
|
||||
throw e;
|
||||
// it should fail.
|
||||
fail("The command " + command.getCommand() + " has invalid symbol and it should fail");
|
||||
} catch (ReaderException e) {
|
||||
// we're checking the exception there without throwing it, else it will print to testng-results.xml file an invalid symbol, thus the xml will be invalid.
|
||||
assertEquals(e.getMessage(), "special characters are not allowed");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -199,19 +199,36 @@ public class CommandDeserializerTest {
|
|||
@DataProvider(name = "inValidSymbols")
|
||||
private Object[][] inValidSymbols() {
|
||||
return new Object[][] {
|
||||
{"service mysql start\uFFFE"},
|
||||
{"service mysql start\uDFFF"},
|
||||
{"service mysql start\uD800"},
|
||||
{"service mysql start\u009F"},
|
||||
{"service mysql start\u0086"},
|
||||
{"service mysql start\u0084"},
|
||||
{"service mysql start\u0084"},
|
||||
{"service mysql start\u007F"},
|
||||
{"service mysql start\u001F"},
|
||||
{"service mysql start\u000E"},
|
||||
{"service mysql start\u000C"},
|
||||
{"service mysql start\u000B"},
|
||||
{"service mysql start\u0008"},
|
||||
{new InvalidSymbolCommand("service mysql start\uFFFE")},
|
||||
{new InvalidSymbolCommand("service mysql start\uDFFF")},
|
||||
{new InvalidSymbolCommand("service mysql start\uD800")},
|
||||
{new InvalidSymbolCommand("service mysql start\u009F")},
|
||||
{new InvalidSymbolCommand("service mysql start\u0086")},
|
||||
{new InvalidSymbolCommand("service mysql start\u0084")},
|
||||
{new InvalidSymbolCommand("service mysql start\u0084")},
|
||||
{new InvalidSymbolCommand("service mysql start\u007F")},
|
||||
{new InvalidSymbolCommand("service mysql start\u001F")},
|
||||
{new InvalidSymbolCommand("service mysql start\u000E")},
|
||||
{new InvalidSymbolCommand("service mysql start\u000C")},
|
||||
{new InvalidSymbolCommand("service mysql start\u000B")},
|
||||
{new InvalidSymbolCommand("service mysql start\u0008")},
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Use of a custom class for the command, so the DataProvider is not printing the string containing invalid characters in the
|
||||
* testng-results.xml file
|
||||
*/
|
||||
private class InvalidSymbolCommand {
|
||||
|
||||
private final String command;
|
||||
|
||||
InvalidSymbolCommand(String command) {
|
||||
this.command = command;
|
||||
}
|
||||
|
||||
String getCommand() {
|
||||
return this.command;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,11 +16,11 @@
|
|||
<parent>
|
||||
<artifactId>che-parent</artifactId>
|
||||
<groupId>org.eclipse.che</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
<artifactId>che-infrastructures-parent</artifactId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
<name>Che Infrastructures Parent</name>
|
||||
<modules>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<parent>
|
||||
<artifactId>che-plugin-composer-parent</artifactId>
|
||||
<groupId>org.eclipse.che.plugin</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>che-plugin-composer-ide</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<parent>
|
||||
<artifactId>che-plugin-composer-parent</artifactId>
|
||||
<groupId>org.eclipse.che.plugin</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>che-plugin-composer-server</artifactId>
|
||||
<name>Che Plugin :: Composer :: Server</name>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<parent>
|
||||
<artifactId>che-plugin-composer-parent</artifactId>
|
||||
<groupId>org.eclipse.che.plugin</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>che-plugin-composer-shared</artifactId>
|
||||
<name>Che Plugin :: Composer :: Shared</name>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<parent>
|
||||
<artifactId>che-plugin-parent</artifactId>
|
||||
<groupId>org.eclipse.che.plugin</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
<artifactId>che-plugin-composer-parent</artifactId>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<parent>
|
||||
<artifactId>che-plugin-cpp-parent</artifactId>
|
||||
<groupId>org.eclipse.che.plugin</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>che-plugin-cpp-lang-ide</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<parent>
|
||||
<artifactId>che-plugin-cpp-parent</artifactId>
|
||||
<groupId>org.eclipse.che.plugin</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>che-plugin-cpp-lang-server</artifactId>
|
||||
<name>Che Plugin :: C/C++ :: Extension Server</name>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<parent>
|
||||
<artifactId>che-plugin-cpp-parent</artifactId>
|
||||
<groupId>org.eclipse.che.plugin</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>che-plugin-cpp-lang-shared</artifactId>
|
||||
<name>Che Plugin :: C/C++ :: Shared</name>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<parent>
|
||||
<artifactId>che-plugin-parent</artifactId>
|
||||
<groupId>org.eclipse.che.plugin</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
<artifactId>che-plugin-cpp-parent</artifactId>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<parent>
|
||||
<artifactId>che-plugin-csharp-parent</artifactId>
|
||||
<groupId>org.eclipse.che.plugin</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>che-plugin-csharp-lang-ide</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<parent>
|
||||
<artifactId>che-plugin-csharp-parent</artifactId>
|
||||
<groupId>org.eclipse.che.plugin</groupId>
|
||||
<version>5.12.0-SNAPSHOT</version>
|
||||
<version>5.13.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>che-plugin-csharp-lang-server</artifactId>
|
||||
<name>Che Plugin :: C# :: Extension Server</name>
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue