mirror of
https://github.com/danieldemus/openhab-core.git
synced 2025-01-10 21:31:53 +01:00
Improve log message to identify profile's link (#3568)
This commit is contained in:
parent
7cf090140c
commit
bff92e0349
@ -76,7 +76,8 @@ public class ScriptProfile implements StateProfile {
|
||||
|
||||
if (toItemScript.isBlank() && toHandlerScript.isBlank()) {
|
||||
logger.error(
|
||||
"Neither 'toItem' nor 'toHandler' script defined. Profile will discard all states and commands.");
|
||||
"Neither 'toItemScript' nor 'toHandlerScript' defined in link '{}'. Profile will discard all states and commands.",
|
||||
callback.getItemChannelLink());
|
||||
isConfigured = false;
|
||||
return;
|
||||
}
|
||||
|
@ -40,6 +40,8 @@ import org.openhab.core.library.types.HSBType;
|
||||
import org.openhab.core.library.types.OnOffType;
|
||||
import org.openhab.core.library.types.PercentType;
|
||||
import org.openhab.core.test.java.JavaTest;
|
||||
import org.openhab.core.thing.ChannelUID;
|
||||
import org.openhab.core.thing.link.ItemChannelLink;
|
||||
import org.openhab.core.thing.profiles.ProfileCallback;
|
||||
import org.openhab.core.thing.profiles.ProfileContext;
|
||||
import org.openhab.core.thing.profiles.ProfileTypeUID;
|
||||
@ -70,6 +72,9 @@ public class ScriptProfileTest extends JavaTest {
|
||||
public void testScriptNotExecutedAndNoValueForwardedToCallbackIfNoScriptDefined() throws TransformationException {
|
||||
ProfileContext profileContext = ProfileContextBuilder.create().build();
|
||||
|
||||
ItemChannelLink link = new ItemChannelLink("DummyItem", new ChannelUID("foo:bar:baz:qux"));
|
||||
when(profileCallback.getItemChannelLink()).thenReturn(link);
|
||||
|
||||
setupInterceptedLogger(ScriptProfile.class, LogLevel.ERROR);
|
||||
|
||||
ScriptProfile scriptProfile = new ScriptProfile(mock(ProfileTypeUID.class), profileCallback, profileContext,
|
||||
@ -85,7 +90,8 @@ public class ScriptProfileTest extends JavaTest {
|
||||
verify(profileCallback, never()).sendCommand(any());
|
||||
|
||||
assertLogMessage(ScriptProfile.class, LogLevel.ERROR,
|
||||
"Neither 'toItem' nor 'toHandler' script defined. Profile will discard all states and commands.");
|
||||
"Neither 'toItemScript' nor 'toHandlerScript' defined in link '" + link.toString()
|
||||
+ "'. Profile will discard all states and commands.");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Loading…
Reference in New Issue
Block a user