public String getConfigPIDFromServices()

in src/main/java/org/apache/sling/testing/clients/osgi/OsgiConsoleClient.java [911:929]


    public String getConfigPIDFromServices(String serviceType, String propertyName, String propertyValue, final long timeout, final long delay) throws ClientException, InterruptedException, TimeoutException {

        ConfigurationPollerByFilter p = new ConfigurationPollerByFilter(String.format("(service.pid=%s.*)", serviceType));

        p.poll(timeout, delay);
        JsonNode jn;
        try {
            jn = new ObjectMapper().readTree(p.getConfigAsString());
        } catch (JsonProcessingException e) {
            throw new TestingSetupException("Error reading configurations", e);
        }

        for (JsonNode configuration: jn) {
            if (configuration.path("properties").path(propertyName).path("value").asText().equals(propertyValue)) {
                return configuration.get("pid").asText();
            }
        }
        return null;
    }