-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add base URL preference for CLI downloads and only download CLI…
… [HEAD-779] (#151) * feat: download CLI instead of LS * feat: add baseURL preference * docs: update Changelog * fix: show download in progress, change preference to a string field, use base url without cli * fix: test * chore: delete obsolete LsMetadata class * fix: invalidThreadAccess * fix: small sanity fixes * feat: only block ui thread during initialization when wizard is shown * chore: remove superfluous LS_BINARY_KEY constant * refactor: rename some variables * chore: add test for default preferences * fix: cleanup mocks between test runs * fix: use temp dir for temp file * fix: create directories before download * fix: binary name construction in windows
- Loading branch information
1 parent
ddd6a1a
commit e0b255d
Showing
23 changed files
with
205 additions
and
244 deletions.
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
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
22 changes: 12 additions & 10 deletions
22
plugin/src/main/java/io/snyk/eclipse/plugin/utils/LsMetadataResponseHandler.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 |
---|---|---|
@@ -1,25 +1,27 @@ | ||
package io.snyk.eclipse.plugin.utils; | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import io.snyk.languageserver.download.LsMetadata; | ||
import org.apache.http.HttpResponse; | ||
import org.apache.http.client.ResponseHandler; | ||
|
||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.nio.charset.Charset; | ||
|
||
import org.apache.http.HttpResponse; | ||
import org.apache.http.client.ResponseHandler; | ||
|
||
public class LsMetadataResponseHandler implements ResponseHandler<LsMetadata> { | ||
private final ObjectMapper om = new ObjectMapper(); | ||
public class LsMetadataResponseHandler implements ResponseHandler<String> { | ||
|
||
public LsMetadataResponseHandler() { | ||
} | ||
|
||
@Override | ||
public LsMetadata handleResponse(HttpResponse httpResponse) { | ||
try (InputStream inputStream = httpResponse.getEntity().getContent()) { | ||
return om.readValue(inputStream, LsMetadata.class); | ||
public String handleResponse(HttpResponse httpResponse) { | ||
String latestCliSupportingLSProtocolVersion = "10"; | ||
InputStream inputStream; | ||
try { | ||
inputStream = httpResponse.getEntity().getContent(); | ||
latestCliSupportingLSProtocolVersion = new String(inputStream.readAllBytes(), Charset.defaultCharset()); | ||
} catch (UnsupportedOperationException | IOException e) { | ||
throw new RuntimeException(e); | ||
} | ||
return latestCliSupportingLSProtocolVersion; | ||
} | ||
} |
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
Oops, something went wrong.