Search in sources :

Example 1 with ProfileContext

use of org.openhab.core.thing.profiles.ProfileContext in project openhab-addons by openhab.

the class ModbusGainOffsetProfileTest method createProfile.

private ModbusGainOffsetProfile<?> createProfile(ProfileCallback callback, @Nullable String gain, @Nullable String preGainOffset) {
    ProfileContext context = mock(ProfileContext.class);
    Configuration config = new Configuration();
    if (gain != null) {
        config.put("gain", gain);
    }
    if (preGainOffset != null) {
        config.put("pre-gain-offset", preGainOffset);
    }
    when(context.getConfiguration()).thenReturn(config);
    return new ModbusGainOffsetProfile<>(callback, context);
}
Also used : ProfileContext(org.openhab.core.thing.profiles.ProfileContext) Configuration(org.openhab.core.config.core.Configuration)

Example 2 with ProfileContext

use of org.openhab.core.thing.profiles.ProfileContext in project openhab-core by openhab.

the class SystemOffsetProfileTest method createProfile.

private SystemOffsetProfile createProfile(ProfileCallback callback, String offset) {
    ProfileContext context = mock(ProfileContext.class);
    Configuration config = new Configuration();
    config.put(SystemOffsetProfile.OFFSET_PARAM, offset);
    when(context.getConfiguration()).thenReturn(config);
    return new SystemOffsetProfile(callback, context);
}
Also used : ProfileContext(org.openhab.core.thing.profiles.ProfileContext) Configuration(org.openhab.core.config.core.Configuration)

Example 3 with ProfileContext

use of org.openhab.core.thing.profiles.ProfileContext in project addons by smarthomej.

the class BitwiseAndTransformationProfileTest method createProfile.

private MultiplyTransformationProfile createProfile(ProfileCallback callback, Integer multiplicand) {
    ProfileContext context = mock(ProfileContext.class);
    Configuration config = new Configuration();
    config.put(MultiplyTransformationProfile.MUTLIPLICAND_PARAM, multiplicand);
    when(context.getConfiguration()).thenReturn(config);
    return new MultiplyTransformationProfile(callback, context, new MultiplyTransformationService());
}
Also used : ProfileContext(org.openhab.core.thing.profiles.ProfileContext) Configuration(org.openhab.core.config.core.Configuration) MultiplyTransformationService(org.smarthomej.transform.math.internal.MultiplyTransformationService)

Example 4 with ProfileContext

use of org.openhab.core.thing.profiles.ProfileContext in project openhab-core by openhab.

the class TimestampOffsetProfileTest method createProfile.

private TimestampOffsetProfile createProfile(ProfileCallback callback, String offset, @Nullable String timeZone) {
    ProfileContext context = mock(ProfileContext.class);
    Map<String, Object> properties = new HashMap<>();
    properties.put(TimestampOffsetProfile.OFFSET_PARAM, offset);
    if (timeZone != null) {
        properties.put(TimestampOffsetProfile.TIMEZONE_PARAM, timeZone);
    }
    when(context.getConfiguration()).thenReturn(new Configuration(properties));
    return new TimestampOffsetProfile(callback, context);
}
Also used : ProfileContext(org.openhab.core.thing.profiles.ProfileContext) Configuration(org.openhab.core.config.core.Configuration) HashMap(java.util.HashMap)

Example 5 with ProfileContext

use of org.openhab.core.thing.profiles.ProfileContext in project addons by smarthomej.

the class MultiplyTransformationProfileTest method createProfile.

private MultiplyTransformationProfile createProfile(ProfileCallback callback, Integer multiplicand) {
    ProfileContext context = mock(ProfileContext.class);
    Configuration config = new Configuration();
    config.put(MultiplyTransformationProfile.MUTLIPLICAND_PARAM, multiplicand);
    when(context.getConfiguration()).thenReturn(config);
    return new MultiplyTransformationProfile(callback, context, new MultiplyTransformationService());
}
Also used : ProfileContext(org.openhab.core.thing.profiles.ProfileContext) Configuration(org.openhab.core.config.core.Configuration) MultiplyTransformationService(org.smarthomej.transform.math.internal.MultiplyTransformationService)

Aggregations

Configuration (org.openhab.core.config.core.Configuration)6 ProfileContext (org.openhab.core.thing.profiles.ProfileContext)6 MultiplyTransformationService (org.smarthomej.transform.math.internal.MultiplyTransformationService)2 HashMap (java.util.HashMap)1