Package org.raml.parser.visitor

Examples of org.raml.parser.visitor.YamlDocumentSuggester.suggest()


        String topSection = "#%RAML 0.8\n" +
                            "title: one\n" +
                            "/ResourceName:";

        YamlDocumentSuggester yamlDocumentSuggester = new YamlDocumentSuggester(new RamlDocumentBuilder());
        List<Suggestion> suggest = yamlDocumentSuggester.suggest(topSection, " ");
        assertThat(suggest, notNullValue());
        assertThat(suggest.isEmpty(), is(false));
        assertThat(suggest.contains(new KeySuggestion("is")), is(true));
        assertThat(suggest.contains(new KeySuggestion("delete")), is(true));
        assertThat(suggest.contains(new KeySuggestion("get")), is(true));
View Full Code Here


        String topSection = "#%RAML 0.8\n" +
                            "title: one\n" +
                            "/ResourceName:";

        YamlDocumentSuggester yamlDocumentSuggester = new YamlDocumentSuggester(new RamlDocumentBuilder());
        List<Suggestion> suggest = yamlDocumentSuggester.suggest(topSection, " del");
        assertThat(suggest, notNullValue());
        assertThat(suggest.size(), is(1));
        assertThat(suggest.contains(new KeySuggestion("delete")), is(true));
        assertThat(suggest.get(0).getIndentation(), is(-1));
    }
View Full Code Here

    @Test
    public void action()
    {
        YamlDocumentSuggester yamlDocumentSuggester = new YamlDocumentSuggester(new RamlDocumentBuilder());
        List<Suggestion> suggest = yamlDocumentSuggester.suggest(HEADER, "  ");
        assertThat(suggest, notNullValue());
        assertThat(suggest.size(), is(ACTION_SUGGEST_COUNT - 1));
        assertThat(suggest.contains(new KeySuggestion("headers")), is(false));
        assertThat(suggest.contains(new KeySuggestion("queryParameters")), is(true));
        assertThat(suggest.get(0).getIndentation(), is(2));
View Full Code Here

    @Test
    public void actionHeaderParam()
    {
        YamlDocumentSuggester yamlDocumentSuggester = new YamlDocumentSuggester(new RamlDocumentBuilder());
        List<Suggestion> suggest = yamlDocumentSuggester.suggest(HEADER, "    ");
        assertThat(suggest, notNullValue());
        assertThat(suggest.isEmpty(), is(false));
        assertThat(suggest.contains(new KeySuggestion("required")), is(true));
        assertThat(suggest.contains(new KeySuggestion("default")), is(true));
        assertThat(suggest.get(0).getIndentation(), is(-1));
View Full Code Here

                            "/ResourceName:\n" +
                            "  put:\n" +
                            "    body:";

        YamlDocumentSuggester yamlDocumentSuggester = new YamlDocumentSuggester(new RamlDocumentBuilder());
        List<Suggestion> suggest = yamlDocumentSuggester.suggest(topSection, "      ");
        assertThat(suggest.isEmpty(), is(false));
        assertThat(suggest.size(), is(BODY_SUGGEST_COUNT));
        assertThat(suggest.contains(new KeySuggestion("application/json")), is(true));
        assertThat(suggest.contains(new KeySuggestion("application/xml")), is(true));
        assertThat(suggest.contains(new KeySuggestion("application/x-www-form-urlencoded")), is(true));
View Full Code Here

                            "  responses:\n" +
                            "   200:\n" +
                            "    body:";

        YamlDocumentSuggester yamlDocumentSuggester = new YamlDocumentSuggester(new RamlDocumentBuilder());
        List<Suggestion> suggest = yamlDocumentSuggester.suggest(topSection, "     ");
        assertThat(suggest.isEmpty(), is(false));
        assertThat(suggest.size(), is(BODY_SUGGEST_COUNT));
        assertThat(suggest.contains(new KeySuggestion("application/json")), is(true));
        assertThat(suggest.contains(new KeySuggestion("application/xml")), is(true));
        assertThat(suggest.contains(new KeySuggestion("application/x-www-form-urlencoded")), is(true));
View Full Code Here

                            "/ResourceName:\n" +
                            " put:\n" +
                            "  responses:";

        YamlDocumentSuggester yamlDocumentSuggester = new YamlDocumentSuggester(new RamlDocumentBuilder());
        List<Suggestion> suggest = yamlDocumentSuggester.suggest(topSection, "   ");
        assertThat(suggest.isEmpty(), is(false));
        assertThat(suggest.size(), is(RESPONSES_SUGGEST_COUNT));
        assertThat(suggest.contains(new KeySuggestion("200")), is(true));
        assertThat(suggest.contains(new KeySuggestion("201")), is(true));
        assertThat(suggest.contains(new KeySuggestion("400")), is(true));
View Full Code Here

    @Test
    public void nonAlignedPosition()
    {
        YamlDocumentSuggester yamlDocumentSuggester = new YamlDocumentSuggester(new RamlDocumentBuilder());
        List<Suggestion> suggest = yamlDocumentSuggester.suggest(HEADER_FOUR_SPACE, "  ");
        assertThat(suggest, notNullValue());
        assertThat(suggest.size(), is(RESOURCE_SUGGEST_COUNT - 3));
        assertThat(suggest.contains(new KeySuggestion("delete")), is(true));
        assertThat(suggest.get(0).getIndentation(), is(4));
    }
View Full Code Here

        String topSection = "#%RAML 0.8\n" +
                            "tilte: Sample API\n" +
                            "versionn: one";

        YamlDocumentSuggester yamlDocumentSuggester = new YamlDocumentSuggester(new RamlDocumentBuilder());
        List<Suggestion> suggest = yamlDocumentSuggester.suggest(topSection, "");
        assertThat(suggest, notNullValue());
        assertThat(suggest.isEmpty(), is(false));
        assertThat(suggest.contains(new KeySuggestion("version")), is(true));
        assertThat(suggest.get(0).getIndentation(), is(0));
    }
View Full Code Here

    {
        String topSection = "#%RAML 0.8\n" +
                            "title: !include title.txt";

        YamlDocumentSuggester yamlDocumentSuggester = new YamlDocumentSuggester(new RamlDocumentBuilder());
        List<Suggestion> suggest = yamlDocumentSuggester.suggest(topSection, "", "");
        assertThat(suggest, notNullValue());
        assertThat(suggest.size(), is(ROOT_SUGGEST_COUNT - 1));
        assertThat(suggest.contains(new KeySuggestion("version")), is(true));
        assertThat(suggest.contains(new KeySuggestion("title")), is(false));
        assertThat(suggest.get(0).getIndentation(), is(0));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.