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 java.time.ZonedDateTime;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.eclipse.jdt.annotation.Nullable;
19 import org.junit.jupiter.api.BeforeAll;
20 import org.openhab.core.library.items.ContactItem;
21 import org.openhab.core.library.types.OnOffType;
22 import org.openhab.core.library.types.OpenClosedType;
23 import org.openhab.core.types.State;
26 * @author Sami Salonen - Initial contribution
29 public class ContactItemIntegrationTest extends AbstractTwoItemIntegrationTest {
31 public static final boolean LEGACY_MODE = false;
33 private static final String NAME = "contact";
34 private static final OpenClosedType STATE1 = OpenClosedType.CLOSED;
35 private static final OpenClosedType STATE2 = OpenClosedType.OPEN;
36 // There is no OpenClosedType state value between CLOSED and OPEN.
37 // Omit extended query tests AbstractTwoItemIntegrationTest by setting stateBetween to null.
38 private static final @Nullable OnOffType STATE_BETWEEN = null;
40 @SuppressWarnings("null")
42 public static void storeData() throws InterruptedException {
43 ContactItem item = (ContactItem) ITEMS.get(NAME);
44 item.setState(STATE1);
45 beforeStore = ZonedDateTime.now();
48 afterStore1 = ZonedDateTime.now();
50 item.setState(STATE2);
53 afterStore2 = ZonedDateTime.now();
55 LOGGER.info("Created item between {} and {}", AbstractDynamoDBItem.DATEFORMATTER.format(beforeStore),
56 AbstractDynamoDBItem.DATEFORMATTER.format(afterStore1));
60 protected String getItemName() {
65 protected State getFirstItemState() {
70 protected State getSecondItemState() {
75 protected @Nullable State getQueryItemStateBetween() {