Search in sources :

Example 6 with SensorBuilder

use of il.ac.technion.cs.smarthouse.sensors.simulator.SensorBuilder in project Smartcity-Smarthouse by TechnionYP5777.

the class InstructionsSenderThreadTest method initSystem.

@Before
public void initSystem() {
    systemCore = new SystemCore();
    fileSystem = systemCore.getFileSystem();
    server = new SensorsLocalServer(fileSystem);
    sensorsService = (SensorsService) systemCore.getSystemServiceManager().getService(ServiceType.SENSORS_SERVICE);
    new Thread(server).start();
    numOfInstructionReceived = 0;
    builder = new SensorBuilder().setSensorId(Random.sensorId()).setAlias("myAlias").setCommname(commname).addInstructionsReceiveingPath(instPath).setPollingInterval(1L * 10).setInstructionHandler((path, inst) -> {
        if (inst.equals(true + ""))
            incNumOfInstructions();
        return true;
    });
    sensorRepresentingObj = sensorsService.getSensor(commname, TestISdata.class);
}
Also used : ServiceType(il.ac.technion.cs.smarthouse.system.services.ServiceType) FileSystem(il.ac.technion.cs.smarthouse.system.file_system.FileSystem) Test(org.junit.Test) SensorsService(il.ac.technion.cs.smarthouse.system.services.sensors_service.SensorsService) SensorBuilder(il.ac.technion.cs.smarthouse.sensors.simulator.SensorBuilder) SystemCore(il.ac.technion.cs.smarthouse.system.SystemCore) SensorApi(il.ac.technion.cs.smarthouse.system.services.sensors_service.SensorApi) GenericSensor(il.ac.technion.cs.smarthouse.sensors.simulator.GenericSensor) SensorData(il.ac.technion.cs.smarthouse.system.services.sensors_service.SensorData) After(org.junit.After) Random(il.ac.technion.cs.smarthouse.utils.Random) Assert(org.junit.Assert) Before(org.junit.Before) SensorBuilder(il.ac.technion.cs.smarthouse.sensors.simulator.SensorBuilder) SystemCore(il.ac.technion.cs.smarthouse.system.SystemCore) Before(org.junit.Before)

Aggregations

SensorBuilder (il.ac.technion.cs.smarthouse.sensors.simulator.SensorBuilder)6 SensorsSimulator (il.ac.technion.cs.smarthouse.sensors.simulator.SensorsSimulator)3 SystemCore (il.ac.technion.cs.smarthouse.system.SystemCore)2 Before (org.junit.Before)2 GenericSensor (il.ac.technion.cs.smarthouse.sensors.simulator.GenericSensor)1 FileSystem (il.ac.technion.cs.smarthouse.system.file_system.FileSystem)1 SensorsLocalServer (il.ac.technion.cs.smarthouse.system.sensors.SensorsLocalServer)1 ServiceType (il.ac.technion.cs.smarthouse.system.services.ServiceType)1 SensorApi (il.ac.technion.cs.smarthouse.system.services.sensors_service.SensorApi)1 SensorData (il.ac.technion.cs.smarthouse.system.services.sensors_service.SensorData)1 SensorsService (il.ac.technion.cs.smarthouse.system.services.sensors_service.SensorsService)1 Random (il.ac.technion.cs.smarthouse.utils.Random)1 Alert (javafx.scene.control.Alert)1 After (org.junit.After)1 Assert (org.junit.Assert)1 Test (org.junit.Test)1