forked from eclipse-che/che
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request eclipse-che#5 in CLD/slx.cloud-che from abhi.CHE6_…
…migration to master * commit '47fe46a34fa1df988ed61d46e5a478e0f67675b7': (156 commits) Fixed build errors eclipse-che#6331 disable key binding handle when any 'Window' opened (eclipse-che#8473) changed info about known issue (eclipse-che#8483) Avoid removal of non-test workspaces at the cleanup environment stage of selenium testing (eclipse-che#8481) Add changes in the methods of checking git-marker in the page object 'CodenvyEditor' updated the command Use nightly stack by default and -Pdev for development Changes pvc name to a prefix + 8 random characters init and cli images should not use tag from CHE (eclipse-che#8474) CHE-7581 Improved keycloak initialization (eclipse-che#8425) CHE-8240: Switch to project explorer tab for reavel resources action. (eclipse-che#8460) Selenium: Create selenium tests to cover the authorization on GitHub (eclipse-che#8395) apply formating for 'CreateNewPackagesWithHelpCreationJavaClassTest' selenium test (eclipse-che#8464) remove read 'preferences' in try/catch block (eclipse-che#8463) add project build to CheckAutocompleteFeaturesInTheTestFolderTest (eclipse-che#8457) Selenium: Add try/catch block for displaying "Known issue" with eclipse-che#8300 bug (eclipse-che#8454) add info about known issue to FileStructureNodesTest selenium test (eclipse-che#8452) Remove "source" field from stack object (eclipse-che#8407) Selenium: Fix unexpected fail of MacrosCommandsEditorTest selenium test (eclipse-che#8441) Fix formatting (eclipse-che#8447) ...
- Loading branch information
Showing
8,490 changed files
with
287,057 additions
and
20,184 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Copyright (c) 2012-2018 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: | ||
Red Hat, Inc. - 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>exec-agent-parent</artifactId> | ||
<groupId>org.eclipse.che</groupId> | ||
<version>6.0.0-M5-SNAPSHOT</version> | ||
</parent> | ||
<artifactId>che-exec-agent-client</artifactId> | ||
<packaging>jar</packaging> | ||
<name>Agent :: Exec :: Client</name> | ||
<dependencies> | ||
<dependency> | ||
<groupId>com.google.inject.extensions</groupId> | ||
<artifactId>guice-assistedinject</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>javax.inject</groupId> | ||
<artifactId>javax.inject</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.eclipse.che</groupId> | ||
<artifactId>che-exec-agent-shared</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.eclipse.che.core</groupId> | ||
<artifactId>che-core-api-core</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.eclipse.che.core</groupId> | ||
<artifactId>che-core-api-dto</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.eclipse.che.core</groupId> | ||
<artifactId>che-core-api-workspace</artifactId> | ||
</dependency> | ||
</dependencies> | ||
</project> |
137 changes: 137 additions & 0 deletions
137
...he-exec-agent-client/src/main/java/org/eclipse/che/agent/exec/client/ExecAgentClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
/* | ||
* Copyright (c) 2012-2018 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: | ||
* Red Hat, Inc. - initial API and implementation | ||
*/ | ||
package org.eclipse.che.agent.exec.client; | ||
|
||
import static org.eclipse.che.dto.server.DtoFactory.newDto; | ||
|
||
import com.google.inject.assistedinject.Assisted; | ||
import java.io.IOException; | ||
import java.util.List; | ||
import javax.inject.Inject; | ||
import org.eclipse.che.agent.exec.shared.dto.GetProcessLogsResponseDto; | ||
import org.eclipse.che.agent.exec.shared.dto.GetProcessResponseDto; | ||
import org.eclipse.che.agent.exec.shared.dto.ProcessKillResponseDto; | ||
import org.eclipse.che.agent.exec.shared.dto.ProcessStartRequestDto; | ||
import org.eclipse.che.agent.exec.shared.dto.ProcessStartResponseDto; | ||
import org.eclipse.che.api.core.ApiException; | ||
import org.eclipse.che.api.core.ServerException; | ||
import org.eclipse.che.api.core.rest.HttpJsonRequestFactory; | ||
import org.eclipse.che.api.workspace.server.token.MachineTokenException; | ||
import org.eclipse.che.api.workspace.server.token.MachineTokenProvider; | ||
|
||
/** | ||
* Helps to interact with exec agent via REST. | ||
* | ||
* @author Max Shaposhnik (mshaposh@redhat.com) | ||
*/ | ||
public class ExecAgentClient { | ||
|
||
private final HttpJsonRequestFactory requestFactory; | ||
private final MachineTokenProvider machineTokenProvider; | ||
private final String serverEndpoint; | ||
|
||
@Inject | ||
public ExecAgentClient( | ||
HttpJsonRequestFactory requestFactory, | ||
MachineTokenProvider machineTokenProvider, | ||
@Assisted String serverEndpoint) { | ||
this.requestFactory = requestFactory; | ||
this.machineTokenProvider = machineTokenProvider; | ||
this.serverEndpoint = serverEndpoint; | ||
} | ||
|
||
/** | ||
* Starts a process within a given command. | ||
* | ||
* @param workspaceId workspace to run command | ||
* @param command command to execute | ||
* @param name command name | ||
* @param type command type | ||
* @return start process response DTO | ||
* @throws ServerException when submit of the process is failed | ||
*/ | ||
public ProcessStartResponseDto startProcess( | ||
String workspaceId, String command, String name, String type) throws ServerException { | ||
ProcessStartRequestDto commandDto = | ||
newDto(ProcessStartRequestDto.class).withCommandLine(command).withName(name).withType(type); | ||
try { | ||
return requestFactory | ||
.fromUrl(serverEndpoint) | ||
.addQueryParam("token", machineTokenProvider.getToken(workspaceId)) | ||
.setAuthorizationHeader("none") // to prevent sending KC token | ||
.usePostMethod() | ||
.setBody(commandDto) | ||
.request() | ||
.asDto(ProcessStartResponseDto.class); | ||
} catch (IOException | ApiException | MachineTokenException e) { | ||
throw new ServerException(e); | ||
} | ||
} | ||
|
||
/** | ||
* Gets information about started process. | ||
* | ||
* @param workspaceId workspace to get process | ||
* @param pid pid of started process | ||
* @return process response DTO | ||
* @throws ServerException when get of the process is failed | ||
*/ | ||
public GetProcessResponseDto getProcess(String workspaceId, int pid) throws ServerException { | ||
try { | ||
return requestFactory | ||
.fromUrl(serverEndpoint + "/" + pid) | ||
.addQueryParam("token", machineTokenProvider.getToken(workspaceId)) | ||
.setAuthorizationHeader("none") // to prevent sending KC token | ||
.useGetMethod() | ||
.request() | ||
.asDto(GetProcessResponseDto.class); | ||
} catch (IOException | ApiException | MachineTokenException e) { | ||
throw new ServerException(e); | ||
} | ||
} | ||
|
||
/** | ||
* Kills started process. | ||
* | ||
* @param workspaceId workspace kill process | ||
* @param pid pid of started process | ||
* @return kill process response DTO | ||
* @throws ServerException when kill of the process is failed | ||
*/ | ||
public ProcessKillResponseDto killProcess(String workspaceId, int pid) throws ServerException { | ||
try { | ||
return requestFactory | ||
.fromUrl(serverEndpoint + "/" + pid) | ||
.useDeleteMethod() | ||
.addQueryParam("token", machineTokenProvider.getToken(workspaceId)) | ||
.setAuthorizationHeader("none") // to prevent sending KC token | ||
.request() | ||
.asDto(ProcessKillResponseDto.class); | ||
} catch (IOException | ApiException | MachineTokenException e) { | ||
throw new ServerException(e); | ||
} | ||
} | ||
|
||
public List<GetProcessLogsResponseDto> getProcessLogs(String workspaceId, int pid) | ||
throws ServerException { | ||
try { | ||
return requestFactory | ||
.fromUrl(serverEndpoint + '/' + pid + '/' + "logs") | ||
.addQueryParam("token", machineTokenProvider.getToken(workspaceId)) | ||
.setAuthorizationHeader("none") // to prevent sending KC token | ||
.useGetMethod() | ||
.request() | ||
.asList(GetProcessLogsResponseDto.class); | ||
} catch (IOException | ApiException | MachineTokenException e) { | ||
throw new ServerException(e); | ||
} | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
...-agent-client/src/main/java/org/eclipse/che/agent/exec/client/ExecAgentClientFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* Copyright (c) 2012-2018 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: | ||
* Red Hat, Inc. - initial API and implementation | ||
*/ | ||
package org.eclipse.che.agent.exec.client; | ||
|
||
/** | ||
* Creates instances of {@link ExecAgentClient} with given exec server endpoint. | ||
* | ||
* @author Max Shaposhnik (mshaposh@redhat.com) | ||
*/ | ||
public interface ExecAgentClientFactory { | ||
|
||
ExecAgentClient create(String serverEndpoint); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Copyright (c) 2012-2018 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: | ||
Red Hat, Inc. - 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>exec-agent-parent</artifactId> | ||
<groupId>org.eclipse.che</groupId> | ||
<version>6.0.0-M5-SNAPSHOT</version> | ||
</parent> | ||
<artifactId>che-exec-agent-shared</artifactId> | ||
<packaging>jar</packaging> | ||
<name>Agent :: Exec :: Shared</name> | ||
<properties> | ||
<dto-generator-out-directory>${project.build.directory}/generated-sources/dto/</dto-generator-out-directory> | ||
</properties> | ||
<dependencies> | ||
<dependency> | ||
<groupId>com.google.code.gson</groupId> | ||
<artifactId>gson</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.eclipse.che.core</groupId> | ||
<artifactId>che-core-api-dto</artifactId> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>build-helper-maven-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>add-resource</id> | ||
<phase>process-sources</phase> | ||
<goals> | ||
<goal>add-resource</goal> | ||
</goals> | ||
<configuration> | ||
<resources> | ||
<resource> | ||
<directory>${dto-generator-out-directory}/META-INF</directory> | ||
<targetPath>META-INF</targetPath> | ||
</resource> | ||
</resources> | ||
</configuration> | ||
</execution> | ||
<execution> | ||
<id>add-source</id> | ||
<phase>process-sources</phase> | ||
<goals> | ||
<goal>add-source</goal> | ||
</goals> | ||
<configuration> | ||
<sources> | ||
<source>${dto-generator-out-directory}</source> | ||
</sources> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>pre-compile</id> | ||
<phase>generate-sources</phase> | ||
<goals> | ||
<goal>compile</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.eclipse.che.core</groupId> | ||
<artifactId>che-core-api-dto-maven-plugin</artifactId> | ||
<version>${project.version}</version> | ||
<executions> | ||
<execution> | ||
<id>server</id> | ||
<phase>process-sources</phase> | ||
<goals> | ||
<goal>generate</goal> | ||
</goals> | ||
<configuration> | ||
<dtoPackages> | ||
<package>org.eclipse.che.agent.exec.shared.dto</package> | ||
</dtoPackages> | ||
<outputDirectory>${dto-generator-out-directory}</outputDirectory> | ||
<genClassName>org.eclipse.che.agent.exec.shared.dto.server.DtoServerImpls</genClassName> | ||
<impl>server</impl> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.eclipse.che</groupId> | ||
<artifactId>che-exec-agent-shared</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
</dependencies> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
Oops, something went wrong.