+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
package org.opendaylight.controller.config.yang.bgp.reconnectstrategy;
import javax.management.InstanceAlreadyExistsException;
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
package org.opendaylight.controller.config.yang.bgp.reconnectstrategy;
import static org.junit.Assert.assertTrue;
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
package org.opendaylight.controller.config.yang.bgp.reconnectstrategy;
import static org.junit.Assert.assertTrue;
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
package org.opendaylight.controller.config.yang.bgp.reconnectstrategy;
import static org.junit.Assert.assertEquals;
public class TimedReconnectStrategyModuleTest extends AbstractConfigTest {
private final String instanceName = "timed";
+
+ private final String EXECUTOR_INSTANCE_NAME = "global-event-executor-insatnce";
private TimedReconnectStrategyModuleFactory factory;
ConfigTransactionJMXClient transaction = configRegistryClient
.createTransaction();
createInstance(transaction, this.factory.getImplementationName(), instanceName, 500, 100L, null, 500L,
- 10L, 10000L, this.executorFactory.getImplementationName());
+ 10L, 10000L, this.executorFactory.getImplementationName(), EXECUTOR_INSTANCE_NAME);
transaction.validateConfig();
fail();
} catch (ValidationException e) {
ConfigTransactionJMXClient transaction = configRegistryClient
.createTransaction();
createInstance(transaction, this.factory.getImplementationName(), instanceName, 500, 100L,
- new BigDecimal(0.5), 500L, 10L, 10000L, this.executorFactory.getImplementationName());
+ new BigDecimal(0.5), 500L, 10L, 10000L, this.executorFactory.getImplementationName(),
+ EXECUTOR_INSTANCE_NAME);
transaction.validateConfig();
fail();
} catch (ValidationException e) {
ConfigTransactionJMXClient transaction = configRegistryClient
.createTransaction();
createInstance(transaction, this.factory.getImplementationName(), instanceName, null, 100L,
- new BigDecimal(1.0), 500L, 10L, 10000L, this.executorFactory.getImplementationName());
+ new BigDecimal(1.0), 500L, 10L, 10000L, this.executorFactory.getImplementationName(),
+ EXECUTOR_INSTANCE_NAME);
transaction.validateConfig();
fail();
} catch (ValidationException e) {
ConfigTransactionJMXClient transaction = configRegistryClient
.createTransaction();
createInstance(transaction, this.factory.getImplementationName(), instanceName, -1, 100L, new BigDecimal(
- 1.0), 500L, 10L, 10000L, this.executorFactory.getImplementationName());
+ 1.0), 500L, 10L, 10000L, this.executorFactory.getImplementationName(),
+ EXECUTOR_INSTANCE_NAME);
transaction.validateConfig();
fail();
} catch (ValidationException e) {
ConfigTransactionJMXClient transaction = configRegistryClient
.createTransaction();
createInstance(transaction, this.factory.getImplementationName(), instanceName, 100, null,
- new BigDecimal(1.0), 100L, 10L, 10000L, this.executorFactory.getImplementationName());
+ new BigDecimal(1.0), 100L, 10L, 10000L, this.executorFactory.getImplementationName(),
+ EXECUTOR_INSTANCE_NAME);
transaction.validateConfig();
fail();
} catch (ValidationException e) {
ConfigTransactionJMXClient transaction = configRegistryClient
.createTransaction();
createInstance(transaction, this.factory.getImplementationName(), instanceName, 100, 300L,
- new BigDecimal(1.0), 100L, 10L, 10000L, this.executorFactory.getImplementationName());
+ new BigDecimal(1.0), 100L, 10L, 10000L, this.executorFactory.getImplementationName(),
+ EXECUTOR_INSTANCE_NAME);
transaction.validateConfig();
fail();
} catch (ValidationException e) {
ConfigTransactionJMXClient transaction = configRegistryClient
.createTransaction();
createInstance(transaction, this.factory.getImplementationName(), instanceName, 500, 100L,
- new BigDecimal(1.0), 500L, 10L, 10000L, this.executorFactory.getImplementationName());
+ new BigDecimal(1.0), 500L, 10L, 10000L, this.executorFactory.getImplementationName(),
+ EXECUTOR_INSTANCE_NAME);
transaction.validateConfig();
CommitStatus status = transaction.commit();
assertBeanCount(1, factory.getImplementationName());
ConfigTransactionJMXClient transaction = configRegistryClient
.createTransaction();
createInstance(transaction, this.factory.getImplementationName(), instanceName, 500, 100L,
- new BigDecimal(1.0), 500L, 10L, 10000L, this.executorFactory.getImplementationName());
+ new BigDecimal(1.0), 500L, 10L, 10000L, this.executorFactory.getImplementationName(),
+ EXECUTOR_INSTANCE_NAME);
transaction.commit();
transaction = configRegistryClient.createTransaction();
assertBeanCount(1, factory.getImplementationName());
.createTransaction();
createInstance(transaction, this.factory.getImplementationName(), instanceName, 500, 100L,
new BigDecimal(1.0), new Long(500), new Long(10), new Long(
- 10000), this.executorFactory.getImplementationName());
+ 10000), this.executorFactory.getImplementationName(),EXECUTOR_INSTANCE_NAME);
transaction.commit();
transaction = configRegistryClient.createTransaction();
assertBeanCount(1, factory.getImplementationName());
final String instanceName, final Integer connectTime,
final Long minSleep, final BigDecimal sleepFactor,
final Long maxSleep, final Long maxAttempts, final Long deadline,
- final String executorModuleName) throws InstanceAlreadyExistsException {
+ final String executorModuleName, final String executorInstanceName) throws InstanceAlreadyExistsException {
ObjectName nameCreated = transaction.createModule(
moduleName, instanceName);
TimedReconnectStrategyModuleMXBean mxBean = transaction.newMBeanProxy(
mxBean.setMaxSleep(maxSleep);
mxBean.setMinSleep(minSleep);
mxBean.setSleepFactor(sleepFactor);
- mxBean.setExecutor(GlobalEventExecutorUtil.createInstance(transaction, executorModuleName, "global-event-executor"));
+ mxBean.setExecutor(GlobalEventExecutorUtil.createInstance(transaction, executorModuleName, executorInstanceName));
return nameCreated;
}
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
package org.opendaylight.controller.config.yang.bgp.rib.impl;
import javax.management.InstanceAlreadyExistsException;
import javax.management.ObjectName;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import org.opendaylight.controller.config.api.ConflictingVersionException;
import org.opendaylight.controller.config.api.ValidationException;
import org.opendaylight.controller.config.manager.impl.AbstractConfigTest;
import org.opendaylight.controller.config.manager.impl.factoriesresolver.HardcodedModuleFactoriesResolver;
import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;
+import org.opendaylight.controller.config.yang.bgp.parser.spi.SimpleBGPExtensionProviderContextModuleFactory;
+import org.opendaylight.controller.config.yang.bgp.parser.spi.SimpleBGPExtensionProviderContextModuleMXBean;
import org.opendaylight.controller.config.yang.bgp.rib.spi.RIBExtensionsImplModuleFactory;
import org.opendaylight.controller.config.yang.netty.threadgroup.NettyThreadgroupModuleFactory;
import org.opendaylight.controller.config.yang.netty.threadgroup.NettyThreadgroupModuleMXBean;
-@Ignore
public class BGPDispatcherImplModuleTest extends AbstractConfigTest {
private final String instanceName = "bgp-message-fct";
private RIBExtensionsImplModuleFactory messageFactory;
+ private SimpleBGPExtensionProviderContextModuleFactory extensionFactory;
+
@Before
public void setUp() throws Exception {
this.factory = new BGPDispatcherImplModuleFactory();
this.threadgroupFactory = new NettyThreadgroupModuleFactory();
this.messageFactory = new RIBExtensionsImplModuleFactory();
- super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(this.factory, threadgroupFactory, messageFactory));
+ this.extensionFactory = new SimpleBGPExtensionProviderContextModuleFactory();
+ super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(this.factory, threadgroupFactory, messageFactory, extensionFactory));
}
@Test
public void testCreateBean() throws Exception {
ConfigTransactionJMXClient transaction = configRegistryClient
.createTransaction();
- createInstance(transaction, this.factory.getImplementationName(), instanceName, this.threadgroupFactory.getImplementationName(), this.messageFactory.getImplementationName());
+ createInstance(transaction, this.factory.getImplementationName(), instanceName, this.threadgroupFactory.getImplementationName(), this.messageFactory.getImplementationName(), this.extensionFactory.getImplementationName());
transaction.validateConfig();
CommitStatus status = transaction.commit();
assertBeanCount(1, factory.getImplementationName());
ConflictingVersionException, ValidationException {
ConfigTransactionJMXClient transaction = configRegistryClient
.createTransaction();
- createInstance(transaction, this.factory.getImplementationName(), instanceName, this.threadgroupFactory.getImplementationName(), this.messageFactory.getImplementationName());
+ createInstance(transaction, this.factory.getImplementationName(), instanceName, this.threadgroupFactory.getImplementationName(), this.messageFactory.getImplementationName(), this.extensionFactory.getImplementationName());
transaction.commit();
transaction = configRegistryClient.createTransaction();
assertBeanCount(1, factory.getImplementationName());
}
public static ObjectName createInstance(final ConfigTransactionJMXClient transaction, final String moduleName,
- final String instanceName, final String threadgropuModuleName, final String messageFactoryModuleName) throws InstanceAlreadyExistsException {
+ final String instanceName, final String threadgropuModuleName, final String messageFactoryModuleName, final String extensionModuleName) throws InstanceAlreadyExistsException {
ObjectName nameCreated = transaction.createModule(
moduleName, instanceName);
BGPDispatcherImplModuleMXBean mxBean = transaction.newMBeanProxy(
nameCreated, BGPDispatcherImplModuleMXBean.class);
mxBean.setBossGroup(createThreadgroupInstance(transaction, threadgropuModuleName, "boss-threadgroup", 10));
mxBean.setWorkerGroup(createThreadgroupInstance(transaction, threadgropuModuleName, "worker-threadgroup", 10));
- //mxBean.setMessageFactory(BGPMessageFactoryImplModuleTest.createInstance(transaction, messageFactoryModuleName, "bgp-msg-fct"));
+ mxBean.setBgpExtensions(createBgpExtensionsInstance(transaction, extensionModuleName, "bgp-extensions"));
return nameCreated;
}
mxBean.setThreadCount(threadCount);
return nameCreated;
}
+
+ public static ObjectName createBgpExtensionsInstance(
+ final ConfigTransactionJMXClient transaction,
+ final String moduleName, final String instanceName)
+ throws InstanceAlreadyExistsException {
+ ObjectName nameCreated = transaction.createModule(moduleName,
+ instanceName);
+ transaction.newMBeanProxy(nameCreated,
+ SimpleBGPExtensionProviderContextModuleMXBean.class);
+ return nameCreated;
+ }
}
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
package org.opendaylight.controller.config.yang.bgp.rib.impl;
import static org.junit.Assert.assertTrue;
import javax.management.ObjectName;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import org.opendaylight.controller.config.api.ConflictingVersionException;
import org.opendaylight.controller.config.api.ValidationException;
import org.opendaylight.controller.config.manager.impl.AbstractConfigTest;
import org.opendaylight.controller.config.manager.impl.factoriesresolver.HardcodedModuleFactoriesResolver;
import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;
+import org.opendaylight.controller.config.yang.bgp.parser.spi.SimpleBGPExtensionProviderContextModuleFactory;
import org.opendaylight.controller.config.yang.bgp.rib.spi.RIBExtensionsImplModuleFactory;
import org.opendaylight.controller.config.yang.netty.threadgroup.NettyThreadgroupModuleFactory;
-@Ignore
public class BGPImplModuleTest extends AbstractConfigTest {
private final String instanceName = "bgp-impl1";
private RIBExtensionsImplModuleFactory messageFactory;
+ private SimpleBGPExtensionProviderContextModuleFactory extensionFactory;
+
@Before
public void setUp() throws Exception {
this.factory = new BGPImplModuleFactory();
this.sessionFacotry = new BGPSessionProposalImplModuleFactory();
this.threadgropFactory = new NettyThreadgroupModuleFactory();
this.messageFactory = new RIBExtensionsImplModuleFactory();
- super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(this.factory, this.dispactherFactory, this.sessionFacotry, this.messageFactory, this.threadgropFactory));
+ this.extensionFactory = new SimpleBGPExtensionProviderContextModuleFactory();
+ super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(this.factory, this.dispactherFactory,
+ this.sessionFacotry, this.messageFactory, this.threadgropFactory, this.extensionFactory));
}
@Test
try {
ConfigTransactionJMXClient transaction = configRegistryClient
.createTransaction();
- createInstance(transaction, this.factory.getImplementationName(), instanceName, "localhost", null, sessionFacotry.getImplementationName(), dispactherFactory.getImplementationName(), threadgropFactory.getImplementationName(), messageFactory.getImplementationName());
+ createInstance(transaction, this.factory.getImplementationName(), instanceName, "localhost", null, sessionFacotry.getImplementationName(),
+ dispactherFactory.getImplementationName(), threadgropFactory.getImplementationName(),
+ messageFactory.getImplementationName(), this.extensionFactory.getImplementationName());
transaction.validateConfig();
fail();
} catch (ValidationException e) {
try {
ConfigTransactionJMXClient transaction = configRegistryClient
.createTransaction();
- createInstance(transaction, this.factory.getImplementationName(), instanceName, "localhost", -1, sessionFacotry.getImplementationName(), dispactherFactory.getImplementationName(), threadgropFactory.getImplementationName(), messageFactory.getImplementationName());
+ createInstance(transaction, this.factory.getImplementationName(), instanceName, "localhost", -1, sessionFacotry.getImplementationName(), dispactherFactory.getImplementationName(), threadgropFactory.getImplementationName(), messageFactory.getImplementationName(), this.extensionFactory.getImplementationName());
transaction.validateConfig();
fail();
} catch (ValidationException e) {
try {
ConfigTransactionJMXClient transaction = configRegistryClient
.createTransaction();
- createInstance(transaction, this.factory.getImplementationName(), instanceName, null, 1, sessionFacotry.getImplementationName(), dispactherFactory.getImplementationName(), threadgropFactory.getImplementationName(), messageFactory.getImplementationName());
+ createInstance(transaction, this.factory.getImplementationName(), instanceName, null, 1, sessionFacotry.getImplementationName(), dispactherFactory.getImplementationName(), threadgropFactory.getImplementationName(), messageFactory.getImplementationName(), this.extensionFactory.getImplementationName());
transaction.validateConfig();
fail();
} catch (ValidationException e) {
public void testCreateBean() throws Exception {
ConfigTransactionJMXClient transaction = configRegistryClient
.createTransaction();
- createInstance(transaction, this.factory.getImplementationName(), instanceName, "localhost", 1, sessionFacotry.getImplementationName(), dispactherFactory.getImplementationName(), threadgropFactory.getImplementationName(), messageFactory.getImplementationName());
+ createInstance(transaction, this.factory.getImplementationName(), instanceName, "localhost", 1, sessionFacotry.getImplementationName(), dispactherFactory.getImplementationName(), threadgropFactory.getImplementationName(), messageFactory.getImplementationName(), this.extensionFactory.getImplementationName());
transaction.validateConfig();
CommitStatus status = transaction.commit();
assertBeanCount(1, factory.getImplementationName());
ConflictingVersionException, ValidationException {
ConfigTransactionJMXClient transaction = configRegistryClient
.createTransaction();
- createInstance(transaction, this.factory.getImplementationName(), instanceName, "localhost", 1, sessionFacotry.getImplementationName(), dispactherFactory.getImplementationName(), threadgropFactory.getImplementationName(), messageFactory.getImplementationName());
+ createInstance(transaction, this.factory.getImplementationName(), instanceName, "localhost", 1, sessionFacotry.getImplementationName(), dispactherFactory.getImplementationName(), threadgropFactory.getImplementationName(), messageFactory.getImplementationName(), this.extensionFactory.getImplementationName());
transaction.commit();
transaction = configRegistryClient.createTransaction();
assertBeanCount(1, factory.getImplementationName());
InstanceNotFoundException {
ConfigTransactionJMXClient transaction = configRegistryClient
.createTransaction();
- createInstance(transaction, this.factory.getImplementationName(), instanceName, "localhost", 1, sessionFacotry.getImplementationName(), dispactherFactory.getImplementationName(), threadgropFactory.getImplementationName(), messageFactory.getImplementationName());
+ createInstance(transaction, this.factory.getImplementationName(), instanceName, "localhost", 1, sessionFacotry.getImplementationName(), dispactherFactory.getImplementationName(), threadgropFactory.getImplementationName(), messageFactory.getImplementationName(), this.extensionFactory.getImplementationName());
transaction.commit();
transaction = configRegistryClient.createTransaction();
assertBeanCount(1, factory.getImplementationName());
}
public static ObjectName createInstance(final ConfigTransactionJMXClient transaction, final String moduleName,
- final String instanceName, final String host, final Integer port, final String sessionModuleName, final String dispatcherModuleName, final String threadgroupModuleName, final String messageFactoryModuleName) throws InstanceAlreadyExistsException {
+ final String instanceName, final String host, final Integer port, final String sessionModuleName, final String dispatcherModuleName, final String threadgroupModuleName, final String messageFactoryModuleName, final String extensionModuleName) throws InstanceAlreadyExistsException {
ObjectName nameCreated = transaction.createModule(
moduleName, instanceName);
BGPImplModuleMXBean mxBean = transaction.newMBeanProxy(
mxBean.setHost(host);
mxBean.setPort(port);
mxBean.setBgpProposal(BGPSessionProposalImplModuleTest.createInstance(transaction, sessionModuleName, "bgp-session1", 1, (short)30, "128.0.0.1"));
- mxBean.setBgpDispatcher(BGPDispatcherImplModuleTest.createInstance(transaction, dispatcherModuleName, "bgp-dispatcher1", threadgroupModuleName, messageFactoryModuleName));
+ mxBean.setBgpDispatcher(BGPDispatcherImplModuleTest.createInstance(transaction, dispatcherModuleName, "bgp-dispatcher1", threadgroupModuleName, messageFactoryModuleName, extensionModuleName));
return nameCreated;
}
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
package org.opendaylight.controller.config.yang.bgp.rib.impl;
import static org.junit.Assert.assertTrue;
import javax.management.ObjectName;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import org.opendaylight.controller.config.api.ConflictingVersionException;
import org.opendaylight.controller.config.api.ValidationException;
import org.opendaylight.controller.config.manager.impl.factoriesresolver.HardcodedModuleFactoriesResolver;
import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;
-@Ignore
public class BGPSessionProposalImplModuleTest extends AbstractConfigTest {
private final String instanceName = "bgp-session-prop";
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
package org.opendaylight.controller.config.yang.bgp.rib.impl;
import java.io.Closeable;
import java.util.Dictionary;
import javax.management.InstanceAlreadyExistsException;
-import javax.management.MalformedObjectNameException;
+import javax.management.InstanceNotFoundException;
import javax.management.ObjectName;
+import org.junit.After;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import org.mockito.Matchers;
import org.mockito.Mockito;
import org.opendaylight.controller.config.manager.impl.AbstractConfigTest;
import org.opendaylight.controller.config.manager.impl.factoriesresolver.HardcodedModuleFactoriesResolver;
import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;
+import org.opendaylight.controller.config.yang.bgp.parser.spi.SimpleBGPExtensionProviderContextModuleFactory;
import org.opendaylight.controller.config.yang.bgp.reconnectstrategy.TimedReconnectStrategyModuleTest;
import org.opendaylight.controller.config.yang.bgp.rib.spi.RIBExtensionsImplModuleFactory;
-import org.opendaylight.controller.config.yang.md.sal.binding.impl.BindingBrokerImplModuleFactory;
-import org.opendaylight.controller.config.yang.md.sal.binding.impl.BindingBrokerImplModuleMXBean;
+import org.opendaylight.controller.config.yang.bgp.rib.spi.RIBExtensionsImplModuleMXBean;
+import org.opendaylight.controller.config.yang.md.sal.binding.impl.DataBrokerImplModuleFactory;
+import org.opendaylight.controller.config.yang.md.sal.binding.impl.DataBrokerImplModuleMXBean;
+import org.opendaylight.controller.config.yang.md.sal.binding.impl.RuntimeMappingModuleFactory;
+import org.opendaylight.controller.config.yang.md.sal.dom.impl.DomBrokerImplModuleFactory;
+import org.opendaylight.controller.config.yang.md.sal.dom.impl.DomBrokerImplModuleMXBean;
+import org.opendaylight.controller.config.yang.md.sal.dom.impl.HashMapDataStoreModuleFactory;
+import org.opendaylight.controller.config.yang.md.sal.dom.impl.HashMapDataStoreModuleMXBean;
import org.opendaylight.controller.config.yang.netty.eventexecutor.GlobalEventExecutorModuleFactory;
import org.opendaylight.controller.config.yang.netty.threadgroup.NettyThreadgroupModuleFactory;
import org.opendaylight.controller.config.yang.reconnectstrategy.TimedReconnectStrategyModuleFactory;
-import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
+import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler;
+import org.opendaylight.controller.sal.core.api.data.DataProviderService;
+import org.opendaylight.yangtools.concepts.Registration;
+import org.opendaylight.yangtools.yang.data.api.CompositeNode;
+import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleListener;
import org.osgi.framework.Filter;
import org.osgi.framework.ServiceListener;
import org.osgi.framework.ServiceReference;
-@Ignore
public class RIBImplModuleTest extends AbstractConfigTest {
-
+
private final String instanceName = "bgp-rib-impl";
private RIBImplModuleFactory factory;
-
- private BindingBrokerImplModuleFactory brokerFactory;
-
+ private DataBrokerImplModuleFactory dataBrokerFactory;
private TimedReconnectStrategyModuleFactory reconnectFactory;
-
private BGPImplModuleFactory bgpFactory;
-
private BGPSessionProposalImplModuleFactory sessionFacotry;
-
private BGPDispatcherImplModuleFactory dispactherFactory;
-
private NettyThreadgroupModuleFactory threadgropFactory;
-
- private RIBExtensionsImplModuleFactory messageFactory;
-
private GlobalEventExecutorModuleFactory executorFactory;
-
+ private SimpleBGPExtensionProviderContextModuleFactory extensionFactory;
+ private RIBExtensionsImplModuleFactory ribExtensionsFactory;
+ private DomBrokerImplModuleFactory domBrokerFactory;
+ private RuntimeMappingModuleFactory runtimeMappingFactory;
+ private HashMapDataStoreModuleFactory dataStroreFactory;
+
+ @SuppressWarnings("unchecked")
@Before
public void setUp() throws Exception {
this.factory = new RIBImplModuleFactory();
- this.brokerFactory = new BindingBrokerImplModuleFactory();
+ this.dataBrokerFactory = new DataBrokerImplModuleFactory();
this.bgpFactory = new BGPImplModuleFactory();
this.executorFactory = new GlobalEventExecutorModuleFactory();
this.dispactherFactory = new BGPDispatcherImplModuleFactory();
this.sessionFacotry = new BGPSessionProposalImplModuleFactory();
this.threadgropFactory = new NettyThreadgroupModuleFactory();
- this.messageFactory = new RIBExtensionsImplModuleFactory();
this.reconnectFactory = new TimedReconnectStrategyModuleFactory();
- super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(this.factory,
- this.dispactherFactory, this.sessionFacotry, this.messageFactory,
- this.threadgropFactory, this.bgpFactory, this.reconnectFactory, this.brokerFactory, this.executorFactory));
+ this.extensionFactory = new SimpleBGPExtensionProviderContextModuleFactory();
+ this.ribExtensionsFactory = new RIBExtensionsImplModuleFactory();
+ this.domBrokerFactory = new DomBrokerImplModuleFactory();
+ this.runtimeMappingFactory = new RuntimeMappingModuleFactory();
+ this.dataStroreFactory = new HashMapDataStoreModuleFactory();
+ super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(mockedContext, this.factory,
+ this.dispactherFactory, this.sessionFacotry, this.threadgropFactory, this.bgpFactory,
+ this.reconnectFactory, this.dataBrokerFactory, this.executorFactory, this.extensionFactory,
+ this.ribExtensionsFactory, this.domBrokerFactory, this.runtimeMappingFactory,
+ this.dataStroreFactory));
Mockito.doReturn(mockedServiceRegistration).when(mockedContext).registerService(
Matchers.any(String.class), Mockito.any(Closeable.class),
Mockito.any(Dictionary.class));
Mockito.doReturn(mockedFilter).when(mockedContext).createFilter(Mockito.anyString());
Mockito.doNothing().when(mockedContext).addServiceListener(Mockito.any(ServiceListener.class), Mockito.anyString());
+
+ Mockito.doNothing().when(mockedContext).addBundleListener(Mockito.any(BundleListener.class));
+
+ Mockito.doReturn(new Bundle[]{}).when(mockedContext).getBundles();
Mockito.doReturn(new ServiceReference[]{}).when(mockedContext).getServiceReferences(Matchers.anyString(), Matchers.anyString());
Mockito.doReturn(mockedserviceReference).when(mockedContext).getServiceReference(Matchers.any(Class.class));
DataProviderService mockedService = Mockito.mock(DataProviderService.class);
+ Registration<DataCommitHandler<InstanceIdentifier, CompositeNode>> registration = Mockito.mock(Registration.class);
+ Mockito.doReturn(registration).when(mockedService).registerCommitHandler(Matchers.any(InstanceIdentifier.class),
+ Matchers.any(DataCommitHandler.class));
Mockito.doReturn(mockedService).when(mockedContext).getService(Matchers.any(ServiceReference.class));
}
public void testCreateBean() throws Exception {
ConfigTransactionJMXClient transaction = configRegistryClient
.createTransaction();
- createInstance(transaction, this.factory.getImplementationName(), instanceName, new ObjectName("org.opendaylight.controller:instanceName=binding-broker-singleton,moduleFactoryName=binding-broker-impl-singleton,type=Module"),
- this.reconnectFactory.getImplementationName(), this.executorFactory.getImplementationName(), this.bgpFactory.getImplementationName(), this.sessionFacotry.getImplementationName(),
- this.dispactherFactory.getImplementationName(), this.threadgropFactory.getImplementationName(), this.messageFactory.getImplementationName());
+ createInstance(transaction, this.factory.getImplementationName(), instanceName, this.dataBrokerFactory.getImplementationName(),
+ this.reconnectFactory.getImplementationName(), this.executorFactory.getImplementationName(), this.bgpFactory.getImplementationName(),
+ this.sessionFacotry.getImplementationName(), this.dispactherFactory.getImplementationName(), this.threadgropFactory.getImplementationName(),
+ this.extensionFactory.getImplementationName(), this.ribExtensionsFactory.getImplementationName(), this.domBrokerFactory.getImplementationName(),
+ this.dataStroreFactory.getImplementationName());
transaction.validateConfig();
CommitStatus status = transaction.commit();
+ Thread.sleep(2000);
assertBeanCount(1, factory.getImplementationName());
- assertStatus(status, 6, 0, 0);
+ assertStatus(status, 16, 0, 0);
+ }
+
+ @After
+ public void closeAllModules() throws Exception {
+ super.destroyAllConfigBeans();
}
public static ObjectName createInstance(final ConfigTransactionJMXClient transaction, final String moduleName,
- final String instanceName, final ObjectName bindingDataModule, final String reconnectModueName, final String executorModuleName, final String bgpModuleName,
- final String sessionModuleName, final String dispatcherModuleName, final String threadgroupModuleName, final String messageFactoryModuleName) throws InstanceAlreadyExistsException, MalformedObjectNameException {
+ final String instanceName, final String bindingDataModuleName, final String reconnectModueName, final String executorModuleName, final String bgpModuleName,
+ final String sessionModuleName, final String dispatcherModuleName, final String threadgroupModuleName, final String extensionModuleName,
+ final String ribExtensionsModuleName, final String domBrokerModuleName, final String dataStroreModuleName)
+ throws Exception {
ObjectName nameCreated = transaction.createModule(
moduleName, instanceName);
RIBImplModuleMXBean mxBean = transaction.newMBeanProxy(
nameCreated, RIBImplModuleMXBean.class);
- ObjectName reconnectObjectName = TimedReconnectStrategyModuleTest.createInstance(transaction, reconnectModueName, "session-reconnect-strategy", 0, 2000L, new BigDecimal(1.0), 5000L, 2000L, null, executorModuleName);
+ ObjectName reconnectObjectName = TimedReconnectStrategyModuleTest.createInstance(transaction, reconnectModueName, "session-reconnect-strategy", 100, 1000L, new BigDecimal(1.0), 5000L, 2000L, null, executorModuleName,
+ "global-event-executor1");
mxBean.setSessionReconnectStrategy(reconnectObjectName);
- mxBean.setDataProvider(bindingDataModule);
- mxBean.setTcpReconnectStrategy(reconnectObjectName);
- mxBean.setBgp(BGPImplModuleTest.createInstance(transaction, bgpModuleName, "bgp-impl1", "localhost", 1, sessionModuleName, dispatcherModuleName, threadgroupModuleName, messageFactoryModuleName));
+ mxBean.setDataProvider(createDataBrokerInstance(transaction, bindingDataModuleName, "data-broker-impl", domBrokerModuleName, dataStroreModuleName));
+ ObjectName reconnectStrategyON = TimedReconnectStrategyModuleTest.createInstance(transaction, reconnectModueName, "tcp-reconnect-strategy", 100, 1000L, new BigDecimal(1.0), 5000L, 2000L, null, executorModuleName,
+ "global-event-executor2");
+ mxBean.setTcpReconnectStrategy(reconnectStrategyON);
+ mxBean.setBgp(BGPImplModuleTest.createInstance(transaction, bgpModuleName, "bgp-impl1", "localhost", 1, sessionModuleName, dispatcherModuleName, threadgroupModuleName, ribExtensionsModuleName, extensionModuleName));
+ mxBean.setExtensions(createRibExtensionsInstance(transaction, ribExtensionsModuleName, "rib-extensions-privider1"));
return nameCreated;
}
- public static ObjectName createBindingBrokerInstance(final ConfigTransactionJMXClient transaction, final String moduleName,
+ public static ObjectName createDataBrokerInstance(final ConfigTransactionJMXClient transaction, final String moduleName,
+ final String instanceName, final String domBrokerModuleName, final String dataStroreModuleName) throws
+ InstanceAlreadyExistsException, InstanceNotFoundException {
+ ObjectName nameCreated = transaction.createModule(
+ moduleName, instanceName);
+ DataBrokerImplModuleMXBean mxBean = transaction.newMBeanProxy(
+ nameCreated, DataBrokerImplModuleMXBean.class);
+ mxBean.setDomBroker(createDomBrokerInstance(transaction, domBrokerModuleName, "dom-broker1", dataStroreModuleName));
+ mxBean.setMappingService(lookupMappingServiceInstance(transaction));
+ return nameCreated;
+ }
+
+ public static ObjectName createDomBrokerInstance(final ConfigTransactionJMXClient transaction, final String moduleName,
+ final String instanceName, final String dataStroreModuleName) throws InstanceAlreadyExistsException {
+ ObjectName nameCreated = transaction.createModule(
+ moduleName, instanceName);
+ DomBrokerImplModuleMXBean mxBean = transaction.newMBeanProxy(
+ nameCreated, DomBrokerImplModuleMXBean.class);
+ mxBean.setDataStore(createDataStoreInstance(transaction, dataStroreModuleName, "has-map-data-strore-instance"));
+ return nameCreated;
+ }
+
+ public static ObjectName createDataStoreInstance(final ConfigTransactionJMXClient transaction, final String moduleName,
+ final String instanceName) throws InstanceAlreadyExistsException {
+ ObjectName nameCreated = transaction.createModule(
+ moduleName, instanceName);
+ transaction.newMBeanProxy(
+ nameCreated, HashMapDataStoreModuleMXBean.class);
+ return nameCreated;
+ }
+
+ public static ObjectName lookupMappingServiceInstance(final ConfigTransactionJMXClient transaction)
+ throws InstanceAlreadyExistsException, InstanceNotFoundException {
+ ObjectName nameCreated = transaction.lookupConfigBean("runtime-generated-mapping", "runtime-mapping-singleton");
+ return nameCreated;
+ }
+
+ public static ObjectName createRibExtensionsInstance(final ConfigTransactionJMXClient transaction, final String moduleName,
final String instanceName) throws InstanceAlreadyExistsException {
ObjectName nameCreated = transaction.createModule(
moduleName, instanceName);
transaction.newMBeanProxy(
- nameCreated, BindingBrokerImplModuleMXBean.class);
+ nameCreated, RIBExtensionsImplModuleMXBean.class);
return nameCreated;
}
}