Search in sources :

Example 1 with TestHardware

use of com.ociweb.iot.hardware.impl.test.TestHardware in project FogLight-Examples by oci-pronghorn.

the class AppTest method testApp.

@Ignore
public void testApp() {
    DeviceRuntime runtime = DeviceRuntime.test(new IoTApp());
    NonThreadScheduler scheduler = (NonThreadScheduler) runtime.getScheduler();
    scheduler.startup();
    TestHardware hardware = (TestHardware) runtime.getHardware();
    int iterations = 10;
    while (--iterations >= 0) {
        scheduler.run();
    // test application here
    }
}
Also used : NonThreadScheduler(com.ociweb.pronghorn.stage.scheduling.NonThreadScheduler) DeviceRuntime(com.ociweb.iot.maker.DeviceRuntime) TestHardware(com.ociweb.iot.hardware.impl.test.TestHardware) Ignore(org.junit.Ignore)

Example 2 with TestHardware

use of com.ociweb.iot.hardware.impl.test.TestHardware in project FogLight-Examples by oci-pronghorn.

the class AppTest method testApp.

@Test
public void testApp() {
    FogRuntime runtime = FogRuntime.test(new IoTApp(false));
    TestHardware hardware = (TestHardware) runtime.getHardware();
    TestI2CBacking backing = (TestI2CBacking) hardware.getI2CBacking();
    ScriptedNonThreadScheduler scheduler = (ScriptedNonThreadScheduler) runtime.getScheduler();
    scheduler.startup();
    hardware.clearI2CWriteCount();
    hardware.write(IoTApp.ANGLE_SENSOR_PORT, 512);
    hardware.write(IoTApp.LIGHT_SENSOR_PORT, 300);
// scheduler.run();
// 
// int i = hardware.getI2CWriteCount();
// while (i>0) {
// 
// hardware.outputLastI2CWrite(System.out,i--);
// 
// }
// need ring of commands so it can be checked.
// assertEquals(Grove_LCD_RGB.RGB_ADDRESS, backing.lastWriteAddress);
// TODO: must ask I2C LCD for its brightness.
// test application here
}
Also used : ScriptedNonThreadScheduler(com.ociweb.pronghorn.stage.scheduling.ScriptedNonThreadScheduler) TestI2CBacking(com.ociweb.iot.hardware.impl.test.TestI2CBacking) TestHardware(com.ociweb.iot.hardware.impl.test.TestHardware) FogRuntime(com.ociweb.iot.maker.FogRuntime) Test(org.junit.Test)

Example 3 with TestHardware

use of com.ociweb.iot.hardware.impl.test.TestHardware in project FogLight-Examples by oci-pronghorn.

the class AppTest method testApp.

// no longer supported use of Paho.
@Ignore
public void testApp() {
    FogRuntime runtime = FogRuntime.test(new IoTApp());
    ScriptedNonThreadScheduler scheduler = (ScriptedNonThreadScheduler) runtime.getScheduler();
    scheduler.startup();
    TestHardware hardware = (TestHardware) runtime.getHardware();
    int iterations = 10;
    while (--iterations >= 0) {
        scheduler.run();
    // test application here
    }
}
Also used : ScriptedNonThreadScheduler(com.ociweb.pronghorn.stage.scheduling.ScriptedNonThreadScheduler) TestHardware(com.ociweb.iot.hardware.impl.test.TestHardware) FogRuntime(com.ociweb.iot.maker.FogRuntime) Ignore(org.junit.Ignore)

Example 4 with TestHardware

use of com.ociweb.iot.hardware.impl.test.TestHardware in project FogLight-Examples by oci-pronghorn.

the class AppTest method testApp.

@Test
public void testApp() {
    FogRuntime runtime = FogRuntime.test(new IoTApp());
    ScriptedNonThreadScheduler scheduler = (ScriptedNonThreadScheduler) runtime.getScheduler();
    scheduler.startup();
    TestHardware hardware = (TestHardware) runtime.getHardware();
    int iterations = 10;
    while (--iterations >= 0) {
        scheduler.run();
    // test application here
    }
}
Also used : ScriptedNonThreadScheduler(com.ociweb.pronghorn.stage.scheduling.ScriptedNonThreadScheduler) TestHardware(com.ociweb.iot.hardware.impl.test.TestHardware) FogRuntime(com.ociweb.iot.maker.FogRuntime) Test(org.junit.Test)

Example 5 with TestHardware

use of com.ociweb.iot.hardware.impl.test.TestHardware in project FogLight-Examples by oci-pronghorn.

the class AppTest method testApp.

@Test
public void testApp() {
    FogRuntime runtime = FogRuntime.test(new IoTApp());
    ScriptedNonThreadScheduler scheduler = (ScriptedNonThreadScheduler) runtime.getScheduler();
    scheduler.startup();
    TestHardware hardware = (TestHardware) runtime.getHardware();
    int iterations = 10;
    while (--iterations >= 0) {
        scheduler.run();
    // test application here
    }
}
Also used : ScriptedNonThreadScheduler(com.ociweb.pronghorn.stage.scheduling.ScriptedNonThreadScheduler) TestHardware(com.ociweb.iot.hardware.impl.test.TestHardware) FogRuntime(com.ociweb.iot.maker.FogRuntime) Test(org.junit.Test)

Aggregations

TestHardware (com.ociweb.iot.hardware.impl.test.TestHardware)13 FogRuntime (com.ociweb.iot.maker.FogRuntime)12 ScriptedNonThreadScheduler (com.ociweb.pronghorn.stage.scheduling.ScriptedNonThreadScheduler)11 Test (org.junit.Test)9 Ignore (org.junit.Ignore)4 BasicTestPortReader (com.ociweb.iot.hardware.impl.test.BasicTestPortReader)2 TestI2CBacking (com.ociweb.iot.hardware.impl.test.TestI2CBacking)1 DeviceRuntime (com.ociweb.iot.maker.DeviceRuntime)1 NonThreadScheduler (com.ociweb.pronghorn.stage.scheduling.NonThreadScheduler)1