diff --git a/vscode-extensions/commons/commons-util/src/main/java/org/springframework/ide/vscode/commons/util/EnumValueParser.java b/vscode-extensions/commons/commons-util/src/main/java/org/springframework/ide/vscode/commons/util/EnumValueParser.java index 212a3c5e8..97827e0c0 100644 --- a/vscode-extensions/commons/commons-util/src/main/java/org/springframework/ide/vscode/commons/util/EnumValueParser.java +++ b/vscode-extensions/commons/commons-util/src/main/java/org/springframework/ide/vscode/commons/util/EnumValueParser.java @@ -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); } } diff --git a/vscode-extensions/vscode-manifest-yaml/src/main/java/org/springframework/ide/vscode/manifest/yaml/ManifestYmlSchema.java b/vscode-extensions/vscode-manifest-yaml/src/main/java/org/springframework/ide/vscode/manifest/yaml/ManifestYmlSchema.java index a13fe80ca..6f826fa6e 100644 --- a/vscode-extensions/vscode-manifest-yaml/src/main/java/org/springframework/ide/vscode/manifest/yaml/ManifestYmlSchema.java +++ b/vscode-extensions/vscode-manifest-yaml/src/main/java/org/springframework/ide/vscode/manifest/yaml/ManifestYmlSchema.java @@ -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) { diff --git a/vscode-extensions/vscode-manifest-yaml/src/main/resources/description-by-prop-name/health-check-type.html b/vscode-extensions/vscode-manifest-yaml/src/main/resources/description-by-prop-name/health-check-type.html new file mode 100644 index 000000000..30be9affb --- /dev/null +++ b/vscode-extensions/vscode-manifest-yaml/src/main/resources/description-by-prop-name/health-check-type.html @@ -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 +\ No newline at end of file diff --git a/vscode-extensions/vscode-manifest-yaml/src/main/resources/description-by-prop-name/health-check-type.md b/vscode-extensions/vscode-manifest-yaml/src/main/resources/description-by-prop-name/health-check-type.md new file mode 100644 index 000000000..fac9be7d7 --- /dev/null +++ b/vscode-extensions/vscode-manifest-yaml/src/main/resources/description-by-prop-name/health-check-type.md @@ -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 +``` diff --git a/vscode-extensions/vscode-manifest-yaml/src/test/java/org/springframework/ide/vscode/manifest/yaml/ManifestYamlEditorTest.java b/vscode-extensions/vscode-manifest-yaml/src/test/java/org/springframework/ide/vscode/manifest/yaml/ManifestYamlEditorTest.java index c305344a2..ab1cb793c 100644 --- a/vscode-extensions/vscode-manifest-yaml/src/test/java/org/springframework/ide/vscode/manifest/yaml/ManifestYamlEditorTest.java +++ b/vscode-extensions/vscode-manifest-yaml/src/test/java/org/springframework/ide/vscode/manifest/yaml/ManifestYamlEditorTest.java @@ -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"); } ////////////////////////////////////////////////////////////////////////////// diff --git a/vscode-extensions/vscode-manifest-yaml/src/test/java/org/springframework/ide/vscode/manifest/yaml/ManifestYmlSchemaTest.java b/vscode-extensions/vscode-manifest-yaml/src/test/java/org/springframework/ide/vscode/manifest/yaml/ManifestYmlSchemaTest.java index 97ec0d2b1..b2d59e0b6 100644 --- a/vscode-extensions/vscode-manifest-yaml/src/test/java/org/springframework/ide/vscode/manifest/yaml/ManifestYmlSchemaTest.java +++ b/vscode-extensions/vscode-manifest-yaml/src/test/java/org/springframework/ide/vscode/manifest/yaml/ManifestYmlSchemaTest.java @@ -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",