package org.openfs.fileservice.stats;

import org.apache.camel.EndpointInject;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Before;
import org.junit.Test;
import org.openfs.fileservice.stats.JvmStatsCollector;

public class JvmStatsCollectorTest extends CamelTestSupport {

	@EndpointInject(uri = "mock:result")
	MockEndpoint resultEndpoint;
	
	@Before
	public void setUp() throws Exception {
		super.setUp();
	}
	
	@Test
	public void testExporter() throws Exception {

		resultEndpoint.expectedMessageCount(1);
		resultEndpoint.assertIsSatisfied();
	}
	

	protected RouteBuilder createRouteBuilder() {
		return new RouteBuilder() {
			@Override
			public void configure() throws Exception {
								
				from("timer://test?repeatCount=1")
				.bean(new JvmStatsCollector()).log("${body}")
				.to("mock:result");
			}
		};
	}
	
}
