2 * Copyright (c) 2014 Cisco Systems, 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.controller.config.yang.pcep.topology.provider;
10 import org.junit.Before;
11 import org.junit.Test;
12 import org.opendaylight.controller.config.api.jmx.CommitStatus;
13 import org.opendaylight.controller.config.manager.impl.AbstractConfigTest;
14 import org.opendaylight.controller.config.manager.impl.factoriesresolver.HardcodedModuleFactoriesResolver;
15 import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;
17 public class Stateful07TopologySessionListenerModuleTest extends AbstractConfigTest {
19 private static final String FACTORY_NAME = Stateful07TopologySessionListenerModuleFactory.NAME;
20 private static final String INSTANCE_NAME = "pcep-topology-stateful07-instance";
23 public void setUp() throws Exception {
24 super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(mockedContext, new Stateful07TopologySessionListenerModuleFactory()));
28 public void testCreateBean() throws Exception {
29 CommitStatus status = createInstance();
30 assertBeanCount(1, FACTORY_NAME);
31 assertStatus(status, 1, 0, 0);
35 public void testReusingOldInstance() throws Exception {
37 ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
38 assertBeanCount(1, FACTORY_NAME);
39 CommitStatus status = transaction.commit();
40 assertBeanCount(1, FACTORY_NAME);
41 assertStatus(status, 0, 0, 1);
44 private CommitStatus createInstance() throws Exception {
45 ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
46 transaction.createModule(FACTORY_NAME, INSTANCE_NAME);
47 return transaction.commit();