@Test public void testParseServiceAndAnonymousServiceParent() { List<CheckReference<?>> refs = VirtualCheckExpressionParser.parseParentsExpression("service 'ping', service 'ping' on host 'default_gateway', service 'ping'"); assertThat(refs, is(notNullValue())); assertThat(refs.size(), is(equalTo(3))); assertThat(refs.get(0), is(notNullValue())); assertThat(refs.get(0), is(instanceOf(AnonymousService.class))); assertThat(refs.get(0), is(hasProperty("name", equalTo("ping")))); assertThat(refs.get(1), is(notNullValue())); assertThat(refs.get(1), is(instanceOf(ServiceByName.class))); assertThat(refs.get(1), is(hasProperty("name", equalTo("ping")))); assertThat(refs.get(1), is(hasProperty("host", is(instanceOf(HostByName.class))))); assertThat(refs.get(1), is(hasProperty("host", hasProperty("name", equalTo("default_gateway"))))); assertThat(refs.get(2), is(notNullValue())); assertThat(refs.get(2), is(instanceOf(AnonymousService.class))); assertThat(refs.get(2), is(hasProperty("name", equalTo("ping")))); }
public static final List<CheckReference<?>> parseParentsExpression(String expression) { try { try (StringReader reader = new StringReader(expression)) { VirtualCheckExpressionParserInternal parser = new VirtualCheckExpressionParserInternal(reader); return parser.readParents(); } } catch (Exception e) { throw new RuntimeException("Failed to parse parents expression: '" + expression + "'", e); } }
VirtualCheckExpressionParser { public static final List<CheckReference<?>> parseParentsExpression(String expression) { try { try (StringReader reader = new StringReader(expression)) { VirtualCheckExpressionParserInternal parser = new VirtualCheckExpressionParserInternal(reader); return parser.readParents(); } } catch (Exception e) { throw new RuntimeException("Failed to parse parents expression: '" + expression + "'", e); } } }
VirtualCheckExpressionParser { public static final List<CheckReference<?>> parseParentsExpression(String expression) { try { try (StringReader reader = new StringReader(expression)) { VirtualCheckExpressionParserInternal parser = new VirtualCheckExpressionParserInternal(reader); return parser.readParents(); } } catch (Exception e) { throw new RuntimeException("Failed to parse parents expression: '" + expression + "'", e); } }  }
VirtualCheckExpressionParser { public static final List<CheckReference<?>> parseParentsExpression(String expression) { try { try (StringReader reader = new StringReader(expression)) { VirtualCheckExpressionParserInternal parser = new VirtualCheckExpressionParserInternal(reader); return parser.readParents(); } } catch (Exception e) { throw new RuntimeException("Failed to parse parents expression: '" + expression + "'", e); } }  static final VirtualCheckOperator parseVirtualCheckExpression(String expression); static final List<CheckReference<?>> parseParentsExpression(String expression); }
VirtualCheckExpressionParser { public static final List<CheckReference<?>> parseParentsExpression(String expression) { try { try (StringReader reader = new StringReader(expression)) { VirtualCheckExpressionParserInternal parser = new VirtualCheckExpressionParserInternal(reader); return parser.readParents(); } } catch (Exception e) { throw new RuntimeException("Failed to parse parents expression: '" + expression + "'", e); } }  static final VirtualCheckOperator parseVirtualCheckExpression(String expression); static final List<CheckReference<?>> parseParentsExpression(String expression);  }