package MonitorModelTest;
import static org.junit.Assert.*;

import org.bench4q.master.infrastructure.communication.impl.MonitorMessengerImpl;
import org.bench4q.share.models.master.MonitorModel;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "classpath:service-test-context.xml" })
public class MonitorModelTest {
	private MonitorModel monitor;
	private MonitorMessengerImpl monitorMessenger;

	public MonitorMessengerImpl getMonitorMessenger() {
		return monitorMessenger;
	}

	@Autowired
	public void setMonitorMessenger(MonitorMessengerImpl monitorMessenger) {
		this.monitorMessenger = monitorMessenger;
	}

	@Before
	public void setUp() {
		this.monitor = new MonitorModel();
		monitor.setHostName("127.0.0.1");
		monitor.setPort(5556);
	}

	@Test
	public void testMemeoryModel() {
		assertTrue(this.monitor.getHostName().equals("127.0.0.1"));
		assertTrue(this.monitor.getPort() == 5556);
		Assert.assertNotNull(this.getMonitorMessenger().memory(
				monitor.getHostName(), monitor.getPort()));

	}
	@Test
	public void testProcessorModel() {
		Assert.assertNotNull(this.getMonitorMessenger().processor(
				monitor.getHostName(), monitor.getPort()));

	}
	@Test
	public void testProcessModel() {
		Assert.assertNotNull(this.getMonitorMessenger().process(
				monitor.getHostName(), monitor.getPort()));

	}
	@Test
	public void testPhysicalDiskModel() {
		Assert.assertNotNull(this.getMonitorMessenger().physicalDisk(
				monitor.getHostName(), monitor.getPort()));

	}
	@Test
	public void testMonitorMain() {
		Assert.assertNotNull(this.getMonitorMessenger().monitorModel(
				monitor.getHostName(), monitor.getPort()));

	}
}
