<dependency>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>mdsal-artifacts</artifactId>
- <version>2.6.0-SNAPSHOT</version>
+ <version>3.0.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependency>
-->
- <!-- TODO Replace pax-cdi-api with blueprint-maven-plugin-annotation after Neon-MRI -->
<dependency>
- <groupId>org.ops4j.pax.cdi</groupId>
- <artifactId>pax-cdi-api</artifactId>
+ <groupId>org.apache.aries.blueprint</groupId>
+ <artifactId>blueprint-maven-plugin-annotation</artifactId>
<optional>true</optional>
</dependency>
<!-- TODO Remove pax-web-api dependency eventually -->
<dependency>
<groupId>org.ops4j.pax.web</groupId>
<artifactId>pax-web-api</artifactId>
- <version>6.1.1</version>
</dependency>
<dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
- <version>2.11.1</version>
</dependency>
<dependency>
<scope>compile</scope>
</dependency>
+ <!-- TODO remove when infrautils' ClasspathHellDuplicatesCheckRule pulls in classgraph, see https://git.opendaylight.org/gerrit/#/c/76625/ -->
<dependency>
<groupId>io.github.classgraph</groupId>
<artifactId>classgraph</artifactId>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
- <!-- TODO remove version once odlparent is up-to-date (currently still 3.0.2) -->
- <version>3.1.0</version>
<configuration>
<archive>
<manifest>
import org.opendaylight.controller.md.sal.dom.broker.impl.DOMNotificationRouter;
import org.opendaylight.infrautils.inject.guice.AbstractCloseableModule;
import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer;
-import org.ops4j.pax.cdi.api.OsgiService;
+import org.opendaylight.mdsal.simple.MdsalWiring;
@SuppressFBWarnings("UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR")
public class ControllerWiring extends AbstractCloseableModule {
@Override
protected void configureCloseables() {
+ install(new MdsalWiring());
+
// TODO this is just for early stage POC! switch to real CDS wiring here, eventually..
DataBrokerTestModule dataBrokerTestModule = new DataBrokerTestModule(true);
DataBroker dataBroker = dataBrokerTestModule.getDataBroker();
bind(DataBroker.class).toInstance(dataBroker);
- bind(DataBroker.class).annotatedWith(OsgiService.class).toInstance(dataBroker);
bindingToNormalizedNodeCodec = dataBrokerTestModule.getBindingToNormalizedNodeCodec();
domNotificationPublishService = dataBrokerTestModule.getDOMNotificationRouter();
package org.opendaylight.genius.simple;
import com.google.inject.AbstractModule;
+import org.opendaylight.controller.simple.ControllerWiring;
import org.opendaylight.daexim.DataImportBootReady;
import org.opendaylight.infrautils.inject.guice.GuiceClassPathBinder;
import org.opendaylight.infrautils.inject.guice.testutils.AnnotationsModule;
import org.opendaylight.infrautils.simple.InfraUtilsWiring;
-import org.opendaylight.mdsal.simple.MdsalWiring;
import org.opendaylight.neutron.simple.NeutronModule;
import org.opendaylight.openflowplugin.simple.OpenFlowPluginWiring;
import org.opendaylight.serviceutils.simple.ServiceUtilsWiring;
-import org.ops4j.pax.cdi.api.OsgiService;
public class GeniusWiring extends AbstractModule {
install(new InfraUtilsWiring());
// MD SAL
- install(new MdsalWiring());
+ install(new ControllerWiring());
// Daexim
// TODO write real DaeximWiring, and replace this line with an install(new DaeximWiring());
- bind(DataImportBootReady.class).annotatedWith(OsgiService.class).toInstance(new DataImportBootReady() {});
+ bind(DataImportBootReady.class).toInstance(new DataImportBootReady() {});
// Neutron
install(new NeutronModule());
import com.google.common.annotations.VisibleForTesting;
import com.google.inject.Injector;
+import java.io.IOException;
+import java.io.InputStream;
import java.util.Set;
import org.apache.karaf.shell.api.action.Action;
import org.apache.karaf.shell.api.console.Session;
}
@VisibleForTesting
+ // TODO This should ideally only be in src/test, not src/main ...
public void testAllRegisteredCommands() throws Exception {
karafMain.testAllRegisteredCommands();
}
}
@SuppressWarnings("checkstyle:RegexpSingleLineJava")
+ // TODO This should ideally only be in src/test, not src/main ...
private void testAllRegisteredCommands() throws Exception {
SessionFactory sessionFactory = createSessionFactory(null);
- Session session = createSession(sessionFactory, null, System.out, System.err, null);
+ Session session = createSession(sessionFactory, new EmptyInputStream(), System.out, System.err, null);
discoverCommands(session, getClass().getClassLoader(), null);
for (Action action : actions) {
manager.instantiate(action.getClass());
}
}
}
+
+ // TODO when we're on Java 11, replace this with InputStream.nullInputStream()
+ private static class EmptyInputStream extends InputStream {
+ @Override
+ public int read() throws IOException {
+ return -1;
+ }
+ }
}
import org.opendaylight.infrautils.caches.baseimpl.CacheManagersRegistry;
import org.opendaylight.infrautils.caches.baseimpl.internal.CacheManagersRegistryImpl;
import org.opendaylight.infrautils.caches.standard.StandardCacheProvider;
-import org.ops4j.pax.cdi.api.OsgiService;
public class CachesWiring extends AbstractModule {
@Override
protected void configure() {
bind(CacheManagersRegistry.class).to(CacheManagersRegistryImpl.class);
- bind(CacheProvider.class).annotatedWith(OsgiService.class).to(StandardCacheProvider.class);
bind(CacheProvider.class).to(StandardCacheProvider.class);
}
-
}
import org.opendaylight.infrautils.inject.PostFullSystemInjectionListener;
import org.opendaylight.infrautils.ready.SystemReadyMonitor;
import org.opendaylight.infrautils.ready.spi.SimpleSystemReadyMonitor;
-import org.ops4j.pax.cdi.api.OsgiService;
public class ReadyWiring extends AbstractModule implements PostFullSystemInjectionListener {
@Override
protected void configure() {
bind(SystemReadyMonitor.class).toInstance(systemReadyMonitor);
- bind(SystemReadyMonitor.class).annotatedWith(OsgiService.class).toInstance(systemReadyMonitor);
bind(PostFullSystemInjectionListener.class).toInstance(this);
}
import com.google.inject.AbstractModule;
import com.google.inject.Provides;
import javax.inject.Singleton;
-import org.opendaylight.controller.simple.ControllerWiring;
import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer;
import org.opendaylight.mdsal.eos.binding.api.EntityOwnershipService;
import org.opendaylight.mdsal.eos.binding.dom.adapter.BindingDOMEntityOwnershipServiceAdapter;
@Override
protected void configure() {
- install(new ControllerWiring());
-
bind(DOMEntityOwnershipService.class).to(SimpleDOMEntityOwnershipService.class);
}
DOMEntityOwnershipService domService, BindingNormalizedNodeSerializer conversionCodec) {
return new BindingDOMEntityOwnershipServiceAdapter(domService, conversionCodec);
}
-
}
bind(AclInterfaceListener.class);
bind(AclEventListener.class);
}
-
}
import org.opendaylight.neutron.transcriber.NeutronVpnIpSecPolicyInterface;
import org.opendaylight.neutron.transcriber.NeutronVpnIpSecSiteConnectionsInterface;
import org.opendaylight.neutron.transcriber.NeutronVpnServiceInterface;
-import org.ops4j.pax.cdi.api.OsgiService;
/**
* Guice module for Neutron.
// The following is currently copy/pasted from
// org.opendaylight.neutron.e2etest.NeutronTestWiring
// but likely will get replaced with automated classpath scanning anyway later
- // (strangely though it needs .annotatedWith(OsgiService.class) everywhere, only here)
- bind(INeutronNetworkCRUD.class).annotatedWith(OsgiService.class).to(NeutronNetworkInterface.class);
- bind(INeutronSubnetCRUD.class).annotatedWith(OsgiService.class).to(NeutronSubnetInterface.class);
- bind(INeutronPortCRUD.class).annotatedWith(OsgiService.class).to(NeutronPortInterface.class);
- bind(INeutronRouterCRUD.class).annotatedWith(OsgiService.class).to(NeutronRouterInterface.class);
- bind(INeutronFloatingIpCRUD.class).annotatedWith(OsgiService.class).to(NeutronFloatingIpInterface.class);
- bind(INeutronSecurityGroupCRUD.class).annotatedWith(OsgiService.class).to(NeutronSecurityGroupInterface.class);
- bind(INeutronSecurityRuleCRUD.class).annotatedWith(OsgiService.class).to(NeutronSecurityRuleInterface.class);
- bind(INeutronFirewallCRUD.class).annotatedWith(OsgiService.class).to(NeutronFirewallInterface.class);
- bind(INeutronFirewallPolicyCRUD.class).annotatedWith(OsgiService.class)
- .to(NeutronFirewallPolicyInterface.class);
- bind(INeutronFirewallRuleCRUD.class).annotatedWith(OsgiService.class).to(NeutronFirewallRuleInterface.class);
- bind(INeutronLoadBalancerCRUD.class).annotatedWith(OsgiService.class).to(NeutronLoadBalancerInterface.class);
- bind(INeutronLoadBalancerListenerCRUD.class).annotatedWith(OsgiService.class)
- .to(NeutronLoadBalancerListenerInterface.class);
- bind(INeutronLoadBalancerPoolCRUD.class).annotatedWith(OsgiService.class)
- .to(NeutronLoadBalancerPoolInterface.class);
- bind(INeutronBgpvpnCRUD.class).annotatedWith(OsgiService.class).to(NeutronBgpvpnInterface.class);
- bind(INeutronL2gatewayCRUD.class).annotatedWith(OsgiService.class).to(NeutronL2gatewayInterface.class);
- bind(INeutronL2gatewayConnectionCRUD.class).annotatedWith(OsgiService.class)
- .to(NeutronL2gatewayConnectionInterface.class);
- bind(INeutronLoadBalancerHealthMonitorCRUD.class).annotatedWith(OsgiService.class)
- .to(NeutronLoadBalancerHealthMonitorInterface.class);
- bind(INeutronMeteringLabelCRUD.class).annotatedWith(OsgiService.class).to(NeutronMeteringLabelInterface.class);
- bind(INeutronMeteringLabelRuleCRUD.class).annotatedWith(OsgiService.class)
- .to(NeutronMeteringLabelRuleInterface.class);
- bind(INeutronVpnServiceCRUD.class).annotatedWith(OsgiService.class).to(NeutronVpnServiceInterface.class);
- bind(INeutronVpnIkePolicyCRUD.class).annotatedWith(OsgiService.class).to(NeutronVpnIkePolicyInterface.class);
- bind(INeutronVpnIpSecPolicyCRUD.class).annotatedWith(OsgiService.class)
- .to(NeutronVpnIpSecPolicyInterface.class);
- bind(INeutronSFCFlowClassifierCRUD.class).annotatedWith(OsgiService.class)
- .to(NeutronSFCFlowClassifierInterface.class);
- bind(INeutronSFCPortChainCRUD.class).annotatedWith(OsgiService.class).to(NeutronSFCPortChainInterface.class);
- bind(INeutronSFCPortPairGroupCRUD.class).annotatedWith(OsgiService.class)
- .to(NeutronSFCPortPairGroupInterface.class);
- bind(INeutronSFCPortPairCRUD.class).annotatedWith(OsgiService.class).to(NeutronSFCPortPairInterface.class);
- bind(INeutronQosPolicyCRUD.class).annotatedWith(OsgiService.class).to(NeutronQosPolicyInterface.class);
- bind(INeutronTrunkCRUD.class).annotatedWith(OsgiService.class).to(NeutronTrunkInterface.class);
- bind(INeutronTapServiceCRUD.class).annotatedWith(OsgiService.class).to(NeutronTapServiceInterface.class);
- bind(INeutronTapFlowCRUD.class).annotatedWith(OsgiService.class).to(NeutronTapFlowInterface.class);
- bind(INeutronVpnIpSecSiteConnectionsCRUD.class).annotatedWith(OsgiService.class)
- .to(NeutronVpnIpSecSiteConnectionsInterface.class);
+ // (strangely though it needs everywhere, only here)
+ bind(INeutronNetworkCRUD.class).to(NeutronNetworkInterface.class);
+ bind(INeutronSubnetCRUD.class).to(NeutronSubnetInterface.class);
+ bind(INeutronPortCRUD.class).to(NeutronPortInterface.class);
+ bind(INeutronRouterCRUD.class).to(NeutronRouterInterface.class);
+ bind(INeutronFloatingIpCRUD.class).to(NeutronFloatingIpInterface.class);
+ bind(INeutronSecurityGroupCRUD.class).to(NeutronSecurityGroupInterface.class);
+ bind(INeutronSecurityRuleCRUD.class).to(NeutronSecurityRuleInterface.class);
+ bind(INeutronFirewallCRUD.class).to(NeutronFirewallInterface.class);
+ bind(INeutronFirewallPolicyCRUD.class).to(NeutronFirewallPolicyInterface.class);
+ bind(INeutronFirewallRuleCRUD.class).to(NeutronFirewallRuleInterface.class);
+ bind(INeutronLoadBalancerCRUD.class).to(NeutronLoadBalancerInterface.class);
+ bind(INeutronLoadBalancerListenerCRUD.class).to(NeutronLoadBalancerListenerInterface.class);
+ bind(INeutronLoadBalancerPoolCRUD.class).to(NeutronLoadBalancerPoolInterface.class);
+ bind(INeutronBgpvpnCRUD.class).to(NeutronBgpvpnInterface.class);
+ bind(INeutronL2gatewayCRUD.class).to(NeutronL2gatewayInterface.class);
+ bind(INeutronL2gatewayConnectionCRUD.class).to(NeutronL2gatewayConnectionInterface.class);
+ bind(INeutronLoadBalancerHealthMonitorCRUD.class).to(NeutronLoadBalancerHealthMonitorInterface.class);
+ bind(INeutronMeteringLabelCRUD.class).to(NeutronMeteringLabelInterface.class);
+ bind(INeutronMeteringLabelRuleCRUD.class).to(NeutronMeteringLabelRuleInterface.class);
+ bind(INeutronVpnServiceCRUD.class).to(NeutronVpnServiceInterface.class);
+ bind(INeutronVpnIkePolicyCRUD.class).to(NeutronVpnIkePolicyInterface.class);
+ bind(INeutronVpnIpSecPolicyCRUD.class).to(NeutronVpnIpSecPolicyInterface.class);
+ bind(INeutronSFCFlowClassifierCRUD.class).to(NeutronSFCFlowClassifierInterface.class);
+ bind(INeutronSFCPortChainCRUD.class).to(NeutronSFCPortChainInterface.class);
+ bind(INeutronSFCPortPairGroupCRUD.class).to(NeutronSFCPortPairGroupInterface.class);
+ bind(INeutronSFCPortPairCRUD.class).to(NeutronSFCPortPairInterface.class);
+ bind(INeutronQosPolicyCRUD.class).to(NeutronQosPolicyInterface.class);
+ bind(INeutronTrunkCRUD.class).to(NeutronTrunkInterface.class);
+ bind(INeutronTapServiceCRUD.class).to(NeutronTapServiceInterface.class);
+ bind(INeutronTapFlowCRUD.class).to(NeutronTapFlowInterface.class);
+ bind(INeutronVpnIpSecSiteConnectionsCRUD.class).to(NeutronVpnIpSecSiteConnectionsInterface.class);
}
}
public class AAAWiringTest extends AbstractSimpleDistributionTest {
public @Rule GuiceRule guice = new GuiceRule(new AAAWiring(), new ControllerWiring(),
- // TODO new WebWiring(true), new OsgiServicesWiring(),
+ // TODO new WebWiring(true), new ReferencesWiring(),
new AnnotationsModule());
}
+++ /dev/null
-/*
- * Copyright (c) 2017 Red Hat, 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.mdsal.simple.test;
-
-import org.junit.Rule;
-import org.opendaylight.infrautils.inject.guice.testutils.AnnotationsModule;
-import org.opendaylight.infrautils.inject.guice.testutils.GuiceRule;
-import org.opendaylight.infrautils.simple.testutils.AbstractSimpleDistributionTest;
-import org.opendaylight.mdsal.simple.MdsalWiring;
-
-public class MdsalWiringTest extends AbstractSimpleDistributionTest {
-
- public @Rule GuiceRule guice = new GuiceRule(
- /* ControllerWiring.class, */ MdsalWiring.class, AnnotationsModule.class);
-
-}
import org.junit.Ignore;
import org.junit.Rule;
+import org.opendaylight.infrautils.inject.guice.GuiceClassPathBinder;
import org.opendaylight.infrautils.inject.guice.testutils.GuiceRule2;
+import org.opendaylight.infrautils.simple.ShellTestWiring;
import org.opendaylight.infrautils.simple.testutils.AbstractSimpleDistributionTest;
import org.opendaylight.netvirt.simple.NetvirtWiring;
@Ignore // TODO un-ignore netvirt, once genius works...
public class NetvirtSimpleDistributionTest extends AbstractSimpleDistributionTest {
- public @Rule GuiceRule2 guice = new GuiceRule2(NetvirtWiring.class);
+ private static final GuiceClassPathBinder CLASS_PATH_BINDER = new GuiceClassPathBinder("org.opendaylight");
+
+ public @Rule GuiceRule2 guice = new GuiceRule2(new NetvirtWiring(CLASS_PATH_BINDER), new ShellTestWiring());
}