Search in sources :

Example 21 with Variable

use of org.batfish.datamodel.questions.Question.InstanceData.Variable in project batfish by batfish.

the class ClientTest method testValidPrefixValue.

@Test
public void testValidPrefixValue() throws IOException {
    JsonNode prefixNode = _mapper.readTree("\"10.168.5.5/30\"");
    Question.InstanceData.Variable variable = new Question.InstanceData.Variable();
    variable.setType(PREFIX);
    Client.validateType(prefixNode, variable);
}
Also used : Variable(org.batfish.datamodel.questions.Question.InstanceData.Variable) Variable(org.batfish.datamodel.questions.Question.InstanceData.Variable) JsonNode(com.fasterxml.jackson.databind.JsonNode) Question(org.batfish.datamodel.questions.Question) Test(org.junit.Test)

Example 22 with Variable

use of org.batfish.datamodel.questions.Question.InstanceData.Variable in project batfish by batfish.

the class ClientTest method testValidBooleanValue.

@Test
public void testValidBooleanValue() throws IOException {
    JsonNode booleanNode = _mapper.readTree("true");
    Question.InstanceData.Variable variable = new Question.InstanceData.Variable();
    variable.setType(BOOLEAN);
    Client.validateType(booleanNode, variable);
}
Also used : Variable(org.batfish.datamodel.questions.Question.InstanceData.Variable) Variable(org.batfish.datamodel.questions.Question.InstanceData.Variable) JsonNode(com.fasterxml.jackson.databind.JsonNode) Question(org.batfish.datamodel.questions.Question) Test(org.junit.Test)

Example 23 with Variable

use of org.batfish.datamodel.questions.Question.InstanceData.Variable in project batfish by batfish.

the class ClientTest method testValidDoubleValue.

@Test
public void testValidDoubleValue() throws IOException {
    JsonNode doubleNode = _mapper.readTree("15.0");
    Question.InstanceData.Variable variable = new Question.InstanceData.Variable();
    variable.setType(DOUBLE);
    Client.validateType(doubleNode, variable);
}
Also used : Variable(org.batfish.datamodel.questions.Question.InstanceData.Variable) Variable(org.batfish.datamodel.questions.Question.InstanceData.Variable) JsonNode(com.fasterxml.jackson.databind.JsonNode) Question(org.batfish.datamodel.questions.Question) Test(org.junit.Test)

Example 24 with Variable

use of org.batfish.datamodel.questions.Question.InstanceData.Variable in project batfish by batfish.

the class ClientTest method testValidLongValue.

@Test
public void testValidLongValue() {
    Long longValue = 15L;
    JsonNode floatNode = _mapper.valueToTree(longValue);
    Question.InstanceData.Variable variable = new Question.InstanceData.Variable();
    variable.setType(LONG);
    Client.validateType(floatNode, variable);
}
Also used : Variable(org.batfish.datamodel.questions.Question.InstanceData.Variable) Variable(org.batfish.datamodel.questions.Question.InstanceData.Variable) JsonNode(com.fasterxml.jackson.databind.JsonNode) Question(org.batfish.datamodel.questions.Question) Test(org.junit.Test)

Example 25 with Variable

use of org.batfish.datamodel.questions.Question.InstanceData.Variable in project batfish by batfish.

the class ClientTest method testValidJsonPathRegexValue.

@Test
public void testValidJsonPathRegexValue() throws IOException {
    JsonNode jsonPathRegexNode = _mapper.readTree("\"/.*/\"");
    Question.InstanceData.Variable variable = new Question.InstanceData.Variable();
    variable.setType(JSON_PATH_REGEX);
    Client.validateType(jsonPathRegexNode, variable);
}
Also used : Variable(org.batfish.datamodel.questions.Question.InstanceData.Variable) Variable(org.batfish.datamodel.questions.Question.InstanceData.Variable) JsonNode(com.fasterxml.jackson.databind.JsonNode) Question(org.batfish.datamodel.questions.Question) Test(org.junit.Test)

Aggregations

Variable (org.batfish.datamodel.questions.Question.InstanceData.Variable)30 JsonNode (com.fasterxml.jackson.databind.JsonNode)25 Question (org.batfish.datamodel.questions.Question)24 Test (org.junit.Test)23 BatfishException (org.batfish.common.BatfishException)6 JSONObject (org.codehaus.jettison.json.JSONObject)3 IOException (java.io.IOException)2 TreeSet (java.util.TreeSet)2 JSONException (org.codehaus.jettison.json.JSONException)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 TypeReference (com.fasterxml.jackson.core.type.TypeReference)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 Path (java.nio.file.Path)1 HashMap (java.util.HashMap)1 PatternSyntaxException (java.util.regex.PatternSyntaxException)1 WorkItem (org.batfish.common.WorkItem)1 BatfishObjectMapper (org.batfish.common.util.BatfishObjectMapper)1 Ip (org.batfish.datamodel.Ip)1 IpWildcard (org.batfish.datamodel.IpWildcard)1 SubRange (org.batfish.datamodel.SubRange)1