45 lines
1.2 KiB
Java
45 lines
1.2 KiB
Java
package de.ctdo.bunti.control;
|
|
|
|
import de.ctdo.bunti.dao.BuntiDevicesDAO;
|
|
import de.ctdo.bunti.model.BuntiDevice;
|
|
import de.ctdo.bunti.model.DeviceUpdate;
|
|
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;
|
|
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
|
|
@ContextConfiguration(locations = { "classpath:/META-INF/spring/root-context.xml","classpath:/de/ctdo/bunti/hibernate-test-context.xml" })
|
|
@RunWith(SpringJUnit4ClassRunner.class)
|
|
public class BuntiControllerImplTest {
|
|
|
|
@Autowired
|
|
BuntiController dut;
|
|
|
|
@Autowired
|
|
BuntiDevicesDAO dao;
|
|
|
|
@Test
|
|
public void test1() throws Exception {
|
|
|
|
BuntiDevice dev = dao.getDeviceById(2);
|
|
DeviceUpdate upt = dut.getDeviceValues(2);
|
|
|
|
Map<String, Object> data = new HashMap<String, Object>();
|
|
data.put("red", 10);
|
|
data.put("green", 20);
|
|
data.put("blue", 30);
|
|
|
|
dut.updateDeviceData(2, data);
|
|
|
|
upt = dut.getDeviceValues(2);
|
|
|
|
return;
|
|
}
|
|
|
|
|
|
}
|