]> git.basschouten.com Git - openhab-addons.git/blob
8a8a41e297059990a4c684dc6f8283c5fe010a97
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2020 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
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
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.persistence.dynamodb.internal;
14
15 import java.time.ZonedDateTime;
16
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.PlayerItem;
21 import org.openhab.core.library.types.PlayPauseType;
22 import org.openhab.core.library.types.RewindFastforwardType;
23 import org.openhab.core.types.State;
24
25 /**
26  *
27  * @author Sami Salonen - Initial contribution
28  *
29  */
30 @NonNullByDefault
31 public class PlayerItemRewindFastForwardIntegrationTest extends AbstractTwoItemIntegrationTest {
32
33     private static final String NAME = "player_rewindfastforward";
34     private static final RewindFastforwardType STATE1 = RewindFastforwardType.FASTFORWARD;
35     private static final RewindFastforwardType STATE2 = RewindFastforwardType.REWIND;
36     private static final @Nullable PlayPauseType STATE_BETWEEN = null;
37
38     @BeforeAll
39     public static void storeData() throws InterruptedException {
40         PlayerItem item = (PlayerItem) ITEMS.get(NAME);
41
42         item.setState(STATE1);
43
44         beforeStore = ZonedDateTime.now();
45         Thread.sleep(10);
46         service.store(item);
47         afterStore1 = ZonedDateTime.now();
48         Thread.sleep(10);
49         item.setState(STATE2);
50         service.store(item);
51         Thread.sleep(10);
52         afterStore2 = ZonedDateTime.now();
53
54         LOGGER.info("Created item between {} and {}", AbstractDynamoDBItem.DATEFORMATTER.format(beforeStore),
55                 AbstractDynamoDBItem.DATEFORMATTER.format(afterStore1));
56     }
57
58     @Override
59     protected String getItemName() {
60         return NAME;
61     }
62
63     @Override
64     protected State getFirstItemState() {
65         return STATE1;
66     }
67
68     @Override
69     protected State getSecondItemState() {
70         return STATE2;
71     }
72
73     @Override
74     protected @Nullable State getQueryItemStateBetween() {
75         return STATE_BETWEEN;
76     }
77 }