Moved commons and concourse editor to 'headless-services'

This commit is contained in:
Kris De Volder
2017-04-06 16:27:12 -07:00
parent 3abf189512
commit bf8f8cffa9
608 changed files with 600 additions and 51 deletions

View File

@@ -0,0 +1,51 @@
/*******************************************************************************
* Copyright (c) 2016-2017 Pivotal, 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:
* Pivotal, Inc. - initial API and implementation
*******************************************************************************/
package org.springframework.ide.vscode.concourse;
import static org.assertj.core.api.Assertions.assertThat;
import java.io.File;
import java.net.URISyntaxException;
import java.nio.file.Paths;
import org.eclipse.lsp4j.InitializeResult;
import org.eclipse.lsp4j.TextDocumentSyncKind;
import org.junit.Test;
import org.springframework.ide.vscode.concourse.ConcourseLanguageServer;
import org.springframework.ide.vscode.languageserver.testharness.LanguageServerHarness;
public class ConcourseLanguageServerTest {
public static File getTestResource(String name) throws URISyntaxException {
return Paths.get(ConcourseLanguageServerTest.class.getResource(name).toURI()).toFile();
}
@Test
public void createAndInitializeServerWithWorkspace() throws Exception {
LanguageServerHarness harness = new LanguageServerHarness(ConcourseLanguageServer::new);
File workspaceRoot = getTestResource("/workspace/");
assertExpectedInitResult(harness.intialize(workspaceRoot));
}
@Test
public void createAndInitializeServerWithoutWorkspace() throws Exception {
File workspaceRoot = null;
LanguageServerHarness harness = new LanguageServerHarness(ConcourseLanguageServer::new);
assertExpectedInitResult(harness.intialize(workspaceRoot));
}
private void assertExpectedInitResult(InitializeResult initResult) {
assertThat(initResult.getCapabilities().getCompletionProvider().getResolveProvider()).isFalse();
assertThat(initResult.getCapabilities().getTextDocumentSync().getLeft()).isEqualTo(TextDocumentSyncKind.Incremental);
}
}

View File

@@ -0,0 +1,48 @@
/*******************************************************************************
* Copyright (c) 2016 Pivotal, 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:
* Pivotal, Inc. - initial API and implementation
*******************************************************************************/
package org.springframework.ide.vscode.concourse;
import static org.junit.Assert.fail;
import org.junit.Test;
import org.springframework.ide.vscode.commons.util.ExceptionUtil;
import org.springframework.ide.vscode.commons.util.ValueParser;
import static org.springframework.ide.vscode.languageserver.testharness.TestAsserts.*;
public class DurationParserTest {
private ValueParser parser = ConcourseValueParsers.DURATION;
@Test
public void goodExamples() throws Exception {
parser.parse("1h40m");
parser.parse("1.5h");
parser.parse("23h59m59s99ms200µs100ns");
}
@Test
public void badExamples() {
does_not_parse("1h:40m");
does_not_parse("15h 30m");
does_not_parse("23hours");
}
private void does_not_parse(String string) {
try {
parser.parse(string);
fail("Should have failed parsing!");
} catch (Exception e) {
assertContains("Duration", ExceptionUtil.getMessage(e));
}
}
}

View File

@@ -0,0 +1,92 @@
/*******************************************************************************
* Copyright (c) 2017 Pivotal, 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:
* Pivotal, Inc. - initial API and implementation
*******************************************************************************/
package org.springframework.ide.vscode.concourse;
import static org.junit.Assert.fail;
import static org.springframework.ide.vscode.languageserver.testharness.TestAsserts.assertContains;
import org.junit.Test;
import org.springframework.ide.vscode.commons.util.ExceptionUtil;
import org.springframework.ide.vscode.commons.util.ValueParser;
public class TimeOfDayParserTest {
private ValueParser parser = ConcourseValueParsers.TIME_OF_DAY;
@Test
public void goodExamples() throws Exception {
String[] examples = {
"3:04 PM -0700",
"3:04 PM +0700",
"3:04 AM +0700",
"00:00 AM +0700",
"23:59 PM +0800",
"3PM -0700",
"0AM +0800",
"24AM +0800",
"3 PM -0700",
"0 AM -0700",
"24 PM -1234",
"15:04 -0700",
"0:00 -0700",
"23:59 -0700",
"304 -0700",
"1504 -0700",
"0004 -0700",
"2359 -0700",
"3:04 PM",
"0:00 AM",
"11:59 PM",
"3PM",
"1AM",
"23PM",
"3 PM",
"1 AM",
"23 PM",
"15:04",
"0:00",
"00:00",
"23:59",
"1504",
"0000",
"2359"
};
for (String string : examples) {
System.out.println(string);
parser.parse(string);
}
}
@Test
public void badExamples() {
does_not_parse("arbirary garbage");
does_not_parse("3:04 PM -0700 extra");
}
private void does_not_parse(String string) {
try {
parser.parse(string);
fail("Should have failed parsing!");
} catch (Exception e) {
assertContains("Time", ExceptionUtil.getMessage(e));
}
}
}

View File

@@ -0,0 +1,23 @@
resources:
- name: sts4
type: git
source:
repository: https://github.com/kdvolder/somestuff
- name: other-repo
type: git
source:
repository: https://github.com/kdvolder/somestuff
- name: more-stuff
type: git
source:
repository: https://github.com/kdvolder/somestuff
jobs:
- name: job1
plan:
- get: sts4
- task: do-stuff
input_mapping:
task_input: bogus_input
repo: sts4
- get: bogus-get
- put: bogus-put

View File

@@ -0,0 +1,115 @@
##########################################################
resource_types:
- name: s3-multi
type: docker-image
source:
repository: kdvolder/s3-resource-simple
- name: slack-notification
type: docker-image
source:
repository: cfcommunity/slack-notification-resource
tag: latest
#########################################################
resources:
- name: docker-git
type: git
source:
uri: git@github.com:spring-projects/sts4.git
branch: {{branch}}
username: kdvolder
private_key: {{rsa_id}}
paths:
- concourse/docker
- name: sts4
type: git
source:
uri: git@github.com:spring-projects/sts4.git
branch: {{branch}}
private_key: {{rsa_id}}
- name: s3-boot-properties-vsix
type: s3
source:
bucket: {{s3_bucket}}
access_key_id: {{s3_accesskey}}
secret_access_key: {{s3_secretkey}}
region_name: {{s3_region}}
regexp: sts4/vscode-extensions/vscode-boot-properties-(.*).vsix
- name: s3-manifest-yaml-vsix
type: s3
source:
bucket: {{s3_bucket}}
access_key_id: {{s3_accesskey}}
secret_access_key: {{s3_secretkey}}
region_name: {{s3_region}}
regexp: sts4/vscode-extensions/vscode-manifest-yaml-(.*).vsix
- name: website
type: s3-multi
source:
bucket: {{s3_prod_bucket}}
access_key_id: {{s3_prod_accesskey}}
secret_access_key: {{s3_prod_secretkey}}
region_name: {{s3_region}}
path: snapshot/STS4/vscode-extensions
options:
- "--acl public-read"
- name: slack-notification
type: slack-notification
source:
url: https://hooks.slack.com/services/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
- name: docker-image
type: docker-image
source:
username: {{docker_hub_username}}
password: {{docker_hub_password}}
repository: kdvolder/sts4-build-env
########################################################################################
jobs:
- name: build-docker-image
serial: true
plan:
- get: docker-git
trigger: true
- put: docker-image
params:
build: docker-git/concourse/docker
get_params:
skip_download: true
- name: build-vsix
plan:
- get: sts4
trigger: true
- task: build-vscode-extensions
file: sts4/concourse/tasks/build-vscode-extensions.yml
on_success:
aggregate:
- put: s3-manifest-yaml-vsix
params:
file: vsix-files/vscode-manifest-yaml-*.vsix
acl: public-read
- put: s3-boot-properties-vsix
params:
file: vsix-files/vscode-boot-properties-*.vsix
acl: public-read
on_failure:
put: slack-notification
params:
channel: "@kdvolder"
text: |
Concourse ${BUILD_PIPELINE_NAME}/${BUILD_JOB_NAME}/${BUILD_NAME} has failed!
- name: build-website
plan:
- aggregate:
- get: sts4
- get: s3-manifest-yaml-vsix
passed:
- build-vsix
trigger: true
- get: s3-boot-properties-vsix
passed:
- build-vsix
trigger: true
- task: build-website
file: sts4/concourse/tasks/build-website.yml
- put: website
params:
path: website

View File

@@ -0,0 +1,10 @@
#!/bin/bash
set -e
workdir=`pwd`
cd sts4/vscode-extensions
./build-all.sh
cd $workdir
cp `find sts4/vscode-extensions -name "*.vsix"` vsix-files

View File

@@ -0,0 +1,11 @@
inputs:
- name: sts4
outputs:
- name: vsix-files
platform: linux
image_resource:
type: docker-image
source:
repository: kdvolder/sts4-build-env
run:
path: "sts4/concourse/tasks/build-vscode-extensions.sh"

View File

@@ -0,0 +1,43 @@
#!/bin/bash
set -e
workdir=`pwd`
sources=$workdir/sts4/eclipse-distribution/common/html
target=$workdir/website
#cp -r "${sources}/stylesheet.css" "$target"
#cp -r ${sources}/*.js "$target"
#cp s3-manifest-yaml-vsix/*.vsix "$target"
#cp s3-boot-properties-vsix/*.vsix "$target"
export vscode_manifest_yaml=$(basename s3-manifest-yaml-vsix/*.vsix)
echo "vscode_manifest_yaml=$vscode_manifest_yaml"
export vscode_boot_properties=$(basename s3-boot-properties-vsix/*.vsix)
echo "vscode_boot_properties=$vscode_boot_properties"
envsubst > "$target/vscode-extensions-snippet.html" << XXXXXX
<ul>
<li>Spring Boot Property Language Server:
<a href="http://s3-test.spring.io/sts4/vscode-extensions/${vscode_boot_properties}">${vscode_boot_properties}</a>
</li>
<li>Cloud Foundry Manifest Language Server:
<a href="http://s3-test.spring.io/sts4/vscode-extensions/${vscode_manifest_yaml}">${vscode_manifest_yaml}</a>
</li>
</ul>
XXXXXX
export vscode_snippet=`cat "$target/vscode-extensions-snippet.html"`
envsubst > "$target/vscode-extensions.html" << XXXXXX
<!DOCTYPE html>
<html>
<body>
<h1>STS4 Vscode Extensions</h1>
$vscode_snippet
</body>
</html>
XXXXXX
cat $target/vscode-extensions.html

View File

@@ -0,0 +1,13 @@
inputs:
- name: sts4
- name: s3-manifest-yaml-vsix
- name: s3-boot-properties-vsix
outputs:
- name: website
platform: linux
image_resource:
type: docker-image
source:
repository: kdvolder/sts4-build-env
run:
path: "sts4/concourse/tasks/build-website.sh"