BUG-865: remove references to URLSchemaContextResolver
[bgpcep.git] / rsvp / impl / src / test / java / org / opendaylight / controller / config / yang / rsvp / parser / impl / RSVPParserModuleTest.java
1 /*
2  * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.controller.config.yang.rsvp.parser.impl;
10
11 import org.junit.Before;
12 import org.junit.Test;
13 import org.opendaylight.controller.config.api.jmx.CommitStatus;
14 import org.opendaylight.controller.config.manager.impl.AbstractConfigTest;
15 import org.opendaylight.controller.config.manager.impl.factoriesresolver.HardcodedModuleFactoriesResolver;
16 import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;
17 import org.opendaylight.controller.config.yang.rsvp.impl.RSVPParserModuleFactory;
18 import org.opendaylight.controller.config.yang.rsvp.spi.SimpleRSVPExtensionProviderContextModuleFactory;
19
20 public class RSVPParserModuleTest extends AbstractConfigTest {
21     private static final String FACTORY_NAME = RSVPParserModuleFactory.NAME;
22     private static final String INSTANCE_NAME = "rsvp-parser-impl";
23
24     @Before
25     public void setUp() throws Exception {
26         super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(this.mockedContext, new
27             RSVPParserModuleFactory(), new SimpleRSVPExtensionProviderContextModuleFactory()));
28     }
29
30     @Test
31     public void testCreateBean() throws Exception {
32         final CommitStatus status = createInstance();
33         assertBeanCount(1, FACTORY_NAME);
34         assertStatus(status, 1, 0, 0);
35     }
36
37     @Test
38     public void testReusingOldInstance() throws Exception {
39         createInstance();
40         final ConfigTransactionJMXClient transaction = this.configRegistryClient.createTransaction();
41         assertBeanCount(1, FACTORY_NAME);
42         final CommitStatus status = transaction.commit();
43         assertBeanCount(1, FACTORY_NAME);
44         assertStatus(status, 0, 0, 1);
45     }
46
47     private CommitStatus createInstance() throws Exception {
48         final ConfigTransactionJMXClient transaction = this.configRegistryClient.createTransaction();
49         transaction.createModule(FACTORY_NAME, INSTANCE_NAME);
50         return transaction.commit();
51     }
52 }