Package org.apache.sling.hc.api

Examples of org.apache.sling.hc.api.Result


    public CompositeResult(ResultLog log, List<HealthCheckExecutionResult> executionResults) {
        super(log);

        for (HealthCheckExecutionResult executionResult : executionResults) {
            HealthCheckMetadata healthCheckMetadata = executionResult.getHealthCheckMetadata();
            Result healthCheckResult = executionResult.getHealthCheckResult();
            for (Entry entry : healthCheckResult) {
                resultLog.add(new ResultLog.Entry(entry.getStatus(), healthCheckMetadata.getName() + ": " + entry.getMessage(), entry.getException()));
            }
            resultLog.add(new ResultLog.Entry(Result.Status.DEBUG, healthCheckMetadata.getName() + " finished after "
                    + HealthCheckExecutorImpl.msHumanReadable(executionResult.getElapsedTimeInMs())
View Full Code Here


    }

    @Override
    public Result execute() {

        Result result = checkForRecursion(referenceToThis, new HashSet<String>());
        if(result != null) {
            // return recursion error
            return result;
        }
View Full Code Here

        Set<String> intersection = new HashSet<String>();
        intersection.addAll(bannedTagsForThisCompositeCheck);
        intersection.retainAll(tagsForIncludedChecks);
       
        if (!intersection.isEmpty()) {
            return new Result(Status.HEALTH_CHECK_ERROR,
                    "INVALID CONFIGURATION: Cycle detected in composite health check hierarchy. Health check '" + thisCheckMetadata.getName()
                            + "' (" + hcReference.getProperty(Constants.SERVICE_PID) + ") must not have tag(s) " + intersection
                            + " as a composite check in the hierarchy is itself already tagged alike (tags assigned to composite checks: "
                            + bannedTagsForThisCompositeCheck + ")");
        }
       
        // check each sub composite check
        ServiceReference[] hcRefsOfCompositeCheck = healthCheckFilter.getTaggedHealthCheckServiceReferences(tagsForIncludedChecksArr);
        for (ServiceReference hcRefOfCompositeCheck : hcRefsOfCompositeCheck) {
            if (CompositeHealthCheck.class.getName().equals(hcRefOfCompositeCheck.getProperty(ComponentConstants.COMPONENT_NAME))) {
                log.debug("Checking sub composite HC {}, {}", hcRefOfCompositeCheck, hcRefOfCompositeCheck.getProperty(ComponentConstants.COMPONENT_NAME));
                Result result = checkForRecursion(hcRefOfCompositeCheck, bannedTagsForThisCompositeCheck);
                if (result != null) {
                    // found recursion
                    return result;
                }
            }
View Full Code Here

            }
        } catch(final Exception e) {
            log.warn("JMX attribute {}/{} check failed: {}", new Object []{ mbeanName, attributeName, e});
            resultLog.healthCheckError("JMX attribute check failed: {}", e);
        }
        return new Result(resultLog);
    }
View Full Code Here

        } catch (final Exception e) {
            resultLog.healthCheckError(
                    "Exception while evaluating expression [{}] with language extension [{}]: {}",
                    expression, languageExtension, e);
        }
        return new Result(resultLog);
    }
View Full Code Here

                resultLog.warn("Replication queue {}'s first item in the default queue has been retried {} times (threshold: {})",
                        entry.getKey(), entry.getValue(), numberOfRetriesAllowed);
            }
        }

        return new Result(resultLog);
    }
View Full Code Here

    @Test
    public void testWithNoReplicationQueueProvider() throws Exception {
        ReplicationQueueHealthCheck replicationQueueHealthCheck = new ReplicationQueueHealthCheck();
        replicationQueueHealthCheck.activate(Collections.<String, Object>emptyMap());
        Result result = replicationQueueHealthCheck.execute();
        assertNotNull(result);
        assertTrue(result.isOk());
    }
View Full Code Here

        Collection<ReplicationQueue> providers = new LinkedList<ReplicationQueue>();
        providers.add(queue);
        when(replicationQueueProvider.getAllQueues()).thenReturn(providers);
        replicationQueueHealthCheck.bindReplicationQueueProvider(replicationQueueProvider);

        Result result = replicationQueueHealthCheck.execute();
        assertNotNull(result);
        assertTrue(result.isOk());
    }
View Full Code Here

        Collection<ReplicationQueue> providers = new LinkedList<ReplicationQueue>();
        providers.add(queue);
        when(replicationQueueProvider.getAllQueues()).thenReturn(providers);
        replicationQueueHealthCheck.bindReplicationQueueProvider(replicationQueueProvider);

        Result result = replicationQueueHealthCheck.execute();
        assertNotNull(result);
        assertTrue(result.isOk());
    }
View Full Code Here

        Collection<ReplicationQueue> providers = new LinkedList<ReplicationQueue>();
        providers.add(queue);
        when(replicationQueueProvider.getAllQueues()).thenReturn(providers);
        replicationQueueHealthCheck.bindReplicationQueueProvider(replicationQueueProvider);

        Result result = replicationQueueHealthCheck.execute();
        assertNotNull(result);
        assertFalse(result.isOk());
    }
View Full Code Here

TOP

Related Classes of org.apache.sling.hc.api.Result

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.