2 * Copyright (c) 2010-2020 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.SwitchItem;
21 import org.openhab.core.library.types.OnOffType;
22 import org.openhab.core.types.State;
26 * @author Sami Salonen - Initial contribution
30 public class SwitchItemIntegrationTest extends AbstractTwoItemIntegrationTest {
32 private static final String NAME = "switch";
33 private static final OnOffType STATE1 = OnOffType.OFF;
34 private static final OnOffType STATE2 = OnOffType.ON;
35 // There is no OnOffType state value between OFF and ON.
36 // Omit extended query tests AbstractTwoItemIntegrationTest by setting stateBetween to null.
37 private static final @Nullable OnOffType STATE_BETWEEN = null;
40 public static void storeData() throws InterruptedException {
41 SwitchItem item = (SwitchItem) ITEMS.get(NAME);
42 item.setState(STATE1);
43 beforeStore = ZonedDateTime.now();
46 afterStore1 = ZonedDateTime.now();
48 item.setState(STATE2);
51 afterStore2 = ZonedDateTime.now();
53 LOGGER.info("Created item between {} and {}", AbstractDynamoDBItem.DATEFORMATTER.format(beforeStore),
54 AbstractDynamoDBItem.DATEFORMATTER.format(afterStore1));
58 protected String getItemName() {
63 protected State getFirstItemState() {
68 protected State getSecondItemState() {
73 protected @Nullable State getQueryItemStateBetween() {