// Path: src/main/java/com/yanglinkui/ab/dsl/Number.java
// public class Number implements Value<BigDecimal> {
// 
//     private final BigDecimal value;
// 
//     public Number(BigDecimal value) {
//         this.value = value;
//     }
// 
//     public BigDecimal getValue() {
//         return this.value;
//     }
// 
//     @Override
//     public String toString() {
//         return "Number: " + this.value;
//     }
// }


import com.yanglinkui.ab.dsl.*;
import com.yanglinkui.ab.dsl.Number;
import junit.framework.Assert;
import org.junit.Test;
import java.lang.*;
import java.math.BigDecimal;
package com.yanglinkui.ab.dsl.service;



/**
 * Created by jonas on 2017/1/8.
 */
public class TestServiceParser {

    @Test
    public void testStatements() {
        ServiceLexer l = new ServiceLexer("s1.version=1,s2.ip='192.168.100.1', s3.version!=[1.1,'1.2']");
        ServiceParser p = new ServiceParser(l);

        Statements s = p.statements();
        Assert.assertNotNull(s);

        Operation e = null;
        e = s.getOperation("s1.version");
        Assert.assertEquals(e.getVariable().getId(), "s1.version");
        Assert.assertEquals(e.getValue().getValue(), new BigDecimal("1"));

        e = s.getOperation("s2.ip");
        Assert.assertEquals(e.getVariable().getId(), "s2.ip");
        Assert.assertEquals(e.getValue().getValue(), "192.168.100.1");

        e = s.getOperation("s3.version");
        Assert.assertEquals(e.getVariable().getId(), "s3.version");
        Assert.assertEquals(e.getValue().getClass(), Array.class);
        Assert.assertEquals(((Array)e.getValue()).getValue().size(), 2);

        for (Value value : ((Array)e.getValue()).getValue()) {
// Path: src/main/java/com/yanglinkui/ab/dsl/Number.java
// public class Number implements Value<BigDecimal> {
// 
//     private final BigDecimal value;
// 
//     public Number(BigDecimal value) {
//         this.value = value;
//     }
// 
//     public BigDecimal getValue() {
//         return this.value;
//     }
// 
//     @Override
//     public String toString() {
//         return "Number: " + this.value;
//     }
// }


// Path: src/test/java/com/yanglinkui/ab/dsl/service/TestServiceParser.java
import com.yanglinkui.ab.dsl.*;
import com.yanglinkui.ab.dsl.Number;
import junit.framework.Assert;
import org.junit.Test;
import java.lang.*;
import java.math.BigDecimal;

package com.yanglinkui.ab.dsl.service;



/**
 * Created by jonas on 2017/1/8.
 */
public class TestServiceParser {

    @Test
    public void testStatements() {
        ServiceLexer l = new ServiceLexer("s1.version=1,s2.ip='192.168.100.1', s3.version!=[1.1,'1.2']");
        ServiceParser p = new ServiceParser(l);

        Statements s = p.statements();
        Assert.assertNotNull(s);

        Operation e = null;
        e = s.getOperation("s1.version");
        Assert.assertEquals(e.getVariable().getId(), "s1.version");
        Assert.assertEquals(e.getValue().getValue(), new BigDecimal("1"));

        e = s.getOperation("s2.ip");
        Assert.assertEquals(e.getVariable().getId(), "s2.ip");
        Assert.assertEquals(e.getValue().getValue(), "192.168.100.1");

        e = s.getOperation("s3.version");
        Assert.assertEquals(e.getVariable().getId(), "s3.version");
        Assert.assertEquals(e.getValue().getClass(), Array.class);
        Assert.assertEquals(((Array)e.getValue()).getValue().size(), 2);

        for (Value value : ((Array)e.getValue()).getValue()) {
            if (value instanceof Number) {