Package org.apache.sling.hc.api

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


            resultLog.warn("{} during execution", iex.getClass().getSimpleName());
        }
        final String execMsg = "Done executing, execution counter=" + counter.incrementAndGet();
        resultLog.debug("{}:{}", this, execMsg);
        log.debug("{}:{}", this, execMsg);
        return new Result(resultLog);
    }
View Full Code Here


    @Override
    public Result execute() {
        final FormattingResultLog resultLog = new FormattingResultLog();
        resultLog.info("All good at {}", new Date());
        return new Result(resultLog);
    }
View Full Code Here

        resultLog.info("{} - counter value set to {} at {}", this, value, new Date());
        if(value % 2 != 0) {
            resultLog.warn("Counter value ({}) is not even", value);
        }
        return new Result(resultLog);
    }
View Full Code Here

        if(languageExtension != null) {
            props.put(ScriptableHealthCheck.PROP_LANGUAGE_EXTENSION, languageExtension);
        }
        Mockito.when(ctx.getProperties()).thenReturn(props);
        hc.activate(ctx);
        final Result r = hc.execute();
        assertEquals("Expecting result " + expected, expected, r.isOk());
    }
View Full Code Here

        props.put(JmxAttributeHealthCheck.PROP_OBJECT_NAME, objectName);
        props.put(JmxAttributeHealthCheck.PROP_ATTRIBUTE_NAME, attributeName);
        props.put(JmxAttributeHealthCheck.PROP_CONSTRAINT, constraint);
        hc.activate(props);

        final Result r = hc.execute();
        assertEquals("Expected result " + expected, expected, r.isOk());
    }
View Full Code Here

        String[] testTags = new String[] { "tag1" };
        compositeHealthCheck.setFilterTags(testTags);

       
        List<HealthCheckExecutionResult> executionResults = new LinkedList<HealthCheckExecutionResult>();
        executionResults.add(createExecutionResult("Check 1", testTags, new Result(Result.Status.INFO, "Good")));
        executionResults.add(createExecutionResult("Check 2", testTags, new Result(Result.Status.CRITICAL, "Bad")));

        when(healthCheckExecutor.execute(testTags)).thenReturn(executionResults);
       
        Result result = compositeHealthCheck.execute();

        verify(healthCheckExecutor, times(1)).execute(testTags);
       
        assertEquals(Result.Status.CRITICAL, result.getStatus());

    }
View Full Code Here

                return result;
            }

        });

        Result result = compositeHealthCheck.execute();

        verify(healthCheckExecutor, never()).execute(Matchers.any(String[].class));
        assertEquals(Result.Status.HEALTH_CHECK_ERROR, result.getStatus());
    }
View Full Code Here

                return result;
            }

        });

        Result result = compositeHealthCheck.execute();

        verify(healthCheckExecutor, never()).execute(Matchers.any(String[].class));
        assertEquals(Result.Status.HEALTH_CHECK_ERROR, result.getStatus());
    }
View Full Code Here

                Mockito.when(ref.getProperty(HealthCheck.NAME)).thenReturn("someTest");
                final HealthCheck hc = new HealthCheck() {
                    @Override
                    public Result execute() {
                        final FormattingResultLog log = new FormattingResultLog();
                        return new Result(hls.setLog(log));
                    }
                };
                Mockito.when(bc.getService(ref)).thenReturn(hc);
               
                refs.add(ref);
View Full Code Here

        final AtomicInteger counter = new AtomicInteger(Integer.MIN_VALUE);
        final HealthCheck hc = new HealthCheck() {
            @Override
            public Result execute() {
                final int v = counter.incrementAndGet();
                return new Result(Result.Status.OK, "counter is now " + v);
            }
           
        };
       
        final Dictionary<String, Object> props = new Hashtable<String, Object>();
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.