Package org.modeshape.sequencer.ddl

Examples of org.modeshape.sequencer.ddl.DdlTokenStream


    public void shouldParseFLOAT() {
        printTest("shouldParseFLOAT()");
        String typeString = getDataTypeString(DataTypes.DTYPE_FLOAT);
        String content = typeString;

        DdlTokenStream tokens = getTokens(content);

        DataType dType = parser.parse(tokens);

        Assert.assertNotNull("DataType was NOT found for Type = " + typeString, dType);
        Assert.assertEquals("Wrong DataType found", typeString, dType.getName());
View Full Code Here


    public void shouldParseREAL() {
        printTest("shouldParseREAL()");
        String typeString = getDataTypeString(DataTypes.DTYPE_REAL);
        String content = typeString;

        DdlTokenStream tokens = getTokens(content);

        DataType dType = parser.parse(tokens);

        Assert.assertNotNull("DataType was NOT found for Type = " + typeString, dType);
        Assert.assertEquals("Wrong DataType found", typeString, dType.getName());
View Full Code Here

    public void shouldParseDOUBLE_PRECISION() {
        printTest("shouldParseDOUBLE_PRECISION()");
        String typeString = getDataTypeString(DataTypes.DTYPE_DOUBLE_PRECISION);
        String content = typeString;

        DdlTokenStream tokens = getTokens(content);

        DataType dType = parser.parse(tokens);

        Assert.assertNotNull("DataType was NOT found for Type = " + typeString, dType);
        Assert.assertEquals("Wrong DataType found", typeString, dType.getName());
View Full Code Here

    public void shouldParseDATE() {
        printTest("shouldParseDATE()");
        String typeString = getDataTypeString(DataTypes.DTYPE_DATE);
        String content = typeString;

        DdlTokenStream tokens = getTokens(content);

        DataType dType = parser.parse(tokens);

        Assert.assertNotNull("DataType was NOT found for Type = " + typeString, dType);
        Assert.assertEquals("Wrong DataType found", typeString, dType.getName());
View Full Code Here

    public void shouldParseTIME() {
        printTest("shouldParseTIME()");
        String typeString = getDataTypeString(DataTypes.DTYPE_TIME);
        String content = typeString;

        DdlTokenStream tokens = getTokens(content);

        DataType dType = parser.parse(tokens);

        Assert.assertNotNull("DataType was NOT found for Type = " + typeString, dType);
        Assert.assertEquals("Wrong DataType found", typeString, dType.getName());
View Full Code Here

    public void shouldParseTIMESTAMP() {
        printTest("shouldParseTIMESTAMP()");
        String typeString = getDataTypeString(DataTypes.DTYPE_TIMESTAMP);
        String content = typeString;

        DdlTokenStream tokens = getTokens(content);

        DataType dType = parser.parse(tokens);

        Assert.assertNotNull("DataType was NOT found for Type = " + typeString, dType);
        Assert.assertEquals("Wrong DataType found", typeString, dType.getName());
View Full Code Here

    public void beforeEach() {
        parser = new DataTypeParser();
    }

    private DdlTokenStream getTokens( String content ) {
        DdlTokenStream tokens = new DdlTokenStream(content, DdlTokenStream.ddlTokenizer(false), false);

        tokens.start();

        return tokens;
    }
View Full Code Here

        Object actualValue = node.getProperty(name);
        assertThat(actualValue, is(expectedValue));
    }

    protected DdlTokenStream getTokens( final String content ) {
        final DdlTokenStream tokens = new DdlTokenStream(content, DdlTokenStream.ddlTokenizer(false), false);
        tokens.start();
        return tokens;
    }
View Full Code Here

    protected void parseColumns( DdlTokenStream tokens,
                                 AstNode tableNode,
                                 boolean isAlterTable ) throws ParsingException {
        String tableElementString = getTableElementsString(tokens, false);

        DdlTokenStream localTokens = new DdlTokenStream(tableElementString, DdlTokenStream.ddlTokenizer(false), false);

        localTokens.start();

        StringBuilder unusedTokensSB = new StringBuilder();

        do {
            if (isColumnDefinitionStart(localTokens)) {
                parseColumnDefinition(localTokens, tableNode, isAlterTable);
            } else {
                // THIS IS AN ERROR. NOTHING FOUND.
                // NEED TO absorb tokens
                unusedTokensSB.append(SPACE).append(localTokens.consume());
            }
        } while (localTokens.canConsume(COMMA));

        if (unusedTokensSB.length() > 0) {
            String msg = DdlSequencerI18n.unusedTokensParsingColumnDefinition.text(tableNode.getName());
            DdlParserProblem problem = new DdlParserProblem(Problems.WARNING, getCurrentMarkedPosition(), msg);
            problem.setUnusedSource(unusedTokensSB.toString());
View Full Code Here

        assert tokens != null;
        assert tableNode != null;

        String tableElementString = getTableElementsString(tokens, false);

        DdlTokenStream localTokens = new DdlTokenStream(tableElementString, DdlTokenStream.ddlTokenizer(false), false);

        localTokens.start();

        StringBuilder unusedTokensSB = new StringBuilder();

        do {
            if (isColumnDefinitionStart(localTokens)) {
                parseColumnDefinition(localTokens, tableNode, isAlterTable);
            } else {
                // THIS IS AN ERROR. NOTHING FOUND.
                // NEED TO absorb tokens
                unusedTokensSB.append(SPACE).append(localTokens.consume());
            }
        } while (localTokens.canConsume(COMMA));

        if (unusedTokensSB.length() > 0) {
            String msg = DdlSequencerI18n.unusedTokensParsingColumnDefinition.text(tableNode.getName());
            DdlParserProblem problem = new DdlParserProblem(Problems.WARNING, getCurrentMarkedPosition(), msg);
            problem.setUnusedSource(unusedTokensSB.toString());
View Full Code Here

TOP

Related Classes of org.modeshape.sequencer.ddl.DdlTokenStream

Copyright © 2018 www.massapicom. 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.