Package org.apache.sirona.status

Examples of org.apache.sirona.status.NodeStatus


    @BeforeClass
    public static void addStatus() {
        IoCs.findOrCreateInstance(Repository.class);
        IoCs.getInstance(NodeStatusDataStore.class).statuses()
            .put("node1",
                new NodeStatus(
                    new ValidationResult[] { new ValidationResult("validation #1", Status.OK, "all is fine") },
                    new Date()));
    }
View Full Code Here


    @Test
    public void checkValidations() throws InterruptedException {
        Thread.sleep(150);

        final NodeStatus result = IoCs.getInstance(NodeStatusDataStore.class).statuses().values().iterator().next();
        assertEquals(1, result.getResults().length);

        final ValidationResult validationResult = result.getResults()[0];
        assertEquals("tomee-datasource-db", validationResult.getName());
        assertEquals(Status.OK, validationResult.getStatus());
    }
View Full Code Here

            reporter = nodeStatusReporter;
        }

        @Override
        public void run() {
            final NodeStatus nodeStatus = reporter.computeStatus();
            try {
                status.set(nodeStatus);
                reportStatus(nodeStatus);
            } catch (final Exception e) {
                LOGGER.log(Level.SEVERE, e.getMessage(), e);
View Full Code Here

                // no-op: ignore
            }
        }

        // status
        final NodeStatus status = new NodeStatusReporter().computeStatus();
        answer.append(cube.statusSnapshot(time, status));

        if (clearAfterCollect) {
            clearCounters();
        }
View Full Code Here

                validations.add(new ValidationResult(
                    slice.getColumnByName("name").getValue(),
                    Status.valueOf(slice.getColumnByName("status").getValue()),
                    slice.getColumnByName("description").getValue()));
            }
            statuses.put(status.getKey(), new NodeStatus(validations.toArray(new ValidationResult[validations.size()]), maxDate));
        }
        return statuses;
    }
View Full Code Here

@RunWith(CassandraRunner.class)
public class AgentStatusTest {
    @Test
    public void checkPersistence() {
        new CassandraCollectorNodeStatusDataStore().store("node1", new NodeStatus(new ValidationResult[] {
            new ValidationResult("v1", Status.OK, "m1"), new ValidationResult("v2", Status.KO, "m2") }, new Date()));
        new CassandraCollectorNodeStatusDataStore().store("node2", new NodeStatus(new ValidationResult[] {
            new ValidationResult("v3", Status.OK, "m3"), new ValidationResult("v4", Status.KO, "m4") }, new Date()));

        final Map<String, NodeStatus> statuses = new CassandraCollectorNodeStatusDataStore().statuses();

        assertEquals(2, statuses.size());

        final NodeStatus n1 = statuses.get("node1");
        assertNotNull(n1);

        final ValidationResult[] result1 = n1.getResults();
        assertEquals(2, result1.length);
        assertEquals("v1", result1[0].getName());
        assertEquals("m1", result1[0].getMessage());
        assertEquals(Status.OK, result1[0].getStatus());
        assertEquals("v2", result1[1].getName());
        assertEquals("m2", result1[1].getMessage());
        assertEquals(Status.KO, result1[1].getStatus());

        final NodeStatus n2 = statuses.get("node2");
        assertNotNull(n2);

        final ValidationResult[] result2 = n2.getResults();
        assertEquals(2, result2.length);
        assertEquals("v3", result2[0].getName());
        assertEquals("m3", result2[0].getMessage());
        assertEquals(Status.OK, result2[0].getStatus());
        assertEquals("v4", result2[1].getName());
View Full Code Here

            @Override
            protected NodeStatusReporter newNodeStatusReporter() {
                return new NodeStatusReporter() {
                    @Override
                    public synchronized NodeStatus computeStatus() {
                        return new NodeStatus(new ValidationResult[]{new ValidationResult("sample", Status.OK, "msg")}, new Date());
                    }
                };
            }

            @Override
View Full Code Here

        delegate.store(marker, nodeStatus);
    }

    @Override
    public Map<String, NodeStatus> statuses() {
        final NodeStatus localStatus = status.get();
        if (readFromStore) {
            final Map<String, NodeStatus> statuses = delegate.statuses();
            if (localStatus == null) {
                return statuses;
            }
View Full Code Here

                    if (date == -1) {
                        statusDate = new Date();
                    } else {
                        statusDate = new Date(date);
                    }
                    final NodeStatus status = new NodeStatus(results.toArray(new ValidationResult[results.size()]), statusDate);
                    statusDataStore.store((String) events[0].getData().get("marker"), status);
                }
            } catch (final Exception e) {
                throw new SironaException(e);
            }
View Full Code Here

                    if (date == -1) {
                        statusDate = new Date();
                    } else {
                        statusDate = new Date(date);
                    }
                    final NodeStatus status = new NodeStatus(results.toArray(new ValidationResult[results.size()]), statusDate);
                    statusDataStore.store((String) events[0].getData().get("marker"), status);
                }
            } catch (final Exception e) {
                throw new SironaException(e);
            }
View Full Code Here

TOP

Related Classes of org.apache.sirona.status.NodeStatus

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.