use of cern.c2mon.client.core.configuration.dynamic.query.QueryObj in project c2mon by c2mon.
the class QueryObjTest method mandatoryKeyForClassWithoutTargetShouldThrowError.
@Test
void mandatoryKeyForClassWithoutTargetShouldThrowError() throws DynConfigException {
QueryKey<String> mode = new QueryKey<>("mode", "GET", true);
mode.setVerifier(s -> s.equalsIgnoreCase("GET") || s.equalsIgnoreCase("POST"));
URI uri = URI.create("opc.tcp://host:500/path?mode=GET");
QueryObj queryObj = new QueryObj(uri, Collections.singletonList(mode));
DataTag.CreateBuilder builder = DataTag.create("a", Object.class, new DataTagAddress(new HardwareAddressImpl()));
assertThrows(DynConfigException.class, () -> queryObj.applyQueryPropertiesTo(builder));
}
use of cern.c2mon.client.core.configuration.dynamic.query.QueryObj in project c2mon by c2mon.
the class QueryObjTest method createQueryObjWithMissingKeyShouldThrowException.
@Test
void createQueryObjWithMissingKeyShouldThrowException() {
List<QueryKey<?>> key = Collections.singletonList(new QueryKey<Integer>("missing", null, true));
assertThrows(DynConfigException.class, () -> new QueryObj(uri, key));
}
use of cern.c2mon.client.core.configuration.dynamic.query.QueryObj in project c2mon by c2mon.
the class QueryObjTest method getUriWithoutParamsShouldReturnUri.
@Test
void getUriWithoutParamsShouldReturnUri() throws DynConfigException {
queryObj = new QueryObj(uri, Collections.emptyList());
assertEquals("opc.tcp://host:500/path", queryObj.getUriWithoutParams());
}
use of cern.c2mon.client.core.configuration.dynamic.query.QueryObj in project c2mon by c2mon.
the class QueryObjTest method mandatoryKeyForClassWithTargetShouldPassWork.
@Test
void mandatoryKeyForClassWithTargetShouldPassWork() throws DynConfigException {
QueryKey<String> mode = new QueryKey<>("mode", "GET", true);
mode.setVerifier(s -> s.equalsIgnoreCase("GET") || s.equalsIgnoreCase("POST"));
mode.setTargetClass(DataTagAddress.class);
URI uri = URI.create("opc.tcp://host:500/path?mode=GET");
QueryObj queryObj = new QueryObj(uri, Collections.singletonList(mode));
DataTag.CreateBuilder builder = DataTag.create("a", Object.class, new DataTagAddress(new HardwareAddressImpl()));
queryObj.applyQueryPropertiesTo(builder);
}
use of cern.c2mon.client.core.configuration.dynamic.query.QueryObj in project c2mon by c2mon.
the class TagConfigStrategyTest method assertQueryAndStrategyMatch.
void assertQueryAndStrategyMatch(String regex) throws DynConfigException {
URI uri = URI.create("dip://host/path?publicationName=x1");
QueryObj queryObj = new QueryObj(uri, Collections.emptyList());
strategy = ITagConfigStrategy.of(uri);
assertEquals(queryObj.matches(regex), strategy.matches(regex));
}
Aggregations