2 * Copyright (c) 2016 Red Hat, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.genius.itm.tests;
10 import javax.inject.Inject;
11 import org.junit.After;
12 import org.junit.Before;
13 import org.junit.Rule;
14 import org.junit.Test;
15 import org.junit.rules.MethodRule;
16 import org.opendaylight.genius.datastoreutils.testutils.JobCoordinatorEventsWaiter;
17 import org.opendaylight.genius.datastoreutils.testutils.JobCoordinatorTestModule;
18 import org.opendaylight.genius.datastoreutils.testutils.TestableDataTreeChangeListenerModule;
19 import org.opendaylight.genius.itm.impl.ItmTestUtils;
20 import org.opendaylight.genius.utils.cache.CacheTestUtil;
21 import org.opendaylight.infrautils.caches.testutils.CacheModule;
22 import org.opendaylight.infrautils.inject.guice.testutils.GuiceRule;
23 import org.opendaylight.infrautils.testutils.LogCaptureRule;
24 import org.opendaylight.infrautils.testutils.LogRule;
27 * Component tests for ITM.
29 public class ItmTest {
31 public @Rule LogRule logRule = new LogRule();
32 public @Rule LogCaptureRule logCaptureRule = new LogCaptureRule();
33 public @Rule MethodRule guice = new GuiceRule(ItmTestModule.class, TestableDataTreeChangeListenerModule.class,
34 JobCoordinatorTestModule.class, CacheModule.class);
36 private @Inject JobCoordinatorEventsWaiter coordinatorEventsWaiter;
39 public void before() {
40 // so that any @Test methods here which do something real
41 // are isolated from any other test that run before this ItmTest
47 // so that any other *Test which will run after us has a clean slate again
51 private void clearCaches() {
52 // Explicitly clear stupid static caches
53 // (TODO which really need to be de-static-ified instead of doing this..)
54 ItmTestUtils.clearAllItmCaches();
55 CacheTestUtil.clearAllCaches();
59 public void testWiring() {
60 // wait for default-TZ creation task (which runs on start-up) to get completed
61 coordinatorEventsWaiter.awaitEventsConsumption();
62 // do nothing; still valuable to check that ItmTestModule works and everything comes up