Test disabling SNIExtension due to failing concourse tests

Some tests are failing in concourse due to handshake alert:
unrecognized_name
This commit is contained in:
nsingh
2017-02-06 12:57:23 -08:00
parent 6b93599ee8
commit 5c5fed3bc9

View File

@@ -21,6 +21,7 @@ import org.springframework.ide.vscode.commons.maven.MavenBuilder;
import org.springframework.ide.vscode.commons.maven.MavenCore;
import org.springframework.ide.vscode.commons.maven.java.MavenJavaProject;
import org.springframework.ide.vscode.commons.maven.java.classpathfile.JavaProjectWithClasspathFile;
import org.springframework.ide.vscode.commons.util.ExceptionUtil;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
@@ -61,6 +62,11 @@ public class ProjectsHarness {
});
}
protected void enableSNIExtension(boolean enable) {
String enableVal = Boolean.toString(enable);
System.setProperty("jsse.enableSNIExtension", enableVal);
}
protected Path getProjectPath(String name) throws URISyntaxException, IOException {
// URI sourceLocation = ProjectsHarness.class.getProtectionDomain().getCodeSource().getLocation().toURI();
// // file:/Users/aboyko/git/sts4/vscode-extensions/commons/project-test-harness/target/project-test-harness-0.0.1-SNAPSHOT.jar
@@ -152,7 +158,23 @@ public class ProjectsHarness {
// }
public MavenJavaProject mavenProject(String name) throws Exception {
return (MavenJavaProject) project(ProjectType.MAVEN, name);
try {
return (MavenJavaProject) project(ProjectType.MAVEN, name);
} catch (Exception e) {
// For maven, on concourse builds sometimes a handshake a
// Disable SNI
/// Possible SSL handshake issue when some server return "unrecognised name".
// Workaroud seems to disable SNI Extension before the project actually gets used
String message = ExceptionUtil.getMessage(e);
if (message != null && message.contains("unrecognized_name")) {
boolean enable = false;
enableSNIExtension(enable);
return (MavenJavaProject) project(ProjectType.MAVEN, name);
}
else {
throw e;
}
}
}
public IJavaProject javaProjectWithClasspathFile(String name) throws Exception {