Fix SAT errors/warnings in resources and tests (#1178)

Fixes SAT errors/warnings in resources and tests reported by SAT 0.8.0-SNAPSHOT.

Related to openhab/static-code-analysis#363

Signed-off-by: Wouter Born <github@maindrain.net>
pull/1180/head
Wouter Born 2019-11-03 11:04:19 +01:00 committed by Christoph Weitkamp
parent 1f9a6f685d
commit f002a21da5
64 changed files with 1154 additions and 1150 deletions

View File

@ -35,9 +35,9 @@ import org.junit.Test;
*/
public class AudioServletTest extends AbstractAudioServletTest {
private final String MEDIA_TYPE_AUDIO_WAV = "audio/wav";
private final String MEDIA_TYPE_AUDIO_OGG = "audio/ogg";
private final String MEDIA_TYPE_AUDIO_MPEG = "audio/mpeg";
private static final String MEDIA_TYPE_AUDIO_WAV = "audio/wav";
private static final String MEDIA_TYPE_AUDIO_OGG = "audio/ogg";
private static final String MEDIA_TYPE_AUDIO_MPEG = "audio/mpeg";
private final byte[] testByteArray = new byte[] { 0, 1, 2 };

View File

@ -33,6 +33,7 @@ import org.eclipse.smarthome.core.library.types.PercentType;
/**
* An {@link AudioSink} fake used for the tests.
*
* @author Petar Valchev - Initial contribution
* @author Christoph Weitkamp - Added examples for getSupportedFormats() and getSupportedStreams()
* @author Christoph Weitkamp - Added parameter to adjust the volume
* @author Wouter Born - Migrate tests from Groovy to Java

View File

@ -1,67 +1,67 @@
{
"conditions":[
"conditions": [
{
"uid":"jsr223.ScriptedCondition",
"label":"Scripted condition",
"description":"allows the definition of a condition by a script",
"uid": "jsr223.ScriptedCondition",
"label": "Scripted condition",
"description": "allows the definition of a condition by a script",
"visibility": "EXPERT",
"configDescriptions":[
"configDescriptions": [
{
"name":"privId",
"type":"TEXT",
"description":"the identifier of the private method",
"required":true
"name": "privId",
"type": "TEXT",
"description": "the identifier of the private method",
"required": true
}
]
}
],
"actions":[
"actions": [
{
"uid":"jsr223.ScriptedAction",
"label":"Scripted action",
"description":"allows the execution of a method defined by a script",
"uid": "jsr223.ScriptedAction",
"label": "Scripted action",
"description": "allows the execution of a method defined by a script",
"visibility": "EXPERT",
"configDescriptions":[
"configDescriptions": [
{
"name":"privId",
"type":"TEXT",
"description":"the identifier of the private method",
"required":true
"name": "privId",
"type": "TEXT",
"description": "the identifier of the private method",
"required": true
}
],
"outputs":[
"outputs": [
{
"name":"result",
"type":"java.lang.Object",
"label":"result",
"description":"the script result.",
"reference":""
"name": "result",
"type": "java.lang.Object",
"label": "result",
"description": "the script result.",
"reference": ""
}
]
}
],
"triggers": [
{
"uid":"jsr223.ScriptedTrigger",
"label":"Scripted trigger",
"description":"allows the execution of a method defined by a script",
"uid": "jsr223.ScriptedTrigger",
"label": "Scripted trigger",
"description": "allows the execution of a method defined by a script",
"visibility": "EXPERT",
"configDescriptions":[
"configDescriptions": [
{
"name":"privId",
"type":"TEXT",
"description":"the identifier of the private method",
"required":true
"name": "privId",
"type": "TEXT",
"description": "the identifier of the private method",
"required": true
}
],
"outputs":[
"outputs": [
{
"name":"triggerOutput",
"type":"java.lang.String",
"label":"TriggerOutput label",
"description":"Text from the trigger",
"reference":"consoleInput",
"defaultValue":"dtag"
"name": "triggerOutput",
"type": "java.lang.String",
"label": "TriggerOutput label",
"description": "Text from the trigger",
"reference": "consoleInput",
"defaultValue": "dtag"
}
]
}

View File

@ -1,18 +1,18 @@
{
"triggers":[
"triggers": [
{
"uid":"core.ChannelEventTrigger",
"label":"a trigger channel fires",
"description":"React on events from a trigger channel of a thing.",
"configDescriptions":[
"uid": "core.ChannelEventTrigger",
"label": "a trigger channel fires",
"description": "React on events from a trigger channel of a thing.",
"configDescriptions": [
{
"name":"channelUID",
"type":"TEXT",
"context":"channel",
"label":"Channel",
"description":"the id of the channel which should be observed for triggers",
"required":true,
"filterCriteria":[
"name": "channelUID",
"type": "TEXT",
"context": "channel",
"label": "Channel",
"description": "the id of the channel which should be observed for triggers",
"required": true,
"filterCriteria": [
{
"value": "TRIGGER",
"name": "kind"
@ -20,20 +20,20 @@
]
},
{
"name":"event",
"type":"TEXT",
"label":"Event",
"description":"the event on the channel to react on",
"required":false
"name": "event",
"type": "TEXT",
"label": "Event",
"description": "the event on the channel to react on",
"required": false
}
],
"outputs":[
"outputs": [
{
"name":"event",
"type":"org.eclipse.smarthome.core.events.Event",
"description":"the event of the channel trigger",
"label":"Event",
"reference":"channelEventTriggerId.event"
"name": "event",
"type": "org.eclipse.smarthome.core.events.Event",
"description": "the event of the channel trigger",
"label": "Event",
"reference": "channelEventTriggerId.event"
}
]
}

View File

@ -1,17 +1,17 @@
{
"triggers":[
"triggers": [
{
"uid":"timer.GenericCronTrigger",
"label":"Cron Trigger",
"description":"This triggers a rule based on a cron expression",
"configDescriptions":[
"uid": "timer.GenericCronTrigger",
"label": "Cron Trigger",
"description": "This triggers a rule based on a cron expression",
"configDescriptions": [
{
"name":"cronExpression",
"type":"TEXT",
"context":"cronexpression",
"label":"cron expression",
"description":"the cron expression",
"required":true
"name": "cronExpression",
"type": "TEXT",
"context": "cronexpression",
"label": "cron expression",
"description": "the cron expression",
"required": true
}
]
}

View File

@ -1,43 +1,43 @@
{
"triggers":[
"triggers": [
{
"uid":"core.GenericEventTrigger",
"label":"Basic Event Trigger",
"description":"Triggers Rules on Events",
"visibility":"HIDDEN",
"configDescriptions":[
"uid": "core.GenericEventTrigger",
"label": "Basic Event Trigger",
"description": "Triggers Rules on Events",
"visibility": "HIDDEN",
"configDescriptions": [
{
"name":"eventTopic",
"type":"TEXT",
"label":"Topic",
"description":"This is the topic, the trigger will listen to: >>smarthome/*<<",
"required":true,
"default":"smarthome/*"
"name": "eventTopic",
"type": "TEXT",
"label": "Topic",
"description": "This is the topic, the trigger will listen to: >>smarthome/*<<",
"required": true,
"default": "smarthome/*"
},
{
"name":"eventSource",
"type":"TEXT",
"label":"Source",
"description":"This is the source of the event (eg. item name)",
"required":true,
"default":""
"name": "eventSource",
"type": "TEXT",
"label": "Source",
"description": "This is the source of the event (eg. item name)",
"required": true,
"default": ""
},
{
"name":"eventTypes",
"type":"TEXT",
"label":"Event Type",
"description":"the event type, the trigger should listen to. Multiple types can be specified comma-separated",
"required":true,
"default":""
"name": "eventTypes",
"type": "TEXT",
"label": "Event Type",
"description": "the event type, the trigger should listen to. Multiple types can be specified comma-separated",
"required": true,
"default": ""
}
],
"outputs":[
"outputs": [
{
"name":"event",
"type":"org.eclipse.smarthome.core.events.Event",
"label":"Event",
"description":"The events which was sent.",
"reference":"event"
"name": "event",
"type": "org.eclipse.smarthome.core.events.Event",
"label": "Event",
"description": "The events which was sent.",
"reference": "event"
}
]
}

View File

@ -1,26 +1,26 @@
{
"actions":[
"actions": [
{
"uid":"core.ItemCommandAction",
"label":"send a command",
"description":"Sends a command to a specified item.",
"configDescriptions":[
"uid": "core.ItemCommandAction",
"label": "send a command",
"description": "Sends a command to a specified item.",
"configDescriptions": [
{
"name":"itemName",
"type":"TEXT",
"label":"Item",
"context":"item",
"description":"the name of the item",
"required":true
"name": "itemName",
"type": "TEXT",
"label": "Item",
"context": "item",
"description": "the name of the item",
"required": true
},
{
"name":"command",
"type":"TEXT",
"label":"Command",
"description":"the default command to be sent if none is passed as an input value",
"required":true,
"limitToOptions":false,
"options":[
"name": "command",
"type": "TEXT",
"label": "Command",
"description": "the default command to be sent if none is passed as an input value",
"required": true,
"limitToOptions": false,
"options": [
{
"label": "ON",
"value": "ON"
@ -48,12 +48,12 @@
]
}
],
"inputs":[
"inputs": [
{
"name":"command",
"type":"command",
"label":"Command",
"description":"command that will be sent to the item."
"name": "command",
"type": "command",
"label": "Command",
"description": "command that will be sent to the item."
}
]
}

View File

@ -1,26 +1,26 @@
{
"triggers":[
"triggers": [
{
"uid":"core.ItemCommandTrigger",
"label":"an item receives a command",
"description":"This triggers the rule if an item receives a command.",
"configDescriptions":[
"uid": "core.ItemCommandTrigger",
"label": "an item receives a command",
"description": "This triggers the rule if an item receives a command.",
"configDescriptions": [
{
"name":"itemName",
"type":"TEXT",
"context":"item",
"label":"Item",
"description":"the name of the item",
"required":true
"name": "itemName",
"type": "TEXT",
"context": "item",
"label": "Item",
"description": "the name of the item",
"required": true
},
{
"name":"command",
"type":"TEXT",
"label":"Command",
"description":"the received command",
"required":false,
"limitToOptions":false,
"options":[
"name": "command",
"type": "TEXT",
"label": "Command",
"description": "the received command",
"required": false,
"limitToOptions": false,
"options": [
{
"label": "ON",
"value": "ON"
@ -48,43 +48,43 @@
]
}
],
"outputs":[
"outputs": [
{
"name":"command",
"type":"command",
"description":"the received command",
"label":"Command"
"name": "command",
"type": "command",
"description": "the received command",
"label": "Command"
},
{
"name":"event",
"type":"org.eclipse.smarthome.core.events.Event",
"label":"Event",
"description":"The event which was sent.",
"reference":"event"
"name": "event",
"type": "org.eclipse.smarthome.core.events.Event",
"label": "Event",
"description": "The event which was sent.",
"reference": "event"
}
]
},
{
"uid":"core.ItemStateUpdateTrigger",
"label":"an item state is updated",
"description":"This triggers the rule if an item state is updated (even if it does not change).",
"configDescriptions":[
"uid": "core.ItemStateUpdateTrigger",
"label": "an item state is updated",
"description": "This triggers the rule if an item state is updated (even if it does not change).",
"configDescriptions": [
{
"name":"itemName",
"type":"TEXT",
"context":"item",
"label":"Item",
"description":"the name of the item",
"required":true
"name": "itemName",
"type": "TEXT",
"context": "item",
"label": "Item",
"description": "the name of the item",
"required": true
},
{
"name":"state",
"type":"TEXT",
"label":"State",
"description":"the state of the item",
"required":false,
"limitToOptions":false,
"options":[
"name": "state",
"type": "TEXT",
"label": "State",
"description": "the state of the item",
"required": false,
"limitToOptions": false,
"options": [
{
"label": "ON",
"value": "ON"
@ -112,43 +112,43 @@
]
}
],
"outputs":[
"outputs": [
{
"name":"state",
"type":"state",
"description":"the item state",
"label":"State"
"name": "state",
"type": "state",
"description": "the item state",
"label": "State"
},
{
"name":"event",
"type":"org.eclipse.smarthome.core.events.Event",
"label":"Event",
"description":"The event which was sent.",
"reference":"event"
"name": "event",
"type": "org.eclipse.smarthome.core.events.Event",
"label": "Event",
"description": "The event which was sent.",
"reference": "event"
}
]
},
{
"uid":"core.ItemStateChangeTrigger",
"label":"an item state changes",
"description":"This triggers the rule if an item state has changed.",
"configDescriptions":[
"uid": "core.ItemStateChangeTrigger",
"label": "an item state changes",
"description": "This triggers the rule if an item state has changed.",
"configDescriptions": [
{
"name":"itemName",
"type":"TEXT",
"context":"item",
"label":"Item",
"description":"the name of the item",
"required":true
"name": "itemName",
"type": "TEXT",
"context": "item",
"label": "Item",
"description": "the name of the item",
"required": true
},
{
"name":"previousState",
"type":"TEXT",
"label":"Previous State",
"description":"the required previous state of the item",
"required":false,
"limitToOptions":false,
"options":[
"name": "previousState",
"type": "TEXT",
"label": "Previous State",
"description": "the required previous state of the item",
"required": false,
"limitToOptions": false,
"options": [
{
"label": "ON",
"value": "ON"
@ -176,13 +176,13 @@
]
},
{
"name":"state",
"type":"TEXT",
"label":"State",
"description":"the state of the item",
"required":false,
"limitToOptions":false,
"options":[
"name": "state",
"type": "TEXT",
"label": "State",
"description": "the state of the item",
"required": false,
"limitToOptions": false,
"options": [
{
"label": "ON",
"value": "ON"
@ -210,25 +210,25 @@
]
}
],
"outputs":[
"outputs": [
{
"name":"newState",
"type":"state",
"description":"the new item state",
"label":"New State"
"name": "newState",
"type": "state",
"description": "the new item state",
"label": "New State"
},
{
"name":"oldState",
"type":"state",
"description":"the old item state",
"label":"Old State"
"name": "oldState",
"type": "state",
"description": "the old item state",
"label": "Old State"
},
{
"name":"event",
"type":"org.eclipse.smarthome.core.events.Event",
"label":"Event",
"description":"The event which was sent.",
"reference":"event"
"name": "event",
"type": "org.eclipse.smarthome.core.events.Event",
"label": "Event",
"description": "The event which was sent.",
"reference": "event"
}
]
}

View File

@ -1,18 +1,18 @@
{
"triggers":[
"triggers": [
{
"uid":"timer.TimeOfDayTrigger",
"label":"it is a fixed time of day",
"description":"Triggers at a specified time",
"visibility":"PUBLIC",
"configDescriptions":[
"uid": "timer.TimeOfDayTrigger",
"label": "it is a fixed time of day",
"description": "Triggers at a specified time",
"visibility": "PUBLIC",
"configDescriptions": [
{
"name":"time",
"context":"time",
"type":"TEXT",
"label":"Time",
"description":"the time (in hh:mm)",
"required":true
"name": "time",
"context": "time",
"type": "TEXT",
"label": "Time",
"description": "the time (in hh:mm)",
"required": true
}
]
}

View File

@ -21,6 +21,9 @@ import java.util.Arrays;
import org.eclipse.smarthome.config.core.ConfigDescriptionParameter.Type;
import org.junit.Test;
/**
* @author Christoph Knauf - Initial contribution
*/
public class ConfigDescriptionParameterBuilderTest {
@Test

View File

@ -30,14 +30,15 @@ import org.junit.Test;
import org.mockito.Mock;
/**
* Tests {@link ConfigDescriptionRegistry}.
*
* @author Simon Kaufmann - converted to Java
* @author Simon Kaufmann - Initial contribution
*/
public class ConfigDescriptionRegistryTest extends JavaTest {
private URI URI_DUMMY;
private URI URI_DUMMY1;
private URI URI_ALIASED;
private URI uriDummy;
private URI uriDummy1;
private URI uriAliases;
private ConfigDescriptionRegistry configDescriptionRegistry;
private ConfigDescription configDescription;
private @Mock ConfigDescriptionProvider configDescriptionProviderMock;
@ -55,9 +56,9 @@ public class ConfigDescriptionRegistryTest extends JavaTest {
public void setUp() throws Exception {
initMocks(this);
URI_DUMMY = new URI("config:Dummy");
URI_DUMMY1 = new URI("config:Dummy1");
URI_ALIASED = new URI("config:Aliased");
uriDummy = new URI("config:Dummy");
uriDummy1 = new URI("config:Dummy1");
uriAliases = new URI("config:Aliased");
configDescriptionRegistry = new ConfigDescriptionRegistry();
ConfigDescriptionParameter param1 = new ConfigDescriptionParameter("param1",
@ -65,64 +66,62 @@ public class ConfigDescriptionRegistryTest extends JavaTest {
List<ConfigDescriptionParameter> pList1 = new ArrayList<>();
pList1.add(param1);
configDescription = new ConfigDescription(URI_DUMMY, pList1);
configDescription = new ConfigDescription(uriDummy, pList1);
when(configDescriptionProviderMock.getConfigDescriptions(any()))
.thenReturn(Collections.singleton(configDescription));
when(configDescriptionProviderMock.getConfigDescription(eq(URI_DUMMY), any())).thenReturn(configDescription);
when(configDescriptionProviderMock.getConfigDescription(eq(uriDummy), any())).thenReturn(configDescription);
configDescription1 = new ConfigDescription(URI_DUMMY1);
configDescription1 = new ConfigDescription(uriDummy1);
when(configDescriptionProviderMock1.getConfigDescriptions(any()))
.thenReturn(Collections.singleton(configDescription1));
when(configDescriptionProviderMock1.getConfigDescription(eq(URI_DUMMY1), any())).thenReturn(configDescription1);
when(configDescriptionProviderMock1.getConfigDescription(eq(uriDummy1), any())).thenReturn(configDescription1);
configDescriptionAliased = new ConfigDescription(URI_ALIASED, Collections
configDescriptionAliased = new ConfigDescription(uriAliases, Collections
.singletonList(new ConfigDescriptionParameter("instanceId", ConfigDescriptionParameter.Type.INTEGER)));
when(configDescriptionProviderAliased.getConfigDescriptions(any()))
.thenReturn(Collections.singleton(configDescriptionAliased));
when(configDescriptionProviderAliased.getConfigDescription(eq(URI_ALIASED), any()))
when(configDescriptionProviderAliased.getConfigDescription(eq(uriAliases), any()))
.thenReturn(configDescriptionAliased);
ConfigDescriptionParameter param2 = new ConfigDescriptionParameter("param2",
ConfigDescriptionParameter.Type.INTEGER);
List<ConfigDescriptionParameter> pList2 = new ArrayList<>();
pList2.add(param2);
configDescription2 = new ConfigDescription(URI_DUMMY, pList2);
configDescription2 = new ConfigDescription(uriDummy, pList2);
when(configDescriptionProviderMock2.getConfigDescriptions(any()))
.thenReturn(Collections.singleton(configDescription2));
when(configDescriptionProviderMock2.getConfigDescription(eq(URI_DUMMY), any())).thenReturn(configDescription2);
when(configDescriptionProviderMock2.getConfigDescription(eq(uriDummy), any())).thenReturn(configDescription2);
when(aliasProvider.getAlias(eq(URI_ALIASED))).thenReturn(URI_DUMMY);
when(aliasProvider.getAlias(eq(uriAliases))).thenReturn(uriDummy);
when(configOptionsProviderMockAliased.getParameterOptions(eq(URI_ALIASED), anyString(), any(), any()))
when(configOptionsProviderMockAliased.getParameterOptions(eq(uriAliases), anyString(), any(), any()))
.thenReturn(Collections.singletonList(new ParameterOption("Option", "Aliased")));
when(configOptionsProviderMockAliased.getParameterOptions(eq(URI_DUMMY), anyString(), any(), any()))
when(configOptionsProviderMockAliased.getParameterOptions(eq(uriDummy), anyString(), any(), any()))
.thenReturn(null);
when(configOptionsProviderMock.getParameterOptions(eq(URI_DUMMY), anyString(), any(), any()))
when(configOptionsProviderMock.getParameterOptions(eq(uriDummy), anyString(), any(), any()))
.thenReturn(Collections.singletonList(new ParameterOption("Option", "Original")));
when(configOptionsProviderMock.getParameterOptions(eq(URI_ALIASED), anyString(), any(), any()))
.thenReturn(null);
when(configOptionsProviderMock.getParameterOptions(eq(uriAliases), anyString(), any(), any())).thenReturn(null);
}
@Test
public void testGetConfigDescription() throws Exception {
configDescriptionRegistry.addConfigDescriptionProvider(configDescriptionProviderMock);
ConfigDescription configDescription = configDescriptionRegistry.getConfigDescription(URI_DUMMY);
ConfigDescription configDescription = configDescriptionRegistry.getConfigDescription(uriDummy);
assertThat(configDescription, is(notNullValue()));
assertThat(configDescription.getUID(), is(equalTo(URI_DUMMY)));
assertThat(configDescription.getUID(), is(equalTo(uriDummy)));
}
@Test
public void testGetConfigDescriptions() throws Exception {
assertThat(configDescriptionRegistry.getConfigDescriptions().size(), is(0));
configDescriptionRegistry.addConfigDescriptionProvider(configDescriptionProviderMock);
assertThat(configDescriptionRegistry.getConfigDescriptions().size(), is(1));
List<ConfigDescription> configDescriptions = new ArrayList<>(configDescriptionRegistry.getConfigDescriptions());
assertThat(configDescriptions.get(0).getUID(), is(equalTo(URI_DUMMY)));
assertThat(configDescriptions.get(0).getUID(), is(equalTo(uriDummy)));
assertThat(configDescriptions.get(0).toParametersMap().size(), is(1));
assertThat(configDescriptions.get(0).toParametersMap().get("param1"), notNullValue());
@ -137,8 +136,7 @@ public class ConfigDescriptionRegistryTest extends JavaTest {
}
@Test
public void testGetConfigDescriptions_options() throws Exception {
public void testGetConfigDescriptionsOptions() throws Exception {
assertThat(configDescriptionRegistry.getConfigDescriptions().size(), is(0));
configDescriptionRegistry.addConfigDescriptionProvider(configDescriptionProviderMock);
@ -148,7 +146,7 @@ public class ConfigDescriptionRegistryTest extends JavaTest {
assertThat(configDescriptionRegistry.getConfigDescriptions().size(), is(1));
List<ConfigDescription> configDescriptions = new ArrayList<>(configDescriptionRegistry.getConfigDescriptions());
assertThat(configDescriptions.get(0).getUID(), is(equalTo(URI_DUMMY)));
assertThat(configDescriptions.get(0).getUID(), is(equalTo(uriDummy)));
assertThat(configDescriptions.get(0).getParameters().size(), is(2));
assertThat(configDescriptions.get(0).getParameters().get(0).getName(), is(equalTo("param1")));
@ -162,25 +160,25 @@ public class ConfigDescriptionRegistryTest extends JavaTest {
}
@Test
public void testGetConfigDescriptions_aliasedOptions() throws Exception {
public void testGetConfigDescriptionsAliasedOptions() throws Exception {
assertThat(configDescriptionRegistry.getConfigDescriptions().size(), is(0));
configDescriptionRegistry.addConfigDescriptionProvider(configDescriptionProviderMock);
configDescriptionRegistry.addConfigDescriptionAliasProvider(aliasProvider);
configDescriptionRegistry.addConfigOptionProvider(configOptionsProviderMockAliased);
ConfigDescription res = configDescriptionRegistry.getConfigDescription(URI_ALIASED);
ConfigDescription res = configDescriptionRegistry.getConfigDescription(uriAliases);
assertThat(res, is(notNullValue()));
assertThat(res.getParameters().get(0).getOptions().size(), is(1));
assertThat(res.getParameters().get(0).getOptions().get(0).getLabel(), is("Aliased"));
assertThat(res.getUID(), is(URI_ALIASED));
assertThat(res.getUID(), is(uriAliases));
configDescriptionRegistry.removeConfigDescriptionProvider(configDescriptionProviderMock);
assertThat(configDescriptionRegistry.getConfigDescriptions().size(), is(0));
}
@Test
public void testGetConfigDescriptions_aliasedOptionsOriginalWins() throws Exception {
public void testGetConfigDescriptionsAliasedOptionsOriginalWins() throws Exception {
assertThat(configDescriptionRegistry.getConfigDescriptions().size(), is(0));
configDescriptionRegistry.addConfigDescriptionProvider(configDescriptionProviderMock);
@ -188,48 +186,48 @@ public class ConfigDescriptionRegistryTest extends JavaTest {
configDescriptionRegistry.addConfigOptionProvider(configOptionsProviderMock);
configDescriptionRegistry.addConfigOptionProvider(configOptionsProviderMockAliased);
ConfigDescription res = configDescriptionRegistry.getConfigDescription(URI_ALIASED);
ConfigDescription res = configDescriptionRegistry.getConfigDescription(uriAliases);
assertThat(res, is(notNullValue()));
assertThat(res.getParameters().get(0).getOptions().size(), is(1));
assertThat(res.getParameters().get(0).getOptions().get(0).getLabel(), is("Aliased"));
assertThat(res.getUID(), is(URI_ALIASED));
assertThat(res.getUID(), is(uriAliases));
configDescriptionRegistry.removeConfigDescriptionProvider(configDescriptionProviderMock);
assertThat(configDescriptionRegistry.getConfigDescriptions().size(), is(0));
}
@Test
public void testGetConfigDescriptions_nonAliasOptions() throws Exception {
public void testGetConfigDescriptionsNonAliasOptions() throws Exception {
assertThat(configDescriptionRegistry.getConfigDescriptions().size(), is(0));
configDescriptionRegistry.addConfigDescriptionProvider(configDescriptionProviderMock);
configDescriptionRegistry.addConfigDescriptionAliasProvider(aliasProvider);
configDescriptionRegistry.addConfigOptionProvider(configOptionsProviderMock);
ConfigDescription res = configDescriptionRegistry.getConfigDescription(URI_ALIASED);
ConfigDescription res = configDescriptionRegistry.getConfigDescription(uriAliases);
assertThat(res, is(notNullValue()));
assertThat(res.getParameters().get(0).getOptions().size(), is(1));
assertThat(res.getParameters().get(0).getOptions().get(0).getLabel(), is("Original"));
assertThat(res.getUID(), is(URI_ALIASED));
assertThat(res.getUID(), is(uriAliases));
configDescriptionRegistry.removeConfigDescriptionProvider(configDescriptionProviderMock);
assertThat(configDescriptionRegistry.getConfigDescriptions().size(), is(0));
}
@Test
public void testGetConfigDescriptions_aliasedMixes() throws Exception {
public void testGetConfigDescriptionsAliasedMixes() throws Exception {
assertThat(configDescriptionRegistry.getConfigDescriptions().size(), is(0));
configDescriptionRegistry.addConfigDescriptionProvider(configDescriptionProviderMock);
configDescriptionRegistry.addConfigDescriptionAliasProvider(aliasProvider);
ConfigDescription res1 = configDescriptionRegistry.getConfigDescription(URI_ALIASED);
ConfigDescription res1 = configDescriptionRegistry.getConfigDescription(uriAliases);
assertThat(res1, is(notNullValue()));
assertThat(res1.getParameters().size(), is(1));
configDescriptionRegistry.addConfigDescriptionProvider(configDescriptionProviderAliased);
ConfigDescription res2 = configDescriptionRegistry.getConfigDescription(URI_ALIASED);
ConfigDescription res2 = configDescriptionRegistry.getConfigDescription(uriAliases);
assertThat(res2, is(notNullValue()));
assertThat(res2.getParameters().size(), is(2));

View File

@ -75,7 +75,7 @@ public class MetadataConfigDescriptionProviderImplTest extends JavaTest {
}
@Test
public void testGetConfigDescriptions_noOptions() {
public void testGetConfigDescriptionsNoOptions() {
service.addMetadataConfigDescriptionProvider(mockProviderLiberal);
Collection<ConfigDescription> res = service.getConfigDescriptions(Locale.ENGLISH);
@ -93,7 +93,7 @@ public class MetadataConfigDescriptionProviderImplTest extends JavaTest {
}
@Test
public void testGetConfigDescriptions_withOptions() {
public void testGetConfigDescriptionsWithOptions() {
service.addMetadataConfigDescriptionProvider(mockProviderRestricted);
Collection<ConfigDescription> res = service.getConfigDescriptions(Locale.ENGLISH);
@ -113,7 +113,7 @@ public class MetadataConfigDescriptionProviderImplTest extends JavaTest {
}
@Test
public void testGetConfigDescription_wrongScheme() {
public void testGetConfigDescriptionWrongScheme() {
service.addMetadataConfigDescriptionProvider(mockProviderRestricted);
service.addMetadataConfigDescriptionProvider(mockProviderLiberal);
@ -121,7 +121,7 @@ public class MetadataConfigDescriptionProviderImplTest extends JavaTest {
}
@Test
public void testGetConfigDescription_valueDescription() {
public void testGetConfigDescriptionValueDescription() {
service.addMetadataConfigDescriptionProvider(mockProviderRestricted);
service.addMetadataConfigDescriptionProvider(mockProviderLiberal);
@ -137,7 +137,7 @@ public class MetadataConfigDescriptionProviderImplTest extends JavaTest {
}
@Test
public void testGetConfigDescription_valueDescriptionNonExistingNamespace() {
public void testGetConfigDescriptionValueDescriptionNonExistingNamespace() {
service.addMetadataConfigDescriptionProvider(mockProviderRestricted);
service.addMetadataConfigDescriptionProvider(mockProviderLiberal);
@ -146,7 +146,7 @@ public class MetadataConfigDescriptionProviderImplTest extends JavaTest {
}
@Test
public void testGetConfigDescription_propertiesDescription() {
public void testGetConfigDescriptionPropertiesDescription() {
service.addMetadataConfigDescriptionProvider(mockProviderRestricted);
service.addMetadataConfigDescriptionProvider(mockProviderLiberal);
@ -163,7 +163,7 @@ public class MetadataConfigDescriptionProviderImplTest extends JavaTest {
}
@Test
public void testGetConfigDescription_propertiesDescriptionNonExistingNamespace() {
public void testGetConfigDescriptionPropertiesDescriptionNonExistingNamespace() {
service.addMetadataConfigDescriptionProvider(mockProviderRestricted);
service.addMetadataConfigDescriptionProvider(mockProviderLiberal);
@ -172,7 +172,7 @@ public class MetadataConfigDescriptionProviderImplTest extends JavaTest {
}
@Test
public void testGetConfigDescription_propertiesDescriptionNonExistingValue() {
public void testGetConfigDescriptionPropertiesDescriptionNonExistingValue() {
service.addMetadataConfigDescriptionProvider(mockProviderRestricted);
service.addMetadataConfigDescriptionProvider(mockProviderLiberal);

View File

@ -64,11 +64,11 @@ public class ConfigStatusServiceTest extends JavaTest {
private static final String ARGS = "args";
private final ConfigStatusMessage PARAM1_MSG1 = ConfigStatusMessage.Builder.information(PARAM1)
private static final ConfigStatusMessage PARAM1_MSG1 = ConfigStatusMessage.Builder.information(PARAM1)
.withMessageKeySuffix(MSG_KEY1).build();
private final ConfigStatusMessage PARAM2_MSG2 = ConfigStatusMessage.Builder.warning(PARAM2)
private static final ConfigStatusMessage PARAM2_MSG2 = ConfigStatusMessage.Builder.warning(PARAM2)
.withMessageKeySuffix(MSG_KEY2).withStatusCode(1).withArguments(ARGS).build();
private final ConfigStatusMessage PARAM3_MSG3 = ConfigStatusMessage.Builder.error(PARAM3)
private static final ConfigStatusMessage PARAM3_MSG3 = ConfigStatusMessage.Builder.error(PARAM3)
.withMessageKeySuffix(MSG_KEY3).withStatusCode(2).withArguments(ARGS).build();
private final Collection<ConfigStatusMessage> messagesEntity1 = new ArrayList<>();

View File

@ -65,7 +65,7 @@ public class InboxPredicatesTest {
.collect(Collectors.toMap(Entry::getKey, Entry::getValue)));
private static final Map<String, Object> PROPS2 = Collections.singletonMap(PROP2, PROP_VAL2);
private static final List<DiscoveryResultImpl> results = Arrays.asList(
private static final List<DiscoveryResultImpl> RESULTS = Arrays.asList(
new DiscoveryResultImpl(THING_TYPE_UID11, THING_UID11, null, PROPS1, PROP1, "label",
DiscoveryResult.TTL_UNLIMITED),
new DiscoveryResultImpl(THING_TYPE_UID11, THING_UID12, null, PROPS1, null, "label",
@ -77,95 +77,95 @@ public class InboxPredicatesTest {
@Before
public void setUp() throws Exception {
results.get(3).setFlag(DiscoveryResultFlag.IGNORED);
RESULTS.get(3).setFlag(DiscoveryResultFlag.IGNORED);
}
@Test
public void testForBinding() {
assertThat(results.stream().filter(forBinding(BINDING_ID1)).collect(Collectors.toList()).size(), is(3));
assertThat(RESULTS.stream().filter(forBinding(BINDING_ID1)).collect(Collectors.toList()).size(), is(3));
assertThat(results.stream().filter(forBinding(BINDING_ID2)).collect(Collectors.toList()).size(), is(1));
assertThat(results.stream().filter(forBinding(BINDING_ID2)).collect(Collectors.toList()).get(0),
is(equalTo(results.get(3))));
assertThat(RESULTS.stream().filter(forBinding(BINDING_ID2)).collect(Collectors.toList()).size(), is(1));
assertThat(RESULTS.stream().filter(forBinding(BINDING_ID2)).collect(Collectors.toList()).get(0),
is(equalTo(RESULTS.get(3))));
assertThat(results.stream().filter(forBinding(BINDING_ID2)).filter(withFlag(DiscoveryResultFlag.NEW))
assertThat(RESULTS.stream().filter(forBinding(BINDING_ID2)).filter(withFlag(DiscoveryResultFlag.NEW))
.collect(Collectors.toList()).size(), is(0));
assertThat(results.stream().filter(forBinding(BINDING_ID2)).filter(withFlag(DiscoveryResultFlag.IGNORED))
assertThat(RESULTS.stream().filter(forBinding(BINDING_ID2)).filter(withFlag(DiscoveryResultFlag.IGNORED))
.collect(Collectors.toList()).size(), is(1));
assertThat(results.stream().filter(forBinding(BINDING_ID2)).filter(withFlag(DiscoveryResultFlag.IGNORED))
.collect(Collectors.toList()).get(0), is(equalTo(results.get(3))));
assertThat(RESULTS.stream().filter(forBinding(BINDING_ID2)).filter(withFlag(DiscoveryResultFlag.IGNORED))
.collect(Collectors.toList()).get(0), is(equalTo(RESULTS.get(3))));
}
@Test
public void testForThingTypeUID() {
assertThat(results.stream().filter(forThingTypeUID(THING_TYPE_UID11)).collect(Collectors.toList()).size(),
assertThat(RESULTS.stream().filter(forThingTypeUID(THING_TYPE_UID11)).collect(Collectors.toList()).size(),
is(2));
assertThat(results.stream().filter(forThingTypeUID(THING_TYPE_UID12)).collect(Collectors.toList()).size(),
assertThat(RESULTS.stream().filter(forThingTypeUID(THING_TYPE_UID12)).collect(Collectors.toList()).size(),
is(1));
assertThat(results.stream().filter(forThingTypeUID(THING_TYPE_UID12)).collect(Collectors.toList()).get(0),
is(equalTo(results.get(2))));
assertThat(RESULTS.stream().filter(forThingTypeUID(THING_TYPE_UID12)).collect(Collectors.toList()).get(0),
is(equalTo(RESULTS.get(2))));
}
@Test
public void testForThingUID() {
assertThat(results.stream().filter(forThingUID(THING_UID11)).collect(Collectors.toList()).size(), is(1));
assertThat(results.stream().filter(forThingUID(THING_UID11)).collect(Collectors.toList()).get(0),
is(equalTo(results.get(0))));
assertThat(RESULTS.stream().filter(forThingUID(THING_UID11)).collect(Collectors.toList()).size(), is(1));
assertThat(RESULTS.stream().filter(forThingUID(THING_UID11)).collect(Collectors.toList()).get(0),
is(equalTo(RESULTS.get(0))));
assertThat(results.stream().filter(forThingUID(THING_UID12)).collect(Collectors.toList()).size(), is(2));
assertThat(results.stream().filter(forThingUID(THING_UID12)).filter(forThingTypeUID(THING_TYPE_UID12))
assertThat(RESULTS.stream().filter(forThingUID(THING_UID12)).collect(Collectors.toList()).size(), is(2));
assertThat(RESULTS.stream().filter(forThingUID(THING_UID12)).filter(forThingTypeUID(THING_TYPE_UID12))
.collect(Collectors.toList()).size(), is(1));
assertThat(results.stream().filter(forThingUID(THING_UID12)).filter(forThingTypeUID(THING_TYPE_UID12))
.collect(Collectors.toList()).get(0), is(equalTo(results.get(2))));
assertThat(RESULTS.stream().filter(forThingUID(THING_UID12)).filter(forThingTypeUID(THING_TYPE_UID12))
.collect(Collectors.toList()).get(0), is(equalTo(RESULTS.get(2))));
}
@Test
public void testWithFlag() {
assertThat(results.stream().filter(withFlag(DiscoveryResultFlag.NEW)).collect(Collectors.toList()).size(),
assertThat(RESULTS.stream().filter(withFlag(DiscoveryResultFlag.NEW)).collect(Collectors.toList()).size(),
is(3));
assertThat(results.stream().filter(withFlag(DiscoveryResultFlag.IGNORED)).collect(Collectors.toList()).size(),
assertThat(RESULTS.stream().filter(withFlag(DiscoveryResultFlag.IGNORED)).collect(Collectors.toList()).size(),
is(1));
assertThat(results.stream().filter(withFlag(DiscoveryResultFlag.IGNORED)).collect(Collectors.toList()).get(0),
is(equalTo(results.get(3))));
assertThat(RESULTS.stream().filter(withFlag(DiscoveryResultFlag.IGNORED)).collect(Collectors.toList()).get(0),
is(equalTo(RESULTS.get(3))));
}
@Test
public void testWithProperty() {
assertThat(results.stream().filter(withProperty(PROP1, PROP_VAL1)).collect(Collectors.toList()).size(), is(2));
assertThat(results.stream().filter(withProperty(PROP2, PROP_VAL2)).collect(Collectors.toList()).size(), is(4));
assertThat(results.stream().filter(withProperty(PROP1, PROP_VAL2)).collect(Collectors.toList()).size(), is(0));
assertThat(results.stream().filter(withProperty(PROP2, PROP_VAL1)).collect(Collectors.toList()).size(), is(0));
assertThat(results.stream().filter(withProperty(null, PROP_VAL1)).collect(Collectors.toList()).size(), is(0));
assertThat(RESULTS.stream().filter(withProperty(PROP1, PROP_VAL1)).collect(Collectors.toList()).size(), is(2));
assertThat(RESULTS.stream().filter(withProperty(PROP2, PROP_VAL2)).collect(Collectors.toList()).size(), is(4));
assertThat(RESULTS.stream().filter(withProperty(PROP1, PROP_VAL2)).collect(Collectors.toList()).size(), is(0));
assertThat(RESULTS.stream().filter(withProperty(PROP2, PROP_VAL1)).collect(Collectors.toList()).size(), is(0));
assertThat(RESULTS.stream().filter(withProperty(null, PROP_VAL1)).collect(Collectors.toList()).size(), is(0));
}
@Test
public void testWithRepresentationProperty() {
assertThat(results.stream().filter(withRepresentationProperty(PROP1)).collect(Collectors.toList()).size(),
assertThat(RESULTS.stream().filter(withRepresentationProperty(PROP1)).collect(Collectors.toList()).size(),
is(1));
assertThat(results.stream().filter(withRepresentationProperty(PROP1)).collect(Collectors.toList()).get(0),
is(equalTo(results.get(0))));
assertThat(results.stream().filter(withRepresentationProperty(PROP2)).collect(Collectors.toList()).size(),
assertThat(RESULTS.stream().filter(withRepresentationProperty(PROP1)).collect(Collectors.toList()).get(0),
is(equalTo(RESULTS.get(0))));
assertThat(RESULTS.stream().filter(withRepresentationProperty(PROP2)).collect(Collectors.toList()).size(),
is(1));
assertThat(results.stream().filter(withRepresentationProperty(PROP2)).collect(Collectors.toList()).get(0),
is(equalTo(results.get(2))));
assertThat(RESULTS.stream().filter(withRepresentationProperty(PROP2)).collect(Collectors.toList()).get(0),
is(equalTo(RESULTS.get(2))));
}
@Test
public void testWithRepresentationPropertyValue() {
assertThat(
results.stream().filter(withRepresentationPropertyValue(PROP_VAL1)).collect(Collectors.toList()).size(),
RESULTS.stream().filter(withRepresentationPropertyValue(PROP_VAL1)).collect(Collectors.toList()).size(),
is(1));
assertThat(
results.stream().filter(withRepresentationPropertyValue(PROP_VAL1)).collect(Collectors.toList()).get(0),
is(equalTo(results.get(0))));
RESULTS.stream().filter(withRepresentationPropertyValue(PROP_VAL1)).collect(Collectors.toList()).get(0),
is(equalTo(RESULTS.get(0))));
assertThat(
results.stream().filter(withRepresentationPropertyValue(PROP_VAL2)).collect(Collectors.toList()).size(),
RESULTS.stream().filter(withRepresentationPropertyValue(PROP_VAL2)).collect(Collectors.toList()).size(),
is(1));
assertThat(
results.stream().filter(withRepresentationPropertyValue(PROP_VAL2)).collect(Collectors.toList()).get(0),
is(equalTo(results.get(2))));
RESULTS.stream().filter(withRepresentationPropertyValue(PROP_VAL2)).collect(Collectors.toList()).get(0),
is(equalTo(RESULTS.get(2))));
}
}

View File

@ -103,7 +103,7 @@ public class PersistentInboxTest {
}
@Test
public void testConfigUpdateNormalization_guessType() {
public void testConfigUpdateNormalizationGuessType() {
Map<String, Object> props = new HashMap<>();
props.put("foo", 1);
Configuration config = new Configuration(props);
@ -121,7 +121,7 @@ public class PersistentInboxTest {
}
@Test
public void testConfigUpdateNormalization_withConfigDescription() throws Exception {
public void testConfigUpdateNormalizationWithConfigDescription() throws Exception {
Map<String, Object> props = new HashMap<>();
props.put("foo", "1");
Configuration config = new Configuration(props);

View File

@ -62,7 +62,7 @@ public class ChannelTypeResourceTest {
}
@Test
public void getAll_shouldRetrieveAllChannelTypes() throws Exception {
public void getAllShouldRetrieveAllChannelTypes() throws Exception {
channelTypeResource.getAll(null);
verify(channelTypeRegistry).getChannelTypes(any(Locale.class));
}

View File

@ -73,17 +73,17 @@ public class MetadataSelectorMatcherTest {
}
@Test
public void nullSelector_shouldReturnEmptySet() {
public void nullSelectorShouldReturnEmptySet() {
assertThat(matcher.filterNamespaces(null, null), is(Collections.emptySet()));
}
@Test
public void emptySelector_shouldReturnEmptySet() {
public void emptySelectorShouldReturnEmptySet() {
assertThat(matcher.filterNamespaces("", null), is(Collections.emptySet()));
}
@Test
public void specificSelector_shouldReturnSpecificNamespace() {
public void specificSelectorShouldReturnSpecificNamespace() {
assertThat(matcher.filterNamespaces("alexa", null), hasSize(1));
assertThat(matcher.filterNamespaces("alexa", null), hasItem("alexa"));
assertThat(matcher.filterNamespaces("magic", null), hasSize(1));
@ -95,13 +95,13 @@ public class MetadataSelectorMatcherTest {
}
@Test
public void regularExpression_shouldMatchSubset() {
public void regularExpressionShouldMatchSubset() {
assertThat(matcher.filterNamespaces(".*", null), hasSize(4));
assertThat(matcher.filterNamespaces("magic.?", null), hasSize(2));
}
@Test
public void nonConfigDescriptionSelector_shouldBeResult() {
public void nonConfigDescriptionSelectorShouldBeResult() {
assertThat(matcher.filterNamespaces("magic, foo, bar", null), hasItems("magic", "foo", "bar"));
}
}

View File

@ -138,7 +138,7 @@ public class SitemapResourceTest extends JavaTest {
}
@Test
public void whenNoSitemapProvidersAreSet_ShouldReturnEmptyList() {
public void whenNoSitemapProvidersAreSetShouldReturnEmptyList() {
sitemapResource.removeSitemapProvider(sitemapProvider);
Response sitemaps = sitemapResource.getSitemaps();
@ -147,7 +147,7 @@ public class SitemapResourceTest extends JavaTest {
}
@Test
public void whenSitemapsAreProvided_ShouldReturnSitemapBeans() {
public void whenSitemapsAreProvidedShouldReturnSitemapBeans() {
Response sitemaps = sitemapResource.getSitemaps();
assertThat((Collection<?>) sitemaps.getEntity(), hasSize(1));
@ -159,7 +159,7 @@ public class SitemapResourceTest extends JavaTest {
}
@Test
public void whenLongPolling_ShouldObserveItems() {
public void whenLongPollingShouldObserveItems() {
new Thread(() -> {
try {
Thread.sleep(STATE_UPDATE_WAIT_TIME); // wait for the #getPageData call and listeners to attach to the
@ -180,7 +180,7 @@ public class SitemapResourceTest extends JavaTest {
}
@Test
public void whenLongPolling_ShouldObserveItemsFromVisibilityRules() {
public void whenLongPollingShouldObserveItemsFromVisibilityRules() {
new Thread(() -> {
try {
Thread.sleep(STATE_UPDATE_WAIT_TIME); // wait for the #getPageData call and listeners to attach to the
@ -201,7 +201,7 @@ public class SitemapResourceTest extends JavaTest {
}
@Test
public void whenLongPolling_ShouldObserveItemsFromLabelColorConditions() {
public void whenLongPollingShouldObserveItemsFromLabelColorConditions() {
new Thread(() -> {
try {
Thread.sleep(STATE_UPDATE_WAIT_TIME); // wait for the #getPageData call and listeners to attach to the
@ -222,7 +222,7 @@ public class SitemapResourceTest extends JavaTest {
}
@Test
public void whenLongPolling_ShouldObserveItemsFromValueColorConditions() {
public void whenLongPollingShouldObserveItemsFromValueColorConditions() {
new Thread(() -> {
try {
Thread.sleep(STATE_UPDATE_WAIT_TIME); // wait for the #getPageData call and listeners to attach to the
@ -243,7 +243,7 @@ public class SitemapResourceTest extends JavaTest {
}
@Test
public void whenGetPageData_ShouldReturnPageBean() throws ItemNotFoundException {
public void whenGetPageDataShouldReturnPageBean() throws ItemNotFoundException {
item.setState(new PercentType(50));
configureItemUIRegistry(item.getState(), OnOffType.ON);

View File

@ -31,6 +31,11 @@ import org.junit.Test;
import com.google.gson.JsonObject;
/**
* Tests {@link JSONResponse}.
*
* @author Henning Treu - Initial contribution
*/
public class JSONResponseTest {
private static final String ENTITY_VALUE = "entityValue";

View File

@ -28,11 +28,16 @@ import org.junit.Test;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
/**
* Tests {@link Stream2JSONInputStream}.
*
* @author Henning Treu - Initial contribution
*/
public class Stream2JSONInputStreamTest {
private Stream2JSONInputStream collection2InputStream;
private final Gson GSON = new GsonBuilder().create();
private static final Gson GSON = new GsonBuilder().create();
@Test(expected = IllegalArgumentException.class)
public void shouldFailForNullSource() throws IOException {

View File

@ -73,7 +73,6 @@ public class MqttAsyncClientEx extends MqttAsyncClient {
@Override
public IMqttDeliveryToken publish(String topic, byte[] payload, int qos, boolean retained, Object userContext,
IMqttActionListener callback) throws MqttException, MqttPersistenceException {
if (connection.publishSuccess) {
callback.onSuccess(getToken(userContext, callback, topic));
} else {

View File

@ -34,6 +34,11 @@ import org.jupnp.model.types.UDN;
import org.jupnp.registry.Registry;
import org.mockito.Mock;
/**
* Tests {@link UpnpIOServiceImpl}.
*
* @author Andre Fuechsel - Initial contribution
*/
public class UpnpIOServiceTest {
private static final String UDN_1_STRING = "UDN";
@ -90,7 +95,7 @@ public class UpnpIOServiceTest {
}
@Test
public void testIsRegistered_everythingEmptyInitially() {
public void testIsRegisteredEverythingEmptyInitially() {
assertTrue(upnpIoService.isRegistered(upnpIoParticipant));
assertThatEverythingIsEmpty();
}

View File

@ -114,7 +114,7 @@ public class MappingUriExtensionsTest {
}
@Test
public void testToPath_emfURI() {
public void testToPathEmfURI() {
MappingUriExtensions mapper = createMapper();
mapper.toUri(request);

View File

@ -33,14 +33,14 @@ public class JavaTestTest {
}
@Test
public void waitForAssertShouldRunAfterLastCall_whenAssertionSucceeds() {
public void waitForAssertShouldRunAfterLastCallWhenAssertionSucceeds() {
Runnable afterLastCall = mock(Runnable.class);
javaTest.waitForAssert(() -> assertTrue(true), null, afterLastCall, 100, 50);
verify(afterLastCall, times(1)).run();
}
@Test
public void waitForAssertShouldRunAfterLastCall_whenAssertionFails() {
public void waitForAssertShouldRunAfterLastCallWhenAssertionFails() {
Runnable afterLastCall = mock(Runnable.class);
try {
javaTest.waitForAssert(() -> assertTrue(false), null, afterLastCall, 100, 50);

View File

@ -23,12 +23,12 @@ import org.junit.Test;
public class XmlHelperTest {
@Test
public void whenUIDContainsDot_shouldBeconvcertedToColon() {
public void whenUIDContainsDotShouldBeconvcertedToColon() {
assertThat(XmlHelper.getSystemUID("system.test"), is("system:test"));
}
@Test
public void whenNoPrefixIsGiven_shouldPrependSystemPrefix() {
public void whenNoPrefixIsGivenShouldPrependSystemPrefix() {
assertThat(XmlHelper.getSystemUID("test"), is("system:test"));
}
}

View File

@ -68,20 +68,20 @@ public class ThingBuilderTest {
}
@Test(expected = IllegalArgumentException.class)
public void testWithChannel_duplicates() {
public void testWithChannelDuplicates() {
thingBuilder.withChannel(ChannelBuilder.create(new ChannelUID(THING_UID, "channel1"), "").build());
thingBuilder.withChannel(ChannelBuilder.create(new ChannelUID(THING_UID, "channel1"), "").build());
}
@Test(expected = IllegalArgumentException.class)
public void testWithChannels_duplicatesCollections() {
public void testWithChannelsDuplicatesCollections() {
thingBuilder.withChannels(Arrays.asList( //
ChannelBuilder.create(new ChannelUID(THING_UID, "channel1"), "").build(), //
ChannelBuilder.create(new ChannelUID(THING_UID, "channel1"), "").build()));
}
@Test(expected = IllegalArgumentException.class)
public void testWithChannels_duplicatesVararg() {
public void testWithChannelsDuplicatesVararg() {
thingBuilder.withChannels( //
ChannelBuilder.create(new ChannelUID(THING_UID, "channel1"), "").build(), //
ChannelBuilder.create(new ChannelUID(THING_UID, "channel1"), "").build());
@ -99,7 +99,7 @@ public class ThingBuilderTest {
}
@Test
public void testWithoutChannel_missing() {
public void testWithoutChannelMissing() {
thingBuilder.withChannels( //
ChannelBuilder.create(new ChannelUID(THING_UID, "channel1"), "").build(), //
ChannelBuilder.create(new ChannelUID(THING_UID, "channel2"), "").build());
@ -108,7 +108,7 @@ public class ThingBuilderTest {
}
@Test(expected = IllegalArgumentException.class)
public void testWithChannel_wrongThing() {
public void testWithChannelWrongThing() {
thingBuilder.withChannel(
ChannelBuilder.create(new ChannelUID(new ThingUID(THING_TYPE_UID, "wrong"), "channel1"), "").build());
}

View File

@ -45,11 +45,9 @@ public class FirmwareEventFactoryTest extends JavaTest {
@Test
public void testSupportedEventTypes() {
Set<String> supportedEventTypes = eventFactory.getSupportedEventTypes();
assertThat(supportedEventTypes, containsInAnyOrder(FirmwareStatusInfoEvent.TYPE,
FirmwareUpdateProgressInfoEvent.TYPE, FirmwareUpdateResultInfoEvent.TYPE));
}
@Test(expected = IllegalArgumentException.class)

View File

@ -151,14 +151,14 @@ public class AutoUpdateManagerTest {
}
@Test
public void testAutoUpdate_noLink() {
public void testAutoUpdateNoLink() {
aum.receiveCommand(event, item);
assertStateEvent("AFTER", AutoUpdateManager.EVENT_SOURCE);
}
@Test
public void testAutoUpdate_noPolicy() {
public void testAutoUpdateNoPolicy() {
links.add(new ItemChannelLink("test", CHANNEL_UID_ONLINE_1));
aum.receiveCommand(event, item);
@ -167,7 +167,7 @@ public class AutoUpdateManagerTest {
}
@Test
public void testAutoUpdate_noPolicy_thingOFFLINE() {
public void testAutoUpdateNoPolicyThingOFFLINE() {
links.add(new ItemChannelLink("test", CHANNEL_UID_OFFLINE_1));
aum.receiveCommand(event, item);
@ -176,7 +176,7 @@ public class AutoUpdateManagerTest {
}
@Test
public void testAutoUpdate_noPolicy_thingOFFLINE_and_thingONLINE() {
public void testAutoUpdateNoPolicyThingOFFLINEandThingONLINE() {
links.add(new ItemChannelLink("test", CHANNEL_UID_OFFLINE_1));
links.add(new ItemChannelLink("test", CHANNEL_UID_ONLINE_1));
@ -186,7 +186,7 @@ public class AutoUpdateManagerTest {
}
@Test
public void testAutoUpdate_noPolicy_thingONLINE_and_thingOFFLINE() {
public void testAutoUpdateNoPolicyThingONLINEandThingOFFLINE() {
links.add(new ItemChannelLink("test", CHANNEL_UID_ONLINE_1));
links.add(new ItemChannelLink("test", CHANNEL_UID_OFFLINE_1));
@ -196,7 +196,7 @@ public class AutoUpdateManagerTest {
}
@Test
public void testAutoUpdate_noPolicy_noHandler() {
public void testAutoUpdateNoPolicyNoHandler() {
links.add(new ItemChannelLink("test", CHANNEL_UID_HANDLER_MISSING));
aum.receiveCommand(event, item);
@ -205,7 +205,7 @@ public class AutoUpdateManagerTest {
}
@Test
public void testAutoUpdate_noPolicy_noThing() {
public void testAutoUpdateNoPolicyNoThing() {
links.add(new ItemChannelLink("test", new ChannelUID(new ThingUID("test::missing"), "gone")));
aum.receiveCommand(event, item);
@ -214,7 +214,7 @@ public class AutoUpdateManagerTest {
}
@Test
public void testAutoUpdate_noPolicy_noChannel() {
public void testAutoUpdateNoPolicyNoChannel() {
links.add(new ItemChannelLink("test", CHANNEL_UID_ONLINE_GONE));
aum.receiveCommand(event, item);
@ -223,7 +223,7 @@ public class AutoUpdateManagerTest {
}
@Test
public void testAutoUpdate_policyVETO_thingONLINE() {
public void testAutoUpdatePolicyVETOThingONLINE() {
links.add(new ItemChannelLink("test", CHANNEL_UID_ONLINE_1));
setAutoUpdatePolicy(CHANNEL_UID_ONLINE_1, AutoUpdatePolicy.VETO);
@ -233,7 +233,7 @@ public class AutoUpdateManagerTest {
}
@Test
public void testAutoUpdate_policyRECOMMEND() {
public void testAutoUpdatePolicyRECOMMEND() {
links.add(new ItemChannelLink("test", CHANNEL_UID_ONLINE_1));
setAutoUpdatePolicy(CHANNEL_UID_ONLINE_1, AutoUpdatePolicy.RECOMMEND);
@ -243,7 +243,7 @@ public class AutoUpdateManagerTest {
}
@Test
public void testAutoUpdate_policyVETObeatsDEFAULT() {
public void testAutoUpdatePolicyVETObeatsDEFAULT() {
links.add(new ItemChannelLink("test", CHANNEL_UID_ONLINE_1));
links.add(new ItemChannelLink("test", CHANNEL_UID_ONLINE_2));
setAutoUpdatePolicy(CHANNEL_UID_ONLINE_1, AutoUpdatePolicy.VETO);
@ -255,7 +255,7 @@ public class AutoUpdateManagerTest {
}
@Test
public void testAutoUpdate_policyVETObeatsRECOMMEND() {
public void testAutoUpdatePolicyVETObeatsRECOMMEND() {
links.add(new ItemChannelLink("test", CHANNEL_UID_ONLINE_1));
links.add(new ItemChannelLink("test", CHANNEL_UID_ONLINE_2));
setAutoUpdatePolicy(CHANNEL_UID_ONLINE_1, AutoUpdatePolicy.VETO);
@ -267,7 +267,7 @@ public class AutoUpdateManagerTest {
}
@Test
public void testAutoUpdate_policyDEFAULTbeatsRECOMMEND() {
public void testAutoUpdatePolicyDEFAULTbeatsRECOMMEND() {
links.add(new ItemChannelLink("test", CHANNEL_UID_ONLINE_1));
links.add(new ItemChannelLink("test", CHANNEL_UID_ONLINE_2));
setAutoUpdatePolicy(CHANNEL_UID_ONLINE_1, AutoUpdatePolicy.DEFAULT);
@ -279,7 +279,7 @@ public class AutoUpdateManagerTest {
}
@Test
public void testAutoUpdate_errorInvalidatesVETO() {
public void testAutoUpdateErrorInvalidatesVETO() {
links.add(new ItemChannelLink("test", CHANNEL_UID_ONLINE_1));
links.add(new ItemChannelLink("test", CHANNEL_UID_ONLINE_GONE));
setAutoUpdatePolicy(CHANNEL_UID_ONLINE_1, AutoUpdatePolicy.RECOMMEND);
@ -291,7 +291,7 @@ public class AutoUpdateManagerTest {
}
@Test
public void testAutoUpdate_errorInvalidatesVETO2() {
public void testAutoUpdateErrorInvalidatesVETO2() {
links.add(new ItemChannelLink("test", CHANNEL_UID_ONLINE_1));
links.add(new ItemChannelLink("test", CHANNEL_UID_ONLINE_GONE));
setAutoUpdatePolicy(CHANNEL_UID_ONLINE_1, AutoUpdatePolicy.DEFAULT);
@ -303,7 +303,7 @@ public class AutoUpdateManagerTest {
}
@Test
public void testAutoUpdate_errorInvalidatesDEFAULT() {
public void testAutoUpdateErrorInvalidatesDEFAULT() {
links.add(new ItemChannelLink("test", CHANNEL_UID_ONLINE_1));
links.add(new ItemChannelLink("test", CHANNEL_UID_ONLINE_GONE));
setAutoUpdatePolicy(CHANNEL_UID_ONLINE_1, AutoUpdatePolicy.RECOMMEND);
@ -315,7 +315,7 @@ public class AutoUpdateManagerTest {
}
@Test
public void testAutoUpdate_multipleErrors() {
public void testAutoUpdateMultipleErrors() {
links.add(new ItemChannelLink("test", CHANNEL_UID_ONLINE_GONE));
links.add(new ItemChannelLink("test", CHANNEL_UID_ONLINE_GONE));
setAutoUpdatePolicy(CHANNEL_UID_ONLINE_GONE, AutoUpdatePolicy.DEFAULT);
@ -326,7 +326,7 @@ public class AutoUpdateManagerTest {
}
@Test
public void testAutoUpdate_disabled() {
public void testAutoUpdateDisabled() {
aum.modified(Collections.singletonMap(AutoUpdateManager.PROPERTY_ENABLED, "false"));
aum.receiveCommand(event, item);
@ -335,7 +335,7 @@ public class AutoUpdateManagerTest {
}
@Test
public void testAutoUpdate_sendOptimisticUpdates() {
public void testAutoUpdateSendOptimisticUpdates() {
links.add(new ItemChannelLink("test", CHANNEL_UID_ONLINE_1));
aum.modified(Collections.singletonMap(AutoUpdateManager.PROPERTY_SEND_OPTIMISTIC_UPDATES, "true"));

View File

@ -83,13 +83,13 @@ public class ChannelItemProviderTest {
}
@Test
public void testItemCreation_notThere() throws Exception {
public void testItemCreationNotThere() throws Exception {
provider.linkRegistryListener.added(new ItemChannelLink(ITEM_NAME, CHANNEL_UID));
verify(listener, only()).added(same(provider), same(ITEM));
}
@Test
public void testItemCreation_alreadyExists() throws Exception {
public void testItemCreationAlreadyExists() throws Exception {
when(itemRegistry.get(eq(ITEM_NAME))).thenReturn(ITEM);
provider.linkRegistryListener.added(new ItemChannelLink(ITEM_NAME, CHANNEL_UID));
@ -97,7 +97,7 @@ public class ChannelItemProviderTest {
}
@Test
public void testItemRemoval_linkRemoved() throws Exception {
public void testItemRemovalLinkRemoved() throws Exception {
provider.linkRegistryListener.added(new ItemChannelLink(ITEM_NAME, CHANNEL_UID));
resetAndPrepareListener();
@ -108,7 +108,7 @@ public class ChannelItemProviderTest {
}
@Test
public void testItemRemoval_itemFromOtherProvider() throws Exception {
public void testItemRemovalItemFromOtherProvider() throws Exception {
provider.linkRegistryListener.added(new ItemChannelLink(ITEM_NAME, CHANNEL_UID));
resetAndPrepareListener();

View File

@ -43,12 +43,12 @@ public class ChannelGroupTypeBuilderTest {
}
@Test(expected = IllegalArgumentException.class)
public void whenLabelIsBlankForState_shouldFail() {
public void whenLabelIsBlankForStateShouldFail() {
ChannelGroupTypeBuilder.instance(CHANNEL_GROUP_TYPE_UID, "");
}
@Test
public void withLabelAndChannelGroupTypeUID_shouldCreateChannelGroupType() {
public void withLabelAndChannelGroupTypeUIDShouldCreateChannelGroupType() {
ChannelGroupType channelGroupType = builder.build();
assertEquals(CHANNEL_GROUP_TYPE_UID, channelGroupType.getUID());
@ -63,28 +63,28 @@ public class ChannelGroupTypeBuilderTest {
}
@Test
public void isAdvanced_shouldSetAdvanced() {
public void isAdvancedShouldSetAdvanced() {
ChannelGroupType channelGroupType = builder.isAdvanced(true).build();
assertTrue(channelGroupType.isAdvanced());
}
@Test
public void withDescription_shouldSetDescription() {
public void withDescriptionShouldSetDescription() {
ChannelGroupType channelGroupType = builder.withDescription(DESCRIPTION).build();
assertEquals(DESCRIPTION, channelGroupType.getDescription());
}
@Test
public void withCategory_shouldSetCategory() {
public void withCategoryShouldSetCategory() {
ChannelGroupType channelGroupType = builder.withCategory(CATEGORY).build();
assertEquals(CATEGORY, channelGroupType.getCategory());
}
@Test
public void withChannelDefinitions_shouldSetUnmodifiableChannelDefinitions() {
public void withChannelDefinitionsShouldSetUnmodifiableChannelDefinitions() {
ChannelGroupType channelGroupType = builder.withChannelDefinitions(mockList(ChannelDefinition.class, 2))
.build();

View File

@ -42,7 +42,7 @@ public class ChannelTypeBuilderTest {
private static final String LABEL = "label";
private static final String TAG = "tag";
private static final List<String> TAGS = Arrays.asList("TAG1", "TAG2");
private static URI CONFIGDESCRIPTION_URI;
private static URI configDescriptionUri;
private static final ChannelTypeUID CHANNEL_TYPE_UID = new ChannelTypeUID("bindingId", "channelId");
private static final StateDescription STATE_DESCRIPTION = new StateDescription(BigDecimal.ZERO, new BigDecimal(100),
BigDecimal.ONE, "%s", false, null);
@ -55,29 +55,29 @@ public class ChannelTypeBuilderTest {
@Before
public void setup() throws URISyntaxException {
CONFIGDESCRIPTION_URI = new URI("config:dummy");
configDescriptionUri = new URI("config:dummy");
// set up a valid basic ChannelTypeBuilder
stateBuilder = ChannelTypeBuilder.state(CHANNEL_TYPE_UID, LABEL, ITEM_TYPE);
triggerBuilder = ChannelTypeBuilder.trigger(CHANNEL_TYPE_UID, LABEL);
}
@Test(expected = IllegalArgumentException.class)
public void whenLabelIsBlankForState_shouldFail() {
public void whenLabelIsBlankForStateShouldFail() {
ChannelTypeBuilder.state(CHANNEL_TYPE_UID, "", ITEM_TYPE);
}
@Test(expected = IllegalArgumentException.class)
public void whenItemTypeIsBlankForState_shouldFail() {
public void whenItemTypeIsBlankForStateShouldFail() {
ChannelTypeBuilder.state(CHANNEL_TYPE_UID, LABEL, "");
}
@Test(expected = IllegalArgumentException.class)
public void whenLabelIsBlankForTrigger_shouldFail() {
public void whenLabelIsBlankForTriggerShouldFail() {
ChannelTypeBuilder.trigger(CHANNEL_TYPE_UID, "");
}
@Test
public void withLabelAndChannelTypeUID_shouldCreateChannelType() {
public void withLabelAndChannelTypeUIDShouldCreateChannelType() {
ChannelType channelType = stateBuilder.build();
assertThat(channelType.getUID(), is(CHANNEL_TYPE_UID));
@ -94,56 +94,56 @@ public class ChannelTypeBuilderTest {
}
@Test
public void isAdvanced_shouldSetAdvanced() {
public void isAdvancedShouldSetAdvanced() {
ChannelType channelType = stateBuilder.isAdvanced(true).build();
assertThat(channelType.isAdvanced(), is(true));
}
@Test
public void withDescription_shouldSetDescription() {
public void withDescriptionShouldSetDescription() {
ChannelType channelType = stateBuilder.withDescription(DESCRIPTION).build();
assertThat(channelType.getDescription(), is(DESCRIPTION));
}
@Test
public void withCategory_shouldSetCategory() {
public void withCategoryShouldSetCategory() {
ChannelType channelType = stateBuilder.withCategory(CATEGORY).build();
assertThat(channelType.getCategory(), is(CATEGORY));
}
@Test
public void withConfigDescriptionURI_shouldSetConfigDescriptionURI() {
ChannelType channelType = stateBuilder.withConfigDescriptionURI(CONFIGDESCRIPTION_URI).build();
public void withConfigDescriptionURIShouldSetConfigDescriptionURI() {
ChannelType channelType = stateBuilder.withConfigDescriptionURI(configDescriptionUri).build();
assertThat(channelType.getConfigDescriptionURI(), is(CONFIGDESCRIPTION_URI));
assertThat(channelType.getConfigDescriptionURI(), is(configDescriptionUri));
}
@Test
public void withTags_shouldSetTag() {
public void withTagsShouldSetTag() {
ChannelType channelType = stateBuilder.withTag(TAG).build();
assertThat(channelType.getTags(), is(hasSize(1)));
}
@Test
public void withTags_shouldSetTags() {
public void withTagsShouldSetTags() {
ChannelType channelType = stateBuilder.withTags(TAGS).build();
assertThat(channelType.getTags(), is(hasSize(2)));
}
@Test
public void withStateDescription_shouldSetStateDescription() {
public void withStateDescriptionShouldSetStateDescription() {
ChannelType channelType = stateBuilder.withStateDescription(STATE_DESCRIPTION).build();
assertThat(channelType.getState(), is(STATE_DESCRIPTION));
}
@Test
public void withEventDescription_shouldSetEventDescription() {
public void withEventDescriptionShouldSetEventDescription() {
ChannelType channelType = triggerBuilder.withEventDescription(EVENT_DESCRIPTION).build();
assertThat(channelType.getEvent(), is(EVENT_DESCRIPTION));

View File

@ -53,27 +53,27 @@ public class ThingTypeBuilderTest {
}
@Test(expected = IllegalArgumentException.class)
public void whenThingTypeIdAndBindingIdBlank_shouldFail() {
public void whenThingTypeIdAndBindingIdBlankShouldFail() {
ThingTypeBuilder.instance("", "", LABEL).build();
}
@Test(expected = IllegalArgumentException.class)
public void whenThingTypeIdBlank_shouldFail() {
public void whenThingTypeIdBlankShouldFail() {
ThingTypeBuilder.instance(BINDING_ID, "", LABEL).build();
}
@Test(expected = IllegalArgumentException.class)
public void whenBindingIdBlank_shouldFail() {
public void whenBindingIdBlankShouldFail() {
ThingTypeBuilder.instance("", THING_TYPE_ID, LABEL).build();
}
@Test(expected = IllegalArgumentException.class)
public void whenLabelBlank_shouldFail() {
public void whenLabelBlankShouldFail() {
ThingTypeBuilder.instance(THING_TYPE_ID, BINDING_ID, "").build();
}
@Test
public void withLabelAndThingTypeUID_shouldCreateThingType() {
public void withLabelAndThingTypeUIDShouldCreateThingType() {
ThingType thingType = ThingTypeBuilder.instance(new ThingTypeUID(BINDING_ID, THING_TYPE_ID), LABEL).build();
assertThat(thingType.getBindingId(), is(BINDING_ID));
@ -83,7 +83,7 @@ public class ThingTypeBuilderTest {
}
@Test
public void withLabelAndThingTypeIdAndBindingID_shouldCreateThingType() {
public void withLabelAndThingTypeIdAndBindingIDShouldCreateThingType() {
ThingType thingType = builder.build();
assertThat(thingType.getBindingId(), is(BINDING_ID));
@ -93,42 +93,42 @@ public class ThingTypeBuilderTest {
}
@Test
public void withLabelAndThingTypeIdAndBindingID_shouldSetListed() {
public void withLabelAndThingTypeIdAndBindingIDShouldSetListed() {
ThingType thingType = builder.build();
assertThat(thingType.isListed(), is(true));
}
@Test
public void withDescription_shouldSetDescription() {
public void withDescriptionShouldSetDescription() {
ThingType thingType = builder.withDescription(DESCRIPTION).build();
assertThat(thingType.getDescription(), is(DESCRIPTION));
}
@Test
public void withCategory_shouldSetCategory() {
public void withCategoryShouldSetCategory() {
ThingType thingType = builder.withCategory(CATEGORY).build();
assertThat(thingType.getCategory(), is(CATEGORY));
}
@Test
public void withListed_shouldBeListed() {
public void withListedShouldBeListed() {
ThingType thingType = builder.isListed(false).build();
assertThat(thingType.isListed(), is(false));
}
@Test
public void withRepresentationProperty_shouldSetRepresentationProperty() {
public void withRepresentationPropertyShouldSetRepresentationProperty() {
ThingType thingType = builder.withRepresentationProperty(REPRESENTATION_PROPERTY).build();
assertThat(thingType.getRepresentationProperty(), is(REPRESENTATION_PROPERTY));
}
@Test
public void withChannelDefinitions_shouldSetUnmodifiableChannelDefinitions() {
public void withChannelDefinitionsShouldSetUnmodifiableChannelDefinitions() {
ThingType thingType = builder.withChannelDefinitions(mockList(ChannelDefinition.class, 2)).build();
assertThat(thingType.getChannelDefinitions(), is(hasSize(2)));
@ -141,7 +141,7 @@ public class ThingTypeBuilderTest {
}
@Test
public void withChannelGroupDefinitions_shouldSetUnmodifiableChannelGroupDefinitions() {
public void withChannelGroupDefinitionsShouldSetUnmodifiableChannelGroupDefinitions() {
ThingType thingType = builder.withChannelGroupDefinitions(mockList(ChannelGroupDefinition.class, 2)).build();
assertThat(thingType.getChannelGroupDefinitions(), is(hasSize(2)));
@ -154,7 +154,7 @@ public class ThingTypeBuilderTest {
}
@Test
public void withProperties_shouldSetUnmodifiableProperties() {
public void withPropertiesShouldSetUnmodifiableProperties() {
ThingType thingType = builder.withProperties(mockProperties()).build();
assertThat(thingType.getProperties().entrySet(), is(hasSize(2)));
@ -167,14 +167,14 @@ public class ThingTypeBuilderTest {
}
@Test
public void withConfigDescriptionURI_shouldSetConfigDescriptionURI() throws Exception {
public void withConfigDescriptionURIShouldSetConfigDescriptionURI() throws Exception {
ThingType thingType = builder.withConfigDescriptionURI(new URI(CONF_URI)).build();
assertThat(thingType.getConfigDescriptionURI(), is(new URI(CONF_URI)));
}
@Test
public void withExtensibleChannelTypeIds_shouldSetUnmodifiableExtensibleChannelTypeIds() {
public void withExtensibleChannelTypeIdsShouldSetUnmodifiableExtensibleChannelTypeIds() {
ThingType thingType = builder
.withExtensibleChannelTypeIds(Arrays.asList(new String[] { "channelTypeId1", "channelTypeId2" }))
.build();
@ -189,7 +189,7 @@ public class ThingTypeBuilderTest {
}
@Test
public void withSupportedBridgeTypeUIDs_shouldSetUnmodifiableSupportedBridgeTypeUIDs() {
public void withSupportedBridgeTypeUIDsShouldSetUnmodifiableSupportedBridgeTypeUIDs() {
ThingType thingType = builder.withSupportedBridgeTypeUIDs(Arrays.asList(new String[] { "bridgeTypeUID1" }))
.build();

View File

@ -126,18 +126,18 @@ public class ThingHelperTest {
@Test(expected = IllegalArgumentException.class)
public void assertThatNoDuplicateChannelsCanBeAdded() {
ThingTypeUID THING_TYPE_UID = new ThingTypeUID("test", "test");
ThingUID THING_UID = new ThingUID(THING_TYPE_UID, "test");
ThingTypeUID thingTypeUID = new ThingTypeUID("test", "test");
ThingUID thingUID = new ThingUID(thingTypeUID, "test");
Thing thing = ThingBuilder.create(THING_TYPE_UID, THING_UID)
.withChannels(ChannelBuilder.create(new ChannelUID(THING_UID, "channel1"), "").build(),
ChannelBuilder.create(new ChannelUID(THING_UID, "channel2"), "").build())
Thing thing = ThingBuilder.create(thingTypeUID, thingUID)
.withChannels(ChannelBuilder.create(new ChannelUID(thingUID, "channel1"), "").build(),
ChannelBuilder.create(new ChannelUID(thingUID, "channel2"), "").build())
.build();
ThingHelper
.addChannelsToThing(thing,
Stream.of(ChannelBuilder.create(new ChannelUID(THING_UID, "channel2"), "").build(),
ChannelBuilder.create(new ChannelUID(THING_UID, "channel3"), "").build())
Stream.of(ChannelBuilder.create(new ChannelUID(thingUID, "channel2"), "").build(),
ChannelBuilder.create(new ChannelUID(thingUID, "channel3"), "").build())
.collect(toList()));
}
}

View File

@ -40,7 +40,6 @@ public class AbstractResourceIconProviderTest {
@Before
public void setUp() {
provider = new AbstractResourceIconProvider() {
@Override
protected InputStream getResource(String iconset, String resourceName) {

View File

@ -88,7 +88,7 @@ public class ItemUIRegistryImplTest {
}
@Test
public void getLabel_plainLabel() {
public void getLabelPlainLabel() {
String testLabel = "This is a plain text";
when(widget.getLabel()).thenReturn(testLabel);
@ -97,7 +97,7 @@ public class ItemUIRegistryImplTest {
}
@Test
public void getLabel_labelWithStaticValue() {
public void getLabelLabelWithStaticValue() {
String testLabel = "Label [value]";
when(widget.getLabel()).thenReturn(testLabel);
@ -106,7 +106,7 @@ public class ItemUIRegistryImplTest {
}
@Test
public void getLabel_labelWithStringValue() {
public void getLabelLabelWithStringValue() {
String testLabel = "Label [%s]";
when(widget.getLabel()).thenReturn(testLabel);
@ -116,7 +116,7 @@ public class ItemUIRegistryImplTest {
}
@Test
public void getLabel_labelWithStringValueFunction() {
public void getLabelLabelWithStringValueFunction() {
String testLabel = "Label [%s]";
when(widget.getLabel()).thenReturn(testLabel);
@ -126,7 +126,7 @@ public class ItemUIRegistryImplTest {
}
@Test
public void getLabel_labelWithIntegerValue() {
public void getLabelLabelWithIntegerValue() {
String testLabel = "Label [%d]";
when(widget.getLabel()).thenReturn(testLabel);
@ -137,7 +137,7 @@ public class ItemUIRegistryImplTest {
}
@Test
public void getLabel_labelWithIntegerValueAndWidth() {
public void getLabelLabelWithIntegerValueAndWidth() {
String testLabel = "Label [%3d]";
when(widget.getLabel()).thenReturn(testLabel);
@ -148,7 +148,7 @@ public class ItemUIRegistryImplTest {
}
@Test
public void getLabel_labelWithHexValueAndWidth() {
public void getLabelLabelWithHexValueAndWidth() {
String testLabel = "Label [%3x]";
when(widget.getLabel()).thenReturn(testLabel);
@ -159,7 +159,7 @@ public class ItemUIRegistryImplTest {
}
@Test
public void getLabel_labelWithDecimalValue() {
public void getLabelLabelWithDecimalValue() {
String testLabel = "Label [%.3f]";
when(widget.getLabel()).thenReturn(testLabel);
@ -170,7 +170,7 @@ public class ItemUIRegistryImplTest {
}
@Test
public void getLabel_labelWithDecimalValueAndUnit() {
public void getLabelLabelWithDecimalValueAndUnit() {
String testLabel = "Label [%.3f " + UnitUtils.UNIT_PLACEHOLDER + "]";
when(widget.getLabel()).thenReturn(testLabel);
@ -180,7 +180,7 @@ public class ItemUIRegistryImplTest {
}
@Test
public void getLabel_labelWithDecimalValueAndUnit2() {
public void getLabelLabelWithDecimalValueAndUnit2() {
String testLabel = "Label [%.0f " + UnitUtils.UNIT_PLACEHOLDER + "]";
when(widget.getLabel()).thenReturn(testLabel);
@ -190,7 +190,7 @@ public class ItemUIRegistryImplTest {
}
@Test
public void getLabel_labelWithDecimalValueAndUnit3() {
public void getLabelLabelWithDecimalValueAndUnit3() {
String testLabel = "Label [%d %%]";
when(widget.getLabel()).thenReturn(testLabel);
@ -200,7 +200,7 @@ public class ItemUIRegistryImplTest {
}
@Test
public void getLabel_labelWithDecimalValueAndUnit4() {
public void getLabelLabelWithDecimalValueAndUnit4() {
String testLabel = "Label [%.0f %%]";
when(widget.getLabel()).thenReturn(testLabel);
@ -210,7 +210,7 @@ public class ItemUIRegistryImplTest {
}
@Test
public void getLabel_labelWithDecimalValueAndUnit5() {
public void getLabelLabelWithDecimalValueAndUnit5() {
String testLabel = "Label [%d " + UnitUtils.UNIT_PLACEHOLDER + "]";
when(widget.getLabel()).thenReturn(testLabel);
@ -220,7 +220,7 @@ public class ItemUIRegistryImplTest {
}
@Test
public void getLabel_labelWithDecimalValueAndUnit6() {
public void getLabelLabelWithDecimalValueAndUnit6() {
String testLabel = "Label [%.0f " + UnitUtils.UNIT_PLACEHOLDER + "]";
when(widget.getLabel()).thenReturn(testLabel);
@ -230,7 +230,7 @@ public class ItemUIRegistryImplTest {
}
@Test
public void getLabel_labelWithDecimalValueAndUnit7() {
public void getLabelLabelWithDecimalValueAndUnit7() {
String testLabel = "Label [%d %%]";
when(widget.getLabel()).thenReturn(testLabel);
@ -240,7 +240,7 @@ public class ItemUIRegistryImplTest {
}
@Test
public void getLabel_labelWithDecimalValueAndUnitConversion() {
public void getLabelLabelWithDecimalValueAndUnitConversion() {
String testLabel = "Label [%.2f °F]";
when(widget.getLabel()).thenReturn(testLabel);
@ -250,7 +250,7 @@ public class ItemUIRegistryImplTest {
}
@Test
public void getLabel_labelWithPercent() {
public void getLabelLabelWithPercent() {
String testLabel = "Label [%.1f %%]";
when(widget.getLabel()).thenReturn(testLabel);
@ -261,7 +261,7 @@ public class ItemUIRegistryImplTest {
}
@Test
public void getLabel_labelWithPercentType() {
public void getLabelLabelWithPercentType() {
String testLabel = "Label [%d %%]";
when(widget.getLabel()).thenReturn(testLabel);
@ -271,7 +271,7 @@ public class ItemUIRegistryImplTest {
}
@Test
public void getLabel_labelWithDate() {
public void getLabelLabelWithDate() {
String testLabel = "Label [%1$td.%1$tm.%1$tY]";
when(widget.getLabel()).thenReturn(testLabel);
@ -293,7 +293,7 @@ public class ItemUIRegistryImplTest {
}
@Test
public void getLabel_labelWithZonedDate() throws ItemNotFoundException {
public void getLabelLabelWithZonedDate() throws ItemNotFoundException {
String testLabel = "Label [%1$td.%1$tm.%1$tY]";
Widget w = mock(Widget.class);
@ -319,7 +319,7 @@ public class ItemUIRegistryImplTest {
}
@Test
public void getLabel_labelWithTime() {
public void getLabelLabelWithTime() {
String testLabel = "Label [%1$tT]";
when(widget.getLabel()).thenReturn(testLabel);
@ -341,7 +341,7 @@ public class ItemUIRegistryImplTest {
}
@Test
public void getLabel_labelWithZonedTime() throws ItemNotFoundException {
public void getLabelLabelWithZonedTime() throws ItemNotFoundException {
String testLabel = "Label [%1$tT]";
Widget w = mock(Widget.class);
@ -367,20 +367,20 @@ public class ItemUIRegistryImplTest {
}
@Test
public void getLabel_widgetWithoutLabelAndItem() {
public void getLabelWidgetWithoutLabelAndItem() {
Widget w = mock(Widget.class);
String label = uiRegistry.getLabel(w);
assertEquals("", label);
}
@Test
public void getLabel_widgetWithoutLabel() {
public void getLabelWidgetWithoutLabel() {
String label = uiRegistry.getLabel(widget);
assertEquals("Item", label);
}
@Test
public void getLabel_labelFromUIProvider() {
public void getLabelLabelFromUIProvider() {
ItemUIProvider provider = mock(ItemUIProvider.class);
uiRegistry.addItemUIProvider(provider);
when(provider.getLabel(anyString())).thenReturn("ProviderLabel");
@ -390,7 +390,7 @@ public class ItemUIRegistryImplTest {
}
@Test
public void getLabel_labelForUndefinedStringItemState() {
public void getLabelLabelForUndefinedStringItemState() {
String testLabel = "Label [%s]";
when(widget.getLabel()).thenReturn(testLabel);
@ -400,7 +400,7 @@ public class ItemUIRegistryImplTest {
}
@Test
public void getLabel_labelForUndefinedIntegerItemState() {
public void getLabelLabelForUndefinedIntegerItemState() {
String testLabel = "Label [%d]";
when(widget.getLabel()).thenReturn(testLabel);
@ -410,7 +410,7 @@ public class ItemUIRegistryImplTest {
}
@Test
public void getLabel_labelForUndefinedDecimalItemState() {
public void getLabelLabelForUndefinedDecimalItemState() {
String testLabel = "Label [%.2f]";
when(widget.getLabel()).thenReturn(testLabel);
@ -420,7 +420,7 @@ public class ItemUIRegistryImplTest {
}
@Test
public void getLabel_labelForUndefinedDateItemState() {
public void getLabelLabelForUndefinedDateItemState() {
String testLabel = "Label [%1$td.%1$tm.%1$tY]";
when(widget.getLabel()).thenReturn(testLabel);
@ -430,7 +430,7 @@ public class ItemUIRegistryImplTest {
}
@Test
public void getLabel_labelForUndefinedQuantityItemState() {
public void getLabelLabelForUndefinedQuantityItemState() {
String testLabel = "Label [%.2f " + UnitUtils.UNIT_PLACEHOLDER + "]";
when(widget.getLabel()).thenReturn(testLabel);
@ -440,7 +440,7 @@ public class ItemUIRegistryImplTest {
}
@Test
public void getLabel_itemNotFound() throws ItemNotFoundException {
public void getLabelItemNotFound() throws ItemNotFoundException {
String testLabel = "Label [%s]";
when(widget.getLabel()).thenReturn(testLabel);
@ -452,7 +452,7 @@ public class ItemUIRegistryImplTest {
}
@Test
public void getLabel_labelWithFunctionValue() {
public void getLabelLabelWithFunctionValue() {
String testLabel = "Label [MAP(de.map):%s]";
when(widget.getLabel()).thenReturn(testLabel);
@ -462,7 +462,7 @@ public class ItemUIRegistryImplTest {
}
@Test
public void getLabel_groupLabelWithValue() {
public void getLabelGroupLabelWithValue() {
String testLabel = "Label [%d]";
when(widget.getLabel()).thenReturn(testLabel);
@ -473,7 +473,7 @@ public class ItemUIRegistryImplTest {
}
@Test
public void getWidget_UnknownPageId() throws ItemNotFoundException {
public void getWidgetUnknownPageId() throws ItemNotFoundException {
Sitemap sitemap = SitemapFactory.eINSTANCE.createSitemap();
when(registry.getItem("unknown")).thenThrow(new ItemNotFoundException("unknown"));
Widget w = uiRegistry.getWidget(sitemap, "unknown");
@ -554,7 +554,7 @@ public class ItemUIRegistryImplTest {
}
@Test
public void getLabel_labelWithoutStateDescription() {
public void getLabelLabelWithoutStateDescription() {
String testLabel = "Label";
when(widget.getLabel()).thenReturn(testLabel);
@ -565,7 +565,7 @@ public class ItemUIRegistryImplTest {
}
@Test
public void getLabel_labelWithoutPatternInStateDescription() {
public void getLabelLabelWithoutPatternInStateDescription() {
String testLabel = "Label";
StateDescription stateDescription = mock(StateDescription.class);
@ -578,7 +578,7 @@ public class ItemUIRegistryImplTest {
}
@Test
public void getLabel_labelWithPatternInStateDescription() {
public void getLabelLabelWithPatternInStateDescription() {
String testLabel = "Label";
StateDescription stateDescription = mock(StateDescription.class);
@ -591,7 +591,7 @@ public class ItemUIRegistryImplTest {
}
@Test
public void getLabel_labelWithEmptyPattern() {
public void getLabelLabelWithEmptyPattern() {
String testLabel = "Label []";
StateDescription stateDescription = mock(StateDescription.class);
@ -604,7 +604,7 @@ public class ItemUIRegistryImplTest {
}
@Test
public void getLabel_labelWithMappedOption() {
public void getLabelLabelWithMappedOption() {
String testLabel = "Label";
StateDescription stateDescription = mock(StateDescription.class);
@ -621,7 +621,7 @@ public class ItemUIRegistryImplTest {
}
@Test
public void getLabel_labelWithUnmappedOption() {
public void getLabelLabelWithUnmappedOption() {
String testLabel = "Label";
StateDescription stateDescription = mock(StateDescription.class);
@ -638,7 +638,7 @@ public class ItemUIRegistryImplTest {
}
@Test
public void getLabel_transformationContainingPercentS() throws ItemNotFoundException {
public void getLabelTransformationContainingPercentS() throws ItemNotFoundException {
// It doesn't matter that "FOO" doesn't exist - this is to assert it doesn't fail before because of the two "%s"
String testLabel = "Memory [FOO(echo %s):%s]";
Widget w = mock(Widget.class);
@ -652,7 +652,7 @@ public class ItemUIRegistryImplTest {
}
@Test
public void getLabelColor_labelWithDecimalValue() {
public void getLabelColorLabelWithDecimalValue() {
String testLabel = "Label [%.3f]";
when(widget.getLabel()).thenReturn(testLabel);
@ -672,7 +672,7 @@ public class ItemUIRegistryImplTest {
}
@Test
public void getLabelColor_labelWithUnitValue() {
public void getLabelColorLabelWithUnitValue() {
String testLabel = "Label [%.3f " + UnitUtils.UNIT_PLACEHOLDER + "]";
when(widget.getLabel()).thenReturn(testLabel);

View File

@ -63,7 +63,7 @@ public class ProxyServletServiceTest {
private static final String VALID_IMAGE_URL = "https://www.eclipse.org/smarthome/test.jpg";
private static final String VALID_VIDEO_URL = "https://www.eclipse.org/smarthome/test.mp4";
static private ProxyServletService service;
private static ProxyServletService service;
private ItemUIRegistry itemUIRegistry;
private ModelRepository modelRepository;

View File

@ -272,7 +272,7 @@ public class QueueingThreadPoolExecutorTest {
return new Runnable10s();
}
private static abstract class AbstractRunnable implements Runnable {
private abstract static class AbstractRunnable implements Runnable {
private static AtomicInteger runs = new AtomicInteger(0);
protected final Logger logger = LoggerFactory.getLogger(AbstractRunnable.class);

View File

@ -99,7 +99,6 @@ public class ThreadFactoryBuilderTest {
UncaughtExceptionHandler handler = new UncaughtExceptionHandler() {
@Override
public void uncaughtException(Thread t, Throwable e) {
}
};

View File

@ -34,14 +34,14 @@ import org.osgi.framework.Bundle;
public class ResourceBundleClassLoaderTest {
static URL createTmpTestPropetiesFile(Path root, String relativeFile) throws Exception {
Path file = Paths.get(relativeFile);
Path fileDir = file.getParent();
Path filePath = Paths.get(relativeFile);
Path dirPath = filePath.getParent();
new File(root.toFile(), fileDir.toString()).mkdirs();
File _file = new File(root.toFile(), relativeFile);
_file.createNewFile();
new File(root.toFile(), dirPath.toString()).mkdirs();
File file = new File(root.toFile(), relativeFile);
file.createNewFile();
return _file.toURL();
return file.toURL();
}
@Test

View File

@ -70,7 +70,6 @@ public class I18nProviderImplTest {
@Before
public void setup() {
initMocks(this);
initialConfig = buildInitialConfig();
when(componentContext.getProperties()).thenReturn(initialConfig);

View File

@ -70,7 +70,7 @@ public class MetadataRegistryImplTest {
}
@Test
public void testGet_empty() throws Exception {
public void testGetEmpty() throws Exception {
MetadataKey key = new MetadataKey("namespace", "itemName");
Metadata res = registry.get(key);

View File

@ -21,8 +21,6 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.smarthome.core.internal.service.StateDescriptionServiceImpl;
import org.eclipse.smarthome.core.library.items.NumberItem;
import org.eclipse.smarthome.core.types.StateDescription;
import org.eclipse.smarthome.core.types.StateDescriptionFragment;
@ -36,7 +34,7 @@ import org.junit.Test;
/**
* Tests for the StateDescriptionService implementation
*
* @author Lyubomir Papazov
* @author Lyubomir Papazov - Initial contribution
*/
@SuppressWarnings({ "deprecation", "null" })
public class StateDescriptionServiceImplTest {
@ -62,7 +60,7 @@ public class StateDescriptionServiceImplTest {
}
@Test
public void legacy_testServiceWithOneStateDescriptionProvider() {
public void legacyTestServiceWithOneStateDescriptionProvider() {
StateDescriptionProvider stateDescriptionProviderDefault = mock(StateDescriptionProvider.class);
when(stateDescriptionProviderDefault.getRank()).thenReturn(STATE_DESCRIPTION_PROVIDER_DEFAULT_SERVICE_RANKING);
StateDescription stateDescription = new StateDescription(STATE_DESCRIPTION_PROVIDER_DEFAULT_MIN_VALUE,
@ -83,7 +81,7 @@ public class StateDescriptionServiceImplTest {
}
@Test
public void legacy_testMinValueMaxValueStepAndPatternTwoDescriptionProviders() {
public void legacyTestMinValueMaxValueStepAndPatternTwoDescriptionProviders() {
StateDescription stateDescription1 = new StateDescription(new BigDecimal("-1"), new BigDecimal("-1"),
new BigDecimal("-1"), "pattern1", false, null);
StateDescription stateDescription2 = new StateDescription(new BigDecimal("-2"), new BigDecimal("-2"),
@ -100,7 +98,7 @@ public class StateDescriptionServiceImplTest {
}
@Test
public void legacy_testIsReadOnlyWhenTwoDescriptionProvidersHigherRankingIsNotReadOnly() {
public void legacyTestIsReadOnlyWhenTwoDescriptionProvidersHigherRankingIsNotReadOnly() {
StateDescription stateDescription1 = new StateDescription(null, null, null, null, false, null);
StateDescription stateDescription2 = new StateDescription(null, null, null, null, true, null);
@ -112,7 +110,7 @@ public class StateDescriptionServiceImplTest {
}
@Test
public void legacy_testIsReadOnlyWhenTwoDescriptionProvidersHigherRankingIsReadOnly() {
public void legacyTestIsReadOnlyWhenTwoDescriptionProvidersHigherRankingIsReadOnly() {
StateDescription stateDescription1 = new StateDescription(null, null, null, null, true, null);
StateDescription stateDescription2 = new StateDescription(null, null, null, null, false, null);
@ -124,7 +122,7 @@ public class StateDescriptionServiceImplTest {
}
@Test
public void legacy_testOptionsWhenTwoDescriptionProvidersHigherRankingProvidesOptions() {
public void legacyTestOptionsWhenTwoDescriptionProvidersHigherRankingProvidesOptions() {
StateDescription stateDescription1 = new StateDescription(null, null, null, null, false,
Arrays.asList(new StateOption("value", "label")));
StateDescription stateDescription2 = new StateDescription(null, null, null, null, false,
@ -138,7 +136,7 @@ public class StateDescriptionServiceImplTest {
}
@Test
public void legacy_testOptionsWhenTwoDescriptionProvidersHigherRankingDoesntProvideOptions() {
public void legacyTestOptionsWhenTwoDescriptionProvidersHigherRankingDoesntProvideOptions() {
StateDescription stateDescription1 = new StateDescription(null, null, null, null, false,
Collections.emptyList());
StateDescription stateDescription2 = new StateDescription(null, null, null, null, false,
@ -156,7 +154,7 @@ public class StateDescriptionServiceImplTest {
StateDescription stateDescription = new StateDescription(null, null, null, "pattern", false, null);
registerStateDescriptionProvider(stateDescription, 1);
List<@NonNull StateOption> options = Arrays.asList(new StateOption("value", "label"));
List<StateOption> options = Arrays.asList(new StateOption("value", "label"));
StateDescriptionFragment stateDescriptionFragment = StateDescriptionFragmentBuilder.create()
.withMinimum(BigDecimal.ZERO).withMaximum(BigDecimal.TEN).withOptions(options).build();
registerStateDescriptionFragmentProvider(stateDescriptionFragment, 1);
@ -172,18 +170,16 @@ public class StateDescriptionServiceImplTest {
@Test
public void testFragmentProviderOrder() {
List<@NonNull StateOption> options = Arrays.asList(new StateOption("value", "label"));
List<StateOption> options = Arrays.asList(new StateOption("value", "label"));
StateDescriptionFragment firstFragment = StateDescriptionFragmentBuilder.create()
.withMinimum(BigDecimal.ZERO) //
StateDescriptionFragment firstFragment = StateDescriptionFragmentBuilder.create().withMinimum(BigDecimal.ZERO) //
.withMaximum(BigDecimal.TEN) //
.withPattern("pattern") //
.withReadOnly(Boolean.TRUE) //
.withOptions(options).build();
registerStateDescriptionFragmentProvider(firstFragment, -1);
StateDescriptionFragment secondFragment = StateDescriptionFragmentBuilder.create()
.withMinimum(BigDecimal.ONE) //
StateDescriptionFragment secondFragment = StateDescriptionFragmentBuilder.create().withMinimum(BigDecimal.ONE) //
.withMaximum(BigDecimal.ONE) //
.withStep(BigDecimal.ONE) //
.withPattern("base_pattern") //

View File

@ -79,19 +79,19 @@ public class GenericItemTest {
@Test(expected = IllegalArgumentException.class)
public void testAddGroupNameWithNull() {
TestItem item = new TestItem("member1");
item.addGroupName(NULL());
item.addGroupName(toNull());
}
@Test(expected = IllegalArgumentException.class)
public void testAddGroupNamesWithNull() {
TestItem item = new TestItem("member1");
item.addGroupNames(Arrays.asList("group-a", NULL(), "group-b"));
item.addGroupNames(Arrays.asList("group-a", toNull(), "group-b"));
}
@Test(expected = IllegalArgumentException.class)
public void testRemoveGroupNameWithNull() {
TestItem item = new TestItem("member1");
item.removeGroupName(NULL());
item.removeGroupName(toNull());
}
@Test
@ -119,7 +119,7 @@ public class GenericItemTest {
public void testGetStateAsWithNull() {
TestItem item = new TestItem("member1");
item.setState(StringType.valueOf("Hello World"));
assertNull(item.getStateAs(NULL()));
assertNull(item.getStateAs(toNull()));
}
@Test
@ -197,7 +197,7 @@ public class GenericItemTest {
*
* @return always {@code null}
*/
private <T> T NULL() {
private <T> T toNull() {
return null; // :-P
}

View File

@ -31,7 +31,6 @@ public class ItemDTOMapperTest {
@Test
public void testMapFunctionWithNumberItemAndCountFunction() {
// testing Group:Number:Count(".*hello.*")
NumberItem item1 = new NumberItem("item1");
@ -44,7 +43,6 @@ public class ItemDTOMapperTest {
assertThat(gFunc, instanceOf(ArithmeticGroupFunction.Count.class));
assertThat(gFunc.getParameters().length, is(1));
assertThat(gFunc.getParameters()[0], instanceOf(StringType.class));
}
}

View File

@ -72,7 +72,7 @@ public class ItemEventFactoryTest {
RawType.DEFAULT_MIME_TYPE);
@Test
public void testCreateEvent_ItemCommandEvent_OnOffType() throws Exception {
public void testCreateEventItemCommandEventOnOffType() throws Exception {
Event event = factory.createEvent(ITEM_COMMAND_EVENT_TYPE, ITEM_COMMAND_EVENT_TOPIC, ITEM_COMMAND_EVENT_PAYLOAD,
SOURCE);
@ -88,7 +88,7 @@ public class ItemEventFactoryTest {
}
@Test
public void testCreateCommandEvent_OnOffType() throws Exception {
public void testCreateCommandEventOnOffType() throws Exception {
ItemCommandEvent event = ItemEventFactory.createCommandEvent(ITEM_NAME, ITEM_COMMAND, SOURCE);
assertEquals(ITEM_COMMAND_EVENT_TYPE, event.getType());
@ -101,7 +101,7 @@ public class ItemEventFactoryTest {
}
@Test
public void testCreateEvent_ItemCommandEvent_RefreshType() throws Exception {
public void testCreateEventItemCommandEventRefreshType() throws Exception {
Event event = factory.createEvent(ITEM_COMMAND_EVENT_TYPE, ITEM_COMMAND_EVENT_TOPIC,
ITEM_REFRESH_COMMAND_EVENT_PAYLOAD, SOURCE);
@ -116,7 +116,7 @@ public class ItemEventFactoryTest {
}
@Test
public void testCreateEvent_ItemStateEvent_UnDefType() throws Exception {
public void testCreateEventItemStateEventUnDefType() throws Exception {
Event event = factory.createEvent(ITEM_STATE_EVENT_TYPE, ITEM_STATE_EVENT_TOPIC, ITEM_UNDEF_STATE_EVENT_PAYLOAD,
SOURCE);
@ -132,7 +132,7 @@ public class ItemEventFactoryTest {
}
@Test
public void testCreateEvent_GroupItemStateChangedEvent() throws Exception {
public void testCreateEventGroupItemStateChangedEvent() throws Exception {
Event event = factory.createEvent(GROUPITEM_CHANGED_EVENT_TYPE, GROUPITEM_STATE_CHANGED_EVENT_TOPIC,
ITEM_STATE_CHANGED_EVENT_PAYLOAD, SOURCE);
@ -150,7 +150,7 @@ public class ItemEventFactoryTest {
}
@Test
public void testCreateEvent_ItemStateEvent_OnOffType() throws Exception {
public void testCreateEventItemStateEventOnOffType() throws Exception {
Event event = factory.createEvent(ITEM_STATE_EVENT_TYPE, ITEM_STATE_EVENT_TOPIC, ITEM_STATE_EVENT_PAYLOAD,
SOURCE);
@ -166,7 +166,7 @@ public class ItemEventFactoryTest {
}
@Test
public void testCreateEvent_ItemStatePredictedEvent_OnOffType() throws Exception {
public void testCreateEventItemStatePredictedEventOnOffType() throws Exception {
Event event = factory.createEvent(ITEM_STATE_PREDICTED_EVENT_TYPE, ITEM_STATE_PREDICTED_EVENT_TOPIC,
ITEM_STATE_PREDICTED_EVENT_PAYLOAD, SOURCE);
@ -181,7 +181,7 @@ public class ItemEventFactoryTest {
}
@Test
public void testCreateStateEvent_OnOffType() {
public void testCreateStateEventOnOffType() {
ItemStateEvent event = ItemEventFactory.createStateEvent(ITEM_NAME, ITEM_STATE, SOURCE);
assertThat(event.getType(), is(ITEM_STATE_EVENT_TYPE));
@ -194,7 +194,7 @@ public class ItemEventFactoryTest {
}
@Test
public void testCreateEvent_ItemAddedEvent() throws Exception {
public void testCreateEventItemAddedEvent() throws Exception {
Event event = factory.createEvent(ITEM_ADDED_EVENT_TYPE, ITEM_ADDED_EVENT_TOPIC, ITEM_ADDED_EVENT_PAYLOAD,
null);
@ -220,19 +220,19 @@ public class ItemEventFactoryTest {
}
@Test
public void testCreateGroupStateChangedEvent_RawType() throws Exception {
GroupItemStateChangedEvent giEvent_source = ItemEventFactory.createGroupStateChangedEvent(GROUP_NAME, ITEM_NAME,
public void testCreateGroupStateChangedEventRawType() throws Exception {
GroupItemStateChangedEvent giEventSource = ItemEventFactory.createGroupStateChangedEvent(GROUP_NAME, ITEM_NAME,
NEW_RAW_ITEM_STATE, RAW_ITEM_STATE);
Event giEvent_parsed = factory.createEvent(giEvent_source.getType(), giEvent_source.getTopic(),
giEvent_source.getPayload(), giEvent_source.getSource());
Event giEventParsed = factory.createEvent(giEventSource.getType(), giEventSource.getTopic(),
giEventSource.getPayload(), giEventSource.getSource());
assertEquals(GroupItemStateChangedEvent.class, giEvent_parsed.getClass());
GroupItemStateChangedEvent groupItemStateChangedEvent = (GroupItemStateChangedEvent) giEvent_parsed;
assertEquals(GroupItemStateChangedEvent.class, giEventParsed.getClass());
GroupItemStateChangedEvent groupItemStateChangedEvent = (GroupItemStateChangedEvent) giEventParsed;
assertEquals(GROUPITEM_CHANGED_EVENT_TYPE, groupItemStateChangedEvent.getType());
assertEquals(GROUPITEM_STATE_CHANGED_EVENT_TOPIC, groupItemStateChangedEvent.getTopic());
assertEquals(giEvent_source.getPayload(), groupItemStateChangedEvent.getPayload());
assertEquals(giEventSource.getPayload(), groupItemStateChangedEvent.getPayload());
assertEquals(GROUP_NAME, groupItemStateChangedEvent.getItemName());
assertEquals(ITEM_NAME, groupItemStateChangedEvent.getMemberName());
assertNull(groupItemStateChangedEvent.getSource());

View File

@ -26,7 +26,6 @@ public class CallItemTest {
@Test
public void testSetStringListType() {
StringListType callType1 = new StringListType("0699222222", "0179999998");
CallItem callItem1 = new CallItem("testItem");

View File

@ -28,7 +28,7 @@ import org.junit.Test;
public class RollershutterItemTest {
@Test
public void setState_stateDown_returnPercent100() {
public void setStateStateDownReturnPercent100() {
RollershutterItem sut = new RollershutterItem("Test");
State state = UpDownType.DOWN;
sut.setState(state);
@ -36,7 +36,7 @@ public class RollershutterItemTest {
}
@Test
public void setState_stateUp_returnPercent0() {
public void setStateStateUpReturnPercent0() {
RollershutterItem sut = new RollershutterItem("Test");
State state = UpDownType.UP;
sut.setState(state);
@ -44,7 +44,7 @@ public class RollershutterItemTest {
}
@Test
public void setState_statePercent50_returnPercent50() {
public void setStateStatePercent50ReturnPercent50() {
RollershutterItem sut = new RollershutterItem("Test");
State state = new PercentType(50);
sut.setState(state);
@ -52,7 +52,7 @@ public class RollershutterItemTest {
}
@Test
public void setState_stateHSB50_returnPercent50() {
public void setStateStateHSB50ReturnPercent50() {
// HSB supported because it is a sub-type of PercentType
RollershutterItem sut = new RollershutterItem("Test");
State state = new HSBType("5,23,42");
@ -61,7 +61,7 @@ public class RollershutterItemTest {
}
@Test
public void setState_stateUndef() {
public void setStateStateUndef() {
RollershutterItem sut = new RollershutterItem("Test");
StateUtil.testUndefStates(sut);
}

View File

@ -58,7 +58,7 @@ public class ArithmeticGroupFunctionTest {
}
@Test
public void testOrFunction_negative() {
public void testOrFunctionNegative() {
items.add(new TestItem("TestItem1", OpenClosedType.CLOSED));
items.add(new TestItem("TestItem2", UnDefType.UNDEF));
items.add(new TestItem("TestItem3", OpenClosedType.CLOSED));
@ -72,7 +72,7 @@ public class ArithmeticGroupFunctionTest {
}
@Test
public void testOrFunction_justsOneItem() {
public void testOrFunctionJustsOneItem() {
items.add(new TestItem("TestItem1", UnDefType.UNDEF));
function = new ArithmeticGroupFunction.Or(OpenClosedType.OPEN, OpenClosedType.CLOSED);
@ -82,7 +82,7 @@ public class ArithmeticGroupFunctionTest {
}
@Test
public void testOrFunction_differntTypes() {
public void testOrFunctionDifferentTypes() {
DimmerItem dimmer1 = new DimmerItem("TestDimmer1");
dimmer1.setState(new PercentType("42"));
DimmerItem dimmer2 = new DimmerItem("TestDimmer2");
@ -120,7 +120,7 @@ public class ArithmeticGroupFunctionTest {
}
@Test
public void testNOrFunction_negative() {
public void testNOrFunctionNegative() {
items.add(new TestItem("TestItem1", OpenClosedType.CLOSED));
items.add(new TestItem("TestItem2", UnDefType.UNDEF));
items.add(new TestItem("TestItem3", OpenClosedType.CLOSED));
@ -146,7 +146,7 @@ public class ArithmeticGroupFunctionTest {
}
@Test
public void testAndFunction_negative() {
public void testAndFunctionNegative() {
items.add(new TestItem("TestItem1", OpenClosedType.OPEN));
items.add(new TestItem("TestItem2", UnDefType.UNDEF));
items.add(new TestItem("TestItem3", OpenClosedType.OPEN));
@ -160,7 +160,7 @@ public class ArithmeticGroupFunctionTest {
}
@Test
public void testAndFunction_justsOneItem() {
public void testAndFunctionJustsOneItem() {
items.add(new TestItem("TestItem1", UnDefType.UNDEF));
function = new ArithmeticGroupFunction.And(OpenClosedType.OPEN, OpenClosedType.CLOSED);
@ -182,7 +182,7 @@ public class ArithmeticGroupFunctionTest {
}
@Test
public void testNAndFunction_negative() {
public void testNAndFunctionNegative() {
items.add(new TestItem("TestItem1", OpenClosedType.OPEN));
items.add(new TestItem("TestItem2", OpenClosedType.OPEN));
items.add(new TestItem("TestItem3", OpenClosedType.CLOSED));

View File

@ -30,7 +30,7 @@ import org.junit.Before;
import org.junit.Test;
/**
* @author Robert Michalak
* @author Robert Michalak - Initial contribution
*/
public class DateTimeGroupFunctionTest {
@ -44,7 +44,6 @@ public class DateTimeGroupFunctionTest {
@Test
public void testLatestFunction() {
ZonedDateTime expectedDateTime = ZonedDateTime.now();
items.add(new TestItem("TestItem1", new DateTimeType(expectedDateTime)));
items.add(new TestItem("TestItem2", UnDefType.UNDEF));
@ -61,7 +60,6 @@ public class DateTimeGroupFunctionTest {
@Test
public void testEarliestFunction() {
ZonedDateTime expectedDateTime = ZonedDateTime.now();
items.add(new TestItem("TestItem1", new DateTimeType(expectedDateTime)));
items.add(new TestItem("TestItem2", UnDefType.UNDEF));

View File

@ -241,8 +241,7 @@ public class DateTimeTypeTest {
/**
* setup Test class with current parameter map.
*
* @param parameterMap
* parameter map
* @param parameterMap parameter map
*/
public DateTimeTypeTest(ParameterSet parameterSet) {
this.parameterSet = parameterSet;

View File

@ -21,8 +21,8 @@ import org.junit.Test;
/**
*
* @author Chris Jackson - added fromRGB() test
* @author Stefan Triller - more tests for type conversions
* @author Chris Jackson - Initial contribution
* @author Stefan Triller - More tests for type conversions
*/
public class HSBTypeTest {

View File

@ -28,18 +28,18 @@ public class PercentTypeTest {
}
@Test(expected = IllegalArgumentException.class)
public void MoreThan100() {
public void moreThan100() {
new PercentType("100.2");
}
@Test
public void DoubleValue() {
public void doubleValue() {
PercentType pt = new PercentType("0.0001");
assertEquals("0.0001", pt.toString());
}
@Test
public void IntValue() {
public void intValue() {
PercentType pt = new PercentType(100);
assertEquals("100", pt.toString());
}

View File

@ -208,27 +208,27 @@ public class QuantityTypeTest {
}
@Test
public void testMultiply_Number() {
public void testMultiplyNumber() {
assertThat(new QuantityType<>("2 m").multiply(BigDecimal.valueOf(2)), is(new QuantityType<>("4 m")));
}
@Test
public void testMultiply_QuantityType() {
public void testMultiplyQuantityType() {
assertThat(new QuantityType<>("2 m").multiply(new QuantityType<>("4 cm")), is(new QuantityType<>("8 m·cm")));
}
@Test
public void testDivide_Number() {
public void testDivideNumber() {
assertThat(new QuantityType<>("4 m").divide(BigDecimal.valueOf(2)), is(new QuantityType<>("2 m")));
}
@Test
public void testDivide_QuantityType() {
public void testDivideQuantityType() {
assertThat(new QuantityType<>("4 m").divide(new QuantityType<>("2 cm")), is(new QuantityType<>("2 m/cm")));
}
@Test(expected = ArithmeticException.class)
public void testDivide_Zero() {
public void testDivideZero() {
new QuantityType<>("4 m").divide(QuantityType.ZERO);
}

View File

@ -21,20 +21,21 @@ import org.junit.Test;
* @author Kai Kreuzer - added tests for valueOf and toFullString
*/
public class StringListTypeTest {
@Test
public void testSerializedEquals_simple() {
final int DEST_IDX = 0;
final int ORIG_IDX = 1;
public void testSerializedEqualsSimple() {
final int destIdx = 0;
final int origIdx = 1;
StringListType call1 = new StringListType("0179999998", "0699222222");
StringListType call2 = new StringListType("0699222222,0179999998");
assertEquals(call1.getValue(ORIG_IDX), call2.getValue(DEST_IDX));
assertEquals(call1.getValue(origIdx), call2.getValue(destIdx));
assertEquals(call2.toString(), "0699222222,0179999998");
}
@Test
public void testSerializedEquals_withEscapedEntries() {
public void testSerializedEqualsWithEscapedEntries() {
String serialized = "value1,value2,value=with=foo,value\\,with\\,foo,,\\,\\,foo";
StringListType call4 = new StringListType(serialized);
@ -87,7 +88,7 @@ public class StringListTypeTest {
}
@Test
public void testValueOf_simple() {
public void testValueOfSimple() {
StringListType abc = StringListType.valueOf("a,b,c");
assertEquals("a", abc.getValue(0));
assertEquals("b", abc.getValue(1));
@ -95,7 +96,7 @@ public class StringListTypeTest {
}
@Test
public void testValueOf_withEscapedEntries() {
public void testValueOfWithEscapedEntries() {
StringListType abC = StringListType.valueOf("a\\,b,c");
assertEquals("a,b", abC.getValue(0));
assertEquals("c", abC.getValue(1));

View File

@ -45,7 +45,7 @@ public class SmartHomeUnitsTest {
private static final double DEFAULT_ERROR = 0.0000000000000001d;
@Test
public void testinHg2PascalConversion() {
public void testInHg2PascalConversion() {
Quantity<Pressure> inHg = Quantities.getQuantity(BigDecimal.ONE, ImperialUnits.INCH_OF_MERCURY);
assertThat(inHg.to(SIUnits.PASCAL), is(Quantities.getQuantity(new BigDecimal("3386.388"), SIUnits.PASCAL)));
@ -54,7 +54,7 @@ public class SmartHomeUnitsTest {
}
@Test
public void test_inHg_UnitSymbol() {
public void testInHgUnitSymbol() {
assertThat(ImperialUnits.INCH_OF_MERCURY.getSymbol(), is("inHg"));
assertThat(ImperialUnits.INCH_OF_MERCURY.toString(), is("inHg"));
}
@ -77,7 +77,7 @@ public class SmartHomeUnitsTest {
}
@Test
public void test_mmHg_UnitSymbol() {
public void testMmHgUnitSymbol() {
assertThat(SmartHomeUnits.MILLIMETRE_OF_MERCURY.getSymbol(), is("mmHg"));
assertThat(SmartHomeUnits.MILLIMETRE_OF_MERCURY.toString(), is("mmHg"));
}
@ -98,7 +98,7 @@ public class SmartHomeUnitsTest {
}
@Test
public void test_hPa_UnitSymbol() {
public void testHpaUnitSymbol() {
assertThat(HECTO(SIUnits.PASCAL).toString(), is("hPa"));
}
@ -164,7 +164,7 @@ public class SmartHomeUnitsTest {
}
@Test
public void test_knot_UnitSymbol() {
public void testKnotUnitSymbol() {
assertThat(SmartHomeUnits.KNOT.getSymbol(), is("kn"));
assertThat(SmartHomeUnits.KNOT.toString(), is("kn"));
}
@ -206,25 +206,25 @@ public class SmartHomeUnitsTest {
}
@Test
public void test_fahrenheit_UnitSymbol() {
public void testFahrenheitUnitSymbol() {
assertThat(ImperialUnits.FAHRENHEIT.getSymbol(), is("°F"));
assertThat(ImperialUnits.FAHRENHEIT.toString(), is("°F"));
}
@Test
public void test_inch_UnitSymbol() {
public void testInchUnitSymbol() {
assertThat(ImperialUnits.INCH.getSymbol(), is("in"));
assertThat(ImperialUnits.INCH.toString(), is("in"));
}
@Test
public void test_mile_UnitSymbol() {
public void testMileUnitSymbol() {
assertThat(ImperialUnits.MILE.getSymbol(), is("mi"));
assertThat(ImperialUnits.MILE.toString(), is("mi"));
}
@Test
public void test_one_UnitSymbol() {
public void testOneUnitSymbol() {
assertThat(SmartHomeUnits.ONE.getSymbol(), is(""));
Quantity<Dimensionless> one1 = Quantities.getQuantity(BigDecimal.ONE, SmartHomeUnits.ONE);
@ -262,8 +262,8 @@ public class SmartHomeUnitsTest {
@Test
public void testMicrogramPerCubicMeter2KilogramPerCubicMeter() {
Quantity<Density> one_kg_m3 = Quantities.getQuantity(BigDecimal.ONE, SmartHomeUnits.KILOGRAM_PER_CUBICMETRE);
Quantity<Density> converted = one_kg_m3.to(SmartHomeUnits.MICROGRAM_PER_CUBICMETRE);
Quantity<Density> oneKgM3 = Quantities.getQuantity(BigDecimal.ONE, SmartHomeUnits.KILOGRAM_PER_CUBICMETRE);
Quantity<Density> converted = oneKgM3.to(SmartHomeUnits.MICROGRAM_PER_CUBICMETRE);
assertThat(converted.getValue().doubleValue(), is(closeTo(1000000000, DEFAULT_ERROR)));
}
@ -279,8 +279,8 @@ public class SmartHomeUnitsTest {
@Test
public void testMicrowattPerSquareCentimetre2KilogramPerSquareCentiMetre() {
Quantity<Intensity> one_mw_cm2 = Quantities.getQuantity(BigDecimal.ONE, SmartHomeUnits.IRRADIANCE);
Quantity<Intensity> converted = one_mw_cm2.to(SmartHomeUnits.MICROWATT_PER_SQUARE_CENTIMETRE);
Quantity<Intensity> oneMwCm2 = Quantities.getQuantity(BigDecimal.ONE, SmartHomeUnits.IRRADIANCE);
Quantity<Intensity> converted = oneMwCm2.to(SmartHomeUnits.MICROWATT_PER_SQUARE_CENTIMETRE);
assertThat(converted.getValue().doubleValue(), is(closeTo(0.01, DEFAULT_ERROR)));
}

View File

@ -37,13 +37,13 @@ import org.junit.Test;
public class UnitUtilsTest {
@Test
public void forBaseUnitsOfDifferentSystems_shouldBeTrue() {
public void forBaseUnitsOfDifferentSystemsShouldBeTrue() {
assertTrue(UnitUtils.isDifferentMeasurementSystem(SIUnits.CELSIUS, ImperialUnits.FAHRENHEIT));
assertTrue(UnitUtils.isDifferentMeasurementSystem(ImperialUnits.MILES_PER_HOUR, SIUnits.KILOMETRE_PER_HOUR));
}
@Test
public void forBaseUnitsOfSameSystem_ShouldBeFalse() {
public void forBaseUnitsOfSameSystemShouldBeFalse() {
assertFalse(UnitUtils.isDifferentMeasurementSystem(CENTI(SIUnits.METRE), SIUnits.METRE));
assertFalse(UnitUtils.isDifferentMeasurementSystem(SIUnits.METRE, MILLI(SIUnits.METRE)));
assertFalse(UnitUtils.isDifferentMeasurementSystem(CENTI(SIUnits.METRE), MILLI(SIUnits.METRE)));
@ -52,13 +52,13 @@ public class UnitUtilsTest {
}
@Test
public void forDerivedUnitsOfDifferentSystems_shouldBeTrue() {
public void forDerivedUnitsOfDifferentSystemsShouldBeTrue() {
assertTrue(UnitUtils.isDifferentMeasurementSystem(CENTI(SIUnits.METRE), ImperialUnits.INCH));
assertTrue(UnitUtils.isDifferentMeasurementSystem(ImperialUnits.MILE, KILO(SIUnits.METRE)));
}
@Test
public void whenValidDimensionIsGiven_shouldCreateQuantityClass() {
public void whenValidDimensionIsGivenShouldCreateQuantityClass() {
Class<? extends Quantity<?>> temperature = UnitUtils.parseDimension("Temperature");
assertNotNull(temperature);
assertTrue(Temperature.class.isAssignableFrom(temperature));

View File

@ -25,40 +25,40 @@ import org.junit.Test;
public class HexUtilsTest {
@Test
public void test_bytesToHex_noParams() {
public void testBytesToHexNoParams() {
byte[] bytes = "ABCD".getBytes();
String result = HexUtils.bytesToHex(bytes);
assertEquals("41424344", result);
}
@Test
public void test_hexToBytes_noParams() {
public void testHexToBytesNoParams() {
byte[] result = HexUtils.hexToBytes("41424344");
assertEquals("ABCD", new String(result));
}
@Test
public void test_bytesToHex_withDelimiter() {
public void testBytesToHexWithDelimiter() {
byte[] bytes = "ABCD".getBytes();
String result = HexUtils.bytesToHex(bytes, " ");
assertEquals("41 42 43 44", result);
}
@Test
public void test_hexToBytes_withDelimiter() {
public void testHexToBytesWithDelimiter() {
byte[] result = HexUtils.hexToBytes("41 42 43 44", " ");
assertEquals("ABCD", new String(result));
}
@Test
public void test_bytesToHex_withMultiCharDelimiter() {
public void testBytesToHexWithMultiCharDelimiter() {
byte[] bytes = "ABCD".getBytes();
String result = HexUtils.bytesToHex(bytes, "-:-");
assertEquals("41-:-42-:-43-:-44", result);
}
@Test
public void test_hexToBytes_withMultiCharDelimiter() {
public void testHexToBytesWithMultiCharDelimiter() {
byte[] result = HexUtils.hexToBytes("41-:-42-:-43-:-44", "-:-");
assertEquals("ABCD", new String(result));
}

View File

@ -1,30 +1,30 @@
{
"actions":[
"actions": [
{
"uid":"CustomAction1",
"label":"CustomAction1",
"outputs":[
"uid": "CustomAction1",
"label": "CustomAction1",
"outputs": [
{
"name":"customActionOutput3",
"type":"outputType3",
"label":"CustomActionOutput1 label",
"description":"Custom action output.",
"defaultValue":"{\"command\":\"OFF\"}",
"required":false
"name": "customActionOutput3",
"type": "outputType3",
"label": "CustomActionOutput1 label",
"description": "Custom action output.",
"defaultValue": "{\"command\":\"OFF\"}",
"required": false
}
]
},
{
"uid":"CustomAction2",
"label":"CustomAction2",
"inputs":[
"uid": "CustomAction2",
"label": "CustomAction2",
"inputs": [
{
"name":"customActionInput",
"type":"outputType4",
"label":"CustomActionOutput2 label",
"description":"Custom action output.",
"defaultValue":5,
"required":false
"name": "customActionInput",
"type": "outputType4",
"label": "CustomActionOutput2 label",
"description": "Custom action output.",
"defaultValue": 5,
"required": false
}
]
}

View File

@ -1,30 +1,30 @@
{
"triggers":[
"triggers": [
{
"uid":"CustomTrigger1",
"label":"Custom Event Trigger",
"outputs":[
"uid": "CustomTrigger1",
"label": "Custom Event Trigger",
"outputs": [
{
"name":"customTriggerOutput1",
"type":"outputType1",
"label":"CustomTriggerOutput1 label",
"description":"Custom trigger output.",
"defaultValue":true,
"reference":"${event}"
"name": "customTriggerOutput1",
"type": "outputType1",
"label": "CustomTriggerOutput1 label",
"description": "Custom trigger output.",
"defaultValue": true,
"reference": "${event}"
}
]
},
{
"uid":"CustomTrigger2",
"label":"Custom Event Trigger",
"outputs":[
"uid": "CustomTrigger2",
"label": "Custom Event Trigger",
"outputs": [
{
"name":"customTriggerOutput2",
"type":"outputType2",
"label":"CustomTriggerOutput2 label",
"description":"Custom trigger output.",
"defaultValue":"event",
"reference":"${event}"
"name": "customTriggerOutput2",
"type": "outputType2",
"label": "CustomTriggerOutput2 label",
"description": "Custom trigger output.",
"defaultValue": "event",
"reference": "${event}"
}
]
}

View File

@ -8,16 +8,18 @@
"jsonTest",
"rule"
],
"configuration": {},
"configuration": {
},
"description": "Sample Rule for items definition.",
"triggers": [
{
"id": "ItemStateChangeTriggerID",
"type": "core.GenericEventTrigger",
"configuration":{
"eventSource":"myMotionItem",
"eventTopic":"smarthome/items/*",
"eventTypes":"ItemStateEvent"
"configuration": {
"eventSource": "myMotionItem",
"eventTopic": "smarthome/items/*",
"eventTypes": "ItemStateEvent"
}
}
],

View File

@ -1,57 +1,57 @@
[
{
"uid":"SimpleTestTemplate",
"description":"Sample Rule Template.",
"tags":[
"uid": "SimpleTestTemplate",
"description": "Sample Rule Template.",
"tags": [
"sample",
"rule",
"template",
"simple"
],
"configDescriptions":[
"configDescriptions": [
{
"name":"onItem",
"type":"TEXT",
"description":"ItemName which state change triggers the rule",
"required":true
"name": "onItem",
"type": "TEXT",
"description": "ItemName which state change triggers the rule",
"required": true
},
{
"name":"ifState",
"type":"TEXT",
"description":"Right operand which is compared with the input.",
"required":true
"name": "ifState",
"type": "TEXT",
"description": "Right operand which is compared with the input.",
"required": true
},
{
"name":"updateItem",
"type":"TEXT",
"description":"Item which should be updated",
"required":true
"name": "updateItem",
"type": "TEXT",
"description": "Item which should be updated",
"required": true
},
{
"name":"updateCommand",
"type":"TEXT",
"description":"Command which should be sent to updateItem",
"required":true
"name": "updateCommand",
"type": "TEXT",
"description": "Command which should be sent to updateItem",
"required": true
}
],
"triggers":[
"triggers": [
{
"id":"ItemUpdateTrigger_1",
"type":"core.GenericEventTrigger",
"configuration":{
"eventSource":"${onItem}",
"eventTopic":"smarthome/items/*",
"eventTypes":"ItemStateEvent"
"id": "ItemUpdateTrigger_1",
"type": "core.GenericEventTrigger",
"configuration": {
"eventSource": "${onItem}",
"eventTopic": "smarthome/items/*",
"eventTypes": "ItemStateEvent"
}
}
],
"actions":[
"actions": [
{
"id":"ItemPostCommandActionID_1",
"type":"core.ItemCommandAction",
"configuration":{
"itemName":"${updateItem}",
"command":"${updateCommand}"
"id": "ItemPostCommandActionID_1",
"type": "core.ItemCommandAction",
"configuration": {
"itemName": "${updateItem}",
"command": "${updateCommand}"
}
}
]

View File

@ -11,16 +11,16 @@
],
"configDescriptions": [
{
"name":"triggerItem",
"type":"TEXT",
"description":"ItemName which state change triggers the rule",
"required":true
"name": "triggerItem",
"type": "TEXT",
"description": "ItemName which state change triggers the rule",
"required": true
},
{
"name":"actionItem",
"type":"TEXT",
"description":"ItemName on which action will be performed.",
"required":true
"name": "actionItem",
"type": "TEXT",
"description": "ItemName on which action will be performed.",
"required": true
}
],
"description": "Sample Rule for items definition.",
@ -28,10 +28,10 @@
{
"id": "ItemStateChangeTriggerID",
"type": "core.GenericEventTrigger",
"configuration":{
"eventSource":"${triggerItem}",
"eventTopic":"smarthome/items/*",
"eventTypes":"ItemStateEvent"
"configuration": {
"eventSource": "${triggerItem}",
"eventTopic": "smarthome/items/*",
"eventTypes": "ItemStateEvent"
}
}
],
@ -41,10 +41,10 @@
"type": "core.GenericEventCondition",
"configuration": {
"topic": "smarthome/items/${triggerItem}/state",
"payload":".*ON.*"
"payload": ".*ON.*"
},
"inputs":{
"event":"ItemStateChangeTriggerID.event"
"inputs": {
"event": "ItemStateChangeTriggerID.event"
}
}
],

View File

@ -1,55 +1,55 @@
[
{
"uid":"TestTemplateWithCompositeModules",
"description":"Sample Rule Template.",
"tags":[
"uid": "TestTemplateWithCompositeModules",
"description": "Sample Rule Template.",
"tags": [
"sample",
"rule",
"template",
"composite"
],
"configDescriptions":[
"configDescriptions": [
{
"name":"onItem",
"type":"TEXT",
"description":"ItemName which state change triggers the rule",
"required":true
"name": "onItem",
"type": "TEXT",
"description": "ItemName which state change triggers the rule",
"required": true
},
{
"name":"ifState",
"type":"TEXT",
"description":"Right operand which is compared with the input.",
"required":true
"name": "ifState",
"type": "TEXT",
"description": "Right operand which is compared with the input.",
"required": true
},
{
"name":"updateItem",
"type":"TEXT",
"description":"Item which should be updated",
"required":true
"name": "updateItem",
"type": "TEXT",
"description": "Item which should be updated",
"required": true
},
{
"name":"updateCommand",
"type":"TEXT",
"description":"Command which should be sent to updateItem",
"required":true
"name": "updateCommand",
"type": "TEXT",
"description": "Command which should be sent to updateItem",
"required": true
}
],
"triggers":[
"triggers": [
{
"id":"ItemUpdateTrigger_2",
"type":"core.ItemStateChangeTrigger",
"configuration":{
"itemName":"${onItem}"
"id": "ItemUpdateTrigger_2",
"type": "core.ItemStateChangeTrigger",
"configuration": {
"itemName": "${onItem}"
}
}
],
"actions":[
"actions": [
{
"id":"ItemPostCommandActionID_1",
"type":"core.ItemCommandAction",
"configuration":{
"itemName":"${updateItem}",
"command":"${updateCommand}"
"id": "ItemPostCommandActionID_1",
"type": "core.ItemCommandAction",
"configuration": {
"itemName": "${updateItem}",
"command": "${updateCommand}"
}
}
]

View File

@ -7,10 +7,10 @@
{
"id": "trigger",
"type": "core.GenericEventTrigger",
"configuration":{
"eventSource":"MyTrigger",
"eventTopic":"smarthome/items/MyTrigger/state",
"eventTypes":"ItemStateEvent"
"configuration": {
"eventSource": "MyTrigger",
"eventTopic": "smarthome/items/MyTrigger/state",
"eventTypes": "ItemStateEvent"
}
}
],