Search in sources :

Example 1 with WorkflowManagerMBean

use of com.adaptris.core.runtime.WorkflowManagerMBean in project interlok by adaptris.

the class MetadataCountMBeanTest method testGetMetadataStatistics.

@Test
public void testGetMetadataStatistics() throws Exception {
    String adapterName = this.getClass().getSimpleName() + "." + getName();
    MetadataTotalsInterceptor interceptor = createInterceptor();
    interceptor.setUniqueId(getName());
    Adapter adapter = createSingleChannelAdapter(adapterName, interceptor);
    List<BaseComponentMBean> mBeans = createJmxManagers(adapter);
    try {
        start(adapter);
        register(mBeans);
        ObjectName workflowObj = createWorkflowObjectName(adapterName);
        ObjectName metricsObj = createMetricsObjectName(adapterName, getName());
        MetadataStatisticsMBean stats = JMX.newMBeanProxy(mBeanServer, metricsObj, MetadataStatisticsMBean.class);
        WorkflowManagerMBean workflow = JMX.newMBeanProxy(mBeanServer, workflowObj, WorkflowManagerMBean.class);
        SerializableAdaptrisMessage msg = createMessageForInjection(null);
        workflow.processAsync(msg);
        assertEquals(1, stats.getStatistics().size());
        assertEquals(interceptor.getStats().size(), stats.getStatistics().size());
        MetadataStatistic interceptorStat = (MetadataStatistic) interceptor.getStats().get(0);
        MetadataStatistic mbeanStat = stats.getStatistics().get(0);
        // They're not objectively equals (not clones), and no equals method.
        assertNotSame(interceptorStat, mbeanStat);
        assertEquals(interceptorStat.getEndMillis(), mbeanStat.getEndMillis());
        assertEquals(interceptorStat.getMetadataStatistics(), mbeanStat.getMetadataStatistics());
    } finally {
        stop(adapter);
    }
}
Also used : WorkflowManagerMBean(com.adaptris.core.runtime.WorkflowManagerMBean) BaseComponentMBean(com.adaptris.core.runtime.BaseComponentMBean) Adapter(com.adaptris.core.Adapter) SerializableAdaptrisMessage(com.adaptris.core.SerializableAdaptrisMessage) ObjectName(javax.management.ObjectName) Test(org.junit.Test)

Example 2 with WorkflowManagerMBean

use of com.adaptris.core.runtime.WorkflowManagerMBean in project interlok by adaptris.

the class StatisticsMBeanCase method testGetTimesliceDuration.

@Test
public void testGetTimesliceDuration() throws Exception {
    String adapterName = this.getClass().getSimpleName() + "." + getName();
    Adapter adapter = createAdapter(adapterName);
    List<BaseComponentMBean> mBeans = createJmxManagers(adapter);
    try {
        start(adapter);
        register(mBeans);
        ObjectName workflowObj = createWorkflowObjectName(adapterName);
        ObjectName metricsObj = createMetricsObjectName(adapterName);
        MetricsMBean stats = JMX.newMBeanProxy(mBeanServer, metricsObj, MetricsMBean.class);
        WorkflowManagerMBean workflow = JMX.newMBeanProxy(mBeanServer, workflowObj, WorkflowManagerMBean.class);
        assertEquals(10, stats.getTimeSliceDurationSeconds());
    } finally {
        stop(adapter);
    }
}
Also used : WorkflowManagerMBean(com.adaptris.core.runtime.WorkflowManagerMBean) BaseComponentMBean(com.adaptris.core.runtime.BaseComponentMBean) Adapter(com.adaptris.core.Adapter) ObjectName(javax.management.ObjectName) Test(org.junit.Test)

Example 3 with WorkflowManagerMBean

use of com.adaptris.core.runtime.WorkflowManagerMBean in project interlok by adaptris.

the class StatisticsMBeanCase method testGet_NoTimeslicesAvailable.

@Test
public void testGet_NoTimeslicesAvailable() throws Exception {
    String adapterName = this.getClass().getSimpleName() + "." + getName();
    Adapter adapter = createAdapter(adapterName);
    List<BaseComponentMBean> mBeans = createJmxManagers(adapter);
    try {
        start(adapter);
        register(mBeans);
        ObjectName workflowObj = createWorkflowObjectName(adapterName);
        ObjectName metricsObj = createMetricsObjectName(adapterName);
        MetricsMBean stats = JMX.newMBeanProxy(mBeanServer, metricsObj, MetricsMBean.class);
        WorkflowManagerMBean workflow = JMX.newMBeanProxy(mBeanServer, workflowObj, WorkflowManagerMBean.class);
        assertEquals(0, stats.getNumberOfTimeSlices());
    } finally {
        stop(adapter);
    }
}
Also used : WorkflowManagerMBean(com.adaptris.core.runtime.WorkflowManagerMBean) BaseComponentMBean(com.adaptris.core.runtime.BaseComponentMBean) Adapter(com.adaptris.core.Adapter) ObjectName(javax.management.ObjectName) Test(org.junit.Test)

Example 4 with WorkflowManagerMBean

use of com.adaptris.core.runtime.WorkflowManagerMBean in project interlok by adaptris.

the class MetadataTotalsMBeanTest method testGetMetadataStatistics.

@Test
public void testGetMetadataStatistics() throws Exception {
    String adapterName = this.getClass().getSimpleName() + "." + getName();
    MetadataCountInterceptor interceptor = createInterceptor();
    interceptor.setUniqueId(getName());
    Adapter adapter = createSingleChannelAdapter(adapterName, interceptor);
    List<BaseComponentMBean> mBeans = createJmxManagers(adapter);
    try {
        start(adapter);
        register(mBeans);
        ObjectName workflowObj = createWorkflowObjectName(adapterName);
        ObjectName metricsObj = createMetricsObjectName(adapterName, getName());
        MetadataStatisticsMBean stats = JMX.newMBeanProxy(mBeanServer, metricsObj, MetadataStatisticsMBean.class);
        WorkflowManagerMBean workflow = JMX.newMBeanProxy(mBeanServer, workflowObj, WorkflowManagerMBean.class);
        SerializableAdaptrisMessage msg = createMessageForInjection(null);
        workflow.processAsync(msg);
        assertEquals(1, stats.getStatistics().size());
        assertEquals(interceptor.getStats().size(), stats.getStatistics().size());
        MetadataStatistic interceptorStat = (MetadataStatistic) interceptor.getStats().get(0);
        MetadataStatistic mbeanStat = stats.getStatistics().get(0);
        // They're not objectively equals (not clones), and no equals method.
        assertNotSame(interceptorStat, mbeanStat);
        assertEquals(interceptorStat.getEndMillis(), mbeanStat.getEndMillis());
        assertEquals(interceptorStat.getMetadataStatistics(), mbeanStat.getMetadataStatistics());
    } finally {
        stop(adapter);
    }
}
Also used : WorkflowManagerMBean(com.adaptris.core.runtime.WorkflowManagerMBean) BaseComponentMBean(com.adaptris.core.runtime.BaseComponentMBean) Adapter(com.adaptris.core.Adapter) SerializableAdaptrisMessage(com.adaptris.core.SerializableAdaptrisMessage) ObjectName(javax.management.ObjectName) Test(org.junit.Test)

Example 5 with WorkflowManagerMBean

use of com.adaptris.core.runtime.WorkflowManagerMBean in project interlok by adaptris.

the class MessageMetricsStatisticsTest method testGetTotalStringStats.

@Test
public void testGetTotalStringStats() throws Exception {
    String adapterName = this.getClass().getSimpleName() + "." + getName();
    Adapter adapter = createAdapter(adapterName);
    List<BaseComponentMBean> mBeans = createJmxManagers(adapter);
    try {
        start(adapter);
        register(mBeans);
        ObjectName workflowObj = createWorkflowObjectName(adapterName);
        ObjectName metricsObj = createMetricsObjectName(adapterName);
        MessageMetricsStatisticsMBean stats = JMX.newMBeanProxy(mBeanServer, metricsObj, MessageMetricsStatisticsMBean.class);
        WorkflowManagerMBean workflow = JMX.newMBeanProxy(mBeanServer, workflowObj, WorkflowManagerMBean.class);
        assertNotNull(stats.getTotalStringStats());
        SerializableAdaptrisMessage msg = createMessageForInjection(null);
        workflow.processAsync(msg);
        assertNotNull(stats.getTotalStringStats());
    } finally {
        stop(adapter);
    }
}
Also used : WorkflowManagerMBean(com.adaptris.core.runtime.WorkflowManagerMBean) BaseComponentMBean(com.adaptris.core.runtime.BaseComponentMBean) Adapter(com.adaptris.core.Adapter) SerializableAdaptrisMessage(com.adaptris.core.SerializableAdaptrisMessage) ObjectName(javax.management.ObjectName) Test(org.junit.Test)

Aggregations

Adapter (com.adaptris.core.Adapter)5 BaseComponentMBean (com.adaptris.core.runtime.BaseComponentMBean)5 WorkflowManagerMBean (com.adaptris.core.runtime.WorkflowManagerMBean)5 ObjectName (javax.management.ObjectName)5 Test (org.junit.Test)5 SerializableAdaptrisMessage (com.adaptris.core.SerializableAdaptrisMessage)3