Search in sources :

Example 6 with ISimpleMXBean

use of org.apache.camel.component.jmx.beans.ISimpleMXBean in project camel by apache.

the class JMXMonitorTypeLongCounterTest method counter.

@Test
public void counter() throws Exception {
    ISimpleMXBean simpleBean = getSimpleMXBean();
    // we should get an event after the monitor number reaches 3
    simpleBean.setLongNumber(1L);
    // this should trigger a notification
    simpleBean.setLongNumber(3L);
    // we should get 1 change from the counter bean
    getMockFixture().waitForMessages();
    getMockFixture().assertMessageReceived(new File("src/test/resources/monitor-consumer/monitorNotificationLong.xml"));
}
Also used : File(java.io.File) ISimpleMXBean(org.apache.camel.component.jmx.beans.ISimpleMXBean) Test(org.junit.Test)

Example 7 with ISimpleMXBean

use of org.apache.camel.component.jmx.beans.ISimpleMXBean in project camel by apache.

the class JMXMonitorTypeStringDiffersTest method differs.

@Test
public void differs() throws Exception {
    ISimpleMXBean simpleBean = getSimpleMXBean();
    simpleBean.setStringValue("changed");
    getMockFixture().waitForMessages();
    getMockFixture().assertMessageReceived(new File("src/test/resources/monitor-consumer/stringDiffers.xml"));
}
Also used : File(java.io.File) ISimpleMXBean(org.apache.camel.component.jmx.beans.ISimpleMXBean) Test(org.junit.Test)

Example 8 with ISimpleMXBean

use of org.apache.camel.component.jmx.beans.ISimpleMXBean in project camel by apache.

the class JMXMonitorTypeStringMatchesTest method matches.

@Test
public void matches() throws Exception {
    ISimpleMXBean simpleBean = getSimpleMXBean();
    simpleBean.setStringValue("bogus");
    Thread.sleep(600);
    simpleBean.setStringValue("initial");
    getMockFixture().waitForMessages();
    getMockFixture().assertMessageReceived(new File("src/test/resources/monitor-consumer/stringMatches.xml"));
}
Also used : File(java.io.File) ISimpleMXBean(org.apache.camel.component.jmx.beans.ISimpleMXBean) Test(org.junit.Test)

Aggregations

ISimpleMXBean (org.apache.camel.component.jmx.beans.ISimpleMXBean)8 Test (org.junit.Test)8 File (java.io.File)5 URI (java.net.URI)1 Notification (javax.management.Notification)1 Exchange (org.apache.camel.Exchange)1 Message (org.apache.camel.Message)1