From c290646ff19479e9bd8fe3c9a497221d0139ab4a Mon Sep 17 00:00:00 2001 From: nsingh Date: Fri, 10 Feb 2017 13:58:06 -0800 Subject: [PATCH] Added routes property to manifest yaml schema --- .../manifest/yaml/ManifestYmlSchema.java | 1 + .../description-by-prop-name/routes.html | 12 +++++++++++ .../description-by-prop-name/routes.md | 14 +++++++++++++ .../manifest/yaml/ManifestYamlEditorTest.java | 20 +++++++++++++++++++ .../manifest/yaml/ManifestYmlSchemaTest.java | 2 ++ 5 files changed, 49 insertions(+) create mode 100644 vscode-extensions/vscode-manifest-yaml/src/main/resources/description-by-prop-name/routes.html create mode 100644 vscode-extensions/vscode-manifest-yaml/src/main/resources/description-by-prop-name/routes.md 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 1c2a46ec2..6672b8fdf 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 @@ -139,6 +139,7 @@ public class ManifestYmlSchema implements YamlSchema { f.yprop("no-route", t_boolean), f.yprop("path", t_path), f.yprop("random-route", t_boolean), + f.yprop("routes", t_strings), f.yprop("services", t_services), f.yprop("stack", t_string), f.yprop("timeout", t_pos_integer), diff --git a/vscode-extensions/vscode-manifest-yaml/src/main/resources/description-by-prop-name/routes.html b/vscode-extensions/vscode-manifest-yaml/src/main/resources/description-by-prop-name/routes.html new file mode 100644 index 000000000..49b219ea2 --- /dev/null +++ b/vscode-extensions/vscode-manifest-yaml/src/main/resources/description-by-prop-name/routes.html @@ -0,0 +1,12 @@ +

Use the routes attribute to provide multiple HTTP and TCP routes. Each route for this app is created if it does not already exist.

+

This attribute is a combination of push options that include --hostname, -d, and --route-path.

+
+---
+  ...
+  routes:
+  - route: example.com
+  - route: www.example.com/foo
+  - route: tcp-example.com:1234
+
+ +

The routes attribute cannot be used in conjunction with the following attributes: host, hosts, domain, domains, and no-hostname. An error will result.

diff --git a/vscode-extensions/vscode-manifest-yaml/src/main/resources/description-by-prop-name/routes.md b/vscode-extensions/vscode-manifest-yaml/src/main/resources/description-by-prop-name/routes.md new file mode 100644 index 000000000..754921e46 --- /dev/null +++ b/vscode-extensions/vscode-manifest-yaml/src/main/resources/description-by-prop-name/routes.md @@ -0,0 +1,14 @@ +Use the `routes` attribute to provide multiple HTTP and TCP routes. Each route for this app is created if it does not already exist. + +This attribute is a combination of `push` options that include `--hostname`, `-d`, and `--route-path`. + +``` +--- + ... + routes: + - route: example.com + - route: www.example.com/foo + - route: tcp-example.com:1234 +``` + +The `routes` attribute cannot be used in conjunction with the following attributes: `host`, `hosts`, `domain`, `domains`, and `no-hostname`. An error will result. \ No newline at end of file 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 94d089d50..fc228b671 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 @@ -279,6 +279,9 @@ public class ManifestYamlEditorTest { // --------------- "random-route: <*>", // --------------- + "routes:\n"+ + "- <*>", + // --------------- "services:\n"+ "- <*>", // --------------- @@ -354,6 +357,10 @@ public class ManifestYamlEditorTest { "- random-route: <*>", // --------------- "applications:\n" + + "- routes:\n"+ + " - <*>", + // --------------- + "applications:\n" + "- services:\n"+ " - <*>", // --------------- @@ -432,6 +439,8 @@ public class ManifestYamlEditorTest { " no-route: true\n" + " path: somepath/app.jar\n" + " random-route: true\n" + + " routes:\n" + + " - tcp-example.com:1234\n" + " services:\n" + " - instance_ABC\n" + " - instance_XYZ\n" + @@ -457,6 +466,7 @@ public class ManifestYamlEditorTest { editor.assertIsHoverRegion("no-route"); editor.assertIsHoverRegion("path"); editor.assertIsHoverRegion("random-route"); + editor.assertIsHoverRegion("routes"); editor.assertIsHoverRegion("services"); editor.assertIsHoverRegion("stack"); editor.assertIsHoverRegion("timeout"); @@ -479,6 +489,7 @@ public class ManifestYamlEditorTest { editor.assertHoverContains("no-route", "You can use the `no-route` attribute with a value of `true` to prevent a route from being created for your application"); editor.assertHoverContains("path", "You can use the `path` attribute to tell Cloud Foundry where to find your application"); editor.assertHoverContains("random-route", "Use the `random-route` attribute to create a URL that includes the app name and random words"); + editor.assertHoverContains("routes", "Each route for this app is created if it does not already exist"); 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"); @@ -596,6 +607,10 @@ public class ManifestYamlEditorTest { "- random-route: <*>", // --------------- "applications:\n" + + "- routes:\n"+ + " - <*>", + // --------------- + "applications:\n" + "- services:\n"+ " - <*>", // --------------- @@ -680,6 +695,11 @@ public class ManifestYamlEditorTest { "- name: test" , // --------------------- "applications:\n" + + "- routes:\n" + + " - <*>\n" + + "- name: test" + ,// --------------------- + "applications:\n" + "- services:\n" + " - <*>\n" + "- name: test" 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 a1e726ee9..1c98a65bd 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 @@ -55,6 +55,7 @@ public class ManifestYmlSchemaTest { "no-route", "path", "random-route", + "routes", "services", "stack", "timeout" @@ -79,6 +80,7 @@ public class ManifestYmlSchemaTest { "no-route", "path", "random-route", + "routes", "services", "stack", "timeout"