Examples of Snapshot


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

            }

            //logs.addAll(current.getLogRecords());
        }

        Snapshot combined = new Snapshot.Builder()
                .activeSessions(activeSessions)
                .committedTX(committedTX)
                .currentThreadBusy(currentThreadBusy)
                .expiredSessions(expiredSessions)
                .peakThreadCount(peakThreadCount)
                .queuedConnections(queuedConnections)
                .rolledBackTX(rolledBackTX)
                .threadCount(threadCount)
                .totalErrors(totalErrors)
                .usedHeapSize(usedHeapSize)
                .instanceName(COMBINED_SNAPSHOT_NAME)
                .logs(new ArrayList<>(logs))
                .build();
        combined.setApps(new ArrayList(applications.values()));
        combined.setPools(new ArrayList(pools.values()));

        return combined;
    }
View Full Code Here

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

        cut.initScripting();
    }

    @Test
    public void firstEscalation() throws ScriptException {
        Snapshot snapshot = new Snapshot.Builder().instanceName("something").build();
        when(cut.scripting.activeScripts()).thenReturn(scripts(""));
        this.cut.escalate(snapshot);


        this.cut.scriptEngine = mock(ScriptEngine.class);
View Full Code Here

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

        this.serializer.initialize();
    }
   
    @Test
    public void serialize() {
      Snapshot snapshot = new Snapshot.Builder().usedHeapSize(42).build();
      StringWriter writer = new StringWriter();
      this.serializer.serialize(snapshot, writer);
      String serializedRepresentation = writer.getBuffer().toString();
      assertNotNull(serializedRepresentation);
      assertTrue(serializedRepresentation.contains("42"));
View Full Code Here

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

                this.cut.scriptEngine, never()).eval(any(String.class), any(Bindings.class));
    }

    @Test
    public void escalation() throws ScriptException {
        Snapshot snapshot = new Snapshot.Builder().instanceName("something").build();
        when(cut.scripting.activeScripts()).thenReturn(scripts("true"));
        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

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

    }

    @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

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

        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

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

        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

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

    @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

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

    }

    @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

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

    @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
TOP
Copyright © 2018 www.massapi.com. 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.