@Test public void testProvideNonOptionalParameterWithValue() throws IOException { Map<String, Variable> variables = new HashMap<>(); Variable integerVariable = new Variable(); integerVariable.setValue(_mapper.readTree("3")); variables.put("integer", integerVariable); Client.checkVariableState(variables); }
@Test public void testMissingNonOptionalParameterNoValue() { Map<String, Variable> variables = new HashMap<>(); Variable integerVariable = new Variable(); variables.put("integer", integerVariable); _thrown.expect(BatfishException.class); String errorMessage = "Missing parameter: integer"; _thrown.expectMessage(equalTo(errorMessage)); Client.checkVariableState(variables); }
@Test public void testValidBgpSessionStatusValue() throws IOException { JsonNode sessionStatusNode = _mapper.readTree("\"sessionStatus\""); Variable variable = new Variable(); variable.setType(BGP_SESSION_STATUS); Client.validateType(sessionStatusNode, variable); }
@Test public void testValidInterfaceValue() throws IOException { JsonNode interfaceNode = _mapper.readTree("\"interfaceName\""); Variable variable = new Variable(); variable.setType(INTERFACE); Client.validateType(interfaceNode, variable); }
@Test public void testValidRoutingProtocolSpecValue() throws IOException { JsonNode rpsNode = _mapper.readTree("\"all\""); Variable variable = new Variable(); variable.setType(ROUTING_PROTOCOL_SPEC); Client.validateType(rpsNode, variable); }
@Test public void testValidBooleanValue() throws IOException { JsonNode booleanNode = _mapper.readTree("true"); Variable variable = new Variable(); variable.setType(BOOLEAN); Client.validateType(booleanNode, variable); }
@Test public void testValidComparatorValue() throws IOException { JsonNode comparatorNode = _mapper.readTree("\">=\""); Variable variable = new Variable(); variable.setType(COMPARATOR); Client.validateType(comparatorNode, variable); }
@Test public void testValidIntegerValue() throws IOException { JsonNode integerNode = _mapper.readTree("15"); Variable variable = new Variable(); variable.setType(INTEGER); Client.validateType(integerNode, variable); }
@Test public void testValidJsonPathValue() throws IOException { JsonNode jsonPathNode = _mapper.readTree("{\"path\" : \"I am path.\", \"suffix\" : true}"); Variable variable = new Variable(); variable.setType(JSON_PATH); Client.validateType(jsonPathNode, variable); }
@Test public void testValidLongValue() { Long longValue = 15L; JsonNode floatNode = _mapper.valueToTree(longValue); Variable variable = new Variable(); variable.setType(LONG); Client.validateType(floatNode, variable); }
@Test public void testValidVrfValue() throws IOException { JsonNode vrfNode = _mapper.readTree("\"vrfName\""); Variable variable = new Variable(); variable.setType(VRF); Client.validateType(vrfNode, variable); }
@Test public void testMissingOptionalParameterNoValue() { Map<String, Variable> variables = new HashMap<>(); Variable integerVariable = new Variable(); integerVariable.setOptional(true); Client.checkVariableState(variables); }
@Test public void testValidAddressGroupValue() throws IOException { JsonNode addressGroupNode = _mapper.readTree("\"addressGroupName\""); Variable variable = new Variable(); variable.setType(ADDRESS_GROUP); Client.validateType(addressGroupNode, variable); }
@Test public void testValidBgpSessionTypeValue() throws IOException { JsonNode sessionTypeNode = _mapper.readTree("\"sessionType\""); Variable variable = new Variable(); variable.setType(BGP_SESSION_TYPE); Client.validateType(sessionTypeNode, variable); }
@Test public void testValidDoubleValue() throws IOException { JsonNode doubleNode = _mapper.readTree("15.0"); Variable variable = new Variable(); variable.setType(DOUBLE); Client.validateType(doubleNode, variable); }
@Test public void testValidIpWildcardValue() throws IOException { JsonNode ipWildcardNode = _mapper.readTree("\"10.168.5.5:10.168.100.100\""); Variable variable = new Variable(); variable.setType(IP_WILDCARD); Client.validateType(ipWildcardNode, variable); }
@Test public void testValidIpsecSessionStatusValue() throws IOException { JsonNode ipsecSessionStatusNode = _mapper.readTree("\"sessionStatus\""); Variable variable = new Variable(); variable.setType(IPSEC_SESSION_STATUS); Client.validateType(ipsecSessionStatusNode, variable); }
@Test public void testValidJsonPathRegexValue() throws IOException { JsonNode jsonPathRegexNode = _mapper.readTree("\"/.*/\""); Variable variable = new Variable(); variable.setType(JSON_PATH_REGEX); Client.validateType(jsonPathRegexNode, variable); }
@Test public void testValidStructureNameValue() throws IOException { JsonNode structureNameNode = _mapper.readTree("\"structureName\""); Variable variable = new Variable(); variable.setType(STRUCTURE_NAME); Client.validateType(structureNameNode, variable); }
@Test public void testSatisfiedMinLengthValue() throws IOException { String longString = "\"long enough\""; Variable variable = new Variable(); variable.setMinLength(8); variable.setType(STRING); Client.validateType(_mapper.readTree(longString), variable); }