2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
7 * This program and the accompanying materials are made available under the
8 * terms of the Eclipse Public License 2.0 which is available at
9 * http://www.eclipse.org/legal/epl-2.0
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.persistence.dynamodb.internal;
15 import static org.junit.jupiter.api.Assertions.assertEquals;
17 import java.time.ZonedDateTime;
19 import org.eclipse.jdt.annotation.NonNullByDefault;
20 import org.eclipse.jdt.annotation.Nullable;
21 import org.junit.jupiter.api.BeforeAll;
22 import org.openhab.core.library.items.CallItem;
23 import org.openhab.core.library.types.StringListType;
24 import org.openhab.core.types.State;
28 * @author Sami Salonen - Initial contribution
32 public class CallItemIntegrationTest extends AbstractTwoItemIntegrationTest {
34 public static final boolean LEGACY_MODE = false;
36 private static final String NAME = "call";
37 // values are encoded as part1,part2 - ordering goes wrt strings
38 private static final StringListType STATE1 = new StringListType("part1", "foo");
39 private static final StringListType STATE2 = new StringListType("part3", "bar");
40 private static final StringListType STATE_BETWEEN = new StringListType("part2", "zzz");
42 @SuppressWarnings("null")
44 public static void storeData() throws InterruptedException {
45 CallItem item = (CallItem) ITEMS.get(NAME);
46 item.setState(STATE1);
47 beforeStore = ZonedDateTime.now();
50 afterStore1 = ZonedDateTime.now();
52 item.setState(STATE2);
55 afterStore2 = ZonedDateTime.now();
57 LOGGER.info("Created item between {} and {}", AbstractDynamoDBItem.DATEFORMATTER.format(beforeStore),
58 AbstractDynamoDBItem.DATEFORMATTER.format(afterStore1));
62 protected String getItemName() {
67 protected State getFirstItemState() {
72 protected State getSecondItemState() {
77 protected @Nullable State getQueryItemStateBetween() {
82 protected void assertStateEquals(State expected, State actual) {
83 // Since CallType.equals is broken, toString is used as workaround
84 assertEquals(expected.toString(), actual.toString());