Search in sources :

Example 1 with DummyItemRegistry

use of org.openhab.io.hueemulation.internal.rest.mocks.DummyItemRegistry in project openhab-addons by openhab.

the class ItemUIDtoHueIDMappingTests method setUp.

@BeforeEach
public void setUp() throws IOException {
    commonSetup = new CommonSetup(true);
    commonSetup.start(new ResourceConfig());
    itemRegistry = new DummyItemRegistry();
    lightsAndGroups.cs = commonSetup.cs;
    lightsAndGroups.eventPublisher = commonSetup.eventPublisher;
    lightsAndGroups.userManagement = commonSetup.userManagement;
    lightsAndGroups.itemRegistry = itemRegistry;
    lightsAndGroups.activate();
}
Also used : DummyItemRegistry(org.openhab.io.hueemulation.internal.rest.mocks.DummyItemRegistry) ResourceConfig(org.glassfish.jersey.server.ResourceConfig) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 2 with DummyItemRegistry

use of org.openhab.io.hueemulation.internal.rest.mocks.DummyItemRegistry in project openhab-addons by openhab.

the class LightsAndGroupsTests method setUp.

@BeforeEach
public void setUp() throws IOException {
    commonSetup = new CommonSetup(false);
    itemRegistry = new DummyItemRegistry();
    this.cs = commonSetup.cs;
    subject.cs = cs;
    subject.eventPublisher = commonSetup.eventPublisher;
    subject.userManagement = commonSetup.userManagement;
    subject.itemRegistry = itemRegistry;
    subject.activate();
    // Add simulated lights
    cs.ds.lights.put("1", new HueLightEntry(new SwitchItem("switch"), "switch", DeviceType.SwitchType));
    cs.ds.lights.put("2", new HueLightEntry(new ColorItem("color"), "color", DeviceType.ColorType));
    cs.ds.lights.put("3", new HueLightEntry(new ColorItem("white"), "white", DeviceType.WhiteTemperatureType));
    // Add group item
    cs.ds.groups.put("10", new HueGroupEntry("name", new GroupItem("white", new SwitchItem("switch")), DeviceType.SwitchType));
    commonSetup.start(new ResourceConfig().registerInstances(subject));
}
Also used : HueLightEntry(org.openhab.io.hueemulation.internal.dto.HueLightEntry) DummyItemRegistry(org.openhab.io.hueemulation.internal.rest.mocks.DummyItemRegistry) ColorItem(org.openhab.core.library.items.ColorItem) GroupItem(org.openhab.core.items.GroupItem) ResourceConfig(org.glassfish.jersey.server.ResourceConfig) HueGroupEntry(org.openhab.io.hueemulation.internal.dto.HueGroupEntry) SwitchItem(org.openhab.core.library.items.SwitchItem) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 3 with DummyItemRegistry

use of org.openhab.io.hueemulation.internal.rest.mocks.DummyItemRegistry in project openhab-addons by openhab.

the class RulesTests method setUp.

@BeforeEach
public void setUp() throws IOException {
    commonSetup = new CommonSetup(false);
    this.cs = commonSetup.cs;
    itemRegistry = new DummyItemRegistry();
    ruleRegistry = new DummyRuleRegistry();
    subject.cs = commonSetup.cs;
    subject.userManagement = commonSetup.userManagement;
    subject.ruleRegistry = ruleRegistry;
    subject.itemRegistry = itemRegistry;
    subject.activate();
    // We need the LightsAndGroups class to convert registry entries into HueDatastore
    // light entries
    lightsAndGroups.cs = cs;
    lightsAndGroups.eventPublisher = commonSetup.eventPublisher;
    lightsAndGroups.userManagement = commonSetup.userManagement;
    lightsAndGroups.itemRegistry = itemRegistry;
    lightsAndGroups.activate();
    addItemToReg(new SwitchItem("switch1"), OnOffType.ON, "Switchable", "name1");
    addItemToReg(new SwitchItem("switch2"), OnOffType.ON, "Switchable", "name2");
    addItemToReg(new ColorItem("color1"), HSBType.BLUE, "ColorLighting", "");
    commonSetup.start(new ResourceConfig().registerInstances(subject));
}
Also used : DummyRuleRegistry(org.openhab.io.hueemulation.internal.rest.mocks.DummyRuleRegistry) DummyItemRegistry(org.openhab.io.hueemulation.internal.rest.mocks.DummyItemRegistry) ColorItem(org.openhab.core.library.items.ColorItem) ResourceConfig(org.glassfish.jersey.server.ResourceConfig) SwitchItem(org.openhab.core.library.items.SwitchItem) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 4 with DummyItemRegistry

use of org.openhab.io.hueemulation.internal.rest.mocks.DummyItemRegistry in project openhab-addons by openhab.

the class SceneTests method setUp.

@BeforeEach
public void setUp() throws IOException {
    commonSetup = new CommonSetup(false);
    this.cs = commonSetup.cs;
    itemRegistry = new DummyItemRegistry();
    ruleRegistry = new DummyRuleRegistry();
    subject.cs = commonSetup.cs;
    subject.userManagement = commonSetup.userManagement;
    subject.itemRegistry = itemRegistry;
    subject.ruleRegistry = ruleRegistry;
    subject.activate();
    // Add simulated lights
    addItemToReg(new SwitchItem("switch1"), OnOffType.ON, "Switchable");
    addItemToReg(new ColorItem("color1"), HSBType.BLUE, "ColorLighting");
    addItemToReg(new DimmerItem("white1"), new PercentType(12), "Lighting");
    addItemToReg(new RollershutterItem("roller1"), new PercentType(12), "Lighting");
    addItemToReg(new DimmerItem("white1"), new PercentType(12), "Lighting");
    addItemToReg(new GroupItem("group1"), OnOffType.ON, "Switchable");
    commonSetup.start(new ResourceConfig().registerInstances(subject));
}
Also used : DummyRuleRegistry(org.openhab.io.hueemulation.internal.rest.mocks.DummyRuleRegistry) DummyItemRegistry(org.openhab.io.hueemulation.internal.rest.mocks.DummyItemRegistry) DimmerItem(org.openhab.core.library.items.DimmerItem) RollershutterItem(org.openhab.core.library.items.RollershutterItem) ColorItem(org.openhab.core.library.items.ColorItem) GroupItem(org.openhab.core.items.GroupItem) PercentType(org.openhab.core.library.types.PercentType) ResourceConfig(org.glassfish.jersey.server.ResourceConfig) SwitchItem(org.openhab.core.library.items.SwitchItem) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 5 with DummyItemRegistry

use of org.openhab.io.hueemulation.internal.rest.mocks.DummyItemRegistry in project openhab-addons by openhab.

the class SensorTests method setUp.

@BeforeEach
public void setUp() throws IOException {
    commonSetup = new CommonSetup(false);
    itemRegistry = new DummyItemRegistry();
    this.cs = commonSetup.cs;
    subject.cs = cs;
    subject.userManagement = commonSetup.userManagement;
    subject.itemRegistry = itemRegistry;
    subject.activate();
    // Add simulated sensor items
    addItemToReg(new SwitchItem("switch1"), OnOffType.ON, "name1");
    addItemToReg(new ContactItem("contact1"), OpenClosedType.OPEN, "");
    addItemToReg(new ColorItem("color1"), HSBType.BLUE, "");
    addItemToReg(new DimmerItem("white1"), new PercentType(12), "");
    addItemToReg(new RollershutterItem("roller1"), new PercentType(12), "");
    addItemToReg(new NumberItem("number1"), new DecimalType(12), "");
    commonSetup.start(new ResourceConfig().registerInstances(subject));
}
Also used : NumberItem(org.openhab.core.library.items.NumberItem) DummyItemRegistry(org.openhab.io.hueemulation.internal.rest.mocks.DummyItemRegistry) ContactItem(org.openhab.core.library.items.ContactItem) DimmerItem(org.openhab.core.library.items.DimmerItem) RollershutterItem(org.openhab.core.library.items.RollershutterItem) ColorItem(org.openhab.core.library.items.ColorItem) DecimalType(org.openhab.core.library.types.DecimalType) PercentType(org.openhab.core.library.types.PercentType) ResourceConfig(org.glassfish.jersey.server.ResourceConfig) SwitchItem(org.openhab.core.library.items.SwitchItem) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

ResourceConfig (org.glassfish.jersey.server.ResourceConfig)5 BeforeEach (org.junit.jupiter.api.BeforeEach)5 DummyItemRegistry (org.openhab.io.hueemulation.internal.rest.mocks.DummyItemRegistry)5 ColorItem (org.openhab.core.library.items.ColorItem)4 SwitchItem (org.openhab.core.library.items.SwitchItem)4 GroupItem (org.openhab.core.items.GroupItem)2 DimmerItem (org.openhab.core.library.items.DimmerItem)2 RollershutterItem (org.openhab.core.library.items.RollershutterItem)2 PercentType (org.openhab.core.library.types.PercentType)2 DummyRuleRegistry (org.openhab.io.hueemulation.internal.rest.mocks.DummyRuleRegistry)2 ContactItem (org.openhab.core.library.items.ContactItem)1 NumberItem (org.openhab.core.library.items.NumberItem)1 DecimalType (org.openhab.core.library.types.DecimalType)1 HueGroupEntry (org.openhab.io.hueemulation.internal.dto.HueGroupEntry)1 HueLightEntry (org.openhab.io.hueemulation.internal.dto.HueLightEntry)1