Merge branch 'master' of https://github.com/spring-projects/sts4
This commit is contained in:
@@ -44,6 +44,8 @@ import org.eclipse.lsp4j.services.TextDocumentService;
|
||||
import org.springframework.ide.vscode.commons.util.Assert;
|
||||
import org.springframework.ide.vscode.commons.util.Futures;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
public class SimpleTextDocumentService implements TextDocumentService {
|
||||
|
||||
private static final Logger LOG = Logger.getLogger(SimpleTextDocumentService.class.getName());
|
||||
@@ -167,7 +169,7 @@ public class SimpleTextDocumentService implements TextDocumentService {
|
||||
public final static CompletableFuture<CompletionList> NO_COMPLETIONS = Futures.of(
|
||||
new CompletionList(false, Collections.emptyList()));
|
||||
|
||||
public final static CompletableFuture<Hover> NO_HOVER = Futures.of(null);
|
||||
public final static CompletableFuture<Hover> NO_HOVER = Futures.of(new Hover(ImmutableList.of(), null));
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
@@ -38,7 +38,7 @@ public class EnumValueParser implements ValueParser {
|
||||
if (values.contains(str)) {
|
||||
return str;
|
||||
} else {
|
||||
throw new IllegalArgumentException("'"+str+"' is not valid for Enum '"+typeName+"'");
|
||||
throw new IllegalArgumentException("'"+str+"' is not valid for Enum '"+typeName+"'. Valid values are: "+values);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -63,6 +63,8 @@ public class ManifestYmlSchema implements YamlSchema {
|
||||
YAtomicType t_memory = f.yatomic("Memory");
|
||||
t_memory.addHints("256M", "512M", "1024M");
|
||||
t_memory.parseWith(ManifestYmlValueParsers.MEMORY);
|
||||
|
||||
YAtomicType t_health_check_type = f.yenum("Health Check Type", "none", "port");
|
||||
|
||||
YAtomicType t_strictly_pos_integer = f.yatomic("Strictly Positive Integer");
|
||||
t_strictly_pos_integer.parseWith(ManifestYmlValueParsers.integerAtLeast(1));
|
||||
@@ -94,7 +96,8 @@ public class ManifestYmlSchema implements YamlSchema {
|
||||
f.yprop("random-route", t_boolean),
|
||||
f.yprop("services", t_strings),
|
||||
f.yprop("stack", t_string),
|
||||
f.yprop("timeout", t_pos_integer)
|
||||
f.yprop("timeout", t_pos_integer),
|
||||
f.yprop("health-check-type", t_health_check_type)
|
||||
};
|
||||
|
||||
for (YTypedPropertyImpl prop : props) {
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<p>Use the <code>health-check-type</code> attribute to set the <code>health_check_type</code>
|
||||
flag to either <code>port</code> or <code>none</code>. If you do not provide
|
||||
a <code>health-check-type</code> attribute, it defaults to <code>port</code>.</p>
|
||||
|
||||
<pre>
|
||||
---
|
||||
...
|
||||
health-check-type: none
|
||||
</pre>
|
||||
@@ -0,0 +1,9 @@
|
||||
Use the `health-check-type` attribute to set the `health_check_type`
|
||||
flag to either `port` or `none`. If you do not provide a `health-check-type`
|
||||
attribute, it defaults to `port`.
|
||||
|
||||
```
|
||||
---
|
||||
...
|
||||
health-check-type: none
|
||||
```
|
||||
@@ -145,13 +145,15 @@ public class ManifestYamlEditorTest {
|
||||
" instances: not a number\n" +
|
||||
" no-route: notBool\n"+
|
||||
" memory: 1024\n" +
|
||||
" disk_quota: 2048\n"
|
||||
" disk_quota: 2048\n" +
|
||||
" health-check-type: unhealthy"
|
||||
);
|
||||
editor.assertProblems(
|
||||
"not a number|Positive Integer",
|
||||
"notBool|boolean",
|
||||
"1024|Memory",
|
||||
"2048|Memory"
|
||||
"2048|Memory",
|
||||
"unhealthy|Health Check Type"
|
||||
);
|
||||
|
||||
//check for 'range' errors:
|
||||
@@ -232,6 +234,8 @@ public class ManifestYamlEditorTest {
|
||||
"env:\n"+
|
||||
" <*>",
|
||||
// ---------------
|
||||
"health-check-type: <*>",
|
||||
// ---------------
|
||||
// "host: <*>",
|
||||
// ---------------
|
||||
// "hosts: \n"+
|
||||
@@ -297,6 +301,9 @@ public class ManifestYamlEditorTest {
|
||||
" <*>",
|
||||
// ---------------
|
||||
"applications:\n" +
|
||||
"- health-check-type: <*>",
|
||||
// ---------------
|
||||
"applications:\n" +
|
||||
"- host: <*>",
|
||||
// ---------------
|
||||
"applications:\n" +
|
||||
@@ -360,6 +367,11 @@ public class ManifestYamlEditorTest {
|
||||
"random-route: false<*>",
|
||||
"random-route: true<*>"
|
||||
);
|
||||
|
||||
assertCompletions("health-check-type: <*>",
|
||||
"health-check-type: none<*>",
|
||||
"health-check-type: port<*>"
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -392,7 +404,8 @@ public class ManifestYamlEditorTest {
|
||||
" - instance_ABC\n" +
|
||||
" - instance_XYZ\n" +
|
||||
" stack: cflinuxfs2\n" +
|
||||
" timeout: 80\n"
|
||||
" timeout: 80\n" +
|
||||
" health-check-type: none\n"
|
||||
);
|
||||
editor.assertIsHoverRegion("memory");
|
||||
editor.assertIsHoverRegion("inherit");
|
||||
@@ -414,6 +427,7 @@ public class ManifestYamlEditorTest {
|
||||
editor.assertIsHoverRegion("services");
|
||||
editor.assertIsHoverRegion("stack");
|
||||
editor.assertIsHoverRegion("timeout");
|
||||
editor.assertIsHoverRegion("health-check-type");
|
||||
|
||||
editor.assertHoverContains("memory", "Use the `memory` attribute to specify the memory limit");
|
||||
editor.assertHoverContains("1G", "Use the `memory` attribute to specify the memory limit");
|
||||
@@ -435,6 +449,7 @@ public class ManifestYamlEditorTest {
|
||||
editor.assertHoverContains("services", "The `services` block consists of a heading, then one or more service instance names");
|
||||
editor.assertHoverContains("stack", "Use the `stack` attribute to specify which stack to deploy your application to.");
|
||||
editor.assertHoverContains("timeout", "The `timeout` attribute defines the number of seconds Cloud Foundry allocates for starting your application");
|
||||
editor.assertHoverContains("health-check-type", "Use the `health-check-type` attribute to");
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -42,6 +42,7 @@ public class ManifestYmlSchemaTest {
|
||||
"domain",
|
||||
"domains",
|
||||
"env",
|
||||
"health-check-type",
|
||||
"host",
|
||||
"hosts",
|
||||
// "inherit",
|
||||
@@ -65,6 +66,7 @@ public class ManifestYmlSchemaTest {
|
||||
"domain",
|
||||
"domains",
|
||||
"env",
|
||||
"health-check-type",
|
||||
// "host",
|
||||
// "hosts",
|
||||
"inherit",
|
||||
|
||||
Reference in New Issue
Block a user