Add blueprint wiring to library 37/40637/5
authorAlexis de Talhouët <adetalhouet@inocybe.com>
Tue, 21 Jun 2016 21:46:12 +0000 (17:46 -0400)
committerAlexis de Talhouët <adetalhouet@inocybe.com>
Wed, 22 Jun 2016 12:39:56 +0000 (12:39 +0000)
Change-Id: Ieb404cc0ada8fef56f9ce63ec04ffbb40029a47e
Signed-off-by: Alexis de Talhouët <adetalhouet@inocybe.com>
library/features/pom.xml
library/features/src/main/features/features.xml
library/impl/src/main/config/default-config.xml [deleted file]
library/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/library/impl/rev141210/LibraryModule.java [deleted file]
library/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/library/impl/rev141210/LibraryModuleFactory.java [deleted file]
library/impl/src/main/resources/org/opendaylight/blueprint/library.xml [new file with mode: 0644]
library/impl/src/main/yang/library-impl.yang [deleted file]
library/impl/src/test/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/library/impl/rev141210/LibraryModuleFactoryTest.java [deleted file]
library/impl/src/test/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/library/impl/rev141210/LibraryModuleTest.java [deleted file]
library/it/src/test/java/org/opendaylight/ovsdb/lib/it/LibraryIntegrationTestBase.java

index 0715b11f5fcc39ff3524d9d1ce892ae311fda42b..4e7940f58e2302f2c2efc1491c0f5ace3a59f9f0 100644 (file)
@@ -68,13 +68,6 @@ and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL
       <artifactId>library</artifactId>
       <version>${project.version}</version>
     </dependency>
-    <dependency>
-      <groupId>${project.groupId}</groupId>
-      <artifactId>library</artifactId>
-      <version>${project.version}</version>
-      <type>xml</type>
-      <classifier>config</classifier>
-    </dependency>
     <dependency>
       <groupId>${project.groupId}</groupId>
       <artifactId>utils.servicehelper</artifactId>
index e7a45e868f992340adfae32a0874a9f6b71b8be7..7e2c530fa6d30de55d2b96e034eb9c68ba16bbd6 100644 (file)
@@ -25,6 +25,5 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
     <bundle start="true">mvn:com.fasterxml.jackson.core/jackson-annotations/{{VERSION}}</bundle>
     <bundle start="true">mvn:com.fasterxml.jackson.core/jackson-core/{{VERSION}}</bundle>
     <bundle start="true">mvn:com.fasterxml.jackson.core/jackson-databind/{{VERSION}}</bundle>
-    <configfile finalname="${configfile.directory}/library.xml">mvn:org.opendaylight.ovsdb/library/{{VERSION}}/xml/config</configfile>
   </feature>
 </features>
diff --git a/library/impl/src/main/config/default-config.xml b/library/impl/src/main/config/default-config.xml
deleted file mode 100644 (file)
index c0b80df..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- vi: set et smarttab sw=4 tabstop=4: -->
-<!--
-Copyright © 2015 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
--->
-<snapshot>
-  <required-capabilities>
-      <capability>urn:opendaylight:params:xml:ns:yang:library:impl?module=library&amp;revision=2014-12-10</capability>
-      <capability>urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding?module=opendaylight-md-sal-binding&amp;revision=2013-10-28</capability>
-  </required-capabilities>
-  <configuration>
-
-    <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
-      <modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
-        <module>
-          <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:library:impl">prefix:library</type>
-          <name>library-default</name>
-          <broker>
-            <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-broker-osgi-registry</type>
-            <name>binding-osgi-broker</name>
-          </broker>
-        </module>
-      </modules>
-      <services xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
-        <service>
-          <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:library:impl">prefix:connection-service</type>
-          <instance>
-            <name>connection-service</name>
-            <provider>/modules/module[type='library'][name='library-default']</provider>
-          </instance>
-        </service>
-      </services>
-    </data>
-  </configuration>
-</snapshot>
diff --git a/library/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/library/impl/rev141210/LibraryModule.java b/library/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/library/impl/rev141210/LibraryModule.java
deleted file mode 100644 (file)
index 57b9609..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright © 2015 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.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.library.impl.rev141210;
-
-import org.opendaylight.controller.config.api.DependencyResolver;
-import org.opendaylight.controller.config.api.ModuleIdentifier;
-import org.opendaylight.ovsdb.lib.impl.OvsdbConnectionService;
-import org.osgi.framework.BundleContext;
-
-import com.google.common.base.Preconditions;
-
-public class LibraryModule extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.library.impl.rev141210.AbstractLibraryModule {
-    private BundleContext bundleContext;
-
-    public LibraryModule(ModuleIdentifier identifier, DependencyResolver dependencyResolver) {
-        super(identifier, dependencyResolver);
-    }
-
-    public LibraryModule(ModuleIdentifier identifier, DependencyResolver dependencyResolver, LibraryModule oldModule, AutoCloseable oldInstance) {
-        super(identifier, dependencyResolver, oldModule, oldInstance);
-    }
-
-    @Override
-    public void customValidation() {
-        // add custom validation form module attributes here.
-        Preconditions.checkNotNull(bundleContext);
-    }
-
-    @Override
-    public java.lang.AutoCloseable createInstance() {
-        return new OvsdbConnectionService();
-    }
-
-    public void setBundleContext(BundleContext bundleContext) {
-        this.bundleContext = bundleContext;
-    }
-}
diff --git a/library/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/library/impl/rev141210/LibraryModuleFactory.java b/library/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/library/impl/rev141210/LibraryModuleFactory.java
deleted file mode 100644 (file)
index 21e88f5..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright © 2015 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
- */
-/*
-* Generated file
-*
-* Generated from: yang module name: library yang module local name: library
-* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
-* Generated at: Fri Jan 02 13:49:24 CST 2015
-*
-* Do not modify this file unless it is present under src/main directory
-*/
-package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.library.impl.rev141210;
-
-import org.opendaylight.controller.config.api.DependencyResolver;
-import org.osgi.framework.BundleContext;
-
-public class LibraryModuleFactory extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.library.impl.rev141210.AbstractLibraryModuleFactory {
-    @Override
-    public LibraryModule instantiateModule(String instanceName, DependencyResolver dependencyResolver, BundleContext bundleContext) {
-        LibraryModule module = super.instantiateModule(instanceName, dependencyResolver, bundleContext);
-        module.setBundleContext(bundleContext);
-        return module;
-    }
-
-    @Override
-    public LibraryModule instantiateModule(String instanceName, DependencyResolver dependencyResolver, LibraryModule oldModule, AutoCloseable oldInstance, BundleContext bundleContext) {
-        LibraryModule module = super.instantiateModule(instanceName, dependencyResolver, oldModule, oldInstance, bundleContext);
-        module.setBundleContext(bundleContext);
-        return module;
-    }
-}
diff --git a/library/impl/src/main/resources/org/opendaylight/blueprint/library.xml b/library/impl/src/main/resources/org/opendaylight/blueprint/library.xml
new file mode 100644 (file)
index 0000000..1bdd859
--- /dev/null
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+  xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+  odl:use-default-for-reference-types="true">
+
+  <bean id="ovsdbConnectionService" class="org.opendaylight.ovsdb.lib.impl.OvsdbConnectionService">
+  </bean>
+  <service ref="ovsdbConnectionService" interface="org.opendaylight.ovsdb.lib.OvsdbConnection"
+    odl:type="default" />
+
+</blueprint>
diff --git a/library/impl/src/main/yang/library-impl.yang b/library/impl/src/main/yang/library-impl.yang
deleted file mode 100644 (file)
index 21932fb..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-module library {
-    yang-version 1;
-    namespace "urn:opendaylight:params:xml:ns:yang:library:impl";
-    prefix "library";
-
-    import config { prefix config; revision-date 2013-04-05; }
-    import opendaylight-md-sal-binding { prefix md-sal-binding; revision-date 2013-10-28;}
-
-    description
-        "Service definition for library project";
-
-    revision "2014-12-10" {
-        description
-            "Initial revision";
-    }
-
-    identity library {
-        base config:module-type;
-        config:java-name-prefix Library;
-        config:provided-service connection-service;
-    }
-
-    identity connection-service {
-        base config:service-type;
-        config:java-class "org.opendaylight.ovsdb.lib.OvsdbConnection";
-    }
-
-    augment "/config:modules/config:module/config:configuration" {
-        case library {
-            when "/config:modules/config:module/config:type = 'library'";
-            container broker {
-                uses config:service-ref {
-                    refine type {
-                        mandatory true;
-                        config:required-identity md-sal-binding:binding-broker-osgi-registry;
-                    }
-                }
-            }
-        }
-    }
-}
diff --git a/library/impl/src/test/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/library/impl/rev141210/LibraryModuleFactoryTest.java b/library/impl/src/test/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/library/impl/rev141210/LibraryModuleFactoryTest.java
deleted file mode 100644 (file)
index d7b9693..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Copyright © 2015 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.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.library.impl.rev141210;
-
-import org.junit.Test;
-
-public class LibraryModuleFactoryTest {
-    @Test
-    public void testFactoryConstructor() {
-        // ensure no exceptions on construction
-        new LibraryModuleFactory();
-    }
-}
diff --git a/library/impl/src/test/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/library/impl/rev141210/LibraryModuleTest.java b/library/impl/src/test/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/library/impl/rev141210/LibraryModuleTest.java
deleted file mode 100644 (file)
index ede3e6d..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright © 2015 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.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.library.impl.rev141210;
-
-import org.junit.Test;
-import org.opendaylight.controller.config.api.DependencyResolver;
-import org.opendaylight.controller.config.api.JmxAttribute;
-import org.opendaylight.controller.config.api.ModuleIdentifier;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
-import org.osgi.framework.BundleContext;
-
-import javax.management.ObjectName;
-
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-public class LibraryModuleTest {
-    @Test
-    public void testCustomValidation() {
-        LibraryModule module = new LibraryModule(mock(ModuleIdentifier.class), mock(DependencyResolver.class));
-        module.setBundleContext(mock(BundleContext.class));
-
-        // ensure no exceptions on validation
-        // currently this method is empty
-        module.customValidation();
-    }
-
-    // TODO Need to migrate all users to SAL RPC
-    @Test
-    public void testCreateInstance() throws Exception {
-        // configure mocks
-        DependencyResolver dependencyResolver = mock(DependencyResolver.class);
-        BindingAwareBroker broker = mock(BindingAwareBroker.class);
-        when(dependencyResolver.resolveInstance(eq(BindingAwareBroker.class), any(ObjectName.class), any(JmxAttribute.class))).thenReturn(broker);
-
-        // create instance of module with injected mocks
-        LibraryModule module = new LibraryModule(mock(ModuleIdentifier.class), dependencyResolver);
-        module.setBundleContext(mock(BundleContext.class));
-
-        // getInstance calls resolveInstance to get the broker dependency and then calls createInstance
-        AutoCloseable closeable = module.getInstance();
-
-        // ensure no exceptions on close
-        closeable.close();
-    }
-}
index 189e899921e63c71fdf0eea7ba95d5894d5b054a..c908a446103728b85f89df5860c7665e52cd9174 100644 (file)
@@ -93,16 +93,6 @@ public abstract class LibraryIntegrationTestBase extends AbstractMdsalTestBase {
         LibraryIntegrationTestBase.setup.set(setup);
     }
 
-    @Override
-    public String getModuleName() {
-        return "library";
-    }
-
-    @Override
-    public String getInstanceName() {
-        return "library-default";
-    }
-
     @Override
     public MavenUrlReference getFeatureRepo() {
         return maven()