package be.iminds.ilabt.jfed.gts;

import be.iminds.ilabt.jfed.gts.model.GtsType;
import org.testng.Assert;
import org.testng.annotations.Test;

import java.io.StringReader;

/**
 * User: twalcari
 * Date: 2/8/2016
 * Time: 17:07
 */
public class GtsDslReaderTest {

    @Test
    public void simpleTest() throws Exception {

        String input = "type imindsBridgeOverGts2 {\n" +
                "\thost {\n" +
                "\t\tid = \"host0\"\n" +
                "\t\tport {\n" +
                "\t\t\tid = \"if0\"\n" +
                "\t\t}\n" +
                "\t\tport {\n" +
                "\t\t\tid = \"if1\"\n" +
                "\t\t}\n" +
                "\t}\n" +
                "\thost {\n" +
                "\t\tid = \"host1\"\n" +
                "\t\tport {\n" +
                "\t\t\tid = \"if0\"\n" +
                "\t\t}\n" +
                "\t\tport {\n" +
                "\t\t\tid = \"if1\"\n" +
                "\t\t}\n" +
                "\t}\n" +
                "\tExternalDomain {\n" +
                "\t\tid = \"lab0\"\n" +
                "\t\tlocation = \"AMS\"\n" +
                "\t\tport {\n" +
                "\t\t\tid = \"ep1\"\n" +
                "\t\t}\n" +
                "\t}\n" +
                "\tExternalDomain {\n" +
                "\t\tid = \"lab1\"\n" +
                "\t\tlocation = \"LJU\"\n" +
                "\t\tport {\n" +
                "\t\t\tid = \"ep2\"\n" +
                "\t\t}\n" +
                "\t}\n" +
                "\tlink {\n" +
                "\t\tid = \"link0\"\n" +
                "\t\tport {\n" +
                "\t\t\tid = \"src\"\n" +
                "\t\t}\n" +
                "\t\tport {\n" +
                "\t\t\tid = \"dst\"\n" +
                "\t\t}\n" +
                "\t}\n" +
                "\tadjacency lab0.ep1, link0.src\n" +
                "\tadjacency host0.if0, link0.dst\n" +
                "\tlink {\n" +
                "\t\tid = \"link1\"\n" +
                "\t\tport {\n" +
                "\t\t\tid = \"src\"\n" +
                "\t\t}\n" +
                "\t\tport {\n" +
                "\t\t\tid = \"dst\"\n" +
                "\t\t}\n" +
                "\t}\n" +
                "\tadjacency host0.if1, link1.src\n" +
                "\tadjacency host1.if0, link1.dst\n" +
                "\tlink {\n" +
                "\t\tid = \"link2\"\n" +
                "\t\tport {\n" +
                "\t\t\tid = \"src\"\n" +
                "\t\t}\n" +
                "\t\tport {\n" +
                "\t\t\tid = \"dst\"\n" +
                "\t\t}\n" +
                "\t}\n" +
                "\tadjacency host1.if1, link2.src\n" +
                "\tadjacency lab1.ep2, link2.dst\n" +
                "}\n" +
                "\n";

        GtsDslReader dslReader = new GtsDslReader(new StringReader(input));

        GtsType type = dslReader.call();
        Assert.assertEquals(type.getName(), "imindsBridgeOverGts2");



    }

}