Package org.lightfish.business.servermonitoring.entity

Examples of org.lightfish.business.servermonitoring.entity.Snapshot$Builder


    }

    @Test
    public void escalation_with_message() throws ScriptException {
        String expectedMessage = "I am expected";
        Snapshot snapshot = new Snapshot.Builder().instanceName("something").build();
        when(cut.scripting.activeScripts()).thenReturn(scripts("true", expectedMessage));
        this.cut.escalate(snapshot);
        this.cut.escalate(snapshot); //second invocation needed to enable evaluation
        verify(this.cut.escalationSink).fire((Escalation) anyObject());
        assertEquals(expectedMessage, lastEscalation.getBasicMessage());
View Full Code Here


        assertEquals(snapshot, lastEscalation.getSnapshot());
    }

    @Test
    public void noEscalation() throws ScriptException {
        Snapshot snapshot = new Snapshot.Builder().instanceName("something").build();
        when(cut.scripting.activeScripts()).thenReturn(scripts("false"));
        this.cut.escalate(snapshot);
        this.cut.escalate(snapshot); //second invocation needed to enable evaluation
        verify(this.cut.escalationSink, never()).fire((Escalation) anyObject());
        assertNull(lastEscalation);
View Full Code Here

        assertNull(lastEscalation);
    }

    @Test
    public void snapshotDependentEscalation() throws ScriptException {
        Snapshot snapshot = new Snapshot.Builder().instanceName("something").committedTX(1).build();
        when(cut.scripting.activeScripts()).thenReturn(scripts("current.committedTX == 1"));
        this.cut.escalate(snapshot);
        this.cut.escalate(snapshot); //second invocation needed to enable evaluation
        verify(this.cut.escalationSink).fire((Escalation) anyObject());
        assertEquals(snapshot, lastEscalation.getSnapshot());
View Full Code Here

    @Test
    public void subequentEscalation() throws ScriptException {
        this.firstEscalation();
        when(this.cut.scriptEngine.createBindings()).thenReturn(mock(Bindings.class));
        Snapshot snapshot = new Snapshot.Builder().instanceName("something").build();
        this.cut.escalate(snapshot);
        verify(this.cut.scriptEngine).eval(any(String.class), any(Bindings.class));
    }
View Full Code Here

    }

    @Test
    public void basic_replace_nothing() throws Exception {
        String expected = "This is a test";
        Snapshot escalation = mock(Snapshot.class);
        String result = instance.processBasicMessage(expected, escalation);
        assertEquals(expected, result);
    }
View Full Code Here

    @Test
    public void basic_replace_heap() throws Exception {
        String expected = "Used Heap: 42";
        String template = "Used Heap: ${usedHeapSize}";
        Snapshot snapshot = new Snapshot.Builder().usedHeapSize(42).build();
        String result = instance.processBasicMessage(template, snapshot);
        assertEquals(expected, result);
    }
View Full Code Here

        String expected = "Free Connections: 42";
        String template = "Free Connections: ${pools[0].numconnfree}";
        List<ConnectionPool> pools = new ArrayList<>();
        pools.add(new ConnectionPool("anything", 42, 24, 1, 1));

        Snapshot snapshot = new Snapshot.Builder().pools(pools).build();
        String result = instance.processBasicMessage(template, snapshot);
        assertEquals(expected, result);
    }
View Full Code Here

                + "</code></pre>";
        String template = "### Free Connections\n    ${pools[0].numconnfree}";
        List<ConnectionPool> pools = new ArrayList<>();
        pools.add(new ConnectionPool("anything", 42, 24, 1, 1));

        Snapshot snapshot = new Snapshot.Builder().pools(pools).build();
        String result = instance.processRichMessage(template, snapshot);
        System.out.println(result);
        assertEquals(expected, result);
    }
View Full Code Here

TOP

Related Classes of org.lightfish.business.servermonitoring.entity.Snapshot$Builder

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.